:root {
  --page: #07131d;
  --page-soft: #0a1823;
  --surface: #0e1d29;
  --surface-raised: #132633;
  --surface-soft: rgba(14, 29, 41, 0.82);
  --field: #0a1924;
  --text: #f3f7f6;
  --text-soft: #9eb0b8;
  --text-muted: #687d87;
  --line: #203541;
  --line-soft: rgba(126, 164, 176, 0.14);
  --accent: #55e1c1;
  --accent-strong: #28cba8;
  --accent-ink: #05261f;
  --sky: #55bce9;
  --warning: #f2bf63;
  --danger: #ff7184;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 13px;
}

html[data-theme="light"] {
  --page: #eef4f4;
  --page-soft: #e6eeee;
  --surface: #ffffff;
  --surface-raised: #f7fbfa;
  --surface-soft: rgba(255, 255, 255, 0.9);
  --field: #f3f8f7;
  --text: #10252d;
  --text-soft: #5f747c;
  --text-muted: #788c93;
  --line: #d3dfdf;
  --line-soft: rgba(35, 82, 92, 0.11);
  --accent: #087d6d;
  --accent-strong: #056c5e;
  --accent-ink: #ffffff;
  --sky: #137fa8;
  --warning: #9f6917;
  --danger: #d93d58;
  --shadow: 0 24px 65px rgba(36, 70, 78, 0.12);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--page);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 22% -10%, rgba(49, 186, 165, 0.1), transparent 30rem),
    var(--page);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.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;
}

.skip-link {
  position: fixed;
  z-index: 500;
  top: 8px;
  left: 8px;
  transform: translateY(-150%);
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}
.skip-link:focus { transform: none; }

.site-header {
  position: sticky;
  z-index: 100;
  top: 0;
  height: 72px;
  padding: 0 clamp(16px, 3vw, 40px);
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 1fr);
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(22px);
}

.brand {
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 11%, var(--surface));
  color: var(--accent);
}
.brand-mark svg { width: 23px; height: 23px; }
.brand strong { display: block; font-family: Manrope, sans-serif; font-size: 15px; letter-spacing: -0.02em; }
.brand small { display: block; margin-top: 2px; color: var(--text-muted); font-size: 9px; letter-spacing: 0.05em; text-transform: uppercase; }

.view-nav {
  height: 42px;
  padding: 4px;
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
}

.nav-item {
  height: 32px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.nav-item svg { width: 15px; height: 15px; }
.nav-item:hover { color: var(--text); }
.nav-item.is-active { background: var(--surface-raised); color: var(--accent); box-shadow: 0 4px 12px rgba(0,0,0,.12); }

.header-actions { justify-self: end; display: flex; align-items: center; gap: 10px; }
.privacy-chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 999px; color: var(--text-muted); font-size: 9px; font-weight: 700; white-space: nowrap; }
.privacy-chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 75%, transparent); }

.icon-button, .dialog-close, .map-action, .swap-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
}
.icon-button { width: 38px; height: 38px; border-radius: 11px; }
.icon-button svg, .dialog-close svg, .map-action svg, .swap-button svg { width: 17px; height: 17px; }
.sun-icon { display: none; }
html[data-theme="light"] .sun-icon { display: block; }
html[data-theme="light"] .moon-icon { display: none; }

.primary-button, .secondary-button, .danger-button {
  min-height: 42px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.primary-button { border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); }
.primary-button:hover { transform: translateY(-1px); background: var(--accent-strong); }
.primary-button svg { width: 16px; height: 16px; }
.secondary-button { border: 1px solid var(--line); background: var(--surface); color: var(--text-soft); }
.secondary-button:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); color: var(--text); }
.danger-button { border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--line)); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }

.app-view { display: none; }
.app-view.is-active { display: block; }

.map-view.is-active {
  height: calc(100vh - 72px);
  min-height: 610px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
}

.map-stage { position: relative; min-width: 0; overflow: hidden; background: #091721; }
html[data-theme="light"] .map-stage { background: #dfe9e8; }

.map-stage::after {
  content: "";
  position: absolute;
  pointer-events: none;
  inset: 0;
  background: radial-gradient(circle at 50% 48%, transparent 48%, rgba(2, 10, 16, .22) 100%);
}

.map-toolbar {
  position: absolute;
  z-index: 10;
  top: 18px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.filter-cluster { display: flex; gap: 8px; }

.select-control, .search-control {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--text-soft);
  box-shadow: 0 10px 28px rgba(0,0,0,.12);
  backdrop-filter: blur(14px);
}
.select-control { height: 38px; min-width: 125px; pointer-events: auto; }
.select-control svg, .search-control svg { width: 15px; height: 15px; margin-left: 11px; flex: 0 0 auto; }
.select-control select {
  width: 100%;
  height: 100%;
  padding: 0 30px 0 9px;
  border: 0;
  outline: none;
  appearance: none;
  background: transparent;
  color: inherit;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}
.map-control-stack { display: grid; gap: 6px; pointer-events: auto; }
.map-action { width: 38px; height: 38px; border-radius: 11px; pointer-events: auto; box-shadow: 0 10px 28px rgba(0,0,0,.12); }
.map-action:disabled { opacity: .42; cursor: default; }

.map-canvas { position: absolute; inset: 0; touch-action: pan-y; }
.map-canvas svg { cursor: grab; }
.map-canvas svg.is-dragging { cursor: grabbing; }
.map-canvas svg { width: 100%; height: 100%; display: block; }
.map-ocean { fill: #091721; }
.map-grid line { stroke: rgba(132, 174, 188, .055); stroke-width: .7; }
.map-countries path { fill: #122632; stroke: #27414d; stroke-width: .5; }
html[data-theme="light"] .map-ocean { fill: #dfe9e8; }
html[data-theme="light"] .map-grid line { stroke: rgba(44, 87, 96, .08); }
html[data-theme="light"] .map-countries path { fill: #cddcda; stroke: #aabfbd; }
.map-route-glow { fill: none; stroke: rgba(76, 223, 192, .14); stroke-width: 7; filter: blur(3px); }
.map-route { fill: none; stroke: url(#flightlog-route-gradient); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.map-route.is-selected { stroke-width: 3; }
.map-route-group:focus { outline: none; }
.map-route-group:focus .map-route { stroke-width: 3; }
.map-airport-ring { fill: rgba(85, 225, 193, .12); stroke: rgba(85, 225, 193, .32); stroke-width: 1; }
.map-airport-dot { fill: var(--accent); stroke: #07251f; stroke-width: 1.2; }
.map-airport-label { fill: #dceae7; stroke: none; font-family: "DM Mono", monospace; font-size: 10px; font-weight: 500; paint-order: stroke; }
html[data-theme="light"] .map-airport-label { fill: #17443f; }

.map-flight-detail {
  position: absolute;
  z-index: 14;
  top: 18px;
  right: 72px;
  width: min(310px, calc(100% - 190px));
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 17px;
  background: color-mix(in srgb, var(--surface) 91%, transparent);
  box-shadow: 0 20px 55px rgba(0,0,0,.24);
  backdrop-filter: blur(22px);
}
.map-flight-detail[hidden] { display: none; }
.detail-close { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--text-muted); cursor: pointer; }
.detail-close:hover { background: var(--surface-raised); color: var(--text); }
.detail-close svg { width: 14px; height: 14px; }
.detail-route { padding-right: 30px; font-family: "DM Mono", monospace; font-size: 23px; font-weight: 500; letter-spacing: -.04em; }
.detail-cities { margin: 6px 0 14px; color: var(--text-muted); font-size: 9px; line-height: 1.5; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-meta span { padding: 6px 8px; border: 1px solid var(--line-soft); border-radius: 999px; color: var(--text-soft); font-size: 8px; font-weight: 650; }
.detail-notes { margin: 12px 0 0; color: var(--text-soft); font-size: 10px; font-style: italic; line-height: 1.5; }
.detail-notes[hidden] { display: none; }
.detail-actions { margin-top: 15px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.compact-button { min-height: 36px; padding: 0 12px; font-size: 10px; }

.map-summary {
  position: absolute;
  z-index: 12;
  left: 22px;
  right: 22px;
  bottom: 20px;
  min-height: 76px;
  padding: 13px 18px;
  display: grid;
  grid-template-columns: minmax(170px, 1fr) repeat(3, minmax(85px, 120px));
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}
.summary-intro span, .summary-stat span { display: block; color: var(--text-muted); font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.summary-intro strong { display: block; margin-top: 5px; font-family: Manrope, sans-serif; font-size: 14px; }
.summary-stat { padding-left: 20px; border-left: 1px solid var(--line-soft); }
.summary-stat strong { display: block; margin-bottom: 3px; font-family: "DM Mono", monospace; font-size: 18px; font-weight: 500; }

.map-empty {
  position: absolute;
  z-index: 8;
  top: 50%;
  left: 50%;
  width: min(620px, calc(100% - 32px));
  transform: translate(-50%, -56%);
  text-align: center;
}
.map-empty[hidden] { display: none; }
.empty-orbit { position: relative; width: 82px; height: 58px; display: block; margin: 0 auto 22px; border: 1px solid rgba(85,225,193,.25); border-radius: 50%; transform: rotate(-18deg); }
.empty-orbit::before, .empty-orbit::after { content: ""; position: absolute; border: 1px solid rgba(85,225,193,.12); border-radius: 50%; }
.empty-orbit::before { inset: 9px -22px; }
.empty-orbit::after { inset: -12px 17px; }
.empty-orbit i { position: absolute; left: 35px; top: 23px; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 22px var(--accent); }
.empty-orbit b { position: absolute; right: -3px; top: 27px; width: 5px; height: 5px; border-radius: 50%; background: var(--sky); }
.eyebrow { margin: 0 0 9px; color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; }
.map-empty h1, .content-header h1 { margin: 0; font-family: Manrope, sans-serif; letter-spacing: -.045em; }
.map-empty h1 { font-size: clamp(30px, 3.5vw, 48px); line-height: 1.04; }
.map-empty > p:not(.eyebrow) { margin: 16px auto 23px; color: var(--text-soft); font-size: 13px; }
.empty-actions { display: flex; justify-content: center; gap: 10px; }

.flight-rail { min-width: 0; padding: 25px 18px 18px; display: flex; flex-direction: column; border-left: 1px solid var(--line-soft); background: var(--page-soft); }
.rail-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 5px; }
.rail-heading h2 { margin: 0; font-family: Manrope, sans-serif; font-size: 20px; letter-spacing: -.03em; }
.rail-subtitle { margin: 6px 0 0; color: var(--text-muted); font-size: 10px; }
.flight-count-badge { min-width: 28px; height: 28px; padding: 0 8px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; color: var(--text-muted); font-family: "DM Mono", monospace; font-size: 10px; }
.rail-search { height: 40px; margin: 18px 0 13px; display: flex; align-items: center; border: 1px solid var(--line); border-radius: 11px; background: var(--field); color: var(--text-muted); }
.rail-search svg { width: 15px; height: 15px; margin: 0 10px 0 12px; }
.rail-search input { min-width: 0; flex: 1; height: 100%; padding: 0 10px 0 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 11px; }
.rail-search input::placeholder, .search-control input::placeholder { color: var(--text-muted); }
.flight-list { min-height: 0; flex: 1; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.flight-list-empty { height: 100%; min-height: 210px; display: grid; place-items: center; padding: 30px; color: var(--text-muted); text-align: center; font-size: 11px; line-height: 1.7; }

.flight-card {
  width: 100%;
  margin-bottom: 9px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 15px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.flight-card:hover, .flight-card.is-selected { border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); background: var(--surface); transform: translateY(-1px); }
.flight-card-top, .flight-card-meta, .flight-route { display: flex; align-items: center; }
.flight-card-top { justify-content: space-between; margin-bottom: 12px; color: var(--text-muted); font-size: 9px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.flight-card-top span:last-child { color: var(--accent); }
.flight-route { gap: 8px; }
.flight-route strong { font-family: "DM Mono", monospace; font-size: 19px; font-weight: 500; letter-spacing: -.04em; }
.route-line { position: relative; height: 1px; flex: 1; background: var(--line); }
.route-line::after { content: ""; position: absolute; right: 0; top: -2px; width: 5px; height: 5px; border-top: 1px solid var(--accent); border-right: 1px solid var(--accent); transform: rotate(45deg); }
.flight-card-meta { justify-content: space-between; margin-top: 10px; color: var(--text-muted); font-size: 9px; }
.flight-card-meta span:first-child { max-width: 66%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-all-button { margin-top: 10px; padding: 13px; border: 0; border-top: 1px solid var(--line-soft); background: transparent; color: var(--text-soft); font-size: 10px; font-weight: 700; cursor: pointer; }
.rail-all-button span { margin-left: 4px; color: var(--accent); }

.content-view { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: clamp(38px, 6vw, 74px) 0 70px; }
.content-header { margin-bottom: 30px; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.content-header h1 { font-size: clamp(36px, 5vw, 58px); line-height: 1; }
.content-header > div > p:last-child { margin: 12px 0 0; color: var(--text-soft); font-size: 13px; }
.history-toolbar { margin-bottom: 16px; display: grid; grid-template-columns: minmax(240px, 1fr) 128px 138px auto auto auto; gap: 10px; }
.search-control { min-width: 0; height: 44px; box-shadow: none; }
.search-control input { min-width: 0; flex: 1; height: 100%; padding: 0 12px 0 9px; border: 0; outline: none; background: transparent; color: var(--text); font-size: 12px; }
.history-toolbar .select-control { height: 44px; box-shadow: none; }

.history-list { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.history-empty { padding: 72px 24px; color: var(--text-muted); text-align: center; }
.history-row { padding: 18px 20px; display: grid; grid-template-columns: 100px minmax(180px, 1.5fr) minmax(160px, 1fr) 120px 108px; align-items: center; gap: 18px; border-bottom: 1px solid var(--line-soft); }
.history-row:last-child { border-bottom: 0; }
.history-date { color: var(--text-muted); font-family: "DM Mono", monospace; font-size: 10px; }
.history-route strong { font-family: "DM Mono", monospace; font-size: 17px; font-weight: 500; }
.history-route span, .history-airline span { display: block; margin-top: 4px; color: var(--text-muted); font-size: 9px; }
.history-airline strong { font-size: 11px; }
.history-distance { color: var(--text-soft); font-family: "DM Mono", monospace; font-size: 11px; }
.row-actions { display: flex; justify-content: flex-end; gap: 5px; }
.row-actions button { width: 31px; height: 31px; display: grid; place-items: center; border: 1px solid var(--line-soft); border-radius: 9px; background: transparent; color: var(--text-muted); cursor: pointer; }
.row-actions button:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.row-actions button[data-delete]:hover { color: var(--danger); }
.row-actions svg { width: 14px; height: 14px; }

.insight-year-control { align-self: center; width: 140px; box-shadow: none; }
.insight-metrics { margin-bottom: 18px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric-card, .insight-card { border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.metric-card { min-height: 130px; padding: 20px; border-radius: var(--radius-lg); }
.metric-card span { display: block; color: var(--text-muted); font-size: 9px; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
.metric-card strong { display: block; margin: 18px 0 5px; font-family: "DM Mono", monospace; font-size: 26px; font-weight: 500; }
.metric-card small { color: var(--text-soft); font-size: 9px; }
.profile-card { position: relative; min-height: 210px; margin-bottom: 12px; padding: 28px 30px; display: grid; grid-template-columns: 142px minmax(0, 1fr) 235px; align-items: center; gap: 28px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line)); border-radius: var(--radius-lg); background: radial-gradient(circle at 13% 50%, rgba(85,225,193,.15), transparent 15rem), linear-gradient(110deg, color-mix(in srgb, var(--accent) 7%, var(--surface)), var(--surface)); box-shadow: var(--shadow); }
.profile-card::after { content: ""; position: absolute; width: 300px; height: 300px; right: -120px; top: -170px; border: 1px solid color-mix(in srgb, var(--sky) 28%, transparent); border-radius: 50%; box-shadow: 0 0 0 24px color-mix(in srgb, var(--sky) 4%, transparent), 0 0 0 48px color-mix(in srgb, var(--sky) 3%, transparent); pointer-events: none; }
.profile-orbit { position: relative; width: 126px; height: 126px; border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line)); border-radius: 50%; transform: rotate(-22deg); }
.profile-orbit::before, .profile-orbit::after { content: ""; position: absolute; border: 1px solid color-mix(in srgb, var(--sky) 25%, transparent); border-radius: 50%; }
.profile-orbit::before { inset: 19px -20px; }
.profile-orbit::after { inset: -21px 27px; }
.profile-orbit i { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 78%, transparent); }
.profile-orbit i:nth-child(1) { left: 21px; top: 31px; }
.profile-orbit i:nth-child(2) { right: 11px; top: 58px; width: 5px; height: 5px; background: var(--sky); }
.profile-orbit i:nth-child(3) { left: 58px; bottom: 7px; width: 4px; height: 4px; background: var(--warning); }
.profile-orbit b { position: absolute; left: 56px; top: 56px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 27px color-mix(in srgb, var(--accent) 85%, transparent); }
.profile-copy { position: relative; z-index: 1; }
.profile-copy h2 { margin: 0; font-family: Manrope, sans-serif; font-size: clamp(24px, 3vw, 36px); letter-spacing: -.045em; }
.profile-copy > p:not(.eyebrow) { max-width: 530px; margin: 9px 0 15px; color: var(--text-soft); font-size: 12px; line-height: 1.65; }
.profile-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.profile-tags span { padding: 6px 9px; border: 1px solid var(--line-soft); border-radius: 999px; color: var(--text-soft); font-size: 9px; font-weight: 700; }
.profile-highlight { position: relative; z-index: 1; padding: 16px; border: 1px solid var(--line-soft); border-radius: 14px; background: color-mix(in srgb, var(--surface-raised) 78%, transparent); }
.profile-highlight span { display: block; color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.profile-highlight strong { display: block; margin-top: 10px; font-family: "DM Mono", monospace; font-size: 17px; font-weight: 500; }
.profile-highlight small { display: block; margin-top: 6px; color: var(--text-muted); font-size: 9px; line-height: 1.45; }
.insight-feature-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .9fr); gap: 12px; margin-bottom: 12px; }
.insight-feature-grid .insight-card { min-height: 330px; }
.insight-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.insight-card { min-height: 330px; padding: 22px; border-radius: var(--radius-lg); }
.card-note { color: var(--text-muted); font-size: 9px; font-weight: 650; letter-spacing: .02em; }
.card-heading h2 { margin: 0; font-family: Manrope, sans-serif; font-size: 17px; letter-spacing: -.03em; }
.year-chart { height: 235px; margin-top: 24px; display: flex; align-items: end; gap: 9px; }
.chart-column { min-width: 20px; flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: end; align-items: center; gap: 8px; }
.chart-column i { width: min(38px, 70%); min-height: 3px; display: block; border-radius: 7px 7px 2px 2px; background: linear-gradient(to top, var(--accent-strong), var(--sky)); }
.chart-column strong { color: var(--text-soft); font-family: "DM Mono", monospace; font-size: 9px; font-weight: 500; }
.chart-column span { color: var(--text-muted); font-size: 9px; }
.month-chart { height: 235px; margin-top: 24px; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: end; gap: 6px; }
.month-column { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: end; gap: 7px; }
.month-column i { width: min(25px, 72%); min-height: 3px; display: block; border-radius: 6px 6px 2px 2px; background: linear-gradient(to top, var(--accent-strong), var(--sky)); }
.month-column strong { min-height: 10px; color: var(--text-soft); font-family: "DM Mono", monospace; font-size: 9px; font-weight: 500; }
.month-column span { color: var(--text-muted); font-size: 8px; }
.highlights-card { min-height: 0; margin-bottom: 12px; }
.highlight-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
.highlight-item { min-height: 118px; padding: 16px; border: 1px solid var(--line-soft); border-radius: 14px; background: color-mix(in srgb, var(--surface-raised) 72%, transparent); }
.highlight-item span { display: block; color: var(--text-muted); font-size: 8px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.highlight-item strong { display: block; margin-top: 12px; color: var(--text); font-family: "DM Mono", monospace; font-size: 16px; font-weight: 500; }
.highlight-item small { display: block; margin-top: 6px; color: var(--text-muted); font-size: 9px; line-height: 1.45; }
.ranking-list { margin-top: 19px; }
.rank-row { padding: 11px 0; display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--line-soft); }
.rank-row:last-child { border-bottom: 0; }
.rank-number { color: var(--text-muted); font-family: "DM Mono", monospace; font-size: 9px; }
.rank-copy strong { display: block; font-size: 11px; }
.rank-copy span { display: block; margin-top: 3px; color: var(--text-muted); font-size: 9px; }
.rank-value { color: var(--accent); font-family: "DM Mono", monospace; font-size: 10px; }
.cabin-chart { min-height: 235px; margin-top: 22px; display: grid; place-items: center; }
.donut { position: relative; width: 165px; height: 165px; border-radius: 50%; background: conic-gradient(var(--accent) 0 var(--p1), var(--sky) var(--p1) var(--p2), var(--warning) var(--p2) var(--p3), #c78cff var(--p3) 100%); }
.donut::after { content: ""; position: absolute; inset: 31px; border-radius: 50%; background: var(--surface); }
.donut-center { position: absolute; z-index: 1; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-center strong { font-family: "DM Mono", monospace; font-size: 24px; font-weight: 500; }
.donut-center span { color: var(--text-muted); font-size: 9px; }
.chart-empty { color: var(--text-muted); font-size: 11px; }

dialog { color: var(--text); }
dialog::backdrop { background: rgba(1, 9, 14, .72); backdrop-filter: blur(8px); }
.flight-dialog { width: min(720px, calc(100% - 24px)); max-height: min(880px, calc(100vh - 24px)); margin: auto; padding: 0; border: 1px solid var(--line); border-radius: 24px; overflow: auto; background: var(--surface); box-shadow: 0 36px 120px rgba(0,0,0,.55); }
.flight-dialog form { max-height: calc(100vh - 32px); overflow: auto; padding: clamp(18px, 3vw, 28px); }
.dialog-header { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.dialog-header h2, .confirm-dialog h2 { margin: 0; font-family: Manrope, sans-serif; font-size: 28px; letter-spacing: -.04em; }
.dialog-header > div > p:last-child, .confirm-dialog p { margin: 7px 0 0; color: var(--text-muted); font-size: 10px; }
.dialog-close { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 11px; }
.route-entry { margin: 20px 0 9px; display: grid; grid-template-columns: 1fr 38px 1fr; align-items: end; gap: 10px; }
.airport-field, .field { position: relative; min-width: 0; }
.airport-field > label, .field > span, .field > label { display: block; margin: 0 0 7px 2px; color: var(--text-soft); font-size: 9px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.airport-input-shell { padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--field); }
.airport-input-shell:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent); }
.airport-input-shell input { width: 100%; padding: 0; border: 0; outline: none; background: transparent; color: var(--text); font-family: "DM Mono", monospace; font-size: 24px; font-weight: 500; text-transform: uppercase; }
.airport-input-shell span { display: block; margin-top: 3px; overflow: hidden; color: var(--text-muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.swap-button { width: 38px; height: 38px; margin-bottom: 9px; border-radius: 11px; }
.route-preview { min-height: 34px; padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line-soft); border-radius: 10px; color: var(--text-muted); font-size: 9px; }
.route-preview strong { color: var(--accent); font-family: "DM Mono", monospace; font-weight: 500; }
.quick-date { width: min(240px, 100%); margin-top: 16px; }
.flight-details { margin-top: 16px; border: 1px solid var(--line-soft); border-radius: 14px; background: color-mix(in srgb, var(--surface-raised) 58%, transparent); }
.flight-details summary { min-height: 52px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--text-soft); cursor: pointer; list-style: none; }
.flight-details summary::-webkit-details-marker { display: none; }
.flight-details summary span { font-size: 10px; font-weight: 750; }
.flight-details summary small { color: var(--text-muted); font-size: 8px; text-align: right; }
.flight-details summary::after { content: "+"; margin-left: auto; color: var(--accent); font-family: "DM Mono", monospace; font-size: 17px; }
.flight-details[open] summary::after { content: "−"; }
.flight-details[open] summary { border-bottom: 1px solid var(--line-soft); }
.form-grid { margin: 0; padding: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 11px 15px; }
.field > span b { margin-left: 4px; color: var(--accent); font-size: 7px; }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 39px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: var(--field);
  color: var(--text);
  font-size: 11px;
}
.field textarea { min-height: 62px; padding-top: 10px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 9%, transparent); }
.field-wide { grid-column: 1 / -1; }
.combo-results { position: absolute; z-index: 50; top: calc(100% + 5px); left: 0; right: 0; max-height: 238px; display: none; overflow: auto; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-raised); box-shadow: 0 18px 45px rgba(0,0,0,.32); }
.combo-results.is-open { display: block; }
.combo-option { width: 100%; padding: 10px 12px; display: grid; grid-template-columns: 44px 1fr; align-items: center; gap: 9px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.combo-option:hover, .combo-option.is-active { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.combo-option:last-child { border-bottom: 0; }
.combo-option > strong { color: var(--accent); font-family: "DM Mono", monospace; font-size: 11px; }
.combo-option span strong { display: block; font-size: 10px; }
.combo-option span small { display: block; margin-top: 3px; color: var(--text-muted); font-size: 8px; }
.combo-empty { padding: 14px; color: var(--text-muted); font-size: 9px; }
.form-error { min-height: 16px; margin: 12px 0 0; color: var(--danger); font-size: 10px; }
.dialog-actions { position: sticky; bottom: -1px; margin: 8px -2px -2px; padding: 12px 2px 2px; display: flex; justify-content: flex-end; gap: 9px; background: linear-gradient(to bottom, transparent, var(--surface) 30%); }
.confirm-dialog { width: min(420px, calc(100% - 28px)); padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.confirm-dialog .dialog-actions { margin-top: 24px; }

.toast { position: fixed; z-index: 300; left: 50%; bottom: 24px; min-width: 190px; padding: 12px 17px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-raised); color: var(--text); box-shadow: var(--shadow); font-size: 10px; text-align: center; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .site-header { grid-template-columns: 1fr auto; }
  .view-nav { position: fixed; z-index: 150; left: 50%; bottom: 13px; transform: translateX(-50%); background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: 0 16px 40px rgba(0,0,0,.28); }
  .map-view.is-active { height: auto; min-height: calc(100vh - 72px); grid-template-columns: 1fr; grid-template-rows: minmax(520px, 68vh) auto; }
  .map-flight-detail { top: 66px; right: 18px; width: min(320px, calc(100% - 36px)); }
  .flight-rail { min-height: 420px; border-top: 1px solid var(--line-soft); border-left: 0; padding-bottom: 90px; }
  .map-summary { grid-template-columns: repeat(3, 1fr); }
  .summary-intro { display: none; }
  .summary-stat:first-of-type { padding-left: 0; border-left: 0; }
  .content-view { padding-bottom: 110px; }
  .insight-metrics { grid-template-columns: repeat(2, 1fr); }
  .insight-feature-grid { grid-template-columns: 1fr; }
  .insight-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .highlight-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-card { grid-template-columns: 96px 1fr; gap: 19px; padding: 22px; }
  .profile-orbit { width: 92px; height: 92px; }
  .profile-orbit b { left: 40px; top: 40px; }
  .profile-orbit i:nth-child(1) { left: 15px; top: 23px; }
  .profile-orbit i:nth-child(2) { right: 7px; top: 42px; }
  .profile-orbit i:nth-child(3) { left: 43px; bottom: 5px; }
  .profile-highlight { grid-column: 2; }
  .history-row { grid-template-columns: 86px 1.3fr 1fr 90px; }
  .history-distance { display: none; }
}

@media (max-width: 620px) {
  .site-header { height: 64px; padding: 0 13px; }
  .brand small { display: none; }
  .brand-mark { width: 34px; height: 34px; }
  .header-actions .add-flight-button span { display: none; }
  .header-actions .add-flight-button { width: 38px; min-height: 38px; padding: 0; }
  .privacy-chip { display: none; }
  .map-view.is-active { height: auto; grid-template-rows: minmax(460px, 72vh) auto; }
  .map-canvas { touch-action: pan-y; }
  .map-toolbar { top: 12px; left: 12px; right: 12px; }
  .filter-cluster { gap: 5px; }
  .filter-cluster .select-control { min-width: 110px; }
  .map-flight-detail { top: 62px; left: 12px; right: 58px; width: auto; padding: 15px; }
  .detail-route { font-size: 20px; }
  .map-summary { left: 10px; right: 10px; bottom: 10px; min-height: 64px; padding: 10px 8px; border-radius: 15px; }
  .summary-stat { padding-left: 10px; }
  .summary-stat strong { font-size: 14px; }
  .summary-stat span { font-size: 7px; }
  .map-empty { transform: translate(-50%, -58%); }
  .map-empty h1 { font-size: 34px; }
  .map-empty > p:not(.eyebrow) { max-width: 270px; line-height: 1.6; }
  .empty-actions { flex-direction: column; align-items: center; }
  .empty-actions button { width: min(260px, 100%); }
  .content-view { width: min(100% - 24px, 1180px); padding-top: 34px; }
  .content-header { align-items: start; }
  .content-header h1 { font-size: 38px; }
  .content-header > .primary-button span { display: none; }
  .history-toolbar { grid-template-columns: 1fr 1fr; }
  .history-toolbar .search-control { grid-column: 1 / -1; }
  .history-row { padding: 15px; grid-template-columns: 72px 1fr auto; gap: 10px; }
  .history-airline { display: none; }
  .insight-metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .profile-card { grid-template-columns: 1fr; gap: 15px; }
  .profile-orbit { display: none; }
  .profile-highlight { grid-column: auto; }
  .metric-card { min-height: 112px; padding: 15px; }
  .metric-card strong { margin-top: 14px; font-size: 21px; }
  .insight-feature-grid { grid-template-columns: 1fr; }
  .month-chart { gap: 3px; }
  .highlight-grid { grid-template-columns: 1fr; }
  .insight-grid { grid-template-columns: 1fr; }
  .route-entry { grid-template-columns: 1fr 34px 1fr; gap: 6px; }
  .airport-input-shell { padding: 10px; }
  .airport-input-shell input { font-size: 20px; }
  .swap-button { width: 34px; height: 34px; }
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .field-wide { grid-column: auto; }
  .flight-details summary small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
