:root {
  --ink: #122033;
  --muted: #5b6b7c;
  --line: rgba(23, 66, 98, 0.12);
  --paper: rgba(255, 252, 247, 0.92);
  --brand: #174262;
  --brand-2: #0f2f46;
  --accent: #c45c26;
  --ok: #1f7a4c;
  --bad: #a33b2c;
  --shadow: 0 16px 40px rgba(15, 47, 70, 0.1);
  --radius: 18px;
  --font: "Manrope", sans-serif;
  --display: "Fraunces", Georgia, serif;
  --side: 230px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: #e8eef3;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(800px 420px at 0% 0%, rgba(196,92,38,0.14), transparent 55%),
    radial-gradient(700px 400px at 100% 0%, rgba(23,66,98,0.18), transparent 50%),
    linear-gradient(165deg, #d9e5ef, #f3efe7 50%, #e7eef4);
}

.shell {
  display: grid;
  grid-template-columns: var(--side) 1fr;
  min-height: 100vh;
  width: min(1200px, 100%);
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid var(--line);
  background: rgba(255,252,247,0.65);
  backdrop-filter: blur(10px);
}

.brand { display: flex; gap: 12px; align-items: center; }
.brand strong { font-family: var(--display); font-size: 1.35rem; }
.mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(145deg, #2a6a96, var(--brand-2));
  position: relative;
  box-shadow: 0 8px 18px rgba(23,66,98,0.25);
}
.mark::after {
  content: "";
  position: absolute;
  inset: 11px 9px 11px 14px;
  border: 2.2px solid rgba(255,255,255,0.92);
  border-left: 0;
  border-radius: 0 999px 999px 0;
}
.eyebrow {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.nav { display: flex; flex-direction: column; gap: 6px; }
.nav-btn {
  appearance: none;
  border: 0;
  text-align: left;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  padding: 11px 12px;
  border-radius: 12px;
  cursor: pointer;
}
.nav-btn:hover { background: rgba(23,66,98,0.06); }
.nav-btn.active {
  background: var(--brand);
  color: white;
}

.side-foot { margin-top: auto; display: grid; gap: 10px; }
.pill {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(23,66,98,0.08);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.main { padding: 22px 22px 40px; }
.bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.kicker { margin: 0 0 4px; color: var(--muted); font-weight: 600; font-size: 13px; }
.bar h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.4rem, 2.5vw, 1.9rem);
  letter-spacing: -0.02em;
}
.bar-stats {
  display: flex;
  gap: 10px;
}
.bar-stats div {
  min-width: 72px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.bar-stats strong { display: block; font-family: var(--display); font-size: 1.15rem; }
.bar-stats span { font-size: 11px; color: var(--muted); }

.tab { display: none; }
.tab.active { display: grid; gap: 14px; }

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.panel-head h2, .video-side h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.2rem;
}
.help { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; max-width: 62ch; }
.help code, .hint code {
  background: rgba(23,66,98,0.08);
  padding: 0.05em 0.35em;
  border-radius: 6px;
  font-size: 12px;
}
.hint { margin: 8px 0 0; color: var(--muted); font-size: 13px; }

.tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--brand);
  background: rgba(23,66,98,0.08);
  border-radius: 999px;
  padding: 5px 9px;
  align-self: center;
}
.tag.ok { color: var(--ok); background: rgba(31,122,76,0.1); }
.tag.bad { color: var(--bad); background: rgba(163,59,44,0.1); }
.tag.run { color: var(--accent); background: rgba(196,92,38,0.12); }

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px 15px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: white; }
.btn.ghost {
  background: rgba(255,255,255,0.7);
  border-color: var(--line);
  color: var(--ink);
}
.btn.tiny {
  padding: 7px 10px;
  font-size: 12px;
  border-radius: 9px;
  background: rgba(23,66,98,0.06);
  color: var(--brand);
}
.btn.full { width: 100%; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.check.dark { color: var(--ink); }
.checks { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }

.login-form { display: grid; gap: 8px; max-width: 480px; }
.login-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  background: white;
}

.slow-login summary {
  cursor: pointer;
  font-weight: 700;
  font-family: var(--display);
  font-size: 1.05rem;
  margin-bottom: 10px;
}

.log {
  margin: 0;
  min-height: 180px;
  max-height: 280px;
  overflow: auto;
  background: #0f2a3c;
  color: #d7e7f3;
  border-radius: 14px;
  padding: 14px;
  font-size: 12.5px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.log .err { color: #ffb4a8; }
.log .ok { color: #98e0b5; }

.file-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  max-height: 380px;
  overflow: auto;
}
.file-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  background: white;
  border: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.file-item strong { font-size: 13px; }
.file-item span { font-size: 11px; color: var(--muted); word-break: break-all; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; margin: 0; }

.video-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
}
.player-host {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: #0b1c2a;
  border: 1px solid var(--line);
}
.player-idle {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255,255,255,0.72);
  font-size: 14px;
  z-index: 2;
  padding: 20px;
  text-align: center;
}
.player-host.is-playing .player-idle { display: none; }
#ytPlayer, #ytPlayer iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.watch-progress {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(23,66,98,0.06), rgba(255,255,255,0.7));
}
.watch-progress-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}
.watch-progress-top strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.watch-progress-top span {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
}
.watch-bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(11, 28, 42, 0.12);
  overflow: hidden;
}
.watch-bar-lms,
.watch-bar-now {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
  transition: width 0.25s linear;
}
.watch-bar-lms { background: rgba(23, 66, 98, 0.35); }
.watch-bar-now { background: var(--brand); }
.watch-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}
.player-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-top: 10px;
}
.player-meta strong { display: block; font-size: 14px; }
.video-side h3 { margin-bottom: 10px; }
.video-list {
  max-height: 460px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.video-item {
  text-align: left;
  border: 1px solid var(--line);
  background: white;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
}
.video-item:hover { border-color: rgba(23,66,98,0.35); }
.video-item.active {
  border-color: var(--brand);
  background: rgba(23,66,98,0.06);
}
.video-item strong { display: block; font-size: 13px; margin-bottom: 3px; }
.video-item span { display: block; font-size: 11px; color: var(--muted); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .video-layout { grid-template-columns: 1fr; }
}
