:root {
  /* Same family as Declutter, Media Studio and Video Grabber: black, white, one crimson, Poppins. */
  --accent: #E63329;
  --accent-text: #fff;
  --bg: #111113;
  --side: #0B0B0D;
  --panel: #1C1C1F;
  --panel-2: rgba(255,255,255,.085);
  --field: #161619;
  --line: rgba(255,255,255,.09);
  --text: #ffffff;
  --muted: rgba(255,255,255,.55);
  --wash: rgba(230,51,41,.14);
  --good: #2fb36b;
  --warn: #e8a33a;
  --font: 'Poppins', system-ui, -apple-system, Segoe UI, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F6F6F7;
  --side: #ECECEF;
  --panel: #FFFFFF;
  --panel-2: rgba(0,0,0,.055);
  --field: #FFFFFF;
  --line: rgba(0,0,0,.10);
  --text: #111113;
  --muted: rgba(0,0,0,.56);
  --wash: rgba(230,51,41,.08);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #F6F6F7; --side: #ECECEF; --panel: #FFFFFF; --panel-2: rgba(0,0,0,.055); --field: #FFFFFF;
    --line: rgba(0,0,0,.10); --text: #111113; --muted: rgba(0,0,0,.56); --wash: rgba(230,51,41,.08); color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }

.btn { background: var(--panel-2); border: 1px solid transparent; border-radius: 8px; padding: 7px 12px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.good { background: var(--good); color: #fff; border-color: transparent; font-weight: 600; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.on { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.icon { padding: 6px 8px; }
input[type=text], input[type=email], input[type=number], textarea, select { background: var(--field); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }

/* header */
.top { display: flex; align-items: center; gap: 18px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--side); height: 56px; }
.logo { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.logo svg { width: 26px; height: 26px; flex: none; }
.wordmark { font-weight: 800; font-size: 19px; letter-spacing: .5px; }
.wordmark b { color: var(--accent); font-weight: 800; }
.tabs { display: inline-flex; gap: 2px; background: var(--panel-2); border-radius: 10px; padding: 3px; }
.tabs a { padding: 5px 16px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 13px; letter-spacing: .4px; }
.tabs a.on { background: var(--accent); color: #fff; }
.bell { position: relative; }
.bell .dot { position: absolute; top: -3px; right: -3px; background: var(--accent); color: var(--accent-text); border-radius: 9px; font-size: 10px; min-width: 17px; height: 17px; display: grid; place-items: center; padding: 0 4px; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; min-width: 260px; z-index: 50; box-shadow: 0 12px 40px rgba(0,0,0,.5); padding: 6px; }
.menu a, .menu button.item { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; text-decoration: none; background: none; border: 0; cursor: pointer; }
.menu a:hover, .menu button.item:hover { background: var(--panel-2); }
.menu .unread { border-left: 3px solid var(--accent); }
.anchor { position: relative; }

/* home */
.page { max-width: 1280px; margin: 0 auto; padding: 24px 18px 80px; }
.page h1 { font-size: 22px; margin: 0; }
.project { margin-top: 28px; }
.project h2 { font-size: 16px; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; text-decoration: none; display: block; transition: border-color .15s; }
.card:hover { border-color: #3a3a42; }
.card .thumb { aspect-ratio: 16/9; background: #000 center/cover no-repeat; position: relative; display: grid; place-items: center; color: var(--muted); }
.card .thumb .ver { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.7); padding: 2px 7px; border-radius: 6px; font-size: 12px; }
.card .body { padding: 10px 12px; }
.card .title { font-weight: 600; margin-bottom: 6px; }
.pill { white-space: nowrap; display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; letter-spacing: .2px; background: var(--panel-2); border: 1px solid var(--line); }
.pill.approved { background: rgba(47,179,107,.15); color: #5fd894; border-color: rgba(47,179,107,.4); }
.pill.needs_changes { background: rgba(232,163,58,.12); color: #f0b85a; border-color: rgba(232,163,58,.4); }
.pill.in_review { background: rgba(80,140,255,.12); color: #8fb4ff; border-color: rgba(80,140,255,.4); }
.empty { padding: 40px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; }

/* login */
.login { max-width: 380px; margin: 12vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 30px; }
.login h1 { margin: 0 0 6px; font-size: 22px; }
.login input { width: 100%; margin: 14px 0 10px; }
.login .btn { width: 100%; justify-content: center; padding: 10px; }
.or { text-align: center; color: var(--muted); margin: 14px 0; font-size: 12px; }

/* review page */
.review { display: grid; grid-template-columns: 1fr 380px; height: calc(100vh - 56px); }
.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar .title { font-weight: 600; font-size: 15px; }
.crumb { color: var(--muted); text-decoration: none; }
.viewer { flex: 1; min-height: 0; display: flex; gap: 6px; padding: 12px; background: #000; position: relative; color: #fff; }
.pane { flex: 1; position: relative; min-width: 0; display: flex; flex-direction: column; }
.pane .label { position: absolute; top: 8px; left: 8px; z-index: 3; background: rgba(0,0,0,.7); border-radius: 6px; padding: 3px 8px; font-size: 12px; font-weight: 600; }
.pane .vwrap { position: relative; flex: 1; min-height: 0; }
.pane video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.pane canvas { position: absolute; z-index: 2; touch-action: none; }
.pane canvas.drawing { cursor: crosshair; }
.toggle-badge { position: absolute; top: 8px; right: 8px; z-index: 3; background: var(--accent); color: var(--accent-text); border-radius: 6px; padding: 4px 10px; font-weight: 700; }
.processing { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); text-align: center; }
.bar { height: 6px; background: var(--panel-2); border-radius: 4px; overflow: hidden; width: 260px; margin: 10px auto; }
.bar > div { height: 100%; background: var(--accent); width: 0; transition: width .3s; }

.controls { padding: 8px 14px 12px; border-top: 1px solid var(--line); background: var(--panel); }
.timeline { position: relative; height: 34px; cursor: pointer; margin-bottom: 6px; }
.timeline .track { position: absolute; left: 0; right: 0; top: 20px; height: 6px; background: var(--panel-2); border-radius: 3px; }
.timeline .played { position: absolute; left: 0; top: 20px; height: 6px; background: var(--accent); border-radius: 3px; opacity: .55; }
.timeline .head { position: absolute; top: 14px; width: 2px; height: 18px; background: var(--text); transform: translateX(-1px); }
.timeline .pin { position: absolute; top: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid var(--panel); transform: translateX(-7px); cursor: pointer; z-index: 2; }
.timeline .pin.done { background: var(--good); }
.timeline .pin.sel { box-shadow: 0 0 0 2px #fff; }
.timeline .hover-tc { position: absolute; top: -22px; background: #000; padding: 1px 6px; border-radius: 4px; font-size: 11px; transform: translateX(-50%); pointer-events: none; white-space: nowrap; color: #fff; }
.tc { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.ctrl-row { display: flex; align-items: center; gap: 6px; }

/* sidebar */
.side { border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.side-head { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button { background: none; border: 0; padding: 4px 10px; border-radius: 6px; cursor: pointer; color: var(--muted); font-size: 12px; }
.seg button.on { background: var(--panel-2); color: var(--text); }
.comments { flex: 1; overflow-y: auto; padding: 8px; }
.cm { padding: 10px; border-radius: 10px; border: 1px solid transparent; margin-bottom: 6px; background: var(--panel-2); }
.cm.sel { border-color: var(--accent); background: var(--wash); }
.cm.done { opacity: .6; }
.cm .who { display: flex; align-items: center; gap: 8px; }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: #3a3a44; color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; }
.cm .when { margin-left: auto; }
.cm .text { margin: 6px 0 4px 32px; white-space: pre-wrap; word-wrap: break-word; line-height: 1.45; }
.cm .acts { margin-left: 32px; display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); }
.cm .acts button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; font-size: 12px; }
.cm .acts button:hover { color: var(--text); }
.tcchip { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 11px; cursor: pointer; font-family: ui-monospace, Menlo, monospace; }
.tcchip:hover { border-color: var(--accent); }
.reply { margin: 8px 0 0 32px; padding-left: 10px; border-left: 2px solid var(--line); }
.reply .text { margin-left: 0; }
.check { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; user-select: none; }
.check input { accent-color: var(--good); width: 15px; height: 15px; cursor: pointer; }
.composer { border-top: 1px solid var(--line); padding: 10px; }
.composer textarea { width: 100%; resize: none; min-height: 64px; }
.drawtools { display: flex; gap: 6px; align-items: center; margin: 6px 0; flex-wrap: wrap; }
.swatch { width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatch.on { border-color: var(--text); }
.approved-banner { background: rgba(47,179,107,.15); border-bottom: 1px solid rgba(47,179,107,.4); color: #5fd894; padding: 8px 14px; font-weight: 600; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 100; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; width: min(520px, 94vw); max-height: 90vh; overflow: auto; }
.modal h3 { margin: 0 0 12px; }
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 30px; text-align: center; cursor: pointer; }
.drop.over { border-color: var(--accent); }
.field { margin: 12px 0; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; }
table.members { width: 100%; border-collapse: collapse; }
table.members td, table.members th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }

#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 6px; align-items: center; }
#toast div { background: var(--panel); color: var(--text); border: 1px solid var(--line); padding: 9px 14px; border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
#toast div.err { border-color: #a33; }

.upload-float { position: fixed; right: 16px; bottom: 16px; width: 320px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; z-index: 90; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.upload-float .bar { width: 100%; }

@media (max-width: 900px) {
  .review { grid-template-columns: 1fr; height: auto; }
  .viewer { height: 56vw; }
  .side { border-left: 0; border-top: 1px solid var(--line); }
}
.pane canvas { pointer-events: none; }

.theme-seg { display: flex; gap: 4px; padding: 6px 10px; }
.theme-seg button { flex: 1; background: var(--panel-2); border: 0; border-radius: 6px; padding: 5px 8px; cursor: pointer; font-size: 12px; }
.theme-seg button.on { background: var(--accent); color: #fff; }
.login .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.login .brand svg { width: 34px; height: 34px; }
.login .brand .wordmark { font-size: 24px; }
.code-input { letter-spacing: 8px; font-size: 22px !important; text-align: center; font-variant-numeric: tabular-nums; }
.cleared { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: rgba(255,255,255,.7); padding: 20px; }
.project h2 .btn { font-size: 13px; font-weight: 500; }
.editing-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--wash); border: 1px solid var(--accent); border-radius: 8px; padding: 5px 6px 5px 10px; margin-bottom: 6px; font-size: 12px; font-weight: 600; }
.editing-bar .btn { padding: 3px 9px; font-size: 12px; }
.cm .acts button.show-drawing { color: var(--accent); font-weight: 600; }
.time-btn { background: none; border: 1px solid transparent; border-radius: 6px; padding: 3px 6px; cursor: pointer; color: var(--text); }
.time-btn:hover { border-color: var(--line); background: var(--panel-2); }
