/* AI Hub's staff panel: slate and indigo, dark by default and light on
   request (`data-theme` on <html>, kept by src/theme.rs). Right to left,
   Vazirmatn throughout. Every colour is a token below; components use the
   tokens only, so the two themes stay one design. */

/* The variable cut: every weight in one file of 111 KB, where the panel
   fetched five static ones of 51 KB, four of them only once it was up. */
@font-face { font-family: "Vazirmatn"; font-weight: 100 900; font-display: swap; src: url("/fonts/Vazirmatn[wght].woff2") format("woff2"); }

:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070b17;
  --bg-glow: radial-gradient(1100px 620px at 100% -8%, rgba(99, 102, 241, 0.2), transparent 62%),
    radial-gradient(760px 480px at 0% -6%, rgba(168, 85, 247, 0.09), transparent 60%),
    radial-gradient(900px 600px at 8% 112%, rgba(34, 211, 238, 0.07), transparent 60%);
  --sidebar: rgba(9, 14, 30, 0.8);
  --surface: #0f1630;
  --surface-2: #141c3a;
  --surface-3: #1a2447;
  /* Cards are a shade of glass over the glow; dialogs and menus stay solid. */
  --card: linear-gradient(180deg, rgba(22, 31, 62, 0.74), rgba(13, 20, 42, 0.74));
  --card-edge: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --hover: rgba(148, 163, 184, 0.07);
  --border: rgba(148, 163, 184, 0.11);
  --border-strong: rgba(148, 163, 184, 0.2);
  --text: #e5e9f2;
  --text-2: #b4bdd0;
  --muted: #8591a8;
  /* Real words are drawn in it (times, labels, ids): 4.5:1 on the surfaces. */
  --faint: #7a86a0;
  --accent: #6366f1;
  --accent-2: #818cf8;
  --accent-3: #a5b4fc;
  --accent-soft: rgba(99, 102, 241, 0.16);
  --accent-ring: rgba(129, 140, 248, 0.45);
  --accent-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --on-accent: #ffffff;
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.14);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.14);
  --violet: #c084fc;
  --violet-soft: rgba(192, 132, 252, 0.14);
  --chart-grid: rgba(148, 163, 184, 0.10);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, 0.7);
  --skeleton: linear-gradient(90deg, rgba(148, 163, 184, 0.06), rgba(148, 163, 184, 0.14), rgba(148, 163, 184, 0.06));
  --tip-bg: #e9edf5;
  --tip-fg: #0b1020;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fb;
  --bg-glow: radial-gradient(1100px 620px at 100% -8%, rgba(99, 102, 241, 0.1), transparent 62%),
    radial-gradient(760px 480px at 0% -6%, rgba(168, 85, 247, 0.05), transparent 60%),
    radial-gradient(900px 600px at 8% 112%, rgba(56, 189, 248, 0.06), transparent 60%);
  --sidebar: rgba(255, 255, 255, 0.84);
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --surface-3: #eef1f8;
  --card: #ffffff;
  --card-edge: inset 0 1px 0 #ffffff;
  --hover: rgba(15, 23, 42, 0.045);
  --border: #e4e8f1;
  --border-strong: #d3d9e6;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #5b6579;
  --faint: #687287;
  --accent: #4f46e5;
  --accent-2: #6366f1;
  --accent-3: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.09);
  --accent-ring: rgba(99, 102, 241, 0.35);
  --accent-grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --on-accent: #ffffff;
  --success: #059669;
  --success-soft: rgba(5, 150, 105, 0.1);
  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, 0.1);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.08);
  --info: #0284c7;
  --info-soft: rgba(2, 132, 199, 0.09);
  --violet: #9333ea;
  --violet-soft: rgba(147, 51, 234, 0.09);
  --chart-grid: rgba(15, 23, 42, 0.07);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 12px 32px -14px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 30px 60px -24px rgba(15, 23, 42, 0.28);
  --skeleton: linear-gradient(90deg, rgba(15, 23, 42, 0.04), rgba(15, 23, 42, 0.09), rgba(15, 23, 42, 0.04));
  --tip-bg: #111827;
  --tip-fg: #f8fafc;
}

:root {
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --sidebar-width: 268px;
  --topbar-height: 68px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --font: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

/* The scrollbar's room is kept from the start: it came only once a page was
   taller than the window, and everything moved sideways by its width as it
   did — the most of what a page-speed audit counted as the dashboard moving. */
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body { background-image: var(--bg-glow); background-attachment: fixed; }

button,
input,
select,
textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

a { color: inherit; text-decoration: none; }

svg { flex-shrink: 0; }

* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* A key to press, as the quick search shows them. */
kbd {
  display: inline-block; font-family: var(--font); font-size: 11px; font-weight: 600; line-height: 1;
  padding: 4px 6px; border-radius: 6px; direction: ltr; white-space: nowrap;
  border: 1px solid var(--border-strong); border-bottom-width: 2px;
  background: var(--surface-2); color: var(--muted);
}

::selection { background: var(--accent-soft); color: var(--text); }

:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 2px; }

.ltr { direction: ltr; unicode-bidi: isolate; }

/* Ids and codes, in a face where 0 and O, 1 and l differ. */
.mono,
.copyable .ltr,
.id-line .ltr { font-family: ui-monospace, "Cascadia Code", Consolas, "Liberation Mono", monospace; font-size: 12.5px; }

/* ----------------------------------------------- the frame's small pieces */

/* For the keyboard: straight to the page, past the menus. */
.skip-link {
  position: fixed; top: 10px; inset-inline-start: 10px; z-index: 500; padding: 10px 16px;
  border-radius: var(--radius); background: var(--accent); color: #fff; font-weight: 700; font-size: 14px;
  box-shadow: var(--shadow-lg); transform: translateY(-160%); transition: transform 0.15s var(--ease);
}
.skip-link:focus { transform: none; }
.content:focus { outline: none; }

/* While staff wait on the server: a thin line along the very top, shown
   only for a wait long enough to notice. */
.workbar {
  position: fixed; top: 0; inset-inline: 0; height: 2px; z-index: 400; overflow: hidden;
  pointer-events: none; opacity: 0; transition: opacity 0.3s var(--ease);
}
.workbar.on { opacity: 1; transition-delay: 0.15s; }
.workbar::before {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -40%;
  background: linear-gradient(90deg, transparent, var(--accent-2), #a855f7, transparent);
  animation: working 1.1s ease-in-out infinite;
}
@keyframes working { to { left: 100%; } }

/* Tooltips (ui.rs TipLayer): one layer over everything, placed by script. */
.tip {
  position: fixed; z-index: 300; pointer-events: none; direction: rtl; white-space: nowrap;
  max-width: min(300px, calc(100vw - 24px)); overflow: hidden; text-overflow: ellipsis;
  padding: 6px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; line-height: 1.5;
  background: var(--tip-bg); color: var(--tip-fg); box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.45);
  animation: tip-in 0.12s var(--ease);
}
.tip-below { transform: translate(-50%, 0); }
.tip-above { transform: translate(-50%, -100%); }
.tip-left { transform: translate(-100%, -50%); }
@keyframes tip-in { from { opacity: 0; } }

.copy-btn {
  width: 26px; height: 26px; display: inline-grid; place-items: center; flex-shrink: 0; vertical-align: middle;
  border: 0; border-radius: 7px; background: transparent; color: var(--faint);
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.copy-btn:hover { background: var(--hover); color: var(--text); }
.copy-btn svg { width: 14px; height: 14px; }
.copyable { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; }
.copyable .ltr { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------ boot screen */

.boot {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: var(--bg); z-index: 100;
}
.boot-mark { display: grid; justify-items: center; gap: 18px; color: var(--muted); font-size: 13px; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--border-strong); border-top-color: var(--accent-2);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ brand */

.brand { display: flex; align-items: center; gap: 12px; }
/* The brand's mark: the site's open pistachio on its emerald (ui.rs
   `BrandMark`), the panel's indigo around it. */
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 8px 20px -8px rgba(5, 150, 105, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-name { font-weight: 800; font-size: 16px; line-height: 1.2; }
.brand-name span { color: var(--accent-2); }
.brand-sub { font-size: 11.5px; color: var(--muted); font-weight: 500; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius);
  border: 1px solid transparent; background: transparent;
  font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease),
    box-shadow 0.18s var(--ease), transform 0.12s var(--ease);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn-primary {
  background: var(--accent-grad);
  color: var(--on-accent);
  box-shadow: 0 8px 18px -8px rgba(99, 102, 241, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 24px -8px rgba(99, 102, 241, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.22); filter: brightness(1.06); }
.btn-ghost { color: var(--text-2); border-color: var(--border); background: var(--surface); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.btn-block { width: 100%; height: 46px; font-size: 15px; }
.btn-link { height: auto; padding: 0; color: var(--accent-2); font-weight: 600; }
.btn-link:hover:not(:disabled) { color: var(--accent-3); }

.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2);
  transition: background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 19px; height: 19px; }

.btn .spinner,
.icon-btn .spinner { width: 16px; height: 16px; border-width: 2px; }
.btn-primary .spinner { border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff; }

/* ----------------------------------------------------------------- inputs */

.field { display: grid; gap: 7px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > svg {
  position: absolute; inset-inline-start: 14px; width: 18px; height: 18px;
  color: var(--faint); pointer-events: none; transition: color 0.18s var(--ease);
}
.input {
  width: 100%; height: 46px; padding: 0 14px; padding-inline-start: 44px;
  border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); outline: none;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease);
}
.input::placeholder { color: var(--faint); }
.input:hover { border-color: var(--faint); }
.input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface); }
.input-wrap:focus-within > svg { color: var(--accent-2); }
.input.has-end { padding-inline-end: 46px; }
/* Written left to right in a right-to-left wrapper, an input's own start is
   its left: the icon at the wrapper's start (the right) keeps its room on
   the input's end, and an end button its room on the input's start. */
.input-wrap > .input.ltr { padding-inline-start: 14px; padding-inline-end: 44px; }
.input-wrap > .input.ltr.has-end { padding-inline-start: 46px; }
.input-end {
  position: absolute; inset-inline-end: 6px; width: 34px; height: 34px; border: 0;
  border-radius: var(--radius-sm); background: transparent; color: var(--faint);
  display: grid; place-items: center;
}
.input-end:hover { color: var(--text); background: var(--hover); }
.input-end svg { width: 18px; height: 18px; }

/* The six boxes of a one-time code; written left to right like any number. */
.otp { display: flex; gap: 10px; justify-content: center; direction: ltr; }
.otp input {
  width: 52px; height: 60px; text-align: center; font-size: 24px; font-weight: 700;
  border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--surface-2); outline: none; caret-color: var(--accent-2);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.18s var(--ease);
}
.otp input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface); }
.otp input.filled { border-color: var(--accent); }
.otp.shake { animation: shake 0.42s var(--ease); }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px;
  border-radius: var(--radius); font-size: 13.5px; line-height: 1.7;
  border: 1px solid transparent;
}
.alert svg { width: 18px; height: 18px; margin-top: 2px; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }

/* ------------------------------------------------------------------ login */

.login {
  min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1fr) 1.05fr;
}
.login-form-side { display: flex; flex-direction: column; padding: 28px 40px; }
.login-top { display: flex; align-items: center; justify-content: space-between; }
.login-center { flex: 1; display: grid; place-items: center; padding: 40px 0; }
.login-card { width: 100%; max-width: 400px; display: grid; gap: 26px; }
.login-head h1 { margin: 0 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -0.2px; }
.login-head p { margin: 0; color: var(--muted); font-size: 14px; }
.login-form { display: grid; gap: 18px; }
.login-steps { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.login-steps .step { display: flex; align-items: center; gap: 8px; }
.login-steps .dot {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--muted);
  border: 1px solid var(--border);
}
.login-steps .step.on .dot { background: var(--accent); color: #fff; border-color: transparent; box-shadow: 0 0 0 4px var(--accent-soft); }
.login-steps .step.done .dot { background: var(--success-soft); color: var(--success); border-color: transparent; }
.login-steps .step.on { color: var(--text); font-weight: 600; }
.login-steps .bar { flex: 1; height: 2px; border-radius: 2px; background: var(--border); }
.login-steps .bar.done { background: linear-gradient(90deg, var(--success), var(--accent)); }
.login-sent { text-align: center; color: var(--muted); font-size: 14px; }
.login-sent strong { color: var(--text); font-weight: 700; }
.login-row { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; color: var(--muted); }
.login-foot { text-align: center; font-size: 12px; color: var(--faint); display: flex; justify-content: center; gap: 6px; align-items: center; }
.login-foot svg { width: 14px; height: 14px; }

.login-art {
  position: relative; overflow: hidden; margin: 14px; margin-inline-start: 0;
  border-radius: 28px; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(600px 400px at 20% 10%, rgba(139, 92, 246, 0.55), transparent 60%),
    radial-gradient(500px 420px at 90% 90%, rgba(34, 211, 238, 0.35), transparent 60%),
    radial-gradient(700px 500px at 70% 30%, rgba(99, 102, 241, 0.65), transparent 65%),
    #0b1030;
  color: #eef0ff; isolation: isolate;
}
.login-art::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, transparent 75%);
}
.login-art::after {
  content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%;
  inset-inline-end: -120px; bottom: -160px; z-index: -1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 60px rgba(255, 255, 255, 0.03), 0 0 0 120px rgba(255, 255, 255, 0.02);
}
.art-badge {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
}
.art-badge svg { width: 15px; height: 15px; }
.art-copy h2 { margin: 0 0 14px; font-size: 34px; line-height: 1.45; font-weight: 800; max-width: 460px; }
.art-copy p { margin: 0; max-width: 430px; color: rgba(238, 240, 255, 0.72); font-size: 15px; }
.art-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 520px; }
.art-tile {
  padding: 14px; border-radius: 16px; background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12); backdrop-filter: blur(10px);
  display: grid; gap: 8px; font-size: 12.5px; color: rgba(238, 240, 255, 0.8);
}
.art-tile svg { width: 20px; height: 20px; color: #c7d2fe; }
.art-tile strong { color: #fff; font-size: 13.5px; }

/* ------------------------------------------------------------------ shell */

.shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--sidebar); border-inline-end: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  padding: 16px 12px 12px; gap: 8px; z-index: 30; overflow: hidden;
}
.sidebar-head {
  display: flex; align-items: center; gap: 8px; padding: 2px 6px 14px; padding-inline-end: 0;
  border-bottom: 1px solid var(--border);
}
.rail-btn { width: 34px; height: 34px; margin-inline-start: auto; background: transparent; border-color: transparent; color: var(--faint); }
.rail-btn svg { width: 18px; height: 18px; }
.rail-btn:hover { background: var(--hover); border-color: var(--border); }

/* The menu: never wider than the sidebar — a long name ends in an ellipsis —
   and on a short window it scrolls with its bar hidden, its two ends fading
   out so that what is past them shows there is more. */
.nav {
  flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 16px;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  margin: 0 -6px; padding: 12px 6px 16px;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 12px, #000 calc(100% - 18px), transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 12px, #000 calc(100% - 18px), transparent);
}
.nav::-webkit-scrollbar { display: none; }
.nav-section { display: flex; flex-direction: column; gap: 2px; }
/* A section's name, then a hairline to the menu's edge. */
.nav-title {
  display: flex; align-items: center; gap: 10px; padding: 0 10px; margin-bottom: 4px;
  font-size: 11px; font-weight: 700; color: var(--faint); letter-spacing: 0.2px; white-space: nowrap;
}
.nav-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 40px; min-width: 0;
  padding: 5px 6px; padding-inline-end: 10px; border-radius: 12px;
  color: var(--text-2); font-weight: 500; font-size: 13.5px;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.nav-icon {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0;
  color: var(--muted);
  transition: background 0.16s var(--ease), color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.nav-icon svg { width: 18px; height: 18px; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item:hover .nav-icon { background: var(--surface-3); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.nav-item[aria-current="page"] .nav-icon {
  background: var(--accent-grad); color: var(--on-accent);
  box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--accent) 75%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
/* The page's own item: a short bar at the menu's outer edge. */
.nav-item[aria-current="page"]::before {
  content: ""; position: absolute; inset-inline-start: -6px; top: 50%; width: 3px; height: 20px;
  border-radius: 3px; background: var(--accent-2); transform: translateY(-50%);
}
.nav-badge {
  margin-inline-start: auto; display: inline-grid; place-items: center; min-width: 20px; height: 20px;
  padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 1;
  background: var(--surface-3); color: var(--muted);
}
.nav-badge.live {
  background: var(--danger); color: #fff;
  box-shadow: 0 4px 10px -4px color-mix(in srgb, var(--danger) 80%, transparent);
}

.me-card {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px;
  background: color-mix(in srgb, var(--surface-2) 80%, transparent); border: 1px solid var(--border);
  box-shadow: var(--card-edge);
}
.me-card .who { min-width: 0; flex: 1; }
.me-card .name { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-card .mail { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  font-weight: 700; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.avatar.sm { width: 30px; height: 30px; font-size: 11.5px; }
.avatar.xs { width: 24px; height: 24px; font-size: 10px; }
.avatar.hue-0 { background: linear-gradient(135deg, #4f46e5, #9333ea); }
.avatar.hue-1 { background: linear-gradient(135deg, #0284c7, #4f46e5); }
.avatar.hue-2 { background: linear-gradient(135deg, #047857, #0284c7); }
.avatar.hue-3 { background: linear-gradient(135deg, #c2410c, #dc2626); }
.avatar.hue-4 { background: linear-gradient(135deg, #db2777, #7c3aed); }
.avatar.hue-5 { background: linear-gradient(135deg, #0f766e, #15803d); }
.avatar.hue-6 { background: linear-gradient(135deg, #e11d48, #a21caf); }
.avatar.hue-7 { background: linear-gradient(135deg, #475569, #4338ca); }

.role {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700;
  padding: 2px 9px; border-radius: 999px;
}
.role-admin { background: var(--accent-soft); color: var(--accent-2); }
.role-support { background: var(--info-soft); color: var(--info); }

.main { min-width: 0; display: flex; flex-direction: column; }

/* The bar along the top: an island of glass floating over the page, held a
   little below the window's edge as the page scrolls beneath it. At its
   start the page — its section's icon, the way to it, its name — and at its
   end the tools: search, the session, the theme, and the member of staff. */
.topbar {
  position: sticky; top: 12px; z-index: 20; height: 64px;
  width: calc(100% - 56px); max-width: 1424px; margin: 12px 28px 0;
  display: flex; align-items: center; gap: 10px; padding: 0 12px;
  border-radius: 18px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  box-shadow: var(--card-edge), var(--shadow-sm), 0 18px 40px -28px color-mix(in srgb, var(--accent) 45%, transparent);
}
.page-mark {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent-2);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-2) 18%, transparent);
}
.page-mark svg { width: 20px; height: 20px; }
/* Where the page is: the way to it, small, over its name. */
.topbar .crumbs { display: grid; gap: 1px; min-width: 0; line-height: 1.35; white-space: nowrap; }
.crumb-trail { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 11.5px; color: var(--muted); }
.crumb-trail svg { width: 13px; height: 13px; opacity: 0.6; }
.topbar .crumbs a { border-radius: 6px; padding: 1px 4px; margin: -1px -4px; transition: color 0.15s var(--ease), background 0.15s var(--ease); }
.topbar .crumbs a:hover { color: var(--accent-2); background: var(--hover); }
.topbar .crumbs strong {
  color: var(--text); font-weight: 800; font-size: 15.5px; letter-spacing: -0.1px;
  min-width: 0; max-width: 420px; overflow: hidden; text-overflow: ellipsis;
}
.crumb-sep { display: inline-flex; }
.topbar .spacer { flex: 1; }
.topbar .menu-btn { display: none; border-color: transparent; background: transparent; }
.search-trigger {
  display: inline-flex; align-items: center; gap: 10px; height: 40px; width: 300px;
  padding-inline: 12px 6px; border-radius: 12px; border: 1px solid transparent;
  background: color-mix(in srgb, var(--surface-3) 70%, transparent);
  color: var(--faint); font-size: 13px; text-align: start;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease), background 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.search-trigger svg { width: 17px; height: 17px; }
.search-trigger .search-text { flex: 1; }
.search-trigger kbd { background: var(--surface); }
.search-trigger:hover {
  border-color: color-mix(in srgb, var(--accent-2) 35%, transparent); background: var(--surface); color: var(--muted);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.session-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--surface-3) 70%, transparent); color: var(--text-2);
  font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
.session-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--success); box-shadow: 0 0 0 3px var(--success-soft);
}
.session-chip.low { color: var(--warning); background: var(--warning-soft); }
.session-chip.low .session-dot { background: var(--warning); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warning) 25%, transparent); }
.topbar .theme-btn { border-color: transparent; background: transparent; color: var(--muted); }
.topbar .theme-btn:hover { background: color-mix(in srgb, var(--surface-3) 70%, transparent); color: var(--text); border-color: transparent; }
.topbar .theme-btn svg { transition: transform 0.35s var(--ease); }
.topbar .theme-btn:hover svg { transform: rotate(-18deg); }
.topbar-divider { width: 1px; height: 28px; background: var(--border); margin-inline: 2px; flex-shrink: 0; }

.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 5px; padding-inline-end: 10px;
  border-radius: 14px; border: 1px solid transparent; background: transparent;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease);
}
.user-btn:hover,
.user-btn[aria-expanded="true"] { background: color-mix(in srgb, var(--surface-3) 70%, transparent); }
/* Signed in: a green dot on the member of staff's picture. */
.user-btn .avatar { position: relative; width: 34px; height: 34px; }
.user-btn .avatar::after {
  content: ""; position: absolute; bottom: -1px; inset-inline-end: -1px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--success); box-shadow: 0 0 0 2px var(--surface);
}
.user-btn .label { display: grid; text-align: start; line-height: 1.3; white-space: nowrap; }
.user-btn .label b { font-size: 13px; }
.user-btn .label small { font-size: 11px; color: var(--muted); }
.user-btn > svg { width: 16px; height: 16px; color: var(--muted); transition: transform 0.2s var(--ease); }
.user-btn[aria-expanded="true"] > svg { transform: rotate(180deg); }
.menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); min-width: 240px; padding: 6px;
  border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); z-index: 50; animation: pop 0.16s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; display: grid; gap: 4px; }
.menu-head .mail { font-size: 12px; color: var(--muted); }
.menu-item {
  width: 100%; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-2);
  font-size: 13.5px; font-weight: 500; text-align: start;
}
.menu-item:hover { background: var(--hover); color: var(--text); }
.menu-item svg { width: 17px; height: 17px; }
.menu-item.danger { color: var(--danger); }
.menu-kbd { margin-inline-start: auto; }
.menu-theme { display: grid; gap: 8px; padding: 8px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.theme-options {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 3px;
  border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border);
}
.theme-option {
  display: grid; justify-items: center; gap: 3px; padding: 7px 4px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-size: 12px; font-weight: 600;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.theme-option svg { width: 16px; height: 16px; }
.theme-option:hover { color: var(--text); }
.theme-option[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border); }
.theme-option[aria-checked="true"] svg { color: var(--accent-2); }
.menu-item.danger:hover { background: var(--danger-soft); }

.scrim { display: none; }
/* Under the open menu, over the page: a click anywhere else closes it. */
.menu-catcher { position: fixed; inset: 0; z-index: 19; }

.content { padding: 28px; display: grid; gap: 22px; align-content: start; max-width: 1480px; width: 100%; }
/* A page's parts rise into place one after another as it opens (`entering`,
   set by the shell for a moment after each page change). Backwards only:
   once risen, nothing stays on them (a transform would hold dialogs). A
   dialog opened meanwhile has its own way in: given this one too, it would
   play its own again once the moment passed, and flicker. They move, but are
   there from the first frame: they rose in from nothing, and the largest of
   them was painted as late as its turn came — which a page-speed audit
   counts as the page not shown yet. */
.content.entering > :not(.dialog-scrim) { animation: rise 0.36s var(--ease) backwards; }
.content.entering > :nth-child(2):not(.dialog-scrim) { animation-delay: 0.04s; }
.content.entering > :nth-child(3):not(.dialog-scrim) { animation-delay: 0.08s; }
.content.entering > :nth-child(4):not(.dialog-scrim) { animation-delay: 0.12s; }
.content.entering > :nth-child(n + 5):not(.dialog-scrim) { animation-delay: 0.16s; }
@keyframes rise { from { transform: translateY(8px); } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.2px; }
.page-head > div:first-child { flex: 1 1 420px; min-width: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; max-width: 860px; line-height: 1.8; }
.page-head .greeting { display: grid; gap: 2px; color: var(--text-2); font-weight: 500; }
.greeting-sub { font-size: 12.5px; color: var(--faint); font-weight: 400; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stamp { font-size: 12.5px; color: var(--faint); display: inline-flex; align-items: center; gap: 6px; }
.stamp svg { width: 14px; height: 14px; }

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--card-edge), var(--shadow-sm); min-width: 0;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap;
  padding: 18px 20px 0;
}
.card-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.card-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
/* A head with its icon on a tile: the words beside it take the room. */
.card-head > .head-chip { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; }
.card-head > .head-chip svg { width: 19px; height: 19px; }
.card-head > .head-chip + div { flex: 1; min-width: 0; }
.card-body { padding: 18px 20px 20px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi {
  padding: 18px 20px; display: grid; gap: 12px; position: relative; overflow: hidden;
  background: radial-gradient(130% 90% at 100% 0%, var(--tone-soft), transparent 55%), var(--card);
}
/* A thread of the card's colour along its top edge. */
.kpi::before {
  content: ""; position: absolute; inset-inline: 18px; top: 0; height: 1px; pointer-events: none;
  background: linear-gradient(to left, transparent, var(--tone), transparent); opacity: 0.55;
}
.kpi-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.kpi-top .chip { width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0; }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }
/* The trend sits across from the name, at the far end of the card's head. */
.spark { width: 96px; height: 32px; min-width: 48px; flex-shrink: 1; margin-inline-start: auto; overflow: visible; }
.spark-line { fill: none; stroke: var(--tone); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chip {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--tone-soft); color: var(--tone);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone, var(--accent-2)) 18%, transparent);
}
.chip svg { width: 20px; height: 20px; }
.kpi-value { font-size: 28px; font-weight: 800; letter-spacing: -0.4px; line-height: 1.1; }
.kpi-value small { font-size: 13px; font-weight: 600; color: var(--muted); margin-inline-start: 6px; letter-spacing: 0; }
.kpi-foot { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.tone-indigo { --tone: var(--accent-2); --tone-soft: var(--accent-soft); }
.tone-emerald { --tone: var(--success); --tone-soft: var(--success-soft); }
.tone-amber { --tone: var(--warning); --tone-soft: var(--warning-soft); }
.tone-sky { --tone: var(--info); --tone-soft: var(--info-soft); }
.tone-violet { --tone: var(--violet); --tone-soft: var(--violet-soft); }
.tone-rose { --tone: var(--danger); --tone-soft: var(--danger-soft); }

.delta {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
}
.delta svg { width: 14px; height: 14px; }
.delta.up { background: var(--success-soft); color: var(--success); }
.delta.down { background: var(--danger-soft); color: var(--danger); }
.delta.flat { background: var(--surface-3); color: var(--muted); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; background: var(--surface-3); color: var(--muted);
}
.pill.warn { background: var(--warning-soft); color: var(--warning); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill .led { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

/* ----------------------------------------------------------------- charts */

/* Time runs left to right whatever the page's direction; the scale sits on
   the left, in a gutter of its own. */
.chart { direction: ltr; padding-left: 52px; }
.chart-plot { position: relative; height: 230px; }
.chart-plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .area-line { fill: none; stroke: var(--accent-2); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.chart .bar { fill: var(--success); opacity: 0.88; transition: opacity 0.15s var(--ease); }
.chart .bar.dim { opacity: 0.32; }
.chart .bar-empty { fill: var(--chart-grid); }
.chart .hit { fill: transparent; cursor: crosshair; }
.y-label {
  position: absolute; right: calc(100% + 10px); transform: translateY(-50%);
  font-size: 11px; color: var(--faint); white-space: nowrap; direction: rtl;
}
.x-axis { position: relative; height: 26px; margin-top: 8px; }
.x-label { position: absolute; top: 0; font-size: 11px; color: var(--faint); white-space: nowrap; direction: rtl; }
.chart-guide {
  position: absolute; top: 0; bottom: 0; width: 0; pointer-events: none;
  border-left: 1px dashed var(--border-strong);
}
.chart-dot {
  position: absolute; width: 12px; height: 12px; border-radius: 50%; pointer-events: none;
  transform: translate(-50%, -50%); background: var(--surface);
  border: 2.5px solid var(--accent-2); box-shadow: 0 0 0 5px var(--accent-soft);
}
.chart-total { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.chart-total b { font-size: 22px; font-weight: 800; }
.chart-total span { font-size: 12.5px; color: var(--muted); }
.tooltip {
  position: absolute; transform: translate(-50%, calc(-100% - 14px)); pointer-events: none; direction: rtl;
  padding: 8px 12px; border-radius: var(--radius); background: var(--surface-3);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow); white-space: nowrap;
  font-size: 12px; color: var(--muted); display: grid; gap: 2px; z-index: 5;
}
.tooltip b { color: var(--text); font-size: 14px; }
.tooltip.below { transform: translate(-50%, 14px); }

.donut-wrap { display: grid; grid-template-columns: 160px 1fr; gap: 20px; align-items: center; }
.donut { position: relative; width: 160px; height: 160px; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut .track { fill: none; stroke: var(--surface-3); }
.donut .seg { fill: none; transition: opacity 0.15s var(--ease); }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-center b { font-size: 26px; font-weight: 800; line-height: 1.1; }
.donut-center span { font-size: 12px; color: var(--muted); }
.legend { display: grid; gap: 10px; }
.legend-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.legend-row .sw { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-row .nm { color: var(--text-2); flex: 1; }
.legend-row .vl { font-weight: 700; }
.legend-row .pc { color: var(--faint); font-size: 12px; min-width: 42px; text-align: end; }

/* ------------------------------------------------------------ lists, misc */

.stat-list { display: grid; gap: 16px; }
.stat-row { display: grid; gap: 8px; }
.stat-row .top { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.stat-row .top svg { width: 17px; height: 17px; color: var(--muted); }
.stat-row .top .nm { flex: 1; color: var(--text-2); }
.stat-row .top b { font-weight: 700; }
.meter { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.activity { display: grid; }
.activity-row { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); align-items: flex-start; }
.activity-row:first-child { border-top: 0; padding-top: 0; }
.activity-row .what { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.7; }
.activity-row .what b { font-weight: 700; }
.activity-row .what .why { display: block; font-size: 12.5px; color: var(--muted); }
.activity-row time { font-size: 12px; color: var(--faint); white-space: nowrap; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile { padding: 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); display: grid; gap: 4px; }
.tile .k { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.tile .k svg { width: 15px; height: 15px; }
.tile .v { font-size: 20px; font-weight: 800; }

.empty { display: grid; justify-items: center; gap: 10px; padding: 26px 10px; text-align: center; color: var(--muted); font-size: 13.5px; }
.empty .chip {
  width: 52px; height: 52px; border-radius: 16px;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--tone, var(--accent-2)) 8%, transparent),
    inset 0 0 0 1px color-mix(in srgb, var(--tone, var(--accent-2)) 18%, transparent);
}

.error-card { padding: 28px; display: grid; justify-items: center; gap: 12px; text-align: center; }
.error-card h2 { margin: 0; font-size: 17px; }
.error-card p { margin: 0; color: var(--muted); font-size: 14px; }

.skeleton { border-radius: var(--radius-sm); background: var(--skeleton); background-size: 300% 100%; animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* Toasts in the corner farthest from the menu: never over its foot. */
.toasts { position: fixed; bottom: 22px; inset-inline-end: 22px; display: grid; gap: 10px; z-index: 200; }
.toast {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 10px; min-width: 280px; max-width: 400px; padding: 10px;
  padding-inline-start: 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg); font-size: 13.5px; animation: pop 0.2s var(--ease);
}
.toast-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.toast-icon svg { width: 16px; height: 16px; }
.toast.ok .toast-icon { background: var(--success-soft); color: var(--success); }
.toast.error .toast-icon { background: var(--danger-soft); color: var(--danger); }
.toast-text { flex: 1; min-width: 0; line-height: 1.6; }
.toast-close {
  width: 28px; height: 28px; display: grid; place-items: center; flex-shrink: 0;
  border: 0; border-radius: 7px; background: transparent; color: var(--faint);
}
.toast-close:hover { background: var(--hover); color: var(--text); }
.toast-close svg { width: 14px; height: 14px; }
.toast::after {
  content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 2px; opacity: 0.6;
  transform-origin: right; animation: toast-time var(--toast-ms, 4500ms) linear forwards;
}
.toast.ok::after { background: var(--success); }
.toast.error::after { background: var(--danger); }
@keyframes toast-time { to { transform: scaleX(0); } }

/* ---------------------------------------------------------- users: lists */

/* Over a list: its search and its filters, on a strip of their own. */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px;
}
.toolbar .search { flex: 1 1 260px; min-width: 0; }
.toolbar .search .input { height: 42px; border-radius: 12px; }
.toolbar .select { border-radius: 12px; }
.select {
  height: 42px; padding: 0 12px; padding-inline-end: 34px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background-color: var(--surface-2); color: var(--text);
  font-size: 13.5px; cursor: pointer; outline: none; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: left 16px center, left 11px center;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.select:hover { border-color: var(--faint); }
.select:focus { border-color: var(--accent-2); box-shadow: 0 0 0 4px var(--accent-soft); }
.select.on { border-color: var(--accent); background-color: var(--accent-soft); }
.select option { background: var(--surface); color: var(--text); }

/* A table: its head a quiet band of small names, its rows with room to
   breathe and parted by hairlines; under the pointer a row is washed in the
   accent — one that opens a page also marked at its start, its arrow
   reaching on. */
.table-wrap { overflow-x: auto; scrollbar-width: thin; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th {
  text-align: start; font-weight: 700; font-size: 11.5px; letter-spacing: 0.2px; color: var(--muted); white-space: nowrap;
  padding: 12px 16px; background: color-mix(in srgb, var(--surface-2) 80%, transparent);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.table td {
  padding: 14px 16px; border-bottom: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  vertical-align: middle; white-space: nowrap; transition: background 0.14s var(--ease), box-shadow 0.14s var(--ease);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--accent) 3.5%, transparent); }
.table tbody tr.link { cursor: pointer; }
.table tbody tr.link:hover td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
/* A mark at the row's start while the pointer is on it. */
.table tbody tr.link:hover td:first-child { box-shadow: inset -3px 0 0 var(--accent-2); }
.table tbody tr.link:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: -2px; }
.table .muted { color: var(--muted); }
.table .end { text-align: end; }
.table .chev { color: var(--faint); width: 32px; }
.table .chev svg { width: 16px; height: 16px; transition: transform 0.16s var(--ease), color 0.16s var(--ease); }
.table tbody tr.link:hover .chev { color: var(--accent-2); }
.table tbody tr.link:hover .chev svg { transform: translateX(-4px); }
.table td b { font-weight: 700; }
.table .amount-cell b { font-size: 14px; letter-spacing: -0.1px; }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person .avatar { width: 36px; height: 36px; font-size: 12px; border-radius: 12px; }
.person .who { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); line-height: 1.45; }
/* A long name or email is cut where the column ends, not the table pushed
   past the page and its last columns out of sight. */
.table .person .who { min-width: 120px; max-width: 260px; }
.person .who b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .who span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap; line-height: 1.5;
  background: var(--tone-soft, var(--surface-3)); color: var(--tone, var(--muted));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone, var(--muted)) 16%, transparent);
}
.tag .led { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag svg { width: 12px; height: 12px; }

/* Under a list: what of it is shown, and its pages as one control. */
.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted);
  background: color-mix(in srgb, var(--surface-2) 55%, transparent); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.pager .pages {
  display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm);
}
.pager .pages > span { padding: 0 10px; font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.pager .icon-btn { width: 32px; height: 32px; border-radius: 9px; border-color: transparent; background: transparent; }
.pager .icon-btn:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent-2); border-color: transparent; }
.pager .icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* --------------------------------------------------------- users: account */

.back {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; padding-inline-start: 10px;
  justify-self: start; border-radius: 10px; font-size: 13px; color: var(--muted); font-weight: 600;
  border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 70%, transparent);
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.back:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface); }
.back svg { width: 16px; height: 16px; }

/* An account's head: a cover of colour over a fine grid of dots, its
   picture rising out of it, who it is and how to reach it on pills; four
   figures on tiles; and what may be done to it along the card's foot. */
.profile { padding: 0; display: grid; position: relative; overflow: hidden; }
.profile-cover {
  position: absolute; inset-inline: 0; top: 0; height: 136px; pointer-events: none;
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--text) 10%, transparent) 1px, transparent 0) 0 0 / 18px 18px,
    radial-gradient(480px 190px at 88% -30%, rgba(139, 92, 246, 0.5), transparent 70%),
    radial-gradient(560px 210px at 22% -50%, rgba(34, 211, 238, 0.28), transparent 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 22%, transparent), transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent);
  mask-image: linear-gradient(to bottom, #000 40%, transparent);
}
.profile-top { display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap; position: relative; padding: 62px 26px 0; }
.id-line .ltr { color: var(--faint); }
.profile-top .avatar {
  width: 92px; height: 92px; font-size: 28px; border-radius: 28px; flex-shrink: 0;
  box-shadow: 0 0 0 5px var(--surface), 0 18px 36px -14px rgba(15, 23, 42, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.profile-id { flex: 1; min-width: 240px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding-bottom: 2px; }
.profile-id h1 {
  margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.3px; line-height: 1.3;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.contact { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--text-2); }
.contact > span {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; max-width: 100%; min-width: 0;
  padding: 0 4px; padding-inline-start: 10px; border-radius: 10px;
  background: color-mix(in srgb, var(--surface-2) 85%, transparent); border: 1px solid var(--border);
}
.contact > span > .ltr { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact .ok,
.contact .no { display: inline-flex; align-items: center; gap: 6px; }
.contact svg { width: 15px; height: 15px; color: var(--muted); }
.contact .ok,
.contact .ok svg { color: var(--success); }
.contact .no { color: var(--faint); }
.contact .no svg { color: var(--warning); }
.profile > .notice { margin: 18px 26px 0; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 22px 26px; }
.fact {
  display: flex; align-items: center; gap: 12px; min-width: 0; padding: 14px; border-radius: 14px;
  background: color-mix(in srgb, var(--surface-2) 80%, transparent); border: 1px solid var(--border);
}
.fact .chip { width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0; }
.fact .chip svg { width: 18px; height: 18px; }
.fact > div { display: grid; gap: 1px; min-width: 0; }
.fact .k { font-size: 12px; color: var(--muted); }
.fact .v { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-actions {
  padding: 14px 26px; border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 60%, transparent);
}
.profile-actions .actions { width: 100%; }
/* Deleting stands apart, at the far end. */
.profile-actions .btn-danger { margin-inline-start: auto; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-warn { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 35%, transparent); background: var(--warning-soft); }
.btn-warn:hover:not(:disabled) { border-color: var(--warning); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: var(--danger-soft); }
.btn-danger:hover:not(:disabled) { border-color: var(--danger); }
.btn-danger-solid {
  background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff;
  box-shadow: 0 8px 18px -8px rgba(220, 38, 38, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-danger-solid:hover:not(:disabled) { filter: brightness(1.08); }
.btn-sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.notice {
  display: flex; gap: 12px; padding: 14px 16px; border-radius: 14px; align-items: flex-start;
  background: var(--tone-soft); border: 1px solid color-mix(in srgb, var(--tone) 30%, transparent); color: var(--text-2); font-size: 13.5px;
}
.notice > svg { width: 20px; height: 20px; color: var(--tone); margin-top: 2px; flex-shrink: 0; }
.notice b { color: var(--text); }
.notice .meta { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* An account's parts as a segmented control: the one open raised out of
   its track. */
.tabs {
  display: flex; gap: 4px; padding: 5px; margin: 16px 16px 0; width: fit-content; max-width: calc(100% - 32px);
  border-radius: 14px; border: 1px solid var(--border); overflow-x: auto; scrollbar-width: none;
  background: color-mix(in srgb, var(--surface-3) 75%, transparent);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; height: 38px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent;
  color: var(--muted); font-weight: 600; font-size: 13.5px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
:root:not([data-theme="light"]) .tabs { background: color-mix(in srgb, var(--surface-2) 80%, transparent); }
:root:not([data-theme="light"]) .tab[aria-selected="true"] { background: var(--surface-3); }
.tab .count {
  min-width: 20px; height: 20px; display: inline-grid; place-items: center; padding: 0 6px; border-radius: 999px;
  font-size: 11px; background: var(--surface-2); color: var(--muted);
}
.tab[aria-selected="true"] .count { background: var(--accent-soft); color: var(--accent-2); }
.tab svg { width: 16px; height: 16px; opacity: 0.85; }
.tab[aria-selected="true"] svg { color: var(--accent-2); opacity: 1; }
.tab-body { padding: 18px 16px; }

/* A box of an account's figures: its colour washed into a corner, its
   icon on a tile beside its name, its rows parted by a dashed line, and
   what may be done from it along its foot. */
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel-box {
  position: relative; border: 1px solid var(--border); border-radius: 18px; padding: 16px;
  display: grid; gap: 14px; align-content: start; min-width: 0;
  background:
    radial-gradient(110% 70% at 100% 0%, color-mix(in srgb, var(--tone-soft, transparent) 70%, transparent), transparent 55%),
    color-mix(in srgb, var(--surface) 82%, transparent);
  box-shadow: var(--card-edge);
}
.panel-box h3 { margin: 0; font-size: 14px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 10px; }
.panel-box h3 svg {
  width: 34px; height: 34px; padding: 8px; border-radius: 11px; flex-shrink: 0;
  background: var(--tone-soft, var(--accent-soft)); color: var(--tone, var(--accent-2));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone, var(--accent-2)) 18%, transparent);
}
.panel-box > .box-actions:last-child {
  margin: 2px -16px -16px; padding: 12px 16px; border-radius: 0 0 17px 17px;
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}
/* An account's share links (user.rs shares_box). */
.share-rows { display: flex; flex-direction: column; }
.share-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px dashed var(--border); }
.share-row:first-child { border-top: 0; padding-top: 0; }
.share-row > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.share-row b { font-weight: 600; overflow-wrap: anywhere; }
.share-row .muted { font-size: 12px; color: var(--muted); }
.big { font-size: 26px; font-weight: 800; letter-spacing: -0.4px; line-height: 1.25; }
.big.muted { font-size: 19px; color: var(--muted); }
/* Held to the width it is given: a long value (an id, a gateway's token)
   breaks or is cut, never widening a dialog past a phone's screen. */
.kv { display: grid; grid-template-columns: minmax(0, 1fr); font-size: 13.5px; }
.kv > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-top: 1px dashed var(--border); min-width: 0; }
.kv > div:first-child { border-top: 0; padding-top: 0; }
.kv span { color: var(--muted); }
.kv > div > span:first-child { flex-shrink: 0; }
.kv b { font-weight: 600; color: var(--text); text-align: end; min-width: 0; overflow-wrap: anywhere; }
/* Counts as figures, each on a small tile. */
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; }
.mini-stat {
  display: grid; gap: 2px; align-content: start; min-width: 0; padding: 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2) 85%, transparent); border: 1px solid var(--border);
}
.mini-stat b { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; line-height: 1.25; color: var(--text); }
.mini-stat span { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* What happened, along a line from one to the next. */
.timeline { display: grid; }
.event { position: relative; display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; padding: 10px 0; align-items: start; }
.event:first-child { padding-top: 0; }
.event:not(:last-child)::after {
  content: ""; position: absolute; inset-inline-start: 13px; top: 44px; bottom: -6px; width: 2px; border-radius: 2px;
  background: var(--border);
}
.event:first-child:not(:last-child)::after { top: 34px; }
.event .dot { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--tone-soft); color: var(--tone); }
.event .dot svg { width: 15px; height: 15px; }
.event .what { font-size: 13.5px; line-height: 1.7; min-width: 0; }
.event .what .why { display: block; color: var(--muted); font-size: 12.5px; }
.event time { font-size: 12px; color: var(--faint); white-space: nowrap; }

/* ---------------------------------------------- referrals, credit, record */

.person-link { color: inherit; }
.person-link:hover b,
a.person-link:hover { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; }
.table td.row-end,
.table th.row-end { text-align: end; width: 1%; }
.state-with-why { display: grid; gap: 4px; justify-items: start; }
.state-with-why .why { font-size: 11.5px; color: var(--muted); white-space: normal; max-width: 280px; line-height: 1.6; }
.action-cell { display: inline-flex; align-items: center; gap: 8px; }
.action-cell .dot {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--tone-soft); color: var(--tone);
}
.action-cell .dot svg { width: 14px; height: 14px; }
.table td.why-cell { white-space: normal; min-width: 200px; }
/* The record's account named in full takes lines, not the page's width; an
   IPv6 address breaks where it must. */
.table td.target-cell { white-space: normal; min-width: 140px; max-width: 240px; }
.table td.ip-cell { white-space: normal; max-width: 150px; }
.table td.ip-cell .ltr { overflow-wrap: anywhere; }
.why-lines { display: grid; gap: 2px; max-width: 380px; line-height: 1.7; }
.why-lines .reason { color: var(--text-2); }
.why-lines .detail { font-size: 12px; color: var(--muted); }
.why-lines .link-inline { font-size: 12px; }

/* ---------------------------------------------------------------- system */

.verdict {
  display: flex; align-items: center; gap: 14px; padding: 18px 20px;
  background: radial-gradient(120% 140% at 100% 0%, var(--tone-soft), transparent 60%), var(--card);
  border-color: color-mix(in srgb, var(--tone) 30%, transparent);
}
.verdict .chip { width: 46px; height: 46px; border-radius: 14px; }
.verdict .chip svg { width: 22px; height: 22px; }
.verdict h2 { margin: 0; font-size: 17px; font-weight: 800; }
.verdict p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.stack.warnings { gap: 10px; }
.services { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.service {
  padding: 14px; border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 75%, transparent); display: grid; gap: 10px; align-content: start;
}
.service.off { opacity: 0.72; }
.service-head { display: flex; align-items: center; gap: 10px; }
.service-head .chip { width: 34px; height: 34px; border-radius: 10px; }
.service-head .chip svg { width: 17px; height: 17px; }
.service-detail { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; line-height: 1.7; }
.service-answer {
  display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: var(--radius);
  background: var(--tone-soft); color: var(--text-2); font-size: 12.5px; line-height: 1.7;
}
.service-answer svg { width: 16px; height: 16px; color: var(--tone); flex-shrink: 0; margin-top: 3px; }
.service-answer .latency { margin-inline-start: auto; color: var(--faint); white-space: nowrap; }
.tiles.tables-tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

/* ----------------------------------------------------------------- dialog */

/* Every change is asked in a dialog: a head washed in the change's colour
   — its icon on a tile, what it does — then its fields, and its buttons
   along a foot of their own, held in sight as a long one scrolls. */
.dialog-scrim {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px;
  background: rgba(2, 6, 23, 0.55); backdrop-filter: blur(10px) saturate(120%); -webkit-backdrop-filter: blur(10px) saturate(120%);
  animation: fade 0.16s var(--ease);
}
.dialog {
  position: relative; width: min(500px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px;
  box-shadow: 0 40px 90px -30px rgba(2, 6, 23, 0.6), 0 0 0 1px color-mix(in srgb, var(--accent-2) 6%, transparent), var(--card-edge);
  animation: dialog-in 0.22s var(--ease);
}
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(0.97); } }
.dialog-head {
  display: flex; gap: 16px; align-items: flex-start; padding: 24px 24px 20px; border-bottom: 1px solid var(--border);
  background: radial-gradient(130% 160% at 100% 0%, var(--head-wash, var(--accent-soft)), transparent 62%);
}
.dialog-head:has(> .tone-amber) { --head-wash: var(--warning-soft); }
.dialog-head:has(> .tone-emerald) { --head-wash: var(--success-soft); }
.dialog-head:has(> .tone-sky) { --head-wash: var(--info-soft); }
.dialog-head:has(> .tone-violet) { --head-wash: var(--violet-soft); }
.dialog-head:has(> .tone-rose) { --head-wash: var(--danger-soft); }
.dialog-head .chip {
  width: 50px; height: 50px; border-radius: 16px; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 24%, transparent), 0 12px 24px -14px var(--tone);
}
.dialog-head .chip svg { width: 23px; height: 23px; }
.dialog-head h2 { margin: 4px 0 6px; font-size: 18px; font-weight: 800; letter-spacing: -0.2px; }
.dialog-head p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.85; }
.dialog-body { padding: 20px 24px 22px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.dialog-foot {
  display: flex; justify-content: flex-start; gap: 10px; flex-direction: row-reverse;
  padding: 14px 24px; border-top: 1px solid var(--border); background: var(--surface-2);
}
.dialog-body > .dialog-foot { margin: 6px -24px -22px; position: sticky; bottom: 0; z-index: 1; }
.textarea {
  width: 100%; min-height: 96px; padding: 11px 14px; border-radius: 12px; resize: vertical;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); outline: none; line-height: 1.8;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease);
}
.textarea:hover { border-color: var(--faint); }
.textarea:focus, .input.plain:focus { border-color: var(--accent-2); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface); }
.input.plain { padding-inline-start: 14px; height: 44px; border-radius: 12px; }
.hint { font-size: 12px; color: var(--faint); }
/* SMS.ir (sms.rs): the keys the server sends by, and a long key or
   template id broken rather than run out of its card. */
.sms-key-hint { margin: -4px 0 0; line-height: 1.7; }
.sms-templates .mono { overflow-wrap: anywhere; }
.sms-admins-row { display: flex; gap: 10px; align-items: center; }
.sms-admins-row .input { flex: 1; min-width: 0; }
.sms-events { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.sms-event {
  display: grid; gap: 10px; align-content: start; min-width: 0; padding: 16px; border-radius: 14px;
  background: color-mix(in srgb, var(--surface-2) 85%, transparent); border: 1px solid var(--border);
}
.sms-event > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.sms-event > header > div { display: grid; gap: 2px; min-width: 0; }
.sms-event > header b { font-size: 14.5px; font-weight: 700; }
.sms-event > header .mono { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.sms-event > header .pill { flex-shrink: 0; }
.sms-event > p { margin: 0; font-size: 12.5px; color: var(--text-2); line-height: 1.8; }
.sms-event .sms-event-to { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.sms-event .sms-event-to svg { width: 15px; height: 15px; flex-shrink: 0; }
.sms-vars { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 12.5px; }
.sms-vars li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; align-items: baseline; }
.sms-vars .mono { color: var(--accent-2); font-weight: 600; }
.sms-vars em { grid-column: 2; font-style: normal; color: var(--muted); font-size: 12px; }
.sms-text { display: grid; gap: 6px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px dashed var(--border-strong); }
.sms-text-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.sms-text pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 13px; line-height: 1.9; color: var(--text); }
.sms-event > footer { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
@media (max-width: 640px) {
  .sms-admins-row { flex-direction: column; align-items: stretch; }
}
/* Email (email.rs): the address an email is tried with beside its button;
   the newsletter's text, room to write and its count; each newsletter sent
   as a card — how far it has gone on a bar, green sent and red failed, its
   text at a press, line for line. */
.email-test-row { display: flex; gap: 10px; align-items: center; }
.email-test-row .input { flex: 1; min-width: 0; }
.hint.wrong { color: var(--danger); }
.newsletter-body { min-height: 220px; }
.composer-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.composer-foot .hint { line-height: 1.7; }
#newsletter-count { flex-shrink: 0; white-space: nowrap; }
.letters { display: grid; gap: 12px; }
.letter {
  display: grid; gap: 10px; min-width: 0; padding: 16px; border-radius: 14px;
  background: color-mix(in srgb, var(--surface-2) 85%, transparent); border: 1px solid var(--border);
}
.letter > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.letter > header > div { display: grid; gap: 2px; min-width: 0; }
.letter > header b { font-size: 14.5px; font-weight: 700; overflow-wrap: anywhere; }
.letter > header .meta { font-size: 12px; color: var(--muted); }
.letter > header .pill { flex-shrink: 0; }
.letter-meter { display: flex; height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.letter-meter i { display: block; height: 100%; }
.letter-meter .sent { background: var(--success); }
.letter-meter .failed { background: var(--danger); }
.letter-figures { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 12.5px; color: var(--muted); }
.letter-figures b { color: var(--text); font-weight: 700; }
.letter-body summary { cursor: pointer; width: fit-content; font-size: 12.5px; font-weight: 600; color: var(--accent-2); }
.letter-body pre {
  margin: 8px 0 0; padding: 10px 12px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere;
  font: inherit; font-size: 13px; line-height: 1.9; color: var(--text);
  background: var(--surface); border: 1px dashed var(--border-strong);
}
.table td.email-subject { white-space: normal; min-width: 180px; max-width: 320px; }
@media (max-width: 640px) {
  .email-test-row { flex-direction: column; align-items: stretch; }
  /* Stacked, the field keeps its own height rather than a share of none. */
  .email-test-row .input { flex: none; }
  .composer-foot { flex-direction: column; gap: 4px; }
  .letter > header { flex-direction: column; }
}
.choices { display: grid; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 14px; cursor: pointer; font-size: 13.5px;
  border: 1px solid var(--border-strong); background: var(--surface);
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.choice:hover { border-color: color-mix(in srgb, var(--accent-2) 45%, var(--border-strong)); }
.choice:has(input:checked) { border-color: var(--accent-2); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
.choice input { width: 18px; height: 18px; margin: 0; flex-shrink: 0; accent-color: var(--accent); }
.choice > span { font-weight: 600; }
.choice small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.readonly-note { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.readonly-note svg { width: 15px; height: 15px; }

/* ---------------------------------------------- payments and subscriptions */

.seg {
  display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--radius-lg); justify-self: start;
  background: var(--surface-2); border: 1px solid var(--border); max-width: 100%; overflow-x: auto;
}
.seg-item {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: var(--radius);
  font-size: 13.5px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.seg-item svg { width: 16px; height: 16px; }
.seg-item:hover { color: var(--text); }
.seg-item[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
/* Five to a row where four would leave the fifth alone below them. */
.stats.five { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* The holidays support's hours skip: a day and its name side by side, the
   button a field of its own, so all three stand level from the top. */
.holiday-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.holiday-form .field { flex: 1 1 200px; margin: 0; }
.holiday-form .holiday-submit { flex: 0 0 auto; }
/* A typed day that is not one, said in the danger's colour. */
.holiday-form .hint.wrong { color: var(--danger); }
.stat { padding: 16px 18px; display: flex; align-items: center; gap: 14px; }
.stat .chip { width: 42px; height: 42px; flex-shrink: 0; }
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat .v { font-size: 20px; font-weight: 800; letter-spacing: -0.2px; }
.stat .f { font-size: 12px; color: var(--faint); margin-top: 2px; }
.dialog-wide { width: min(600px, 100%); }
.receipt-hero {
  display: grid; justify-items: center; gap: 6px; text-align: center; padding: 18px 16px 20px;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: radial-gradient(320px 120px at 50% -20%, var(--accent-soft), transparent 75%), var(--surface-2);
}
.receipt-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.receipt-amount { font-size: 30px; font-weight: 800; letter-spacing: -0.4px; line-height: 1.25; }
.receipt-hero .tags { justify-content: center; }
.receipt-plan { font-size: 13px; color: var(--muted); }
.receipt-lines { padding: 2px 2px 0; }
.receipt-total { padding-top: 10px; border-top: 1px dashed var(--border-strong); }
.receipt-total span { color: var(--text-2); font-weight: 700; }
.receipt-total .total { font-size: 16px; }
.receipt-meta b { font-weight: 600; min-width: 0; }
.dialog .kv + .kv { border-top: 1px solid var(--border); padding-top: 14px; }
/* A purchase refunded (billing.rs): its record a box of its own in the
   receipt; in the refund's dialog, what is wrong held close to the fields. */
.refund-box .kv b { font-weight: 600; }
.refund-wrong { margin: -6px 0 0; }
.kv .total { font-size: 16px; font-weight: 800; }
.link-inline { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-2); font-weight: 600; font-size: 13px; }
.link-inline:hover { text-decoration: underline; }
.link-inline svg { width: 14px; height: 14px; }
.box-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.stack { display: grid; gap: 16px; }
.stack > .link-inline { justify-self: start; }
.choices.row { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.quick .btn { border-radius: 999px; height: 32px; padding: 0 13px; }
.quick .btn[aria-pressed="true"] { border-color: var(--accent-2); background: var(--accent-soft); color: var(--text); }
.event .what .amount { font-weight: 800; }

/* -------------------------------------------------- questions asked most */

.faq-summary { margin: 0 0 12px; font-size: 13px; }
.faq-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.faq-row {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 12px 14px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface-2);
}
.faq-row.hidden { opacity: 0.6; border-style: dashed; }
.faq-place {
  width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-2); font-size: 12.5px; font-weight: 800;
}
.faq-main { display: grid; gap: 3px; min-width: 0; }
.faq-question { font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.faq-gist {
  color: var(--muted); font-size: 12.5px; line-height: 1.8;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.faq-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11.5px; }
.faq-actions { display: flex; gap: 4px; }
.faq-actions .icon-btn { width: 34px; height: 34px; }
.faq-actions .icon-btn svg { width: 16px; height: 16px; }
.faq-actions .icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.faq-actions .icon-btn.danger:hover:not(:disabled) { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
/* What the site will show of an answer, as it is typed. */
.faq-preview { display: grid; gap: 6px; }
.faq-preview-body {
  padding: 10px 14px; border-radius: var(--radius); border: 1px dashed var(--border-strong);
  background: var(--surface-2); color: var(--text-2); font-size: 13px; line-height: 1.9;
}
.faq-preview-body p { margin: 0; }
.faq-preview-body ul { margin: 4px 0; padding-inline-start: 20px; }
.faq-wrong { align-self: center; color: var(--warning); }
@media (max-width: 620px) {
  .faq-row { grid-template-columns: 28px minmax(0, 1fr); }
  .faq-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

/* ------------------------------------------------------------------- blog */

/* The list (blog.rs): a post by its title, a link to it, and under it its
   address on the site; its last change over who made it. */
.blog-summary { margin-inline-start: auto; font-size: 12.5px; white-space: nowrap; }
.blog-cell { display: grid; gap: 2px; min-width: 0; max-width: 420px; line-height: 1.5; }
.blog-cell a {
  font-weight: 700; white-space: normal; overflow-wrap: anywhere; justify-self: start;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.blog-cell a:hover { color: var(--accent-2); }
.blog-cell .mono { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; justify-self: start; max-width: 100%; }
.blog-changed { display: grid; line-height: 1.5; }
/* A post written: the post itself, and beside it — held in sight while a
   long text scrolls — whether it goes out, what is known of it and its
   buttons. */
.blog-editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.blog-editor [hidden] { display: none !important; }
.blog-side { display: grid; gap: 16px; position: sticky; top: 92px; min-width: 0; }
.blog-side .box-actions { justify-content: space-between; }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px var(--danger-soft); }
.blog-slug-offer { justify-self: start; height: auto; padding: 0; font-size: 12.5px; }
.blog-moved { color: var(--warning); font-weight: 600; }
.blog-wrong { color: var(--warning); line-height: 1.8; }
.blog-new-note { margin: 0; line-height: 1.8; }
.blog-facts .copyable { min-width: 0; }
.blog-facts .copyable .ltr { overflow-wrap: anywhere; }
/* Writing or the preview: a choice over the text. */
.blog-write-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.blog-tabs { padding: 3px; border-radius: 12px; }
.blog-tabs .seg-item { height: 32px; padding: 0 12px; font-size: 13px; border: 0; background: transparent; cursor: pointer; }
.blog-tabs .seg-item[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
/* The text as written: room for a long one, in a face whose marks line up,
   Persian falling back to the panel's own. */
.blog-body {
  min-height: 440px; font-family: ui-monospace, "Cascadia Code", Consolas, var(--font);
  font-size: 13.5px; line-height: 1.95; tab-size: 4;
}
.md-cheats { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--faint); }
.md-cheats code {
  font-family: ui-monospace, "Cascadia Code", Consolas, var(--font); font-size: 11.5px; padding: 1px 6px; border-radius: 6px;
  background: var(--surface-3); color: var(--text-2); unicode-bidi: isolate;
}
#blog-count { flex-shrink: 0; white-space: nowrap; }
.blog-preview-wrap { display: grid; gap: 8px; }
/* What the site will show of a post, drawn as an article: the server's HTML
   in a box of its own, right to left. */
.blog-article {
  padding: 22px 24px; border-radius: var(--radius-lg); border: 1px dashed var(--border-strong);
  background: var(--surface); color: var(--text-2); font-size: 14.5px; line-height: 2; overflow-wrap: anywhere; min-width: 0;
}
.blog-article-head { display: grid; gap: 6px; justify-items: start; padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.blog-article-head h1 { margin: 0; font-size: 24px; font-weight: 800; line-height: 1.5; color: var(--text); }
.blog-article-lead { margin: 0; color: var(--muted); font-size: 15px; }
.blog-article-body > :first-child { margin-top: 0; }
.blog-article-body > :last-child { margin-bottom: 0; }
.blog-article-body h1,
.blog-article-body h2,
.blog-article-body h3,
.blog-article-body h4 { margin: 1.4em 0 0.5em; color: var(--text); font-weight: 800; line-height: 1.55; }
.blog-article-body h1 { font-size: 22px; }
.blog-article-body h2 { font-size: 19px; }
.blog-article-body h3 { font-size: 16.5px; }
.blog-article-body h4 { font-size: 15px; }
.blog-article-body p { margin: 0 0 1em; }
.blog-article-body ul,
.blog-article-body ol { margin: 0 0 1em; padding-inline-start: 24px; }
.blog-article-body li { margin: 0.25em 0; }
.blog-article-body strong { color: var(--text); }
.blog-article-body a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; }
.blog-article-body img { display: block; max-width: 100%; height: auto; margin: 1em auto; border-radius: 12px; }
.blog-article-body blockquote {
  margin: 0 0 1em; padding: 10px 16px; border-radius: 10px; color: var(--text);
  border-inline-start: 3px solid var(--accent-2); background: var(--accent-soft);
}
.blog-article-body blockquote > :last-child { margin-bottom: 0; }
.blog-article-body code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.86em;
  padding: 1px 6px; border-radius: 6px; background: var(--surface-3); color: var(--text); direction: ltr; unicode-bidi: isolate;
}
.blog-article-body pre {
  margin: 0 0 1em; padding: 12px 14px; border-radius: 12px; overflow-x: auto; direction: ltr; text-align: left;
  background: var(--surface-2); border: 1px solid var(--border);
}
.blog-article-body pre code { padding: 0; background: none; font-size: 12.5px; line-height: 1.8; }
.blog-article-body table { width: 100%; margin: 0 0 1em; border-collapse: collapse; font-size: 13.5px; display: block; overflow-x: auto; }
.blog-article-body th,
.blog-article-body td { padding: 6px 10px; border: 1px solid var(--border); text-align: start; }
.blog-article-body hr { margin: 1.5em 0; border: 0; border-top: 1px solid var(--border); }
@media (max-width: 1100px) {
  .blog-editor { grid-template-columns: minmax(0, 1fr); }
  .blog-side { position: static; }
}
@media (max-width: 640px) {
  .blog-summary { margin-inline-start: 0; flex-basis: 100%; }
  .blog-article { padding: 16px; }
  .blog-body { min-height: 320px; }
}

/* ----------------------------------------------------------- AI providers */

/* The figures at a glance: a tile each, its icon on a tile of its colour. */
.ai-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.ai-stat {
  position: relative; display: flex; align-items: center; gap: 14px; min-width: 0; padding: 16px 18px;
  border-radius: 18px; border: 1px solid var(--border); overflow: hidden;
  background: radial-gradient(130% 100% at 100% 0%, var(--tone-soft), transparent 60%), var(--card);
  box-shadow: var(--card-edge), var(--shadow-sm);
}
.ai-stat::before {
  content: ""; position: absolute; inset-inline: 16px; top: 0; height: 1px; pointer-events: none;
  background: linear-gradient(to left, transparent, var(--tone), transparent); opacity: 0.5;
}
.ai-stat .chip { width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0; }
.ai-stat .chip svg { width: 21px; height: 21px; }
.ai-stat > div { display: grid; gap: 2px; min-width: 0; }
.ai-stat .k { font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-stat b { font-size: 19px; font-weight: 800; letter-spacing: -0.3px; line-height: 1.3; overflow-wrap: anywhere; }
.ai-stat small { font-size: 11.5px; color: var(--muted); }
.ai-stat.tone-amber small { color: var(--warning); font-weight: 600; }
/* Over the list: its name, and how many there are. */
.ai-list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.ai-list-head h2 { margin: 0; font-size: 16px; font-weight: 800; }
.ai-summary { margin: 0; font-size: 13px; }
.ai-providers { display: grid; gap: 18px; transition: opacity 0.15s var(--ease); }

/* A provider: its mark and name, its form and currency, its address on a
   pill; then its models and its keys, each under a head of its own; and
   along its foot, when it was last changed. */
.ai-provider { overflow: hidden; border-radius: 20px; }
.ai-provider.off { opacity: 0.78; }
.ai-provider.off .ai-provider-head { filter: grayscale(0.6); }
.ai-provider-head {
  display: flex; align-items: center; gap: 16px; padding: 20px 22px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(70% 140% at 100% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
    color-mix(in srgb, var(--surface-2) 45%, transparent);
}
.ai-logo {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; flex-shrink: 0;
  color: #fff; font-weight: 800; font-size: 17px; letter-spacing: 0.3px; direction: ltr;
  box-shadow: 0 12px 26px -14px rgba(15, 23, 42, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.ai-logo.hue-0 { background: linear-gradient(135deg, #4f46e5, #9333ea); }
.ai-logo.hue-1 { background: linear-gradient(135deg, #0284c7, #4f46e5); }
.ai-logo.hue-2 { background: linear-gradient(135deg, #047857, #0284c7); }
.ai-logo.hue-3 { background: linear-gradient(135deg, #c2410c, #dc2626); }
.ai-logo.hue-4 { background: linear-gradient(135deg, #db2777, #7c3aed); }
.ai-logo.hue-5 { background: linear-gradient(135deg, #0f766e, #15803d); }
.ai-logo.hue-6 { background: linear-gradient(135deg, #e11d48, #a21caf); }
.ai-logo.hue-7 { background: linear-gradient(135deg, #475569, #4338ca); }
.ai-provider-title { display: grid; gap: 7px; min-width: 0; flex: 1; justify-items: start; }
.ai-provider-title h2 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -0.2px; overflow-wrap: anywhere; }
.ai-provider-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-url {
  display: inline-block; max-width: 100%; padding: 3px 10px; border-radius: 8px; font-size: 12px; color: var(--text-2);
  background: var(--surface-3); border: 1px solid var(--border); overflow-wrap: anywhere;
}
.ai-provider-head .row-actions {
  align-self: flex-start; padding: 4px; border-radius: 12px; border: 1px solid var(--border); gap: 2px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}
.ai-provider-head .row-actions .icon-btn { border-color: transparent; background: transparent; }
.ai-provider-head .row-actions .icon-btn:hover:not(:disabled) { background: var(--hover); }
.ai-provider-body { display: grid; gap: 22px; padding: 20px 22px 22px; }
.ai-part { display: grid; gap: 12px; }
.ai-part-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ai-part-title { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; color: var(--text); }
.ai-part-title svg { width: 16px; height: 16px; color: var(--accent-2); }
.ai-part-count { font-size: 12px; color: var(--muted); padding: 2px 10px; border-radius: 999px; background: var(--surface-3); }
.ai-add-key { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.ai-none {
  margin: 0; font-size: 13px; padding: 14px; border-radius: 14px; text-align: center;
  border: 1px dashed var(--border-strong); background: color-mix(in srgb, var(--surface-2) 60%, transparent);
}
.ai-provider-foot {
  display: flex; align-items: center; gap: 8px; padding: 12px 22px; font-size: 12px; color: var(--faint);
  border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}
.ai-provider-foot svg { width: 14px; height: 14px; }

/* The model each of the site's AIs is answered with: a card each — the
   AI, its model, what it costs. */
.ai-models { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.ai-model {
  display: grid; gap: 4px; align-content: start; min-width: 0; padding: 12px 14px;
  border-radius: 14px; border: 1px solid var(--border); font-size: 12.5px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 90%, transparent), color-mix(in srgb, var(--surface-2) 90%, transparent));
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), transform 0.16s var(--ease);
}
.ai-model:hover { border-color: color-mix(in srgb, var(--accent-2) 35%, var(--border)); box-shadow: 0 10px 24px -18px var(--accent); }
.ai-model-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ai-model-top b { font-size: 13.5px; font-weight: 700; }
.ai-model .mono { color: var(--text-2); overflow-wrap: anywhere; justify-self: start; }
.ai-model-price { font-size: 11.5px; color: var(--muted); }
/* In a group's row, a key is a chip, as it was. */
.ai-group .ai-models { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.ai-group .ai-model { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; }

/* A key: its icon, how it stands, when it was last used, what it has cost,
   its credit, why it was last refused — and what can be done with it. */
.ai-keys { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ai-key {
  display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 16px;
  border: 1px solid var(--border); background: color-mix(in srgb, var(--surface-2) 75%, transparent);
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.ai-key:hover { border-color: var(--border-strong); background: color-mix(in srgb, var(--surface-2) 100%, transparent); }
.ai-key.off { opacity: 0.6; border-style: dashed; }
.ai-key-icon {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; align-self: flex-start;
  background: var(--accent-soft); color: var(--accent-2);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-2) 18%, transparent);
}
.ai-key-icon svg { width: 18px; height: 18px; }
.ai-key.off .ai-key-icon { background: var(--surface-3); color: var(--faint); box-shadow: none; }
.ai-key-main { display: grid; gap: 5px; min-width: 0; flex: 1; }
.ai-key-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ai-key-top b { font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.ai-tail { font-size: 12px; color: var(--text-2); padding: 1px 8px; border-radius: 6px; background: var(--surface-3); }
.ai-key-foot { font-size: 12px; color: var(--muted); }
.ai-key-error {
  display: flex; gap: 6px; align-items: flex-start; font-size: 12px; color: var(--danger); overflow-wrap: anywhere;
  justify-self: start; padding: 4px 10px; border-radius: 8px; background: var(--danger-soft);
}
.ai-key-error svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 3px; }
.row-actions { display: flex; gap: 4px; flex-shrink: 0; }
.row-actions .icon-btn { width: 34px; height: 34px; border-radius: 10px; }
.row-actions .icon-btn svg { width: 16px; height: 16px; }
.row-actions .icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.row-actions .icon-btn.danger:hover:not(:disabled) { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.ai-key > .row-actions {
  padding: 4px; gap: 2px; border-radius: 12px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}
.ai-key > .row-actions .icon-btn { border-color: transparent; background: transparent; }
.ai-key > .row-actions .icon-btn:hover:not(:disabled) { background: var(--hover); }

/* What the AI requests cost: the span and the dollar's rate, the figures. */
.ai-cost-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ai-rate { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-rate .input { width: 140px; height: 38px; }
.ai-kpis .kpi-value { font-size: 21px; overflow-wrap: anywhere; }
.ai-cost-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ai-cost-head .select { width: auto; min-width: 160px; }
.ai-cost-who { display: grid; gap: 1px; color: inherit; text-decoration: none; }
.ai-cost-who:hover b { color: var(--accent-2); }
.ai-cost-who span { font-size: 12px; color: var(--muted); justify-self: start; }
.ai-gain { color: var(--success); font-weight: 700; }
.ai-loss { color: var(--danger); font-weight: 700; }
.ai-near { color: var(--warning); font-weight: 700; }
.ai-cost-note { line-height: 1.9; margin: 0; }
/* Each plan's fair-use ceiling: its share of the price under it; the AIs
   kept past it, side by side. */
.ai-fair-ceiling { display: grid; gap: 1px; }
.ai-fair-ceiling small { font-size: 12px; }
.ai-fair-action { text-align: end; white-space: nowrap; }
.ai-fair-ais { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
@media (max-width: 1100px) {
  .ai-kpis,
  .ai-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .ai-kpis { grid-template-columns: minmax(0, 1fr); }
}
/* A key's credit: how much of the share the site may spend is gone. */
.ai-budget { display: grid; gap: 6px; margin-top: 4px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--surface) 75%, transparent); border: 1px solid var(--border); max-width: 520px; }
.ai-bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.ai-bar span {
  display: block; height: 100%; border-radius: inherit; transition: width 0.3s var(--ease);
  background: linear-gradient(to left, var(--tone, var(--accent-2)), color-mix(in srgb, var(--tone, var(--accent-2)) 65%, #fff));
}
.ai-usage { color: var(--text-2); }

/* Whose requests are asked with which keys: each plan's group, a card
   each; the groups; the accounts given one. */
.ai-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.ai-plan {
  display: grid; gap: 10px; align-content: start; padding: 14px 16px; border-radius: 16px;
  border: 1px solid var(--border); background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}
.ai-plan-name { font-size: 14px; font-weight: 800; display: inline-flex; align-items: center; gap: 8px; }
.ai-plan-name::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.ai-plan .ai-missing { grid-column: auto; }
.ai-group { align-items: start; }
.ai-checks { display: grid; gap: 6px; }

/* The provider's form: in numbered parts, two choices side by side, and a
   card for each of the site's AIs — its model, whether it reads pictures,
   its prices. */
.dialog.dialog-xl { width: min(760px, 100%); }
.form-section { display: grid; gap: 14px; padding-top: 4px; }
.form-section + .form-section { border-top: 1px dashed var(--border); padding-top: 18px; }
.form-section-title { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 800; color: var(--text); }
.form-section-title span {
  width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0;
  font-size: 12px; font-weight: 800; background: var(--accent-soft); color: var(--accent-2);
}
.ai-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ai-slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ai-slot {
  display: grid; gap: 8px; align-content: start; padding: 12px; border-radius: 14px;
  border: 1px solid var(--border); background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  transition: border-color 0.16s var(--ease);
}
.ai-slot:focus-within { border-color: color-mix(in srgb, var(--accent-2) 55%, var(--border)); box-shadow: 0 0 0 3px var(--accent-soft); }
.ai-slot-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; }
.ai-slot-name { font-size: 13px; font-weight: 700; color: var(--text); }
.ai-slot .input.plain { height: 40px; background: var(--surface); }
.ai-prices { display: flex; gap: 8px; }
.ai-price { height: 34px !important; font-size: 12px; flex: 1 1 0; min-width: 0; }
.ai-vision { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.ai-vision input { accent-color: var(--accent); margin: 0; }
@media (max-width: 620px) {
  .ai-stats { grid-template-columns: minmax(0, 1fr); }
  .ai-key { flex-wrap: wrap; padding: 12px; }
  .ai-key-icon { display: none; }
  .ai-key > .row-actions { width: 100%; justify-content: flex-end; }
  .ai-provider-head { flex-wrap: wrap; padding: 16px; }
  .ai-provider-head .row-actions { margin-inline-start: auto; }
  .ai-provider-body { padding: 16px; }
  .ai-provider-foot { padding: 12px 16px; }
  .ai-pair,
  .ai-slots { grid-template-columns: minmax(0, 1fr); }
}

/* --------------------------------------------------------- discount codes */

/* A code in the list: its letters, and under them what staff noted of it. */
.code-cell { display: grid; gap: 2px; min-width: 0; }
.code-cell b { font-weight: 700; letter-spacing: 0.4px; justify-self: start; }
.code-cell span { font-size: 12px; color: var(--muted); white-space: normal; overflow-wrap: anywhere; }
/* How often it was used, and under it what waits at the gateway. */
.code-use { display: grid; gap: 1px; justify-items: start; }
/* Its letters over its page, and beside a payment's discount. */
.code-letters { letter-spacing: 1px; overflow-wrap: anywhere; }
.code-letters .copyable .ltr { font-size: inherit; white-space: normal; }
.code-chip {
  display: inline-block; margin-inline-end: 8px; padding: 1px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; font-weight: 600;
}
/* A purchase that named it: what was paid, and how it went. */
.use-end { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0; }
/* The form's two choices side by side, and its fields as wide as it is. */
/* Each field from the top: a longer hint under one does not push the
   other's box down. */
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.field .select { width: 100%; height: 46px; }
.input.mono:disabled { opacity: 0.7; cursor: not-allowed; }
@media (max-width: 520px) {
  .field-row { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- support */

.who-ticket { display: grid; line-height: 1.5; min-width: 0; }
.who-ticket b { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.who-ticket span { font-size: 12px; }
/* In the queue a subject or a name takes two lines at most, an email one:
   the columns after them stay on the page. */
.table .who-ticket { max-width: 340px; }
.table .who-ticket b {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  overflow: hidden; white-space: normal;
}
.table .who-ticket span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .who-ticket .prio { margin-inline-end: 6px; vertical-align: -2px; }
.table .prio { color: var(--violet); display: inline-flex; }
.table .prio svg { width: 14px; height: 14px; }
.table .from { display: block; font-size: 11.5px; color: var(--faint); }
.ticket-top { padding: 20px 22px; display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.ticket-title { flex: 1; min-width: 240px; display: grid; gap: 8px; }
.ticket-title h1 { margin: 0; font-size: 20px; font-weight: 800; }
.ticket-title .muted { font-size: 12.5px; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ticket-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.ticket-side { display: grid; gap: 16px; }
.ticket-side .panel-box { background: var(--surface); }
.ticket-side .muted { color: var(--muted); font-size: 12.5px; }
.conversation { display: grid; gap: 12px; padding: 20px; }
.msg {
  max-width: 82%; padding: 12px 14px; border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: var(--surface-2); display: grid; gap: 6px;
}
.msg.mine { justify-self: start; }
.msg.staff { justify-self: end; background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent-2) 30%, transparent); }
.msg-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.ticket-id .ltr { font-size: 12px; }
.msg-head time { margin-inline-start: auto; color: var(--faint); font-size: 12px; white-space: nowrap; }
.msg-body { font-size: 14px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.composer { border-top: 1px solid var(--border); padding: 16px 20px 20px; display: grid; gap: 12px; }
.composer .textarea { min-height: 120px; }
.composer-actions { display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 1100px) {
  .ticket-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .msg { max-width: 94%; }
  .conversation { padding: 14px; }
  .composer { padding: 14px; }
}

/* ------------------------------------------- the support chat's inbox */

/* The conversations and one in full beside them, filling the page's height;
   each scrolls on its own (chats.rs). */
.inbox {
  display: grid; grid-template-columns: 360px minmax(0, 1fr); padding: 0; overflow: hidden;
  height: max(540px, calc(100dvh - var(--topbar-height) - 168px));
}
.ib-list { display: flex; flex-direction: column; min-height: 0; border-inline-end: 1px solid var(--border); }
.ib-list-head { display: grid; gap: 10px; padding: 12px; border-bottom: 1px solid var(--border); }
.ib-tabs { margin: 0; width: auto; max-width: 100%; }
.ib-tabs .tab { height: 34px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.ib-list-head .search .input { height: 40px; border-radius: 12px; }
.ib-rows { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.ib-row-skeleton { padding: 10px 14px; }
.ib-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 12px 14px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none;
  transition: background 0.16s var(--ease);
}
.ib-row:hover { background: var(--hover); }
.ib-row[aria-current="page"] { background: var(--accent-soft); box-shadow: inset -3px 0 0 var(--accent-2); }
.ib-row:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: -2px; }
.ib-row.closed { opacity: 0.7; }
.ib-face { position: relative; display: inline-grid; }
.ib-online {
  position: absolute; bottom: -1px; left: -1px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--success); border: 2px solid var(--surface);
}
.ib-what { display: grid; gap: 3px; min-width: 0; }
.ib-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ib-name b { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-name .tag { padding: 1px 7px; font-size: 10.5px; }
.ib-preview { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-row.unread .ib-preview { color: var(--text-2); font-weight: 600; }
.ib-meta { display: grid; justify-items: end; gap: 5px; font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.ib-meta .nav-badge { margin: 0; }
.ib-wait { display: inline-flex; align-items: center; gap: 3px; color: var(--warning); font-weight: 700; }
.ib-wait svg { width: 12px; height: 12px; }
.ib-wait.late { color: var(--danger); }
.ib-more { margin: 12px auto; display: flex; }

.ib-thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.ib-thread-loading { display: grid; gap: 14px; padding: 18px; }
.ib-none { margin: auto; display: grid; justify-items: center; gap: 10px; max-width: 380px; padding: 30px; text-align: center; }
.ib-none h2 { margin: 0; font-size: 16px; font-weight: 800; }
.ib-none p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.9; }
.ib-thread-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.ib-back { display: none; }
.ib-who { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; min-width: 0; flex: 1 1 200px; }
.ib-who h2 { margin: 0; font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-reach { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; font-size: 12.5px; min-width: 0; }
.ib-reach > * { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-presence { display: inline-flex; align-items: center; gap: 5px; color: var(--faint); font-weight: 600; }
.ib-presence::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ib-presence.on { color: var(--success); }
.ib-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.ib-ticket {
  display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 10px 14px; align-items: end;
  padding: 14px 16px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}
.ib-ticket > p { grid-column: 1 / -1; margin: 0; font-size: 12.5px; line-height: 1.8; }
.ib-ticket-actions { grid-column: 1 / -1; display: flex; gap: 8px; }

.ib-messages {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  display: flex; flex-direction: column; gap: 10px; padding: 18px 20px;
}
.ib-older { align-self: center; }
.ib-day, .ib-new { display: flex; align-items: center; gap: 10px; margin: 4px 0; font-size: 11.5px; font-weight: 700; color: var(--faint); }
.ib-day::before, .ib-day::after, .ib-new::before, .ib-new::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.ib-new { color: var(--danger); }
.ib-new::before, .ib-new::after { background: color-mix(in srgb, var(--danger) 40%, transparent); }
.ib-msg {
  max-width: min(76%, 620px); display: grid; gap: 4px; padding: 10px 14px; border-radius: 16px;
  border: 1px solid var(--border); background: var(--surface-2);
}
/* The visitor at the start of the line, support and the bot at its end. */
.ib-msg.visitor { align-self: flex-start; border-end-start-radius: 5px; }
.ib-msg.staff, .ib-msg.bot { align-self: flex-end; border-end-end-radius: 5px; }
.ib-msg.staff { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent-2) 30%, transparent); }
.ib-msg.bot { background: color-mix(in srgb, var(--surface-3) 60%, transparent); border-style: dashed; }
.ib-msg.pending { opacity: 0.7; }
.ib-msg.failed { opacity: 1; border-color: var(--danger); }
.ib-msg-who { font-size: 11.5px; font-weight: 700; color: var(--accent-2); }
.ib-msg.bot .ib-msg-who { color: var(--muted); }
.ib-msg-body { font-size: 14px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.ib-msg-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 11px; color: var(--faint); }
.ib-handled { color: var(--success); font-weight: 600; }
.ib-seen.on { color: var(--accent-2); font-weight: 700; }
.ib-retry { height: auto; font-size: 11.5px; color: var(--danger); }
.ib-retry svg { width: 13px; height: 13px; }
.ib-typing {
  align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; border-radius: 16px;
  border: 1px solid var(--border); background: var(--surface-2);
}
.ib-typing span[aria-hidden] { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: ib-dots 1.3s infinite; }
.ib-typing span[aria-hidden]:nth-child(2) { animation-delay: 0.18s; }
.ib-typing span[aria-hidden]:nth-child(3) { animation-delay: 0.36s; }
@keyframes ib-dots {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}
.ib-problem { margin: 0 16px 10px; }
.ib-composer { display: flex; align-items: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); }
.ib-composer .textarea { flex: 1; min-height: 46px; max-height: 160px; resize: none; field-sizing: content; }
.ib-composer .btn { width: 46px; height: 46px; padding: 0; flex-shrink: 0; }
.ib-count { margin: -6px 16px 10px; font-size: 11.5px; color: var(--muted); text-align: end; }

/* Narrower, one of the two at a time: the list, or the conversation chosen
   with the way back to the list. */
@media (max-width: 1023px) {
  .inbox { grid-template-columns: minmax(0, 1fr); height: max(520px, calc(100dvh - var(--topbar-height) - 150px)); }
  .inbox.has-open .ib-list { display: none; }
  .inbox:not(.has-open) .ib-thread { display: none; }
  .ib-list { border-inline-end: 0; }
  .ib-back { display: inline-flex; width: 38px; padding: 0; justify-content: center; }
}
@media (max-width: 640px) {
  .ib-messages { padding: 14px; }
  .ib-msg { max-width: 92%; }
  .ib-ticket { grid-template-columns: minmax(0, 1fr); }
}

/* --------------------------------------------- the support chat's bot */

.bot-try { display: flex; gap: 10px; align-items: flex-end; }
.bot-try .field { flex: 1; min-width: 0; }
.bot-verdict {
  display: grid; gap: 8px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface-2);
}
.bot-verdict > b { font-size: 14px; }
.bot-verdict .answer { font-size: 13.5px; line-height: 1.9; color: var(--text-2); }
.bot-verdict .answer p { margin: 0; }
.bot-verdict .answer ul { margin: 4px 0; padding-inline-start: 20px; }
.miss-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.miss-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; align-items: center;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
}
.miss-row b { font-size: 14px; overflow-wrap: anywhere; }
.miss-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 4px; font-size: 12px; color: var(--muted); }
.miss-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.faq-keywords { max-width: 100%; white-space: normal; }
@media (max-width: 640px) {
  .miss-row { grid-template-columns: minmax(0, 1fr); }
  .bot-try { flex-direction: column; align-items: stretch; }
}

/* ------------------------------------------------------ keyboard shortcuts */

.dialog.shortcuts { width: min(580px, 100%); }
.shortcut-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.shortcut-groups h3 { margin: 0 0 6px; font-size: 12px; color: var(--muted); font-weight: 700; }
.shortcut {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px;
}
.shortcut:last-child { border-bottom: 0; }
.shortcut-keys { display: inline-flex; align-items: center; gap: 4px; color: var(--faint); font-size: 12px; white-space: nowrap; }

/* ----------------------------------------------------------- quick search */

.palette-scrim {
  position: fixed; inset: 0; z-index: 90; display: flex; justify-content: center; align-items: flex-start;
  padding: 12vh 16px 16px; background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade 0.14s var(--ease);
}
.palette {
  width: min(600px, 100%); overflow: hidden; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), var(--card-edge); animation: pop 0.18s var(--ease);
}
.palette-field { display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 18px; border-bottom: 1px solid var(--border); }
.palette-field > svg { width: 20px; height: 20px; color: var(--accent-2); }
.palette-field input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; font-size: 16px; }
.palette-field input::placeholder { color: var(--faint); }
.palette-list { list-style: none; margin: 0; padding: 8px; max-height: min(380px, 55vh); overflow-y: auto; }
.palette-item {
  display: flex; align-items: center; gap: 12px; height: 46px; padding: 0 10px; border-radius: var(--radius);
  color: var(--text-2); font-size: 14px; cursor: pointer;
}
.palette-item[aria-selected="true"] { background: var(--accent-soft); color: var(--text); }
.palette-icon {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--surface-3); color: var(--muted); transition: background 0.14s var(--ease), color 0.14s var(--ease);
}
.palette-icon svg { width: 16px; height: 16px; }
.palette-item[aria-selected="true"] .palette-icon { background: var(--accent-grad); color: #fff; }
.palette-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-hint { font-size: 12px; color: var(--faint); white-space: nowrap; }
.palette-foot {
  display: flex; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent); font-size: 12px; color: var(--faint);
}
.palette-foot span { display: inline-flex; align-items: center; gap: 4px; }

/* -------------------------------------------- the sidebar narrowed to icons */

@media (min-width: 1025px) {
  .shell { transition: grid-template-columns 0.25s var(--ease); }
  .shell.rail { grid-template-columns: 78px minmax(0, 1fr); }
  .shell.rail .sidebar { padding-inline: 12px; }
  .shell.rail .sidebar-head { flex-direction: column; gap: 12px; padding: 4px 0 6px; }
  .shell.rail .brand-text { display: none; }
  .shell.rail .rail-btn { margin: 0; }
  .shell.rail .nav-title { height: 1px; padding: 0; margin: 0 12px 6px; overflow: hidden; color: transparent; background: var(--border); }
  .shell.rail .nav-title::after { display: none; }
  .shell.rail .nav-item { justify-content: center; gap: 0; padding: 5px 0; }
  /* Still read out, and shown on hover (the item's title). */
  .shell.rail .nav-label {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap;
  }
  .shell.rail .nav-badge.live {
    position: absolute; top: 1px; inset-inline-end: 6px; min-width: 17px; height: 17px; padding: 0 4px;
    font-size: 10px; box-shadow: 0 0 0 2px var(--bg);
  }
  .shell.rail .me-card { justify-content: center; padding: 6px; background: transparent; border-color: transparent; }
  .shell.rail .me-card .who,
  .shell.rail .me-card .role { display: none; }
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
}

@media (max-width: 1024px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; width: min(300px, 86vw);
    transform: translateX(105%); transition: transform 0.25s var(--ease); box-shadow: var(--shadow-lg);
  }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .scrim {
    display: block; position: fixed; inset: 0; z-index: 25; background: rgba(2, 6, 23, 0.55);
    backdrop-filter: blur(2px); animation: fade 0.2s var(--ease);
  }
  .topbar .menu-btn { display: inline-grid; }
  .rail-btn { display: none; }
  .topbar { top: 10px; width: calc(100% - 24px); margin: 10px 12px 0; padding: 0 8px; }
  .content { padding: 20px 16px; }
}
@keyframes fade { from { opacity: 0; } }

@media (max-width: 1180px) {
  .search-trigger { width: 220px; }
}

@media (max-width: 860px) {
  .search-trigger { width: 40px; padding: 0; justify-content: center; }
  .search-trigger .search-text,
  .search-trigger kbd { display: none; }
}

@media (max-width: 640px) {
  .kpis,
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .legend { width: 100%; }
  .user-btn .label,
  .user-btn > svg,
  .session-chip,
  .crumb-trail,
  .topbar-divider { display: none; }
  .topbar { gap: 6px; height: 58px; }
  .page-mark { width: 34px; height: 34px; border-radius: 10px; }
  .page-mark svg { width: 18px; height: 18px; }
  .login-form-side { padding: 20px; }
  .otp { gap: 7px; }
  .otp input { width: 44px; height: 54px; font-size: 21px; }
  /* Three dates under a narrow chart: the first, one between, the last. */
  .x-label:nth-child(2),
  .x-label:nth-child(4),
  .x-label:nth-child(5) { display: none; }
  .chart { padding-left: 46px; }
  .page-head h1 { font-size: 21px; }
  .toolbar .select { flex: 1 1 140px; }
  .table .wide-only { display: none; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 16px; }
  .fact { padding: 10px; gap: 10px; }
  .fact .chip { width: 32px; height: 32px; }
  .profile-actions { padding: 12px 16px; }
  .profile > .notice { margin: 14px 16px 0; }
  .profile-id h1 { font-size: 20px; }
  .tab-body { padding: 14px; }
  .palette-foot { display: none; }
  .palette-scrim { padding-top: 8vh; }
  .topbar .crumbs strong { max-width: 150px; font-size: 14.5px; }
  .shortcut-groups { grid-template-columns: minmax(0, 1fr); }
  .table.cards thead { display: none; }
  .table.cards,
  .table.cards tbody { display: block; width: 100%; }
  .table.cards tbody { padding: 10px; display: grid; gap: 10px; }
  .table.cards tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; padding: 14px;
    border: 1px solid var(--border); border-radius: 16px; background: color-mix(in srgb, var(--surface-2) 60%, transparent);
  }
  .table.cards tbody tr:last-child { border-bottom: 1px solid var(--border); }
  .table.cards td {
    display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 4px;
    padding: 0; border: 0; white-space: normal; text-align: start; min-width: 0; background: none !important;
  }
  .table.cards td[data-label]::before { content: attr(data-label); color: var(--faint); font-size: 11.5px; font-weight: 600; flex-shrink: 0; }
  .table.cards td.lead {
    order: -1; grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: flex-start;
    padding-bottom: 12px; border-bottom: 1px dashed var(--border);
  }
  .table.cards td.wide-only { display: flex; }
  .table.cards td.chev { display: none; }
  .table.cards td.row-end { justify-content: flex-start; width: auto; }
  .table.cards td.row-end:empty { display: none; }
  .table.cards td.why-cell { align-items: flex-start; }
  /* A card's chips break their words rather than run off its edge. */
  .table.cards td > * { max-width: 100%; }
  .table.cards .tags { min-width: 0; }
  .table.cards .tag { white-space: normal; }
  .table.cards .who-ticket { max-width: 100%; }
  /* Tabs that do not fit go on a second line: none is out of sight. */
  .seg,
  .tabs { flex-wrap: wrap; }
  .table.cards .code-use { justify-items: start; }
  .table.cards td[colspan] { display: block; grid-column: 1 / -1; }
  .table.cards tbody tr.link:hover td:first-child { box-shadow: none; }
  .profile-top { padding: 48px 16px 0; gap: 14px; flex-direction: column; align-items: flex-start; }
  .profile-id { min-width: 0; width: 100%; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px 14px; flex-direction: column; align-items: flex-start; gap: 8px; }
  .stat .chip { width: 34px; height: 34px; }
  .stat .v { font-size: 16px; }
  .profile-top .avatar { width: 72px; height: 72px; font-size: 22px; border-radius: 22px; }
  .dialog-head { padding: 20px 18px 16px; gap: 12px; }
  .dialog-head .chip { width: 42px; height: 42px; border-radius: 13px; }
  .dialog-body { padding: 16px 18px 18px; }
  .dialog-body > .dialog-foot { margin: 4px -18px -18px; padding: 12px 18px; }
  .dialog-foot { padding: 12px 18px; }
}

/* ---------------------------------------------------------- authenticator */

/* Signing in another way: a quiet link under the button. */
.login-switch { justify-self: center; display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; }
.login-switch svg { width: 16px; height: 16px; }
.recovery-input { text-align: center; letter-spacing: 2px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 17px; }

/* Setting a key up: its QR on a white tile — scanners read dark on light,
   whatever the theme — then what to do, step by step. */
.enroll-card { max-width: 440px; }
.enroll-who { color: var(--muted); font-size: 13px; }
.key-setup { display: grid; gap: 18px; justify-items: center; }
.qr-tile {
  width: 196px; height: 196px; padding: 10px; border-radius: 18px; background: #fff;
  box-shadow: 0 0 0 1px var(--border), 0 18px 40px -24px rgba(2, 6, 23, 0.45);
}
.qr-tile svg { width: 100%; height: 100%; display: block; }
.key-steps { margin: 0; padding: 0; list-style: none; counter-reset: key; display: grid; gap: 12px; width: 100%; }
.key-steps li {
  counter-increment: key; position: relative; display: grid; gap: 4px; justify-items: start;
  padding-inline-start: 36px; font-size: 13px; color: var(--muted); line-height: 1.8;
}
.key-steps li::before {
  content: counter(key, persian); position: absolute; inset-inline-start: 0; top: 0;
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; background: var(--accent-soft); color: var(--accent-2);
}
.key-steps b { color: var(--text); font-size: 13.5px; }
.key-text {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  padding: 5px; padding-inline-start: 12px; border-radius: 12px;
  background: var(--surface-2); border: 1px dashed var(--border-strong);
}
.key-text code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; letter-spacing: 1px;
  color: var(--text); overflow-wrap: anywhere;
}

/* Recovery codes, shown once: two columns read left to right. */
.recovery-shown { display: grid; gap: 14px; }
.recovery-codes {
  margin: 0; padding: 14px; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px;
  border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); direction: ltr;
}
.recovery-codes li { text-align: center; }
.recovery-codes code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; letter-spacing: 1px; color: var(--text); }
.recovery-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.keep-check { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
.keep-check input { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }

/* «امنیت حساب من». */
.pill.good { background: var(--success-soft); color: var(--success); }
.security-body { display: grid; gap: 16px; align-content: start; }
.security-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.kv-list { margin: 0; display: grid; gap: 10px; }
.kv-list > div {
  display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.kv-list dt { color: var(--muted); flex-shrink: 0; }
.kv-list dd { margin: 0; color: var(--text); font-weight: 600; text-align: end; }
.recovery-left { display: flex; align-items: baseline; gap: 8px; }
.recovery-left strong { font-size: 34px; font-weight: 800; letter-spacing: -0.5px; line-height: 1; }
.recovery-left span { color: var(--muted); font-size: 13.5px; }
.recovery-meter { height: 8px; }
.meter.warn i { background: var(--warning); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  /* Still, not sweeping: the whole line while the wait lasts. */
  .workbar::before { animation: none !important; left: 0; width: 100%; }
  .toast::after { display: none; }
}
