/* Vietnamese STT — design system. No external fonts or assets. */

/* ---------------------------------------------------------------- tokens */
:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e9ecf1;
  --border: #e3e7ed;
  --border-strong: #cfd5de;
  --text: #0f172a;
  --text-2: #475467;
  --text-3: #667085;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-text: #4338ca;
  --on-accent: #ffffff;
  --ok: #067647; --ok-soft: #ecfdf3; --ok-border: #abefc6;
  --warn: #b54708; --warn-soft: #fffaeb; --warn-border: #fedf89;
  --err: #b42318; --err-soft: #fef3f2; --err-border: #fecdca;
  --info: #175cd3; --info-soft: #eff8ff; --info-border: #b2ddff;
  --viz-1: #4f46e5;                 /* validated: chart series, light surface */
  --grid: #eaecf0;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 12px -2px rgba(16, 24, 40, .10), 0 2px 4px -2px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 40px -8px rgba(16, 24, 40, .18);
  --radius-sm: 6px; --radius: 10px; --radius-lg: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sidebar: 252px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0b0d12;
    --surface: #12151c;
    --surface-2: #181c25;
    --surface-3: #222734;
    --border: #252b37;
    --border-strong: #353c4b;
    --text: #e8eaf0;
    --text-2: #b1b8c6;
    --text-3: #8a93a5;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-soft: #1e1b4b;
    --accent-text: #a5b4fc;
    --on-accent: #0b0d12;
    --ok: #47cd89; --ok-soft: #0c2a1c; --ok-border: #145a38;
    --warn: #fdb022; --warn-soft: #2e2106; --warn-border: #5c3d06;
    --err: #f97066; --err-soft: #2d1210; --err-border: #6b2019;
    --info: #53b1fd; --info-soft: #0b2240; --info-border: #194185;
    --viz-1: #6366f1;               /* validated: chart series, dark surface */
    --grid: #232835;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 4px 14px -2px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .7);
  }
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14.5px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; }
h1 { font-size: 24px; font-weight: 650; line-height: 1.25; }
h2 { font-size: 16px; font-weight: 620; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }
.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; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm); box-shadow: var(--shadow-md); }
.skip-link:focus { top: 12px; }
.hidden { display: none !important; }
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
svg.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.icon.sm { width: 16px; height: 16px; }
svg.icon.lg { width: 22px; height: 22px; }

/* ---------------------------------------------------------------- layout */
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.nowrap-row { flex-wrap: nowrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 960px) { .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); } }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border-right: 1px solid var(--border); padding: 16px 12px; overflow-y: auto;
}
.brand-mark { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.brand-mark:hover { text-decoration: none; }
.brand-logo { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #7c3aed); display: grid; place-items: center; color: #fff; }
.brand-logo svg { width: 18px; height: 18px; stroke: #fff; }
.nav-section { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding: 14px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); font-weight: 520; }
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.plan-box { background: var(--surface-2); border-radius: var(--radius); padding: 12px; margin: 8px 0 12px; }
.plan-box .meter { margin: 8px 0 6px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font-weight: 650; font-size: 13px; flex: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.content { padding: 28px 32px 64px; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head p { color: var(--text-3); margin-top: 4px; }
.scrim { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; width: min(86vw, 300px); transform: translateX(-100%); transition: transform .2s var(--ease); box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(15, 23, 42, .45); }
  .topbar { display: flex; }
  .content { padding: 20px 16px 56px; }
}

/* ---------------------------------------------------------------- surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 16px; }
:is(.grid2, .grid3, .stack, .stack-lg) > .card + .card { margin-top: 0; }
.stack > .card + .card { margin-top: 12px; }
.stack-lg > .card + .card { margin-top: 20px; }
@media (max-width: 600px) { .hide-sm { display: none; } }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head p { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.card.flush { padding: 0; }
.card.flush .card-head { padding: 16px 20px 0; }
.divider { height: 1px; background: var(--border); margin: 16px 0; border: 0; }

/* ---------------------------------------------------------------- buttons */
.btn {
  --b-bg: var(--surface); --b-fg: var(--text); --b-bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 14px; line-height: 20px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--b-bd);
  background: var(--b-bg); color: var(--b-fg); cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.btn:hover:not(:disabled) { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.primary { --b-bg: var(--accent); --b-fg: var(--on-accent); --b-bd: var(--accent); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { --b-fg: var(--err); }
.btn.danger:hover:not(:disabled) { background: var(--err-soft); border-color: var(--err-border); }
.btn.danger-solid { --b-bg: var(--err); --b-fg: #fff; --b-bd: var(--err); }
.btn.danger-solid:hover:not(:disabled) { filter: brightness(1.08); background: var(--err); }
.btn.ghost { --b-bg: transparent; --b-bd: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn.icon-only { padding: 7px; }
.btn.sm.icon-only { padding: 5px; }
.btn.block { width: 100%; }
.btn .spinner { width: 14px; height: 14px; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-text); cursor: pointer; font-weight: 550; }
.link-btn:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- forms */
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.hint { font-size: 12.5px; color: var(--text-3); }
.input, .select, .textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 9px 12px;
  box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-2); color: var(--text-3); }
.input[aria-invalid="true"] { border-color: var(--err); }
.textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-icon .input { padding-left: 36px; }
.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); position: relative; flex: none; cursor: pointer; transition: background .15s; margin-top: 1px; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s var(--ease); }
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:disabled { opacity: .5; cursor: not-allowed; }
.switch strong { display: block; font-weight: 600; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); min-height: 42px; }
.chips:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-soft); color: var(--accent-text); border-radius: 6px; padding: 3px 4px 3px 8px; font-size: 13px; font-weight: 550; }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 2px; display: inline-flex; border-radius: 4px; }
.chip button:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.chips input { border: 0; outline: 0; flex: 1; min-width: 140px; font: inherit; color: var(--text); background: transparent; padding: 3px 4px; }

/* ---------------------------------------------------------------- feedback */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge.queued { color: var(--text-2); }
.badge.processing { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.badge.processing::before { animation: pulse 1.2s ease-in-out infinite; }
.badge.completed, .badge.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-border); }
.badge.failed, .badge.err { background: var(--err-soft); color: var(--err); border-color: var(--err-border); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
@keyframes pulse { 50% { opacity: .25; } }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--err-border); background: var(--err-soft); color: var(--err); font-size: 14px; }
.alert svg { margin-top: 1px; }
.alert.ok { border-color: var(--ok-border); background: var(--ok-soft); color: var(--ok); }
.alert.warn { border-color: var(--warn-border); background: var(--warn-soft); color: var(--warn); }
.alert.info { border-color: var(--info-border); background: var(--info-soft); color: var(--info); }
.alert .alert-body { color: var(--text); }
.alert .alert-body strong { display: block; color: inherit; }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px; height: 14px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.empty { text-align: center; padding: 48px 16px; color: var(--text-3); }
.empty .empty-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 12px; color: var(--text-2); }
.empty h3 { color: var(--text); margin-bottom: 4px; }
.empty .btn { margin-top: 16px; }

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--ok); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow-lg); animation: toast-in .2s var(--ease); font-size: 14px; }
.toast.error { border-left-color: var(--err); }
.toast.info { border-left-color: var(--info); }
.toast svg { color: var(--ok); margin-top: 1px; }
.toast.error svg { color: var(--err); }
.toast.info svg { color: var(--info); }
.toast .grow { word-break: break-word; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

dialog.modal { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.modal::backdrop { background: rgba(15, 23, 42, .5); }
dialog.modal[open] { animation: modal-in .18s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-head { padding: 20px 22px 0; display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.modal-head p { color: var(--text-3); margin-top: 4px; font-size: 14px; }
.modal-body { padding: 18px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.modal-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.modal-icon.danger { background: var(--err-soft); color: var(--err); }

.menu { position: absolute; z-index: 50; min-width: 180px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: none; font: inherit; color: var(--text); padding: 8px 10px; border-radius: 6px; cursor: pointer; text-align: left; }
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); outline: none; }
.menu button.danger { color: var(--err); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.banner { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 8px 16px; font-size: 13.5px; background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--warn-border); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; position: relative; }
table, .table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; font-size: 12px; letter-spacing: .03em; text-transform: uppercase; color: var(--text-3); padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { width: 1%; white-space: nowrap; text-align: right; }
.file-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-icon { width: 34px; height: 34px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; flex: none; }
.file-cell .name { font-weight: 600; color: var(--text); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-3); }

/* ---------------------------------------------------------------- stats & meters */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.stat .label { display: flex; align-items: center; gap: 8px; font-weight: 550; color: var(--text-3); font-size: 13px; }
.stat .value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 14px; font-weight: 550; color: var(--text-3); margin-left: 4px; letter-spacing: 0; }
.stat .sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.meter { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.meter > div { height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s var(--ease); }
.meter.warn > div { background: var(--warn); }
.meter.full > div { background: var(--err); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 0; }
.stats div { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.stats dt { font-size: 12px; color: var(--text-3); }
.stats dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- upload */
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 28px 16px; text-align: center; background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over, .dropzone:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.dropzone .dz-icon { width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 12px; background: var(--surface); display: grid; place-items: center; color: var(--accent-text); box-shadow: var(--shadow-sm); }
.dropzone strong { display: block; font-size: 15px; }
.uploads { margin-top: 12px; display: grid; gap: 8px; }
.upload-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.upload-item .progress { grid-column: 1 / -1; height: 4px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.upload-item .progress > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ---------------------------------------------------------------- checklist */
.checklist { display: grid; gap: 2px; }
.check-item { display: flex; gap: 12px; align-items: center; padding: 10px 8px; border-radius: 8px; }
.check-item .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; flex: none; color: #fff; }
.check-item.done .dot { background: var(--ok); border-color: var(--ok); }
.check-item.done .title { color: var(--text-3); text-decoration: line-through; }

/* ---------------------------------------------------------------- transcript editor */
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .editor-layout { grid-template-columns: minmax(0, 1fr); } }
.editor-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 5; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
@media (max-width: 900px) { .editor-toolbar { top: 53px; } }
.segments { padding: 8px; }
.seg { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 12px; padding: 6px 8px; border-radius: 8px; border-left: 3px solid transparent; }
.seg:hover { background: var(--surface-2); }
.seg.active { background: var(--accent-soft); }
.seg.dirty { border-left-color: var(--warn); }
.seg.match textarea { box-shadow: inset 0 -2px 0 var(--warn); }
.seg.dim { opacity: .35; }
.seg .ts { font-family: var(--mono); font-size: 12px; color: var(--text-3); padding: 8px 6px; border: 0; background: none; cursor: pointer; text-align: left; border-radius: 6px; font-variant-numeric: tabular-nums; }
.seg .ts:hover { color: var(--accent-text); background: var(--surface); }
.seg textarea { width: 100%; border: 1px solid transparent; background: transparent; color: var(--text); font: inherit; font-size: 15px; line-height: 1.6; padding: 6px 8px; border-radius: 6px; resize: none; overflow: hidden; }
.seg textarea:hover { border-color: var(--border); }
.seg textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
@media (max-width: 560px) { .seg { grid-template-columns: minmax(0, 1fr); gap: 0; } .seg .ts { padding: 4px 6px 0; } }
.player { position: sticky; bottom: 0; z-index: 10; margin-top: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 10px 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.player audio { flex: 1; min-width: 220px; height: 40px; }
.player .select { width: auto; padding: 6px 10px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; text-align: right; font-weight: 550; min-width: 0; overflow-wrap: anywhere; }
kbd { font-family: var(--mono); font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; }

/* ---------------------------------------------------------------- chart */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis-label { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .bar { fill: var(--viz-1); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .bar.hover { opacity: .8; }
.chart-tip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); font-size: 12.5px; padding: 6px 9px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, calc(-100% - 8px)); box-shadow: var(--shadow-md); }
.hbar { display: grid; grid-template-columns: minmax(90px, 30%) minmax(0, 1fr) 72px; gap: 10px; align-items: center; font-size: 13.5px; padding: 6px 0; }
.hbar .track { height: 10px; background: var(--surface-2); border-radius: 4px; }
.hbar .fill { height: 100%; background: var(--viz-1); border-radius: 4px; min-width: 3px; }
.hbar .val { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- code */
.code { position: relative; background: #0f172a; color: #e2e8f0; border-radius: var(--radius); padding: 14px 16px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; overflow-x: auto; white-space: pre; }
.code .copy-btn { position: absolute; top: 8px; right: 8px; }
.tabs-inline { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tabs-inline button { border: 0; background: none; font: inherit; font-weight: 600; font-size: 13.5px; color: var(--text-3); padding: 8px 10px; border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px; }
.tabs-inline button[aria-selected="true"] { color: var(--accent-text); border-bottom-color: var(--accent); }
.secret { font-family: var(--mono); font-size: 13px; background: var(--surface-2); border: 1px dashed var(--border-strong); padding: 12px; border-radius: 8px; word-break: break-all; }

/* ---------------------------------------------------------------- auth */
.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-aside { background: radial-gradient(1200px 600px at -10% -10%, #6366f1 0%, #312e81 45%, #0f172a 100%); color: #e0e7ff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-aside .brand-mark { color: #fff; padding: 0; }
.auth-aside h2 { font-size: 30px; line-height: 1.2; color: #fff; font-weight: 700; letter-spacing: -0.02em; max-width: 440px; }
.auth-aside ul { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 14px; max-width: 440px; }
.auth-aside li { display: flex; gap: 12px; color: #c7d2fe; }
.auth-aside li svg { color: #a5b4fc; margin-top: 2px; }
.auth-aside li strong { color: #fff; display: block; }
.auth-main { display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: min(400px, 100%); }
.auth-card h1 { margin-bottom: 6px; }
.auth-card > p { color: var(--text-3); margin-bottom: 24px; }
@media (max-width: 860px) { .auth-layout { grid-template-columns: minmax(0, 1fr); } .auth-aside { display: none; } }

/* ---------------------------------------------------------------- legacy (status/admin pages) */
header.top { background: var(--surface); border-bottom: 1px solid var(--border); }
header.top .wrap { display: flex; align-items: center; gap: 20px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--text); }
nav.tabs { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
nav.tabs a { color: var(--text-2); padding: 6px 10px; border-radius: 8px; font-weight: 520; }
nav.tabs a:hover { background: var(--surface-2); text-decoration: none; }
main.wrap { padding-top: 28px; padding-bottom: 48px; }
main.wrap h1 { margin-bottom: 16px; }
main.wrap h2 { margin-bottom: 10px; }

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

/* ---------- public status page ---------- */
.public-head { max-width: 760px; margin: 0 auto; padding: 24px 16px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.public-head .brand-mark { padding: 0; }
.public-head img.brand-logo { background: none; padding: 0; }
.public-main { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; display: flex; flex-direction: column; gap: 28px; }
.public-main h2 { font-size: 15px; margin-bottom: 10px; }
.status-hero { display: flex; gap: 14px; align-items: center; padding: 20px 22px; border-radius: 14px; border: 1px solid var(--ok-border); background: var(--ok-soft); }
.status-hero h1 { font-size: 20px; color: var(--ok); }
.status-hero p { margin-top: 2px; font-size: 13px; color: var(--text-2); }
.status-hero.warn { border-color: var(--warn-border); background: var(--warn-soft); }
.status-hero.warn h1 { color: var(--warn); }
.status-hero.err { border-color: var(--err-border); background: var(--err-soft); }
.status-hero.err h1 { color: var(--err); }
.status-dot { width: 14px; height: 14px; flex: none; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 5px color-mix(in srgb, var(--ok) 20%, transparent); }
.warn .status-dot { background: var(--warn); box-shadow: 0 0 0 5px color-mix(in srgb, var(--warn) 20%, transparent); }
.err .status-dot { background: var(--err); box-shadow: 0 0 0 5px color-mix(in srgb, var(--err) 20%, transparent); }
.components { list-style: none; margin: 0; padding: 0; }
.components li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--border); }
.components li:first-child { border-top: 0; }
.incident.active { border-color: var(--warn-border); }
.incident-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.incident-head h3 { font-size: 15px; }
.timeline { list-style: none; margin: 12px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.timeline li { font-size: 14px; }
.public-main footer a { color: var(--accent-text); }

/* ---------- email verification ---------- */
.banner.verify { background: var(--info-soft); color: var(--info); border-bottom-color: var(--info-border); flex-wrap: wrap; }
.banner.verify strong { color: inherit; }
.verify-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 20px; background: var(--accent-soft); color: var(--accent-text); }
.verify-icon.ok { background: var(--ok-soft); color: var(--ok); }
.verify-icon.err { background: var(--err-soft); color: var(--err); }
.verify-tips { margin: 20px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.dropzone.disabled { cursor: default; border-style: solid; }
.dropzone.disabled:hover { border-color: var(--border); background: var(--surface-2); }
.verify-result { text-align: center; }
.verify-result .verify-icon, .verify-result .spinner { margin-left: auto; margin-right: auto; }
