/* ===========================================================================
   SRT QC — the landing page drop zone and the full-window editor.
   Tokens only (flayr.css). Like the review player, the picture and the
   timeline sit on the dark stage (ink) so footage is judged against black;
   the panels around them stay in the light system.
   ======================================================================== */

/* Finding colours: badges use the pill classes, the canvas reads these. */
:root {
  --sq-sync: var(--signal);
  --sq-spelling: var(--danger);
  --sq-grammar: var(--cyan);
  --sq-technical: var(--warn-soft);
}

/* ---------------------------------------------------------- landing ---- */
.sq-hero { padding-bottom: clamp(24px, 4vw, 40px); }
.sq-dropcard { max-width: 860px; margin: 0 auto; }
.sq-dropcard-title { font-size: var(--fs-4); margin: 0 0 4px; }
.sq-dropcard-sub { margin: 0 0 18px; }
.sq-slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sq-slot { border: 0; font: inherit; min-height: 150px; align-content: center; }
.sq-slot strong { color: var(--ink); font-weight: 600; }
.sq-slot-name { font-size: var(--fs-xs); overflow-wrap: anywhere; }
.sq-slot.is-set { background: var(--mint-soft); color: var(--teal-ink); }
.sq-slot.is-set .sq-slot-name { color: var(--ink); }
.sq-slot.is-over { background: var(--mint-soft); box-shadow: inset 0 0 0 2px var(--teal); }
.sq-msgs { display: grid; gap: 8px; margin-top: 12px; }
.sq-msgs:empty { display: none; }
.sq-open-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 18px; }
.sq-feature-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r); background: var(--mint-soft); color: var(--teal-ink); margin-bottom: 14px; flex: none; }
.sq-feature-icon .icon { width: 22px; height: 22px; }
.sq-privacy { display: flex; gap: 18px; align-items: flex-start; }
.sq-privacy .sq-feature-icon { margin: 0; }
.sq-privacy h2 { margin: 0 0 6px; }
@media (max-width: 640px) { .sq-slots { grid-template-columns: minmax(0, 1fr); } .sq-slot { min-height: 110px; } .sq-privacy { flex-direction: column; } }

/* ------------------------------------------------------- app shell ---- */
.sq-app { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; background: var(--bg); }
.sq-bar { flex: none; height: 52px; display: flex; align-items: center; gap: 12px; padding: 0 12px; background: var(--surface); box-shadow: inset 0 -1px 0 var(--hairline); min-width: 0; }
.sq-back { flex: none; }
.sq-files { display: flex; gap: 14px; min-width: 0; flex: 1; font-size: var(--fs-xs); color: var(--muted); }
.sq-file { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.sq-file .icon { width: 15px; height: 15px; flex: none; color: var(--teal-ink); }
.sq-bar-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.sq-status { font-size: var(--fs-2xs); color: var(--muted); max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 6px; font-variant-numeric: tabular-nums; }

.sq-loader { flex: 1; display: grid; place-items: center; padding: 24px; overflow: auto; }
.sq-loader-card { width: min(760px, 100%); display: grid; gap: 12px; }
.sq-loader-card h1 { margin: 0; }
.sq-loader-card p { margin: 0; }

.sq-main {
  flex: 1; min-height: 0; display: grid; gap: 10px; padding: 10px;
  /* Large player on the left; the subtitle column (caption list over the
     selected subtitle) between it and the findings; timeline along the bottom. */
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px) minmax(280px, 360px);
  grid-template-rows: minmax(0, 1.5fr) minmax(190px, 1fr) clamp(220px, 34vh, 330px);
  grid-template-areas: "stage trans find" "stage insp find" "tl tl tl";
}

/* ----------------------------------------------------------- player ---- */
.sq-stage { grid-area: stage; min-height: 0; display: flex; flex-direction: column; background: var(--ink); border-radius: var(--r-lg); overflow: hidden; color: var(--surface); }
.sq-screen { position: relative; flex: 1; min-height: 0; background: var(--ink); }
.sq-screen video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--ink); cursor: pointer; }
.sq-captions { position: absolute; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: .25em; text-align: center; line-height: 1.28; font-weight: 500; letter-spacing: 0; padding: 0 4%; }
.sq-cap span { display: inline; background: color-mix(in srgb, var(--ink) 74%, transparent); color: var(--surface); padding: .06em .32em; border-radius: .18em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

.sq-transport { flex: none; display: flex; align-items: center; gap: 2px; padding: 6px 10px; flex-wrap: wrap; }
.sq-ctrl { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 6px; border: 0; border-radius: var(--r-sm); background: transparent; color: color-mix(in srgb, var(--surface) 85%, transparent); font-size: 16px; line-height: 1; }
.sq-ctrl:hover { background: color-mix(in srgb, var(--surface) 12%, transparent); color: var(--surface); }
.sq-ctrl .icon { width: 17px; height: 17px; }
.sq-ctrl-big .icon { width: 21px; height: 21px; fill: currentColor; }
.sq-flip .icon { transform: scaleX(-1); }
.sq-when-playing, .sq-when-muted { display: none; }
.is-playing .sq-when-playing, .is-muted .sq-when-muted { display: block; }
.is-playing .sq-when-paused, .is-muted .sq-when-sound { display: none; }
.sq-tc { font-family: var(--mono); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; padding: 0 8px; white-space: nowrap; }
.sq-tc b { color: var(--mint-brand); font-weight: 500; }
.sq-tc span, .sq-tc small { color: color-mix(in srgb, var(--surface) 55%, transparent); }
.sq-tc small { font-family: var(--font); margin-left: 4px; }
.sq-rate { background: color-mix(in srgb, var(--surface) 12%, transparent); color: var(--surface); border: 0; border-radius: var(--r-xs); padding: 5px 6px; font-size: var(--fs-2xs); }
.sq-rate option { color: var(--ink); }
.sq-gap { flex: 1; }

/* ----------------------------------------------------------- panels ---- */
.sq-panel { min-height: 0; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-lg); overflow: hidden; }
.sq-panel-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px 8px; }
.sq-panel-head h2 { font-size: 15px; margin: 0; letter-spacing: -0.01em; flex: 1; min-width: 0; }
.sq-panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 14px 12px; overscroll-behavior: contain; }
.sq-empty { color: var(--muted); font-size: var(--fs-xs); text-align: center; padding: 18px 10px; margin: 0; }
.sq-empty h3 { font-size: var(--fs-sm); margin: 0 0 4px; }
.sq-empty p { margin: 0; }
.sq-linkbtn { border: 0; background: none; padding: 2px 4px; color: var(--muted); font-size: var(--fs-2xs); text-decoration: underline; text-underline-offset: 2px; }
.sq-linkbtn:hover { color: var(--ink); }
.sq-count { color: var(--muted); font-weight: 400; font-size: var(--fs-xs); margin-left: 4px; }
.sq-count b { color: var(--teal-ink); font-weight: 600; }

/* transcript */
.sq-transcript { grid-area: trans; }
.sq-lang { width: auto; max-width: 150px; }
.sq-tx-status { flex: none; padding: 0 14px 8px; display: grid; gap: 5px; }
.sq-tx-line { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-2xs); color: var(--text); font-variant-numeric: tabular-nums; }
.sq-tx-body { font-size: var(--fs-sm); line-height: 1.6; }
.sq-seg { margin: 0 0 8px; color: var(--text); }
.sq-seg-tc { font-family: var(--mono); font-size: 10px; color: var(--faint); margin-right: 8px; }
.sq-w { cursor: pointer; border-radius: 4px; padding: 0 1px; }
.sq-w:hover { background: var(--surface-2); }
.sq-w.is-now { background: var(--mint); color: var(--ink); }

/* inspector */
.sq-inspector { grid-area: insp; }
.sq-insp-nav { display: flex; gap: 2px; }
.sq-times { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.sq-times label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-2xs); color: var(--muted); }
.sq-tc-input { width: 112px; font-family: var(--mono); font-size: var(--fs-2xs); }
.sq-dur { font-size: var(--fs-2xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.sq-time-acts { display: inline-flex; gap: 2px; margin-left: auto; }
.sq-text-wrap { position: relative; display: flex; gap: 8px; }
.sq-text { flex: 1; min-height: 76px; font-size: var(--fs-sm); line-height: 1.45; resize: vertical; }
.sq-linecounts { display: flex; flex-direction: column; gap: 3px; padding-top: 10px; font-family: var(--mono); font-size: 10px; color: var(--faint); min-width: 26px; text-align: right; }
.sq-stats { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 6px; font-size: var(--fs-2xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.sq-stats .is-over, .sq-linecounts .is-over, .sq-dur.is-over { color: var(--danger); font-weight: 600; }

/* findings */
.sq-findings { grid-area: find; }
.sq-findings .check { font-size: var(--fs-2xs); color: var(--muted); white-space: nowrap; }
.sq-filters { margin: 0 12px 6px; flex: none; }
.sq-filters > button { font-size: var(--fs-2xs); padding: 4px 8px; }
.sq-filters b { font-weight: 600; color: var(--muted); margin-left: 2px; }
.sq-check-status { flex: none; padding: 0 14px; font-size: var(--fs-2xs); color: var(--muted); display: grid; gap: 2px; }
.sq-check-status:not(:empty) { padding-bottom: 6px; }
.sq-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 8px; overscroll-behavior: contain; }
.sq-f { position: relative; padding: 10px; border-radius: var(--r); cursor: pointer; transition: background .12s; outline: none; }
.sq-f + .sq-f::before { content: ''; position: absolute; left: 10px; right: 10px; top: 0; height: 1px; background: var(--hairline); }
.sq-f:hover, .sq-f.is-cue { background: var(--surface-2); }
.sq-f.is-active { background: var(--mint-soft); }
.sq-f:hover::before, .sq-f.is-active::before, .sq-f.is-cue::before, .sq-f:hover + .sq-f::before, .sq-f.is-active + .sq-f::before, .sq-f.is-cue + .sq-f::before { background: transparent; }
.sq-f:focus-visible { box-shadow: var(--ring); }
.sq-f.is-dismissed { opacity: .5; }
.sq-f-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.sq-f-top .pill { padding: 1px 8px; }
.sq-sev { font-size: 11px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.sq-sev::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.sq-sev-error::before { background: var(--danger); }
.sq-sev-warning::before { background: var(--warn); }
.sq-sev-info::before { background: var(--info); }
.sq-f-tc { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.sq-f-num { font-size: 11px; color: var(--teal-ink); font-weight: 600; }
.sq-f-msg { font-size: var(--fs-xs); line-height: 1.45; color: var(--ink); overflow-wrap: anywhere; }
.sq-f-sugg { font-size: var(--fs-2xs); line-height: 1.45; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.sq-f-acts { display: flex; gap: 6px; margin-top: 8px; }
.sq-f-acts .btn-sm { min-height: 28px; padding: 4px 12px; font-size: var(--fs-2xs); }

/* timeline */
.sq-tl { grid-area: tl; min-height: 0; display: flex; flex-direction: column; background: var(--ink); border-radius: var(--r-lg); overflow: hidden; color: var(--surface); }
.sq-tl-bar { flex: none; display: flex; align-items: center; gap: 4px; padding: 4px 10px; }
.sq-tl-hint { margin-left: auto; font-size: var(--fs-2xs); color: color-mix(in srgb, var(--surface) 50%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sq-chip { border: 0; border-radius: var(--pill); padding: 4px 12px; font-size: var(--fs-2xs); background: color-mix(in srgb, var(--surface) 10%, transparent); color: color-mix(in srgb, var(--surface) 85%, transparent); }
.sq-chip:hover { background: color-mix(in srgb, var(--surface) 18%, transparent); }
.sq-chip[aria-pressed="true"] { background: var(--teal); color: var(--ink); }
.sq-tl-canvas { position: relative; flex: 1; min-height: 0; outline: none; touch-action: none; }
.sq-tl-canvas:focus-visible { box-shadow: inset var(--ring); border-radius: 0; }
.sq-tl-canvas canvas { position: absolute; left: 0; top: 0; }

/* dialogs */
.sq-keys { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: var(--fs-xs); }
.sq-keys dt { margin: 0; }
.sq-keys dd { margin: 0; color: var(--text); }
kbd { font-family: var(--mono); font-size: 11px; background: var(--surface-2); color: var(--ink); padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.sq-presets { margin-bottom: 14px; }
.sq-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin-bottom: 12px; }
.sq-settings-grid .field { display: grid; gap: 4px; font-size: var(--fs-2xs); color: var(--muted); }

/* ------------------------------------------------------- responsive ---- */
@media (max-width: 1100px) {
  .sq-main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(200px, 1fr) minmax(140px, 24%) minmax(160px, 24%) clamp(200px, 30vh, 300px);
    grid-template-areas: "stage stage" "trans insp" "find find" "tl tl"; }
  .sq-files { display: none; }
}
@media (max-width: 720px) {
  .sq-app { height: auto; min-height: 100dvh; overflow: auto; }
  .sq-main { display: flex; flex-direction: column; }
  .sq-stage { min-height: 260px; }
  .sq-panel { max-height: 50vh; }
  .sq-tl { height: 300px; flex: none; }
  .sq-status, .sq-tl-hint { display: none; }
  .sq-settings-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Caption list (the SRT's own subtitles) */
.sq-cl-count { font-weight: 400; color: var(--muted); font-size: var(--fs-xs); margin-left: 4px; }
.sq-cl-list { list-style: none; margin: 0; padding: 0; }
.sq-cl-item { display: grid; grid-template-columns: 28px 1fr; gap: 0 8px; padding: 7px 8px; border-radius: var(--r-sm, 8px); cursor: pointer; font-size: var(--fs-sm); line-height: 1.4; }
.sq-cl-item:hover { background: var(--surface-2); }
.sq-cl-n { grid-row: span 2; font-family: var(--mono); font-size: 11px; color: var(--faint); padding-top: 2px; }
.sq-cl-tc { font-family: var(--mono); font-size: 10px; color: var(--faint); }
.sq-cl-text { color: var(--text); }
.sq-cl-item.is-now { background: var(--mint-soft); }
.sq-cl-item.is-sel { box-shadow: inset 3px 0 0 var(--teal); background: var(--surface-2); }
.sq-cl-item.is-flagged .sq-cl-n { color: var(--danger); font-weight: 600; }
/* Timeline tools */
.sq-tools { display: inline-flex; gap: 2px; margin-right: 6px; }
.sq-tools .sq-chip .icon { width: 13px; height: 13px; }
.sq-chip.is-on { background: var(--teal); color: var(--ink); }
.sq-transcript .sq-panel-head h2 { white-space: nowrap; margin-right: auto; }
.sq-transcript .sq-panel-head { flex-wrap: wrap; row-gap: 6px; }
.sq-qc-text { font-family: var(--mono); font-size: var(--fs-xs); line-height: 1.5; resize: vertical; }
.sq-findings .sq-filters { flex-wrap: wrap; row-gap: 4px; }
.sq-slot-wrap { position: relative; display: grid; }
.sq-slot-remove { position: absolute; top: 8px; right: 8px; background: var(--surface) !important; box-shadow: var(--shadow-sm, 0 1px 3px rgba(13, 22, 37, .15)); }
.sq-slot-remove:hover { background: var(--surface-2) !important; }
