/* Voice2Text — shared styles for the dashboard (/) and the admin panel (/admin). */
:root {
  --bg: #f3f5fa; --surface: #ffffff; --surface-2: #f7f8fc; --text: #121a2f; --muted: #5d6682; --line: #e1e6f0;
  --accent: #0d9488; --accent-2: #6366f1; --accent-3: #db2777; --accent-soft: #dcf5f1; --on-accent: #fff;
  --rec: #e5484d; --rec-soft: #fde7e8; --ok: #0f8a54; --ok-soft: #e1f5ea; --warn: #a96500; --warn-soft: #fff2d9;
  --err: #cf3434; --err-soft: #fde6e6;
  --viz-bg: #0b1020; --viz-line: rgba(255, 255, 255, .06); --viz-text: rgba(226, 232, 255, .78);
  --radius: 16px; --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(18, 26, 47, .05), 0 8px 28px rgba(18, 26, 47, .06);
  --tx-size: 1.2rem; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #080c18; --surface: #111729; --surface-2: #151c31; --text: #e6eaf7; --muted: #929bba; --line: #222b45;
    --accent: #2dd4bf; --accent-2: #818cf8; --accent-3: #f472b6; --accent-soft: #0f2d2e; --on-accent: #04211e;
    --rec: #ff6369; --rec-soft: #3b1619; --ok: #3ccf8e; --ok-soft: #10332a; --warn: #f0b44c; --warn-soft: #39290f;
    --err: #ff6b6b; --err-soft: #3d1a1f; --viz-bg: #060a16;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 30px rgba(0, 0, 0, .28); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #080c18; --surface: #111729; --surface-2: #151c31; --text: #e6eaf7; --muted: #929bba; --line: #222b45;
  --accent: #2dd4bf; --accent-2: #818cf8; --accent-3: #f472b6; --accent-soft: #0f2d2e; --on-accent: #04211e;
  --rec: #ff6369; --rec-soft: #3b1619; --ok: #3ccf8e; --ok-soft: #10332a; --warn: #f0b44c; --warn-soft: #39290f;
  --err: #ff6b6b; --err-soft: #3d1a1f; --viz-bg: #060a16;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 30px rgba(0, 0, 0, .28); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
p { margin: .3rem 0 .7rem; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.spacer { flex: 1; }
kbd {
  font: 600 .78em ui-monospace, "SF Mono", Menlo, Consolas, monospace; padding: .1em .45em; border-radius: 6px;
  border: 1px solid var(--line); border-bottom-width: 2px; background: var(--surface-2);
}
svg { flex: none; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 84%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.topbar-inner { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 8px; padding: 9px 16px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.06rem; letter-spacing: -.01em; }
.brand b { color: var(--accent); }
.brand-logo {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #14b8a6, #6366f1 55%, #ec4899);
}
.pick {
  position: relative; display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 8px 0 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted);
}
.pick svg { width: 16px; height: 16px; }
.pick select {
  appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: var(--text);
  font: inherit; font-weight: 600; font-size: .9rem; padding: 0 16px 0 0; cursor: pointer; max-width: 150px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 5px center, right 0 center; background-size: 5px 5px; background-repeat: no-repeat;
}
.pick select:focus { outline: none; }
.pick:focus-within { border-color: var(--accent-2); }
.pick select option { color: #111; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
}
.icon-btn:hover { color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }

/* ---------- dashboard layout ---------- */
body.dash { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.layout {
  flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 12px 16px 14px;
  display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); align-items: start;
}
.workspace { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: calc(100dvh - 57px - 26px); }
@media (min-width: 1000px) {
  .layout { grid-template-columns: minmax(0, 1fr) 330px; }
  .saved { position: sticky; top: 70px; max-height: calc(100dvh - 84px); }
}

/* recorder: big button + visualiser on an always-dark "instrument" panel */
.recorder {
  display: flex; align-items: stretch; gap: 12px; padding: 12px; height: 176px; overflow: hidden;
  background: radial-gradient(120% 140% at 0% 0%, #17204a 0%, var(--viz-bg) 55%); border-color: transparent;
}
.rec-btn {
  --lvl: 0; position: relative; flex: none; align-self: center; width: 104px; height: 104px; border-radius: 50%;
  border: 0; cursor: pointer; color: #fff; display: grid; place-items: center;
  background: linear-gradient(140deg, #14b8a6, #6366f1 60%, #a855f7);
  box-shadow: 0 10px 30px rgba(99, 102, 241, .45), inset 0 1px 0 rgba(255, 255, 255, .3);
  transition: transform .15s ease, background .25s ease, box-shadow .25s ease;
  -webkit-tap-highlight-color: transparent;
}
.rec-btn:hover { transform: scale(1.03); }
.rec-btn:active { transform: scale(.97); }
.rec-btn svg { width: 42%; height: 42%; grid-area: 1 / 1; }
.rec-btn .i-stop, .rec-btn .i-spin { display: none; }
.rec-ring {
  position: absolute; inset: -4px; border-radius: 50%; pointer-events: none; opacity: 0;
  box-shadow: 0 0 0 calc(3px + var(--lvl) * 14px) rgba(255, 99, 105, .3), 0 0 0 calc(2px + var(--lvl) * 30px) rgba(255, 99, 105, .1);
  transition: box-shadow .08s linear, opacity .2s;
}
body.recording .rec-btn { background: linear-gradient(140deg, #ff5f6d, #e5484d); box-shadow: 0 10px 30px rgba(229, 72, 77, .5); }
body.recording .rec-btn .i-mic { display: none; }
body.recording .rec-btn .i-stop { display: block; }
body.recording .rec-ring { opacity: 1; }
body.busy .rec-btn { background: linear-gradient(140deg, #475069, #2b3352); box-shadow: none; cursor: progress; }
body.busy .rec-btn .i-mic, body.busy .rec-btn .i-stop { display: none; }
body.busy .rec-btn .i-spin { display: block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.viz { position: relative; flex: 1; min-width: 0; border-radius: 12px; overflow: hidden; background: rgba(255, 255, 255, .02); cursor: pointer; }
.viz canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.viz-status {
  position: absolute; left: 10px; top: 8px; right: 110px; display: flex; align-items: center; gap: 7px; color: var(--viz-text);
  white-space: nowrap; overflow: hidden;
  font-size: .8rem; font-weight: 600; letter-spacing: .02em; pointer-events: none; text-shadow: 0 1px 2px #000;
}
.viz-status .detail { margin-left: -4px; opacity: .8; overflow: hidden; text-overflow: ellipsis; }
.viz-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #3ccf8e; box-shadow: 0 0 8px #3ccf8e; }
body.recording .viz-status .dot { background: #ff6369; box-shadow: 0 0 10px #ff6369; animation: blink 1.2s ease-in-out infinite; }
body.busy .viz-status .dot { background: #f0b44c; box-shadow: 0 0 8px #f0b44c; }
body.offline .viz-status .dot { background: #8891aa; box-shadow: none; }
@keyframes blink { 50% { opacity: .3; } }
.viz-mode {
  position: absolute; right: 8px; top: 7px; border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .06);
  color: var(--viz-text); font: 600 .72rem/1 system-ui, sans-serif; padding: 6px 9px; border-radius: 99px; cursor: pointer;
  letter-spacing: .04em; text-transform: uppercase;
}
.viz-mode:hover { background: rgba(255, 255, 255, .12); }
.viz-timer {
  position: absolute; right: 12px; bottom: 6px; color: #fff; font: 700 1.6rem/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums; letter-spacing: .02em; opacity: .9; pointer-events: none; text-shadow: 0 2px 8px #000;
}
.viz-timer small { font-size: .55em; opacity: .55; margin-left: 4px; }

/* keep-on-server switches */
.keep { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; padding: 0 4px; font-size: .86rem; }
.keep-label { color: var(--muted); font-weight: 600; }
.keep-hint { color: var(--muted); font-size: .8rem; }
.switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-weight: 600; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
  position: relative; width: 34px; height: 20px; border-radius: 99px; background: var(--line); transition: background .2s;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s;
}
.switch input:checked + .track { background: var(--warn); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .5; }
.keep.on .keep-hint { color: var(--warn); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.stat {
  display: flex; flex-direction: column; gap: 1px; padding: 8px 11px; border-radius: var(--radius-sm); min-width: 0;
  background: var(--surface); border: 1px solid var(--line);
}
.stat .v { font-size: 1.28rem; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .v small { font-size: .6em; font-weight: 600; color: var(--muted); margin-left: 2px; }
.stat .k { font-size: .76rem; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.hot .v { color: var(--accent); }

/* transcript */
.transcript { flex: 1; display: flex; flex-direction: column; min-height: 240px; overflow: hidden; }
.tx-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px 0; }
.tx-head h2 { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 750; }
.tx-count { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 650; padding: 3px 9px; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent);
}
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.err { background: var(--err-soft); color: var(--err); }
.chip-btn {
  border: 0; border-radius: 99px; background: var(--accent); color: var(--on-accent); cursor: pointer;
  font: 700 .72rem/1 system-ui, sans-serif; padding: 4px 9px; margin: -1px -5px -1px 4px;
}
.chip .spin { width: 10px; height: 10px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.tx-body { position: relative; flex: 1; min-height: 120px; }
.tx-body textarea, .tx-live {
  position: absolute; inset: 0; width: 100%; height: 100%; padding: 8px 14px 12px; margin: 0; border: 0; resize: none;
  background: transparent; color: var(--text); font: 450 var(--tx-size)/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-y: auto; overflow-wrap: anywhere; white-space: pre-wrap;
}
.tx-body textarea:focus { outline: none; }
.tx-body textarea::placeholder { color: var(--muted); opacity: .75; }
.tx-live .prev { color: var(--text); }
.tx-live .seg { transition: color .3s; }
.tx-live .seg.live { color: var(--text); }
.tx-live .seg.refining { text-decoration: underline dotted color-mix(in srgb, var(--muted) 70%, transparent); text-underline-offset: 5px; }
.tx-live .seg.refined { animation: refined 1.2s ease-out; }
@keyframes refined { from { background: color-mix(in srgb, var(--accent) 22%, transparent); } to { background: transparent; } }
.tx-live .seg.pending { display: inline-flex; gap: 4px; vertical-align: middle; padding: 0 4px; }
.tx-live .seg.pending i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); opacity: .3; animation: dots 1s infinite; }
.tx-live .seg.pending i:nth-child(2) { animation-delay: .15s; }
.tx-live .seg.pending i:nth-child(3) { animation-delay: .3s; }
@keyframes dots { 40% { opacity: 1; transform: translateY(-3px); } }
.tx-live .partial { color: var(--muted); font-style: italic; }
.tx-live .caret { display: inline-block; width: 2px; height: 1.1em; vertical-align: text-bottom; background: var(--rec); margin-left: 2px; animation: blink 1s steps(2) infinite; }
.tx-actions { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); background: var(--surface-2); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 42px; padding: 0 16px;
  border-radius: 11px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: 650 .93rem/1 system-ui, sans-serif; cursor: pointer; transition: transform .1s, background .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent; white-space: nowrap; text-decoration: none;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--err); }
.btn.danger.solid { background: var(--err); border-color: var(--err); color: #fff; }
.btn.sm { height: 32px; padding: 0 11px; font-size: .84rem; border-radius: 9px; }
.btn.sm svg { width: 15px; height: 15px; }
.btn.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.link-btn { border: 0; background: none; color: var(--muted); font: 600 .82rem system-ui, sans-serif; cursor: pointer; padding: 4px; }
.link-btn:hover { color: var(--err); }

/* stored list */
.saved { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.saved-head { display: flex; align-items: center; padding: 12px 14px 0; }
.saved-head h2 { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 750; display: flex; align-items: center; gap: 7px; }
.count { background: var(--surface-2); border: 1px solid var(--line); color: var(--text); border-radius: 99px; padding: 0 7px; font-size: .74rem; letter-spacing: 0; }
.saved-note { margin: 2px 14px 8px; font-size: .78rem; color: var(--muted); }
.saved-list { list-style: none; margin: 0; padding: 0 10px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.saved-item {
  position: relative; padding: 10px 40px 9px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line);
  animation: pop .25s ease-out;
}
@keyframes pop { from { transform: translateY(-4px); opacity: 0; } }
.saved-item p {
  margin: 0 0 6px; font-size: .95rem; line-height: 1.45; overflow-wrap: anywhere; cursor: pointer;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.saved-item.open p { -webkit-line-clamp: unset; display: block; }
.saved-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .74rem; color: var(--muted); }
.saved-meta .acts { margin-left: auto; display: flex; gap: 2px; }
.mini {
  border: 0; background: none; color: var(--muted); width: 30px; height: 28px; border-radius: 8px; display: grid; place-items: center; cursor: pointer;
}
.mini:hover { background: var(--line); color: var(--text); }
.mini svg { width: 16px; height: 16px; }
.saved-x { position: absolute; top: 6px; right: 6px; }
.saved-x:hover { color: var(--err); background: var(--err-soft); }
.saved-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 18px 16px 24px; color: var(--muted); font-size: .88rem; }
.saved-empty svg { width: 30px; height: 30px; opacity: .45; }

.foot { text-align: center; color: var(--muted); font-size: .74rem; padding: 2px 16px 12px; }
.foot a { color: inherit; }

/* toasts + modal */
.toasts { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  background: #141b31; color: #f1f3fb; padding: 10px 16px; border-radius: 12px; font-size: .9rem; font-weight: 550;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3); animation: toast .25s ease-out; pointer-events: auto; max-width: 100%;
}
.toast.err { background: #b42323; }
.toast.ok { background: #0f7a4b; }
@keyframes toast { from { transform: translateY(8px); opacity: 0; } }
.modal {
  border: 1px solid var(--line); border-radius: 18px; padding: 0; width: min(520px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}
.modal::backdrop { background: rgba(6, 10, 22, .55); backdrop-filter: blur(3px); }
.modal form { padding: 20px 22px; }
.modal h2 { font-size: 1.2rem; margin-bottom: 8px; }
.modal .modes { margin: 8px 0 12px; }
.modal .modes dt { font-weight: 700; margin-top: 8px; }
.modal .modes dt small { font-weight: 500; color: var(--muted); }
.modal .modes dd { margin: 2px 0 0; color: var(--muted); font-size: .92rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.modal-actions.rev { flex-direction: row-reverse; justify-content: flex-start; }
.input {
  width: 100%; height: 44px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: 1rem;
}
.input:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 22%, transparent); }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }

/* ---------- dashboard: tablet & phone ---------- */
@media (max-width: 999px) {
  .saved { max-height: none; }
  .saved-list { overflow: visible; }
  :root { --tx-size: 1.3rem; }
}
@media (min-width: 601px) and (max-width: 999px) {
  /* tablet: transcript takes most of the screen, the stored list peeks in below it */
  .workspace { min-height: 0; }
  .transcript { flex: none; height: max(300px, calc(100dvh - 57px - 176px - 34px - 66px - 70px - 150px)); }
}
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .stat { padding: 6px 9px; }
  .stat .v { font-size: 1.12rem; }
  .stat .k { font-size: .7rem; }
}
@media (max-width: 600px) {
  :root { --tx-size: 1.38rem; }
  .topbar-inner { padding: 7px 10px; gap: 6px; min-height: 52px; }
  .brand-name { display: none; }
  .pick { height: 36px; padding: 0 4px 0 8px; }
  .pick svg { display: none; }
  .pick select { max-width: 132px; font-size: .86rem; }
  .viz-status { right: 74px; }
  .viz-status .detail { display: none; }
  .viz-mode { padding: 5px 7px; font-size: .64rem; }
  .icon-btn { width: 36px; height: 36px; }
  #infoBtn { display: none; }
  .layout { padding: 8px 10px 10px; gap: 10px; }
  .workspace { gap: 8px; min-height: calc(100dvh - 53px - 20px); }
  .recorder { height: 128px; padding: 8px; gap: 8px; }
  .rec-btn { width: 78px; height: 78px; }
  .viz-timer { font-size: 1.25rem; }
  .keep { font-size: .82rem; gap: 4px 12px; }
  .keep-hint { display: none; }
  .transcript { min-height: 200px; }
  .tx-actions { display: grid; grid-template-columns: repeat(3, 1fr); padding: 8px; gap: 6px; }
  .btn { height: 48px; padding: 0 10px; }
  .foot { font-size: .7rem; }
}
@media (max-width: 370px) {
  .pick select { max-width: 104px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ======================================================= admin panel ===== */
body.admin { min-height: 100vh; }
.admin-shell { max-width: 1180px; margin: 0 auto; padding: 14px 16px 40px; }
.admin-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.admin-tabs a {
  text-decoration: none; color: var(--muted); padding: 8px 12px; border-radius: 10px; font-weight: 650; font-size: .92rem; white-space: nowrap;
}
.admin-tabs a:hover { color: var(--text); background: var(--surface); }
.admin-tabs a.active { color: var(--accent); background: var(--accent-soft); }
.page-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 14px; }
.page-title h1 { font-size: 1.35rem; letter-spacing: -.01em; }
.grid { display: grid; gap: 14px; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.panel { padding: 16px; }
.panel h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.kpi { padding: 14px 16px; }
.kpi .v { font-size: 1.7rem; font-weight: 760; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .k { font-size: .76rem; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.kpi .s { font-size: .8rem; color: var(--muted); }
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--accent); }
.chart .bar:hover { fill: var(--accent-2); }
.chart .axis { fill: var(--muted); font-size: 10px; }
.chart .gridline { stroke: var(--line); }
.meter { height: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 99px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .9rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.t th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .input { height: 40px; max-width: 320px; }
.toolbar select.input { width: auto; }
.items { display: flex; flex-direction: column; gap: 10px; }
.item { padding: 12px 14px; }
.item-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-size: .84rem; color: var(--muted); }
.item-head b { color: var(--text); font-size: .92rem; }
.item-head input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.item-text { margin: 8px 0; font-size: 1rem; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 9.5em; overflow: auto; }
.item-text.none { color: var(--muted); font-style: italic; font-size: .9rem; }
.item audio { width: 100%; max-width: 460px; height: 36px; margin: 2px 0 6px; display: block; }
.item-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.item-note { font-size: .84rem; color: var(--warn); margin: 4px 0; }
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 5px; align-content: start; }
.field > span { font-weight: 650; font-size: .9rem; }
.field small { color: var(--muted); font-size: .8rem; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
.check span b { display: block; font-size: .92rem; }
.check span small { color: var(--muted); font-size: .8rem; }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 4px; min-width: 120px; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .5s; }
.login {
  min-height: 100dvh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(80% 60% at 50% 0%, color-mix(in srgb, var(--accent-2) 16%, transparent), transparent), var(--bg);
}
.login .card { width: min(400px, 100%); padding: 26px 24px; }
.login h1 { font-size: 1.3rem; margin: 14px 0 4px; }
.login form { display: grid; gap: 12px; margin-top: 14px; }
.err-text { color: var(--err); font-size: .88rem; min-height: 1.2em; margin: 0; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
@media (max-width: 760px) {
  .admin-topbar .topbar-inner { flex-wrap: wrap; row-gap: 4px; padding-bottom: 6px; }
  .admin-topbar .admin-tabs { order: 9; flex-basis: 100%; margin: 0 -4px; }
  .admin-topbar .spacer { display: none; }
  .admin-topbar .brand { margin-right: auto; }
}
@media (max-width: 600px) {
  .admin-shell { padding: 10px 10px 30px; }
  .kpi .v { font-size: 1.4rem; }
  .grid.kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  table.t.stack thead { display: none; }
  table.t.stack tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.t.stack td { border: 0; padding: 2px 4px; }
}
