/* Biashara base styles. System fonts only (fast on slow networks, CSP font-src 'self'). */
:root {
  --bg: #F2F4EF; --surface: #FFFFFF; --sunk: #E9EDE6; --ink: #18211C; --muted: #5B6760; --line: #D9DED5;
  --accent: #0B6B57; --accent-soft: #DCEFE8; --on-accent: #FFFFFF;
  --gold: #B87A0B; --gold-soft: #F7EBCF;
  --good: #22744A; --bad: #B3261E; --bad-soft: #F8E1DE;
  --radius: 12px;
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Ubuntu, sans-serif;
  --f-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101512; --surface: #18201C; --sunk: #141A17; --ink: #E6ECE8; --muted: #9AA79F; --line: #2A3530;
    --accent: #4DC4A4; --accent-soft: #163A30; --on-accent: #08241C;
    --gold: #E6B04B; --gold-soft: #3A2D12;
    --good: #5CC48B; --bad: #F08A80; --bad-soft: #3D1D1A;
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--f-body); padding-bottom: env(safe-area-inset-bottom, 0px); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; text-wrap: balance; }
a { color: var(--accent); }
code, pre { font-family: var(--f-mono); font-size: .9em; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.note { color: var(--muted); font-size: .9rem; margin: 0; }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 10px; padding: 10px 16px; font: 600 15px var(--f-body); cursor: pointer; text-decoration: none; min-height: 44px; }
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-sm { min-height: 34px; padding: 5px 10px; font-size: 13px; }
select, input, textarea { font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }

/* Top bar */
.topbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px; max-width: 1080px; margin: 0 auto; }
.brand { display: inline-flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 18px; }
.locale { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.locale label { color: var(--muted); }
.js .locale [type=submit] { display: none; }

/* Home */
.home { max-width: 1080px; margin: 0 auto; padding: 8px 16px 48px; display: grid; gap: 24px; }
.hero { padding: clamp(16px, 5vw, 48px) 0 8px; max-width: 46rem; }
.eyebrow { color: var(--gold); font-weight: 600; font-size: .9rem; letter-spacing: .02em; margin: 0 0 12px; }
.hero h1 { font-size: clamp(30px, 6vw, 48px); letter-spacing: -.02em; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 40rem; }
.points { list-style: none; padding: 0; margin: 20px 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.points li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; font-weight: 500; }
.status { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; margin: 8px 0; }
.status .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
.status.is-ok .dot { background: var(--good); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.panel h2 { font-size: 18px; }

/* Tables */
.table-wrap { overflow-x: auto; margin-top: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.chip-ok { background: var(--accent-soft); color: var(--accent); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-muted { background: var(--sunk); color: var(--muted); }

/* Error pages */
.error { max-width: 36rem; margin: 0 auto; padding: calc(48px + env(safe-area-inset-top, 0px)) 16px 48px; }
.error-code { font: 600 14px var(--f-mono); color: var(--gold); letter-spacing: .1em; margin: 0 0 8px; }
.error h1 { font-size: clamp(26px, 5vw, 36px); }
.debug { margin-top: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.debug pre { overflow-x: auto; white-space: pre; font-size: 12px; }

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

/* ---------- Phase 4: forms, auth pages, app shell ---------- */
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 8px; }
.alert { background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 10px 14px; margin: 0 0 16px; font-weight: 500; }
.alert-bad { background: var(--bad-soft); color: var(--bad); }
.notice { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; background: var(--gold-soft); color: var(--ink);
  border-radius: 10px; padding: 10px 14px; margin: 0 0 16px; }
.auth { padding: 8px 16px 48px; display: flex; justify-content: center; }
.auth-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: clamp(18px, 4vw, 28px); }
.auth-card h1 { font-size: 24px; }
.form { display: grid; gap: 14px; margin: 16px 0; }
.form.narrow { max-width: 380px; }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field label { font-weight: 600; font-size: 14px; }
.field input[type=text], .field input[type=email], .field input[type=tel], .field input[type=password], .field input[type=number], .field input[type=date], .field input:not([type]), .field textarea, .field select {
  width: 100%; min-height: 46px; padding: 10px 12px; font-size: 16px; border-radius: 10px; }
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.field [aria-invalid=true] { border-color: var(--bad); }
.field.check { grid-template-columns: auto 1fr; align-items: start; gap: 10px; }
.field.check input { width: 20px; height: 20px; margin-top: 2px; }
.field.check .field-error { grid-column: 1 / -1; }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.field-error { margin: 0; font-size: 13px; color: var(--bad); font-weight: 500; }
.label-row { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.password { display: flex; gap: 8px; }
.password input { flex: 1; }
.btn-block { width: 100%; justify-content: center; }
.btn-danger { color: var(--bad); border-color: var(--bad); }
.switch { text-align: center; color: var(--muted); margin: 8px 0 0; }
.otp { letter-spacing: .3em; font-family: var(--f-mono); font-size: 20px !important; text-align: center; }
.recovery { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.recovery summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.inline { display: inline; margin: 0; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.appbar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; background: var(--surface); border-bottom: 1px solid var(--line); }
.appnav { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; font-weight: 500; }
.appnav a { color: var(--muted); text-decoration: none; }
.appnav a[aria-current=page] { color: var(--accent); }
.app { max-width: 960px; margin: 0 auto; padding: 20px 16px 48px; display: grid; gap: 16px; }
.app > * { min-width: 0; } /* wide tables scroll inside .table-wrap instead of widening the page */
.app h1 { font-size: clamp(24px, 4vw, 30px); margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card h2 { font-size: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.card h3 { font-size: 16px; margin-top: 0; }
.muted-card { background: var(--sunk); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; margin: 12px 0 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 13px; color: var(--muted); font-weight: 600; }
.facts dd { margin: 4px 0 0; }
.chip-gold { background: var(--gold-soft); color: var(--gold); }
.steps { padding-left: 20px; display: grid; gap: 16px; }
.qr { display: block; background: #fff; padding: 6px; border-radius: 8px; border: 1px solid var(--line); max-width: 100%; height: auto; }
.secret { word-break: break-all; }
.codes-box { background: var(--gold-soft); border-radius: 10px; padding: 14px; margin: 12px 0; }
.codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.codes code { font-size: 16px; }
.row-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.appnav .linklike { text-decoration: none; color: var(--muted); }
.appnav .linklike:hover { color: var(--ink); }

/* ---------- Phase 5: business switcher, settings ---------- */
.appbar-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.business-pill { display: inline-flex; gap: 6px; align-items: center; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 4px 12px; font-weight: 600; font-size: 14px; text-decoration: none; }
.business-list { list-style: none; padding: 0; display: grid; gap: 10px; }
.business-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.business-item h2 { font-size: 18px; margin: 0 0 2px; }
.business-item.is-current { border-color: var(--accent); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; }
ul.plain { list-style: none; padding: 0; margin: 8px 0; }
ul.plain li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
ul.plain li:first-child { border-top: 0; }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.announcement { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; border-radius: 10px; padding: 12px 14px;
  background: var(--accent-soft); color: var(--ink); border-left: 4px solid var(--accent); }
.announcement p { margin: 4px 0 0; }
.announcement.sev-warning { background: var(--gold-soft); border-left-color: var(--gold); }
.announcement.sev-critical { background: var(--bad-soft); border-left-color: var(--bad); }

/* ---------- Phase 6: platform console ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mt { margin-top: 16px; }
.r { text-align: right; }
.flush { padding: 0; }
.flush .table, .card.flush { margin-top: 0; }
.w-num { width: 7em; }
.pf { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.pf-side { background: var(--surface); border-right: 1px solid var(--line); padding: calc(16px + env(safe-area-inset-top, 0px)) 14px 16px;
  display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.pf-side .brand { display: flex; gap: 8px; align-items: center; font-weight: 700; color: var(--ink); text-decoration: none; }
.pf-badge { align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--ink); color: var(--surface); border-radius: 6px; padding: 2px 8px; }
.pf-side nav { display: grid; gap: 2px; }
.pf-side nav a { color: var(--muted); text-decoration: none; padding: 8px 10px; border-radius: 8px; font-weight: 500; }
.pf-side nav a:hover { background: var(--sunk); color: var(--ink); }
.pf-side nav a[aria-current=page] { background: var(--accent-soft); color: var(--accent); }
.pf-me { margin-top: auto; display: grid; gap: 4px; font-size: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.pf-me span { color: var(--muted); }
.pf-main { padding: 22px clamp(16px, 3vw, 32px) 48px; display: grid; gap: 16px; align-content: start; min-width: 0; max-width: 1200px; }
.pf-main h1 { font-size: clamp(22px, 3.5vw, 28px); margin: 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pf-main .alert { margin: 0; }
.pf-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 2px; min-width: 0; }
.kpi-l { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi-v { font-size: 24px; font-weight: 700; overflow-wrap: anywhere; }
.kpi-s { font-size: 12px; color: var(--muted); }
.chart { width: 100%; height: auto; display: block; margin: 8px 0; }
.chart .bar { fill: var(--accent); }
.chart .bar-hit:hover .bar { fill: var(--good); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .baseline { stroke: var(--muted); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--f-body); }
.hbars { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 8px; }
.hbars li { display: grid; grid-template-columns: minmax(70px, 30%) 1fr 3ch; gap: 10px; align-items: center; font-size: 14px; }
.hb-track { width: 100%; height: 8px; display: block; background: var(--sunk); border-radius: 4px; overflow: hidden; }
.hb-fill { fill: var(--accent); }
.hb-v { text-align: right; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters input[type=search] { flex: 1 1 220px; min-width: 0; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.dl dt { color: var(--muted); font-size: 14px; }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form input:not([type=number]):not([type=date]) { flex: 1 1 200px; min-width: 0; }
.stack { display: grid; gap: 8px; }
.stack > input { width: 100%; }
.mod-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); gap: 6px 12px; }
.mod-list li { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.plan { display: grid; gap: 6px; align-content: start; }
.plan header { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.plan h2 { margin: 0; font-size: 18px; }
.plan p { margin: 0; }
.plan-archived { opacity: .7; }
.plan-price { font-size: 22px; font-weight: 700; }
.limits { list-style: none; padding: 0; margin: 4px 0; }
.limits li { display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding: 4px 0; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0; min-width: 0; }
legend { font-weight: 700; padding: 0 6px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 8px; margin-top: 10px; }
.check-item { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.check-item input { width: 18px; height: 18px; }
.check-item .chip { margin-left: auto; }
.secret-value { font-size: 20px; background: var(--gold-soft); padding: 6px 10px; border-radius: 8px; display: inline-block; }
code.wrap { white-space: pre-wrap; word-break: break-all; font-size: 12px; }
textarea { width: 100%; }
.field input[type=number], .field input:not([type]), .field input[type=date], .field textarea { width: 100%; }
@media (max-width: 760px) {
  .pf { grid-template-columns: 1fr; }
  .pf-side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; align-items: center; }
  .pf-side nav { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; order: 3; }
  .pf-side nav a { padding: 6px 8px; font-size: 14px; }
  .pf-me { margin-top: 0; border-top: 0; padding-top: 0; margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
}
.card .announcement + .announcement { margin-top: 10px; }
.table .num { white-space: nowrap; }

/* ---------- Phase 7: business administration ---------- */
.hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.hub-card { display: grid; gap: 6px; align-content: start; color: var(--ink); text-decoration: none; }
a.hub-card:hover { border-color: var(--accent); }
.hub-card h2 { margin: 0; font-size: 18px; }
.hub-meta { font-weight: 600; color: var(--accent); font-size: 14px; }
.hub-card.is-locked { background: var(--sunk); }
.hub-card form { margin-top: 4px; }
.mods { list-style: none; padding: 0; margin: 4px 0 0; display: grid; }
.mod { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.mod:first-child { border-top: 0; }
.mod-text { flex: 1 1 260px; min-width: 0; }
.mod-text p { margin: 2px 0 0; }
.mod-action { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mod-not_in_plan .mod-text, .mod-blocked .mod-text { opacity: .7; }
.usage { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 14px; }
.usage-row { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.meter { width: 100%; height: 6px; display: block; border-radius: 3px; overflow: hidden; }
.meter-track { fill: var(--sunk); }
.meter-fill { fill: var(--accent); }
.meter.is-full .meter-fill { fill: var(--gold); }
.share { border-color: var(--accent); }
.copy-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.copy-input { flex: 1 1 auto; min-width: 0; font-family: var(--f-mono); font-size: 13px; }
.share-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.invites { list-style: none; padding: 0; margin: 0; }
.invites li { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.invites li:first-child { border-top: 0; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.business-item.is-archived { opacity: .7; }
.plain-fieldset { border: 0; padding: 0; margin: 0; }
.plain-fieldset[disabled] input, .plain-fieldset[disabled] select { background: var(--sunk); }

/* ---------- Phase 8: role editor ---------- */
.scope-key { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 8px 16px; margin: 10px 0 0; }
.scope-key dt { font-weight: 700; }
.scope-key dd { margin: 0; color: var(--muted); }
.perms { list-style: none; padding: 0; margin: 4px 0 0; }
.perm { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.perm:first-child { border-top: 0; }
.perm-label { flex: 1 1 220px; min-width: 0; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.perm-label label { font-weight: 500; }
.perm-label .hint { flex-basis: 100%; }
.perm-control { flex: 0 1 260px; display: grid; gap: 6px; min-width: 0; }
.perm-control select { width: 100%; }
.perm.is-on .perm-label label { font-weight: 700; }
.perm-branches { border: 0; padding: 0; margin: 0; display: grid; gap: 4px; }
.sticky-save { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(transparent, var(--bg) 40%); }
.role-form { display: grid; gap: 16px; }
.can-list { display: grid; gap: 10px; }
.can-list h3 { margin: 0 0 2px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.can-list ul { margin: 0; padding-left: 18px; }

/* ---------- Phase 8: developer tools ---------- */
a.kpi-link { color: var(--ink); text-decoration: none; }
a.kpi-link:hover { border-color: var(--accent); }
.checks { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 4px; }
.checks li { display: flex; gap: 8px; font-size: 14px; }
.checks .check-mark { width: 1.2em; font-weight: 700; }
.checks .ok .check-mark { color: var(--good); }
.checks .bad .check-mark { color: var(--bad); }
.checks .warn .check-mark { color: var(--muted); }
.log-entry header { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.log-message { margin: 8px 0; overflow-wrap: anywhere; }
pre.trace { white-space: pre-wrap; word-break: break-all; font-size: 12px; background: var(--sunk); padding: 10px; border-radius: 8px; max-height: 360px; overflow: auto; }
.maint-banner { background: var(--gold-soft); color: var(--ink); border-left: 4px solid var(--gold); padding: 8px 12px; border-radius: 8px; font-size: 14px; }

/* ---------- Phase 9: subscription & billing ---------- */
.sub-banner { display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; border-radius: 10px; padding: 10px 14px; border-left: 4px solid var(--accent); background: var(--accent-soft); color: var(--ink); }
.sub-warning { background: var(--gold-soft); border-left-color: var(--gold); }
.sub-critical { background: var(--bad-soft); border-left-color: var(--bad); }
.price-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 14px; }
.price-card { display: grid; gap: 8px; align-content: start; }
.price-card.is-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.price-card h3 { margin: 0; font-size: 18px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.price-card .amount { font-size: 22px; font-weight: 700; }
.price-card ul { margin: 0; padding-left: 18px; font-size: 14px; }
.price-card form { display: grid; gap: 8px; margin-top: auto; }
.invoice { max-width: 760px; }
.invoice-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.invoice-lines { width: 100%; border-collapse: collapse; margin-top: 12px; }
.invoice-lines td, .invoice-lines th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.invoice-lines .r { text-align: right; }
.invoice-lines tfoot td { font-weight: 700; border-bottom: 0; }
.pay-steps { white-space: pre-line; background: var(--sunk); border-radius: 10px; padding: 12px; }
@media print {
  .appbar, .no-print, .sub-banner, .alert, .locale, .tabbar, .nav-sheet, .offline-bar { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 0; padding: 0; }
}
.pay-row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 14px 0; border-top: 1px solid var(--line); }
.pay-row:first-of-type { border-top: 0; }
.pay-actions { display: grid; gap: 8px; align-content: start; min-width: min(100%, 320px); }
.seller { white-space: pre-line; }

/* ---------- Phase 10: onboarding ---------- */
.steps-bar { list-style: none; padding: 0; margin: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.steps-bar li { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px 4px 4px; }
.steps-bar .step-n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--sunk); font-weight: 700; font-size: 13px; }
.steps-bar .is-current { color: var(--ink); border-color: var(--accent); font-weight: 600; }
.steps-bar .is-current .step-n { background: var(--accent); color: var(--on-accent); }
.steps-bar .is-done .step-n { background: var(--accent-soft); color: var(--accent); }
.onboard-form { display: grid; gap: 16px; }
.onboard-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 10px; margin-top: 8px; }
.pick { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; background: var(--surface); }
.pick:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pick input[type=checkbox] { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.pick-body { display: grid; gap: 4px; min-width: 0; }
.pick-body .chip { justify-self: start; }
.pick.is-unavailable { cursor: default; opacity: .7; }
.entry-table td { vertical-align: middle; }
.entry-table input, .entry-table select { width: 100%; min-width: 110px; }
.entry-table input.amount { text-align: right; font-family: var(--f-mono); min-width: 120px; }
.field.narrow { max-width: 280px; }
.setup-card, .guide-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; border-color: var(--accent); }
.setup-card h2, .guide-card h2 { margin: 0 0 4px; }
.setup-card p, .guide-card p { margin: 0; }
.guide-card { border-color: var(--gold); }
.next-list { padding-left: 18px; display: grid; gap: 6px; }
.done-card h1 { margin-top: 0; }

/* Phase 10: entry tables become stacked cards on phones (labels from data-label). */
.guide-list { margin: 4px 0 8px; padding-left: 18px; display: grid; gap: 4px; }
@media (max-width: 640px) {
  .entry-table.stackable thead { display: none; }
  .entry-table.stackable, .entry-table.stackable tbody, .entry-table.stackable tr, .entry-table.stackable td { display: block; width: 100%; }
  .entry-table.stackable tr { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
  .entry-table.stackable td { padding: 0; border: 0; text-align: left; }
  .entry-table.stackable td[data-label]::before { content: attr(data-label); display: block; font-size: .78rem; color: var(--muted); margin-bottom: 2px; }
  .entry-table.stackable td:first-child { grid-column: 1 / -1; }
  .entry-table.stackable input, .entry-table.stackable select { min-width: 0; }
}

/* Phase 11: dashboard */
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 16px; }
.dash-head h1 { margin-bottom: 2px; }
.dash-head p { margin: 0; }
.dash-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; background: var(--sunk); border-radius: 999px; padding: 3px; gap: 2px; }
.seg a { padding: 6px 12px; border-radius: 999px; text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }
.seg a[aria-current] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
.branch-pick select { min-height: 36px; border-radius: 999px; padding: 4px 12px; }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.dash-grid .w-full { grid-column: 1 / -1; }
.widget h2 { font-size: 17px; }
.w-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.w-head h2 { margin-bottom: 4px; }
.w-head p { margin: 0; }
.w-total { font-size: 18px; font-weight: 700; }
.widget[data-widget="kpis"], .widget[data-widget="quick_actions"] { background: transparent; border: 0; padding: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.widget[data-widget="my_today"] .kpis .kpi { background: var(--sunk); border: 0; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.kpi p { margin: 0; }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi-value { font-size: clamp(20px, 2.4vw, 26px); font-weight: 700; margin: 4px 0 6px !important; overflow-wrap: anywhere; }
.kpi-sub { font-size: 13px; color: var(--muted); line-height: 1.5; }
.delta { font-size: 13px; font-weight: 600; }
.delta-good { color: var(--good); }
.delta-bad { color: var(--bad); }
.delta-flat, .delta-none { color: var(--muted); font-weight: 500; }
.neg { color: var(--bad); }
.pos { color: var(--good); }
.warn { color: var(--gold); }
.big { font-size: 20px; font-weight: 700; }
.empty { color: var(--muted); margin: 6px 0 0; }
.small-h { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 16px 0 0; }
.widget .note + .small-h { margin-top: 12px; }
.facts-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.facts-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.facts dd a { text-decoration: none; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }
ul.plain li .r, .r { text-align: right; }
/* chart */
.chart { margin: 12px 0 0; position: relative; }
.chart svg { display: block; overflow: visible; }
.chart .bar { fill: var(--accent); opacity: .78; }
.chart .bar-today { opacity: 1; }
.chart .hit { fill: transparent; }
.chart .bar-g:hover .bar, .chart .bar-g:focus .bar { opacity: 1; fill: var(--gold); }
.chart .bar-g:focus { outline: none; }
.chart .axis { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-x { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.chart-tip { position: absolute; top: -6px; transform: translate(-50%, -100%); background: var(--ink); color: var(--bg); font-size: 12px; padding: 5px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 2; }
.chart-table { margin-top: 10px; font-size: 14px; }
.chart-table summary { cursor: pointer; color: var(--accent); font-size: 13px; }
/* ranked lists with meters */
ol.ranked { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 10px; }
ol.ranked li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: baseline; }
ol.ranked .meter { grid-column: 1 / -1; display: block; height: 4px; }
.meter-track { fill: var(--sunk); }
.meter-fill { fill: var(--accent); }
.meter-alt { fill: var(--gold); }
.rk-name { min-width: 0; overflow-wrap: anywhere; }
/* insights */
ul.insights { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.ins { display: flex; gap: 10px; align-items: flex-start; }
.ins-mark { flex: 0 0 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--accent-soft); color: var(--accent); }
.ins-warn .ins-mark { background: var(--gold-soft); color: var(--gold); }
.ins-good .ins-mark { background: var(--accent-soft); color: var(--good); }
@media (max-width: 760px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .dash-tools { width: 100%; }
  .seg { width: 100%; justify-content: space-between; }
  .seg a { padding: 6px 8px; flex: 1; text-align: center; font-size: 13px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 12px; }
  .facts-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
}

/* Phase 12: products */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin-bottom: 2px; }
.page-head p { margin: 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn-ghost:hover { border-color: var(--line); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.filters { margin-bottom: 12px; }
.filters select { min-height: 38px; }
.empty-card { text-align: center; padding: 36px 18px; }
.empty-card .page-actions { justify-content: center; margin-top: 14px; }
.product-table td { vertical-align: middle; }
.th-img, .td-img { width: 52px; }
.td-img img, .img-ph { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; display: block; }
.img-ph { display: grid; place-items: center; background: var(--sunk); color: var(--muted); font-weight: 700; }
.img-ph-lg { width: 160px; height: 160px; font-size: 48px; border-radius: 14px; }
.row-link { text-decoration: none; color: var(--ink); }
.row-link:hover strong { text-decoration: underline; }
.product-form { display: grid; gap: 16px; }
.product-form .card h2 { margin-bottom: 4px; }
.choice-row { display: flex; gap: 10px; flex-wrap: wrap; border: 0; padding: 0; margin: 0; }
.choice-row legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; padding: 0; }
.choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; flex: 1 1 220px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: 4px; }
.switch-line { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; cursor: pointer; }
.variants { display: grid; gap: 12px; margin: 10px 0; }
.vrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px 14px; align-items: start; }
.variants.is-multi .vrow { border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.vrow-title { grid-column: 1 / -1; margin: 0; }
.variants:not(.is-multi) [data-multi], .variants:not(.is-multi) ~ [data-multi], .card:has(.variants:not(.is-multi)) [data-multi-note] { display: none; }
.variants:not(.is-multi) .vrow + .vrow { display: none; }
.product-form.is-service [data-stock-only] { display: none; }
.opening-box { margin-top: 6px; }
details.more summary { cursor: pointer; font-weight: 600; }
details.more[open] summary { margin-bottom: 12px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.notice-warn { background: var(--gold-soft); }
.product-head { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 20px; align-items: start; margin-bottom: 16px; }
.product-photo img { width: 160px; height: 160px; object-fit: cover; border-radius: 14px; display: block; background: var(--sunk); }
.product-photo { display: grid; gap: 8px; justify-items: start; }
.photo-form label.btn { cursor: pointer; }
.price-big { font-size: 28px; font-weight: 700; margin: 4px 0 12px; }
tr.muted td { color: var(--muted); }
.inline-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.inline-form .field { flex: 1 1 260px; }
.cat-list li { align-items: center; padding: 10px 16px; }
.cat-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex: 1; }
.cat-row input { flex: 1 1 200px; min-width: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
.pad { padding: 16px; }
.error-card { border-color: var(--bad); background: var(--bad-soft); margin-bottom: 16px; }
.error-list { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.col-list { padding-left: 18px; display: grid; gap: 4px; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 14px 0; }
@media (max-width: 640px) {
  .product-head { grid-template-columns: 1fr; }
  .product-photo { grid-template-columns: 96px 1fr; align-items: center; }
  .product-photo img, .img-ph-lg { width: 96px; height: 96px; font-size: 32px; }
  .product-photo form, .product-photo p { grid-column: 2; }
  .stackable-list thead { display: none; }
  .stackable-list, .stackable-list tbody, .stackable-list tr { display: block; width: 100%; }
  .stackable-list tr { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .stackable-list td { display: block; border: 0; padding: 0; text-align: left; }
  .product-table td.td-img { grid-row: span 3; }
  .product-table td:nth-child(2) { grid-column: 2 / -1; }
  .stackable-list td[data-label] { grid-column: 2; font-size: 13px; }
  .stackable-list td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-family: var(--f-body); }
  .stackable-list td.r { text-align: left; }
  .filters select { flex: 1 1 45%; }
}
.field input[type=file] { width: 100%; max-width: 100%; min-width: 0; font-size: 14px; }
.card .note + .note { margin-top: 6px; }

/* Phase 13: barcodes */
.barcode { display: block; background: #fff; }
.bc-variants { display: grid; gap: 18px; margin-top: 10px; }
.bc-variant h3 { margin: 0 0 8px; }
.bc-variant { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.bc-variant h3 { flex-basis: 100%; }
.bc-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: #fff; color: #18211C; width: 220px; }
.bc-item p { margin: 6px 0 0; }
.bc-preview { width: 100%; height: 70px; }
.bc-preview.qr { width: 120px; height: 120px; }
.bc-actions { display: flex; gap: 12px; margin-top: 6px; }
.danger-link { color: var(--bad); }
.bc-add { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex-basis: 100%; }
.bc-add input { flex: 1 1 200px; max-width: 320px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
.list-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 0 0 8px; }
.list-bar p { margin: 0; }
.th-pick, .td-pick { width: 34px; }
.td-pick input { width: 18px; height: 18px; }
.label-setup { display: grid; gap: 16px; }
.copies { width: 80px; text-align: right; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
/* camera scanner */
.scan-overlay { position: fixed; inset: 0; z-index: 50; background: #000; display: grid; place-items: center; }
.scan-overlay video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: relative; width: min(80vw, 420px); height: min(40vw, 200px); border: 3px solid #fff; border-radius: 14px; box-shadow: 0 0 0 100vmax rgb(0 0 0 / .45); }
.scan-msg { position: absolute; top: 24px; left: 16px; right: 16px; color: #fff; text-align: center; font-weight: 600; margin: 0; }
.scan-overlay .btn { position: absolute; bottom: 32px; left: 50%; transform: translateX(-50%); }
/* label printing */
.page-print { background: #e9ece6; }
.print-bar { position: sticky; top: 0; z-index: 2; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.lbl-sheets { display: grid; gap: 16px; justify-content: center; padding: 16px; }
.lbl-page { background: #fff; color: #000; box-shadow: 0 1px 4px rgb(0 0 0 / .15); overflow: hidden; box-sizing: border-box; }
.lbl { box-sizing: border-box; overflow: hidden; display: flex; flex-direction: column; justify-content: center; align-items: stretch; text-align: center; font-family: Arial, Helvetica, sans-serif; color: #000; }
.lbl-sheet .lbl { outline: 1px dashed #ddd; outline-offset: -1px; }
.lbl p { margin: 0; line-height: 1.15; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lbl-name { font-size: 9pt; font-weight: 700; }
.lbl-biz { font-size: 6.5pt; }
.lbl-price { font-size: 10pt; font-weight: 700; }
.lbl-sku { font-size: 6.5pt; font-family: monospace; }
.lbl .lbl-code { width: 100%; margin: 1px 0; }
.lbl-qr { flex-direction: row; gap: 2mm; align-items: center; text-align: left; }
.lbl-qr .lbl-code { width: auto; aspect-ratio: 1; flex: 0 0 auto; }
.lbl-qr .lbl-text { min-width: 0; flex: 1; }
@media print {
  .page-print { background: #fff; }
  .print-bar, .skip { display: none !important; }
  .lbl-sheets { display: block; padding: 0; }
  .lbl-page { box-shadow: none; page-break-after: always; break-after: page; }
  .lbl-page:last-child { page-break-after: auto; break-after: auto; }
  .lbl-sheet .lbl { outline: 0; }
}
.lbl-num { font-size: 7pt; font-family: monospace; letter-spacing: .5px; }

/* Phase 14: inventory */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 0 0 16px; }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }
.inv-kpis { margin-bottom: 14px; }
.kpi-link { text-decoration: none; color: inherit; }
.kpi-link:hover { border-color: var(--accent); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.seg-left { margin-bottom: 12px; flex-wrap: wrap; }
.inv-form { display: grid; gap: 16px; }
.picker-cell { position: relative; min-width: 220px; }
.picker-label { display: block; margin-top: 3px; }
.picker-list { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin: 2px 0 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 24px rgb(0 0 0 / .12); max-height: 260px; overflow: auto; }
.picker-list li { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.picker-list li:hover, .picker-list li.on { background: var(--accent-soft); }
.dir-fixed [data-direction-cell] select { pointer-events: none; opacity: .6; }
.dir-out [data-cost-cell] input { visibility: hidden; }
.inv-lines td { vertical-align: top; }
.approve-box { border-color: var(--gold); margin-bottom: 16px; }
.reject-form { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.reject-form input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
.count-table .group-row th { background: var(--sunk); text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--ink); }
.count-input { width: 110px; }
.count-table td { vertical-align: middle; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; z-index: 3; }
.timeline { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.timeline li::before { content: "● "; color: var(--accent); }
.sheet-doc { max-width: 190mm; margin: 0 auto; padding: 12mm 0; background: #fff; color: #000; font-family: Arial, Helvetica, sans-serif; }
.sheet-doc h1 { font-size: 16pt; }
.sheet-table { width: 100%; border-collapse: collapse; font-size: 10pt; }
.sheet-table th, .sheet-table td { border: 1px solid #999; padding: 5px 6px; text-align: left; }
.sheet-table .box { width: 30mm; }
.sheet-table .group-row th { background: #eee; }
@media print { .sheet-doc { padding: 0; } @page { size: A4; margin: 12mm; } }

/* ---------- Phase 15: sales, receipts, POS ---------- */
.sales-kpis { margin: 4px 0 16px; }
.sale-form { display: grid; gap: 16px; }
.sale-form h2 { margin: 0 0 8px; font-size: 18px; }
.field.full, .form-grid .full { grid-column: 1 / -1; }
.picker-cell, .field.picker-cell { position: relative; }
.pay-rows { display: grid; gap: 8px; }
.pay-line { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 10px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.pay-line .field input, .pay-line .field select { width: 100%; }
.sale-summary { border-color: var(--accent); }
.sum-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; margin: 0; }
.sum-list dt { font-size: 13px; color: var(--muted); font-weight: 600; }
.sum-list dd { margin: 2px 0 0; }
.warn-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; }
.warn-list li { background: var(--gold-soft); border-radius: 8px; padding: 6px 10px; font-size: 14px; }
.alert-warn { background: var(--gold-soft); color: var(--ink); }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.plain-list li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.return-entry + .return-entry { border-top: 1px solid var(--line); padding-top: 8px; }
.return-entry p { margin: 0 0 4px; }
.danger-zone summary { cursor: pointer; font-weight: 600; color: var(--bad); }
.danger-zone .inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.danger-zone .inline-form input { flex: 1 1 220px; min-width: 0; }

/* Receipt: thermal 58/80 mm rolls or A4. */
.receipt { background: #fff; color: #000; margin: 16px auto; padding: 12px; font: 13px/1.4 var(--f-mono, ui-monospace, monospace); box-shadow: 0 2px 12px rgb(0 0 0 / .1); }
.receipt-58 { width: 58mm; font-size: 11px; padding: 6px; }
.receipt-80 { width: 80mm; }
.receipt-a4 { width: min(100% - 32px, 180mm); padding: 24px; font-family: var(--f-body); font-size: 14px; }
.rc-head { display: grid; text-align: center; gap: 1px; }
.rc-biz { font-size: 1.25em; }
.rc-title { text-align: center; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin: 8px 0; border-top: 1px dashed #000; border-bottom: 1px dashed #000; padding: 4px 0; }
.rc-meta, .rc-totals { margin: 0; display: grid; gap: 1px; }
.rc-meta div, .rc-totals div { display: flex; justify-content: space-between; gap: 8px; }
.rc-meta dd, .rc-totals dd { margin: 0; text-align: right; }
.rc-lines { width: 100%; border-collapse: collapse; margin: 8px 0; }
.rc-lines th { text-align: left; border-bottom: 1px dashed #000; font-size: .85em; }
.rc-lines td { padding: 3px 0; vertical-align: top; border-bottom: 1px dotted #999; }
.rc-lines .r { text-align: right; white-space: nowrap; padding-left: 6px; }
.rc-sub { display: block; font-size: .9em; color: #333; }
.rc-total { font-weight: 700; font-size: 1.1em; border-top: 1px dashed #000; padding-top: 2px; }
.rc-qr { display: flex; justify-content: center; margin: 10px 0 4px; }
.rc-qr svg { width: 28mm; height: 28mm; }
.receipt-58 .rc-qr svg { width: 22mm; height: 22mm; }
.rc-footer, .rc-thanks { text-align: center; margin: 6px 0 0; }
@media print {
  .page-receipt { background: #fff; }
  .receipt { margin: 0; box-shadow: none; width: auto; }
}

/* POS: catalog on the left, cart on the right; stacked on phones. */
.page-pos { min-height: 100vh; }
.pos-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px; background: var(--surface); border-bottom: 1px solid var(--line); }
.pos-biz { font-size: 17px; }
.pos-keys { margin-left: auto; }
.pos-noscript { margin: 16px; }
.pos-screen { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 16px; padding: 16px; align-items: start; }
.pos-screen[hidden] { display: none !important; }
.pos-catalog { display: grid; gap: 10px; min-width: 0; }
.pos-search { display: flex; gap: 8px; }
.pos-search input { flex: 1; font-size: 18px; padding: 10px 14px; min-width: 0; }
.pos-cats { display: flex; gap: 6px; flex-wrap: wrap; }
.pos-cats .chip { border: 1px solid var(--line); background: var(--surface); cursor: pointer; font: inherit; font-size: 14px; padding: 4px 12px; }
.pos-cats .chip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.pos-msg { margin: 0; min-height: 1.2em; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pos-item { display: grid; gap: 4px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; cursor: pointer; font: inherit; color: var(--ink); min-height: 84px; align-content: start; }
.pos-item:hover, .pos-item:focus-visible { border-color: var(--accent); }
.pos-item-name { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.pos-item-price { font-weight: 700; color: var(--accent); }
.pos-item-meta { color: var(--muted); }
.pos-cart { position: sticky; top: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; max-height: calc(100vh - 90px); overflow: auto; }
.pos-cart-head { display: flex; justify-content: space-between; align-items: center; }
.pos-cart-head h2 { margin: 0; font-size: 18px; }
.pos-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pos-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "name name x" "qty price total"; gap: 4px 8px; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.pos-line-name { grid-area: name; font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.pos-x { grid-area: x; }
.pos-qty { grid-area: qty; display: flex; gap: 4px; align-items: center; }
.pos-qty input { width: 64px; text-align: center; padding: 4px; }
.pos-price { grid-area: price; width: 96px; text-align: right; padding: 4px; }
.pos-line-total { grid-area: total; text-align: right; font-weight: 700; min-width: 70px; }
.pos-more summary { cursor: pointer; font-size: 14px; color: var(--accent); }
.pos-more .field { margin-top: 8px; }
.pos-more input { width: 100%; }
.pos-totals { margin: 0; display: grid; gap: 4px; }
.pos-totals div { display: flex; justify-content: space-between; align-items: baseline; }
.pos-totals dd { margin: 0; }
.pos-total dd { font-size: 28px; font-weight: 800; }
.pos-change { font-size: 22px; font-weight: 800; color: var(--accent); }
.pos-accounts { display: flex; flex-wrap: wrap; gap: 6px; }
.pos-acc { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 8px; cursor: pointer; font-size: 14px; }
.pos-acc:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.pos-pay-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-top: 8px; }
.pos-pay-row input { width: 100%; font-size: 18px; }
.pos-complete { font-size: 18px; padding: 12px; justify-content: center; }
.pos-complete[disabled] { opacity: .5; cursor: not-allowed; }
.pos-done { position: fixed; inset: 0; background: rgb(0 0 0 / .45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.pos-done[hidden] { display: none; }
.pos-done-card { width: min(420px, 100%); text-align: center; }
.pos-done-change { font-size: 26px; font-weight: 800; color: var(--accent); margin: 8px 0; }
.pos-done .form-actions { justify-content: center; }
@media (max-width: 860px) {
  .pos-screen { grid-template-columns: 1fr; padding: 10px; }
  .pos-cart { position: static; max-height: none; }
  .pos-keys { display: none; }
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
.form-stack { display: grid; gap: 10px; }
.form-stack legend { padding: 0; margin-bottom: 6px; }
.form-stack legend h2 { margin: 0; font-size: 18px; }

/* ---------- Phase 16: expenses ---------- */
.cat-bars { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.cat-bars a { display: grid; grid-template-columns: minmax(90px, 28%) 1fr minmax(110px, auto); gap: 10px; align-items: center; font-size: 14px; color: var(--ink); text-decoration: none; padding: 4px 6px; border-radius: 8px; }
.cat-bars a:hover { background: var(--sunk); }
.cb-name { overflow-wrap: anywhere; }
.cb-track { width: 100%; height: 10px; display: block; background: var(--sunk); border-radius: 5px; overflow: hidden; }
.cb-fill { fill: var(--gold); }
.cb-v { text-align: right; white-space: nowrap; }
.exp-form { display: grid; gap: 16px; }
.exp-form h2 { margin: 0 0 8px; font-size: 18px; }
.amount-big input { font-size: 26px; font-weight: 700; padding: 10px 14px; width: 100%; font-family: var(--f-mono); }
.cat-pick { display: flex; flex-wrap: wrap; gap: 6px; border: 0; padding: 0; margin: 0; }
.cat-pick legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; padding: 0; }
.cat-pick label { border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 14px; background: var(--surface); }
.cat-pick label:has(input:checked) { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.cat-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cat-pick label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.paid-choice { display: flex; gap: 8px; flex-wrap: wrap; }
.exp-form [data-when-paid][hidden], .exp-form [data-when-owed][hidden] { display: none !important; }
.receipt-thumb { max-width: min(100%, 360px); max-height: 420px; border-radius: 8px; border: 1px solid var(--line); display: block; }
.rule-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.rule-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.rule-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 10px; align-items: end; margin-top: 10px; }
.rule-form input { width: 100%; }
@media (max-width: 640px) { .cat-bars a { grid-template-columns: 1fr auto; } .cb-track { grid-column: 1 / -1; order: 3; } }

/* ---------- Phase 17: customers ---------- */
.contact-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pre-line { white-space: pre-line; }
.notice-card { border-color: var(--gold); }
.st-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 10px; }
.st-table tfoot td { border-top: 2px solid var(--line); font-weight: 600; }
.page-print .statement-doc { background: #fff; color: #000; max-width: 190mm; margin: 16px auto; padding: 14mm; box-shadow: 0 2px 12px rgb(0 0 0 / .1); }
@media print { .page-print .statement-doc { margin: 0; padding: 0; box-shadow: none; max-width: none; } }

/* ---------- Phase 19: debts ---------- */
.cb-fill.cb-ok { fill: var(--accent); }
.cb-fill.cb-bad { fill: var(--bad); }
.party-head { display: flex; gap: 12px; flex-wrap: wrap; align-items: baseline; justify-content: space-between; }
.debt-pick { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.debt-pick li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.debt-pick li.is-late { border-color: var(--bad); }
.pay-preview { font-size: 14px; }
.payment-reversed { text-decoration: line-through; color: var(--muted); }
.reminder-text { white-space: pre-line; background: var(--sunk); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 8px 0; }
.receipt-doc { max-width: 640px; }
.receipt-doc .rc-total { font-size: 28px; font-weight: 700; font-family: var(--f-mono); }
.dir-pick { display: flex; gap: 8px; flex-wrap: wrap; border: 0; padding: 0; margin: 0 0 4px; }
.dir-pick legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; padding: 0; }
.dir-pick label { flex: 1 1 220px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; background: var(--surface); }
.dir-pick label:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row form { margin: 0; }
.inline-details summary { cursor: pointer; color: var(--accent); }
.inline-details[open] { min-width: min(100%, 260px); }
@media (max-width: 640px) {
  .people-table td:first-child, .people-table td[data-label], .people-table td.td-actions { grid-column: 1 / -1; }
  .people-table td.td-actions { margin-top: 6px; }
}

/* ---------- Phase 20: reports ---------- */
.report-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 12px; margin-top: 8px; }
.report-card { display: grid; gap: 4px; text-decoration: none; color: var(--ink); align-content: start; }
.report-card:hover { border-color: var(--accent); }
.report-card.is-locked { opacity: .7; }
.chart .bar-neg { fill: var(--bad); }
.statement-table td.r, .statement-table th.r { white-space: nowrap; }
.statement-table tr.st-total td { font-weight: 700; border-top: 2px solid var(--line); }
.statement-table tr.st-grand td { font-weight: 700; font-size: 1.05em; border-top: 2px solid var(--ink); }
.statement-table td.st-indent { padding-left: 24px; }
.hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; align-items: end; height: 80px; margin-top: 8px; }
.hours span { background: var(--accent); opacity: .75; border-radius: 2px 2px 0 0; min-height: 1px; }
.hours-x { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
@media print {
  .report-head .page-actions, .filters { display: none !important; }
  .chart-table { display: none; }
  .kpis { grid-template-columns: repeat(4, 1fr); }
}
.cat-bars .cat-bar-row { display: grid; grid-template-columns: minmax(90px, 28%) 1fr minmax(110px, auto); gap: 10px; align-items: center; font-size: 14px; padding: 4px 6px; }
.statement-table th.r { text-align: right; }

/* ---------- Phase 21: branches ---------- */
.branch-switch { display: inline-flex; align-items: center; margin: 0; }
.branch-switch select { min-height: 32px; padding: 4px 28px 4px 10px; border-radius: 999px; font-size: 14px; font-weight: 600; background-color: var(--sunk); border: 1px solid var(--line); color: var(--ink); max-width: 46vw; }
.staff-list li { align-items: center; }
.check-line { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.check-line input { width: 20px; height: 20px; }

/* ---- Phase 23: integrations ---- */
.break { overflow-wrap: anywhere; word-break: break-word; }
.code-block { background: var(--sunk); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow-x: auto; white-space: pre; font-size: 13px; line-height: 1.5; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.tag-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.steps-list { margin: 8px 0; padding-left: 20px; display: grid; gap: 4px; }
.field-button { flex: 0 0 auto !important; }
tr.is-muted td { color: var(--muted); }
.wh-events { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.wh-group { display: grid; gap: 8px; align-content: start; }
.wh-group h3 { margin: 0; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.wh-list li { display: block; padding: 10px 0; border-top: 1px solid var(--line); }
.wh-list li:first-child { border-top: 0; }
.identity-list li { align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.identity-list li:first-child { border-top: 0; }
.oauth-buttons { margin-top: 16px; display: grid; gap: 8px; }
.oauth-buttons .or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; margin: 0 0 4px; }
.oauth-buttons .or::before, .oauth-buttons .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.btn-oauth { justify-content: center; }
.btn-oauth-apple { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.contact-table td:first-child, .contact-table th:first-child { width: 44px; }
.contact-table input[type=checkbox] { width: 20px; height: 20px; }
.contacts-bar { padding: 14px 0 0; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.contact-table .c-sub-email { display: none; }
.contact-table td { vertical-align: top; }
@media (max-width: 640px) {
  .contact-table .c-email { display: none; }
  .contact-table .c-sub-email { display: block; }
  .contact-table td, .contact-table th { padding-left: 8px; padding-right: 8px; }
}
.inline-form input[type=checkbox] { flex: 0 0 auto; width: 20px; height: 20px; }
.inline-form .check-line { white-space: nowrap; }
.wh-group .check-line { align-items: flex-start; }
.wh-group .check-line input { margin-top: 3px; flex: 0 0 auto; }
.contact-table .chip { white-space: normal; }

/* ---- Phase 24: WhatsApp ---- */
.tpl-list li { display: block; padding: 12px 0; border-top: 1px solid var(--line); }
.tpl-list li:first-child { border-top: 0; }
.tpl-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.tpl-body { background: var(--sunk); border-radius: 8px; padding: 8px 10px; margin: 0; }
.wa-sent li { align-items: center; border-top: 1px solid var(--line); padding-top: 6px; }
.wa-threads li { display: block; border-top: 1px solid var(--line); }
.wa-threads li:first-child { border-top: 0; }
.wa-threads a { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 16px; color: var(--ink); text-decoration: none; }
.wa-threads a:hover { background: var(--sunk); }
.wa-who { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.wa-last { grid-column: 1 / 2; overflow-wrap: anywhere; }
.wa-when { grid-column: 2; grid-row: 1; text-align: right; }
.wa-chat { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.wa-bubble { max-width: min(80%, 520px); padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.wa-bubble p { margin: 0; overflow-wrap: anywhere; }
.wa-bubble.is-out { align-self: flex-end; background: var(--accent-soft); border-color: transparent; }
.wa-meta { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.shared-doc .rc-lines th:nth-child(2), .shared-doc .rc-lines td:nth-child(2) { white-space: nowrap; }
summary.tpl-head { cursor: pointer; margin: 0; }
details[open] > summary.tpl-head { margin-bottom: 8px; }

/* ---- Phase 25: SMS ---- */
.gw { border-top: 1px solid var(--line); padding: 12px 0; }
.gw > summary { list-style-position: inside; }
.sms-bubble { background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; max-width: 520px; overflow-wrap: anywhere; margin: 10px 0; }
.camp-list li { display: block; border-top: 1px solid var(--line); }
.camp-list li:first-child { border-top: 0; }
.camp-list a { display: grid; gap: 4px; padding: 12px 16px; color: var(--ink); text-decoration: none; }
.camp-list a:hover { background: var(--sunk); }

/* ---- Phase 26: Email ---- */
details.pop { position: relative; }
details.pop > summary { list-style: none; cursor: pointer; }
details.pop > summary::-webkit-details-marker { display: none; }
.pop-body { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: min(320px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .12); }
@media (max-width: 640px) { .pop-body { position: static; width: auto; margin-top: 8px; box-shadow: none; } details.pop { flex-basis: 100%; } }
.email-to { display: flex; gap: 8px; flex-wrap: wrap; }
.email-to input { flex: 1 1 220px; min-width: 0; }
.member-list { display: grid; gap: 6px; }
.doc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
main.auth-card[data-email-stop] { margin: 32px auto; width: min(440px, calc(100% - 32px)); }

/* ---- Phase 27: Payments ---- */
main.pay-card { margin: 32px auto; width: min(460px, calc(100% - 32px)); }
.pay-card .spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pay-card .spinner { animation: none; } }
.pay-request .btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Import & export (Phase 28) */
.data-list { gap: 0; }
.data-list li { align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.data-list li:first-child { border-top: 0; }
.data-list .block { display: block; }
.data-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Phase 29: menu on wide screens and phones, installable app ---------- */
.nav-drop { position: relative; }
.nav-drop > summary { list-style: none; cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.nav-drop > summary::-webkit-details-marker { display: none; }
.nav-drop > summary::after { content: "▾"; font-size: 12px; }
.nav-drop > summary[aria-current=page] { color: var(--accent); }
.nav-drop-panel { position: absolute; top: calc(100% + 10px); left: 0; z-index: 40; min-width: 200px; display: grid; gap: 2px; padding: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.nav-drop-right { left: auto; right: 0; }
.nav-drop-panel a, .nav-drop-panel .linklike { display: block; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-align: left; width: 100%; }
.nav-drop-panel a:hover, .nav-drop-panel .linklike:hover { background: var(--sunk); }
.nav-drop-panel a[aria-current=page] { color: var(--accent); background: var(--accent-soft); }
.nav-drop-panel .locale { padding: 6px 10px; }
.nav-me { margin: 2px 10px 6px; }
.nav-menu-btn { display: none; align-items: center; gap: 6px; color: var(--ink); text-decoration: none; font-weight: 600; }
.nav-sheet { display: none; position: fixed; inset: 0; z-index: 60; }
.nav-sheet:target, .nav-sheet.is-open { display: block; }
.nav-sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.nav-sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 85vh; overflow-y: auto; background: var(--surface);
  border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 14px; }
.nav-sheet-head { display: flex; justify-content: space-between; align-items: center; }
.nav-sheet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.nav-sheet-grid a { padding: 12px; border-radius: 12px; background: var(--sunk); color: var(--ink); text-decoration: none; font-weight: 600; }
.nav-sheet-grid a[aria-current=page] { background: var(--accent-soft); color: var(--accent); }
.nav-sheet-account { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; border-top: 1px solid var(--line); padding-top: 12px; }
.nav-sheet-account a { color: var(--ink); }
.tabbar { display: none; }
@media (max-width: 760px) {
  .appnav { display: none; }
  .nav-menu-btn { display: inline-flex; }
  body:has(.tabbar) .nav-menu-btn { display: none; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px)); }
  .tabbar a { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; border-radius: 10px; min-width: 0; }
  .tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar a[aria-current=page] { color: var(--accent); background: var(--accent-soft); }
  body:has(.tabbar) .app { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .appbar { flex-wrap: nowrap; }
  .appbar .branch-switch select { max-width: 42vw; }
}
@media (min-width: 761px) { .nav-sheet:target { display: none; } }
.page-app .appbar { position: sticky; top: 0; z-index: 35; }
/* Installed app / phone app: no browser bar above, so leave room for the status bar */
@media (display-mode: standalone) { .appbar { padding-top: calc(10px + env(safe-area-inset-top, 0px)); } }
.offline-bar { position: fixed; left: 12px; right: 12px; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); z-index: 70; background: #3A2A06; color: #FFE7B0;
  border-radius: 12px; padding: 10px 14px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
@media (min-width: 761px) { .offline-bar { left: auto; right: 20px; bottom: 20px; max-width: 380px; } }
.offline-card { max-width: 520px; margin: 48px auto; padding: 0 16px; display: grid; gap: 6px; text-align: left; }
.offline-card h1 { margin: 12px 0 0; }
.offline-card h2 { margin: 18px 0 0; font-size: 20px; }
.app-get .store-row { display: flex; flex-wrap: wrap; gap: 10px; }
.device-list li { align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.device-list li:first-child { border-top: 0; }

/* Phase 30: password before linking / removing a sign-in method */
.identity-confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.identity-confirm input { max-width: 200px; }
.identity-confirm .field-error { flex-basis: 100%; margin: 0; }

/* Terms of service and privacy policy (Phase 33) */
.legal { max-width: 46rem; margin: 0 auto; padding: 24px 16px 64px; }
.legal-text h1 { margin-bottom: 4px; }
.legal-text h2 { font-size: 1.1rem; margin: 28px 0 8px; }
.legal-text p, .legal-text li { line-height: 1.6; }
.legal-text ul { padding-left: 1.25rem; }
.auth-legal { text-align: center; margin-top: 16px; }
.mono-text { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; width: 100%; }
