:root {
  --bg: #0a0710;
  --panel: #130d1e;
  --panel2: #1b1230;
  --line: #33244f;
  --text: #f5f2fa;
  --muted: #aaa1bb;
  --red: #e0262d;
  --orange: #ff7a2a;
  --violet: #8b4dff;
  --green: #36d399;
  --yellow: #f7c948;
  --sky: #7ec8ff;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font-family: Inter, "Segoe UI", sans-serif;
  background:
    radial-gradient(900px 500px at 85% -10%, #38136b 0, transparent 65%),
    radial-gradient(700px 420px at -10% 110%, #5a1d7a 0, transparent 55%),
    var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: Syne, Inter, sans-serif; letter-spacing: -0.03em; }
.app { display: grid; grid-template-columns: 248px 1fr; grid-template-rows: 68px 1fr auto; min-height: 100vh; }
.top {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  background: #0d0815cc;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 9;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { width: 36px; height: 36px; }
.brand strong { font-family: Syne, Inter, sans-serif; font-size: 16px; }
.brand span {
  color: var(--muted);
  font-size: 12px;
  border-left: 1px solid #4b3a63;
  padding-left: 12px;
  letter-spacing: 0.02em;
}
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.who select, .class-pill {
  border: 1px solid var(--line);
  background: #140e20;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
}
.who select option { background: #140e20; }
.class-pill { color: var(--yellow); font-weight: 700; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--violet), #4b1d9a);
  color: #fff; font-size: 12px; font-weight: 800;
  box-shadow: 0 0 0 3px #2a184866;
}
nav {
  background: #0e0916cc;
  border-right: 1px solid var(--line);
  padding: 16px 12px 28px;
  backdrop-filter: blur(10px);
}
nav button {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 3px 0;
}
nav button:hover { background: #1a1228; }
nav button.on {
  background: #241736;
  border-color: #4a3274;
  box-shadow: inset 3px 0 0 var(--yellow);
}
nav button small {
  min-width: 1.4rem;
  text-align: center;
  border-radius: 999px;
  background: #2a1848;
  color: var(--yellow);
  font-size: 11px;
  padding: 2px 6px;
}
main { padding: 22px 24px 48px; }
.player {
  grid-column: 1 / -1;
  display: none;
  gap: 12px;
  align-items: center;
  padding: 12px 18px;
  background: linear-gradient(90deg, #1a1030, #2a1450 55%, #123528);
  color: #fff;
  border-top: 1px solid #4a3274;
}
.player.on { display: flex; }
.player audio { width: min(280px, 40vw); height: 32px; }
.player .grow { flex: 1; min-width: 0; }
.player button {
  background: transparent;
  color: #fff;
  border: 1px solid #6a45a8;
  border-radius: 999px;
  padding: 6px 12px;
}
.player .play { width: 42px; height: 42px; padding: 0; border: 0; background: var(--violet); }
.player .play.audio { background: #1c7a52; }
.head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.05; }
.sub { color: var(--muted); max-width: 680px; line-height: 1.5; margin-top: 8px; }
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--yellow);
  font-weight: 700;
  margin-bottom: 6px;
}
.grid { display: grid; gap: 12px; }
.kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.two { grid-template-columns: 1.2fr 0.8fr; }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.seven { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card {
  background: linear-gradient(180deg, #181024, #120c1c);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 16px 40px rgba(8, 4, 16, 0.35);
}
.card h3 { font-size: 16px; }
.kpi .num {
  font-size: 32px;
  font-weight: 800;
  margin: 6px 0 2px;
  font-family: Syne, Inter, sans-serif;
  background: linear-gradient(90deg, var(--violet), var(--sky));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.kpi .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.kpi .delta { color: #c8bdd8; font-size: 12px; }
.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  margin-right: 6px;
  border: 1px solid #4a3274;
  background: #24183a;
  color: #ddd4f0;
}
.tag.lock { background: #2a1420; border-color: #6b3040; color: #ffb4c0; }
.row.locked, .card.locked, tr.locked { opacity: 0.62; }
.tag.audio { background: #10281f; border-color: #1f6b4e; color: #b8ffe0; }
.tag.video { background: #24143f; border-color: #6a45a8; color: #e4d4ff; }
.tag.print, .tag.pdf { background: #2a2412; border-color: #8a6420; color: #ffe3a3; }
.meta { color: var(--muted); font-size: 13px; line-height: 1.45; margin-top: 6px; }
.btn {
  border: 1px solid var(--line);
  background: #1a1228;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
}
.btn.primary {
  background: linear-gradient(180deg, #9a63ff, #6d35e0);
  border-color: #b48bff;
  color: #fff;
  box-shadow: 0 8px 24px #8b4dff55;
}
.btn.tiny { padding: 6px 12px; font-size: 13px; }
.btn.good { background: #123528; border-color: #1f6b4e; color: #b8ffe0; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.tag.low { background: #3a1620; border-color: #8a3040; color: #ffc4ce; }
.tag.high { background: #123528; border-color: #1f6b4e; color: #b8ffe0; }
.phase { font-size: 11px; letter-spacing: 0.16em; color: #7d7094; margin: 14px 8px 6px; }
.tabs, .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tabs { border-bottom: 1px solid var(--line); margin-bottom: 14px; gap: 0; }
.tabs button { background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); padding: 8px 12px; }
.tabs button.on { color: var(--yellow); border-bottom-color: var(--yellow); }
.row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid #2a1d40; }
.row:last-child { border-bottom: 0; }
.media { display: flex; gap: 12px; align-items: center; }
.play { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--violet); color: #fff; font-size: 16px; flex: none; }
.play.audio { background: #1c7a52; }
.progress { height: 6px; background: #2a1d40; border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--violet), var(--sky)); }
.tablebox { overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #2a1d40; vertical-align: middle; }
th { color: #c3b6d6; font-weight: 600; background: #160f24; }
tr.click:hover { background: #1c1430; cursor: pointer; }
.note { color: var(--muted); font-size: 12px; margin-top: 10px; }
.callout { border: 1px solid #8a6420; background: #2a2112; border-radius: 14px; padding: 12px 14px; color: #ffe3a3; }
.tl { margin: 12px 0 0; padding: 0; list-style: none; }
.tl li { position: relative; padding: 0 0 16px 18px; border-left: 1px solid #3a2a55; }
.tl li::before { content: ""; position: absolute; left: -5px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--violet); }
.drawer { position: fixed; top: 0; right: 0; height: 100%; width: min(440px, 100%); background: #110b19; border-left: 1px solid var(--line); transform: translateX(100%); transition: 0.2s ease; z-index: 20; padding: 18px; overflow: auto; }
.drawer.on { transform: none; display: flex; flex-direction: column; }
.drawer.wide { width: min(72vw, 1100px); }
.drawer.full { width: 100%; }
#drawerBody { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.viewer-bar { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.viewer-bar h2 { margin: 0; font-size: 18px; }
.drawer .stage.film, #modalBox .stage.film { aspect-ratio: auto; flex: 1; height: calc(100vh - 120px); min-height: 280px; }
.drawer.full .stage.film, #modalBox.full .stage.film, #drawer:fullscreen .stage.film, #modalBox:fullscreen .stage.film { height: calc(100vh - 72px); }
#modalBox:has(.stage.film) { display: flex; flex-direction: column; }
#modalBox:has(.stage.film) .stage.film { flex: 1; min-height: 0; }
#modalBox.wide { width: min(100vw - 24px, 100%); max-height: 96vh; }
#modalBox.full { width: 100%; height: 100%; max-height: none; border-radius: 0; }
#drawer:fullscreen, #modalBox:fullscreen { background: #110b19; padding: 18px; overflow: auto; }
.toast { position: fixed; bottom: 78px; left: 50%; transform: translateX(-50%) translateY(12px); background: #241736; border: 1px solid #6a45a8; border-radius: 12px; padding: 10px 14px; opacity: 0; pointer-events: none; transition: 0.2s; z-index: 40; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.flip { min-height: 150px; border-radius: 14px; border: 1px dashed #6a45a8; display: grid; place-items: center; text-align: center; padding: 18px; background: #160f24; }
.q { padding: 12px 0; border-bottom: 1px solid #2a1d40; }
.field { background: #120c1c; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; }
.split { display: grid; grid-template-columns: 220px 1fr; gap: 12px; }
.sidebtn { width: 100%; text-align: left; margin-top: 6px; }
dl { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; }
.player .grow { flex: 1; min-width: 0; }
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.gate .card { width: min(460px, 100%); }
.stage {
  margin-top: 14px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: radial-gradient(500px 180px at 70% 20%, #4b2a86, transparent 60%), #0c0814;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: flex-end;
  padding: 16px;
  min-height: 180px;
}
.stage.film { display: block; padding: 0; }
.stage video, .stage iframe { width: 100%; height: 100%; border: 0; background: #0c0814; object-fit: contain; }
.empty {
  border: 1px dashed #4a3274;
  border-radius: 18px;
  padding: 22px;
  color: var(--muted);
  background: #120c1c;
}
.bento { text-align: left; width: 100%; transition: transform 0.15s ease, border-color 0.15s ease; }
.bento:hover { border-color: var(--violet); transform: translateY(-2px); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters input {
  background: #140e20;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
}
.chip {
  border: 1px solid var(--line);
  background: #140e20;
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--muted);
}
.chip.on { background: #2a1848; border-color: #6a45a8; color: #fff; }
.modal {
  position: fixed; inset: 0;
  background: #05030acc;
  display: none;
  place-items: center;
  padding: 20px;
  z-index: 20;
}
.modal.on { display: grid; }
.modal .sheet { width: min(920px, 100%); max-height: 88vh; overflow: auto; }
html[data-theme="light"] {
  --bg: #f7f4fb;
  --panel: #ffffff;
  --panel2: #f4eefe;
  --line: #e4d9f6;
  --text: #1b1230;
  --muted: #65597a;
  --violet: #6d35e0;
  --yellow: #8a6208;
  --green: #0e7a52;
  --sky: #1d6fbf;
}
html[data-theme="light"] body {
  background:
    radial-gradient(900px 480px at 90% -15%, #eadcff 0, transparent 62%),
    radial-gradient(640px 380px at -10% 110%, #ffe8c7 0, transparent 55%),
    var(--bg);
}
html[data-theme="light"] .top,
html[data-theme="light"] nav { background: #ffffffd6; }
html[data-theme="light"] .card,
html[data-theme="light"] .empty { background: #fff; box-shadow: 0 12px 32px rgba(80, 40, 140, 0.08); }
html[data-theme="light"] .who select,
html[data-theme="light"] .chip,
html[data-theme="light"] .btn,
html[data-theme="light"] .filters input { background: #fff; }
html[data-theme="light"] .who select option { background: #fff; color: #1b1230; }
html[data-theme="light"] nav button:hover { background: #f4eefe; }
html[data-theme="light"] nav button.on { background: #f3e8ff; border-color: #d7c4fb; }
html[data-theme="light"] nav button small { background: #fff4cc; color: #8a6208; }
html[data-theme="light"] .tag { background: #f3e8ff; color: #4b1d9a; border-color: #d7c4fb; }
html[data-theme="light"] .tag.lock { background: #fff1f2; color: #9f1239; border-color: #fecdd3; }
html[data-theme="light"] .tag.audio { background: #e7faf3; color: #0e7a52; border-color: #b7ead4; }
html[data-theme="light"] .tag.video { background: #f3e8ff; color: #5b2cc4; border-color: #d7c4fb; }
html[data-theme="light"] .tag.print,
html[data-theme="light"] .tag.pdf { background: #fff6df; color: #8a6208; border-color: #f0ddaa; }
html[data-theme="light"] .chip.on { background: #6d35e0; color: #fff; border-color: #6d35e0; }
html[data-theme="light"] .player { background: linear-gradient(90deg, #2a1450, #6d35e0 60%, #0e7a52); }
html[data-theme="light"] .modal { background: rgba(27, 18, 48, 0.45); }
html[data-theme="light"] .stage { background: #1b1230; }
html[data-theme="light"] .kpi .num { background: linear-gradient(90deg, #6d35e0, #1d6fbf); -webkit-background-clip: text; background-clip: text; }
html[data-theme="light"] .kpi .delta,
html[data-theme="light"] .phase { color: #65597a; }
html[data-theme="light"] .tabs button.on { color: #8a6208; }
html[data-theme="light"] th { background: #f4eefe; color: #4b3a63; }
html[data-theme="light"] .row,
html[data-theme="light"] th,
html[data-theme="light"] td,
html[data-theme="light"] .q,
html[data-theme="light"] .tl li { border-color: #e4d9f6; }
html[data-theme="light"] tr.click:hover { background: #f4eefe; }
html[data-theme="light"] .progress,
html[data-theme="light"] .flip,
html[data-theme="light"] .field { background: #f7f4fb; }
html[data-theme="light"] .drawer, html[data-theme="light"] #drawer:fullscreen, html[data-theme="light"] #modalBox:fullscreen { background: #fff; }
html[data-theme="light"] .toast { background: #fff; color: #1b1230; }
html[data-theme="light"] .callout { background: #fff6df; color: #5c4204; }
html[data-theme="light"] .tag.low { background: #ffe8ee; color: #9d1230; border-color: #f3c2ce; }
html[data-theme="light"] .tag.high,
html[data-theme="light"] .btn.good { background: #e7faf3; color: #0e7a52; border-color: #b7ead4; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr auto; }
  nav { display: flex; gap: 6px; overflow: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  nav button { width: auto; white-space: nowrap; }
  nav button.on { box-shadow: none; }
  .kpis, .four, .seven { grid-template-columns: 1fr 1fr; }
  .two, .three, .split { grid-template-columns: 1fr; }
  .phase { display: none; }
  .brand span { display: none; }
}
