/* =====================================================================
   NAVLOG â€” Flight Operations
   Premium aviation SaaS interface Â· light / dark Â· responsive
   ---------------------------------------------------------------------
   The stylesheet is intentionally dependency-free. All layout, tokens,
   components, dark theme and responsive rules live here.
   ===================================================================== */

/* ------------------------------------------------------------------ */
/* 1. Design tokens                                                    */
/* ------------------------------------------------------------------ */
:root {
  --bg: #edf2f8;
  --bg-deep: #e7edf6;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --surface-glass: rgba(255, 255, 255, 0.82);
  --text: #0b1a2b;
  --text-2: #4d5e75;
  --text-3: #7c8ca2;
  --text-inverse: #f7fbff;
  --border: #dde5f0;
  --border-strong: #c9d5e4;
  --border-subtle: #ebf0f7;

  --accent: #d51f3f;
  --accent-strong: #b3102d;
  --accent-soft: #fff1f3;
  --accent-border: #ffd3da;
  --accent-rgb: 213, 31, 63;

  --blue: #2364d2;
  --blue-strong: #1d4fb0;
  --blue-soft: #eef4ff;
  --blue-border: #cbdcff;
  --blue-rgb: 35, 100, 210;

  --emerald: #0b8f6a;
  --emerald-strong: #087658;
  --emerald-soft: #ecfdf6;
  --emerald-border: #b8ead9;

  --east: #0f766e;
  --east-strong: #0b5f59;
  --east-soft: #ecfdf8;
  --east-border: #a9e6da;
  --east-rgb: 15, 118, 110;

  --west: #7c3aed;
  --west-strong: #6527d9;
  --west-soft: #f5f2ff;
  --west-border: #d8ccff;
  --west-rgb: 124, 58, 237;

  --sky: #0369a1;
  --sky-soft: #eff9ff;
  --sky-border: #bae6fd;

  --indigo: #4f46e5;
  --indigo-soft: #eef2ff;
  --indigo-border: #c7d2fe;

  --amber: #b45309;
  --amber-soft: #fffbeb;
  --amber-border: #fde68a;

  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;

  --sidebar-bg: #0a1422;
  --sidebar-bg-2: #0d1a2c;
  --sidebar-border: rgba(164, 190, 224, 0.13);
  --sidebar-text: #eaf2fc;
  --sidebar-muted: #8194ad;

  --shadow-xs: 0 1px 2px rgba(15, 35, 60, 0.04);
  --shadow-sm: 0 3px 10px rgba(15, 35, 60, 0.05);
  --shadow-md: 0 12px 30px -12px rgba(15, 35, 60, 0.18);
  --shadow-lg: 0 28px 70px -28px rgba(6, 21, 42, 0.35);
  --shadow-sidebar: 18px 0 50px -30px rgba(4, 13, 27, 0.7);

  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius-md: 13px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  --sidebar-w: 286px;
  --topbar-h: 72px;
  --page-max: 1510px;
  --ring: 0 0 0 4px rgba(var(--accent-rgb), 0.13);
  --transition: 180ms cubic-bezier(0.2, 0.7, 0.3, 1);
}

[data-theme="dark"] {
  --bg: #070d17;
  --bg-deep: #050a12;
  --surface: #0e1828;
  --surface-raised: #111d2f;
  --surface-2: #0b1523;
  --surface-3: #162235;
  --surface-glass: rgba(13, 24, 40, 0.86);
  --text: #e9f0fa;
  --text-2: #9bacc3;
  --text-3: #6f819b;
  --text-inverse: #07111f;
  --border: #213049;
  --border-strong: #2d3e59;
  --border-subtle: #18253a;

  --accent: #fb7185;
  --accent-strong: #f43f5e;
  --accent-soft: rgba(251, 113, 133, 0.11);
  --accent-border: rgba(251, 113, 133, 0.28);
  --accent-rgb: 251, 113, 133;

  --blue: #7aa9ff;
  --blue-strong: #a3c2ff;
  --blue-soft: rgba(77, 127, 235, 0.13);
  --blue-border: rgba(113, 155, 255, 0.27);
  --blue-rgb: 122, 169, 255;

  --emerald: #34d3a6;
  --emerald-strong: #6ee7c0;
  --emerald-soft: rgba(52, 211, 166, 0.1);
  --emerald-border: rgba(52, 211, 166, 0.25);

  --east: #2dd4bf;
  --east-strong: #5eead4;
  --east-soft: rgba(45, 212, 191, 0.09);
  --east-border: rgba(45, 212, 191, 0.26);
  --east-rgb: 45, 212, 191;

  --west: #a78bfa;
  --west-strong: #c4b5fd;
  --west-soft: rgba(167, 139, 250, 0.1);
  --west-border: rgba(167, 139, 250, 0.27);
  --west-rgb: 167, 139, 250;

  --sky: #7dd3fc;
  --sky-soft: rgba(56, 189, 248, 0.09);
  --sky-border: rgba(125, 211, 252, 0.22);

  --indigo: #a5b4fc;
  --indigo-soft: rgba(129, 140, 248, 0.1);
  --indigo-border: rgba(165, 180, 252, 0.25);

  --amber: #fcd34d;
  --amber-soft: rgba(251, 191, 36, 0.09);
  --amber-border: rgba(252, 211, 77, 0.23);

  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.1);
  --danger-border: rgba(248, 113, 113, 0.26);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 18px 40px -18px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 36px 90px -35px rgba(0, 0, 0, 0.8);
  --shadow-sidebar: 18px 0 60px -30px rgba(0, 0, 0, 0.8);
  --ring: 0 0 0 4px rgba(var(--accent-rgb), 0.16);
}

/* ------------------------------------------------------------------ */
/* 2. Base                                                             */
/* ------------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1300px 760px at 82% -12%, rgba(var(--blue-rgb), 0.12), transparent 60%),
    radial-gradient(900px 640px at 3% 17%, rgba(var(--accent-rgb), 0.055), transparent 60%),
    radial-gradient(1100px 760px at 55% 108%, rgba(var(--east-rgb), 0.055), transparent 65%),
    linear-gradient(180deg, #f1f5fa 0%, #e9eff7 44%, #e3eaf4 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--transition), color var(--transition);
}

[data-theme="dark"] body {
  background:
    radial-gradient(1200px 700px at 84% -8%, rgba(69, 118, 210, 0.2), transparent 60%),
    radial-gradient(900px 600px at 7% 8%, rgba(225, 29, 72, 0.065), transparent 60%),
    radial-gradient(1000px 720px at 60% 110%, rgba(20, 184, 166, 0.06), transparent 62%),
    linear-gradient(180deg, #08111e 0%, #060b13 55%, #070d17 100%);
  background-attachment: fixed;
}

body.no-scroll {
  overflow: hidden;
}

::selection {
  background: rgba(var(--accent-rgb), 0.18);
}

h1, h2, h3, h4, p {
  margin: 0;
}

h1 {
  font-size: clamp(27px, 2.4vw, 36px);
  line-height: 1.1;
  letter-spacing: -0.035em;
  font-weight: 800;
}

h2 {
  font-size: 16px;
  line-height: 1.25;
  letter-spacing: -0.018em;
  font-weight: 750;
}

h3 {
  font-size: 15px;
  letter-spacing: -0.012em;
  font-weight: 700;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

input,
select,
textarea {
  min-width: 0;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-3);
  opacity: 0.9;
}

select {
  appearance: none;
  -webkit-appearance: none;
}

a {
  color: var(--blue);
  text-decoration: none;
}

img,
video {
  display: block;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center;
}

.manage-item-icon i,
.freq-role i,
.panel-icon i,
.modal-icon i {
  line-height: 1;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 1px 5px;
  border-radius: 5px;
  color: var(--text);
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.muted-copy {
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.65;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text-3) 38%, transparent);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--text-3) 58%, transparent);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* ------------------------------------------------------------------ */
/* 3. App shell / sidebar                                              */
/* ------------------------------------------------------------------ */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 640px;
  padding: 22px 16px 16px;
  color: var(--sidebar-text);
  background:
    radial-gradient(560px 280px at 12% -4%, rgba(65, 125, 220, 0.16), transparent 64%),
    radial-gradient(360px 320px at 95% 100%, rgba(var(--accent-rgb), 0.1), transparent 60%),
    linear-gradient(180deg, var(--sidebar-bg-2), var(--sidebar-bg));
  border-right: 1px solid var(--sidebar-border);
  box-shadow: var(--shadow-sidebar);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 20px;
  border-bottom: 1px solid var(--sidebar-border);
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  flex: 0 0 auto;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, #e52a4b, #a40c26);
  box-shadow: 0 10px 22px -10px rgba(220, 38, 63, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.brand-mark span {
  position: relative;
  z-index: 1;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-mark i {
  position: absolute;
  right: -5px;
  bottom: -5px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  font-size: 9px;
  color: #dce9fb;
  background: #142a46;
  border: 1px solid rgba(174, 205, 245, 0.25);
  border-radius: 50%;
  transform: rotate(45deg);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.brand-copy strong {
  font-size: 16px;
  letter-spacing: 0.14em;
  font-weight: 800;
}

.brand-copy span {
  margin-top: 3px;
  color: var(--sidebar-muted);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.sidebar-close {
  display: none;
  margin-left: auto;
  color: var(--sidebar-muted);
  border-color: var(--sidebar-border);
}

.sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  padding-top: 18px;
  overflow-y: auto;
}

.nav-section-label {
  padding: 0 10px;
  margin-bottom: 7px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #667c99;
}

.nav-section-spaced {
  margin-top: 20px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 11px;
  margin-bottom: 3px;
  color: #aebfd5;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 12px;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
}

.nav-item:hover {
  color: #e9f2ff;
  background: rgba(154, 190, 235, 0.075);
}

.nav-item:active {
  transform: scale(0.992);
}

.nav-item.is-active {
  color: #fff;
  background: linear-gradient(100deg, rgba(83, 135, 220, 0.2), rgba(74, 104, 155, 0.08));
  border-color: rgba(129, 170, 230, 0.17);
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 50%;
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.8);
  transform: translateY(-50%);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  flex: 0 0 auto;
  font-size: 14px;
  color: #93a9c5;
  background: rgba(144, 177, 219, 0.08);
  border: 1px solid rgba(158, 190, 229, 0.1);
  border-radius: 10px;
  transition: all var(--transition);
}

.nav-item.is-active .nav-icon {
  color: #f9d4da;
  background: rgba(var(--accent-rgb), 0.18);
  border-color: rgba(var(--accent-rgb), 0.3);
}

.nav-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.nav-copy strong {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.nav-copy small {
  margin-top: 2px;
  color: #6c829f;
  font-size: 10.5px;
  font-weight: 500;
}

.nav-item.is-active .nav-copy small {
  color: #9eb1ca;
}

.nav-count {
  min-width: 22px;
  padding: 2px 6px;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: #bed3ee;
  text-align: center;
  background: rgba(168, 199, 238, 0.1);
  border: 1px solid rgba(178, 207, 243, 0.11);
  border-radius: 99px;
}

.nav-live {
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-radius: 50%;
  background: #455a74;
}

.nav-live.is-live {
  background: #3ddc97;
  box-shadow: 0 0 0 4px rgba(61, 220, 151, 0.12), 0 0 12px rgba(61, 220, 151, 0.45);
}

.sidebar-footer {
  flex: 0 0 auto;
  padding-top: 13px;
  margin-top: 12px;
  border-top: 1px solid var(--sidebar-border);
}

.install-app-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 34px;
  padding: 8px 9px;
  margin-bottom: 4px;
  color: #dbe8f7;
  font-size: 11px;
  font-weight: 650;
  background: rgba(151, 184, 226, 0.09);
  border: 1px solid rgba(166, 199, 240, 0.14);
  border-radius: 10px;
  transition: background var(--transition), border-color var(--transition);
}

.install-app-btn:hover {
  background: rgba(151, 184, 226, 0.15);
  border-color: rgba(166, 199, 240, 0.24);
}

.install-app-btn i {
  width: 18px;
  color: #8fd0ff;
  text-align: center;
}

.theme-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 9px;
  color: #a8bad0;
  border-radius: 10px;
  transition: background var(--transition);
}

.theme-switch:hover {
  background: rgba(156, 190, 234, 0.07);
}

.theme-switch-track {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 45px;
  height: 24px;
  padding: 0 6px;
  color: #c5d7ec;
  background: rgba(151, 184, 226, 0.12);
  border: 1px solid rgba(166, 199, 240, 0.16);
  border-radius: 99px;
}

.theme-switch-track > i {
  position: relative;
  z-index: 1;
  font-size: 9px;
}

.theme-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: linear-gradient(145deg, #eef6ff, #afc8e6);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 240ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

[data-theme="dark"] .theme-switch-thumb {
  transform: translateX(21px);
  background: linear-gradient(145deg, #506888, #223a5b);
}

.theme-switch-label {
  font-size: 11px;
  font-weight: 500;
}

.sidebar-overlay {
  display: none;
}

/* ------------------------------------------------------------------ */
/* 4. Top bar                                                          */
/* ------------------------------------------------------------------ */
.app-main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  height: var(--topbar-h);
  padding: 0 clamp(16px, 2.4vw, 34px);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
}

.breadcrumb i {
  font-size: 8px;
  color: var(--text-3);
  opacity: 0.7;
}

.breadcrumb strong {
  overflow: hidden;
  color: var(--text);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar .mobile-menu {
  display: none;
}

.utc-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
  animation: pulse-soft 2.2s ease-in-out infinite;
}

.utc-label {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--text-3);
}

.utc-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

#utcDatePart,
#utcTimePart {
  white-space: nowrap;
}

.connection-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 9px;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.connection-pill i {
  font-size: 9px;
  color: var(--emerald);
}

.connection-pill.is-local {
  color: var(--amber);
  border-color: var(--amber-border);
  background: var(--amber-soft);
}

.connection-pill.is-local i {
  color: var(--amber);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 9px;
  transition: all var(--transition);
}

.icon-button:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.icon-button:active {
  transform: scale(0.95);
}

.sidebar .sidebar-close {
  display: none;
}

.theme-toggle {
  background: var(--surface-2);
}

.theme-toggle i {
  font-size: 13px;
}

/* ------------------------------------------------------------------ */
/* 5. Page / headings / panels                                         */
/* ------------------------------------------------------------------ */
.page-container {
  width: 100%;
  max-width: var(--page-max);
  padding: 28px clamp(16px, 2.4vw, 34px) 54px;
  margin: 0 auto;
}

.view {
  animation: view-in 320ms ease;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.page-heading > div:first-child {
  min-width: 0;
}

.page-heading h1 {
  margin-top: 5px;
  color: var(--text);
}

.page-heading p {
  max-width: 760px;
  margin-top: 8px;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.6;
}

.page-heading-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.page-heading-actions button[onclick*="switchView('planner')"] {
  display: none !important;
}

@media (max-width: 1024px) {
  .page-heading-actions button[onclick*="switchView('planner')"] {
    display: inline-flex !important;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 7px 11px;
    color: var(--text-2);
    font-size: 9px;
    font-weight: 700;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: none;
  }
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow-line {
  width: 18px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.eyebrow--small {
  margin-bottom: 3px;
  font-size: 9.5px;
  color: var(--text-3);
}

.eyebrow--small + h2 {
  margin-top: 1px;
}

.panel {
  position: relative;
  margin-bottom: 18px;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.panel--flat {
  box-shadow: none;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.panel-heading-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.panel-heading-main > div {
  min-width: 0;
}

.panel-heading h2 {
  color: var(--text);
}

.panel-heading p {
  margin-top: 3px;
  color: var(--text-3);
  font-size: 11.5px;
}

.panel-heading p strong {
  color: var(--text-2);
  font-weight: 600;
}

.panel-heading-side {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.panel-icon {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  font-size: 14px;
  border: 1px solid transparent;
  border-radius: 10px;
}

.panel-icon--red {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.panel-icon--blue {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: var(--blue-border);
}

.panel-icon--emerald {
  color: var(--emerald);
  background: var(--emerald-soft);
  border-color: var(--emerald-border);
}

.panel-icon--sky {
  color: var(--sky);
  background: var(--sky-soft);
  border-color: var(--sky-border);
}

.heading-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

/* ------------------------------------------------------------------ */
/* 6. Buttons / badges / inputs                                        */
/* ------------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: all var(--transition);
}

.btn i {
  font-size: 12px;
}

.btn:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}

.btn:active {
  transform: translateY(1px) scale(0.995);
}

.btn--sm {
  min-height: 32px;
  padding: 0 11px;
  font-size: 11.5px;
  border-radius: 9px;
}

.btn--sm i {
  font-size: 11px;
}

.btn--lg {
  min-height: 45px;
  padding: 0 20px;
  font-size: 13.5px;
  border-radius: 12px;
}

.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, #e02949, var(--accent-strong));
  border-color: var(--accent-strong);
  box-shadow: 0 8px 20px -10px rgba(var(--accent-rgb), 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn--primary:hover {
  background: linear-gradient(135deg, #ed3553, #c31333);
  border-color: #a80d29;
  box-shadow: 0 10px 24px -8px rgba(var(--accent-rgb), 0.85);
}

[data-theme="dark"] .btn--primary {
  color: #25030b;
  background: linear-gradient(135deg, #fb7185, #f43f5e);
  border-color: #fb7185;
  text-shadow: none;
}

.btn--outline {
  color: var(--text);
  background: transparent;
  border-color: var(--border-strong);
}

.btn--outline:hover {
  background: var(--surface-2);
}

.btn--ghost {
  color: var(--text-2);
  background: transparent;
  border-color: transparent;
}

.btn--ghost:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border);
}

.btn--soft,
.btn--blue-soft {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: var(--blue-border);
}

.btn--soft:hover,
.btn--blue-soft:hover {
  filter: brightness(0.98);
}

.btn--violet-soft {
  color: var(--west);
  background: var(--west-soft);
  border-color: var(--west-border);
}

.btn--violet-soft:hover {
  filter: brightness(0.98);
}

.btn--sky-soft {
  color: var(--sky);
  background: var(--sky-soft);
  border-color: var(--sky-border);
}

.btn--sky-soft:hover {
  filter: brightness(0.98);
}

.btn--emerald-soft {
  color: var(--emerald);
  background: var(--emerald-soft);
  border-color: var(--emerald-border);
}

.btn--emerald-soft:hover {
  filter: brightness(0.98);
}

.btn--success {
  color: #fff;
  background: linear-gradient(135deg, #0ca678, var(--emerald-strong));
  border-color: var(--emerald-strong);
  box-shadow: 0 8px 18px -10px rgba(11, 143, 106, 0.75);
}

[data-theme="dark"] .btn--success {
  color: #02241a;
  background: linear-gradient(135deg, #34d3a6, #10b981);
  border-color: #34d3a6;
}

.btn--indigo {
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #4338ca);
  border-color: #4338ca;
}

[data-theme="dark"] .btn--indigo {
  color: #101237;
  background: linear-gradient(135deg, #a5b4fc, #818cf8);
  border-color: #a5b4fc;
}

.btn--danger {
  color: #fff;
  background: linear-gradient(135deg, #e23939, #b91c1c);
  border-color: #b91c1c;
}

[data-theme="dark"] .btn--danger {
  color: #2b0505;
  background: linear-gradient(135deg, #f87171, #ef4444);
  border-color: #f87171;
}

.btn--danger-ghost {
  color: var(--danger);
  background: transparent;
  border-color: var(--danger-border);
}

.btn--danger-ghost:hover {
  background: var(--danger-soft);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 23px;
  padding: 0 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.015em;
  white-space: nowrap;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text-2);
}

.badge i {
  font-size: 9px;
}

.badge--soft {
  color: var(--emerald);
  background: var(--emerald-soft);
  border-color: var(--emerald-border);
}

.badge--blue {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: var(--blue-border);
}

.badge--success {
  color: var(--emerald);
  background: var(--emerald-soft);
  border-color: var(--emerald-border);
}

.badge--mono {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.badge--warning {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: var(--amber-border);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > label,
.field-label {
  color: var(--text-2);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.005em;
}

.field > label > span {
  color: var(--text-3);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.input-shell,
.select-shell {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 38px;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.input-shell:hover,
.select-shell:hover {
  border-color: var(--border-strong);
}

.input-shell:focus-within,
.select-shell:focus-within {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.input-shell.is-invalid,
.input-shell.is-invalid:focus-within {
  background: var(--danger-soft);
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.flight-input-warning {
  margin-top: 12px;
}

.flight-input-warning p {
  margin-top: 3px;
  line-height: 1.5;
}

.input-shell > i {
  flex: 0 0 auto;
  width: 34px;
  font-size: 12px;
  text-align: center;
  color: var(--text-3);
}

.input-shell input,
.select-shell select {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 12.5px;
  font-weight: 550;
}

.input-shell > i + input {
  padding-left: 0;
}

.input-shell input[type="date"],
.input-shell input[type="time"] {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: -0.02em;
}

[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(0.85);
}

.input-shell--mono input {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.input-shell--accent {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.input-shell--accent > i {
  color: var(--accent);
}

.select-shell::after {
  content: "\f078";
  position: absolute;
  right: 11px;
  font-family: "Font Awesome 6 Free";
  font-size: 9px;
  font-weight: 900;
  color: var(--text-3);
  pointer-events: none;
}

.select-shell select {
  padding-right: 28px;
  cursor: pointer;
}

/* Native option popups need explicit colours: otherwise Windows/Chromium can
   render light option text on a white popup in dark mode. */
select option,
select optgroup {
  color: var(--text);
  background-color: var(--surface);
}

select option:checked,
select option:hover {
  color: var(--text);
  background-color: var(--surface-3);
}

[data-theme="dark"] {
  color-scheme: dark;
}

[data-theme="dark"] select,
[data-theme="dark"] select option,
[data-theme="dark"] select optgroup {
  color: #e9f0fa;
  background-color: #0e1828;
}

[data-theme="dark"] select option:checked,
[data-theme="dark"] select option:hover {
  color: #ffffff;
  background-color: #21324c;
}

[data-theme="dark"] select optgroup {
  color: #9bacc3;
  font-weight: 700;
}

.select-leading {
  position: absolute;
  left: 12px;
  z-index: 1;
  font-size: 11px;
  color: var(--text-3);
  pointer-events: none;
}

.select-shell .select-leading + select {
  padding-left: 30px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field--full {
  grid-column: 1 / -1;
}

/* ------------------------------------------------------------------ */
/* 7. Flight setup                                                     */
/* ------------------------------------------------------------------ */
.setup-panel {
  overflow: hidden;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  padding: 18px 20px;
}

.panel-footnotes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
  padding: 11px 20px;
  background: var(--surface-2);
  border-top: 1px solid var(--border-subtle);
}

.storage-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--text-3);
  font-size: 10.5px;
  line-height: 1.5;
}

.storage-note i {
  margin-top: 2px;
  font-size: 9px;
}

.storage-note strong {
  color: var(--text-2);
  font-weight: 650;
}

.footnote-timezone {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.02em;
}

.footnote-timezone i {
  font-size: 9px;
}

/* ------------------------------------------------------------------ */
/* 8. Route workspace                                                  */
/* ------------------------------------------------------------------ */
.route-panel {
  overflow: hidden;
}

.route-panel.menu-open {
  overflow: visible;
}

.route-panel-heading {
  flex-wrap: wrap;
}

.route-command-bar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 11px 14px;
  padding: 12px 20px;
  background: linear-gradient(180deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 60%, var(--surface)));
  border-bottom: 1px solid var(--border-subtle);
}

.manage-toggle {
  min-height: 38px;
  padding: 0 12px;
  color: var(--text-2);
  background: var(--surface);
}

.manage-toggle:hover {
  color: var(--text);
}

.manage-chevron {
  font-size: 7px;
  transition: transform var(--transition);
}

.manage-toggle.is-open .manage-chevron {
  transform: rotate(180deg);
}

.route-manage-menu {
  position: absolute;
  top: calc(100% - 5px);
  bottom: auto;
  right: 20px;
  z-index: 45;
  width: min(380px, calc(100vw - 40px));
  max-height: min(72vh, 620px);
  padding: 7px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: var(--shadow-lg);
  animation: menu-in 160ms ease both;
}

.route-manage-menu.is-up {
  top: auto;
  bottom: calc(100% + 5px);
}

.manage-menu-head {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 9px 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.manage-menu-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 11px;
  background: var(--blue-soft);
  border: 1px solid var(--blue-border);
  border-radius: 8px;
}

.manage-menu-head > div {
  min-width: 0;
}

.manage-menu-head strong {
  display: block;
  color: var(--text);
  font-size: 10.5px;
  font-weight: 700;
}

.manage-menu-head span {
  display: block;
  margin-top: 1px;
  color: var(--text-3);
  font-size: 8.5px;
  line-height: 1.45;
}

.manage-group-label {
  padding: 8px 9px 4px;
  color: var(--text-3);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.manage-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 8px;
  color: var(--text);
  text-align: left;
  border-radius: 8px;
  transition: background var(--transition);
}

.manage-item:hover {
  background: var(--surface-2);
}

.manage-item:disabled {
  opacity: 0.38;
  pointer-events: none;
}

.manage-item-icon {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  color: var(--text-3);
  font-size: 10px;
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.manage-item-icon--emerald { color: var(--emerald); background: var(--emerald-soft); border-color: var(--emerald-border); }
.manage-item-icon--blue { color: var(--blue); background: var(--blue-soft); border-color: var(--blue-border); }
.manage-item-icon--violet { color: var(--west); background: var(--west-soft); border-color: var(--west-border); }
.manage-item-icon--sky { color: var(--sky); background: var(--sky-soft); border-color: var(--sky-border); }
.manage-item-icon--rose { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-border); }

.manage-item-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.manage-item-copy strong {
  color: var(--text);
  font-size: 10px;
  font-weight: 650;
}

.manage-item-copy small {
  overflow: hidden;
  color: var(--text-3);
  font-size: 8.5px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manage-item-arrow {
  color: var(--text-3);
  font-size: 7px;
  opacity: 0.55;
}

.manage-divider {
  height: 1px;
  margin: 5px 7px;
  background: var(--border-subtle);
}

.manage-backdrop {
  display: none;
}

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.route-command-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.command-group {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-xs);
}

.command-group-label {
  padding: 0 6px;
  color: var(--text-3);
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.command-group .btn {
  border-color: transparent;
  box-shadow: none;
}

.command-group .btn--danger-ghost {
  border-color: transparent;
}

.command-group .btn:hover {
  border-color: currentColor;
}

.command-tool {
  align-self: stretch;
}

.route-control-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-subtle);
}

.route-select-group {
  flex: 1 1 320px;
  max-width: 520px;
  min-width: 0;
}

.route-select-group > label {
  display: block;
  margin-bottom: 5px;
  color: var(--text-3);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.select-shell--wide {
  background: var(--surface);
}

.select-shell--wide select {
  font-size: 12.5px;
  font-weight: 650;
}

.route-control-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.route-control-actions .btn--ghost {
  color: var(--text-2);
}

.route-overview {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(440px, 1.55fr);
  gap: 20px;
  align-items: center;
  padding: 17px 20px 14px;
}

.route-identity {
  min-width: 0;
}

.route-endpoints {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.route-endpoint {
  overflow: hidden;
  max-width: 46%;
  padding: 5px 9px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
}

.route-direction {
  color: var(--accent);
  font-size: 13px;
}

.route-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-top: 9px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 500;
}

.tag i {
  font-size: 9px;
  color: var(--text-3);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.metric-card {
  min-width: 0;
  padding: 9px 10px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
}

.metric-card .metric-label {
  display: block;
  overflow: hidden;
  color: var(--text-3);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.metric-card strong {
  display: inline-block;
  margin-top: 1px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 18px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.06em;
}

.metric-card small {
  margin-left: 3px;
  color: var(--text-3);
  font-size: 9px;
  font-weight: 500;
}

.metric-card--east {
  background: var(--east-soft);
  border-color: var(--east-border);
}

.metric-card--east .metric-label,
.metric-card--east small {
  color: var(--east);
  opacity: 0.78;
}

.metric-card--east strong {
  color: var(--east);
}

.metric-card--west {
  background: var(--west-soft);
  border-color: var(--west-border);
}

.metric-card--west .metric-label,
.metric-card--west small {
  color: var(--west);
  opacity: 0.78;
}

.metric-card--west strong {
  color: var(--west);
}

.route-profile-wrap {
  padding: 0 20px 15px;
}

.route-profile-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.profile-start,
.profile-end {
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.profile-caption {
  flex: 1;
  overflow: hidden;
  color: var(--text-3);
  font-size: 9.5px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-profile {
  display: flex;
  gap: 2px;
  width: 100%;
  height: 14px;
  padding: 3px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
}

.profile-segment {
  position: relative;
  min-width: 7px;
  height: 100%;
  border-radius: 2px;
  opacity: 0.85;
  transition: opacity var(--transition), transform var(--transition);
}

.profile-segment:hover {
  opacity: 1;
  transform: scaleY(1.25);
}

.profile-segment--east {
  background: var(--east);
}

.profile-segment--west {
  background: var(--west);
}

.profile-segment--unknown {
  background: var(--text-3);
}

.profile-segment.is-active {
  outline: 2px solid var(--text);
  outline-offset: 1px;
}

.region-focus-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.5fr;
  gap: 8px;
  padding: 0 20px 15px;
}

.region-card {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 10px 11px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.region-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.region-card--east {
  color: var(--east);
  background: var(--east-soft);
  border-color: var(--east-border);
}

.region-card--west {
  color: var(--west);
  background: var(--west-soft);
  border-color: var(--west-border);
}

.region-card-icon {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  font-size: 12px;
  border-radius: 8px;
  background: color-mix(in srgb, currentColor 10%, transparent);
}

.region-card-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.region-card-copy small {
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: 0.11em;
  opacity: 0.7;
  text-transform: uppercase;
}

.region-card-copy strong {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 700;
}

.region-card-copy em {
  overflow: hidden;
  margin-top: 2px;
  font-size: 9.5px;
  font-style: normal;
  opacity: 0.68;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.region-card-arrow {
  margin-left: auto;
  font-size: 9px;
  opacity: 0.5;
}

.route-table-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px 9px;
  background: var(--surface);
}

.route-table-heading h3 {
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
}

.input-shell.is-locked {
  opacity: 0.72;
  background: var(--surface-3);
}

.input-shell.is-locked input {
  cursor: not-allowed;
}

.route-table-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-3);
  font-size: 9px;
  line-height: 1.4;
  text-align: right;
}

.route-table-hint i {
  color: var(--accent);
  font-size: 8px;
}

.route-view-static {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  color: var(--text-2);
  font-size: 9.5px;
  font-weight: 650;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
}

.route-view-static > i {
  color: var(--blue);
  font-size: 8px;
}

.route-view-count {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 8px;
  background: var(--surface-3);
  border-radius: 99px;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: var(--surface-2);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.segmented-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 27px;
  padding: 0 10px;
  color: var(--text-3);
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 650;
  transition: all var(--transition);
}

.segmented-item span {
  display: inline-grid;
  place-items: center;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  background: var(--surface-3);
  border-radius: 99px;
}

.segmented-item:hover {
  color: var(--text);
}

.segmented-item.is-active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(15, 35, 60, 0.12);
}

[data-theme="dark"] .segmented-item.is-active {
  background: var(--surface-3);
}

.table-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.leg-bulk-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
}

.leg-bulk-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid var(--blue-border);
  border-radius: 6px;
  font-size: 9px;
}

.leg-bulk-copy {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 9px;
  min-width: 0;
}

.leg-bulk-copy strong {
  color: var(--text-2);
  font-size: 9.5px;
  font-weight: 700;
}

.leg-bulk-copy span {
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.leg-bulk-bar .btn {
  flex: 0 0 auto;
}

.legs-container {
  min-height: 210px;
  scroll-margin-top: 92px;
}

.legs-table-wrap,
.leg-card {
  scroll-margin-top: 92px;
}

.output-panel {
  scroll-margin-top: 82px;
}

.legs-table-wrap {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
}

#view-planner .page-heading-actions {
  display: none;
}

#view-planner .setup-panel .panel-heading-side,
#view-planner .route-table-hint {
  display: none;
}

.planner-jump {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: -4px 0 12px;
}

.planner-jump a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  color: var(--text-3);
  font-size: 9px;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
}

.planner-jump a:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.planner-jump a span {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 8px;
  background: var(--accent-soft);
  border-radius: 4px;
}

#setupPanel,
#routePanel,
#outputPanel {
  scroll-margin-top: 90px;
}

.legs-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.legs-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 35px;
  padding: 0 9px;
  color: var(--text-3);
  text-align: left;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.legs-table thead th:nth-child(1) {
  width: 40px;
  padding-left: 20px;
  text-align: center;
}

.legs-table thead th:nth-child(3),
.legs-table thead th:nth-child(4),
.legs-table thead th:nth-child(5),
.legs-table thead th:nth-child(6),
.legs-table thead th:nth-child(7) {
  text-align: center;
}

.legs-table thead th:nth-child(8) {
  width: 99px;
  padding-right: 20px;
  text-align: right;
}

.legs-table tbody tr {
  transition: background var(--transition);
}

.legs-table tbody tr:hover {
  background: var(--surface-2);
}

.legs-table tbody tr.is-focused {
  background: color-mix(in srgb, var(--blue-soft) 60%, var(--surface));
  box-shadow: inset 3px 0 0 var(--blue);
}

.legs-table td {
  padding: 7px 9px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-subtle);
}

.legs-table td:first-child {
  padding-left: 20px;
  text-align: center;
}

.legs-table td:last-child {
  padding-right: 20px;
}

.legs-table tbody tr:last-child td {
  border-bottom: 0;
}

.leg-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 23px;
  height: 23px;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
}

.legs-table tr.is-focused .leg-index {
  color: var(--blue);
  background: var(--surface);
  border-color: var(--blue-border);
}

.leg-points {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 235px;
}

.leg-points select {
  width: 100%;
  min-width: 0;
  height: 29px;
  padding: 0 23px 0 8px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 650;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 6px;
  outline: 0;
  cursor: pointer;
  transition: all var(--transition);
}

.leg-points select:hover {
  border-color: var(--border);
}

.leg-points select:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.11);
}

.leg-arrow {
  flex: 0 0 auto;
  color: var(--text-3);
  font-size: 9px;
}

.leg-coords {
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 8.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leg-mc {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}

.leg-mc strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.leg-mc-line {
  display: inline-flex;
  align-items: center;
  gap: 1px;
}

.leg-mc-input {
  width: 42px;
  height: 25px;
  padding: 0 2px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 650;
  text-align: center;
  letter-spacing: -0.03em;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  appearance: textfield;
  -moz-appearance: textfield;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}

.leg-mc-input::-webkit-inner-spin-button,
.leg-mc-input::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.leg-mc-input:hover {
  background: var(--surface-2);
  border-color: var(--border);
}

.leg-mc-input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.12);
}

.leg-mc-input.is-override {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.leg-mc-unit {
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 650;
}

.leg-mc-reset {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 18px;
  padding: 0;
  color: var(--accent);
  font-size: 7px;
  background: transparent;
  border: 0;
  border-radius: 4px;
}

.leg-mc-reset:hover {
  background: var(--accent-soft);
}

.leg-mc--mobile {
  flex-direction: row;
  align-items: center;
  gap: 5px;
}

.leg-mc--mobile .leg-mc-input {
  width: 44px;
  height: 23px;
}

.pwa-install-note {
  margin-top: 10px;
  color: var(--text-3);
  font-size: 10.5px;
  line-height: 1.55;
}

#pwaInstallSteps {
  display: grid;
  gap: 6px;
  line-height: 1.55;
}

#pwaInstallSteps strong {
  color: var(--text);
}

.leg-region-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 5px;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
  border-radius: 4px;
}

.leg-region-chip--east {
  color: var(--east);
  background: var(--east-soft);
  border-color: var(--east-border);
}

.leg-region-chip--west {
  color: var(--west);
  background: var(--west-soft);
  border-color: var(--west-border);
}

.leg-region-chip--unknown {
  color: var(--text-3);
  background: var(--surface-3);
  border-color: var(--border);
}

.leg-distance {
  display: block;
  margin-top: 1px;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.leg-num-wrap {
  display: flex;
  justify-content: center;
}

.leg-num {
  width: 68px;
  height: 29px;
  padding: 0 4px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 6px;
  outline: 0;
  transition: all var(--transition);
}

.leg-num:hover {
  border-color: var(--border);
}

.leg-num:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.11);
}

.leg-num--msa {
  color: var(--text-2);
}

.leg-num--alt {
  color: var(--blue);
}

.leg-num--ias {
  width: 57px;
}

.leg-num-unit {
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 8px;
}

.leg-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1px;
}

.leg-action {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  color: var(--text-3);
  border-radius: 5px;
  font-size: 9px;
  transition: all var(--transition);
}

.leg-action:hover {
  color: var(--text);
  background: var(--surface-3);
}

.leg-action--danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.leg-action--auto:hover {
  color: var(--blue);
  background: var(--blue-soft);
}

.legs-mobile {
  display: none;
  padding: 10px;
}

.leg-card {
  padding: 11px;
  margin-bottom: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.leg-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.leg-card-route {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex: 1;
}

.leg-card-route select {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 22px 0 7px;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.leg-card-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.leg-card-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.leg-card-field span {
  color: var(--text-3);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.leg-card-field input {
  width: 100%;
  height: 30px;
  padding: 0 5px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: 0;
}

.leg-card-field input:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.legs-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 220px;
  padding: 32px 20px;
  text-align: center;
}

.legs-empty-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: var(--text-3);
  font-size: 18px;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
}

.legs-empty strong {
  color: var(--text);
  font-size: 13px;
}

.legs-empty p {
  max-width: 380px;
  color: var(--text-3);
  font-size: 11.5px;
}

.route-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 20px;
  background: linear-gradient(100deg, var(--surface-2), color-mix(in srgb, var(--accent-soft) 32%, var(--surface-2)));
  border-top: 1px solid var(--border);
}

.action-bar-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.action-kicker {
  color: var(--accent);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.action-bar-copy strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.action-bar-copy span {
  color: var(--text-3);
  font-size: 10px;
  line-height: 1.45;
}

.action-bar-buttons {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

/* ------------------------------------------------------------------ */
/* 9. NAVLOG output / preview                                          */
/* ------------------------------------------------------------------ */
.output-panel {
  overflow: hidden;
}

.output-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.flight-sync-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin: 0 12px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
}

.flight-sync-copy {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.flight-sync-copy > i {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 7px;
}

.flight-sync-copy strong,
.flight-sync-copy span {
  display: block;
}

.flight-sync-copy strong {
  color: var(--text);
  font-size: 10.5px;
}

.flight-sync-copy span {
  margin-top: 1px;
  color: var(--text-3);
  font-size: 8.5px;
}

.flight-sync-fields {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.flight-sync-fields label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-3);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.flight-sync-fields input {
  min-height: 30px;
  padding: 4px 7px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.flight-sync-fields input:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent-soft);
}

.output-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 9px 20px 0;
  border-bottom: 1px solid var(--border);
}

.output-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px 11px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  transition: color var(--transition);
}

.output-tab i {
  font-size: 10px;
}

.output-tab:hover {
  color: var(--text);
}

.output-tab.is-active {
  color: var(--text);
}

.output-tab.is-active::after {
  content: "";
  position: absolute;
  right: 9px;
  bottom: -1px;
  left: 9px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

.output-tabs-spacer {
  flex: 1;
}

.output-summary {
  padding-bottom: 9px;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 9.5px;
  white-space: nowrap;
}

.output-pane {
  padding: 14px;
}

.preview-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  min-height: 300px;
  padding: 14px;
  overflow-x: hidden;
  background:
    linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
    var(--surface-2);
  background-size: 18px 18px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}

.preview-stage > * {
  min-width: 0;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
  min-height: 270px;
  padding: 24px;
  text-align: left;
}

.empty-state-art {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 24px;
  background:
    radial-gradient(circle at 32% 25%, rgba(255, 255, 255, 0.8), transparent 45%),
    var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.empty-state h3 {
  color: var(--text);
  font-size: 15px;
}

.empty-state p {
  max-width: 430px;
  margin: 5px 0 11px;
  color: var(--text-2);
  font-size: 11.5px;
  line-height: 1.6;
}

.empty-state p strong {
  color: var(--text);
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  min-height: 300px;
  padding: 30px;
  text-align: center;
}

.radar {
  position: relative;
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  overflow: hidden;
  color: #34d399;
  background: #071624;
  border: 1px solid rgba(52, 211, 153, 0.4);
  border-radius: 50%;
  box-shadow: 0 0 0 8px rgba(16, 185, 129, 0.05), 0 12px 30px -10px rgba(0, 0, 0, 0.5);
}

.radar::before,
.radar::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(52, 211, 153, 0.22);
  border-radius: 50%;
}

.radar::before {
  inset: 17px;
}

.radar::after {
  inset: 33px;
}

.radar-sweep {
  position: absolute;
  inset: 0;
  background: conic-gradient(from 0deg, rgba(52, 211, 153, 0.45) 0deg, transparent 64deg);
  animation: radar-sweep 2s linear infinite;
}

.radar i {
  position: relative;
  z-index: 1;
  font-size: 14px;
}

.loading-copy h4 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
}

.loading-copy p {
  margin: 3px 0 0;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.progress-track {
  width: 210px;
  height: 5px;
  overflow: hidden;
  background: var(--surface-3);
  border-radius: 99px;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #fb7185);
  border-radius: 99px;
  transition: width 280ms ease;
}

/* Preview sheet */
.preview-sheet {
  flex: 0 0 auto;
  width: 900px;
  max-width: 100%;
  padding: 20px;
  color: #111827;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 18px 42px -22px rgba(15, 23, 42, 0.35);
  font-family: var(--font-sans);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #0f172a;
}

.sheet-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sheet-logo {
  display: grid;
  place-items: center;
  min-width: 42px;
  height: 23px;
  color: #fff;
  background: #d51f3f;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.sheet-title {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.015em;
}

.sheet-page-meta {
  color: #64748b;
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.sheet-meta {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr;
  margin: 7px 0;
  border: 1px solid #94a3b8;
  border-radius: 3px;
  overflow: hidden;
}

.sheet-meta-cell {
  padding: 4px 6px;
  font-size: 8.5px;
  line-height: 1.45;
  border-right: 1px solid #cbd5e1;
}

.sheet-meta-cell:last-child {
  border-right: 0;
}

.sheet-meta-cell span {
  display: block;
  color: #64748b;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sheet-meta-cell strong {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
}

.sheet-meta-cell em {
  color: #b91c1c;
  font-family: var(--font-mono);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
}

.sheet-fuel {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin: 7px 0;
  overflow: hidden;
  border: 1px solid #94a3b8;
  border-radius: 3px;
}

.sheet-fuel-item {
  min-width: 0;
  padding: 4px 3px;
  text-align: center;
  border-right: 1px solid #cbd5e1;
}

.sheet-fuel-item:last-child {
  border-right: 0;
}

.sheet-fuel-item span {
  display: block;
  overflow: hidden;
  color: #64748b;
  font-size: 6.8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.sheet-fuel-item strong {
  display: block;
  margin-top: 1px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
}

.sheet-fuel-item--req {
  background: #f1f5f9;
}

.sheet-fuel-item--fob {
  background: #ecfdf5;
}

.sheet-fuel-item--fob strong {
  color: #047857;
}

.sheet-flags {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-bottom: 6px;
}

.sheet-flag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 6px;
  color: #1e3a8a;
  font-size: 7.8px;
  background: #eff6ff;
  border: 1px dashed #3b82f6;
  border-radius: 3px;
}

.sheet-flag b {
  font-weight: 700;
}

.sheet-flag span {
  padding: 0 4px;
  color: #fff;
  font-size: 6.5px;
  font-weight: 700;
  background: #2563eb;
  border-radius: 2px;
}

.nav-preview-table {
  width: 100%;
  margin-bottom: 6px;
  border-collapse: collapse;
  table-layout: fixed;
}

.nav-preview-table th,
.nav-preview-table td {
  padding: 2px 2px;
  text-align: center;
  border: 1px solid #475569;
  font-size: 7.9px;
  line-height: 1.3;
}

.nav-preview-table th {
  color: #334155;
  background: #f8fafc;
  font-size: 6.8px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.nav-preview-table td {
  font-family: var(--font-mono);
}

.nav-preview-table td.nav-wpt {
  font-family: var(--font-sans);
  font-weight: 800;
}

.nav-preview-table .nav-strong {
  font-weight: 700;
}

.nav-preview-table .nav-eta {
  color: #b91c1c;
  font-weight: 700;
}

.nav-preview-table .nav-manual {
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px dashed #3b82f6;
  font-weight: 600;
}

.nav-preview-table .nav-secondary {
  color: #64748b;
}

.nav-preview-table .nav-coord {
  font-size: 6.9px;
}

.sheet-comm {
  width: 100%;
  margin-bottom: 6px;
  border-collapse: collapse;
}

.sheet-comm td {
  padding: 2px 3px;
  text-align: center;
  border: 1px solid #475569;
  font-size: 7.2px;
}

.sheet-comm tr:first-child td {
  color: #334155;
  background: #f8fafc;
  font-size: 6.6px;
  font-weight: 800;
  text-transform: uppercase;
}

.sheet-frequency-note {
  padding: 3px 6px;
  margin-bottom: 5px;
  color: #92400e;
  font-size: 6.2px;
  line-height: 1.4;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 3px;
}

.sheet-frequency-note i {
  margin-right: 3px;
}

.sheet-notes {
  display: grid;
  grid-template-columns: 1.15fr 1.15fr 0.85fr;
  border: 1px solid #475569;
  background: #f8fafc;
}

.sheet-note {
  padding: 4px 5px;
  color: #475569;
  font-size: 6.8px;
  line-height: 1.45;
  border-right: 1px solid #cbd5e1;
}

.sheet-note:last-child {
  border-right: 0;
}

.sheet-note b {
  color: #1e293b;
  font-size: 7.1px;
}

.sheet-sign {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #1e3a8a;
  background: #eff6ff;
  border: 1px dashed #3b82f6;
  text-align: center;
}

.sheet-sign b {
  font-size: 7.3px;
}

.sheet-sign span {
  margin-top: 2px;
  font-size: 6.2px;
  color: #3b82f6;
}

/* Weather */
.weather-workspace {
  padding: 4px;
}

.weather-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 7px 14px;
}

.weather-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.weather-head-copy {
  display: flex;
  align-items: center;
  gap: 10px;
}

.weather-head h3 {
  color: var(--text);
  font-size: 14px;
}

.weather-head p {
  margin-top: 2px;
  color: var(--text-3);
  font-size: 10.5px;
}

.weather-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.weather-empty {
  grid-column: 1 / -1;
  padding: 20px;
  color: var(--text-3);
  font-size: 11.5px;
  text-align: center;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 9px;
}

.weather-cell {
  min-width: 0;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.weather-cell span {
  display: block;
  overflow: hidden;
  color: var(--text-3);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.weather-cell strong {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.35;
  font-weight: 600;
}

.weather-table-wrap {
  margin-top: 12px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 9px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5px;
  text-align: left;
}

.data-table th {
  padding: 7px 9px;
  color: var(--text-3);
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 7px 9px;
  color: var(--text-2);
  font-family: var(--font-mono);
  border-bottom: 1px solid var(--border-subtle);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: var(--surface-2);
}

.weather-legend {
  padding: 9px 10px;
  color: var(--text-3);
  font-size: 9.5px;
  line-height: 1.6;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}

.weather-notes {
  margin-top: 5px;
  padding: 6px 8px;
  color: var(--amber);
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  border-radius: 6px;
}

/* ------------------------------------------------------------------ */
/* 10. Alerts / notices                                                */
/* ------------------------------------------------------------------ */
.alert {
  padding: 9px 11px;
  margin: 10px 0;
  font-size: 11px;
  line-height: 1.55;
  border: 1px solid transparent;
  border-radius: 9px;
}

.alert--danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-border);
}

.alert--warning {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: var(--amber-border);
}

.alert-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
}

.alert-code {
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.alert-note {
  margin-top: 4px;
  color: var(--text-2);
  font-size: 10px;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  margin-bottom: 12px;
  font-size: 10.5px;
  line-height: 1.55;
  border: 1px solid transparent;
  border-radius: 8px;
}

.notice > i {
  margin-top: 2px;
  flex: 0 0 auto;
  font-size: 10px;
}

.notice--info {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: var(--blue-border);
}

.notice--warning {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: var(--amber-border);
}

/* ------------------------------------------------------------------ */
/* 11. Route library                                                   */
/* ------------------------------------------------------------------ */
.library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 14px;
  margin-bottom: 18px;
}

.search-shell {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(380px, 100%);
  min-height: 36px;
  padding: 0 11px;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.search-shell:focus-within {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.search-shell i {
  font-size: 11px;
}

.search-shell input {
  width: 100%;
  height: 34px;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 11.5px;
}

.library-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-3);
  font-size: 10.5px;
  white-space: nowrap;
}

.library-stats strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 600;
}

.library-stat-divider {
  width: 1px;
  height: 12px;
  background: var(--border);
}

.library-section {
  margin-bottom: 22px;
}

.section-label {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 9px;
}

.section-label span {
  color: var(--text);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.section-label em {
  color: var(--text-3);
  font-size: 10px;
  font-style: normal;
}

.route-library-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.route-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.route-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.route-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm);
}

.route-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.route-card-title {
  min-width: 0;
}

.route-card-title h3 {
  overflow: hidden;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-card-title p {
  overflow: hidden;
  margin-top: 3px;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.route-card-stats {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  margin: 9px 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.route-card-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.route-card-stat span {
  color: var(--text-3);
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.route-card-stat strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.route-card-stat--east strong {
  color: var(--east);
}

.route-card-stat--west strong {
  color: var(--west);
}

.route-card-spark {
  display: flex;
  gap: 2px;
  height: 5px;
  margin-bottom: 10px;
}

.route-card-spark span {
  height: 100%;
  min-width: 3px;
  border-radius: 2px;
}

.route-card-spark .east { background: var(--east); }
.route-card-spark .west { background: var(--west); }

.route-card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
}

.route-card-actions .btn {
  min-width: 0;
}

.route-card-actions .btn:first-child {
  flex: 1;
}

.library-empty {
  grid-column: 1 / -1;
  padding: 26px;
  color: var(--text-3);
  font-size: 11.5px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
}

.library-note {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 15px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.library-note > i {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  color: var(--emerald);
  background: var(--emerald-soft);
  border: 1px solid var(--emerald-border);
  border-radius: 7px;
  font-size: 11px;
}

.library-note strong {
  display: block;
  color: var(--text);
  font-size: 11px;
}

.library-note p {
  margin-top: 2px;
  color: var(--text-3);
  font-size: 10px;
  line-height: 1.55;
}

/* ------------------------------------------------------------------ */
/* 12. Frequency directory                                             */
/* ------------------------------------------------------------------ */
.frequency-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 15px;
  margin-bottom: 14px;
  background:
    linear-gradient(100deg, var(--amber-soft), color-mix(in srgb, var(--amber-soft) 48%, var(--surface)));
  border: 1px solid var(--amber-border);
  border-radius: 12px;
  box-shadow: var(--shadow-xs);
}

.frequency-disclaimer-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  color: var(--amber);
  font-size: 12px;
  background: color-mix(in srgb, var(--amber) 10%, var(--surface));
  border: 1px solid var(--amber-border);
  border-radius: 8px;
}

.frequency-disclaimer strong {
  display: block;
  color: var(--amber);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.frequency-disclaimer p {
  margin-top: 1px;
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
}

.frequency-disclaimer span {
  display: block;
  margin-top: 2px;
  color: var(--text-2);
  font-size: 9.5px;
  line-height: 1.5;
}

.frequency-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.frequency-list {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: var(--shadow-xs);
}

.freq-list-head,
.freq-row {
  display: grid;
  grid-template-columns: 108px minmax(220px, 1fr) 108px 292px;
  gap: 12px;
  align-items: center;
}

.freq-list-head {
  min-height: 31px;
  padding: 0 14px;
  color: var(--text-3);
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.freq-list-head span:last-child {
  text-align: right;
}

.freq-row {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition);
}

.freq-row:last-child {
  border-bottom: 0;
}

.freq-row:hover {
  background: var(--surface-2);
}

.freq-row-role {
  display: flex;
  align-items: center;
  min-width: 0;
}

.freq-row-main {
  min-width: 0;
}

.freq-row-main h3 {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.freq-row-main p {
  overflow: hidden;
  margin-top: 2px;
  color: var(--text-3);
  font-size: 9.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.freq-row-place {
  overflow: hidden;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.freq-row-values {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.freq-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 29px;
  padding: 3px 7px;
  color: var(--freq-accent, var(--blue));
  background: var(--freq-soft, var(--blue-soft));
  border: 1px solid var(--freq-border, var(--blue-border));
  border-radius: 7px;
  transition: filter var(--transition), transform var(--transition);
}

.freq-chip:hover {
  filter: brightness(0.98);
}

.freq-chip:active {
  transform: scale(0.985);
}

.freq-chip-label {
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.07em;
  opacity: 0.62;
  text-transform: uppercase;
}

.freq-chip strong {
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.freq-chip small {
  font-family: var(--font-mono);
  font-size: 7.5px;
  opacity: 0.55;
}

.freq-chip i {
  font-size: 8px;
  opacity: 0.5;
}

.freq-card {
  --freq-accent: var(--blue);
  --freq-soft: var(--blue-soft);
  --freq-border: var(--blue-border);
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.freq-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.freq-card--tower { --freq-accent: var(--accent); --freq-soft: var(--accent-soft); --freq-border: var(--accent-border); }
.freq-card--approach { --freq-accent: var(--blue); --freq-soft: var(--blue-soft); --freq-border: var(--blue-border); }
.freq-card--company { --freq-accent: var(--emerald); --freq-soft: var(--emerald-soft); --freq-border: var(--emerald-border); }
.freq-card--traffic,
.freq-card--route { --freq-accent: var(--sky); --freq-soft: var(--sky-soft); --freq-border: var(--sky-border); }
.freq-card--military { --freq-accent: var(--amber); --freq-soft: var(--amber-soft); --freq-border: var(--amber-border); }
.freq-card--nav { --freq-accent: var(--west); --freq-soft: var(--west-soft); --freq-border: var(--west-border); }
.freq-card--atis { --freq-accent: var(--amber); --freq-soft: var(--amber-soft); --freq-border: var(--amber-border); }
.freq-card--ground { --freq-accent: var(--text-2); --freq-soft: var(--surface-3); --freq-border: var(--border); }
.freq-card--aerodrome { --freq-accent: var(--east); --freq-soft: var(--east-soft); --freq-border: var(--east-border); }

.freq-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.freq-role {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  color: var(--freq-accent);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--freq-soft);
  border: 1px solid var(--freq-border);
  border-radius: 4px;
}

.freq-place {
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.freq-card h3 {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.freq-values {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 9px 0 7px;
}

.freq-copy {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 36px;
  padding: 4px 9px;
  color: var(--freq-accent);
  text-align: left;
  background: var(--freq-soft);
  border: 1px solid var(--freq-border);
  border-radius: 8px;
  transition: filter var(--transition), transform var(--transition);
}

.freq-copy:hover {
  filter: brightness(0.98);
}

.freq-copy:active {
  transform: scale(0.992);
}

.freq-copy-label {
  color: var(--freq-accent);
  font-size: 7.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  opacity: 0.68;
  text-transform: uppercase;
}

.freq-value {
  color: var(--freq-accent);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
}

.freq-unit {
  margin-left: auto;
  color: var(--freq-accent);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 500;
  opacity: 0.6;
}

.freq-copy > i {
  color: var(--freq-accent);
  font-size: 9px;
  opacity: 0.55;
}

.freq-note {
  margin-top: auto;
  color: var(--text-3);
  font-size: 9.5px;
  line-height: 1.5;
}

.frequency-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  padding: 12px 14px;
  color: var(--text-3);
  font-size: 9.5px;
  line-height: 1.55;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.frequency-legend i {
  margin-right: 4px;
  color: var(--blue);
}

.frequency-legend b {
  color: var(--text-2);
  font-weight: 650;
}

.freq-row-delete {
  display: inline-grid;
  place-items: center;
  width: 27px;
  height: 29px;
  padding: 0;
  color: var(--text-3);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
}

.freq-row-delete:hover {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-border);
}

.calc-freq-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 12px;
  padding: 7px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-subtle);
}

.calc-freq-copy {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.calc-freq-copy > i {
  color: var(--blue);
  font-size: 9px;
}

.calc-freq-copy .section-label {
  flex: 0 0 auto;
}

.calc-freq-copy > p {
  margin: 0;
  overflow: hidden;
  color: var(--text-3);
  font-size: 9px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calc-freq-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}

.navlog-freq-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
}

.navlog-freq-chips:empty {
  display: none;
}

.navlog-freq-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 5px 3px 7px;
  color: var(--text-2);
  font-size: 9.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.navlog-freq-chip strong {
  color: var(--text);
  font-weight: 700;
}

.navlog-freq-chip small {
  color: var(--text-3);
  font-size: 8px;
}

.navlog-freq-chip button {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  padding: 0;
  color: var(--text-3);
  background: transparent;
  border: 0;
  border-radius: 4px;
}

.navlog-freq-chip button:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.frequency-select-info {
  margin: 8px 0;
  color: var(--text-3);
  font-size: 9.5px;
}

.frequency-select-list {
  display: grid;
  gap: 6px;
  max-height: min(48vh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.freq-select-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 10px;
  cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.freq-select-item:hover {
  border-color: var(--border-strong);
}

.freq-select-item.is-selected {
  background: var(--blue-soft);
  border-color: var(--blue-border);
}

.freq-select-item.is-disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.freq-select-item input {
  margin-top: 2px;
  accent-color: var(--blue);
}

.freq-select-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.freq-select-copy strong {
  color: var(--text);
  font-size: 10.5px;
}

.freq-select-values {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.freq-select-values span {
  padding: 2px 5px;
  color: var(--text-2);
  font-size: 8.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
}

.freq-select-values b {
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 650;
}

/* ------------------------------------------------------------------ */
/* Maintenance mode                                                    */
/* ------------------------------------------------------------------ */
.maintenance-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 22px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 20% 15%, rgba(37, 99, 235, 0.16), transparent 42%),
    radial-gradient(circle at 85% 80%, rgba(213, 31, 63, 0.13), transparent 45%),
    var(--bg);
}

body.maintenance-active {
  overflow: hidden;
}

.maintenance-card {
  width: min(430px, 100%);
  padding: 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
}

.maintenance-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-bottom: 18px;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.maintenance-logo {
  display: grid;
  place-items: center;
  width: 34px;
  height: 22px;
  color: #fff;
  background: #d51f3f;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.maintenance-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid var(--blue-border);
  border-radius: 14px;
  font-size: 19px;
}

.maintenance-card h1 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  letter-spacing: -0.045em;
}

.maintenance-card > p {
  margin: 7px 0 18px;
  color: var(--text-3);
  font-size: 10.5px;
  line-height: 1.6;
}

.maintenance-form {
  display: grid;
  gap: 8px;
  text-align: left;
}

.maintenance-form > label {
  color: var(--text-3);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.maintenance-form .btn {
  justify-content: center;
  margin-top: 3px;
}

/* ------------------------------------------------------------------ */
/* 13. Guide                                                           */
/* ------------------------------------------------------------------ */
.guide-safety {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px 16px;
  margin-bottom: 14px;
  color: var(--amber);
  background: linear-gradient(100deg, var(--amber-soft), color-mix(in srgb, var(--amber-soft) 50%, var(--surface)));
  border: 1px solid var(--amber-border);
  border-radius: 13px;
}

.guide-safety-icon {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 12%, transparent);
  border-radius: 8px;
  font-size: 13px;
}

.guide-safety strong {
  display: block;
  font-size: 12px;
}

.guide-safety p {
  margin-top: 3px;
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.65;
}

.guide-safety b {
  color: var(--text);
}

.guide-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}

.guide-tools .search-shell {
  flex: 1 1 auto;
}

.guide-count {
  flex: 0 0 auto;
  color: var(--text-3);
  font-size: 9px;
}

.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.guide-card[hidden] {
  display: none;
}

.guide-purpose {
  padding: 8px 9px;
  margin-bottom: 9px;
  color: var(--text-2);
  font-size: 10px;
  line-height: 1.6;
  background: var(--surface-2);
  border-left: 2px solid var(--accent);
  border-radius: 0 6px 6px 0;
}

.guide-purpose b {
  color: var(--text);
}

.guide-body h4 {
  margin: 9px 0 5px;
  color: var(--text);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.guide-body ol {
  margin: 0 0 0 16px;
  padding: 0;
  color: var(--text-2);
  font-size: 10px;
  line-height: 1.6;
}

.guide-body ol li {
  margin-bottom: 4px;
}

.guide-caution {
  padding: 8px 9px;
  margin-top: 9px;
  color: var(--text-2);
  font-size: 9.5px;
  line-height: 1.55;
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  border-radius: 6px;
}

.guide-caution b {
  color: var(--amber);
}

.guide-card {
  align-self: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.guide-card summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.guide-card summary::-webkit-details-marker {
  display: none;
}

.guide-card summary:hover {
  background: var(--surface-2);
}

.guide-number {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 7px;
}

.guide-card summary > span:nth-child(2) {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.guide-card summary strong {
  color: var(--text);
  font-size: 11.5px;
  font-weight: 700;
}

.guide-card summary small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-3);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guide-card summary > i {
  color: var(--text-3);
  font-size: 9px;
  transition: transform var(--transition);
}

.guide-card[open] summary > i {
  transform: rotate(180deg);
}

.guide-body {
  padding: 0 14px 14px 50px;
  color: var(--text-2);
  font-size: 10.5px;
  line-height: 1.7;
  border-top: 1px solid var(--border-subtle);
}

.guide-body ul {
  padding-left: 14px;
  margin: 10px 0 0;
}

.guide-body li {
  margin-bottom: 4px;
}

.guide-body b {
  color: var(--text);
}

.guide-rule-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}

.guide-rule {
  display: flex;
  flex-direction: column;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.guide-rule--east {
  color: var(--east);
  background: var(--east-soft);
  border-color: var(--east-border);
}

.guide-rule--west {
  color: var(--west);
  background: var(--west-soft);
  border-color: var(--west-border);
}

.guide-rule small {
  font-size: 8.5px;
  opacity: 0.7;
}

.guide-rule strong {
  margin-top: 1px;
  font-size: 12px;
}

.guide-rule span {
  margin-top: 1px;
  font-size: 9.5px;
  opacity: 0.9;
}

.guide-footer-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  color: var(--text-3);
  font-size: 10px;
  line-height: 1.6;
}

/* ------------------------------------------------------------------ */
/* 13. Modals                                                          */
/* ------------------------------------------------------------------ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(4, 11, 22, 0.62);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  animation: fade-in 180ms ease both;
}

.modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: min(92vh, 900px);
  max-height: min(92dvh, 900px);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: modal-in 220ms cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

.modal-head {
  flex: 0 0 auto;
}

.modal--md { max-width: 520px; }
.modal--lg { max-width: 880px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 17px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface);
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.modal-title h3 {
  color: var(--text);
  font-size: 14px;
}

.modal-title p {
  margin-top: 2px;
  color: var(--text-3);
  font-size: 10px;
}

.modal-icon {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
}

.modal-icon--blue { color: var(--blue); background: var(--blue-soft); border-color: var(--blue-border); }
.modal-icon--emerald { color: var(--emerald); background: var(--emerald-soft); border-color: var(--emerald-border); }
.modal-icon--danger { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-border); }
.modal-icon--indigo { color: var(--indigo); background: var(--indigo-soft); border-color: var(--indigo-border); }

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px 17px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-body--compact {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#addRouteAuthPane,
#addRouteFormPane {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

#addRouteFormPane .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.modal-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  padding-top: 2px;
}

.modal-body .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 10px 0 2px;
  margin-top: 4px;
  background: var(--surface);
  border-top: 1px solid var(--border-subtle);
}

.modal-actions--sticky {
  padding: 12px 17px;
  margin: 0;
  background: var(--surface);
  border-top: 1px solid var(--border-subtle);
}

.target-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.target-box span {
  color: var(--text-3);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.target-box strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

.target-box em {
  color: var(--text-3);
  font-size: 9.5px;
  font-style: normal;
}

.continue-route-box {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(220px, 300px);
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  background:
    linear-gradient(100deg, color-mix(in srgb, var(--blue-soft) 80%, var(--surface)), var(--surface-2));
  border: 1px solid var(--blue-border);
  border-radius: 10px;
}

.continue-route-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--blue-border);
  border-radius: 8px;
}

.continue-route-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.continue-route-copy strong {
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}

.continue-route-copy span {
  color: var(--text-3);
  font-size: 9.5px;
  line-height: 1.45;
}

.continue-route-box .select-shell {
  background: var(--surface);
}

.continue-route-box .select-shell select {
  font-size: 10.5px;
  font-weight: 600;
}

.leg-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 3px;
}

.leg-editor-head > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.leg-editor-head strong {
  color: var(--text);
  font-size: 11.5px;
}

.leg-editor-head span {
  color: var(--text-3);
  font-size: 9.5px;
}

.route-leg-editor {
  max-height: 380px;
  padding-right: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.editor-leg-row {
  padding: 8px;
  margin-bottom: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
}

.editor-leg-main {
  display: flex;
  align-items: center;
  gap: 5px;
}

.editor-leg-number {
  width: 25px;
  flex: 0 0 auto;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 9px;
  text-align: center;
}

.editor-leg-main select {
  width: 100%;
  min-width: 0;
  height: 29px;
  padding: 0 22px 0 7px;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 650;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.editor-leg-fields {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 7px;
  padding: 7px 0 0 30px;
  margin-top: 6px;
  border-top: 1px solid var(--border-subtle);
}

.editor-mini-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.editor-mini-field span {
  color: var(--text-3);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.editor-mini-field input {
  width: 68px;
  height: 27px;
  padding: 0 4px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  outline: 0;
}

.editor-mini-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1);
}

.editor-mini-field--mc input {
  width: 58px;
}

.editor-mini-field--mc input.is-override {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.editor-leg-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.editor-region {
  padding: 2px 5px;
  margin-right: 2px;
  font-size: 7.5px;
  font-weight: 750;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
  border-radius: 3px;
}

.editor-region--east { color: var(--east); background: var(--east-soft); border-color: var(--east-border); }
.editor-region--west { color: var(--west); background: var(--west-soft); border-color: var(--west-border); }
.editor-region--unknown { color: var(--text-3); background: var(--surface-3); border-color: var(--border); }

/* ------------------------------------------------------------------ */
/* 14. Toasts / mobile bar                                             */
/* ------------------------------------------------------------------ */
.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: min(340px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--emerald);
  border-radius: 9px;
  box-shadow: var(--shadow-md);
  font-size: 11px;
  line-height: 1.5;
  pointer-events: auto;
  animation: toast-in 220ms ease both;
}

.toast i {
  margin-top: 2px;
  color: var(--emerald);
  font-size: 10px;
}

.toast.is-error {
  border-left-color: var(--danger);
}

.toast.is-error i {
  color: var(--danger);
}

.toast.is-warning {
  border-left-color: var(--amber);
}

.toast.is-warning i {
  color: var(--amber);
}

.mobile-actionbar {
  display: none;
}

/* ------------------------------------------------------------------ */
/* 14b. Performance calculations                                       */
/* ------------------------------------------------------------------ */
.performance-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.performance-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 190px;
  padding: 15px;
  color: var(--text);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.performance-card--active {
  cursor: pointer;
}

.performance-card--active:hover {
  border-color: var(--accent-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.performance-card--soon {
  color: var(--text-3);
  cursor: not-allowed;
  background: var(--surface-2);
  opacity: 0.72;
}

.performance-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.performance-card-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--accent);
  font-size: 15px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 9px;
}

.performance-card--soon .performance-card-icon {
  color: var(--text-3);
  background: var(--surface);
  border-color: var(--border);
}

.performance-card h2 {
  margin: 13px 0 0;
  color: var(--text);
  font-size: 13px;
}

.performance-card p {
  flex: 1;
  margin: 5px 0 12px;
  color: var(--text-3);
  font-size: 9.5px;
  line-height: 1.6;
}

.performance-card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
}

.performance-card--soon .performance-card-link {
  color: var(--text-3);
}

.performance-calculator {
  margin-top: 4px;
}

.performance-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.performance-toolbar h2 {
  margin-top: 2px;
  font-size: 18px;
}

.back-to-performance {
  flex: 0 0 auto;
}

.performance-pdf-btn {
  margin-left: auto;
}

.performance-layout {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.performance-form {
  padding: 14px;
}

.performance-form-section {
  padding: 0 0 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.performance-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}

.performance-section-head > span {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 8px;
  background: var(--accent-soft);
  border-radius: 5px;
}

.performance-section-head strong,
.performance-section-head small {
  display: block;
}

.performance-section-head strong {
  color: var(--text);
  font-size: 10px;
}

.performance-section-head small {
  margin-top: 1px;
  color: var(--text-3);
  font-size: 8px;
}

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

.performance-field-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.performance-form .field label {
  font-size: 8px;
}

.performance-form .input-shell input,
.performance-form .select-shell select {
  min-height: 33px;
  font-size: 10px;
}

.performance-readout {
  display: block;
  min-height: 19px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 19px;
}

.performance-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  margin-top: 9px;
}

.performance-checks label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 8.5px;
  font-weight: 650;
}

.performance-checks input {
  accent-color: var(--accent);
}

.performance-submit {
  width: 100%;
}

.performance-form-note {
  margin-top: 9px;
  color: var(--text-3);
  font-size: 7.8px;
  line-height: 1.55;
}

.performance-sheet {
  min-height: 480px;
  padding: 16px;
  color: #172033;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.performance-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 440px;
  color: var(--text-3);
  text-align: center;
}

.performance-empty i {
  font-size: 25px;
  color: var(--accent);
}

.performance-empty strong {
  color: var(--text);
  font-size: 12px;
}

.performance-empty span {
  font-size: 9px;
}

.perf-sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 2px solid #172033;
}

.perf-sheet-header small {
  display: block;
  color: #64748b;
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.08em;
}

.perf-sheet-header h3 {
  margin: 3px 0 0;
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.03em;
}

.perf-sheet-header > span {
  color: #64748b;
  font-family: var(--font-mono);
  font-size: 7.5px;
  text-align: right;
}

.perf-conditions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 12px;
  background: #d8e1ec;
  border: 1px solid #d8e1ec;
}

.perf-cond {
  padding: 7px 8px;
  background: #fff;
}

.perf-cond span {
  display: block;
  color: #64748b;
  font-family: var(--font-mono);
  font-size: 6.8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.perf-cond strong {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
}

.perf-section {
  margin-top: 12px;
}

.perf-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  color: #fff;
  background: #1e3a5f;
}

.perf-section-head strong {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
}

.perf-section-head span {
  font-family: var(--font-mono);
  font-size: 7.5px;
}

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

.perf-table th,
.perf-table td {
  padding: 5px 7px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
}

.perf-table th {
  color: #64748b;
  font-size: 7px;
  font-weight: 700;
  text-transform: uppercase;
  background: #f8fafc;
}

.perf-table td:last-child,
.perf-table th:last-child {
  text-align: right;
}

.perf-table tr.is-total td {
  color: #0f172a;
  font-weight: 800;
  background: #f1f5f9;
  border-top: 1px solid #94a3b8;
}

.perf-table tr.is-warning td {
  color: #b91c1c;
}

.perf-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  font-family: var(--font-mono);
  font-size: 7px;
  font-weight: 800;
  border-radius: 4px;
}

.perf-status--ok { color: #047857; background: #d1fae5; }
.perf-status--bad { color: #b91c1c; background: #fee2e2; }
.perf-status--warn { color: #92400e; background: #fef3c7; }

.perf-warnings {
  padding: 8px 9px;
  margin-top: 10px;
  color: #92400e;
  font-size: 8px;
  line-height: 1.55;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 5px;
}

.perf-warnings ul {
  margin: 4px 0 0 14px;
  padding: 0;
}

.perf-source {
  margin-top: 12px;
  padding-top: 8px;
  color: #64748b;
  font-family: var(--font-mono);
  font-size: 7px;
  line-height: 1.5;
  border-top: 1px solid #e2e8f0;
}

.briefing-chart {
  color: #172033;
  background: #fff;
  border: 1px solid #172033;
  font-family: Arial, Helvetica, sans-serif;
}

.briefing-header {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 9px;
  border-bottom: 1px solid #172033;
}

.briefing-afa {
  color: #b91c1c;
  font-size: 25px;
  font-weight: 900;
  letter-spacing: -0.08em;
  text-transform: lowercase;
}

.briefing-header strong {
  font-size: 12px;
  text-align: center;
  letter-spacing: 0.02em;
}

.briefing-header > span {
  color: #64748b;
  font-family: var(--font-mono);
  font-size: 6.5px;
}

.briefing-top {
  display: grid;
  grid-template-columns: 1.1fr 1fr 0.7fr;
  border-bottom: 1px solid #172033;
}

.briefing-top > span {
  padding: 6px 9px;
  font-size: 10px;
  font-weight: 700;
}

.briefing-top > span + span {
  border-left: 1px solid #172033;
}

.briefing-fill {
  display: inline-block;
  min-width: 52px;
  padding: 0 4px;
  color: #0f172a;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  border-bottom: 1px solid #475569;
}

.briefing-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.briefing-table td {
  padding: 5px 7px;
  vertical-align: top;
  font-size: 9.5px;
  line-height: 1.55;
  border-bottom: 1px solid #cbd5e1;
}

.briefing-table tr:last-child td {
  border-bottom: 0;
}

.briefing-num {
  width: 28px;
  color: #475569;
  font-family: var(--font-mono);
  font-size: 8px !important;
  font-weight: 700;
  text-align: right;
}

.briefing-table strong {
  color: #0f172a;
}

.briefing-table .briefing-fill {
  min-width: 40px;
}

.briefing-remarks {
  display: block;
  min-height: 28px;
  color: #334155;
  font-family: var(--font-mono);
  font-size: 8px;
}

.briefing-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 9px;
  color: #64748b;
  font-family: var(--font-mono);
  font-size: 6.5px;
  border-top: 1px solid #172033;
}

.briefing-source {
  margin-top: 9px;
  color: #64748b;
  font-size: 8px;
  line-height: 1.5;
}

@media (max-width: 1120px) {
  .performance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .performance-layout { grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .performance-grid { grid-template-columns: 1fr; }
  .performance-layout { grid-template-columns: 1fr; }
  .performance-sheet { min-height: 0; }
  .performance-empty { min-height: 240px; }
  .performance-toolbar { align-items: flex-start; flex-direction: column; }
  .performance-pdf-btn { margin-left: 0; width: 100%; }
}

@media (max-width: 680px) {
  .performance-field-grid,
  .performance-field-grid--three { grid-template-columns: 1fr; }
  .perf-conditions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .performance-sheet { padding: 10px; overflow-x: auto; }
  .perf-table { min-width: 300px; }
}

@media print {
  .sidebar,
  .topbar,
  .performance-form,
  .performance-toolbar,
  .performance-empty,
  .perf-source,
  .toast-stack,
  .mobile-actionbar {
    display: none !important;
  }
  .page-container { margin: 0; padding: 0; }
  .performance-sheet { border: 0; box-shadow: none; }
}

/* ------------------------------------------------------------------ */
/* 15. Animations                                                      */
/* ------------------------------------------------------------------ */
@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@keyframes radar-sweep {
  to { transform: rotate(360deg); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------------ */
/* 16. Responsive                                                      */
/* ------------------------------------------------------------------ */
@media (max-width: 1320px) {
  .config-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .route-overview {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .metric-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .region-focus-grid {
    grid-template-columns: 1fr 1fr;
  }

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

@media (max-width: 1120px) {
  .config-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .route-panel-heading {
    align-items: flex-start;
  }

  .route-control-bar,
  .route-command-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .route-select-group {
    max-width: none;
  }

  .route-control-actions,
  .route-command-actions {
    justify-content: flex-start;
  }

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

@media (max-width: 1024px) {
  /* iOS Safari zooms focused controls below 16px. Keep controls at 16px on
     touch-sized layouts without disabling user-controlled page zoom. */
  input:not([type="checkbox"]):not([type="radio"]),
  textarea,
  select {
    font-size: 16px !important;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 80;
    width: var(--sidebar-w);
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    padding-top: calc(22px + env(safe-area-inset-top));
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    overflow: hidden;
    transform: translateX(-104%);
    transition: transform 240ms cubic-bezier(0.2, 0.75, 0.25, 1);
  }

  .sidebar-nav {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }

  .sidebar-footer {
    flex-shrink: 0;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar .sidebar-close {
    display: inline-grid;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: block;
    background: rgba(3, 9, 18, 0.55);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 220ms ease, visibility 220ms ease;
  }

  body.sidebar-open .sidebar-overlay {
    opacity: 1;
    visibility: visible;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .topbar .mobile-menu {
    display: inline-grid;
  }

  .topbar {
    padding: 0 18px;
  }

  .page-container {
    padding: 22px 18px 46px;
  }

  .topbar-new span {
    display: none;
  }

  .topbar-new {
    width: 34px;
    padding: 0;
  }
}

@media (max-width: 860px) {
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .page-heading-actions {
    justify-content: flex-start;
  }

  .route-overview {
    padding: 14px;
  }

  .route-profile-wrap,
  .region-focus-grid,
  .table-toolbar,
  .calc-freq-bar,
  .route-action-bar {
    padding-right: 14px;
    padding-left: 14px;
  }

  .route-action-bar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .action-bar-buttons {
    width: 100%;
  }

  .action-bar-buttons .btn--primary {
    flex: 1;
  }

  .legs-table-wrap {
    display: none;
  }

  .legs-mobile {
    display: block;
  }

  .legs-container {
    min-height: 0;
  }

  .output-tabs {
    padding: 8px 14px 0;
    overflow-x: auto;
  }

  .output-summary {
    display: none;
  }

  .output-pane {
    padding: 10px;
  }

  .preview-stage {
    padding: 9px;
  }

  .preview-sheet {
    width: 100%;
    max-width: 900px;
  }

  .guide-grid {
    grid-template-columns: 1fr;
  }

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

  .freq-list-head,
  .freq-row {
    grid-template-columns: 92px minmax(150px, 1fr) 82px 232px;
    gap: 8px;
  }

  .weather-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .weather-head-actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .weather-head-actions .btn {
    flex: 1 1 auto;
  }
}

@media (max-width: 680px) {
  :root {
    --topbar-h: 62px;
  }

  .topbar {
    padding: 0 13px;
  }

  .breadcrumb {
    display: none;
  }

  .utc-chip {
    padding: 0 8px;
    min-height: 32px;
  }

  #utcDatePart {
    display: none;
  }

  .utc-time {
    font-size: 10.5px;
  }

  .connection-pill {
    display: none;
  }

  .page-container {
    padding: 17px 12px 96px;
  }

  .panel {
    margin-bottom: 12px;
    border-radius: 14px;
  }

  .panel-heading {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px;
  }

  .panel-heading-side {
    width: 100%;
    justify-content: flex-start;
  }

  .panel-heading-side.heading-actions {
    justify-content: flex-start;
  }

  .page-heading h1 {
    font-size: 28px;
  }

  .page-heading p {
    font-size: 12.5px;
  }

  .page-heading-actions {
    width: 100%;
  }

  .page-heading-actions .btn {
    flex: 1 1 calc(50% - 6px);
  }

  .config-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 14px;
  }

  .panel-footnotes {
    padding: 9px 14px;
    gap: 6px;
  }

  .footnote-timezone {
    width: 100%;
    margin-left: 0;
  }

  .route-table-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px 8px;
  }

  .route-table-hint {
    text-align: left;
  }

  .route-select-group {
    flex-basis: auto;
  }

  .route-control-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
  }

  .route-control-actions .btn {
    justify-content: flex-start;
  }

  .route-command-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
    width: 100%;
  }

  .command-group {
    width: 100%;
  }

  .command-group .btn {
    flex: 1;
  }

  .command-tool {
    width: 100%;
  }

  .route-manage-menu {
    position: fixed;
    top: auto;
    right: 12px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    left: 12px;
    z-index: 95;
    width: auto;
    max-height: min(64dvh, 600px);
    padding: 8px;
    border-radius: 14px;
    animation: sheet-in 220ms cubic-bezier(0.2, 0.8, 0.3, 1) both;
  }

  .route-manage-menu.is-up {
    bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .manage-backdrop:not(.hidden) {
    position: fixed;
    inset: 0;
    z-index: 94;
    display: block;
    background: rgba(4, 11, 22, 0.46);
    backdrop-filter: blur(3px);
  }

  .manage-item-copy small {
    white-space: normal;
  }

  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric-card:nth-child(4),
  .metric-card:nth-child(5) {
    grid-column: span 1;
  }

  .region-focus-grid {
    grid-template-columns: 1fr;
  }

  .table-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-toolbar-right {
    width: 100%;
  }

  .action-bar-buttons {
    display: grid;
    grid-template-columns: auto 1fr;
  }

  .output-tabs {
    gap: 0;
  }

  .output-tab {
    font-size: 10px;
    padding: 7px 8px 10px;
  }

  .empty-state {
    flex-direction: column;
    text-align: center;
  }

  .empty-state-art {
    width: 54px;
    height: 54px;
  }

  .preview-sheet {
    width: 100%;
    padding: 12px;
  }

  .sheet-meta {
    grid-template-columns: 1fr 1fr;
  }

  .sheet-meta-cell:nth-child(2) {
    border-right: 0;
  }

  .sheet-meta-cell:nth-child(3),
  .sheet-meta-cell:nth-child(4) {
    border-top: 1px solid #cbd5e1;
  }

  .sheet-head {
    flex-wrap: wrap;
    gap: 5px;
  }

  .sheet-title {
    font-size: 8px;
  }

  .sheet-page-meta {
    font-size: 5.8px;
  }

  .sheet-meta-cell {
    padding: 3px 4px;
    font-size: 6px;
  }

  .sheet-meta-cell span {
    font-size: 5.2px;
  }

  .sheet-meta-cell strong,
  .sheet-meta-cell em {
    font-size: 6.2px;
  }

  .sheet-fuel {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sheet-fuel-item {
    padding: 3px 2px;
  }

  .sheet-fuel-item span {
    font-size: 5.2px;
  }

  .sheet-fuel-item strong {
    font-size: 6.2px;
  }

  .sheet-flags {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .sheet-flag {
    padding: 2px 4px;
    font-size: 5.8px;
  }

  .nav-preview-table th,
  .nav-preview-table td {
    padding: 1px;
    font-size: 5.5px;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }

  .nav-preview-table th {
    font-size: 5.2px;
  }

  .nav-preview-table .nav-coord {
    font-size: 5px;
  }

  .sheet-comm {
    table-layout: fixed;
  }

  .sheet-comm td {
    padding: 1px;
    font-size: 5.4px;
  }

  .sheet-frequency-note {
    padding: 2px 4px;
    font-size: 5.2px;
  }

  .weather-summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .route-library-grid {
    grid-template-columns: 1fr;
  }

  .frequency-grid {
    grid-template-columns: 1fr;
  }

  .freq-list-head {
    display: none;
  }

  .freq-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "role place"
      "main main"
      "values values";
    gap: 5px 10px;
    padding: 11px 12px;
  }

  .freq-row-role {
    grid-area: role;
  }

  .freq-row-main {
    grid-area: main;
  }

  .freq-row-main h3,
  .freq-row-main p {
    white-space: normal;
  }

  .freq-row-place {
    grid-area: place;
    text-align: right;
  }

  .freq-row-values {
    grid-area: values;
    justify-content: flex-start;
    margin-top: 3px;
  }

  .frequency-disclaimer {
    gap: 9px;
    padding: 11px 12px;
    margin-bottom: 11px;
  }

  .frequency-disclaimer-icon {
    width: 29px;
    height: 29px;
    font-size: 11px;
  }

  .library-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
    padding: 9px;
  }

  .search-shell {
    width: 100%;
  }

  .library-stats {
    justify-content: space-between;
  }

  .section-label {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .library-note {
    align-items: flex-start;
  }

  .guide-body {
    padding-left: 14px;
  }

  .guide-safety {
    padding: 12px;
  }

  .guide-rule-grid {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    align-items: end;
    padding: 0 0 max(6px, env(safe-area-inset-bottom));
  }

  .modal {
    max-height: 94vh;
    max-height: calc(100dvh - 8px);
    border-radius: 16px 16px 0 0;
    border-bottom: 0;
    animation: sheet-in 240ms cubic-bezier(0.2, 0.8, 0.3, 1) both;
  }

  .modal--md,
  .modal--lg {
    max-width: none;
  }

  .modal-head {
    flex: 0 0 auto;
    padding: 13px 14px;
  }

  .modal-body {
    padding: 13px 14px;
  }

  .modal-body .modal-actions,
  .modal-actions--sticky {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    background: var(--surface);
  }

  #addRouteFormPane .route-leg-editor {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .modal-actions--sticky {
    padding: 10px 14px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .continue-route-box {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
  }

  .continue-route-box .select-shell {
    grid-column: 1 / -1;
  }

  .editor-leg-main {
    flex-wrap: wrap;
  }

  .editor-leg-main select {
    flex: 1 1 38%;
  }

  .editor-leg-fields {
    flex-wrap: wrap;
    padding-left: 0;
  }

  .editor-mini-field {
    flex: 1 1 30%;
  }

  .editor-mini-field input {
    width: 100%;
  }

  .editor-leg-actions {
    width: 100%;
    justify-content: flex-end;
    margin-left: 0;
  }

  .toast-stack {
    right: 12px;
    bottom: 78px;
    width: calc(100vw - 24px);
  }

  body:not([data-view="planner"]) .mobile-actionbar {
    display: none;
  }

  .mobile-actionbar {
    position: fixed;
    right: 12px;
    bottom: 12px;
    left: 12px;
    z-index: 60;
    display: grid;
    grid-template-columns: 1fr 1.45fr 1fr;
    gap: 5px;
    padding: 6px;
    background: color-mix(in srgb, var(--surface-raised) 92%, transparent);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 20px 45px -20px rgba(7, 18, 34, 0.6);
    backdrop-filter: blur(16px);
  }

  .mobile-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 43px;
    color: var(--text-2);
    border-radius: 9px;
    font-size: 9px;
    font-weight: 650;
  }

  .mobile-action:disabled {
    opacity: 0.48;
    pointer-events: none;
  }

  .mobile-action i {
    font-size: 14px;
  }

  .mobile-action--primary {
    color: #fff;
    background: linear-gradient(135deg, #e02949, var(--accent-strong));
  }

  [data-theme="dark"] .mobile-action--primary {
    color: #25030b;
    background: linear-gradient(135deg, #fb7185, #f43f5e);
  }
}

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

  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .metric-card:nth-child(5) {
    grid-column: 1 / -1;
  }

  .route-endpoints {
    flex-wrap: wrap;
  }

  .route-endpoint {
    max-width: 100%;
  }

  .region-card-copy em {
    white-space: normal;
  }

  .leg-card-fields {
    grid-template-columns: 1fr 1fr;
  }

  .leg-card-field:last-child {
    grid-column: 1 / -1;
  }

  .weather-summary-grid {
    grid-template-columns: 1fr;
  }

  .sheet-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
}

@keyframes sheet-in {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ------------------------------------------------------------------ */
/* 17. Print                                                           */
/* ------------------------------------------------------------------ */
@media print {
  .sidebar,
  .topbar,
  .page-heading,
  .setup-panel,
  .route-panel,
  .output-tabs,
  .mobile-actionbar,
  .toast-stack {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .app-shell {
    display: block;
  }

  .page-container {
    padding: 0;
  }

  .output-panel {
    border: 0;
    box-shadow: none;
  }

  .output-pane {
    padding: 0;
  }

  .preview-stage {
    display: block;
    padding: 0;
    overflow: visible;
    background: #fff;
    border: 0;
  }

  .preview-sheet {
    width: 100%;
    margin: 0 0 10mm;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    page-break-after: always;
  }
}

@media (max-width: 1024px) {
  .topbar {
    height: auto;
    min-height: calc(var(--topbar-h) + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    padding-left: calc(18px + env(safe-area-inset-left));
    padding-right: calc(18px + env(safe-area-inset-right));
  }

  .mobile-actionbar {
    bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 680px) {
  .flight-sync-bar {
    align-items: flex-start;
    flex-direction: column;
    margin: 0 8px 9px;
  }

  .flight-sync-fields {
    width: 100%;
  }

  .flight-sync-fields label {
    flex: 1 1 130px;
  }

  .flight-sync-fields input {
    flex: 1;
    min-width: 0;
  }

  .calc-freq-bar {
    align-items: flex-start;
    padding: 7px 12px;
  }

  .calc-freq-copy {
    flex: 1 1 100%;
  }

  .calc-freq-copy > p {
    white-space: normal;
  }

  .calc-freq-actions {
    width: 100%;
    margin-left: 0;
  }

  .calc-freq-actions .btn {
    flex: 1;
  }

  .calc-freq-bar .navlog-freq-chips {
    flex: 1 1 100%;
  }

  .leg-bulk-bar {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 7px 12px;
  }

  .leg-bulk-copy {
    flex: 1 1 calc(100% - 34px);
  }

  .leg-bulk-bar .btn {
    width: 100%;
  }

  .frequency-select-list {
    max-height: 40vh;
  }
}


