/* Asset Manager: light by default, dark on request (the sun/moon button in the top bar). Colour is used only for state.
   Every colour in this file comes from the variables below; the video monitor and the scopes stay black in both themes. */
:root, :root[data-theme="light"] {
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Space Grotesk", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --neon-glow: rgba(55,230,255,.35);
  --neon-soft: rgba(55,230,255,.12);
  --topbar-h: 52px;
  --list-w: 460px;
}
:root[data-theme="light"], :root:not([data-theme]) {
  color-scheme: light;
  --bg: #eef3fb;
  --panel: #ffffff;
  --panel2: #f1f5fb;
  --panel3: #e3e9f5;
  --line: #d3d9e6;
  --line2: #bcc4d6;
  --text: #16181d;
  --text-hi: #0c0e12;
  --muted: #565b66;
  --focus: #1456c7;
  --sel: #dfe9fb;
  --ok: #1f7a46;
  --warn: #9a6100;
  --bad: #b3213f;
  --info: #1456c7;
  --list-bg: #ffffff;
  --accent: #1456c7;
  --accent-ctl: #1456c7;
  --input-bg: #ffffff;
  --hover: #eef3fb;
  --row-line: #e6ebf4;
  --chk-row: #e3ecfb;
  --btn-hover-line: #94a0ba;
  --btn-active: #d6dff0;
  --pressed-bg: #d9e5fa;
  --pressed-line: #8fb0ea;
  --primary-bg: #1456c7;
  --primary-line: #1148a8;
  --primary-text: #ffffff;
  --faint: #9097a4;
  --placeholder: #9aa1ad;
  --scrub-track: #d9dfeb;
  --scrub-buf: #bcc6da;
  --tl-bg: #e9eef7;
  --thumb-bg: #dde0e6;
  --pop-bg: #ffffff;
  --scope-bg: #0b0c0e;
  --soft-text: #4b5160;
  --hdr: #8a5a00;
  --toast-bg: #2b2f38;
  --toast-text: #ffffff;
  --bulk-bg: #e6eefb;
  --bulk-line: #b3c5e8;
  --bad-bg: #fdeceb;
  --bad-line: #e5a8a3;
  --bad-line2: #cf5a52;
  --bad-text: #a42d26;
  --warn-bg: #fff6df;
  --warn-line: #e3c872;
  --warn-text: #7a5700;
  --ok-bg: #e8f6ee;
  --ok-line: #8fcba8;
  --ok-text: #1b6b3e;
  --info-bg: #e9f1fd;
  --info-line: #a5c0e8;
  --info-text: #2a5aa6;
  --info-hi: #1d4a8f;
  --shadow: rgba(20,40,90,.20);
  --scrim: rgba(20,28,44,.45);
  --tl-wave: #2f6fd0;
  --tl-wave-muted: #aab2c0;
  --tl-lane-bg: #f4f5f8;
  --tl-wave-lane: #e8ebf1;
  --tl-ruler-bg: #e9ebf0;
  --tl-tick-major: rgba(50,58,74,.8);
  --tl-tick-minor: rgba(90,98,114,.42);
  --tl-label: rgba(36,42,54,.92);
  --tl-video-bg: #d8dce4;
  --tl-video-g1: #cfd4de;
  --tl-video-g2: #c3c9d6;
  --tl-line: #d3d7df;
  --tl-mk-bg: #f0f2f6;
  --tl-mk-text: rgba(28,34,46,.9);
  --tl-say: rgba(28,34,46,.5);
  --tl-centre: rgba(0,0,0,.14);
  --tl-lbl: rgba(0,0,0,.42);
  --tl-shade: rgba(243,244,247,.6);
  --tl-sel: #111111;
  --tl-strip-dim: rgba(0,0,0,.06);
}
:root[data-theme="dark"], .player:fullscreen {
  color-scheme: dark;
  --bg: #121215;
  --panel: #1c1c21;
  --panel2: #24242b;
  --panel3: #2d2d36;
  --line: #303039;
  --line2: #3d3d49;
  --text: #ededf0;
  --text-hi: #ffffff;
  --muted: #8f8f99;
  --focus: #37e6ff;
  --sel: #17303a;
  --ok: #72b085;
  --warn: #d4a650;
  --bad: #ff6f8e;
  --info: #7fd3e6;
  --list-bg: #151518;
  --accent: #37e6ff;
  --accent-ctl: #37e6ff;
  --input-bg: #17171b;
  --hover: #1a1a1f;
  --row-line: #232329;
  --chk-row: #172f38;
  --btn-hover-line: #55555f;
  --btn-active: #34343e;
  --pressed-bg: #143641;
  --pressed-line: #2a8da0;
  --primary-bg: #37e6ff;
  --primary-line: #37e6ff;
  --primary-text: #041018;
  --faint: #5c5c66;
  --placeholder: #6a6a74;
  --scrub-track: #2a2a31;
  --scrub-buf: #3d3d48;
  --tl-bg: #101013;
  --thumb-bg: #111111;
  --pop-bg: #0e0e11;
  --scope-bg: #0b0c0e;
  --soft-text: #b8b8c2;
  --hdr: #e3c071;
  --toast-bg: #24242b;
  --toast-text: #ededf0;
  --bulk-bg: #15262c;
  --bulk-line: #2c5560;
  --bad-bg: #2d1a21;
  --bad-line: #6e3345;
  --bad-line2: #b84a67;
  --bad-text: #ffc2cf;
  --warn-bg: #2c2617;
  --warn-line: #7a652b;
  --warn-text: #ecd9a0;
  --ok-bg: #172a1f;
  --ok-line: #2f6a47;
  --ok-text: #bfe3cb;
  --info-bg: #14262c;
  --info-line: #2f6677;
  --info-text: #bdeaf5;
  --info-hi: #a6e6f5;
  --shadow: rgba(0,0,0,.55);
  --scrim: rgba(0,0,0,.6);
  --tl-wave: #2fc9de;
  --tl-wave-muted: #4a4a55;
  --tl-lane-bg: #15151a;
  --tl-wave-lane: #1b1b21;
  --tl-ruler-bg: #16161b;
  --tl-tick-major: rgba(200,204,212,.75);
  --tl-tick-minor: rgba(160,165,175,.4);
  --tl-label: rgba(205,208,214,.9);
  --tl-video-bg: #202027;
  --tl-video-g1: #2a2a32;
  --tl-video-g2: #212128;
  --tl-line: #303039;
  --tl-mk-bg: #18181d;
  --tl-mk-text: rgba(225,228,234,.86);
  --tl-say: rgba(255,255,255,.34);
  --tl-centre: rgba(255,255,255,.07);
  --tl-lbl: rgba(255,255,255,.28);
  --tl-shade: rgba(0,0,0,.45);
  --tl-sel: #ffffff;
  --tl-strip-dim: rgba(0,0,0,.18);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  background-image: radial-gradient(ellipse 900px 500px at 15% -10%, rgba(55,230,255,.08), transparent 60%), radial-gradient(ellipse 700px 500px at 100% 10%, rgba(120,90,255,.10), transparent 55%); background-attachment: fixed;
  font: 13.5px/1.4 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 600; color: var(--text-hi); font-family: var(--display); }
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: var(--btn-hover-line); }
.btn:active { background: var(--btn-active); }
.btn[aria-pressed="true"] { background: var(--pressed-bg); border-color: var(--pressed-line); color: var(--text-hi); }
.btn:disabled { opacity: .45; cursor: default; }
.btn { border-radius: 8px; }
.btn.primary { background: var(--primary-bg); border-color: var(--primary-line); color: var(--primary-text); font-family: var(--display); font-weight: 600; }
.btn.primary:hover { background: var(--primary-bg); border-color: var(--primary-line); filter: brightness(1.06); box-shadow: 0 0 0 1px var(--neon-glow), 0 10px 26px -12px var(--neon-glow); }
:root[data-theme="light"] { --neon-glow: rgba(20,86,199,.30); --neon-soft: rgba(20,86,199,.10); }
.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=email], input[type=search], input[type=password], input[type=date], select, textarea {
  background: var(--input-bg); border: 1px solid var(--line2); border-radius: 6px; padding: 6px 9px; min-width: 0;
}
input[type=date] { color-scheme: dark; }
:root[data-theme="light"] input[type=date] { color-scheme: light; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--neon-soft, rgba(55,230,255,.12)); }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
textarea { font: inherit; color: inherit; resize: vertical; width: 100%; }
select { padding-right: 4px; }
input[type=range] { accent-color: var(--accent-ctl); 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(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; 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; }
.login-card .linkbtn, .login-card .login-link { align-self: flex-start; background: none; border: 0; padding: 4px 0; margin: 2px 0 0; color: var(--muted); font-size: 12.5px; text-decoration: underline; cursor: pointer; }
.login-card .linkbtn:hover, .login-card .login-link:hover { color: var(--text-hi); }
.login-card .login-link:not([hidden]) { display: inline-block; }
.login-card #eaFinish { color: var(--accent); font-weight: 500; }
.pw-wrap { position: relative; display: flex; }
.pw-wrap input { padding-right: 62px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: 4px 8px; color: var(--muted); font-size: 12px; cursor: pointer; border-radius: 5px; }
.pw-toggle:hover { color: var(--text-hi); background: var(--panel3); }

/* ---------- 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 { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 600; color: var(--text-hi); letter-spacing: .01em; white-space: nowrap; }
.brand img { height: 22px; width: auto; display: block; }
.brand .brand-sep { width: 1px; height: 18px; background: var(--line2); }
.brand .brand-sub { color: var(--muted); font-weight: 500; font-size: 13px; }
:root[data-theme="light"] .brand img, :root[data-theme="light"] .login-logo { content: url("brand/editanyware-logo-light.png"); }
.login-logo { display: block; height: 32px; width: auto; aspect-ratio: 2291 / 381; max-width: 100%; align-self: flex-start; object-fit: contain; margin: 0 0 14px; }   /* the card is a flex column: without align-self the image stretched to the full card width */
.search { flex: 1 1 260px; max-width: 520px; }
.search input { width: 100%; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.who { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge.cust { color: var(--info); border-color: var(--info-line); white-space: nowrap; }
.client-head { flex: none; padding: 10px 14px 6px; border-bottom: 1px solid var(--line); background: var(--bg); }
.client-head h2 { font-size: 15px; letter-spacing: .01em; text-transform: none; color: var(--text-hi); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.one-client .clients { display: none !important; }
.cap-off { display: none !important; }   /* a control the signed-in principal may not use: hidden, never merely disabled */
.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 var(--accent); }
.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 var(--info-line); 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; display: flex; align-items: center; gap: 14px; }
.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 var(--row-line); vertical-align: middle; }
.assets tbody tr { cursor: default; }
.assets tbody tr:hover { background: var(--hover); }
.assets tbody tr.sel { background: var(--sel); box-shadow: inset 3px 0 0 var(--accent); }
.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 var(--info-line); 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: var(--soft-text); }
.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: var(--bad-line); }
.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: var(--accent); background: var(--sel); }
.card.missing { opacity: .6; }
.card .poster { position: relative; aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; color: var(--muted); 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; }
body.split .detail { left: var(--list-w); border-left: 1px solid var(--line); }
body.split.list-hidden .detail { left: 0; border-left: 0; }
.detail-bar { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.dtitle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: 6px; }
.detail-bar-right { display: flex; gap: 6px; }
#dList { display: none; }
body.split #dList { display: inline-block; }
.detail-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; padding: 8px 12px 8px; gap: 6px; }
.player { flex: none; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.monitor { flex: none; display: flex; align-items: stretch; justify-content: center; gap: 8px; min-width: 0; }
.stage-wrap { position: relative; flex: 1 1 0; min-width: 0; aspect-ratio: 16 / 9; max-height: var(--stage-max, calc(100vh - var(--topbar-h) - 210px)); max-width: var(--stage-maxw, none); display: flex; align-items: center; justify-content: center; background: #000; border-radius: 6px; overflow: hidden; }   /* shaped like the picture and as wide as the pane, so no black bars; the timeline does not size it */
.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: #e08a84; }
.meters { flex: none; width: 84px; position: relative; background: #0b0c0e; border-radius: 6px; cursor: pointer; overflow: hidden; }
.meters canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.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; }

.transport { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.tcbar { display: flex; flex-direction: column; gap: 3px; flex: none; }
.tc-big { font-family: var(--mono); font-size: 28px; 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-subrow { display: flex; gap: 10px; align-items: baseline; min-height: 15px; }
.tc-marks { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mark-chip { font-family: var(--mono); font-size: 11.5px; 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: var(--btn-hover-line); }
.shuttle-ind { font-family: var(--mono); font-size: 12px; color: var(--warn); min-width: 5em; }

.scrub { position: relative; height: 22px; flex: none; cursor: pointer; touch-action: none; border-radius: 4px; }
.scrub-track { position: absolute; left: 0; right: 0; top: 7px; height: 8px; background: var(--scrub-track); border-radius: 4px; }
.scrub-buf { position: absolute; left: 0; top: 0; bottom: 0; background: var(--scrub-buf); border-radius: 4px; width: 0; }
.scrub-played { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); 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: 26px; transform: translateX(-50%); background: #000; color: #fff; 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 { flex: 1 1 auto; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: flex-end; min-width: 0; }
.cgroup { display: flex; gap: 5px; align-items: center; }
.cgroup.right { margin-left: 0; }
#cVol { width: 84px; }
.monitor-row { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 12.5px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.monitor-row .sep { width: 1px; height: 18px; background: var(--line2); }
#oZebraTh { width: 90px; }
.player:fullscreen { background: #000; padding: 10px; color: var(--text); }
.player:fullscreen .monitor { flex: 1; min-height: 0; }
.player:fullscreen .stage-wrap { aspect-ratio: auto !important; max-height: none; max-width: none; }

.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: var(--input-bg); 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 ---------- */
.dock-panel.scopes { display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.dock-panel.scopes[hidden] { display: none; }
.scopes-grid { flex: 1; min-height: 0; display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; align-items: stretch; scrollbar-width: thin; }
.scope-box { flex: none; height: 100%; background: var(--scope-bg); border: 1px solid var(--line); border-radius: 6px; padding: 5px; }
.scope-title { height: 16px; font-size: 10.5px; color: #8a8d95; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; overflow: hidden; }
.scope-box canvas { display: block; height: calc(100% - 18px); width: auto; max-width: none; }
#cvWave { aspect-ratio: 2 / 1; }
#cvParade { aspect-ratio: 3 / 1; }
#cvVec { aspect-ratio: 1 / 1; }
#cvHist { aspect-ratio: 384 / 320; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; background: var(--scrim); 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: var(--toast-bg); border: 1px solid var(--line2); border-radius: 6px; padding: 8px 14px; z-index: 60; max-width: 90vw; }
.toast:empty { display: none; }
.toast { pointer-events: none; color: var(--toast-text); }
.toast .toast-act { pointer-events: auto; }
.toast.bad { border-color: var(--bad-line); color: var(--bad-text); }
.toast-act { margin-left: 14px; background: none; border: 0; color: #37e6ff; text-decoration: underline; cursor: pointer; padding: 0 2px; }
.toast-act:hover { color: var(--info-hi); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .who { max-width: 110px; }
  .scope-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1000px) {
  #refreshInfo, .brand { display: none; }
  .edit-grid { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {     /* the clients + folders column is permanent above this; below it is one drawer */
  .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; }
}
@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: var(--bad-line); color: var(--bad-text); }
.btn.danger:hover { background: #5a3331; }
.btn.icon.sm { width: 26px; height: 26px; }
.btn.icon.sm svg { width: 14px; height: 14px; }

/* ---------- timeline ---------- */
.timeline { --tl-head: 132px; --tl-gut: 0px; position: relative; flex: none; padding-top: 2px; }
.tl-bar { display: flex; justify-content: space-between; align-items: center; gap: 6px 14px; flex-wrap: wrap; margin-bottom: 4px; }
.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: var(--bad-bg); border: 1px solid var(--bad-line); border-radius: 6px; color: var(--bad-text); 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: var(--tl-bg); 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: 22px; }
.tl-mk-row .tl-lane { height: 22px; cursor: default; }
.tl-video-row .tl-lane { height: 32px; }
.tl-audio { overflow-y: auto; overflow-x: hidden; max-height: 190px; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.tl-audio .tl-lane { height: 42px; }
.tl-audio.d4 .tl-lane { height: 36px; }
.tl-audio.d6 .tl-lane { height: 32px; }
.tl-audio .tl-noaudio .tl-lane { height: 34px; }
.tl-audio .tl-mixrow .tl-lane { height: 46px; }
@media (max-height: 780px) {
  .tc-big { font-size: 26px; }
  .tl-video-row .tl-lane { height: 30px; }
  .tl-audio { max-height: min(150px, 26vh); }
  .tl-audio .tl-lane { height: 40px; }
  .tl-audio.d4 .tl-lane { height: 34px; }
  .tl-audio.d6 .tl-lane { height: 30px; }
}
.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: var(--btn-hover-line); }
.tl-spk svg { width: 17px; height: 17px; fill: currentColor; stroke: currentColor; }
.tl-spk[aria-pressed="true"] { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-text); }
.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 #3b3e46; border-radius: 3px; padding: 0 5px; white-space: nowrap; color: #fff; }
.tl-hover-tip.left { left: auto; right: 5px; }
.tl-card { position: absolute; z-index: 6; max-width: 320px; min-width: 150px; background: var(--pop-bg); 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: var(--scrub-track); 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: var(--btn-hover-line); border-radius: 4px; cursor: grab; touch-action: none; }
.tl-hs-thumb:hover { background: var(--faint); }
.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: var(--bg); box-shadow: 0 0 0 2px var(--text-hi); }
.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 { font-family: var(--display); 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: var(--accent); }
.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: var(--bad-bg); border: 1px solid var(--bad-line); 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 var(--row-line); vertical-align: middle; }
.mk-row { cursor: pointer; }
.mk-row:hover { background: var(--hover); }
.mk-row.sel { background: var(--sel); box-shadow: inset 3px 0 0 var(--accent); }
.mk-row.pending { opacity: .6; }
.mk-row.editing { cursor: default; background: var(--hover); }
.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: var(--hover); }
.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 var(--row-line); 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; }
}

/* ---------- dock: Markers | Details | Import | Scopes, under the timeline ---------- */
.dock { flex: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; overflow: hidden; }
.dock-grip { flex: none; height: 9px; cursor: ns-resize; position: relative; touch-action: none; outline-offset: -2px; }
.dock-grip::after { content: ""; position: absolute; left: 50%; top: 3px; width: 44px; height: 3px; margin-left: -22px; border-radius: 2px; background: var(--line2); }
.dock-grip:hover::after, .dock-grip.drag::after, .dock-grip:focus-visible::after { background: var(--accent); }
.dock.closed .dock-grip { display: none; }
.dock-bar { flex: none; display: flex; align-items: center; gap: 6px; padding: 0 8px 0 6px; }
.dock:not(.closed) .dock-bar { border-bottom: 1px solid var(--line); }
.dock.closed .dock-bar { padding-top: 2px; }
.dock .tabbar { border: 0; background: none; border-radius: 0; padding: 0; }
.dock .tab { padding: 6px 12px; }
.dock.closed .tab[aria-selected="true"] { border-bottom-color: transparent; }
.dock-body { height: var(--dock-h, 250px); min-height: 0; position: relative; }
.dock.closed .dock-body { display: none; }
.dock-panel { height: 100%; overflow: auto; padding: 10px 12px; scrollbar-width: thin; }
.dock .edit-panel.dock-panel { margin: 0; border: 0; border-radius: 0; background: none; }
.dock .edit-panel > h2:first-child { display: none; }
#sideMarkers { display: flex; flex-direction: column; overflow: hidden; }
#sideMarkers[hidden] { display: none; }
#sideMarkers .mk-bar { flex: none; gap: 6px; margin-bottom: 8px; }
#sideMarkers .mk-bar select { max-width: 200px; }
#sideMarkers .mk-empty { flex: none; margin: 4px 2px; }
#sideMarkers .mk-table-wrap { flex: 1; }
#sideMarkers .mk-table thead th { background: var(--panel); }
.dock .edit-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.dock .edit-block.wide { grid-column: 1 / -1; }
.dock .info { grid-template-columns: max-content 1fr max-content 1fr; }
.splitter { display: none; position: fixed; top: var(--topbar-h); bottom: 0; left: calc(var(--list-w) - 5px); width: 11px; cursor: col-resize; z-index: 25; touch-action: none; }
.splitter::after { content: ""; position: absolute; left: 5px; top: 0; bottom: 0; width: 1px; background: transparent; }
.splitter:hover::after, .splitter.drag::after, .splitter:focus-visible::after { left: 4px; width: 3px; background: var(--accent); }
body.split:not(.list-hidden) .splitter { display: block; }

/* ---------- split view: the list stays on the left while a clip plays ---------- */
body.split .main { flex: none; width: var(--list-w); }
body.split.list-hidden .layout { display: none; }
body.split .btn.nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
body.split.list-hidden .btn.nav-toggle { display: none; }
body.split .clients { position: fixed; top: var(--topbar-h); bottom: 0; left: 0; z-index: 30; transform: translateX(-102%); transition: transform .15s; box-shadow: 4px 0 18px var(--shadow); }
body.split .clients.open { transform: none; }
body.split .filters:not(.open) { display: none; }
body.split .results { padding: 0 8px 20px; }
body.split .result-bar, body.split .filters { padding-left: 10px; padding-right: 10px; }
body.split .bulk-bar { margin-left: 8px; margin-right: 8px; }
body.split .assets th[data-col]:not([data-col="thumb"]):not([data-col="name"]):not([data-col="duration"]),
body.split .assets td[data-col]:not([data-col="thumb"]):not([data-col="name"]):not([data-col="duration"]) { display: none; }
body.split .assets { width: 100%; }
body.split .assets td.c-name { min-width: 120px; width: auto; max-width: none; }
body.split .grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.filters-btn { display: none; }
body.split .filters-btn { display: inline-block; }
.filters-btn .n { margin-left: 4px; font-size: 11px; background: var(--accent); color: var(--primary-text); border-radius: 8px; padding: 0 5px; }
.assets tbody tr.sel { background: var(--sel); box-shadow: inset 3px 0 0 var(--accent); }
.theme-btn svg { width: 17px; height: 17px; }
.main { background: var(--list-bg); }
.assets th { background: var(--list-bg); }

/* ---------- 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: var(--info-bg); border-color: var(--info-line); color: var(--info-text); }
.im-note.bad { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-text); font-weight: 500; }
.im-banner { border-radius: 8px; padding: 12px 14px; margin: 10px 0; border: 1px solid var(--line2); }
.im-banner.bad { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-text); }
.im-banner.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-text); }
.im-banner.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-text); }
.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; }

/* =====================================================================
 * v3: list columns, thumbnails, selection, inline editing, modals, delete
 * ===================================================================== */
.btn.danger-outline { border-color: var(--bad-line); color: var(--bad-text); background: transparent; }
.btn.danger-outline:hover { background: var(--bad-bg); border-color: var(--bad-line2); color: var(--bad-text); }
.btn.danger { background: #8c2f2a; border-color: #b8453f; color: #fff; }
.btn.danger:hover:not(:disabled) { background: #a63a34; }
.warn-text { color: var(--warn); }
.ok-text { color: var(--ok); }
.red { color: var(--bad-text); }
.trash-chk { color: var(--muted); }

table.assets { width: auto; min-width: 0; }
.assets td { padding: 4px 8px; white-space: nowrap; }
.assets td.c-name, .assets td.c-tags, .assets td.c-field { white-space: normal; }
.assets .sel-cell, .assets .sel-th { width: 30px; padding: 0 0 0 10px; text-align: center; }
.assets .sel-cell input, .assets .sel-th input { width: 15px; height: 15px; accent-color: var(--accent-ctl); cursor: pointer; }
.assets .c-thumb { width: 108px; padding: 4px 6px 4px 4px; }
.lthumb { position: relative; width: 96px; height: 54px; border-radius: 3px; overflow: hidden; background: var(--thumb-bg); flex: none; }
.lthumb img { width: 96px; height: 54px; object-fit: cover; display: block; }
.lthumb.noimg { display: flex; align-items: center; justify-content: center; color: var(--faint); font: 10px var(--mono); }
.assets tbody tr { height: 62px; }
.assets tbody tr.chk { background: var(--chk-row); }
.assets tbody tr.sel { background: var(--sel); }
.assets tbody tr.deleted td:not(.c-act) { opacity: .6; }
.assets td.c-name { min-width: 190px; width: 230px; max-width: 300px; position: relative; padding-right: 30px; }
.assets td.c-tags { min-width: 120px; max-width: 280px; }
.assets td.c-field { min-width: 90px; max-width: 220px; overflow-wrap: anywhere; }
.assets td.hdr { color: var(--hdr); }
.assets td.editable { cursor: default; }
.assets td.editable:hover { box-shadow: inset 0 0 0 1px var(--line2); }
.assets td:focus-visible, .assets td:focus { outline: 2px solid var(--focus); outline-offset: -2px; }
.assets td.editing { padding: 3px 4px; box-shadow: inset 0 0 0 2px var(--focus); }
.assets td.invalid { box-shadow: inset 0 0 0 2px var(--bad); }
.assets td.c-field:empty:hover::after, .assets td.c-tags:empty:hover::after { content: "double-click to edit"; color: var(--faint); font-size: 11px; }
.assets td.c-field .fldchk { width: 15px; height: 15px; accent-color: var(--accent-ctl); cursor: pointer; }
.cell-in { width: 100%; min-width: 80px; padding: 4px 6px; }
.cell-edit { position: absolute; right: 4px; top: 4px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 4px; background: var(--panel3); color: var(--muted); opacity: 0; cursor: pointer; }
.cell-edit svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; }
.assets tr:hover .cell-edit, .cell-edit:focus-visible { opacity: 1; }
.assets th { white-space: nowrap; }
.assets th.h-thumb { width: 108px; }
.assets .c-act { text-align: right; width: 80px; }
.assets .num { text-align: right; font-variant-numeric: tabular-nums; }
.card .card-chk { position: absolute; left: 8px; top: 8px; z-index: 3; width: 17px; height: 17px; accent-color: var(--accent-ctl); }
.card { position: relative; }
.card.chk { border-color: var(--accent); }
.card.deleted { opacity: .6; }
.grow { flex: 1; }

.bulk-bar { flex: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 2px 14px 6px; padding: 6px 10px; background: var(--bulk-bg); border: 1px solid var(--bulk-line); border-radius: 6px; }
.bulk-n { font-weight: 600; color: var(--text-hi); margin-right: 6px; }

.colwrap { position: relative; }
.colpop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; width: 340px; max-height: min(70vh, 560px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line2); border-radius: 8px; box-shadow: 0 12px 34px rgba(0,0,0,.55); }
.colpop-head { padding: 10px 12px 6px; }
.colpop-list { list-style: none; margin: 0; padding: 0 6px; overflow-y: auto; flex: 1; }
.colpop-list li { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 5px; }
.colpop-list li:hover { background: var(--panel2); }
.colpop-list li.drag { opacity: .4; }
.colpop-list li.over { box-shadow: inset 0 2px 0 var(--focus); }
.colpop-list label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.colpop-list .grip { color: var(--faint); cursor: grab; letter-spacing: -2px; }
.colpop-list .tag-mini { font-size: 10px; color: var(--info); border: 1px solid var(--info-line); border-radius: 8px; padding: 0 6px; }
.colpop-foot { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 10px 10px; border-top: 1px solid var(--line); }

.modal-overlay { position: fixed; inset: 0; z-index: 70; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.6); outline: none; }
.modal.modal-wide { width: min(980px, 100%); }
.modal-head { flex: none; display: flex; justify-content: space-between; align-items: center; padding: 14px 18px 8px; }
.modal-head h2 { font-size: 16px; text-transform: none; letter-spacing: 0; color: var(--text-hi); }
.modal-body { flex: 1; overflow: auto; padding: 4px 18px 12px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.modal-foot { flex: none; display: flex; gap: 8px; align-items: center; padding: 10px 18px 14px; border-top: 1px solid var(--line); }
.modal .fld input[type=text], .modal .fld select, .modal .fld textarea, .modal .fld input[type=date] { width: 100%; }
.modal h3 { font-size: 14px; color: var(--text-hi); }
.modal h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 8px 0 4px; }
.mf-list { display: flex; flex-direction: column; gap: 10px; }
.mf-row { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--panel2); }
.mf-main { display: grid; grid-template-columns: auto minmax(120px, 1.4fr) minmax(80px, .8fr) minmax(130px, 1fr) auto auto; gap: 10px; align-items: end; }
.mf-move { display: flex; flex-direction: column; gap: 3px; }
.mf-key code { font: 12px var(--mono); padding: 5px 0; color: var(--text); }
.mf-vis { padding-bottom: 5px; font-size: 12px; }
.mf-choices textarea { width: 100%; }
.mf-confirm { background: var(--bad-bg); border: 1px solid var(--bad-line); border-radius: 6px; padding: 8px 12px; }
.mf-confirm p { margin: 0 0 8px; }
.mf-confirm-b { display: flex; gap: 8px; margin-top: 8px; }
.bk-val { display: block; }

.dcard { border: 1px solid var(--line2); border-radius: 8px; padding: 12px 14px; background: var(--panel2); display: flex; flex-direction: column; gap: 10px; }
.dparts { display: flex; flex-direction: column; gap: 6px; }
.dpart { display: grid; grid-template-columns: 190px 1fr; gap: 10px; align-items: start; padding: 4px 0; border-bottom: 1px solid var(--row-line); }
.dpart.off { opacity: .85; }
.dpart .dd { font-size: 12.5px; color: var(--text); overflow-wrap: anywhere; }
.chk { display: inline-flex; align-items: center; gap: 7px; }
.dpart .chk { display: flex; align-items: center; }
.vers { margin-top: 2px; }
.vtab { width: 100%; border-collapse: collapse; font-size: 12px; }
.vtab th { text-align: left; font-weight: 500; color: var(--muted); padding: 4px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.vtab td { padding: 5px 8px; border-bottom: 1px solid var(--row-line); vertical-align: top; }
.vtab tr.self td { background: var(--chk-row); }
.vtab .vc { width: 26px; } .vtab .vw { max-width: 300px; overflow-wrap: anywhere; } .vtab .num { text-align: right; white-space: nowrap; }
.dsum { margin: 2px 0 6px 20px; padding: 0; }
.dsum li { margin: 3px 0; }
.dsum.stay { color: var(--muted); }
.dwarn { background: var(--bad-bg); border: 1px solid var(--bad-line2); color: var(--bad-text); border-radius: 6px; padding: 10px 12px; margin: 6px 0; }
.dwarn .mono { white-space: pre-wrap; margin-top: 6px; color: var(--bad-text); }
.dack { margin: 4px 0; }
.dtype { margin-top: 8px; max-width: 360px; }
.dtype input { font-family: var(--mono); letter-spacing: .08em; }
.dres td { vertical-align: middle; }

.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 14px; }
.field-in { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field-in label { font-size: 11.5px; color: var(--muted); }
.field-in input[type=text], .field-in input[type=date], .field-in select { width: 100%; }
.field-in.chk { flex-direction: row; align-items: center; gap: 8px; }
.field-in.chk label { order: 2; font-size: 12.5px; color: var(--text); }
.vtab .vkey { word-break: break-all; }
.restore-btn { margin: 3px 0 0 0; display: block; }

/* timeline: folded away on request (keeps its own tool row) */
.timeline.folded .tl-note, .timeline.folded .tl-stack, .timeline.folded .tl-hs-row { display: none; }
.timeline.folded .tl-zoom, .timeline.folded #tlFit, .timeline.folded #tlFollow, .timeline.folded .tl-zoominfo { display: none; }
.tl-bar-l .tc-marks { margin-left: 4px; }
.tl-bar-l .mark-chip { padding: 2px 6px; }

/* wide window: the panel moves to the right of the monitor, in the space that a 16:9 picture would leave empty */
.detail.side-dock .detail-body { flex-direction: row; align-items: flex-start; }
.detail.side-dock .player { flex: 1 1 0; min-width: 0; }
.detail.side-dock .dock { flex: none; width: clamp(340px, 30%, 460px); position: sticky; top: 0; height: calc(100vh - var(--topbar-h) - 45px - 22px); }
.detail.side-dock .dock-body { height: auto; flex: 1; }
.detail.side-dock .dock-grip, .detail.side-dock #dockToggle { display: none; }
.detail.side-dock .dock.closed .dock-body { display: block; }
.detail.side-dock .dock.closed .tab[aria-selected="true"] { border-bottom-color: var(--accent); }
.detail.side-dock .scopes-grid { flex-direction: column; overflow-x: hidden; overflow-y: auto; }
.detail.side-dock .scope-box { height: auto; }
.detail.side-dock .scope-box canvas { width: 100%; height: auto; }
.detail.side-dock .edit-grid { grid-template-columns: 1fr; }
.detail.side-dock .info { grid-template-columns: max-content 1fr; }
.detail.side-dock .dock.closed { position: sticky; top: 0; }

/* ---------- playlist (sub-clips) ---------- */
#playlistPanel { display: flex; flex-direction: column; overflow: hidden; }
#playlistPanel[hidden] { display: none; }
.pl-bar { flex: none; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.pl-bar select { max-width: 300px; }
.pl-empty { flex: none; margin: 4px 2px; }
.pl-empty[hidden] { display: none; }
.pl-list { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 0; scrollbar-width: thin; }
.pl-row { display: grid; grid-template-columns: 22px 64px minmax(0, 1fr) auto auto; gap: 4px 10px; align-items: center; padding: 5px 4px; border-bottom: 1px solid var(--row-line); }
.pl-row:hover { background: var(--hover); }
.pl-row.cur { background: var(--sel); box-shadow: inset 3px 0 0 var(--accent); }
.pl-row.gone { opacity: .6; }
.pl-n { text-align: right; font-size: 11.5px; }
.pl-thumb { width: 64px; height: 36px; border-radius: 3px; background: var(--thumb-bg); overflow: hidden; display: block; }
.pl-thumb img { width: 64px; height: 36px; object-fit: cover; display: block; }
.pl-main { min-width: 0; }
.pl-open { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; display: flex; gap: 8px; align-items: baseline; max-width: 100%; min-width: 0; }
.pl-open:hover .pl-name { text-decoration: underline; }
.pl-name { color: var(--text-hi); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-clip { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-dur { font-size: 12px; text-align: right; }
.pl-acts { display: flex; gap: 3px; }
.pl-ic { padding: 3px 7px; min-width: 28px; }
.pl-edit { grid-column: 3 / -1; display: flex; flex-direction: column; gap: 6px; }
.pl-edit-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.pl-edit .fld input { width: 100%; }

/* ---------- export dialogs ---------- */
.modal-export { width: min(760px, 100%); }
.ex-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.ex-grid .fld.wide { grid-column: 1 / -1; }
.ex-grid .fld select, .ex-grid .fld input, .ex-grid .fld textarea { width: 100%; }
.ex-check { margin-top: 6px; }
.ex-items { list-style: none; margin: 0 0 8px; padding: 0; border: 1px solid var(--line); border-radius: 6px; max-height: 150px; overflow: auto; }
.ex-items li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; padding: 4px 10px; border-bottom: 1px solid var(--row-line); align-items: baseline; }
.ex-items li:last-child { border-bottom: 0; }
.ex-items li.bad { background: var(--bad-bg); }
.ex-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-hi); }
.ex-est { margin: 6px 0 0; }
.ex-rights { margin-top: 6px; }
.modal-exports { width: min(1040px, 100%); }
.ex-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ex-table th { text-align: left; font-weight: 500; color: var(--muted); padding: 5px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ex-table td { padding: 7px 8px; border-bottom: 1px solid var(--row-line); vertical-align: top; }
.ex-table td.num { text-align: right; white-space: nowrap; }
.ex-to { max-width: 220px; overflow-wrap: anywhere; }
.ex-st.bad { color: var(--bad); }
.ex-acts { white-space: nowrap; text-align: right; }
.ex-acts .btn + .btn { margin-left: 4px; }
/* playlist history: archive toggle, read-only banner, header line */
.pl-arch-toggle { font-size: 12.5px; color: var(--muted); }
.pl-arch-toggle.dis { opacity: .5; cursor: default; }
.pl-banner { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; padding: 7px 10px; margin: 0 0 8px; border: 1px solid var(--line); border-left: 3px solid var(--muted); border-radius: 6px; background: var(--panel2); color: var(--text-hi); font-weight: 500; }
.pl-banner[hidden], .pl-meta[hidden] { display: none; }
.pl-banner-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.pl-meta { flex: none; margin: 0 2px 6px; }
.pl-opt-arch { color: var(--muted); }
.pl-list.ro .pl-name { color: var(--muted); }
/* export mode: per-file table in the dialog, files in the exports list */
.ex-parts-wrap { margin: 6px 0 0; border: 1px solid var(--line); border-radius: 6px; max-height: 170px; overflow: auto; }
.ex-parts { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ex-parts th { position: sticky; top: 0; background: var(--panel); text-align: left; font-weight: 500; color: var(--muted); padding: 4px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ex-parts td { padding: 4px 8px; border-bottom: 1px solid var(--row-line); }
.ex-parts tr:last-child td { border-bottom: 0; }
.ex-parts td.num, .ex-parts th.num { text-align: right; white-space: nowrap; }
.ex-parts td.ex-pn { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-hi); }
.ex-files { margin-top: 4px; }
.ex-files > summary { cursor: pointer; color: var(--text); font-size: 12.5px; }
.ex-files ul { list-style: none; margin: 4px 0 0; padding: 0; }
.ex-files li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 10px; padding: 3px 0; border-bottom: 1px solid var(--row-line); font-size: 12px; }
.ex-files li:last-child { border-bottom: 0; }
.ex-files li > :nth-child(3) { grid-column: 1 / -1; font-size: 11.5px; }
.ex-files li .ex-fn { overflow-wrap: anywhere; color: var(--text-hi); }
.ex-files li.bad .ex-fn, .ex-files li.bad .ex-fs { color: var(--bad); }


/* ---------- iPhone and other small phones (portrait up to ~640 px, plus iPhone landscape) ---------- */
@supports (height: 100dvh) { #app { height: 100dvh; } }
html { -webkit-text-size-adjust: 100%; }
button, .tab, select, summary { touch-action: manipulation; }
@media (max-width: 640px) {
  :root { --topbar-h: 100px; }
  /* top bar becomes two rows: Clients + search, then the tools in a row that scrolls sideways */
  .topbar { flex-wrap: wrap; align-content: center; gap: 0 8px; padding: env(safe-area-inset-top) 8px 0; height: calc(var(--topbar-h) + env(safe-area-inset-top)); }
  .btn.nav-toggle { height: 38px; }
  .search { flex: 1 1 0; max-width: none; padding: 6px 0; }
  .topbar-right { order: 3; flex: 0 0 100%; margin-left: 0; height: 46px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; gap: 6px; padding-bottom: 4px; }
  .topbar-right::-webkit-scrollbar { display: none; }
  .topbar-right > * { flex: none; }
  .btn { min-height: 38px; }
  .btn.small-btn { min-height: 34px; }
  .btn.icon { width: 42px; height: 38px; }
  input[type=text], input[type=email], input[type=search], input[type=password], input[type=date], select, textarea { font-size: 16px; }   /* stops iOS zooming into a field when it is focused */
  .clients { width: min(84vw, 300px); top: calc(var(--topbar-h) + env(safe-area-inset-top)); padding-bottom: env(safe-area-inset-bottom); }
  /* the list is the compact one used beside the monitor: thumbnail, name, duration; filters tucked behind the Filters button */
  .filters:not(.open) { display: none; }
  .filters-btn { display: inline-block; }
  .results { padding: 0 8px 20px; }
  .result-bar, .filters { padding-left: 10px; padding-right: 10px; }
  .assets th[data-col]:not([data-col="thumb"]):not([data-col="name"]):not([data-col="duration"]),
  .assets td[data-col]:not([data-col="thumb"]):not([data-col="name"]):not([data-col="duration"]) { display: none; }
  .assets { width: 100%; }
  .assets td.c-name { min-width: 120px; width: auto; max-width: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .btn.nav-toggle { padding: 0 12px; flex: none; }
  .result-bar { flex-wrap: wrap; gap: 6px; }
  .bulk-bar { flex-wrap: wrap; }
  /* the clip view takes the whole screen (the list is one tap away with Close) */
  .detail { top: 0; padding-top: env(safe-area-inset-top); }
  body.split .detail { left: 0; border-left: 0; }
  #dList, .splitter { display: none !important; }
  .detail-bar { flex-wrap: wrap; gap: 6px; padding: 6px 8px; }
  .dtitle { order: 3; flex: 1 0 100%; margin: 0; }
  #dClient, .dtitle > .muted { display: none; }
  .detail-bar-right { margin-left: auto; }
  .detail-body { padding: 6px 8px calc(10px + env(safe-area-inset-bottom)); gap: 8px; }
  .monitor { gap: 6px; }
  .meters { width: 38px; }
  .tc-big { font-size: 24px; }
  .transport { gap: 6px 10px; }
  .controls { justify-content: flex-start; gap: 6px; }
  .cgroup { flex-wrap: wrap; }
  #helpBtn { display: none; }                /* keyboard shortcuts mean nothing on a phone */
  #cVol { display: none; }                  /* iPhones ignore the page's volume, the hardware buttons set it */
  .timeline { --tl-head: 80px; }
  .tl-bar { flex-wrap: wrap; gap: 6px; }
  .dock .tabbar { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .dock .tab { white-space: nowrap; padding: 9px 12px; flex: none; }
  .dock-body { height: var(--dock-h, 46vh); }
  .overlay { padding: 8px; }
  .dpart { grid-template-columns: 1fr; gap: 2px; }
  .dpart code, .dpart .mono { overflow-wrap: anywhere; }
  .modal { width: 100%; max-height: calc(100dvh - 16px); border-radius: 12px; }
  .pl-bar > label.fld.inline { flex: 1 1 100%; min-width: 0; }
  .pl-bar select { width: 100%; max-width: none; min-width: 0; }
  .pl-arch-toggle { flex: 1 1 100%; min-height: 30px; }
  .pl-banner-acts { width: 100%; }
  .pl-banner-acts .btn { flex: 1; }
  .ex-grid { grid-template-columns: 1fr; }
  .ex-parts th.ex-pic, .ex-parts td.ex-pic { display: none; }
  .ex-parts td.ex-pn { max-width: 84px; }
  .ex-parts th, .ex-parts td { padding-left: 6px; padding-right: 6px; }
  .toast { left: 8px; right: 8px; transform: none; max-width: none; bottom: calc(10px + env(safe-area-inset-bottom)); }
}
/* iPhone on its side: short and wide, so give the picture the height and keep the bars thin */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --topbar-h: 46px; }
  .detail { top: 0; padding-top: env(safe-area-inset-top); }
  .detail-bar { padding: 3px 10px; }
  .detail-body { padding-top: 4px; gap: 4px; }
  #helpBtn { display: none; }
}

/* ---------- folders (issue #222 stage 2): the tree beside the list, a drawer where there is no room ---------- */
.folders { width: 252px; flex: none; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 10px 8px; display: flex; flex-direction: column; gap: 6px; }
.folders[hidden], .crumbs[hidden], .folders-btn[hidden], .pk-new[hidden] { display: none !important; }
.ft-head { display: flex; align-items: center; justify-content: space-between; }
.ft-head h2 { padding: 4px 8px 4px; }
.ft-close, .folders-btn { display: none; }
.ft-err { margin: 0; padding: 0 4px; }
.ft-err:empty { display: none; }
.ft-msg { margin: 2px 6px; line-height: 1.45; }
.ft-msg:empty { display: none; }
.ft-hint { margin: 2px 6px 4px; line-height: 1.45; }
.ft-hint[hidden] { display: none !important; }
.ft-tree { display: flex; flex-direction: column; gap: 1px; }
.ft-row { display: flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 8px 4px calc(4px + (var(--lvl, 1) - 1) * 14px); border-radius: 6px; cursor: pointer; position: relative; outline: none; }
.ft-row:hover { background: var(--panel2); }
.ft-row.sel { background: var(--sel); box-shadow: inset 3px 0 0 var(--accent); }
.ft-row:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.ft-row.ft-edit { cursor: default; }
.ft-row.drop-ok { background: var(--hover); outline: 2px dashed var(--accent); outline-offset: -2px; }
.ft-row.drop-no { opacity: .55; }
.ft-twist { flex: none; width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); border-radius: 4px; }
.ft-twist.has:hover { background: var(--panel3); color: var(--text-hi); }
.ft-twist svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .12s; }
.ft-twist.open svg { transform: rotate(90deg); }
.ft-ico { flex: none; display: inline-flex; color: var(--muted); }
.ft-ico svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ft-ico.project { color: var(--info); }
.ft-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ft-count { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.ft-in { flex: 1; min-width: 0; padding: 3px 6px; }
.crumbs { flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; padding: 6px 14px 2px; }
.crumb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 13px; }
.crumb-list li + li::before { content: "\203A"; color: var(--faint); margin: 0 6px 0 4px; }
.crumb { background: none; border: 0; padding: 2px 4px; border-radius: 4px; color: var(--info); cursor: pointer; font: inherit; }
.crumb:hover { text-decoration: underline; }
.crumb.cur { color: var(--text-hi); font-weight: 600; cursor: default; padding: 2px 4px; }
.crumb-only { color: var(--muted); }
.fold-line { margin: 0 0 8px; }
.pk-list { display: flex; flex-direction: column; gap: 1px; max-height: min(46vh, 360px); overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: var(--input-bg); }
.pk-item { display: flex; align-items: center; text-align: left; background: none; border: 0; border-radius: 5px; padding: 6px 8px 6px calc(8px + (var(--lvl, 1) - 1) * 16px); min-height: 32px; cursor: pointer; color: var(--text); font: inherit; }
.pk-item:hover { background: var(--panel2); }
.pk-item.sel { background: var(--sel); box-shadow: inset 3px 0 0 var(--accent); color: var(--text-hi); }
.pk-item.project .pk-name::before { content: "\25B6\00a0"; color: var(--info); font-size: .8em; }
.pk-item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.pk-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-new { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pk-new input { flex: 1 1 160px; min-width: 0; }
.pk-empty { padding: 8px; margin: 0; }
tr[draggable="true"], .card[draggable="true"] { -webkit-user-drag: element; }
@media (max-width: 1000px) {
  .folders { position: fixed; top: var(--topbar-h); bottom: 0; left: 0; z-index: 15; width: min(84vw, 300px); transform: translateX(-102%); visibility: hidden; transition: transform .15s, visibility 0s .15s; box-shadow: 4px 0 18px var(--shadow); }
  .folders.open { transform: none; visibility: visible; transition-delay: 0s; }
  .folders-btn { display: inline-block; }
  .ft-close { display: inline-flex; }
}
body.split .folders { position: fixed; top: var(--topbar-h); bottom: 0; left: 0; z-index: 30; width: min(84vw, 300px); transform: translateX(-102%); visibility: hidden; transition: transform .15s, visibility 0s .15s; box-shadow: 4px 0 18px var(--shadow); }
body.split .folders.open { transform: none; visibility: visible; transition-delay: 0s; }
body.split .folders-btn { display: inline-block; }
body.split .ft-close { display: inline-flex; }
body.split .crumbs { padding-left: 10px; padding-right: 10px; }
body.one-client .folders { border-left: 0; }
@media (max-width: 640px) {
  .folders { top: calc(var(--topbar-h) + env(safe-area-inset-top)); padding-bottom: env(safe-area-inset-bottom); }
  .crumbs { padding-left: 10px; padding-right: 10px; }
  .ft-row { min-height: 40px; }
  .pk-item { min-height: 42px; }
  .btn.folders-btn { min-height: 34px; }
}

/* ---------- uploader keys (issue #222 stage 3) ---------- */
.uk-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.uk-row { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; background: var(--panel2); }
.uk-row.revoked { opacity: .7; }
.uk-main { flex: 1 1 220px; min-width: 0; }
.uk-label { font-weight: 600; overflow-wrap: anywhere; }
.uk-meta { overflow-wrap: anywhere; }
.uk-confirm { flex-basis: 100%; }
.badge.ok { color: var(--ok-text); border-color: var(--ok-line); }
.uk-create { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; margin: 10px 0 4px; }
.uk-name { flex: 1 1 220px; min-width: 0; }
.uk-secret { border: 2px solid var(--warn-line); background: var(--warn-bg); color: var(--warn-text); border-radius: 8px; padding: 10px 12px; margin: 10px 0 4px; display: flex; flex-direction: column; gap: 8px; }
.uk-secret p { margin: 0; }
.uk-key { width: 100%; box-sizing: border-box; font-family: var(--mono); font-size: 13px; word-break: break-all; resize: none; background: var(--input-bg); color: var(--text); border: 1px solid var(--line2); border-radius: 6px; padding: 8px; }
.uk-secret-b { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.uk-modal .modal-body { overflow-wrap: anywhere; }
.uk-create:empty { display: none; }

/* ---- Erase client (admin only): the trash button on the selected client row, and the dialog ---- */
.client-erase { opacity: 0; background: none; border: 0; color: var(--muted); cursor: pointer; width: 26px; height: 26px; border-radius: 5px; margin-right: 4px; flex: none; }
.client-row.active .client-erase, .client-row:hover .client-erase, .client-erase:focus-visible { opacity: .85; }
.client-erase:hover, .client-erase:focus-visible { color: var(--bad-text); background: var(--bad-bg); opacity: 1; }
.client-erase svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.er-modal { width: min(640px, 100%); }
.er-client { font-size: 17px; text-transform: none; letter-spacing: 0;overflow-wrap: anywhere; }
.er-sum { margin: 2px 0; line-height: 1.5; overflow-wrap: anywhere; }
.er-blocker { margin: 0; }
.er-proxy { border: 1px solid var(--warn-line); background: var(--warn-bg); color: var(--warn-text); border-radius: 6px; padding: 10px 12px; }
.er-proxy .chk { align-items: flex-start; }
.er-proxy .chk input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent-ctl); flex: none; }
.er-proxy-why { margin: 6px 0 0 23px; }
.er-confirm { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.er-type-h { margin: 0; }
.er-namerow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.er-name { flex: 1 1 220px; min-width: 0; background: var(--panel2); border: 1px solid var(--line2); border-radius: 6px; padding: 8px 10px; color: var(--text-hi); user-select: all; -webkit-user-select: all; overflow-wrap: anywhere; white-space: pre-wrap; }
.er-name:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.er-type input { font-family: var(--mono); }
.er-phase { margin: 0; font-size: 15px; font-weight: 600; color: var(--text-hi); }
.er-bar { width: 100%; height: 10px; accent-color: var(--accent-ctl); }
.er-tally { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .client-erase { opacity: .85; width: 32px; height: 32px; }
  .er-modal .modal-foot { flex-wrap: wrap; }
}

/* ---------- one permanent tree for staff: the folders open in place under the client on screen ---------- */
#clients .folders { position: static; transform: none; visibility: visible; transition: none; box-shadow: none; z-index: auto; width: auto; flex: none; overflow: visible; background: none; border: 0; border-left: 1px solid var(--line); padding: 2px 0 8px 4px; margin: 2px 0 6px 16px; }
#clients .ft-head, #clients .ft-close { display: none; }
#clients .ft-row { padding-right: 4px; }
@media (min-width: 1300px) {      /* beside a playing clip there is room to keep it: the list stays put, the monitor takes what is left */
  body.split:not(.list-hidden) { --side-w: 248px; }
  body.split .clients { position: static; transform: none; box-shadow: none; z-index: auto; }
  body.split:not(.list-hidden) .btn.nav-toggle { display: none; }
  body.split:not(.list-hidden) .detail { left: calc(var(--side-w) + var(--list-w)); }
  body.split:not(.list-hidden) .splitter { left: calc(var(--side-w) + var(--list-w) - 5px); }
}

/* ---------- the right-click menu and the row's "..." button ---------- */
.ft-more { flex: none; margin-left: 2px; padding: 0 6px; min-width: 24px; height: 22px; line-height: 20px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 16px; cursor: pointer; }
.ft-more:hover, .ft-more:focus-visible { background: var(--panel3); color: var(--text-hi); }
.client-row.drop-ok { background: var(--hover); outline: 2px dashed var(--accent); outline-offset: -2px; }
.ctx-menu { position: fixed; z-index: 80; min-width: 210px; max-width: 300px; padding: 4px; background: var(--panel); border: 1px solid var(--line2); border-radius: 10px; box-shadow: 0 12px 36px rgba(0,0,0,.45); display: flex; flex-direction: column; gap: 1px; }
.ctx-item { display: flex; align-items: center; justify-content: space-between; gap: 18px; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.ctx-item:hover, .ctx-item:focus-visible { background: var(--hover); outline: none; }
.ctx-item:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.ctx-item.danger { color: var(--bad); }
.ctx-item[aria-disabled="true"] { color: var(--muted); cursor: default; }
.ctx-item[aria-disabled="true"]:hover { background: transparent; }
.ctx-key { color: var(--muted); font-size: 11px; }
.ctx-note { margin: 2px 10px 6px; line-height: 1.4; }
@media (max-width: 640px) { .ft-more { min-width: 36px; height: 32px; } .ctx-item { min-height: 40px; } }
