:root {
  --navy-950: #071224;
  --navy-900: #0D1F3C;
  --navy-800: #152C52;
  --navy-700: #1E3A6A;
  --blue-600: #2563EB;
  --blue-500: #3B82F6;
  --blue-400: #60A5FA;
  --amber-600: #BD8B13;
  --amber-500: #D99B16;
  --amber-400: #F59E0B;
  --amber-100: #FEF3C7;
  --green-600: #16A34A;
  --green-500: #22C55E;
  --red-600: #DC2626;
  --red-500: #EF4444;
  --slate-50: #F8FAFC;
  --slate-100: #F1F5F9;
  --slate-200: #E2E8F0;
  --slate-300: #CBD5E1;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1E293B;
  --slate-900: #0F172A;
  --radius: 12px;
  --shadow-sm: 0 1px 3px rgba(13, 31, 60, 0.08);
  --shadow-md: 0 8px 24px rgba(13, 31, 60, 0.12);
  --shadow-lg: 0 16px 40px rgba(7, 18, 36, 0.18);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--slate-100);
  color: var(--slate-800);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, .brand-font {
  font-family: 'Poppins', sans-serif;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Safety Top Bar */
.vde-safety-bar {
  background: linear-gradient(90deg, #071224 0%, #0D1F3C 50%, #071224 100%);
  color: #F8FAFC;
  border-bottom: 2px solid var(--amber-500);
  font-size: 0.78rem;
  padding: 8px 16px;
  text-align: center;
}

.vde-safety-bar strong {
  color: var(--amber-400);
}

/* Header */
.app-header {
  background: var(--navy-900);
  color: #FFFFFF;
  padding: 18px 20px 0 20px;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
}

.brand-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue-600), var(--navy-700));
  border: 1.5px solid var(--amber-400);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #FFFFFF;
  font-size: 1.05rem;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #FFFFFF;
}

.brand-title span {
  color: var(--amber-400);
}

.brand-sub {
  font-size: 0.78rem;
  color: #94A3B8;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
}

.norm-pill {
  background: rgba(37, 99, 235, 0.22);
  border: 1px solid rgba(96, 165, 250, 0.4);
  color: #DBEAFE;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: none;
  color: #CBD5E1;
  padding: 11px 18px;
  border-radius: 10px 10px 0 0;
  font-family: 'Poppins', sans-serif;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
}

.tab-btn.active {
  background: var(--slate-100);
  color: var(--navy-900);
  border-color: var(--slate-100);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.12);
}

.tab-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
}

.tab-btn.active .tab-num {
  background: var(--blue-600);
  color: #FFFFFF;
}

/* Main Container */
.main-container {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px 48px 16px;
  flex: 1;
}

.tab-panel {
  display: none;
  animation: fadeIn 0.22s ease;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Cards */
.card {
  background: #FFFFFF;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
}

.card-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--slate-200);
}

.card-title {
  font-size: 1.15rem;
  color: var(--navy-900);
  font-weight: 700;
}

.card-subtitle {
  font-size: 0.86rem;
  color: var(--slate-600);
  margin-top: 2px;
}

/* Simulator Layout */
.circuit-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.circuit-pill {
  background: var(--slate-50);
  border: 1.5px solid var(--slate-300);
  border-radius: 10px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  transition: all 0.16s ease;
}

.circuit-pill:hover {
  border-color: var(--blue-500);
}

.circuit-pill.active {
  background: #EFF6FF;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.circuit-pill-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--blue-600);
}

.circuit-pill-name {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--navy-900);
  margin-top: 2px;
}

.sim-grid {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 980px) {
  .sim-grid {
    grid-template-columns: 1fr;
  }
}

/* Control Desk */
.control-desk {
  background: var(--navy-900);
  color: #F8FAFC;
  border-radius: var(--radius);
  padding: 18px;
  border: 1px solid var(--navy-700);
  box-shadow: var(--shadow-md);
}

.desk-title {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--amber-400);
  margin-bottom: 14px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.desk-group {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
}

.desk-group-label {
  font-size: 0.74rem;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
  font-weight: 600;
}

.btn-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ctrl-btn {
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  border: none;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 0.84rem;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.15s ease, opacity 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.ctrl-btn:active {
  transform: scale(0.97);
}

.ctrl-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-q1 {
  background: #334155;
  color: #F8FAFC;
  border: 1.5px solid #64748B;
}

.btn-q1.on {
  background: var(--green-600);
  border-color: #86EFAC;
  box-shadow: 0 0 14px rgba(22, 163, 74, 0.45);
}

.btn-start {
  background: var(--green-600);
  color: #FFFFFF;
}

.btn-start:hover:not(:disabled) {
  background: #15803D;
}

.btn-left {
  background: var(--blue-600);
  color: #FFFFFF;
}

.btn-stop {
  background: var(--red-600);
  color: #FFFFFF;
}

.btn-nothalt {
  background: repeating-linear-gradient(
    45deg,
    #FACC15,
    #FACC15 10px,
    #1E293B 10px,
    #1E293B 20px
  );
  padding: 3px;
  border-radius: 10px;
}

.btn-nothalt-inner {
  background: #B91C1C;
  color: #FFFFFF;
  width: 100%;
  padding: 10px;
  border-radius: 7px;
  font-weight: 700;
  display: block;
  text-align: center;
}

.btn-nothalt.latched .btn-nothalt-inner {
  background: #7F1D1D;
  box-shadow: inset 0 3px 8px rgba(0,0,0,0.6);
  border: 1.5px solid #FCA5A5;
}

.btn-fault {
  background: #B45309;
  color: #FEF3C7;
}

.btn-fault.tripped {
  background: #DC2626;
  color: #FFFFFF;
}

.btn-reset {
  background: #475569;
  color: #FFFFFF;
}

/* Pilot Lamps */
.lamp-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pilot-lamp {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 8px 6px;
  text-align: center;
  font-size: 0.72rem;
}

.lamp-bulb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  margin: 0 auto 5px auto;
  background: #334155;
  border: 2px solid #475569;
  transition: all 0.2s ease;
}

.lamp-bulb.green-on {
  background: #22C55E;
  border-color: #BBF7D0;
  box-shadow: 0 0 14px #22C55E;
}

.lamp-bulb.blue-on {
  background: #3B82F6;
  border-color: #BFDBFE;
  box-shadow: 0 0 14px #3B82F6;
}

.lamp-bulb.red-on {
  background: #EF4444;
  border-color: #FECACA;
  box-shadow: 0 0 14px #EF4444;
}

.lamp-bulb.amber-on {
  background: #F59E0B;
  border-color: #FDE68A;
  box-shadow: 0 0 14px #F59E0B;
}

/* Telemetry Bar */
.telemetry-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.tele-box {
  background: var(--navy-950);
  color: #F8FAFC;
  padding: 10px 12px;
  border-radius: 9px;
  border-left: 3px solid var(--blue-500);
}

.tele-label {
  font-size: 0.7rem;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.tele-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.05rem;
  font-weight: 700;
  color: #FFFFFF;
  margin-top: 2px;
}

/* SVG Schematic Canvas */
.svg-canvas-wrap {
  background: #FFFFFF;
  border: 1.5px solid var(--slate-300);
  border-radius: 10px;
  padding: 12px;
  overflow-x: auto;
}

.svg-canvas-wrap svg {
  width: 100%;
  min-width: 680px;
  height: auto;
  display: block;
}

/* Lesson Box */
.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.lesson-step {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-left: 4px solid var(--blue-600);
  border-radius: 8px;
  padding: 14px;
}

.lesson-step h4 {
  font-size: 0.92rem;
  color: var(--navy-900);
  margin-bottom: 6px;
}

.lesson-step p {
  font-size: 0.84rem;
  color: var(--slate-700);
}

/* 100 Scenarios Catalog */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}

.search-input {
  flex: 1;
  min-width: 220px;
  padding: 10px 14px;
  border: 1.5px solid var(--slate-300);
  border-radius: 8px;
  font-size: 0.9rem;
}

.cat-btn {
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--slate-300);
  background: var(--slate-50);
  color: var(--slate-700);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.cat-btn.active {
  background: var(--navy-900);
  color: #FFFFFF;
  border-color: var(--navy-900);
}

.progress-banner {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy-900);
}

.scenario-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
  max-height: 640px;
  overflow-y: auto;
  padding-right: 4px;
}

.scenario-card {
  border: 1px solid var(--slate-200);
  border-radius: 9px;
  padding: 13px 15px;
  background: #FFFFFF;
  transition: border-color 0.15s;
}

.scenario-card.done {
  border-left: 4px solid var(--green-600);
  background: #F0FDF4;
}

.scenario-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}

.scenario-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--blue-600);
  background: #EFF6FF;
  padding: 2px 7px;
  border-radius: 5px;
}

.scenario-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--navy-900);
  margin-top: 4px;
}

.scenario-details {
  display: none;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--slate-300);
  font-size: 0.82rem;
  color: var(--slate-700);
}

.scenario-card.expanded .scenario-details {
  display: block;
}

.scenario-meta-line {
  margin-top: 6px;
}

.done-toggle {
  margin-top: 10px;
  padding: 6px 11px;
  border-radius: 6px;
  border: 1px solid var(--slate-300);
  background: #FFFFFF;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.scenario-card.done .done-toggle {
  background: var(--green-600);
  color: #FFFFFF;
  border-color: var(--green-600);
}

/* Forms & Calculators */
.calc-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 22px;
  align-items: start;
}

@media (max-width: 920px) {
  .calc-grid {
    grid-template-columns: 1fr;
  }
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy-900);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--slate-300);
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
  color: var(--slate-900);
  background: #FFFFFF;
}

.form-control:focus {
  outline: none;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.result-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card {
  background: var(--slate-50);
  border: 1.5px solid var(--slate-200);
  border-top: 4px solid var(--navy-900);
  border-radius: 10px;
  padding: 15px;
}

.kpi-card.highlight {
  background: #EFF6FF;
  border-color: #BFDBFE;
  border-top-color: var(--blue-600);
}

.kpi-card.amber {
  background: #FFFBEB;
  border-color: #FDE68A;
  border-top-color: var(--amber-600);
}

.kpi-card.green {
  background: #F0FDF4;
  border-color: #BBF7D0;
  border-top-color: var(--green-600);
}

.kpi-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--slate-600);
  font-weight: 700;
}

.kpi-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--navy-900);
  margin: 6px 0 4px 0;
}

.kpi-note {
  font-size: 0.78rem;
  color: var(--slate-600);
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.spec-table th, .spec-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--slate-200);
  text-align: left;
}

.spec-table th {
  background: var(--navy-900);
  color: #FFFFFF;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.action-btn {
  background: var(--blue-600);
  color: #FFFFFF;
  border: none;
  padding: 11px 18px;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.action-btn:hover {
  background: #1D4ED8;
}

.action-btn.secondary {
  background: var(--navy-900);
}

/* Certificate Preview */
.cert-wrapper {
  background: #FFFFFF;
  border: 2px solid var(--navy-900);
  outline: 6px double var(--amber-600);
  outline-offset: -14px;
  border-radius: 6px;
  padding: 46px 42px;
  max-width: 880px;
  margin: 0 auto;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.cert-kicker {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--amber-600);
  margin-bottom: 8px;
}

.cert-heading {
  font-family: 'Poppins', sans-serif;
  font-size: 2.1rem;
  color: var(--navy-900);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.cert-sub {
  font-size: 0.95rem;
  color: var(--slate-600);
  margin-bottom: 22px;
}

.cert-recipient {
  font-family: 'Poppins', sans-serif;
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--blue-600);
  border-bottom: 2px solid var(--amber-500);
  display: inline-block;
  padding: 4px 28px 8px 28px;
  margin: 6px 0 18px 0;
}

.cert-body-text {
  max-width: 660px;
  margin: 0 auto 24px auto;
  font-size: 0.94rem;
  color: var(--slate-700);
  line-height: 1.65;
}

.cert-modules-pillbox {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 28px;
}

.cert-pill {
  background: var(--slate-100);
  border: 1px solid var(--slate-300);
  color: var(--navy-900);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
}

.cert-footer-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 20px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--slate-200);
}

.cert-sign-line {
  font-family: 'Georgia', serif;
  font-style: italic;
  font-size: 1.3rem;
  color: var(--navy-900);
  margin-bottom: 4px;
}

.cert-seal-circle {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--navy-800), var(--navy-950));
  border: 3px solid var(--amber-500);
  color: var(--amber-400);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.6px;
}

/* Footer */
.app-footer {
  background: var(--navy-950);
  color: #94A3B8;
  padding: 24px 16px;
  font-size: 0.8rem;
  text-align: center;
  border-top: 1px solid var(--navy-800);
}

.app-footer a {
  color: var(--amber-400);
  text-decoration: none;
  font-weight: 600;
}

@media print {
  .vde-safety-bar,
  .app-header,
  .app-footer,
  .no-print {
    display: none !important;
  }
  body {
    background: #FFFFFF !important;
  }
  .main-container {
    padding: 0 !important;
    max-width: 100% !important;
  }
  .card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .cert-wrapper {
    box-shadow: none !important;
    max-width: 100% !important;
    margin: 0 !important;
  }
}
