/* ==========================================================================
   Suprata Caption — design system
   Brand: purple #8B4FE0 → blue #1E8FE8 → teal #2FD9D0 on deep plum.
   ========================================================================== */

:root {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --purple: #8B4FE0;
  --blue: #1E8FE8;
  --teal: #2FD9D0;
  --plum: #42344F;
  --grad: linear-gradient(120deg, #8B4FE0 0%, #4F6FF0 45%, #1E8FE8 70%, #2FD9D0 100%);
  --grad-soft: linear-gradient(120deg, rgba(139,79,224,.12), rgba(30,143,232,.10) 60%, rgba(47,217,208,.12));

  --bg: #F5F4FA;
  --bg-tint: #EFEDF7;
  --surface: #FFFFFF;
  --surface-2: #FAF9FD;
  --surface-3: #F2F0F8;
  --border: #E5E1EE;
  --border-strong: #D3CDE0;
  --ink: #1C1527;
  --ink-2: #463F52;
  --muted: #736B82;
  --faint: #A79FB5;

  --accent: #6A3BD6;
  --accent-hover: #5B2FC4;
  --accent-ink: #FFFFFF;
  --accent-soft: #F0EAFE;
  --ring: 0 0 0 3px rgba(106, 59, 214, .30);

  --ok: #0B8A5E;      --ok-bg: #E4F6EE;
  --warn: #A55F00;    --warn-bg: #FFF3DD;
  --bad: #C92F43;     --bad-bg: #FDEBEE;
  --info: #1A62C9;    --info-bg: #E7F0FD;
  --muted-bg: #F0EEF4;

  --side-bg: #150F1F;
  --side-bg-2: #1D1529;
  --side-ink: #CFC6DE;
  --side-muted: #8A7F9C;
  --side-active: rgba(255,255,255,.08);

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(28, 21, 39, .05);
  --shadow: 0 1px 2px rgba(28, 21, 39, .04), 0 10px 30px -14px rgba(28, 21, 39, .16);
  --shadow-lg: 0 24px 60px -20px rgba(28, 21, 39, .35);
  --side-w: 248px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D0913; --bg-tint: #120D1A; --surface: #17111F; --surface-2: #1C1526; --surface-3: #231B2F;
    --border: #2A2236; --border-strong: #3A3049; --ink: #EFEAF7; --ink-2: #CFC7DC; --muted: #9D94AE; --faint: #6E6580;
    --accent: #A07CFF; --accent-hover: #B496FF; --accent-ink: #120B1C; --accent-soft: #261C3A; --ring: 0 0 0 3px rgba(160, 124, 255, .35);
    --ok: #3FD49B; --ok-bg: #0F2A21; --warn: #F2B24C; --warn-bg: #2E2210; --bad: #FF6B7D; --bad-bg: #331620; --info: #6FB0FF; --info-bg: #11233A; --muted-bg: #221B2C;
    --side-bg: #0A0710; --side-bg-2: #110C18;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D0913; --bg-tint: #120D1A; --surface: #17111F; --surface-2: #1C1526; --surface-3: #231B2F;
  --border: #2A2236; --border-strong: #3A3049; --ink: #EFEAF7; --ink-2: #CFC7DC; --muted: #9D94AE; --faint: #6E6580;
  --accent: #A07CFF; --accent-hover: #B496FF; --accent-ink: #120B1C; --accent-soft: #261C3A; --ring: 0 0 0 3px rgba(160, 124, 255, .35);
  --ok: #3FD49B; --ok-bg: #0F2A21; --warn: #F2B24C; --warn-bg: #2E2210; --bad: #FF6B7D; --bad-bg: #331620; --info: #6FB0FF; --info-bg: #11233A; --muted-bg: #221B2C;
  --side-bg: #0A0710; --side-bg-2: #110C18;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.55; color: var(--ink);
  background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img, svg, video { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; color: var(--ink); letter-spacing: -0.015em; line-height: 1.25; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 .75em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
code, kbd, .mono { font-family: var(--mono); font-size: .92em; }
kbd {
  display: inline-block; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--border-strong);
  border-bottom-width: 2px; background: var(--surface); color: var(--ink-2); font-size: 11.5px; line-height: 1.5;
}
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 1000; background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: 10px; font-weight: 600; }
.skip-link:focus { top: 12px; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- app shell */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  background: radial-gradient(120% 60% at 0% 0%, rgba(139,79,224,.22), transparent 60%),
              radial-gradient(90% 50% at 100% 100%, rgba(47,217,208,.10), transparent 60%),
              linear-gradient(180deg, var(--side-bg-2), var(--side-bg));
  color: var(--side-ink); padding: 22px 14px 16px; border-right: 1px solid rgba(255,255,255,.04);
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px 18px; }
.side-brand img { height: 30px; width: auto; flex: none; object-fit: contain; }
.side-brand .product { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--side-muted); border-left: 1px solid rgba(255,255,255,.14); padding-left: 10px; }
.side-org {
  display: flex; align-items: center; gap: 10px; margin: 0 4px 18px; padding: 10px 12px; border-radius: 12px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.06);
}
.side-org .avatar { width: 32px; height: 32px; font-size: 12px; }
.side-org-name { font-weight: 600; color: #fff; font-size: 13.5px; line-height: 1.25; }
.side-org-sub { font-size: 11.5px; color: var(--side-muted); }
.side-label { font-size: 10.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--side-muted); padding: 14px 12px 6px; }
.side nav a {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 12px; margin: 1px 0; border-radius: 10px;
  color: var(--side-ink); font-weight: 500; font-size: 14px; transition: background .15s, color .15s;
}
.side nav a:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.side nav a.is-active { background: var(--side-active); color: #fff; }
.side nav a.is-active::before {
  content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad);
}
.side nav a.is-active .icon { color: #B79BFF; }
.side nav .count { margin-left: auto; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: rgba(255,255,255,.1); color: #fff; }
.side nav .count.hot { background: linear-gradient(120deg, #8B4FE0, #1E8FE8); }
.side-foot { margin-top: auto; padding: 14px 6px 0; border-top: 1px solid rgba(255,255,255,.07); display: grid; gap: 4px; }
.side-foot a, .side-foot button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 9px; color: var(--side-muted);
  font: inherit; font-size: 13.5px; background: none; border: 0; cursor: pointer; text-align: left;
}
.side-foot a:hover, .side-foot button:hover { color: #fff; background: rgba(255,255,255,.05); text-decoration: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 12px 32px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.topbar .crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; min-width: 0; }
.topbar .crumbs a { color: var(--muted); }
.topbar .crumbs .sep { color: var(--faint); }
.topbar .crumbs .here { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.menu-toggle { display: none; }
.content { padding: 28px 32px 56px; width: 100%; max-width: 1360px; }
.content.wide { max-width: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.page-head p.lede { color: var(--muted); margin: 6px 0 0; max-width: 70ch; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- surfaces */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 22px 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 9px; }
.card-head .icon { color: var(--accent); }
.card-body { padding: 20px 22px; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card + .card { margin-top: 20px; }
.grid > .card + .card, .stack > .card + .card, .split > .card + .card, .split-wide > .card + .card { margin-top: 0; }
.card.glow { position: relative; }
.card.glow::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; background: var(--grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; opacity: .7;
}
/* minmax(0, 1fr), not the implicit auto column: an auto column grows to fit unbreakable content
   (a long file name or URL) and pushes the card out from under its neighbour. */
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.split-wide { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi { position: relative; overflow: hidden; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.kpi .label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; display: flex; align-items: center; gap: 7px; }
.kpi .value { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi.feature { background: var(--grad); border: 0; color: #fff; }
.kpi.feature .label, .kpi.feature .sub { color: rgba(255,255,255,.82); }
.kpi.feature .value { color: #fff; }
.kpi .meter { height: 6px; border-radius: 99px; background: var(--surface-3); margin-top: 12px; overflow: hidden; }
.kpi .meter > i { display: block; height: 100%; background: var(--grad); border-radius: inherit; }
.kpi.feature .meter { background: rgba(255,255,255,.25); }
.kpi.feature .meter > i { background: #fff; }
.kpi.is-bad .value { color: var(--bad); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  font: inherit; font-weight: 600; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--border-strong);
  cursor: pointer; white-space: nowrap; transition: transform .06s, background .15s, border-color .15s, box-shadow .15s; text-decoration: none !important;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary {
  color: #fff; border: 0; background: linear-gradient(120deg, #7A44DE, #4E66EC 60%, #1E8FE8);
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 8px 20px -8px rgba(106, 59, 214, .65);
}
.btn-primary:hover { background: linear-gradient(120deg, #6C38D0, #4258DE 60%, #1580D6); color: #fff; }
.btn-accent { color: var(--accent-ink); background: var(--accent); border-color: transparent; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { color: #fff; background: var(--bad); border-color: transparent; }
.btn-danger:hover { background: #B02538; }
.btn-soft { background: var(--accent-soft); color: var(--accent); border-color: transparent; box-shadow: none; }
.btn-soft:hover { background: color-mix(in srgb, var(--accent-soft) 80%, var(--accent) 20%); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15.5px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  white-space: nowrap; background: var(--muted-bg); color: var(--muted);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill.no-dot::before { display: none; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill-muted { background: var(--muted-bg); color: var(--muted); }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 7px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--ink-2); border: 1px solid var(--border); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em;
  padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table th.right, .table td.right { text-align: right; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.is-link { cursor: pointer; }
.table .title-cell a { color: var(--ink); font-weight: 600; }
.table .title-cell .sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.table.compact td { padding: 9px 14px; }
.table.compact th { padding: 9px 14px; }
.card > .table-wrap:first-child table th:first-child { border-top-left-radius: var(--radius); }
.card > .table-wrap:first-child table th:last-child { border-top-right-radius: var(--radius); }

/* ---------------------------------------------------------------- forms */
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin-bottom: 16px; }
.field > label, .label { font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.field .error { font-size: 12.5px; color: var(--bad); font-weight: 600; }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 9px 13px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 14.5px; transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23736B82' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.input-sm, .select-sm { min-height: 34px; padding: 5px 10px; font-size: 13.5px; }
.select-sm { padding-right: 32px; background-position: right 10px center; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.check .t { font-weight: 600; display: block; }
.check .d { font-size: 12.5px; color: var(--muted); display: block; }
.switch-row { position: relative; display: flex; align-items: flex-start; gap: 12px; cursor: pointer; font-weight: 400; }
.switch-row input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch { flex: none; position: relative; width: 40px; height: 22px; margin-top: 1px; border-radius: 999px; background: var(--border-strong); transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { transform: translateX(18px); }
.switch-row input:focus-visible + .switch { box-shadow: var(--ring); }
.switch-text .t { font-weight: 600; display: block; }
.switch-text .d { font-size: 12.5px; font-weight: 400; color: var(--muted); display: block; }
.switch-row input:checked ~ .switch-text .d { color: var(--warn); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; align-items: start; }
.form-grid .full { grid-column: 1 / -1; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin: 0; }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; padding: 16px 20px; }
.filters .field { margin: 0; min-width: 170px; }

/* segmented control */
.seg { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--border); gap: 2px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { padding: 7px 14px; border-radius: 9px; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.seg input:checked + label { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg input:focus-visible + label { box-shadow: var(--ring); }

/* choice cards */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.choice { position: relative; display: block; }
.choice input { position: absolute; opacity: 0; }
.choice .box { display: grid; gap: 4px; padding: 14px 16px; border-radius: 12px; border: 1.5px solid var(--border-strong); background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.choice .box strong { display: flex; align-items: center; gap: 8px; }
.choice .box span { font-size: 12.5px; color: var(--muted); }
.choice input:checked + .box { border-color: var(--accent); box-shadow: var(--ring); background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.choice input:focus-visible + .box { box-shadow: var(--ring); }

/* ---------------------------------------------------------------- alerts / flash */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: 12px; border: 1px solid; font-size: 14px; margin-bottom: 16px; }
.alert .icon { margin-top: 1px; }
.alert-info { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 25%, transparent); color: var(--info); }
.alert-ok, .alert-success { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 25%, transparent); color: var(--ok); }
.alert-warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 25%, transparent); color: var(--warn); }
.alert-error, .alert-bad { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 25%, transparent); color: var(--bad); }
.alert .body { color: var(--ink-2); }
.alert .body strong { color: var(--ink); }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 10px; width: min(380px, calc(100vw - 40px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 13px 16px; border-radius: 12px; background: #1F1729; color: #fff; box-shadow: var(--shadow-lg);
  font-size: 14px; animation: toast-in .25s ease-out;
}
.toast.ok .icon { color: #3FD49B; } .toast.error .icon { color: #FF6B7D; } .toast.info .icon { color: #8FC2FF; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------------------------------------------------------- empty states */
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty .badge { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--grad-soft); color: var(--accent); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

/* ---------------------------------------------------------------- avatar */
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--grad); color: #fff; font-weight: 700; font-size: 13px; flex: none; }

/* ---------------------------------------------------------------- definition list */
.dl { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px 16px; margin: 0; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- stage tracker */
.stages { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; position: relative; margin: 4px 0 6px; }
.stage { position: relative; display: grid; justify-items: center; gap: 8px; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.stage .dot { position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--border-strong); color: var(--faint); }
.stage .dot .icon { width: 15px; height: 15px; }
.stage::before { content: ""; position: absolute; top: 15px; left: -50%; right: 50%; height: 2px; background: var(--border-strong); }
.stage:first-child::before { display: none; }
.stage.done { color: var(--ink-2); }
.stage.done .dot { background: var(--grad); border-color: transparent; color: #fff; }
.stage.done::before, .stage.current::before { background: linear-gradient(90deg, #8B4FE0, #1E8FE8); }
.stage.current { color: var(--ink); }
.stage.current .dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 16%, transparent); }
.stage.current .dot::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--accent); opacity: .35; animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { from { transform: scale(.85); opacity: .5; } to { transform: scale(1.25); opacity: 0; } }

/* ---------------------------------------------------------------- timeline */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { position: relative; padding: 0 0 16px 26px; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.timeline li::after { content: ""; position: absolute; left: 10px; top: 20px; bottom: 2px; width: 1px; background: var(--border-strong); }
.timeline li:last-child::after { display: none; }
.timeline .when { font-size: 12px; color: var(--muted); }
.timeline .who { font-weight: 600; }

/* ---------------------------------------------------------------- progress */
.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--grad); border-radius: inherit; transition: width .3s; }
.progress.indeterminate > i { width: 35%; animation: indet 1.3s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

/* ---------------------------------------------------------------- dropzone */
.dropzone {
  position: relative; display: grid; place-items: center; gap: 10px; padding: 38px 24px; text-align: center; border-radius: 16px;
  border: 2px dashed var(--border-strong); background: var(--surface-2); transition: border-color .15s, background .15s; cursor: pointer;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 50%, var(--surface)); }
.dropzone .badge { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--grad); color: #fff; box-shadow: 0 10px 24px -10px rgba(106,59,214,.7); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-file { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.upload-file .meta { flex: 1; min-width: 0; }
.upload-file .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a, .tabs button {
  padding: 10px 14px; font-weight: 600; font-size: 14px; color: var(--muted); border: 0; background: none; cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-family: inherit;
}
.tabs a:hover, .tabs button:hover { color: var(--ink); text-decoration: none; }
.tabs .is-active, .tabs [aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------------------------------------------------------------- dialog */
dialog.modal { border: 0; padding: 0; border-radius: 18px; width: min(520px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog.modal::backdrop { background: rgba(14, 9, 20, .55); backdrop-filter: blur(4px); }
.modal-head { padding: 20px 22px 0; }
.modal-body { padding: 14px 22px 4px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px 20px; }

/* ---------------------------------------------------------------- pagination */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--border); font-size: 13.5px; color: var(--muted); }

/* ---------------------------------------------------------------- downloads */
.downloads { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.dl-btn {
  display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink);
  transition: border-color .15s, transform .08s, background .15s;
}
.dl-btn:hover { border-color: var(--accent); background: var(--surface); text-decoration: none; transform: translateY(-1px); }
.dl-btn strong { display: flex; align-items: center; gap: 7px; font-size: 14px; }
.dl-btn span { font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------------- player + interactive transcript */
.player { position: relative; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 16 / 9; }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.player.audio-only { aspect-ratio: auto; background: var(--grad); padding: 30px 18px 14px; }
.transcript-pane { max-height: 520px; overflow-y: auto; padding: 4px 4px 4px 0; scroll-behavior: smooth; }
.t-para { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 4px 14px; padding: 10px 12px; border-radius: 10px; }
.t-para:hover { background: var(--surface-2); }
.t-time { font-family: var(--mono); font-size: 12px; color: var(--muted); padding-top: 3px; cursor: pointer; background: none; border: 0; text-align: left; }
.t-time:hover { color: var(--accent); }
.t-speaker { grid-column: 2; font-weight: 700; font-size: 12.5px; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
.t-text { grid-column: 2; line-height: 1.75; font-size: 15px; }
.t-text .w { cursor: pointer; border-radius: 4px; padding: 1px 0; transition: background .1s; }
.t-text .w:hover { background: var(--accent-soft); }
.t-text .w.now { background: color-mix(in srgb, var(--teal) 35%, transparent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--teal) 35%, transparent); }
mark.hit { background: color-mix(in srgb, #FFD54A 55%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------------------------------------------------------------- search results */
.result { padding: 18px 22px; border-bottom: 1px solid var(--border); }
.result:last-child { border-bottom: 0; }
.result h3 a { color: var(--ink); }
.result .moments { display: grid; gap: 6px; margin-top: 10px; }
.result .moment { display: flex; gap: 12px; align-items: baseline; font-size: 14px; padding: 6px 10px; border-radius: 9px; background: var(--surface-2); }
.result .moment a.time { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }

/* ---------------------------------------------------------------- bars (simple charts) */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) 80px; gap: 12px; align-items: center; font-size: 13.5px; }
.bar-row .track { height: 12px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar-row .track > i { display: block; height: 100%; background: var(--grad); border-radius: inherit; min-width: 2px; }
.colchart { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 10px; }
.colchart .col { flex: 1; display: grid; justify-items: center; gap: 6px; height: 100%; align-content: end; min-width: 0; }
.colchart .col i { display: block; width: 100%; max-width: 46px; border-radius: 8px 8px 3px 3px; background: var(--grad); min-height: 3px; }
.colchart .col span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.colchart .col b { font-size: 11.5px; font-weight: 600; color: var(--ink-2); }

/* ---------------------------------------------------------------- auth / landing */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr); background: var(--bg); }
.auth-hero {
  position: relative; overflow: hidden; display: flex; flex-direction: column; padding: 44px 56px; color: #fff;
  background: radial-gradient(70% 60% at 15% 10%, rgba(139,79,224,.75), transparent 70%),
              radial-gradient(60% 55% at 90% 85%, rgba(47,217,208,.55), transparent 70%),
              radial-gradient(50% 50% at 70% 30%, rgba(30,143,232,.55), transparent 70%),
              #120C1B;
}
.auth-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .18;
  background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(70% 70% at 50% 50%, #000, transparent);
}
.auth-hero > * { position: relative; z-index: 1; }
.auth-hero .logo { height: 40px; width: auto; max-width: 100%; align-self: flex-start; object-fit: contain; }
.auth-hero .pitch { margin-top: auto; max-width: 560px; }
.auth-hero h1 { color: #fff; font-size: 44px; line-height: 1.08; letter-spacing: -0.035em; }
.auth-hero p { color: rgba(255,255,255,.8); font-size: 16.5px; margin-top: 16px; }
.auth-hero .points { display: grid; gap: 12px; margin: 30px 0 0; padding: 0; list-style: none; }
.auth-hero .points li { display: flex; gap: 12px; align-items: center; color: rgba(255,255,255,.92); font-size: 15px; }
.auth-hero .points .icon { width: 30px; height: 30px; padding: 6px; border-radius: 9px; background: rgba(255,255,255,.12); color: #fff; }
.caption-demo { margin-top: 34px; display: inline-block; background: rgba(0,0,0,.6); color: #fff; font-family: var(--mono); font-size: 15px; line-height: 1.5; padding: 8px 14px; border-radius: 6px; }
.auth-panel { display: grid; place-items: center; padding: 40px 28px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 26px; letter-spacing: -0.025em; }
.auth-card .sub { color: var(--muted); margin: 8px 0 26px; }
.sso-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; height: 54px; border-radius: 14px; border: 0; cursor: pointer;
  font: inherit; font-size: 16px; font-weight: 650; color: #fff; text-decoration: none !important;
  background: linear-gradient(120deg, #7A44DE, #4E66EC 55%, #1E8FE8); box-shadow: 0 14px 30px -14px rgba(106,59,214,.9), 0 1px 0 rgba(255,255,255,.25) inset;
  transition: transform .08s, filter .15s;
}
.sso-btn:hover { filter: brightness(1.06); color: #fff; }
.sso-btn:active { transform: translateY(1px); }
.sso-btn .mark { width: 26px; height: 26px; border-radius: 8px; background: rgba(255,255,255,.18); display: grid; place-items: center; }
.auth-card .fine { font-size: 12.5px; color: var(--muted); margin-top: 22px; line-height: 1.6; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; margin: 22px 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* bare pages (errors) */
.bare { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.bare .card { max-width: 520px; width: 100%; text-align: center; padding: 40px 32px; }
.bare .code { font-size: 64px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }

/* ---------------------------------------------------------------- misc */
.notice-bar { display: flex; align-items: center; gap: 10px; padding: 10px 32px; font-size: 13.5px; background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid color-mix(in srgb, var(--warn) 20%, transparent); }
.notice-bar.info { background: var(--info-bg); color: var(--info); }
.notice-bar.dev { background: #1F1729; color: #E8DFFF; border-bottom-color: transparent; }
.notice-bar a { color: inherit; font-weight: 700; text-decoration: underline; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-rows > li { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-bottom: 1px solid var(--border); }
.list-rows > li:last-child { border-bottom: 0; }
.chip-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
.sticky-side { position: sticky; top: 88px; }
details.disclosure > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
details.disclosure > summary::-webkit-details-marker { display: none; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px 24px; }
.perm-group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 10px; }
.perm-group .check { margin-bottom: 10px; }
.code-box { font-family: var(--mono); font-size: 13px; padding: 12px 14px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--border); overflow-wrap: anywhere; }
.meta-list { display: grid; gap: 4px; }
.heat { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--surface-3); }
.heat i { flex: 1; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .split, .split-wide { grid-template-columns: minmax(0, 1fr); }
  .sticky-side { position: static; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 100; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .side { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(10,6,16,.5); z-index: 90; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 10px 16px; }
  .content { padding: 20px 16px 48px; }
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-hero { padding: 28px 22px 34px; }
  .auth-hero h1 { font-size: 32px; }
  .auth-hero .pitch { margin-top: 36px; }
  .dl { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .dl dd { margin-bottom: 8px; }
  .stage { font-size: 11px; }
  .bar-row { grid-template-columns: 90px minmax(0, 1fr) 60px; }
  .notice-bar { padding: 10px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .side, .topbar, .page-actions, .no-print, .notice-bar { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #ccc; }
  body { background: #fff; }
}

/* ---------------------------------------------------------------- public pages (privacy, terms) */
.public-page { background: var(--bg); }
.public-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 28px; border-bottom: 1px solid var(--border); background: var(--surface); }
.public-top nav { gap: 18px; font-size: 14px; }
.public-top nav a:not(.btn) { color: var(--ink-2); text-decoration: none; }
.public-top nav a[aria-current] { color: var(--accent); font-weight: 600; }
.public-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.public-brand img { height: 30px; width: auto; }
.public-brand .product { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); border-left: 1px solid var(--border); padding-left: 10px; }
.public-main { padding: 40px 20px 56px; }
.legal { max-width: 760px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 36px 40px; box-shadow: var(--shadow-sm); }
.legal h1 { font-size: 30px; letter-spacing: -0.02em; margin-bottom: 6px; }
.legal h2 { font-size: 19px; margin: 30px 0 10px; }
.legal h3 { font-size: 15.5px; margin: 20px 0 8px; }
.legal p, .legal li { line-height: 1.65; color: var(--ink-2); }
.legal p { margin: 0 0 12px; }
.legal ul { margin: 0 0 12px; padding-left: 22px; }
.legal li { margin-bottom: 6px; }
.legal-address { white-space: normal; }
.public-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; max-width: 760px; margin: 0 auto; padding: 0 20px 40px; font-size: 13px; color: var(--muted); }
.public-foot .row { gap: 16px; }
.auth-links { text-align: center; }
@media (max-width: 640px) {
  .public-top { padding: 14px 16px; }
  .public-top nav { gap: 12px; }
  .public-main { padding: 20px 12px 40px; }
  .legal { padding: 22px 18px; }
}

/* ---------------------------------------------------------------- YouTube channel picker */
.yt-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; object-fit: cover; background: var(--surface-3); }
.yt-points { display: grid; gap: 12px; max-width: 560px; margin: 8px auto 0; }
.yt-points li { display: flex; gap: 10px; align-items: flex-start; color: var(--ink-2); line-height: 1.55; }
.yt-points .icon { flex: none; margin-top: 3px; color: var(--accent); }
.yt-list > li { display: flex; align-items: center; gap: 16px; padding: 12px 22px; border-bottom: 1px solid var(--border); }
.yt-list > li:last-child { border-bottom: 0; }
.yt-thumb-link { position: relative; flex: none; display: block; line-height: 0; }
.yt-thumb { display: block; width: 168px; aspect-ratio: 16 / 9; height: auto; border-radius: 8px; object-fit: cover; background: var(--surface-3); }
.yt-dur { position: absolute; right: 6px; bottom: 6px; padding: 2px 5px; border-radius: 4px; background: rgba(0,0,0,.78); color: #fff; font-size: 11.5px; font-weight: 600; line-height: 1.3; }
.yt-meta { flex: 1; min-width: 0; }
.yt-title { font-weight: 600; color: var(--ink); line-height: 1.4; margin-bottom: 4px; overflow-wrap: anywhere; }
.yt-action { flex: none; }
.yt-picked { display: flex; gap: 16px; align-items: flex-start; }
.yt-picked .yt-thumb { width: 220px; }
@media (max-width: 640px) {
  .yt-list > li { flex-wrap: wrap; padding: 12px 16px; gap: 12px; }
  .yt-thumb { width: 120px; }
  .yt-action { width: 100%; }
  .yt-picked { flex-direction: column; }
  .yt-picked .yt-thumb { width: 100%; }
}