/* ============================================================================
   BSERC DEF-SPACE AUTUMN INTERNSHIP PROGRAMME 2026 — PROJECT 4
   AEROSPACE COMMAND-CENTRE DESIGN SYSTEM
   Theme: Obsidian Black (#07080c) + Champagne Gold (#d4af37) + Graphite (#12151e) + Crimson (#e63946)
   Typography: Editorial Serif (Playfair Display / Cormorant Garamond) + Precision Technical Sans & Mono
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=Cormorant+Garamond:ital,wght@0,500;0,600;0,700;1,600&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --obsidian: #07080c;
  --obsidian-deep: #040508;
  --graphite-950: #0b0d14;
  --graphite-900: #10131c;
  --graphite-850: #141824;
  --graphite-800: #181d2b;
  --graphite-700: #21283b;
  --graphite-600: #2c354d;

  --border-subtle: rgba(212, 175, 55, 0.16);
  --border-card: rgba(255, 255, 255, 0.08);
  --border-active: rgba(212, 175, 55, 0.55);
  --border-crimson: rgba(230, 57, 70, 0.55);

  --gold-primary: #d4af37;
  --gold-bright: #f0d068;
  --gold-light: #f3e5ab;
  --gold-muted: #9e8230;
  --gold-glow: rgba(212, 175, 55, 0.22);
  --gold-soft: rgba(212, 175, 55, 0.08);

  --crimson-accent: #e63946;
  --crimson-bright: #ff4757;
  --crimson-glow: rgba(230, 57, 70, 0.28);
  --crimson-soft: rgba(230, 57, 70, 0.10);

  --emerald-accent: #10b981;
  --cyan-accent: #38bdf8;

  --slate-text: #f1f5f9;
  --slate-body: #cbd5e1;
  --slate-muted: #8b9bb4;
  --text-dim: #8b9bb4;

  --serif-font: 'Cormorant Garamond', 'Cinzel', 'Georgia', serif;
  --display-font: 'Cinzel', 'Cormorant Garamond', 'Georgia', serif;
  --sans-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono-font: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;

  --sidebar-w: 252px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--obsidian);
  color: var(--slate-text);
  font-family: var(--sans-font);
  font-size: 13.5px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(212, 175, 55, 0.10), transparent 70%),
    radial-gradient(ellipse 60% 40% at 85% 20%, rgba(230, 57, 70, 0.06), transparent 65%),
    linear-gradient(rgba(212, 175, 55, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212, 175, 55, 0.025) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 48px 48px, 48px 48px;
}

/* CUSTOM SCROLLBAR */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--obsidian-deep); }
::-webkit-scrollbar-thumb { background: var(--graphite-700); border: 1px solid var(--border-subtle); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-muted); }

/* KEYFRAME ANIMATIONS */
@keyframes fadeUpIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--gold-primary); }
  50%      { opacity: 0.55; box-shadow: 0 0 16px var(--crimson-accent); }
}

@keyframes scanlineSweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

/* ============================================================================
   PERSISTENT TACTICAL SIDEBAR NAVIGATION
   ============================================================================ */
aside.app-sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, rgba(11, 13, 20, 0.98) 0%, rgba(7, 8, 12, 0.99) 100%);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  box-shadow: 6px 0 30px rgba(0, 0, 0, 0.65);
}

.sidebar-header {
  padding: 20px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 13px;
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.08) 0%, transparent 100%);
  text-decoration: none;
}

.sidebar-logo {
  width: 38px;
  height: 38px;
  background: radial-gradient(circle at 30% 30%, #242b3d, #0c0f17);
  border: 1px solid var(--gold-primary);
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.25), inset 0 0 8px rgba(212, 175, 55, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display-font);
  font-weight: 700;
  font-size: 16px;
  color: var(--gold-primary);
  border-radius: 3px;
  flex-shrink: 0;
}

.sidebar-title h2 {
  font-family: var(--display-font);
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.sidebar-title p {
  font-size: 9.5px;
  color: var(--gold-primary);
  font-family: var(--mono-font);
  letter-spacing: 0.6px;
  margin-top: 2px;
}

nav.sidebar-nav {
  padding: 18px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow-y: auto;
}

.nav-section-label {
  font-family: var(--mono-font);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--gold-muted);
  padding: 8px 12px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  color: var(--slate-muted);
  text-decoration: none;
  font-family: var(--sans-font);
  font-size: 12.5px;
  font-weight: 500;
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.nav-link:hover {
  background: rgba(212, 175, 55, 0.06);
  color: #fff;
  border-left-color: var(--gold-muted);
  padding-left: 16px;
}

.nav-link.active {
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.16) 0%, rgba(230, 57, 70, 0.05) 100%);
  color: var(--gold-light);
  font-weight: 600;
  border-left: 3px solid var(--gold-primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.nav-icon {
  font-size: 14px;
  width: 22px;
  text-align: center;
  color: var(--gold-primary);
}

.sidebar-specs-mini {
  margin: 8px 12px 12px;
  padding: 12px;
  background: rgba(14, 18, 27, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  font-family: var(--mono-font);
  font-size: 10px;
}

.sidebar-specs-mini .ssm-title {
  color: var(--gold-primary);
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: 0.6px;
  display: flex;
  justify-content: space-between;
}

.sidebar-specs-mini .ssm-row {
  display: flex;
  justify-content: space-between;
  color: var(--slate-muted);
  padding: 2px 0;
}

.sidebar-specs-mini .ssm-row b {
  color: var(--slate-text);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-subtle);
  background: var(--obsidian-deep);
}

.sys-badge {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono-font);
  font-size: 10px;
  color: var(--gold-light);
  letter-spacing: 0.4px;
}

.sys-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald-accent);
  box-shadow: 0 0 10px var(--emerald-accent);
  animation: pulseGlow 2.6s infinite;
}

/* ============================================================================
   INSTITUTIONAL PRESTIGE BANNER & TOP HEADER BAR
   ============================================================================ */
main.app-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: calc(100vw - var(--sidebar-w));
}

.inst-prestige-bar {
  background: linear-gradient(180deg, #12151f 0%, #0a0c12 100%);
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 28px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  position: relative;
}

.inst-prestige-bar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 15%;
  right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-primary), transparent);
  opacity: 0.55;
}

.inst-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inst-emblem {
  width: 32px;
  height: 32px;
  border: 1px solid var(--gold-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-primary);
  font-family: var(--display-font);
  font-size: 13px;
  background: rgba(212, 175, 55, 0.08);
}

.inst-left-text strong {
  display: block;
  font-family: var(--serif-font);
  font-size: 15px;
  color: #fff;
  letter-spacing: 0.4px;
}

.inst-left-text span {
  font-size: 10.5px;
  color: var(--slate-muted);
}

.inst-center {
  text-align: center;
}

.inst-center h2 {
  font-family: var(--serif-font);
  font-size: 20px;
  font-weight: 600;
  color: var(--gold-light);
  letter-spacing: 0.8px;
}

.inst-center p {
  font-size: 10.5px;
  color: var(--slate-muted);
  letter-spacing: 0.4px;
}

.inst-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.inst-right strong {
  font-family: var(--serif-font);
  font-size: 15px;
  color: #fff;
}

.inst-right span {
  font-size: 10.5px;
  color: var(--gold-light);
}

header.top-bar {
  background: rgba(11, 13, 20, 0.90);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-card);
  padding: 12px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
  flex-wrap: wrap;
  gap: 12px;
}

.top-title {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.top-title h1 {
  font-family: var(--serif-font);
  font-size: 21px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.4px;
}

.page-tag {
  background: rgba(212, 175, 55, 0.10);
  border: 1px solid rgba(212, 175, 55, 0.35);
  color: var(--gold-light);
  padding: 3px 10px;
  font-family: var(--mono-font);
  font-size: 10px;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  border-radius: 2px;
}

.top-meta {
  display: flex;
  align-items: center;
  gap: 18px;
  font-family: var(--mono-font);
  font-size: 11px;
  color: var(--slate-muted);
}

/* ============================================================================
   PAGE CONTAINER & TACTICAL GLASS CARDS
   ============================================================================ */
.page-container {
  padding: 24px 28px 36px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 22px;
  animation: fadeUpIn 0.35s ease-out;
}

.tactical-card {
  background: linear-gradient(165deg, rgba(22, 27, 40, 0.92) 0%, rgba(12, 15, 23, 0.96) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.tactical-card:hover {
  border-color: rgba(212, 175, 55, 0.32);
}

/* Corner precision brackets */
.tactical-card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  width: 8px;
  height: 8px;
  border-top: 2px solid var(--gold-primary);
  border-left: 2px solid var(--gold-primary);
  pointer-events: none;
}

.tactical-card::after {
  content: '';
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 8px;
  height: 8px;
  border-bottom: 2px solid var(--gold-primary);
  border-right: 2px solid var(--gold-primary);
  pointer-events: none;
}

/* Unified support for both .card-head and .card-title */
.card-head,
.card-title {
  padding: 11px 18px;
  background: linear-gradient(90deg, rgba(26, 32, 46, 0.95) 0%, rgba(16, 20, 30, 0.9) 100%);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--sans-font);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gold-light);
}

.card-head h3,
.card-title > span:first-child {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 9px;
}

.card-head h3::before,
.card-title > span:first-child::before {
  content: '/';
  color: var(--crimson-accent);
  font-family: var(--mono-font);
  font-weight: 800;
  font-size: 14px;
}

.card-body {
  padding: 18px;
}

/* Support direct content inside tactical-card when .card-title is used */
.tactical-card > .card-title ~ * {
  margin-left: 18px;
  margin-right: 18px;
}
.tactical-card > .card-title ~ *:last-child {
  margin-bottom: 18px;
}
.tactical-card > .card-title {
  margin-bottom: 14px;
}

/* BADGES */
.badge {
  font-family: var(--mono-font);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 2px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.badge-gold {
  background: rgba(212, 175, 55, 0.14);
  border: 1px solid rgba(212, 175, 55, 0.45);
  color: var(--gold-light);
}

.badge-crimson {
  background: rgba(230, 57, 70, 0.15);
  border: 1px solid rgba(230, 57, 70, 0.5);
  color: #ff8a93;
}

.badge-emerald {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
}

/* ============================================================================
   TELEMETRY STRIP & KPI INSTRUMENT BOXES
   ============================================================================ */
.tele-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.tele-box {
  background: linear-gradient(145deg, rgba(22, 27, 40, 0.95), rgba(11, 14, 21, 0.98));
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--gold-primary);
  padding: 14px 16px;
  border-radius: 3px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.tele-box.gold    { border-left-color: var(--gold-primary); }
.tele-box.crimson { border-left-color: var(--crimson-accent); }
.tele-box.emerald { border-left-color: var(--emerald-accent); }

.tele-lbl {
  font-size: 10px;
  color: var(--slate-muted);
  font-family: var(--mono-font);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.tele-val {
  font-family: var(--mono-font);
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-top: 4px;
  letter-spacing: -0.3px;
}

.tele-foot {
  font-family: var(--mono-font);
  font-size: 10.5px;
  color: var(--gold-light);
  margin-top: 4px;
  opacity: 0.85;
}

/* ============================================================================
   SLIDERS & CONTROLS (Unified .control-item and .ctrl-group)
   ============================================================================ */
.control-item,
.ctrl-group {
  margin-bottom: 15px;
}

.control-label,
.ctrl-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono-font);
  font-size: 11.5px;
  color: var(--slate-body);
  margin-bottom: 6px;
}

.control-label span.v,
.ctrl-value {
  color: var(--gold-primary);
  font-weight: 700;
  font-size: 13px;
  background: rgba(212, 175, 55, 0.10);
  padding: 1px 7px;
  border: 1px solid rgba(212, 175, 55, 0.28);
  border-radius: 2px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, var(--crimson-accent) 0%, var(--gold-primary) 100%);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--gold-light);
  border: 2px solid var(--obsidian);
  box-shadow: 0 0 10px var(--gold-primary);
  cursor: pointer;
  transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.18);
  background: #fff;
}

select.tactical-select,
input.tactical-input {
  background: var(--graphite-950);
  border: 1px solid var(--border-subtle);
  color: var(--slate-text);
  font-family: var(--mono-font);
  font-size: 11.5px;
  padding: 7px 11px;
  border-radius: 3px;
  outline: none;
}

select.tactical-select:focus,
input.tactical-input:focus {
  border-color: var(--gold-primary);
}

/* ============================================================================
   DATA TABLES
   ============================================================================ */
.data-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-card);
  border-radius: 3px;
}

table.tactical-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono-font);
  font-size: 11.5px;
}

table.tactical-table th {
  background: rgba(24, 29, 43, 0.95);
  color: var(--gold-light);
  font-weight: 700;
  text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-active);
  text-align: right;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

table.tactical-table th:first-child { text-align: left; }

table.tactical-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-align: right;
  color: #cbd5e1;
}

table.tactical-table td:first-child { text-align: left; }

table.tactical-table tbody tr {
  transition: background 0.15s ease;
}

table.tactical-table tbody tr:hover {
  background: rgba(212, 175, 55, 0.08);
}

table.tactical-table tr.highlight-optimum {
  background: rgba(212, 175, 55, 0.13);
}

table.tactical-table tr.highlight-optimum td {
  color: var(--gold-bright);
  font-weight: 700;
}

table.tactical-table tr.highlight-crimson {
  background: rgba(230, 57, 70, 0.13);
}

table.tactical-table tr.highlight-crimson td {
  color: #ff8a93;
  font-weight: 700;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn-tactical {
  background: linear-gradient(180deg, #1b2232 0%, #111520 100%);
  border: 1px solid var(--border-subtle);
  color: var(--slate-text);
  padding: 8px 15px;
  font-family: var(--mono-font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  border-radius: 3px;
  transition: all 0.2s ease;
}

.btn-tactical:hover {
  background: var(--graphite-700);
  border-color: var(--gold-primary);
  color: #fff;
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.2);
}

.btn-tactical.primary,
.btn-tactical.btn-gold {
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.24) 0%, rgba(212, 175, 55, 0.10) 100%);
  border-color: var(--gold-primary);
  color: var(--gold-light);
}

.btn-tactical.primary:hover,
.btn-tactical.btn-gold:hover {
  background: var(--gold-primary);
  color: #05070a;
  box-shadow: 0 0 18px var(--gold-glow);
}

.btn-tactical.btn-crimson {
  background: linear-gradient(180deg, rgba(230, 57, 70, 0.28) 0%, rgba(230, 57, 70, 0.12) 100%);
  border-color: var(--crimson-accent);
  color: #ffd1d6;
}

.btn-tactical.btn-crimson:hover {
  background: var(--crimson-accent);
  color: #fff;
  box-shadow: 0 0 18px var(--crimson-glow);
}

/* ============================================================================
   FOOTER
   ============================================================================ */
footer.app-footer {
  margin-top: auto;
  padding: 14px 28px;
  background: var(--obsidian-deep);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono-font);
  font-size: 10.5px;
  color: var(--slate-muted);
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 1024px) {
  :root { --sidebar-w: 210px; }
  .inst-prestige-bar { grid-template-columns: 1fr; text-align: center; }
  .inst-left, .inst-right { justify-content: center; align-items: center; text-align: center; }
}

@media (max-width: 768px) {
  body { flex-direction: column; }
  aside.app-sidebar {
    position: relative;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  main.app-main {
    margin-left: 0;
    max-width: 100vw;
  }
}
