:root {
  --accent: #6d5cff;
  --bg: #0e1015;
  --panel: #161a22;
  --panel-2: #1d222c;
  --line: #2a3140;
  --text: #e8ecf4;
  --muted: #93a0b5;
  --good: #35c17e;
  --warn: #e0a33a;
  --bad: #e0534a;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.boot { padding: 60px; text-align: center; color: var(--muted); }

/* ---------- layout ---------- */
.app { min-height: 100%; }
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; padding: 6px 8px 16px; }
.brand .dot { width: 12px; height: 12px; border-radius: 4px; background: var(--accent); }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 8px; color: var(--muted); cursor: pointer; font-weight: 500; }
.nav-item:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-spacer { flex: 1; }
.nav-user { border-top: 1px solid var(--line); padding-top: 12px; font-size: 13px; color: var(--muted); }
.main { padding: 24px 28px 60px; max-width: 1400px; overflow-x: hidden; }

/* ---------- typography ---------- */
h1 { font-size: 23px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }
.small { font-size: 12.5px; }

/* ---------- controls ---------- */
button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 8px 13px; transition: filter .12s;
}
button:hover:not(:disabled), .btn:hover { filter: brightness(1.18); text-decoration: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: transparent; color: #fff; }
button.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
button.ghost { background: transparent; }
button.sm { padding: 4px 9px; font-size: 12.5px; }
button.icon { padding: 4px 8px; }
input, select, textarea {
  font: inherit; width: 100%; padding: 9px 11px; border-radius: 8px;
  border: 1px solid var(--line); background: #10141b; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { resize: vertical; min-height: 76px; }
input[type=checkbox] { width: auto; }
input[type=range] { padding: 0; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- surfaces ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card.tight { padding: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 26px; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 12.5px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 9px 13px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 600; font-size: 14px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--panel-2); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pill.good { background: rgba(53,193,126,.16); color: var(--good); }
.pill.warn { background: rgba(224,163,58,.16); color: var(--warn); }
.pill.bad { background: rgba(224,83,74,.16); color: var(--bad); }
.pill.accent { background: rgba(109,92,255,.2); color: #b3a9ff; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.empty { padding: 34px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- media ---------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
.media-card { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.media-card.selected { border-color: var(--accent); }
.media-thumb { width: 100%; aspect-ratio: 16/10; object-fit: cover; background: #0a0d12; display: block; }
.media-thumb.placeholder { display: grid; place-items: center; color: var(--muted); font-size: 26px; }
.media-meta { padding: 8px 9px; font-size: 12px; }
.media-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px; text-align: center; color: var(--muted); }
.dropzone.hot { border-color: var(--accent); color: var(--text); }
video.preview { width: 100%; max-height: 420px; background: #000; border-radius: 8px; display: block; }

/* ---------- recorder ---------- */
.rec-stage { position: relative; background: #000; border-radius: 10px; overflow: hidden; }
.rec-stage video { width: 100%; max-height: 62vh; display: block; }
.rec-stage video.mirrored { transform: scaleX(-1); }
.prompter { position: absolute; left: 0; right: 0; top: 0; height: 46%; overflow: hidden;
  background: linear-gradient(#000c, #0009); padding: 14px 22px; }
.prompter-inner { font-size: 26px; line-height: 1.45; font-weight: 700; text-align: center; white-space: pre-wrap; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); display: inline-block; margin-right: 6px; }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; font-size: 96px; font-weight: 800; background: #0008; }

/* ---------- timeline editor ---------- */
.timeline { display: flex; gap: 8px; overflow-x: auto; padding: 10px; background: #0b0e13; border: 1px solid var(--line); border-radius: 9px; min-height: 104px; }
.tl-clip { flex: 0 0 auto; width: 132px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.tl-clip.active { border-color: var(--accent); }
.tl-clip img { width: 100%; height: 62px; object-fit: cover; display: block; background: #000; }
.tl-clip .lab { padding: 4px 6px; font-size: 11px; }
.progress { height: 7px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); transition: width .3s; }
.cue-row { display: grid; grid-template-columns: 92px 92px 1fr 34px; gap: 7px; margin-bottom: 6px; align-items: center; }
.beat { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 9px; background: var(--panel-2); }

/* ---------- toasts & modal ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--accent); padding: 11px 15px;
  border-radius: 8px; max-width: 380px; box-shadow: 0 8px 26px #0008; font-size: 14px; }
.toast.err { border-left-color: var(--bad); }
.toast.ok { border-left-color: var(--good); }
.modal-bg { position: fixed; inset: 0; background: #000b; display: grid; place-items: center; z-index: 70; padding: 20px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px; }
.auth-card h1 { text-align: center; }
.auth-card .sub { text-align: center; }

/* ---------- public review ---------- */
.review-wrap { max-width: 900px; margin: 0 auto; padding: 28px 20px 60px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell { min-height: 92px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: var(--panel); font-size: 12px; }
.cal-cell.today { border-color: var(--accent); }
.cal-cell .d { color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.cal-ev { background: var(--panel-2); border-radius: 5px; padding: 3px 5px; margin-bottom: 3px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; overflow-x: auto; align-items: center; border-right: none; border-bottom: 1px solid var(--line); }
  .nav-user, .nav-spacer { display: none; }
  .brand { padding: 6px 8px; }
  .main { padding: 16px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
}
