:root {
  --bg: #050505;
  --surface: #0d0d0d;
  --surface-2: #141414;
  --surface-3: #1a1a1a;
  --border: #262626;
  --text: #ffffff;
  --muted: #a6a6a6;
  --primary: #e02e33;
  --primary-hover: #e65b5e;
  --success: #22c55e;
  --warning: #f59e0b;
  --radius: 12px;
  --font-body: 'Assistant', system-ui, sans-serif;
  --font-head: 'Montserrat', 'Assistant', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: var(--font-body); font-size: 16px; line-height: 1.5; min-height: 100vh; }
h1, h2, h3 { margin: 0; font-weight: 800; line-height: 1.2; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
a { color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.error { color: var(--primary-hover); min-height: 1.5em; margin: 0; font-size: 14px; }

/* buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-3); color: var(--text); font: inherit; font-weight: 700; font-size: 15px;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: #222; border-color: #333; }
.btn.primary { background: var(--primary); border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger:hover { border-color: var(--primary); color: var(--primary-hover); }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.link:hover { color: var(--text); text-decoration: underline; }
.link.danger:hover { color: var(--primary-hover); }

input, textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font: inherit; padding: 10px 12px; outline: none;
}
input:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 72px; }
label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--muted);
}
.badge.red { background: rgba(224, 46, 51, .15); border-color: rgba(224, 46, 51, .4); color: #ff8a8d; }
.badge.green { background: rgba(34, 197, 94, .12); border-color: rgba(34, 197, 94, .4); color: #6ee7a0; }
.badge.warn { background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .4); color: #fbbf5a; }
.badge.tiny { font-size: 11px; padding: 0 8px; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px;
  padding: 12px 20px; background: rgba(5, 5, 5, .9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.brand span { font-family: var(--font-head); font-weight: 900; letter-spacing: .08em; font-size: 18px; }
.topbar-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.topbar-actions { display: flex; gap: 8px; }

.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 380px; display: grid; gap: 16px; text-align: center; }
.login .brand { justify-self: center; }
.login label { text-align: start; }

/* dashboard */
.container { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; display: grid; gap: 28px; }
.grid-form { display: grid; grid-template-columns: 2fr 1.5fr 1.5fr auto; gap: 12px; align-items: end; margin-top: 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head input { max-width: 260px; }
.project-list { display: grid; gap: 10px; }
.project {
  display: flex; align-items: center; gap: 16px; padding: 16px 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.project:hover { border-color: #333; }
.project-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.project-title { font-weight: 800; font-size: 17px; text-decoration: none; }
.project-title:hover { color: var(--primary-hover); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.project-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* review */
.review {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px;
  padding: 20px; max-width: 1600px; margin: 0 auto; align-items: start;
}
.stage { display: grid; gap: 12px; min-width: 0; }
.player { background: #000; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.player video { display: block; width: 100%; max-height: 72vh; background: #000; }
.markers { position: relative; height: 14px; margin: 0 4px; border-radius: 99px; background: var(--surface-2); }
.marker {
  position: absolute; top: 50%; width: 12px; height: 12px; margin-left: -6px; transform: translateY(-50%);
  border-radius: 50%; background: var(--primary); border: 2px solid var(--bg); cursor: pointer; padding: 0;
}
.marker { background: var(--c, var(--primary)); }
.marker.resolved { opacity: .35; }
.marker:hover { transform: translateY(-50%) scale(1.35); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.versions { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--muted); font: inherit; font-weight: 700; cursor: pointer;
}
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.toolbar-actions { display: flex; gap: 8px; }
.approved {
  padding: 12px 16px; border-radius: var(--radius); background: rgba(34, 197, 94, .1);
  border: 1px solid rgba(34, 197, 94, .35); color: #86efac; font-weight: 700;
}
.approved .link { margin-inline-start: 8px; }
.empty { text-align: center; padding: 56px 20px; display: grid; gap: 8px; }

.upload { display: grid; gap: 12px; }
.upload-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.progress { display: grid; gap: 6px; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }

.panel {
  position: sticky; top: 76px; display: flex; flex-direction: column; max-height: calc(100vh - 96px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--border); }
.count { color: var(--muted); font-weight: 600; }
.seg { display: flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 700; padding: 4px 12px; border-radius: 999px; cursor: pointer; }
.seg button.active { background: var(--surface-3); color: var(--text); }
.comments { flex: 1; overflow-y: auto; padding: 8px; display: grid; gap: 6px; align-content: start; min-height: 120px; }
.comments .muted { padding: 24px 12px; text-align: center; }
.thread { display: grid; gap: 4px; }
.comment {
  padding: 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid transparent;
  border-inline-start: 3px solid var(--c, var(--border));
}
.comment:hover { border-color: var(--border); border-inline-start-color: var(--c, var(--border)); }
.comment.active { border-color: var(--c, var(--primary)); }
.comment.resolved { opacity: .5; }
.comment.from-admin { background: #18100f; }
.comment .author { color: var(--c, var(--text)); }
.comment.reply { margin-inline-start: 20px; padding: 10px 12px; background: #111; }
.reply-form { margin-inline-start: 20px; display: grid; gap: 8px; padding: 10px; border-radius: 10px; background: #111; border: 1px solid var(--border); }
.reply-form textarea { min-height: 56px; }
.reply-row { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.reply-row .btn { height: 34px; font-size: 14px; }
.comment-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.comment p { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-actions { display: flex; gap: 14px; margin-top: 8px; }
.tc {
  font-family: ui-monospace, Consolas, monospace; font-size: 13px; font-weight: 700; direction: ltr;
  background: rgba(224, 46, 51, .15); color: #ff8a8d; border: 0; border-radius: 6px; padding: 2px 8px; cursor: pointer;
}
.tc:hover { background: var(--primary); color: #fff; }
.composer { border-top: 1px solid var(--border); padding: 12px; display: grid; gap: 8px; background: var(--surface); }
.composer-row { display: flex; align-items: center; gap: 10px; }
.composer-row .btn { margin-inline-start: auto; }
.tc-toggle { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; color: var(--text); cursor: pointer; }
.tc-toggle input { width: auto; accent-color: var(--primary); }
.tc-toggle span { font-family: ui-monospace, Consolas, monospace; direction: ltr; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 700;
  transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--primary); color: #fff; }

@media (max-width: 960px) {
  .review { grid-template-columns: 1fr; padding: 12px; }
  .panel { position: static; max-height: none; }
  .comments { max-height: 60vh; }
  .grid-form { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { padding: 10px 16px; gap: 10px; }
  .brand span { display: none; }
  .topbar-actions .btn { padding: 0 12px; font-size: 14px; }
  .project { flex-direction: column; align-items: stretch; }
  .project-actions { flex-wrap: wrap; }
  .section-head { flex-direction: column; align-items: stretch; }
  .section-head input { max-width: none; }
}
