:root {
  --bg: #0d0e10;
  --panel: #15171a;
  --panel-2: #1c1f23;
  --line: #2a2e34;
  --text: #eceef1;
  --muted: #8b929c;
  --accent: #ff5a36;
  --accent-ink: #160704;
  --ok: #3ccf7a;
  --warn: #ffb020;
  --bad: #ff4d5e;
  --radius: 12px;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body, #app { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* buttons + inputs */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--panel-2); padding: 8px 14px; border-radius: 9px; font-weight: 600; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: #24282d; border-color: #3a3f46; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #ff7150; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #04140a; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.input, textarea.input, select.input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; outline: none; }
.input:focus { border-color: var(--accent); }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.toggle { display: flex; align-items: center; gap: 10px; margin: 10px 0; cursor: pointer; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }

/* landing */
.landing { min-height: 100%; display: grid; grid-template-columns: 1.2fr 1fr; }
.landing .hero { padding: 64px; display: flex; flex-direction: column; justify-content: center; background:
  radial-gradient(900px 500px at 10% 0%, rgba(255,90,54,.18), transparent 60%), var(--bg); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.logo i { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; }
.logo i::after { content: ''; width: 9px; height: 13px; background: var(--bg); border-radius: 0 7px 7px 0; margin-left: 2px; }
.hero h1 { font-size: clamp(36px, 5vw, 60px); line-height: 1.02; letter-spacing: -.035em; margin: 48px 0 18px; font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lead { font-size: 18px; color: var(--muted); max-width: 560px; margin: 0 0 36px; }
.features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 640px; }
.feature { border: 1px solid var(--line); background: rgba(21,23,26,.7); border-radius: var(--radius); padding: 14px 16px; }
.feature b { display: block; margin-bottom: 4px; }
.feature span { color: var(--muted); font-size: 13px; }
.auth { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--panel); border-left: 1px solid var(--line); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.02em; }
.tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 10px; margin: 20px 0 24px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 7px; font-weight: 600; color: var(--muted); }
.tabs button.on { background: var(--panel-2); color: var(--text); }
.form-error { color: var(--bad); min-height: 20px; font-size: 13px; margin-bottom: 10px; }

/* app shell */
.shell { display: grid; grid-template-columns: 248px 1fr; height: 100%; }
.side { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px; gap: 18px; overflow: auto; }
.side h4 { margin: 0 0 8px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: 0 8px; }
.side nav a { display: flex; justify-content: space-between; padding: 7px 8px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.side nav a:hover, .side nav a.on { background: var(--panel-2); color: var(--text); }
.meter { padding: 12px; background: var(--bg); border-radius: 10px; border: 1px solid var(--line); font-size: 12px; }
.meter .bar { height: 6px; background: var(--panel-2); border-radius: 4px; overflow: hidden; margin: 8px 0 4px; }
.meter .bar i { display: block; height: 100%; background: var(--accent); }
.activity { font-size: 12px; color: var(--muted); display: grid; gap: 8px; padding: 0 8px; }
.activity div b { color: var(--text); font-weight: 500; }
.main { overflow: auto; position: relative; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 16px 28px; background: rgba(13,14,16,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 20px; margin: 0; letter-spacing: -.02em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb { color: var(--muted); font-weight: 500; }
.content { padding: 24px 28px 120px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; position: relative; transition: border-color .15s, transform .15s; }
.card:hover { border-color: #3d424a; transform: translateY(-1px); }
.thumb { aspect-ratio: 16/9; background: #08090a center/cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; position: relative; }
.thumb .badges { position: absolute; left: 8px; top: 8px; display: flex; gap: 6px; }
.thumb .dur { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.75); padding: 2px 6px; border-radius: 5px; font: 600 11px var(--mono); color: #fff; }
.pill { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: rgba(0,0,0,.7); color: #fff; letter-spacing: .02em; }
.pill.approved { background: var(--ok); color: #04140a; }
.pill.changes { background: var(--warn); color: #1a1000; }
.pill.ver { background: var(--accent); color: var(--accent-ink); }
.card .meta { padding: 12px 14px; }
.card .meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta small { color: var(--muted); font-size: 12px; display: flex; gap: 10px; margin-top: 3px; }
.card .menu-btn { position: absolute; right: 8px; top: 8px; background: rgba(0,0,0,.65); border: 0; border-radius: 7px; width: 28px; height: 28px; color: #fff; opacity: 0; transition: opacity .15s; }
.card:hover .menu-btn { opacity: 1; }
.new-card { border: 1.5px dashed var(--line); background: transparent; border-radius: var(--radius); display: grid; place-items: center; min-height: 180px; color: var(--muted); font-weight: 600; }
.new-card:hover { border-color: var(--accent); color: var(--accent); }

.empty { text-align: center; padding: 80px 20px; border: 1.5px dashed var(--line); border-radius: 16px; color: var(--muted); }
.empty h3 { color: var(--text); margin: 0 0 8px; font-size: 20px; }

.dropzone-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(255,90,54,.12); border: 3px dashed var(--accent); display: grid; place-items: center; font-size: 26px; font-weight: 800; pointer-events: none; }

/* upload tray */
.tray { position: fixed; right: 20px; bottom: 20px; width: 380px; max-width: calc(100vw - 40px); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.5); z-index: 40; overflow: hidden; }
.tray header { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 700; }
.tray .items { max-height: 320px; overflow: auto; }
.up { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.up:last-child { border-bottom: 0; }
.up .row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.up .row b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.up .bar { height: 4px; background: var(--panel-2); border-radius: 3px; margin: 7px 0 4px; overflow: hidden; }
.up .bar i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.up.done .bar i { background: var(--ok); }
.up.error .bar i { background: var(--bad); }
.up small { color: var(--muted); font-size: 12px; font-family: var(--mono); }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; width: 100%; max-width: 480px; padding: 24px; max-height: calc(100vh - 40px); overflow: auto; }
.modal h3 { margin: 0 0 18px; font-size: 20px; letter-spacing: -.02em; }
.modal footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.kinds button { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 12px 8px; text-align: left; }
.kinds button b { display: block; font-size: 13px; }
.kinds button span { font-size: 11px; color: var(--muted); }
.kinds button.on { border-color: var(--accent); background: rgba(255,90,54,.08); }
.linkbox { display: flex; gap: 8px; }
.menu { position: fixed; z-index: 70; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 5px; min-width: 190px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 7px; }
.menu button:hover { background: #2b3036; }

.shares { margin-top: 36px; }
.shares h2 { font-size: 15px; margin: 0 0 12px; }
.share-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; font-size: 13px; }
.share-row .grow { flex: 1; min-width: 0; }
.share-row .grow b { display: block; }
.kind-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 3px 7px; border-radius: 6px; background: var(--panel-2); color: var(--muted); }

/* review */
.review { display: grid; grid-template-columns: 1fr 380px; height: 100%; }
.review .stage { display: flex; flex-direction: column; min-width: 0; background: #000; }
.review .stagebar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.review .stagebar h1 { font-size: 15px; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewport { flex: 1; position: relative; display: grid; place-items: center; overflow: hidden; min-height: 0; }
.viewport video, .viewport img { max-width: 100%; max-height: 100%; display: block; }
.viewport .media-wrap { position: relative; max-width: 100%; max-height: 100%; display: grid; }
.viewport canvas.draw { position: absolute; inset: 0; width: 100%; height: 100%; }
.viewport canvas.draw.live { cursor: crosshair; }
.viewport .nofile { color: var(--muted); text-align: center; max-width: 420px; padding: 20px; display: grid; justify-items: center; gap: 4px; }
.viewport .nofile h3 { color: var(--text); margin: 8px 0 4px; }
.pbar { width: 260px; height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.pbar i { display: block; height: 100%; background: var(--accent); transition: width .6s; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--panel-2); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pill.prep { background: rgba(0,0,0,.75); color: #fff; }
.pill.prep::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 5px; vertical-align: 1px; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.controls { background: var(--panel); border-top: 1px solid var(--line); padding: 10px 16px 14px; }
.scrub { position: relative; height: 34px; cursor: pointer; margin-bottom: 6px; }
.scrub .track { position: absolute; left: 0; right: 0; top: 20px; height: 6px; background: var(--panel-2); border-radius: 3px; }
.scrub .buffered { position: absolute; left: 0; top: 0; bottom: 0; background: #2f343b; border-radius: 3px; }
.scrub .played { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 3px; }
.scrub .head { position: absolute; top: 14px; width: 2px; height: 18px; background: #fff; transform: translateX(-1px); }
.scrub .range { position: absolute; top: 20px; height: 6px; background: rgba(255,255,255,.35); }
.scrub .mk { position: absolute; top: 0; width: 18px; height: 18px; border-radius: 50%; transform: translateX(-9px); background: var(--panel-2); border: 2px solid var(--accent); font-size: 9px; font-weight: 800; display: grid; place-items: center; color: #fff; }
.scrub .mk.resolved { border-color: var(--ok); opacity: .6; }
.ctl-row { display: flex; align-items: center; gap: 6px; }
.ctl-row .tc { font: 700 15px var(--mono); padding: 4px 10px; background: var(--bg); border-radius: 7px; border: 1px solid var(--line); letter-spacing: .02em; }
.ctl-row .grow { flex: 1; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent; display: grid; place-items: center; color: var(--text); }
.icon-btn:hover { background: var(--panel-2); }
.icon-btn.on { background: var(--accent); color: var(--accent-ink); }
.icon-btn svg { width: 18px; height: 18px; }

.notes { background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.notes header { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.notes header b { flex: 1; }
.decision { display: flex; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.decision .btn { flex: 1; justify-content: center; }
.status-banner { padding: 10px 16px; font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--line); }
.status-banner.approved { background: rgba(60,207,122,.12); color: var(--ok); }
.status-banner.changes { background: rgba(255,176,32,.1); color: var(--warn); }
.clist { flex: 1; overflow: auto; padding: 8px; }
.cm { padding: 10px 10px 10px 12px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.cm:hover { background: var(--panel-2); }
.cm.active { border-color: var(--accent); background: rgba(255,90,54,.06); }
.cm.resolved { opacity: .55; }
.cm .top { display: flex; gap: 8px; align-items: baseline; font-size: 12px; }
.cm .top b { font-size: 13px; }
.cm .tcb { font: 700 11px var(--mono); color: var(--accent); background: rgba(255,90,54,.12); padding: 2px 6px; border-radius: 5px; }
.cm .body { margin: 5px 0 0; white-space: pre-wrap; word-wrap: break-word; }
.cm .acts { display: flex; gap: 4px; margin-top: 6px; }
.cm .acts button { border: 0; background: none; color: var(--muted); font-size: 12px; padding: 2px 6px; border-radius: 5px; }
.cm .acts button:hover { background: #2b3036; color: var(--text); }
.cm .reply { margin: 8px 0 0 14px; padding-left: 10px; border-left: 2px solid var(--line); font-size: 13px; }
.cm .num { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--accent); font-size: 9px; font-weight: 800; }
.compose { border-top: 1px solid var(--line); padding: 12px 16px 16px; }
.compose textarea { resize: none; min-height: 70px; }
.compose .opts { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; }
.compose .opts .grow { flex: 1; }
.chip { font: 700 11px var(--mono); padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); }
.chip.on { color: var(--accent); border-color: var(--accent); }
.swatch { width: 18px; height: 18px; border-radius: 50%; border: 2px solid transparent; }
.swatch.on { border-color: #fff; }

/* share pages */
.share-page { min-height: 100%; }
.share-head { padding: 28px 32px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; background: radial-gradient(700px 300px at 0% 0%, rgba(255,90,54,.14), transparent 60%); }
.share-head h1 { margin: 2px 0 0; font-size: 26px; letter-spacing: -.02em; }
.request-box { max-width: 640px; margin: 48px auto; padding: 0 20px; }
.bigdrop { border: 2px dashed var(--line); border-radius: 18px; padding: 60px 20px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.bigdrop:hover, .bigdrop.over { border-color: var(--accent); background: rgba(255,90,54,.05); }
.bigdrop h2 { margin: 0 0 6px; }
.center-card { max-width: 380px; margin: 12vh auto; padding: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }

#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: pop .2s ease-out; }
.toast.err { background: var(--bad); color: #fff; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

.kbd { font: 600 11px var(--mono); padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); }

@media (max-width: 900px) {
  .landing { grid-template-columns: 1fr; }
  .landing .hero { padding: 40px 20px; }
  .features { grid-template-columns: 1fr; }
  .auth { border-left: 0; border-top: 1px solid var(--line); padding: 32px 16px; }
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .review { grid-template-columns: 1fr; height: auto; }
  .review .viewport { min-height: 40vh; }
  .notes { border-left: 0; border-top: 1px solid var(--line); min-height: 60vh; }
  .share-head { padding: 20px 16px; }
}
