:root {
  --bg: #0e1015;
  --bg2: #13161d;
  --panel: #181c24;
  --panel2: #1f242e;
  --panel3: #262c38;
  --border: #2b3240;
  --border2: #394152;
  --text: #e9ecf2;
  --muted: #98a1b3;
  --accent: #6c8cff;
  --accent2: #8aa3ff;
  --accent-bg: rgba(108, 140, 255, 0.14);
  --ok: #2bc48a;
  --ok-bg: rgba(43, 196, 138, 0.16);
  --warn: #f5b84a;
  --bad: #ff6b6b;
  --bad-bg: rgba(255, 107, 107, 0.14);
  --keep: #23a874;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Heebo', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
h1 { font-size: 28px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; flex-wrap: wrap; }
.gap { gap: 12px; }
.gap-sm { gap: 6px; }
kbd {
  font-family: inherit; font-size: 11px; font-weight: 600;
  background: var(--panel3); border: 1px solid var(--border2); border-bottom-width: 2px;
  border-radius: 5px; padding: 0 5px; min-width: 18px; display: inline-block; text-align: center; color: var(--muted);
}

/* ---------------------------------------------------------------- icons & buttons */
.ic { width: 18px; height: 18px; fill: currentColor; flex: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  background: var(--panel2); color: var(--text); border: 1px solid var(--border2);
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: var(--panel3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn kbd { margin-inline-start: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--accent2); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger-soft { background: var(--bad-bg); border-color: rgba(255,107,107,.35); color: #ffb3b3; }
.btn-danger-soft:hover { background: rgba(255,107,107,.24); }
.btn-ok { background: var(--ok-bg); border-color: rgba(43,196,138,.4); color: #7ff0c3; }
.btn-ok:hover { background: rgba(43,196,138,.26); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--panel2); color: var(--text); }
.btn-lg { height: 44px; padding: 0 20px; font-size: 16px; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer; font: inherit; font-size: 18px;
}
.icon-btn:hover { background: var(--panel2); color: var(--text); border-color: var(--border); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.sm { width: 26px; height: 26px; font-size: 15px; }
.btn-round {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border2);
  background: var(--panel2); color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.btn-round:hover { background: var(--panel3); }
.btn-round.play { width: 50px; height: 50px; background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-round.play .ic { width: 24px; height: 24px; }

.input {
  height: 36px; padding: 0 11px; border-radius: var(--radius-sm); border: 1px solid var(--border2);
  background: var(--bg2); color: var(--text); font: inherit; min-width: 0;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.input.mini { height: 28px; padding: 0 7px; font-size: 13px; }
select.input { padding-inline-end: 4px; }
input[type=range] { accent-color: var(--accent); flex: 1; min-width: 80px; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }

.badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 99px;
  font-size: 12px; font-weight: 600; background: var(--panel3); color: var(--muted); white-space: nowrap;
}
.conf-ok { background: var(--ok-bg); color: #7ff0c3; }
.conf-warn { background: rgba(245,184,74,.15); color: var(--warn); }
.conf-bad { background: var(--bad-bg); color: #ffb3b3; }
.badge-live { background: var(--accent-bg); color: var(--accent2); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--cam, var(--accent)); display: inline-block; flex: none; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  height: 58px; flex: none; display: flex; align-items: center; gap: 18px; padding: 0 18px;
  background: var(--bg2); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; white-space: nowrap; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), #a26bff); display: grid; place-items: center; }
.brand-mark svg { width: 16px; height: 16px; fill: #fff; }
.topbar-slot { flex: 1; display: flex; align-items: center; gap: 18px; min-width: 0; }
.proj-meta { display: flex; align-items: baseline; gap: 10px; min-width: 0; padding-inline-start: 16px; border-inline-start: 1px solid var(--border); }
.title-input, .client-input { background: transparent; border: 1px solid transparent; color: var(--text); font: inherit; border-radius: 6px; padding: 3px 6px; min-width: 0; }
.title-input { font-weight: 700; font-size: 16px; width: 260px; }
.client-input { color: var(--muted); width: 150px; font-size: 13.5px; }
.title-input:hover, .client-input:hover { border-color: var(--border); }
.title-input:focus, .client-input:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.tabs { display: flex; gap: 4px; margin-inline-start: auto; }
.tab { display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 99px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.tab:hover { background: var(--panel2); color: var(--text); }
.tab.active { background: var(--accent-bg); color: var(--text); }
.tab.disabled { opacity: .4; cursor: not-allowed; }
.tab-n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--panel3); }
.tab.active .tab-n { background: var(--accent); color: #fff; }

#app { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.project-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.page { padding: 28px 32px 48px; max-width: 1400px; width: 100%; margin: 0 auto; overflow: auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head p { margin-top: 6px; }
.search { width: 260px; height: 44px; }
.section-title { display: flex; align-items: center; gap: 10px; font-size: 19px; margin-bottom: 14px; }
.sub-title { font-size: 15px; margin: 26px 0 10px; color: var(--muted); }
.step { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 14px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }

/* ---------------------------------------------------------------- projects */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }
.project-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, transform .15s; }
.project-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.pc-thumb { aspect-ratio: 16 / 9; background: var(--panel2) center / cover no-repeat; display: grid; place-items: center; position: relative; color: var(--border2); }
.pc-thumb .ic { width: 42px; height: 42px; }
.pc-thumb .badge { position: absolute; top: 10px; inset-inline-start: 10px; }
.pc-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.pc-title { font-weight: 700; font-size: 16.5px; }
.pc-client { color: var(--muted); font-size: 13.5px; }
.pc-stats { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.pc-stats span::before { content: '•'; margin-inline-end: 6px; color: var(--border2); }
.pc-stats span:first-child::before { display: none; }
.pc-foot { margin-top: auto; padding-top: 10px; display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.owner-filter { width: auto; }
.empty-state { grid-column: 1 / -1; text-align: center; padding: 70px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty-icon { width: 76px; height: 76px; border-radius: 22px; background: var(--accent-bg); color: var(--accent); display: grid; place-items: center; margin-bottom: 6px; }
.empty-icon .ic { width: 38px; height: 38px; }

/* ---------------------------------------------------------------- upload */
.upload-layout { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; gap: 28px; align-items: start; }
.dropzone {
  border: 2px dashed var(--border2); border-radius: 16px; padding: 34px 22px; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 10px; background: var(--bg2); transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.hover, .dropzone:focus-visible { border-color: var(--accent); background: var(--accent-bg); outline: none; }
.drop-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--accent-bg); color: var(--accent); display: grid; place-items: center; }
.drop-icon .ic { width: 30px; height: 30px; }
.drop-title { font-size: 18px; font-weight: 700; }
.dropzone .muted { max-width: 330px; font-size: 13.5px; }
.file-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.file-row { display: flex; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 9px; }
.file-thumb, .angle-thumb { width: 74px; aspect-ratio: 16/9; border-radius: 6px; overflow: hidden; background: var(--panel2); flex: none; }
.file-thumb img, .angle-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-ph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); }
.file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.file-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: right; }
.file-meta { display: flex; gap: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.file-status { font-size: 12px; color: var(--muted); }
.st-error .file-status { color: var(--bad); }
.st-ready .file-status { color: var(--ok); }
.progress { height: 4px; border-radius: 4px; background: var(--panel3); overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); transition: width .3s; }
.st-ready .progress-bar { background: var(--ok); }
.st-error .progress-bar { background: var(--bad); }
.info-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.info-card.live { justify-content: flex-start; border-color: rgba(108,140,255,.4); }
.info-card.ok { border-color: rgba(43,196,138,.35); }
.info-card.error { border-color: var(--bad); color: #ffb3b3; }
.info-card.small { font-size: 13px; padding: 10px 14px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--accent-bg); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.cams-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cam-chip { display: inline-flex; align-items: center; gap: 7px; background: var(--panel); border: 1px solid var(--border); border-radius: 99px; padding: 3px 12px; }
.cam-chip input { background: transparent; border: none; color: var(--text); font: inherit; font-weight: 600; padding: 3px 0; }
.cam-chip input:focus { outline: none; }
.cam-chip:focus-within { border-color: var(--accent); }
.segments-box { display: flex; flex-direction: column; gap: 12px; }
.seg-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.seg-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.seg-num { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 800; display: grid; place-items: center; flex: none; }
.seg-name { flex: 1; background: transparent; border: 1px solid transparent; color: var(--text); font: inherit; font-weight: 700; font-size: 16px; border-radius: 6px; padding: 3px 6px; }
.seg-name:hover { border-color: var(--border); }
.seg-name:focus { outline: none; border-color: var(--accent); }
.angles { display: flex; flex-direction: column; gap: 8px; }
.angle-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 10px; background: var(--bg2); border-inline-start: 4px solid var(--cam); }
.angle-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.angle-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.offset-ctl { display: inline-flex; align-items: center; gap: 3px; }
.offset-ctl .input { width: 74px; text-align: center; direction: ltr; }

/* ---------------------------------------------------------------- editor */
.editor { flex: 1; min-height: 0; display: grid; grid-template-columns: 250px 1fr; }
.ed-side { background: var(--bg2); border-inline-end: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.side-head { padding: 16px 16px 10px; }
.side-head p { margin-top: 3px; }
.seg-list { flex: 1; overflow: auto; padding: 4px 10px; display: flex; flex-direction: column; gap: 6px; }
.seg-item { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.seg-item:hover { background: var(--panel); }
.seg-item.active { background: var(--accent-bg); border-color: rgba(108,140,255,.45); }
.seg-item.excluded { opacity: .5; }
.seg-thumb { width: 64px; aspect-ratio: 16/9; border-radius: 6px; background: var(--panel3) center / cover; position: relative; flex: none; }
.seg-thumb .seg-num { position: absolute; top: -6px; inset-inline-start: -6px; width: 22px; height: 22px; font-size: 12px; border-radius: 6px; }
.seg-meta { flex: 1; min-width: 0; }
.seg-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cam-dots { display: flex; gap: 4px; margin-top: 3px; }
.cam-dots .dot { width: 8px; height: 8px; }
.seg-actions { display: flex; flex-direction: column; align-items: center; gap: 0; }
.mini-check { display: grid; place-items: center; width: 26px; height: 22px; cursor: pointer; }
.total-box { padding: 14px 16px; border-top: 1px solid var(--border); }
.total-num { font-size: 26px; font-weight: 800; direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }

.ed-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: auto; padding: 14px 18px 30px; gap: 12px; }
.ed-top { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.stage-col { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.ed-main { --stage-h: 52vh; }
.ed-top.portrait { --stage-h: 66vh; }
/* the preview view (scrolls when shown bigger than Fit) and the frame inside it */
.stage-view { width: 100%; max-height: var(--stage-h); overflow: hidden; border-radius: var(--radius); }
.stage-view.zoomed { overflow: auto; border: 1px solid var(--border); background: #05060a; }
.stage-frame { background: #000; border-radius: var(--radius); overflow: hidden; border: 2px solid var(--border); aspect-ratio: 16 / 9; margin: 0 auto; width: calc(min(100%, var(--stage-h) * var(--ratio, 1.7778)) * var(--view-zoom, 1)); max-width: none; transition: border-color .15s, box-shadow .15s; box-sizing: border-box; }
.stage-view.zoomed .stage-frame { border-radius: 0; }
.stage-frame .stage { cursor: pointer; }
.stage-frame.armed { border-color: var(--ok); box-shadow: 0 0 0 3px rgba(43,196,138,.25); }
.stage-frame.armed .stage { cursor: grab; }
.stage { position: relative; width: 100%; height: 100%; overflow: hidden; background: #000; cursor: grab; user-select: none; touch-action: none; }
.stage.dragging { cursor: grabbing; }
.stage-video { position: absolute; object-fit: fill; pointer-events: none; }
.stage-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.slot-box { position: absolute; border: 2px solid transparent; transition: border-color .12s; }
.slot-box.hover { border-color: var(--cam); }
.slot-tag { position: absolute; top: 8px; inset-inline-start: 8px; background: rgba(0,0,0,.6); border-inline-start: 3px solid var(--cam); color: #fff; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 4px; }
.slot-hint { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.65); color: #fff; font-size: 12.5px; padding: 4px 10px; border-radius: 99px; display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.slot-hint .ic { width: 14px; height: 14px; }
.slot-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; text-align: center; padding: 10px; }
.stage-msg { position: absolute; inset: 0; z-index: 3; display: none; place-items: center; background: repeating-linear-gradient(-45deg, rgba(10,12,16,.55) 0 14px, rgba(10,12,16,.72) 14px 28px); color: #ffd0d0; font-weight: 700; font-size: 18px; pointer-events: none; }
.stage-msg.show { display: grid; }
.transport { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.time-label { font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 600; margin-inline-start: 6px; }
.save-state { font-size: 12.5px; color: var(--muted); }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-ui { width: 36px; height: 20px; border-radius: 99px; background: var(--panel3); position: relative; transition: background .15s; flex: none; }
.toggle-ui::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: inset-inline-start .15s; }
.toggle input:checked + .toggle-ui { background: var(--ok); }
.toggle input:checked + .toggle-ui::after { inset-inline-start: 19px; }
.toggle input:focus-visible + .toggle-ui { outline: 2px solid var(--accent); }

.inspector { display: flex; flex-direction: column; gap: 10px; max-height: calc(var(--stage-h) + 70px); overflow: auto; }
.insp-sec { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.insp-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 700; font-size: 14px; }
.keep-state { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13.5px; padding: 8px 10px; border-radius: 8px; }
.keep-state.in { background: var(--ok-bg); }
.keep-state.out { background: var(--bad-bg); }
.layout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.layout-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 6px; border-radius: 9px;
  background: var(--bg2); border: 1.5px solid var(--border); color: var(--text); cursor: pointer; font: inherit; position: relative;
}
.layout-btn:hover { border-color: var(--border2); background: var(--panel2); }
.layout-btn.active { border-color: var(--accent); background: var(--accent-bg); }
.layout-btn .layout-name { font-weight: 600; font-size: 13px; }
.layout-btn .muted.small { font-size: 11px; }
.layout-btn kbd { position: absolute; top: 4px; inset-inline-end: 4px; font-size: 10px; }
.layout-ico { width: 40px; height: 23px; border-radius: 4px; overflow: hidden; display: flex; gap: 2px; background: #000; border: 1px solid var(--border2); }
.layout-ico span { flex: 1; }
.seg-ctl { display: flex; background: var(--bg2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 3px; }
.seg-ctl-btn { flex: 1; height: 28px; border: none; border-radius: 6px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.seg-ctl-btn.active { background: var(--panel3); color: var(--text); font-weight: 600; }
.frame-row { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-radius: 8px; background: var(--bg2); border-inline-start: 3px solid var(--cam); }
.frame-head { display: flex; align-items: center; gap: 7px; font-size: 13.5px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
.tool-group { display: flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 8px; flex-wrap: wrap; }
.tool-group.end { margin-inline-start: auto; }
.tool-label { font-size: 12px; color: var(--muted); font-weight: 600; margin-inline-end: 4px; }
.tool-group .layout-btn { flex-direction: row; padding: 4px 8px; padding-inline-end: 30px; gap: 7px; }
.tool-group .layout-btn .muted.small { display: none; }
.tool-group .layout-ico { width: 28px; height: 16px; }
.tool-group .layout-btn kbd { top: 50%; transform: translateY(-50%); }
.sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 4px; }

/* timeline (always left-to-right) */
.timeline { display: flex; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; user-select: none; flex: none; }
.tl-side { width: 96px; flex: none; border-right: 1px solid var(--border); background: var(--bg2); direction: rtl; }
.side-ruler { height: 26px; border-bottom: 1px solid var(--border); }
.side-lane { height: 58px; display: flex; align-items: center; padding: 0 10px; font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--border); }
.side-lane.cam { height: 40px; }
.side-lane.keep { color: #7ff0c3; }
.side-cover { padding: 3px 8px; }
.cover-name { height: 12px; font-size: 10.5px; display: flex; align-items: center; gap: 4px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.cover-name .dot { width: 6px; height: 6px; }
.tl-scroll { flex: 1; overflow-x: auto; overflow-y: hidden; position: relative; }
.tl-inner { position: relative; cursor: text; }
.ruler { height: 26px; position: relative; border-bottom: 1px solid var(--border); background: var(--bg2); }
.tick { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--border2); }
.tick span { position: absolute; top: 5px; left: 5px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lane { position: relative; border-bottom: 1px solid var(--border); }
.lane-keep { height: 58px; }
.lane-cam { height: 40px; }
.lane-cover { position: relative; }
.piece { position: absolute; top: 4px; bottom: 4px; border-radius: 6px; overflow: hidden; display: flex; align-items: flex-end; }
.piece-label { font-size: 11.5px; font-weight: 700; padding: 2px 7px; white-space: nowrap; color: rgba(255,255,255,.95); text-shadow: 0 1px 2px rgba(0,0,0,.5); position: relative; z-index: 1; }
.piece.keep { background: linear-gradient(180deg, #2bc48a, #1d9668); box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.piece.drop { background: repeating-linear-gradient(-45deg, #2a2f3b 0 6px, #22262f 6px 12px); box-shadow: inset 0 0 0 1px var(--border2); }
.piece.drop .piece-label { color: var(--muted); text-shadow: none; }
.piece.cam { background: var(--a); align-items: center; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.piece.cam.split { background: linear-gradient(180deg, var(--a) 0 50%, var(--b) 50% 100%); }
.dim { position: absolute; top: 0; bottom: 0; background: rgba(14,16,21,.72); pointer-events: none; z-index: 1; }

.handle { position: absolute; top: 0; bottom: 0; width: 12px; margin-left: -6px; cursor: ew-resize; z-index: 3; display: flex; justify-content: center; }
.handle::before { content: ''; width: 3px; height: 100%; background: #fff; border-radius: 2px; opacity: .75; box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
.handle:hover::before { opacity: 1; background: var(--warn); }
.handle-x { position: absolute; top: -2px; width: 17px; height: 17px; border-radius: 50%; border: none; background: var(--bad); color: #fff; font-size: 12px; line-height: 1; cursor: pointer; display: none; padding: 0; }
.handle:hover .handle-x { display: block; }
.cover-bar { position: absolute; height: 7px; border-radius: 4px; opacity: .85; }
.playhead { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #ff4d5e; z-index: 4; pointer-events: none; }
.playhead-cap { position: absolute; top: 0; left: -6px; width: 14px; height: 14px; background: #ff4d5e; clip-path: polygon(0 0, 100% 0, 50% 100%); }

.tables > .btn { margin-bottom: 8px; }
.tables-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.tables-grid h4 { margin-bottom: 8px; font-size: 14px; color: var(--muted); }
.tbl { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; font-size: 13.5px; }
.tbl th { text-align: start; font-weight: 600; color: var(--muted); font-size: 12px; padding: 8px 10px; background: var(--bg2); border-bottom: 1px solid var(--border); }
.tbl td { padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl .input.mini { width: 92px; text-align: center; }
.row-drop td { opacity: .6; }

/* ---------------------------------------------------------------- versions & export */
.versions-layout { display: grid; grid-template-columns: 1fr 1.15fr; gap: 30px; align-items: start; }
.save-version { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.save-version .input { flex: 1; min-width: 140px; }
.version-list { display: flex; flex-direction: column; gap: 10px; }
.version { display: flex; flex-direction: column; gap: 10px; }
.version.selected { border-color: var(--accent); }
.version-head { display: flex; gap: 12px; align-items: flex-start; }
.version-num { background: var(--accent-bg); color: var(--accent2); font-weight: 800; border-radius: 8px; padding: 4px 9px; font-size: 14px; }
.version-name { font-weight: 700; }
.export-box .card { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.format-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.format-card { border: 1.5px solid var(--border); border-radius: 10px; padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 5px; background: var(--bg2); position: relative; }
.format-card:hover { border-color: var(--border2); }
.format-card.active { border-color: var(--accent); background: var(--accent-bg); }
.format-card input { position: absolute; opacity: 0; }
.format-title { font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.format-ext { font-size: 12px; color: var(--accent2); direction: ltr; text-align: right; }
.export-options { display: flex; flex-direction: column; gap: 10px; }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { margin-top: 4px; }
.howto summary { cursor: pointer; color: var(--accent2); font-weight: 600; }
.howto ul { margin: 10px 0 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--muted); }
.howto b { color: var(--text); }

/* ---------------------------------------------------------------- modal & toasts */
.overlay { position: fixed; inset: 0; background: rgba(5,7,10,.65); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--panel); border: 1px solid var(--border2); border-radius: 16px; width: min(440px, 100%); box-shadow: var(--shadow); max-height: 90vh; display: flex; flex-direction: column; }
.modal-wide { width: min(720px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 6px; }
.modal-body { padding: 10px 18px; overflow: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--muted); }
.help ol { padding-inline-start: 20px; display: flex; flex-direction: column; gap: 10px; margin: 0 0 16px; }
.help .chip { padding: 1px 7px; border-radius: 4px; font-size: 12.5px; font-weight: 600; }
.chip.keep { background: var(--keep); color: #fff; }
.chip.drop { background: repeating-linear-gradient(-45deg, #2a2f3b 0 5px, #22262f 5px 10px); border: 1px solid var(--border2); }
.kbd-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; font-size: 13.5px; color: var(--muted); background: var(--bg2); padding: 12px 14px; border-radius: 10px; }
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: center; }
.toast { background: var(--panel3); border: 1px solid var(--border2); padding: 10px 18px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 500; transition: opacity .4s, transform .4s; }
.toast-ok { border-color: rgba(43,196,138,.6); }
.toast-error { border-color: var(--bad); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .ed-top { grid-template-columns: 1fr; }
  .inspector { max-height: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .tables-grid, .versions-layout { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 16px; }
  .topbar-slot { flex-wrap: wrap; }
  .tabs { margin-inline-start: 0; overflow-x: auto; }
  .proj-meta { border: none; padding: 0; }
  .page { padding: 18px 16px 40px; }
  .upload-layout { grid-template-columns: 1fr; }
  .editor { grid-template-columns: 1fr; }
  .ed-side { border: none; border-bottom: 1px solid var(--border); max-height: 220px; }
  .ed-main { padding: 12px 16px 30px; }
  .format-grid { grid-template-columns: 1fr; }
  .search { width: 100%; }
}

/* ---------------------------------------------------------------- timelines (YouTube / story / reels) */
.tl-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 7px 10px; }
.tl-chip { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border2); background: var(--bg2); font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.tl-chip:hover { border-color: var(--accent); }
.tl-chip.active { background: var(--accent-bg); border-color: var(--accent); }
.aspect-ico { display: inline-block; border: 2px solid currentColor; border-radius: 3px; flex: none; opacity: .85; }
.tl-chip.active .aspect-ico { color: var(--accent2); }
.aspect-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.aspect-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--bg2); color: var(--text); font: inherit; cursor: pointer; text-align: center; }
.aspect-card:hover { border-color: var(--border2); }
.aspect-card.active { border-color: var(--accent); background: var(--accent-bg); }
.aspect-box { height: 28px; display: grid; place-items: center; }
.aspect-box .aspect-ico { transform: scale(1.4); }
.layout-ico.vertical { width: 16px; height: 28px; flex-direction: column; }
.tool-group .layout-ico.vertical { width: 11px; height: 19px; }
.story-hint { margin: 0; justify-content: flex-start; border-color: rgba(108,140,255,.4); }
.warn-text { color: var(--warn); }
@media (max-width: 860px) { .aspect-grid { grid-template-columns: 1fr 1fr; } }

/* ---------------------------------------------------------------- notes, submissions */
.note-flag { position: absolute; top: 1px; transform: translateX(-50%); z-index: 5; border: none; background: #f5b84a; border-radius: 6px 6px 6px 0; width: 22px; height: 22px; font-size: 12px; line-height: 22px; padding: 0; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.note-flag:hover { transform: translateX(-50%) scale(1.15); }
.note-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.note-row:last-child { border-bottom: none; }
.note-input { height: auto; padding: 9px 11px; resize: vertical; font: inherit; }
.badge-submitted { background: rgba(43,196,138,.9); color: #062b1c; }
.pc-thumb .badge-submitted { top: auto; bottom: 10px; }
.info-card.submission { border-color: var(--ok); background: var(--ok-bg); }
.pc-tls { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip-tl { font-size: 11.5px; background: var(--panel3); border-radius: 99px; padding: 1px 8px; color: var(--muted); }

/* ---------------------------------------------------------------- picture / sound tracks */
.lane-group, .side-group { height: 20px; border-bottom: 1px solid var(--border); background: var(--bg); }
.side-group { display: flex; align-items: center; padding: 0 10px; font-size: 11px; font-weight: 800; letter-spacing: .5px; color: var(--muted); }
.lane-video { height: 40px; }
.lane-audio { height: 44px; }
.side-lane.track { height: 40px; gap: 6px; font-size: 12px; font-weight: 600; border-inline-start: 3px solid var(--cam); padding: 0 8px; }
.side-lane.track.audio { height: 44px; }
.side-lane.track.audio.active { background: color-mix(in srgb, var(--cam) 14%, transparent); }
.trk-id { font-size: 10px; font-weight: 800; color: var(--muted); background: var(--panel3); border-radius: 4px; padding: 1px 4px; }
.trk-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trk-use { border: 1px solid var(--border2); background: var(--panel2); border-radius: 6px; width: 26px; height: 24px; cursor: pointer; font-size: 13px; padding: 0; }
.trk-use.on { border-color: var(--ok); background: var(--ok-bg); }
.trk-use:disabled { opacity: .35; cursor: default; }
.tl-side { width: 168px; }
.clip-block { position: absolute; top: 2px; bottom: 2px; border-radius: 5px; background: color-mix(in srgb, var(--cam) 18%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cam) 60%, transparent); }
.lane-audio.active .clip-block { background: color-mix(in srgb, var(--cam) 26%, transparent); }
.lane-canvas { position: absolute; top: 0; pointer-events: none; z-index: 1; }
.off-air { position: absolute; top: 0; bottom: 0; background: rgba(14,16,21,.66); pointer-events: none; z-index: 2; }
.lane-msg { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 12px; font-size: 12px; color: var(--muted); z-index: 3; pointer-events: none; }
.spinner.sm { width: 12px; height: 12px; border-width: 2px; display: inline-block; vertical-align: middle; }
.mix-row { margin-top: 8px; padding: 6px 10px; border-radius: 8px; background: var(--bg2); }

/* ---------------------------------------------------------------- speakers */
.speakers-box { margin-bottom: 16px; }
.card.speakers { display: flex; flex-direction: column; gap: 12px; border-color: rgba(108,140,255,.45); }
.card.speakers .section-title { margin: 0; font-size: 17px; }
.speaker-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.speaker-card { background: var(--bg2); border: 1px solid var(--border); border-inline-start: 4px solid var(--cam); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.speaker-head { display: flex; align-items: center; gap: 8px; }
.speaker-dot { width: 30px; height: 30px; border-radius: 50%; background: var(--cam); color: #fff; font-weight: 800; display: grid; place-items: center; flex: none; }
.speaker-name { flex: 1; font-weight: 700; }
.speaker-row { display: flex; align-items: flex-end; gap: 8px; }
.speaker-row .input { width: 100%; }
.speaker-thumb { width: 64px; aspect-ratio: 16/9; border-radius: 6px; overflow: hidden; background: var(--panel3); display: grid; place-items: center; flex: none; color: var(--muted); }
.speaker-thumb img { width: 100%; height: 100%; object-fit: cover; }
.listen-btn { width: 64px; flex: none; padding: 0 4px; }
.auto-opts { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--bg2); }

.no-sound { position: absolute; top: 0; bottom: 0; z-index: 2; background: repeating-linear-gradient(-45deg, rgba(120,128,145,.55) 0 5px, rgba(60,66,80,.65) 5px 10px); display: flex; align-items: flex-start; overflow: hidden; }
.no-sound span { font-size: 10.5px; font-weight: 700; padding: 2px 5px; color: #fff; white-space: nowrap; text-shadow: 0 1px 2px #000; }
.lane-audio, .lane-video { background: repeating-linear-gradient(-45deg, rgba(255,255,255,.035) 0 6px, transparent 6px 12px); }
.pos-row input[type=range] { min-width: 60px; }
.pos-label { min-width: 74px; text-align: center; }
.pos-val { width: 26px; text-align: center; }

.speed-row .seg-ctl { width: auto; }
.speed-row .seg-ctl-btn { padding: 0 12px; }
.toast-info { border-color: var(--warn); }

/* ---- per-moment sound + timeline tools */
.lane-psound { height: 34px; }
.side-lane.psound { height: 34px; font-size: 12.5px; color: #cfd6e4; }
.piece.snd { background: color-mix(in srgb, var(--a) 70%, #12151b); align-items: center; box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); }
.piece.snd.mute { background: repeating-linear-gradient(-45deg, #2a2f3b 0 6px, #22262f 6px 12px); box-shadow: inset 0 0 0 1px var(--border2); }
.piece.snd.mute .piece-label { color: var(--muted); text-shadow: none; }
.cut-line { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: rgba(255,255,255,.55); z-index: 3; pointer-events: none; }
.tl-hover { position: absolute; display: none; pointer-events: none; z-index: 5; }
.tl-hover.select { border-radius: 6px; box-shadow: inset 0 0 0 2px #fff; background: rgba(255,255,255,.08); }
.tl-hover.blade { border-left: 2px dashed #ffd23f; margin-left: -1px; }
.tl-hover.erase { width: 0; border-left: 4px solid var(--bad); margin-left: -2px; box-shadow: 0 0 10px var(--bad); }
.tl-hint { position: absolute; display: none; z-index: 6; pointer-events: none; white-space: nowrap; font-size: 11.5px; padding: 3px 8px; border-radius: 6px; background: rgba(10,12,16,.92); color: var(--muted); border: 1px solid var(--border2); direction: rtl; }
.tl-hint.actionable { color: #fff; border-color: var(--accent); }
.tl-inner[data-tool=blade] .lane:not(.lane-group) { cursor: crosshair; }
.tl-inner[data-tool=erase] .lane:not(.lane-group) { cursor: pointer; }
.tl-inner[data-tool=select] .lane:not(.lane-group) { cursor: default; }
.tl-inner[data-tool=erase] .handle { cursor: pointer; }
.tool-btn.active { background: var(--accent-bg); border-color: var(--accent); color: #fff; }
.tool-ico { font-size: 14px; line-height: 1; }
.mic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 6px; }
.mic-btn { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--border2); background: var(--panel2); color: var(--text); cursor: pointer; text-align: start; font: inherit; font-size: 12.5px; }
.mic-btn.active { border-color: var(--cam, var(--accent)); background: color-mix(in srgb, var(--cam, var(--accent)) 20%, transparent); }
.mic-btn.mute.active { border-color: var(--border2); background: var(--panel3); }
.mic-name { font-weight: 700; }
.channel-note { font-size: 11.5px; }
.channels-box { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 14px; padding: 10px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--border2); }
.channel-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.channel-row.same { opacity: .7; }

/* tools: the active one is unmistakable */
.tool-btn.active { background: var(--ok); border-color: var(--ok); color: #06140e; font-weight: 800; box-shadow: 0 0 0 3px rgba(43,196,138,.3); }
.tool-btn.active kbd { background: rgba(0,0,0,.18); color: #06140e; border-color: transparent; }
.rot-group { flex-wrap: wrap; }
.rot-btn { position: relative; opacity: .5; }
.rot-btn.in-rot { opacity: 1; border-color: var(--ok); }
.rot-num { position: absolute; top: -6px; inset-inline-start: -6px; width: 17px; height: 17px; border-radius: 50%; background: var(--ok); color: #06140e; font-size: 10.5px; font-weight: 800; display: grid; place-items: center; }
.tl-zoom { width: 120px; min-width: 80px; flex: none; }
.handle { pointer-events: none; }
.handle-x { display: none !important; }
.tl-inner.on-cut .lane:not(.lane-group) { cursor: ew-resize !important; }
.tl-hover.cut { width: 0; border-left: 4px solid var(--warn); margin-left: -2px; box-shadow: 0 0 10px var(--warn); }
.view-zoom .view-zoom-val { min-width: 38px; text-align: center; }
.mix-wait { margin-inline-start: 6px; font-weight: 400; }

/* ------------------------------------------------------------------ subtitles step */
.subs-editor .ed-top { grid-template-columns: minmax(0, 1fr) minmax(360px, 460px); }
.subs-editor .ed-top.portrait { grid-template-columns: minmax(0, 1fr) minmax(360px, 560px); }
.sub-panel { display: flex; flex-direction: column; gap: 10px; max-height: calc(var(--stage-h) + 70px); min-height: 0; }
.cue-pane { display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: 1; }
.cue-pane .cue-list { overflow: auto; min-height: 0; flex: 1; padding-inline-end: 2px; }
.sub-layer { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.sub-box { position: absolute; text-align: center; unicode-bidi: isolate; direction: rtl; white-space: normal; }
.sub-box .sub-line { display: inline; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.sub-style { display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.sub-style h4 { margin-bottom: 2px; }
.color-in { width: 34px; height: 26px; padding: 0; border: 1px solid var(--border2); border-radius: 6px; background: none; cursor: pointer; }
.sub-cta { border-color: rgba(108,140,255,.45); background: var(--accent-bg); }
.cue-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cue-list { display: flex; flex-direction: column; gap: 6px; }
.cue { display: grid; grid-template-columns: 82px minmax(0, 1fr) auto; gap: 10px; align-items: start; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.cue.current { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(108,140,255,.25); background: #1b2133; }
.cue.cut { opacity: .45; }
.cue.partial { border-inline-start: 3px solid var(--warn); }
.cue-side { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.cue-time { background: none; border: none; color: var(--accent2); font: inherit; font-size: 13px; cursor: pointer; padding: 0; }
.cue-time:hover { text-decoration: underline; }
.cue-nudge { display: flex; gap: 2px; }
.cue-nudge .nb { width: 24px; height: 20px; border-radius: 5px; border: 1px solid var(--border2); background: var(--bg2); color: var(--muted); font-size: 12px; line-height: 1; cursor: pointer; padding: 0; }
.cue-nudge .nb:hover { color: var(--text); border-color: var(--accent); }
.cue-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cue-text { width: 100%; resize: none; overflow: hidden; background: var(--bg2); color: var(--text); border: 1px solid var(--border); border-radius: 7px; padding: 6px 9px; font: inherit; font-size: 16px; line-height: 1.5; unicode-bidi: plaintext; }
.cue-text:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.cue-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cue-spk { border: none; border-radius: 99px; padding: 1px 9px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; background: color-mix(in srgb, var(--c) 25%, transparent); color: var(--text); border-inline-start: 3px solid var(--c); }
.cue-len { color: var(--muted); }
.cue-actions { display: flex; flex-direction: column; gap: 3px; }
.inspector.sub-panel { overflow: hidden; display: flex; }
@media (max-width: 1100px) {
  .subs-editor .ed-top, .subs-editor .ed-top.portrait { grid-template-columns: 1fr; }
  .inspector.sub-panel { max-height: 70vh; }
}

/* toolbar in rows: helpers on top, the timeline tools below (big), the rotation under the select tool */
.toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
.tool-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tool-row .tool-group.end { margin-inline-start: auto; }
.tools-main { gap: 10px; padding: 2px 0; }
.tool-btn.big { font-size: 16px; padding: 10px 22px; border-radius: 12px; min-width: 150px; justify-content: center; }
.tool-btn.big .tool-ico { font-size: 20px; }
.rot-row { background: var(--panel); border: 1px solid var(--ok); border-radius: var(--radius); padding: 6px 10px; margin-inline-start: 24px; }

/* Mekadmim brand */
.brand-logo { height: 26px; width: auto; display: block; }
.brand-name { font-weight: 700; }
.brand-name b { font-weight: 800; background: linear-gradient(180deg, #3FA2C0, #7EE8C1); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Mekadmim podcast package: export card, load block, raw files */
.package-card, .load-block { display: flex; align-items: center; gap: 16px; padding: 16px 18px; margin-bottom: 18px;
  border: 1.5px solid rgba(126,232,193,.45); background: linear-gradient(90deg, rgba(63,162,192,.14), rgba(126,232,193,.07)); }
.load-block.drag { border-style: dashed; border-color: #7EE8C1; background: rgba(126,232,193,.16); }
.package-logo { height: 46px; width: auto; flex: none; }
.package-title { margin: 0 0 4px; font-size: 17px; }
.package-card p, .load-block p { margin: 2px 0; }
.package-btn { white-space: nowrap; }
.load-status { margin-top: 6px; }
.raw-box { margin-bottom: 18px; }
.raw-card { border: 1.5px solid rgba(126,232,193,.45); }
.raw-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 12px; }
.raw-list { display: flex; flex-direction: column; gap: 8px; }
.raw-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg2); }
.raw-row.ok { border-color: rgba(43,196,138,.5); }
.raw-row.bad { border-color: rgba(255,107,107,.6); }
.raw-icon { width: 30px; height: 30px; display: grid; place-items: center; flex: none; font-weight: 800; color: var(--ok); }
.raw-facts { margin: 2px 0; }
.raw-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 300px; }
.raw-path { width: 230px; font-size: 12px; }
.raw-done { display: flex; align-items: center; gap: 10px; }
.ok-text { color: #7ff0c3; }
.bad-text { color: var(--bad); }

/* ---- linking files from this computer (no copy) */
.link-btn { width: 100%; justify-content: center; margin-top: 10px; }
.link-hint { margin: 4px 2px 10px; }
.link-badge { margin-inline-start: 8px; font-size: 11px; background: rgba(108,140,255,.16); color: #b9c8ff; }
.link-dialog { display: flex; flex-direction: column; gap: 10px; }
.fs-bar { align-items: center; }
.fs-crumb { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; text-align: left; }
.fs-list { height: 340px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--bg2); padding: 4px; }
.fs-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border-radius: 7px; border: 0; background: transparent; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.fs-row:hover { background: var(--panel2); }
.fs-row.on { background: var(--accent-bg); }
.fs-ic { width: 22px; text-align: center; }

/* ---- sign-in, user menu, users page */
.login-page { display: grid; place-items: center; min-height: calc(100vh - 140px); }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 30px 28px; text-align: center; }
.login-card h1 { font-size: 21px; margin: 0; }
.login-card .muted { margin: -6px 0 4px; }
.login-card .field { display: flex; flex-direction: column; gap: 5px; text-align: start; font-size: 13.5px; }
.login-logo { width: 64px; height: 64px; margin: 0 auto; }
.login-err { color: var(--bad); font-size: 13.5px; min-height: 18px; }
.user-slot { flex: none; }
.user-menu { position: relative; }
.user-btn { gap: 8px; }
.user-dot { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--accent-bg); color: var(--accent); font-weight: 800; font-size: 13px; }
.user-pop { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 50; min-width: 200px; background: var(--panel); border: 1px solid var(--border2); border-radius: 10px; padding: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.4); display: flex; flex-direction: column; }
.user-pop[hidden] { display: none; }
.user-pop-head { padding: 6px 10px; }
.user-pop-item { display: block; text-align: start; padding: 8px 10px; border-radius: 7px; border: 0; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.user-pop-item:hover { background: var(--panel2); }
.users-table { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.users-row { display: grid; grid-template-columns: 2fr 1.6fr .8fr 1fr auto; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); }
.users-row:first-child { border-top: 0; }
.users-row.head { background: var(--panel2); font-size: 12.5px; color: var(--muted); font-weight: 600; }
.users-row .badge { margin-inline-start: 6px; }
.warn-text { color: #ffcf70; }
.pc-owner { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.pc-owner .user-dot { width: 20px; height: 20px; font-size: 11px; }

/* ---- sound tracks feeding the general sound (on / off, whole or in parts) */
.trk-mute { margin-inline-start: auto; border: 1px solid var(--border2); background: var(--panel2); border-radius: 6px; width: 28px; height: 24px; cursor: pointer; font-size: 13px; padding: 0; flex: none; }
.trk-mute.on { border-color: var(--ok); background: var(--ok-bg); }
.trk-mute.part { border-color: var(--warn); }
.side-lane.track.audio.trk-off .trk-name { opacity: .5; text-decoration: line-through; }
.off-air.track-off { display: flex; align-items: center; padding-inline-start: 6px; overflow: hidden; }
.off-air.track-off span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.side-lane.psound.warn { color: var(--warn); }
.manual-preview { max-height: 160px; overflow: auto; display: flex; flex-direction: column; gap: 3px; }
.rot-row.rot-hidden { visibility: hidden; }

/* ---- manual cut: a small timeline of the segment with a draggable range */
.mc-dialog { gap: 14px; }
.mc-wrap { padding: 10px 12px 0; }
.mc-track { position: relative; height: 46px; border-radius: 8px; background: var(--bg2); border: 1px solid var(--border2); cursor: pointer; touch-action: none; user-select: none; }
.mc-piece { position: absolute; top: 6px; bottom: 6px; }
.mc-piece.keep { background: rgba(43,196,138,.35); }
.mc-piece.drop { background: repeating-linear-gradient(-45deg, #2a2f3b 0 6px, #22262f 6px 12px); }
.mc-range { position: absolute; top: 0; bottom: 0; background: rgba(255,107,107,.28); box-shadow: inset 0 0 0 2px var(--bad); border-radius: 4px; cursor: grab; }
.mc-handle { position: absolute; top: -6px; bottom: -6px; width: 14px; margin-left: -7px; border-radius: 5px; background: var(--bad); cursor: ew-resize; box-shadow: 0 0 0 2px var(--bg); }
.mc-handle::after { content: ''; position: absolute; left: 6px; top: 12px; bottom: 12px; width: 2px; background: rgba(255,255,255,.7); }
.mc-handle:focus-visible { outline: 2px solid #fff; }
.mc-ticks { position: relative; height: 18px; font-size: 11px; color: var(--muted); }
.mc-ticks span { position: absolute; transform: translateX(-50%); top: 3px; white-space: nowrap; }
.mc-fields { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mc-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.mc-time { width: 110px; text-align: center; }
.mc-len { font-size: 13px; color: var(--bad); font-weight: 600; padding-bottom: 8px; }

/* ---- notes on the timeline: 📝 above the tracks, a card on hover (edit / delete / jump) */
.tool-btn.big.note-add { min-width: 0; background: rgba(245,184,74,.12); border-color: rgba(245,184,74,.45); }
.tool-btn.big.note-add:hover { background: rgba(245,184,74,.22); }
.tools-main .sep { width: 1px; align-self: stretch; background: var(--border2); margin: 0 4px; }
.note-line { position: absolute; top: 26px; bottom: 0; width: 0; border-left: 1px dashed rgba(245,184,74,.75); pointer-events: none; z-index: 4; }
.note-pop { position: fixed; z-index: 200; width: 300px; background: var(--panel); border: 1px solid rgba(245,184,74,.6); border-radius: 12px; padding: 10px 12px; box-shadow: 0 12px 32px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 8px; }
.note-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.note-pop-time { font-size: 12.5px; font-weight: 700; color: #ffcf70; }
.note-pop-text { white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.45; max-height: 180px; overflow: auto; }
.note-pop-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.note-pop-tinput { width: 96px; height: 28px; font-size: 12px; text-align: center; }
.pc-owner[title] { cursor: pointer; } .pc-owner:hover { color: var(--text); }

/* ---- admin: activity log */
.act-bar { margin-bottom: 12px; flex-wrap: wrap; }
.act-filter { width: auto; }
.act-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.act-row { display: grid; grid-template-columns: 150px 1.2fr 1.6fr 2.4fr 130px; gap: 12px; align-items: center; padding: 8px 14px; border-top: 1px solid var(--border); border-inline-start: 3px solid transparent; }
.act-row:first-child { border-top: 0; }
.act-row.head { background: var(--panel2); font-size: 12.5px; color: var(--muted); font-weight: 600; }
.act-row.k-bad { border-inline-start-color: var(--bad); background: rgba(255,107,107,.06); }
.act-row.k-good { border-inline-start-color: var(--ok); background: rgba(43,196,138,.06); }
.act-row.k-auth { border-inline-start-color: var(--accent); }
.act-row.script { opacity: .55; }
.act-row .badge { margin-inline-start: 6px; }
@media (max-width: 800px) { .act-row { grid-template-columns: 1fr 1fr; } .act-row.head { display: none; } }

/* ---- editor locked while the general sound is rebuilt */
.overlay.mix-lock { z-index: 300; cursor: progress; }
.mix-lock-box { max-width: 460px; display: flex; flex-direction: column; gap: 12px; padding: 22px 24px; }
.mix-lock-head { display: flex; align-items: center; gap: 12px; }
.mix-lock-head h3 { margin: 0; font-size: 18px; }
.mix-lock-progress { height: 10px; }
.mix-lock-pct { font-weight: 700; color: var(--accent); min-width: 44px; }

/* ------------------------------------------------------------------ cloud edit site */
/* an action this user may not use: still shown, greyed out, explains itself */
.perm-off, .perm-off:hover { opacity: .42; filter: grayscale(.7); cursor: not-allowed !important; }
.tab.perm-off { opacity: .42; }
.home-note { background: var(--panel2); border: 1px dashed var(--border2); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 12px; color: var(--muted); }
.chip.view-only { background: var(--panel3); color: var(--warn); padding: 3px 10px; border-radius: 999px; font-size: 13px; }
.view-as-bar { background: #3a2f12; color: #ffd98a; padding: 8px 16px; display: flex; gap: 12px; align-items: center; justify-content: center; font-size: 14px; border-bottom: 1px solid #6b5420; }
.login-note { background: var(--ok-bg); color: #7ff0c3; border-radius: var(--radius-sm); padding: 8px 12px; }

/* saving state in the editor */
.save-state.saving { color: var(--muted); }
.save-state.ok { color: var(--ok); }
.save-state.dirty { color: var(--warn); }
.save-state.offline { color: var(--warn); font-weight: 600; }
.save-state.err { color: var(--bad); font-weight: 600; }

/* project page: status strip, presence warning, messages */
.proj-extra { flex: none; white-space: nowrap; }
.proj-extra .btn { white-space: nowrap; }
.cloud-on { border-color: var(--accent); }
.cloud-panel .cloud-actions { flex-wrap: wrap; }
.ok-text { color: var(--ok); }
.proj-strip { margin: 12px 20px 0; padding: 10px 14px; border-radius: var(--radius-sm); display: flex; gap: 12px; align-items: center; font-size: 14px; }
.proj-strip.submitted { background: var(--ok-bg); color: #9ff3d1; }
.proj-strip.done { background: var(--panel3); color: var(--muted); }
.proj-strip.locked { background: rgba(245, 184, 74, .14); color: var(--warn); border: 1px solid rgba(245, 184, 74, .35); }
.proj-strip.locked span { flex: 1; }
.proj-strip[hidden] { display: none; }
.presence-bar { background: rgba(245, 184, 74, .14); color: var(--warn); border: 1px solid rgba(245, 184, 74, .35); border-radius: var(--radius-sm); padding: 8px 12px; margin: 0 0 10px; font-size: 14px; }
.has-unread { border-color: var(--accent); color: var(--accent2); }
.msg-count:not(:empty) { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 12px; margin-inline-start: 6px; }
.badge-msg { background: var(--accent-bg); color: var(--accent2); }
.msg-overlay { justify-content: flex-start; align-items: stretch; }
.msg-panel { background: var(--panel); border-inline-end: 1px solid var(--border); width: min(440px, 100vw); height: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.msg-head { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.msg-list { flex: 1; overflow: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 8px 12px; border-radius: 12px; background: var(--panel2); align-self: flex-end; }
.msg.mine { background: var(--accent-bg); align-self: flex-start; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-meta { margin-bottom: 2px; }
.msg-compose { border-top: 1px solid var(--border); padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.msg-input { resize: vertical; min-height: 64px; }
.note-replies { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.note-reply { background: var(--panel2); border-radius: var(--radius-sm); padding: 6px 10px; font-size: 14px; }
.note-reply.from-admin { border-inline-start: 3px solid var(--accent); }

/* status of a project in the cloud */
.status-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel3); color: var(--muted); }
.st-waiting { background: rgba(245, 184, 74, .16); color: var(--warn); }
.st-editing { background: var(--accent-bg); color: var(--accent2); }
.st-submitted { background: var(--ok-bg); color: #7ff0c3; }
.st-done { background: var(--panel3); color: var(--muted); }
.pc-status { position: absolute; top: 8px; inset-inline-start: 8px; }
.pc-unread { position: absolute; top: 8px; inset-inline-end: 8px; }
.version-kind { background: var(--panel3); color: var(--muted); font-weight: 500; }
.card.version.kind-session { border-inline-start: 3px solid var(--panel3); }

/* roles & permissions */
.roles-card { padding: 0; overflow: auto; }
.roles-table { width: 100%; border-collapse: collapse; }
.roles-table th, .roles-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: center; vertical-align: middle; }
.roles-table th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
.roles-table .roles-action { text-align: start; min-width: 280px; }
.role-head { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.roles-group td { background: var(--bg2); color: var(--muted); font-size: 13px; font-weight: 700; text-align: start; padding: 6px 14px; }
.perm-home .roles-action { color: var(--muted); }
.perm-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.perm-chip.on { background: var(--ok-bg); color: var(--ok); }
.perm-chip.off, .perm-chip.home { background: var(--panel3); color: var(--muted); }
.switch { width: 44px; height: 24px; border-radius: 999px; background: var(--panel3); border: 1px solid var(--border2); position: relative; cursor: pointer; padding: 0; }
.switch .switch-knob { position: absolute; top: 2px; inset-inline-start: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: inset-inline-start .15s, background .15s; }
.switch.on { background: var(--ok-bg); border-color: rgba(43,196,138,.5); }
.switch.on .switch-knob { inset-inline-start: 22px; background: var(--ok); }
.idle-input .input { width: 90px; }

/* dashboard */
.dash { display: flex; flex-direction: column; gap: 16px; }
.dash .card { padding: 16px 18px; }
.dash h2 { font-size: 18px; margin-bottom: 10px; }
.storage-head { align-items: center; }
.storage-bar { height: 10px; margin: 10px 0 8px; }
.storage-card.near .progress-bar { background: var(--warn); }
.storage-card.over .progress-bar { background: var(--bad); }
.table-scroll { overflow-x: auto; }
.dash-table { width: 100%; border-collapse: collapse; }
.dash-table th, .dash-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: start; white-space: nowrap; }
.dash-table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.work-user { margin: 6px 0; }
.work-user summary { cursor: pointer; padding: 6px 0; }

/* the guide */
.guide .guide-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.guide .guide-toc a { background: var(--panel2); padding: 5px 12px; border-radius: 999px; font-size: 14px; }
.guide .guide-sec { padding: 16px 20px; margin-bottom: 12px; }
.guide .guide-sec h2 { font-size: 19px; margin-bottom: 8px; }
.guide .guide-sec li { margin: 6px 0; line-height: 1.6; }
.guide-video video { width: 100%; border-radius: var(--radius-sm); }
.guide .guide-toc a, .guide-panel .guide-toc a { white-space: nowrap; }
.guide-pic { margin: 6px 0 12px; }
.guide-pic img { display: block; max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border2); cursor: zoom-in; background: var(--bg); }
.guide-pic figcaption { margin-top: 4px; }
.guide-pic-big { display: block; max-width: 100%; max-height: 72vh; margin: 0 auto 8px; border-radius: var(--radius-sm); }
.guide-spots { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border2); }
/* the guide beside the work: the page stays usable (no dark cover); a sheet from the bottom on a phone */
.guide-panel { position: fixed; top: 64px; bottom: 12px; inset-inline-end: 12px; width: min(420px, calc(100vw - 24px)); z-index: 96; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border2); border-radius: var(--radius); box-shadow: var(--shadow); animation: fade .15s; }
.guide-panel-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.guide-panel-head b { font-size: 16px; }
.guide-panel-hint { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guide-panel-head .icon-btn { flex: none; }
.guide-panel-body { overflow-y: auto; padding: 12px; flex: 1; }
.guide-panel .guide-toc { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.guide-panel .guide-toc a { background: var(--panel2); padding: 4px 10px; border-radius: 999px; font-size: 13px; }
.guide-panel .guide-sec { padding: 12px 14px; margin-bottom: 10px; }
.guide-panel .guide-sec h2 { font-size: 16px; margin-bottom: 6px; }
.guide-panel .guide-sec li { margin: 5px 0; line-height: 1.55; font-size: 14px; }
.guide-panel .guide-sec ul { padding-inline-start: 18px; }
.guide-panel.min { bottom: auto; }
.guide-panel.min .guide-panel-body { display: none; }
.guide-panel.min .guide-panel-head { border-bottom: none; cursor: pointer; }
.guide-panel.min .guide-min { transform: rotate(180deg); }
.spot-ring { position: fixed; z-index: 95; pointer-events: none; border: 3px solid var(--warn); border-radius: 10px; box-shadow: 0 0 0 4000px rgba(5, 7, 10, .45), 0 0 18px rgba(245, 184, 74, .8); animation: spot-pulse 1s ease-in-out infinite; }
.spot-label { position: absolute; bottom: 100%; inset-inline-start: -3px; margin-bottom: 6px; background: var(--warn); color: #1a1205; font-weight: 700; font-size: 14px; padding: 4px 10px; border-radius: 8px; white-space: nowrap; }
.spot-ring.label-below .spot-label { bottom: auto; top: 100%; margin: 6px 0 0; }
@keyframes spot-pulse { 50% { border-color: #fff3d6; box-shadow: 0 0 0 4000px rgba(5, 7, 10, .45), 0 0 28px rgba(245, 184, 74, 1); } }
@media (max-width: 860px) {
  .guide-panel { top: auto; bottom: 0; inset-inline: 0; width: 100%; height: 62vh; border-radius: var(--radius) var(--radius) 0 0; }
  .guide-panel.min { height: auto; bottom: 0; }
  .guide-panel-hint { display: none; }
}
@media (max-width: 700px) {
  .proj-extra { margin-inline-start: 0; }
  .roles-table .roles-action { min-width: 180px; }
}
.pc-thumb .pc-unread { inset-inline-start: auto; }

/* ------------------------------------------------------------------ phones and small tablets
   (the cloud site is opened from phones: nothing wider than the screen, controls big enough for a finger) */
@media (max-width: 860px) {
  html, body { overflow-x: hidden; }
  .topbar { flex-wrap: wrap; row-gap: 8px; height: auto; padding: 8px 12px; }
  .user-slot { margin-inline-start: auto; }
  .topbar-slot { order: 3; flex: 1 1 100%; flex-wrap: wrap; gap: 8px; min-width: 0; }
  .topbar-slot:empty { display: none; }
  .proj-meta { flex: 1 1 100%; min-width: 0; }
  .title-input { width: auto; flex: 1 1 auto; min-width: 0; }
  .client-input { width: 110px; flex: none; }
  .tabs { flex: 1 1 0; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 6px 10px; font-size: 14px; }
  .proj-extra { flex: none; }
  .proj-strip { margin: 10px 12px 0; flex-wrap: wrap; }
  .page-head { margin-bottom: 18px; }
  .page-head > .row { flex-wrap: wrap; width: 100%; }
  /* the editor: segments in a strip on top, the preview full width, the timeline scrolls sideways */
  .ed-side { max-height: none; }
  .side-head { padding: 10px 12px 4px; }
  .side-head p { display: none; }
  .seg-list { flex-direction: row; overflow-x: auto; padding: 4px 12px 8px; }
  .seg-item { flex: 0 0 auto; width: 220px; }
  .total-box { padding: 6px 12px 10px; }
  .ed-main { padding: 10px 12px 30px; gap: 10px; }
  .ed-main, .ed-top.portrait { --stage-h: 46vh; }
  .inspector { grid-template-columns: 1fr; }
  .tables-grid { grid-template-columns: 1fr; }
  .tool-row { gap: 6px; }
  .tool-row .tool-group.end { margin-inline-start: 0; }
  .tool-btn.big { min-width: 0; flex: 1 1 auto; padding: 9px 12px; font-size: 15px; }
  .tool-btn.big.note-add { flex-basis: 100%; }
  .rot-row { margin-inline-start: 0; }
  .tool-label { flex-basis: 100%; }
  .tl-side { width: 110px; }
  .side-lane { padding: 0 6px; font-size: 12px; }
  .act-row { grid-template-columns: 1fr 1fr; }
  .users-row { grid-template-columns: 1fr 1fr; }
  .users-row.head { display: none; }
  .roles-table .roles-action { position: sticky; inset-inline-start: 0; background: var(--panel); z-index: 1; min-width: 170px; }
  .roles-table th, .roles-table td { padding: 8px; }
  .storage-head { flex-wrap: wrap; }
  .dash .card { padding: 14px; }
  .msg-panel { width: 100vw; }
  .note-pop { max-width: calc(100vw - 16px); }
  .modal { max-height: 92vh; }
  .modal-body { overflow: auto; }
}
@media (max-width: 480px) {
  .brand-name b { display: none; }
  .brand { font-size: 15px; }
  h1 { font-size: 23px; }
  .page { padding: 14px 12px 36px; }
  .project-grid { grid-template-columns: 1fr; }
  .btn-lg { padding: 10px 16px; font-size: 15px; }
  .client-input { display: none; }
  .tab-n { display: none; }
  /* project top: the name with 💬 / ❓ beside it, then all four tabs on a row of their own (none cut off) */
  .proj-meta { flex: 1 1 0; order: 1; }
  .proj-extra { order: 2; }
  .tabs { order: 3; flex: 1 1 100%; justify-content: space-between; gap: 2px; }
  .tab { padding: 6px 8px; font-size: 13px; gap: 4px; }
  .transport { justify-content: center; }
  .guide .guide-sec { padding: 14px; }
  .login-card { padding: 24px 18px; }
}
/* fingers: bigger hit areas where a mouse needs none */
@media (pointer: coarse) {
  .icon-btn { min-width: 36px; min-height: 36px; }
  .btn-sm { min-height: 34px; }
  .switch { width: 50px; height: 28px; }
  .switch .switch-knob { width: 22px; height: 22px; }
  .switch.on .switch-knob { inset-inline-start: 24px; }
}
@media (max-width: 860px) {
  /* one scroll for the whole editor (segments, preview, tools, timeline) instead of panes inside panes */
  .editor { display: block; overflow-y: auto; }
  .ed-side { border-bottom: 1px solid var(--border); }
  .ed-main { overflow: visible; }
  .total-box { display: flex; align-items: baseline; gap: 10px; }
  .total-num { font-size: 20px; }
}
/* touch: the preview lets the page scroll unless reframing is switched on (click on the preview = green frame) */
.stage-frame:not(.armed) .stage { touch-action: pan-x pan-y; }
@media (max-width: 860px) {
  .save-version .row { flex-wrap: wrap; }
  .save-version .input { flex: 1 1 100%; }
  .package-card, .load-block { flex-direction: column; align-items: stretch; text-align: start; }
  .package-card .package-logo, .load-block .package-logo { display: none; }
  .version-head { flex-wrap: wrap; }
  .card.version > .row { flex-wrap: wrap; }
}
@media (max-width: 1180px) {
  .versions-layout, .tables-grid { grid-template-columns: minmax(0, 1fr); }
  .versions-layout > *, .ed-top > * { min-width: 0; }
}
@media (max-width: 480px) { .btn-text { display: none; } }

/* where am I (the admin): cloud edit site / full mode on the home computer */
.mode-bar { display: flex; align-items: center; gap: 6px; flex: none; }
.mode-chip { display: inline-flex; align-items: center; gap: 2px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.mode-chip.cloud { background: var(--accent-bg); color: var(--accent2); }
.mode-chip.home { background: rgba(245, 184, 74, .16); color: var(--warn); }
.mode-chip.off { background: var(--panel3); color: var(--muted); }
.mode-switch { white-space: nowrap; }
.mode-switch.on { border-color: var(--ok); color: #7ff0c3; }
.cloud-adminpw .form { margin-top: 8px; }
#user-slot, .user-slot { display: flex; align-items: center; gap: 8px; }
