/* шрифт госномеров (app/plate.py) */
@font-face { font-family: "RoadNumbers"; src: url("fonts/roadnumbers.otf") format("opentype"); font-display: block; }
/* Цвета — только через переменные: светлая тема ниже, тёмная — в блоках после неё */
:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --card: #fff;
  --subtle: #fafbfc;      /* шапки таблиц, неактивные ячейки */
  --hover: #f3f4f6;
  --text: #1d2330;
  --muted: #6b7280;
  --faint: #c0c4cc;
  --line: #e3e6ea;
  --input-line: #cfd4db;
  --focus: #bfd3fe;
  --chip: #e5e7eb;
  --accent: #2563eb;      --accent-hover: #1d4ed8;  --on-accent: #fff;
  --header: #1f2937;      --header-hover: #374151;  --header-text: #d1d5db;
  --green: #16a34a;       --green-bg: #ecfdf3;      --green-chip: #dcfce7;
  --yellow: #a16207;      --yellow-bg: #fefce8;     --yellow-chip: #fef9c3;  --yellow-line: #eab308;
  --orange: #c2410c;      --orange-bg: #fff4ec;     --orange-chip: #ffedd5;  --orange-line: #ea580c;
  --red: #dc2626;         --red-bg: #fef2f2;        --red-chip: #fee2e2;
  --grey: #9ca3af;        --grey-bg: #f6f7f9;       --grey-line: #d1d5db;
  --blue: #2563eb;        --blue-bg: #eff5ff;
  --chart-charged: #c7d2fe;  --chart-received: #16a34a;  --chart-grid: #eef0f3;
  --shadow: 0 20px 50px rgba(0, 0, 0, .25);
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1218; --card: #181c24; --subtle: #1d222b; --hover: #222833;
    --text: #e6e8ec; --muted: #9aa3b2; --faint: #4b5260; --line: #2a303b; --input-line: #3a4150;
    --focus: #1e3a8a; --chip: #262c37;
    --accent: #5b8def; --accent-hover: #74a0f5; --on-accent: #0b0f16;
    --header: #0a0d12; --header-hover: #1f2530; --header-text: #b8c0cc;
    --green: #4ade80; --green-bg: #13251b; --green-chip: #173322;
    --yellow: #facc15; --yellow-bg: #262110; --yellow-chip: #3a3112; --yellow-line: #ca8a04;
    --orange: #fb923c; --orange-bg: #2a1a10; --orange-chip: #3d2414; --orange-line: #ea580c;
    --red: #f87171; --red-bg: #2a1416; --red-chip: #401a1d;
    --grey: #6b7280; --grey-bg: #1b1f27; --grey-line: #3a4150;
    --blue: #60a5fa; --blue-bg: #14203a;
    --chart-charged: #3b4a7a; --chart-received: #22c55e; --chart-grid: #232933;
    --shadow: 0 20px 50px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1218; --card: #181c24; --subtle: #1d222b; --hover: #222833;
  --text: #e6e8ec; --muted: #9aa3b2; --faint: #4b5260; --line: #2a303b; --input-line: #3a4150;
  --focus: #1e3a8a; --chip: #262c37;
  --accent: #5b8def; --accent-hover: #74a0f5; --on-accent: #0b0f16;
  --header: #0a0d12; --header-hover: #1f2530; --header-text: #b8c0cc;
  --green: #4ade80; --green-bg: #13251b; --green-chip: #173322;
  --yellow: #facc15; --yellow-bg: #262110; --yellow-chip: #3a3112; --yellow-line: #ca8a04;
  --orange: #fb923c; --orange-bg: #2a1a10; --orange-chip: #3d2414; --orange-line: #ea580c;
  --red: #f87171; --red-bg: #2a1416; --red-chip: #401a1d;
  --grey: #6b7280; --grey-bg: #1b1f27; --grey-line: #3a4150;
  --blue: #60a5fa; --blue-bg: #14203a;
  --chart-charged: #3b4a7a; --chart-received: #22c55e; --chart-grid: #232933;
  --shadow: 0 20px 50px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 24px 0 10px; }
h3 { font-size: 15px; margin: 0 0 8px; }
code { background: var(--chip); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.c-red { color: var(--red); }
.c-green { color: var(--green); }

/* шапка */
header {
  background: var(--header); color: #fff; padding: 0 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: nowrap; min-height: 54px;
  position: sticky; top: 0; z-index: 10;
}
header .logo { font-weight: 700; color: #fff; font-size: 16px; white-space: nowrap; flex: none; }
header .logo .instance { font-weight: 600; font-size: 12px; padding: 1px 6px; margin-left: 4px; border-radius: 6px; background: var(--header-hover); vertical-align: 1px; }
header nav { display: flex; gap: 2px; flex-wrap: nowrap; min-width: 0; overflow-x: auto; scrollbar-width: none; }
header nav::-webkit-scrollbar { display: none; }
header nav a { color: var(--header-text); padding: 6px 9px; border-radius: 6px; white-space: nowrap; flex: none; }
header nav a:hover, header nav a.on { background: var(--header-hover); color: #fff; text-decoration: none; }
header .nav-more { flex: none; margin-left: -14px; }
header .nav-more[hidden] { display: none; }
header .nav-more > summary { color: var(--header-text); padding: 6px 9px; border-radius: 6px; white-space: nowrap; }
header .nav-more > summary:hover, header .nav-more[open] > summary, header .nav-more.on > summary { background: var(--header-hover); color: #fff; }
header .nav-more .menu-pop { left: 0; right: auto; min-width: 180px; }
header .nav-more .menu-pop a.on { background: var(--hover); font-weight: 600; }
header .right-side { margin-left: auto; display: flex; gap: 8px; align-items: center; flex: none; }
header .search { min-width: 0; }
header input[type=search] {
  border: 1px solid transparent; border-radius: 6px; padding: 7px 10px; width: 140px; max-width: 100%; min-width: 120px; font-size: 14px;
  background: var(--card); color: var(--text);
}
#theme-toggle {
  background: var(--header-hover); border: 0; color: #fff; padding: 6px 9px; border-radius: 6px; font-size: 15px;
}
#theme-toggle:hover { filter: brightness(1.2); background: var(--header-hover); }
main { max-width: 1280px; margin: 0 auto; padding: 22px 20px 60px; }

/* кнопки, формы */
.btn, button {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 7px; padding: 6px 12px; font: inherit; font-size: 14px; white-space: nowrap;
}
.btn:hover, button:hover { border-color: var(--input-line); text-decoration: none; background: var(--hover); }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover, button.primary:hover { background: var(--accent-hover); }
.btn.pay { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn.pay:hover { background: #15803d; }
.btn.sm, button.sm { padding: 3px 8px; font-size: 13px; }
.btn.danger, button.danger { color: var(--red); }
.link-btn { border: 0; background: none; color: var(--accent); padding: 0; font-size: inherit; }
.link-btn:hover { background: none; text-decoration: underline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar h1 { margin: 0; margin-right: auto; }
form.inline { display: inline; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=date], input[type=number], input[type=password], input[type=time], input[type=email],
input[type=tel], input:not([type]), select, textarea {
  width: 100%; border: 1px solid var(--input-line); border-radius: 7px; padding: 7px 9px; font: inherit;
  background: var(--card); color: var(--text);
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); border-color: var(--accent); }
.form { background: var(--card); border-radius: var(--radius); padding: 20px; border: 1px solid var(--line); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px 18px; }
/* длинное содержимое (строка вариантов, адрес) не раздвигает колонку шире экрана */
.grid2 > *, .grid3 > * { min-width: 0; }
.full { grid-column: 1 / -1; }
.hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px 16px; padding-top: 6px; }  /* на телефоне варианты — в несколько строк */
.radio-row label, label.check { display: flex; gap: 6px; align-items: center; color: var(--text); font-size: 14px; margin: 0; }
.error { background: var(--red-bg); color: var(--red); border-radius: 7px; padding: 9px 12px; margin-bottom: 14px; }
.ok { background: var(--green-bg); color: var(--green); border-radius: 7px; padding: 9px 12px; margin-bottom: 14px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 0; min-width: 0; }
legend { font-size: 13px; color: var(--muted); padding: 0 6px; }

/* блоки */
.panel { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); padding: 16px; }
.panel + .panel { margin-top: 16px; }
.cols { display: grid; grid-template-columns: 1fr 380px; gap: 20px; align-items: start; }

/* итоги */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat .v { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 13px; color: var(--muted); }
.stat.red .v { color: var(--red); }
/* цветные плашки на главной: оттенок из цвета темы — сам подстраивается под светлую и тёмную */
.stat[class*="tint-"] { --t: var(--accent); --tp: 9%;
  background: color-mix(in srgb, var(--t) var(--tp), var(--card));
  border-color: color-mix(in srgb, var(--t) calc(var(--tp) * 3), var(--line)); }
.stat.tint-green-soft { --t: var(--green); --tp: 8%; }
.stat.tint-green { --t: var(--green); --tp: 17%; }
.stat.tint-red { --t: var(--red); --tp: 15%; }
.stat.tint-blue { --t: var(--accent); --tp: 15%; }
.stat.tint-yellow { --t: var(--yellow-line); --tp: 17%; }
a.stat-link[class*="tint-"]:hover { border-color: var(--t); }
a.stat-link { color: var(--text); text-decoration: none; display: block; transition: border-color .15s; }
a.stat-link:hover { border-color: var(--accent); }
a.stat-link:hover .l { color: var(--accent); }

/* карточки мест */
.places { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.pcard {
  background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--grey);
  border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-height: 150px;
}
.pcard .top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.pcard .pname { font-size: 18px; font-weight: 700; color: var(--text); }
/* «на продаже» — своим цветом, чтобы не путать со статусами оплаты (жёлтый «скоро», красный «долг») */
.badge.b-sale { background: var(--blue-bg); color: var(--blue); border: 1px solid color-mix(in srgb, var(--blue) 30%, transparent); }
.pcard .amount { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; }
.pcard .who { font-weight: 550; }
.pcard .foot { margin-top: auto; padding-top: 8px; display: flex; gap: 6px; }
.pcard.s-paid, .pcard.s-upcoming, .pcard.s-advance { border-left-color: var(--green); }
.pcard.s-soon { border-left-color: var(--yellow-line); background: var(--yellow-bg); }
.pcard.s-due { border-left-color: var(--orange-line); background: var(--orange-bg); }
.pcard.s-overdue { border-left-color: var(--red); background: var(--red-bg); }
.pcard.s-free { border-left-color: var(--grey-line); background: var(--grey-bg); }
.pcard.s-booked { border-left-color: var(--blue); background: var(--blue-bg); }

.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 20px; white-space: nowrap; background: var(--grey-bg); color: var(--muted); }
.badge.s-paid, .badge.s-advance { background: var(--green-chip); color: var(--green); }
.badge.s-upcoming { background: var(--grey-bg); color: var(--muted); }
.badge.s-soon { background: var(--yellow-chip); color: var(--yellow); }
.badge.s-due { background: var(--orange-chip); color: var(--orange); }
.badge.s-overdue { background: var(--red-chip); color: var(--red); }
.badge.s-booked { background: var(--blue-bg); color: var(--blue); }
.badge.s-split, .badge.s-in_whole { background: var(--grey-bg); color: var(--muted); }


/* таблицы */
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; background: var(--subtle); }
tr.dim td { color: var(--muted); }
tfoot td { font-weight: 650; }
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.table-wrap table { border: 0; }

/* карточки сущностей */
.head { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
.head .title { flex: 1; min-width: 260px; }
.head .title h1 { margin-bottom: 4px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.balance { text-align: right; }
.balance .v { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.balance .v.debt { color: var(--red); }
.balance .v.adv { color: var(--green); }
.contract { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--card); margin-bottom: 12px; }
/* карточка арендатора: слева кто он, справа — сколько должен и «Оплата» */
.tcard { display: flex; gap: 24px; align-items: stretch; margin-bottom: 22px; flex-wrap: wrap; }
.tcard-main { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 8px; }
.tcard-main h1 { margin: 0; }
.tchips { display: flex; flex-wrap: wrap; gap: 6px; }
.tchip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 13px;
  background: var(--subtle); border: 1px solid var(--line); color: var(--text); text-decoration: none; }
a.tchip:hover { border-color: var(--accent); color: var(--accent); }
.tnotes { white-space: pre-line; }
.tphone { font-size: 20px; font-weight: 600; color: var(--text); text-decoration: none; font-variant-numeric: tabular-nums; width: fit-content; }
.tphone:hover { color: var(--accent); }
.tmsg { display: flex; flex-wrap: wrap; gap: 6px; }
.tmsg-btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 6px; border-radius: 20px; font-size: 14px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); text-decoration: none; }
.tmsg-btn:hover { border-color: var(--input-line); background: var(--hover); color: var(--text); }
.msg-icon { flex: none; display: block; }
/* госномер картинкой: нажатие копирует */
.plate, .plate-text { padding: 0; border: 0; background: none; cursor: copy; line-height: 0; border-radius: 4px; }
.plate svg { display: block; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .15)); }
.plate:hover svg { filter: drop-shadow(0 0 0 2px var(--accent)) drop-shadow(0 1px 3px rgba(0, 0, 0, .25)); }
.plate:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.plate-text { line-height: 1.3; padding: 2px 8px; border: 2px solid #111; background: #fff; color: #111; font-weight: 700; font-size: 13px; }
.tcars { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.tcar { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.tcar .muted { line-height: 1.2; }
.copy-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; padding: 10px 16px;
  border-radius: 10px; background: #1f2937; color: #fff; font-size: 14px; box-shadow: var(--shadow); }
.tactions { margin-top: auto; padding-top: 4px; }
.tarchive { margin-left: auto; }
.tarchive .link-btn { color: var(--muted); }
.tcard-balance { min-width: 220px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right;
  padding-left: 24px; border-left: 1px solid var(--line); }
.tcard-balance .v { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tcard-balance .v.debt { color: var(--red); }
.tcard-balance .v.adv { color: var(--green); }
.tcard-balance .btn.pay { margin-top: 6px; }
/* договор: шапка, условия сеткой, действия справа, «Расторгнуть» — в меню «⋯» */
.cc-head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.cc-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cc-place { font-size: 18px; font-weight: 700; color: var(--text); }
.cc-term { color: var(--muted); font-size: 13px; }
.cc-actions { display: flex; gap: 6px; align-items: center; }
.cc-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 16px; margin: 12px 0 4px; font-size: 14px; }
.cc-facts span { display: block; font-size: 12px; color: var(--muted); }
.cc-warn { margin-top: 6px; color: var(--orange); }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 220px; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .15); }
.menu-pop a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: 14px; white-space: nowrap; }
.menu-pop a:hover { background: var(--hover); }
.menu-pop a.danger { color: var(--red); }
.account-menu > summary { display: flex; align-items: center; min-height: 32px; }
.account-menu .menu-pop { width: 220px; }
.account-menu-name { display: block; overflow-wrap: anywhere; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.account-menu .menu-pop button { display: block; width: 100%; padding: 8px 10px; border: 0; background: transparent;
  color: var(--text); text-align: left; font-size: 14px; }
.account-menu .menu-pop button:hover { background: var(--hover); }
.ended-list { margin: 4px 0 18px; }
.ended-list > summary { cursor: pointer; color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.contract.ended { opacity: .75; background: var(--subtle); }
.contract .row { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.contract .row h3 { margin: 0; }
.sub { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
.sub ul { margin: 0; padding-left: 18px; font-size: 14px; }
.mini-form { display: flex; gap: 6px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.mini-form input { width: auto; padding: 4px 7px; font-size: 13px; }
.mini-form input[type=text] { width: 120px; }
details > summary { cursor: pointer; color: var(--accent); font-size: 13px; }

/* календарь */
.cal { width: 100%; table-layout: fixed; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal th { text-align: center; }
.cal td { height: 110px; padding: 6px; border: 1px solid var(--line); }
.cal td.other { background: var(--subtle); color: var(--faint); }
.cal td.today { background: var(--blue-bg); }
.cal .d { font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; }
/* клетка дня — сводка, все оплаты открываются в окне */
.cal-sum { display: block; margin-top: 3px; padding: 5px 6px; border-radius: 5px; background: var(--grey-bg); color: var(--text); font-size: 12px; line-height: 1.35; }
.cal-sum:hover { text-decoration: none; filter: brightness(1.1); }
.cal-sum > b { display: block; font-size: 13px; }
.cal-sum .cs-money { display: block; }
.cal-bar { display: flex; height: 5px; border-radius: 3px; overflow: hidden; margin: 4px 0 3px; background: var(--line); }
.cal-bar i { display: block; height: 100%; }
.cal-dots { display: flex; flex-wrap: wrap; gap: 0 7px; font-size: 11px; }
.cal-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; flex: none; }
.legend i.cal-dot { width: 9px; height: 9px; border: 0; border-radius: 50%; vertical-align: 0; }
.cd-paid { background: #22c55e; }
.cd-upcoming { background: #94a3b8; }
.cd-soon { background: #eab308; }
.cd-due { background: #f97316; }
.cd-overdue { background: #ef4444; }
/* окно дня */
.day-title { margin-right: 24px; margin-bottom: 4px; }
.day-statuses { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 8px 0 10px; }
.day-list { display: flex; flex-direction: column; gap: 1px; }
dialog .day-list { max-height: 60vh; overflow-y: auto; }
.day-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; color: var(--text); }
.day-row:hover { background: var(--hover); text-decoration: none; }
.day-code { min-width: 36px; }
.day-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-sum { font-weight: 600; }

/* отчёты */
.chart { width: 100%; height: auto; }
.chart text { font-size: 11px; fill: var(--muted); }
.chart .grid { stroke: var(--chart-grid); }
.chart .bar-charged { fill: var(--chart-charged); }
.chart .bar-received { fill: var(--chart-received); }
.chart text.received { fill: var(--chart-received); }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; border: 1px solid var(--line); }
.legend .l-charged { background: var(--chart-charged); }
.legend .l-received { background: var(--chart-received); }
.legend .l-paid { background: var(--green-chip); }
.legend .l-upcoming { background: var(--grey-bg); }
.legend .l-soon { background: var(--yellow-chip); }
.legend .l-due { background: var(--orange-chip); }
.legend .l-overdue { background: var(--red-chip); }

/* диалог */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(520px, 94vw); box-shadow: var(--shadow); background: var(--card); color: var(--text); }
dialog::backdrop { background: rgba(5, 8, 15, .55); }
dialog .dlg { padding: 20px; }
dialog .dlg h2 { margin-top: 0; }
dialog .close { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 20px; color: var(--muted); }

.empty { color: var(--muted); padding: 10px 0; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 5px 12px; border-radius: 20px; background: var(--chip); color: var(--text); font-size: 14px; }
.tabs a.on { background: var(--text); color: var(--bg); }

.header-btn { background: var(--header-hover); border: 0; color: #fff; padding: 6px 10px; border-radius: 6px; font-size: 15px; }
.header-btn:hover { filter: brightness(1.2); background: var(--header-hover); text-decoration: none; }
.header-btn.on { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .45); }
/* «←» назад — перед названием страницы (ставит app.js), только на компьютере */
.title-back { display: none; }
@media (min-width: 641px) {
  .title-back { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 34px; height: 34px;
    margin: 0 10px 0 0; padding: 0; vertical-align: middle; border-radius: 9px; border: 1px solid var(--line);
    background: var(--card); color: var(--text); font-size: 18px; font-weight: 700; line-height: 1; cursor: pointer; }
  .title-back:hover { border-color: var(--accent); color: var(--accent); background: var(--card); }
}

/* вход */
.auth-box { max-width: 380px; margin: 8vh auto 0; text-align: center; }
.auth-box .form { text-align: left; }
.auth-logo { font-size: 48px; line-height: 1; margin-bottom: 8px; }

@media (max-width: 1000px) {
  .cols { grid-template-columns: 1fr !important; }
  .cols > * { min-width: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid2, .grid3, .sub { grid-template-columns: 1fr; }
  header input[type=search] { width: 120px; }
}

/* телефон */
@media (max-width: 640px) {
  body { font-size: 16px; }
  header { position: static; padding: 8px 12px 0; gap: 8px; flex-wrap: wrap; padding-top: max(8px, env(safe-area-inset-top)); }
  header .logo { order: 1; }
  header .right-side { order: 2; margin-left: auto; }
  header .search { display: none; }
  header nav {
    order: 3; width: calc(100% + 24px); margin: 0 -12px; padding: 4px 12px 8px;
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  header nav::-webkit-scrollbar { display: none; }
  header nav a { white-space: nowrap; flex: none; }
  main { padding: 14px 12px 50px; }
  h1 { font-size: 21px; }
  .toolbar h1 { width: 100%; }
  .stats { gap: 8px; }
  .stat { padding: 10px; }
  .stat .v { font-size: 18px; }
  .places { grid-template-columns: 1fr; }
  .pcard { min-height: 0; }
  .btn, button { padding: 8px 12px; }
  .btn.sm, button.sm { padding: 6px 10px; }
  input[type=text], input[type=date], input[type=number], input[type=password], input[type=time], input[type=search],
  input:not([type]), select, textarea { font-size: 16px; } /* iOS не зумит */
  .form { padding: 14px; }
  .balance { text-align: left; width: 100%; }
  .tcard-balance { align-items: flex-start; text-align: left; padding: 14px 0 0; border-left: 0; border-top: 1px solid var(--line); width: 100%; }
  .cc-facts { grid-template-columns: 1fr 1fr; }
  .head { gap: 12px; }
  th, td { padding: 7px 8px; }
  .cal td { height: 64px; padding: 3px; font-size: 11px; }
  .cal-sum { margin-top: 2px; padding: 3px; border-radius: 4px; text-align: center; }
  .cal-sum .cs-word, .cal-sum .cs-money, .cal-bar, .cal-dots .n { display: none; }
  .cal-dots { justify-content: center; gap: 1px; margin-top: 2px; }
  .cal-sum .cal-dot { width: 7px; height: 7px; margin: 0; }
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 14px 14px 0 0; max-height: 92vh; }
  dialog .dlg { padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  dialog:has(.day-list) { width: calc(100vw - 24px); max-width: calc(100vw - 24px); margin: auto; border-radius: 12px; max-height: 84vh; }
  .mobile-search { display: block !important; margin-bottom: 14px; }
}
.mobile-search { display: none; }
.mobile-search input { width: 100%; }


/* несколько машин у арендатора */
.extra-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 6px; }
.car-row { display: grid; grid-template-columns: 1fr 150px 170px auto; gap: 8px; margin-bottom: 6px; }
@media (max-width: 640px) { .car-row { grid-template-columns: 1fr 1fr auto; } .car-row select { grid-column: 1 / 3; } }

/* выпадающий список с поиском (combo.js) */
.combo { position: relative; }
.combo-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  background: var(--card); border: 1px solid var(--input-line); border-radius: 8px;
  max-height: 290px; overflow-y: auto; box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
.combo-item { padding: 8px 10px; cursor: pointer; line-height: 1.3; }
.combo-item small { display: block; color: var(--muted); font-size: 12px; }
.combo-item.active { background: var(--hover); }
.combo-item.selected { font-weight: 600; }
.combo-empty { padding: 10px; color: var(--muted); font-size: 14px; }

/* группы на главной */
.pgroup { margin-bottom: 18px; }
.pgroup > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: baseline; gap: 10px; padding: 6px 2px 10px; color: var(--text);
}
.pgroup > summary::-webkit-details-marker { display: none; }
.pgroup > summary::before {
  content: "›"; color: var(--muted); font-size: 22px; line-height: 1; width: 14px; text-align: center;
  transform: rotate(90deg); transition: transform .15s; align-self: center;
}
.pgroup:not([open]) > summary::before { transform: none; }
.pgroup:not([open]) > summary { padding-bottom: 4px; }
.g-title { font-weight: 650; font-size: 16px; display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; }
.g-ico { flex: none; }
.g-count { font-size: 13px; color: var(--muted); background: var(--chip); border-radius: 10px; padding: 0 8px; }
.g-total { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.g-overdue .g-total { color: var(--red); }
.g-due .g-total { color: var(--orange); }
.g-soon .g-total { color: var(--yellow); }

/* поиск по спискам */
.list-search { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.list-search input {
  width: 100%; max-width: 420px; border: 1px solid var(--input-line); border-radius: 7px; padding: 8px 10px;
  font: inherit; background: var(--card); color: var(--text);
}
.list-search input:focus { outline: 2px solid var(--focus); border-color: var(--accent); }
.mobile-search input { border: 1px solid var(--input-line); border-radius: 7px; padding: 8px 10px; font: inherit;
  background: var(--card); color: var(--text); }
.name-cell { min-width: 120px; }

/* напоминание: отправка в мессенджеры */
.share-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 12px; }
.share-btns .btn { justify-content: center; padding: 10px 12px; }
.share-btns .wa { background: #25d366; border-color: #25d366; color: #fff; }
.share-btns .tg { background: #2aabee; border-color: #2aabee; color: #fff; }

/* финансы в карточке места */
.finance { min-width: 260px; }
.fin { display: grid; grid-template-columns: auto auto; gap: 2px 18px; margin: 6px 0 0; font-variant-numeric: tabular-nums; }
.fin dt { color: var(--muted); }
.fin dd { margin: 0; text-align: right; }
.chart .bar-expenses { fill: var(--red); opacity: .55; }
.legend .l-expenses { background: var(--red); opacity: .55; }

/* фото и документы */
.ficon { flex: none; vertical-align: -0.3em; }
.btn .ficon, button .ficon { margin-right: 2px; }
/* просмотр файла в программе */
.viewer-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; position: sticky; top: 0; z-index: 5;
  background: var(--bg); padding: 8px 0; }
.viewer-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.viewer-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-bottom: 30px; }
.viewer-page { width: 100%; max-width: 900px; height: auto; background: #fff; border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .15), 0 4px 14px rgba(0, 0, 0, .08); }
.viewer-photos { position: relative; touch-action: pan-y pinch-zoom; user-select: none; }
.photo-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 30px; line-height: 1; text-decoration: none;
  background: rgba(0, 0, 0, .45); color: #fff; }
.photo-nav:hover { background: rgba(0, 0, 0, .65); color: #fff; }
.photo-nav.prev { left: 8px; }
.photo-nav.next { right: 8px; }
.photo-count { font-size: 13px; color: var(--muted); }
@media (hover: none) { .photo-nav { width: 36px; height: 36px; font-size: 24px; background: rgba(0, 0, 0, .3); } }
.viewer-photo { max-width: 100%; max-height: calc(100vh - 140px); object-fit: contain; border-radius: 6px; }

/* документы (PDF, Word, Excel) — строками: значок, название, размер и дата */
.files { display: flex; flex-direction: column; gap: 6px; max-width: 560px; }
.doc-groups { display: flex; flex-direction: column; gap: 16px; }
.doc-group-title { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.doc-row { display: flex; align-items: center; gap: 4px; padding: 6px 4px 6px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--card); }
.doc-row:hover { border-color: var(--input-line); }
.doc-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: var(--text); text-decoration: none; }
.doc-link:hover .doc-name { color: var(--accent); }
.doc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.doc-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.doc-row form { margin: 0; }
.doc-del { background: none; border: none; color: var(--muted); padding: 4px 8px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.doc-del:hover { background: var(--red); color: #fff; }
@media (max-width: 640px) { .doc-meta { display: none; } }
/* фото — ровные квадраты; крестик круглый, на компьютере появляется при наведении */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
@media (max-width: 640px) { .photo-grid { grid-template-columns: repeat(4, 1fr); } }
.ph { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--subtle); border: 1px solid var(--line); }
.ph a, .ph img { display: block; width: 100%; height: 100%; }
.ph img { object-fit: cover; transition: transform .15s; }
.ph a:hover img { transform: scale(1.04); }
.ph form { margin: 0; }
.ph-del { position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; padding: 0; border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; /* крестик — строго по центру кружка */
  background: rgba(0, 0, 0, .5); color: #fff; cursor: pointer; opacity: 0; transition: opacity .15s, background .15s; }
.ph-del svg { display: block; }
.ph:hover .ph-del, .ph-del:focus { opacity: 1; }
.ph-del:hover { background: var(--red); }
@media (hover: none) { .ph-del { opacity: 1; } }
/* «Добавить» — строкой в стиле документов */
.file-add { margin: 0; }
.file-add-btn { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 12px; border-radius: 8px;
  border: 1px dashed var(--input-line); color: var(--muted); font-size: 14px; cursor: pointer; background: transparent; }
.file-add-btn b { font-size: 18px; font-weight: 400; line-height: 1; }
.file-add-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--blue-bg); }
.file-add-btn.loading { opacity: .6; pointer-events: none; }
.gal-upload { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 2px dashed var(--input-line); border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 13px; text-align: center; margin: 0; padding: 6px; }
.gal-upload b { font-size: 26px; font-weight: 400; line-height: 1; }
.gal-upload:hover { border-color: var(--accent); color: var(--accent); }
.gal-upload.loading { opacity: .6; pointer-events: none; }

/* страница подготовки договора */
.need input { border-style: dashed; }
.need-tag { font-size: 11px; color: var(--muted); margin-left: 4px; white-space: nowrap; }
.need-tag::before { content: "●"; color: var(--yellow-line); font-size: 8px; vertical-align: 2px; margin-right: 4px; }
.need-summary { background: var(--subtle); margin-bottom: 14px; }
.ok-summary { background: var(--green-bg); border-color: transparent; margin-bottom: 14px; }
.form h3 { margin-bottom: 10px; }
.prep-block { border-top: 1px solid var(--line); padding: 12px 0 4px; }
.prep-block > summary { cursor: pointer; color: var(--text); font-size: 15px; list-style-position: outside; }
.prep-block > summary b { font-weight: 650; }
.prep-block > summary.done, .prep-block > summary.done b, .prep-block > summary.done .muted { color: var(--green); }
.prep-block > summary.done .muted { opacity: .8; }
.ready-panel { margin-bottom: 14px; }
.sign-preview { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: flex; align-items: center; justify-content: center; height: 120px; }
.sign-preview img { max-height: 100%; max-width: 100%; }

/* окно «Настроить расположение» подписи и печати — образец в миллиметрах, всегда белый лист */
.sl-wrap { background: #e9e9e9; border-radius: 8px; padding: 12px; overflow-x: auto; overflow-y: hidden; }
.sl-scale { transform-origin: 0 0; }
.sl-paper { position: relative; width: 185mm; background: #fff; color: #000; font-family: "Times New Roman", Times, serif;
  box-shadow: 0 1px 4px rgba(0,0,0,.25); display: flex; align-items: flex-start; padding-bottom: 30mm;
  user-select: none; -webkit-user-select: none; }
.sl-paper::after { content: 'низ листа'; position: absolute; left: 0; right: 0; bottom: 1mm; text-align: center;
  font: 3mm system-ui, sans-serif; color: #aaa; pointer-events: none; }
.sl-cell { position: relative; box-sizing: border-box; padding: 0 1.9mm; border: 0.2mm solid #000; }
.sl-cell + .sl-cell { border-left: 0; }
.sl-cell p { margin: 0; line-height: 1.15; white-space: pre-wrap; position: relative; z-index: 1; pointer-events: none; }
.sl-cell p.sl-sign { line-height: 1.04; }
.sl-img { position: absolute; touch-action: none; cursor: grab; }
.sl-img:active { cursor: grabbing; }
.sl-img.sl-stamp { z-index: 0; }
.sl-img.sl-sig { z-index: 2; }
.sl-img img { width: 100%; height: 100%; display: block; pointer-events: none; }
.sl-img.sel { outline: 0.4mm dashed #2b7cff; }
.sl-handle { position: absolute; right: -3mm; top: -3mm; width: 6mm; height: 6mm; border-radius: 50%; background: #2b7cff;
  border: 0.6mm solid #fff; cursor: nesw-resize; touch-action: none; }
.sl-origin { position: absolute; height: 0; border-top: 0.2mm dotted #d33; pointer-events: none; z-index: 3; }
.sl-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 12px 0; }
.sl-nums div { background: var(--panel2, rgba(127,127,127,.08)); border-radius: 8px; padding: 8px 10px; }
.sl-nums b { display: block; font-size: 17px; }

/* телефон: страница листается только вверх-вниз; таблицы — карточками (строка = блок с подписями полей) */
@media (max-width: 640px) {
  html, body { overflow-x: clip; max-width: 100%; }
  main, .panel, .form, section { min-width: 0; max-width: 100%; }
  img, svg, video, iframe { max-width: 100%; }
  .toolbar > * { max-width: 100%; }
  h1, h2, h3, td, .pcard, .panel { overflow-wrap: anywhere; }

  table.stack, table.stack tbody, table.stack tfoot, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; padding: 9px 12px;
    border-bottom: 1px solid var(--line); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack tr[hidden] { display: none; }
  table.stack td { width: auto; padding: 0; border: 0; text-align: left !important; max-width: 100%; }
  table.stack td:first-child { width: 100%; font-weight: 600; }
  table.stack td:empty { display: none; }
  table.stack td[data-label]::before { content: attr(data-label) " "; color: var(--muted); font-size: 12px; font-weight: 400; }
  table.stack td.empty { width: 100%; font-weight: 400; }
  table.stack tfoot tr { background: var(--subtle); }

  .sl-wrap { overflow: hidden; padding: 6px; }
}

/* касса: неразобранные чеки */
.kassa-unsorted { border-color: var(--yellow-line); }
.kassa-assign { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0; }
.kassa-assign select, .kassa-assign .combo { flex: 1 1 220px; min-width: 0; }
.kassa-banner { display: block; margin-bottom: 14px; background: var(--yellow-bg); border-color: var(--yellow-line); color: inherit; }

/* настройки: плитка в две колонки, порядок по смыслу (слева — деньги и документы, справа — подключения и безопасность) */
.set-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.set-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.set-tiles .form, .set-tiles .panel { margin: 0 !important; }
.set-tile { min-width: 0; }
/* «Расположение»: плитки свёрнуты в строки с названием — перетаскивание мышкой или стрелки */
.set-layout-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-left: auto; }
.set-layout-tools, .set-tile-move { display: none; }
.set-layout-bar.editing [data-layout-edit] { display: none; }
.set-layout-bar.editing .set-layout-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.set-tiles.editing .set-col { min-height: 60px; padding: 6px; border: 1px dashed var(--input-line); border-radius: var(--radius); gap: 8px; }
.set-tiles.editing .set-tile > :not(.set-tile-move) { display: none; }
.set-tiles.editing .set-tile-move { display: flex; align-items: center; gap: 6px; padding: 10px 12px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); cursor: grab; user-select: none; }
.set-tile-move b { flex: 1; min-width: 0; }
.set-tile-grip { color: var(--muted); font-size: 18px; line-height: 1; }
.set-tile.dragging .set-tile-move { opacity: .45; border-style: dashed; }
@media (max-width: 1000px) { .set-tiles { grid-template-columns: 1fr; } }

/* действия в строках списков и таблиц — не слипаются */
li > a + form.inline, li > form.inline + form.inline, li > .badge + a, td > a + form.inline { margin-left: 8px; }
/* пустая галерея — компактная кнопка вместо большой плитки */

/* телефон: главная компактнее — кнопки «+» в одну строку, плитки сумм плотнее */
@media (max-width: 640px) {
  .wide-only { display: none; }
  .dash-tools { gap: 8px; }
  .dash-tools .btn { flex: 1 1 0; justify-content: center; padding: 8px 6px; font-size: 14px; }
  .stats .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stat .l { font-size: 12px; line-height: 1.3; }
}
.warn-line { margin-top: 8px; padding: 7px 10px; border-radius: 7px; background: var(--yellow-bg); color: var(--yellow); font-size: 13px; }

/* настройки: список устройств */
.dev-list { display: flex; flex-direction: column; }
.dev-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); }
.dev-row:first-child { border-top: 0; }
.dev-main { min-width: 0; }

/* арендатор: физлицо или организация — показываются только свои поля */
.kind-switch { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.kind-switch label { display: flex; align-items: center; gap: 6px; margin: 0; padding: 7px 12px; border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer; color: var(--text); font-size: 14px; background: var(--card); }
.kind-switch label:has(input:checked) { border-color: var(--accent); background: var(--blue-bg); }
.kind-switch input { margin: 0; }
form[data-kind="company"] [data-kind-only="person"], form[data-kind="person"] [data-kind-only="company"] { display: none; }

/* страница «Банк» */
.ico-title { display: inline-flex; align-items: center; gap: 10px; }
.bank-status { margin: -6px 0 16px; }
.decide { display: flex; gap: 12px 20px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 12px 0; border-top: 1px solid var(--line); }
.decide:first-of-type { border-top: 0; }
.decide-info { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.decide-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.c-orange { color: var(--orange); }
.bank-txns td.desc, .kassa-table td.desc { max-width: 420px; }
.bank-settings { margin-top: 24px; }
.bank-settings > summary { cursor: pointer; font-weight: 650; }
.bank-settings[open] > summary { margin-bottom: 12px; }
.bank-checks { display: flex; flex-direction: column; gap: 6px; justify-content: flex-end; padding-bottom: 4px; }
@media (max-width: 1000px) { .bank-settings .grid3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .bank-settings .grid3 { grid-template-columns: 1fr; } }
.decide-actions .kassa-assign { flex-wrap: nowrap; }
.decide-actions .kassa-assign select, .decide-actions .kassa-assign .combo { flex: 0 1 240px; width: 240px; }
@media (max-width: 640px) {
  .decide-actions, .decide-actions .kassa-assign { width: 100%; flex-wrap: wrap; }
  .decide-actions .kassa-assign select, .decide-actions .kassa-assign .combo { flex: 1 1 100%; width: 100%; }
}

/* список арендаторов: одна строка на человека */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.people-sum { margin: -4px 0 12px; }
.people td { vertical-align: middle; padding: 10px 12px; }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person-main { min-width: 0; }
.person .pn { font-weight: 600; color: var(--text); }
.person-sub { margin-top: 1px; }
.avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; letter-spacing: .02em; }
.a-red { background: var(--red-chip); color: var(--red); }
.a-orange { background: var(--orange-chip); color: var(--orange); }
.a-yellow { background: var(--yellow-chip); color: var(--yellow); }
.a-green { background: var(--green-chip); color: var(--green); }
.a-grey { background: var(--chip); color: var(--muted); }
.people td.bal { font-weight: 600; width: 1%; white-space: nowrap; }
.people td.pay { width: 1%; text-align: right; }
@media (max-width: 640px) {
  .people tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .people tr:last-child { border-bottom: 0; }
  .people td { display: block; padding: 0; border: 0; width: auto !important; }
  .people td:first-child { flex: 1 1 100%; }
  .people td.bal { margin-left: 50px; }
  .people td.pay { margin-left: auto; }
  .people tr[hidden] { display: none; }
}
@media (max-width: 640px) {
  .toolbar.toolbar-row { flex-wrap: nowrap; }
  .toolbar.toolbar-row h1 { width: auto; flex: 1 1 auto; min-width: 0; }
  .chips { gap: 5px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chips a { padding: 5px 9px; font-size: 13px; white-space: nowrap; }
}

/* форма договора: смысловые блоки, ровные строки */
.cf-section { padding: 14px 0; border-top: 1px solid var(--line); }
.cf-section.first { border-top: 0; padding-top: 0; }
.cf-section > h3, .cf-section > summary h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 10px; }
.cf-section > summary { cursor: pointer; }
.cf-section .grid2, .cf-section .grid3 { align-items: start; }
.seg { display: flex; border: 1px solid var(--input-line); border-radius: 7px; overflow: hidden; }
.seg label { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0; padding: 8px 6px;
  color: var(--text); font-size: 14px; cursor: pointer; background: var(--card); white-space: nowrap; }
.seg label + label { border-left: 1px solid var(--input-line); }
.seg label:has(input:checked) { background: var(--blue-bg); color: var(--accent); font-weight: 600; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
@media (max-width: 1000px) { .cf-section .grid3 { grid-template-columns: 1fr 1fr; } .cf-section .grid3 > :first-child { grid-column: 1 / -1; } }
@media (max-width: 640px) { .cf-section .grid3 { grid-template-columns: 1fr 1fr; } }

/* подготовка договора: одна ширина, «Сохранить» всегда под рукой */
.prep-page { max-width: none; }
@media (min-width: 1001px) { .prep-page .grid2 { gap: 14px 24px; } }
.ready-state { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; }
.sticky-save { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  margin: 16px -20px -20px; padding: 12px 20px; background: var(--card); border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius); padding-bottom: max(12px, env(safe-area-inset-bottom)); }
@media (max-width: 640px) { .sticky-save { margin: 16px -14px -14px; padding: 10px 14px; } }
.prep-form > .prep-block:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }

/* формы — на всю ширину, как карточки (окна поверх страницы — своего размера) */
@media (min-width: 1001px) { .form.wide .grid2 { gap: 14px 24px; } }
.ico-title > span { flex: none; }
.form > .actions, .form > form > .actions { margin-top: 16px; }

/* «опасная» кнопка — мягкий красный фон, в тон бейджу «просрочка» */
.btn.danger-fill, button.danger-fill { background: var(--red-chip); border-color: transparent; color: var(--red); }
.btn.danger-fill:hover, button.danger-fill:hover { background: var(--red-chip); border-color: var(--red); }

/* расходы: калькуляция по категориям */
.exp-stats { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); max-width: 640px; }
.exp-cats { margin-bottom: 16px; }
.exp-cat + .exp-cat { margin-top: 10px; }
.exp-cat-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 4px; }
.exp-bar { height: 8px; background: var(--chip); border-radius: 4px; overflow: hidden; }
.exp-bar i { display: block; height: 100%; background: var(--red); opacity: .55; border-radius: 4px; }

/* «Статистика»: плитки показателей, подсказки «?», графики стоимости */
.stats.kpi { grid-template-columns: repeat(6, 1fr); }
.stat .s { font-size: 12px; margin-top: 3px; line-height: 1.35; }
.stat .v small { font-size: 13px; font-weight: 500; color: var(--muted); }
.stat.hero { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: color-mix(in srgb, var(--accent) 6%, var(--card)); }
.stat.hero .v { color: var(--accent); }
.stat .bar, .vs .bar { height: 6px; border-radius: 3px; background: var(--chip); margin-top: 6px; overflow: hidden; }
.stat .bar b, .vs .bar b { display: block; height: 100%; background: var(--green); border-radius: 3px; }
.vs .bar.alt b { background: var(--grey); }
.vs > div + div { margin-top: 12px; }
.vs .v { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tip { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; font: 600 10px/1 system-ui, sans-serif;
  font-style: normal; background: var(--chip); color: var(--muted); cursor: help; position: relative; vertical-align: 1px;
  text-transform: none; letter-spacing: 0; }
.tip:hover::after, .tip:focus::after, .tip.open::after { content: attr(data-tip); position: absolute; z-index: 30; top: 21px; left: 50%;
  transform: translateX(-50%); width: 250px; padding: 9px 11px; border-radius: 8px; background: var(--header); color: #f3f4f6;
  font: 400 12.5px/1.45 system-ui, sans-serif; text-align: left; box-shadow: var(--shadow); white-space: normal; }
th .tip:hover::after, th .tip:focus::after, th .tip.open::after { left: auto; right: -8px; transform: none; }
.warn-panel { background: var(--yellow-bg); border-color: var(--yellow-line); margin-bottom: 12px; }
.stat-table th.sorted { color: var(--accent); }
.stat-table td.name-cell { min-width: 120px; }
.cols.two { grid-template-columns: 1fr 1fr; }
.table-wrap.flat { border: 0; border-radius: 0; }
.chart .value-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.chart .value-tail { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 2 4; }
.chart .value-dot { fill: var(--card); stroke: var(--accent); stroke-width: 2.5; }
.chart .buy-line { stroke: var(--grey); stroke-dasharray: 5 4; }
.legend .l-value { background: var(--accent); }
.legend .l-buy { background: var(--grey); }
.legend .l-expenses { background: var(--red); opacity: .55; }
.period-tabs { align-items: center; }
.period-custom { position: relative; }
.period-custom > summary { list-style: none; cursor: pointer; padding: 5px 12px; border-radius: 20px; background: var(--chip); font-size: 14px; }
.period-custom > summary::-webkit-details-marker { display: none; }
.period-custom.on > summary { background: var(--text); color: var(--bg); }
.period-custom form { position: absolute; z-index: 20; top: 36px; left: 0; display: flex; gap: 8px; flex-wrap: wrap; padding: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); width: max-content; max-width: 90vw; }
.buy-panel { margin-bottom: 18px; }
.val-history { margin-top: 10px; }
.val-history > summary { cursor: pointer; color: var(--accent); }
@media (max-width: 1200px) { .stats.kpi { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1000px) { .cols.two { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .stats.kpi { grid-template-columns: repeat(2, 1fr); }
  .stats.kpi .stat.hero:first-child, .stats.kpi .stat.hero:first-child ~ .stat:last-child:nth-child(even) { grid-column: 1 / -1; }
  .stats.kpi .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stats.kpi .stat:last-child:nth-child(even) { grid-column: auto; }
  .tip:hover::after, .tip:focus::after, .tip.open::after, th .tip.open::after, th .tip:focus::after, th .tip:hover::after {
    position: fixed; top: auto; bottom: 16px; left: 16px; right: 16px; width: auto; transform: none; font-size: 14px; }
  .period-custom form { position: fixed; left: 16px; right: 16px; top: auto; width: auto; max-width: none; }
}
.phone-icon { color: var(--muted); vertical-align: -2px; flex: none; }
.kpi-head { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.stats.kpi + .kpi-head { margin-top: -6px; }
.placeholder-panel { border: 1px dashed var(--grey-line); border-radius: var(--radius); padding: 14px 16px; color: var(--muted);
  font-size: 14px; line-height: 1.5; margin-bottom: 16px; }
.placeholder-panel a { white-space: nowrap; }
.in-doc { font-size: 11px; margin-left: 2px; opacity: .75; cursor: help; }

/* Настройки → «Распознавание платежей» */
.recog-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 800px) { .recog-grid { grid-template-columns: minmax(0, 1fr); } }
.recog-grid .form { margin: 0 0 16px; }
.recog-grid h3 { margin-top: 0; }
.recog-grid h3.recog-sub { margin-top: 20px; }
.recog-grid textarea { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 13px; line-height: 1.55; }
.recog-lead { margin: 0 0 10px; }
.recog-res, .recog-notes { list-style: none; margin: 0; padding: 0; }
.recog-res li { padding: 9px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.recog-res li:first-child { border-top: 0; }
.recog-notes { font-size: 13px; margin-top: 8px; }
.recog-notes li { padding: 3px 0; overflow-wrap: anywhere; }
.recog-ok { color: var(--green, #16a34a); }
.recog-wait { color: var(--orange, #d97706); }
.recog-skip { color: var(--muted); }
.recog-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 0 0 10px; overflow-wrap: anywhere; }
.recog-card select, .recog-card .combo { width: 100%; margin: 8px 0; }
.recog-new { background: var(--chip); border-radius: 6px; padding: 8px 10px; margin: 0 0 8px; font-size: 13px; }
@media (max-width: 800px) { .recog-grid textarea { font-size: 16px; } } /* мельче 16px телефон увеличивает страницу при вводе */

/* страница комплекса: места — прокручиваемый список с галочками */
.cx-scroll { max-height: 360px; overflow-y: auto; border: 1px solid var(--line, rgba(127,127,127,.25)); border-radius: 8px; }
.cx-table { width: 100%; margin: 0; }
.cx-table thead th { position: sticky; top: 0; background: var(--card); z-index: 1; }
.cx-table td:first-child, .cx-table th:first-child { width: 32px; }
.cx-table tr.on td { background: var(--green-bg, rgba(46,160,67,.08)); }
.cx-table label { cursor: pointer; }
.decide[hidden] { display: none; }  /* поиск по «Ждут решения» */

/* окно «Ошибся местом»: места договора кнопками */
.fix-places { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }


/* арендаторы, «По сроку цены»: вместо баланса — с какого числа цена и сколько прошло; от 6 месяцев — подсветка */
.people .age { display: none; font-size: 13px; color: var(--muted); white-space: normal; text-align: right; }
.people .age b { display: block; color: var(--text); font-weight: 600; font-size: 15px; white-space: nowrap; }
.people .age-since { display: block; white-space: nowrap; }
.people .age.age-old b { color: var(--yellow); }
.people .age.age-old b::before { content: "⚠ "; }
.people .age-next { display: block; color: var(--green); font-size: 12px; white-space: nowrap; }
#list-table.by-age .age { display: block; }
#list-table.by-age .bal-v, #list-table.by-age td.pay { display: none; }
/* места и гаражи, «По сроку цены»: так же — в столбце «Договор» вместо цены */
.plist .age { display: none; font-size: 13px; color: var(--muted); }
.plist .age b { display: block; color: var(--text); font-weight: 600; font-size: 14px; white-space: nowrap; }
.plist .age-since, .plist .age-next { display: block; white-space: nowrap; }
.plist .age.age-old b { color: var(--yellow); }
.plist .age.age-old b::before { content: "⚠ "; }
.plist .age-next { color: var(--green); font-size: 12px; }
#list-table.plist.by-age .age { display: block; }
/* «По дате платежа»: справа — дата ближайшего платежа (просроченный срок — красным).
   У арендаторов это порядок по умолчанию, у мест — выбранный в списке */
.due-d { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; }
.due-d.c-red { color: var(--red); }
#list-table.by-abc .due-d, #list-table.by-age .due-d { display: none; }
.plist .due-d { display: none; color: var(--text); font-weight: 600; font-size: 14px; }
#list-table.plist.by-due .due-d { display: block; }
.plist .due-d.c-red { color: var(--red); }
@media (max-width: 640px) { .people .age { text-align: left; } .people .age b, .people .age-since, .people .age-next { display: inline; } .people .age b::after { content: " · "; color: var(--muted); font-weight: 400; } .people .age-next::before { content: " "; } }

/* арендаторы: «Архив» ссылкой в шапке; рядом с поиском — «Кому платит» и порядок */
.head-link { font-size: 14px; color: var(--muted); margin-left: auto; margin-right: 6px; }
.toolbar-row .head-link + .btn { margin-left: 0; }
.list-tools input, .list-tools select { box-sizing: border-box; height: 40px; }
.list-tools select {
  width: auto; max-width: 240px; font: inherit; color: var(--text); background-color: var(--card);
  border: 1px solid var(--input-line); border-radius: 7px; padding: 8px 32px 8px 10px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa3b2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.list-tools select:focus { outline: 2px solid var(--focus); border-color: var(--accent); }
@media (max-width: 640px) {
  .list-tools { flex-wrap: wrap; }
  .list-tools input { flex: 1 1 100%; }
  .list-tools select { flex: 1 1 0; min-width: 0; max-width: none; font-size: 13px; padding: 8px 22px 8px 8px; background-position: right 6px center; }
}

/* главная: группы в порядке владельца (Настройки → «Порядок групп на главной») */
.dash-groups { display: flex; flex-direction: column; }
.order-list { list-style: none; margin: 4px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; }
.order-list li { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-top: 1px solid var(--line); }
.order-list li:first-child { border-top: 0; }
.order-list li > span { flex: 1; }
.order-list li > .ord-grip { flex: none; }
.order-list li { cursor: grab; user-select: none; -webkit-user-select: none; background: var(--card); }
.order-list .ord-grip { color: var(--muted); font-size: 18px; line-height: 1; padding: 4px 6px; margin: -4px 0; touch-action: none; cursor: grab; }
.order-list.sorting, .order-list.sorting li { cursor: grabbing; }
.order-list li.dragging { background: var(--hover); box-shadow: 0 2px 10px rgba(0,0,0,.18); position: relative; z-index: 1; border-radius: 6px; }
.order-list .ord-ico { display: inline-block; width: 1.6em; }

/* SMS-напоминания: журнал */
.sms-log { list-style: none; margin: 0; padding: 0; }
.sms-log li { padding: 5px 0; border-top: 1px solid var(--line); display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; }
.sms-log li:first-child { border-top: 0; }

/* Финансы → «Чеки аренды»: период — месяц / полгода / год / свои даты */
.receipts-period { margin-bottom: 10px; }
.receipts-custom { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; }
.receipts-custom label { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; }
.receipts-custom input[type=date] { width: auto; }
#receipts { scroll-margin-top: 80px; }  /* при переходе к чекам кнопки не прячутся под шапкой */
.receipts-order { display: contents; }  /* порядок чеков — в одной строке с поиском */

/* Настройки → Telegram-бот: кнопки «сводка» и «оповещения об оплате» */
.tg-switches { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 0; }
.tg-switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.tg-switch .hint { margin: 0; }

/* Получатели платежей → «Типы получателей»: свой список типов */
.kinds-title { font-size: 18px; margin: 28px 0 10px; }
.kinds-hint { text-transform: none; letter-spacing: 0; font-weight: 400; }
.kinds-table td { vertical-align: middle; padding-top: 6px; padding-bottom: 6px; }
.kinds-table .num { width: 130px; }
.kind-act { width: 1%; text-align: right; }
.kinds-table .kind-input { width: 100%; max-width: 420px; background: transparent; border: 1px solid transparent; box-shadow: none; padding: 5px 8px; margin-left: -8px; font-weight: 500; }
.kinds-table .kind-input:hover { border-color: var(--line); }
.kinds-table .kind-input:focus { background: var(--bg); border-color: var(--accent); }
.kind-new td { border-bottom: 0; }
.kinds-table .kind-new .kind-input { font-weight: 400; border: 1px dashed var(--line); margin-left: 0; }
@media (max-width: 560px) { .kinds-hint { display: none; } .kinds-table .num { display: none; } .kind-new td:first-child { width: 100%; } .kinds-table .kind-input { margin-left: 0; } }

/* Ширина столбцов, которую можно менять мышью (table[data-resize]) */
table[data-resize] thead th { position: relative; }
table.cols-fixed { table-layout: fixed; }
table.cols-fixed td, table.cols-fixed th { overflow-wrap: anywhere; }
.col-grip { position: absolute; top: 0; right: -4px; width: 8px; height: 100%; cursor: col-resize; z-index: 2; touch-action: none; }
.col-grip::after { content: ""; position: absolute; top: 25%; bottom: 25%; left: 3px; width: 2px; border-radius: 1px; background: var(--line); }
.col-grip:hover::after, .col-resizing .col-grip::after { background: var(--accent); top: 0; bottom: 0; }
body.col-resizing { cursor: col-resize; user-select: none; }
@media (max-width: 640px) { .col-grip { display: none; } }

/* Поле даты: печатать «дд.мм.гггг» или выбрать в календаре (📅) — app.js */
.date-field { position: relative; display: flex; align-items: stretch; width: 100%; }
.date-field.inline { display: inline-flex; width: auto; vertical-align: middle; }
.date-field .date-text { flex: 1 1 auto; min-width: 0; padding-right: 38px; }
.date-field.inline .date-text { width: 9.5em; }
.date-field .date-pick { position: absolute; right: 1px; top: 1px; bottom: 1px; width: 34px; display: flex; align-items: center;
  justify-content: center; font-size: 16px; border-left: 1px solid var(--input-line); border-radius: 0 6px 6px 0; pointer-events: none; }
.date-field input[type=date] { position: absolute; right: 1px; top: 1px; bottom: 1px; width: 34px !important; height: auto;
  padding: 0; border: 0; opacity: 0; cursor: pointer; }
.date-field input[type=date]::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: auto; height: auto; opacity: 0; cursor: pointer; }
.date-field .date-text:disabled ~ .date-pick { opacity: .4; }

/* SMS-напоминания: кнопка в шапке (рядом с ⚙️) и пульт отправки (/sms) */
.btn-count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 2px; border-radius: 10px; font-size: 12px;
  line-height: 18px; text-align: center; background: var(--red); color: #fff; font-weight: 600; }
.hb-sms { position: relative; }
.hb-sms .btn-count { position: absolute; top: -6px; right: -7px; min-width: 17px; padding: 0 4px; margin: 0; font-size: 11px;
  line-height: 16px; box-shadow: 0 0 0 2px var(--header); }
.sms-status { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.sms-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; padding: 0 11px; height: 29px; line-height: 1;
  box-sizing: border-box; white-space: nowrap; border-radius: 20px;
  background: var(--grey-bg); color: var(--muted); border: 1px solid var(--line); text-decoration: none; }
.sms-chip.ok { color: var(--green); }
.sms-chip.warn { color: var(--yellow); }
a.sms-chip:hover, button.sms-chip:hover { border-color: var(--accent); filter: none; }
button.sms-chip { font: inherit; font-size: 13px; cursor: pointer; margin: 0; box-shadow: none; }
.sms-status form.inline { display: contents; }
.stats.sms-stats { grid-template-columns: repeat(4, 1fr); }
.sms-panel { margin-bottom: 16px; padding: 0; overflow: hidden; }
.sms-panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 16px 10px; }
.sms-panel-head h3 { margin: 0; flex: 1 1 auto; }
.sms-panel-head input[type=search] { width: 260px; max-width: 100%; border: 1px solid var(--input-line); border-radius: 7px;
  padding: 7px 10px; font: inherit; background: var(--card); color: var(--text); }
.sms-panel .table-wrap { border: 0; border-radius: 0; margin: 0; }
.sms-panel table { border-top: 1px solid var(--line); }
.sms-panel td { vertical-align: middle; }
.sms-cb { width: 34px; text-align: center !important; }
.sms-cb input { width: 17px; height: 17px; margin: 0; cursor: pointer; }
.sms-table tbody tr:has(input[data-pick-one]:checked) { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.sms-preview summary { cursor: pointer; color: var(--accent); list-style: none; }
.sms-preview summary::-webkit-details-marker { display: none; }
.sms-preview[open] summary { margin-bottom: 6px; }
.sms-bubble { white-space: normal; max-width: 340px; font-size: 13px; line-height: 1.4; padding: 8px 11px; border-radius: 12px 12px 12px 3px;
  background: var(--grey-bg); border: 1px solid var(--line); color: var(--text); }
.sms-bar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 12px; justify-content: flex-end; flex-wrap: wrap;
  padding: 12px 16px; background: var(--card); border-top: 1px solid var(--line); z-index: 2; }
.sms-bar [data-pick-count] { margin-right: auto; }
label.sms-all-m { display: none; }
.sms-panel > .hint { padding: 0 16px 14px; margin: 0; }
.sms-none { padding: 18px 16px 20px; color: var(--muted); }
.sms-empty { text-align: center; padding: 36px 20px; }
.sms-empty-ico { font-size: 40px; }
.sms-empty h3 { margin: 8px 0 4px; }
.sms-empty p { margin: 0 0 14px; }
.cols.sms-set-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.sms-set-cols > div > .form + .form { margin-top: 16px; }
.sms-guide { margin: 0; padding: 0; overflow: hidden; }
.sms-guide-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.sms-guide-head h3 { margin: 0; flex: 1 1 auto; }
.sms-guide-head .muted { white-space: nowrap; }
.sms-guide-lead { margin: 14px 16px 4px; line-height: 1.5; }
.sms-steps { counter-reset: st; list-style: none; margin: 8px 0 0; padding: 0 16px; }
.sms-steps > li { counter-increment: st; position: relative; padding: 12px 0 12px 44px; line-height: 1.55; border-bottom: 1px dashed var(--line); }
.sms-steps > li:last-child { border-bottom: 0; }
.sms-steps > li::before { content: counter(st); position: absolute; left: 0; top: 11px; width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; background: var(--accent); }
.sms-steps ul { margin: 6px 0; padding-left: 18px; }
.sms-steps ul li { margin: 3px 0; }
.sms-step-act { margin: 8px 0; }
.sms-guide-foot { margin: 4px 16px 16px; padding: 12px 14px; border-radius: 9px; background: var(--grey-bg); line-height: 1.5; }
.sms-guide-alt { margin-top: 10px; }
.sms-guide-alt summary { cursor: pointer; color: var(--accent); }
.sms-guide-alt[open] summary { margin-bottom: 6px; }
@media (max-width: 640px) {
  .stats.sms-stats { grid-template-columns: 1fr 1fr; }
  .sms-panel-head input[type=search] { width: 100%; }
  label.sms-all-m { display: flex; }
  .sms-bar button { flex: 1 1 100%; }
  table.stack.sms-table td.sms-cb { width: auto; }
  .sms-bubble { max-width: none; }
}
.sms-panel-head .receipts-period { margin: 0; }
.sms-journal-custom { padding: 0 16px; }

.license-view-ended main,
.license-view-ended dialog,
.license-view main form[method="post"],
.license-view main a:is([download], [href^="/files/"], [href^="/bank/"], [href^="/kassa/"], [href^="/backup/"], [href$=".xlsx"], [href$=".csv"], [href$=".pdf"], [href$=".docx"], [href$="/new"], [href$="/edit"]) {
  display: none;
}
