/* Asset Manager: dark, neutral, calm. Colour is used only for state. */
:root {
  color-scheme: dark;
  --bg: #141518;
  --panel: #1a1b1f;
  --panel2: #212227;
  --panel3: #292b31;
  --line: #2f3137;
  --line2: #3b3e46;
  --text: #d3d5da;
  --text-hi: #eceef1;
  --muted: #8a8d95;
  --focus: #b9bfcc;
  --sel: #2b2e36;
  --ok: #72b085;
  --warn: #d4a650;
  --bad: #d4706a;
  --info: #86a6cf;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --topbar-h: 52px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 13.5px/1.4 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 600; color: var(--text-hi); }
h2 { font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
h3 { font-size: 12px; margin: 14px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--bad); min-height: 1.2em; margin: 6px 0 0; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
a { color: inherit; }

/* ---------- controls ---------- */
button, input, select { font: inherit; color: inherit; }
.btn {
  background: var(--panel2); border: 1px solid var(--line2); border-radius: 6px;
  padding: 6px 11px; cursor: pointer; color: var(--text); line-height: 1.2;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--panel3); border-color: #4a4e58; }
.btn:active { background: #31333a; }
.btn[aria-pressed="true"] { background: #3a3d46; border-color: #5a5f6c; color: var(--text-hi); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: #3b3f49; border-color: #5a5f6c; color: var(--text-hi); }
.btn.icon { padding: 0; width: 34px; height: 32px; display: inline-flex; align-items: center; justify-content: center; }
.btn.icon.big { width: 44px; }
.btn.icon svg { width: 18px; height: 18px; fill: currentColor; stroke: currentColor; }
.btn.small-btn { padding: 4px 9px; font-size: 12px; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 11px; padding: 0 0 0 6px; }
.link-btn:hover { color: var(--text); }
input[type=text], input[type=search], input[type=password], input[type=date], select, textarea {
  background: #101114; border: 1px solid var(--line2); border-radius: 6px; padding: 6px 9px; min-width: 0;
}
input[type=date] { color-scheme: dark; }
input::placeholder, textarea::placeholder { color: #666a73; }
textarea { font: inherit; color: inherit; resize: vertical; width: 100%; }
select { padding-right: 4px; }
input[type=range] { accent-color: #9aa0ad; height: 18px; }
.chk { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; user-select: none; }
.seg { display: inline-flex; }
.seg .seg-btn { border-radius: 0; }
.seg .seg-btn:first-child { border-radius: 6px 0 0 6px; }
.seg .seg-btn:last-child { border-radius: 0 6px 6px 0; margin-left: -1px; }

/* ---------- login ---------- */
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 26px; display: flex; flex-direction: column; gap: 8px; }
.login-card h1 { font-size: 20px; }
.login-card p { margin: 0 0 6px; }
.login-card label { font-size: 12px; color: var(--muted); margin-top: 6px; }
.login-card input { width: 100%; padding: 9px 10px; }
.login-card .btn { margin-top: 10px; padding: 9px; }

/* ---------- shell ---------- */
#app { height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: 12px; padding: 0 14px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 600; color: var(--text-hi); letter-spacing: .02em; white-space: nowrap; }
.search { flex: 1 1 260px; max-width: 520px; }
.search input { width: 100%; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.btn.nav-toggle { display: none; width: auto; padding: 0 10px; }
.layout { flex: 1; display: flex; min-height: 0; }
.clients {
  width: 248px; flex: none; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line);
  padding: 10px 8px;
}
.clients h2 { padding: 4px 8px 8px; }
.client-row { display: flex; align-items: center; border-radius: 6px; position: relative; }
.client-row:hover { background: var(--panel2); }
.client-row.active { background: var(--sel); box-shadow: inset 3px 0 0 #8f96a3; }
.client-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 8px 8px 8px 12px; cursor: pointer; text-align: left; border-radius: 6px; }
.client-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.client-new { font-size: 10.5px; color: var(--info); border: 1px solid #3d5575; border-radius: 9px; padding: 0 6px; }
.client-edit { opacity: 0; background: none; border: 0; color: var(--muted); cursor: pointer; width: 26px; height: 26px; border-radius: 5px; margin-right: 4px; }
.client-row:hover .client-edit, .client-edit:focus-visible, .client-row.editing .client-edit { opacity: 1; }
.client-edit:hover { color: var(--text-hi); background: var(--panel3); }
.client-edit svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.client-rename { flex: 1; margin: 3px 6px 3px 8px; min-width: 0; }
.client-sep { border-top: 1px solid var(--line); margin: 8px 6px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.filters { flex: none; padding: 10px 14px 6px; border-bottom: 1px solid var(--line); background: var(--bg); }
.filter-row { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; }
.fld { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); }
.fld.grow { flex: 1; min-width: 140px; max-width: 360px; }
.fld.inline { flex-direction: row; }
.fld > span:not(.sr-only) { padding-left: 2px; }
.fld-add { display: flex; gap: 8px; align-items: flex-end; flex: 0 1 auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0 2px; min-height: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 12px; padding: 2px 4px 2px 10px; font-size: 12px; max-width: 100%; }
.chip .chip-k { color: var(--muted); }
.chip button { background: none; border: 0; color: var(--muted); cursor: pointer; width: 20px; height: 20px; border-radius: 10px; font-size: 14px; line-height: 1; }
.chip button:hover { background: var(--panel3); color: var(--text-hi); }
.chip-clear { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 12px; }
.result-bar { flex: none; padding: 8px 14px 4px; }
.results { flex: 1; overflow: auto; padding: 0 14px 20px; outline: none; }
.list-msg { padding: 28px 8px; text-align: center; color: var(--muted); }
.more { text-align: center; padding: 14px; }

/* ---------- list table ---------- */
table.assets { width: 100%; border-collapse: collapse; }
.assets th {
  position: sticky; top: 0; background: var(--bg); z-index: 2; text-align: left; font-weight: 500; font-size: 11.5px;
  color: var(--muted); padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.assets th button { background: none; border: 0; padding: 0; cursor: pointer; color: inherit; font: inherit; }
.assets th button:hover { color: var(--text-hi); }
.assets th .arrow { margin-left: 4px; font-size: 10px; }
.assets td { padding: 7px 8px; border-bottom: 1px solid #202227; vertical-align: middle; }
.assets tbody tr { cursor: default; }
.assets tbody tr:hover { background: #1b1c20; }
.assets tbody tr.sel { background: var(--sel); box-shadow: inset 3px 0 0 #8f96a3; }
.assets tbody tr.missing td { opacity: .55; }
.assets td.fmt, .assets td.date { white-space: nowrap; }
.assets .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.assets .mono { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.name-cell { min-width: 180px; max-width: 360px; }
.name-link { color: var(--text-hi); text-decoration: none; font-weight: 500; overflow-wrap: anywhere; }
.name-link:hover { text-decoration: underline; }
.src { color: var(--muted); font-size: 11.5px; overflow-wrap: anywhere; }
.new-badge { display: inline-block; font-size: 10px; letter-spacing: .05em; text-transform: uppercase; color: var(--info); border: 1px solid #3d5575; border-radius: 3px; padding: 0 4px; margin-left: 6px; vertical-align: 1px; }
.pill { display: inline-block; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; font-size: 11.5px; margin: 1px 3px 1px 0; color: #b4b7bf; }
.badge { display: inline-block; font-size: 11px; border-radius: 4px; padding: 1px 6px; border: 1px solid var(--line2); color: var(--muted); }
.badge.bad { color: var(--bad); border-color: #6b3a37; }
.df-tag { color: var(--warn); font-size: 10.5px; margin-left: 4px; }

/* ---------- grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; padding-top: 8px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; cursor: default; }
.card:hover { border-color: var(--line2); }
.card.sel { border-color: #8f96a3; background: var(--sel); }
.card.missing { opacity: .6; }
.card .poster { position: relative; aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; color: #8d909a; font-family: var(--mono); font-size: 12px; }
.card .dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.6); border-radius: 3px; padding: 0 5px; color: #dfe1e5; }
.card .res { position: absolute; left: 6px; top: 6px; background: rgba(0,0,0,.45); border-radius: 3px; padding: 0 5px; color: #c5c8ce; }
.card .new-badge { position: absolute; right: 6px; top: 6px; margin: 0; background: rgba(0,0,0,.6); }
.card .cbody { padding: 8px 10px 10px; }
.card .cmeta { color: var(--muted); font-size: 11.5px; margin: 2px 0 4px; }

/* ---------- detail ---------- */
.detail { position: fixed; inset: var(--topbar-h) 0 0 0; background: var(--bg); z-index: 20; display: flex; flex-direction: column; }
.detail-bar { flex: none; display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--panel); }
.dtitle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-bar-right { display: flex; gap: 6px; }
.detail-body { flex: 1; overflow: auto; display: grid; grid-template-columns: minmax(0, 1fr) clamp(360px, 32vw, 480px); gap: 14px; padding: 14px; align-items: start; }
.left-col { min-width: 0; }
.player { background: #0d0e10; border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.stage-wrap { position: relative; height: clamp(210px, calc(100vh - 380px - var(--tl-h, 0px)), 640px); display: flex; align-items: center; justify-content: center; background: #000; border-radius: 4px; overflow: hidden; }
.stage { position: relative; width: 100%; height: 100%; background: #000; }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: #000; }
.ov-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.guides { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.guides * { vector-effect: non-scaling-stroke; }
.vid-msg { position: absolute; left: 10px; bottom: 10px; right: 10px; color: #c3c6cc; background: rgba(0,0,0,.65); border-radius: 4px; padding: 4px 8px; font-size: 12px; pointer-events: none; }
.vid-msg:empty { display: none; }
.vid-msg.bad { color: var(--bad); }
.false-legend { display: flex; height: 14px; border-radius: 3px; overflow: hidden; font-size: 10px; font-family: var(--mono); }
.false-legend span { flex: 1; text-align: center; color: #000; line-height: 14px; mix-blend-mode: normal; }

.tcbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 2px 2px 0; }
.tc-big { font-family: var(--mono); font-size: 38px; line-height: 1.05; letter-spacing: .02em; color: var(--text-hi); font-variant-numeric: tabular-nums; }
.tc-sub { font-size: 11.5px; font-family: var(--mono); }
.tc-marks { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mark-chip { font-family: var(--mono); font-size: 12px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 4px; padding: 3px 7px; color: var(--text); cursor: pointer; }
.mark-chip.static { cursor: default; }
.mark-chip.set { color: var(--text-hi); border-color: #6b7080; }
.shuttle-ind { font-family: var(--mono); font-size: 12px; color: var(--warn); min-width: 5em; }

.scrub { position: relative; height: 26px; cursor: pointer; touch-action: none; border-radius: 4px; }
.scrub-track { position: absolute; left: 0; right: 0; top: 9px; height: 8px; background: #22242a; border-radius: 4px; }
.scrub-buf { position: absolute; left: 0; top: 0; bottom: 0; background: #33363e; border-radius: 4px; width: 0; }
.scrub-played { position: absolute; left: 0; top: 0; bottom: 0; background: #8f96a3; border-radius: 4px 0 0 4px; width: 0; }
.scrub-range { position: absolute; top: -4px; bottom: -4px; background: rgba(212,166,80,.28); border-left: 2px solid var(--warn); border-right: 2px solid var(--warn); border-radius: 2px; }
.scrub-mark { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--warn); }
.scrub-thumb { position: absolute; top: -4px; width: 4px; height: 16px; margin-left: -2px; background: var(--text-hi); border-radius: 2px; }
.scrub-tip { position: absolute; bottom: 28px; transform: translateX(-50%); background: #000; border: 1px solid var(--line2); border-radius: 4px; padding: 1px 6px; font-family: var(--mono); font-size: 12px; pointer-events: none; white-space: nowrap; z-index: 3; }

.controls { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.cgroup { display: flex; gap: 5px; align-items: center; }
.cgroup.right { margin-left: auto; }
#cVol { width: 90px; }
.monitor-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 12.5px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.monitor-row .sep { width: 1px; height: 18px; background: var(--line2); }
#oZebraTh { width: 90px; }
.player:fullscreen { background: #000; border: 0; border-radius: 0; padding: 10px; }
.player:fullscreen .stage-wrap { flex: 1; height: auto; }

.edit-panel { margin-top: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.edit-panel h2 { margin-bottom: 10px; }
.edit-panel h2:not(:first-child) { margin-top: 18px; }
.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.edit-block { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.edit-block.wide { grid-column: 1 / -1; }
.edit-block label, .lbl { font-size: 11.5px; color: var(--muted); }
.edit-block input[type=text] { width: 100%; }
.row-head { display: flex; align-items: center; justify-content: space-between; }
.tag-edit { display: flex; flex-wrap: wrap; gap: 5px; background: #101114; border: 1px solid var(--line2); border-radius: 6px; padding: 4px 6px; align-items: center; }
.tag-edit:focus-within { border-color: var(--focus); }
.tag-chips { display: contents; }
.tag-edit input { flex: 1; min-width: 120px; border: 0; background: transparent; padding: 3px 2px; outline: none; }
.meta-rows { display: flex; flex-direction: column; gap: 6px; }
.meta-row { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(120px, 2fr) 30px; gap: 6px; }
.meta-row input { width: 100%; }
.meta-row .btn { padding: 0; }
.save-state { min-height: 1.3em; margin: 8px 0 0; }
.save-state.bad { color: var(--bad); }
.save-state.ok { color: var(--ok); }
.info { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; font-size: 12.5px; }
.info dt { color: var(--muted); }
.info dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

/* ---------- scopes ---------- */
.scopes { display: flex; flex-direction: column; gap: 10px; }
.scopes[hidden] { display: none; }
.scopes-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.scope-box { background: #0b0c0e; border: 1px solid var(--line); border-radius: 6px; padding: 5px; }
.scope-title { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.scope-box canvas { width: 100%; display: block; }
#cvWave { aspect-ratio: 2 / 1; }
#cvParade { aspect-ratio: 3 / 1; }
#cvVec { aspect-ratio: 1 / 1; }
#cvHist { aspect-ratio: 384 / 320; }
#cvMeter { aspect-ratio: 520 / 116; }
.scope-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog { background: var(--panel); border: 1px solid var(--line2); border-radius: 10px; padding: 18px 22px; width: min(780px, 100%); max-height: 90vh; overflow: auto; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
.dialog-head h2 { font-size: 16px; text-transform: none; letter-spacing: 0; color: var(--text-hi); }
.help-cols { display: grid; grid-template-columns: 1fr 1.3fr; gap: 24px; }
.keys { display: grid; grid-template-columns: max-content 1fr; gap: 5px 14px; margin: 0; }
.keys dt { align-self: start; font-family: var(--mono); font-size: 12px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 4px; padding: 0 6px; justify-self: start; }
.keys dd { margin: 0; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #25272d; border: 1px solid var(--line2); border-radius: 6px; padding: 8px 14px; z-index: 60; max-width: 90vw; }
.toast:empty { display: none; }
.toast.bad { border-color: #6b3a37; color: #e8b9b5; }
.toast-act { margin-left: 14px; background: none; border: 0; color: var(--info); text-decoration: underline; cursor: pointer; padding: 0 2px; }
.toast-act:hover { color: #b7cdea; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .detail-body { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  #sideMarkers .mk-table-wrap { flex: none; max-height: 420px; }
  .side-panel.scopes { overflow: visible; }
  .scope-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1000px) {
  .btn.nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .clients { position: fixed; top: var(--topbar-h); bottom: 0; left: 0; z-index: 15; transform: translateX(-102%); transition: transform .15s; box-shadow: 4px 0 18px rgba(0,0,0,.4); }
  .clients.open { transform: none; }
  #refreshInfo, .brand { display: none; }
  .edit-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .col-hide-sm { display: none; }
  .help-cols { grid-template-columns: 1fr; }
  .topbar { gap: 8px; padding: 0 8px; }
}
@media (max-width: 1180px) { .col-hide-md { display: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
.scope-off { display: none; margin: 0; }
.scopes.off .scope-box { display: none; }
.scopes.off .scope-off { display: block; }

/* =====================================================================
 * v2: timeline, markers, import
 * ===================================================================== */
.audio-host { display: none; }
.card .poster.has-img { background: #000 !important; }
.poster-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.grow { flex: 1; }
.btn.danger { background: #4a2a28; border-color: #7a3f3b; color: #f0c4c0; }
.btn.danger:hover { background: #5a3331; }
.btn.icon.sm { width: 26px; height: 26px; }
.btn.icon.sm svg { width: 14px; height: 14px; }

/* ---------- timeline ---------- */
.timeline { --tl-head: 140px; --tl-gut: 0px; position: relative; border-top: 1px solid var(--line); padding-top: 8px; }
.tl-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px 14px; flex-wrap: wrap; margin-bottom: 6px; }
.tl-bar-l, .tl-bar-r { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tl-bar h2 { font-size: 12px; }
.tl-state { color: var(--muted); }
.tl-state.busy { color: var(--info); }
.tl-state.busy::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: currentColor; animation: tlpulse 1.1s ease-in-out infinite; }
.tl-note { display: flex; align-items: center; gap: 12px; margin: 0 0 6px; padding: 6px 10px; background: #2a1d1c; border: 1px solid #5d3431; border-radius: 6px; color: #e8b9b5; font-size: 12.5px; }
.tl-note span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
@keyframes tlpulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.tl-zoominfo { min-width: 78px; }
.tl-zoom { min-width: 32px; font-size: 15px; line-height: 1; }
.tl-stack { position: relative; border: 1px solid var(--line); border-radius: 6px; background: #121316; overflow: hidden; }
.tl-top { padding-right: var(--tl-gut); }
.tl-row { display: flex; align-items: stretch; }
.tl-head {
  flex: none; width: var(--tl-head); display: flex; align-items: center; gap: 8px; padding: 0 8px; background: var(--panel);
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; min-width: 0;
}
.tl-lane { position: relative; flex: 1; min-width: 0; overflow: hidden; touch-action: none; user-select: none; cursor: ew-resize; }
.tl-lane canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tl-ruler-row .tl-lane { height: 26px; }
.tl-mk-row .tl-lane { height: 26px; cursor: default; }
.tl-video-row .tl-lane { height: 44px; }
.tl-audio { overflow-y: auto; overflow-x: hidden; max-height: 236px; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: #3b3e46 transparent; }
.tl-audio .tl-lane { height: 58px; }
.tl-audio.d4 .tl-lane { height: 46px; }
.tl-audio.d6 .tl-lane { height: 40px; }
.tl-audio .tl-noaudio .tl-lane { height: 34px; }
.tl-audio .tl-mixrow .tl-lane { height: 46px; }
@media (max-height: 780px) {
  .stage-wrap { height: clamp(170px, calc(100vh - 380px - var(--tl-h, 0px)), 640px); }
  .tc-big { font-size: 30px; }
  .tl-video-row .tl-lane { height: 36px; }
  .tl-audio { max-height: min(236px, 34vh); }
  .tl-audio .tl-lane { height: 50px; }
  .tl-audio.d4 .tl-lane { height: 42px; }
  .tl-audio.d6 .tl-lane { height: 36px; }
}
.tl-alabel { color: var(--text); text-transform: none; letter-spacing: 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tl-alabel.muted { color: var(--muted); }
.tl-spk {
  flex: none; width: 30px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--panel2); border: 1px solid var(--line2); border-radius: 6px; color: var(--text);
}
.tl-spk:hover { background: var(--panel3); border-color: #4a4e58; }
.tl-spk svg { width: 17px; height: 17px; fill: currentColor; stroke: currentColor; }
.tl-spk[aria-pressed="true"] { background: #3d2624; border-color: #7a3f3b; color: #ec9f98; }
.tl-arow.muted .tl-lane, .tl-mixrow.muted .tl-lane { opacity: .5; }
.tl-arow.muted .tl-alabel, .tl-mixrow.muted .tl-alabel { text-decoration: line-through; color: var(--muted); }
.tl-overlay { position: absolute; top: 0; bottom: 0; left: var(--tl-head); right: var(--tl-gut); overflow: hidden; pointer-events: none; z-index: 4; }
.tl-ph { position: absolute; left: 0; top: 0; bottom: 0; width: 0; will-change: transform; }
.tl-ph::before { content: ""; position: absolute; left: -1px; top: 0; bottom: 0; width: 2px; background: #ff6a58; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.tl-ph-handle { position: absolute; left: -7px; top: 0; width: 14px; height: 12px; background: #ff6a58; clip-path: polygon(0 0, 100% 0, 100% 45%, 50% 100%, 0 45%); pointer-events: auto; cursor: ew-resize; }
.tl-hover { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-left: 1px dashed rgba(255,255,255,.32); }
.tl-hover-tip { position: absolute; top: 14px; left: 5px; font: 10.5px var(--mono); background: #000; border: 1px solid var(--line2); border-radius: 3px; padding: 0 5px; white-space: nowrap; color: var(--text-hi); }
.tl-hover-tip.left { left: auto; right: 5px; }
.tl-card { position: absolute; z-index: 6; max-width: 320px; min-width: 150px; background: #0d0e10; border: 1px solid var(--line2); border-radius: 6px; padding: 7px 10px; box-shadow: 0 6px 20px rgba(0,0,0,.5); pointer-events: none; font-size: 12px; }
.tl-card-h { display: flex; align-items: center; gap: 7px; margin-bottom: 2px; color: var(--text-hi); }
.tl-card-n { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.tl-card-hint { margin-top: 5px; opacity: .8; font-size: 11px; }
.tl-hs-row { display: flex; margin-top: 5px; padding-right: var(--tl-gut); }
.tl-hs-row .tl-head { background: none; border: 0; }
.tl-hs { position: relative; flex: 1; height: 12px; background: #1a1b1f; border-radius: 6px; outline-offset: 1px; }
.tl-hs.off { visibility: hidden; }
.tl-hs-thumb { position: absolute; left: 0; top: 2px; height: 8px; min-width: 28px; background: #4a4e58; border-radius: 4px; cursor: grab; touch-action: none; }
.tl-hs-thumb:hover { background: #666b78; }
.mk-dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--mk, #e5c14a); box-shadow: 0 0 0 1px rgba(0,0,0,.4); vertical-align: -1px; }

/* marker editor popover */
.mk-editor { position: absolute; z-index: 30; width: 320px; max-width: calc(100% - 12px); display: flex; flex-direction: column; gap: 8px; background: var(--panel); border: 1px solid var(--line2); border-radius: 8px; padding: 10px 12px; box-shadow: 0 12px 34px rgba(0,0,0,.6); }
.mk-ed-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; color: var(--text-hi); }
.mk-editor .fld input, .mk-editor .fld textarea { width: 100%; }
.mk-cols { display: flex; gap: 7px; flex-wrap: wrap; padding: 2px; }
.mk-sw { width: 24px; height: 24px; border-radius: 50%; padding: 0; background: var(--mk); border: 2px solid transparent; cursor: pointer; box-shadow: 0 0 0 1px rgba(0,0,0,.5); }
.mk-sw.on { border-color: #fff; box-shadow: 0 0 0 2px #000; }
.mk-ed-actions { display: flex; gap: 8px; align-items: center; }
.mk-ed-actions .muted { margin-left: auto; }

/* ---------- tabs ---------- */
.tabs { margin-top: 14px; }
.tabbar { display: flex; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; padding: 4px 6px 0; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 14px; color: var(--muted); cursor: pointer; font-weight: 500; border-radius: 6px 6px 0 0; }
.tab:hover { color: var(--text); background: var(--panel2); }
.tab[aria-selected="true"] { color: var(--text-hi); border-bottom-color: #9aa1af; }
.tab-badge { display: inline-block; min-width: 20px; text-align: center; background: var(--panel3); border-radius: 10px; padding: 0 6px; font-size: 11px; margin-left: 4px; color: var(--text); }
.tab-badge.zero { color: var(--muted); background: var(--panel2); }
.tabs .edit-panel { margin-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; border-top-color: var(--line); }
.tabs .edit-panel > h2:first-child { display: none; }

/* ---------- markers tab ---------- */
.mk-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.mk-confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: #2a1d1c; border: 1px solid #6b3a37; border-radius: 6px; padding: 6px 8px; margin-bottom: 8px; font-size: 12.5px; }
.mk-empty { margin: 14px 2px; }
.mk-table-wrap { overflow: auto; min-height: 0; }
.mk-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mk-table th { position: sticky; top: 0; z-index: 1; background: var(--panel); text-align: left; font-weight: 500; color: var(--muted); font-size: 11.5px; padding: 5px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.mk-table td { padding: 4px 8px; border-bottom: 1px solid #202227; vertical-align: middle; }
.mk-row { cursor: pointer; }
.mk-row:hover { background: #1b1c20; }
.mk-row.sel { background: var(--sel); box-shadow: inset 3px 0 0 #8f96a3; }
.mk-row.pending { opacity: .6; }
.mk-row.editing { cursor: default; background: #1f2026; }
.mk-table .c-dot { width: 22px; padding-right: 0; }
.mk-table .c-tc { white-space: nowrap; }
.mk-table .c-main { min-width: 0; }
.mk-table .c-name { overflow-wrap: anywhere; color: var(--text-hi); }
.mk-table .c-note { color: var(--muted); font-size: 11.5px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mk-table .c-list { display: inline-block; margin-top: 2px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10.5px; color: var(--muted); border: 1px solid var(--line2); border-radius: 8px; padding: 0 6px; }
.mk-table .c-act { text-align: right; white-space: nowrap; width: 62px; }
.mk-row .c-act .btn { opacity: 0; }
.mk-row .c-act .btn + .btn { margin-left: 2px; }
.mk-row:hover .c-act .btn, .mk-row:focus-within .c-act .btn, .mk-row.sel .c-act .btn { opacity: 1; }
.mk-row.editing td input, .mk-row.editing td select { width: 100%; }
.mk-row.editing .c-main { display: flex; flex-direction: column; gap: 5px; }
.mk-row.editing .c-tc { width: 118px; }
.mk-row.editing .c-act { width: auto; white-space: normal; }
.mk-row.editing .c-act .btn { display: block; margin: 0 0 5px auto; opacity: 1; }

/* ---------- import tab ---------- */
.im-drop { border: 1px dashed var(--line2); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.im-drop.over { border-color: var(--focus); background: #1d1f25; }
.im-src { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.im-fname { color: var(--text-hi); }
#imPaste { font-family: var(--mono); font-size: 12px; min-height: 70px; }
#imConf { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.im-row { display: flex; gap: 12px 16px; align-items: flex-end; flex-wrap: wrap; }
.im-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 10px; }
.im-map select { width: 100%; }
.im-target { border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px 6px; display: flex; gap: 14px; flex-wrap: wrap; margin: 0; }
.im-target legend { font-size: 11.5px; color: var(--muted); padding: 0 4px; }
.im-issues { list-style: none; margin: 0; padding: 0; color: var(--warn); display: flex; flex-direction: column; gap: 2px; }
.im-issues:empty { display: none; }
.im-preview-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
.im-preview { width: 100%; border-collapse: collapse; font-size: 12px; }
.im-preview[hidden] { display: none; }
.im-preview th { text-align: left; font-weight: 500; color: var(--muted); padding: 5px 8px; border-bottom: 1px solid var(--line); background: var(--panel2); white-space: nowrap; }
.im-preview td { padding: 4px 8px; border-bottom: 1px solid #202227; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.im-preview td.num { color: var(--muted); text-align: right; }
.im-preview tr.bad td { color: var(--bad); }
.im-preview tr.out td { color: var(--warn); }
.im-actions { display: flex; align-items: center; gap: 12px; }
.im-result { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 4px; }
.im-result p { margin: 6px 0; }
.im-skips, .im-per { margin: 4px 0 8px 18px; padding: 0; }

@media (max-width: 720px) {
  .timeline { --tl-head: 112px; }
  .tl-zoominfo { display: none; }
}

/* ---------- right-hand panel: Markers | Scopes ---------- */
.side { position: sticky; top: 14px; height: calc(100vh - var(--topbar-h) - 50px - 28px); min-height: 340px; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.side-tabbar { flex: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 4px 8px 0; background: transparent; }
.side-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 10px 12px 12px; }
.side-panel.scopes { overflow-y: auto; scrollbar-width: thin; }
#sideMarkers .mk-bar { flex: none; gap: 6px; margin-bottom: 8px; }
#sideMarkers .mk-bar select { max-width: 170px; }
#sideMarkers .mk-empty { flex: none; }
#sideMarkers .mk-table-wrap { flex: 1; }
#sideMarkers .mk-table thead th { background: var(--panel); }
.scopes-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }

/* ---------- import: timecode base, notices, result ---------- */
.im-base { border: 1px solid var(--line); border-radius: 6px; padding: 4px 12px 8px; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.im-base legend { font-size: 11.5px; color: var(--muted); padding: 0 4px; }
.im-base input[type=text] { width: 9.5em; padding: 2px 6px; margin: 0 4px; }
.im-note { border-radius: 6px; padding: 9px 12px; font-size: 13px; line-height: 1.45; border: 1px solid var(--line2); }
.im-note.tip { background: #1b2533; border-color: #3d5575; color: #c3d6ee; }
.im-note.bad { background: #2f1b1a; border-color: #8a3f3a; color: #f3c1bc; font-weight: 500; }
.im-banner { border-radius: 8px; padding: 12px 14px; margin: 10px 0; border: 1px solid var(--line2); }
.im-banner.bad { background: #2f1b1a; border-color: #8a3f3a; color: #f3c1bc; }
.im-banner.warn { background: #2c2617; border-color: #7a652b; color: #ecd9a0; }
.im-banner.ok { background: #172a1f; border-color: #2f6a47; color: #bfe3cb; }
.im-banner p { margin: 4px 0; }
.im-banner-h { font-size: 15px; font-weight: 600; }
.im-hint { font-size: 12.5px; opacity: .95; }
.im-banner .im-skips { margin: 6px 0 6px 18px; }
.im-base .err:empty { display: none; }
.im-base { gap: 4px; }
