/* Finalize ▸ Subtitles — the Subtitles screen (assets/view-subtitles.js).
   EVERY RULE IS SCOPED UNDER #view-subtitles, so nothing here can reach the
   audit surface or the shell (e2e/css_bleed_guard.cjs). Colours come from the
   app's own tokens (tms.css :root), so the screen follows the app's theme. */

#view-subtitles { min-height: 0; flex: 1; background: var(--panel, #f7f7f5); color: var(--ink, #222); }
#view-subtitles .sv-top { display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  background: var(--bg, #fff); border-bottom: 1px solid var(--line, #d8d8d8); flex-wrap: wrap; }
#view-subtitles .sv-title { font-weight: 700; }
#view-subtitles .sv-grow { flex: 1; }
#view-subtitles .sv-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
#view-subtitles .sv-empty { padding: 40px 20px; text-align: center; color: var(--mut, #666); }
#view-subtitles .sv-note { font-size: 12.5px; margin-top: 8px; min-height: 16px; }
#view-subtitles .small { font-size: 12px; }
#view-subtitles .sv-red { color: var(--red, #c0392b); font-weight: 600; }
#view-subtitles .sv-green { color: var(--green, #1e8e3e); font-weight: 600; }
#view-subtitles .sv-amber { color: var(--amber, #b26a00); font-weight: 600; }

/* ---- setup and progress ---- */
#view-subtitles .sv-setup { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px;
  padding: 18px; max-width: 1180px; width: 100%; box-sizing: border-box; margin: 0 auto; }
#view-subtitles .sv-card { background: var(--bg, #fff); border: 1px solid var(--line, #d8d8d8); border-radius: 8px; padding: 14px 16px; }
#view-subtitles .sv-card h4 { margin: 0 0 10px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--mut, #666); }
#view-subtitles .sv-drop { display: flex; gap: 12px; align-items: center; border: 2px dashed #b8c7dd; border-radius: 8px;
  padding: 14px; background: rgba(26, 95, 180, .05); cursor: pointer; }
#view-subtitles .sv-drop.over { border-color: var(--blue, #1a5fb4); background: rgba(26, 95, 180, .12); }
#view-subtitles .sv-drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
#view-subtitles .sv-drop:focus-within { outline: 2px solid var(--blue, #1a5fb4); outline-offset: 2px; }
#view-subtitles .sv-fileicon { width: 34px; height: 42px; border-radius: 4px; background: var(--blue, #1a5fb4); color: #fff;
  font: 700 10px/42px system-ui, sans-serif; text-align: center; flex: none; }
#view-subtitles .sv-kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 12px; font-size: 13px; margin-top: 12px; align-items: center; }
#view-subtitles .sv-kv > div:nth-child(odd) { color: var(--mut, #666); }
#view-subtitles .sv-kv input[type=number] { width: 70px; }
#view-subtitles .sv-meter { height: 8px; border-radius: 5px; background: var(--line, #e5e5e5); overflow: hidden; margin-top: 5px; }
#view-subtitles .sv-meter i { display: block; height: 100%; background: var(--green, #1e8e3e); }
#view-subtitles .sv-meter i.bad { background: var(--red, #c0392b); }
#view-subtitles .sv-alert { margin-top: 12px; padding: 9px 12px; border-radius: 6px; background: var(--red-bg, #fde8e8);
  color: var(--red, #c0392b); font-size: 13px; }
#view-subtitles .sv-chk { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; font-size: 13px; cursor: pointer; }
#view-subtitles .sv-chk input { margin-top: 3px; }
#view-subtitles .sv-actrow { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
#view-subtitles .sv-stage { font-size: 14px; margin: 8px 0 12px; }
#view-subtitles .sv-runs { display: flex; flex-direction: column; gap: 4px; }
#view-subtitles .sv-runrow { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px;
  border: 1px solid var(--line, #d8d8d8); border-radius: 6px; background: var(--bg, #fff); padding: 6px 10px; font: inherit; cursor: pointer; }
#view-subtitles .sv-runrow:hover { border-color: var(--blue, #1a5fb4); }
#view-subtitles .sv-runrow span { font-size: 12px; }

/* ---- document ---- */
#view-subtitles .sv-doc { display: flex; flex-direction: column; flex: 1; min-height: 0; }
#view-subtitles .sv-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 12px;
  background: var(--bg, #fff); border-bottom: 1px solid var(--line, #d8d8d8); font-size: 12.5px; }
#view-subtitles .sv-tools input[type=number] { width: 70px; }
#view-subtitles .sv-inline { display: inline-flex; gap: 5px; align-items: center; }
#view-subtitles .sv-seg { display: inline-flex; border: 1px solid var(--line, #c9c9c3); border-radius: 6px; overflow: hidden; }
#view-subtitles .sv-seg button { border: 0; background: var(--bg, #fff); padding: 4px 10px; font: 600 12px/1.3 system-ui, sans-serif; cursor: pointer; color: inherit; }
#view-subtitles .sv-seg button.on { background: var(--blue, #1a5fb4); color: #fff; }
#view-subtitles .sv-counts { display: flex; gap: 6px; flex-wrap: wrap; }
#view-subtitles .cnt { font: 600 11.5px/1 system-ui, sans-serif; padding: 4px 8px; border-radius: 999px; }
#view-subtitles .cnt.b { background: var(--red-bg, #fde8e8); color: var(--red, #c0392b); }
#view-subtitles .cnt.w { background: var(--amber-bg, #fdf3e0); color: var(--amber, #8a5a12); }
#view-subtitles .cnt.i { background: rgba(26, 95, 180, .1); color: var(--blue, #1a5fb4); }
#view-subtitles .cnt.o, #view-subtitles .cnt.a { background: var(--green-bg, #e6f6e6); color: var(--green, #1e8e3e); }
#view-subtitles .sv-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; flex: 1; min-height: 0; }
#view-subtitles .sv-grid { overflow: auto; border-right: 1px solid var(--line, #d8d8d8); background: var(--bg, #fff); }
#view-subtitles .sv-ghead, #view-subtitles .sv-row { display: grid; grid-template-columns: 112px minmax(0, 1fr) minmax(0, 1fr) 34px; }
#view-subtitles .sv-ghead { position: sticky; top: 0; z-index: 1; background: #f0f0ec; border-bottom: 1px solid var(--line, #d8d8d8);
  font: 700 11px/1 system-ui, sans-serif; letter-spacing: .07em; text-transform: uppercase; color: var(--mut, #666); }
#view-subtitles .sv-ghead > div { padding: 9px 10px; }
#view-subtitles .sv-row { border-bottom: 1px solid #ecece7; cursor: pointer; }
#view-subtitles .sv-row > div { padding: 8px 10px; min-width: 0; overflow-wrap: anywhere; }
#view-subtitles .sv-row.sel { background: #eef4fc; box-shadow: inset 3px 0 0 var(--blue, #1a5fb4); }
#view-subtitles .sv-gap { padding: 3px 10px; font-size: 11.5px; color: var(--mut, #888); background: #fafaf7; border-bottom: 1px solid #ecece7; }
#view-subtitles .tc { font: 11.5px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #777; border-right: 1px solid #eee; }
#view-subtitles .tc b { display: block; color: var(--ink, #222); font-weight: 600; }
#view-subtitles .cps { display: inline-block; margin-top: 3px; font: 600 10px/1 system-ui, sans-serif; padding: 2px 5px; border-radius: 3px; background: #eee; color: #555; }
#view-subtitles .cps.hot { background: var(--red-bg, #fde8e8); color: var(--red, #c0392b); }
#view-subtitles .en { color: #333; border-right: 1px solid #eee; }
#view-subtitles .flag { display: grid; place-items: start center; }
#view-subtitles .fl { display: inline-block; width: 18px; height: 18px; border-radius: 4px; font: 700 10px/18px system-ui, sans-serif; text-align: center; color: #fff; flex: none; }
#view-subtitles .fl.b { background: var(--red, #c0392b); }
#view-subtitles .fl.w { background: var(--amber, #b7791f); }
#view-subtitles .fl.i { background: var(--blue, #1a5fb4); }
#view-subtitles .w { border-radius: 2px; }
#view-subtitles .shade .w.sa { background: #eef3fb; }
#view-subtitles .shade .w.sb { background: #f4f0fb; }
#view-subtitles .w.x { text-decoration: line-through; text-decoration-color: var(--red, #c0392b); color: #9a3a30; background: var(--red-bg, #fde8e8); }
#view-subtitles .w.fix { background: var(--green-bg, #e6f6e6); color: var(--green, #1e6e2e); }
#view-subtitles .w.mk-add { background: var(--red-bg, #fde8e8); box-shadow: inset 0 -2px 0 var(--red, #c0392b); }
#view-subtitles .w.mk-typo { background: #fff1c9; box-shadow: inset 0 -2px 0 #d8a31a; }
#view-subtitles .sv-ins { background: #eaf6ee; font-style: italic; }
#view-subtitles .sv-eng { font-style: italic; color: #555; }
#view-subtitles .sv-tag { font: 600 10px/1 system-ui, sans-serif; padding: 2px 5px; border-radius: 3px; background: #eee; color: #555; }
#view-subtitles .sv-bmark { display: inline-block; width: 2px; height: 16px; background: var(--blue, #1a5fb4); vertical-align: -3px; margin: 0 2px; position: relative; }
#view-subtitles .sv-bmark::after { content: ""; position: absolute; left: -4px; top: -5px; width: 10px; height: 6px; background: var(--blue, #1a5fb4); border-radius: 2px; }

/* ---- side: issues and inspector ---- */
#view-subtitles .sv-side { display: flex; flex-direction: column; min-height: 0; background: #fbfbf9; }
#view-subtitles .sv-sh { display: flex; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line, #e3e3de); font-weight: 700; font-size: 12.5px; }
#view-subtitles .sv-ilist { max-height: 38%; overflow: auto; padding: 6px 8px; border-bottom: 1px solid var(--line, #e3e3de); flex: none; }
#view-subtitles .sv-it { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: center; width: 100%; text-align: left;
  padding: 6px; border: 0; border-radius: 6px; background: transparent; font: 12.3px/1.35 system-ui, sans-serif; color: inherit; cursor: pointer; }
#view-subtitles .sv-it:hover { background: #f1f4f9; }
#view-subtitles .sv-it.on { background: #eef4fc; }
#view-subtitles .sv-it.done { opacity: .6; }
#view-subtitles .sv-it small { color: #777; }
#view-subtitles .pill { font: 600 10.5px/1 system-ui, sans-serif; padding: 3px 7px; border-radius: 999px; white-space: nowrap; }
#view-subtitles .pill.b { background: var(--red-bg, #fde8e8); color: var(--red, #c0392b); }
#view-subtitles .pill.w { background: var(--amber-bg, #fdf3e0); color: var(--amber, #8a5a12); }
#view-subtitles .pill.i { background: rgba(26, 95, 180, .1); color: var(--blue, #1a5fb4); }
#view-subtitles .pill.o, #view-subtitles .pill.a { background: var(--green-bg, #e6f6e6); color: var(--green, #1e8e3e); }
#view-subtitles .sv-insp { padding: 12px; font-size: 12.8px; overflow: auto; flex: 1; }
#view-subtitles .sv-insp h5 { margin: 0 0 6px; font-size: 13px; }
#view-subtitles .why { color: #555; margin-bottom: 10px; }
#view-subtitles .cmp { border: 1px solid var(--line, #e3e3de); border-radius: 6px; background: var(--bg, #fff); padding: 8px 10px; margin-bottom: 8px; }
#view-subtitles .cmp input[type=text] { width: 100%; box-sizing: border-box; }
#view-subtitles .lab { font: 700 10px/1 system-ui, sans-serif; letter-spacing: .07em; text-transform: uppercase; color: #888; margin-bottom: 4px; }
#view-subtitles .x { text-decoration: line-through; text-decoration-color: var(--red, #c0392b); color: #9a3a30; }
#view-subtitles .cuelab { font: 600 10.5px/1.4 ui-monospace, Menlo, monospace; color: #777; margin: 6px 0 3px; }
#view-subtitles .sv-chips { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; margin: 6px 0; padding: 6px; border-radius: 6px; outline: none; }
#view-subtitles .sv-chips:focus { box-shadow: 0 0 0 2px var(--blue, #1a5fb4); }
#view-subtitles .chip { background: var(--bg, #fff); border: 1px solid var(--line, #e0e0da); border-radius: 4px; padding: 1px 5px; font: 12px/1.6 inherit; cursor: pointer; color: inherit; }
#view-subtitles .chip:hover { border-color: var(--blue, #1a5fb4); }
#view-subtitles .acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
#view-subtitles .sv-nav { border-top: 1px solid var(--line, #eee); padding-top: 10px; }
#view-subtitles .sv-done { margin-top: 10px; padding: 8px 10px; border-radius: 6px; background: var(--green-bg, #e6f6e6); font-size: 12.5px; }
#view-subtitles .sv-radios { margin: 6px 0; }
#view-subtitles .sv-radio { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; margin: 5px 0; cursor: pointer; }
#view-subtitles .sv-radio input { margin-top: 2px; }
#view-subtitles input[type=search] { width: 100%; box-sizing: border-box; margin-bottom: 6px; }
#view-subtitles .sv-results { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow: auto; }
#view-subtitles .sv-opt { text-align: left; border: 1px solid var(--line, #e3e3de); border-radius: 6px; background: var(--bg, #fff);
  padding: 6px 8px; font: 12px/1.4 system-ui, sans-serif; cursor: pointer; color: inherit; }
#view-subtitles .sv-opt:hover { border-color: var(--blue, #1a5fb4); }
#view-subtitles .sv-opt small { display: block; color: #777; }
#view-subtitles .sv-dialog { max-width: 560px; }

@media (max-width: 900px) {
  #view-subtitles .sv-main { grid-template-columns: 1fr; }
  #view-subtitles .sv-side { border-top: 1px solid var(--line, #d8d8d8); max-height: 50vh; }
}
