:root {
  --ink: #172033;
  --ink-2: #4a5568;
  --ink-3: #7a8699;
  --paper: #f3f5f8;
  --panel: #ffffff;
  --rule: #d8dee7;
  --rule-2: #e8ecf2;
  --signal: #2450c8;
  --signal-soft: #e6ecfb;
  --amber: #a86a12;
  --amber-soft: #fbf1df;
  --green: #2e7d57;
  --green-soft: #e3f2ea;
  --red: #b83a2a;
  --red-soft: #fbe7e4;
  --agent: #eef2fb;
  --client: #f4f5f7;
  --radius: 6px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 15px/1.5 var(--font);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
[hidden] { display: none !important; }

/* ---------- butoane */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--panel); cursor: pointer; font-size: 14px; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--signal); border-color: var(--signal); color: #fff; }
.btn.primary:hover { background: #1c41a6; }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); }
.btn.link { border: 0; background: none; padding: 4px 6px; color: var(--ink-2); }
.btn.link:hover { color: var(--ink); text-decoration: underline; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- antet */
.top {
  display: flex; align-items: center; gap: 24px;
  height: 56px; padding: 0 20px;
  background: var(--ink); color: #fff;
}
.brand { font-weight: 600; font-size: 16px; letter-spacing: .2px; }
.brand small { font-weight: 400; color: #aab4c5; margin-left: 8px; font-size: 13px; }
.top .stats { color: #aab4c5; font-size: 13px; margin-left: auto; }
.top nav { display: flex; gap: 4px; }
.top .btn.link { color: #d5dbe6; }
.top .btn.link:hover { color: #fff; }

/* ---------- layout */
.layout { display: grid; grid-template-columns: 380px 1fr; height: calc(100% - 56px); }
.side { border-right: 1px solid var(--rule); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.detail { overflow: auto; min-height: 0; }

/* ---------- încărcare */
.upload { padding: 16px; border-bottom: 1px solid var(--rule); }
.drop {
  display: block; padding: 18px 16px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--rule); border-radius: var(--radius); background: var(--paper);
  color: var(--ink-2); font-size: 14px;
}
.drop strong { color: var(--ink); display: block; font-size: 15px; }
.drop.over { border-color: var(--signal); background: var(--signal-soft); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.opts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 10px 12px; margin-top: 12px; }
.opts label.field { display: flex; flex-direction: column; font-size: 13px; color: var(--ink-2); gap: 3px; }
.opts select { width: 100%; min-width: 0; padding: 6px 8px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); }
.opts .check { grid-column: 1 / -1; display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--ink-2); }
.opts .check input { margin-top: 3px; }
.upbar { height: 3px; background: var(--rule-2); border-radius: 2px; margin-top: 12px; overflow: hidden; }
.upbar div { height: 100%; width: 0; background: var(--signal); transition: width .2s; }
.upmsg { font-size: 13px; margin-top: 6px; color: var(--ink-2); }
.upmsg.err { color: var(--red); }

/* ---------- listă */
.list-head { display: flex; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--rule-2); }
.list-head input, .list-head select {
  padding: 6px 10px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); min-width: 0;
}
.list-head input { flex: 1; }
.jobs { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
.job {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px;
  padding: 11px 16px; border-bottom: 1px solid var(--rule-2); cursor: pointer;
  border-left: 3px solid transparent;
}
.job:hover { background: var(--paper); }
.job.sel { background: var(--signal-soft); border-left-color: var(--signal); }
.job .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job .title { grid-column: 1 / -1; font-size: 13.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job .meta { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; font-size: 12.5px; color: var(--ink-3); }
.score { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 14px; }
.score.hi { color: var(--green); } .score.mid { color: var(--amber); } .score.lo { color: var(--red); }
.empty-list { padding: 28px 16px; color: var(--ink-3); font-size: 14px; }

/* ---------- mini-banda din listă */
.mini { display: inline-flex; gap: 3px; }
.mini i { width: 14px; height: 4px; border-radius: 2px; background: var(--rule); }
.mini i.done { background: var(--green); }
.mini i.active { background: var(--signal); }
.mini i.review { background: var(--amber); }
.mini i.error { background: var(--red); }
.mini i.skip { background: var(--rule-2); }

/* ---------- detaliu */
.pane { max-width: 1000px; padding: 24px 32px 48px; }
.empty { display: grid; place-items: center; height: 100%; color: var(--ink-3); text-align: center; padding: 40px; }
.empty h2 { color: var(--ink); font-weight: 600; margin: 0 0 6px; font-size: 20px; }
.dhead { display: flex; gap: 16px; align-items: flex-start; }
.dhead h1 { font-size: 21px; font-weight: 600; margin: 0; word-break: break-word; line-height: 1.3; }
.dhead .actions { margin-left: auto; display: flex; gap: 8px; flex-shrink: 0; }
.dmeta { color: var(--ink-3); font-size: 13.5px; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 16px; }

/* ---------- banda de procesare: elementul central */
.pipe { display: grid; grid-template-columns: repeat(4, 1fr); margin: 22px 0 18px; }
.step { position: relative; padding-top: 14px; }
.step .bar { position: absolute; top: 0; left: 0; right: 4px; height: 6px; border-radius: 3px; background: var(--rule-2); overflow: hidden; }
.step .bar div { height: 100%; width: 0; background: var(--signal); transition: width .6s ease; }
.step .lbl { font-weight: 600; font-size: 14px; }
.step .sub { font-size: 12.5px; color: var(--ink-3); }
.step.done .bar div { width: 100%; background: var(--green); }
.step.done .lbl::after { content: " ✓"; color: var(--green); }
.step.active .bar div { background: var(--signal); }
.step.active .lbl { color: var(--signal); }
.step.pulse .bar div { width: 100%; animation: pulse 1.4s ease-in-out infinite; }
.step.review .bar div { width: 100%; background: var(--amber); }
.step.review .lbl { color: var(--amber); }
.step.error .bar div { width: 100%; background: var(--red); }
.step.error .lbl { color: var(--red); }
.step.skip .lbl { color: var(--ink-3); font-weight: 400; text-decoration: line-through; }
@keyframes pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .step.pulse .bar div { animation: none; opacity: .7; }
  .step .bar div, .upbar div { transition: none; }
}

/* ---------- mesaje */
.notice { padding: 12px 14px; border-radius: var(--radius); margin: 0 0 16px; font-size: 14px; display: flex; gap: 12px; align-items: center; }
.notice .grow { flex: 1; }
.notice.review { background: var(--amber-soft); color: #6d4509; }
.notice.error { background: var(--red-soft); color: #7c2318; }
.notice.info { background: var(--signal-soft); color: #1c3a8c; }

audio { width: 100%; margin: 0 0 12px; }

/* ---------- file */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule); margin-bottom: 18px; }
.tab { padding: 9px 14px; border: 0; background: none; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }

/* ---------- analiză */
.an-top { display: grid; grid-template-columns: 1fr auto; gap: 12px 24px; align-items: start; }
.an-top h2 { margin: 0; font-size: 19px; font-weight: 600; }
.an-top .rez { grid-column: 1; color: var(--ink-2); margin: 0; }
.bigscore { grid-row: 1 / span 3; grid-column: 2; text-align: right; }
.bigscore b { display: block; font-size: 44px; line-height: 1; font-variant-numeric: tabular-nums; }
.bigscore span { font-size: 13px; color: var(--ink-3); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12.5px; padding: 2px 9px; border-radius: 10px; background: var(--paper); border: 1px solid var(--rule); color: var(--ink-2); }
.an-actions { display: flex; gap: 8px; align-items: center; margin: 16px 0 4px; padding-bottom: 16px; border-bottom: 1px solid var(--rule-2); flex-wrap: wrap; }
.an-actions select { padding: 6px 8px; border: 1px solid var(--rule); border-radius: var(--radius); }
.an-cost { margin-left: auto; font-size: 12.5px; color: var(--ink-3); }

.md { max-width: 74ch; }
.md h1, .md h2 { font-size: 17px; margin: 26px 0 8px; font-weight: 600; }
.md h3 { font-size: 15px; margin: 20px 0 6px; font-weight: 600; }
.md p { margin: 0 0 10px; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 22px; }
.md li { margin-bottom: 4px; }
.md code { background: var(--paper); padding: 1px 5px; border-radius: 4px; font-size: 13.5px; }
.md hr { border: 0; border-top: 1px solid var(--rule); margin: 20px 0; }
.md .tbl { overflow-x: auto; margin: 0 0 14px; }
.md table { border-collapse: collapse; font-size: 14px; min-width: 60%; }
.md th, .md td { border-bottom: 1px solid var(--rule); padding: 7px 12px 7px 0; text-align: left; vertical-align: top; }
.md th { font-weight: 600; border-bottom-color: var(--ink-3); }

/* ---------- transcriere */
.tr-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.tr-tools .grow { flex: 1; font-size: 13px; color: var(--ink-3); }
.warn-line { font-size: 13px; color: var(--red); margin-bottom: 10px; }
.seg { display: grid; grid-template-columns: 74px 1fr; gap: 10px; padding: 5px 0; }
.seg .t {
  border: 0; background: none; padding: 2px 0; text-align: left; cursor: pointer;
  color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums;
}
.seg .t:hover { color: var(--signal); text-decoration: underline; }
.seg .body { padding: 4px 10px; border-radius: var(--radius); }
.seg .spk { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-right: 6px; }
.lanes .seg.agent .body { background: var(--agent); margin-right: 12%; }
.lanes .seg.client .body { background: var(--panel); border: 1px solid var(--rule-2); margin-left: 12%; }
.seg.playing .body { outline: 1.5px solid var(--signal); }
mark.ph { background: #fff0c2; color: #6d4509; padding: 0 3px; border-radius: 3px; font-size: .92em; }
.seg textarea {
  width: 100%; border: 1px solid var(--rule); border-radius: var(--radius); padding: 5px 8px;
  resize: vertical; min-height: 34px; background: #fffdf5;
}

/* ---------- dialoguri */
dialog { border: 0; border-radius: 10px; padding: 0; width: min(640px, 94vw); box-shadow: 0 20px 60px rgba(23, 32, 51, .28); }
dialog::backdrop { background: rgba(23, 32, 51, .45); }
.dlg { padding: 22px 24px; }
.dlg h2 { margin: 0 0 14px; font-size: 18px; }
.dlg .row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.dlg input { padding: 7px 10px; border: 1px solid var(--rule); border-radius: var(--radius); flex: 1; min-width: 140px; }
.dlg table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dlg td, .dlg th { padding: 7px 8px 7px 0; border-bottom: 1px solid var(--rule-2); text-align: left; }
.dlg .foot { display: flex; justify-content: flex-end; margin-top: 18px; gap: 8px; }
.dlg .msg { font-size: 13.5px; margin-top: 8px; min-height: 1.2em; }
.dlg .msg.err { color: var(--red); } .dlg .msg.ok { color: var(--green); }
.audit { max-height: 60vh; overflow: auto; }
.audit td { font-size: 13px; }

.menu { position: relative; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; min-width: 230px;
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(23, 32, 51, .14); padding: 4px;
}
.menu-list a { display: block; padding: 8px 10px; color: var(--ink); text-decoration: none; border-radius: 4px; font-size: 14px; }
.menu-list a:hover { background: var(--paper); }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: var(--radius); font-size: 14px; z-index: 50;
}

/* ---------- login */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 20px; }
.login { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; padding: 28px; }
.login h1 { font-size: 20px; margin: 0 0 4px; }
.login p { margin: 0 0 20px; color: var(--ink-3); font-size: 14px; }
.login label { display: block; font-size: 13px; color: var(--ink-2); margin: 12px 0 4px; }
.login input { width: 100%; padding: 9px 11px; border: 1px solid var(--rule); border-radius: var(--radius); }
.login .btn { width: 100%; justify-content: center; margin-top: 20px; padding: 10px; }
.login .err { color: var(--red); font-size: 14px; margin-top: 12px; min-height: 1.3em; }

/* ---------- ecrane mici */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .side { border-right: 0; border-bottom: 1px solid var(--rule); }
  .jobs { max-height: 50vh; }
  .pane { padding: 18px 16px 40px; }
  .pipe { grid-template-columns: repeat(2, 1fr); gap: 14px 0; }
  .top { gap: 12px; padding: 0 12px; }
  .top .stats, .brand small { display: none; }
  .top nav { overflow-x: auto; margin-left: auto; }
  .dhead { flex-direction: column; }
  .dhead .actions { margin-left: 0; }
}

/* =================================================================== Voice QA, Etapa 2 */
.span2 { grid-column: 1 / -1; }
.opts input:not([type=checkbox]) { width: 100%; min-width: 0; padding: 6px 8px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); }
.adv summary { cursor: pointer; font-size: 13.5px; color: var(--ink-2); padding: 2px 0; }
.adv[open] summary { margin-bottom: 8px; }
.opts.inner { margin-top: 0; }
.list-head.second { padding-top: 0; }
.list-head.second select { flex: 1; }
.unassigned {
  margin: 10px 16px 0; padding: 8px 12px; border: 1px solid var(--amber); border-radius: var(--radius);
  background: var(--amber-soft); color: #6d4509; font-size: 13.5px; text-align: left; cursor: pointer;
}
.hint { font-size: 13px; color: var(--ink-3); margin: 0 0 8px; }
.dlg.wide { width: auto; }
dialog:has(.dlg.wide) { width: min(900px, 96vw); }
.dlg h3 { font-size: 15px; margin: 18px 0 6px; }
.dlg select[multiple] { min-width: 180px; border: 1px solid var(--rule); border-radius: var(--radius); padding: 4px; }
.dlg td input, .dlg td select { padding: 4px 6px; border: 1px solid var(--rule); border-radius: 4px; width: 100%; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; align-items: end; }
.grid2 .field, .dlg .field { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--ink-2); }
.grid2 input { padding: 7px 10px; border: 1px solid var(--rule); border-radius: var(--radius); }
.pat { display: grid; grid-template-columns: 160px 1fr auto; gap: 8px; margin-bottom: 6px; }
.pat input { padding: 6px 8px; border: 1px solid var(--rule); border-radius: var(--radius); font-family: Consolas, monospace; font-size: 13px; min-width: 0; }
.pat input:first-child { font-family: inherit; }

/* listă interacțiuni */
.job .ref { font-weight: 600; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; border: 1px solid transparent; white-space: nowrap; }
.pill.open { background: var(--signal-soft); color: #1c3a8c; }
.pill.closed { background: var(--paper); color: var(--ink-2); border-color: var(--rule); }
.pill.proc { background: var(--signal-soft); color: var(--signal); }
.pill.err { background: var(--red-soft); color: var(--red); }
.pill.warn { background: var(--amber-soft); color: var(--amber); }
.job .sub { grid-column: 1 / -1; font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job .flags { display: inline-flex; gap: 4px; }

/* detaliu interacțiune */
.ihead { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.ihead h1 { margin: 0; font-size: 22px; font-variant-numeric: tabular-nums; }
.ihead .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 20px; margin: 18px 0; padding: 14px 16px;
  background: var(--panel); border: 1px solid var(--rule-2); border-radius: var(--radius); }
.facts div span { display: block; font-size: 12px; color: var(--ink-3); }
.facts div b { font-weight: 500; font-variant-numeric: tabular-nums; }
.ids { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 22px; }
.ids label { display: flex; flex-direction: column; font-size: 12px; color: var(--ink-3); gap: 3px; }
.ids input { padding: 6px 8px; border: 1px solid var(--rule); border-radius: var(--radius); width: 170px; background: var(--panel); }

/* cronologia apelurilor: fiecare apel e o secțiune pe firul interacțiunii */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--rule); }
.call { position: relative; margin-bottom: 18px; background: var(--panel); border: 1px solid var(--rule-2); border-radius: var(--radius); }
.call::before { content: attr(data-n); position: absolute; left: -26px; top: 12px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--ink); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.call.err::before { background: var(--red); }
.call.proc::before { background: var(--signal); }
.call-head { display: flex; gap: 12px; align-items: center; padding: 10px 14px; flex-wrap: wrap; }
.call-head .t1 { font-weight: 600; }
.call-head .t2 { color: var(--ink-3); font-size: 13.5px; display: flex; gap: 12px; flex-wrap: wrap; }
.call-head .acts { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.call-head .acts .btn { padding: 4px 10px; font-size: 13px; }
.call-body { padding: 0 14px 14px; }
.call .notice { margin: 0 0 10px; }
.stages { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--ink-3); padding: 0 14px 10px; }
.stages i { width: 34px; height: 5px; border-radius: 3px; background: var(--rule-2); overflow: hidden; position: relative; }
.stages i.done { background: var(--green); }
.stages i.active { background: var(--signal-soft); }
.stages i.active::after { content: ""; position: absolute; inset: 0; background: var(--signal); animation: pulse 1.4s ease-in-out infinite; }
.stages i.error { background: var(--red); }
.conf { font-size: 12.5px; }
.conf.lo { color: var(--amber); font-weight: 600; }
.lanes .seg.necunoscut .body { background: var(--panel); border: 1px dashed var(--rule); }
.mini-tabs { display: flex; gap: 2px; margin: 4px 0 10px; border-bottom: 1px solid var(--rule-2); }
.mini-tabs .tab { padding: 6px 10px; font-size: 13.5px; }
select.inline { padding: 4px 6px; border: 1px solid var(--rule); border-radius: var(--radius); font-size: 13px; }

@media (max-width: 900px) {
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: 1fr; }
  .pat { grid-template-columns: 1fr; }
}
h2.sec { font-size: 16px; font-weight: 600; margin: 0 0 12px; }
.small { font-size: 12.5px; margin-bottom: 8px; }
a.btn { text-decoration: none; color: var(--ink); }
a.btn.link { color: var(--ink-2); }
.chk-group { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13.5px; }
.chk-group label { display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }
.dlg .chk-group input { flex: none; min-width: 0; padding: 0; }
.dlg .row .chk-group { flex: 1 1 100%; }
.dlg input[type=checkbox] { flex: none; min-width: 0; }
