:root {
  --bg: #070912;
  --panel: rgba(18, 24, 40, 0.88);
  --panel-2: rgba(25, 33, 54, 0.86);
  --line: rgba(255,255,255,0.1);
  --line-2: rgba(255,255,255,0.18);
  --text: #f8f2e9;
  --muted: #abb3c4;
  --faint: #71798d;
  --gold: #f6c76b;
  --orange: #ff9b5c;
  --purple: #b896ff;
  --blue: #7dbbff;
  --green: #7ddc9f;
  --red: #ff7774;
  --radius: 22px;
  --radius-sm: 15px;
  --shadow: 0 22px 90px rgba(0,0,0,.42);
  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at 15% 5%, rgba(246,199,107,.18), transparent 32%),
    radial-gradient(circle at 85% 0%, rgba(184,150,255,.15), transparent 30%),
    radial-gradient(circle at 50% 95%, rgba(125,187,255,.10), transparent 36%),
    var(--bg);
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  position: relative;
  overflow: hidden;
}
.login-glow {
  position: absolute;
  inset: auto -10% -35% -10%;
  height: 420px;
  background: radial-gradient(circle, rgba(246,199,107,.18), transparent 65%);
  filter: blur(20px);
}
.login-panel {
  width: min(1120px, 100%);
  position: relative;
  border: 1px solid var(--line);
  border-radius: 34px;
  background: linear-gradient(180deg, rgba(18,24,40,.95), rgba(8,10,19,.90));
  box-shadow: var(--shadow);
  padding: clamp(22px, 4vw, 42px);
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-large { align-items: flex-start; gap: 20px; }
.brand-mark {
  width: 48px; height: 48px; border-radius: 16px;
  background: linear-gradient(135deg, var(--gold), var(--orange) 48%, var(--purple));
  display: grid; place-items: center; color: #130b05; font-weight: 1000;
  box-shadow: 0 12px 40px rgba(246,199,107,.24);
  flex: none;
}
.brand-large .brand-mark { width: 76px; height: 76px; border-radius: 26px; font-size: 1.25rem; }
.brand strong { display: block; font-size: 1.08rem; }
.brand span:not(.eyebrow) { color: var(--muted); font-size: .86rem; }
h1, h2, h3 { margin: 0; line-height: 1.05; }
h1 { font-size: clamp(2.2rem, 5vw, 5rem); letter-spacing: -0.05em; }
h2 { font-size: clamp(1.35rem, 2.3vw, 2rem); }
h3 { font-size: 1.05rem; }
p { color: var(--muted); line-height: 1.58; }
.eyebrow { color: var(--gold); text-transform: uppercase; letter-spacing: .14em; font-size: .73rem; font-weight: 900; }

.login-card {
  margin: 28px 0 18px;
  display: flex; gap: 16px; align-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.045);
}
.google-pill {
  width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center;
  background: #fff; color: #333; font-weight: 1000; font-size: 1.4rem;
}
.login-users { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.login-user {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.045);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--text);
  text-align: left;
  min-height: 240px;
  transition: .18s ease;
}
.login-user:hover { transform: translateY(-3px); border-color: rgba(246,199,107,.44); background: rgba(246,199,107,.08); }
.login-user strong, .login-user span { display: block; }
.login-user span { color: var(--muted); margin-top: 3px; font-size: .86rem; }
.login-user p { font-size: .88rem; min-height: 76px; }
.login-note {
  margin-top: 18px; padding: 14px 16px; border: 1px solid rgba(246,199,107,.25);
  border-radius: 18px; color: var(--muted); background: rgba(246,199,107,.08);
}
.login-note strong { color: var(--gold); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 306px 1fr; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 22px;
  display: flex; flex-direction: column; gap: 16px;
  background: rgba(5,7,14,.78); border-right: 1px solid var(--line); backdrop-filter: blur(18px);
}
.user-card, .mini-stat {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(255,255,255,.065), rgba(255,255,255,.035));
  padding: 14px;
}
.user-card p { margin: 10px 0 0; font-size: .84rem; }
.user-card span { color: var(--muted); font-size: .8rem; display: block; }
.nav { display: flex; flex-direction: column; gap: 5px; overflow: auto; padding-right: 4px; }
.nav button {
  border: 1px solid transparent; background: transparent; color: var(--muted);
  padding: 10px 12px; border-radius: 14px; text-align: left; transition: .16s ease;
}
.nav button:hover { background: rgba(255,255,255,.055); color: var(--text); }
.nav button.active { background: rgba(246,199,107,.12); border-color: rgba(246,199,107,.28); color: var(--text); }
.sidebar-footer { margin-top: auto; display: grid; gap: 10px; color: var(--muted); }
.footer-link { color: var(--gold); text-decoration: none; }
.text-button, .mini-switch {
  border: none; background: transparent; color: var(--blue); text-align: left; padding: 0; cursor: pointer;
}
.mini-switch { margin-top: 10px; font-size: .83rem; }
.mini-stat strong, .mini-stat span { display: block; }
.mini-stat span { color: var(--muted); font-size: .84rem; margin-top: 2px; }

.main { padding: 24px 34px 52px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 22px; }
.topbar h1 { font-size: clamp(2rem, 3vw, 3.4rem); }
.top-actions, .row { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }

.primary, .ghost, .danger, .success, .small-btn, .chip {
  border: 1px solid var(--line-2); border-radius: 14px; color: var(--text);
  background: rgba(255,255,255,.06); padding: 10px 13px; text-decoration: none; display: inline-flex; gap: 7px; align-items: center; justify-content: center;
}
.primary { border: none; background: linear-gradient(135deg, var(--gold), var(--orange)); color: #170b04; font-weight: 900; }
.success { background: rgba(125,220,159,.13); border-color: rgba(125,220,159,.35); color: #dfffea; }
.danger { background: rgba(255,119,116,.13); border-color: rgba(255,119,116,.35); color: #ffd2d0; }
.small-btn, .chip { padding: 7px 10px; border-radius: 12px; font-size: .83rem; }
.chip.active { background: rgba(246,199,107,.16); border-color: rgba(246,199,107,.38); color: var(--gold); }

.view { display: grid; gap: 18px; }
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card, .hero-card, .segment-card, .candidate-card, .secret-card, .canon-card, .outtake-card, .entity-card, .song-card, .profile-card {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); padding: 18px; overflow: hidden;
}
.hero-card {
  display: grid; grid-template-columns: 1fr minmax(260px, 360px); gap: 20px; align-items: stretch;
  background: linear-gradient(135deg, rgba(246,199,107,.14), rgba(184,150,255,.09) 52%, rgba(125,187,255,.08)), var(--panel);
}
.rule-card { border: 1px solid rgba(246,199,107,.26); border-radius: 20px; padding: 18px; background: rgba(0,0,0,.18); display: flex; flex-direction: column; justify-content: center; }
.rule-card strong { color: var(--gold); font-size: 1.3rem; }
.rule-card span { color: var(--muted); margin-top: 8px; }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.card-header p { margin: 6px 0 0; }
.stat-card { position: relative; min-height: 136px; display: flex; flex-direction: column; justify-content: space-between; }
.stat-card strong { font-size: 2.25rem; }
.stat-card span { color: var(--muted); }
.accent { position: absolute; top: 16px; right: 16px; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 22px currentColor; }
.accent.purple { background: var(--purple); } .accent.orange { background: var(--orange); } .accent.red { background: var(--red); } .accent.gold { background: var(--gold); }

.avatar {
  width: 44px; height: 44px; border-radius: 15px; display: grid; place-items: center; flex: none;
  font-weight: 1000; color: #120c05; background: linear-gradient(135deg, var(--gold), var(--orange));
}
.avatar.big { width: 54px; height: 54px; border-radius: 18px; margin-bottom: 12px; }
.avatar.huge { width: 72px; height: 72px; border-radius: 24px; margin-bottom: 14px; font-size: 1.2rem; }
.avatar.purple { background: linear-gradient(135deg, var(--purple), var(--blue)); }
.avatar.red { background: linear-gradient(135deg, var(--red), var(--orange)); }
.avatar.gold { background: linear-gradient(135deg, var(--gold), #fff0aa); }
.avatar.orange { background: linear-gradient(135deg, var(--orange), var(--gold)); }

.badge, .tag {
  display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(255,255,255,.055); color: var(--muted); font-size: .76rem; padding: 5px 9px; white-space: nowrap;
}
.badge.gold { color: var(--gold); border-color: rgba(246,199,107,.35); background: rgba(246,199,107,.1); }
.badge.orange { color: #ffd2b5; border-color: rgba(255,155,92,.35); background: rgba(255,155,92,.1); }
.badge.purple { color: #dfd1ff; border-color: rgba(184,150,255,.35); background: rgba(184,150,255,.1); }
.badge.blue { color: #cce5ff; border-color: rgba(125,187,255,.35); background: rgba(125,187,255,.1); }
.badge.green { color: #ddffe9; border-color: rgba(125,220,159,.35); background: rgba(125,220,159,.1); }
.badge.red { color: #ffd4d2; border-color: rgba(255,119,116,.35); background: rgba(255,119,116,.1); }
.tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.progress { height: 10px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--orange)); border-radius: inherit; }

.checklist { display: grid; gap: 10px; }
.checklist label { display: flex; gap: 10px; color: var(--muted); }
.checklist input { width: auto; accent-color: var(--gold); }
.pipeline-mini, .stack { display: grid; gap: 12px; }
.capture-row { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(180px, 320px) auto; gap: 16px; align-items: center; border: 1px solid var(--line); border-radius: 18px; padding: 14px; background: rgba(255,255,255,.045); }
.capture-row h3, .capture-row p { margin: 0; }
.capture-row p { margin-top: 5px; }
.code { white-space: pre-wrap; overflow: auto; padding: 16px; border-radius: 18px; border: 1px solid var(--line); background: rgba(0,0,0,.28); color: #f7e8c9; }

.review-layout { display: grid; grid-template-columns: 300px minmax(0, 1.15fr) minmax(300px, .75fr); gap: 18px; align-items: start; }
.filter-grid { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.timeline-list { display: grid; gap: 8px; max-height: 520px; overflow: auto; padding-right: 4px; }
.timeline-button { border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.045); color: var(--text); text-align: left; padding: 10px; }
.timeline-button strong { color: var(--gold); display: block; }
.timeline-button span { color: var(--muted); font-size: .84rem; }
.audio-wave { height: 74px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.045); display: flex; align-items: center; gap: 5px; padding: 12px; margin-bottom: 14px; overflow: hidden; }
.audio-wave span { flex: 1; height: 20px; border-radius: 999px; background: linear-gradient(180deg, rgba(246,199,107,.8), rgba(184,150,255,.38)); }
.audio-wave span:nth-child(2) { height: 42px; } .audio-wave span:nth-child(3) { height: 56px; } .audio-wave span:nth-child(4) { height: 33px; } .audio-wave span:nth-child(5) { height: 48px; }
.segment-card, .candidate-card, .secret-card, .canon-card, .outtake-card, .entity-card, .song-card { background: rgba(255,255,255,.045); box-shadow: none; }
.segment-card p, .candidate-card p, .secret-card p { margin: 10px 0; }
.time { font-variant-numeric: tabular-nums; color: var(--gold); font-weight: 900; }
.segment-meta, .secret-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; color: var(--muted); font-size: .84rem; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: rgba(0,0,0,.13); margin: 12px 0; }
.secret-card.owner_only { border-color: rgba(255,119,116,.28); }
.secret-card.dm_only { border-color: rgba(246,199,107,.28); }
.secret-card.shared { border-color: rgba(184,150,255,.28); }
small { color: var(--faint); display: block; line-height: 1.45; }

input, textarea, select {
  width: 100%; border: 1px solid var(--line-2); border-radius: 14px; background: rgba(255,255,255,.06); color: var(--text); padding: 12px 13px; outline: none; margin: 7px 0 13px;
}
select option { background: #111827; color: var(--text); }
textarea { min-height: 108px; resize: vertical; }
.info-box, .rule-box, .private-note, .callout {
  border: 1px solid var(--line); border-radius: 18px; padding: 14px; background: rgba(255,255,255,.045);
}
.info-box strong, .rule-box strong { color: var(--text); }
.info-box p, .rule-box p { margin: 7px 0 0; font-size: .9rem; }
.private-note { margin: 12px 0; color: var(--muted); border-color: rgba(246,199,107,.24); background: rgba(246,199,107,.07); }
.rules-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 12px; }
.matrix-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 18px; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th, td { border-bottom: 1px solid var(--line); padding: 12px; text-align: center; color: var(--muted); }
th:first-child, td:first-child { text-align: left; color: var(--text); position: sticky; left: 0; background: rgba(18,24,40,.98); }
th { color: var(--gold); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.profile-card { text-align: left; box-shadow: none; background: rgba(255,255,255,.045); }
.profile-card.selected { border-color: rgba(246,199,107,.5); background: rgba(246,199,107,.08); }
.profile-card p { font-size: .84rem; }
.pipeline-flow { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.pipeline-step { border: 1px solid var(--line); border-radius: 18px; padding: 14px; background: rgba(255,255,255,.045); }
.pipeline-step span { width: 34px; height: 34px; border-radius: 12px; background: linear-gradient(135deg, var(--gold), var(--orange)); color: #160b04; display: grid; place-items: center; font-weight: 1000; margin-bottom: 10px; }

.empty { border: 1px dashed var(--line-2); border-radius: 18px; padding: 18px; color: var(--muted); background: rgba(255,255,255,.03); }
.modal-backdrop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 24px; background: rgba(0,0,0,.62); backdrop-filter: blur(10px); }
.modal { width: min(860px, 100%); max-height: min(86vh, 900px); overflow: auto; position: relative; padding: 24px; border-radius: 28px; border: 1px solid var(--line-2); background: rgba(18,24,40,.98); box-shadow: var(--shadow); }
.modal-close { position: absolute; top: 14px; right: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: var(--text); border-radius: 12px; width: 38px; height: 38px; }
.quote { font-size: 1.2rem; color: var(--text); }
.modal-actions { margin-top: 18px; }
.account-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.account-option { border: 1px solid var(--line); border-radius: 18px; padding: 14px; background: rgba(255,255,255,.045); color: var(--text); text-align: left; }
.account-option span { color: var(--muted); display: block; margin-top: 4px; }
.toast { position: fixed; bottom: 24px; right: 24px; z-index: 50; padding: 13px 16px; border-radius: 16px; background: rgba(246,199,107,.96); color: #140c05; font-weight: 800; box-shadow: var(--shadow); }
.callout.warning { border-color: rgba(255,119,116,.3); background: rgba(255,119,116,.08); color: var(--muted); }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .nav { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); }
  .review-layout, .hero-card { grid-template-columns: 1fr; }
  .grid.cols-4, .grid.cols-3, .login-users, .rules-grid, .pipeline-flow, .account-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 720px) {
  .main { padding: 18px; }
  .topbar, .card-header, .capture-row { display: grid; grid-template-columns: 1fr; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .login-users, .rules-grid, .pipeline-flow, .account-grid, .segment-meta, .secret-grid { grid-template-columns: 1fr; }
  .nav { grid-template-columns: 1fr 1fr; }
}
