/* Bảng test Tốc Ký — kiểu bảng dày dữ liệu, chữ hệ thống (offline, không tải font). */
:root {
  --bg: #f8fafc; --surface: #ffffff; --surface-2: #f1f5f9; --fg: #0f172a; --muted: #475569;
  --border: #cbd5e1; --primary: #1e293b; --on-primary: #ffffff; --focus: #2563eb;
  --ok: #15803d; --ok-bg: #dcfce7; --run: #92400e; --run-bg: #fef3c7; --err: #b91c1c; --err-bg: #fee2e2;
  --now: #fef9c3; --hl: #dbeafe; --asr: #64748b; --llm: #2563eb;
  --r: 8px; --gap: 16px; --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a; --surface: #1e293b; --surface-2: #273449; --fg: #f1f5f9; --muted: #a3b1c6;
    --border: #3b4a63; --primary: #e2e8f0; --on-primary: #0f172a; --focus: #60a5fa;
    --ok: #86efac; --ok-bg: #14532d; --run: #fde68a; --run-bg: #713f12; --err: #fca5a5; --err-bg: #7f1d1d;
    --now: #3f3a12; --hl: #1e3a5f; --asr: #94a3b8; --llm: #60a5fa;
  }
}
* { box-sizing: border-box; }
html { font: 15px/1.5 var(--font); }
body { margin: 0; background: var(--bg); color: var(--fg); }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 16px; margin: 0 0 8px; } h3 { font-size: 15px; margin: 12px 0 4px; }
a { color: var(--focus); }
code, pre, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
code { font-size: 13px; } pre { font-size: 12.5px; white-space: pre-wrap; background: var(--surface-2); padding: 8px; border-radius: var(--r); max-height: 420px; overflow: auto; margin: 0; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; z-index: 100; background: var(--surface); padding: 8px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* nút */
.btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px; border-radius: var(--r);
  border: 1px solid var(--border); background: var(--surface); color: var(--fg); font: inherit; cursor: pointer;
  text-decoration: none; transition: background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.primary:hover { opacity: .9; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--err); }
.btn.small { min-height: 28px; padding: 2px 8px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
input, select, textarea { font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 6px 10px; min-height: 36px; max-width: 100%; }
label { display: block; font-weight: 500; margin: 8px 0 4px; } label.check { display: inline-flex; gap: 6px; align-items: center; font-weight: 400; margin: 0; }

/* khung */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 8px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border); height: 56px; }
.brand { font-weight: 700; color: var(--fg); text-decoration: none; margin-right: auto; white-space: nowrap; }
.topbar > .btn, .nav-toggle { flex-shrink: 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: middle; }
.nav-toggle { display: none; }
.layout { display: grid; grid-template-columns: 260px 1fr; min-height: calc(100dvh - 56px); }
.sidebar { border-right: 1px solid var(--border); background: var(--surface); padding: 12px 8px; overflow-y: auto;
  position: sticky; top: 56px; height: calc(100dvh - 56px - 64px); }
.sidebar h2 { padding: 0 8px; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px; border-radius: var(--r); color: var(--fg); text-decoration: none; }
.sidebar a:hover { background: var(--surface-2); }
.sidebar a[aria-current] { background: var(--hl); }
.sidebar .name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sidebar .sub { grid-column: 1 / -1; font-size: 12px; }
main { padding: var(--gap) var(--gap) 96px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 16px; margin-bottom: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; } .row.end { justify-content: flex-end; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.empty { max-width: 560px; margin: 48px auto; text-align: center; }

/* đầu trang cuộc họp + số liệu */
.hop-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.kpi b { font-size: 18px; } .kpi .badge { align-self: flex-start; }
.bar { height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; } .bar i { display: block; height: 100%; background: var(--ok); }
.alert { grid-column: 1 / -1; margin: 0; padding: 8px 12px; border-radius: var(--r); }
.alert.err { background: var(--err-bg); color: var(--err); }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.run { background: var(--run-bg); color: var(--run); } .badge.err { background: var(--err-bg); color: var(--err); }
.badge.l-ket_luan { background: var(--ok-bg); color: var(--ok); } .badge.l-giao_viec { background: var(--run-bg); color: var(--run); }
.badge.l-so_lieu { background: var(--hl); color: var(--focus); }
.pill { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; font-size: 13px; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.err { background: var(--err-bg); color: var(--err); }

/* menu chạy lại */
.menu { position: relative; } .menu > summary { list-style: none; } .menu > summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; right: 0; top: 42px; z-index: 30; width: 300px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 8px 24px rgb(0 0 0 / .18); }
.menu-panel select { width: 100%; }

/* tab */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; overflow-x: auto; }
.tabs button { white-space: nowrap; font: inherit; background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 14px; color: var(--muted); cursor: pointer; min-height: 40px; }
.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--focus); font-weight: 600; }

/* biên bản */
.md li { margin: 2px 0 2px 18px; } .md p { margin: 4px 0; } .md h3:first-child { margin-top: 0; }
textarea { width: 100%; min-height: 460px; font: 13px/1.5 var(--mono); resize: vertical; }
.diff { font: 12.5px/1.5 var(--mono); white-space: pre-wrap; }
.diff .add { background: var(--ok-bg); } .diff .del { background: var(--err-bg); } .diff .hunk { color: var(--muted); margin-top: 8px; }
a.ts { font-family: var(--mono); font-size: 13px; text-decoration: none; cursor: pointer; }

/* bản ghi & ý */
.doan > summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.doan > summary .btn { margin-left: auto; }
.doan-body { display: grid; grid-template-columns: 3fr 2fr; gap: 12px; margin-top: 10px; }
.seg { margin: 0; padding: 4px 6px; border-radius: 6px; scroll-margin: 120px; }
.seg.now { background: var(--now); } .seg.hl { background: var(--hl); }
.items { display: flex; flex-direction: column; gap: 6px; }
.item { text-align: left; font: inherit; color: var(--fg); background: var(--surface-2); border: 1px solid transparent; border-radius: var(--r); padding: 6px 10px; cursor: pointer; }
.item:hover { border-color: var(--border); }

/* kỹ thuật */
.cfg { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; } .cfg dt { font-weight: 600; } .cfg dd { margin: 0; }
.scroll-x { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 14px; }
.data th, .data td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.data th { font-size: 12px; color: var(--muted); } .data tr:hover td { background: var(--surface-2); } .r { text-align: right !important; }
.hbar { display: inline-block; height: 8px; border-radius: 4px; vertical-align: middle; } .hbar.asr { background: var(--asr); } .hbar.llm { background: var(--llm); }

/* thanh nghe */
.player { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; background: var(--surface); border-top: 1px solid var(--border); height: 64px; }
.player audio { flex: 1; min-width: 160px; height: 40px; }
.speeds .btn[aria-pressed="true"] { background: var(--hl); }

/* tải lên */
dialog { width: min(560px, calc(100vw - 32px)); color: var(--fg); padding: 20px; }
dialog::backdrop { background: rgb(0 0 0 / .5); }
dialog input#up-ten { width: 100%; }
.drop { margin-top: 12px; border: 2px dashed var(--border); border-radius: var(--r); padding: 24px; text-align: center; cursor: pointer; font-weight: 400; color: var(--muted); }
.drop.over { border-color: var(--focus); background: var(--hl); }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.up-list { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 6px; }
.up-list li { display: grid; grid-template-columns: 1fr auto; gap: 4px; font-size: 14px; }
.up-list progress { grid-column: 1 / -1; width: 100%; height: 6px; }
.toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: var(--primary); color: var(--on-primary); padding: 8px 16px; border-radius: var(--r); z-index: 50; }
.field-err { color: var(--err); margin: 4px 0; }
.login { display: grid; place-items: center; min-height: 100dvh; } .login-card { width: min(360px, calc(100vw - 32px)); } .login-card input { width: 100%; } .login-card .btn { margin-top: 12px; width: 100%; justify-content: center; }

/* màn nhỏ */
@media (max-width: 900px) {
  .cols, .doan-body { grid-template-columns: 1fr; }
}
@media (max-width: 359px) { .up-btn span { display: none; } .tabs button { padding: 8px 8px; } }  /* màn rất hẹp: nút tải lên chỉ còn icon (có aria-label) */
@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; inset: 56px 0 64px 0; height: auto; z-index: 15; }
  #nav-open:checked ~ .layout .sidebar { display: block; }
  .speeds, #where, .brand .muted, .pill .long { display: none; }
  .menu-panel { right: auto; left: 0; width: min(300px, calc(100vw - 24px)); }
  .topbar { gap: 8px; padding: 8px 12px; }
  .player { gap: 4px; padding: 8px; } .player audio { min-width: 0; }
  main { padding: 12px 12px 96px; }
}
dialog.card { margin: auto; }
.sidebar .badge { align-self: start; }
/* phần tử con của grid/flex mặc định không co nhỏ hơn nội dung (min-width: auto) → ô chọn/chữ dài làm tràn ngang */
.cols > *, .doan-body > *, .layout > *, .kpis > *, .row > select { min-width: 0; }
.row > select { flex: 1; } select { width: auto; max-width: 100%; text-overflow: ellipsis; }
.md, .seg, .item, .sidebar .name { overflow-wrap: anywhere; }
