:root {
  --bg: #0b0d10;
  --panel: #15191e;
  --panel-2: #20262d;
  --panel-3: #11151a;
  --text: #f7f4ef;
  --muted: #aeb5bf;
  --line: #303741;
  --lime: #d9ff35;
  --teal: #72e3d7;
  --rose: #ff6f91;
  --amber: #ffb84d;
  --blue: #8cb4ff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(114, 227, 215, 0.05), transparent 260px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(230px, 0.9fr) minmax(420px, 1.4fr) minmax(260px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 18px 28px;
  background: rgba(11, 13, 16, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1216;
  color: var(--lime);
  font-weight: 800;
  letter-spacing: 0;
}

.brand-title {
  font-size: 15px;
  font-weight: 750;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.nav button,
.icon-button,
.primary,
.secondary,
.ghost {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  min-height: 40px;
  padding: 0 14px;
}

.nav button {
  min-height: 36px;
  background: transparent;
  border-color: transparent;
}

.nav button.active {
  background: var(--lime);
  border-color: var(--lime);
  color: #111;
  font-weight: 750;
}

.user-chip {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.identity-text {
  max-width: 170px;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.status-pill.good {
  border-color: rgba(114, 227, 215, 0.42);
  color: var(--teal);
}

.status-pill.warn {
  border-color: rgba(255, 184, 77, 0.42);
  color: var(--amber);
}

.small-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--teal);
  font-weight: 800;
}

.auth-panel {
  position: sticky;
  top: 77px;
  z-index: 4;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 10, 12, 0.94);
  backdrop-filter: blur(16px);
}

.auth-form {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 16px 0;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 300px) minmax(180px, 260px) auto;
  gap: 12px;
  align-items: end;
}

.auth-form h2 {
  font-size: 18px;
}

.auth-form p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.auth-form label {
  display: grid;
  gap: 7px;
}

.auth-form label span {
  color: var(--muted);
  font-size: 12px;
}

.auth-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1216;
  color: var(--text);
  padding: 0 12px;
}

.auth-actions {
  display: flex;
  gap: 8px;
}

.main {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.system-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.system-strip > div {
  min-height: 72px;
  padding: 14px;
  background: #101419;
}

.strip-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.system-strip strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 22px;
}

.hero-copy {
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(217, 255, 53, 0.10), transparent 34%),
    linear-gradient(100deg, rgba(114, 227, 215, 0.08), transparent 58%),
    var(--panel);
  box-shadow: var(--shadow);
}

.eyebrow {
  color: var(--lime);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  margin-top: 12px;
  max-width: 760px;
  font-size: clamp(34px, 6vw, 68px);
  line-height: 0.96;
}

.hero-copy p {
  max-width: 720px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.primary {
  background: var(--lime);
  color: #111;
  border-color: var(--lime);
  font-weight: 800;
}

.secondary {
  background: transparent;
}

.status-panel,
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.status-panel {
  padding: 22px;
  border-radius: 8px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.metric {
  min-height: 94px;
  padding: 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-value {
  font-size: 28px;
  font-weight: 850;
}

.metric-label {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 18px;
}

.panel {
  padding: 22px;
  border-radius: 8px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.library-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 170px 150px auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.search-field,
.filter-field {
  display: grid;
  gap: 7px;
}

.search-field span,
.filter-field span {
  color: var(--muted);
  font-size: 12px;
}

.search-field input,
.filter-field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1216;
  color: var(--text);
  padding: 0 12px;
}

.result-count {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 0 12px;
  white-space: nowrap;
}

.lesson-card {
  display: flex;
  flex-direction: column;
  min-height: 305px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-3);
}

.thumb {
  position: relative;
  min-height: 128px;
  background:
    linear-gradient(135deg, rgba(140, 180, 255, 0.22), transparent 46%),
    linear-gradient(45deg, rgba(217, 255, 53, 0.10), transparent 45%),
    #151a20;
}

.thumb::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background:
    linear-gradient(90deg, transparent 0 28%, rgba(255,255,255,0.16) 28% 32%, transparent 32% 64%, rgba(255,255,255,0.16) 64% 68%, transparent 68%),
    radial-gradient(circle at 32% 30%, rgba(217, 255, 53, 0.24), transparent 28%);
}

.badge-row {
  position: absolute;
  inset: auto 10px 10px 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: var(--text);
  font-size: 11px;
  padding: 5px 8px;
}

.lesson-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}

.lesson-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.lesson-heading h3 {
  font-size: 17px;
  line-height: 1.2;
}

.lesson-meta {
  min-height: 18px;
}

.lesson-body p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.card-progress-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.ghost {
  min-height: 34px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
}

.progress-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #2b3037;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--lime);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
}

.field select,
.field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1216;
  color: var(--text);
  padding: 0 12px;
}

.stack {
  display: grid;
  gap: 12px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-3);
}

.row strong {
  display: block;
  font-size: 14px;
}

.row span {
  color: var(--muted);
  font-size: 12px;
}

.lesson-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
}

.lesson-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.lesson-view aside h1 {
  font-size: 34px;
  line-height: 1.05;
}

.lesson-view aside p:not(.tiny) {
  color: var(--muted);
  line-height: 1.55;
}

.player {
  display: grid;
  min-height: 420px;
  place-items: center;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 50% 50%, rgba(217, 255, 53, 0.16), transparent 28%),
    #050607;
}

.play-icon {
  display: grid;
  width: 88px;
  height: 88px;
  place-items: center;
  border-radius: 50%;
  background: var(--lime);
  color: #111;
  font-size: 36px;
}

.video-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050607;
}

.wistia-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050607;
}

.wistia-shell .wistia_embed {
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 320px;
}

.lesson-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 68vh;
  background: #050607;
  object-fit: contain;
}

.video-credit {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.video-credit a {
  color: var(--teal);
  text-align: right;
}

.player-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.tiny {
  color: var(--muted);
  font-size: 12px;
}

.empty {
  color: var(--muted);
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
}

.admin-main {
  display: grid;
  gap: 18px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 18px;
}

.admin-status {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1216;
  color: var(--muted);
  font-size: 13px;
}

.admin-status.loading {
  color: var(--teal);
}

.admin-key-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

.admin-key-form label,
.admin-form label {
  display: grid;
  gap: 7px;
}

.admin-key-form span,
.admin-form span {
  color: var(--muted);
  font-size: 12px;
}

.admin-key-form input,
.admin-form input,
.admin-form select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1216;
  color: var(--text);
  padding: 0 12px;
}

.admin-media-list {
  display: grid;
  gap: 10px;
}

.admin-media-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-3);
}

.admin-media-row img,
.media-inspector img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  background: #050607;
  object-fit: cover;
}

.admin-media-row strong,
.admin-media-row span {
  overflow-wrap: anywhere;
}

.admin-media-row span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.admin-row-actions {
  display: flex;
  gap: 8px;
}

.danger {
  color: var(--rose);
}

.admin-form {
  display: grid;
  gap: 12px;
}

.admin-divider {
  height: 1px;
  margin: 20px 0;
  background: var(--line);
}

.compact-title {
  margin-bottom: 12px;
}

.admin-lesson-row span {
  overflow-wrap: anywhere;
}

.media-inspector {
  display: grid;
  gap: 14px;
}

.media-inspector-body {
  display: grid;
  gap: 10px;
}

.media-inspector-body p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.media-inspector dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.media-inspector dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.media-inspector dt {
  color: var(--muted);
  font-size: 12px;
}

.media-inspector dd {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  text-align: right;
  overflow-wrap: anywhere;
}

.billing-main {
  display: grid;
  gap: 18px;
}

.billing-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.billing-status-grid,
.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.plan-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 0;
}

.plan-card {
  display: grid;
  min-height: 220px;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-3);
}

.plan-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.plan-status {
  align-self: end;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--teal);
  font-size: 12px;
  padding: 6px 9px;
}

.billing-actions {
  display: grid;
  gap: 10px;
}

.paywall {
  display: grid;
  min-height: 420px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 111, 145, 0.12), transparent 35%),
    linear-gradient(110deg, rgba(114, 227, 215, 0.10), transparent 62%),
    #050607;
}

.paywall-inner {
  width: min(520px, calc(100% - 32px));
}

.paywall-inner h2 {
  margin-top: 10px;
  font-size: 34px;
  line-height: 1;
}

.paywall-inner p {
  color: var(--muted);
  line-height: 1.55;
}

.paywall-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.boot-loading,
.boot-error {
  margin-top: 28px;
}

.boot-loading p,
.boot-error p {
  color: var(--muted);
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }

  .nav {
    justify-content: flex-start;
    width: 100%;
  }

  .user-chip {
    justify-content: flex-start;
  }

  .hero,
  .grid,
  .lesson-view,
  .admin-grid,
  .billing-grid {
    grid-template-columns: 1fr;
  }

  .system-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-grid,
  .form-grid,
  .library-controls,
  .auth-form,
  .admin-key-form,
  .billing-status-grid,
  .plan-grid {
    grid-template-columns: 1fr;
  }

  .admin-media-row {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .admin-row-actions {
    grid-column: 1 / -1;
  }

  .brand {
    min-width: 0;
  }

  .video-credit {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .main {
    width: min(100% - 20px, 1180px);
    padding-top: 16px;
  }

  .topbar {
    padding: 14px 10px;
  }

  .nav button {
    flex: 1 1 auto;
  }

  .system-strip {
    grid-template-columns: 1fr;
  }

  .hero-copy,
  .panel,
  .status-panel {
    padding: 16px;
  }

  h1 {
    font-size: 34px;
  }

  .library-controls {
    gap: 10px;
  }
}
