/* ============================================================
   Pilot LMS — Design System
   Aesthetic: refined aviation. Navy + warm gold. Instrument-panel
   detailing. Fraunces for display, Inter for UI, JetBrains for data.
   ============================================================ */

:root {
  /* Brand */
  --navy-900: #07182E;
  --navy-800: #0B1F3A;
  --navy-700: #112A4D;
  --navy-600: #1A3A65;
  --navy-500: #2A5180;

  --gold-700: #8C6E2A;
  --gold-600: #B08A36;
  --gold-500: #C9A24B;
  --gold-400: #DCB867;
  --gold-300: #E9CE8F;

  --ivory: #F7F3EA;
  --paper: #FAFAF7;
  --paper-2: #F2EFE8;
  --line: #E5DFD2;
  --line-2: #D6CFBE;

  --ink-900: #0E1620;
  --ink-700: #2C3744;
  --ink-500: #5A6573;
  --ink-400: #7A8593;
  --ink-300: #B0B7C1;

  --success: #2C7A4B;
  --warning: #B4731B;
  --danger:  #B33A3A;
  --info:    #2A6FA8;

  /* Type */
  --font-display: 'Fraunces', Georgia, serif;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  /* Geometry */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 14px;
  --radius-xl: 22px;

  --shadow-sm: 0 1px 2px rgba(7, 24, 46, 0.06), 0 1px 1px rgba(7, 24, 46, 0.04);
  --shadow:    0 4px 14px rgba(7, 24, 46, 0.08), 0 1px 2px rgba(7, 24, 46, 0.04);
  --shadow-lg: 0 22px 50px rgba(7, 24, 46, 0.18), 0 4px 14px rgba(7, 24, 46, 0.08);

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-900);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
}
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 500; letter-spacing: -0.01em; color: var(--ink-900); }
h1 { font-size: 2rem; line-height: 1.15; }
h2 { font-size: 1.5rem; line-height: 1.2; }
h3 { font-size: 1.125rem; line-height: 1.25; }
h4 { font-size: 0.95rem; font-family: var(--font-ui); font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-500); }
p { margin: 0; }
a { color: var(--navy-700); text-decoration: none; transition: color 0.15s var(--ease); }
a:hover { color: var(--gold-600); }
button { font: inherit; cursor: pointer; }

/* ============================================================
   AUTH (Login)
   ============================================================ */
.auth-page {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--paper);
}
.auth-page__art {
  position: relative;
  background:
    radial-gradient(900px 600px at 30% 20%, rgba(201, 162, 75, 0.18), transparent 60%),
    radial-gradient(700px 500px at 80% 90%, rgba(42, 81, 128, 0.45), transparent 60%),
    linear-gradient(160deg, var(--navy-900), var(--navy-800) 50%, var(--navy-700));
  color: var(--ivory);
  padding: 56px 56px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.auth-page__art::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  pointer-events: none;
}
.auth-page__brand { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.auth-page__brand-mark {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1.5px solid var(--gold-500);
  border-radius: 50%;
  color: var(--gold-400);
}
.auth-page__brand-text { font-family: var(--font-display); font-size: 22px; letter-spacing: 0.04em; }
.auth-page__brand-text small { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.3em; color: var(--gold-300); text-transform: uppercase; margin-top: 2px; }

.auth-page__hero { position: relative; z-index: 1; max-width: 460px; }
.auth-page__hero h1 {
  color: var(--ivory);
  font-size: 3rem;
  line-height: 1.05;
  font-weight: 400;
}
.auth-page__hero h1 em { font-style: italic; color: var(--gold-400); }
.auth-page__hero p { color: rgba(247, 243, 234, 0.7); margin-top: 18px; max-width: 380px; }

.auth-page__meta {
  position: relative; z-index: 1;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: rgba(247, 243, 234, 0.5);
  display: flex; justify-content: space-between;
  text-transform: uppercase;
}

.auth-page__form-wrap {
  display: grid;
  place-items: center;
  padding: 48px;
}
.auth-page__form { width: 100%; max-width: 380px; }
.auth-page__form h2 {
  font-size: 1.75rem;
  margin-bottom: 8px;
}
.auth-page__form .auth-sub { color: var(--ink-500); margin-bottom: 32px; }

.auth-demo {
  margin-top: 24px;
  padding: 16px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  background: var(--paper-2);
}
.auth-demo h5 {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin: 0 0 10px;
  font-weight: 500;
}
.auth-demo__row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px 0;
  color: var(--ink-700);
  cursor: pointer;
  border-radius: 4px;
  padding: 4px 6px;
  transition: background 0.15s;
}
.auth-demo__row:hover { background: rgba(201, 162, 75, 0.1); }
.auth-demo__row strong { color: var(--navy-800); font-weight: 600; }

@media (max-width: 880px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-page__art { padding: 32px 24px; min-height: 240px; }
  .auth-page__hero h1 { font-size: 2rem; }
  .auth-page__form-wrap { padding: 32px 24px 48px; }
}

/* ============================================================
   APP SHELL
   ============================================================ */
.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100dvh;
}

.sidebar {
  background: var(--navy-900);
  color: var(--ivory);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  border-right: 1px solid rgba(255,255,255,0.05);
}
.sidebar__brand {
  padding: 22px 22px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar__brand-mark {
  width: 36px; height: 36px;
  border: 1.5px solid var(--gold-500);
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--gold-400);
}
.sidebar__brand-name {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 0.04em;
}
.sidebar__brand-name small {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--gold-300);
  margin-top: 2px;
  text-transform: uppercase;
}

.sidebar__nav { padding: 16px 12px; flex: 1; overflow-y: auto; }
.sidebar__section {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  color: rgba(247, 243, 234, 0.4);
  text-transform: uppercase;
  padding: 14px 12px 8px;
}
.sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: rgba(247, 243, 234, 0.75);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 13.5px;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.sidebar__link:hover { background: rgba(255,255,255,0.04); color: var(--ivory); }
.sidebar__link.active {
  background: rgba(201, 162, 75, 0.12);
  color: var(--gold-300);
}
.sidebar__link.active::before {
  content: '';
  position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px;
  background: var(--gold-500);
  border-radius: 0 2px 2px 0;
}
.sidebar__link svg { width: 18px; height: 18px; opacity: 0.85; }

.sidebar__footer {
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gold-700);
  color: var(--ivory);
  display: grid; place-items: center;
  font-weight: 600;
  font-size: 13px;
  flex: 0 0 auto;
}
.sidebar__footer-user {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
}
.sidebar__user { flex: 1; min-width: 0; }
.sidebar__user-name { color: var(--ivory); font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-role { color: rgba(247, 243, 234, 0.5); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase; }
.sidebar__signout {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(247, 243, 234, 0.85);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}
.sidebar__signout:hover {
  background: rgba(201, 162, 75, 0.12);
  border-color: var(--gold-500);
  color: var(--gold-300);
}
.sidebar__signout svg { width: 16px; height: 16px; }

.main {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--paper);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 250, 247, 0.9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar__title { display: flex; align-items: baseline; gap: 14px; }
.topbar__title h2 { font-size: 1.35rem; }
.topbar__title small {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-400);
}
.topbar__actions { display: flex; align-items: center; gap: 10px; }
.topbar__bell {
  position: relative;
  background: transparent;
  border: 1px solid var(--line-2);
  width: 38px; height: 38px;
  border-radius: var(--radius);
  display: grid; place-items: center;
  color: var(--ink-700);
  transition: all 0.15s;
}
.topbar__bell:hover { border-color: var(--gold-500); color: var(--gold-700); }
.topbar__bell-dot {
  position: absolute;
  top: 8px; right: 9px;
  width: 8px; height: 8px;
  background: var(--gold-500);
  border-radius: 50%;
  border: 2px solid var(--paper);
}

.content { padding: 32px; max-width: 1320px; width: 100%; }

.mobile-toggle { display: none; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 280px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .shell.menu-open .sidebar { transform: translateX(0); }
  .shell.menu-open::after {
    content: '';
    position: fixed; inset: 0;
    background: rgba(7, 24, 46, 0.5);
    z-index: 99;
  }
  .topbar { padding: 14px 18px; }
  .content { padding: 20px; }
  .mobile-toggle {
    display: grid;
    place-items: center;
    background: transparent;
    border: 1px solid var(--line-2);
    width: 38px; height: 38px;
    border-radius: var(--radius);
    color: var(--ink-700);
  }
  .topbar__title h2 { font-size: 1.1rem; }
}

/* ============================================================
   FORMS
   ============================================================ */
.field { margin-bottom: 18px; }
.field__label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: 6px;
  font-weight: 500;
}
.field__hint { font-size: 12px; color: var(--ink-400); margin-top: 4px; }
.input, .select, .textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  font: inherit;
  color: var(--ink-900);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(201, 162, 75, 0.15);
}
.textarea { resize: vertical; min-height: 90px; font-family: var(--font-ui); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%235A6573' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13.5px;
  border: 1px solid transparent;
  transition: transform 0.1s, background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--navy-800);
  color: var(--ivory);
}
.btn--primary:hover { background: var(--navy-700); }
.btn--gold {
  background: var(--gold-500);
  color: var(--navy-900);
}
.btn--gold:hover { background: var(--gold-400); }
.btn--ghost {
  background: transparent;
  border-color: var(--line-2);
  color: var(--ink-700);
}
.btn--ghost:hover { border-color: var(--navy-700); color: var(--navy-800); background: var(--paper); }
.btn--danger {
  background: transparent;
  border-color: rgba(179, 58, 58, 0.3);
  color: var(--danger);
}
.btn--danger:hover { background: rgba(179, 58, 58, 0.06); border-color: var(--danger); }
.btn--sm { padding: 6px 12px; font-size: 12.5px; }
.btn--lg { padding: 14px 24px; font-size: 15px; }
.btn--full { width: 100%; }
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   CARDS, KPIs, TABLES
   ============================================================ */
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 16px;
}
.card__head h3 { font-family: var(--font-display); font-size: 1.2rem; }
.card__head .label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-400);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.kpi {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gold-500);
  opacity: 0;
  transition: opacity 0.2s;
}
.kpi:hover::before { opacity: 1; }
.kpi__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: 8px;
}
.kpi__value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 500;
  color: var(--ink-900);
  line-height: 1;
}
.kpi__sub {
  font-size: 12px;
  color: var(--ink-500);
  margin-top: 8px;
}
.kpi__sub strong { color: var(--success); font-weight: 600; }

.section { margin-bottom: 28px; }
.section__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}
.section__head h3 { font-size: 1.4rem; }
.section__head .label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-400);
}

.table-wrap {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-500);
  font-weight: 500;
  padding: 14px 18px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
}
.table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(201, 162, 75, 0.04); }
.table-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--ink-400);
  font-style: italic;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.pill--success { background: rgba(44, 122, 75, 0.1); color: var(--success); }
.pill--warning { background: rgba(180, 115, 27, 0.12); color: var(--warning); }
.pill--danger  { background: rgba(179, 58, 58, 0.1); color: var(--danger); }
.pill--info    { background: rgba(42, 111, 168, 0.1); color: var(--info); }
.pill--muted   { background: var(--paper-2); color: var(--ink-500); }
.pill--gold    { background: rgba(201, 162, 75, 0.15); color: var(--gold-700); }

/* ============================================================
   COURSE CARDS
   ============================================================ */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.course-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.2s var(--ease), box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  position: relative;
}
.course-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--gold-500);
}
.course-card__cover {
  height: 130px;
  background:
    radial-gradient(400px 200px at 20% 30%, rgba(201, 162, 75, 0.25), transparent 60%),
    linear-gradient(135deg, var(--navy-800), var(--navy-600));
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 16px;
  color: var(--ivory);
}
.course-card__cover::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(ellipse at top right, black 30%, transparent 75%);
}
.course-card__code {
  position: relative;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold-300);
}
.course-card__body { padding: 18px; flex: 1; display: flex; flex-direction: column; }
.course-card__title { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.2; margin-bottom: 8px; }
.course-card__desc { color: var(--ink-500); font-size: 13px; line-height: 1.5; margin-bottom: 14px; flex: 1; }
.course-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-500);
}
.course-card__meta-item { display: flex; align-items: center; gap: 6px; }

.progress-bar {
  height: 6px;
  background: var(--paper-2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 12px;
}
.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-400));
  border-radius: 999px;
  transition: width 0.4s var(--ease);
}

/* ============================================================
   COURSE PLAYER
   ============================================================ */
.player {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100dvh;
  background: var(--navy-900);
  color: var(--ivory);
}
.player__rail {
  background: var(--navy-900);
  border-right: 1px solid rgba(255,255,255,0.06);
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
}
.player__rail-header {
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 16px;
}
.player__exit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  color: rgba(247, 243, 234, 0.5);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.player__exit:hover { color: var(--gold-400); }
.player__course-title { font-family: var(--font-display); font-size: 1.1rem; color: var(--ivory); }
.player__course-meta { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; color: var(--gold-300); text-transform: uppercase; margin-top: 4px; }

.player__lessons { flex: 1; }
.player__lesson {
  margin-bottom: 18px;
}
.player__lesson-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  color: rgba(247, 243, 234, 0.4);
  text-transform: uppercase;
  padding: 0 12px 8px;
}
.player__slide-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: rgba(247, 243, 234, 0.7);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.player__slide-link:hover { background: rgba(255,255,255,0.04); color: var(--ivory); }
.player__slide-link.active { background: rgba(201, 162, 75, 0.12); color: var(--gold-300); }
.player__slide-link__num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(247, 243, 234, 0.4);
  min-width: 22px;
}
.player__slide-link.done .player__slide-link__num { color: var(--gold-500); }
.player__slide-link.active .player__slide-link__num { color: var(--gold-400); }

.player__stage {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--ivory);
  color: var(--ink-900);
}
.player__progress {
  height: 3px;
  background: rgba(7, 24, 46, 0.06);
  position: relative;
}
.player__progress-fill {
  height: 100%;
  background: var(--gold-500);
  transition: width 0.3s var(--ease);
}
.player__slide-host {
  flex: 1;
  overflow-y: auto;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 40px;
}
.slide {
  width: 100%;
  max-width: 980px;
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 48px 56px;
  position: relative;
  animation: slideIn 0.4s var(--ease-out);
}
.slide::before {
  content: '';
  position: absolute;
  top: 18px; left: 18px;
  width: 28px; height: 28px;
  border-top: 1.5px solid var(--gold-500);
  border-left: 1.5px solid var(--gold-500);
}
.slide::after {
  content: '';
  position: absolute;
  bottom: 18px; right: 18px;
  width: 28px; height: 28px;
  border-bottom: 1.5px solid var(--gold-500);
  border-right: 1.5px solid var(--gold-500);
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.slide__kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-700);
  margin-bottom: 10px;
}
.slide__title { font-family: var(--font-display); font-size: 2rem; line-height: 1.15; margin-bottom: 14px; }
.slide__body { font-size: 15.5px; line-height: 1.65; color: var(--ink-700); }
.slide__body p { margin-bottom: 14px; }
.slide__body ul, .slide__body ol { padding-left: 22px; margin-bottom: 14px; }
.slide__body li { margin-bottom: 6px; }
.slide__media {
  margin: 20px 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-2);
  display: flex;
  justify-content: center;
}
.slide__media img, .slide__media video { max-width: 100%; height: auto; display: block; }
.slide__media video { width: 100%; }
.slide__media iframe { width: 100%; height: 60vh; border: 0; }
.slide__pdf-canvas { width: 100%; height: auto; max-height: 70vh; }

.slide__hotspots { position: relative; }
.hotspot {
  position: absolute;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gold-500);
  color: var(--navy-900);
  border: 3px solid white;
  box-shadow: 0 0 0 2px var(--gold-500), 0 4px 12px rgba(0,0,0,0.3);
  display: grid; place-items: center;
  font-weight: 700;
  cursor: pointer;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.hotspot-info {
  position: absolute;
  background: var(--navy-800);
  color: var(--ivory);
  padding: 14px 18px;
  border-radius: var(--radius);
  max-width: 260px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  line-height: 1.5;
  z-index: 5;
}

.player__bar {
  border-top: 1px solid var(--line);
  background: white;
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.player__bar-counter {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-500);
  text-transform: uppercase;
}

/* Knowledge check inside a slide */
.knowledge-check {
  margin-top: 24px;
  padding: 24px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold-500);
  border-radius: var(--radius);
  background: var(--paper);
}
.knowledge-check__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-700);
  margin-bottom: 6px;
}
.knowledge-check__q { font-family: var(--font-display); font-size: 1.2rem; margin-bottom: 14px; }
.kc-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: white;
  cursor: pointer;
  margin-bottom: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.kc-option:hover { border-color: var(--navy-500); }
.kc-option.selected { border-color: var(--navy-700); background: rgba(42, 81, 128, 0.05); }
.kc-option.correct { border-color: var(--success); background: rgba(44, 122, 75, 0.06); }
.kc-option.wrong { border-color: var(--danger); background: rgba(179, 58, 58, 0.05); }
.kc-option__bullet {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--line-2);
  flex: 0 0 auto;
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-500);
}
.kc-option.selected .kc-option__bullet { border-color: var(--navy-700); color: var(--navy-700); }
.kc-option.correct .kc-option__bullet { background: var(--success); color: white; border-color: var(--success); }
.kc-option.wrong .kc-option__bullet { background: var(--danger); color: white; border-color: var(--danger); }
.kc-explain {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  line-height: 1.55;
}
.kc-explain--ok { background: rgba(44, 122, 75, 0.08); color: var(--success); }
.kc-explain--no { background: rgba(179, 58, 58, 0.08); color: var(--danger); }

/* Final quiz screen */
.quiz {
  width: 100%;
  max-width: 760px;
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px 48px;
  margin: auto;
}
.quiz__head { text-align: center; margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.quiz__head h2 { font-size: 1.75rem; margin-bottom: 6px; }
.quiz__progress {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-500);
  text-transform: uppercase;
}
.quiz__q { font-family: var(--font-display); font-size: 1.35rem; margin-bottom: 20px; line-height: 1.3; }

/* Score ring */
.score-ring {
  width: 180px; height: 180px;
  margin: 0 auto 20px;
  position: relative;
}
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring__bg { fill: none; stroke: var(--paper-2); stroke-width: 12; }
.score-ring__fill { fill: none; stroke: var(--gold-500); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 1.2s var(--ease); }
.score-ring__text {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 3rem;
  color: var(--ink-900);
}

/* ============================================================
   BUILDER
   ============================================================ */
.builder {
  display: grid;
  grid-template-columns: 260px 1fr 340px;
  gap: 18px;
  height: calc(100dvh - 80px - 64px);
}
.builder__pane {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.builder__pane-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.builder__pane-head h4 { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.25em; color: var(--ink-500); }
.builder__pane-body { flex: 1; overflow-y: auto; padding: 12px; }

.lesson-node {
  margin-bottom: 6px;
}
.lesson-node__head {
  padding: 9px 10px;
  background: var(--paper-2);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.lesson-node__slides { padding: 4px 0 4px 12px; }
.slide-node {
  padding: 8px 10px;
  font-size: 12.5px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--ink-700);
  display: flex;
  align-items: center;
  gap: 8px;
}
.slide-node:hover { background: var(--paper); }
.slide-node.active { background: rgba(201, 162, 75, 0.12); color: var(--gold-700); font-weight: 500; }
.slide-node__num { font-family: var(--font-mono); font-size: 11px; color: var(--ink-400); min-width: 18px; }
.slide-node.active .slide-node__num { color: var(--gold-600); }

.dropzone {
  border: 2px dashed var(--line-2);
  border-radius: var(--radius);
  padding: 28px 16px;
  text-align: center;
  color: var(--ink-500);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--gold-500);
  background: rgba(201, 162, 75, 0.05);
  color: var(--gold-700);
}
.dropzone strong { display: block; font-weight: 600; color: var(--ink-700); margin-bottom: 4px; }

/* ============================================================
   CERTIFICATE TEMPLATES
   ============================================================ */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.template-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.template-card:hover { border-color: var(--gold-500); box-shadow: var(--shadow-sm); }
.template-card__head { display: flex; align-items: center; gap: 12px; }
.template-card__swatch {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--line);
  flex: 0 0 auto;
}
.template-card__name { font-family: var(--font-display); font-size: 1.1rem; line-height: 1.2; }
.template-card__company { font-size: 12.5px; }
.template-card__meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.template-card__meta .label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  color: var(--ink-400);
  text-transform: uppercase;
  display: block;
  margin-bottom: 2px;
}
.template-card__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.template-card--new {
  border-style: dashed;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  min-height: 220px;
}
.template-card--new:hover { background: rgba(201, 162, 75, 0.04); }

.template-editor {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 24px;
  min-height: 520px;
}
.template-editor__form { max-height: 70vh; overflow-y: auto; padding-right: 10px; }
.template-editor__preview { position: sticky; top: 0; }
@media (max-width: 880px) {
  .template-editor { grid-template-columns: 1fr; min-height: auto; }
  .template-editor__form { max-height: none; }
}

.upload-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--paper-2);
}
.upload-preview img {
  max-height: 60px;
  max-width: 120px;
  object-fit: contain;
  background: white;
  border-radius: 4px;
  padding: 4px;
}

/* Segmented toggle (Text / Image) */
.segmented {
  display: inline-flex;
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 2px;
  gap: 2px;
}
.segmented__btn {
  background: transparent;
  border: none;
  padding: 4px 12px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-500);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.segmented__btn:hover { color: var(--ink-900); }
.segmented__btn--active {
  background: white;
  color: var(--navy-800);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
#modal-root {
  position: fixed; inset: 0;
  z-index: 200;
  pointer-events: none;
}
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(7, 24, 46, 0.5);
  backdrop-filter: blur(2px);
  pointer-events: auto;
  animation: fade 0.2s var(--ease);
}
.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  width: min(540px, calc(100vw - 32px));
  max-height: calc(100dvh - 64px);
  display: flex;
  flex-direction: column;
  animation: pop 0.2s var(--ease-out);
}
.modal--wide { width: min(820px, calc(100vw - 32px)); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop {
  from { opacity: 0; transform: translate(-50%, -48%) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.modal__head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.modal__head h3 { font-family: var(--font-display); font-size: 1.25rem; }
.modal__close {
  background: transparent;
  border: none;
  width: 32px; height: 32px;
  border-radius: var(--radius);
  display: grid; place-items: center;
  color: var(--ink-500);
}
.modal__close:hover { background: var(--paper-2); color: var(--ink-900); }
.modal__body { padding: 22px; overflow-y: auto; }
.modal__foot {
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 10px;
  background: var(--paper);
}

/* ============================================================
   TOAST
   ============================================================ */
#toast-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--navy-900);
  color: var(--ivory);
  padding: 12px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  min-width: 220px;
  max-width: 380px;
  border-left: 3px solid var(--gold-500);
  pointer-events: auto;
  animation: toastIn 0.25s var(--ease-out);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
.toast--success { border-left-color: var(--success); }
.toast--error { border-left-color: var(--danger); }
.toast--warning { border-left-color: var(--warning); }

/* ============================================================
   Misc
   ============================================================ */
.muted { color: var(--ink-400); }
.mono { font-family: var(--font-mono); }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row--end { justify-content: flex-end; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 680px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .player { grid-template-columns: 1fr; }
  .player__rail { display: none; }
  .player.rail-open { grid-template-columns: 280px 1fr; }
  .builder { grid-template-columns: 1fr; height: auto; gap: 12px; }
  .slide { padding: 28px 24px; }
  .quiz { padding: 28px 24px; }
}

/* Print (for certificate preview) */
@media print {
  .sidebar, .topbar, .player__bar { display: none !important; }
}

/* Focus visibility */
:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
}
.sidebar :focus-visible { outline-color: var(--gold-400); }
