/* SyntobiMind admin.
   One token scale for space, type, radii, elevation and motion; flat neutral greys, one accent,
   status colours only for status. No gradients, no glass, no backdrop-filter. */

/* ================================================================ tokens */

:root {
  /* space: 4/8 */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;
  /* radii */
  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-pill: 999px;
  /* type: size / line height */
  --fs-xs: 12px; --lh-xs: 16px;
  --fs-sm: 13px; --lh-sm: 20px;
  --fs-md: 14px; --lh-md: 20px;
  --fs-lg: 16px; --lh-lg: 24px;
  --fs-xl: 20px; --lh-xl: 28px;
  --fs-2xl: 24px; --lh-2xl: 32px;
  --fs-3xl: 30px; --lh-3xl: 36px;
  --fw-medium: 500; --fw-semi: 600; --fw-bold: 650;
  /* controls */
  --ctl-sm: 28px; --ctl-md: 34px; --ctl-lg: 40px; --ctl-touch: 44px;
  /* motion */
  --dur-fast: 120ms; --dur: 180ms; --dur-slow: 220ms;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-sheet: cubic-bezier(.22, 1, .36, 1);
  /* layout */
  --sidebar-w: 248px; --rail-w: 68px; --topbar-h: 56px;
  --gutter: clamp(16px, 3vw, 40px);
  --content-max: 1440px; --content-narrow: 960px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;

  /* colour: light */
  color-scheme: light;
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-2: #fafafb;
  --surface-3: #f1f1f3;
  --hover: #eeeef1;
  --border: #e6e6ea;
  --border-strong: #d4d4da;
  --text: #111113;
  --text-2: #4a4a52;
  --text-3: #6a6a73;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-text: #1d4ed8;
  --accent-weak: #eef3fe;
  --on-accent: #ffffff;
  --good: #15803d; --good-dot: #16a34a; --good-weak: #e9f6ee;
  --warn: #9a5b00; --warn-dot: #e3a008; --warn-weak: #fdf4de;
  --bad: #b42318; --bad-dot: #d92d20; --bad-weak: #fdecea;
  --violet: #6d28d9;
  --focus: #2563eb;
  --shadow-xs: 0 1px 2px rgba(16, 16, 20, .04);
  --shadow-sm: 0 1px 2px rgba(16, 16, 20, .05), 0 1px 3px rgba(16, 16, 20, .04);
  --shadow-lg: 0 16px 40px rgba(16, 16, 20, .14), 0 2px 8px rgba(16, 16, 20, .06);
  --scrim: rgba(16, 16, 20, .36);
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #111113;
  --grid: #ececef; --baseline: #c9c9cf; --hover-band: rgba(16, 16, 20, .04);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0b0c; --surface: #131315; --surface-2: #18181b; --surface-3: #202024; --hover: #1d1d21;
    --border: #26262b; --border-strong: #35353c;
    --text: #f2f2f3; --text-2: #b8b8bf; --text-3: #8d8d96;
    --accent: #2563eb; --accent-hover: #3070f0; --accent-text: #82acf8; --accent-weak: #15203a;
    --good: #4ade80; --good-dot: #22c55e; --good-weak: #12261a;
    --warn: #f0b84b; --warn-dot: #eab308; --warn-weak: #2c2310;
    --bad: #f8877d; --bad-dot: #ef4444; --bad-weak: #321718;
    --violet: #af87ff; --focus: #6b9bf5;
    --shadow-xs: none; --shadow-sm: none;
    --shadow-lg: 0 20px 48px rgba(0, 0, 0, .55), 0 0 0 1px #26262b;
    --scrim: rgba(0, 0, 0, .6);
    --series-1: #3987e5; --series-2: #d95926; --series-3: #f2f2f3;
    --grid: #232327; --baseline: #3a3a41; --hover-band: rgba(255, 255, 255, .05);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0b0c; --surface: #131315; --surface-2: #18181b; --surface-3: #202024; --hover: #1d1d21;
  --border: #26262b; --border-strong: #35353c;
  --text: #f2f2f3; --text-2: #b8b8bf; --text-3: #8d8d96;
  --accent: #2563eb; --accent-hover: #3070f0; --accent-text: #82acf8; --accent-weak: #15203a;
  --good: #4ade80; --good-dot: #22c55e; --good-weak: #12261a;
  --warn: #f0b84b; --warn-dot: #eab308; --warn-weak: #2c2310;
  --bad: #f8877d; --bad-dot: #ef4444; --bad-weak: #321718;
  --violet: #af87ff; --focus: #6b9bf5;
  --shadow-xs: none; --shadow-sm: none;
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, .55), 0 0 0 1px #26262b;
  --scrim: rgba(0, 0, 0, .6);
  --series-1: #3987e5; --series-2: #d95926; --series-3: #f2f2f3;
  --grid: #232327; --baseline: #3a3a41; --hover-band: rgba(255, 255, 255, .05);
}

/* ================================================================ base */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: var(--fs-md)/var(--lh-md) var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
code, pre, .mono { font-family: var(--mono); font-size: .92em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-xs); }
::selection { background: var(--accent-weak); }

.muted { color: var(--text-3); }
.small { font-size: var(--fs-xs); line-height: var(--lh-xs); }
.strong { font-weight: var(--fw-semi); }
.tone-bad { color: var(--bad); }
.tone-warn { color: var(--warn); }
.tone-good { color: var(--good); }
.pad-t { padding-top: var(--s-2); }
.nowrap, .table td.nowrap { white-space: nowrap; }
.noscript { padding: var(--s-6); text-align: center; }
.stack { display: flex; flex-direction: column; gap: var(--s-4); min-width: 0; }
.stack-sm { display: flex; flex-direction: column; gap: var(--s-3); }

.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ================================================================ loading, skeletons */

.boot { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: var(--s-3); color: var(--text-3); }
.spinner {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 2px solid var(--border-strong); border-top-color: var(--text-2);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading { display: flex; flex-direction: column; padding: var(--s-2) 0; }
.card > .loading { margin: 0; }
.sk-row { display: flex; align-items: center; gap: var(--s-3); height: 52px; padding: 0 var(--s-5); border-bottom: 1px solid var(--border); }
.sk-row:last-child { border-bottom: 0; }
.sk { display: block; height: 10px; border-radius: var(--r-pill); background: var(--surface-3); animation: pulse 1.1s ease-in-out infinite alternate; }
.sk-dot { width: 24px; height: 24px; border-radius: 50%; flex: none; }
.sk[data-w="1"] { width: 38%; }
.sk[data-w="2"] { width: 52%; }
.sk[data-w="3"] { width: 30%; }
.sk-end { width: 64px; margin-left: auto; }
.tile-sk { gap: var(--s-3); }
.sk-label { width: 55%; }
.sk-value { width: 70%; height: 20px; border-radius: var(--r-sm); }
.sk-sub { width: 45%; }
@keyframes pulse { from { opacity: .45; } to { opacity: 1; } }

/* ================================================================ buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: var(--ctl-md); padding: 0 var(--s-4); border-radius: var(--r-md);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: var(--fs-sm); line-height: 1; font-weight: var(--fw-medium); white-space: nowrap;
  cursor: pointer; text-decoration: none; box-shadow: var(--shadow-xs);
  transition: background-color var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}
.btn:hover { background: var(--hover); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.is-busy { cursor: progress; }
.btn-sm { height: var(--ctl-sm); padding: 0 var(--s-3); font-size: var(--fs-xs); border-radius: var(--r-sm); gap: 6px; }
.btn-sm .icon { width: 14px; height: 14px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--bad-dot); border-color: var(--bad-dot); color: #fff; }
.btn-danger:hover { background: var(--bad); border-color: var(--bad); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-danger-ghost { color: var(--bad); }
.btn-danger-ghost:hover { background: var(--bad-weak); border-color: color-mix(in srgb, var(--bad-dot) 45%, var(--border)); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: var(--ctl-md); height: var(--ctl-md); border-radius: var(--r-md);
  border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer;
  transition: background-color var(--dur-fast), color var(--dur-fast);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn-sm { width: 24px; height: 24px; border-radius: var(--r-sm); }
.icon-btn-sm .icon { width: 13px; height: 13px; }
.icon-btn-danger:hover { color: var(--bad); background: var(--bad-weak); }

.chip-btn {
  height: var(--ctl-sm); padding: 0 var(--s-3); border-radius: var(--r-pill); font-size: var(--fs-xs);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); cursor: pointer;
  transition: background-color var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.chip-btn:hover { color: var(--text); background: var(--hover); }
.chip-btn.is-on { background: var(--accent-weak); border-color: var(--accent); color: var(--accent-text); font-weight: var(--fw-semi); }

.link { color: var(--accent-text); text-decoration: none; }
.link:hover { text-decoration: underline; text-underline-offset: 2px; }
.link-strong { color: var(--text); font-weight: var(--fw-semi); text-decoration: none; }
.link-strong:hover { color: var(--accent-text); }
.link-plain { text-decoration: none; }
.link-plain:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ================================================================ form controls */

.input {
  width: 100%; height: var(--ctl-md); padding: 0 var(--s-3);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--text); font-size: var(--fs-md);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.input::placeholder { color: var(--text-3); }
.input:hover { border-color: color-mix(in srgb, var(--text-3) 60%, var(--border-strong)); }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--accent-weak); }
.input:disabled, .input[readonly] { background: var(--surface-2); color: var(--text-2); }
.textarea { height: auto; min-height: 72px; padding: var(--s-2) var(--s-3); resize: vertical; line-height: var(--lh-md); }
.select { padding-right: var(--s-8); cursor: pointer; }
input[type="date"].input, input[type="datetime-local"].input { padding-right: var(--s-2); }

.form { display: flex; flex-direction: column; gap: var(--s-4); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-span { grid-column: 1 / -1; }
.label { font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: var(--fw-medium); color: var(--text-2); }
.hint { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--text-3); }
.form-error {
  padding: var(--s-2) var(--s-3); border-radius: var(--r-md); font-size: var(--fs-sm); line-height: var(--lh-sm);
  background: var(--bad-weak); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad-dot) 40%, transparent);
}
.form-error.form-note { background: var(--warn-weak); color: var(--warn); border-color: color-mix(in srgb, var(--warn-dot) 45%, transparent); }
.form-section { display: flex; flex-direction: column; gap: var(--s-3); padding-bottom: var(--s-5); border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: 0; padding-bottom: 0; }
.form-section-title { font-size: var(--fs-sm); font-weight: var(--fw-semi); }
.quick { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.inline-form { display: flex; gap: var(--s-2); align-items: center; }
.inline-form .input { width: 120px; }

.switch { display: inline-flex; align-items: center; gap: var(--s-3); cursor: pointer; user-select: none; position: relative; min-height: var(--ctl-sm); }
.switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.switch-track { position: relative; flex: none; width: 36px; height: 20px; border-radius: var(--r-pill); background: var(--border-strong); transition: background-color var(--dur); }
.switch-thumb { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform var(--dur) var(--ease-out); }
.switch-input:checked + .switch-track { background: var(--accent); }
.switch-input:checked + .switch-track .switch-thumb { transform: translateX(16px); }
.switch-input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch-input:disabled + .switch-track { opacity: .45; }
.switch-label { font-size: var(--fs-md); }

.checks { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); }
.check { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--fs-md); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: var(--r-md); background: var(--surface-3); border: 1px solid var(--border); }
.seg {
  height: var(--ctl-sm); padding: 0 var(--s-3); border: 0; border-radius: var(--r-sm); background: transparent;
  color: var(--text-2); font-size: var(--fs-sm); font-weight: var(--fw-medium); white-space: nowrap; cursor: pointer;
  transition: background-color var(--dur-fast), color var(--dur-fast);
}
.seg:hover { color: var(--text); }
.seg[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--border); }
.segmented-icons .seg { display: inline-flex; align-items: center; gap: 6px; }
.segmented-icons .seg .icon { width: 14px; height: 14px; }

.search { position: relative; display: flex; align-items: center; flex: 1 1 280px; min-width: 0; }
.search .icon { position: absolute; left: var(--s-3); color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 36px; }

/* ================================================================ sign-in screen */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: var(--s-8) var(--s-4); }
.login-card {
  width: 100%; max-width: 400px; padding: var(--s-10) var(--s-8) var(--s-8); border-radius: var(--r-xl);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.brand-login { flex-direction: column; justify-content: center; gap: var(--s-3); padding: 0; margin-bottom: var(--s-5); font-size: var(--fs-sm); color: var(--text-3); }
.brand-login .brand-mark { width: 56px; height: 56px; border-radius: var(--r-xl); }
.login-title { font-size: var(--fs-xl); line-height: var(--lh-xl); font-weight: var(--fw-bold); letter-spacing: -.015em; text-align: center; text-wrap: balance; }
.login-sub { color: var(--text-3); margin: var(--s-1) auto var(--s-6); font-size: var(--fs-sm); line-height: var(--lh-sm); text-align: center; max-width: 32ch; }
.login-form .form-error { text-align: center; }
.login-form .btn { height: var(--ctl-lg); }
.login-card > .error-state { padding: var(--s-2) 0; }
.offline-card .brand-login { justify-content: center; }

/* ================================================================ shell */

.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: var(--s-2);
  padding: var(--s-3); background: var(--bg); border-right: 1px solid var(--border); overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin;
}
.sidebar-head { display: flex; align-items: center; gap: var(--s-2); height: 44px; padding: 0 var(--s-1) 0 var(--s-2); }
.brand { display: flex; align-items: center; gap: var(--s-3); min-width: 0; flex: 1; text-decoration: none; border-radius: var(--r-md); }
.brand-mark {
  width: 30px; height: 30px; border-radius: var(--r-md); display: grid; place-items: center; flex: none;
  background: var(--text); color: var(--bg);
}
.mark-svg { width: 62%; height: 62%; display: block; }
.mark-svg path { stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; }
.mark-svg circle { fill: currentColor; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-size: var(--fs-md); line-height: 18px; font-weight: var(--fw-bold); letter-spacing: -.01em; white-space: nowrap; }
.brand-tag { font-size: 11px; line-height: 14px; color: var(--text-3); font-weight: var(--fw-medium); }
.rail-btn { width: 30px; height: 30px; color: var(--text-3); }

.nav { display: flex; flex-direction: column; gap: var(--s-4); padding-top: var(--s-2); }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-section {
  padding: 0 var(--s-3) var(--s-1); font-size: 11px; line-height: var(--lh-xs); font-weight: var(--fw-semi);
  letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); white-space: nowrap;
}
.nav-link {
  position: relative; display: flex; align-items: center; gap: var(--s-3); height: 34px; padding: 0 var(--s-3);
  border-radius: var(--r-md); color: var(--text-2); text-decoration: none; font-size: var(--fs-sm); font-weight: var(--fw-medium);
  border: 1px solid transparent; transition: background-color var(--dur-fast), color var(--dur-fast);
}
.nav-link .icon { color: var(--text-3); transition: color var(--dur-fast); }
.nav-link:hover { background: var(--hover); color: var(--text); }
.nav-link:hover .icon { color: var(--text-2); }
.nav-link:focus-visible { outline-offset: -2px; border-radius: var(--r-md); }
.nav-link.active { background: var(--surface); color: var(--text); font-weight: var(--fw-semi); border-color: var(--border); box-shadow: var(--shadow-xs); }
.nav-link.active .icon { color: var(--accent-text); }
.nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill);
  background: var(--warn-weak); color: var(--warn); font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums;
}

.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: var(--s-1); padding-top: var(--s-3); border-top: 1px solid var(--border); }
.nav-user {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--s-3); height: 44px; padding: 0 var(--s-2);
  border: 0; border-radius: var(--r-md); background: transparent; text-align: left; cursor: pointer;
  transition: background-color var(--dur-fast);
}
.nav-user:hover { background: var(--hover); }
.nav-user-text { display: flex; flex-direction: column; min-width: 0; }
.nav-user-name { font-size: var(--fs-sm); line-height: 18px; font-weight: var(--fw-semi); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-user-email { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-signout { color: var(--text-3); }

.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--surface-3); border: 1px solid var(--border); color: var(--text-2); font-size: var(--fs-xs); font-weight: var(--fw-bold);
}
.avatar-lg { width: 48px; height: 48px; font-size: var(--fs-xl); }

/* Rail: icons only. Chosen at ≥1100px, automatic from 761 to 1099px. */
@media (min-width: 761px) {
  .shell.is-rail { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .is-rail .sidebar { padding: var(--s-3) var(--s-2); align-items: center; }
  .is-rail .sidebar-head { flex-direction: column; height: auto; gap: var(--s-2); padding: 0; }
  .is-rail .brand { flex: none; }
  .is-rail .brand-text, .is-rail .nav-label, .is-rail .nav-user-text, .is-rail .nav-signout { display: none; }
  .is-rail .rail-btn .icon { transform: scaleX(-1); }
  .is-rail .nav { width: 100%; align-items: center; }
  .is-rail .nav-group { align-items: center; gap: 2px; width: 100%; }
  .is-rail .nav-section { width: 24px; height: 1px; padding: 0; margin: 0 auto var(--s-2); background: var(--border); font-size: 0; overflow: hidden; }
  .is-rail .nav-group:first-child .nav-section { display: none; }
  .is-rail .nav-link { width: 40px; height: 40px; padding: 0; justify-content: center; }
  .is-rail .nav-link .icon { width: 18px; height: 18px; }
  .is-rail .nav-count { position: absolute; top: 4px; right: 4px; min-width: 8px; width: 8px; height: 8px; padding: 0; font-size: 0; background: var(--warn-dot); box-shadow: 0 0 0 2px var(--bg); }
  .is-rail .sidebar-foot { width: 100%; justify-content: center; }
  .is-rail .nav-user { flex: none; width: 40px; justify-content: center; padding: 0; }
}
@media (min-width: 761px) and (max-width: 1099px) {
  .shell { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .sidebar { padding: var(--s-3) var(--s-2); align-items: center; }
  .sidebar-head { flex-direction: column; height: auto; gap: var(--s-2); padding: 0; }
  .brand { flex: none; }
  .brand-text, .nav-label, .nav-user-text, .nav-signout, .rail-btn { display: none; }
  .nav { width: 100%; align-items: center; }
  .nav-group { align-items: center; width: 100%; }
  .nav-section { width: 24px; height: 1px; padding: 0; margin: 0 auto var(--s-2); background: var(--border); font-size: 0; overflow: hidden; }
  .nav-group:first-child .nav-section { display: none; }
  .nav-link { width: 40px; height: 40px; padding: 0; justify-content: center; }
  .nav-link .icon { width: 18px; height: 18px; }
  .nav-count { position: absolute; top: 4px; right: 4px; min-width: 8px; width: 8px; height: 8px; padding: 0; font-size: 0; background: var(--warn-dot); box-shadow: 0 0 0 2px var(--bg); }
  .sidebar-foot { width: 100%; justify-content: center; }
  .nav-user { flex: none; width: 40px; justify-content: center; padding: 0; }
}

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h);
  background: var(--bg); border-bottom: 1px solid var(--border);
  padding-inline: var(--gutter);
}
/* The top bar lines up with the page's content column. */
.topbar-inner { height: 100%; max-width: var(--content-max); margin: 0 auto; display: flex; align-items: center; gap: var(--s-3); }
.main:has(.view[data-width="narrow"]) .topbar-inner { max-width: var(--content-narrow); }
.crumbs { display: flex; align-items: center; gap: var(--s-2); min-width: 0; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.crumb { color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb-link { color: var(--text-2); text-decoration: none; border-radius: var(--r-xs); }
.crumb-link:hover { color: var(--text); }
.crumb-current { color: var(--text); font-weight: var(--fw-semi); }
.crumb-sep { color: var(--border-strong); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--s-1); }
.account-btn { border-radius: 50%; }
.appbar-mark { display: none; }

.live-pill {
  display: inline-flex; align-items: center; gap: var(--s-2); height: var(--ctl-sm); padding: 0 var(--s-3); margin-right: var(--s-1);
  border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface);
  font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-2);
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.live-live .live-dot { background: var(--good-dot); box-shadow: 0 0 0 3px var(--good-weak); }
.live-connecting .live-dot, .live-retry .live-dot { background: var(--warn-dot); }
.live-retry { color: var(--warn); }

.offline-bar {
  display: none; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--gutter); font-size: var(--fs-sm);
  background: var(--warn-weak); color: var(--warn); border-bottom: 1px solid var(--border);
}
.offline-bar .live-dot { background: var(--warn-dot); }
.is-offline .offline-bar { display: flex; }

/* Content: centred column, one gutter, a wide and a narrow measure. */
.view {
  width: 100%; max-width: calc(var(--content-max) + 2 * var(--gutter)); margin: 0 auto;
  padding: var(--s-8) var(--gutter) var(--s-16);
  display: flex; flex-direction: column; gap: var(--s-6); outline: none;
  container-type: inline-size; container-name: view;
}
.view[data-width="narrow"] { max-width: calc(var(--content-narrow) + 2 * var(--gutter)); }
.view > * { animation: rise var(--dur-slow) var(--ease-out) backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.tabbar { display: none; }

/* ================================================================ page header, toolbar */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.page-head > div:first-child { min-width: 0; }
.page-title { font-size: var(--fs-2xl); line-height: var(--lh-2xl); font-weight: var(--fw-bold); letter-spacing: -.02em; }
.page-sub { margin-top: var(--s-1); color: var(--text-3); font-size: var(--fs-md); line-height: var(--lh-md); max-width: 72ch; }
.page-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }

.toolbar { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; margin-bottom: calc(-1 * var(--s-2)); }
.toolbar > .select { width: auto; min-width: 160px; }
.filter-pill {
  display: inline-flex; align-items: center; gap: var(--s-1); height: var(--ctl-sm); padding: 0 var(--s-1) 0 var(--s-3);
  border-radius: var(--r-pill); background: var(--accent-weak); color: var(--accent-text); font-size: var(--fs-xs); font-weight: var(--fw-medium);
}
.filter-pill .icon-btn { color: inherit; }

/* ================================================================ cards */

.card { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap;
  min-height: 56px; padding: var(--s-3) var(--s-5); border-bottom: 1px solid var(--border);
}
.card-title { font-size: var(--fs-md); line-height: var(--lh-md); font-weight: var(--fw-semi); }
.card-actions { display: flex; gap: var(--s-2); align-items: center; }
.card > :not(.card-head) { margin: var(--s-5); }
.card > .table-wrap, .card > .loading { margin: 0; }
.card > :not(.card-head):has(> .table-wrap, > .loading) { margin: 0; }
.card > .table-wrap + .pager, .card > .table-wrap + .table-foot { margin-top: 0; }
.card-section { display: flex; flex-direction: column; gap: var(--s-3); padding-top: var(--s-4); border-top: 1px solid var(--border); }
.card-text { color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); max-width: 72ch; }
.title-with-dot { display: inline-flex; align-items: center; gap: var(--s-2); }
.count-badge {
  min-width: 22px; height: 20px; padding: 0 7px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: var(--fw-semi);
  background: var(--surface-3); color: var(--text-2); text-align: center; line-height: 20px; font-variant-numeric: tabular-nums;
}

/* Page grids collapse by the content column's width, not the window's. */
.grid-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--s-4); align-items: start; }
.grid-1-1 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); align-items: start; }
.grid-user { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); align-items: start; }
@container view (max-width: 960px) { .grid-2-1, .grid-user { grid-template-columns: minmax(0, 1fr); } }
@container view (max-width: 760px) { .grid-1-1 { grid-template-columns: minmax(0, 1fr); } }

/* ================================================================ stat tiles */

.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s-4); }
.tile-unit { margin-left: 6px; font-size: var(--fs-sm); font-weight: var(--fw-medium); letter-spacing: 0; color: var(--text-3); }
.tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles > .error-state { grid-column: 1 / -1; }
@container view (max-width: 1100px) { .tiles { gap: var(--s-3); } .tiles .tile { padding: var(--s-4); } .tile-money { font-size: 20px; } }
@container view (max-width: 860px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container view (max-width: 620px) { .tiles-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.tile {
  display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; padding: var(--s-5);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs);
  text-decoration: none; color: inherit; transition: border-color var(--dur-fast);
}
.tile-link:hover { border-color: var(--border-strong); }
.tile-label { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: var(--fw-medium); color: var(--text-2); }
.tile-value { margin-top: var(--s-1); font-size: 28px; line-height: var(--lh-3xl); font-weight: var(--fw-bold); letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile-money { font-size: 22px; line-height: 30px; }
.tile-sub { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--text-3); }
.tile-live { width: 7px; height: 7px; }

/* ================================================================ badges, dots, chips */

.badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 var(--s-2); border-radius: var(--r-sm);
  font-size: var(--fs-xs); font-weight: var(--fw-semi); white-space: nowrap; vertical-align: middle;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border);
}
.badge-good { background: var(--good-weak); color: var(--good); border-color: transparent; }
.badge-warn { background: var(--warn-weak); color: var(--warn); border-color: transparent; }
.badge-bad { background: var(--bad-weak); color: var(--bad); border-color: transparent; }
.badge-accent { background: var(--accent-weak); color: var(--accent-text); border-color: transparent; }
.badge-muted { background: transparent; color: var(--text-3); }
.badges { display: flex; flex-wrap: wrap; gap: var(--s-1); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--border-strong); }
.dot-online { background: var(--good-dot); box-shadow: 0 0 0 3px var(--good-weak); }
.dot-offline { background: transparent; box-shadow: inset 0 0 0 1.5px var(--border-strong); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; min-height: 24px; padding: 2px 10px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); line-height: var(--lh-xs); border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.chip-off { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.chips-small .chip { min-height: 22px; font-size: 11.5px; padding: 2px var(--s-2); }
.kind { font-size: 11px; line-height: var(--lh-xs); color: var(--text-3); background: var(--surface-3); padding: 0 6px; border-radius: var(--r-xs); }

/* ================================================================ tables */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); line-height: var(--lh-sm); font-variant-numeric: tabular-nums; }
.table th {
  height: 40px; padding: 0 var(--s-4); text-align: left; white-space: nowrap;
  font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-3);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.card > .table-wrap:first-child thead th:first-child, .card > div:first-child > .table-wrap:first-child thead th:first-child { border-top-left-radius: calc(var(--r-lg) - 1px); }
.card > .table-wrap:first-child thead th:last-child, .card > div:first-child > .table-wrap:first-child thead th:last-child { border-top-right-radius: calc(var(--r-lg) - 1px); }
.table th:first-child, .table td:first-child { padding-left: var(--s-5); }
.table th:last-child, .table td:last-child { padding-right: var(--s-5); }
.table td { height: 52px; padding: var(--s-2) var(--s-4); border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-compact td { height: 44px; }
.table .num { text-align: right; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions > * + * { margin-left: 6px; }
.table tbody tr { transition: background-color var(--dur-fast); }
.table tbody tr:hover td { background: var(--surface-2); }
.row-link { cursor: pointer; }
.row-group th, .row-group td { height: 36px; background: var(--surface-2); font-size: var(--fs-xs); color: var(--text-2); font-weight: var(--fw-semi); text-align: left; }
.row-group td.num { text-align: right; color: var(--text); }
.row-total td { font-weight: var(--fw-semi); background: var(--surface-2); }
.cell-user { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.cell-sub { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--text-3); }
.clamp { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-foot { padding: var(--s-3) var(--s-5); border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-3); margin: 0 !important; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-5); border-top: 1px solid var(--border); font-size: var(--fs-xs); margin: 0 !important; }
.pager-btns { display: flex; gap: var(--s-2); }

/* Wide windows: headers stay in view while a long table scrolls (narrower ones scroll tables sideways). */
@media (min-width: 1440px) {
  .card .table-wrap:not(.table-wrap-cards), .card .table-wrap-cards { overflow: visible; }
  .card .table-wrap .table thead th { position: sticky; top: var(--topbar-h); z-index: 2; }
}

/* ================================================================ empty, error */

.empty, .error-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-2); padding: var(--s-12) var(--s-6); }
.empty-icon { width: 44px; height: 44px; margin-bottom: var(--s-2); border-radius: var(--r-lg); display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); }
.empty-icon .icon { width: 20px; height: 20px; }
.error-state .empty-icon { background: var(--bad-weak); color: var(--bad); }
.empty-title { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: var(--fw-semi); }
.empty-text { color: var(--text-3); font-size: var(--fs-sm); line-height: var(--lh-sm); max-width: 48ch; }
.empty .btn, .error-state .btn { margin-top: var(--s-3); }

/* ================================================================ dashboard */

.chart { display: flex; flex-direction: column; gap: var(--s-3); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4); font-size: var(--fs-xs); color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-note { margin-left: auto; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: none; }
.swatch-1 { background: var(--series-1); }
.swatch-2 { background: var(--series-2); }
.swatch-line { width: 14px; height: 2px; border-radius: 1px; background: var(--series-3); }
.chart-stage { position: relative; }
.chart-svg { display: block; overflow: visible; }
.chart-svg .grid { stroke: var(--grid); stroke-width: 1; }
.chart-svg .axis-base { stroke: var(--baseline); stroke-width: 1; }
.chart-svg .axis-label { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-svg .bar-1 { fill: var(--series-1); }
.chart-svg .bar-2 { fill: var(--series-2); }
.chart-svg .line-profit { fill: none; stroke: var(--series-3); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .dot-profit { fill: var(--series-3); stroke: var(--surface); stroke-width: 2; }
.chart-svg .hover-band { fill: var(--hover-band); }
.chart-svg .hit { fill: transparent; cursor: default; }
.chart-svg .hit:focus { outline: none; }
.chart-svg .hit:focus-visible { stroke: var(--focus); stroke-width: 2; }
.chart-tip {
  position: absolute; width: 220px; padding: var(--s-3); border-radius: var(--r-md); pointer-events: none;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); font-size: var(--fs-xs);
}
.tip-title { font-weight: var(--fw-semi); margin-bottom: 6px; font-size: var(--fs-sm); }
.tip-row { display: flex; align-items: center; gap: var(--s-2); line-height: 22px; }
.tip-label { color: var(--text-2); }
.tip-value { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: var(--fw-semi); }
.chart-sum { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-5); padding-top: var(--s-3); border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-2); }
.chart-sum strong { color: var(--text); font-weight: var(--fw-semi); font-variant-numeric: tabular-nums; }
.chart-sum strong.tone-bad { color: var(--bad); }

.hbars { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--s-4); }
.hbar-label { display: flex; justify-content: space-between; gap: var(--s-2); margin-bottom: 6px; font-size: var(--fs-sm); }
.hbar-value { font-weight: var(--fw-semi); font-variant-numeric: tabular-nums; }
.hbar-track { height: 8px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.hbar-fill { display: block; height: 100%; min-width: 2px; border-radius: var(--r-pill); background: var(--series-1); }
.hbar-foot { margin-top: var(--s-4); font-size: var(--fs-xs); line-height: var(--lh-xs); }

.people, .events, .crashes { list-style: none; padding: 0; margin: 0; }
.person { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) 0; border-bottom: 1px solid var(--border); }
.person:first-child { padding-top: 0; }
.person:last-child { border-bottom: 0; padding-bottom: 0; }
.person-main { min-width: 0; flex: 1; }
.person-line { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; font-size: var(--fs-sm); }
.person-meta { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-time { font-size: var(--fs-xs); color: var(--text-3); }

.event { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) 0; border-bottom: 1px solid var(--border); }
.event:first-child { padding-top: 0; }
.event:last-child { border-bottom: 0; padding-bottom: 0; }
.event-mark { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; flex: none; background: var(--border-strong); }
.event-good { background: var(--good-dot); }
.event-warn { background: var(--warn-dot); }
.event-bad { background: var(--bad-dot); }
.event-main { flex: 1; min-width: 0; }
.event-text { font-size: var(--fs-sm); line-height: var(--lh-sm); overflow-wrap: anywhere; }
.event-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-3); margin-top: 2px; font-size: var(--fs-xs); color: var(--text-3); }
.event-time { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
.event-fresh .event-text { animation: rise var(--dur-slow) var(--ease-out) backwards; }

/* ================================================================ user page */

.user-head { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; }
.user-head-main { flex: 1; min-width: 220px; }
.user-head-meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2) var(--s-3); margin-top: 2px; color: var(--text-2); font-size: var(--fs-sm); }
.inline-status { display: inline-flex; align-items: center; gap: var(--s-2); }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s-3) var(--s-5); margin: 0; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv-compact { gap: var(--s-2) var(--s-4); font-size: var(--fs-xs); }
.note { padding: var(--s-3); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.note-text { margin-top: var(--s-1); white-space: pre-wrap; font-size: var(--fs-sm); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.btn-row-label { min-width: 52px; margin-right: var(--s-1); font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--text-2); }
.ent-head { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }

.crash { border-bottom: 1px solid var(--border); }
.crash:last-child { border-bottom: 0; }
.crash-sum { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-1) var(--s-4); padding: var(--s-3) 0; cursor: pointer; list-style: none; border-radius: var(--r-xs); }
.crash-sum::-webkit-details-marker { display: none; }
.crash-sum::before { content: "›"; width: 10px; display: inline-block; color: var(--text-3); transition: transform var(--dur-fast); }
details[open] > .crash-sum::before { transform: rotate(90deg); }
.crash-msg { flex: 1 1 320px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-xs); }
.crash-meta { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); font-size: var(--fs-xs); color: var(--text-3); }
.crash-pre {
  margin: 0 0 var(--s-2); padding: var(--s-3) var(--s-4); max-height: 420px; overflow: auto; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border); font-size: var(--fs-xs); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
}
.crash-foot { display: flex; align-items: center; justify-content: space-between; padding-bottom: var(--s-3); }

/* ================================================================ plans */

.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s-4); }
.plan-card {
  display: flex; flex-direction: column; gap: var(--s-4); padding: var(--s-6);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs);
}
.plan-inactive { background: var(--surface-2); }
.plan-inactive .plan-name { color: var(--text-2); }
.plan-top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-3); }
.plan-name { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: var(--fw-bold); letter-spacing: -.01em; }
.plan-slug { font-size: var(--fs-xs); color: var(--text-3); }
.plan-badges { display: flex; flex-wrap: wrap; gap: var(--s-1); justify-content: flex-end; }
.plan-desc { color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.plan-price { padding-bottom: var(--s-4); border-bottom: 1px solid var(--border); }
.plan-amount { font-size: var(--fs-2xl); line-height: var(--lh-2xl); font-weight: var(--fw-bold); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.plan-foot { margin-top: auto; display: flex; justify-content: flex-end; padding-top: var(--s-1); }

.features { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.feature { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.feature-list { border: 0; padding: 0; margin: 0; grid-column: 1 / -1; }
.feature-list legend { padding: 0; margin-bottom: var(--s-2); }

/* ================================================================ settings */

.setting { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; padding: var(--s-4) 0; border-bottom: 1px solid var(--border); }
.card > .setting { margin-top: 0; margin-bottom: 0; }
.card > .setting:last-child { border-bottom: 0; }
.setting-text { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.setting > .select { width: auto; max-width: 360px; }
.copy-row { display: flex; flex-direction: column; gap: 6px; }
.copy-box { display: flex; align-items: center; gap: var(--s-2); }
.copy-value {
  flex: 1; min-width: 0; padding: var(--s-2) var(--s-3); border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border); font-size: var(--fs-xs); line-height: var(--lh-xs); overflow-wrap: anywhere; user-select: all;
}
.secret { font-size: var(--fs-sm); }
.callout { padding: var(--s-3); margin-bottom: var(--s-3); border-radius: var(--r-md); font-size: var(--fs-sm); line-height: var(--lh-sm); border: 1px solid; }
.callout-warn { background: var(--warn-weak); border-color: color-mix(in srgb, var(--warn-dot) 45%, transparent); color: var(--text); }

/* ================================================================ user picker */

.picker { position: relative; }
.picker-list {
  list-style: none; margin: var(--s-1) 0 0; padding: var(--s-1); max-height: 280px; overflow: auto;
  border-radius: var(--r-md); border: 1px solid var(--border-strong); background: var(--surface); box-shadow: var(--shadow-lg);
}
.picker-item { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: var(--s-2) var(--s-3); border: 0; border-radius: var(--r-sm); background: transparent; text-align: left; cursor: pointer; font-size: var(--fs-sm); }
.picker-item:hover, .picker-item:focus { background: var(--hover); outline: none; }
.picker-empty { padding: var(--s-3); color: var(--text-3); font-size: var(--fs-sm); }
.picked { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); border: 1px solid var(--border-strong); border-radius: var(--r-md); }
.picked-main { flex: 1; min-width: 0; }

/* ================================================================ dialogs */

.dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0;
  border-radius: var(--r-xl); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: pop var(--dur) var(--ease-out);
}
.dialog:not([open]) { display: none; }
.dialog-wide { width: min(780px, calc(100vw - 32px)); }
.dialog-menu { width: min(420px, calc(100vw - 32px)); }
.dialog::backdrop { background: var(--scrim); animation: fade-in var(--dur) ease-out; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-3); padding: var(--s-5) var(--s-5) var(--s-3) var(--s-6); }
.dialog-head .icon-btn { margin-top: -4px; }
.dialog-title { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: var(--fw-bold); letter-spacing: -.01em; }
.dialog-desc { margin-top: 2px; font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--text-3); }
.dialog-body { padding: var(--s-1) var(--s-6) var(--s-6); overflow-y: auto; }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-4) var(--s-6); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.confirm-body { color: var(--text-2); font-size: var(--fs-md); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }

/* The "More" and account sheets. */
.more-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
.more-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-2); min-height: 92px; padding: var(--s-3) var(--s-2);
  border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  text-decoration: none; font-size: var(--fs-sm); font-weight: var(--fw-semi); text-align: center;
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast);
}
.more-item:hover { border-color: var(--border-strong); }
.more-item:active { transform: scale(.96); }
.more-icon { width: 40px; height: 40px; border-radius: var(--r-lg); display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }
.more-icon .icon { width: 20px; height: 20px; }
.more-item.active { border-color: var(--accent); }
.more-item.active .more-icon { background: var(--accent-weak); border-color: transparent; color: var(--accent-text); }
.account-head { display: flex; align-items: center; gap: var(--s-3); padding-bottom: var(--s-2); }
.account-who { min-width: 0; overflow-wrap: anywhere; }
.account-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; padding: var(--s-1) 0 var(--s-2); }

/* ================================================================ toasts */

.toasts { position: fixed; right: var(--s-6); bottom: var(--s-6); z-index: 100; display: flex; flex-direction: column; gap: var(--s-2); max-width: calc(100vw - 48px); }
.toast {
  display: flex; align-items: center; gap: var(--s-3); width: 380px; max-width: 100%; padding: var(--s-3) var(--s-2) var(--s-3) var(--s-4);
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); font-size: var(--fs-sm); line-height: var(--lh-sm);
  animation: pop var(--dur) var(--ease-out);
}
.toast-text { flex: 1; min-width: 0; }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--accent); }
.toast-success .toast-dot { background: var(--good-dot); }
.toast-error .toast-dot { background: var(--bad-dot); }
.toast-error { border-color: color-mix(in srgb, var(--bad-dot) 50%, var(--border-strong)); }
.toast-action { flex: none; }
.toast-close { width: 28px; height: 28px; }
.toast-leaving { opacity: 0; transform: translateY(4px); transition: opacity var(--dur-slow), transform var(--dur-slow); }

/* ================================================================ system: version, update, backup */

.sys-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); }
.sys-fact { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; }
.sys-fact-k { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--text-3); }
.sys-fact-v { font-size: var(--fs-md); font-weight: var(--fw-semi); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sys-cmd { display: inline-block; margin-top: var(--s-3); padding: 6px var(--s-3); border-radius: var(--r-sm); background: var(--surface-3); border: 1px solid var(--border); }
.sys-banner { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); }
.sys-banner-dot { flex: none; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--text-3); }
.sys-banner[data-tone="good"] .sys-banner-dot { background: var(--good-dot); }
.sys-banner[data-tone="warn"] .sys-banner-dot { background: var(--warn-dot); }
.sys-banner[data-tone="bad"] { border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); background: var(--bad-weak); }
.sys-banner[data-tone="bad"] .sys-banner-dot { background: var(--bad-dot); }
.sys-banner[data-tone="info"] .sys-banner-dot { background: var(--accent); }
.sys-banner-t { font-weight: var(--fw-semi); font-size: var(--fs-md); }
.sys-banner-x { margin-top: 2px; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.sys-progress { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); }
.sys-progress-top { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); }
.sys-progress-msg { display: inline-flex; align-items: center; gap: var(--s-3); font-weight: var(--fw-semi); font-size: var(--fs-md); }
.sys-progress-pct { font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; }
.sys-bar { height: 8px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.sys-fill { height: 100%; border-radius: inherit; background: var(--accent); transition: width .6s var(--ease-sheet); }
.sys-steps { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); list-style: none; margin: 0; padding: 0; }
.sys-step { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-3); }
.sys-step i { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--border-strong); }
.sys-step[data-s="done"] { color: var(--text-2); }
.sys-step[data-s="done"] i { background: var(--good-dot); border-color: var(--good-dot); }
.sys-step[data-s="now"] { color: var(--text); font-weight: var(--fw-semi); }
.sys-step[data-s="now"] i { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.sys-elapsed { font-size: var(--fs-xs); }
.sys-sub { margin-bottom: 6px; font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--text-3); }
.sys-commits { display: flex; flex-direction: column; }
.sys-commit { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s-3); align-items: baseline; padding: var(--s-2) 0; border-top: 1px solid var(--border); font-size: var(--fs-sm); }
.sys-commit-s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sys-commit-d { font-size: var(--fs-xs); white-space: nowrap; }
.sys-log summary { cursor: pointer; font-size: var(--fs-xs); color: var(--text-2); }
.sys-log pre { margin-top: var(--s-2); max-height: 280px; overflow: auto; padding: var(--s-3); border-radius: var(--r-md); background: var(--surface-3); border: 1px solid var(--border); font-size: 11.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
@container view (max-width: 640px) { .sys-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ================================================================ announcements, releases */

.kind-tile { flex: none; width: 36px; height: 36px; border-radius: var(--r-lg); display: grid; place-items: center; color: var(--accent-text); background: color-mix(in srgb, var(--accent) 13%, transparent); }
.kind-tile .icon { width: 17px; height: 17px; }
.kind-tile[data-kind="update"] { color: var(--good); background: color-mix(in srgb, var(--good) 13%, transparent); }
.kind-tile[data-kind="warning"] { color: var(--warn); background: color-mix(in srgb, var(--warn-dot) 16%, transparent); }
.kind-tile[data-kind="offer"] { color: var(--violet); background: color-mix(in srgb, var(--violet) 14%, transparent); }

.ann-list { list-style: none; margin: 0; padding: 0; }
.ann-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: var(--s-2) var(--s-4); align-items: center; padding: var(--s-4) 0; border-bottom: 1px solid var(--border); }
.ann-row:first-child { padding-top: 0; }
.ann-row:last-child { border-bottom: 0; padding-bottom: 0; }
.ann-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ann-title { font-weight: var(--fw-semi); font-size: var(--fs-md); overflow-wrap: anywhere; }
.ann-excerpt { color: var(--text-2); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ann-meta { display: flex; flex-wrap: wrap; gap: 2px var(--s-4); margin-top: 2px; font-size: var(--fs-xs); color: var(--text-3); }
.ann-aud { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); }
.ann-aud .icon { width: 13px; height: 13px; }
.ann-side { display: flex; flex-direction: column; align-items: flex-end; gap: var(--s-1); }
.ann-reads { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ann-actions { display: flex; align-items: center; gap: var(--s-1); }

/* Composer: the form beside a preview of the app's own card (always its dark look). */
.compose { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--s-6); align-items: start; }
.compose-form { display: flex; flex-direction: column; gap: var(--s-4); min-width: 0; }
.compose-preview { position: sticky; top: 0; display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.pv-stage { display: grid; place-items: center; min-height: 280px; padding: var(--s-6) var(--s-4); border-radius: var(--r-lg); background: #0a0a0a; border: 1px solid var(--border); }
.pv-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 10px; padding: 20px 20px 18px; border-radius: 14px; background: #141414; color: #fafafa; box-shadow: inset 0 0 0 1px #ffffff1a, 0 12px 40px #000000a0; }
.pv-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 2px; }
.pv-ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; color: #5c8fff; background: #5c8fff24; }
.pv-ic .icon { width: 21px; height: 21px; }
.pv-ic[data-kind="update"] { color: #4ade80; background: #4ade8024; }
.pv-ic[data-kind="warning"] { color: #fbbf24; background: #fbbf2426; }
.pv-ic[data-kind="offer"] { color: #af87ff; background: #af87ff26; }
.pv-x { width: 28px; height: 28px; display: grid; place-items: center; color: #858585; }
.pv-x .icon { width: 15px; height: 15px; }
.pv-title { font-size: 18px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; overflow-wrap: anywhere; }
.pv-date { font-size: 11.5px; color: #858585; margin-top: -4px; }
.pv-body { display: flex; flex-direction: column; gap: 8px; font-size: 13px; line-height: 1.65; color: #a1a1a1; }
.pv-body p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.pv-empty { color: #686868; }
.pv-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.pv-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px; background: #ffffff12; color: #fafafa; font-size: 12.5px; font-weight: 600; }
.pv-btn .icon { width: 14px; height: 14px; }
.pv-btn-primary { background: #5c8fff; color: #ffffff; }
.pv-note { text-align: center; }

.rel-hero { display: flex; flex-direction: column; gap: var(--s-4); padding: var(--s-6); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.rel-hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-3); flex-wrap: wrap; }
.rel-kicker { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--text-3); }
.rel-version { margin-top: var(--s-1); font-size: var(--fs-3xl); line-height: var(--lh-3xl); font-weight: var(--fw-bold); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.rel-sub { margin-top: 2px; color: var(--text-2); font-size: var(--fs-sm); }
.rel-hero-empty { gap: var(--s-1); }
.rel-notes { margin: 0; padding: var(--s-4) 0 0 var(--s-5); display: flex; flex-direction: column; gap: var(--s-1); border-top: 1px solid var(--border); font-size: var(--fs-sm); line-height: 22px; color: var(--text-2); }
.rel-notes li { overflow-wrap: anywhere; }
.rel-v { font-variant-numeric: tabular-nums; }
.sha { display: inline-flex; align-items: center; gap: var(--s-1); }
.sha code { font-size: var(--fs-xs); color: var(--text-2); }

.drop {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-2);
  padding: var(--s-8) var(--s-4); border-radius: var(--r-lg); border: 1.5px dashed var(--border-strong); background: var(--surface-2);
  text-align: center; cursor: pointer; transition: border-color var(--dur-fast), background-color var(--dur-fast);
}
.drop:hover { border-color: var(--text-3); }
.drop:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.drop-over { border-color: var(--accent); background: var(--accent-weak); }
.drop-has { border-style: solid; }
.drop-icon { width: 24px; height: 24px; color: var(--text-3); }
.drop-text { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-sm); overflow-wrap: anywhere; }
.drop-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ================================================================ grant a license, edit sign-in */

.lic { display: flex; flex-direction: column; }
.lic-step { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-5) 0; border-bottom: 1px solid var(--border); }
.lic-step:first-child { padding-top: var(--s-1); }
.lic-step-title { display: flex; align-items: center; gap: var(--s-3); margin: 0; font-size: var(--fs-md); font-weight: var(--fw-semi); }
.lic-step-n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent-weak); color: var(--accent-text); font-size: var(--fs-xs); font-weight: 700; font-variant-numeric: tabular-nums; }
.lic-step-n .icon { width: 12px; height: 12px; }
.lic-who { display: flex; align-items: center; gap: var(--s-3); min-height: 56px; padding: var(--s-3); border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); font-size: var(--fs-sm); }
.lic-who[data-kind="existing"] { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.lic-who[data-kind="new"] { border-color: color-mix(in srgb, var(--good) 40%, var(--border)); background: var(--good-weak); }
.lic-who[data-kind="invalid"], .lic-who[data-kind="error"] { color: var(--bad); }
.lic-who-text { min-width: 0; overflow-wrap: anywhere; }
.lic-who-ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--good-dot); color: #fff; }
.lic-who-ic .icon { width: 14px; height: 14px; stroke-width: 2.4; }
.lic-new { display: flex; flex-direction: column; gap: var(--s-2); }
.lic-pw-hint { margin: 0; }
.lic-plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--s-3); }
.lic-plan {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; padding: var(--s-4);
  border-radius: var(--r-lg); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); text-align: left; cursor: pointer;
  transition: border-color var(--dur-fast), background-color var(--dur-fast);
}
.lic-plan:hover { border-color: var(--text-3); }
.lic-plan.is-on { border-color: var(--accent); background: var(--accent-weak); box-shadow: 0 0 0 1px var(--accent); }
.lic-plan.is-inactive:not(.is-on) { background: var(--surface-2); }
.lic-plan-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); width: 100%; }
.lic-plan-name { font-weight: var(--fw-bold); font-size: var(--fs-md); }
.lic-check { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent); color: var(--on-accent); }
.lic-check .icon { width: 12px; height: 12px; stroke-width: 3; }
.lic-plan-price { font-size: var(--fs-sm); font-weight: var(--fw-semi); font-variant-numeric: tabular-nums; }
.lic-plan-meta { font-size: var(--fs-xs); color: var(--text-3); }
.lic-plan .chips { margin-top: 2px; }
.lic-seg, .signin-seg { align-self: flex-start; }
.lic-add { display: flex; flex-direction: column; gap: var(--s-3); }
.lic-custom { display: flex; align-items: center; gap: var(--s-3); }
.lic-custom .input { width: 160px; }
.lic-until .input { max-width: 240px; }
.lic-end { display: flex; align-items: flex-start; flex-wrap: wrap; gap: var(--s-2); padding: var(--s-3); border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-2); }
.lic-end > .icon { color: var(--good); margin-top: 2px; }
.lic-end strong { color: var(--text); }
.lic-end-note { flex-basis: 100%; padding-left: var(--s-6); color: var(--warn); font-size: var(--fs-xs); }
.lic-end-warn { border-color: var(--warn-dot); }
.lic-summary {
  position: sticky; bottom: calc(-1 * var(--s-6)); z-index: 1; display: flex; align-items: flex-start; gap: var(--s-3);
  margin: var(--s-1) calc(-1 * var(--s-6)) calc(-1 * var(--s-6)); padding: var(--s-3) var(--s-6);
  background: var(--surface); border-top: 1px solid var(--border); font-size: var(--fs-sm); line-height: var(--lh-sm); overflow-wrap: anywhere;
}
.lic-summary-ic { width: 28px; height: 28px; border-radius: var(--r-md); display: grid; place-items: center; flex: none; background: var(--accent-weak); color: var(--accent-text); }
.lic-summary-ic .icon { width: 14px; height: 14px; }

.signin { display: flex; flex-direction: column; gap: var(--s-4); }
.signin-id { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.signin-ic { width: 40px; height: 40px; border-radius: var(--r-lg); display: grid; place-items: center; flex: none; background: var(--accent-weak); color: var(--accent-text); }
.signin-ic .icon { width: 19px; height: 19px; }
.signin-id-text { min-width: 0; }
.signin-email { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: var(--fw-bold); letter-spacing: -.005em; overflow-wrap: anywhere; }
.signin-facts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); padding-top: var(--s-4); border-top: 1px solid var(--border); }
.signin-fact { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; font-size: var(--fs-sm); }
.signin-pw { display: inline-flex; align-items: center; gap: var(--s-2); }
.signin-dots { letter-spacing: 2px; color: var(--text-2); font-weight: 700; }
.signin-check { display: flex; align-items: center; flex-wrap: wrap; gap: 6px var(--s-3); min-height: 22px; margin-top: calc(-1 * var(--s-1)); font-size: var(--fs-sm); }
.signin-check[data-kind="invalid"], .signin-check[data-kind="taken"], .signin-check[data-kind="error"] { color: var(--bad); }
.signin-ok { display: inline-flex; align-items: center; gap: 5px; color: var(--good); font-weight: var(--fw-semi); }
.signin-ok .icon { width: 14px; height: 14px; stroke-width: 2.6; }
.signin-move { display: inline-flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }
.signin-move .icon { width: 13px; height: 13px; color: var(--text-3); }
.signin-old { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--border-strong); overflow-wrap: anywhere; }
.signin-hint { margin: calc(-1 * var(--s-1)) 0 0; }
.signin-bits { overflow-wrap: anywhere; }
.pw-box { display: flex; flex-direction: column; gap: 6px; }
.pw-row { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.pw-wrap { position: relative; flex: 1 1 260px; min-width: 0; }
.pw-wrap .input { padding-right: 44px; font-family: var(--mono); letter-spacing: .02em; }
.pw-eye { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; }
.pw-strength { display: flex; align-items: center; gap: var(--s-3); }
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-1); width: 160px; flex: none; }
.pw-meter i { height: 5px; border-radius: var(--r-pill); background: var(--surface-3); transition: background-color var(--dur); }
.pw-meter[data-score="1"] i:nth-child(-n+1) { background: var(--bad-dot); }
.pw-meter[data-score="2"] i:nth-child(-n+2) { background: var(--warn-dot); }
.pw-meter[data-score="3"] i:nth-child(-n+3) { background: var(--good-dot); }
.pw-meter[data-score="4"] i { background: var(--good-dot); }
.pw-meter-text { font-size: var(--fs-xs); color: var(--text-3); }

@media (max-width: 900px) {
  .compose { grid-template-columns: minmax(0, 1fr); }
  .compose-preview { position: static; }
}

/* ================================================================ large windows */

@media (min-width: 1920px) {
  :root { --sidebar-w: 264px; }
  .tile-value { font-size: 30px; line-height: 38px; }
  .tile-money { font-size: 24px; line-height: 32px; }
}

/* ================================================================ phones: an app, not a shrunken website */

@media (max-width: 760px) {
  :root { --gutter: 16px; }
  html { -webkit-tap-highlight-color: transparent; }
  body { font-size: 15px; }
  body:has(dialog[open]) { overflow: hidden; }

  .shell { display: block; min-height: 100dvh; }
  .sidebar { display: none; }
  .topbar { height: calc(var(--topbar-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) max(var(--s-2), env(safe-area-inset-right)) 0 max(var(--s-4), env(safe-area-inset-left)); }
  .topbar-inner { gap: var(--s-2); }
  .appbar-mark { display: grid; width: 32px; height: 32px; border-radius: var(--r-md); }
  .crumbs { flex: 1; }
  .crumb:not(.crumb-current), .crumb-sep { display: none; }
  .crumb-current { font-size: 17px; line-height: 24px; font-weight: var(--fw-bold); letter-spacing: -.01em; }
  .topbar-right { gap: 0; }
  .live-pill { width: 36px; height: var(--ctl-touch); padding: 0; margin: 0; justify-content: center; border: 0; background: transparent; }
  .live-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .live-dot { width: 9px; height: 9px; }
  .account-btn .avatar { width: 32px; height: 32px; font-size: var(--fs-sm); }
  .offline-bar { padding: var(--s-2) var(--s-4); }

  .view { padding: var(--s-4) max(var(--s-4), env(safe-area-inset-right)) calc(112px + env(safe-area-inset-bottom)) max(var(--s-4), env(safe-area-inset-left)); gap: var(--s-4); }
  .page-head { flex-direction: column; align-items: stretch; gap: var(--s-3); }
  .page-head .page-title { display: none; }
  .page-sub { font-size: var(--fs-sm); line-height: var(--lh-sm); margin-top: 0; }
  .page-actions { width: 100%; }
  .page-actions > .btn { flex: 1; }
  .user-head .page-title { font-size: var(--fs-xl); line-height: var(--lh-xl); }
  .toolbar { margin-bottom: 0; }

  .tabbar {
    display: flex; position: fixed; z-index: 30; gap: 2px; height: 64px; padding: 6px;
    left: max(var(--s-3), env(safe-area-inset-left)); right: max(var(--s-3), env(safe-area-inset-right));
    bottom: calc(var(--s-3) + env(safe-area-inset-bottom));
    background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-lg);
  }
  .tab {
    flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 0; border-radius: var(--r-xl); background: transparent; color: var(--text-3); text-decoration: none;
    font-size: 11px; font-weight: var(--fw-semi); cursor: pointer; transition: transform var(--dur-fast) var(--ease-out), color var(--dur-fast);
  }
  .tab:active { transform: scale(.92); }
  .tab:focus-visible { outline-offset: -2px; }
  .tab-icon { position: relative; display: grid; place-items: center; width: 52px; height: 30px; border-radius: var(--r-pill); transition: background-color var(--dur-fast); }
  .tab .icon { width: 21px; height: 21px; }
  .tab.active { color: var(--text); }
  .tab.active .tab-icon { background: var(--accent-weak); color: var(--accent-text); }
  .tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tab-count { position: absolute; top: -3px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--warn-dot); color: #1b1300; font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--surface); }

  .toasts { left: var(--s-3); right: var(--s-3); bottom: calc(88px + env(safe-area-inset-bottom)); max-width: none; }
  .toast { width: auto; }

  /* Dialogs are bottom sheets. */
  .dialog, .dialog-wide, .dialog-menu {
    width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 20px 20px 0 0;
    max-height: calc(100dvh - 24px - env(safe-area-inset-top));
    animation: sheet-in var(--dur-slow) var(--ease-sheet);
  }
  .dialog::before { content: ""; flex: none; width: 36px; height: 4px; margin: var(--s-2) auto 0; border-radius: var(--r-pill); background: var(--border-strong); }
  .dialog-head { align-items: center; padding: var(--s-2) max(var(--s-2), env(safe-area-inset-right)) var(--s-2) max(var(--s-4), env(safe-area-inset-left)); }
  .dialog-head:has(.dialog-desc) { align-items: flex-start; }
  .dialog-head .icon-btn { margin-top: 0; }
  .dialog-body { padding: var(--s-1) max(var(--s-4), env(safe-area-inset-right)) var(--s-4) max(var(--s-4), env(safe-area-inset-left)); }
  .dialog-menu .dialog-body { padding-bottom: calc(var(--s-5) + env(safe-area-inset-bottom)); }
  .dialog-actions { padding: var(--s-3) var(--s-4) calc(var(--s-3) + env(safe-area-inset-bottom)); border-radius: 0; }
  .dialog-actions .btn { flex: 1; }
  .lic-summary { bottom: calc(-1 * var(--s-4)); margin: var(--s-1) calc(-1 * var(--s-4)) calc(-1 * var(--s-4)); padding: var(--s-3) var(--s-4); }

  /* Touch: 44px targets; 16px inputs so iOS doesn't zoom in. */
  .btn, .btn-sm { height: var(--ctl-touch); padding: 0 var(--s-4); font-size: 14.5px; border-radius: var(--r-md); }
  .icon-btn { width: var(--ctl-touch); height: var(--ctl-touch); }
  .icon-btn-sm { width: 32px; height: 32px; }
  .input { height: var(--ctl-touch); font-size: 16px; }
  .textarea { height: auto; }
  .seg { height: 40px; padding: 0 var(--s-4); font-size: var(--fs-md); }
  .chip-btn { height: 40px; padding: 0 var(--s-4); font-size: var(--fs-sm); }
  .switch, .check { min-height: var(--ctl-touch); }
  .toast-close { width: 36px; height: 36px; }

  .tile { padding: var(--s-4); }
  .tile-value { font-size: 22px; line-height: 28px; }
  .tile-money { font-size: 17px; line-height: 24px; }
  .form-grid, .features { grid-template-columns: minmax(0, 1fr); }
  .legend-note { margin-left: 0; width: 100%; }
  .toolbar > .select { flex: 1 1 140px; }
  .toolbar > .segmented { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .toolbar > .segmented::-webkit-scrollbar { display: none; }
  .toolbar > .segmented .seg { flex: 1 0 auto; padding: 0 var(--s-3); }
  .search { flex-basis: 100%; }
  .card-head { padding: var(--s-3) var(--s-4); min-height: 52px; }
  .card > :not(.card-head) { margin: var(--s-4); }
  .card > .table-wrap, .card > .loading { margin: 0; }
  .tile-unit { margin-left: 4px; font-size: var(--fs-xs); }
  .plan-card, .rel-hero { padding: var(--s-5); }
  .rel-version { font-size: 26px; line-height: 32px; }
  .sk-row { padding: 0 var(--s-4); }

  /* Tables become card lists. */
  .table-wrap-cards { overflow: visible; }
  .table-cards, .table-cards tbody { display: block; width: 100%; }
  .table-cards thead { display: none; }
  .table-cards tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3) var(--s-4); padding: var(--s-4); border-bottom: 1px solid var(--border); }
  .card > :not(.card-head):has(> .table-wrap-cards) { margin-top: 0; margin-bottom: 0; }
  .table-cards tbody tr:last-child { border-bottom: 0; }
  .table.table-cards td, .table.table-cards th { display: block; height: auto; min-width: 0; padding: 0; border: 0; text-align: left; white-space: normal; background: transparent; }
  .table-cards td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: 11.5px; font-weight: var(--fw-semi); color: var(--text-3); }
  .table-cards td.cell-title { order: -1; grid-column: 1 / -1; font-size: 15px; }
  .table-cards td.cell-title::before { display: none; }
  .table-cards td:empty { display: none; }
  .table-cards td.actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: flex-end; }
  .table-cards td.actions > * + * { margin-left: 0; }
  .table-cards td.actions .btn { flex: 1; }
  .table-cards tr:has(> td.actions > .icon-btn:only-child) { position: relative; padding-right: 52px; }
  .table-cards td.actions:has(> .icon-btn:only-child) { position: absolute; top: 6px; right: 4px; }
  .table-cards .clamp { max-width: none; white-space: normal; }
  .table-cards tbody tr:hover td { background: transparent; }
  .table-cards tr.row-link:active { background: var(--surface-2); }
  .table-cards tr.row-group { display: flex; justify-content: space-between; align-items: baseline; padding: var(--s-3) var(--s-4); background: var(--surface-2); }
  .table-cards tr.row-group td:empty { display: none; }
  .table-cards td .badges { margin-top: 2px; }

  .ann-row { grid-template-columns: auto minmax(0, 1fr); gap: var(--s-3); align-items: start; padding: var(--s-4) 2px; }
  .ann-side { grid-column: 2; flex-direction: row; align-items: center; gap: var(--s-3); }
  .ann-actions { grid-column: 1 / -1; gap: var(--s-2); }
  .ann-actions .btn { flex: 1; }
  .ann-excerpt { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .segmented-icons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .segmented-icons .seg { justify-content: center; gap: 5px; padding: 0 var(--s-1); font-size: var(--fs-sm); }
  .sys-commit { grid-template-columns: auto minmax(0, 1fr); }
  .sys-commit-d { display: none; }
  .lic-plans { grid-template-columns: minmax(0, 1fr); }
  .lic-seg, .signin-seg { align-self: stretch; display: grid; }
  .lic-seg { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .signin-seg { grid-template-columns: 1fr 1fr; }
  .lic-seg .seg { padding: 0 6px; }
  .lic-custom .input { width: 100%; flex: 1; }
  .lic-until .input { max-width: none; }
  .pw-row .btn { flex: 1; }
  .pw-wrap { flex-basis: 100%; }
  .pw-eye { width: 40px; height: 40px; }
  .pw-meter { width: 120px; }

  .login-wrap { min-height: 100dvh; padding: max(var(--s-6), env(safe-area-inset-top)) var(--s-4) max(var(--s-6), env(safe-area-inset-bottom)); }
  .login-card { padding: var(--s-8) var(--s-5) var(--s-6); }
}

@media (max-width: 380px) {
  .tile-value { font-size: 20px; }
  .tile-money { font-size: 15px; }
  .more-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ================================================================ preferences */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .sk { animation: none; }
}

@media (forced-colors: active) {
  .dot-online, .dot-offline, .swatch, .bar-1, .bar-2 { forced-color-adjust: none; }
  .nav-link.active { outline: 2px solid CanvasText; }
}

/* ================================================================ date picker */

.dp-trigger {
  display: flex; align-items: center; gap: var(--s-2); text-align: left; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.dp-trigger .icon { color: var(--text-3); }
.dp-trigger:focus-visible { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--accent-weak); }
.dp-value { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-placeholder { color: var(--text-3); }
.dp-alt { font-variant-numeric: tabular-nums; }
.dp-alt:not(:empty) + * { margin-left: var(--s-2); }

.dp {
  width: 320px; max-width: calc(100vw - 16px); padding: var(--s-3); border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: var(--s-3);
}
.dp:not([open]) { display: none; }
.dp-pop { position: fixed; inset: auto; margin: 0; overflow-y: auto; animation: pop var(--dur) var(--ease-out); }
.dp-pop::backdrop { background: transparent; }
.dp-head { display: flex; align-items: center; gap: var(--s-1); }
.dp-nav { width: 32px; height: 32px; }
.dp-title {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: var(--s-1); height: 32px;
  border: 0; border-radius: var(--r-md); background: transparent; font-size: var(--fs-md); font-weight: var(--fw-semi); cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.dp-title:hover { background: var(--hover); }
.dp-title .icon { width: 14px; height: 14px; color: var(--text-3); }
.dp-grid { width: 100%; border-collapse: separate; border-spacing: 2px; table-layout: fixed; }
.dp-grid th { height: 28px; font-size: 11px; font-weight: var(--fw-semi); color: var(--text-3); text-align: center; }
.dp-grid th.is-weekend { color: var(--bad); }
.dp-grid td { padding: 0; text-align: center; }
.dp-day {
  width: 100%; aspect-ratio: 1; max-height: 40px; border: 0; border-radius: var(--r-md); background: transparent;
  font-size: var(--fs-sm); font-variant-numeric: tabular-nums; color: var(--text); cursor: pointer; position: relative;
  transition: background-color var(--dur-fast), color var(--dur-fast);
}
.dp-day:hover:not(:disabled) { background: var(--hover); }
.dp-day:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.dp-day.is-out { color: var(--text-3); opacity: .55; }
.dp-day.is-weekend { color: var(--bad); }
.dp-day.is-today { font-weight: 700; box-shadow: inset 0 0 0 1px var(--border-strong); }
.dp-day.is-today::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }
.dp-day.is-sel, .dp-day.is-sel:hover { background: var(--accent); color: var(--on-accent); font-weight: var(--fw-semi); box-shadow: none; }
.dp-day.is-sel::after { background: var(--on-accent); }
.dp-day:disabled { color: var(--text-3); opacity: .35; cursor: not-allowed; text-decoration: line-through; text-decoration-color: var(--border-strong); }
.dp-months { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); padding: var(--s-1) 0; }
.dp-month {
  height: 44px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2);
  font-size: var(--fs-sm); font-weight: var(--fw-medium); cursor: pointer; transition: background-color var(--dur-fast), border-color var(--dur-fast);
}
.dp-month:hover:not(:disabled) { border-color: var(--border-strong); background: var(--hover); }
.dp-month.is-today { border-color: var(--accent); }
.dp-month.is-sel { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.dp-month:disabled { opacity: .4; cursor: not-allowed; }
.dp-presets { display: flex; flex-wrap: wrap; gap: 6px; padding-top: var(--s-3); border-top: 1px solid var(--border); }
.dp-preset { height: 26px; padding: 0 var(--s-3); }
.dp-preset:disabled { opacity: .45; cursor: not-allowed; }
.dp-time { display: flex; align-items: center; gap: var(--s-2); padding-top: var(--s-3); border-top: 1px solid var(--border); }
.dp-time .label { margin-right: auto; }
.dp-time .icon { color: var(--text-3); }
.dp-num { width: 52px; text-align: center; font-variant-numeric: tabular-nums; padding: 0 var(--s-2); }
.dp-colon { font-weight: var(--fw-semi); color: var(--text-2); }
.dp-foot { display: flex; align-items: center; gap: var(--s-2); }
.dp-foot-gap { flex: 1; }
.dp-clear { color: var(--bad); }
.dp-clear:hover { background: var(--bad-weak); color: var(--bad); }

@media (max-width: 760px) {
  .dp {
    width: 100%; max-width: 100%; margin: auto 0 0; padding: var(--s-2) max(var(--s-4), env(safe-area-inset-right)) calc(var(--s-4) + env(safe-area-inset-bottom)) max(var(--s-4), env(safe-area-inset-left));
    border: 0; border-radius: 20px 20px 0 0; max-height: calc(100dvh - 24px); overflow-y: auto;
    animation: sheet-in var(--dur-slow) var(--ease-sheet);
  }
  .dp::before { content: ""; flex: none; width: 36px; height: 4px; margin: 0 auto; border-radius: var(--r-pill); background: var(--border-strong); }
  .dp::backdrop { background: var(--scrim); animation: fade-in var(--dur) ease-out; }
  .dp-nav { width: var(--ctl-touch); height: var(--ctl-touch); }
  .dp-title { height: var(--ctl-touch); font-size: var(--fs-lg); }
  .dp-day { max-height: 48px; min-height: 44px; font-size: var(--fs-md); }
  .dp-month { height: 52px; font-size: var(--fs-md); }
  .dp-preset { height: 40px; flex: 1; }
  .dp-num { width: 64px; }
  .dp-foot .btn { flex: 1; }
  .dp-foot-gap { display: none; }
}
