/* IAMS design system.
   <html> carries: data-theme = light | dark, data-style = soft | strict, data-palette = graphite | sea | adjara | clay | plum.
   Soft: warm neutrals, round corners, roomy controls. Strict: neutral greys, square corners, dense tables.
   Colours come only from these variables; no gradients anywhere. */

:root {
  --acc-l: #1f5546; --acc-d: #6cc4a6;
  --bg: #f6f5f2; --surface: #ffffff; --surface-2: #fbfaf8; --hover: #efede8;
  --line: #e7e4de; --line-strong: #d5d1c8;
  --text: #1c1c1a; --muted: #6c6a65; --faint: #9a978f;
  --accent: var(--acc-l); --on-accent: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 10%, var(--surface));
  --accent-hover: color-mix(in srgb, var(--accent) 86%, #000);
  --ring: color-mix(in srgb, var(--accent) 26%, transparent);
  --good: #23704f; --bad: #a2352c; --warn: #8a5a00; --info: #2b5797; --mute: #77746d;
  --tint: 11%;
  --r-xs: 6px; --r-sm: 8px; --r: 10px; --r-lg: 16px; --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(28, 28, 26, .05);
  --shadow: 0 1px 2px rgba(28, 28, 26, .04), 0 8px 24px rgba(28, 28, 26, .07);
  --shadow-pop: 0 12px 32px rgba(28, 28, 26, .16);
  --ctl-h: 38px; --ctl-px: 13px; --cell-py: 10px; --pad: 20px; --gap: 16px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans Georgian", "BPG Arial", Sylfaen, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", "SF Mono", Consolas, ui-monospace, monospace;
  --fs: 14.5px;
  --sidebar: 244px; --topbar: 58px;
  color-scheme: light;
}
:root[data-theme=dark] {
  --bg: #141413; --surface: #1c1c1a; --surface-2: #222220; --hover: #2a2a27;
  --line: #2f2f2c; --line-strong: #3d3d39;
  --text: #ecebe6; --muted: #a5a39b; --faint: #77756e;
  --accent: var(--acc-d); --on-accent: #111110;
  --accent-soft: color-mix(in srgb, var(--accent) 15%, var(--surface));
  --accent-hover: color-mix(in srgb, var(--accent) 86%, #fff);
  --good: #5ccf98; --bad: #ff8077; --warn: #e7b34a; --info: #7fb0ff; --mute: #a19f97;
  --tint: 17%;
  --shadow-sm: none; --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-pop: 0 12px 32px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
/* Strict: neutral greys, muted states, dense, almost no corners or shadows. */
:root[data-style=strict] {
  --bg: #f3f3f3; --surface: #ffffff; --surface-2: #f7f7f7; --hover: #ededed;
  --line: #dcdcdc; --line-strong: #c4c4c4;
  --text: #1a1a1a; --muted: #595959; --faint: #8a8a8a;
  --good: #2b6e42; --bad: #a8322b; --warn: #7f5a12; --info: #2b5591; --mute: #6b6b6b;
  --tint: 9%;
  --r-xs: 2px; --r-sm: 3px; --r: 4px; --r-lg: 4px; --r-pill: 3px;
  --shadow-sm: none; --shadow: none; --shadow-pop: 0 6px 18px rgba(0, 0, 0, .14);
  --ctl-h: 32px; --ctl-px: 10px; --cell-py: 6px; --pad: 14px; --gap: 12px;
  --font: "IBM Plex Sans", "Segoe UI", "Noto Sans Georgian", "BPG Arial", Sylfaen, "Helvetica Neue", Arial, system-ui, sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Mono", Consolas, ui-monospace, monospace;
  --fs: 13.5px;
  --sidebar: 220px; --topbar: 50px;
}
:root[data-style=strict][data-theme=dark] {
  --bg: #161616; --surface: #1e1e1e; --surface-2: #252525; --hover: #2c2c2c;
  --line: #363636; --line-strong: #474747;
  --text: #e6e6e6; --muted: #a3a3a3; --faint: #7a7a7a;
  --good: #74c08e; --bad: #ee8a85; --warn: #d6b264; --info: #8fb4ee; --mute: #9a9a9a;
  --shadow-pop: 0 6px 18px rgba(0, 0, 0, .5);
}
/* Palettes: the accent for light and dark theme; "clay" also warms the neutrals of the soft style. */
:root[data-palette=graphite] { --acc-l: #2f3640; --acc-d: #c3cad6; }
:root[data-palette=sea] { --acc-l: #1f5fbf; --acc-d: #7fb0ff; }
:root[data-palette=adjara] { --acc-l: #1f6b4e; --acc-d: #5fcf9f; }
:root[data-palette=clay] { --acc-l: #b5532f; --acc-d: #e5906d; }
:root[data-palette=plum] { --acc-l: #7a3a92; --acc-d: #cf95e6; }
:root[data-palette=clay][data-style=soft][data-theme=light] { --bg: #f4f1ea; --surface-2: #faf8f3; --hover: #ebe6dc; --line: #e4ded2; --line-strong: #d2cabb; }
:root[data-palette=clay][data-style=soft][data-theme=dark] { --bg: #1a1816; --surface: #221f1c; --surface-2: #28241f; --hover: #302b26; --line: #36312b; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: var(--fs)/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.6em; line-height: 1.25; }
h2 { font-size: 1.12em; line-height: 1.35; }
h3 { font-size: 1em; }
p { margin: 0; }
img { display: block; max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
:root[data-style=strict] h1 { font-size: 1.4em; }

.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 15px; height: 15px; }
.i.lg { width: 22px; height: 22px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .88em; }
.tiny { font-size: .78em; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 12px; gap: 6px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: var(--r-sm); background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; letter-spacing: .02em; flex: none; }
.brand-name { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name b { font-size: 15px; letter-spacing: -.01em; }
.brand-name span { font-size: 11px; color: var(--muted); letter-spacing: .02em; }
.org-switch { margin: 0 0 8px; }
.org-switch select { width: 100%; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 14px 10px 4px; font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--muted); font-weight: 500; }
.nav-item:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav-item.on { background: var(--accent-soft); color: var(--accent); }
.nav-item .count { margin-left: auto; font-size: 11px; background: var(--bad); color: #fff; border-radius: var(--r-pill); padding: 0 6px; line-height: 18px; min-width: 18px; text-align: center; }
:root[data-style=strict] .nav-item { padding: 6px 8px; }
:root[data-style=strict] .nav-item.on { background: var(--hover); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.trial-note { font-size: 12px; color: var(--muted); padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar); display: flex; align-items: center; gap: 10px; padding: 0 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .search { flex: 1; max-width: 520px; position: relative; }
.topbar .search input { padding-left: 36px; background: var(--surface); }
.topbar .search .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.topbar .spacer { flex: 1; }
.page { padding: 24px; max-width: 1440px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: var(--gap); }
.page.narrow { max-width: 880px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: .88em; flex-wrap: wrap; margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.crumbs .sep { color: var(--faint); }
.demo-bar { background: var(--accent); color: var(--on-accent); font-size: 13px; padding: 6px 24px; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }
.demo-bar button { all: unset; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.ro-bar { background: color-mix(in srgb, var(--warn) var(--tint), var(--surface)); color: var(--warn); font-size: 13px; padding: 8px 24px; border-bottom: 1px solid var(--line); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--ctl-h); padding: 0 var(--ctl-px); border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
:root[data-theme=dark] .btn.danger { color: #111; }
.btn.danger-ghost { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: calc(var(--ctl-h) - 8px); padding: 0 10px; font-size: .9em; border-radius: var(--r-sm); gap: 6px; }
.btn.lg { height: calc(var(--ctl-h) + 8px); padding: 0 18px; font-size: 1.02em; }
.btn.block { width: 100%; }
.icon-btn { width: var(--ctl-h); height: var(--ctl-h); display: inline-grid; place-items: center; border-radius: var(--r); border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.bordered { border-color: var(--line-strong); background: var(--surface); }
.btn:focus-visible, .icon-btn:focus-visible, .nav-item:focus-visible, .chip:focus-visible, .tile:focus-visible, .seg button:focus-visible, a:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

/* ---------- Forms ---------- */
input, select, textarea { width: 100%; height: var(--ctl-h); padding: 0 var(--ctl-px); border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea { height: auto; min-height: 76px; padding: 9px var(--ctl-px); resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; padding: 0; accent-color: var(--accent); flex: none; }
input[type=file] { height: auto; padding: 8px; }
input[type=color] { padding: 2px; width: 48px; }
:root[data-style=soft] input, :root[data-style=soft] select, :root[data-style=soft] textarea { background: var(--surface-2); }
:root[data-style=soft] input:focus, :root[data-style=soft] select:focus, :root[data-style=soft] textarea:focus { background: var(--surface); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span:first-child { font-size: .88em; font-weight: 500; color: var(--muted); }
.field .req { color: var(--bad); }
.field .hint { font-size: .82em; color: var(--faint); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { margin-top: 2px; }
.check small { display: block; color: var(--muted); }
.l10n { display: flex; flex-direction: column; gap: 4px; }
.l10n-tabs { display: flex; gap: 2px; }
.l10n-tabs button { all: unset; cursor: pointer; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: var(--r-xs); color: var(--faint); }
.l10n-tabs button.on { background: var(--accent-soft); color: var(--accent); }
.l10n-tabs button.has::after { content: "•"; margin-left: 2px; color: var(--good); }
.money-in { display: grid; grid-template-columns: 1fr 86px; gap: 6px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; white-space: normal; }
.row.nowrap > div { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.stack.tight { gap: 8px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--gap); align-items: start; }
.cols-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: var(--gap); align-items: start; }

/* ---------- Segmented controls and chips ---------- */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r); background: var(--hover); flex: none; }
.seg button, .seg a { all: unset; cursor: pointer; padding: 5px 10px; border-radius: calc(var(--r) - 3px); font-size: .86em; font-weight: 600; color: var(--muted); text-align: center; white-space: nowrap; }
.seg button.on, .seg a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
:root[data-style=strict] .seg { padding: 2px; border: 1px solid var(--line); background: var(--surface-2); }
:root[data-style=strict] .seg button.on { background: var(--accent); color: var(--on-accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); cursor: pointer; font-size: .88em; font-weight: 500; white-space: nowrap; }
.chip:hover { color: var(--text); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip .n { font-size: .85em; color: var(--faint); }
.chip.on .n { color: inherit; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--pad); box-shadow: var(--shadow-sm); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head .sub { color: var(--muted); font-size: .88em; margin-top: 2px; }
.card.flush > .card-head { padding: var(--pad) var(--pad) 0; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .i { width: 34px; height: 34px; color: var(--faint); stroke-width: 1.4; }
.empty b { color: var(--text); font-size: 1.05em; }
.note { padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-size: .92em; display: flex; gap: 10px; align-items: flex-start; }
.note.warn { background: color-mix(in srgb, var(--warn) var(--tint), var(--surface)); color: var(--text); border-color: color-mix(in srgb, var(--warn) 30%, var(--line)); }
.note.bad { background: color-mix(in srgb, var(--bad) var(--tint), var(--surface)); color: var(--text); border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); }
.note.good { background: color-mix(in srgb, var(--good) var(--tint), var(--surface)); color: var(--text); border-color: color-mix(in srgb, var(--good) 30%, var(--line)); }
.note .i { margin-top: 1px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 500; white-space: nowrap; color: var(--c, var(--muted)); background: color-mix(in srgb, var(--c, var(--muted)) var(--tint), var(--surface)); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.good { --c: var(--good); } .badge.bad { --c: var(--bad); } .badge.warn { --c: var(--warn); } .badge.info { --c: var(--info); } .badge.accent { --c: var(--accent); } .badge.mute { --c: var(--mute); }
:root[data-style=strict] .badge { height: 20px; padding: 0 7px; font-size: 11.5px; }
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: var(--r-xs); background: var(--hover); color: var(--muted); font-weight: 500; vertical-align: middle; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .95em; }
.t th { text-align: left; font-weight: 600; font-size: .8em; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.t td { padding: var(--cell-py) 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr { transition: background .1s; }
.t tbody tr.link { cursor: pointer; }
.t tbody tr:hover { background: var(--surface-2); }
.t tbody tr.sel { background: var(--accent-soft); }
.t .chk { width: 36px; }
.t th.sortable { cursor: pointer; user-select: none; }
.t th.sortable:hover { color: var(--text); }
:root[data-style=strict] .t th { padding: 7px 10px; background: var(--surface-2); }
:root[data-style=strict] .t td { padding: var(--cell-py) 10px; }
:root[data-style=strict] .t tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); }
.cell-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-main .thumb { width: 34px; height: 34px; border-radius: var(--r-sm); object-fit: cover; background: var(--hover); flex: none; display: grid; place-items: center; color: var(--faint); }
.cell-main .t1 { font-weight: 500; }
.cell-main .t2 { font-size: .85em; color: var(--muted); }
.inv { font-family: var(--mono); font-size: .9em; font-weight: 600; }

.bulk { position: sticky; bottom: 16px; z-index: 20; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-radius: var(--r-lg); background: var(--text); color: var(--bg); box-shadow: var(--shadow-pop); }
.bulk .btn { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 30%, transparent); }
.bulk .btn:hover { background: color-mix(in srgb, var(--bg) 12%, transparent); }
.bulk b { margin-right: 6px; }

/* ---------- Dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; color: var(--text); box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
a.kpi:hover { text-decoration: none; border-color: var(--line-strong); }
.kpi .k { font-size: .82em; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 1.75em; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .s { font-size: .8em; color: var(--faint); }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c, transparent); }
.kpi.good { --c: var(--good); } .kpi.bad { --c: var(--bad); } .kpi.warn { --c: var(--warn); } .kpi.info { --c: var(--info); } .kpi.accent { --c: var(--accent); }
:root[data-style=strict] .kpi .v { font-size: 1.5em; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; display: flex; flex-direction: column; gap: 10px; color: var(--text); cursor: pointer; position: relative; box-shadow: var(--shadow-sm); }
.tile:hover { border-color: var(--line-strong); text-decoration: none; }
.tile.pinned { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.tile .name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.tile .name .ic { width: 30px; height: 30px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.tile .big { font-size: 1.6em; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1; }
.tile .rest { font-size: .8em; color: var(--faint); }
.tile .pin { position: absolute; top: 10px; right: 10px; }
.stack-bar { display: flex; height: 6px; border-radius: var(--r-pill); overflow: hidden; background: var(--hover); gap: 1px; }
.stack-bar i { display: block; height: 100%; background: var(--c); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .78em; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); display: inline-block; }
.c-in_stock { --c: var(--info); } .c-in_service { --c: var(--good); } .c-in_transit { --c: var(--accent); } .c-under_repair { --c: var(--warn); }
.c-missing { --c: var(--bad); } .c-pending_disposal { --c: color-mix(in srgb, var(--bad) 60%, var(--warn)); } .c-disposed { --c: var(--mute); }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--text); }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { text-decoration: none; background: var(--surface-2); margin: 0 calc(-1 * var(--pad)); padding-left: var(--pad); padding-right: var(--pad); }
.list-item .ic { width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--hover); color: var(--muted); flex: none; }
.list-item .ic.accent { background: var(--accent-soft); color: var(--accent); }
.list-item .ic.bad { background: color-mix(in srgb, var(--bad) var(--tint), var(--surface)); color: var(--bad); }
.list-item .ic.warn { background: color-mix(in srgb, var(--warn) var(--tint), var(--surface)); color: var(--warn); }
.list-item .ic.good { background: color-mix(in srgb, var(--good) var(--tint), var(--surface)); color: var(--good); }
.list-item .t1 { font-weight: 500; }
.list-item .t2 { font-size: .85em; color: var(--muted); }
.block-tools { display: flex; gap: 4px; }
.customize .block { outline: 2px dashed var(--line-strong); outline-offset: 4px; border-radius: var(--r-lg); }
.customize .block.off { opacity: .4; }

/* ---------- Detail pages ---------- */
.hero { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.hero .photo { width: 120px; height: 120px; border-radius: var(--r-lg); background: var(--hover); object-fit: cover; flex: none; display: grid; place-items: center; color: var(--faint); overflow: hidden; }
.hero .photo .i { width: 40px; height: 40px; stroke-width: 1.3; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 20px; }
.fact .k { font-size: .8em; color: var(--muted); }
.fact .v { font-weight: 500; overflow-wrap: anywhere; }
.timeline { display: flex; flex-direction: column; }
.tl { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 10px 0; position: relative; color: var(--text); }
.tl::before { content: ""; position: absolute; left: 16px; top: 44px; bottom: -10px; width: 1px; background: var(--line); }
.tl:last-child::before { display: none; }
.tl .ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--hover); color: var(--muted); }
a.tl:hover { text-decoration: none; }
a.tl:hover .t1 { color: var(--accent); }
.tl .t1 { font-weight: 500; }
.tl .t2 { font-size: .85em; color: var(--muted); }
.flow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 500; }
.flow .i { color: var(--faint); }

/* ---------- Operation picker ---------- */
.op-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.op-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--text); cursor: pointer; text-align: left; }
.op-card:hover { border-color: var(--accent); text-decoration: none; background: var(--accent-soft); }
.op-card .ic { width: 36px; height: 36px; border-radius: var(--r); background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.op-card b { display: block; margin-bottom: 2px; }
.op-card span { font-size: .85em; color: var(--muted); }
.op-card.off { opacity: .45; pointer-events: none; }
.steps { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .88em; color: var(--muted); }
.steps b { color: var(--text); }
.picker { max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); }
.result { padding: 12px 14px; border-radius: var(--r); background: var(--accent-soft); color: var(--text); display: flex; gap: 10px; align-items: center; }
.result .i { color: var(--accent); }

/* ---------- Class tree ---------- */
.tree { display: flex; flex-direction: column; gap: 1px; }
.tree-row { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer; color: var(--text); }
.tree-row:hover { background: var(--hover); text-decoration: none; }
.tree-row.on { background: var(--accent-soft); color: var(--accent); }
.tree-row .tw { width: 16px; color: var(--faint); flex: none; display: grid; place-items: center; }
.tree-row .n { margin-left: auto; font-size: .8em; color: var(--faint); font-variant-numeric: tabular-nums; }
.fields-ed { display: flex; flex-direction: column; gap: 8px; }
.field-row { display: grid; grid-template-columns: minmax(140px, 1.4fr) 110px 110px minmax(120px, 1fr) 34px; gap: 6px; align-items: center; }
.field-row.inherited { opacity: .7; }
.field-row .from { font-size: .8em; color: var(--faint); }

/* ---------- Popovers, appearance switcher, language ---------- */
.pop-wrap { position: relative; }
.pop-wrap > summary { list-style: none; cursor: pointer; }
.pop-wrap > summary::-webkit-details-marker { display: none; }
.pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 280px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.pop-row { display: flex; flex-direction: column; gap: 6px; }
.pop-row .eyebrow { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.pop .seg { align-self: flex-start; }
.lang-btn { display: inline-flex; align-items: center; gap: 6px; height: var(--ctl-h); padding: 0 10px; border-radius: var(--r); color: var(--muted); font-weight: 600; font-size: .88em; }
.lang-btn:hover { background: var(--hover); color: var(--text); }
.menu { display: flex; flex-direction: column; min-width: 220px; padding: 6px; gap: 0; }
.menu a, .menu button { all: unset; cursor: pointer; display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--r-sm); color: var(--text); }
.menu a:hover, .menu button:hover { background: var(--hover); text-decoration: none; }
.menu hr { margin: 6px 0; }
.menu .who { padding: 8px 10px; }

.look { position: relative; width: var(--ctl-h); height: var(--ctl-h); flex: none; }
.look-inner { position: absolute; right: 0; top: 0; z-index: 55; height: var(--ctl-h); display: flex; flex-direction: row-reverse; align-items: center; gap: 10px; border-radius: var(--r); transition: background .15s, box-shadow .15s, padding .15s; }
.look-theme { flex: none; }
.look-more { display: flex; align-items: center; gap: 10px; white-space: nowrap; max-width: 0; overflow: hidden; opacity: 0; transition: max-width .25s ease, opacity .15s ease; }
.look:hover .look-inner, .look:focus-within .look-inner { background: var(--surface); box-shadow: var(--shadow-pop); outline: 1px solid var(--line-strong); padding-left: 10px; }
.look:hover .look-more, .look:focus-within .look-more { max-width: 560px; opacity: 1; }
.look-pal { display: flex; gap: 8px; padding: 6px 4px; }
.pal { all: unset; cursor: pointer; width: 20px; height: 20px; border-radius: 50%; flex: none; position: relative; overflow: hidden; background: var(--a); box-shadow: 0 0 0 1px var(--line-strong); transition: transform .12s; }
.pal::after { content: ""; position: absolute; inset: 0 0 0 50%; background: var(--b); }
.pal:hover { transform: scale(1.15); }
.pal.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.pal:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.look-flat { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Dialogs and toasts ---------- */
dialog.dlg { border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--surface); color: var(--text); padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow-pop); }
dialog.dlg.wide { width: min(880px, calc(100vw - 32px)); }
dialog.dlg::backdrop { background: rgba(15, 15, 14, .45); }
.dlg form, .dlg > div { display: flex; flex-direction: column; gap: 14px; padding: 20px; max-height: calc(100vh - 60px); overflow: auto; }
.dlg .dlg-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: var(--r); box-shadow: var(--shadow-pop); font-size: .92em; max-width: min(560px, calc(100vw - 32px)); animation: toast-in .18s ease-out; }
.toast.bad { background: var(--bad); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Map ---------- */
.map { position: relative; overflow: hidden; background: var(--hover); border-radius: var(--r-lg); border: 1px solid var(--line); min-height: 320px; touch-action: none; user-select: none; }
.map.tall { height: calc(100vh - 210px); min-height: 420px; }
.map .tiles-layer { position: absolute; inset: 0; }
.map .tiles-layer img { position: absolute; width: 256px; height: 256px; max-width: none; }
:root[data-theme=dark] .map .tiles-layer img { filter: invert(1) hue-rotate(180deg) brightness(.95) contrast(.85) saturate(.7); }
.map .marker { position: absolute; transform: translate(-50%, -100%); cursor: pointer; z-index: 2; }
.map .marker .pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--c, var(--accent)); display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); border: 2px solid #fff; }
.map .marker .pin .i { transform: rotate(45deg); color: #fff; width: 14px; height: 14px; }
.map .marker.on .pin { outline: 3px solid var(--ring); }
.map .zoom { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 4px; z-index: 3; }
.map .attrib { position: absolute; right: 0; bottom: 0; font-size: 10px; background: color-mix(in srgb, var(--surface) 80%, transparent); padding: 1px 6px; z-index: 3; color: var(--muted); }
.map .attrib a { color: var(--muted); }
.map-pop { position: absolute; z-index: 4; transform: translate(-50%, calc(-100% - 40px)); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 10px 12px; box-shadow: var(--shadow-pop); min-width: 200px; }
.k-store { --c: #1f5fbf; } .k-warehouse { --c: #8a5a00; } .k-office { --c: #7a3a92; } .k-service { --c: #23704f; } .k-other { --c: #6b6b6b; }

/* ---------- Floor plan ---------- */
.plan-wrap { display: grid; grid-template-columns: 280px 1fr; gap: var(--gap); align-items: start; }
.plan { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; height: calc(100vh - 220px); min-height: 460px; touch-action: none; }
.plan svg { width: 100%; height: 100%; display: block; cursor: grab; }
.plan svg.panning { cursor: grabbing; }
.plan .room { fill: var(--surface-2); stroke: var(--text); stroke-width: 3; vector-effect: non-scaling-stroke; }
.plan .grid line { stroke: var(--line-strong); stroke-opacity: .55; vector-effect: non-scaling-stroke; }
.plan .eq rect { fill: color-mix(in srgb, var(--c, var(--accent)) 18%, var(--surface)); stroke: var(--c, var(--accent)); stroke-width: 1.5; vector-effect: non-scaling-stroke; cursor: move; }
.plan .eq.sel rect { stroke-width: 3; fill: color-mix(in srgb, var(--accent) 30%, var(--surface)); }
.plan .eq text { fill: var(--text); font-size: 13px; pointer-events: none; font-family: var(--font); }
.plan .eq .rot { fill: var(--accent); cursor: grab; }
.plan .dim { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.plan-tools { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; z-index: 2; flex-wrap: wrap; }
.plan-side .item { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: var(--r-sm); cursor: grab; border: 1px solid var(--line); margin-bottom: 4px; background: var(--surface); }
.plan-side .item:hover { border-color: var(--accent); }

/* ---------- Landing ---------- */
.landing { min-height: 100vh; display: flex; flex-direction: column; }
.landing-top { display: flex; align-items: center; gap: 12px; padding: 16px 32px; }
.landing-hero { max-width: 1180px; margin: 0 auto; padding: 48px 32px 24px; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: 48px; align-items: start; width: 100%; }
.landing-hero h1 { font-size: 2.6em; line-height: 1.08; letter-spacing: -.03em; }
.landing-hero .lead { font-size: 1.15em; color: var(--muted); margin-top: 16px; max-width: 560px; }
.landing-feats { max-width: 1180px; margin: 0 auto; padding: 24px 32px 64px; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; width: 100%; }
.feat { padding: 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.feat .ic { width: 38px; height: 38px; border-radius: var(--r); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 10px; }
.feat b { display: block; margin-bottom: 4px; }
.feat p { color: var(--muted); font-size: .92em; }
.auth-card { padding: 24px; }
.demo-list { display: flex; flex-direction: column; gap: 6px; }
.demo-row { all: unset; cursor: pointer; display: grid; grid-template-columns: 38px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.demo-row:hover { border-color: var(--accent); background: var(--accent-soft); }
.demo-row:focus-visible { box-shadow: 0 0 0 3px var(--ring); }
.ava { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; color: #fff; background: hsl(var(--h, 200) 45% 42%); flex: none; font-size: 14px; }
.ava.sm { width: 28px; height: 28px; font-size: 12px; }
.foot { margin-top: auto; padding: 20px 32px; color: var(--faint); font-size: .85em; display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; border-top: 1px solid var(--line); }

/* ---------- Billing ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.plan-card { padding: 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.plan-card.cur { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan-card ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: .92em; }

/* ---------- Matrix (roles) ---------- */
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }

/* ---------- Print: acts ---------- */
.print-only { display: none; }
.act { background: #fff; color: #000; padding: 32px; max-width: 900px; margin: 0 auto; font: 13px/1.45 var(--font); }
.act h1 { font-size: 18px; text-align: center; margin: 12px 0 4px; }
.act .meta { display: flex; justify-content: space-between; gap: 16px; font-size: 12px; }
.act table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.act th, .act td { border: 1px solid #000; padding: 5px 7px; text-align: left; font-size: 12px; }
.act .signs { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 40px; margin-top: 32px; }
.act .sign { border-top: 1px solid #000; padding-top: 4px; font-size: 11px; }
@media print {
  .side, .topbar, .demo-bar, .ro-bar, .no-print, .toasts { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .page { padding: 0; max-width: none; }
  .print-only { display: block; }
}

/* ---------- Accounts, second factor, support ---------- */
.note.info { background: color-mix(in srgb, var(--info) var(--tint), var(--surface)); color: var(--text); border-color: color-mix(in srgb, var(--info) 30%, var(--line)); }
.chips.wrap { flex-wrap: wrap; }
.list-item.wrap { flex-wrap: wrap; }
.list-item.wrap > .grow { min-width: 180px; }
.perm-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 20px; }
.perm-group { display: flex; flex-direction: column; gap: 8px; }
.perm-group .eyebrow, .pop-row .eyebrow { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.qr-box { align-self: center; padding: 10px; background: #fff; border-radius: var(--r); border: 1px solid var(--line); line-height: 0; }
.qr-box svg { width: 196px; height: 196px; display: block; }
pre.recovery { margin: 0; padding: 12px 16px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); font: 600 15px/1.7 var(--mono); columns: 2; column-gap: 24px; }
.chat-msg { max-width: 78%; padding: 10px 12px; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--line); align-self: flex-start; }
.chat-msg.staff { align-self: flex-end; background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, var(--line)); }
.chat-head { font-size: .85em; margin-bottom: 2px; }
.chat-text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Responsive ----------
   Three frames, as in the other products of the studio: sidebar (1024 and wider), icon rail (640–1023),
   top bar + bottom tabs (narrower than 640). Checked at 390, 768, 1280 and 1440 px. */
.top-brand, .tabbar, .only-sm { display: none; }
.nav-item { position: relative; }
@media (max-width: 1100px) {
  .cols-2-1 { grid-template-columns: minmax(0, 1fr) !important; }
  .landing-hero { grid-template-columns: 1fr; gap: 28px; }
  .plan-wrap { grid-template-columns: 1fr; }
  .plan-wrap > :first-child { order: 2; max-height: 320px; overflow: auto; }
}

/* Tablet: icon rail */
@media (min-width: 640px) and (max-width: 1023px) {
  :root { --sidebar: 72px; }
  .side { padding: 12px 10px; align-items: center; }
  .brand { padding: 4px 0 12px; }
  .brand-name, .nav-text, .org-switch, .side-foot { display: none; }
  .nav { align-items: center; }
  .nav-item { width: 48px; height: 44px; padding: 0; justify-content: center; }
  .nav-item .count { position: absolute; top: 3px; right: 2px; min-width: 16px; line-height: 16px; padding: 0 4px; font-size: 10px; }
  .nav-group { font-size: 0; padding: 0; height: 1px; width: 32px; background: var(--line); margin: 10px auto; }
  .topbar { padding: 0 20px; }
  .page { padding: 22px 20px 40px; }
  .topbar .hide-m { display: none; }
  .look:hover .look-more, .look:focus-within .look-more { max-width: calc(100vw - 200px); }
}

/* Phone: top bar + bottom tabs; the menu opens the sidebar as a drawer */
@media (max-width: 639px) {
  :root { --tabbar: 62px; --topbar: 54px; }
  .shell { display: block; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 80; transform: translateX(-102%); transition: transform .2s; padding-bottom: 20px; }
  .shell.nav-open .side { transform: none; box-shadow: var(--shadow-pop); }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 70; }
  .hide-sm { display: none !important; }
  .only-sm { display: block; }
  .topbar { padding: 0 8px 0 12px; gap: 2px; height: var(--topbar); }
  .top-brand { display: grid; place-items: center; margin-right: 6px; }
  .top-brand:hover { text-decoration: none; }
  .top-brand .brand-mark { width: 32px; height: 32px; }
  .topbar .search { flex: 1; min-width: 0; margin-right: 2px; }
  .topbar .search input { height: 38px; font-size: 16px; }
  .topbar .spacer { display: none; }
  .topbar .pop { position: fixed; left: 8px; right: 8px; top: calc(var(--topbar) + 6px); min-width: 0; max-height: calc(100dvh - var(--topbar) - var(--tabbar) - 24px); overflow: auto; }
  .menu-lang { display: flex; flex-direction: column; gap: 10px; padding: 6px 10px; }
  .menu-lang .seg { flex-wrap: wrap; }
  .demo-bar { padding: 5px 12px; font-size: 12.5px; gap: 10px; flex-wrap: nowrap; white-space: nowrap; }
  .demo-bar b { margin-right: auto; }
  .ro-bar { padding: 8px 12px; }

  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
  .tab { all: unset; cursor: pointer; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 500; color: var(--faint); min-width: 0; }
  .tab span:not(.count):not(.plus) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
  .tab .i { width: 22px; height: 22px; }
  .tab.on { color: var(--accent); }
  .tab:hover { text-decoration: none; color: var(--text); }
  .tab .count { position: absolute; top: 6px; left: calc(50% + 5px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-pill); background: var(--bad); color: #fff; font: 600 10px/16px var(--font); text-align: center; }
  .tab .count.dot { min-width: 8px; width: 8px; height: 8px; padding: 0; top: 9px; left: calc(50% + 8px); }
  .tab-plus .plus { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent); }
  :root[data-style=strict] .tab-plus .plus { border-radius: var(--r); }
  .tab-plus .plus .i { width: 24px; height: 24px; }
  .tab:focus-visible { box-shadow: inset 0 0 0 2px var(--ring); }

  .page { padding: 18px 14px calc(var(--tabbar) + 28px + env(safe-area-inset-bottom)); }
  h1 { font-size: 1.4em; }
  .page-head { align-items: flex-start; gap: 12px; }
  .page-head > div:first-child { min-width: 0; }
  .page-head .actions { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 2px 14px; width: calc(100% + 28px); }
  .page-head .actions::-webkit-scrollbar { display: none; }
  .page-head .actions .btn { flex: none; }
  .card { padding: 16px; }
  .card.flush > .card-head { padding: 16px 16px 0; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 12px 14px; }
  .kpi .v { font-size: 1.5em; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 12px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; }
  .card .chips { margin: 0 -16px; padding: 0 16px; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .row > select, .row > input:not([type=checkbox]):not([type=radio]) { flex: 1 1 140px; width: auto; min-width: 0; }
  .row > input[type=search] { flex-basis: 100%; }
  .card > .row > div { flex: 1 1 calc(50% - 5px) !important; min-width: calc(50% - 5px) !important; }
  .card > .row > div:has(> input[type=search]), .card > .row > div:only-child { flex-basis: 100% !important; }
  .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
  .hero { flex-direction: column; gap: 14px; }
  .hero .photo { width: 72px; height: 72px; }
  .hero > .grow { width: 100%; }
  .op-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr 1fr; }
  .bulk { bottom: calc(var(--tabbar) + 12px + env(safe-area-inset-bottom)); }
  .toasts { bottom: calc(var(--tabbar) + 14px + env(safe-area-inset-bottom)); }
  .map.tall { height: calc(100dvh - var(--topbar) - var(--tabbar) - 150px); min-height: 360px; }
  .floor-svg { height: 52vh; }
  .plan { height: calc(100dvh - var(--topbar) - var(--tabbar) - 190px); min-height: 380px; }
  .landing-top, .landing-hero, .landing-feats { padding-left: 16px; padding-right: 16px; }
  .landing-hero h1 { font-size: 2em; }
  .landing .tabbar { display: none; }
  .landing-top { padding-top: 12px; padding-bottom: 12px; gap: 6px; }
  .land-nav.hide-m { display: none; }

  /* Tables become cards: see stackTables() in js/app.js */
  table.t.stack, .t.stack tbody { display: block; }
  .t.stack thead { display: none; }
  .t.stack tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); align-items: center; }
  .t.stack tbody tr.has-chk { grid-template-columns: auto minmax(0, 1fr) auto; }
  .t.stack tbody tr:last-child { border-bottom: 0; }
  :root[data-style=strict] .t.stack tbody tr:nth-child(even) { background: none; }
  .t.stack td { display: block; padding: 0; border: 0; min-width: 0; }
  .t.stack td.c-chk { grid-row: 1; grid-column: 1; width: auto; }
  .t.stack td.c-main { grid-row: 1; grid-column: 1; font-weight: 500; }
  .t.stack tr.has-chk td.c-main { grid-column: 2; }
  .t.stack td.c-badge { grid-row: 1; grid-column: -2; justify-self: end; }
  .t.stack td.c-kv, .t.stack td.c-act, .t.stack td.c-full { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: .92em; text-align: right; }
  .t.stack tr.has-chk td.c-kv, .t.stack tr.has-chk td.c-act { grid-column: 2 / -1; }
  .t.stack td.c-kv::before { content: attr(data-label); color: var(--faint); font-size: .88em; text-align: left; flex: none; max-width: 45%; }
  .t.stack td.c-kv:nth-child(1 of .c-kv) { margin-top: 4px; }
  .t.stack td.c-act { justify-content: flex-end; }
  .t.stack td.c-full { display: block; text-align: center; }
  .t.stack td.c-none { display: none; }
  .t.stack tbody tr.figs { grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); }
  .t.stack tr.figs td.c-main { grid-column: 1 / -1; margin-bottom: 4px; }
  .t.stack tr.figs td.c-kv { grid-column: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 0; margin: 0; text-align: left; }
  .t.stack tr.figs td.c-kv::before { max-width: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }
  .t.stack .cell-main .t1 { line-height: 1.3; }

  dialog.dlg, dialog.dlg.wide { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom: 0; }
  .dlg form, .dlg > div { max-height: 88dvh; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .dlg .dlg-foot .btn { flex: 1; }
  .pop.wide-pop { width: auto; }
}
@media (max-width: 379px) {
  .page { padding-left: 12px; padding-right: 12px; }
  .kpi .v { font-size: 1.35em; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Accounts: password meter, codes, provider buttons ---------- */
.pw { display: flex; flex-direction: column; gap: 6px; }
.pw-row { display: flex; gap: 6px; align-items: center; }
.pw-row input { flex: 1; }
.pw-bar { height: 4px; background: var(--hover); border-radius: var(--r-pill); overflow: hidden; }
.pw-bar i { display: block; height: 100%; width: 0; background: var(--bad); transition: width .15s; }
.pw-bar i.mid { background: var(--warn); } .pw-bar i.ok { background: var(--good); }
.pw-tips { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); }
.pw-tips .bad { color: var(--bad); } .pw-tips .good { color: var(--good); }
.code-in { font: 600 22px/1 var(--mono); letter-spacing: .4em; text-align: center; }
.or { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.linkish { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }

/* ---------- Notices ---------- */
.bell { position: relative; }
.bell-dot { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-pill); background: var(--bad); color: #fff; font: 600 10px/16px var(--font); text-align: center; }
.pop.wide-pop { width: min(380px, calc(100vw - 24px)); padding: 4px; gap: 0; }
.notice-list { display: flex; flex-direction: column; max-height: 60vh; overflow: auto; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: var(--r-sm); color: var(--text); }
.notice:hover { background: var(--hover); text-decoration: none; }
.notice .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notice .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--info); }
.notice.warn .dot { background: var(--warn); } .notice.bad .dot { background: var(--bad); }
.notice.read { opacity: .62; } .notice.read .dot { background: var(--line-strong); }
.notice-page .notice { border-bottom: 1px solid var(--line); border-radius: 0; padding: 12px 16px; }
.notice-page .notice:last-child { border-bottom: 0; }

/* ---------- Change log ---------- */
.tl-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.tl-item:last-child { border-bottom: 0; }
.tl-head { display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; }
.t.diff { margin-top: 6px; }
.t.diff td { padding: 3px 8px; border: 0; vertical-align: top; }
.t.diff .old { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--bad) 60%, transparent); }
.t.diff .new { font-weight: 500; }
tr.bad-row td { color: var(--bad); }

/* ---------- Photos of acts, scanner ---------- */
.photos-in { display: flex; flex-wrap: wrap; gap: 8px; }
.photos-in .ph, .photos-in .ph-add { width: 84px; height: 84px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--hover); position: relative; overflow: hidden; display: grid; place-items: center; color: var(--muted); }
.photos-in .ph img { width: 100%; height: 100%; object-fit: cover; }
.photos-in .ph-add { cursor: pointer; border-style: dashed; gap: 2px; align-content: center; justify-items: center; font: inherit; }
.photos-in .ph-add:hover { border-color: var(--accent); color: var(--accent); }
.photos-in .ph-x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; cursor: pointer; }
.photos-in .ph-x .i { width: 12px; height: 12px; }
.req-field > span::after { content: " *"; color: var(--bad); }
.scan-box { position: relative; background: #000; border-radius: var(--r); overflow: hidden; aspect-ratio: 4 / 3; max-height: 60vh; }
.scan-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 18% 22%; border: 2px solid rgba(255, 255, 255, .85); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .25); }

/* ---------- Labels ---------- */
.label-sheets { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.label-page { display: grid; background: #fff; color: #000; box-shadow: var(--shadow); overflow: hidden; }
.label { box-sizing: border-box; padding: 2.5mm 3mm; display: flex; gap: 2.5mm; align-items: center; overflow: hidden; border: .1mm dashed #ccc; font-family: Arial, sans-serif; }
.label.empty { background: #f4f4f4; }
.lb-qr { flex: none; height: calc(var(--lh) - 5mm); aspect-ratio: 1; }
.lb-qr svg { width: 100%; height: 100%; display: block; }
.lb-text { min-width: 0; display: flex; flex-direction: column; gap: .6mm; flex: 1; }
.lb-org { font-size: 6.5pt; color: #444; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-inv { font: 700 11pt/1.1 "Consolas", monospace; letter-spacing: .02em; }
.lb-model, .lb-site { font-size: 7pt; line-height: 1.15; max-height: 2.3em; overflow: hidden; }
.lb-bar svg { width: 100%; height: 8mm; display: block; }
.label.small { padding: 1.2mm 1.5mm; gap: 1.5mm; }
.label.small .lb-qr { height: calc(var(--lh) - 2.4mm); }
.label.small .lb-inv { font-size: 8pt; } .label.small .lb-model { font-size: 5.5pt; } .label.small .lb-org { font-size: 5pt; }
.label.small .lb-bar svg { height: 5mm; }
.check.inline { display: inline-flex; gap: 6px; align-items: center; }
@media print {
  .label-sheets { gap: 0; display: block; }
  .label-page { box-shadow: none; page-break-after: always; break-after: page; }
  .label { border-color: transparent; }
  .label.empty { background: none; }
}

/* ---------- Floor plan, requests thread ---------- */
.floor-card { padding: 8px; overflow: auto; }
.floor-svg { width: 100%; height: min(70vh, 720px); display: block; background: var(--surface-2); border-radius: var(--r-sm); }
.floor-room { cursor: pointer; }
.floor-room > rect:first-child { fill: color-mix(in srgb, var(--accent) 8%, var(--surface)); stroke: var(--accent); stroke-width: 4; }
.floor-room:hover > rect:first-child { fill: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.floor-room text { fill: var(--text); font-family: var(--font); font-weight: 600; pointer-events: none; }
.floor-room text.sub { fill: var(--muted); font-weight: 400; }
.floor-unit { fill: color-mix(in srgb, var(--accent) 45%, var(--surface)); stroke: var(--accent); stroke-width: 1.5; pointer-events: none; }
.thread { display: flex; flex-direction: column; gap: 14px; }
.thread .msg { display: flex; gap: 10px; align-items: flex-start; }
.thread .msg p { margin: 4px 0 0; }

/* ---------- Landing, help, start ---------- */
.land-nav { display: flex; gap: 18px; margin-left: 24px; font-size: 14px; }
.land-nav a { color: var(--muted); } .land-nav a:hover { color: var(--text); text-decoration: none; }
.land-points { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; color: var(--muted); }
.land-points li { display: flex; gap: 8px; align-items: center; } .land-points .i { color: var(--good); }
.land-band { max-width: 1120px; width: 100%; margin: 0 auto; padding: 40px 24px; display: flex; flex-direction: column; gap: 16px; }
.land-band h2 { font-size: 1.6em; }
.land-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.land-steps li { display: flex; gap: 12px; }
.land-steps .n { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.price-plan { display: flex; flex-direction: column; gap: 12px; }
.price-plan.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.price-plan .price { font-size: 1.6em; font-weight: 700; }
.price-plan ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; flex: 1; font-size: 14px; }
.price-plan li { display: flex; gap: 8px; align-items: flex-start; } .price-plan li .i { color: var(--good); flex: none; margin-top: 2px; }
.faq { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 10px; align-items: start; }
.faq summary { cursor: pointer; list-style: none; }
.land-cta { text-align: center; padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; border-top: 1px solid var(--line); }
.auth-only { display: grid; place-items: center; padding: 40px 16px 60px; }
.auth-only .auth-card { width: min(460px, 100%); }
.landing .foot { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.docs .prose { line-height: 1.6; }
.prose h1 { font-size: 1.6em; margin: 0 0 12px; } .prose h2 { font-size: 1.2em; margin: 22px 0 8px; } .prose h3 { margin: 16px 0 6px; }
.prose p, .prose ul, .prose ol { margin: 8px 0; } .prose ul, .prose ol { padding-left: 22px; }
.prose pre { background: var(--hover); padding: 10px 12px; border-radius: var(--r-sm); overflow: auto; font-size: 12px; }
.prose table { margin: 10px 0; } .prose blockquote { border-left: 3px solid var(--line-strong); margin: 8px 0; padding: 2px 12px; color: var(--muted); }
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.help-card { display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.help-card:hover { border-color: var(--accent); text-decoration: none; }
.done-step { opacity: .75; }
.start-card { color: var(--text); border-color: var(--accent); }
.start-card:hover { text-decoration: none; background: var(--accent-soft); }

/* ---------- Platform: site, client area, console ---------- */
.announce { background: var(--accent-soft); color: var(--accent); text-align: center; padding: 8px 16px; font-size: 14px; font-weight: 500; }
.hero-preview { gap: 14px; transform: rotate(-.6deg); box-shadow: 0 18px 48px rgba(0, 0, 0, .10), var(--shadow-sm); }
.hero-preview .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hero-preview .kpi .v { font-size: 1.35em; }
.list-item .ic.tone-accent { background: var(--accent-soft); color: var(--accent); }
.list-item .ic.tone-warn { background: color-mix(in srgb, var(--warn) var(--tint), var(--surface)); color: var(--warn); }
.list-item .ic.tone-good { background: color-mix(in srgb, var(--good) var(--tint), var(--surface)); color: var(--good); }
.regions { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.region-flag { display: inline-grid; place-items: center; width: 36px; height: 26px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 700; font-size: 12px; letter-spacing: .04em; }
.land-foot { max-width: 1120px; width: 100%; margin: 0 auto; padding: 28px 24px 36px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 32px; border-top: 1px solid var(--line); }
.land-foot .row a { color: var(--muted); }
.narrow-band { max-width: 860px; }
.good-text { color: var(--good); } .warn-text { color: var(--warn); }
.ro-bar.info-bar { background: color-mix(in srgb, var(--info) var(--tint), var(--surface)); color: var(--info); }
.ro-bar.bad-bar { background: color-mix(in srgb, var(--bad) var(--tint), var(--surface)); color: var(--bad); }
.ro-bar a { color: inherit; font-weight: 600; text-decoration: underline; }
.org-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.org-card h3 { margin: 0; font-size: 1.1em; }
.use-row { display: flex; flex-direction: column; gap: 4px; }
.use-bar { height: 6px; border-radius: 3px; background: var(--hover); overflow: hidden; }
.use-bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; min-width: 2px; }
.use-bar.warn span { background: var(--warn); } .use-bar.over span { background: var(--bad); }
.chip.off { opacity: .55; text-decoration: line-through; cursor: default; }
.chip { cursor: default; }
.small-plans { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.small-plans .price-plan { padding: 14px; gap: 8px; }
.small-plans .price-plan .price { font-size: 1.25em; }
.on-plan { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); justify-content: center; }
.price-plan.archived { opacity: .6; }
.pay-opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border-radius: var(--r-md, 10px); border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.pay-opt:hover { border-color: var(--accent); background: var(--accent-soft); }
.pay-opt .i:first-child { color: var(--accent); }
.invoice-doc { gap: 18px; }
.invoice-doc table tfoot td { font-weight: 500; }
.invoice-doc table tfoot tr.strong td { font-weight: 700; font-size: 1.05em; }
.filters { margin-bottom: 4px; } .filters input[type=search] { min-width: 260px; flex: 1; max-width: 420px; }
.provider-box { padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.demo-card .eyebrow { margin-top: 4px; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--hover); }
@media (max-width: 640px) {
  .org-grid { grid-template-columns: 1fr; }
  .hero-preview { transform: none; }
  .filters input[type=search] { min-width: 0; }
  .land-foot { padding: 20px 16px 96px; }
}
@media print {
  .invoice-doc { border: 0; box-shadow: none; }
}
.eyebrow { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
