/* =====================================================
   ABL Skyline — Design System
   Navy / Gold institutional aesthetic
   ===================================================== */

:root {
  /* Palette */
  --navy: #0B2545;
  --navy-deep: #061838;
  --navy-darker: #050C1C;
  --navy-card: #0F2A4D;
  --gold: #C9A050;
  --gold-deep: #B58E3A;
  --gold-soft: #E8C880;
  --ink: #E8E1CC;
  --ink-soft: #B8B4A6;
  --ink-faint: #5E5C53;
  --line: #1B3559;
  --line-soft: #142A47;
  --good: #7EE0B0;
  --warn: #F7B955;
  --bad: #F26B6B;
  --info: #6FC3F7;

  /* Typography */
  --f-display: 'Fraunces', Georgia, serif;
  --f-body: 'IBM Plex Sans', -apple-system, sans-serif;
  --f-mono: 'IBM Plex Mono', monospace;

  /* Radii / spacing */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 18px;
  --shadow-1: 0 1px 0 rgba(255,255,255,0.04), 0 1px 2px rgba(0,0,0,0.4);
  --shadow-2: 0 8px 24px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--navy-darker); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.55; }
body {
  background:
    radial-gradient(ellipse at 20% -10%, rgba(201,160,80,0.08), transparent 50%),
    radial-gradient(ellipse at 80% 110%, rgba(11,37,69,0.7), transparent 50%),
    var(--navy-darker);
  min-height: 100vh;
  position: relative;
}
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    linear-gradient(rgba(201,160,80,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201,160,80,0.015) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}
#app { position: relative; z-index: 1; }
a { color: var(--gold); text-decoration: none; transition: color .15s; }
a:hover { color: var(--gold-soft); }
img, svg { max-width: 100%; height: auto; vertical-align: middle; }
code, pre { font-family: var(--f-mono); }

h1, h2, h3, h4 { font-family: var(--f-display); font-weight: 500; letter-spacing: -0.01em; color: var(--ink); margin: 0 0 .6em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); line-height: 1.1; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); line-height: 1.2; }
h3 { font-size: 1.25rem; line-height: 1.3; }
h4 { font-size: 1rem; font-weight: 600; }
p { margin: 0 0 1em; }
small { font-size: .82rem; color: var(--ink-soft); }
.eyebrow { font-family: var(--f-mono); font-size: .68rem; letter-spacing: .28em; text-transform: uppercase; color: var(--gold); margin-bottom: 1rem; }
.mono { font-family: var(--f-mono); }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.good { color: var(--good); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
hr { border: none; border-top: 1px solid var(--line); margin: 2rem 0; }

/* ---------- App layout ---------- */
#app { min-height: 100vh; display: flex; flex-direction: column; }
#view { flex: 1; }
.container { max-width: 1320px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 880px; margin: 0 auto; padding: 0 24px; }

/* ---------- Top nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 60;
  background: rgba(5, 12, 28, 0.85);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav .row { display: flex; align-items: center; gap: 24px; padding: 14px 24px; max-width: 1400px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 12px; cursor: pointer; transition: opacity .15s; }
.brand:hover { opacity: .85; }
.brand-mark { width: 32px; height: 32px; flex-shrink: 0; }
.brand img { display: block; }
.brand-text { font-family: var(--f-display); font-size: 1.1rem; font-weight: 600; color: var(--ink); }
.brand-sub { font-family: var(--f-mono); font-size: .58rem; letter-spacing: .25em; color: var(--gold); text-transform: uppercase; margin-top: 2px; }
.nav-spacer { flex: 1; }
.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-link {
  padding: 8px 14px;
  color: var(--ink-soft);
  font-size: .9rem;
  cursor: pointer;
  border-radius: 6px;
  position: relative;
  transition: color .15s, background .15s;
}
.nav-link:hover { color: var(--ink); background: var(--line-soft); }
.nav-link.active { color: var(--gold); }
.nav-link[aria-current="page"]::after {
  content: '';
  position: absolute;
  bottom: -16px;
  left: 14px;
  right: 14px;
  height: 2px;
  background: var(--gold);
}

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  position: relative;
}
.menu-toggle span::before, .menu-toggle span::after {
  content: ''; display: block; position: absolute; width: 18px; height: 2px; background: var(--ink); left: 0;
}
.menu-toggle span::before { top: -6px; }
.menu-toggle span::after { top: 6px; }

@media (max-width: 880px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex; flex-direction: column; align-items: stretch; gap: 0;
    position: absolute; top: 100%; left: 0; right: 0;
    background: rgba(5,12,28,0.98); border-bottom: 1px solid var(--line);
    padding: 8px;
  }
  .nav-links.open .nav-link { padding: 12px; border-bottom: 1px solid var(--line-soft); }
  .nav-links.open .btn { margin: 8px; }
  .menu-toggle { display: inline-flex; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 8px;
  font-family: var(--f-body); font-size: .92rem; font-weight: 500;
  cursor: pointer; border: 1px solid transparent; text-decoration: none;
  transition: all .15s ease; line-height: 1;
}
.btn-primary { background: linear-gradient(180deg, var(--gold), var(--gold-deep)); color: var(--navy-deep); font-weight: 600; box-shadow: 0 4px 14px rgba(201,160,80,0.25); }
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(201,160,80,0.35); }
.btn-secondary { background: var(--navy); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--line-soft); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--line-soft); }
.btn-danger { background: rgba(242,107,107,0.12); color: var(--bad); border-color: var(--bad); }
.btn-sm { padding: 6px 12px; font-size: .82rem; }
.btn-lg { padding: 14px 24px; font-size: 1rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---------- Cards ---------- */
.card {
  background: linear-gradient(180deg, rgba(15,42,77,0.6), rgba(11,37,69,0.4));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--shadow-1);
  position: relative;
  transition: border-color .25s ease, transform .25s ease;
}
.card:hover { border-color: rgba(201,160,80,0.3); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-family: var(--f-display); font-size: 1.1rem; font-weight: 600; }
.card-actions { display: flex; gap: 8px; }
.pillar { padding: 24px; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(15,42,77,0.5), rgba(6,24,56,0.4));
  position: relative; overflow: hidden;
  transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}
.pillar:hover {
  border-color: rgba(201,160,80,0.35);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.pillar::after {
  content: ''; position: absolute; top: 0; left: 0; height: 2px; width: 0;
  background: linear-gradient(90deg, var(--gold), transparent);
  transition: width .4s ease;
}
.pillar:hover::after { width: 100%; }
.pillar-num { font-family: var(--f-display); font-size: 3.4rem; color: var(--gold); opacity: .22; line-height: 1; }
.pillar h3 { margin-top: -32px; position: relative; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.kpi {
  background: linear-gradient(180deg, rgba(11,37,69,0.7), rgba(6,24,56,0.55));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 20px;
  transition: border-color .25s ease, transform .25s ease;
  position: relative;
}
.kpi:hover { border-color: rgba(201,160,80,0.3); transform: translateY(-1px); }
.kpi-label { font-family: var(--f-mono); font-size: .65rem; letter-spacing: .25em; text-transform: uppercase; color: var(--gold); margin-bottom: 10px; }
.kpi-value { font-family: var(--f-display); font-size: 2.1rem; font-weight: 600; color: var(--ink); line-height: 1; }
.kpi-delta { font-family: var(--f-mono); font-size: .8rem; margin-top: 10px; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.tbl th { color: var(--gold); font-family: var(--f-mono); font-size: .68rem; letter-spacing: .15em; text-transform: uppercase; font-weight: 500; }
.tbl tr:hover { background: rgba(201,160,80,0.04); }
.tbl-compact th, .tbl-compact td { padding: 6px 8px; font-size: .82rem; }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 16px; }
.field label { display: block; font-family: var(--f-mono); font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; padding: 11px 14px;
  background: rgba(5,12,28,0.7);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-family: var(--f-body); font-size: .95rem;
  transition: border-color .15s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--gold); }
.textarea { resize: vertical; min-height: 100px; }
.help { font-size: .78rem; color: var(--ink-soft); margin-top: 6px; }
.error-text { font-size: .85rem; color: var(--bad); margin-top: 6px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 12px;
  font-family: var(--f-mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
}
.badge-good { background: rgba(126,224,176,0.14); color: var(--good); }
.badge-warn { background: rgba(247,185,85,0.14); color: var(--warn); }
.badge-bad  { background: rgba(242,107,107,0.14); color: var(--bad); }
.badge-info { background: rgba(111,195,247,0.14); color: var(--info); }
.badge-gold { background: rgba(201,160,80,0.14); color: var(--gold); }
.badge-mono { background: var(--line-soft); color: var(--ink); }

/* ---------- Toast / banner ---------- */
.toast-host { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.toast {
  background: var(--navy-card); border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 8px; padding: 14px 18px;
  box-shadow: var(--shadow-2);
  animation: toast-in .25s;
}
.toast.ok { border-left-color: var(--good); }
.toast.err { border-left-color: var(--bad); }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.banner { background: rgba(247,185,85,0.08); border: 1px solid rgba(247,185,85,0.3); padding: 12px 18px; border-radius: 8px; margin-bottom: 16px; }

/* ---------- Hero / landing ---------- */
.hero { padding: 96px 0 64px; position: relative; overflow: hidden; }
.hero::before {
  content: ''; position: absolute; top: -20%; right: -10%; width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(201,160,80,0.10), transparent 60%);
  pointer-events: none;
}
.hero::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: .25;
}
.hero h1 {
  max-width: 18ch;
  font-size: clamp(2.1rem, 5vw, 3.8rem);
  font-weight: 500;
  line-height: 1.05;
  animation: fadeUp .8s ease;
}
.hero .lead {
  max-width: 64ch;
  font-size: clamp(1rem, 1.4vw, 1.18rem);
  color: var(--ink-soft);
  margin: 1.4em 0 2em;
  animation: fadeUp .8s ease .1s both;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; animation: fadeUp .8s ease .2s both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.eyebrow { animation: fadeUp .6s ease; }
.section { padding: 56px 0; }
.section-tight { padding: 32px 0; }
.section h2 { max-width: 22ch; }
.section .lead { max-width: 64ch; color: var(--ink-soft); }
.section .eyebrow::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--gold);
  vertical-align: middle;
  margin-right: 12px;
  opacity: .6;
}
.grid-2 { display: grid; gap: 24px; grid-template-columns: 1fr 1fr; }
.grid-3 { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-4 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Map ---------- */
#map-host, .leaflet-container {
  background: var(--navy-deep) !important;
  border-radius: var(--r-md);
}
.leaflet-control-attribution { background: rgba(5,12,28,0.7) !important; color: var(--ink-soft) !important; font-size: 9px !important; }
.leaflet-control-attribution a { color: var(--gold) !important; }
.aircraft-marker { background: var(--gold); border: 2px solid #fff; border-radius: 50%; transform-origin: center; box-shadow: 0 0 8px rgba(201,160,80,0.6); }

/* ---------- Footer ---------- */
.footer { background: rgba(5,12,28,0.6); border-top: 1px solid var(--line); padding: 48px 0 24px; margin-top: 80px; }
.footer-grid { display: grid; gap: 32px; grid-template-columns: 2fr 1fr 1fr 1fr; }
.footer-grid h4 { font-family: var(--f-mono); font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 8px; }
.footer-grid a { color: var(--ink-soft); font-size: .9rem; }
.footer-grid a:hover { color: var(--ink); }
.footer-bottom { border-top: 1px solid var(--line-soft); padding-top: 16px; margin-top: 32px; font-size: .82rem; color: var(--ink-faint); display: flex; gap: 16px; flex-wrap: wrap; }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 500px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- Auth / forms layout ---------- */
.auth-wrap { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 60px); padding: 40px 16px; }
.auth-card { width: 100%; max-width: 460px; padding: 36px; background: var(--navy-card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); }
.auth-card h1 { font-size: 1.6rem; margin-bottom: 4px; }
.auth-card .lead { color: var(--ink-soft); margin-bottom: 24px; font-size: .95rem; }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--ink-faint); font-size: .8rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------- Dashboard layout ---------- */
.dash { display: grid; grid-template-columns: 260px 1fr; gap: 28px; padding: 28px; max-width: 1500px; margin: 0 auto; }
.dash-side {
  background: linear-gradient(180deg, rgba(11,37,69,0.5), rgba(6,24,56,0.4));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px;
  height: max-content;
  position: sticky;
  top: 80px;
}
.dash-side h3 { font-family: var(--f-mono); font-size: .65rem; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.dash-side-link {
  display: block;
  padding: 10px 14px;
  color: var(--ink-soft);
  border-radius: 6px;
  cursor: pointer;
  font-size: .92rem;
  margin-bottom: 2px;
  transition: background .15s, color .15s;
}
.dash-side-link:hover { background: var(--line-soft); color: var(--ink); }
.dash-side-link.active {
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  color: var(--navy-deep);
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(201,160,80,0.25);
}
.dash-main { min-width: 0; }
.dash-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.dash-header h1 { font-size: 1.6rem; margin: 0; }

@media (max-width: 900px) {
  .dash { grid-template-columns: 1fr; padding: 12px; }
  .dash-side { position: static; }
  .dash-side-links { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; flex-wrap: nowrap; }
  .dash-side-link { white-space: nowrap; padding: 8px 14px; flex-shrink: 0; }
}

/* ---------- Misc helpers ---------- */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.spacer { flex: 1; }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; }
.spin { width: 22px; height: 22px; border: 2px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: sp 0.8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, transparent, rgba(201,160,80,0.05), transparent); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Aircraft list item */
.aircraft-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 12px; border-bottom: 1px solid var(--line-soft); align-items: center; }
.aircraft-row:hover { background: rgba(201,160,80,0.04); }
.aircraft-tail { font-family: var(--f-mono); font-weight: 500; color: var(--gold); }
.aircraft-type { font-size: .8rem; color: var(--ink-soft); }

/* News feed */
.news-item { padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.news-item h4 { margin-bottom: 4px; font-family: var(--f-body); font-size: .98rem; font-weight: 500; }
.news-item .news-meta { font-family: var(--f-mono); font-size: .68rem; color: var(--gold); letter-spacing: .12em; text-transform: uppercase; margin-bottom: 6px; }
.news-item summary { color: var(--ink-soft); font-size: .88rem; }

/* Weather card */
.wx-card { display: grid; grid-template-columns: 80px 1fr; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; align-items: center; }
.wx-temp { font-family: var(--f-display); font-size: 1.5rem; color: var(--gold); text-align: center; }
.wx-detail { font-size: .85rem; color: var(--ink-soft); }
.wx-advice { font-size: .8rem; margin-top: 4px; padding: 4px 8px; border-radius: 4px; background: var(--line-soft); display: inline-block; }

.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); margin-right: 6px; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
