/* Screens of the ASR factory. Builds on tokens.css and components.css; no new brand colours. */

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Heebo", -apple-system, system-ui, sans-serif; font-size: 14px; }
.num, .en { font-family: "Inter", system-ui, sans-serif; direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; direction: ltr; unicode-bidi: isolate; font-size: 12px; }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 2px solid var(--primary-500); outline-offset: 2px; }
.muted { color: var(--text-3); }
.main { max-width: 1320px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.grid { display: grid; gap: 16px; }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.table-wrap { overflow-x: auto; }
.table td.file { max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.empty { padding: 40px 16px; text-align: center; color: var(--text-3); }
.stat__value small { font-size: 14px; font-weight: 500; color: var(--text-3); margin-inline-start: 6px; }

.meter { height: 8px; border-radius: var(--r-pill); background: var(--bg-deep); overflow: hidden; margin-top: 12px; }
.meter > i { display: block; height: 100%; background: var(--primary-500); border-radius: var(--r-pill); }

.filter { cursor: pointer; }
.filter.on { background: var(--primary-500); color: white; border-color: transparent; }

.breakdown { display: flex; flex-direction: column; gap: 10px; }
.breakdown div { display: flex; align-items: center; gap: 10px; }
.breakdown b { font-weight: 600; min-width: 44px; text-align: left; }

/* Review screen */
.review { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.review__side { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 16px; max-height: calc(100vh - 24px); overflow-y: auto; }
@media (max-width: 1100px) { .review { grid-template-columns: 1fr; } .review__side { position: static; max-height: none; } .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.player { position: sticky; top: 12px; z-index: 5; box-shadow: var(--shadow-md); }
.wave { direction: ltr; position: relative; height: 96px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--stroke); overflow: hidden; cursor: pointer; }
.wave canvas { width: 100%; height: 100%; display: block; }
.player__bar { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.player__time { font-size: 15px; font-weight: 600; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-3); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 5px; vertical-align: -1px; }

.turn { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--stroke); align-items: start; }
.turn:last-child { border-bottom: 0; }
.turn__meta { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.turn__body { border-radius: var(--r-md); padding: 10px 14px; line-height: 2.05; font-size: 16px; border-inline-start: 3px solid var(--spk); background: var(--spk-bg); }
.turn.rejected .turn__body { opacity: 0.45; text-decoration: line-through; }
.spk-chip { background: var(--spk-bg); color: var(--spk); border-color: transparent; font-weight: 600; cursor: pointer; }
.spk-1 { --spk: var(--agent); --spk-bg: #f3f0ff; }
.spk-2 { --spk: var(--customer); --spk-bg: #e6f6f6; }
.spk-3 { --spk: var(--info); --spk-bg: var(--info-bg); }
.spk-4 { --spk: var(--warn); --spk-bg: var(--warn-bg); }
.spk-5 { --spk: var(--text-2); --spk-bg: var(--bg-deep); }

.w { padding: 2px 3px; border-radius: 6px; cursor: pointer; transition: background 80ms; }
.w:hover { background: rgba(15, 23, 41, 0.08); }
.w.now { background: var(--primary-500); color: white; }
.w.sel { box-shadow: 0 0 0 2px var(--primary-400); }
.w.low { text-decoration: underline dotted var(--warn); text-underline-offset: 5px; }
.w.flag { text-decoration: underline wavy var(--danger); text-underline-offset: 5px; }
.w.edited { background: var(--success-bg); }
.w.edited.now { background: var(--primary-500); }
.w.rej { opacity: 0.45; text-decoration: line-through; }
.event { font-size: 12px; color: var(--text-3); }

/* In-place word editor: opens under the word that was clicked */
.pop { position: absolute; z-index: 30; display: none; width: 560px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--stroke-strong); border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 12px; flex-direction: column; gap: 10px; }
.pop.open { display: flex; }
.pop__row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pop__text { flex: 1; min-width: 180px; padding: 9px 12px; border-radius: var(--r-md); border: 1px solid var(--primary-400); box-shadow: 0 0 0 3px var(--primary-50); font-size: 17px; outline: none; }
.pop__label { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-3); }
.pop__label input { width: 96px; padding: 6px 8px; border-radius: var(--r-sm); border: 1px solid var(--stroke); }
.pop__times summary { cursor: pointer; font-size: 12px; color: var(--text-3); }
.pop__times .pop__row { margin-top: 8px; }
.pop__hint { font-size: 11px; color: var(--text-3); line-height: 1.6; }

.finding { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; border: 0; background: transparent; width: 100%; text-align: right; font-size: 13px; color: var(--text-2); }
.finding:hover { background: var(--surface-2); }
.finding .sev { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.sev--error { background: var(--danger); } .sev--warning { background: var(--warn); } .sev--info { background: var(--info); }
.finding small { display: block; color: var(--text-3); }
.scroll { max-height: 300px; overflow-y: auto; }

.editor .field input, .editor .field select { padding: 8px 10px; }
.editor .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.history li { padding: 6px 0; border-bottom: 1px solid var(--stroke); font-size: 13px; list-style: none; }
.history { margin: 0; padding: 0; }
.history li:last-child { border-bottom: 0; }

.toast { position: fixed; bottom: 24px; left: 24px; background: var(--text); color: white; padding: 12px 18px; border-radius: var(--r-md); font-size: 14px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(8px); transition: all 180ms; pointer-events: none; z-index: 50; }
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--danger); }

/* Management screens */
.table--plain tbody tr { cursor: default; }
.table--plain td { white-space: normal; }
.wrap { white-space: normal; word-break: break-word; }
.label { font-size: 12px; color: var(--text-3); margin-bottom: 6px; font-weight: 500; }
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.form-row .field { min-width: 180px; }
.form-row .field textarea { min-width: 420px; direction: ltr; text-align: left; }
.note { margin-top: 12px; padding: 10px 14px; border-radius: var(--r-md); background: var(--info-bg); color: var(--text-2); font-size: 13px; line-height: 1.6; }
.note--warn { background: var(--warn-bg); }
.note--danger { background: var(--danger-bg); color: var(--danger); }
.version { padding: 16px 0; border-bottom: 1px solid var(--stroke); display: flex; flex-direction: column; gap: 10px; }
.version:first-child { padding-top: 0; }
.version:last-child { border-bottom: 0; padding-bottom: 0; }
.kv { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; text-align: right; }
.pre { background: var(--surface-2); border: 1px solid var(--stroke); border-radius: var(--r-sm); padding: 12px; overflow-x: auto; white-space: pre-wrap; text-align: left; max-height: 320px; overflow-y: auto; }
.example { padding: 10px 0; border-bottom: 1px solid var(--stroke); font-size: 14px; line-height: 1.8; }
.sub { font-size: 15px; font-weight: 600; margin: 16px 0 4px; }
.breakdown div .en { flex: 1; }

.w.tagged { box-shadow: inset 0 0 0 1.5px var(--info); }
.w.tagged.sel { box-shadow: 0 0 0 2px var(--primary-400); }

.finding-row { border-bottom: 1px solid var(--stroke); padding-bottom: 6px; margin-bottom: 4px; }
.finding-row:last-child { border-bottom: 0; }
.finding-actions { display: flex; gap: 6px; padding: 0 26px 2px 0; flex-wrap: wrap; }
.event--mark { cursor: pointer; background: var(--surface-2); border: 1px dashed var(--stroke-strong); border-radius: 6px; padding: 1px 6px; }

/* Simple review screen */
.btn--big { padding: 12px 22px; font-size: 16px; }
.topbar--review { flex-wrap: wrap; row-gap: 10px; }
.topbar--review .topbar__spacer { order: 0; }
.more { position: relative; }
.more > summary { list-style: none; }
.more > summary::-webkit-details-marker { display: none; }
.more__menu { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 20; min-width: 270px; background: var(--surface); border: 1px solid var(--stroke); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.more__item { border: 0; background: transparent; text-align: right; padding: 9px 12px; border-radius: 8px; font-size: 14px; color: var(--text); cursor: pointer; }
.more__item:hover:not(:disabled) { background: var(--primary-50); color: var(--primary-600); }
.more__item:disabled { color: var(--text-4); cursor: not-allowed; }
.more__info { border-top: 1px solid var(--stroke); margin-top: 4px; padding: 10px 12px 6px; font-size: 12px; color: var(--text-3); display: flex; flex-direction: column; gap: 6px; }
.login { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: var(--bg, #f5f6fb); padding: 16px; }
.login__box { width: 380px; max-width: 100%; background: var(--surface); border: 1px solid var(--stroke); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login__box h2 { margin: 0; font-size: 22px; }
.login__box p { margin: 0; }
.login__logo { height: 26px; align-self: flex-start; }
.login__box label, .form-row label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-3); }
.login__box input, .form-row input { padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--stroke-strong); font-size: 16px; background: var(--surface); color: var(--text); }
.login__box input:focus, .form-row input:focus { outline: none; border-color: var(--primary-400); box-shadow: 0 0 0 3px var(--primary-50); }
.login__error { color: var(--danger); font-size: 14px; min-height: 20px; }
.login__code { font-size: 28px; letter-spacing: 10px; text-align: center; font-weight: 700; }
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-row label { flex: 1; min-width: 160px; }
.people-list { display: flex; flex-direction: column; gap: 10px; }
.person { border: 1px solid var(--stroke); border-radius: var(--r-md); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.person--off { opacity: .6; }
.person__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.person__head .spacer { flex: 1; }
.people .meter { margin-top: 6px; height: 6px; max-width: 160px; }
#user-box:empty { display: none; }
#user-box { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
#user-box .sidebar__user-info b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.monitor__time { font-size: 18px; font-weight: 600; color: var(--text-2); margin: 2px 0 8px; }
.meter--big { height: 16px; }
.stat--success { border-top: 4px solid var(--success); }
.stat--warn { border-top: 4px solid var(--warn); }
.stat--primary { border-top: 4px solid var(--primary-500); }
.days { display: flex; align-items: flex-end; gap: 10px; min-height: 140px; direction: ltr; }
.days__col { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; max-width: 56px; font-size: 12px; color: var(--text-3); }
.days__col i { display: block; width: 100%; background: var(--primary-500); border-radius: 6px 6px 0 0; }
.days__col b { color: var(--text); }
.studio { position: fixed; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center; background: rgba(22, 16, 60, .5); padding: 16px; }
.studio.open { display: flex; }
.studio__box { width: 920px; max-width: 100%; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.studio__head { display: flex; align-items: center; gap: 12px; }
.studio__head h3 { margin: 0; flex: 1; font-size: 18px; }
.studio__context { margin: 0; font-size: 17px; line-height: 1.9; color: var(--text-2); }
.studio__context mark { background: var(--primary-100); color: var(--text); padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.studio__wave { direction: ltr; height: 150px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--stroke); overflow: hidden; cursor: pointer; }
.studio__wave canvas { width: 100%; height: 100%; display: block; }
.studio__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.studio__row input[type=range] { flex: 1; min-width: 200px; accent-color: var(--primary-500); direction: ltr; }
.studio__row .spacer { flex: 1; }
.guide { display: flex; align-items: center; gap: 16px; background: var(--primary-50); border-color: var(--primary-100); }
.guide ol { margin: 0; padding-inline-start: 20px; flex: 1; line-height: 1.9; font-size: 14px; color: var(--text-2); }
.fold > summary { cursor: pointer; font-weight: 600; font-size: 15px; color: var(--text-2); }
.fold[open] > summary { margin-bottom: 12px; }

.scroll { overflow-x: hidden; }
.btn--play { background: var(--primary-50); color: var(--primary-700); border-color: var(--primary-200); font-weight: 600; min-width: 96px; justify-content: center; }
.btn--play:hover { background: var(--primary-100); border-color: var(--primary-400); }
