/* Translitiration — dark UI */
:root {
    --bg: #0E1114;
    --panel: #12161A;
    --panel-2: #161B20;
    --inset: #0B0E11;
    --line: #232A31;
    --line-2: #2B333B;
    --row: #1B2127;
    --hl: #1A2026;
    --text: #E6E8EB;
    --text-2: #C9CFD6;
    --muted: #A3ACB6;
    --dim: #8C96A0;
    --accent: #F2B25C;
    --accent-ink: #1A1206;
    --accent-bg: #2A2113;
    --customer: #8FB4F0;
    --customer-sw: #6F9BE0;
    --ok: #5FD0A0;
    --idle: #5B6672;
    --danger: #F08A8A;
    --sans: 'IBM Plex Sans', system-ui, sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, monospace;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; }
a { color: var(--accent); }
a:hover { color: #FFD08A; }
h1 { margin: 0; font-size: 28px; font-weight: 600; }
h2 { margin: 0; font-size: 16px; font-weight: 600; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.link { text-decoration: none; }
[hidden] { display: none !important; }

/* top bar */
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; padding: 14px 32px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 17px; }
.brand svg { color: var(--accent); }
.brand:hover { color: var(--text); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { padding: 10px 14px; border-radius: 8px; color: var(--muted); text-decoration: none; }
.nav a.active, .nav a:hover { background: #1E242B; color: var(--text); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbar-right form { margin: 0; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 13px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--idle); flex: none; }
.dot.ok { background: var(--ok); }
.dot.busy { background: var(--accent); }
.dot.fail { background: var(--danger); }

/* layout */
.page { min-height: calc(100vh - 70px); }
.container { max-width: 1280px; margin: 0 auto; padding: 32px; }
.stack { display: flex; flex-direction: column; gap: 22px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head p { margin: 6px 0 0; }
.h-file { font-size: 22px; margin-top: 6px; word-break: break-all; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.card { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.cols { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font: inherit; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #3A444E; color: var(--text); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: default; pointer-events: none; }
.btn-primary { border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: #FFC67A; color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-danger-ghost.confirm { background: #3A1A1A; border-color: var(--danger); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn-block { width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* dropzone */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px; border: 1.5px dashed #33404B; border-radius: 12px; background: #12171C; color: var(--muted); cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.dropzone svg { color: var(--accent); }
.dropzone strong { color: var(--text); font-weight: 500; }
.dropzone.over { border-color: var(--accent); background: #191712; }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.pill.on { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.search { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search input, .field input { min-height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-2); background: #12171C; color: var(--text); font: inherit; font-size: 14px; }
.search input { width: 300px; max-width: 60vw; }

/* table */
.table-box { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.table { width: 100%; min-width: 860px; border-collapse: collapse; }
.table th { text-align: left; padding: 12px 20px; font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .8px; color: var(--dim); border-bottom: 1px solid var(--line); }
.table td { padding: 12px 20px; border-bottom: 1px solid var(--row); font-size: 14px; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td.file { font-family: var(--mono); }
.table td.num { font-family: var(--mono); color: var(--text-2); }
.table td.preview { color: var(--muted); max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.table td.right { white-space: nowrap; width: 1%; }
.btn-danger-ghost.confirm { color: #fff; }
.status { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.tag { display: inline-block; margin-left: 8px; padding: 1px 6px; border-radius: 4px; font-size: 11px; color: var(--dim); border: 1px solid var(--line-2); font-family: var(--sans); }

/* player */
.player { display: flex; align-items: center; gap: 16px; padding: 16px 20px; }
.play { flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.wave { flex: 1; min-width: 0; height: 48px; cursor: pointer; }
.time { flex: none; font-size: 14px; color: var(--text-2); }

/* transcript */
.transcript { flex: 999 1 560px; min-width: 0; }
.transcript-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.segmented { display: flex; padding: 3px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.segmented button { min-height: 38px; padding: 0 14px; border-radius: 7px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.segmented button.on { background: var(--line); color: var(--text); }
.legend { margin-left: auto; display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.sw-agent { background: var(--accent); }
.sw-customer { background: var(--customer-sw); }
.lines { padding: 8px 0; }
.line { display: grid; grid-template-columns: 56px 84px minmax(0, 1fr); gap: 12px; padding: 10px 20px; cursor: pointer; border-left: 2px solid transparent; }
.line:hover { background: #161B20; }
.line.now { background: var(--hl); border-left-color: var(--accent); }
.line.no-speaker { grid-template-columns: 56px minmax(0, 1fr); }
.line .t { font-family: var(--mono); font-size: 13px; color: var(--dim); padding-top: 2px; }
.line .who { font-size: 13px; font-weight: 600; padding-top: 1px; }
.line .who.agent { color: var(--accent); }
.line .who.customer { color: var(--customer); }
.line .txt { line-height: 1.55; }
.plain { padding: 20px; line-height: 1.7; white-space: pre-wrap; }
.pending { padding: 24px 20px; display: flex; flex-direction: column; gap: 12px; }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.error-box { margin: 16px 20px; padding: 12px 14px; border: 1px solid #5A2A2A; border-radius: 8px; background: #221416; color: #F4B4B4; }

/* side */
.side { flex: 1 1 320px; display: flex; flex-direction: column; gap: 16px; }
.side-card { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.side-head { display: flex; align-items: center; justify-content: space-between; }
.details { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.details div { display: flex; flex-direction: column; gap: 3px; }
.details dt { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--dim); }
.details dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.details dd.empty { color: var(--idle); }
.details.compact { gap: 8px; font-size: 14px; }
.details.compact div { flex-direction: row; justify-content: space-between; gap: 12px; }
.details.compact dt { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--muted); }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.login-card p { margin: 0; }
.login-brand { font-size: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span:first-child { font-size: 13px; color: var(--muted); }
.field input { min-height: 44px; font-size: 15px; }
.field-error, .form-error { color: var(--danger); font-size: 13px; }
.form-error ul { margin: 0; padding-left: 18px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); padding: 12px 18px; border-radius: 10px; background: #232A31; color: var(--text); border: 1px solid var(--line-2); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--danger); }

@media (max-width: 640px) {
    .container { padding: 20px 16px; }
    .topbar { padding: 12px 16px; gap: 12px; }
    .search { margin-left: 0; width: 100%; }
    .search input { flex: 1; width: auto; }
}

/* summary */
.summary-card { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.summary-card p { margin: 0; line-height: 1.6; }
.outcome { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--text-2); }
.outcome.booked { border-color: var(--ok); color: var(--ok); }
.outcome.quote, .outcome.callback { border-color: var(--accent); color: var(--accent); }
.table td.summary { color: var(--muted); max-width: 380px; }
.table td.summary .clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }

/* settings */
.settings-card { padding: 24px; display: flex; flex-direction: column; gap: 18px; max-width: 760px; }
.settings-card p { margin: 0; line-height: 1.6; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.settings-grid input { width: 140px; }
.usage { display: flex; flex-direction: column; gap: 8px; }
.usage-head { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); }
.usage-warn { color: var(--danger); margin: 0; }
.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.settings-divider { height: 1px; background: var(--line); margin: 4px 0; }
.settings-card .field input { width: 140px; }
.settings-card input:disabled { opacity: .5; }
