/* Кабінет компанії Envoy. Світлий теплий фон, білі картки з великими заокругленнями, фіолетовий акцент Envoy.
   Тема: системна, або обрана вручну перемикачем (html[data-theme]). Шрифт Onest — з кирилицею. */
:root {
  --bg: #f4f2ee; --text: #1c1b20; --muted: #75737c; --line: rgba(28, 27, 32, .08);
  --card: #ffffff; --glass: #ffffff; --glass-strong: #ffffff; --glass-edge: rgba(28, 27, 32, .06);
  --field: #f6f5f2; --hover: rgba(28, 27, 32, .04);
  --ink: #1d1c22; --ink-text: #ffffff;
  --accent: #5b55f0; --accent-soft: rgba(91, 85, 240, .10); --accent-text: #fff;
  --brand: linear-gradient(135deg, #8f86ff 0%, #6a63f6 50%, #5048ea 100%);
  --ok: #1d9a5f; --warn: #b9740c; --danger: #d6454a; --info: #3a6fd8;
  --tint-ok: #e8f4ec; --tint-warn: #fbf0dc; --tint-danger: #fae6e4; --tint-info: #e7eefa; --tint-accent: #eeedfd;
  --radius: 22px; --radius-sm: 14px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --shadow: 0 1px 2px rgba(45, 35, 25, .04), 0 10px 30px rgba(45, 35, 25, .06);
  --shadow-lift: 0 2px 4px rgba(45, 35, 25, .05), 0 18px 40px rgba(45, 35, 25, .10);
  --blur: none;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131216; --text: #f2f1f5; --muted: #9c9aa5; --line: rgba(255, 255, 255, .08);
    --card: #1d1c22; --glass: #1d1c22; --glass-strong: #24232a; --glass-edge: rgba(255, 255, 255, .06);
    --field: #26252c; --hover: rgba(255, 255, 255, .04);
    --ink: #f2f1f5; --ink-text: #131216;
    --accent: #918cff; --accent-soft: rgba(145, 140, 255, .16);
    --ok: #4cd08e; --warn: #f0b552; --danger: #ff7a7e; --info: #7aa6ff;
    --tint-ok: rgba(76, 208, 142, .12); --tint-warn: rgba(240, 181, 82, .13); --tint-danger: rgba(255, 122, 126, .13);
    --tint-info: rgba(122, 166, 255, .13); --tint-accent: rgba(145, 140, 255, .14);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .28);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .3), 0 20px 44px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131216; --text: #f2f1f5; --muted: #9c9aa5; --line: rgba(255, 255, 255, .08);
  --card: #1d1c22; --glass: #1d1c22; --glass-strong: #24232a; --glass-edge: rgba(255, 255, 255, .06);
  --field: #26252c; --hover: rgba(255, 255, 255, .04);
  --ink: #f2f1f5; --ink-text: #131216;
  --accent: #918cff; --accent-soft: rgba(145, 140, 255, .16);
  --ok: #4cd08e; --warn: #f0b552; --danger: #ff7a7e; --info: #7aa6ff;
  --tint-ok: rgba(76, 208, 142, .12); --tint-warn: rgba(240, 181, 82, .13); --tint-danger: rgba(255, 122, 126, .13);
  --tint-info: rgba(122, 166, 255, .13); --tint-accent: rgba(145, 140, 255, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .28);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, .3), 0 20px 44px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 14.5px/1.5 "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; letter-spacing: -0.005em; font-feature-settings: "tnum" 0;
}
/* М'яке світло згори: фіолетове зліва й тепле справа */
.backdrop { position: fixed; inset: 0; z-index: -1; pointer-events: none; background:
  radial-gradient(55vw 38vw at -5% -10%, rgba(143, 134, 255, .20), transparent 70%),
  radial-gradient(50vw 34vw at 105% -8%, rgba(255, 200, 150, .28), transparent 70%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .backdrop { opacity: .45; } }
:root[data-theme="dark"] .backdrop { opacity: .45; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 28px; line-height: 1.15; letter-spacing: -0.03em; margin: 4px 0 16px; font-weight: 600; }
h2 { font-size: 18px; letter-spacing: -0.02em; margin: 28px 0 12px; font-weight: 600; }
h3 { letter-spacing: -0.015em; font-weight: 600; }
b, strong { font-weight: 600; }
.muted { color: var(--muted); }
.i { width: 20px; height: 20px; flex: none; }

/* ---------- Верхня панель: бренд · розділи · пошук і дії ---------- */
.topbar { position: sticky; top: 0; z-index: 20; padding: 10px 16px 0; padding-top: max(10px, env(safe-area-inset-top)); view-transition-name: topbar; }
.bar { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 7px 8px 7px 7px; border-radius: 28px; background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
  border: 1px solid var(--glass-edge); box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--brand); box-shadow: 0 8px 18px rgba(91, 85, 240, .32); }
.brand-mark img { width: 24px; height: 24px; border-radius: 7px; }
.brand-text { display: grid; line-height: 1.15; min-width: 0; }
.brand-text b { font-size: 16.5px; letter-spacing: -0.025em; }
.brand-text small { color: var(--muted); font-size: 12px; max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topnav { display: none; gap: 2px; padding: 4px; border-radius: 999px; background: var(--field); border: 1px solid var(--line); }
.topnav a { position: relative; padding: 7px 16px; border-radius: 999px; color: var(--text); font-weight: 500; font-size: 14px; white-space: nowrap;
  transition: background .2s, color .2s; }
.topnav a > span:not(.nav-pill) { position: relative; z-index: 1; }
.topnav a:hover { text-decoration: none; background: var(--hover); }
.topnav a.active { color: var(--ink-text); }
.topnav a.active:hover { background: none; }
.nav-pill { position: absolute; inset: 0; border-radius: 999px; background: var(--ink); box-shadow: 0 6px 14px rgba(20, 18, 30, .18);
  view-transition-name: nav-pill; }
.me { display: flex; align-items: center; gap: 8px; }
.me-name { color: var(--muted); font-size: 14px; white-space: nowrap; }
.top-search { display: flex; align-items: center; gap: 8px; padding: 0 8px 0 13px; height: 40px; border-radius: 999px; background: var(--field);
  border: 1px solid var(--line); color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; transition: border-color .2s, color .2s, box-shadow .2s; }
.top-search:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 40%, transparent); box-shadow: 0 0 0 4px var(--accent-soft); }
.top-search-text { min-width: 90px; text-align: left; }
kbd { font: inherit; font-size: 11.5px; font-weight: 600; padding: 2px 7px; border-radius: 8px; color: var(--muted);
  background: var(--card); border: 1px solid var(--line); white-space: nowrap; }
.top-search .i { width: 18px; height: 18px; }
@media (max-width: 1279px) { .top-search-text, .top-search kbd { display: none; } .top-search { width: 40px; padding: 0; justify-content: center; } }
.glass-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--text);
  background: var(--field); border: 1px solid var(--line); position: relative; cursor: pointer; font: inherit; }
.glass-btn:hover { text-decoration: none; color: var(--accent); }
.glass-btn, .rail a, .rail button { transition: background .2s, color .2s, transform .15s; }
.glass-btn:active, .rail a:active { transform: scale(.92); }
.glass-btn .i { width: 18px; height: 18px; }

main { max-width: 1240px; margin: 0 auto; padding: 18px 16px 48px; }
body.with-tabs main { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }

/* ---------- Бічна панель (комп'ютер): тема й швидкі дії ---------- */
.rail { display: none; }
.rail-group { display: grid; gap: 8px; padding: 8px; border-radius: 999px; background: var(--card);
  border: 1px solid var(--glass-edge); box-shadow: var(--shadow); }
.rail a, .rail button { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: var(--muted);
  border: 0; background: transparent; cursor: pointer; position: relative; }
.rail a:hover, .rail button:hover { color: var(--text); background: var(--hover); text-decoration: none; }
.rail .on { background: var(--ink); color: var(--ink-text); }
.rail .on:hover { background: var(--ink); color: var(--ink-text); }
.rail .accent { background: var(--brand); color: #fff; box-shadow: 0 8px 18px rgba(91, 85, 240, .32); }
.rail .accent:hover { color: #fff; background: var(--brand); filter: brightness(1.06); }
.rail .i { width: 19px; height: 19px; }
.rail [data-tip]:hover::after { content: attr(data-tip); position: absolute; left: 52px; top: 50%; transform: translateY(-50%);
  white-space: nowrap; padding: 6px 12px; border-radius: 10px; background: var(--ink); color: var(--ink-text);
  font-size: 13px; font-weight: 500; z-index: 5; pointer-events: none; }
.count { position: absolute; top: 2px; right: 0; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
  border: 2px solid var(--card); }

/* Видно лише там, де є нижня панель вкладок (телефон, планшет): на комп'ютері те саме — у бічній панелі */
@media (min-width: 1100px) { .tabs-only { display: none !important; } }
/* На телефоні «+» і сповіщень угорі немає: додати — у пошуку, сповіщення — у «Налаштуваннях» */
@media (max-width: 1099px) { .desk-only { display: none !important; } }

@media (min-width: 1100px) {
  .topnav { display: inline-flex; }
  .rail { display: grid; gap: 12px; align-content: start; position: fixed; z-index: 15; left: max(16px, calc(50vw - 700px));
    top: 86px; view-transition-name: rail; }
  main { padding-left: 88px; max-width: 1340px; }
  body.with-tabs main { padding-bottom: 56px; }
  .tabbar { display: none !important; }
}

/* ---------- Нижня панель вкладок (телефон і планшет) ---------- */
.tabbar { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom)); display: flex; gap: 2px; padding: 6px;
  border-radius: 999px; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px); border: 1px solid var(--glass-edge);
  box-shadow: 0 18px 50px rgba(30, 25, 40, .18); max-width: calc(100vw - 20px); }
.tab { display: grid; justify-items: center; gap: 2px; min-width: 64px; padding: 7px 12px 6px; border-radius: 999px;
  color: var(--text); font: inherit; font-size: 11px; font-weight: 500; background: none; border: 0; cursor: pointer;
  opacity: .72; transition: background .2s, color .2s, opacity .2s; }
.tab:hover { text-decoration: none; opacity: 1; }
.tab.active { color: var(--ink-text); background: var(--ink); opacity: 1; }
.tab .i { width: 22px; height: 22px; }
@media (max-width: 899px) { .me-name { display: none; } }
@media (max-width: 380px) { .tab { min-width: 54px; padding: 7px 8px 6px; } }

/* ---------- Картки, списки, таблиці ---------- */
.card { background: var(--card); border: 1px solid var(--glass-edge); border-radius: var(--radius); padding: 18px;
  margin-bottom: 14px; box-shadow: var(--shadow); }
a.card { display: block; color: var(--text); transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
a.card:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow-lift); }
a.card:active { transform: translateY(-1px) scale(.995); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 8px; }
.stat .num { font-size: 28px; font-weight: 600; letter-spacing: -0.03em; text-align: left; }
.stat .label { color: var(--muted); font-size: 13.5px; }
.stat.danger .num { color: var(--danger); }
.row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; }
.row > h1, .row > h2 { margin-bottom: 12px; }
.card .row + .row { border-top: 1px solid var(--line); }

table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); border: 1px solid var(--glass-edge);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 500; background: color-mix(in srgb, var(--field) 60%, transparent); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td, tr:hover > td { background: var(--hover); }
.table-wrap { overflow-x: auto; border-radius: var(--radius); margin-bottom: 14px; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; background: var(--accent);
  color: var(--accent-text); border-radius: 999px; padding: 9px 18px; font: inherit; font-weight: 600; cursor: pointer;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 30%, transparent); transition: transform .15s var(--ease), filter .2s, box-shadow .2s, background .2s, color .2s, border-color .2s; }
.btn:hover { text-decoration: none; filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 12px 24px color-mix(in srgb, var(--accent) 34%, transparent); }
.btn:active { transform: scale(.97); }
.btn.secondary { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .04); border: 1px solid var(--line); }
.btn.secondary:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); filter: none; box-shadow: 0 6px 16px rgba(30, 25, 40, .07); }
.btn.danger { background: transparent; color: var(--danger); box-shadow: none; border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.danger.secondary { border-color: transparent; }
.btn.small { padding: 6px 13px; font-size: 13px; }
.btn .i { width: 18px; height: 18px; }
button:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: default; }

/* ---------- Значки стану ---------- */
.badge { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 3px 11px; border-radius: 99px;
  background: var(--field); color: var(--muted); }
.badge.ok { color: var(--ok); background: var(--tint-ok); } .badge.warn { color: var(--warn); background: var(--tint-warn); }
.badge.off { color: var(--muted); } .badge.danger { color: var(--danger); background: var(--tint-danger); }
h1 .badge { vertical-align: middle; font-size: 13px; }

/* ---------- Фільтри-сегменти ---------- */
.tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 4px; margin-bottom: 16px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--glass-edge); box-shadow: var(--shadow); }
.tabs a { padding: 6px 15px; border-radius: 999px; color: var(--text); font-size: 13.5px; font-weight: 500; transition: background .2s, color .2s; }
.tabs a:hover { text-decoration: none; background: var(--hover); }
.tabs a.active { background: var(--ink); color: var(--ink-text); }

/* ---------- Кроки договору ---------- */
.steps { display: flex; gap: 8px; margin: 4px 0 8px; flex-wrap: wrap; }
.stepper { flex: 1; min-width: 110px; text-align: center; padding: 9px; border-radius: 999px; color: var(--muted);
  font-size: 14px; font-weight: 600; background: var(--glass); border: 1px solid var(--glass-edge); }
.stepper.now { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, var(--glass)); }
.stepper.done { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--glass)); }
.doc-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; align-items: center; }
.doc-actions .copy input[type=file] { width: auto; max-width: 220px; font-size: 13px; }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.radio-row label.check { font-weight: 500; }
.sign-ways { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sign-way { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; }
.sign-way p { margin: 4px 0 10px; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; align-items: start; }

/* ---------- Форми ---------- */
form.stack { display: grid; gap: 16px; max-width: 580px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
label.check { display: flex; gap: 10px; align-items: center; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--text); background: var(--field);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 13px; width: 100%;
  transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--accent); }
input[type=file] { padding: 6px; font-size: 13px; color: var(--muted); }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; color: var(--accent); background: var(--accent-soft);
  border: 0; border-radius: 999px; padding: 6px 12px; margin-right: 10px; cursor: pointer; }
label.check input { width: auto; }
textarea { min-height: 90px; }
.help { font-weight: 400; color: var(--muted); font-size: 13px; }
.error { font-weight: 500; color: var(--danger); font-size: 13px; }
.alert { background: var(--tint-warn); border-color: transparent; box-shadow: none; }
.card.alert { background: var(--tint-warn); }
.copy { display: flex; gap: 8px; align-items: center; }
.copy input { font-size: 13px; }
.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

/* Рядки послуг (рахунок, акт, додаток) */
.lines { display: grid; gap: 8px; }
.line { display: grid; grid-template-columns: 1fr 90px 70px 120px; gap: 8px; }
.line.head { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.line.appendix { grid-template-columns: 1fr 150px; }
.cell { display: block; font-weight: 400; }
.cell-label { display: none; }
.line.empty[hidden] { display: none; }
.report-lines { display: grid; gap: 10px; }
.report-line { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 8px; align-items: start; }
.report-line textarea { min-height: 44px; }

/* Шаблони й тексти договорів */
.template-layout { display: grid; grid-template-columns: 1fr 300px; gap: 14px; align-items: start; }
.fields-help { position: sticky; top: 90px; max-height: 80vh; overflow: auto; }
.field-chip { display: grid; gap: 1px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.field-chip code { cursor: pointer; color: var(--accent); }
.field-chip code.copied { color: var(--ok); }
.doc-editor { min-height: 520px; font: 14px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace; }
a.card.contract-row { display: block; color: var(--text); }

@media (max-width: 760px) { .template-layout, .sign-ways { grid-template-columns: 1fr; } .fields-help { position: static; } }
@media (max-width: 600px) {
  main { padding: 14px 12px 40px; }
  h1 { font-size: 25px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat .num { font-size: 20px; }
  .stats .card { margin-bottom: 0; padding: 14px; }
  .card { padding: 15px; border-radius: 20px; }
  .hide-sm { display: none; }
  th, td { padding: 9px 10px; }
  .report-line { grid-template-columns: 1fr; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .lines { gap: 10px; }
  .line, .line.appendix { grid-template-columns: 1fr 1fr 1.3fr; padding: 10px; border: 1px solid var(--line);
    border-radius: var(--radius-sm); background: var(--field); }
  .line.appendix { grid-template-columns: 1fr; }
  .line > .cell:first-child { grid-column: 1 / -1; }
  .line.head { display: none; }
  .cell-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
}

/* Без підтримки розмиття — щільніші картки, щоб текст читався */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --glass: rgba(255, 255, 255, .94); --glass-strong: #fff; }
  @media (prefers-color-scheme: dark) { :root { --glass: rgba(28, 29, 44, .96); --glass-strong: #23243a; } }
}

/* ---------- Візуальний редактор договорів ---------- */
.doc-editor-box { position: relative; display: grid; gap: 0; }
.doc-toolbar { position: sticky; top: 76px; z-index: 5; display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 6px; border-radius: 999px; background: var(--glass-strong); backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur); border: 1px solid var(--glass-edge); box-shadow: var(--shadow); }
.tb-group { display: flex; gap: 2px; padding: 0 4px; border-right: 1px solid var(--line); }
.tb-group:last-child { border-right: 0; }
.tb-end { margin-left: auto; }
.doc-toolbar button { font: inherit; font-size: 13px; font-weight: 600; color: var(--text); background: none; border: 0;
  border-radius: 999px; padding: 7px 12px; cursor: pointer; white-space: nowrap; }
.doc-toolbar button:hover { background: var(--accent-soft); color: var(--accent); }
.doc-toolbar .tb-accent { background: var(--brand); color: #fff; }
.doc-toolbar .tb-accent:hover { color: #fff; filter: brightness(1.07); }
.doc-canvas { padding: 22px 0 8px; overflow-x: auto; }
/* Аркуш паперу: як у Word, білий і в темній темі */
.doc-page { background: #fff; color: #111; width: min(100%, 820px); min-height: 900px; margin: 0 auto; padding: 64px 70px 80px 84px;
  border-radius: 6px; box-shadow: 0 2px 6px rgba(0, 0, 0, .06), 0 18px 50px rgba(30, 32, 90, .16);
  font: 15.5px/1.5 "Times New Roman", "Liberation Serif", Tinos, Times, serif; outline: none; caret-color: #4a52f2; }
.doc-page p, .doc-page h1, .doc-page h2 { margin: 0 0 6px; }
.doc-page .b-title { text-align: center; font-size: 18px; font-weight: 700; letter-spacing: 0; margin-bottom: 4px; }
.doc-page .b-title + .b-title { font-size: 15.5px; margin-bottom: 14px; }
.doc-page .b-section { text-align: center; font-size: 15.5px; font-weight: 700; text-transform: uppercase; margin: 22px 0 8px; letter-spacing: 0; }
.doc-page .b-para { text-align: justify; }
.doc-page .b-clause { padding-left: 2.6em; text-indent: -2.6em; }
.doc-page .b-split { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 10px 0 16px; }
.split-sep { color: #b8bbd6; font-size: 12px; user-select: none; }
.doc-page :focus { outline: none; }
.doc-page .b-para:hover, .doc-page .b-section:hover, .doc-page .b-title:hover, .doc-page .b-split:hover {
  background: rgba(74, 82, 242, .035); border-radius: 4px; }
.fld { display: inline-block; padding: 0 7px; margin: 0 1px; border-radius: 7px; font: 600 13px/1.55 -apple-system, "Segoe UI", sans-serif;
  color: #3b42d9; background: #eceeff; border: 1px solid #d8dbff; white-space: nowrap; text-indent: 0; vertical-align: 1px; cursor: default; }
.fld.unknown { color: #c0262d; background: #ffecec; border-color: #ffd0d0; }
.doc-source { display: none; min-height: 560px; font: 14px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace; margin-top: 16px; }
.text-mode .doc-canvas { display: none; }
.text-mode .doc-source { display: block; }
.text-mode [data-cmd]:not([data-cmd="text"]):not([data-cmd="undo"]):not([data-cmd="redo"]) { opacity: .35; pointer-events: none; }
.text-mode [data-cmd="text"] { background: var(--accent-soft); color: var(--accent); }

/* Палітра полів — збоку на комп'ютері, знизу на телефоні */
.field-palette { display: none; position: fixed; z-index: 40; right: 18px; top: 90px; bottom: 110px; width: 330px;
  flex-direction: column; border-radius: 26px; background: var(--glass-strong); backdrop-filter: saturate(200%) blur(28px);
  -webkit-backdrop-filter: saturate(200%) blur(28px); border: 1px solid var(--glass-edge); box-shadow: 0 24px 60px rgba(30, 32, 90, .25); }
.field-palette.open { display: flex; }
.fp-head { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.fp-head input { font-size: 15px; padding: 9px 13px; border-radius: 999px; }
.fp-close { border: 0; background: var(--field); color: var(--text); border-radius: 50%; width: 38px; flex: none; cursor: pointer; }
.fp-body { overflow: auto; padding: 6px 10px 14px; }
.fp-title { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 12px 6px 6px; }
.fp-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: none; border: 0; border-radius: 12px; padding: 7px 8px; cursor: pointer; font: inherit; color: var(--text); }
.fp-item:hover { background: var(--accent-soft); }
.fp-item code { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.fp-item .fld { white-space: normal; text-align: left; }
@media (max-width: 760px) {
  .doc-toolbar { border-radius: 22px; top: 70px; }
  .tb-end { margin-left: 0; }
  .doc-page { padding: 28px 20px 40px; min-height: 600px; font-size: 15px; }
  .doc-page .b-clause { padding-left: 0; text-indent: 0; }
  .field-palette { left: 8px; right: 8px; top: auto; bottom: calc(8px + env(safe-area-inset-bottom)); width: auto; height: 62vh; }
}
.editor-meta { display: grid; gap: 10px; }
.editor-form > .row { position: relative; }

/* ---------- Кроки «Погодження» і «Підпис» ---------- */
.step-card { position: relative; }
.step-card.now { box-shadow: var(--shadow), 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }
.step-card.done { background: color-mix(in srgb, var(--ok) 7%, var(--glass)); }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.step-head h2 { margin: 0; font-size: 19px; }
.step-num { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: none;
  font-size: 14px; font-weight: 700; color: var(--muted); background: var(--field); border: 1px solid var(--line); }
.step-num.now { color: #fff; background: var(--brand); border: 0; }
.step-num.done { color: #fff; background: var(--ok); border: 0; }
.step-pill { margin-left: auto; font-size: 12px; font-weight: 650; padding: 3px 11px; border-radius: 999px;
  color: var(--muted); background: var(--field); }
.step-pill.now { color: var(--accent); background: var(--accent-soft); }
.step-pill.done { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.step-result { margin: 0; font-size: 16px; }
.step-hint { margin: 0 0 12px; font-size: 14px; }
.step-files { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 14px; }
.sign-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sign-opt { display: grid; justify-items: start; gap: 2px; text-align: left; padding: 14px 16px; border-radius: 18px; cursor: pointer;
  font: inherit; color: var(--text); background: var(--glass-strong); border: 1px solid var(--glass-edge); box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .15s, border-color .15s; }
.sign-opt:hover { border-color: var(--accent); transform: translateY(-1px); }
.sign-opt:active { transform: scale(.98); }
.sign-opt b { font-size: 16px; }
.sign-opt span:not(.sign-ico) { color: var(--muted); font-size: 13px; }
.sign-ico { font-size: 22px; line-height: 1; margin-bottom: 4px; }
.scan-opt { margin-top: 10px; font-size: 14px; }
.scan-opt summary { cursor: pointer; color: var(--accent); font-weight: 600; list-style: none; padding: 6px 0; }
.scan-opt summary::-webkit-details-marker { display: none; }
.scan-opt[open] summary { margin-bottom: 8px; }
.scan-opt input { margin-bottom: 4px; }
.sign-compact .sign-opt { padding: 9px 12px; border-radius: 14px; }
.sign-compact .sign-opt b { font-size: 14px; }
.sign-compact .sign-ico { font-size: 17px; }
@media (max-width: 520px) { .sign-choice { grid-template-columns: 1fr; } }

/* Головна: що чекає підпису */
.sign-list .row { padding: 8px 0; }
.sign-list .row + .row { border-top: 1px solid var(--line); }
.stat.attention { box-shadow: var(--shadow), 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }
.stat.attention .num { color: var(--accent); }
[id] { scroll-margin-top: 90px; }

/* Матеріали на погодження */
.material-preview { display: block; max-width: 100%; max-height: 420px; margin-top: 12px; border-radius: 14px; box-shadow: var(--shadow); }
.break { overflow-wrap: anywhere; }
.journal { display: grid; gap: 10px; }
.journal-row { display: grid; grid-template-columns: 128px 1fr; gap: 10px; font-size: 14px; }
@media (max-width: 560px) { .journal-row { grid-template-columns: 1fr; gap: 2px; } }
.pick-list { display: grid; gap: 6px; margin: 8px 0 12px; }

/* Дії з документом: на вузькому екрані кожна форма — на всю ширину, нічого не виходить за край картки */
.doc-actions .copy { flex-wrap: wrap; min-width: 0; max-width: 100%; }
.doc-actions .copy select { flex: 1 1 200px; width: auto; min-width: 0; max-width: 100%; }
@media (max-width: 560px) {
  .doc-actions > form, .doc-actions > a { width: 100%; }
  .doc-actions .copy select, .doc-actions .copy input[type=file] { flex: 1 1 100%; max-width: none; }
  .doc-actions .copy .btn { flex: 1 1 auto; }
}

/* Перші кроки на головній */
.onboarding { margin-bottom: 18px; }
.onboarding .progress { height: 6px; border-radius: 99px; background: var(--accent-soft); margin: 12px 0 6px; overflow: hidden; }
.onboarding .progress span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.steps-list { list-style: none; padding: 0; margin: 8px 0 12px; display: grid; gap: 4px; }
.steps-list li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 8px 0;
  border-bottom: 1px solid var(--line, rgba(127,127,160,.15)); }
.steps-list li:last-child { border-bottom: 0; }
.steps-list .tick { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px;
  font-weight: 700; background: var(--accent-soft); color: var(--accent); }
.steps-list li.done .tick { background: var(--ok); color: #fff; }
.steps-list li.done b { color: var(--muted); font-weight: 500; text-decoration: line-through; }
.steps-list .what { display: grid; gap: 2px; min-width: 0; }
.steps-list .what .muted { font-size: 13px; }
@media (max-width: 560px) { .steps-list li { grid-template-columns: 28px 1fr; } .steps-list li > .btn, .steps-list li > span:last-child:not(.what) { grid-column: 2; justify-self: start; } }

/* Довідка */
.help-toc { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.help-toc a { padding: 5px 12px; border-radius: 99px; background: var(--accent-soft); font-size: 14px; }
.help-section { scroll-margin-top: 90px; }
.help-section ul, .help-section ol { padding-left: 20px; margin: 6px 0; }
.help-section li { margin: 4px 0; }
.memo { white-space: pre-wrap; font: inherit; font-size: 14px; background: var(--field); border-radius: 14px; padding: 14px; margin: 10px 0; }

/* Низ сторінки кабінету: довідка й контакти */
.page-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; margin: 36px 0 8px; font-size: 13px; }
.page-foot a { color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.page-foot a:hover { color: var(--accent); }
.page-foot .i { width: 16px; height: 16px; }

/* Звіти: стовпчики «виставлено / отримано» — фіолетовий Envoy і теплий помаранчевий.
   Пару перевірено на розрізнення при порушеннях кольорозору (світла й темна теми). */
.viz-root { --series-1: #5b55f0; --series-2: #eb6834; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .viz-root { --series-1: #7d77ff; --series-2: #e0703c; } }
:root[data-theme="dark"] .viz-root { --series-1: #7d77ff; --series-2: #e0703c; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.legend b { color: var(--text); font-weight: 600; margin-right: 10px; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; margin-right: 4px; }
.key.s1, .vbar.s1 { background: var(--series-1); }
.key.s2, .vbar.s2 { background: var(--series-2); }
.bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; height: 200px; align-items: end;
  border-bottom: 1px solid var(--line); padding-top: 8px; }
.bar-group { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; outline: none; }
.bar-pair { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.vbar { width: min(16px, 40%); min-height: 0; border-radius: 6px 6px 2px 2px; transition: opacity .15s; }
.bar-label { position: absolute; bottom: -22px; left: -4px; right: -4px; text-align: center; font-size: 12px; color: var(--muted); overflow: hidden; }
.bars:hover .bar-group:not(:hover) .vbar { opacity: .45; }
.tip { display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 3;
  background: var(--card); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-lift); border-radius: 14px;
  padding: 8px 10px; font-size: 13px; white-space: nowrap; flex-direction: column; gap: 2px; }
.bar-group:hover .tip, .bar-group:focus .tip { display: flex; }
.bar-group:first-child .tip, .bar-group:nth-child(2) .tip { left: 0; transform: none; }
.bar-group:last-child .tip, .bar-group:nth-last-child(2) .tip { left: auto; right: 0; transform: none; }
.viz-root .bars { margin-bottom: 26px; }

/* Короткі підсумки над графіком на головній */
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 16px; margin-bottom: 16px; }
.mini-stats > div { display: grid; gap: 2px; }
.mini-stats b { font-size: 20px; letter-spacing: -0.02em; }
.mini-stats .muted { font-size: 13px; }

/* Надходження з банку */
.bank-tx { padding: 10px 0; border-bottom: 1px solid var(--line); }
.bank-tx:last-child { border-bottom: 0; }
.bank-purpose { font-size: 13px; overflow-wrap: anywhere; }
.bank-tx select { max-width: 280px; }
.bank-entity { padding: 10px 0; border-top: 1px solid var(--line); }

.help-steps { margin: 6px 0 4px; padding-left: 20px; font-size: 14px; }
.help-steps li { margin: 3px 0; }

/* Мої сповіщення: ранковий підсумок */
.ok-text { color: var(--ok); font-weight: 600; font-size: 14px; }
.label-like { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.digest-form { max-width: 640px; }
.digest-grid { display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: start; }
.day-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.day-pick { display: block; cursor: pointer; }
.day-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.day-pick span { display: inline-block; min-width: 44px; text-align: center; padding: 8px 10px; border-radius: 12px;
  background: var(--field); border: 1px solid var(--glass-edge); font-weight: 600; font-size: 14px; color: var(--muted); }
.day-pick input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.day-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.tg-preview { background: #e9eef3; border-radius: 22px; padding: 18px; max-width: 520px; }
.tg-bubble { background: #fff; color: #12131a; border-radius: 16px 16px 16px 4px; padding: 12px 14px; font-size: 14px;
  line-height: 1.45; white-space: pre-wrap; box-shadow: 0 1px 1px rgba(0, 0, 0, .06); }
@media (prefers-color-scheme: dark) {
  .tg-preview { background: #0e1621; }
  .tg-bubble { background: #182533; color: #f2f3f8; }
}
@media (max-width: 560px) { .digest-grid { grid-template-columns: 1fr; } }
.me-name a { color: inherit; }

/* Підпис КЕП в Envoy */
.kep-start { margin: 6px 0 0; }
.kep-opt { width: 100%; text-align: left; border-color: color-mix(in srgb, var(--accent) 45%, var(--glass-edge)) !important; }
.kep-panel { margin-top: 8px; padding: 12px 14px; border-radius: 16px; background: var(--accent-soft); }
.kep-head { font-size: 15px; margin-bottom: 4px; }
.kep-row { padding: 6px 0; font-size: 14px; }

.sign-mode-choice .sign-choice { margin-top: 10px; }
.manual-sign { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.scan-pick { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; flex: 1 1 240px; }
.scan-pick input[type=file] { font-weight: 400; }
.other-way { margin-top: 12px; font-size: 14px; }
.other-way summary { cursor: pointer; color: var(--muted); }
.other-way .sign-form { margin-top: 10px; }
.other-way-form { margin-top: 10px; }
.linkish { background: none; border: 0; color: var(--accent); font: inherit; font-size: 14px; cursor: pointer; padding: 0; }
.kep-files { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0 0; font-size: 14px; }
.appendix-sign { width: 100%; }

/* Податки */
.tax-card h2 { font-size: 18px; }
.tax-next { display: flex; gap: 14px; align-items: center; margin: 14px 0; padding: 12px 14px; border-radius: 16px; background: var(--accent-soft); }
.tax-next-when { display: grid; text-align: center; min-width: 58px; }
.tax-next-when b { font-size: 20px; } .tax-next-when span { font-size: 12px; color: var(--muted); }
.tax-quarters { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 10px; }
.tax-q { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.tax-q .row { padding: 5px 0; font-size: 14px; }
.tax-q-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.tax-total { border-top: 1px solid var(--line); margin-top: 4px; }
.tax-dates { font-size: 12px; margin-top: 6px; }
.tax-limit { margin-top: 14px; font-size: 14px; }
.limit-bar { height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; margin-top: 6px; }
.limit-bar span { display: block; height: 100%; background: var(--accent); border-radius: 8px; }
.limit-bar span.warn { background: var(--warn); }
.tax-dps { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.tax-table td, .tax-table th { font-size: 14px; }
.tax-table tr.debt td { color: var(--danger); }
.tax-card-details { margin-top: 10px; font-size: 14px; }
.tax-card-details summary { cursor: pointer; color: var(--muted); }
.tax-block { margin-top: 8px; } .tax-block .row { padding: 3px 0; font-size: 13px; }
.tax-remind { margin-top: 14px; font-size: 14px; }

.tax-extra { font-size: 13px !important; padding: 2px 0 !important; }
.tax-add { margin-top: 6px; font-size: 13px; }
.tax-add summary { cursor: pointer; color: var(--accent); }
.tax-add-form { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.tax-add-form input[name=note] { grid-column: 1 / -1; }
.tax-add-form button { grid-column: 1 / -1; justify-self: start; }
.tax-dues { margin-top: 8px; display: grid; gap: 6px; }
.tax-due { display: flex; gap: 10px; align-items: center; font-size: 13px; flex-wrap: wrap; }
.tax-due-date { font-weight: 600; min-width: 42px; }
.tax-due-title { flex: 1; min-width: 160px; }
.tax-due-hint { font-size: 12px; }
.tax-note { font-size: 13px; margin: 10px 0 0; }
.tax-add-form select { max-width: 120px; }

/* Сторінки з ключем КЕП: на широкому екрані пояснення ліворуч, форма праворуч */
@media (min-width: 900px) {
  .kep-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
  .kep-layout .kep-about p:last-child { margin-bottom: 0; }
}
.tax-due-title b { white-space: nowrap; }

/* Гілка договору: договір → додатки, у кожного додатка — етапи до акта чи накладної */
.branch-head { display: flex; align-items: center; gap: 12px; margin: 26px 0 10px; flex-wrap: wrap; }
.branch-head h2 { margin: 0; }
.branch-head .steps.compact { margin: 0 0 0 auto; flex: 0 1 420px; }
.steps.compact .stepper { padding: 5px 10px; min-width: 0; font-size: 13px; }
.branch-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; background: var(--line);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--line) 45%, transparent); }
.branch-dot.now { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.branch-dot.done { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 18%, transparent); }
.branch-body { margin-left: 6px; padding-left: 20px; border-left: 2px solid var(--line); }
.branch-body > .card, .branch-body > section { margin-top: 0; }
.appendix-branch.finished { background: color-mix(in srgb, var(--ok) 5%, var(--glass)); }
.stage-strip { list-style: none; display: flex; gap: 6px; margin: 12px 0 6px; padding: 0; overflow-x: auto; }
.stage { flex: 1 1 0; min-width: 96px; display: grid; grid-template-columns: auto 1fr; column-gap: 7px; align-items: center;
  padding: 7px 10px; border-radius: 12px; background: color-mix(in srgb, var(--line) 30%, transparent); color: var(--muted);
  font-size: 13px; line-height: 1.25; }
.stage-mark { grid-row: span 2; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; background: var(--glass); }
.stage-label { font-weight: 600; }
.stage-note { font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage.done { color: var(--ok); background: color-mix(in srgb, var(--ok) 11%, var(--glass)); }
.stage.done .stage-mark { background: var(--ok); color: #fff; }
.stage.now { color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent); }
.stage.now .stage-mark { background: var(--accent); color: var(--accent-text); }
.stage.skip { opacity: .55; }
.appendix-items summary { cursor: pointer; padding: 4px 0; }
.mini-table { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 14px; }
.mini-table td { padding: 4px 0; border-bottom: 1px solid var(--line); }
.mini-table td.num { text-align: right; white-space: nowrap; padding-left: 12px; color: var(--muted); }
.mini-table td.num:last-child { color: inherit; }
.branch-docs { display: grid; gap: 3px; font-size: 14px; margin: 6px 0; }
.branch-docs:empty { display: none; }
.branch-add { display: block; padding: 12px 16px; border: 1.5px dashed var(--line); border-radius: 16px; text-align: center;
  color: var(--accent); text-decoration: none; margin-bottom: 8px; }
.branch-add:hover { border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 700px) {
  .branch-head .steps.compact { flex-basis: 100%; margin: 0; }
  .branch-body { padding-left: 12px; margin-left: 4px; }
  .stage-strip { display: grid; grid-template-columns: 1fr 1fr; }
  .stage { min-width: 0; }
}

/* «Документи»: вкладки-розділи над списками */
.docs-nav { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
.docs-nav a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 14px; color: var(--text);
  background: var(--glass); box-shadow: 0 0 0 1px var(--line); font-weight: 550; font-size: 14px; }
.docs-nav a .i { width: 18px; height: 18px; opacity: .75; }
.docs-nav a:hover { text-decoration: none; box-shadow: 0 0 0 1px var(--accent); }
.docs-nav a.active { color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--accent) 60%, transparent); }
@media (max-width: 600px) {
  .docs-nav { flex-wrap: nowrap; overflow-x: auto; margin-right: -12px; padding-right: 12px; scrollbar-width: none; }
  .docs-nav a { flex: none; }
}

/* Налаштування */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.settings-item { display: flex; gap: 14px; align-items: flex-start; color: var(--text); margin: 0; }
.settings-item:hover { text-decoration: none; box-shadow: var(--shadow), 0 0 0 1.5px var(--accent); }
.settings-item .i { width: 26px; height: 26px; flex: none; color: var(--accent); margin-top: 2px; }
.settings-item b { display: block; margin-bottom: 3px; }
.settings-item .muted { font-size: 14px; }
.client-branch .branch-line { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center;
  padding: 8px 0 8px 10px; margin-left: 4px; border-left: 2px solid var(--line); color: inherit; font-size: 14px; }
.client-branch .branch-line:hover { text-decoration: none; background: var(--accent-soft); }
.client-branch .branch-line .branch-dot { width: 10px; height: 10px; margin-left: -16px; }
.client-branch > .row { margin-bottom: 6px; }
.branch-add.small { padding: 7px 12px; margin: 8px 0 0; font-size: 14px; }
@media (max-width: 600px) { .client-branch .branch-line { grid-template-columns: auto 1fr; } .branch-state { grid-column: 2; } }
.branch-hint { font-size: 13.5px; margin: 6px 0 2px; }

/* ---------- Заголовок сторінки, панель інструментів ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-sub { margin: 6px 0 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.search-pill { display: flex; align-items: center; gap: 10px; flex: 1 1 280px; max-width: 460px; height: 44px; font-weight: 400; padding: 0 18px;
  border-radius: 999px; background: var(--card); border: 1px solid var(--glass-edge); box-shadow: var(--shadow); color: var(--muted); }
.search-pill input { border: 0; background: transparent; padding: 0; height: 100%; box-shadow: none; }
.search-pill input:focus { box-shadow: none; }
.search-pill .i { width: 19px; height: 19px; }
.ok-text { color: var(--ok); } .danger-text { color: var(--danger); } .warn-text { color: var(--warn); }

/* ---------- Клієнти картками ---------- */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.client-card { margin: 0; display: grid; gap: 16px; transition: transform .15s, box-shadow .15s; }
.client-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.client-card.off { opacity: .6; }
.client-top { display: flex; gap: 14px; align-items: center; color: var(--text); min-width: 0; }
.client-top:hover { text-decoration: none; }
.avatar { width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 600; font-size: 17px;
  color: var(--accent); background: var(--tint-accent); letter-spacing: .02em; }
.client-name { display: grid; min-width: 0; }
.client-name b { font-size: 15.5px; line-height: 1.25; }
.client-name .muted { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-figures { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--field); }
.client-figures div { display: grid; gap: 2px; }
.client-figures .muted { font-size: 12.5px; }
.client-figures b { font-size: 17px; letter-spacing: -0.02em; }
.client-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.client-actions { display: flex; gap: 6px; }
.client-actions .glass-btn { width: 40px; height: 40px; }

/* ---------- Головна: привітання, показники, події й сповіщення ---------- */
.hero { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; align-items: stretch; margin-bottom: 18px; }
.hero h1 { font-size: 36px; margin: 12px 0 8px; letter-spacing: -0.035em; }
.hero-sub { margin: 0 0 18px; color: var(--muted); font-size: 15px; max-width: 560px; }
.hero-sub b { color: var(--text); }
.date-chip { display: inline-flex; align-items: center; gap: 9px; padding: 7px 14px; border-radius: 999px; background: var(--card);
  border: 1px solid var(--glass-edge); box-shadow: var(--shadow); font-size: 13.5px; color: var(--muted); }
.date-chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--tint-ok); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-actions .btn { padding: 10px 18px; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.kpi { margin: 0; display: grid; align-content: space-between; gap: 14px; min-height: 148px; position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; right: -50px; bottom: -70px; width: 190px; height: 190px; border-radius: 50%;
  border: 26px solid var(--tint-accent); pointer-events: none; }
.kpi-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; color: var(--muted); font-weight: 500; }
.kpi-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff;
  box-shadow: 0 8px 18px rgba(91, 85, 240, .3); flex: none; }
.kpi-icon .i { width: 18px; height: 18px; }
.kpi b { font-size: 30px; letter-spacing: -0.035em; font-weight: 600; position: relative; z-index: 1; font-variant-numeric: tabular-nums; }
.kpi .muted { font-size: 13.5px; position: relative; z-index: 1; }
.chart-card { margin-bottom: 18px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.two-col > .card { margin: 0; }
.card-title { margin: 0 0 14px; font-size: 18px; }
.feed-item, .alert-item { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 12px 14px;
  border-radius: 18px; color: var(--text); margin-top: 8px; }
.feed-item { background: var(--field); }
.feed-item:hover, .alert-item:hover { text-decoration: none; filter: brightness(.985); }
.feed-icon, .alert-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; }
.feed-icon .i, .alert-icon .i { width: 20px; height: 20px; }
.feed-icon { background: var(--tint-info); color: var(--info); }
.feed-icon.pay { background: var(--tint-ok); color: var(--ok); }
.feed-icon.sign { background: var(--tint-accent); color: var(--accent); }
.feed-icon.approve { background: var(--tint-ok); color: var(--ok); }
.feed-icon.material { background: var(--tint-warn); color: var(--warn); }
.feed-text { display: grid; min-width: 0; line-height: 1.3; }
.feed-text b { font-size: 14.5px; }
.feed-text span { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-time { font-size: 13px; white-space: nowrap; }
.alert-item > .i { width: 18px; height: 18px; opacity: .6; }
.alert-item.danger { background: var(--tint-danger); } .alert-item.danger .alert-icon { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
.alert-item.warn { background: var(--tint-warn); } .alert-item.warn .alert-icon { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.alert-item.ok { background: var(--tint-ok); } .alert-item.ok .alert-icon { color: var(--ok); background: color-mix(in srgb, var(--ok) 15%, transparent); }
.alert-item.info { background: var(--tint-info); } .alert-item.info .alert-icon { color: var(--info); background: color-mix(in srgb, var(--info) 15%, transparent); }
.alert-item.accent { background: var(--tint-accent); } .alert-item.accent .alert-icon { color: var(--accent); background: color-mix(in srgb, var(--accent) 15%, transparent); }
.alert-item.muted { background: var(--field); } .alert-item.muted .alert-icon { color: var(--muted); background: var(--hover); }
.alert-item .feed-text span { color: var(--muted); }
@media (max-width: 1000px) {
  .hero, .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .hero h1 { font-size: 34px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { min-height: 140px; padding: 16px; }
  .kpi b { font-size: 22px; }
  .kpi-icon { width: 36px; height: 36px; }
  .hero-actions .btn { flex: 1 1 auto; padding: 11px 16px; }
  .feed-time { display: none; }
  .feed-item, .alert-item { grid-template-columns: auto 1fr; }
  .alert-item > .i { display: none; }
}
.avatar.tone-1 { color: var(--ok); background: var(--tint-ok); } .avatar.tone-2 { color: var(--warn); background: var(--tint-warn); }
.avatar.tone-3 { color: var(--info); background: var(--tint-info); } .avatar.tone-4 { color: var(--danger); background: var(--tint-danger); }
.client-foot .badge { white-space: nowrap; }
.mini-table { background: transparent; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
.mini-table td { padding: 7px 2px; }
.mini-table tr:hover > td { background: transparent; }
.kpi-head { position: relative; z-index: 1; }
@media (max-width: 600px) {
  .kpi::after { width: 130px; height: 130px; right: -45px; bottom: -55px; border-width: 18px; }
  .kpi-head { font-size: 13.5px; line-height: 1.25; }
  .kpi .kpi-icon { display: none; }
}
@media (max-width: 600px) { .chart-card .mini-stats { grid-template-columns: 1fr 1fr; } .chart-card .mini-stats b { font-size: 17px; } }
.theme-pick { display: flex; gap: 8px; }
.theme-pick button { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; }
.theme-pick button.on { background: var(--ink); color: var(--ink-text); border-color: transparent; }
.theme-pick .i { width: 18px; height: 18px; }

/* ---------- Рух: переходи між сторінками, поява карток, графік ---------- */
/* Між сторінками шапка й бічна панель стоять на місці, а темна «пігулка» меню перетікає до нового розділу. */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: .14s ease-out both vt-out; }
::view-transition-new(root) { animation: none; }
::view-transition-group(nav-pill), ::view-transition-group(tab-pill) { animation-duration: .38s; animation-timing-function: var(--ease); }
@keyframes vt-out { to { opacity: 0; } }
.rise { animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.hero-text > * { animation: rise .6s var(--ease) both; }
.hero-text > :nth-child(2) { animation-delay: .05s; } .hero-text > :nth-child(3) { animation-delay: .1s; }
.hero-text > :nth-child(4) { animation-delay: .15s; }
.vbar { transform-origin: bottom; animation: grow .9s var(--ease) both; }
.bar-group:nth-child(n) .vbar { animation-delay: calc(.25s + var(--b, 0) * 35ms); }
@keyframes grow { from { transform: scaleY(0); } }
.kpi::after { transition: transform .6s var(--ease); }
.kpi:hover::after { transform: scale(1.12) rotate(8deg); }
.kpi-icon { transition: transform .35s var(--ease); }
.kpi:hover .kpi-icon, .task:hover .task-icon { transform: rotate(-8deg) scale(1.06); }
.count { animation: pop .5s .4s var(--ease) both; }
@keyframes pop { from { transform: scale(0); } 70% { transform: scale(1.15); } }
.date-chip i { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px transparent; } }
.rail [data-tip]::after { opacity: 0; transition: opacity .15s, transform .2s var(--ease); }
.rail [data-tip]:hover::after { opacity: 1; }
.tab.active { view-transition-name: tab-pill; }
.tab { transition: background .25s var(--ease), color .2s, opacity .2s, transform .15s; }
.tab:active { transform: scale(.94); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  @view-transition { navigation: none; }
}

/* ---------- Пошук (Ctrl+K) ---------- */
.palette { position: fixed; inset: 0; z-index: 60; display: grid; place-items: start center; padding: 9vh 16px 16px; }
.palette[hidden] { display: none; }
.palette-scrim { position: absolute; inset: 0; background: rgba(20, 18, 28, .32); backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity .18s; }
.palette-box { position: relative; width: min(680px, 100%); max-height: min(620px, 80vh); display: grid; grid-template-rows: auto 1fr auto;
  background: var(--card); border: 1px solid var(--glass-edge); border-radius: 26px; box-shadow: 0 30px 80px rgba(20, 18, 30, .28);
  overflow: hidden; opacity: 0; transform: translateY(-10px) scale(.97); transition: opacity .18s, transform .25s var(--ease); }
.palette.open .palette-scrim { opacity: 1; }
.palette.open .palette-box { opacity: 1; transform: none; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--muted); }
.palette-input input { border: 0; background: transparent; padding: 6px 0; font-size: 17px; box-shadow: none; }
.palette-input input:focus { box-shadow: none; }
.palette-input kbd { cursor: pointer; }
.palette-list { overflow-y: auto; padding: 6px 10px 10px; overscroll-behavior: contain; }
.palette-group { padding: 12px 10px 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.palette-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 8px 10px;
  border-radius: 14px; color: var(--text); transition: background .12s; }
.palette-item:hover { text-decoration: none; }
.palette-item.on { background: var(--hover); background: color-mix(in srgb, var(--accent) 8%, var(--card)); }
.palette-icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--field); color: var(--muted); }
.palette-item.on .palette-icon { background: var(--accent); color: #fff; }
.palette-icon .i { width: 18px; height: 18px; }
.palette-text { display: grid; min-width: 0; line-height: 1.3; }
.palette-text span { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-go { color: var(--muted); opacity: 0; transform: translateX(-4px); transition: opacity .15s, transform .2s var(--ease); }
.palette-go .i { width: 16px; height: 16px; }
.palette-item.on .palette-go { opacity: 1; transform: none; }
.palette-empty { padding: 28px; text-align: center; color: var(--muted); margin: 0; }
.palette-foot { display: flex; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--line); font-size: 12.5px; }
.palette-foot kbd { margin-right: 4px; }
#palette-icons { display: none; }
@media (max-width: 600px) {
  .palette { padding: 0; place-items: stretch; }
  .palette-box { width: 100%; max-height: none; height: 100%; border-radius: 0; padding-top: env(safe-area-inset-top); }
  .palette-foot { display: none; }
}

/* ---------- Документи картками ---------- */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; margin-bottom: 14px; }
.doc-card { margin: 0; display: grid !important; gap: 12px; align-content: start; }
.doc-top { display: flex; gap: 12px; align-items: center; min-width: 0; }
.doc-icon { width: 42px; height: 42px; border-radius: 14px; flex: none; display: grid; place-items: center;
  color: var(--warn); background: var(--tint-warn); }
.doc-icon .i { width: 19px; height: 19px; }
.doc-icon.ok { color: var(--ok); background: var(--tint-ok); } .doc-icon.danger { color: var(--danger); background: var(--tint-danger); }
.doc-icon.off { color: var(--muted); background: var(--field); } .doc-icon.info { color: var(--info); background: var(--tint-info); }
.doc-title { display: grid; min-width: 0; line-height: 1.3; }
.doc-title b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-title .muted { font-size: 12.5px; }
.doc-client { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 13px; flex-wrap: wrap; }
.doc-foot > span:first-child { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.doc-sum { font-size: 15.5px; letter-spacing: -0.02em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-note { font-size: 12.5px; }
.crumbs { margin: 0 0 4px; font-size: 13.5px; color: var(--muted); }

/* ---------- Головна: що потребує уваги ---------- */
.section-head { display: flex; align-items: center; gap: 12px; margin: 26px 0 12px; }
.section-head h2 { margin: 0; }
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; margin-bottom: 18px; align-items: start; }
.task { margin: 0; scroll-margin-top: 90px; }
.task-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.task-head h2 { margin: 0; font-size: 16px; flex: 1; line-height: 1.25; }
.task-icon { width: 40px; height: 40px; border-radius: 13px; flex: none; display: grid; place-items: center; transition: transform .35s var(--ease); }
.task-icon .i { width: 19px; height: 19px; }
.task-count { min-width: 32px; height: 32px; padding: 0 10px; border-radius: 99px; display: grid; place-items: center;
  font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.task.warn .task-icon, .task.warn .task-count { color: var(--warn); background: var(--tint-warn); }
.task.danger .task-icon, .task.danger .task-count { color: var(--danger); background: var(--tint-danger); }
.task.ok .task-icon, .task.ok .task-count { color: var(--ok); background: var(--tint-ok); }
.task.accent .task-icon, .task.accent .task-count { color: var(--accent); background: var(--tint-accent); }
.task.info .task-icon, .task.info .task-count { color: var(--info); background: var(--tint-info); }
.task.muted .task-icon, .task.muted .task-count { color: var(--muted); background: var(--field); }
.task.warn { box-shadow: var(--shadow), inset 0 3px 0 color-mix(in srgb, var(--warn) 70%, transparent); }
.task.danger { box-shadow: var(--shadow), inset 0 3px 0 color-mix(in srgb, var(--danger) 70%, transparent); }
.task-body > p.muted:first-child { margin-top: 0 !important; font-size: 13.5px; }
.task-body .row { padding: 10px 12px; margin-top: 6px; border-radius: 14px; background: var(--field); border: 0 !important; font-size: 14px;
  transition: background .2s; }
.task-body .row:hover { background: color-mix(in srgb, var(--accent) 6%, var(--field)); }
.task-body .row > h1, .task-body .row > h2 { margin: 0; }
.kpi.hot { box-shadow: var(--shadow), 0 0 0 1.5px color-mix(in srgb, var(--warn) 55%, transparent); }
.money-kpis { display: grid; gap: 14px; }
.money-kpis .kpi { min-height: 0; }

/* ---------- Новий договір: вибір клієнта ---------- */
.pick-card { display: grid !important; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; margin: 0; }
.pick-card.new { border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 4%, var(--card));
  grid-template-columns: auto 1fr; }
.pick-card.new .avatar { background: var(--brand); color: #fff; }
.pick-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.pick-meta .i { width: 18px; height: 18px; transition: transform .25s var(--ease); }
.pick-card:hover .pick-meta .i { transform: translate(2px, -2px); color: var(--accent); }
.pick-card[hidden] { display: none !important; }

/* ---------- Налаштування ---------- */
.theme-card { gap: 14px; }
.theme-pick { flex-wrap: wrap; }
.theme-pick button { transition: background .2s, color .2s; }

/* ---------- Телефон ---------- */
@media (max-width: 1099px) {
  .bar { padding: 6px; }
  .brand-text small { max-width: 46vw; }
}
@media (max-width: 600px) {
  h1 { font-size: 24px; }
  .hero h1 { font-size: 30px; margin-top: 10px; }
  .hero-sub { font-size: 14.5px; }
  .task-grid { grid-template-columns: 1fr; }
  .task-body .row { flex-direction: column; align-items: stretch; gap: 8px; }
  .task-body .row .actions { justify-content: space-between; }
  .doc-grid { grid-template-columns: 1fr; gap: 10px; }
  .doc-card { gap: 10px; }
  .client-grid { grid-template-columns: 1fr; gap: 12px; }
  .page-head { align-items: flex-start; }
  .page-head .btn { padding: 8px 14px; }
  .toolbar { gap: 10px; }
  .search-pill { max-width: none; flex-basis: 100%; }
  .row > h1 { font-size: 24px; }
  .tab { min-width: 0; flex: 1; padding: 7px 6px 6px; }
  .tabbar { left: 10px; right: 10px; transform: none; justify-content: space-between; }
  .pick-card { grid-template-columns: auto 1fr; }
  .pick-meta { display: none; }
}

/* ---------- Податки картками ---------- */
.tax-entity { margin-bottom: 34px; scroll-margin-top: 90px; }
.tax-head { display: flex; align-items: center; gap: 14px; margin: 6px 0 14px; flex-wrap: wrap; }
.tax-head-text { display: grid; gap: 2px; flex: 1; min-width: 200px; }
.tax-head-text h2 { margin: 0; font-size: 20px; }
.tax-head-text .muted { font-size: 13.5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tax-dps-chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--field); color: var(--muted); }
.tax-dps-chip .i { width: 16px; height: 16px; }
.tax-dps-chip.ok { background: var(--tint-ok); color: var(--ok); } .tax-dps-chip.warn { background: var(--tint-warn); color: var(--warn); }
.tax-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 6px; }
.tax-kpi { min-height: 140px; }
.tax-kpi b { font-size: 26px; }
.tax-limit-mini { display: grid; gap: 6px; position: relative; z-index: 1; }
.tax-limit-mini .muted { font-size: 12.5px; }
.tax-parts { display: grid; gap: 2px; margin-top: 8px; position: relative; z-index: 1; font-size: 13px; }
.tax-parts a { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; color: inherit; text-decoration: none; border-top: 1px solid var(--line); }
.tax-parts a:first-child { border-top: 0; }
.tax-parts a span { color: var(--muted); } .tax-parts a:hover span { color: var(--text); }
.tax-kpi .tax-parts b { font-size: 13px; font-weight: 700; letter-spacing: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.limit-bar span { transform-origin: left; animation: grow-x 1s .3s var(--ease) both; }
@keyframes grow-x { from { transform: scaleX(0); } }
.section-head h3 { margin: 0; font-size: 16px; }
.due-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.due-card { margin: 0; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; }
.due-card.soon { box-shadow: var(--shadow), inset 3px 0 0 var(--warn); }
.due-date { width: 54px; height: 58px; border-radius: 16px; display: grid; place-content: center; text-align: center; line-height: 1.05;
  background: var(--accent-soft); color: var(--accent); }
.due-card.soon .due-date { background: var(--tint-warn); color: var(--warn); }
.due-date b { font-size: 22px; letter-spacing: -0.03em; } .due-date span { font-size: 12px; font-weight: 600; text-transform: uppercase; }
.due-text { display: grid; gap: 2px; min-width: 0; line-height: 1.3; }
.due-text b { font-size: 14.5px; }
.due-text .muted { font-size: 13px; }
.due-hint { font-size: 12px; max-width: 130px; text-align: right; }
.tax-q { margin: 0; padding: 16px; border: 1px solid var(--glass-edge); }
.tax-dps { margin: 0; }
.settle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.settle-card { display: grid; gap: 10px; padding: 14px; border-radius: 16px; background: var(--field); }
.settle-card.debt { background: var(--tint-danger); }
.settle-name { font-size: 14px; }
.settle-figures { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; font-size: 14px; font-variant-numeric: tabular-nums; }
.settle-figures > span { display: grid; }
.settle-figures .muted { font-size: 12px; }
.settle-card .btn { justify-self: start; }
@media (max-width: 600px) {
  .due-grid { grid-template-columns: 1fr; }
  .due-card { grid-template-columns: auto 1fr; }
  .due-card > .btn, .due-card > .due-hint { grid-column: 1 / -1; justify-self: stretch; text-align: left; max-width: none; }
  .tax-kpis { grid-template-columns: 1fr; }
  .tax-dps-chip { order: 3; }
}

.person-card { margin: 0; display: grid; gap: 14px; }
.person-badges { display: flex; gap: 6px; flex-wrap: wrap; min-height: 4px; }
.person-badges:empty { display: none; }
.doc-card.person .avatar { width: 42px; height: 42px; font-size: 15px; }
a.card.kpi { display: grid; }
/* Справи на головній — щільно, як цеглинки: колонки замість рядків, без порожніх проміжків */
.task-grid { display: block; columns: 3 340px; column-gap: 14px; }
.task-grid > .task { break-inside: avoid; margin: 0 0 14px; display: block; width: 100%; }
@media (max-width: 600px) { .task-grid { columns: 1; } }
.pick-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.pick-card .client-name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Форми: дві колонки на широкому екрані, короткий вибір — картками ---------- */
.form-card { max-width: 960px; }
form.form-grid { max-width: none; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; align-items: start; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid .field { display: grid; gap: 6px; }
.form-grid label.field > span:first-child { font-weight: 600; }
fieldset.choice { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.choice legend { font-weight: 600; font-size: 14px; padding: 0; margin-bottom: 8px; }
.choice-row { display: flex; flex-wrap: wrap; gap: 10px; }
.choice-card { flex: 1 1 200px; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 16px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--field); font-weight: 500; transition: border-color .2s, background .2s, box-shadow .2s; }
.choice-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.choice-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 4px var(--accent-soft); }
.choice-card input { flex: none; }
@media (max-width: 760px) { form.form-grid { grid-template-columns: 1fr; } }

/* ---------- Плюс у бічній панелі й меню «Що додати?» ---------- */
.rail .rail-add { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 20px; border: 0; cursor: pointer; position: relative;
  background: var(--ink); color: var(--ink-text); box-shadow: 0 10px 22px rgba(20, 18, 30, .22);
  transition: transform .25s var(--ease), box-shadow .25s; margin-bottom: 4px; }
.rail-add .i { width: 22px; height: 22px; transition: transform .3s var(--ease); }
.rail .rail-add:hover { background: var(--ink); color: var(--ink-text); transform: translateY(-2px); box-shadow: 0 14px 28px rgba(20, 18, 30, .28); }
.rail-add:hover .i { transform: rotate(90deg); }
.rail-add:active { transform: scale(.94); }
.rail-add[data-tip]:hover::after { content: attr(data-tip); position: absolute; left: 66px; top: 50%; transform: translateY(-50%);
  white-space: nowrap; padding: 6px 12px; border-radius: 10px; background: var(--ink); color: var(--ink-text); font-size: 13px; font-weight: 500; }
@media (min-width: 1100px) { .rail { top: 96px; } .add-sm { display: none; } }
.rail a.on { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 45%, transparent); }
.rail a.on:hover { background: var(--accent-soft); color: var(--accent); }
.add-menu .palette-box { width: min(620px, 100%); grid-template-rows: auto 1fr; padding: 8px 8px 12px; }
.add-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 8px 16px; }
.add-head h2 { margin: 0; font-size: 20px; }
.add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 6px 8px; overflow-y: auto; }
.add-item { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 18px; background: var(--field); color: var(--text);
  border: 1.5px solid transparent; transition: border-color .2s, background .2s, transform .2s var(--ease); }
.add-item:hover, .add-item:focus-visible { text-decoration: none; outline: none; border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 6%, var(--field)); transform: translateY(-2px); }
.add-icon { width: 44px; height: 44px; border-radius: 14px; flex: none; display: grid; place-items: center; background: var(--card); color: var(--accent);
  box-shadow: var(--shadow); }
.add-item:hover .add-icon { background: var(--accent); color: #fff; }
.add-menu.open .add-item { animation: rise .35s var(--ease) both; }
.add-menu.open .add-item:nth-child(2) { animation-delay: .03s; } .add-menu.open .add-item:nth-child(3) { animation-delay: .06s; }
.add-menu.open .add-item:nth-child(4) { animation-delay: .09s; } .add-menu.open .add-item:nth-child(5) { animation-delay: .12s; }
.add-menu.open .add-item:nth-child(6) { animation-delay: .15s; }
@media (max-width: 600px) {
  .add-grid { grid-template-columns: 1fr; }
  .add-menu .palette-box { height: auto; max-height: 100%; align-self: end; border-radius: 26px 26px 0 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .add-menu.palette { place-items: end stretch; }
  .add-sm { background: var(--ink); color: var(--ink-text); border-color: transparent; }
}

/* ---------- Позначки на вкладках «Документів» ---------- */
.docs-nav a { padding: 9px 15px; }
.nav-count { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.nav-count.warn { color: var(--warn); background: var(--tint-warn); }
.nav-count.info { color: var(--info); background: var(--tint-info); }
.nav-count.danger { color: var(--danger); background: var(--tint-danger); }

/* ---------- Сторінка «Чекає вашого підпису» ---------- */
.big-count { min-width: 56px; height: 56px; padding: 0 16px; border-radius: 20px; display: grid; place-items: center; font-size: 26px; font-weight: 700;
  color: var(--warn); background: var(--tint-warn); }
.sign-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-bottom: 8px; }
.sign-card { margin: 0; display: grid; gap: 14px; transition: transform .25s var(--ease), box-shadow .25s; position: relative; overflow: hidden; }
.sign-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--warn), color-mix(in srgb, var(--warn) 20%, transparent)); }
.sign-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.sign-card-top { display: flex; align-items: center; gap: 12px; }
.sign-card-top .doc-title { flex: 1; }
.sign-kind { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.sign-client { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.avatar.small { width: 30px; height: 30px; font-size: 12px; }
.sign-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; padding: 12px 14px; border-radius: 16px;
  background: var(--field); font-size: 14px; }
.sign-facts > span { display: grid; gap: 2px; min-width: 0; }
.sign-facts > span > :last-child, .sign-facts > span { overflow: hidden; text-overflow: ellipsis; }
.sign-facts .muted { font-size: 12px; }
.sign-by { display: flex; gap: 6px; align-items: center; margin: -4px 0 0; font-size: 13px; }
.sign-by .i { width: 15px; height: 15px; color: var(--ok); }
.sign-actions { display: flex; gap: 8px; }
.sign-actions .btn { flex: 1; }
.empty-state { text-align: center; padding: 40px 20px; max-width: 560px; margin: 20px auto; }
.empty-state h2 { margin: 12px 0 6px; }
.empty-icon { width: 64px; height: 64px; border-radius: 22px; display: inline-grid; place-items: center; color: var(--ok); background: var(--tint-ok); }
.empty-icon .i { width: 28px; height: 28px; }

/* ---------- Головна: ширші справи ---------- */
.task-grid { columns: 2 460px; column-gap: 18px; }
.task-grid > .task { margin-bottom: 18px; padding: 20px; }
.task-head { margin-bottom: 14px; gap: 14px; }
.task-head h2 { font-size: 17px; }
.task-head h2 a { color: inherit; }
.task-head h2 a:hover { color: var(--accent); text-decoration: none; }
.task-icon { width: 44px; height: 44px; border-radius: 15px; }
.task-body { display: grid; gap: 8px; }
.task-body > p.muted:first-child { margin: 0 0 4px !important; }
.task-body .row { margin: 0; padding: 12px 14px; border-radius: 16px; gap: 10px 14px; align-items: center; }
.task-body .row > span:first-child { flex: 1 1 260px; min-width: 0; line-height: 1.4; }
.task-body .row .actions { flex: none; align-items: center; }
.task-body .row b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hero { margin-bottom: 8px; }
.hero-text { padding: 6px 0; }
@media (max-width: 600px) { .task-grid { columns: 1; } .task-grid > .task { padding: 16px; } }
.add-item .palette-text span { white-space: normal; }
.form-page { max-width: 960px; margin: 0 auto; }
.form-page .form-card { max-width: none; }

/* ---------- Бічна панель: компактніша, плюс — спокійний ---------- */
@media (min-width: 1100px) {
  .rail { gap: 10px; top: 92px; }
  main { padding-left: 76px; }
}
.rail-group { gap: 4px; padding: 5px; }
.rail a, .rail button { width: 38px; height: 38px; }
.rail .i { width: 18px; height: 18px; }
.rail [data-tip]:hover::after { left: 46px; }
.rail .rail-add { width: 48px; height: 48px; border-radius: 16px; margin: 0;
  background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent); }
.rail .rail-add:hover { background: var(--accent); color: #fff; box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 28%, transparent); }
.rail .rail-add .i { width: 19px; height: 19px; }
.rail-add[data-tip]:hover::after { left: 56px; }
.count { min-width: 17px; height: 17px; font-size: 10.5px; top: 0; right: -2px; }
@media (max-width: 600px) { .add-sm { background: var(--accent-soft); color: var(--accent); } }

/* ---------- Головна: заголовок, показники, справи вкладками, етапи документів ---------- */
.home-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin: 6px 0 18px; }
.home-head h1 { font-size: 32px; margin: 0 0 6px; letter-spacing: -0.035em; animation: rise .6s var(--ease) both; }
.home-head .hero-sub { margin: 0; }
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.tile { margin: 0; display: grid !important; gap: 6px; padding: 16px 18px; }
.tile-head { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.tile-icon { width: 32px; height: 32px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent);
  transition: transform .35s var(--ease); }
.tile-icon .i { width: 16px; height: 16px; }
.tile:hover .tile-icon { transform: rotate(-8deg) scale(1.08); }
.tile.warn .tile-icon { background: var(--tint-warn); color: var(--warn); }
.tile.danger .tile-icon { background: var(--tint-danger); color: var(--danger); }
.tile b { font-size: 24px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .muted { font-size: 12.5px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; align-items: start; }
.home-grid > .card { margin: 0; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 17px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.seg-btn { display: inline-flex; align-items: center; gap: 8px; padding: 7px 8px 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; transition: background .2s, color .2s, border-color .2s; }
.seg-btn span { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--field); color: var(--muted); }
.seg-btn.warn span { background: var(--tint-warn); color: var(--warn); } .seg-btn.danger span { background: var(--tint-danger); color: var(--danger); }
.seg-btn.ok span { background: var(--tint-ok); color: var(--ok); } .seg-btn.accent span { background: var(--tint-accent); color: var(--accent); }
.seg-btn.info span { background: var(--tint-info); color: var(--info); }
.seg-btn:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.seg-btn[aria-selected="true"] { background: var(--ink); color: var(--ink-text); border-color: transparent; }
.task-panel[hidden] { display: none; }
.task-panel { animation: rise .35s var(--ease) both; }
.task-panel .task-head { display: none; }
.task-panel .task-body { display: grid; gap: 8px; }
.task-panel .task-body > p.muted:first-child { margin: 0 0 2px !important; font-size: 13.5px; }
.task-panel .row { margin: 0; padding: 12px 14px; border-radius: 16px; background: var(--field); border: 0 !important; gap: 10px 14px;
  align-items: center; font-size: 14px; transition: background .2s; }
.task-panel .row:hover { background: color-mix(in srgb, var(--accent) 6%, var(--field)); }
.task-panel .row > span:first-child { flex: 1 1 260px; min-width: 0; line-height: 1.4; }
.task-panel .row b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.pipeline { display: grid; gap: 14px; }
.stage-row { display: grid; gap: 7px; color: var(--text); }
.stage-row:hover { text-decoration: none; }
.stage-top { display: flex; justify-content: space-between; font-size: 14px; }
.stage-top b { font-size: 16px; font-variant-numeric: tabular-nums; }
.stage-bar { height: 10px; border-radius: 99px; background: var(--field); overflow: hidden; }
.stage-bar span { display: block; height: 100%; min-width: 10px; border-radius: 99px; background: var(--muted); opacity: .45;
  transform-origin: left; animation: grow-x .9s .2s var(--ease) both; }
.stage-row.info .stage-bar span { background: var(--info); opacity: 1; } .stage-row.warn .stage-bar span { background: var(--warn); opacity: 1; }
.stage-row.ok .stage-bar span { background: var(--ok); opacity: 1; }
.stage-row:hover .stage-top span { color: var(--accent); }
.pipeline-note { font-size: 12.5px; margin: 16px 0 0; }
.events-card .feed-item { margin-top: 6px; }
.empty-state.small { padding: 18px; margin: 0 auto; }
.empty-state.small h3 { margin: 10px 0 4px; }
@media (max-width: 1000px) { .home-grid { grid-template-columns: 1fr; } .kpi-row { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) {
  .home-head h1 { font-size: 26px; }
  .home-head .hero-actions { width: 100%; }
  .kpi-row { gap: 10px; } .tile { padding: 14px; } .tile b { font-size: 19px; }
  .seg { flex-wrap: nowrap; overflow-x: auto; margin-right: -16px; padding-right: 16px; scrollbar-width: none; }
  .seg-btn { flex: none; }
  .task-panel .row { flex-direction: column; align-items: stretch; }
}
.stage-bar span { min-width: 0; }
.home-grid .chart-card .mini-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.home-grid .chart-card .mini-stats b { font-size: 17px; }
.home-grid .chart-card .mini-stats .muted { font-size: 12px; }
@media (max-width: 600px) { .home-grid .chart-card .mini-stats { grid-template-columns: 1fr 1fr; } }
.home-grid.stretch { align-items: stretch; }
.events-card { display: flex; flex-direction: column; }
.events-card .card-head .btn { margin-left: auto; }
.events-day { padding: 8px 14px 14px; }
@media (max-width: 600px) {
  .task-panel .row > span:first-child { flex: 0 0 auto; }
  .task-panel .row .actions, .task-panel .row > .btn, .task-panel .row > form { align-self: stretch; }
  .task-panel .row .actions { justify-content: space-between; }
  .tabbar { gap: 0; padding: 5px; }
  .tab { flex: 1 1 auto; min-width: 0; padding: 7px 4px 6px; font-size: 10.5px; letter-spacing: -0.02em; }
  .tab span { white-space: nowrap; }
}
@media (max-width: 1000px) { .home-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Списки документів на телефоні: заголовок, кнопки, фільтри й вкладки — без злипання й обрізання ---------- */
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.filter-tabs { max-width: 100%; }
@media (max-width: 600px) {
  .docs-nav { gap: 6px; margin: 0 -12px 16px; padding: 2px 12px 4px; scroll-padding: 12px;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .docs-nav a { padding: 8px 12px; font-size: 13.5px; }
  .nav-count { font-size: 10.5px; padding: 1px 6px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 14px; }
  .page-head .actions { display: grid; grid-template-columns: 1fr 1fr; }
  .page-head .actions .btn { width: 100%; padding: 10px 12px; }
  .page-head .actions .btn:only-child { grid-column: 1 / -1; }
  .page-head > .btn { align-self: stretch; }
  .filter-tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -12px 16px; padding: 4px;
    border-radius: 0; background: none; border: 0; box-shadow: none; gap: 6px; padding-left: 12px; padding-right: 12px; }
  .filter-tabs::-webkit-scrollbar, .docs-nav::-webkit-scrollbar, .seg::-webkit-scrollbar { display: none; }
  .filter-tabs a { flex: none; white-space: nowrap; background: var(--card); border: 1px solid var(--line); }
  .filter-tabs a.active { border-color: transparent; }
  .doc-foot { gap: 8px 10px; }
  .doc-foot .badge { white-space: normal; }
}

/* Сплата податку: перераховано → сплачено */
.pay-state { font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 999px; text-align: center; max-width: 170px; line-height: 1.3; }
.pay-state.wait { color: var(--warn); background: var(--tint-warn); }
.pay-state.ok { color: var(--ok); background: var(--tint-ok); }
.pay-sent { display: grid; gap: 6px; margin-top: 12px; justify-items: start; }
@media (max-width: 600px) { .due-card > .pay-state { grid-column: 1 / -1; max-width: none; } }

/* Від ДПС: картка на головній і листи */
.side-stack { display: grid; gap: 14px; align-content: start; }
.side-stack > .card { margin: 0; }
.dps-card .card-head .btn { margin-left: auto; }
.dps-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; margin-top: 6px;
  border-radius: 14px; background: var(--field); color: var(--text); transition: background .2s; }
.dps-item:hover { text-decoration: none; background: color-mix(in srgb, var(--accent) 6%, var(--field)); }
.dps-dot { width: 9px; height: 9px; border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.dps-item.unseen .dps-dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dps-item.demand.unseen { background: var(--tint-danger); }
.dps-item.demand.unseen .dps-dot { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent); }
.dps-item .feed-text b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.letter-card.unseen { box-shadow: var(--shadow), inset 3px 0 0 var(--accent); }

/* Новий клієнт за кодом */
.quick-client { display: grid; gap: 16px; }
.quick-client .kind-pick .choice-card { flex: 1 1 150px; padding: 10px 14px; }
.code-field input { font-size: 22px; letter-spacing: .08em; padding: 14px 16px; font-variant-numeric: tabular-nums; }
.found { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; margin: 0; padding: 14px 16px;
  background: var(--tint-ok); border-color: transparent; box-shadow: none; animation: rise .35s var(--ease) both; }
.found[hidden] { display: none; }
.found > div { display: grid; min-width: 0; }
.found .muted { font-size: 13px; }
.alert-line { margin: 0; padding: 10px 14px; border-radius: 14px; background: var(--tint-warn); font-size: 14px; }
.more-fields summary { cursor: pointer; color: var(--accent); font-weight: 500; }
@media (max-width: 600px) { .found { grid-template-columns: auto 1fr; } .found .badge { grid-column: 2; justify-self: start; } }

/* Декларація */
.decl-problems { background: var(--tint-warn); border-color: transparent; box-shadow: none; }
.decl-problems ul { margin: 6px 0 0; padding-left: 20px; }
.decl-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.decl-grid > .card { margin: 0; }
.decl-rows { display: grid; gap: 4px; }
.decl-row { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 9px 12px; border-radius: 12px;
  font-size: 14px; font-variant-numeric: tabular-nums; }
.decl-row:nth-child(odd) { background: var(--field); }
.decl-row.total { background: var(--accent-soft); }
.decl-code { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.decl-facts { display: grid; gap: 10px; font-size: 14px; }
.decl-facts > span, .decl-kved { display: grid; gap: 2px; }
.decl-facts .muted, .decl-kved > .muted { font-size: 12px; }
.decl-kved { margin-top: 12px; font-size: 14px; }
.decl-send code { font-size: 12px; word-break: break-all; }
@media (max-width: 900px) { .decl-grid { grid-template-columns: 1fr; } }
.decl-send .msg { display: none; padding: 10px 12px; border-radius: 12px; font-size: 14px; }
.decl-send .msg.err { display: block; color: var(--danger); background: var(--tint-danger); }
.decl-send .msg.info { display: block; background: var(--accent-soft); }
.filing { display: grid; gap: 2px; padding: 10px 12px; border-radius: 14px; margin-top: 10px; font-size: 14px; color: var(--text); }
.filing.sent, .filing.receipt { background: var(--tint-ok); }
.filing.rejected { background: var(--tint-danger); }
.filing.receipt:hover { text-decoration: none; filter: brightness(.98); }

.letter-card .doc-top { color: var(--text); }
.letter-card .doc-top:hover { text-decoration: none; color: var(--accent); }
.letter-card .doc-foot form { margin: 0; }
.read-all { margin: -6px 0 12px; }
.dps-card .linkish { font-size: 13px; }
.main-stack { display: grid; gap: 14px; align-content: start; min-width: 0; }
.main-stack > .card, .side-stack > .card { margin: 0; }
.chart-card .row h2 { margin: 0; }

/* Головна: колонки закінчуються рівно — останній блок зліва добирає висоту */
.home-grid { align-items: stretch; }
.main-stack, .side-stack { display: flex; flex-direction: column; gap: 14px; }
.main-stack > .card:last-child { flex: 1; }
.taxes-card { display: flex; flex-direction: column; }
.due-row { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 10px 12px; margin-top: 6px;
  border-radius: 16px; background: var(--field); color: var(--text); transition: background .2s; }
.due-row:hover { text-decoration: none; background: color-mix(in srgb, var(--accent) 6%, var(--field)); }
.due-row .due-date { width: 46px; height: 50px; border-radius: 14px; }
.due-row .due-date b { font-size: 18px; } .due-row .due-date span { font-size: 11px; }
.due-row.soon .due-date { background: var(--tint-warn); color: var(--warn); }
.due-sum { white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 1000px) { .main-stack > .card:last-child { flex: none; } }
.side-stack > .card:last-child { flex: 1; }
.taxes-card .card-head .btn, .events-card .card-head .btn { margin-left: auto; }
@media (max-width: 1000px) { .side-stack > .card:last-child { flex: none; } }

/* Новий клієнт — покроково */
.wizard-page { max-width: 820px; }
.wz-steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 16px; overflow-x: auto; scrollbar-width: none; }
.wz-steps li { flex: 1; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; background: var(--card);
  border: 1px solid var(--line); font-size: 13.5px; color: var(--muted); white-space: nowrap; transition: background .25s, color .25s; }
.wz-steps li span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--field); flex: none; }
.wz-steps li.now { color: var(--ink-text); background: var(--ink); border-color: transparent; }
.wz-steps li.now span { background: var(--accent); color: #fff; }
.wz-steps li.done { color: var(--ok); background: var(--tint-ok); border-color: transparent; }
.wz-steps li.done span { background: var(--ok); color: #fff; }
.wizard { display: grid; gap: 16px; padding: 24px; }
.wz { display: grid; gap: 14px; animation: rise .35s var(--ease) both; }
.wz[hidden] { display: none; }
.wz h2 { margin: 0; font-size: 20px; }
.wz-note { margin: -6px 0 0; font-size: 13.5px; }
.wz .wide-2 { grid-column: 1 / -1; }
.kind-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.kind-card { display: grid; gap: 8px; align-content: start; padding: 18px; border-radius: 20px; border: 1.5px solid var(--line);
  background: var(--field); cursor: pointer; font-weight: 400; transition: border-color .2s, background .2s, transform .2s var(--ease); }
.kind-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.kind-card input { position: absolute; opacity: 0; pointer-events: none; }
.kind-card b { font-size: 16px; }
.kind-card .muted { font-size: 13px; line-height: 1.4; }
.kind-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--card); color: var(--accent); }
.kind-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 4px var(--accent-soft); }
.kind-card:has(input:checked) .kind-icon { background: var(--accent); color: #fff; }
.wz-error { margin: 0; padding: 10px 14px; border-radius: 14px; background: var(--tint-danger); color: var(--danger); font-size: 14px; }
.wz-actions { display: flex; gap: 10px; align-items: center; padding-top: 6px; border-top: 1px solid var(--line); }
.wz-actions #next, .wz-actions #save { margin-left: auto; }
.wz-actions #back .i { transform: rotate(-135deg); }
@media (max-width: 700px) {
  .kind-cards { grid-template-columns: 1fr; }
  .wz-steps li { flex: none; }
  .wizard { padding: 16px; }
  .wz-actions { flex-wrap: wrap; }
  .wz-actions #next, .wz-actions #save { flex: 1; }
}
[hidden] { display: none !important; }
.wz .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 700px) { .wz .grid2 { grid-template-columns: 1fr; } }

/* Головна: події тягнуться до низу лівої колонки — список не задає висоту, а вміщає скільки влізе */
.events-fill { position: relative; flex: 1; min-height: 250px; }
.events-list { position: absolute; inset: 0; overflow: hidden; }
@media (max-width: 1000px) {
  .events-fill { position: static; min-height: 0; }
  .events-list { position: static; }
}

/* Цифри у вкладках документів: скільки в кожній; де щось чекає саме на вас — помітно */
.tabs a { display: inline-flex; align-items: center; gap: 6px; }
.tab-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--hover); color: var(--muted); font-size: 11.5px; font-weight: 700; line-height: 1; }
.tabs a.active .tab-count { background: rgba(255, 255, 255, .18); color: inherit; }
.tab-count.todo { background: #e5484d; color: #fff; }

/* ---------- Картки даних: шапка сторінки з головним і плитки «назва — значення» ---------- */
.hero-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 18px 20px; margin-bottom: 14px;
  animation: rise-in .5s cubic-bezier(.2, .8, .2, 1) both; }
.hero-card .avatar.big { width: 56px; height: 56px; border-radius: 18px; font-size: 19px; }
.hero-card h1 { margin: 0; font-size: 26px; letter-spacing: -0.03em; line-height: 1.15; }
.hero-sub { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 6px; color: var(--muted); font-size: 13.5px; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.hero-actions form { margin: 0; }
.hero-stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.hero-stat { padding: 10px 12px; border-radius: 14px; background: var(--hover); }
.hero-stat b { display: block; font-size: 19px; letter-spacing: -0.02em; }
.hero-stat span { color: var(--muted); font-size: 12.5px; }
.hero-stat.warn b { color: #e5484d; }
.hero-stat.ok b { color: var(--ok, #1f9d55); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin: 0 0 18px; }
.fact { position: relative; display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; background: var(--card);
  border: 1px solid var(--line); min-width: 0; animation: rise-in .45s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--n, 0) * 35ms);
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s; }
.fact:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -20px rgba(20, 20, 60, .35); }
.fact.wide { grid-column: 1 / -1; }
.fact-ico { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--hover); color: var(--accent, #4a52f2); }
.fact-ico .i { width: 17px; height: 17px; }
.fact-body { min-width: 0; flex: 1; }
.fact-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.fact-value { display: block; margin-top: 2px; font-size: 14.5px; font-weight: 600; overflow-wrap: anywhere; }
.fact-value.empty { color: var(--muted); font-weight: 500; }
.fact-value a { font-weight: 600; }
.fact .copy-btn { position: absolute; top: 8px; right: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 4px 6px;
  border-radius: 8px; font-size: 12px; opacity: 0; transition: opacity .2s, background .2s; }
.fact:hover .copy-btn { opacity: 1; }
.fact .copy-btn:hover { background: var(--hover); color: var(--text); }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 22px 0 10px; }
.section-title-row h2 { margin: 0; }
@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { .hero-card, .fact { animation: none; } }
@media (max-width: 700px) {
  .hero-card { grid-template-columns: auto minmax(0, 1fr); }
  .hero-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .hero-card h1 { font-size: 22px; }
}

/* ---------- Податки: синхронізація, скасування позначки, картка платника ---------- */
.tax-dps-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin-left: auto; }
.tax-sync { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.tax-sync .i { width: 14px; height: 14px; }
.pay-stack { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.undo-pay { font-size: 12px; color: var(--muted); text-decoration: underline dotted; text-underline-offset: 3px; }
.undo-pay:hover { color: var(--danger); }
.tax-dps .facts { margin-bottom: 12px; }
.payer-card { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; margin-top: 10px; }
.payer-block { padding: 12px 14px; border-radius: 14px; background: var(--hover); }
.payer-block > b { display: block; font-size: 13px; margin-bottom: 6px; }
.payer-block dl { margin: 0; display: grid; gap: 4px; }
.payer-block dl div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 8px; font-size: 13px; }
.payer-block dt { color: var(--muted); font-weight: 500; }
.payer-block dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .tax-dps-side { align-items: flex-start; margin-left: 0; }
  .pay-stack { align-items: flex-start; }
}

/* ---------- Документ: значок у шапці й рядки послуг картками ---------- */
.doc-ico.big { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.doc-ico.big .i { width: 26px; height: 26px; }
.fact-ico { background: var(--accent-soft); color: var(--accent); }
.lines-card { padding: 6px 8px; margin-bottom: 18px; }
.line-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 10px; border-radius: 12px;
  animation: rise-in .4s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--n, 0) * 40ms); transition: background .2s; }
.line-row + .line-row { border-top: 1px solid var(--line); }
.line-row:hover { background: var(--hover); }
.line-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--hover); color: var(--muted); font-size: 12px; font-weight: 700; }
.line-text { display: flex; flex-direction: column; min-width: 0; }
.line-text b { font-weight: 600; overflow-wrap: anywhere; }
.line-text .muted { font-size: 12.5px; }
.line-sum { font-weight: 700; white-space: nowrap; }
.line-total { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 4px 2px 2px; padding: 12px 10px 8px;
  border-top: 2px solid var(--line); font-weight: 600; }
.line-total b { font-size: 18px; letter-spacing: -0.02em; }
.material-preview-card { padding: 10px; margin-bottom: 18px; }
.material-preview-card .material-preview { margin: 0; width: 100%; border-radius: 12px; }

/* ---------- Довідка: шапка з пошуком, картки тем, зміст збоку, розділи з появою ---------- */
.help-hero { text-align: center; padding: 18px 0 8px; animation: rise-in .5s cubic-bezier(.2, .8, .2, 1) both; }
.help-hero-ico { width: 60px; height: 60px; margin: 0 auto 10px; border-radius: 20px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); }
.help-hero-ico .i { width: 28px; height: 28px; }
.help-hero h1 { margin: 0; font-size: 34px; letter-spacing: -0.035em; }
.help-hero p { color: var(--muted); margin: 6px auto 0; max-width: 560px; }
.help-search { position: relative; display: block; max-width: 520px; margin: 18px auto 0; }
.help-search .i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.help-search input { width: 100%; height: 48px; padding: 0 18px 0 46px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  font-size: 15px; box-shadow: 0 12px 30px -22px rgba(20, 20, 60, .35); transition: box-shadow .2s, border-color .2s; }
.help-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.help-empty { margin-top: 12px !important; }
.help-topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 22px 0 28px; }
.help-topic { display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--line);
  color: var(--text); text-decoration: none !important; animation: rise-in .45s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--n, 0) * 30ms);
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s, border-color .25s; }
.help-topic:hover { transform: translateY(-3px); border-color: transparent; box-shadow: 0 18px 36px -22px rgba(20, 20, 60, .4); }
.help-topic[hidden] { display: none; }
.help-topic-ico { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 8px;
  transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.help-topic:hover .help-topic-ico { transform: scale(1.08) rotate(-4deg); }
.help-topic-ico .i { width: 18px; height: 18px; }
.help-topic b { font-size: 15px; }
.help-topic span:last-child { color: var(--muted); font-size: 13px; line-height: 1.35; }
.help-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 22px; align-items: start; }
.help-side { position: sticky; top: 84px; }
.help-toc { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.help-toc a { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 12px; background: transparent; color: var(--muted);
  font-size: 13.5px; text-decoration: none; transition: background .2s, color .2s; }
.help-toc a .i { width: 16px; height: 16px; flex: none; }
.help-toc a:hover { background: var(--hover); color: var(--text); }
.help-toc a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.help-toc a[hidden] { display: none; }
.help-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.help-section { margin: 0; padding: 20px 22px; scroll-margin-top: 90px; }
.help-section[hidden] { display: none; }
.help-section h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 19px; letter-spacing: -0.02em; }
.help-h-ico { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.help-h-ico .i { width: 17px; height: 17px; }
.help-section p { line-height: 1.6; }
.help-section ul { list-style: none; padding-left: 0; margin: 8px 0; display: grid; gap: 8px; }
.help-section ul li { position: relative; padding-left: 20px; margin: 0; line-height: 1.55; }
.help-section ul li::before { content: ""; position: absolute; left: 4px; top: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.help-section ol { list-style: none; counter-reset: step; padding-left: 0; margin: 8px 0; display: grid; gap: 10px; }
.help-section ol li { counter-increment: step; position: relative; padding: 10px 12px 10px 48px; margin: 0; border-radius: 14px; background: var(--hover); line-height: 1.5; }
.help-section ol li::before { content: counter(step); position: absolute; left: 12px; top: 10px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: var(--accent-text, #fff); font-size: 12px; font-weight: 700; }
.help-section .muted { font-size: 13.5px; }
.help-anim .help-section { opacity: 0; transform: translateY(14px); transition: opacity .55s cubic-bezier(.2, .8, .2, 1), transform .55s cubic-bezier(.2, .8, .2, 1); }
.help-anim .help-section.shown { opacity: 1; transform: none; }
@media (max-width: 900px) {
  .help-layout { grid-template-columns: minmax(0, 1fr); }
  .help-side { display: none; }
  .help-topics { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 420px) { .help-topics { grid-template-columns: 1fr; } .help-hero h1 { font-size: 28px; } }

/* Ключ на цьому пристрої: згода під час підключення ДПС і повідомлення про фонове оновлення */
.remember-key { align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); font-weight: 500; }
.remember-key input { margin-top: 3px; }
.remember-key .muted { display: block; font-size: 12.5px; margin-top: 3px; font-weight: 400; }
.dps-key-state { margin: 4px 0 0; font-size: 13px; }
.dps-toast { position: fixed; left: 50%; bottom: 22px; z-index: 200; transform: translateX(-50%); padding: 10px 16px; border-radius: 999px;
  background: var(--ink, #1c1b20); color: #fff; font-size: 13.5px; font-weight: 600; box-shadow: 0 14px 36px -12px rgba(0, 0, 0, .45);
  animation: rise-in .35s cubic-bezier(.2, .8, .2, 1) both; transition: opacity .4s, transform .4s; }
.dps-toast.bad { background: var(--danger); }
.dps-toast.out { opacity: 0; transform: translate(-50%, 8px); }

/* ---------- Шапка: знак Envoy як в адмінці власника, поруч — логотип або назва компанії ---------- */
.brand { gap: 10px; }
.brand-icon { width: 32px; height: 32px; border-radius: 10px; flex: none; box-shadow: 0 8px 18px -8px rgba(40, 40, 120, .45);
  transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.brand:hover .brand-icon { transform: rotate(-8deg) scale(1.06); }
.brand-word { font-weight: 800; font-size: 19px; letter-spacing: -0.035em; line-height: 1; color: var(--text); }
.brand-sep { width: 1px; height: 22px; background: var(--line); flex: none; margin: 0 2px; }
.brand-company { color: var(--muted); font-size: 13.5px; font-weight: 600; max-width: 190px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.brand-company-logo { height: 28px; max-width: 150px; width: auto; object-fit: contain; display: block; }
@media (max-width: 1180px) { .brand-company { max-width: 130px; } .brand-company-logo { max-width: 110px; } }
@media (max-width: 600px) {
  .brand { gap: 8px; }
  .brand-icon { width: 30px; height: 30px; }
  .brand-word { font-size: 18px; }
  .brand-sep { height: 18px; margin: 0; }
  .brand-company { max-width: 28vw; font-size: 12.5px; }
  .brand-company-logo { height: 24px; max-width: 26vw; }
}
/* Налаштування: логотип */
.brand-card { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: center; }
.brand-preview { height: 96px; border-radius: 16px; display: grid; place-items: center; padding: 14px; background: var(--hover); border: 1px dashed var(--line); }
.brand-preview { overflow: hidden; min-width: 0; }
.brand-preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-preview-empty { font-weight: 700; color: var(--muted); text-align: center; }
.brand-card-text { display: flex; flex-direction: column; gap: 6px; }
.brand-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
@media (max-width: 600px) { .brand-card { grid-template-columns: 1fr; } }

/* ---------- Юрособи: картка юрособи, вибір підпису, банки ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.entity-card .entity-title { margin: 0; font-size: 22px; letter-spacing: -0.025em; }
.entity-facts { grid-column: 1 / -1; margin: 0; padding-top: 14px; border-top: 1px solid var(--line); }
.empty-state, .empty-calm { color: var(--muted); padding: 18px 20px; }
.empty-calm { color: var(--ok); font-weight: 600; }
.sign-choice { display: grid; grid-template-columns: 1.15fr 1fr; gap: 12px; margin: 10px 0 8px; }
.sign-option { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: 20px; background: var(--card);
  border: 2px solid var(--line); cursor: pointer; transition: border-color .25s, box-shadow .25s, transform .25s cubic-bezier(.2, .8, .2, 1); }
.sign-option:hover { transform: translateY(-2px); box-shadow: 0 18px 36px -24px rgba(20, 20, 60, .4); }
.sign-option input { position: absolute; opacity: 0; pointer-events: none; }
.sign-option.kep { background: linear-gradient(160deg, var(--accent-soft), var(--card) 60%); }
.sign-option.on { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.sign-option.locked { cursor: default; }
.sign-option.locked:hover { transform: none; box-shadow: none; }
.sign-option-top { display: flex; justify-content: space-between; align-items: center; }
.sign-option-ico { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.sign-tag { padding: 3px 10px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 700; }
.sign-option b { font-size: 17px; margin-top: 4px; }
.sign-option ul { margin: 2px 0 6px; padding-left: 18px; color: var(--muted); font-size: 13.5px; display: grid; gap: 2px; }
.sign-state { margin-top: auto; align-self: flex-start; padding: 6px 14px; border-radius: 999px; background: var(--hover); font-weight: 600; font-size: 13px; }
.sign-option.on .sign-state { background: var(--accent); color: #fff; }
.bank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; margin: 10px 0 18px; }
.bank-card { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.bank-card.err { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.bank-card.add { border-style: dashed; }
.bank-card-head { display: flex; align-items: center; gap: 12px; }
.bank-card-head > div { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.bank-card-head .muted { font-size: 12.5px; }
.bank-logo { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none; font-weight: 800; font-size: 12px; letter-spacing: -0.02em; }
.bank-logo.monobank { background: #111; color: #fff; }
.bank-logo.privat { background: #8cc63f; color: #fff; }
.bank-logo.add { background: var(--accent-soft); color: var(--accent); }
.bank-logo .i { width: 18px; height: 18px; }
.facts.compact { grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.facts.compact .fact { padding: 9px 10px; }
.facts.compact .fact-ico { width: 28px; height: 28px; }
.bank-card-actions { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.provider-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.provider-pick label { cursor: pointer; }
.provider-pick input { position: absolute; opacity: 0; }
.provider-pick span { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 14px; border: 2px solid var(--line); font-weight: 600; font-size: 13.5px; transition: border-color .2s; }
.provider-pick .bank-logo { width: 30px; height: 30px; border-radius: 9px; font-size: 10px; }
.provider-pick input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 760px) { .sign-choice { grid-template-columns: 1fr; } .bank-grid { grid-template-columns: 1fr; } .facts.compact { grid-template-columns: 1fr; } }

/* ---------- Надходження з банку ---------- */
.tx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tx-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--line);
  animation: rise-in .45s cubic-bezier(.2, .8, .2, 1) both; }
.tx-card.has-match { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.task-body .tx-card + .tx-card { margin-top: 8px; }
.tx-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tx-amount { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; color: var(--ok); }
.tx-date { color: var(--muted); font-size: 13px; }
.tx-who { font-weight: 600; font-size: 14px; }
.tx-purpose { padding: 8px 10px; border-radius: 10px; background: var(--hover); color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.tx-match { font-size: 13.5px; line-height: 1.5; }
.tx-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 6px; }
.tx-pick { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.tx-pick select { flex: 1; min-width: 180px; }
.bank-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.upload-card { display: flex; gap: 14px; align-items: flex-start; margin: 0; }
.upload-card .doc-ico { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.upload-card p { margin: 4px 0 8px; font-size: 13.5px; }
.mini-bank { display: flex; gap: 10px; align-items: center; padding: 6px 0; font-size: 13.5px; }
.mini-bank .bank-logo { width: 32px; height: 32px; border-radius: 10px; font-size: 10px; }
.doc-icon.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
@media (max-width: 760px) { .tx-grid, .bank-bottom { grid-template-columns: 1fr; } }

/* ---------- Податки: назва юрособи закріплена над її даними ---------- */
.tax-head { position: sticky; top: 74px; z-index: 6; margin: 6px -10px 14px; padding: 10px; border-radius: 18px;
  background: color-mix(in srgb, var(--card) 86%, transparent); backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
  border: 1px solid var(--line); box-shadow: 0 12px 30px -24px rgba(20, 20, 60, .45); }
@media (max-width: 760px) { .tax-head { top: 64px; margin: 6px -4px 12px; } .tax-head-text h2 { font-size: 17px; } }
@media (max-width: 760px) {
  .tax-head { gap: 10px; padding: 8px 10px; flex-wrap: nowrap; }
  .tax-head .avatar { width: 34px; height: 34px; font-size: 12px; border-radius: 11px; }
  .tax-head-text { min-width: 0; }
  .tax-head-text h2 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tax-head-text .muted { font-size: 12px; flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
  .tax-head-text .muted .badge { display: none; }
  .tax-dps-side { display: none; }  /* синхронізація й статус ДПС — у картці «Кабінет ДПС» нижче */
}

/* ---------- Логотип компанії: прев'ю шапки й редактор ---------- */
.brand-card { grid-template-columns: 260px minmax(0, 1fr); }
.brand-preview { height: auto; min-height: 84px; padding: 12px 16px; justify-items: start; border-style: solid; background: var(--card); }
.brand-mock { display: inline-flex; align-items: center; gap: 10px; min-width: 0; max-width: 100%; }
.brand-mock .brand-company-logo { height: 28px; max-width: 150px; width: auto; object-fit: contain; }
.brand-mock .brand-company { max-width: 120px; }
.brand-preview img.brand-icon { width: 32px; height: 32px; object-fit: initial; }
.file-pick { cursor: pointer; }
.logo-editor { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; padding-top: 16px;
  border-top: 1px solid var(--line); animation: rise-in .35s cubic-bezier(.2, .8, .2, 1) both; }
.logo-editor[hidden] { display: none; }
.logo-stage-wrap { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
#logo-canvas { width: 100%; height: auto; aspect-ratio: 720 / 192; border-radius: 14px; border: 2px dashed var(--accent); cursor: grab; touch-action: none;
  background-color: #fff; background-image: linear-gradient(45deg, #e9e9ee 25%, transparent 25%), linear-gradient(-45deg, #e9e9ee 25%, transparent 25%),
  linear-gradient(45deg, transparent 75%, #e9e9ee 75%), linear-gradient(-45deg, transparent 75%, #e9e9ee 75%);
  background-size: 18px 18px; background-position: 0 0, 0 9px, 9px -9px, -9px 0; }
#logo-canvas:active { cursor: grabbing; }
.logo-hint { font-size: 12.5px; }
.logo-controls { display: flex; flex-direction: column; gap: 12px; }
.logo-zoom { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; font-weight: 600; font-size: 13.5px; }
.logo-zoom input { width: 100%; accent-color: var(--accent); }
.logo-zoom output { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }
.logo-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.logo-mock-line { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--hover); flex-wrap: wrap; }
.logo-mock-line .muted { font-size: 12.5px; }
@media (max-width: 760px) { .brand-card { grid-template-columns: 1fr; } .logo-editor { grid-template-columns: 1fr; } }

/* Листи від ДПС: вибір юрособи */
.entity-pick { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 0 12px; padding: 2px; }
.entity-pick::-webkit-scrollbar { display: none; }
.entity-pick a { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--card);
  border: 1px solid var(--line); color: var(--text); font-weight: 600; font-size: 13.5px; text-decoration: none; transition: border-color .2s, box-shadow .2s; }
.entity-pick a:hover { border-color: var(--accent); }
.entity-pick a.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--accent-soft); }
.entity-pick-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar.mini { width: 26px; height: 26px; border-radius: 50%; font-size: 10.5px; display: inline-grid; place-items: center; }

/* ---------- Логотип компанії: світла й темна тема ---------- */
.brand-logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo-dark { display: block; }
  :root:not([data-theme="light"]) .brand-logo-light { display: none; }
}
:root[data-theme="dark"] .brand-logo-dark { display: block; }
:root[data-theme="dark"] .brand-logo-light { display: none; }
.brand-card-two { grid-template-columns: 1fr; align-items: stretch; }
.logo-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.logo-slot { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 18px; border: 1px solid var(--line); min-width: 0; }
.logo-slot-head { display: flex; flex-direction: column; }
.logo-slot-head .muted { font-size: 12.5px; }
.logo-slot-mock { display: flex; align-items: center; min-height: 64px; padding: 12px 16px; border-radius: 14px; overflow: hidden; }
/* Тло й кольори шапки саме цієї теми — незалежно від того, яка тема зараз у кабінеті */
.logo-slot.light .logo-slot-mock, .logo-slot.light.logo-mock-line, [data-variant="light"] #logo-canvas { background: #f4f2ee; }
.logo-slot.dark .logo-slot-mock, .logo-slot.dark.logo-mock-line, [data-variant="dark"] #logo-canvas { background: #131216; }
.logo-slot.light .brand-word, .logo-slot.light .brand-company { color: #15151a; }
.logo-slot.dark .brand-word, .logo-slot.dark .brand-company { color: #f3f2f7; }
.logo-slot.light .brand-sep { background: rgba(20, 20, 30, .14); }
.logo-slot.dark .brand-sep { background: rgba(255, 255, 255, .18); }
.logo-slot.logo-mock-line { padding: 10px 12px; border: 0; flex-direction: row; }
.logo-slot.dark.logo-mock-line .muted { color: rgba(255, 255, 255, .6); }
.brand-company-logo.faded { opacity: .45; }
.logo-slot-note { font-size: 12.5px; }
.logo-slot .brand-form { margin-top: auto; }
#logo-editor-title { font-size: 14px; }
@media (max-width: 760px) { .logo-slots { grid-template-columns: 1fr; } }

/* ---------- Печатка: позначка підписаного документа ---------- */
.stamp { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border: 1.5px solid currentColor; border-radius: 6px;
  color: var(--accent); font-size: 12px; font-weight: 600; line-height: 1.4; white-space: nowrap; transform: rotate(-2deg);
  background: color-mix(in srgb, var(--accent) 5%, transparent); }
.stamp::before { content: ""; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid currentColor; flex: none; }
.step-result .stamp { margin-right: 6px; }
/* Стан листа клієнту: крапка замість емодзі */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; background: var(--ok); }
.status-dot.bad { background: var(--danger); }
.sign-ico .i, .icon .i, .ico .i { width: 22px; height: 22px; }
/* Посилання в плитці даних — як звичайне значення, але клікабельне */
a.fact-value { color: var(--accent); }
a.fact-value:hover { text-decoration: underline; }

/* Число над назвою вкладки: скільки там чекає ваших дій */
.todo-badge { position: absolute; top: -7px; right: -6px; z-index: 2; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  display: grid; place-items: center; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--bg); pointer-events: none; }
.docs-nav a, .topnav a, .tabbar .tab { position: relative; }
.tabbar .tab .todo-badge { top: 2px; right: calc(50% - 22px); }
.topnav a > span.todo-badge { position: absolute; top: -5px; right: -4px; z-index: 2; }
/* Телефон: рядок вкладок прокручується вбік — місце зверху для числа, ширший проміжок і коротке згасання праворуч */
@media (max-width: 600px) {
  .docs-nav { padding-top: 10px; margin-top: -8px; gap: 10px; padding-right: 36px;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent); }
}

/* Прев'ю матеріалу — у власних пропорціях, без розтягування на всю ширину */
.material-preview-card { text-align: center; }
.material-preview-card .material-preview { width: auto; max-width: 100%; height: auto; max-height: 560px; margin: 0 auto; object-fit: contain; }

/* ================= Вигляд адмінки власника: скло, чорнило й лайм, Urbanist, поява з розмиттям ================= */
:root, :root[data-theme="light"] {
  --font-ui: "Urbanist", "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #e9ece7; --text: #13171a; --muted: #50574f; --line: rgba(18, 22, 20, .08);
  --card: #ffffff; --glass: rgba(255, 255, 255, .74); --glass-strong: rgba(255, 255, 255, .92); --glass-edge: rgba(255, 255, 255, .78);
  --field: rgba(18, 22, 20, .05); --hover: rgba(18, 22, 20, .05);
  --ink: #13171a; --ink-text: #f6f7f3;
  --lime: #c4ef4f; --lime-deep: #a9d636; --lime-text: #3f6410; --sky: #5aa6ec; --coral: #f27d5f;
  --accent: #13171a; --accent-soft: rgba(196, 239, 79, .38); --accent-text: #f6f7f3; --brand: #13171a;
  --ok: #3c7a14; --warn: #a8661a; --danger: #b8401f; --info: #2f78c4;
  --tint-ok: rgba(196, 239, 79, .32); --tint-warn: rgba(242, 178, 95, .2); --tint-danger: rgba(242, 125, 95, .18);
  --tint-info: rgba(90, 166, 236, .16); --tint-accent: rgba(196, 239, 79, .32);
  --glass-card: rgba(255, 255, 255, .58); --glass-rim: rgba(255, 255, 255, .78);
  --glass-blur: blur(20px) saturate(150%);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 18px 40px -30px rgba(20, 30, 20, .45);
  --shadow: var(--glass-shadow);
  --shadow-lift: 0 20px 50px -18px rgba(15, 25, 20, .35), 0 2px 6px rgba(15, 25, 20, .08);
  --radius: 18px; --radius-sm: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101311; --text: #eef1ea; --muted: #a3aa9f; --line: rgba(255, 255, 255, .08);
    --card: #1a1e1b; --glass: rgba(30, 34, 31, .78); --glass-strong: rgba(30, 34, 31, .94); --glass-edge: rgba(255, 255, 255, .07);
    --field: rgba(255, 255, 255, .06); --hover: rgba(255, 255, 255, .05);
    --ink: #eef1ea; --ink-text: #13171a;
    --accent: #c4ef4f; --accent-soft: rgba(196, 239, 79, .16); --accent-text: #13171a; --brand: #c4ef4f;
    --ok: #a9d636; --warn: #f0b552; --danger: #ff8f73; --info: #7ab8f2;
    --tint-ok: rgba(196, 239, 79, .13); --tint-warn: rgba(240, 181, 82, .13); --tint-danger: rgba(255, 143, 115, .14);
    --tint-info: rgba(122, 184, 242, .13); --tint-accent: rgba(196, 239, 79, .13);
    --glass-card: rgba(28, 32, 29, .62); --glass-rim: rgba(255, 255, 255, .07);
    --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 18px 40px -24px rgba(0, 0, 0, .6);
    --shadow-lift: 0 20px 50px -18px rgba(0, 0, 0, .7);
  }
}
:root[data-theme="dark"] {
  --bg: #101311; --text: #eef1ea; --muted: #a3aa9f; --line: rgba(255, 255, 255, .08);
  --card: #1a1e1b; --glass: rgba(30, 34, 31, .78); --glass-strong: rgba(30, 34, 31, .94); --glass-edge: rgba(255, 255, 255, .07);
  --field: rgba(255, 255, 255, .06); --hover: rgba(255, 255, 255, .05);
  --ink: #eef1ea; --ink-text: #13171a;
  --accent: #c4ef4f; --accent-soft: rgba(196, 239, 79, .16); --accent-text: #13171a; --brand: #c4ef4f;
  --ok: #a9d636; --warn: #f0b552; --danger: #ff8f73; --info: #7ab8f2;
  --tint-ok: rgba(196, 239, 79, .13); --tint-warn: rgba(240, 181, 82, .13); --tint-danger: rgba(255, 143, 115, .14);
  --tint-info: rgba(122, 184, 242, .13); --tint-accent: rgba(196, 239, 79, .13);
  --glass-card: rgba(28, 32, 29, .62); --glass-rim: rgba(255, 255, 255, .07);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 18px 40px -24px rgba(0, 0, 0, .6);
  --shadow-lift: 0 20px 50px -18px rgba(0, 0, 0, .7);
}
body { font-family: var(--font-ui); font-size: 14.5px; }
button, input, select, textarea { font-family: inherit; }

/* Тло: повільні кольорові плями під склом (лайм, небо, персик, крем) */
.backdrop { display: block; overflow: hidden; opacity: 1; background: linear-gradient(180deg, #eef1ec 0%, #e6eae3 60%, #e9ece7 100%); }
.backdrop i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .7; animation: glass-drift 26s ease-in-out infinite alternate; }
.backdrop .b1 { width: 44vw; height: 44vw; left: -12vw; top: -18vw; background: #d4f08a; }
.backdrop .b2 { width: 36vw; height: 36vw; right: -10vw; top: 4vw; background: #b9dcf7; animation-delay: -8s; }
.backdrop .b3 { width: 42vw; height: 42vw; left: 30vw; bottom: -26vw; background: #f7cdbd; animation-delay: -14s; }
.backdrop .b4 { width: 24vw; height: 24vw; right: 16vw; bottom: 6vw; background: #e8eccb; animation-delay: -4s; }
@keyframes glass-drift { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(4vw, 3vw) scale(1.08); }
  100% { transform: translate(-3vw, 5vw) scale(.96); } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .backdrop { opacity: 1; background: #101311; }
  :root:not([data-theme="light"]) .backdrop i { opacity: .16; } }
:root[data-theme="dark"] .backdrop { opacity: 1; background: #101311; }
:root[data-theme="dark"] .backdrop i { opacity: .16; }
@media (prefers-reduced-motion: reduce) { .backdrop i { animation: none; } }

/* Скло: картки, таблиці, верхня й бічна панелі */
.card, table, .fact, .tx-card, .help-topic, .sign-option, .rail-group, .bar, .date-chip, .entity-pick a {
  background: var(--glass-card); border-color: var(--glass-rim); box-shadow: var(--glass-shadow);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); }
.card .card, .card table, .card .fact { backdrop-filter: none; -webkit-backdrop-filter: none; }
a.card, .entity-card, .doc-card, .tx-card, .help-topic { transition: transform .35s var(--ease), box-shadow .35s var(--ease), background .25s; }
a.card:hover, .entity-card:hover, .doc-card:hover, .tx-card:hover, .help-topic:hover {
  transform: translateY(-2px); box-shadow: var(--shadow-lift); background: var(--glass); text-decoration: none; }

/* Заголовки й числа */
h1 { font-weight: 800; letter-spacing: -0.035em; }
h2 { font-weight: 700; }
.tile b { font-weight: 800; font-size: 28px; }
.brand-word { font-weight: 800; }

/* Кнопки, меню, лічильники — як в адмінці: чорнило, лайм, корал */
.btn { box-shadow: 0 6px 14px -6px rgba(19, 23, 26, .45); }
.btn:hover { filter: none; box-shadow: 0 12px 24px -10px rgba(19, 23, 26, .5); }
.brand-mark, .rail .accent, .kpi-icon { background: var(--ink); color: var(--ink-text); box-shadow: 0 8px 18px -8px rgba(20, 30, 20, .4); }
.rail-add { background: var(--glass, rgba(255, 255, 255, .7)) !important; color: var(--text) !important; box-shadow: var(--shadow) !important;
  border: 1px solid var(--line) !important; }
.rail-add .i { color: var(--ok); }
.rail .rail-add:hover { background: var(--ink) !important; color: var(--ink-text) !important; }
.rail .rail-add:hover .i { color: var(--lime); }
.todo-badge, .count { background: var(--coral); color: #13171a; }
.tile-icon { background: var(--well, rgba(18, 22, 20, .06)); color: var(--text); }
.viz-root { --series-1: #c9cfc6; --series-2: #13171a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .viz-root { --series-1: #3b403a; --series-2: #c4ef4f; } }
:root[data-theme="dark"] .viz-root { --series-1: #3b403a; --series-2: #c4ef4f; }

/* Плитки на головній — як решта карток; те, що чекає на вас, — лише кольорова позначка й число */
.tile.accent { box-shadow: var(--shadow), inset 0 0 0 1.5px color-mix(in srgb, var(--lime-deep) 70%, transparent); }
.tile.accent .tile-icon { background: var(--tint-ok); color: var(--ok); }
.tile.ink .tile-icon { background: var(--ink); color: var(--ink-text); }

/* Рух адмінки: картки з'являються з легким розмиттям, по черзі */
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.99); filter: blur(5px); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(14px) scale(.99); filter: blur(5px); } }
main .card { animation: rise .6s var(--ease) both; animation-delay: calc(var(--n, var(--i, 0)) * 40ms); }
.kpi-row .tile:nth-child(2) { --n: 1; } .kpi-row .tile:nth-child(3) { --n: 2; } .kpi-row .tile:nth-child(4) { --n: 3; }
@media (prefers-reduced-motion: reduce) { main .card { animation: none; } }
/* Верхня панель щільніша, під нею — м'який перехід у тло (як в адмінці): картки не просвічують крізь меню */
.topbar::before { content: ""; position: absolute; inset: 0 0 -14px; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, var(--bg) 55%, transparent); }
.bar { background: var(--glass-strong); }
/* Телефон: заголовок сторінки на всю ширину зліва (пізніше загальне правило .page-head зсувало його праворуч) */
@media (max-width: 600px) { .page-head { flex-direction: column; align-items: stretch; } }

/* Податки: кнопки декларацій юрособи */
.decl-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
/* Декларація: дата початку на єдиному податку */
.decl-since { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.decl-since label { display: grid; gap: 4px; font-size: 13px; }
.decl-since input[type=date] { height: 36px; }
.decl-since .help { flex-basis: 100%; }
/* Декларація: дата початку на єдиному податку */
.decl-since { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.decl-since label { display: grid; gap: 4px; font-size: 13px; }
.decl-since input[type=date] { height: 36px; }
.decl-since .help { flex-basis: 100%; }

/* Податки: списання з банку на рішення «витрата / не витрата» */
.tax-out-row { align-items: center; gap: 12px; flex-wrap: wrap; }
.tax-out-row > span:first-child { display: grid; gap: 2px; min-width: 0; flex: 1 1 240px; }
.tax-out-purpose { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tax-out-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tax-out-actions form { display: flex; gap: 6px; align-items: center; }
.tax-out-vat { width: 90px; height: 32px; }
/* ПРРО на сторінці юрособ */
.bank-logo.prro { background: #13171a; color: #c4ef4f; font-size: 11px; }
.bank-card details > summary { list-style: none; }
.bank-card details > summary::-webkit-details-marker { display: none; }

/* Рахунки юрособи: з картки ДПС, реквізитів і вручну — підключені, з виписками чи без */
.acc-list { display: flex; flex-direction: column; gap: 0; padding-bottom: 6px; margin-bottom: 14px; }
.acc-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding-bottom: 10px; }
.acc-head .muted { font-size: 13px; }
.acc-row { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; border-top: 1px solid var(--line);
  scroll-margin-top: 90px; animation: acc-in .35s var(--ease) both; }
.acc-row:target { background: linear-gradient(90deg, var(--accent-soft), transparent 70%); border-radius: var(--radius-sm);
  padding-left: 10px; padding-right: 10px; }
@keyframes acc-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.acc-main { display: flex; align-items: center; gap: 12px; }
.acc-logo { width: 40px; height: 40px; border-radius: 12px; flex: none; object-fit: cover; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.acc-logo.none { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); box-shadow: none; }
.acc-logo.none .i { width: 18px; height: 18px; }
.acc-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.acc-text .mono { font-variant-numeric: tabular-nums; letter-spacing: .01em; word-break: break-all; font-size: 14.5px; }
.acc-text .muted { font-size: 12.5px; }
.acc-row .badge { flex: none; white-space: nowrap; }
.acc-row.state-closed .acc-main { opacity: .6; }
.acc-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); padding-left: 52px; }
.acc-result { margin: 0 0 0 52px; display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--ok); }
.acc-result .i { width: 16px; height: 16px; }
.acc-note { margin: 0; padding-left: 52px; font-size: 12.5px; color: var(--muted); }
.acc-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; flex-wrap: wrap; padding-left: 52px; }
.cash-op label { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 600; }
.cash-op select { min-width: 0; max-width: 100%; }
.acc-upload { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; }
.acc-upload .btn { cursor: pointer; }
.acc-upload .help { font-size: 12.5px; }
.acc-connect { padding-left: 52px; }
.acc-connect > summary { list-style: none; display: inline-flex; }
.acc-connect > summary::-webkit-details-marker { display: none; }
.acc-connect[open] > summary { margin-bottom: 10px; }
.acc-connect form { max-width: 520px; }
.acc-add { border-top: 1px dashed var(--line); padding-top: 12px; }
.acc-add > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600;
  color: var(--accent); font-size: 14px; }
.acc-add > summary::-webkit-details-marker { display: none; }
.acc-add > summary .i { width: 16px; height: 16px; }
.acc-add-form { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(160px, 1fr) auto; gap: 10px; align-items: end; margin-top: 10px; }
@media (max-width: 760px) {
  .acc-meta, .acc-note, .acc-actions, .acc-connect { padding-left: 0; }
  .acc-result { margin-left: 0; }
  .acc-add-form { grid-template-columns: 1fr; }
  .acc-main { flex-wrap: wrap; row-gap: 6px; }
  .acc-text { flex-basis: calc(100% - 52px); }
  .acc-text .mono { font-size: 13.5px; }
  .acc-row .badge { margin-left: 52px; }
}

/* Податкові накладні з ЄРПН */
.erpn { display: flex; flex-direction: column; gap: 12px; }
.erpn-how > summary, .erpn-list > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--accent); }
.erpn-upload { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; }
.erpn-upload .btn { cursor: pointer; }
.erpn-upload .help { font-size: 12.5px; }
.erpn-table { display: flex; flex-direction: column; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.erpn-tr { display: grid; grid-template-columns: 1.1fr 1.5fr 1.5fr 1.2fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); align-items: baseline; }
.erpn-th { color: var(--muted); font-size: 12.5px; border-top: 0; }
.erpn-pay { color: var(--warn); } .erpn-credit { color: var(--ok); }
.erpn-doc { align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); }
.erpn-doc > span:first-child { display: flex; flex-direction: column; gap: 2px; flex: 1 1 280px; min-width: 0; }
.erpn-sum { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; white-space: nowrap; }
.erpn-list[open] > summary { margin-bottom: 6px; }
@media (max-width: 760px) {
  .erpn-th { display: none; }
  .erpn-tr { grid-template-columns: 1fr; gap: 2px; }
  .erpn-tr > span[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
}

/* Декларація з ПДВ */
.vat-rows { display: flex; flex-direction: column; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.vat-row { display: grid; grid-template-columns: 52px 1fr 130px 120px; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); align-items: baseline; }
.vat-row > span:nth-child(3), .vat-row > b { text-align: right; white-space: nowrap; }
.vat-row.vat-th { color: var(--muted); font-size: 12.5px; border-top: 0; }
.vat-row.total { font-weight: 700; }
.vat-row .mono { font-variant-numeric: tabular-nums; }
.vat-params { display: grid; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.vat-params label { display: grid; gap: 4px; font-size: 13.5px; }
.vat-params .btn { justify-self: start; }
@media (max-width: 760px) {
  .vat-row { grid-template-columns: 44px 1fr 1fr; row-gap: 2px; }
  .vat-row > span:nth-child(2) { grid-column: 2 / 4; }
  .vat-row > span:nth-child(3) { grid-column: 2; text-align: left; }
  .vat-row > b { grid-column: 3; text-align: left; }
  .vat-row > [data-label]::before { content: attr(data-label) " "; color: var(--muted); font-weight: 400; font-size: 12px; }
  .vat-row > .empty { display: none; }
  .vat-row > span.empty + b { grid-column: 2; }
  .vat-row.vat-th { display: none; }
}

/* Надходження: дохід з усіх джерел і звірка з ДПС */
.income-period { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.income-period .seg { margin: 0; display: inline-flex; gap: 4px; padding: 4px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); }
.income-period .seg a { padding: 6px 14px; border-radius: 99px; color: var(--muted); font-weight: 600; font-size: 13.5px; text-decoration: none; }
.income-period .seg a.on { background: var(--accent); color: var(--accent-text); }
.income-nav { display: flex; align-items: center; gap: 10px; }
.income-nav b { min-width: 150px; text-align: center; }
.income-entity { margin-bottom: 14px; animation: acc-in .35s var(--ease) both; }
.income-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.income-head h2 { margin: 0; font-size: 17px; }
.income-head > div:nth-child(2) { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.income-head .muted { font-size: 13px; }
.income-total { display: flex; flex-direction: column; align-items: flex-end; }
.income-total b { font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.income-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; padding-top: 12px; }
.income-cols h3 { margin: 0 0 6px; font-size: 14px; color: var(--muted); font-weight: 600; }
.income-src { align-items: baseline; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.income-src:first-of-type { border-top: 0; }
.income-src > span { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.income-src > span b { font-weight: 600; font-size: 14px; word-break: break-word; }
.income-src .muted { font-size: 12.5px; }
.income-src > b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.income-note { display: block; margin: 8px 0 0; font-size: 13px; color: var(--muted); }
a.income-note:hover { color: var(--accent); }
.income-issue { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; margin-bottom: 8px;
  border-radius: var(--radius-sm); background: var(--tint-warn); font-size: 13.5px; }
.income-issue.info { background: var(--tint-info); }
.income-issue.ok { background: var(--tint-ok); grid-template-columns: 22px 1fr; }
.income-issue-ico { display: grid; place-items: center; color: var(--warn); }
.income-issue.info .income-issue-ico { color: var(--info); }
.income-issue.ok .income-issue-ico { color: var(--ok); }
.income-issue-ico .i { width: 18px; height: 18px; }
.income-issue .btn { white-space: nowrap; }
@media (max-width: 760px) {
  .income-cols { grid-template-columns: 1fr; }
  .income-total { align-items: flex-start; width: 100%; }
  .income-issue { grid-template-columns: 22px 1fr; }
  .income-issue .btn { grid-column: 2; justify-self: start; }
}

/* Дані ДРФО: хто платив ФОП */
.drfo-rows .vat-row { grid-template-columns: 110px 1fr 130px 140px; }
.drfo-rows .vat-row.drfo-gap > span:nth-child(3), .drfo-rows .vat-row.drfo-gap > b { color: var(--danger); }
.drfo-period { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.vat-params input, .drfo-period input { min-width: 0; width: 100%; box-sizing: border-box; }
.decl-grid > .side-stack { min-width: 0; }
.drfo-problems { margin: 12px 0 0; padding-left: 18px; font-size: 13.5px; color: var(--warn); }
@media (max-width: 760px) { .drfo-rows .vat-row { grid-template-columns: 1fr 1fr; } .drfo-rows .vat-row > span:nth-child(2) { grid-column: 1 / 3; } }

/* Повнота ЄРПН: дні місяця */
.erpn-days { display: flex; flex-wrap: wrap; gap: 4px; margin: 14px 0 6px; }
.erpn-day { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; font-size: 12.5px;
  font-variant-numeric: tabular-nums; border: 1px solid var(--line); color: var(--muted); }
.erpn-day.asked { background: var(--hover); color: var(--text); }
.erpn-day.got { background: var(--tint-ok); color: var(--ok); border-color: transparent; font-weight: 700; }

/* Вкладки «Надходження» */
.income-tabs { margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px; overflow: visible; }
.income-tabs .seg-btn { padding: 7px 14px; text-decoration: none; color: var(--text); font-weight: 600; font-size: 13.5px; }
.income-tabs .seg-btn.on { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.acc-personal { margin-top: 6px; }
.acc-personal > summary { cursor: pointer; font-size: 13.5px; color: var(--muted); padding: 10px 0 4px; }
.acc-row.personal .acc-main { opacity: .7; }
.prro-registered { margin: 0 0 10px; padding-left: 18px; font-size: 13.5px; }
.income-h { margin: 18px 0 4px; font-size: 14px; color: var(--muted); font-weight: 600; }
.acc-got { margin: 0 0 0 52px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.acc-gap { margin: 0 0 0 52px; display: flex; align-items: flex-start; gap: 6px; font-size: 13px; color: var(--warn); }
.acc-gap .i { width: 15px; height: 15px; flex: none; margin-top: 2px; }
@media (max-width: 760px) { .acc-got, .acc-gap { margin-left: 0; } }

/* Операції: банк і каси — зміни кас з Z-звітів ДПС */
.ops-tabs { margin: -4px 0 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.ops-tabs .seg-btn { padding: 5px 12px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 13px; }
.ops-tabs .seg-btn.on { background: var(--field); color: var(--text); }
.shift-table { display: flex; flex-direction: column; font-size: 13.5px; font-variant-numeric: tabular-nums; margin-top: 12px; }
.shift-tr { display: grid; grid-template-columns: 0.9fr 1.8fr repeat(4, 1fr); gap: 4px 10px; padding: 8px 0; border-top: 1px solid var(--line); align-items: baseline; }
.shift-tr > :nth-child(n+3) { text-align: right; }
.shift-th { color: var(--muted); font-size: 12.5px; border-top: 0; }
.shift-total { font-weight: 700; border-top: 1.5px solid var(--line); }
.shift-acq { grid-column: 2 / -1; font-size: 12.5px; color: var(--muted); text-align: left !important; }
@media (max-width: 760px) {
  .shift-th { display: none; }
  .shift-tr { grid-template-columns: 1fr 1fr; }
  .shift-tr > :nth-child(n+3) { text-align: left; }
  .shift-tr > [data-label]:nth-child(n+3)::before { content: attr(data-label) ": "; color: var(--muted); font-weight: 400; }
  .shift-acq { grid-column: 1 / -1; }
}
.ops-totals { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 12px; margin-bottom: 8px; }
.ops-total { margin: 0; display: grid; gap: 4px; padding: 14px 16px; }
.ops-total b { font-size: 19px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ops-total.main b { font-size: 24px; }
.ops-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ops-filters .ops-tabs { margin: 0; }
.ops-entity select { min-width: 0; max-width: 100%; }
.ops-feed { display: flex; flex-direction: column; padding: 6px 18px; }
.op-row { display: grid; grid-template-columns: 46px 32px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.op-row:first-child { border-top: 0; }
.op-row.off .op-amount { color: var(--muted); font-weight: 500; }
.op-date { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13.5px; padding-top: 6px; }
.op-ico { width: 32px; height: 32px; border-radius: 11px; display: grid; place-items: center; background: var(--field); color: var(--text); }
.op-ico .i { width: 16px; height: 16px; }
.op-ico.cash { background: var(--tint-ok); color: var(--ok); }
.op-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.op-main > .muted { font-size: 13px; overflow-wrap: anywhere; }
.op-sub { font-size: 12.5px; color: var(--muted); }
.op-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.op-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 900px) { .ops-totals { grid-template-columns: 1fr 1fr; } .ops-total.main { grid-column: 1 / -1; } }
@media (max-width: 560px) {
  .op-row { grid-template-columns: 40px minmax(0, 1fr); }
  .op-ico { display: none; }
  .op-side { grid-column: 2; align-items: flex-start; text-align: left; flex-direction: row; flex-wrap: wrap; }
}
.op-acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.op-pay > summary { list-style: none; cursor: pointer; }
.op-pay > summary::-webkit-details-marker { display: none; }
.op-pay[open] { flex-basis: 100%; }
.op-pay .tx-pick { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.op-pay select { min-width: 0; max-width: 260px; }
/* Надходження: юрособа → період → підсумок-фільтр → стрічка */
.page-head .income-tabs { margin: 0; }
.income-entities { margin-bottom: 14px; }
.entity-sum { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12.5px; white-space: nowrap; }
.entity-pick a.active .entity-sum { color: var(--text); }
.income-when { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.income-when .income-nav b { min-width: 0; padding: 0 4px; }
a.ops-total { display: grid !important; align-content: start; color: inherit; text-decoration: none; cursor: pointer; }
a.ops-total:hover { transform: translateY(-2px); }
a.ops-total.on { box-shadow: var(--shadow), inset 0 0 0 2px var(--accent); }
.home-source-note { margin: 0 0 10px; text-decoration: none; color: inherit; }
.tax-risk { display: block; margin-top: 8px; padding: 8px 10px; border-radius: 10px; font-size: 12.5px; line-height: 1.35;
  background: var(--tint-warn); color: var(--text); position: relative; z-index: 1; }
.person-access { display: grid; gap: 4px; margin: 8px 0; } .access-sum { font-size: 12.5px; }
.access-edit summary { list-style: none; display: inline-flex; } .access-edit summary::-webkit-details-marker { display: none; }
.access-form { display: grid; gap: 8px; margin-top: 10px; } .access-perms { display: grid; gap: 4px; }
.access-perms .muted { font-size: 12.5px; margin-top: 4px; } .access-perms .check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
