/*
 * Iris Platform — дизайн-система застосунку (портовано з docs/design/*).
 * Правила світу — DESIGN.md. Джерело токенів — iris-brandbook (монохром) +
 * UI-акцент soft violet (тільки інтерактив). Не хардкодити кольори у в'юхах.
 */

:root {
  color-scheme: dark;

  --bg:#000000; --surface-1:#0A0A0B; --surface-2:#141416; --surface-3:#1C1C1F; --surface-input:#0E0E10;
  --line:rgba(255,255,255,.08); --line-strong:rgba(255,255,255,.14); --line-faint:rgba(255,255,255,.05);
  --text:#F5F5F7; --text-2:#A6A6AD; --text-3:#6E6E76; --text-on-accent:#FFFFFF;

  --violet-200:#D4CBFB; --violet-300:#BCAEF9; --violet-400:#A08FF3;
  --violet-500:#8A78EE; --violet-600:#7A67E6; --violet-700:#6857D6;
  --accent:var(--violet-600); --accent-hover:var(--violet-500); --accent-active:var(--violet-700);
  --accent-text:var(--violet-300);
  --accent-tint:rgba(138,120,238,.12); --accent-tint-2:rgba(138,120,238,.20);
  --focus-ring:rgba(138,120,238,.55); --accent-glow:0 0 0 4px rgba(138,120,238,.16);

  --success:#35A379; --danger:#D25A4C; --warning:#D19A2A; --info:#5A8FCB;
  --success-tint:rgba(53,163,121,.14); --danger-tint:rgba(210,90,76,.14); --warning-tint:rgba(209,154,42,.14);

  --font-ui:"Inter",-apple-system,BlinkMacSystemFont,"SF Pro Text","Helvetica Neue",Arial,sans-serif;
  --font-brand:"Archivo","Helvetica Neue",Arial,sans-serif;
  --font-mono:"JetBrains Mono",ui-monospace,"SF Mono",Menlo,monospace;

  --r-sm:8px; --r-md:12px; --r-lg:18px; --r-xl:24px; --r-full:9999px;
  --shadow-1:0 1px 2px rgba(0,0,0,.4); --shadow-2:0 8px 30px rgba(0,0,0,.45);
  --ease:cubic-bezier(.22,.61,.36,1); --dur-1:120ms; --dur-2:180ms; --dur-3:260ms;
}

html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font-ui); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; letter-spacing: -.011em;
}
::selection { background: var(--accent-tint-2); color: #fff; }
/* Атрибут hidden ховає завжди — навіть елементи, яким клас задає display (плитки, сітки). */
[hidden] { display: none !important; }
.iris a { color: inherit; text-decoration: none; }
.iris button { font-family: inherit; cursor: pointer; }
.mono { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-2); letter-spacing: -.02em; }

/* ============ APP SHELL ============ */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface-1); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { padding: 22px 22px 18px; display: flex; align-items: center; gap: 10px; }
/* Логотип — лише з файлу власника (iris-brandbook, logo-master-*): знак у два рядки, задаємо тільки висоту. */
.brand img { height: 34px; width: auto; display: block; opacity: .96; }
.brand .badge { margin-left: auto; font: 500 10px/1 var(--font-mono); color: var(--text-3); border: 1px solid var(--line); padding: 4px 6px; border-radius: var(--r-full); letter-spacing: .04em; }

.nav { padding: 8px 12px; overflow-y: auto; flex: 1; }
.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 4px; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--text-3); text-transform: uppercase; padding: 8px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-md); color: var(--text-2); font-weight: 500; transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease); position: relative; }
.nav-item svg { width: 18px; height: 18px; flex: none; stroke-width: 1.6; opacity: .9; }
.nav-item .count { margin-left: auto; font: 500 11px/1 var(--font-mono); color: var(--text-3); }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--accent-tint); color: var(--text); }
.nav-item.active svg { color: var(--accent-text); opacity: 1; }
.nav-item.active .count { color: var(--accent-text); }

/* Розкривні розділи меню (docs/CRM_SPEC.md §1) */
.nav > * + * { margin-top: 2px; }
.nav-label-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-row { display: flex; align-items: center; gap: 2px; }
.nav-row > .nav-item { flex: 1; min-width: 0; }
.nav-toggle { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: var(--r-md); color: var(--text-3); background: none; border: none; transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.nav-toggle:hover { background: var(--surface-3); color: var(--text); }
.nav-toggle:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--focus-ring); }
.nav-toggle svg { width: 14px; height: 14px; stroke-width: 2; transition: transform var(--dur-1) var(--ease); }
.nav-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.nav-sub { margin: 2px 0 6px 19px; padding-left: 10px; border-left: 1px solid var(--line); }
.nav-sub > * + * { margin-top: 1px; }
.nav-subitem { padding: 6px 10px; font-size: 13px; }
.nav-item.is-soon { color: var(--text-3); cursor: default; }
.nav-item.is-soon:hover { background: none; color: var(--text-3); }
.nav-item .soon { margin-left: auto; flex: none; font: 500 10px/1 var(--font-mono); letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); border: 1px solid var(--line); border-radius: var(--r-full); padding: 3px 6px; }
.userchip-form { margin: 0; }

/* Перемикач мови у верхній панелі */
.locale-switch { position: relative; }
.locale-switch summary { list-style: none; cursor: pointer; height: 32px; min-width: 42px; padding: 0 10px; display: grid; place-items: center; border-radius: var(--r-md); border: 1px solid var(--line); font: 500 12px/1 var(--font-mono); color: var(--text-2); transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.locale-switch summary::-webkit-details-marker { display: none; }
.locale-switch summary:hover { background: var(--surface-3); color: var(--text); }
.locale-switch summary:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--focus-ring); }
.locale-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 168px; padding: 6px; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow-1); z-index: 30; }
.locale-menu form { margin: 0; }
.locale-option { width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--r-md); background: none; border: none; color: var(--text-2); font-size: 13px; }
.locale-option:hover { background: var(--surface-3); color: var(--text); }
.locale-option:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--focus-ring); }
.locale-option.is-current { color: var(--text); font-weight: 600; }

/* Дошка зі статусами (заявки) */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
@media (max-width: 900px) { .board { grid-template-columns: 1fr; } }
.board-col { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px; min-height: 140px; transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease); }
.board-col.is-over { border-color: var(--focus-ring); background: var(--accent-tint); }
.board-col-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 10px; font-size: 13px; }
.board-cards { display: flex; flex-direction: column; gap: 8px; }
.board-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 12px 8px; cursor: grab; }
.board-card:active { cursor: grabbing; }
.board-card.is-dragging { opacity: .45; }
.board-card-title { font-weight: 600; font-size: 14px; color: var(--text); display: block; }
.board-card-meta { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; font-size: 12.5px; color: var(--text-2); }
.board-card-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12px; }
.board-card-actions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; border-top: 1px solid var(--line-faint); padding-top: 6px; }
.board-empty, .board-more { padding: 10px 4px; font-size: 12.5px; }

/* Графік: тиждень стрічками й календар місяця */
.week-scroll { overflow-x: auto; }
.week-grid, .month-grid { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 860px; }
.week-grid th, .week-grid td, .month-grid th, .month-grid td { border-bottom: 1px solid var(--line-faint); border-right: 1px solid var(--line-faint); padding: 8px; vertical-align: top; text-align: left; font-size: 12.5px; }
.week-grid thead th, .month-grid thead th { font-weight: 600; color: var(--text-2); background: var(--surface-1); }
.week-grid th[scope=row] { width: 170px; font-weight: 600; }
.week-grid th[scope=row] .subtle { display: block; font-weight: 400; }
.week-grid td { height: 64px; }
.week-grid .today, .month-grid .today { background: var(--accent-tint); }
.strip { display: flex; flex-direction: column; gap: 1px; padding: 5px 8px; margin-bottom: 4px; border-radius: 8px; background: var(--surface-3); border-left: 3px solid var(--text-3); color: var(--text); font-size: 12px; line-height: 1.3; text-decoration: none; }
.strip .mono { font-size: 11.5px; }
.strip.is-mine { border-left-color: var(--accent); }
a.strip:hover { background: var(--surface-2); }
.strip.small { flex-direction: row; gap: 6px; padding: 3px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.month-grid td { height: 108px; }
.month-grid td.outside { opacity: .4; }
.month-day { display: flex; justify-content: space-between; align-items: baseline; text-decoration: none; color: var(--text); margin-bottom: 4px; }
.month-date { font-weight: 600; font-size: 13px; }
.month-count { font-size: 11.5px; color: var(--text-3); }
.month-more { font-size: 11.5px; }

/* Дзвіночок сповіщень у верхній панелі */
.bell { position: relative; }
.bell summary { list-style: none; cursor: pointer; position: relative; width: 36px; height: 32px; display: grid; place-items: center; border-radius: var(--r-md); border: 1px solid var(--line); color: var(--text-2); transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.bell summary::-webkit-details-marker { display: none; }
.bell summary:hover { background: var(--surface-3); color: var(--text); }
.bell summary:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--focus-ring); }
.bell summary svg { width: 17px; height: 17px; stroke-width: 1.7; }
.bell-count { position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: var(--r-full); background: var(--accent); color: var(--text-on-accent); font: 600 10px/17px var(--font-mono); text-align: center; }
.bell-menu { position: absolute; right: 0; top: calc(100% + 6px); width: 360px; max-width: calc(100vw - 32px); background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow-2); z-index: 30; overflow: hidden; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.bell-head .link-plain { background: none; border: none; color: var(--text-2); font-size: 12.5px; }
.bell-item { display: block; width: 100%; text-align: left; padding: 10px 14px; background: none; border: none; border-bottom: 1px solid var(--line-faint); color: var(--text-2); font-size: 13px; line-height: 1.4; }
.bell-item b { display: block; color: var(--text); font-weight: 600; }
.bell-item time { display: block; font-size: 11.5px; margin-top: 2px; }
.bell-item:hover { background: var(--surface-3); }
.bell-item.is-unread { box-shadow: inset 2px 0 0 var(--accent); }
.bell-all { display: block; padding: 10px 14px; font-size: 12.5px; color: var(--text-2); text-align: center; }
.bell-all:hover { color: var(--text); }

/* Сторінки розділів: заголовок блоку, картки інструментів, пояснення в панелі */
.section-title { font-size: 15px; font-weight: 600; letter-spacing: -.01em; margin: 28px 0 12px; }
.org-card-body { min-width: 0; }
.mono-mark svg { width: 20px; height: 20px; stroke-width: 1.7; }
.panel-note { padding: 0 20px 18px; color: var(--text-2); font-size: 13.5px; line-height: 1.55; }

.sidebar-foot { border-top: 1px solid var(--line); padding: 12px; }
.userchip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-md); transition: background var(--dur-1) var(--ease); width: 100%; text-align: left; background: none; border: none; }
.userchip:hover { background: var(--surface-3); }
.avatar { width: 30px; height: 30px; border-radius: var(--r-full); flex: none; background: linear-gradient(150deg, var(--violet-500), var(--violet-700)); display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff; }
.userchip .who { line-height: 1.2; min-width: 0; }
.userchip .who b { font-weight: 600; font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userchip .who span { font-size: 11px; color: var(--text-3); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 60px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; padding: 0 24px; background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: saturate(140%) blur(18px); position: sticky; top: 0; z-index: 20; }
.search { display: flex; align-items: center; gap: 9px; background: var(--surface-input); border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 12px; width: 320px; color: var(--text-3); transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease); }
.search:focus-within { border-color: var(--focus-ring); box-shadow: var(--accent-glow); }
.search svg { width: 16px; height: 16px; stroke-width: 1.7; }
.search input { border: none; background: none; outline: none; color: var(--text); width: 100%; font-size: 13.5px; }
.search input::placeholder { color: var(--text-3); }
.search kbd { font: 500 11px/1 var(--font-mono); color: var(--text-3); border: 1px solid var(--line); border-radius: 6px; padding: 3px 5px; }
.topbar-spacer { flex: 1; }
.icon-btn { width: 36px; height: 36px; border-radius: var(--r-md); display: grid; place-items: center; color: var(--text-2); transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease); position: relative; background: none; border: none; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; stroke-width: 1.6; }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface-1); }

.content { padding: 28px 32px 64px; max-width: 1200px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 640; letter-spacing: -.02em; }
.page-head p { color: var(--text-2); margin-top: 4px; font-size: 13.5px; }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; }

/* ============ BUTTONS ============ */
.btn { display: inline-flex; align-items: center; gap: 8px; justify-content: center; height: 38px; padding: 0 16px; border-radius: var(--r-md); font-weight: 560; font-size: 13.5px; letter-spacing: -.01em; border: none; cursor: pointer; transition: transform var(--dur-1) var(--ease), background var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease); white-space: nowrap; user-select: none; }
.btn svg { width: 16px; height: 16px; stroke-width: 1.8; flex: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--focus-ring); }
.btn:active { transform: scale(.975); }
.btn-primary { background: var(--accent); color: var(--text-on-accent); box-shadow: var(--shadow-1); }
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-1), var(--accent-glow); }
.btn-primary:active { background: var(--accent-active); box-shadow: none; }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--line-strong); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--accent-tint); color: var(--accent-text); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover { background: var(--danger-tint); border-color: color-mix(in srgb, var(--danger) 60%, transparent); }
.btn[disabled], .btn.is-disabled { opacity: .4; pointer-events: none; box-shadow: none; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-block { width: 100%; }

/* ============ PANELS / TABLE / PILLS ============ */
.panel { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel-head { display: flex; align-items: center; gap: 12px 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h3 { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
.panel-head .sub { color: var(--text-3); font-size: 12.5px; }
.panel-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.ribbon { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 22px; }
.ribbon .cell { padding: 18px 20px; border-right: 1px solid var(--line); }
.ribbon .cell:last-child { border-right: none; }
.ribbon .k { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.ribbon .k svg { width: 14px; height: 14px; stroke-width: 1.7; color: var(--text-3); }
.ribbon .v { font-size: 27px; font-weight: 620; letter-spacing: -.02em; margin-top: 10px; }
.ribbon .v small { font-size: 15px; color: var(--text-3); font-weight: 500; }
.delta { font-size: 12px; margin-top: 6px; display: inline-flex; align-items: center; gap: 4px; }
.delta.up { color: var(--success); } .delta.flat { color: var(--text-3); }
.delta svg { width: 13px; height: 13px; stroke-width: 2; }
.grid-2 { display: grid; grid-template-columns: 1.7fr 1fr; gap: 22px; align-items: start; }

.iris-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.iris-table thead th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--text-3); padding: 11px 18px; border-bottom: 1px solid var(--line); }
.iris-table thead th:nth-child(1), .iris-table tbody td:nth-child(1) { width: 44%; }
.iris-table thead th:nth-child(2), .iris-table tbody td:nth-child(2) { width: 27%; }
.iris-table thead th:nth-child(3), .iris-table tbody td:nth-child(3) { width: 19%; }
.iris-table thead th:nth-child(4), .iris-table tbody td:nth-child(4) { width: 10%; text-align: right; }
.iris-table tbody td { padding: 13px 18px; border-bottom: 1px solid var(--line-faint); font-size: 13.5px; vertical-align: middle; }
.iris-table tbody tr { transition: background var(--dur-1) var(--ease); }
.iris-table tbody tr:hover { background: var(--surface-3); }
.iris-table tbody tr:last-child td { border-bottom: none; }
.cellname { display: flex; align-items: center; gap: 11px; }
.cellname > div { min-width: 0; }
.flag { width: 26px; height: 26px; border-radius: 7px; background: var(--surface-3); display: grid; place-items: center; font-size: 13px; flex: none; }
.cellname b { font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cellname span { display: block; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iris-table.auto { table-layout: auto; }
.iris-table.auto th, .iris-table.auto td { width: auto; }
.iris-table.auto td:last-child, .iris-table.auto th:last-child { text-align: right; white-space: nowrap; }
.row-link { cursor: pointer; }
.avatar-sm { width: 34px; height: 34px; border-radius: var(--r-full); background: linear-gradient(150deg, var(--violet-500), var(--violet-700)); display: grid; place-items: center; font-weight: 650; font-size: 12px; color: #fff; flex: none; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--r-full); font-size: 12px; font-weight: 550; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--success); background: var(--success-tint); }
.pill.grace { color: var(--warning); background: var(--warning-tint); }
.pill.susp { color: var(--danger); background: var(--danger-tint); }
.pill.neutral { color: var(--text-2); background: var(--surface-3); }

/* ============ CONTROLS ============ */
.stack { display: flex; flex-direction: column; gap: 20px; padding: 18px; }
.field-label { font-size: 12px; color: var(--text-2); font-weight: 550; margin-bottom: 9px; display: flex; justify-content: space-between; }
.field-label .val { color: var(--accent-text); font-family: var(--font-mono); font-size: 12px; }
input[type=range].iris-range { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: none; }
input[type=range].iris-range::-webkit-slider-runnable-track { height: 5px; border-radius: var(--r-full); background: var(--track, var(--surface-3)); }
input[type=range].iris-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; margin-top: -6.5px; background: #fff; border: 1px solid rgba(0,0,0,.15); box-shadow: 0 1px 3px rgba(0,0,0,.5); transition: box-shadow var(--dur-1) var(--ease), transform var(--dur-1) var(--ease); }
input[type=range].iris-range:hover::-webkit-slider-thumb { box-shadow: 0 1px 3px rgba(0,0,0,.5), var(--accent-glow); }
input[type=range].iris-range:active::-webkit-slider-thumb { transform: scale(1.08); }
input[type=range].iris-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--focus-ring); }

.toggle { position: relative; width: 44px; height: 26px; flex: none; display: inline-block; }
.toggle input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.toggle .track { position: absolute; inset: 0; border-radius: var(--r-full); background: var(--surface-3); transition: background var(--dur-2) var(--ease); }
.toggle .knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.5); transition: transform var(--dur-2) var(--ease); }
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked ~ .knob { transform: translateX(18px); }
.toggle input:focus-visible + .track { box-shadow: 0 0 0 3px var(--focus-ring); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.row-between .t b { font-weight: 550; font-size: 13.5px; }
.row-between .t span { display: block; font-size: 12px; color: var(--text-3); }

.segmented { display: inline-flex; background: var(--surface-input); border: 1px solid var(--line); border-radius: var(--r-md); padding: 3px; gap: 2px; }
.segmented button, .segmented a, .segmented .off { padding: 6px 14px; border-radius: 9px; font-size: 12.5px; font-weight: 550; color: var(--text-2); border: none; background: none; text-decoration: none; transition: color var(--dur-1) var(--ease), background var(--dur-1) var(--ease); }
.segmented button.on, .segmented a.on { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow-1); }
.segmented button:hover:not(.on), .segmented a:hover:not(.on) { color: var(--text); }
.segmented .off { opacity: .45; cursor: default; }

/* Код активації комп'ютера точки: читається з екрана й виділяється одним кліком. */
.activation-code { display: inline-block; margin: 6px 0 8px; padding: 10px 14px; border-radius: var(--r-md); background: var(--surface-input); border: 1px solid var(--line); font-size: 20px; letter-spacing: .06em; user-select: all; }

/* Показники роботи точки: плитки-цифри (число — пропорційними цифрами, підпис — приглушений). */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; padding: 14px 18px 4px; }
.kpi { padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-1); border: 1px solid var(--line-faint); }
.kpi .label { font-size: 12.5px; color: var(--text-3); }
.kpi .value { font-size: 24px; font-weight: 600; letter-spacing: -.02em; margin-top: 4px; color: var(--text); }
.kpi .meta { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.kpi-grid.tight { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-grid.tight .kpi { padding: 12px 14px; }
.kpi-grid.tight .value { font-size: 20px; }

/* Каса по місяцях: одна серія без легенди; монохромні стовпчики ≤24px із заокругленим верхом (акцент — лише для
   інтерактиву), шкала — тонкі суцільні лінії, підказка — на наведення й фокус. */
.bar-chart { margin: 0; padding: 10px 18px 12px; }
.bar-chart-title { font-size: 12.5px; color: var(--text-3); margin-bottom: 22px; }
.bar-chart-plot { position: relative; height: 150px; display: flex; align-items: flex-end; gap: 4px; border-bottom: 1px solid var(--line-strong); }
.bar-chart-grid { position: absolute; inset: 0; pointer-events: none; }
.bar-chart-grid .tick { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.bar-chart-grid .tick span { position: absolute; right: 0; top: -17px; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.bar-col { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; outline: none; border-radius: 6px; }
.bar-col .bar { width: min(24px, 70%); height: var(--h); background: var(--text-2); border-radius: 4px 4px 0 0; transition: background var(--dur-1) var(--ease); }
.bar-col:hover .bar, .bar-col:focus-visible .bar { background: var(--text); }
/* Дві серії (фінанси: дохід і витрата) — поруч, тон розрізняє серії, легенда над графіком. */
.bar-col.pair { gap: 2px; }
.bar-col.pair .bar { width: min(12px, 34%); }
.bar-col.pair .bar.expense { height: var(--h2); background: var(--text-3); }
.bar-col.pair:hover .bar.expense, .bar-col.pair:focus-visible .bar.expense { background: var(--text-2); }
.bar-col.pair .bar-tip { bottom: calc(max(var(--h), var(--h2)) + 8px); }
.bar-chart-legend { display: flex; gap: 14px; margin: -14px 0 10px; font-size: 12px; color: var(--text-3); }
.bar-chart-legend .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: var(--text-2); vertical-align: -1px; }
.bar-chart-legend .swatch.expense { background: var(--text-3); }
.bar-col:focus-visible { box-shadow: 0 0 0 2px var(--focus-ring); }
.bar-tip { position: absolute; left: 50%; bottom: calc(var(--h) + 8px); transform: translateX(-50%); z-index: 2; white-space: nowrap; padding: 6px 10px; border-radius: var(--r-sm); background: var(--surface-3); border: 1px solid var(--line-strong); box-shadow: var(--shadow-2); font-size: 12px; color: var(--text-2); opacity: 0; pointer-events: none; transition: opacity var(--dur-1) var(--ease); }
.bar-tip b { display: block; color: var(--text); font-size: 13px; font-weight: 600; }
.bar-col:hover .bar-tip, .bar-col:focus-visible .bar-tip { opacity: 1; }
.bar-chart-axis { display: flex; gap: 4px; margin-top: 6px; }
.bar-chart-axis span { flex: 1; text-align: center; font-size: 11px; color: var(--text-3); }
/* Лінія «каса за годину по днях» (показники): SVG у тих самих тонах, що й стовпчики — сітка лініями, серія чорнилом,
   точки з підказкою через <title>. */
.line-chart { margin: 0; }
.line-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.line-chart .grid { stroke: var(--line); stroke-width: 1; }
.line-chart .series { fill: none; stroke: var(--text-2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line-chart .dot { fill: var(--surface-1); stroke: var(--text); stroke-width: 2; }
.line-chart .dot:hover { fill: var(--text); }
.line-chart .tick, .line-chart .axis { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; align-items: start; }
.analytics-grid .panel { overflow-x: auto; }
@media (max-width: 1100px) { .analytics-grid { grid-template-columns: 1fr; } }
/* Медіа сайту (запит сайту §16): слоти з мініатюрами, стрілки порядку, форма завантаження. */
.media-slot { padding: 12px 18px 14px; border-top: 1px solid var(--line-faint); }
.media-slot-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
.media-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.media-list li { display: flex; align-items: center; gap: 12px; }
.media-thumb { width: 64px; height: 44px; object-fit: cover; border-radius: 6px; background: var(--surface-3); flex: none; display: grid; place-items: center; color: var(--text-3); }
.media-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.media-actions { display: flex; gap: 4px; }
.media-upload { display: flex; gap: 8px; align-items: center; }
.media-upload .tinput { max-width: 360px; }
.line-chart .limit { stroke: var(--warning); stroke-width: 1; stroke-dasharray: 4 4; opacity: .7; }
.line-chart .hit { fill: transparent; stroke: none; }
.line-chart .hit:hover { fill: var(--text); }
.iris-table tr.total td { border-top: 1px solid var(--line-strong); font-weight: 600; }
.chart-table { padding: 0 18px 14px; font-size: 12.5px; color: var(--text-2); }
.chart-table summary { cursor: pointer; color: var(--text-3); margin-bottom: 6px; }

/* Журнал точки: фільтри в один рядок над тим, що фільтрують; позначки стану — знак + текст, не лише колір. */
.journal-filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 16px; }
.journal-filters .log-search { display: flex; gap: 8px; margin-left: auto; }
.journal-filters .log-search .tinput { width: 240px; }
.journal-table th, .journal-table td { width: auto !important; text-align: left !important; }
.session-crumbs { margin: 0 0 16px; color: var(--text-2); }
.sev { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.sev.error { color: var(--danger); }
.sev.warning { color: var(--warning); }
.pager { display: flex; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--line-faint); }
.assign-worker { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.assign-worker .tselect { max-width: 260px; }
.timeline { list-style: none; margin: 0; padding: 4px 0; }
.timeline li { display: grid; grid-template-columns: 52px 18px 1fr; gap: 8px; padding: 7px 18px; font-size: 13px; border-bottom: 1px solid var(--line-faint); }
.timeline li:last-child { border-bottom: none; }
.timeline time { color: var(--text-3); font-variant-numeric: tabular-nums; }
.timeline .icon { text-align: center; color: var(--text-3); }
.timeline li.error .icon, .timeline li.crash .icon { color: var(--danger); }
.timeline li.warning .icon { color: var(--warning); }
.log-lines { font-family: var(--font-mono); font-size: 12px; line-height: 1.55; padding: 8px 0; overflow-x: auto; }
.log-lines .row { display: grid; grid-template-columns: 64px 48px 110px minmax(0, 1fr); gap: 10px; padding: 2px 18px; }
.log-lines .row.error { background: var(--danger-tint); }
.log-lines .row.warning { background: var(--warning-tint); }
.log-lines .meta { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-lines .msg { white-space: pre-wrap; word-break: break-word; color: var(--text); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Графік (рішення власника 2026-09-14): дні з бронюваннями, скасовані — приглушено. */
.schedule-day { border-bottom: 1px solid var(--line-faint); }
.schedule-day:last-child { border-bottom: none; }
.schedule-day h4 { margin: 0; padding: 12px 18px 4px; font-size: 13px; font-weight: 600; }
.schedule-day .schedule-free { padding: 2px 18px 12px; font-size: 13px; }
.schedule-day .iris-table tbody td { padding-top: 9px; padding-bottom: 9px; }
.schedule-day .iris-table tbody tr.muted td { color: var(--text-3); }
.schedule-day .iris-table tbody tr.muted .mono { text-decoration: line-through; }
.iris-table td.nowrap { white-space: nowrap; }
.iris-table tbody tr.muted td { color: var(--text-3); }
/* Техніка (CRM_SPEC §5): мініатюра моделі в каталозі, фото на картці. */
.eq-thumb { display: block; width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: var(--surface-input); }
.eq-thumb.empty { border: 1px dashed var(--line); }
.eq-photo { display: block; max-width: 100%; max-height: 260px; border-radius: var(--r-md); margin: 6px 0 12px; }
.schedule-rules { margin: 0; padding: 12px 18px 16px 34px; }
.schedule-rules li { margin-bottom: 6px; }
/* «Фото зміни» (етап В, крок 2б): мініатюри на чорному, вікно перегляду без скачування. */
.qc-grid { list-style: none; margin: 0; padding: 4px 18px 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.qc-grid li { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.qc-thumb { display: block; width: 100%; aspect-ratio: 1; padding: 0; background: #000; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; cursor: zoom-in; }
.qc-thumb:focus-visible { outline: none; border-color: var(--focus-ring); box-shadow: var(--accent-glow); }
.qc-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.qc-thumb.pending { display: grid; place-items: center; cursor: default; color: var(--text-3); font-size: 12px; background: var(--surface-input); }
.qc-meta { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
/* margin: auto — центрування модального dialog, яке скидання стилів Tailwind прибирає (margin: 0 усім елементам). */
.qc-dialog { margin: auto; padding: 0; border: none; border-radius: var(--r-lg); background: #000; max-width: min(92vw, 1040px); }
.qc-dialog::backdrop { background: rgba(0, 0, 0, .78); }
.qc-dialog img { display: block; min-width: 240px; min-height: 240px; max-width: 100%; max-height: 86vh; margin: 0 auto; user-select: none; -webkit-user-drag: none; }
.qc-dialog form { position: absolute; top: 8px; right: 8px; }
.qc-dialog form .btn { color: #fff; background: rgba(255, 255, 255, .1); }
.qc-viewers { padding: 4px 18px 16px; border-top: 1px solid var(--line-faint); }
.qc-viewers h4 { margin: 12px 0 6px; font-size: 13px; font-weight: 600; }
.qc-viewers ul { list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--text-2); line-height: 1.7; }

.tinput { width: 100%; height: 38px; padding: 0 13px; border-radius: var(--r-md); background: var(--surface-input); border: 1px solid var(--line); color: var(--text); font-size: 13.5px; transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease); }
.tinput::placeholder { color: var(--text-3); }
.tinput:focus { outline: none; border-color: var(--focus-ring); box-shadow: var(--accent-glow); }

/* ============ AUTH (login) ============ */
.auth-body { display: grid; place-items: center; min-height: 100vh; overflow: hidden; position: relative; }
.ambient { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 0; }
.ambient img { width: 820px; max-width: 120vw; opacity: .05; filter: saturate(0); }
.ambient::after { content: ""; position: absolute; width: 720px; height: 720px; border-radius: 50%; background: radial-gradient(circle, var(--accent-tint) 0%, transparent 62%); opacity: .5; }
.auth-wrap { position: relative; z-index: 1; width: 380px; max-width: calc(100vw - 40px); }
.auth-brand { display: flex; justify-content: center; margin-bottom: 34px; }
.auth-brand img { height: 46px; width: auto; opacity: .98; }
.auth-card { background: color-mix(in srgb, var(--surface-2) 82%, transparent); backdrop-filter: saturate(140%) blur(20px); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 32px 30px; box-shadow: var(--shadow-2); }
.auth-card h1 { font-size: 20px; font-weight: 620; letter-spacing: -.02em; text-align: center; }
.auth-card .lede { text-align: center; color: var(--text-2); font-size: 13.5px; margin-top: 6px; margin-bottom: 26px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 550; color: var(--text-2); margin-bottom: 8px; }
.field .tinput { height: 44px; font-size: 14.5px; }
.field-head { display: flex; justify-content: space-between; align-items: baseline; }
.link { color: var(--accent-text); font-size: 12.5px; font-weight: 550; transition: color var(--dur-1) var(--ease); }
.link:hover { color: var(--violet-200); }
.checkrow { display: flex; align-items: center; gap: 10px; margin: 4px 0 22px; cursor: pointer; }
.check { position: relative; width: 20px; height: 20px; flex: none; display: inline-block; }
.check input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.check .box { position: absolute; inset: 0; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface-input); transition: all var(--dur-1) var(--ease); }
.check input:checked + .box { background: var(--accent); border-color: var(--accent); }
.check .box::after { content: ""; position: absolute; left: 6.5px; top: 3px; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0); transition: transform var(--dur-1) var(--ease); }
.check input:checked + .box::after { transform: rotate(45deg) scale(1); }
.check input:focus-visible + .box { box-shadow: 0 0 0 3px var(--focus-ring); }
.checkrow span { font-size: 13px; color: var(--text-2); }
.btn-auth { width: 100%; height: 46px; border-radius: var(--r-md); background: var(--accent); color: #fff; font-weight: 580; font-size: 14.5px; letter-spacing: -.01em; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; cursor: pointer; box-shadow: var(--shadow-1); transition: background var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), transform var(--dur-1) var(--ease); }
.btn-auth:hover { background: var(--accent-hover); box-shadow: var(--shadow-1), var(--accent-glow); }
.btn-auth:active { background: var(--accent-active); transform: scale(.985); box-shadow: none; }
.btn-auth:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--focus-ring); }
.btn-auth svg { width: 18px; height: 18px; flex: none; }
.btn-alt { width: 100%; height: 44px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--text); font-weight: 550; font-size: 13.5px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; cursor: pointer; transition: background var(--dur-1) var(--ease); }
.btn-alt:hover { background: var(--surface-3); }
.btn-alt svg { width: 17px; height: 17px; }
.auth-foot { text-align: center; margin-top: 26px; color: var(--text-3); font-size: 12px; }
.auth-foot a { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }
.flash { max-width: 360px; margin: 0 auto 16px; padding: 10px 14px; border-radius: var(--r-md); font-size: 13px; text-align: center; }
.flash.notice { background: var(--success-tint); color: var(--success); }
.flash.alert { background: var(--danger-tint); color: var(--danger); }

/* Перемикач мови на сторінках входу й анкети */
.auth-locale { position: fixed; top: 16px; right: 18px; z-index: 20; }

/* Самореєстрація (CRM_SPEC §3.2): ширша картка, групи полів, повідомлення про дані */
.req { color: var(--accent-text); font-weight: 650; }
.onboarding-card .req-note { text-align: center; margin: -16px 0 18px; }
.auth-body.is-long { padding: 44px 0; }
.auth-wrap.is-wide { width: 600px; }
/* Без uppercase: велика кирилична «З» у «КРОК 1 З 2» читається як цифра «3». */
.onboarding-step { text-align: center; font-size: 12.5px; font-weight: 550; color: var(--text-3); margin-bottom: 8px; }
.onboarding-card fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.onboarding-card legend { float: left; width: 100%; padding: 16px 0 0; margin: 0 0 14px; border-top: 1px solid var(--line-faint); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.onboarding-card legend + * { clear: both; }
.onboarding-card .hint { font-size: 12px; color: var(--text-3); margin: -8px 0 14px; }
.onboarding-card .field .hint { margin: 6px 0 0; }
.onboarding-card .row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.onboarding-card .row-phone { display: grid; grid-template-columns: 2fr 3fr; gap: 0 14px; }
.onboarding-card .field .tselect { height: 44px; font-size: 14.5px; }
.onboarding-card .check-line { margin: 2px 0 16px; }
.onboarding-card .check-line .t { font-size: 13px; color: var(--text-2); line-height: 1.45; }
.notice-list { margin: 0 0 14px; font-size: 13px; line-height: 1.55; }
.notice-list .doc .doc-h1, .notice-list .doc .doc-h2, .notice-list .doc .doc-h3 { font-size: 13px; font-weight: 600; text-align: left; color: var(--text); margin: 12px 0 3px; }
.notice-list .doc p, .notice-list .doc li { color: var(--text-2); margin: 0 0 6px; }
.notice-draft { margin-bottom: 14px; }
@media (max-width: 640px) { .onboarding-card .row-2, .onboarding-card .row-phone { grid-template-columns: 1fr; } }
.upload-row { display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: start; }
.upload-thumb { width: 72px; height: 72px; margin-top: 24px; border-radius: var(--r-md); border: 1px dashed var(--line-strong); background: var(--surface-input); overflow: hidden; }
.upload-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tfile { display: block; width: 100%; font-size: 13px; color: var(--text-2); padding: 8px 10px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-input); }
.tfile::file-selector-button { margin-right: 12px; height: 28px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font-weight: 550; cursor: pointer; }
.review-note { max-width: none; text-align: left; margin: 0 0 16px; }

/* Підказки адреси (Geoapify) під полем вулиці */
.addr-field { position: relative; }
.addr-suggestions { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; margin: 0; padding: 6px; list-style: none; max-height: 260px; overflow-y: auto; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow-1); }
.addr-suggestions button { width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text); font-size: 13.5px; cursor: pointer; }
.addr-suggestions button:hover, .addr-suggestions button.is-active { background: var(--surface-3); }
.addr-suggestions .sub { color: var(--text-3); font-size: 12px; margin-left: 8px; }

/* NDA: читання з перекладом і підпис (CRM_SPEC §3.2, крок 7) */
.auth-wrap.is-wide.nda-wrap { width: 880px; }
.nda-langs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: -8px 0 16px; }
.nda-langs a { font-size: 12.5px; padding: 5px 11px; border-radius: var(--r-full); border: 1px solid var(--line); color: var(--text-2); }
.nda-langs a.is-active { border-color: var(--accent); color: var(--accent-text); }
.nda-text { max-height: 58vh; overflow-y: auto; display: grid; gap: 24px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-input); }
.nda-text.has-translation { grid-template-columns: 1fr 1fr; }
.nda-text .nda-end { grid-column: 1 / -1; height: 1px; }
.nda-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin-bottom: 10px; }
.nda-body { overflow-wrap: anywhere; font-size: 13px; line-height: 1.6; color: var(--text); }
/* Документи компанії з розмітки DocumentMarkup: заголовки, абзаци, пункти */
.doc .doc-h1 { font-size: 15px; font-weight: 650; text-align: center; letter-spacing: -.01em; margin: 0 0 14px; }
.doc .doc-h2 { font-size: 13.5px; font-weight: 650; margin: 20px 0 8px; }
.doc .doc-h3 { font-size: 13px; font-weight: 600; margin: 16px 0 6px; }
.doc p { margin: 0 0 10px; }
.doc ul { margin: 0 0 10px; padding-left: 20px; list-style: disc; }
.doc li::marker { color: var(--text-3); }
.doc li { margin: 0 0 6px; }
.doc strong { font-weight: 650; }
.nda-admin { padding: 16px 18px; }
.onboarding-card .nda-hint { text-align: center; margin: 12px 0 0; }
.nda-form { margin-top: 18px; }
.nda-form fieldset:disabled { opacity: .45; }
.form.form-wide { max-width: 980px; }
@media (max-width: 800px) { .nda-text.has-translation { grid-template-columns: 1fr; } }

/* Перевірка анкети в картці людини (CRM_SPEC §3.2, кроки 8–9) */
.review-panel { margin-bottom: 22px; }
.review-body { padding: 6px 18px 18px; }
.review-files { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 14px 0; }
.review-file { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-2); }
.review-file img { width: 160px; height: 110px; object-fit: cover; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-input); }
.review-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding-top: 14px; border-top: 1px solid var(--line-faint); }
.review-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.review-form label { font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.review-form .tinput { width: 100%; }
@media (max-width: 800px) { .review-actions { grid-template-columns: 1fr; } }

/* ============ FORMS ============ */
.form { padding: 20px; display: flex; flex-direction: column; gap: 18px; max-width: 640px; }
.form-field { display: flex; flex-direction: column; gap: 8px; }
.form-field > label { font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.form-field .hint { font-size: 12px; color: var(--text-3); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tselect { width: 100%; height: 38px; padding: 0 12px; border-radius: var(--r-md); background: var(--surface-input); border: 1px solid var(--line); color: var(--text); font-size: 13.5px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236E6E76' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.tselect:focus { outline: none; border-color: var(--focus-ring); box-shadow: var(--accent-glow); }
textarea.tinput { height: auto; padding: 10px 13px; min-height: 76px; resize: vertical; line-height: 1.5; }
.form-actions { display: flex; gap: 10px; align-items: center; padding-top: 4px; }
.errors { background: var(--danger-tint); color: var(--danger); border-radius: var(--r-md); padding: 12px 14px; font-size: 13px; }
.errors ul { margin: 6px 0 0; padding-left: 18px; }
/* Поле з помилкою: Rails обгортає його в .field_with_errors — обгортка не ламає сітку, рамка червона. */
.field_with_errors { display: contents; }
.field_with_errors label { color: var(--danger); }
.field_with_errors .tinput, .field_with_errors .tselect { border-color: var(--danger); }
.link-plain { color: var(--accent-text); font-weight: 550; }
.link-plain:hover { color: var(--violet-200); }

/* Checkbox list / permission grid */
.check-line { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; cursor: pointer; }
.check-line .check { margin-top: 1px; }
.check-line .t b { font-weight: 550; font-size: 13.5px; }
.check-line .t span { display: block; font-size: 12px; color: var(--text-3); }
.perm-group { border-top: 1px solid var(--line-faint); padding: 8px 0; }
.perm-group > h4 { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin: 8px 0 4px; }

/* ============ PEOPLE / CARDS ============ */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
/* Сторінка точок: пошук і вигляд «списком / плитками» в тулбарі. */
.points-search { width: 240px; }
.segmented button svg { display: block; }
.points-empty { padding: 14px 18px; }
.card-grid .points-empty { grid-column: 1 / -1; }
.org-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease); display: block; }
.org-card:hover { border-color: var(--line-strong); background: var(--surface-3); }
.org-card .top { display: flex; align-items: center; gap: 12px; }
.org-card .mono-mark { width: 40px; height: 40px; border-radius: var(--r-md); background: var(--surface-3); display: grid; place-items: center; font-weight: 700; color: var(--text-2); font-size: 15px; flex: none; }
.org-card h3 { font-size: 15px; font-weight: 600; }
.org-card .meta { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.org-card .foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-faint); font-size: 12.5px; color: var(--text-2); }

.avatar-lg { width: 56px; height: 56px; border-radius: var(--r-full); background: linear-gradient(150deg, var(--violet-500), var(--violet-700)); display: grid; place-items: center; font-weight: 700; font-size: 19px; color: #fff; flex: none; }

.badge-role { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: var(--r-full); font-size: 11.5px; font-weight: 550; background: var(--accent-tint); color: var(--accent-text); white-space: nowrap; }
.badge-role.plain { background: var(--surface-3); color: var(--text-2); }
.badge-role.global::before { content: "◆"; margin-right: 5px; font-size: 8px; }
.role-badges { display: inline-flex; flex-wrap: wrap; gap: 5px; }

/* Definition list (profile) */
.def-list { display: grid; grid-template-columns: 150px 1fr; gap: 0; }
.def-list dt { padding: 12px 0; color: var(--text-3); font-size: 13px; border-bottom: 1px solid var(--line-faint); }
.def-list dd { padding: 12px 0; font-size: 13.5px; border-bottom: 1px solid var(--line-faint); }
.def-list dt:last-of-type, .def-list dd:last-of-type { border-bottom: none; }

/* Invite banner */
.invite-banner { background: var(--accent-tint); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: var(--r-lg); padding: 16px 18px; margin-bottom: 22px; }
.invite-banner h4 { font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.invite-banner p { font-size: 12.5px; color: var(--text-2); margin-bottom: 12px; }
.invite-link { display: flex; gap: 8px; }
.invite-link input { flex: 1; height: 38px; padding: 0 12px; border-radius: var(--r-md); background: var(--surface-input); border: 1px solid var(--line); color: var(--text); font-family: var(--font-mono); font-size: 12px; }

/* Empty state */
.empty-state { text-align: center; padding: 56px 20px; color: var(--text-3); }
.empty-state svg { width: 40px; height: 40px; stroke-width: 1.3; opacity: .5; margin-bottom: 14px; }
.empty-state h3 { font-size: 15px; color: var(--text-2); font-weight: 600; margin-bottom: 6px; }
.empty-state p { font-size: 13px; max-width: 340px; margin: 0 auto 18px; }

.section-gap { margin-top: 24px; }
.subtle { color: var(--text-3); font-size: 12.5px; }
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; white-space: nowrap; }
.status-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-dot.active { color: var(--success); }
.status-dot.invited { color: var(--warning); }
.status-dot.suspended { color: var(--danger); }
.status-dot.review { color: var(--accent-text); }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .ribbon { grid-template-columns: repeat(2, 1fr); }
  .ribbon .cell:nth-child(2) { border-right: none; }
  .ribbon .cell:nth-child(1), .ribbon .cell:nth-child(2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: 20px 18px 48px; }
  .search { width: 100%; }
}

/* Політика вмісту (Налаштування) */
.csp-kpis { padding-bottom: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.csp-mode { font-size: 18px; }
.csp-reports { margin-top: 16px; }
.panel-empty { padding: 14px 18px; }

/* Навчання */
.panel-gap { margin-top: 16px; }
.panel-top { align-self: start; }
.panel-form { padding: 18px; }
.panel-actions { display: flex; gap: 10px; padding: 4px 18px 18px; }
.inline-form { display: inline; margin: 0; }
.row-actions { display: flex; gap: 12px; align-items: center; justify-content: flex-end; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.course-card { display: block; padding: 18px; border-radius: var(--r-lg); background: var(--surface-1); border: 1px solid var(--line); text-decoration: none; color: var(--text); transition: border-color var(--dur-1) var(--ease); }
.course-card:hover { border-color: var(--line-strong); }
.course-card h3 { margin: 12px 0 6px; font-size: 16px; font-weight: 600; }
.course-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.course-kind { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.course-deadline { margin: 10px 0 0; font-size: 13px; color: var(--text-2); min-height: 18px; }
.lesson-list { margin: 0; padding: 6px 18px 12px 38px; }
.lesson-list li { padding: 7px 0; }
.lesson-list li .pill { margin-left: 8px; }
.lesson { margin-top: 16px; }
.lesson-body { padding: 20px 22px 8px; max-width: 760px; font-size: 14.5px; line-height: 1.6; }
.lesson-body .doc .doc-h2 { font-size: 15px; }
.lesson-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 6px 22px 20px; }
.quiz { display: grid; gap: 14px; max-width: 820px; }
.quiz-question { margin: 0; padding: 18px 20px; }
.quiz-question legend { float: left; width: 100%; font-weight: 600; font-size: 14.5px; margin-bottom: 12px; padding: 0; }
.quiz-number { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; margin-right: 6px; border-radius: 999px; background: var(--surface-3); font-size: 12px; }
.quiz-option { clear: both; display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; font-size: 14px; }
.quiz-option input { margin-top: 3px; accent-color: var(--accent); }
.attempt-kpis { padding-bottom: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.attempt-answers { margin-top: 16px; }
.answer-list { margin: 0; padding: 8px 18px 14px 40px; }
.answer-list > li { padding: 10px 0; border-bottom: 1px solid var(--line-faint); }
.answer-list > li:last-child { border-bottom: 0; }
.answer-list p { margin: 4px 0 0; }
.option-list { margin: 6px 0 0; padding-left: 18px; color: var(--text-2); }
.option-list .is-correct { color: var(--success); font-weight: 600; }
.problem-list { margin: 0; padding: 10px 18px 16px 36px; }
.problem-list li { padding: 4px 0; }
.publish-form { padding: 0 18px 18px; }
.locale-block { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; margin: 0 0 16px; }
.locale-block legend { padding: 0 8px; font-weight: 600; }
.mono-area { font-family: var(--font-mono, ui-monospace, Menlo, monospace); font-size: 13px; line-height: 1.5; min-height: 320px; }
.format-help { margin-bottom: 16px; }
.format-help summary { cursor: pointer; color: var(--text-2); }
.format-help pre { margin: 10px 0; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); font-size: 12.5px; white-space: pre-wrap; }
.results-filter { margin-left: 0; }
.training-block { padding: 6px 0 4px; }
.training-block p { margin: 0 0 10px; }
