/* ELEMENTARNO CRM — дизайн-система v2 (REDESIGN.md, 03.11.2026).
   Стиль «true-black flat»: чорний #0a0a0a, жовтий #FFD300 — головна дія, синій студії #4D51F5 — ШІ/Inbox і «чекаю оплату».
   Картки без рамок і тіней — лише світлота (#0a0a0a → #141414 → #1e1e1e). Без збірки: звичайний CSS, деплой = git pull.
   Імена, що збігалися зі старими класами, перейменовано: рядок списку .lrow (не .row), сітка .g12 (не .grid),
   галочка .tick (не .check), чіпи пошуку .schip. Поле вводу — будь-який input/select/textarea (окремий клас не потрібен). */


/* ---------- Токени ---------- */
:root {
  color-scheme: dark;
  --ground: #0a0a0a; --surface: #141414; --raised: #1e1e1e; --active: #1c1c1c; --hover: #1b1b1b;
  --rule: #222222; --control: #3d3d3d; --field: #0a0a0a;
  --text: #f5f5f5; --muted: #b4b4b4; --faint: #949494;
  --strong: #fff; --accent-hover: #ffe04d; --field-focus: #0d0d0d;
  --accent: #ffd300; --accent-ink: #0a0a0a; --accent-tint: #221e06; --accent-tint-h: #2b2608;
  --blue: #4d51f5; --blue-ink: #a3a6ff; --blue-tint: #181a3f; --blue-tint-h: #212456;
  --negative: #ff6b5e; --neg-bg: #2b1513; --neg-tint: #211311; --neg-tint-h: #2a1815;
  --warn: #ff9f43; --warn-bg: #2b1d0d; --warn-tint: #20180a; --warn-tint-h: #291f0d;
  --positive: #3fc07a; --pos-bg: #14271b;
  --radius-card: 8px; --radius-ctl: 8px; --radius-chip: 4px;
  --gap: 16px; --pad: 20px; --ctl: 36px; --row: 48px;
  --fs-figure: 32px; --fs-title: 24px; --fs-section: 16px; --fs-body: 14px; --fs-small: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Старі імена → нові токени (щоб решта екранів одразу говорила новою мовою) */
  --bg: var(--ground); --surface-2: var(--raised); --text-muted: var(--muted); --border: var(--rule);
  --focus: var(--accent); --brand-accent: var(--accent); --brand-ink: var(--ground);
  --ok: var(--positive); --danger: var(--negative); --info: var(--blue-ink);
  --radius: var(--radius-card); --radius-sm: var(--radius-ctl); --shadow: none;
}
@media (max-width: 640px) { :root { --ctl: 44px; --row: 56px; } }

/* ---------- Основа ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--ground); color: var(--text); font: 400 var(--fs-body)/20px var(--font); }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: var(--mono); font-size: .9em; }
h1, h2, h3 { margin: 0 0 12px; }
h1 { font-size: var(--fs-title); line-height: 32px; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: var(--fs-section); line-height: 24px; font-weight: 600; }
h3 { font-size: var(--fs-body); line-height: 20px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: var(--fs-small); line-height: 18px; }
.big { font-size: var(--fs-title); line-height: 32px; font-weight: 600; margin: 4px 0; font-variant-numeric: tabular-nums; }
.text-danger { color: var(--negative); }
.text-warn { color: var(--warn); }
.text-ok { color: var(--positive); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sr, .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Контроли: одна висота ---------- */
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date],
input[type=datetime-local], input[type=time], input[type=month], input[type=url], input[type=tel], select, textarea {
  height: var(--ctl); min-width: 0; padding: 0 12px; line-height: 20px;
  background: var(--field); color: var(--text); border: 1px solid var(--control); border-radius: var(--radius-ctl);
  transition: border-color .12s, background-color .12s;
}
textarea { height: auto; min-height: 88px; padding: 8px 12px; width: 100%; resize: vertical; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%23949494' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
select[multiple] { height: auto; background-image: none; padding: 6px 12px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input::-webkit-calendar-picker-indicator { filter: invert(.7); cursor: pointer; }
input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: #5a5a5a; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; background-color: var(--field-focus); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; }

.btn {
  height: var(--ctl); padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--radius-ctl); border: 1px solid var(--control); background: transparent; color: var(--text);
  font-weight: 500; line-height: 20px; white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background-color .12s, border-color .12s, color .12s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary, .btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover, .btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn.ai { background: var(--blue-tint); border-color: #2d3080; color: var(--blue-ink); }
.btn.ai:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.icon { width: var(--ctl); padding: 0; }
.btn svg, .ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.btn-small { padding: 0 12px; }
.btn-block { width: 100%; }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
button.btn-ghost:hover, .btn-ghost.danger:hover { color: var(--negative); border-color: var(--negative); }
.btn-danger { border-color: #5a2520; color: var(--negative); }
.btn-danger:hover { border-color: var(--negative); color: var(--negative); background: var(--neg-tint); }
.btn:disabled, .btn[aria-disabled=true] { opacity: .45; cursor: not-allowed; transform: none; }
.link { color: var(--text); font-weight: 500; text-decoration: none; border: 0; border-bottom: 1px solid var(--control); background: none; padding: 0; cursor: pointer; transition: color .12s, border-color .12s; }
.link:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Каркас: сайдбар 224 + хедер 64 ---------- */
.app { display: grid; grid-template-columns: 224px minmax(0, 1fr); grid-template-rows: 64px 1fr; min-height: 100vh; }
.side { grid-row: 1 / 3; border-right: 1px solid var(--rule); display: flex; flex-direction: column; padding: 0 12px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { height: 64px; flex: none; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--rule); margin: 0 -12px 4px; padding: 0 12px 0 20px; }
.brandlink { display: flex; align-items: center; color: #fff; }
.brandlink:hover { color: var(--accent); }
.logo { width: 150px; height: auto; display: block; }
.crm-tag { font-size: 11px; font-weight: 600; color: var(--blue-ink); background: var(--blue-tint); border-radius: 4px; padding: 2px 6px; line-height: 14px; }
.navgroup { font-size: var(--fs-small); color: var(--faint); padding: 16px 8px 6px; }
.nav { display: flex; flex-direction: column; }
.nav a, .nav button { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 8px; border-radius: 6px; color: #bbb; text-decoration: none; background: none; border: 0; width: 100%; cursor: pointer; text-align: left; transition: background-color .12s, color .12s; }
.nav a svg, .nav button svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav a:hover, .nav button:hover { background: #161616; color: #fff; }
.nav a[aria-current=page] { background: var(--accent-tint); color: var(--strong); font-weight: 500; }
.nav a[aria-current=page] svg { stroke: var(--accent); }
.nav .count { margin-left: auto; font-size: 12px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--neg-bg); color: var(--negative); display: grid; place-items: center; font-variant-numeric: tabular-nums; font-weight: 500; }
.nav .count.n { background: var(--blue-tint); color: var(--blue-ink); }
/* Підпункти меню: видно під відкритим розділом (у мобільному «Ще» — завжди) */
.subnav { display: flex; flex-direction: column; margin: 2px 0 6px 15px; padding-left: 10px; border-left: 1px solid var(--rule); }
.nav .subnav a { height: 30px; font-size: 13px; color: var(--muted); }
.nav .subnav a[aria-current=true] { color: #fff; font-weight: 500; background: none; }
.nav .subnav a[aria-current=true]::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-left: -3px; }
.nav .subnav a:hover { color: var(--strong); }
/* Дубль навігації на сторінці — лише там, де бічного меню немає */
@media (min-width: 1101px) { .nav-dup { display: none !important; } }
.nav .soon { margin-left: auto; font-size: 11px; color: var(--faint); }
.nav a.is-soon { opacity: .5; }
.side .bottom { margin-top: auto; padding-top: 12px; }
.side .bottom form { margin: 0; }

.top { display: flex; align-items: center; gap: 16px; padding: 0 32px; border-bottom: 1px solid var(--rule); min-width: 0; }
.toplogo { display: none; color: var(--strong); }
.search { position: relative; width: 420px; margin: 0; }
.search svg { position: absolute; left: 12px; top: 50%; margin-top: -8px; width: 16px; height: 16px; stroke: var(--faint); fill: none; stroke-width: 1.5; pointer-events: none; }
.search input { width: 100%; padding: 0 56px 0 38px; }
.search kbd { position: absolute; right: 10px; top: 50%; margin-top: -10px; font: 500 12px/18px var(--font); color: var(--faint); border: 1px solid var(--control); border-radius: 4px; padding: 0 6px; }
.top .right { margin-left: auto; display: flex; align-items: center; gap: 16px; align-self: stretch; }
.top .date { color: var(--muted); white-space: nowrap; }
.top .who { display: flex; align-items: center; gap: 10px; border-left: 1px solid var(--rule); padding-left: 16px; height: 100%; color: var(--muted); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--blue-tint); color: var(--blue-ink); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }

.main { padding: 28px 32px 48px; min-width: 0; }
.canvas { max-width: 1320px; margin: 0 auto; }
.main:has(.board) .canvas { max-width: none; }
.titlerow { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.titlerow h1 { margin: 0; }
.titlerow .actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.finding { margin: 4px 0 0; color: var(--muted); }
.finding strong { color: var(--text); font-weight: 500; }
.finding .bad { color: var(--negative); font-weight: 500; }

.tabbar { display: none; }
.msearch { display: none; }
.msearch > summary { list-style: none; }
.msearch > summary::-webkit-details-marker { display: none; }

/* ---------- Панелі й сітка 12 ---------- */
.g12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); align-items: start; margin-bottom: var(--gap); }
.s3 { grid-column: span 3; } .s4 { grid-column: span 4; } .s5 { grid-column: span 5; } .s6 { grid-column: span 6; }
.s7 { grid-column: span 7; } .s8 { grid-column: span 8; } .s9 { grid-column: span 9; } .s12 { grid-column: 1 / -1; }
.panel { background: var(--surface); border-radius: var(--radius-card); padding: var(--pad); min-width: 0; }
.panel h2 { margin: 0; }
.panel + .panel { margin-top: var(--gap); }
.g12 > .panel + .panel { margin-top: 0; }
.ph { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.ph .meta { color: var(--faint); font-size: var(--fs-small); }
.ph .end { margin-left: auto; }
.empty-note { color: var(--faint); margin: 4px 0 0; }

/* ---------- Рядки списків: рядок — ціль кліку ---------- */
.lgroup { font-size: var(--fs-small); color: var(--faint); padding: 12px 0 4px; display: flex; gap: 8px; }
.lgroup.over { color: var(--negative); }
.lrow { display: grid; align-items: center; gap: 12px; min-height: var(--row); border-top: 1px solid var(--rule); margin: 0 -12px; padding: 6px 12px; border-radius: 6px; transition: background-color .12s; }
.lgroup + .lrow, .lrow:first-child { border-top-color: transparent; }
.lrow:hover { background: var(--hover); }
.lrow:hover .link { color: var(--accent); border-color: var(--accent); }
.lrow form { margin: 0; }
.lrow > div { min-width: 0; }
.lrow.over, .lrow.hot, .lrow.bad { background: var(--neg-tint); border-top-color: transparent; margin-top: 2px; }
.lrow.over:hover, .lrow.hot:hover, .lrow.bad:hover { background: var(--neg-tint-h); }
.lrow.today { background: var(--accent-tint); border-top-color: transparent; margin-top: 2px; }
.lrow.today:hover { background: var(--accent-tint-h); }
.lrow.warn { background: var(--warn-tint); border-top-color: transparent; margin-top: 2px; }
.lrow.warn:hover { background: var(--warn-tint-h); }
.lrow.today .due { color: var(--accent); }
.lrow.over + .lgroup, .lrow.today + .lgroup { margin-top: 4px; }
.task { grid-template-columns: 20px minmax(0, 1fr) auto 88px; }
.debt { grid-template-columns: minmax(0, 1fr) auto 72px auto; }
.lsite { grid-template-columns: auto minmax(0, 1fr) auto; }
.lrem { grid-template-columns: minmax(0, 1fr) auto; }
.lbill { grid-template-columns: minmax(0, 1fr) auto auto; }
.t1 { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.t1 a { text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
.t1 a:hover { color: var(--accent); }
.t2 { font-size: var(--fs-small); color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 18px; }
.t2 a { text-decoration: none; }
.t2 a:hover { color: var(--text); }
.t2 .say { color: var(--muted); }
.due { font-size: var(--fs-small); color: var(--muted); text-align: right; white-space: nowrap; }
.due.over { color: var(--negative); }
.amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.amt small { color: var(--faint); font-size: var(--fs-small); }
.days { font-size: var(--fs-small); color: var(--faint); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--rule); color: var(--faint); font-size: var(--fs-small); }
.tick { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--control); background: transparent; padding: 0; cursor: pointer; display: block; transition: background-color .12s, border-color .12s; }
.tick:hover { border-color: var(--accent); background: var(--accent-tint); }

/* Інлайн-дія в рядку (напр. «Отримано» → сума + Записати) */
.inline-act { position: relative; }
.inline-act > summary { list-style: none; }
.inline-act > summary::-webkit-details-marker { display: none; }
.inline-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 15; width: 280px; background: var(--raised); border-radius: var(--radius-card); padding: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, .6); display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.inline-pop input, .inline-pop select { width: 100%; }
.inline-pop .full { grid-column: 1 / -1; }

/* ---------- Словник статусів: одна мітка на всю CRM ---------- */
.pill, .tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: var(--radius-chip); font-size: 12px; line-height: 20px; font-weight: 500; white-space: nowrap; flex: none; background: var(--raised); color: var(--muted); border: 0; vertical-align: middle; }
.pill.bad, .tag-bad, .tag-debtor { background: var(--neg-bg); color: var(--negative); }
.pill.warn, .tag-wait { background: var(--warn-bg); color: var(--warn); }
.pill.ok, .tag-ok { background: var(--pos-bg); color: var(--positive); }
.pill.info, .tag-info, .tag-support { background: var(--blue-tint); color: var(--blue-ink); }
.pill.accent, .tag-vip { background: var(--accent-tint); color: var(--accent); }
.tag-past { opacity: .7; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: #555; }
.dot.ok, .dot.health-green { background: var(--positive); }
.dot.warn, .dot.health-yellow { background: var(--warn); }
.dot.bad, .dot.health-red { background: var(--negative); }
.dot.off, .dot.health-unknown { background: #555; }

/* ---------- Гроші: сума, сходи боргу, KPI ---------- */
.figure { font-size: var(--fs-figure); line-height: 40px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.figure small { font-size: 16px; color: var(--faint); font-weight: 500; }
.ladder { display: flex; gap: 2px; height: 10px; margin: 14px 0 8px; }
.ladder i { display: block; height: 100%; background: #3a3a3a; min-width: 4px; }
.ladder i:first-child { border-radius: 3px 0 0 3px; } .ladder i:last-child { border-radius: 0 3px 3px 0; }
.ladder i:only-child { border-radius: 3px; }
.ladder i.b0 { background: var(--blue); } .ladder i.b1 { background: #3639a8; } .ladder i.b2 { background: var(--warn); } .ladder i.b3 { background: var(--negative); }
.ladderkey { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; font-size: 12px; color: var(--faint); }
.ladderkey b { display: block; color: var(--text); font-weight: 500; font-size: 14px; font-variant-numeric: tabular-nums; }
.ladderkey .b0 b, .ladderkey .b1 b { color: var(--blue-ink); }
.ladderkey .b2 b { color: var(--warn); }
.ladderkey .b3 b { color: var(--negative); }
.ladderkey .zero b { color: var(--faint); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border-radius: var(--radius-card); margin-bottom: var(--gap); }
.kpis > div { padding: 16px var(--pad); border-left: 1px solid var(--rule); min-width: 0; }
.kpis > div:first-child { border-left: 0; }
.kpis .l { font-size: var(--fs-small); color: var(--faint); }
.kpis .v { font-size: 24px; line-height: 32px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpis .v small { font-size: 14px; color: var(--muted); }
.kpis .d { font-size: 12px; color: var(--faint); }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font: 12px var(--font); fill: var(--faint); }
.chart .cur text { fill: var(--accent); }
.chart-key { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--faint); margin-top: 8px; }
.chart-key i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* Вкладки: підкреслення */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--rule); margin: 8px 0 16px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 0; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; text-decoration: none; transition: color .12s, border-color .12s; }
.tabs a:hover { color: var(--strong); border-color: var(--control); }
.tabs a[aria-current=page] { color: var(--text); border-color: var(--accent); }
.tabs a span { color: var(--faint); font-variant-numeric: tabular-nums; margin-left: 4px; }
.tabs a .bad { color: var(--negative); }

/* ---------- Сайти: інцидент і аптайм ---------- */
.panel.alert { background: var(--neg-tint); box-shadow: inset 0 0 0 1px #4a201b; }
.incident { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.incident h2 a { text-decoration: none; }
.incact { display: flex; gap: 8px; flex-wrap: wrap; }
.uptime { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 2px; height: 24px; margin-top: 12px; }
.uptime i { background: #2c4a36; border-radius: 2px; }
.uptime i.w { background: var(--warn); } .uptime i.b { background: var(--negative); } .uptime i.n { background: #2a2a2a; }
.uplabels { display: flex; justify-content: space-between; font-size: 12px; color: var(--faint); margin-top: 6px; }
.more-inc { overflow-wrap: anywhere; margin-top: 12px; font-size: var(--fs-small); color: var(--muted); }
.more-inc a { margin-right: 12px; }

/* ---------- Пошук ---------- */
.sgroup { font-size: 13px; color: var(--faint); padding: 14px 0 6px; display: flex; gap: 6px; }
.sres { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 56px; text-decoration: none; }
.sres .t1, .sres .t2 { display: block; }
.sico { width: 32px; height: 32px; border-radius: 8px; background: var(--raised); display: grid; place-items: center; }
.sico svg { width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.sres.over { background: var(--neg-tint); }
.sres.over .sico svg { stroke: var(--negative); }
mark { background: none; color: var(--accent); font-weight: 600; }
.schips { display: flex; gap: 8px; overflow-x: auto; margin: 12px 0 8px; scrollbar-width: none; }
.schip { height: 32px; padding: 0 14px; border-radius: 16px; border: 1px solid var(--control); background: transparent; white-space: nowrap; font-weight: 500; flex: none; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; color: var(--text); }
.schip:hover { border-color: var(--accent); }
.schip[aria-pressed=true], .schip[aria-current=page] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.shint { font-size: 13px; color: var(--faint); padding-top: 16px; }

/* ---------- Таблиці: рядок несе стан ---------- */
.table-wrap { overflow-x: auto; }
/* відкрите «Оплата ▾» / «⋯» не обрізається скролом таблиці (на мобільному спливне — fixed) */
.table-wrap:has(details.inline-act[open]) { overflow: visible; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { font-size: 12px; font-weight: 400; color: var(--faint); text-align: left; padding: 8px 12px; white-space: nowrap; border-bottom: 0; text-transform: none; letter-spacing: 0; }
td { padding: 10px 12px; border-top: 1px solid var(--rule); border-bottom: 0; vertical-align: middle; transition: background-color .12s; }
th.num, td.num, th.r, td.r { text-align: right; }
tbody tr:hover td { background: var(--hover); }
tbody tr:hover .btn { border-color: var(--accent); color: var(--accent); }
tbody tr:hover .btn-primary, tbody tr:hover .btn.primary { color: var(--accent-ink); border-color: var(--accent); }
tbody tr.hot td, tbody tr.bad td { background: var(--neg-tint); }
tbody tr.hot:hover td, tbody tr.bad:hover td { background: var(--neg-tint-h); }
tbody tr.warn td { background: var(--warn-tint); }
tbody tr.warn:hover td { background: var(--warn-tint-h); }
tbody tr.today td { background: var(--accent-tint); }
td.payload, td.err { font-family: var(--mono); font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
td.err { color: var(--negative); }
td form { margin: 0; }
td .t1 { white-space: normal; }

/* ---------- Повідомлення ---------- */
.flash { padding: 10px 14px; border-radius: var(--radius-card); margin-bottom: 16px; font-weight: 500; background: var(--raised); }
.flash-success { background: var(--pos-bg); color: var(--positive); }
.flash-error { background: var(--neg-bg); color: var(--negative); }
.flash-warning { background: var(--warn-bg); color: var(--warn); }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 40; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* Швидка правка в один рядок: проєкт / час / що зроблено / мікрофон / Записати */
.qentry { display: grid; grid-template-columns: 220px 96px minmax(0, 1fr) auto auto; gap: 8px; background: var(--surface); border-radius: var(--radius-card); padding: 12px; margin-bottom: var(--gap); }
.qentry > :not(.sr) { min-width: 0; width: 100%; }
.qentry .btn { width: auto; }
.qentry .btn.icon { width: var(--ctl); }
.qentry input.num { text-align: center; }
.qentry-hint { margin: -8px 0 var(--gap); padding: 0 4px; color: var(--faint); font-size: var(--fs-small); }
.timer-strip { display: flex; align-items: center; gap: 12px; background: var(--accent-tint); border-radius: var(--radius-card); padding: 8px 12px; margin-bottom: var(--gap); flex-wrap: wrap; }
.timer-strip form { margin: 0; }

/* ---------- Решта екранів: старі компоненти на нових токенах ---------- */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.card { background: var(--surface); border: 0; border-radius: var(--radius-card); padding: var(--pad); margin-bottom: var(--gap); min-width: 0; }
.grid > .card { margin-bottom: 0; }
.card.is-muted { background: transparent; box-shadow: inset 0 0 0 1px var(--rule); }
.card-accent { box-shadow: inset 0 0 0 1px #4a3f0a; }
.empty p:last-child { margin-bottom: 0; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 13px; color: var(--muted); }
.field > input, .field > select, .field > textarea { color: var(--text); font-weight: 400; font-size: var(--fs-body); }
.code-input { font-family: var(--mono); font-size: 18px; letter-spacing: .2em; width: 11ch; text-align: center; }

.status-list { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 8px; }
.status-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plain { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 4px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.twofa-setup { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.qr { background: #fff; padding: 8px; border-radius: var(--radius-ctl); line-height: 0; }
.qr svg { width: 200px; height: 200px; }
.steps { margin: 0; padding-left: 1.2em; max-width: 46ch; display: flex; flex-direction: column; gap: 8px; }
.secret { display: inline-block; margin-top: 4px; padding: 4px 8px; background: var(--raised); border-radius: var(--radius-chip); word-break: break-all; }
.codes { columns: 2; padding-left: 1.4em; font-size: 16px; margin: 0 0 14px; }
.codes li { margin-bottom: 4px; }

body.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 12px; padding: 28px; }
.auth-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; color: var(--strong); }
.auth-brand .logo { width: 170px; }
.auth-card .code-input { width: 100%; }
.auth-card .stack + p { margin-top: 16px; margin-bottom: 0; }
/* ---------- Фаза 2: клієнти, проєкти, роботи ---------- */
.mt { margin-top: 18px; }
.mt-s { margin-top: 10px; }
.grow { flex: 1 1 auto; min-width: 0; }
.strong { font-weight: 650; text-decoration: none; }
.count { display: inline-block; min-width: 1.6em; padding: 0 6px; border-radius: 99px; background: var(--surface-2); color: var(--text-muted); font-size: .75rem; text-align: center; font-weight: 600; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.toolbar .row { margin-bottom: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.stack-cards { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.stack-cards > .card, .stack-cards > form { margin-bottom: 0; }
.span-3 { grid-column: 1 / -1; }
.w-short { max-width: 10ch; }
.w-xs { width: 7ch; }
.field em { font-style: normal; font-weight: 400; color: var(--text-muted); font-size: .8rem; }
.field-error { color: var(--danger); font-size: .82rem; font-weight: 500; }
.row-field { flex-direction: row; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.notes { white-space: normal; background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; font-size: .92rem; }
.ext { text-decoration: none; }

/* Форми */
.form-card { max-width: 860px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid input:not([type=checkbox]), .form-grid select, .form-grid textarea { width: 100%; }
.form-grid .w-short { width: 100%; max-width: 14ch; }
.form-grid .code-input { max-width: 14ch; }
fieldset.field { border: 0; padding: 0; margin: 0; }
.subform { border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 12px 14px 10px; margin: 0; background: var(--surface-2); }
.subform legend { font-size: .85rem; font-weight: 600; padding: 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; font-weight: 400; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 99px; cursor: pointer; font-size: .88rem; }
.chip:has(input:checked) { border-color: var(--text); background: var(--surface-2); }
.form-actions { display: flex; gap: 8px; margin-top: 18px; }


/* Списки робіт */
.bucket { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin: 16px 0 6px; }
.bucket-overdue { color: var(--danger); }
.bucket-today { color: var(--text); }
.work-list { list-style: none; margin: 0; padding: 0; }
.work-list li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--border); }
.work-list li:last-child { border-bottom: 0; }
.work-title { font-weight: 550; text-decoration: none; }
.work-title:hover { text-decoration: underline; }
.meta { font-size: .85rem; color: var(--text-muted); }
.meta a { color: inherit; }
.client-note { font-size: .85rem; margin-top: 4px; padding: 4px 8px; border-left: 2px solid var(--brand-accent); background: var(--surface-2); border-radius: 0 4px 4px 0; }
.check { margin: 2px 0 0; }
.checkbox { width: 20px; height: 20px; border: 2px solid var(--border); border-radius: 6px; background: var(--surface); cursor: pointer; padding: 0; flex: none; }
.checkbox:hover { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 15%, transparent); }
.row-item { display: flex; align-items: center; gap: 10px; }
.row-item form { margin: 0; }
.money-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.money-list li > a:first-child { grid-column: 1; grid-row: 1; font-weight: 550; }
.money-list li > span { grid-column: 1; grid-row: 2; }
.money-list li > strong { grid-column: 2; grid-row: 1; align-self: center; white-space: nowrap; text-align: right; }
.money-list li > a.small { grid-column: 2; grid-row: 2; justify-self: end; }
.project-list { list-style: none; margin: 0; padding: 0; }
.project-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.project-list li:last-child { border-bottom: 0; }

/* Теги клієнтів */
.tag-vip { color: #9a6b00; border-color: var(--brand-accent); background: color-mix(in srgb, var(--brand-accent) 18%, transparent); }
.tag-debtor { color: var(--danger); border-color: currentColor; }
.tag-support { color: var(--info); border-color: currentColor; }
.tag-past { opacity: .7; }

/* Картка роботи */
.status-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 14px; }
.status-bar form { margin: 0; }
.status-bar .label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 2px; }
.kv-wide { grid-template-columns: 130px 1fr; margin-top: 12px; }
.big-inline { font-size: 1.2rem; font-weight: 650; }
.muted-inv { opacity: .8; font-variant-numeric: tabular-nums; margin-left: 4px; }
.stage-list { list-style: none; margin: 0; padding: 0; }
.stage { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.stage:last-child { border-bottom: 0; }
.stage .small { margin-top: 3px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stage form { margin: 0; }
.stage-done strong { text-decoration: line-through; text-decoration-color: var(--text-muted); }
.notes-feed { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.note { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: .92rem; overflow-wrap: anywhere; }
.note-client { border-left: 3px solid var(--brand-accent); }
.note-ai { border-left: 3px solid var(--info); }
.note-head { margin-bottom: 4px; }

/* Абонемент */
details > summary { list-style: none; display: inline-flex; }
details > summary::-webkit-details-marker { display: none; }
.meter { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 8px 0 6px; }
.meter span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.meter.over span { background: var(--danger); }

@media (max-width: 760px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .kv-wide { grid-template-columns: 110px 1fr; }
  .toolbar .btn { flex: 0 0 auto; }
}

/* ---------- Безпека: пристрої, пароль, вхід ---------- */
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.device-list { list-style: none; margin: 0; padding: 0; }
.device-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.device-list li:last-child { border-bottom: 0; }
.device-list form { margin: 0; }
.device-list .tag { margin-left: 6px; }
.check-line { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; cursor: pointer; line-height: 1.4; }
.check-line input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--brand-accent); }
.check-line em { font-style: normal; color: var(--text-muted); font-size: .8rem; }
.card > h2 + p.muted, .card > h2 + .muted { margin-top: -.2em; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.auth-card .code-input { width: 100%; }
.auth-card .stack + p { margin-top: 16px; margin-bottom: 0; }

/* ---------- Фаза 3: гроші ---------- */
.month-label { font-size: 1.05rem; min-width: 11ch; text-align: center; }
.row-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.row-2 input, .row-2 select { width: 100%; }
.stack input:not([type=checkbox]):not([type=radio]), .stack select, .stack textarea { width: 100%; }
.stat-table td, .stat-table th { padding: 8px 10px; }
.money-head { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-bottom: 14px; }
.money-head .label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 2px; }
.pick-list { list-style: none; margin: 0; padding: 0; }
.pick-list li { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); }
.pick-list li:last-child { border-bottom: 0; }
.pick { display: flex; align-items: center; gap: 12px; padding: 10px 0; cursor: pointer; flex: 1 1 auto; min-width: 0; }
.pick input { width: 18px; height: 18px; flex: none; accent-color: var(--brand-accent); }
.pick .grow { display: flex; flex-direction: column; gap: 2px; }
.pick-title { font-weight: 550; }
.pick:has(input:not(:checked)) { opacity: .6; }
.pick-total { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--border); font-size: 1.05rem; text-align: right; }
.export { position: relative; }
.export > summary { list-style: none; }
.export-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; width: 300px; display: flex; flex-direction: column; gap: 10px; margin: 0; }
.export-pop .row { margin: 0; flex-wrap: nowrap; }
.export-pop input, .export-pop select { width: 100%; }
.bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; height: 140px; align-items: end; margin-top: 6px; }
.bar-col { display: flex; flex-direction: column; align-items: stretch; height: 100%; gap: 4px; }
.bar-pair { flex: 1 1 auto; display: flex; align-items: flex-end; gap: 2px; }
.bar { flex: 1 1 0; border-radius: 3px 3px 0 0; min-height: 1px; }
.bar-billed { background: color-mix(in srgb, var(--text-muted) 45%, transparent); }
.bar-received { background: var(--brand-accent); }
.bar-label { font-size: .7rem; color: var(--text-muted); text-align: center; }
.legend { margin-top: 8px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.sw-billed { background: color-mix(in srgb, var(--text-muted) 45%, transparent); }
.sw-received { background: var(--brand-accent); margin-left: 8px; }
.expense-list li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.expense-list form { margin: 0; }
@media (max-width: 760px) {
  .export-pop { right: auto; left: 0; width: min(300px, calc(100vw - 32px)); }
  .bars { height: 110px; gap: 3px; }
}
.grid-top { align-items: start; }

/* ---------- Доступи ---------- */
.input-copy { display: flex; gap: 6px; align-items: center; }
.input-copy input { flex: 1 1 auto; min-width: 0; }
.cred-list { list-style: none; margin: 0; padding: 0; }
.cred-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.cred-list li:last-child { border-bottom: 0; }
.cred-list form { margin: 0; }
.cred-list .grow { min-width: 0; overflow-wrap: anywhere; }

/* ---------- Дошка (канбан) ---------- */
.board-hint { margin: -6px 0 12px; }
.board { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.board-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-height: 200px; display: flex; flex-direction: column; }
.board-col-head { display: flex; flex-direction: column; gap: 2px; padding: 2px 4px 10px; }
.board-col-head h2 { margin: 0; font-size: .95rem; display: flex; align-items: center; gap: 6px; }
.board-drop { display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; min-height: 120px; border-radius: var(--radius-sm); transition: background .15s; }
.board-col.is-over .board-drop { background: color-mix(in srgb, var(--brand-accent) 14%, transparent); outline: 2px dashed var(--brand-accent); outline-offset: 2px; }
.board-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; cursor: grab; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
.board-card:active { cursor: grabbing; }
.board-card.is-dragging { opacity: .45; }
.board-card.is-overdue { border-left: 3px solid var(--danger); }
.board-title { font-weight: 600; text-decoration: none; line-height: 1.3; }
.board-title:hover { text-decoration: underline; }
.board-card .meta a { text-decoration: none; }
.board-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.board-move { margin: 0; }
.board-pay { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 20px; }
.board-pay a { margin-left: auto; }
.board-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.board-actions form { margin: 0; }
.board-move select { min-height: 30px; padding: 3px 24px 3px 8px; font-size: .8rem; width: auto; }
.board-empty { text-align: center; padding: 20px 0; }
.board-toast { position: fixed; right: 20px; bottom: 20px; z-index: 30; background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow); max-width: 360px; font-size: .9rem; }
.board-toast.is-error { background: var(--danger); color: #fff; }
@media (hover: hover) { .board-actions { display: none; } .board-card:hover .board-actions, .board-card:focus-within .board-actions { display: flex; } }
@media (max-width: 760px) {
  .board { grid-template-columns: repeat(4, 82vw); scroll-snap-type: x mandatory; }
  .board-col { scroll-snap-align: start; }
}
.board-marker { height: 4px; border-radius: 99px; background: var(--brand-accent); margin: -2px 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-accent) 25%, transparent); }
.board-card { transition: box-shadow .15s, transform .15s; }
.board-card.is-dropped { animation: board-drop .5s ease-out; }
@keyframes board-drop { from { transform: scale(1.03); box-shadow: 0 0 0 3px var(--brand-accent); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .board-card, .board-card.is-dropped { transition: none; animation: none; } }
.board-edit { position: relative; }
.board-edit > summary { list-style: none; }
.board-edit[open] { flex-basis: 100%; }
.board-edit[open] > form { margin-top: 8px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.board-card:has(.board-edit[open]) .board-actions { display: flex; }
.board-card:has(.board-edit[open]) { cursor: default; }
.board-move select { width: 64px; }

/* Дошка: компактні дії на картці + меню «⋯» */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font: inherit; font-size: .9rem; cursor: pointer; list-style: none; line-height: 1; }
.icon-btn:hover { color: var(--text); border-color: var(--text-muted); }
.icon-btn-text { font-size: .8rem; font-weight: 600; }
details > summary.icon-btn::-webkit-details-marker { display: none; }
.board-menu { position: relative; }
.board-menu[open] > summary { color: var(--text); border-color: var(--brand-accent); }
.board-menu-pop { position: absolute; z-index: 25; top: calc(100% + 6px); left: 0; min-width: 210px; display: flex; flex-direction: column; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); margin: 0; animation: menu-in .12s ease-out; }
.board-menu-pop button { text-align: left; background: none; border: 0; border-radius: var(--radius-sm); padding: 8px 10px; font: inherit; font-size: .9rem; color: var(--text); cursor: pointer; }
.board-menu-pop button:hover:not(:disabled) { background: var(--surface-2); }
.board-menu-pop button:disabled { color: var(--text-muted); cursor: default; }
.board-menu-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: 8px 10px 2px; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .board-menu-pop { animation: none; } }
.board-card:has(.board-menu[open]) .board-actions { display: flex; }
.board-card:has(.board-menu[open]) { z-index: 5; position: relative; }

/* 💬 Нотатка на картці — робочий статус для себе */
.board-note > summary { list-style: none; }
.board-note > summary::-webkit-details-marker { display: none; }
.board-note-text { display: block; cursor: pointer; font-size: .85rem; line-height: 1.35; padding: 6px 8px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--brand-accent) 12%, transparent); border-left: 3px solid var(--brand-accent); color: var(--text); white-space: pre-wrap; word-break: break-word; }
.board-note-text:hover { background: color-mix(in srgb, var(--brand-accent) 20%, transparent); }
.board-note-at { font-size: .7rem; color: var(--text-muted); margin-left: 4px; white-space: nowrap; }
.board-note[open] > .board-note-text { display: none; }
.board-note-new[open] { flex-basis: 100%; }
.board-note-new[open] > summary { display: none; }
.board-note-form { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.board-note-form textarea { font-size: .85rem; min-height: 56px; resize: vertical; }
.board-card:has(.board-note[open]) { cursor: default; }
.board-card:has(.board-note-new[open]) .board-actions { display: flex; }

/* Нагадування */
.rem-list li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0 9px 10px; border-bottom: 1px solid var(--border); border-left: 3px solid var(--text-muted); }
.rem-list li:last-child { border-bottom: 0; }
.rem-bad { border-left-color: var(--danger) !important; }
.rem-warn { border-left-color: var(--brand-accent) !important; }
.rem-title { font-weight: 550; text-decoration: none; }
.rem-title:hover { text-decoration: underline; }
.rem-snooze { display: flex; gap: 3px; margin: 0; flex-shrink: 0; }
.rem-snooze .icon-btn { min-width: 28px; height: 26px; padding: 0 5px; font-size: .72rem; }
@media (hover: hover) { .rem-snooze { opacity: .35; } .rem-list li:hover .rem-snooze, .rem-list li:focus-within .rem-snooze { opacity: 1; } }
.client-note-mine { border-left-color: var(--brand-accent); background: color-mix(in srgb, var(--brand-accent) 12%, transparent); }

/* Календар */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 12px; }
.cal-dow { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: 0 6px 4px; }
.cal-day { min-height: 96px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; display: flex; flex-direction: column; gap: 3px; }
.cal-day.is-other { opacity: .45; }
.cal-day.is-weekend { background: var(--surface-2); }
.cal-day.is-today { border-color: var(--brand-accent); box-shadow: inset 0 0 0 1px var(--brand-accent); }
.cal-num { font-size: .8rem; color: var(--text-muted); padding: 0 3px; }
.cal-day.is-today .cal-num { color: var(--brand-accent); font-weight: 700; }
.cal-item { display: block; text-decoration: none; font-size: .76rem; line-height: 1.25; padding: 3px 5px; border-radius: 4px; border-left: 3px solid var(--text-muted); background: var(--surface-2); color: var(--text); overflow: hidden; }
.cal-item:hover { filter: brightness(1.15); }
.cal-item-title { display: block; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-item-sub { display: block; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-work { border-left-color: var(--info, #4a9eff); }
.cal-hosting { border-left-color: #a78bfa; }
.cal-support { border-left-color: #34d399; }
.cal-bill { border-left-color: var(--brand-accent); }
.cal-item.is-late { border-left-color: var(--danger); }
.cal-item.is-done { opacity: .5; text-decoration: line-through; }
.mt-m { margin-top: 16px; }
@media (max-width: 760px) {
  .cal { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
  .cal-day { min-height: 56px; padding: 2px; }
  .cal-item-sub { display: none; }
  .cal-item { font-size: .62rem; padding: 2px 3px; }
}
.rem-more { margin-top: 6px; }
.rem-more > summary { cursor: pointer; list-style: none; padding: 4px 0; }
.rem-more > summary::-webkit-details-marker { display: none; }
.rem-more[open] > summary { display: none; }

/* 🎤 Inbox */
.mic-card { padding: 10px 14px; }
.mic-row { display: flex; gap: 10px; align-items: center; }
.mic-form { display: flex; gap: 6px; align-items: center; margin: 0; }
.mic-form input[type="text"] { min-width: 0; }
.mic-btn { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--brand-accent); background: var(--surface); color: var(--brand-accent); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: transform .15s, background .15s; }
.mic-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mic-btn:hover { background: color-mix(in srgb, var(--brand-accent) 15%, transparent); }
.mic-btn.is-rec { background: var(--danger); border-color: var(--danger); color: #fff; animation: mic-pulse 1.2s ease-in-out infinite; }
.mic-btn:disabled { opacity: .4; cursor: not-allowed; }
@keyframes mic-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 50%, transparent); } 50% { box-shadow: 0 0 0 10px transparent; } }
.mic-status { margin: 6px 0 0; }
.inbox-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.inbox-item:last-child { border-bottom: 0; }
.inbox-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 4px; }
.inbox-text > summary { cursor: pointer; list-style: none; font-style: italic; color: var(--text-muted); }
.inbox-text > summary::-webkit-details-marker { display: none; }
.inbox-text > summary::before { content: '“'; } .inbox-text > summary::after { content: '”'; }
.inbox-reply { margin: 6px 0; }
.inbox-question { margin: 6px 0; color: var(--brand-accent); }
.inbox-actions { margin: 6px 0 0; }
.inbox-action { display: flex; gap: 8px; align-items: flex-start; padding: 5px 8px; border-left: 3px solid var(--brand-accent); background: var(--surface-2); border-radius: 0 4px 4px 0; margin-bottom: 4px; cursor: pointer; }
.inbox-action input { margin-top: 3px; }
.inbox-done li { padding: 2px 0; }
.inbox-discarded { opacity: .55; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.cal-key { display: inline-block; padding: 2px 8px; border-left: 3px solid var(--text-muted); background: var(--surface-2); border-radius: 0 4px 4px 0; }

/* Сайти: реєстр і монітор */
.health-counts a { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.w-med { width: 240px; max-width: 100%; }
.row.wrap { flex-wrap: wrap; }
.sites-table td .strong { font-weight: 600; text-decoration: none; }
.sites-table tr.is-muted { opacity: .55; }
.checks-strip { display: flex; gap: 2px; flex-wrap: wrap; }
.chk { width: 8px; height: 18px; border-radius: 2px; background: var(--ok); display: inline-block; }
.chk.bad { background: var(--danger); }
.check-inline { display: flex; gap: 8px; align-items: center; cursor: pointer; }

/* Послуги: вкладки, підсумки, прогрес */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.seg-item { padding: 7px 14px; text-decoration: none; color: var(--text); font-size: .92rem; border-right: 1px solid var(--border); }
.seg-item:last-child { border-right: 0; }
.seg-item.is-active { background: var(--text); color: var(--surface); }
.stats { display: flex; flex-wrap: wrap; gap: 10px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); min-width: 180px; }
.stat-label { font-size: .78rem; color: var(--text-muted); }
.stat strong { font-size: 1.15rem; }
.mb-m { margin-bottom: 16px; }
.services-table tr.is-muted { opacity: .55; }
.services-table .bar { display: inline-block; vertical-align: middle; width: 64px; height: 6px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.services-table .bar i { display: block; height: 100%; background: var(--brand-accent); }
.services-table .bar i.is-over { background: var(--danger); }

/* Масові дії у списках */
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 10px; border: 1px solid var(--brand-accent); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--brand-accent) 10%, transparent); }
.bulk-bar form { margin: 0; }
.sites-table input[type=checkbox] { width: 16px; height: 16px; }

/* Система: помилки */
.errors-table .trace { white-space: pre-wrap; font-size: .75rem; max-height: 260px; overflow: auto; background: var(--surface-2); padding: 8px; border-radius: var(--radius-sm); margin: 6px 0 0; }

/* ELM Connector */
.card-accent-box { border: 1px solid var(--brand-accent); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 12px; background: color-mix(in srgb, var(--brand-accent) 8%, transparent); }
.key-once { font-size: 1rem; user-select: all; word-break: break-all; }
.upd-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 4px 0; }
.upd-list form, form.inline { display: inline; margin: 0; }
.mb-s { margin-bottom: 8px; }
.connector-msg { padding: 6px 10px; border-radius: var(--radius-sm); background: var(--surface-2); }

/* ---------- Старі компоненти: підтягнути до нової мови ---------- */
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--raised); color: var(--muted); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.toolbar .end { margin-left: auto; color: var(--faint); font-size: var(--fs-small); }
.card-head h2 { margin: 0; }
.meta { font-size: var(--fs-small); color: var(--faint); }
.meta a { color: var(--muted); }
.bucket { font-size: var(--fs-small); text-transform: none; letter-spacing: 0; color: var(--faint); font-weight: 400; margin: 16px 0 4px; }
.bucket-overdue { color: var(--negative); }
.work-list li, .project-list li, .device-list li, .cred-list li, .stage, .inbox-item, .pick-list li, .money-list li { border-bottom-color: var(--rule); }
.checkbox { width: 18px; height: 18px; border: 1.5px solid var(--control); border-radius: 5px; background: transparent; }
.checkbox:hover { border-color: var(--accent); background: var(--accent-tint); }
.chip { height: 32px; padding: 0 12px; border-color: var(--control); font-size: 13px; }
.chip:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); color: var(--text); }
.subform { border: 1px dashed var(--control); background: transparent; border-radius: var(--radius-card); }
.notes, .note, .secret { background: var(--raised); }
.status-bar .label, .money-head .label, .board-menu-label, .cal-dow { text-transform: none; letter-spacing: 0; font-size: var(--fs-small); color: var(--faint); }
.icon-btn { height: var(--ctl); min-width: var(--ctl); padding: 0 10px; border-color: var(--control); background: transparent; color: var(--muted); border-radius: var(--radius-ctl); }
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.board-move select { height: var(--ctl); min-height: 0; padding: 0 28px 0 10px; font-size: 13px; width: 72px; }
.board-col { background: var(--surface); border: 0; }
.board-card { background: var(--raised); border: 0; box-shadow: none; }
.board-card.is-overdue { box-shadow: inset 3px 0 0 var(--negative); border-left: 0; }
.board-menu-pop { background: var(--raised); border: 1px solid var(--control); }
.board-menu-pop button:hover:not(:disabled) { background: var(--hover); }
.board-toast { background: var(--raised); color: var(--text); box-shadow: 0 16px 40px rgba(0, 0, 0, .6); }
.board-toast.is-error { background: var(--neg-bg); color: var(--negative); }
.cal-day { background: var(--surface); border: 0; }
.cal-day.is-weekend { background: #101010; }
.cal-day.is-today { box-shadow: inset 0 0 0 1px var(--accent); }
.cal-item { background: var(--raised); }
.cal-work { border-left-color: var(--blue); }
.seg { display: inline-flex; gap: 24px; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; overflow-x: auto; }
.seg-item { padding: 8px 0; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted); font-weight: 500; text-decoration: none; }
.seg-item:hover { color: var(--strong); }
.seg-item.is-active { background: none; color: var(--text); border-bottom-color: var(--accent); }
.stats { display: flex; flex-wrap: wrap; gap: 0; background: var(--surface); border-radius: var(--radius-card); }
.stat { border: 0; border-left: 1px solid var(--rule); border-radius: 0; background: none; padding: 16px var(--pad); min-width: 200px; }
.stat:first-child { border-left: 0; }
.stat-label { color: var(--faint); font-size: var(--fs-small); }
.stat strong { font-size: 20px; line-height: 28px; font-weight: 500; font-variant-numeric: tabular-nums; }
.bulk-bar { border: 0; background: var(--accent-tint); border-radius: var(--radius-card); }
.health-counts a { border-color: var(--control); }
.sites-table tr.is-muted td, .services-table tr.is-muted td { opacity: .55; }
.sites-table tr.is-muted, .services-table tr.is-muted { opacity: 1; }
.services-table .bar { background: var(--raised); border: 0; }
.card-accent-box { border: 0; background: var(--accent-tint); border-radius: var(--radius-card); }
.connector-msg { background: var(--raised); }
.errors-table .trace { background: var(--ground); }
.inbox-action { background: var(--raised); }
.mic-btn { width: var(--ctl); height: var(--ctl); border: 1px solid #2d3080; background: var(--blue-tint); color: var(--blue-ink); }
.mic-btn svg { width: 18px; height: 18px; stroke-width: 1.6; }
.mic-btn:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
.month-label { font-size: var(--fs-section); font-weight: 600; }
.export-pop { background: var(--raised); box-shadow: 0 16px 40px rgba(0, 0, 0, .6); }
.rem-list li { border-left-color: var(--control); border-bottom-color: var(--rule); }
.rem-bad { border-left-color: var(--negative) !important; }
.rem-warn { border-left-color: var(--warn) !important; }
.rem-snooze .icon-btn { height: 28px; min-width: 28px; }
.client-note { background: var(--raised); }
.client-note-mine { background: var(--accent-tint); }
.form-actions { gap: 8px; }

/* ---------- Адаптив ---------- */
@media (max-width: 1100px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: 64px 1fr; }
  .side { display: none; }
  .top { padding: 0 16px; }
  .toplogo { display: flex; align-items: center; flex: none; }
  .toplogo .logo { width: 120px; }
  .search { width: auto; flex: 1; }
  .top .date { display: none; }
  .main { padding: 20px 16px 96px; }
  .s3, .s4, .s5, .s6, .s7, .s8, .s9 { grid-column: 1 / -1; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis > div:nth-child(3) { border-left: 0; }
  .kpis > div:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .grid, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; height: 64px; padding: 0 8px env(safe-area-inset-bottom); background: var(--ground); border-top: 1px solid var(--rule); z-index: 30; }
  .tabbar > a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; color: var(--muted); text-decoration: none; position: relative; }
  .tabbar > a svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar > a:hover { color: var(--strong); }
  .tabbar > a[aria-current=page] { color: var(--strong); }
  .tabbar > a[aria-current=page] svg { stroke: var(--accent); }
  .tabmore { display: flex; }
  .tabmore > summary { list-style: none; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; color: var(--muted); cursor: pointer; }
  .tabmore > summary::-webkit-details-marker { display: none; }
  .tabmore > summary svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.5; }
  .tabmore[open] > summary { color: var(--strong); }
  .tabmore[open] > summary svg { stroke: var(--accent); }
  .tabbar .badge { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--negative); color: #fff; font-size: 10px; line-height: 16px; text-align: center; }
  .t2, .ladderkey, .kpis .l, .kpis .d, .lgroup, .ph .meta, .foot, .days, .due, th, .pill, .tag { font-size: 13px; }
  .board-toast { bottom: 80px; }
  /* «Ще»: повне меню знизу */
  .more-sheet { position: fixed; left: 0; right: 0; bottom: 64px; z-index: 29; background: var(--ground); border-top: 1px solid var(--rule); padding: 8px 16px 16px; max-height: calc(100vh - 128px); overflow-y: auto; box-shadow: 0 -24px 48px rgba(0, 0, 0, .7); }
  .more-sheet .nav a, .more-sheet .nav button { height: 44px; }
}
@media (max-width: 1100px) and (min-width: 641px) {
  th, td { padding-left: 8px; padding-right: 8px; }
}
@media (max-width: 640px) {
  .top { position: relative; gap: 8px; }
  .top .search, .top .who { display: none; }
  .toplogo .logo { width: 136px; }
  .top .right { gap: 8px; }
  .msearch { display: block; }
  .msearch[open] > summary { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); }
  .sheet { position: fixed; left: 0; right: 0; top: 64px; bottom: 64px; z-index: 28; background: var(--ground); border-bottom: 1px solid var(--rule); padding: 12px 16px 16px; overflow-y: auto; box-shadow: 0 24px 48px rgba(0, 0, 0, .7); }
  .sinput { position: relative; }
  .sinput svg { position: absolute; left: 14px; top: 50%; margin-top: -8px; width: 16px; height: 16px; stroke: var(--faint); fill: none; stroke-width: 1.5; }
  .sinput input { width: 100%; padding-left: 40px; border-color: var(--accent); font-size: 16px; }
  .schips { margin: 12px -16px 8px; padding: 0 16px; }
  .schip { height: 40px; border-radius: 20px; padding: 0 16px; }
  .sheet .lrow { margin: 0 -8px; padding: 6px 8px; }

  .titlerow { flex-wrap: wrap; }
  .titlerow .actions { margin-left: 0; width: 100%; }
  .titlerow .actions .btn { flex: 1; }
  .qentry { grid-template-columns: minmax(0, 1fr) 88px; }
  .qentry .what { grid-column: 1 / -1; }
  .qentry .mic { display: none; }
  .qentry .go { grid-column: 1 / -1; }
  .task { grid-template-columns: 24px minmax(0, 1fr) auto; }
  .task .due { display: none; }
  .tick { width: 22px; height: 22px; }
  .ladderkey { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 12px; }
  .debt { grid-template-columns: minmax(0, 1fr) auto auto; }
  .debt .days { display: none; }
  .ph { flex-wrap: wrap; row-gap: 2px; }
  .kpis { grid-template-columns: 1fr; }
  .kpis > div { display: grid; grid-template-columns: 1fr auto; align-items: baseline; border-left: 0 !important; border-top: 1px solid var(--rule); padding: 12px var(--pad); }
  .kpis > div:first-child { border-top: 0; }
  .kpis .v { font-size: 16px; line-height: 24px; grid-row: 1 / 3; grid-column: 2; text-align: right; }
  .toolbar .end { display: none; }
  .incident { grid-template-columns: 1fr; }
  .incact { display: grid; grid-template-columns: 1fr 1fr; }
  .incact .primary { grid-column: 1 / -1; }
  .inline-pop { position: fixed; left: 16px; right: 16px; top: auto; bottom: 80px; width: auto; }
  .desk-only { display: none; }
  /* Таблиці → рядки у два рівні */
  table.resp { min-width: 0; }
  table.resp thead { display: none; }
  table.resp tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; border-top: 1px solid var(--rule); padding: 10px 12px; margin: 0 -12px; border-radius: 6px; }
  table.resp tr.hot, table.resp tr.bad { background: var(--neg-tint); border-top-color: transparent; margin-top: 2px; }
  table.resp tr.warn { background: var(--warn-tint); border-top-color: transparent; margin-top: 2px; }
  table.resp td { border: 0; height: auto; padding: 0; background: transparent !important; }
  table.resp td.hide { display: none; }
  table.resp td.sub { grid-column: 1; font-size: 13px; color: var(--faint); }
  table.resp td.am, table.resp td.st { grid-column: 2; grid-row: 1; text-align: right; }
  table.resp td.act { grid-column: 2; grid-row: 2; text-align: right; }
  table.resp td.act .link, table.resp td.act summary { font-size: 13px; }
  .table-wrap table:not(.resp) { min-width: 560px; }
  .form-grid { grid-template-columns: 1fr; }
  .stat { min-width: 0; flex: 1 1 100%; border-left: 0; border-top: 1px solid var(--rule); }
  .stat:first-child { border-top: 0; }
  .codes { columns: 1; }
  .hide-sm { display: none; }
}
.btn.ai.is-rec { background: var(--negative); border-color: var(--negative); color: #fff; animation: mic-pulse 1.2s ease-in-out infinite; }
td a, .lrow a:not(.link):not(.btn) { text-decoration: none; }
td a:not(.btn):not(.link):hover { color: var(--accent); }

/* Обслуговування: місяці як у Notion */
.mgrid th.mh, .mgrid td.mc { text-align: center; padding-left: 2px; padding-right: 2px; width: 40px; }
.mgrid th.mh.cur { color: var(--accent); }
.mgrid td.mc { position: relative; }
.mcell { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; list-style: none; border: 1px solid transparent; transition: background-color .12s, border-color .12s; }
.mcell::-webkit-details-marker { display: none; }
.mcell.none { cursor: default; }
.mcell.paid { background: var(--pos-bg); color: var(--positive); }
.mcell.part { background: var(--warn-bg); color: var(--warn); }
.mcell.wait { background: var(--blue-tint); color: var(--blue-ink); }
.mcell.warn { background: var(--warn-bg); color: var(--warn); }
.mcell.bad { background: var(--neg-bg); color: var(--negative); }
.mcell.skip { background: var(--raised); color: var(--faint); }
.mcell.unknown { background: transparent; border-color: var(--rule); color: var(--faint); }
.mcell.future { border: 1px dashed var(--control); }
.mcell.cur { box-shadow: 0 0 0 1px var(--accent); }
.mcell:hover { border-color: var(--accent); }
.mdet[open] > .mcell { border-color: var(--accent); }
.mpop { width: 300px; text-align: left; font-weight: 400; }
.mpop .mrow { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.mpop form { margin: 0; }
.mpop .link { font-size: 13px; }
.table-wrap:has(.mgrid) { overflow: visible; }
.mdet.lft .inline-pop { right: auto; left: 0; }
@media (max-width: 1100px) { .table-wrap:has(.mgrid) { overflow-x: auto; } .mdet .inline-pop, .mdet.lft .inline-pop { position: fixed; left: 16px; right: 16px; top: auto; bottom: 80px; width: auto; } }
.clarify { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 4px; }
.clarify form { margin: 0; }
.clarify-answer { display: flex; gap: 8px; flex: 1 1 320px; }
.clarify-answer input { flex: 1; min-width: 0; }
.inbox-question { color: var(--warn); }

/* Оплата роботи: один блок */
.payform { display: flex; flex-direction: column; gap: 10px; }
.paysum { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--faint); font-size: 13px; }
.paysum b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.paysum b.text-ok { color: var(--positive); } .paysum b.text-danger { color: var(--negative); }
.paystate { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--ground); border: 1px solid var(--control); border-radius: var(--radius-ctl); padding: 3px; }
.paystate label { position: relative; cursor: pointer; }
.paystate input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.paystate span { display: flex; align-items: center; justify-content: center; height: calc(var(--ctl) - 8px); border-radius: 6px; font-weight: 500; font-size: 13px; color: var(--muted); transition: background-color .12s, color .12s; white-space: nowrap; }
.paystate label:hover span { color: var(--text); }
.paystate .ps-none input:checked + span { background: var(--neg-bg); color: var(--negative); }
.paystate .ps-partial input:checked + span { background: var(--warn-bg); color: var(--warn); }
.paystate .ps-full input:checked + span { background: var(--pos-bg); color: var(--positive); }
.paystate input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.payform .btn { align-self: flex-start; }
.board-pay-form { margin-top: 8px; padding: 10px; border-radius: var(--radius-ctl); background: var(--surface); }
.board-pay-edit[open] { flex-basis: 100%; }
.board-card:has(.board-pay-edit[open]) .board-actions { display: flex; }
.board-card:has(.board-pay-edit[open]) { cursor: default; }

/* Шапка на планшеті/телефоні: закріплена, зліва «Меню» і «Назад» */
.menubtn, .backbtn { display: none !important; }
@media (max-width: 1100px) {
  .top { position: sticky; top: 0; z-index: 30; background: var(--ground); }
  .menubtn, .backbtn { display: inline-flex !important; flex: none; }
  .top { gap: 8px; }
}
@media (max-width: 640px) {
  .top { position: sticky; padding: 0 12px; }
  .toplogo .logo { width: 112px; }
  .backbtn + .toplogo .logo { width: 96px; }
}
input[type=file] { height: auto; padding: 6px; color: var(--muted); }
input[type=file]::file-selector-button { height: 30px; margin-right: 10px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--control); background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.rem-snooze .icon-btn { height: var(--ctl); min-width: var(--ctl); }

/* Клієнти: сайти в колонці */
.clients-table .sitelist { white-space: normal; }
.clients-table .sitelist a { display: inline-block; margin: 0 10px 2px 0; }
.clients-table .sitelist a.faint { text-decoration: line-through; }

/* Заголовок секції в картці: жовта мітка зліва, лічильник, дія справа */
.sechead { display: flex; align-items: center; gap: 10px; margin: -2px 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--rule); }
.sechead h2 { margin: 0; color: var(--accent); position: relative; padding-left: 12px; }
.sechead h2::before { content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 3px; border-radius: 2px; background: var(--accent); }
.sechead > .btn { margin-left: auto; }

/* Картка клієнта: отримано за весь час */
.received { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--rule); }
.received .label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.received .big { margin: 0; }
.received .text-ok { color: var(--positive, #3ddc84); }
.kv-list { list-style: none; margin: 8px 0 12px; padding: 0; }
.kv-list li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--rule); font-size: 13px; }
.kv-list li:last-child { border-bottom: 0; }
.kv-list li span { color: var(--muted); }

/* Піддомени деревом під основним доменом */
.subarrow { color: var(--faint, #555); margin-right: 6px; font-family: ui-monospace, monospace; }
.sites-table tr.is-sub td:nth-child(2) .t1 { padding-left: 18px; }
.sites-table tr.is-sub td:nth-child(2) a { font-weight: 400; color: var(--muted); }
.sites-table tr.is-sub td { border-top-color: transparent; }
.project-list li.is-sub { padding-left: 22px; border-top: 0; }
.project-list li.is-sub > a.strong { font-weight: 400; color: var(--muted); }
.clients-table .sitelist a.is-sub { color: var(--muted); }
.clients-table .sitelist a.is-sub .subarrow { margin-right: 3px; }

/* ── Дошка: панелі під кнопками картки — кнопки не стрибають, форма плавно розкривається ── */
.board-panel { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .22s cubic-bezier(.2,.7,.2,1), opacity .18s ease, margin-top .22s ease; margin-top: 0; }
.board-panel.is-open { grid-template-rows: 1fr; opacity: 1; margin-top: 8px; }
.board-panel-in { overflow: hidden; min-height: 0; }
.board-panel-box { padding: 10px; border-radius: var(--radius-ctl); background: var(--surface); margin: 0; }
.board-panel .board-pay-form { margin-top: 0; }
.board-card.has-panel .board-actions { display: flex; }
.board-card.has-panel { cursor: default; }
[data-board-toggle][aria-expanded="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-tint); }

/* ── Мікроанімації: м'яко й коротко, вимикаються з prefers-reduced-motion ── */
.btn, .icon-btn, .schip, .tabs a, .nav a { transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .1s ease; }
.btn:active, .icon-btn:active { transform: scale(.97); }
.board-card { transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease; }
@media (hover: hover) { .board-card:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.35); } }
.board-card.is-dragging { transform: rotate(1deg) scale(1.02); }
.flash { animation: flash-in .28s cubic-bezier(.2,.7,.2,1); }
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.canvas { animation: page-in .22s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
details.inline-act[open] > :not(summary), details.export[open] > :not(summary), .board-note[open] > form, .msearch[open] .sheet, .tabmore[open] .more-sheet { animation: menu-in .16s ease-out; }
.lrow, .clients-table tbody tr, .sites-table tbody tr { transition: background-color .12s ease; }
@media (prefers-reduced-motion: reduce) {
  .board-panel { transition: none; }
  .btn, .icon-btn, .board-card, .lrow { transition: none; }
  .btn:active, .icon-btn:active, .board-card:hover, .board-card.is-dragging { transform: none; }
  .flash, .canvas, details[open] > * { animation: none !important; }
}
.board-pay-form .paystate span { font-size: 12px; padding: 0 4px; }
.board-pay-form .paystate { gap: 2px; }
.tab-hint { margin: -4px 0 12px; }

/* Гроші → По роках */
.years { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.year-row { border: 1px solid var(--rule); border-radius: var(--radius-card); background: var(--surface); }
.year-row > summary { list-style: none; display: grid; grid-template-columns: 70px repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; align-items: center; padding: 14px 18px; cursor: pointer; }
.year-row > summary::-webkit-details-marker { display: none; }
.year-row[open] > summary { border-bottom: 1px solid var(--rule); }
.year-y { font-size: 20px; font-weight: 600; }
.year-cur { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; min-width: 0; }
.year-cur strong { font-size: 16px; }
.year-bar { flex-basis: 100%; height: 4px; border-radius: 2px; background: var(--rule); overflow: hidden; }
.year-bar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width .4s ease; }
.year-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; padding: 14px 18px 6px; animation: menu-in .16s ease-out; }
.year-col .label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.year-col .kv-list li a { color: var(--text); }
@media (max-width: 760px) { .year-row > summary { grid-template-columns: 1fr; gap: 8px; } }
.year-y small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
.year-eur strong { font-size: 18px; color: var(--accent); }
.year-eur .year-bar i { background: var(--accent); }
.year-cur:not(.year-eur) .year-bar i { background: #5a5a5a; }

/* Боржники: за що борг */
.debt-items { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.debt-items li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.debt-items a { color: var(--text); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.debt-items .di-kind { font-size: 11px; padding: 1px 7px; }
.debt-items .di-hosting .di-kind { background: rgba(77,81,245,.2); color: #b3b8ff; }
.debt-items .di-support .di-kind { background: rgba(255,211,0,.14); color: var(--accent); }
.debt-items .di-left { margin-left: auto; font-weight: 600; white-space: nowrap; }

#service-payments .di-host { background: rgba(77,81,245,.2); color: #b3b8ff; }
#service-payments .di-sup { background: rgba(255,211,0,.14); color: var(--accent); }
/* видалення сайту: перенести на інший / видалити з усім */
.del-pop label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.del-pop label input[type=radio] { width: auto; margin: 0; accent-color: var(--accent, #ffd400); }
.del-pop p { margin: 0; }
/* сайт: хто робив + прапорці «хостинг» / «обслуговую» */
.tag-host { color: #b3b8ff; background: rgba(77,81,245,.2); }
.tag-sup { color: var(--accent); background: rgba(255,211,0,.14); }
.rel-tags { white-space: nowrap; }
/* сторінка сайту: головна робота (розробка — жовта, оновлення сайту — синя) */
.major-works { display: grid; gap: 8px; }
.major-work { --mw: var(--accent, #ffd300); position: relative; display: grid; grid-template-columns: 1fr auto auto auto; grid-template-areas: "kind sum pill menu" "title sum pill menu"; align-items: center; gap: 2px 14px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--mw) 9%, transparent); border: 1px solid color-mix(in srgb, var(--mw) 35%, transparent); }
.major-work.mw-redesign { --mw: #8b91ff; }
.major-work:hover { border-color: var(--mw); }
.major-work .mw-kind { grid-area: kind; font-size: 12px; color: var(--mw); text-transform: uppercase; letter-spacing: .04em; }
.major-work .mw-title { grid-area: title; font-weight: 600; color: inherit; text-decoration: none; }
.major-work .mw-title:hover { text-decoration: underline; }
.major-work .mw-sum { grid-area: sum; font-size: 20px; font-weight: 700; white-space: nowrap; }
.major-work .pill { grid-area: pill; }
.major-work .mw-menu { grid-area: menu; position: relative; }
.major-work .mw-menu .full { width: 100%; }
#site-works h2 { display: flex; align-items: center; gap: 8px; }
/* клієнт (посередник) */
.via { color: var(--text-muted); font-size: .92em; }
.via a { color: inherit; }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.paid-ok { color: var(--positive); font-size: 13px; font-weight: 600; white-space: nowrap; }
/* список сайтів: ↗ відкрити сайт у новій вкладці */
.sites-table a.ext { margin-left: 6px; padding: 0 4px; border-radius: 4px; color: var(--text-muted); text-decoration: none; font-size: 13px; opacity: .55; }
.sites-table tr:hover a.ext { opacity: 1; }
.sites-table a.ext:hover { color: var(--accent, #ffd300); background: rgba(255,211,0,.1); }

/* кілька маленьких форм-кнопок у рядку таблиці (кошик: «Повернути» · «Назавжди») */
.row-actions form { display: inline-block; margin-left: 4px; }

/* «Під наглядом»: міні-графік оцінки по тижнях */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 40px; margin: 8px 0; }
.spark span { flex: 1; max-width: 18px; min-height: 2px; background: var(--accent, #f5c400); border-radius: 2px 2px 0 0; opacity: .85; }
.spark span:last-child { opacity: 1; }

/* Сповіщення: стрічка CRM і перемикачі Telegram */
.notif-feed { list-style: none; margin: 0; padding: 0; }
.notif-day { font-size: 12px; color: var(--faint); padding: 14px 0 6px; }
.notif { padding: 10px 12px; border-top: 1px solid var(--rule); border-left: 2px solid transparent; }
.notif.is-new { border-left-color: var(--accent); background: var(--raised); }
.notif-head { display: flex; align-items: baseline; gap: 8px; }
.notif-time { margin-left: auto; font-variant-numeric: tabular-nums; }
.notif-text { color: var(--muted); font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }
.notif-tg { font-size: 11px; padding: 1px 6px; border-radius: 8px; background: var(--blue-tint); color: var(--blue-ink); white-space: nowrap; }
.notif-switches { gap: 12px; margin: 12px 0; }
.notif-switches .check-inline, .notif-extra .check-inline { align-items: flex-start; }
.notif-switches input, .notif-extra input { margin-top: 3px; flex: none; }
.notif-hint { display: block; margin-top: 1px; }
.notif-extra { border-top: 1px solid var(--rule); padding-top: 10px; }
.notif-extra summary { cursor: pointer; color: var(--muted); }
.notif-extra ul { margin-top: 10px; }

/* Банери модулів (hook layout.notices) і пауза моніторингу */
.notice-bar { padding: 10px 14px; margin-bottom: 16px; border-radius: 10px; border: 1px solid var(--accent); background: var(--raised); font-size: 14px; }
.pause-form { display: grid; gap: 14px; margin: 14px 0; }
.pause-form fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.pause-form legend { margin-bottom: 6px; }
.mon-form { display: grid; gap: 12px; }
.mon-form .check-inline { align-items: flex-start; }
.mon-form .check-inline input { margin-top: 3px; flex: none; }
.mon-row { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-left: 24px; }
.mon-row input[type=time], .mon-row select { width: auto; display: inline-block; margin-left: 4px; }
.mon-passes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 6px 0 12px; }
.mon-passes > div { display: grid; gap: 2px; }
.mon-passes strong { font-size: 18px; }
@media (max-width: 640px) { .mon-passes { grid-template-columns: 1fr; } }
