/* Cutlist — review-room dark UI.
   Dark is functional here: video must read true against neutral surroundings.
   Reds/oranges are reserved for action presets (semantic), so UI accent is
   an instrument teal; the internal-tier badge is violet. Timecodes are mono. */

:root {
  --bg: #101318;
  --surface: #171b22;
  --surface-2: #1f242e;
  --surface-3: #262d39;
  --line: #2a3140;
  --line-strong: #3a4356;
  --text: #e8ebf0;
  --muted: #8b94a3;
  --faint: #5c6575;
  --accent: #4db8c4;
  --accent-dim: #2c5f66;
  --internal: #9d8cff;
  --danger: #e5484d;
  --ok: #57c76f;
  --warn: #f0883e;
  --mono: "SF Mono", "Cascadia Code", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); }
a { color: var(--accent); text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------ shell */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; height: 52px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.brand {
  font: 700 13px/1 var(--mono); letter-spacing: 0.18em;
  display: flex; align-items: center; gap: 8px; color: var(--text);
}
.brand .tick {
  width: 3px; height: 16px; background: var(--accent);
  transform: skewX(-18deg); border-radius: 1px;
}
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); font-size: 13px; }

.page { max-width: 1060px; margin: 0 auto; padding: 32px 20px 80px; }

/* ------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--line-strong);
  font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: background 120ms, border-color 120ms;
}
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #06282c; font-weight: 600; }
.btn.primary:hover { background: #63c8d3; }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: default; }

.input, textarea.input {
  width: 100%; padding: 8px 11px;
  background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
.input:focus { border-color: var(--accent); outline: none; }
textarea.input { resize: vertical; min-height: 60px; }
select.input { appearance: none; }
label.field { display: block; margin-bottom: 14px; }
label.field .lbl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }

.tc { font-family: var(--mono); font-size: 12px; letter-spacing: 0.02em; }

.badge {
  font: 600 10.5px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 4px;
}
.badge.internal { color: var(--internal); background: rgba(157,140,255,0.12); border: 1px solid rgba(157,140,255,0.35); }
.badge.role { color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); }
.badge.status-in_review { color: var(--accent); background: rgba(77,184,196,0.1); border: 1px solid rgba(77,184,196,0.3); }
.badge.status-changes_requested { color: var(--warn); background: rgba(240,136,62,0.1); border: 1px solid rgba(240,136,62,0.3); }
.badge.status-approved { color: var(--ok); background: rgba(87,199,111,0.1); border: 1px solid rgba(87,199,111,0.3); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface-3); border: 1px solid var(--line-strong);
  padding: 10px 18px; border-radius: 10px; font-size: 13px; z-index: 100;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
.toast.error { border-color: var(--danger); }

/* ------------------------------------------------ auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card {
  width: 380px; max-width: 100%;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 34px 32px;
}
.auth-card .brand { justify-content: center; margin-bottom: 6px; font-size: 15px; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }
.form-error { color: var(--danger); font-size: 13px; margin: 10px 0 0; min-height: 18px; }

/* ------------------------------------------------ dashboard */
.dash-head { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.dash-head h1 { font: 600 20px/1.2 var(--sans); flex: 1; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.proj-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px; text-align: left;
  display: block; width: 100%; transition: border-color 120ms;
}
.proj-card:hover { border-color: var(--accent-dim); }
.proj-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.proj-card .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.empty {
  border: 1px dashed var(--line-strong); border-radius: 12px;
  padding: 46px 20px; text-align: center; color: var(--muted);
}

/* ------------------------------------------------ modal / panel */
.overlay {
  position: fixed; inset: 0; background: rgba(6,8,11,0.7);
  z-index: 50; display: grid; place-items: center; padding: 20px;
}
.modal {
  width: 460px; max-width: 100%; max-height: 88vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 14px; padding: 26px;
}
.modal h2 { font-size: 16px; margin-bottom: 18px; }
.modal .row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.member-row, .preset-row, .version-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--line);
}
.member-row:last-child, .preset-row:last-child, .version-row:last-child { border-bottom: none; }
.member-row .grow, .preset-row .grow, .version-row .grow { flex: 1; min-width: 0; }
.member-row .name { font-weight: 500; }
.member-row .email { color: var(--muted); font-size: 12px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.invite-out {
  margin-top: 12px; padding: 10px 12px; background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  font-family: var(--mono); font-size: 11.5px; word-break: break-all;
}
.section-label {
  font: 600 11px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--faint); margin: 22px 0 10px;
}
.section-label:first-child { margin-top: 0; }

/* ------------------------------------------------ review layout */
.review {
  display: grid; grid-template-columns: minmax(0, 1fr) 400px;
  gap: 0; height: calc(100vh - 52px);
}
.player-col { display: flex; flex-direction: column; min-width: 0; padding: 20px 24px; overflow-y: auto; }
.notes-col {
  border-left: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; min-height: 0;
}
@media (max-width: 980px) {
  .review { grid-template-columns: 1fr; height: auto; }
  .notes-col { border-left: none; border-top: 1px solid var(--line); max-height: none; }
}

.video-frame {
  background: #000; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line);
  display: grid; place-items: center; position: relative;
}
.video-frame video { width: 100%; max-height: 56vh; display: block; background: #000; }

/* control bar */
.controls {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 2px 6px;
}
.controls .timedisp { font-family: var(--mono); font-size: 13px; color: var(--text); }
.controls .timedisp .dur { color: var(--faint); }
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line-strong);
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(77,184,196,0.1); }
.icon-btn svg { width: 16px; height: 16px; fill: currentColor; }
.kbd-hint { color: var(--faint); font-size: 11.5px; font-family: var(--mono); }

/* --------- the timeline: scrubber + note rail (signature element) */
.timeline-wrap { user-select: none; margin-top: 4px; }
.scrubber {
  position: relative; height: 30px; cursor: pointer;
  border-radius: 6px; background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.scrubber .buffered { position: absolute; top: 0; bottom: 0; left: 0; background: var(--surface-3); }
.scrubber .played { position: absolute; top: 0; bottom: 0; left: 0; background: rgba(77,184,196,0.18); }
.scrubber.range-mode { cursor: crosshair; box-shadow: 0 0 0 1px var(--accent); }
.playhead {
  position: absolute; top: -4px; bottom: -4px; width: 2px;
  background: var(--accent); z-index: 5; pointer-events: none;
}
.playhead::after {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--accent);
}
.range-select {
  position: absolute; top: 0; bottom: 0;
  background: rgba(77,184,196,0.25);
  border-left: 2px solid var(--accent); border-right: 2px solid var(--accent);
  z-index: 4; pointer-events: none;
}
.note-rail { position: relative; height: 46px; margin-top: 6px; }
.rail-track {
  position: absolute; inset: 0;
  border-radius: 6px; background: var(--surface);
  border: 1px dashed var(--line);
}
.rail-range {
  position: absolute; top: 6px; height: 16px; border-radius: 4px;
  opacity: 0.85; min-width: 4px; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.25);
}
.rail-range:hover, .rail-range.hot { opacity: 1; box-shadow: 0 0 0 2px rgba(255,255,255,0.35); z-index: 3; }
.rail-range.resolved { opacity: 0.3; }
.rail-point {
  position: absolute; top: 27px; width: 12px; height: 12px;
  transform: translateX(-50%) rotate(45deg); border-radius: 2px;
  cursor: pointer; border: 1px solid rgba(255,255,255,0.3);
}
.rail-point:hover, .rail-point.hot { box-shadow: 0 0 0 2px rgba(255,255,255,0.35); z-index: 3; }
.rail-point.resolved { opacity: 0.3; }

/* range composer popover */
.composer {
  margin-top: 14px; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 12px; padding: 16px;
}
.composer .times { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.composer .times input {
  width: 88px; text-align: center; font-family: var(--mono); font-size: 12.5px;
  padding: 6px 4px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 6px;
}
.composer .times .arrow { color: var(--faint); }
.preset-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--line-strong);
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.chip.selected { border-color: var(--chip-color, var(--accent)); background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--chip-color, var(--accent)); }
.composer .foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.composer .foot .spacer { flex: 1; }
.vis-toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.vis-toggle input { accent-color: var(--internal); }

/* ------------------------------------------------ notes sidebar */
.notes-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.notes-head .toprow { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.notes-head h2 { font-size: 13px; font-weight: 600; flex: 1; }
.filter-row { display: flex; gap: 6px; flex-wrap: wrap; }
.seg {
  display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden;
}
.seg button { padding: 5px 10px; font-size: 12px; color: var(--muted); }
.seg button.on { background: var(--surface-3); color: var(--text); }
.notes-list { flex: 1; overflow-y: auto; padding: 10px 12px 30px; }
.group-head {
  display: flex; align-items: center; gap: 8px;
  font: 600 11px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin: 16px 4px 8px;
}
.group-head:first-child { margin-top: 4px; }
.group-head .count { color: var(--faint); }

.note-card {
  background: var(--surface-2); border: 1px solid var(--line);
  border-left: 3px solid var(--note-color, var(--line-strong));
  border-radius: 10px; padding: 11px 12px; margin-bottom: 9px;
  transition: border-color 120ms, box-shadow 120ms;
}
.note-card.hot { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-dim); }
.note-card.resolved { opacity: 0.55; }
.note-card .head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.note-card .tcbtn {
  font-family: var(--mono); font-size: 11.5px; color: var(--accent);
  background: rgba(77,184,196,0.08); border: 1px solid rgba(77,184,196,0.25);
  padding: 2px 7px; border-radius: 5px;
}
.note-card .tcbtn:hover { background: rgba(77,184,196,0.16); }
.note-card .action-tag {
  font: 600 10.5px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 4px; color: #0e1116;
  background: var(--note-color, var(--muted));
}
.note-card .body { white-space: pre-wrap; word-wrap: break-word; margin-bottom: 7px; }
.note-card .meta { display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: 11.5px; flex-wrap: wrap; }
.note-card .meta .spacer { flex: 1; }
.note-card .meta button { color: var(--faint); font-size: 11.5px; }
.note-card .meta button:hover { color: var(--text); }
.note-card .meta .resolve { color: var(--muted); display: inline-flex; gap: 5px; align-items: center; }
.note-card .meta .resolve:hover { color: var(--ok); }
.note-card.resolved .meta .resolve { color: var(--ok); }

.replies { margin-top: 9px; border-top: 1px solid var(--line); padding-top: 8px; }
.reply { display: flex; gap: 8px; margin-bottom: 7px; font-size: 12.5px; }
.reply .who { color: var(--muted); font-weight: 600; white-space: nowrap; }
.reply .del { color: var(--faint); visibility: hidden; }
.reply:hover .del { visibility: visible; }
.reply-input { display: flex; gap: 7px; margin-top: 4px; }
.reply-input input { flex: 1; padding: 6px 10px; font-size: 12.5px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 7px; }

.share-banner {
  margin: 10px 12px 0; padding: 10px 12px; border-radius: 10px;
  background: rgba(157,140,255,0.08); border: 1px solid rgba(157,140,255,0.3);
  font-size: 12.5px; color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.share-banner .n { font-family: var(--mono); color: var(--internal); font-weight: 700; }

/* review topbar extras */
.review-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.review-top h1 { font-size: 16px; font-weight: 600; margin-right: 4px; }
.ver-select {
  font-family: var(--mono); font-size: 12.5px;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  padding: 6px 10px; border-radius: 8px;
}
.upload-progress { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.upload-progress .bar { height: 100%; background: var(--accent); width: 0%; transition: width 200ms; }
.drop-hint { color: var(--muted); font-size: 12.5px; }
