/* Tidet Cloud mockup (throwaway, sample data only).
   Colours are the new desktop app's v10e tokens (packages/tokens/src/td-palette.ts,
   tdDarkPalette / tdLightPalette), copied, not tuned. Chart colours are the
   validated data-viz slots 1-2 (checked against #181818 and #ffffff). */

html[data-theme="dark"] {
  color-scheme: dark;
  --frame: #1D1D1D; --plane: #181818; --raise: #2A2A2A; --code: #1F1F1F;
  --fill: rgba(255,255,255,.05); --fill2: rgba(255,255,255,.08);
  --line: rgba(255,255,255,.08); --line2: rgba(255,255,255,.13);
  --t1: #F3F3F3; --t2: #B4B4B4; --t3: #9E9E9E; --t4: #5C5C5C;
  --glass: rgba(36,36,36,.92); --tog-off: #454545;
  --sh: 0 0 0 1px rgba(255,255,255,.14), 0 4px 16px rgba(0,0,0,.45);
  --dawn: #F4B942; --dawn-mark: #F4B942; --ink: #1B1405;
  --live: #86A9D0; --ok: #7DB394; --err: #E3846F; --warn: #C9A050; --need: #F284BF; --unread: #7BAAF7;
  --go: #F2F2F2; --go-ink: #161616; --acc-solid: #D9D9D9; --acc-solid-ink: #1D1D1D;
  --sel: rgba(134,169,208,.14);
  --focus: #C8C8C8;
  --s1: #3987e5; --s2: #d95926; --seq-lo: #184f95; --seq-hi: #86b6ef;
  --grid: #2c2c2a; --axis: #383835;
  --scrim: rgba(0,0,0,.55);
}
html[data-theme="light"] {
  color-scheme: light;
  --frame: #FAFAFA; --plane: #FFFFFF; --raise: #FFFFFF; --code: #FAFAFA;
  --fill: rgba(26,28,31,.045); --fill2: rgba(26,28,31,.07);
  --line: rgba(26,28,31,.08); --line2: rgba(26,28,31,.13);
  --t1: #1A1C1F; --t2: #4C4E53; --t3: #65676C; --t4: #B4B5B8;
  --glass: rgba(255,255,255,.9); --tog-off: #D7D7DA;
  --sh: 0 0 0 1px rgba(26,28,31,.08), 0 2px 6px -2px rgba(26,28,31,.06), 0 16px 40px -12px rgba(26,28,31,.16);
  --dawn: #F4B942; --dawn-mark: #B07A1A; --ink: #1B1405;
  --live: #3A5F87; --ok: #286C4F; --err: #9C4536; --warn: #7B5A16; --need: #AE2C77; --unread: #2A62C2;
  --go: #1A1C1F; --go-ink: #FFFFFF; --acc-solid: #2A2C30; --acc-solid-ink: #FFFFFF;
  --sel: rgba(63,102,144,.11);
  --focus: #4C4E53;
  --s1: #2a78d6; --s2: #eb6834; --seq-lo: #e6effb; --seq-hi: #184f95;
  --grid: #ececea; --axis: #c3c2b7;
  --scrim: rgba(26,28,31,.32);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--plane); color: var(--t1);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--sel); }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--t2); }
.subtle { color: var(--t3); }
.small { font-size: 12.5px; }
.mono { font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }
.skip { position: absolute; left: 8px; top: -40px; z-index: 100; background: var(--go); color: var(--go-ink); padding: 6px 10px; border-radius: 8px; }
.skip:focus { top: 48px; }

/* ---------- layout ---------- */
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 3px 9px; cursor: pointer; font-size: 12.5px; color: var(--t2); }
.seg button[aria-pressed="true"] { background: var(--fill2); color: var(--t1); }
#stage { container-type: inline-size; container-name: stage; min-height: 100vh; }

/* ---------- product shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0,1fr); min-height: 100vh; }
html[data-width="390"] .shell { min-height: 780px; }
.side { background: var(--frame); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 12px 10px; gap: 4px; }
.brand { display: flex; align-items: center; gap: 8px; padding: 4px 8px 10px; font-weight: 600; letter-spacing: -.01em; }
.brand .mark { width: 20px; height: 20px; }
.orgswitch { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: transparent; cursor: pointer; text-align: left; margin-bottom: 8px; }
.orgswitch:hover { background: var(--fill); }
.avatar { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: var(--fill2); font-size: 11px; font-weight: 600; color: var(--t1); }
.avatar.round { border-radius: 50%; }
.avatar.lg { width: 32px; height: 32px; font-size: 13px; border-radius: 8px; }
.orgswitch .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.region { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; letter-spacing: .03em; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line2); color: var(--t2); }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 7px; text-decoration: none; color: var(--t2); }
.nav a:hover { background: var(--fill); color: var(--t1); }
.nav a[aria-current="page"] { background: var(--fill2); color: var(--t1); font-weight: 500; }
.nav a .count { margin-left: auto; font-size: 11.5px; color: var(--need); font-weight: 600; }
.nav .group { font-size: 11.5px; color: var(--t3); padding: 14px 8px 4px; letter-spacing: .02em; }
.nav svg, .ico { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.side .foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 8px; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 8px; padding: 6px 8px; font-size: 13px; }
.me .who { min-width: 0; }
.me .who div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--frame); }
.content { padding: 28px 40px 64px; max-width: 1180px; width: 100%; }
.pagehead { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.pagehead .titles { flex: 1; min-width: 0; }
h1 { font-size: 22px; line-height: 1.25; font-weight: 600; letter-spacing: -.015em; margin: 0; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 10px; letter-spacing: -.005em; }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 6px; }
.pagehead p { margin: 4px 0 0; color: var(--t2); }
.crumbs { font-size: 12.5px; color: var(--t3); margin-bottom: 6px; }
.crumbs a { text-decoration: none; } .crumbs a:hover { text-decoration: underline; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 8px 10px; text-decoration: none; color: var(--t2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--t1); }
.tabs a[aria-current="page"] { color: var(--t1); border-bottom-color: var(--t1); font-weight: 500; }
.tabs .badge { margin-left: 6px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line2); background: var(--raise); color: var(--t1); cursor: pointer; font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--fill2); }
.btn.go { background: var(--go); color: var(--go-ink); border-color: transparent; border-radius: 999px; padding: 0 16px; }
.btn.go:hover { filter: brightness(.94); }
html[data-theme="dark"] .btn.go:hover { filter: brightness(.9); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--t2); }
.btn.ghost:hover { background: var(--fill); color: var(--t1); }
.btn.danger { color: var(--err); }
.btn.go.danger { background: var(--err); color: #fff; }
.btn.sm { min-height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.iconbtn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--t2); cursor: pointer; }
.iconbtn:hover { background: var(--fill); color: var(--t1); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }

/* chips and badges */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line2); color: var(--t2); white-space: nowrap; }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--t3); flex: none; }
.chip.ok i { background: var(--ok); } .chip.warn i { background: var(--warn); } .chip.err i { background: var(--err); } .chip.live i { background: var(--live); } .chip.need i { background: var(--need); }
.chip.solid { background: var(--fill2); border-color: transparent; color: var(--t1); }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--fill2); color: var(--t1); font-size: 11px; font-weight: 600; }
.badge.need { background: var(--need); color: #fff; }
html[data-theme="dark"] .badge.need { color: #2a0a1c; }
.lock { display: inline-flex; align-items: center; gap: 4px; color: var(--t3); font-size: 12px; }

/* cards */
.card { background: var(--frame); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
html[data-theme="light"] .card { background: #fff; box-shadow: 0 1px 2px rgba(26,28,31,.04); }
.card.flat { background: transparent; box-shadow: none; }
.card .cardhead { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card .cardhead h2 { margin: 0; }
.hero { padding: 24px; }
.hero h2 { font-size: 18px; margin-bottom: 6px; }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--fill); font-size: 13px; margin-bottom: 16px; }
.callout.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.callout.err { border-color: color-mix(in srgb, var(--err) 50%, transparent); }
.callout .ico { margin-top: 2px; }
.callout .grow { flex: 1; }

/* lists inside cards */
.list { display: flex; flex-direction: column; }
.list .item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list .item:first-child { border-top: 0; padding-top: 2px; }
.list .item .grow { flex: 1; min-width: 0; }
.list .item .t { font-weight: 500; }
.list .item .d { color: var(--t2); font-size: 13px; }

/* steps (first run) */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.steps li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.steps .dot { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line2); display: grid; place-items: center; font-size: 11px; color: var(--t3); margin-top: 1px; }
.steps li.done .dot { background: var(--ok); border-color: var(--ok); color: var(--plane); }
.steps li.now .dot { border-color: var(--t1); color: var(--t1); }
.steps li.done .t { color: var(--t2); text-decoration: line-through; text-decoration-color: var(--t4); }
.steps .grow { flex: 1; }
.progress { height: 6px; border-radius: 3px; background: var(--fill2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--t1); border-radius: 3px; }

/* stat tiles */
.tile { padding: 16px; }
.tile .label { color: var(--t2); font-size: 12.5px; }
.tile .value { font-size: 24px; font-weight: 600; letter-spacing: -.01em; margin-top: 4px; }
.tile .delta { font-size: 12px; color: var(--t3); margin-top: 2px; }
.tile .delta.up { color: var(--ok); }

/* tables */
.tablewrap { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-weight: 500; color: var(--t3); font-size: 12.5px; padding: 9px 14px; background: var(--frame); border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
table.t tr:first-child td { border-top: 0; }
table.t tbody tr:hover td { background: var(--fill); }
table.t td.actions { text-align: right; white-space: nowrap; }
table.t td .sub { color: var(--t3); font-size: 12.5px; }
.cellwho { display: flex; align-items: center; gap: 10px; min-width: 0; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 6px; padding: 0 10px; height: 32px; border: 1px solid var(--line2); border-radius: 8px; background: var(--raise); min-width: 220px; color: var(--t3); }
.search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; color: var(--t1); }
.search:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }

/* menus */
.menu { position: fixed; z-index: 80; min-width: 190px; background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--sh); border-radius: 10px; padding: 4px; }
.menu button { display: flex; width: 100%; text-align: left; gap: 8px; padding: 7px 10px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; font-size: 13px; }
.menu button:hover, .menu button:focus-visible { background: var(--fill2); outline: none; }
.menu button.danger { color: var(--err); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }

/* dialogs */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 90; display: grid; place-items: center; padding: 16px; }
.dialog { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--raise); border-radius: 14px; box-shadow: var(--sh); padding: 22px; }
html[data-theme="dark"] .dialog { background: #222; }
.dialog.wide { width: min(760px, 100%); }
.dialog h2 { font-size: 17px; margin-bottom: 6px; }
.dialog .lead { color: var(--t2); margin: 0 0 16px; }
.dialog .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label, .field > .lab { font-size: 13px; font-weight: 500; }
.field .help { font-size: 12.5px; color: var(--t3); }
.field .error { font-size: 12.5px; color: var(--err); display: flex; gap: 6px; align-items: center; }
.input, select.input, textarea.input { height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line2); background: var(--plane); color: var(--t1); width: 100%; }
html[data-theme="dark"] .input { background: #1b1b1b; }
textarea.input { height: auto; padding: 8px 10px; min-height: 80px; }
.input[aria-invalid="true"] { border-color: var(--err); }
.input:focus { outline: 2px solid var(--focus); outline-offset: 0; }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line2); border-radius: 10px; cursor: pointer; background: transparent; text-align: left; }
.choice:hover { background: var(--fill); }
.choice[aria-checked="true"], .choice[aria-pressed="true"] { border-color: var(--t1); background: var(--fill); }
.choice .t { font-weight: 500; } .choice .d { font-size: 12.5px; color: var(--t3); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--acc-solid); }
.codebox { display: flex; gap: 6px; }
.codebox .input { text-align: center; font-size: 18px; font-weight: 600; letter-spacing: .3em; height: 44px; }
.bigcode { font-size: 26px; font-weight: 600; letter-spacing: .25em; text-align: center; padding: 12px; border-radius: 10px; background: var(--fill); font-variant-numeric: tabular-nums; }
.words { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 6px; counter-reset: w; }
.words span { counter-increment: w; padding: 6px 8px; border-radius: 6px; background: var(--fill); font-size: 13px; }
.words span::before { content: counter(w) ". "; color: var(--t3); font-size: 11.5px; }

/* switch */
.switch { position: relative; width: 34px; height: 20px; border-radius: 10px; background: var(--tog-off); border: 0; cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--acc-solid); }
.switch[aria-checked="true"]::after { transform: translateX(14px); background: var(--acc-solid-ink); }
html[data-theme="light"] .switch[aria-checked="true"]::after { background: #fff; }

/* item cards (Directory) */
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.itemcard { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--frame); }
html[data-theme="light"] .itemcard { background: #fff; }
.itemcard .top { display: flex; gap: 10px; align-items: center; }
.itemcard .name { font-weight: 600; }
.itemcard .desc { color: var(--t2); font-size: 13px; flex: 1; }
.itemcard .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--t3); }
.source { font-size: 11.5px; color: var(--t3); }

/* skeleton */
.sk { border-radius: 6px; background: linear-gradient(90deg, var(--fill) 0%, var(--fill2) 50%, var(--fill) 100%); background-size: 200% 100%; animation: sk 1.4s ease-in-out infinite; height: 12px; }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* empty and error states */
.empty { text-align: center; padding: 48px 16px; border: 1px dashed var(--line2); border-radius: 12px; }
.empty .ico { width: 28px; height: 28px; color: var(--t3); }
.empty h2 { margin: 10px 0 4px; }
.empty p { color: var(--t2); margin: 0 0 14px; }

/* charts */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--t3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .gridl { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .bar { fill: var(--s1); }
.chart .bar.s2 { fill: var(--s2); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .hit:focus + .bar { filter: brightness(1.15); }
.chart .lbl { fill: var(--t2); font-size: 11.5px; }
.chart .line { fill: none; stroke: var(--s1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--s1); opacity: .1; }
.chart .dotm { fill: var(--s1); stroke: var(--frame); stroke-width: 2; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--t2); flex-wrap: wrap; margin-bottom: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: fixed; z-index: 95; pointer-events: none; background: var(--glass); box-shadow: var(--sh); border-radius: 8px; padding: 6px 9px; font-size: 12.5px; }
.tip b { display: block; font-size: 13.5px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 10px; align-items: center; font-size: 13px; padding: 5px 0; }
.hbar .track { height: 10px; border-radius: 0 4px 4px 0; background: transparent; }
.hbar .track > i { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--s1); max-width: 100%; }
.heat { display: grid; gap: 2px; font-size: 12px; }
.heat .c { padding: 6px 4px; text-align: center; border-radius: 4px; font-variant-numeric: tabular-nums; }
.funnel .step { display: grid; grid-template-columns: minmax(110px, 170px) 1fr 70px; gap: 10px; align-items: center; padding: 6px 0; font-size: 13px; }
.funnel .bar { height: 24px; border-radius: 0 4px 4px 0; background: var(--s1); }
.funnel .pct { text-align: right; color: var(--t2); font-variant-numeric: tabular-nums; }

/* region columns (back office health) */
.regioncol h2 { display: flex; gap: 8px; align-items: center; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; font-size: 13.5px; }
.kv dt { color: var(--t2); } .kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* toast */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 99; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--glass); box-shadow: var(--sh); border-radius: 10px; padding: 10px 14px; font-size: 13px; max-width: 360px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

/* sign-in pages */
.authpage { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--frame); }
html[data-width="390"] .authpage { min-height: 780px; }
.authcard { width: min(400px, 100%); background: var(--plane); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--sh); }
.authcard .mark { width: 28px; height: 28px; margin-bottom: 14px; }
.authcard h1 { font-size: 20px; margin-bottom: 6px; }
.authcard .btn { width: 100%; min-height: 40px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--t3); font-size: 12px; margin: 14px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* start page */
.start { max-width: 1040px; margin: 0 auto; padding: 36px 24px 64px; }
.start h1 { font-size: 26px; }
.start .lead { color: var(--t2); max-width: 720px; margin: 8px 0 24px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.cards a.card { text-decoration: none; display: flex; flex-direction: column; gap: 6px; }
.cards a.card:hover { border-color: var(--line2); background: var(--fill); }
.cards a.card .t { font-weight: 600; font-size: 15px; }
.cards a.card .d { color: var(--t2); font-size: 13px; }

/* live demo */
.live { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)) 1.1fr repeat(2, minmax(0,1fr)); gap: 12px; align-items: stretch; }
.device { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; background: var(--frame); min-height: 380px; overflow: hidden; }
html[data-theme="light"] .device { background: #fff; }
.device header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 500; font-size: 13px; }
.device .feed { flex: 1; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; overflow: auto; max-height: 420px; font-size: 12.5px; }
.device .ev { padding: 6px 8px; border-radius: 8px; background: var(--fill); }
.device .ev .n { color: var(--t3); font-variant-numeric: tabular-nums; margin-right: 6px; }
.device .ev.me { background: var(--fill2); }
.device .ev.new { animation: flash 1.2s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 2px var(--live); } to { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .device .ev.new { animation: none; } }
.device footer { padding: 8px 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--t3); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.device.off { opacity: .6; }
.regionbox .feed .ev { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11.5px; word-break: break-all; }
.timeline { font-size: 12.5px; }

/* ---------- narrow: the stage is the container (works for the 390 preview and a real phone) ---------- */
@container stage (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 70; top: 0; bottom: 0; left: 0; width: 280px; transform: translateX(-100%); visibility: hidden; transition: transform .2s, visibility .2s; box-shadow: none; }
  .shell.drawer .side { transform: none; visibility: visible; box-shadow: var(--sh); }
  .topbar { display: flex; }
  .content { padding: 18px 16px 48px; }
  .pagehead { flex-wrap: wrap; }
  .pagehead .actions { width: 100%; }
  .pagehead .actions .btn.go { width: 100%; }
  h1 { font-size: 20px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .grid4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .choices { grid-template-columns: 1fr; }
  .tablewrap { border: 0; overflow: visible; }
  table.t, table.t tbody, table.t tr, table.t td { display: block; width: 100%; }
  table.t thead { display: none; }
  table.t tr { border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; margin-bottom: 10px; background: var(--frame); }
  table.t td { border: 0; padding: 6px 0; display: flex; gap: 12px; justify-content: space-between; align-items: center; text-align: right; }
  table.t td::before { content: attr(data-label); color: var(--t3); font-size: 12.5px; text-align: left; flex: none; }
  table.t td.first { text-align: left; justify-content: flex-start; }
  table.t td.first::before { content: none; }
  table.t td.actions { justify-content: flex-end; }
  table.t td.actions::before { content: none; }
  table.t tbody tr:hover td { background: transparent; }
  .live { grid-template-columns: 1fr; }
  .chip { white-space: normal; }
  .mono { word-break: break-all; }
  .words { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hbar { grid-template-columns: 100px 1fr auto; }
  .funnel .step { grid-template-columns: 96px 1fr 56px; }
}
@container stage (max-width: 1100px) and (min-width: 761px) {
  .live { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .live .regionbox { grid-column: 1 / -1; order: -1; }
}
/* A dialog is drawn outside the stage container, so its own two-column grids follow the window, not the page: the record a
   version form stacks its fields on a phone instead of squeezing two into 160 px. */
@media (max-width: 760px) {
  .dialog .grid2, .dialog .grid3 { grid-template-columns: 1fr; }
}
@media (forced-colors: active) {
  .btn.go { border: 1px solid ButtonText; }
  .chip i { forced-color-adjust: none; }
}
