/* SIG Planner — minimalist editing-workstation look. Theme tokens live on body[data-theme]. */
:root {
  --patrick: #e3a600;
  --cole: #1f63d6;
  --splitter: 6px;
  --status-h: 34px;
}
body[data-theme='light'] { --patrick-ink: #b8860b; --cole-ink: #2f66c8; }
body[data-theme='dark'] { --patrick-ink: #e6b93a; --cole-ink: #6c9bf0; }
body[data-theme='light'] {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #f6f7f9;
  --surface-2: #eceef2;
  --border: #d9dce2;
  --ink: #1b1d22;
  --ink-2: #5b6170;
  --ink-3: #6b7180;
  --accent: #2a5bd7;
  --track-bg: #eef0f4;
  --grid: rgba(0, 0, 0, 0.07);
  --playhead: #111;
  --danger: #c9302c;
  --shadow: 0 6px 24px rgba(20, 24, 40, 0.18);
}
body[data-theme='dark'] {
  color-scheme: dark;
  --bg: #17181c;
  --surface: #1f2126;
  --surface-2: #2a2d34;
  --border: #363a43;
  --ink: #e8eaee;
  --ink-2: #a3a9b6;
  --ink-3: #868c9c;
  --accent: #6e97ff;
  --track-bg: #121316;
  --grid: rgba(255, 255, 255, 0.08);
  --playhead: #f4f4f4;
  --danger: #ff6b66;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 13px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  min-width: 690px;
  min-height: 520px;
}
#app { height: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button { cursor: pointer; }
button:disabled, select:disabled, textarea:disabled, input:disabled { cursor: not-allowed; opacity: 0.45; }
.icon { display: block; flex: none; }

/* ---------- identity screen ---------- */
.identity { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; }
.identity h1 { margin: 0; font-size: 30px; font-weight: 500; letter-spacing: 0.28em; padding-left: 0.28em; }
.identity-buttons { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; }
.identity-btn {
  --ib: var(--patrick-ink); min-width: 200px; padding: 30px 24px; font-size: 20px; font-weight: 600; letter-spacing: 0.18em;
  border: 2px solid var(--ib); border-radius: 12px; color: var(--ib);
  background: color-mix(in srgb, var(--ib) 9%, var(--bg)); transition: background-color 0.15s, border-color 0.15s;
}
.identity-btn:hover { background: color-mix(in srgb, var(--ib) 18%, var(--bg)); }
.identity-patrick { --ib: var(--patrick-ink); }
.identity-cole { --ib: var(--cole-ink); }
.identity-note { color: var(--ink-3); font-size: 12px; }
.boot-message { height: 100%; display: grid; place-items: center; color: var(--ink-2); text-align: center; padding: 24px; }
.boot-message.error { color: var(--danger); }
.boot-message pre { white-space: pre-wrap; max-width: 640px; color: var(--ink-2); }

/* ---------- workspace ---------- */
.shell { display: flex; flex-direction: column; height: 100%; }
.offline-banner { background: var(--danger); color: #fff; text-align: center; padding: 4px 8px; font-weight: 600; display: none; }
body.offline .offline-banner { display: block; }
.workspace { flex: 1; min-height: 0; display: flex; }
.left { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.player-pane { min-height: 0; background: #000; position: relative; display: flex; flex-direction: column; }
.timeline-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--bg); user-select: none; -webkit-user-select: none; }
.timeline-pane input, .timeline-pane textarea { user-select: text; -webkit-user-select: text; }
.sidebar { flex: none; min-width: 0; display: flex; flex-direction: column; background: var(--bg); border-left: 1px solid var(--border); }
.splitter { flex: none; background: var(--surface-2); position: relative; z-index: 5; touch-action: none; }
.splitter::after { content: ''; position: absolute; inset: 0; background: transparent; transition: background 0.12s; }
.splitter:hover::after, .splitter.dragging::after, .splitter:focus-visible::after { background: var(--accent); opacity: 0.55; }
.splitter-v { width: var(--splitter); cursor: col-resize; }
.splitter-h { height: var(--splitter); cursor: row-resize; }
body.resizing { user-select: none; }
body.resizing.resizing-v { cursor: col-resize; }
body.resizing.resizing-h { cursor: row-resize; }
body.resizing video { pointer-events: none; }

/* ---------- player ---------- */
.stage { flex: 1; min-height: 0; position: relative; overflow: hidden; background: #000; cursor: default; }
.stage.zoomed { cursor: grab; }
.stage.panning { cursor: grabbing; }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transform-origin: 50% 50%; user-select: none; }
.stage-overlay { position: absolute; left: 8px; top: 8px; display: flex; gap: 6px; pointer-events: none; }
.stage-overlay span { background: rgba(0, 0, 0, 0.6); color: #fff; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-variant-numeric: tabular-nums; }
.media-error { position: absolute; inset: 0; display: grid; place-items: center; color: #f3b7b5; padding: 24px; text-align: center; background: #111; }
.media-error div { max-width: 520px; }
.transport { flex: none; display: flex; align-items: center; gap: 4px; padding: 4px 8px; background: var(--surface); border-top: 1px solid var(--border); color: var(--ink); flex-wrap: wrap; }
.transport .tc { font: 600 14px ui-monospace, 'Cascadia Mono', Consolas, monospace; margin: 0 8px; min-width: 104px; font-variant-numeric: tabular-nums; }
.transport .speed { color: var(--ink-2); min-width: 76px; font-variant-numeric: tabular-nums; }
.transport .grow { flex: 1; }
.transport select { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 2px 4px; }
.icon-btn { display: inline-flex; align-items: center; gap: 4px; background: transparent; border: 1px solid transparent; border-radius: 5px; padding: 4px 6px; color: var(--ink); }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); }
.icon-btn.active { background: var(--surface-2); border-color: var(--border); }
.btn { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px; }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.1); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger); filter: brightness(1.1); }

/* ---------- timeline ---------- */
.tl-top { flex: none; display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-bottom: 1px solid var(--border); min-height: 46px; }
.tl-marker-now { flex: 1; min-width: 0; text-align: left; background: transparent; border: 0; padding: 2px 4px; display: flex; gap: 6px; align-items: flex-start; color: var(--ink); border-radius: 4px; }
.tl-marker-now:hover:not(:disabled) { background: var(--surface); }
.tl-marker-now .pin { width: 10px; height: 12px; margin-top: 3px; flex: none; clip-path: polygon(0 0, 100% 0, 100% 65%, 50% 100%, 0 65%); }
.tl-marker-now .txt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; }
.tl-marker-now.empty { cursor: default; }
.btn-label { display: inline-flex; align-items: center; gap: 6px; line-height: 1; }
.tl-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.tl-scroll { flex: 1; min-height: 80px; position: relative; overflow-x: scroll; overflow-y: hidden; background: var(--track-bg); }
.tl-scroll { scrollbar-gutter: auto; }
.tl-scroll::-webkit-scrollbar { height: 10px; background: transparent; }
.tl-scroll::-webkit-scrollbar-track { background: transparent; border: 0; }
.tl-scroll::-webkit-scrollbar-corner { background: transparent; }
.tl-scroll::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
.tl-scroll::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--ink) 28%, transparent); border-radius: 5px; border: 2px solid transparent; background-clip: padding-box; }
.tl-scroll::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--ink) 45%, transparent); background-clip: padding-box; }
@supports not selector(::-webkit-scrollbar) { .tl-scroll { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--ink) 30%, transparent) transparent; } }
.tl-content { position: relative; height: 100%; min-height: 150px; }
.tl-ruler { position: absolute; left: 0; right: 0; top: 0; height: 26px; background: var(--surface); border-bottom: 1px solid var(--border); cursor: ew-resize; }
.tick { position: absolute; bottom: 0; width: 1px; background: var(--ink-3); height: 6px; pointer-events: none; }
.tick.major { height: 12px; }
.tick-label { position: absolute; top: 2px; font: 11px ui-monospace, Consolas, monospace; color: var(--ink-2); padding-left: 4px; pointer-events: none; white-space: nowrap; }
.gridline { position: absolute; top: 26px; bottom: 0; width: 1px; background: var(--grid); pointer-events: none; }
.tl-markers { position: absolute; left: 0; right: 0; top: 26px; height: 20px; }
.marker { position: absolute; top: 2px; width: 14px; margin-left: -7px; height: 18px; border: 0; padding: 0; background: transparent; }
.marker i { display: block; width: 12px; height: 14px; margin: 0 auto; clip-path: polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%); background: var(--mc); }
.marker:hover i, .marker.open i { filter: brightness(1.2) drop-shadow(0 0 2px var(--ink)); }
.tl-track { position: absolute; left: 0; right: 0; top: 50px; bottom: 30px; min-height: 56px; }
.seg { position: absolute; top: 0; bottom: 0; display: flex; align-items: flex-start; overflow: hidden; background: var(--fill); border-right: 1px solid rgba(0, 0, 0, 0.35); cursor: pointer; transition: opacity 0.15s; }
.seg.dim { opacity: 0.3; }
.seg .thumb { flex: none; margin: 4px; width: var(--thumb); height: var(--thumb); object-fit: cover; background: #0004; border-radius: 2px; pointer-events: none; }
.seg .seg-label { position: absolute; left: 6px; bottom: 3px; right: 4px; font-size: 11px; color: var(--seg-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; text-shadow: 0 0 2px var(--fill); }
.seg[data-status='black'] { --seg-ink: #ddd; }
.seg .badge { position: absolute; right: 4px; top: 3px; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 10px; padding: 0 5px; border-radius: 8px; pointer-events: none; }
.seg .placement { position: absolute; inset: 0; border: 3px solid #ff2020; box-shadow: inset 0 0 0 1px #fff8; pointer-events: none; }
.seg .overdue { position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(135deg, rgba(222, 20, 30, 0.72) 0 5px, rgba(222, 20, 30, 0) 5px 12px); border-top: 2px dashed #ff2020; border-bottom: 2px dashed #ff2020; }
.seg .sel-local { position: absolute; inset: 3px; pointer-events: none; z-index: 2; border-radius: 1px; box-shadow: inset 0 0 12px 3px rgba(255, 255, 255, 0.85), inset 0 0 0 1px rgba(255, 255, 255, 0.55); animation: sel-glow 2.2s ease-in-out infinite; }
@keyframes sel-glow {
  0%, 100% { box-shadow: inset 0 0 8px 2px rgba(255, 255, 255, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.35); }
  50% { box-shadow: inset 0 0 16px 5px rgba(255, 255, 255, 0.95), inset 0 0 0 1px rgba(255, 255, 255, 0.7); }
}
.seg .sel-remote { position: absolute; inset: 5px; border: 3px solid var(--rc); pointer-events: none; z-index: 1; }
.seg .sel-remote.second { inset: 8px; }
.cut { position: absolute; top: -4px; bottom: -4px; width: 11px; margin-left: -5px; cursor: col-resize; z-index: 4; touch-action: none; }
.cut::after { content: ''; position: absolute; left: 4px; width: 3px; top: 4px; bottom: 4px; background: transparent; border-radius: 2px; }
.cut:hover::after { background: var(--ink); opacity: 0.6; }
.cut.selected::after { background: var(--accent); opacity: 1; box-shadow: 0 0 0 2px var(--bg); }
.cut.dragging::after { background: var(--accent); opacity: 1; }
.playhead { position: absolute; top: 0; bottom: 0; width: 0; z-index: 6; pointer-events: none; }
.playhead::after { content: ''; position: absolute; left: -1px; top: 0; bottom: 0; width: 2px; background: var(--ph, var(--playhead)); }
.playhead .head { position: absolute; left: -6px; top: 12px; width: 12px; height: 14px; background: var(--ph, var(--playhead)); clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%); }
.playhead .who { position: absolute; left: 7px; top: 27px; background: var(--ph); color: #fff; font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 3px; white-space: nowrap; }
.playhead.remote .who.dark { color: #231a00; }
.tl-empty-hint { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; color: var(--ink-3); font-size: 11px; pointer-events: none; }

/* ---------- filters ---------- */
.filterbar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px 8px; border-top: 1px solid var(--border); background: var(--surface); }
.filterbar .label { color: var(--ink-3); margin-right: 2px; }
.fbtn { display: inline-flex; align-items: center; gap: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 2px 10px; }
.fbtn.on { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.fbtn .count { background: var(--accent); color: #fff; border-radius: 8px; font-size: 10px; padding: 0 5px; }
.filterbar .dimnote { color: var(--ink-3); margin-left: auto; font-size: 11px; }

/* ---------- popovers / modals / toasts ---------- */
.popover { position: fixed; z-index: 50; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 8px; max-height: 70vh; overflow: auto; min-width: 180px; }
.popover h3 { margin: 0 0 6px; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.pop-row { display: flex; align-items: center; gap: 8px; padding: 3px 4px; border-radius: 4px; white-space: nowrap; }
.pop-row:hover { background: var(--surface); }
.pop-row.past { color: var(--ink-3); }
.pop-row select { margin-left: auto; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; }
.pop-actions { display: flex; gap: 6px; justify-content: space-between; margin-top: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--c); flex: none; border: 1px solid rgba(0, 0, 0, 0.25); }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); display: grid; place-items: center; z-index: 60; }
.modal { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; max-width: 440px; box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 8px; font-size: 16px; }
.modal p { margin: 0 0 8px; color: var(--ink-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
#toasts { position: fixed; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 80; max-width: 380px; }
.toast { background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 6px; box-shadow: var(--shadow); transition: opacity 0.25s; }
.toast-error { background: var(--danger); color: #fff; }
.toast.leaving { opacity: 0; }
.split-pop { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.split-choices { display: flex; align-items: center; gap: 6px; }
.split-sq { width: 54px; height: 54px; border: 2px solid var(--ink); border-radius: 6px; background: var(--fill); display: grid; place-items: center; color: #fff; }
.split-sq:hover { transform: scale(1.06); box-shadow: var(--shadow); }
.marker-pop { display: flex; flex-direction: column; gap: 8px; width: 260px; }
.marker-pop textarea { width: 100%; resize: vertical; min-height: 54px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 6px; }
.marker-colors { display: flex; gap: 6px; }
.marker-colors button { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; background: var(--c); padding: 0; }
.marker-colors button[aria-checked='true'] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--bg) inset; }

/* ---------- sidebar ---------- */
.tabs { flex: none; display: flex; border-bottom: 1px solid var(--border); }
.tab { flex: 1; background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 9px 4px; color: var(--ink-2); font-weight: 600; }
.tab:hover { color: var(--ink); background: var(--surface); }
.tab[aria-selected='true'] { color: var(--ink); border-bottom-color: var(--accent); }
.panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.panel[hidden] { display: none; }
.search { flex: none; padding: 8px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; align-items: stretch; }
.search-field { position: relative; width: 100%; display: flex; align-items: center; }
.comment-count { font-size: 11px; color: var(--ink-3); padding: 4px 2px 0; }
.search-field .icon { position: absolute; left: 10px; color: var(--ink-3); pointer-events: none; }
.search input { width: 100%; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 4px 12px 4px 30px; }
.seg-head { flex: none; padding: 8px 10px 4px; border-bottom: 1px solid var(--border); }
.seg-title { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.seg-title .name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg-title .state { color: var(--ink-2); font-size: 12px; display: flex; align-items: center; gap: 5px; }
.checks { display: flex; flex-direction: column; gap: 1px; align-items: flex-start; }
.check { display: flex; align-items: center; gap: 8px; padding: 2px 4px; border-radius: 4px; cursor: pointer; }
.check:hover { background: var(--surface); }
.check input { margin: 0; width: 15px; height: 15px; accent-color: var(--c); }
.check.disabled { opacity: 0.5; cursor: not-allowed; }
.check .swatch.placement { background: transparent; border: 2px solid #ff2020; }
.clist { flex: 1; min-height: 0; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; position: relative; }
.empty { color: var(--ink-3); text-align: center; padding: 24px 12px; }
.comment { position: relative; display: flex; gap: 8px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: text; touch-action: pan-y; }
.comment:hover { border-color: var(--ink-3); }
.comment.completed .ctext { color: var(--ink-3); text-decoration: line-through; }
.comment.dragging { z-index: 4; box-shadow: var(--shadow); cursor: grabbing; transition: none; background: var(--bg); }
.comment.shifting { transition: transform 0.15s ease; }
.comment.flash { animation: flash 1.4s ease-out; }
.comment.remote-edit { border-color: var(--rc); box-shadow: 0 0 0 2px var(--rc); }
.comment.aggregated { cursor: pointer; }
@keyframes flash { from { background: color-mix(in srgb, var(--accent) 30%, var(--surface)); } to { background: var(--surface); } }
.circle { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ink-3); background: transparent; padding: 0; margin-top: 1px; display: grid; place-items: center; color: #fff; }
.circle:hover:not(:disabled) { border-color: var(--caribbean, #1db89a); }
.circle[aria-checked='true'] { background: #1db89a; border-color: #1db89a; }
.cbody { flex: 1; min-width: 0; }
.ctext { white-space: pre-wrap; overflow-wrap: anywhere; }
.ctext a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.cmeta { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 4px; font-size: 11px; color: var(--ink-3); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; border-radius: 9px; background: var(--surface-2); color: var(--ink-2); border: 1px solid transparent; font-size: 11px; line-height: 17px; }
.chip.user { color: #fff; background: var(--uc); }
.chip.user.patrick { color: #231a00; }
.chip.week.past { opacity: 0.55; }
.chip.week.overdue { background: rgba(222, 20, 30, 0.15); color: var(--danger); border-color: var(--danger); font-weight: 600; }
.chip.segref { cursor: pointer; }
.cactions { display: flex; flex-direction: column; gap: 2px; opacity: 0; }
.comment:hover .cactions, .comment:focus-within .cactions, .comment.aggregated .cactions { opacity: 1; }
.cactions .icon-btn { padding: 2px; color: var(--ink-3); }
.cactions .icon-btn:hover { color: var(--danger); }
.editing-by { font-size: 11px; font-weight: 700; color: var(--rc); }
.cedit textarea, .composer textarea { width: 100%; resize: vertical; min-height: 54px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 6px; }
.cedit-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; align-items: center; }
.cedit-row select { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 1px 2px; max-width: 150px; }
.tagchip { border: 1px solid var(--border); background: var(--bg); border-radius: 10px; padding: 0 8px; font-size: 11px; line-height: 18px; color: var(--ink-2); }
.tagchip[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: #fff; }
.edit-hint { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.conflict { margin-top: 6px; padding: 6px; border: 1px solid var(--danger); border-radius: 6px; font-size: 12px; }
.conflict blockquote { margin: 4px 0; padding-left: 8px; border-left: 3px solid var(--border); white-space: pre-wrap; color: var(--ink-2); }
.composer { flex: none; border-top: 1px solid var(--border); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.composer .row { display: flex; gap: 6px; align-items: stretch; }
.composer textarea { resize: none; overflow: hidden; min-height: 32px; max-height: 40vh; line-height: 1.4; display: block; flex: 1; min-width: 0; }
.composer textarea:not(:placeholder-shown) { overflow-y: auto; }
.composer .composer-options { margin-top: 0; }
.composer .composer-options + .composer-options { margin-top: 4px; }
.btn-add { align-self: stretch; background: #111; border-color: #111; color: #fff; padding: 0 14px; }
.btn-add:hover:not(:disabled) { background: #333; border-color: #333; }
body[data-theme='dark'] .btn-add { background: #f2f2f2; border-color: #f2f2f2; color: #111; }
body[data-theme='dark'] .btn-add:hover:not(:disabled) { background: #d8d8d8; border-color: #d8d8d8; }
.composer-note { color: var(--ink-3); font-size: 12px; text-align: center; padding: 4px; }

/* ---------- history / backups ---------- */
.hist-tools { flex: none; padding: 8px; display: flex; gap: 6px; align-items: center; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.seg-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.seg-toggle button { background: var(--bg); border: 0; padding: 2px 12px; }
.seg-toggle button[aria-pressed='true'] { background: var(--accent); color: #fff; }
.hist-item { display: flex; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--border); }
.hist-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--uc); margin-top: 6px; flex: none; }
.hist-item .when { color: var(--ink-3); font-size: 11px; }
.hist-item .who { font-weight: 600; }
.hist-item .sum { overflow-wrap: anywhere; }
.bk-item { padding: 8px 4px; border-bottom: 1px solid var(--border); }
.bk-item .meta { color: var(--ink-3); font-size: 11px; }
.bk-note { color: var(--ink-3); font-size: 12px; padding: 8px; border-top: 1px solid var(--border); }

/* ---------- status bar ---------- */
.statusbar { flex: none; height: var(--status-h); display: flex; align-items: center; gap: 14px; padding: 0 10px; background: var(--surface); border-top: 1px solid var(--border); }
.presence { display: flex; gap: 12px; align-items: center; }
.pres { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 0; padding: 2px 6px; border-radius: 10px; font-weight: 600; }
.pres .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--uc); }
.pres.offline { filter: grayscale(1); opacity: 0.55; font-weight: 500; cursor: default; }
.pres.online.other:hover { background: var(--surface-2); }
.pres.self { cursor: default; }
.statusbar .grow { flex: 1; }
.ver { color: var(--ink-3); font-size: 11px; }
.statusbar > .icon-btn { margin-left: -4px; }
.save { display: inline-flex; align-items: center; gap: 6px; min-width: 100px; justify-content: flex-end; }
.save .dot { width: 8px; height: 8px; border-radius: 50%; background: #2fa84f; }
.save[data-state='saving'] .dot { background: #e3a600; }
.save[data-state='failed'] .dot, .save[data-state='offline'] .dot { background: var(--danger); }
.save[data-state='failed'], .save[data-state='offline'] { color: var(--danger); font-weight: 600; }

body.offline .needs-online { pointer-events: none; opacity: 0.55; }

@media (max-width: 1000px) {
  .transport .tc { min-width: 90px; }
  .tl-top { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .seg .sel-local { animation: none !important; box-shadow: inset 0 0 14px 4px rgba(255, 255, 255, 0.85), inset 0 0 0 1px rgba(255, 255, 255, 0.6); }
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

.mode-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.mode-btn { background: transparent; color: var(--ink-3); border: 0; padding: 4px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.mode-btn + .mode-btn { border-left: 1px solid var(--border); }
.mode-btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.view-mode .cut { pointer-events: none; }
