@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/plus-jakarta-sans-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/plus-jakarta-sans-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/plus-jakarta-sans-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/plus-jakarta-sans-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/jetbrains-mono-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/jetbrains-mono-latin-500-normal.woff2) format('woff2'); }

:root {
  --bg: #F4EFE6; --surface: #FFFDF9; --side: #FBF8F2; --line: #E7DFD2; --line2: #CFC5B5; --soft: #F1EBE0; --soft2: #EFE8DD;
  --ink: #1C1915; --text2: #3A332B; --text3: #4A433A; --muted: #5A5246; --muted2: #6E6558; --faint: #8F8576; --faint2: #A69B8B;
  --accent: #F2B532; --accent-soft: #FBEBCB;
  --good: #1F6B43; --good-dot: #2F8A57; --good-bg: #E3F1E8;
  --warn: #8A4B00; --warn-dot: #D18A00; --warn-bg: #FBEBCB;
  --bad: #A1281F; --bad-dot: #C7372B; --bad-bg: #FBE3DF;
  --info: #1D4F91; --info-dot: #5B8DEF; --info-bg: #E2ECF8;
  --r-lg: 22px; --r-md: 18px; --r-sm: 12px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --side-w: 248px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.45; }
a { color: var(--ink); }
a:hover { color: var(--text3); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; }
h3 { font-size: 13px; font-weight: 700; color: var(--muted); }
p { margin: 0; }
.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(--muted2); }
.mono { font-family: var(--mono); font-size: 0.92em; }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.right { text-align: right; }
.grow { flex: 1 1 auto; min-width: 0; }
.hidden { display: none !important; }
.good { color: var(--good); } .warn { color: var(--warn); } .bad { color: var(--bad); }

/* ------------------------------------------------------------------ layout */
.app { display: flex; min-height: 100vh; align-items: stretch; }
.side { flex: 0 0 var(--side-w); width: var(--side-w); background: var(--side); border-right: 1px solid var(--line); }
.side-in { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 16px 12px; display: flex; flex-direction: column; gap: 18px; }
.app.collapsed { --side-w: 72px; }
.app.collapsed .side .label, .app.collapsed .side .nav-head, .app.collapsed .side .nav-badge, .app.collapsed .side .me-text, .app.collapsed .side .brand-name { display: none; }
.app.collapsed .side .nav a, .app.collapsed .side .me { justify-content: center; }
.app.collapsed .side .brand-row { flex-direction: column; }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 4px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; background: var(--ink); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-mark span { width: 11px; height: 11px; border-radius: 999px; background: var(--accent); }
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 18px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-head { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 4px 12px 6px; border: 0; background: none; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: var(--muted2); text-transform: uppercase; cursor: pointer; text-align: left; border-radius: 8px; }
.nav-head:hover { color: var(--ink); }
.nav-head svg { transition: transform 0.15s; }
.nav-head.static { cursor: default; padding-left: 0; }
.nav-group.closed .nav-head svg { transform: rotate(-90deg); }
.nav-items { display: flex; flex-direction: column; gap: 2px; }
.nav-group.closed .nav-items a:not([aria-current="page"]) { display: none; }
.app.collapsed .nav-group.closed .nav-items a { display: flex; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 12px; color: var(--text2); font-size: 14px; font-weight: 500; text-decoration: none; }
.nav a:hover { background: var(--soft); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: #FFFDF9; font-weight: 600; }
.nav a .label { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav a.sys { font-size: 13px; }
.nav-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--ink); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.nav-badge.quiet { background: transparent; color: var(--warn); padding: 0; }
.nav .dotwrap { width: 18px; display: inline-flex; justify-content: center; flex-shrink: 0; }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--soft); text-decoration: none; color: var(--ink); }
.me-avatar { width: 32px; height: 32px; border-radius: 999px; background: var(--ink); color: #FFFDF9; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-weight: 700; font-size: 13px; }
.me-text { min-width: 0; }
.me-text b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text span { display: block; font-size: 12px; color: var(--muted); }
.main { flex: 1 1 560px; min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 16px 32px; background: var(--bg); border-bottom: 1px solid var(--line); }
.top-title { min-width: 0; }
.top-title p { margin-top: 3px; font-size: 13px; color: var(--muted); }
.top-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.searchpill { display: flex; align-items: center; gap: 10px; width: 300px; max-width: 100%; height: 44px; padding: 0 8px 0 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: 14px; cursor: pointer; }
.searchpill:hover { border-color: var(--line2); color: var(--ink); }
.searchpill span { flex: 1 1 auto; text-align: left; }
kbd { font-family: var(--mono); font-size: 11px; padding: 3px 7px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.iconbtn { position: relative; width: 44px; height: 44px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; text-decoration: none; flex-shrink: 0; }
.iconbtn.plain { background: transparent; border-color: transparent; border-radius: 12px; color: var(--text3); }
.iconbtn:hover { border-color: var(--line2); }
.iconbtn .count { position: absolute; top: 3px; right: 3px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: var(--ink); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.page { padding: 24px 32px 48px; display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.page.narrow { max-width: 880px; }
.bottom-nav { display: none; }
svg.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
svg.icon.sm { width: 14px; height: 14px; }
svg.icon.lg { width: 22px; height: 22px; }

/* ------------------------------------------------------------------ building blocks */
.row { display: flex; gap: 16px; flex-wrap: wrap; align-items: stretch; }
.row.tight { gap: 8px; }
.row.center { align-items: center; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stack.tight { gap: 6px; }
.stack.loose { gap: 20px; }
.col-2 { flex: 2 1 560px; min-width: 0; }
.col-1 { flex: 1 1 320px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px; min-width: 0; }
.card.sm { border-radius: var(--r-md); padding: 16px 18px; }
.card.flat { background: transparent; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head p { font-size: 12px; color: var(--muted); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head p { font-size: 13px; color: var(--muted); }
.divider { height: 1px; background: var(--line); margin: 4px 0; border: 0; }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi-hero-num { font-size: 56px; font-weight: 600; letter-spacing: -0.035em; line-height: 1.05; margin-top: 8px; font-variant-numeric: tabular-nums; }
.kpi-num { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.kpi-change { display: flex; align-items: center; gap: 5px; margin-top: 6px; font-size: 12px; font-weight: 600; }
.kpi-change .muted { font-weight: 500; }
.kpi-grid { flex: 1.3 1 300px; min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kpi-hero { flex: 1 1 250px; display: flex; flex-direction: column; }
.kpi-hero .spark-wrap { margin-top: auto; padding-top: 18px; }
.spark-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--muted); }
a.cardlink { text-decoration: none; color: inherit; display: block; }
a.cardlink:hover .card, a.cardlink.card:hover { border-color: var(--line2); }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--soft); color: var(--text3); }
.badge.high, .badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.medium, .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.low, .badge.info { background: var(--info-bg); color: var(--info); }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.outline { background: transparent; border: 1px dashed var(--faint2); color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 999px; background: var(--faint2); display: inline-block; flex-shrink: 0; }
.dot.up { background: var(--good-dot); } .dot.slow { background: var(--warn-dot); } .dot.down { background: var(--bad-dot); }
.dot.lg { width: 10px; height: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line2); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #FFFDF9; }
.btn.primary:hover { background: #38322B; color: #FFFDF9; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--soft); }
.btn.danger { color: var(--bad); border-color: #E3B5AE; }
.btn.danger:hover { border-color: var(--bad); color: var(--bad); }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn.block { width: 100%; }
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--soft); border-radius: 999px; flex-wrap: wrap; }
.seg button { min-height: 32px; padding: 0 12px; border-radius: 999px; border: 0; background: transparent; font-size: 13px; font-weight: 600; color: var(--text3); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(28, 25, 21, 0.12); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.tabs a[aria-current="page"], .tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.meter { height: 8px; border-radius: 999px; background: var(--soft2); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--ink); border-radius: 999px; }
.meter.accent > span { background: var(--accent); }
.meter.warn > span { background: var(--warn-dot); }
.meter.bad > span { background: var(--bad-dot); }
.list { display: flex; flex-direction: column; }
.list > .item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); min-width: 0; }
.list > .item:first-child { border-top: 0; padding-top: 0; }
.item-main { flex: 1 1 auto; min-width: 0; }
.item-title { font-weight: 600; font-size: 14px; }
.item-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex-shrink: 0; }
.sev-bar { width: 4px; align-self: stretch; border-radius: 4px; background: var(--faint2); flex-shrink: 0; }
.sev-bar.high { background: var(--bad-dot); } .sev-bar.medium { background: var(--warn-dot); } .sev-bar.low { background: var(--info-dot); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line2); border-radius: var(--r-md); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; }
.note { padding: 12px 14px; border-radius: var(--r-sm); background: var(--soft); color: var(--text3); font-size: 13px; }
.note.why { color: var(--ink); font-size: 14px; display: grid; gap: 8px; }
.note.why ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.own-keys { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 12px; }
.own-keys summary { cursor: pointer; font-weight: 600; }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.note.bad { background: var(--bad-bg); color: var(--bad); }
.note.good { background: var(--good-bg); color: var(--good); }
.note.info { background: var(--info-bg); color: var(--info); }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted2); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--side); }

/* ------------------------------------------------------------------ forms */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field .label { font-size: 13px; font-weight: 600; color: var(--text3); }
.field .help { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12px; color: var(--bad); font-weight: 600; }
.input, select.input, textarea.input { width: 100%; min-height: 44px; padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid var(--line2); background: #FFFFFF; font-size: 15px; }
textarea.input { min-height: 88px; resize: vertical; }
.input:focus { outline: 3px solid var(--accent); outline-offset: 0; border-color: var(--ink); }
.input[aria-invalid="true"] { border-color: var(--bad); }
.input:disabled { opacity: 0.55; cursor: not-allowed; }
.input.code { font-family: var(--mono); font-size: 22px; letter-spacing: 0.3em; text-align: center; }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: 32px; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--ink); flex-shrink: 0; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > .field { flex: 1 1 200px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.secret { font-family: var(--mono); font-size: 18px; letter-spacing: 0.06em; padding: 12px 14px; border-radius: var(--r-sm); background: var(--soft); word-break: break-all; user-select: all; }
.codebox { font-family: var(--mono); font-size: 12px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--ink); color: #F4EFE6; word-break: break-all; user-select: all; white-space: pre-wrap; }

/* ------------------------------------------------------------------ auth screens */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.auth-card.wide { max-width: 520px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.qr { width: 200px; height: 200px; border-radius: 12px; border: 1px solid var(--line); background: #FFFDF9; align-self: center; }
.steps { margin: 0; padding-left: 20px; color: var(--text3); display: flex; flex-direction: column; gap: 6px; }

/* ------------------------------------------------------------------ overview pieces */
.summary { display: flex; flex-direction: column; gap: 6px; }
.summary-line { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.summary-line .dot { margin-top: 7px; }
.goal { display: flex; flex-direction: column; gap: 6px; }
.goal-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.goal-top b { font-weight: 600; }
.sysgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.sys-card { display: flex; flex-direction: column; gap: 10px; }
.sys-card .problem { font-size: 13px; color: var(--text3); }
.sys-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; min-height: 44px; }
.sys-row:first-child { border-top: 0; }
.sys-row:hover .sys-name { text-decoration: underline; }
.sys-name { font-weight: 600; font-size: 14px; flex: 1 1 auto; min-width: 0; }
.sys-meta { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.srv { display: flex; flex-direction: column; gap: 12px; }
.srv-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.srv-metric .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.srv-metric .l { font-size: 12px; color: var(--muted); }
.week { display: flex; flex-direction: column; gap: 10px; }
.week-day { display: flex; gap: 12px; align-items: flex-start; }
.week-date { width: 54px; flex-shrink: 0; font-size: 12px; font-weight: 700; color: var(--muted); padding-top: 2px; text-transform: uppercase; letter-spacing: 0.03em; }
.week-items { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }

/* ------------------------------------------------------------------ search */
.bigsearch { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 8px 0 18px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line2); }
.bigsearch:focus-within { outline: 3px solid var(--accent); border-color: var(--ink); }
.bigsearch input { flex: 1 1 auto; min-width: 0; border: 0; background: transparent; font-size: 17px; height: 100%; outline: none; }
.answer-num { font-size: 52px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text2); font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; }
.chip:hover { border-color: var(--line2); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #FFFDF9; }
.results { display: flex; flex-direction: column; gap: 4px; }
.result { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; text-decoration: none; color: inherit; cursor: pointer; border: 1px solid transparent; background: none; text-align: left; width: 100%; min-height: 52px; }
.result:hover, .result[aria-current="true"] { background: var(--surface); border-color: var(--line); }
.result .type { font-size: 11px; font-weight: 700; color: var(--muted2); text-transform: uppercase; letter-spacing: 0.05em; }
.rec-field { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.rec-field:first-child { border-top: 0; }
.rec-field dt { color: var(--muted); font-size: 13px; }
.rec-field dd { margin: 0; word-break: break-word; }
.split { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.split > .left { flex: 1.4 1 420px; min-width: 0; }
.split > .rightcol { flex: 1 1 340px; min-width: 0; position: sticky; top: 92px; }

/* ------------------------------------------------------------------ charts */
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart-box { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.chart-top { font-size: 11px; color: var(--muted); }
.chart text { font-family: var(--font); font-size: 10px; fill: var(--muted); }
.chart .bar { fill: var(--line2); }
.chart .bar.hot { fill: var(--ink); }
.chart .bar:hover { fill: var(--accent); }
.chart .line { fill: none; stroke: var(--faint); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .line.ink { stroke: var(--ink); }
.chart .area { fill: rgba(242, 181, 50, 0.16); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .fail { fill: var(--bad-dot); }
.chart .endpoint { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }

/* ------------------------------------------------------------------ calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head { font-size: 11px; font-weight: 700; color: var(--muted2); text-transform: uppercase; letter-spacing: 0.05em; padding: 0 6px; }
.cal-day { min-height: 104px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 8px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-day.other { background: transparent; border-style: dashed; }
.cal-day.today { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.cal-num { font-size: 12px; font-weight: 700; color: var(--muted); }
.cal-ev { font-size: 11px; line-height: 1.3; padding: 3px 6px; border-radius: 6px; background: var(--soft); color: var(--text2); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; text-decoration: none; }
.cal-ev.cert { background: var(--warn-bg); color: var(--warn); }
.cal-ev.goal { background: var(--info-bg); color: var(--info); }

/* ------------------------------------------------------------------ overlays */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(28, 25, 21, 0.38); display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; }
.dialog { width: 100%; max-width: 640px; max-height: 80vh; overflow: hidden; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--line); box-shadow: 0 24px 64px rgba(28, 25, 21, 0.25); }
.dialog.form-dialog { max-width: 560px; overflow-y: auto; padding: 24px; gap: 18px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cmd-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 60px; border-bottom: 1px solid var(--line); }
.cmd-input input { flex: 1 1 auto; border: 0; outline: none; background: transparent; font-size: 17px; height: 100%; min-width: 0; }
.cmd-list { overflow-y: auto; padding: 8px; }
.cmd-group { padding: 10px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted2); }
.cmd-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 8px 10px; border: 0; background: none; border-radius: 12px; text-align: left; cursor: pointer; color: var(--ink); text-decoration: none; }
.cmd-item[aria-selected="true"] { background: var(--soft); }
.cmd-item .sub { font-size: 12px; color: var(--muted); }
.cmd-foot { display: flex; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 480px; }
.toast { pointer-events: auto; background: var(--ink); color: #FFFDF9; padding: 12px 16px; border-radius: 14px; font-size: 14px; box-shadow: 0 12px 32px rgba(28, 25, 21, 0.3); }
.toast.bad { background: var(--bad); }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.skeleton { background: linear-gradient(90deg, var(--soft) 0%, var(--soft2) 50%, var(--soft) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 12px; min-height: 20px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ------------------------------------------------------------------ business screens */
.input.slim, select.input.slim { width: auto; min-height: 36px; padding: 4px 10px; font-size: 14px; }
.more-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; overflow-y: auto; }
.more-sheet .nav { gap: 2px; }
.legend { display: inline-flex; align-items: center; gap: 6px; }
.legend::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--line2); }
.legend.ink::before { background: var(--ink); }
.legend.exp::before { background: var(--accent); }
.chart .bar.exp { fill: var(--accent); }
.center-text { text-align: center; align-items: center; }
.actions.center { justify-content: center; }
.qr.big { width: 240px; height: 240px; }
.btn.big { min-height: 52px; font-size: 16px; }
.input.big { font-size: 22px; font-variant-numeric: tabular-nums; }

section.stats, div.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.list > a.item { text-decoration: none; color: inherit; }
.list > a.item:hover .item-title { text-decoration: underline; }
.big-check { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--ink); flex-shrink: 0; cursor: pointer; }
.linklike { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.linklike:hover { text-decoration: underline; }
.task.done .item-title { text-decoration: line-through; color: var(--muted); }
details.card > summary { cursor: pointer; font-weight: 600; }
/* documents */
.doc-preview { background: var(--soft); border-radius: var(--r-md); padding: 16px; max-height: calc(100vh - 140px); overflow-y: auto; }
.paper { background: #FFFFFF; color: #1C1915; border-radius: 6px; box-shadow: 0 2px 10px rgba(28, 25, 21, 0.08); padding: 28px 30px; font-family: Arial, Helvetica, sans-serif; font-size: 12.5px; line-height: 1.5; }
.paper-head { border-bottom: 2px solid var(--accent); padding-bottom: 8px; margin-bottom: 16px; font-size: 11px; color: #5A5246; }
.paper-head b { display: block; font-size: 14px; color: #1C1915; }
.paper h1 { font-size: 20px; margin: 4px 0 10px; letter-spacing: 0; }
.paper h2 { font-size: 14px; margin: 16px 0 6px; color: #1C1915; }
.paper p { margin: 0 0 10px; }
.paper ul { margin: 0 0 10px; padding-left: 20px; }
.paper hr { border: 0; border-top: 1px solid #D9D0C1; margin: 10px 0; }
.paper-items { width: 100%; border-collapse: collapse; margin: 6px 0 14px; font-size: 12px; }
.paper-items th { background: #F1EBE0; color: #5A5246; font-size: 10px; text-transform: uppercase; text-align: left; padding: 6px; }
.paper-items td { border-bottom: 1px solid #E7DFD2; padding: 6px; vertical-align: top; }
.paper-items .num { text-align: right; white-space: nowrap; }
.paper-items tfoot td { border-bottom: 0; }
.paper-sig { display: flex; gap: 40px; margin-top: 40px; }
.paper-sig .sig { border-top: 1px solid #1C1915; padding-top: 4px; min-width: 200px; font-size: 11px; color: #5A5246; }
.paper-sig .sig b { color: #1C1915; font-size: 12px; }
.line-edit { display: grid; grid-template-columns: minmax(0, 1fr) 70px 110px 110px 36px; gap: 8px; align-items: start; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.line-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.line-edit .input { min-height: 38px; padding: 6px 10px; font-size: 14px; }
.line-amt { text-align: right; font-weight: 600; padding-top: 9px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.total-out { font-size: 16px; }
/* client portal and ticket threads */
.portal { min-height: 100vh; display: flex; flex-direction: column; }
.bubble { padding: 12px 14px; border-radius: 14px; max-width: 90%; }
.bubble.me { background: var(--soft); align-self: flex-end; }
.bubble.them { background: var(--info-bg); align-self: flex-start; }
.bubble.note { background: var(--warn-bg); align-self: stretch; max-width: none; }
/* POS */
.pos { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.pos-left { flex: 1.5 1 420px; min-width: 0; }
.pos-right { flex: 1 1 340px; min-width: 0; position: sticky; top: 92px; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pos-item { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 96px; padding: 14px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; }
.pos-item:hover { border-color: var(--ink); }
.pos-item:active { transform: scale(0.98); }
.pos-name { font-weight: 600; font-size: 14px; line-height: 1.3; }
.pos-price { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: auto; }
.pos-stock { font-size: 11px; font-weight: 600; color: var(--muted); }
.pos-stock.warn { color: var(--warn); } .pos-stock.bad { color: var(--bad); }
.pos-methods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.pos-methods button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; border-radius: 12px; border: 1px solid var(--line2); background: var(--surface); font-weight: 600; font-size: 13px; cursor: pointer; padding: 0 6px; }
.pos-methods button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #FFFDF9; }
.pos-line { align-items: center; }
.stepper { display: flex; align-items: center; gap: 2px; background: var(--soft); border-radius: 999px; }
.stepper .iconbtn { width: 36px; height: 36px; }
.stepper .qty { min-width: 26px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.pos-change { font-size: 18px; font-weight: 700; color: var(--good); min-height: 24px; }
.pos-change.bad { color: var(--bad); }
.pos-bar { display: none; }

/* acknowledgment slip */
.slip { font-family: var(--mono); font-size: 12px; line-height: 1.5; color: #111; max-width: 320px; margin: 0 auto; }
.slip hr { border: 0; border-top: 1px dashed #999; margin: 6px 0; }
.slip-head { text-align: center; margin-bottom: 6px; }
.slip-head b { font-size: 14px; }
.slip-title { text-align: center; font-weight: 700; letter-spacing: 0.08em; margin: 6px 0; }
.slip-line { display: flex; justify-content: space-between; gap: 12px; }
.slip-line span:last-child { text-align: right; white-space: nowrap; }
.slip-sub { color: #555; padding-left: 12px; }
.slip-total { font-weight: 700; font-size: 14px; }
.slip-foot { text-align: center; margin-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.slip-preview { background: #FFFFFF; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 16px; }
.print-piece { display: none; }
@media print {
  body.printing-piece > *:not(.print-piece) { display: none !important; }
  body.printing-piece .print-piece { display: block; }
  body.printing-piece { background: #FFFFFF; }
}

/* orders board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(210px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.board-col { background: var(--soft); border-radius: var(--r-md); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.board-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 4px; }
.board-head h3 { color: var(--ink); }
.board-empty { padding: 8px 4px; }
.order { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; }

/* ------------------------------------------------------------------ my money (personal) */
.personal-tabs { flex: 1 1 420px; min-width: 0; }
.personal.hide-amounts .amt { filter: blur(7px); user-select: none; }
.cat-dot { display: inline-block; width: 10px; height: 10px; border-radius: 999px; flex-shrink: 0; }
.list > .item > .cat-dot { margin-top: 5px; }
.month-title { min-width: 150px; text-align: center; }
.fab { position: fixed; right: 18px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 21; width: 56px; height: 56px; border-radius: 999px; border: 0; background: var(--ink); color: #FFFDF9; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 10px 24px rgba(28, 25, 21, 0.3); cursor: pointer; }
.fab .icon { width: 24px; height: 24px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 32px; height: 32px; border-radius: 999px; border: 2px solid transparent; cursor: pointer; padding: 0; box-shadow: inset 0 0 0 2px rgba(255, 253, 249, 0.6); }
.swatch[aria-checked="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 3px #FFFDF9; }
.fund-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.budget-input { width: 130px; }
.budget-cell { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.budget-cell .meter { flex: 1 1 auto; }
.pcal-day { font: inherit; color: inherit; text-align: left; cursor: pointer; width: 100%; }
.pcal-day:hover:not(:disabled) { border-color: var(--line2); }
.pcal-day:disabled { cursor: default; }
.cal-in { font-size: 12px; font-weight: 700; color: var(--good); font-variant-numeric: tabular-nums; }
.cal-out { font-size: 12px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.cal-count { font-size: 11px; color: var(--muted); margin-top: auto; }
.item-btn { width: 100%; background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; align-items: center !important; }
.item-btn:hover .item-title { text-decoration: underline; }
.put-away { margin-top: 10px; }
.put-away summary { cursor: pointer; padding: 6px 0; }
.entry-what { flex-wrap: nowrap; }
.materials-edit { display: grid; grid-template-columns: minmax(0, 1fr) 110px 44px; gap: 8px; align-items: center; }
.uses { font-size: 12px; color: var(--muted); }
.btn.disabled-link { opacity: 0.5; }

/* ------------------------------------------------------------------ phone */
@media (max-width: 760px) {
  .side { display: none; }
  .top { padding: 12px 16px; position: sticky; }
  .top h1 { font-size: 20px; }
  .top-tools .searchpill { display: none; }
  .page { padding: 16px 16px 96px; gap: 22px; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .bottom-nav a, .bottom-nav button { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; justify-content: center; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; background: none; border: 0; position: relative; cursor: pointer; }
  .bottom-nav [aria-current="page"] { color: var(--ink); }
  .bottom-nav .count { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 16px; height: 16px; border-radius: 999px; background: var(--accent); color: var(--ink); font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
  .kpi-hero-num { font-size: 44px; }
  .answer-num { font-size: 40px; }
  .card { padding: 16px; border-radius: var(--r-md); }
  .rec-field { grid-template-columns: 1fr; gap: 2px; }
  .split > .rightcol { position: static; }
  .cal { grid-template-columns: 1fr; }
  .cal-head, .cal-day.other { display: none; }
  .cal-day { min-height: 0; }
  .cal-day.empty-day { display: none; }
  .srv-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .overlay { padding: 0; align-items: stretch; }
  .dialog { max-width: none; max-height: none; border-radius: 0; height: 100%; }
  .hide-phone { display: none !important; }
  .pos-right { position: static; }
  .pos-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .personal .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .personal .stats .kpi-num { font-size: 21px; }
  .personal .stats .card { padding: 14px; }
  .pos-bar { display: flex; position: fixed; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 19; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(28, 25, 21, 0.08); }
  .board { grid-auto-flow: row; grid-auto-columns: auto; }
  .line-edit { grid-template-columns: minmax(0, 1fr) 64px 92px; }
  .line-edit .line-main { grid-column: 1 / -1; }
  .line-amt { grid-column: 1 / 3; text-align: left; padding-top: 0; }
  .doc-preview { max-height: none; padding: 8px; }
  .paper { padding: 18px 16px; }
}
@media (min-width: 761px) { .show-phone { display: none !important; } }

/* ------------------------------------------------------------------ print (reports) */
@media print {
  body { background: #FFFFFF; font-size: 12px; }
  .side, .top, .bottom-nav, .no-print, .toasts { display: none !important; }
  .page { padding: 0; }
  .card { border-color: #BBBBBB; break-inside: avoid; }
  a { text-decoration: none; }
}
.show-print { display: none; }
@media print { .show-print { display: block; margin-bottom: 12px; } }
