/* ============================================================
   AI-M — ระบบช่วยจัดทำรายงานสรุปการประชุม
   ============================================================ */

:root {
  --brand: #d97706;
  --brand-strong: #b45309;
  --brand-soft: #fef3c7;
  --brand-tint: #fffbeb;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #f1f3f5;
  --line: #e3e6ea;
  --line-strong: #cdd3da;

  --text: #16191d;
  --text-2: #4a525c;
  --text-3: #7d8792;

  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #059669;
  --success-soft: #ecfdf5;
  --info: #2563eb;
  --info-soft: #eff6ff;

  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 14px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-2: 0 4px 16px rgba(16, 24, 40, .08);
  --shadow-3: 0 16px 48px rgba(16, 24, 40, .16);

  --sidebar-w: 236px;
  --font: "IBM Plex Sans Thai", "Sarabun", "Leelawadee UI", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
}

[data-theme="dark"] {
  --brand: #f59e0b;
  --brand-strong: #fbbf24;
  --brand-soft: #422006;
  --brand-tint: #1c1508;

  --bg: #0e1116;
  --surface: #161a21;
  --surface-2: #1b2029;
  --surface-3: #222833;
  --line: #2a313c;
  --line-strong: #3b4553;

  --text: #eef1f5;
  --text-2: #b3bcc8;
  --text-3: #7f8b99;

  --danger: #f87171;
  --danger-soft: #2a1414;
  --success: #34d399;
  --success-soft: #0d241c;
  --info: #60a5fa;
  --info-soft: #10203a;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 4px 16px rgba(0, 0, 0, .45);
  --shadow-3: 0 16px 48px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }

/* ต้องมาก่อนกฎ display อื่น ๆ ไม่งั้น .btn/.card ที่ตั้ง display จะลบล้าง hidden */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.35; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------ layout --- */

.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 18px; }
.brand-mark {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--brand), var(--brand-strong));
  color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .3px;
}
.brand-name { font-size: 15px; font-weight: 650; letter-spacing: -.2px; }
.brand-sub { font-size: 11.5px; color: var(--text-3); }

.nav-label {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3); padding: 14px 8px 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 10px;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-2);
  font-size: 14px; text-align: start; cursor: pointer;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--brand-tint); color: var(--brand-strong); font-weight: 600; }
[data-theme="dark"] .nav-item.active { background: var(--brand-soft); color: var(--brand-strong); }
.nav-item svg { width: 17px; height: 17px; flex: none; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 12px; }
.sys-status {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 12px; color: var(--text-2);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.ok { background: var(--success); }
.dot.warn { background: var(--brand); }
.dot.bad { background: var(--danger); }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; letter-spacing: -.2px; }
.topbar .sub { font-size: 12.5px; color: var(--text-3); }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }

.view { padding: 24px 28px 64px; max-width: 1180px; width: 100%; }
.view[hidden] { display: none; }

/* ------------------------------------------------------------ generic --- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 20px; border-bottom: 1px solid var(--line);
}
.card-head h2 { font-size: 14.5px; }
.card-head .hint { font-size: 12.5px; color: var(--text-3); font-weight: 400; }
.card-head .spacer { margin-inline-start: auto; }
.card-body { padding: 20px; }
.card-body.tight { padding: 14px 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; min-height: 36px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: background .14s, border-color .14s, opacity .14s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-3); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }

.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-strong); border-color: var(--brand-strong); }
[data-theme="dark"] .btn-primary { color: #1a1205; }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(.92); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-lg { min-height: 44px; padding: 10px 22px; font-size: 14.5px; }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 12.5px; }
.btn-icon { padding: 6px; min-height: 32px; width: 32px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.field .req { color: var(--danger); }
.field .help { font-size: 11.5px; color: var(--text-3); }

.input, .select, .textarea {
  width: 100%; padding: 8px 11px; min-height: 36px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  outline: none; transition: border-color .14s, box-shadow .14s;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
.textarea { min-height: 84px; resize: vertical; line-height: 1.6; }
.select { appearance: none; padding-inline-end: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%237d8792'%3E%3Cpath d='M5.5 7.5 10 12l4.5-4.5'  stroke='%237d8792' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 18px; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }

.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.spacer { margin-inline-start: auto; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 100px;
  background: var(--surface-3); color: var(--text-2);
  font-size: 11.5px; font-weight: 550;
}
.pill.ok { background: var(--success-soft); color: var(--success); }
.pill.warn { background: var(--brand-soft); color: var(--brand-strong); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.info { background: var(--info-soft); color: var(--info); }

.note {
  display: flex; gap: 10px; padding: 11px 14px;
  border-radius: var(--radius-sm); font-size: 13px;
  background: var(--info-soft); color: var(--text-2);
  border: 1px solid color-mix(in srgb, var(--info) 22%, transparent);
}
.note.warn { background: var(--brand-tint); border-color: color-mix(in srgb, var(--brand) 30%, transparent); }
.note.bad { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 28%, transparent); }
.note svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }

.empty { padding: 34px 20px; text-align: center; color: var(--text-3); font-size: 13px; }
.empty svg { width: 30px; height: 30px; opacity: .5; margin-bottom: 8px; }

/* ------------------------------------------------------------ stepper --- */

.stepper { display: flex; gap: 0; margin-bottom: 20px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-1); }
.step {
  flex: 1; display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border: 0; background: transparent;
  border-inline-end: 1px solid var(--line);
  cursor: pointer; text-align: start; min-width: 0;
}
.step:last-child { border-inline-end: 0; }
.step:disabled { cursor: not-allowed; opacity: .5; }
.step:not(:disabled):hover { background: var(--surface-2); }
.step-num {
  width: 25px; height: 25px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-3);
  font-size: 12px; font-weight: 650;
}
.step-text { display: flex; flex-direction: column; min-width: 0; }
.step-title { font-size: 13px; font-weight: 550; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-sub { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step.active { background: var(--brand-tint); }
[data-theme="dark"] .step.active { background: var(--surface-2); }
.step.active .step-num { background: var(--brand); color: #fff; }
.step.active .step-title { color: var(--brand-strong); font-weight: 650; }
.step.done .step-num { background: var(--success-soft); color: var(--success); }

.step-actions { display: flex; gap: 10px; margin-top: 18px; }
.step-actions .spacer { margin-inline-start: auto; }

/* ------------------------------------------- template & source pickers --- */

.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.pick {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  padding: 14px 16px; text-align: start; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: var(--radius);
  background: var(--surface-2);
}
.pick:hover { border-color: var(--line-strong); }
.pick.selected { border-color: var(--brand); background: var(--brand-tint); }
[data-theme="dark"] .pick.selected { background: var(--surface-3); }
.pick-title { font-size: 13.5px; font-weight: 600; }
.pick-desc { font-size: 12px; color: var(--text-3); }

.source-tabs { display: flex; gap: 6px; padding: 6px; background: var(--surface-3); border-radius: var(--radius); margin-bottom: 18px; }
.source-tab {
  flex: 1; padding: 8px 12px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-2); font-size: 13.5px; font-weight: 500; cursor: pointer;
}
.source-tab:hover { color: var(--text); }
.source-tab.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-1); }

/* ----------------------------------------------------------- recorder --- */

.recorder { display: grid; grid-template-columns: minmax(320px, 380px) 1fr; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .recorder { grid-template-columns: 1fr; } }

.rec-panel {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 26px 20px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.rec-state {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 13px; border-radius: 100px;
  background: var(--surface-3); color: var(--text-2); font-size: 12.5px; font-weight: 550;
}
.rec-state.live { background: var(--danger-soft); color: var(--danger); }
.rec-state.live .dot { background: var(--danger); animation: blink 1.1s ease-in-out infinite; }
.rec-state.paused { background: var(--brand-soft); color: var(--brand-strong); }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.rec-time { font-family: var(--mono); font-size: 40px; font-weight: 600; letter-spacing: 1px; line-height: 1.1; }
.rec-meter { width: 100%; height: 46px; border-radius: var(--radius-sm); background: var(--surface-3); overflow: hidden; }
.rec-meter canvas { display: block; width: 100%; height: 100%; }
.rec-buttons { display: flex; gap: 10px; width: 100%; }
.rec-buttons .btn { flex: 1; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 40px 24px; text-align: center;
  border: 2px dashed var(--line-strong); border-radius: var(--radius-lg);
  background: var(--surface-2); cursor: pointer;
}
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-tint); }
.dropzone svg { width: 32px; height: 32px; color: var(--text-3); }
.dropzone strong { font-size: 14px; font-weight: 600; }

.file-chip {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2);
}
.file-chip .ico { width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  border-radius: 8px; background: var(--brand-soft); color: var(--brand-strong); }
.file-chip .name { font-weight: 550; font-size: 13.5px; word-break: break-all; }

/* -------------------------------------------------------- notes / tags --- */

.tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
  padding: 5px 11px; border: 1px solid var(--line-strong); border-radius: 100px;
  background: var(--surface); color: var(--text-2); font-size: 12.5px; cursor: pointer;
}
.tag:hover { border-color: var(--brand); color: var(--brand-strong); background: var(--brand-tint); }
.tag:disabled { opacity: .45; cursor: not-allowed; }

.timeline { max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.tl-item { display: flex; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.tl-item:last-child { border-bottom: 0; }
.tl-time { font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: var(--brand-strong);
  background: var(--brand-tint); padding: 2px 7px; border-radius: 5px; height: fit-content; flex: none; }
[data-theme="dark"] .tl-time { background: var(--surface-3); }
.tl-text { flex: 1; word-break: break-word; }

/* ------------------------------------------------------ attendee picker --- */

.combo { position: relative; }
.combo-list {
  position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 40;
  max-height: 260px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-3);
}
.combo-list[hidden] { display: none; }
.combo-opt { display: flex; align-items: baseline; gap: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px; }
.combo-opt:hover, .combo-opt.hl { background: var(--brand-tint); }
[data-theme="dark"] .combo-opt:hover, [data-theme="dark"] .combo-opt.hl { background: var(--surface-3); }
.combo-opt .nick { color: var(--text-3); font-size: 12px; }
.combo-opt .dept { margin-inline-start: auto; color: var(--text-3); font-size: 11.5px; }
.combo-empty { padding: 10px 12px; font-size: 12.5px; color: var(--text-3); }

.person-row { display: grid; grid-template-columns: 1fr 200px 32px; gap: 8px; align-items: center; }
.attendee-group + .attendee-group { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.group-title { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.group-title input { font-weight: 600; }

/* ----------------------------------------------------------- progress --- */

.progress { height: 7px; border-radius: 100px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; border-radius: 100px;
  background: linear-gradient(90deg, var(--brand), var(--brand-strong)); transition: width .35s ease; }
.progress.indeterminate > i { width: 35% !important; animation: slide 1.3s ease-in-out infinite; }
@keyframes slide { 0% { margin-inline-start: -35%; } 100% { margin-inline-start: 100%; } }

.spin { width: 15px; height: 15px; border: 2px solid var(--line-strong); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- review --- */

.transcript {
  max-height: 340px; overflow-y: auto; padding: 14px 16px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 13.5px; line-height: 1.75;
}
.ts-line { display: flex; gap: 10px; padding: 2px 0; }
.ts-line .t { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); flex: none; padding-top: 3px; }

.sec { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.sec + .sec { margin-top: 12px; }
.sec-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; background: var(--surface-2); cursor: pointer; }
.sec-head h3 { font-size: 13.5px; flex: 1; }
.sec-head .chev { transition: transform .18s; color: var(--text-3); }
.sec.open .sec-head .chev { transform: rotate(90deg); }
.sec-body { padding: 14px; border-top: 1px solid var(--line); }
.sec:not(.open) .sec-body { display: none; }
.sec.empty-sec .sec-head h3 { color: var(--text-3); }

.line-item { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: start; }
.line-item + .line-item { margin-top: 6px; }
.line-item .lvl { width: 96px; padding-inline: 8px; font-size: 12.5px; }
.line-item textarea { min-height: 36px; }

.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th, .mini-table td { border: 1px solid var(--line); padding: 0; text-align: start; vertical-align: top; }
.mini-table th { background: var(--surface-3); padding: 7px 10px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.mini-table td input, .mini-table td textarea { border: 0; border-radius: 0; background: transparent; min-height: 34px; }
.mini-table td input:focus, .mini-table td textarea:focus { box-shadow: inset 0 0 0 2px var(--brand); }
.mini-table td.act { width: 36px; text-align: center; background: var(--surface-2); }

.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th { text-align: start; font-size: 12px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .04em; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: 0; }


/* ------------------------------------------------- ฝั่งผู้เข้าร่วมประชุม --- */

.side-block + .side-block { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.side-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.side-head h3 { font-size: 14px; }
.side-head .hint { font-size: 12px; color: var(--text-3); }

.side-tag {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 100px;
  font-size: 11px; font-weight: 650; letter-spacing: .02em;
}
.side-tag.internal { background: var(--brand-soft); color: var(--brand-strong); }
.side-tag.external { background: var(--info-soft); color: var(--info); }

.side-groups .attendee-group:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

/* --------------------------------------------------- รายการไฟล์บันทึก --- */

.src-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; border-bottom: 1px solid var(--line);
}
.src-row:last-child { border-bottom: 0; }
.src-row:hover { background: var(--surface-2); }
.src-row.compact { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; }
.src-row.compact:last-child { margin-bottom: 0; }

.src-num {
  width: 22px; height: 22px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-3); font-size: 11px; font-weight: 650;
}
.src-ico {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  border-radius: 9px; background: var(--brand-soft); color: var(--brand-strong);
}
.src-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.src-label { border-color: transparent; background: transparent; padding: 2px 6px; min-height: 28px; font-weight: 550; }
.src-label:hover { border-color: var(--line); }

/* ผู้พูดและเส้นคั่นไฟล์ใน transcript */
.ts-spk {
  flex: none; align-self: flex-start;
  padding: 1px 7px; border-radius: 5px; margin-inline-end: 2px;
  background: var(--surface-3); color: var(--text-2);
  font-size: 11px; font-weight: 650; font-family: var(--mono);
}
.ts-spk.named { background: var(--brand-soft); color: var(--brand-strong); font-family: var(--font); }
.ts-divider {
  display: flex; align-items: center; gap: 7px;
  margin: 12px 0 6px; padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 650; color: var(--brand-strong);
}
.ts-divider:first-child { margin-top: 0; }


/* ------------------------------------------------------- จับคู่ผู้พูด --- */

.spk-file + .spk-file { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.spk-file-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.spk-file-head h4 { font-size: 13.5px; font-weight: 600; }

.spk-row {
  display: grid; grid-template-columns: 116px 1fr 260px; gap: 12px;
  align-items: start; padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.spk-row:last-child { border-bottom: 0; }
.spk-tag {
  font-family: var(--mono); font-size: 11.5px; font-weight: 650;
  padding: 3px 8px; border-radius: 6px; text-align: center;
  background: var(--surface-3); color: var(--text-2);
}
.spk-meta { font-size: 11px; color: var(--text-3); margin-top: 4px; text-align: center; }
.spk-sample { font-size: 12.5px; color: var(--text-2); line-height: 1.55; }
.spk-sample q { color: var(--text); }
.spk-sugg { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.spk-sugg button {
  border: 1px dashed var(--brand); background: var(--brand-tint); color: var(--brand-strong);
  border-radius: 100px; padding: 2px 10px; font-size: 11.5px; cursor: pointer;
}
[data-theme="dark"] .spk-sugg button { background: var(--surface-3); }
.spk-sugg button:hover { border-style: solid; }

@media (max-width: 900px) {
  .spk-row { grid-template-columns: 1fr; }
  .spk-tag, .spk-meta { text-align: start; }
}

/* -------------------------------------------------------------- toast --- */

.toasts { position: fixed; inset-block-end: 20px; inset-inline-end: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; max-width: 400px; }
.toast {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-3); font-size: 13px;
  animation: pop .2s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
.toast.ok { border-inline-start: 3px solid var(--success); }
.toast.err { border-inline-start: 3px solid var(--danger); }
.toast.info { border-inline-start: 3px solid var(--info); }
.toast .x { margin-inline-start: auto; cursor: pointer; color: var(--text-3); background: none; border: 0; padding: 0 2px; }

/* -------------------------------------------------------------- modal --- */

.modal-back { position: fixed; inset: 0; z-index: 150; background: rgba(15, 20, 28, .55);
  display: grid; place-items: center; padding: 24px; backdrop-filter: blur(2px); }
.modal-back[hidden] { display: none; }
.modal { width: min(560px, 100%); max-height: 85vh; overflow: auto;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-3); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 600; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }

/* ------------------------------------------------------------ settings --- */

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tab {
  padding: 9px 15px; border: 0; background: transparent; cursor: pointer;
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand-strong); border-bottom-color: var(--brand); font-weight: 600; }

.list-editor { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-editor-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--surface-2); border-bottom: 1px solid var(--line); }
.list-scroll { max-height: 460px; overflow-y: auto; }

.sec-editor { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.sec-editor:last-child { border-bottom: 0; }
.sec-editor .handle { display: flex; flex-direction: column; gap: 2px; align-items: center; padding-top: 4px; }
.sec-editor .handle button { border: 0; background: none; cursor: pointer; color: var(--text-3); padding: 0; line-height: 1; }
.sec-editor .handle button:hover { color: var(--brand); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap;
    border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 14px; }
  .brand { padding: 0 12px 0 0; }
  .nav-label, .sidebar-foot { display: none; }
  .view { padding: 16px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .stepper { flex-wrap: wrap; }
  .step { flex: 1 1 45%; }
}

/* ------------------------------------------------ กู้เสียงที่อัดค้างไว้ --- */

.rescue {
  margin-bottom: 14px; padding: 13px 15px;
  border-radius: var(--radius-sm);
  background: var(--brand-tint);
  border: 1px solid color-mix(in srgb, var(--brand) 34%, transparent);
}
.rescue-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.rescue-head svg { flex: none; color: var(--brand-strong); }
.rescue p { color: var(--text-2); }

/* --------------------------------------------------------- แก้ไขโน้ต --- */

.tl-editable { cursor: text; border-bottom: 1px dashed transparent; }
.tl-editable:hover { border-bottom-color: var(--line-strong); }
.tl-input { flex: 1; height: 30px; font-size: 13px; padding: 3px 8px; }

/* ------------------------------------------- หน้าแรกตอนยังไม่เปิดการประชุม --- */

.blank { padding: 52px 24px; text-align: center; }
.blank > svg { width: 22px; height: 22px; color: var(--brand); opacity: .75; }
.blank h2 { margin: 8px 0 6px; font-size: 18px; }
.blank p { color: var(--text-3); font-size: 13.5px; line-height: 1.75; }
.blank-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
