/* Dashboard-only surfaces. Operational conditions keep their own category colors. */
#dashboardView {
  --desk-surface: #101e32;
  --desk-inset: #15253b;
  --desk-line: #2d425b;
  --desk-ink: #eff4f7;
  --desk-muted: #a3b7c6;
  --desk-meta: #b4cce4;
  --desk-label: #d1e4fa;
  --desk-ui-font: Manrope, -apple-system, "Segoe UI", sans-serif;
  --desk-accent: #9dc9ff;
  --desk-tint: #1d3553;
  --desk-shadow: 0 5px 18px #02080d26;
  --desk-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  gap: clamp(0.8rem, 1vw, 1.3rem);
  padding-block: 1rem 2rem;
}
html[data-theme="day"] #dashboardView {
  --desk-surface: #fff;
  --desk-inset: #edf3fa;
  --desk-line: #c3d1e0;
  --desk-ink: #152c47;
  --desk-muted: #405875;
  --desk-meta: #425e7b;
  --desk-label: #1d476e;
  --desk-accent: var(--pilotcb-blue);
  --desk-tint: #e8f0fd;
  --desk-shadow: 0 1px 2px #17364f12, 0 5px 18px #17364f0c;
}
body:has(> #dashboardView:not([hidden])) { background: #091321; }
html[data-theme="day"] body:has(> #dashboardView:not([hidden])) { background: #eaf0f5; }
body:has(> #dashboardView:not([hidden]))::before { background: none; }

#dashboardView .dashboard-card, #dashboardView .airport-bar {
  color: var(--desk-ink);
  background: var(--desk-surface);
  border: 1px solid var(--desk-line);
  border-radius: 14px;
  box-shadow: var(--desk-shadow);
}

/* The orbital photograph is decoration and carries no operational data. */
#dashboardView .nas-panel {
  padding: clamp(1rem, 1.6vw, 1.75rem);
  color: #f5f9fa;
  border-color: #344c5c;
  background:
    linear-gradient(90deg, #0c1b31 4%, #102448d9 28%, #10253555 60%, #081627eb),
    url("/assets/pro-earth-night.webp") center 35% / cover, #101e32;
}
#dashboardView .nas-panel .panel-heading { margin: 0 0 1rem; flex-wrap: wrap; }
#dashboardView .heading-lockup { display: grid; gap: 0.18rem; }
#dashboardView .nas-source {
  color: #c7d7d8;
  font: 600 0.75rem/1.35 var(--desk-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
#dashboardView .nas-source:hover { text-decoration: underline; }
#dashboardView #nas-title {
  margin: 0;
  color: #f7f9f9;
  font: 650 clamp(1.95rem, 2.6vw, 3.15rem)/1.08 Manrope, "Segoe UI", sans-serif;
  letter-spacing: -0.047em;
}
#dashboardView .nas-heading-actions { flex-wrap: wrap; gap: 0.35rem 1rem; }
#dashboardView .nas-heading-actions p { color: #d2e1e7; white-space: normal; }
#dashboardView .nas-heading-actions #nas-status-message { color: #f2f7fa; }
#dashboardView .nas-full-link {
  color: white;
  background: #0c1d2ad9;
  border: 1px solid #75909e;
  border-radius: 7px;
  font-size: 0.75rem;
}
#dashboardView .nas-full-link:hover { background: #244253; }
#dashboardView .nas-item {
  align-items: start;
  gap: 0.6rem;
  padding: 0.85rem;
  border-radius: 9px;
  background: #11243aef;
  box-shadow: none;
}
#dashboardView .nas-item.neutral { border-color: #455c6a; }
#dashboardView .nas-item.normal { border-color: #35584f; }
#dashboardView .nas-item.warning { border-color: #85704a; }
#dashboardView .nas-item.danger { border-color: #91606c; }
#dashboardView .nas-item h3 {
  font: 650 0.75rem/1.35 Manrope, "Segoe UI", sans-serif;
  text-transform: none;
  letter-spacing: 0.015em;
}
#dashboardView .nas-item.neutral :is(.nas-symbol, h3) { color: #b4d5e2; }
#dashboardView .nas-item.normal :is(.nas-symbol, h3) { color: #95dfb6; }
#dashboardView .nas-item.warning :is(.nas-symbol, h3) { color: #ffcf83; }
#dashboardView .nas-item.danger :is(.nas-symbol, h3) { color: #ffa3ac; }
#dashboardView .nas-item strong { color: #f2f6f8; font-size: 0.95rem; line-height: 1.32; }
#dashboardView .nas-item.normal strong { color: #cedeeb; font-weight: 600; }
#dashboardView .nas-item p { color: #b6c7d1; font-size: 0.75rem; line-height: 1.42; }
#dashboardView .nas-symbol {
  width: 1.35rem;
  height: 1.35rem;
  border: 0;
}
#dashboardView :is(.nas-symbol, .weather-icon) svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#dashboardView .airport-bar { padding: clamp(0.9rem, 1.2vw, 1.4rem); }
#dashboardView .airport-details { border-color: var(--desk-line); }
#dashboardView .airport-title-row { flex-wrap: wrap; }
#dashboardView #station-name {
  color: var(--desk-ink);
  font-size: clamp(1.25rem, 1.5vw, 1.8rem);
  letter-spacing: -0.035em;
  line-height: 1.18;
  white-space: normal;
}
#dashboardView #airport-full-name { color: var(--desk-ink); font-size: 0.85rem; white-space: normal; }
#dashboardView #station-meta, #dashboardView .airport-context em { color: var(--desk-muted); font-size: 0.75rem; }
#dashboardView :is(.airport-facts span, .airport-context span, .compact-label) {
  color: var(--desk-muted);
  font: 650 0.75rem/1.3 var(--desk-ui-font);
  letter-spacing: 0.045em;
}
#dashboardView .compact-label { color: var(--desk-accent); }
#dashboardView .airport-facts div { border-color: var(--desk-line); }
#dashboardView :is(.airport-facts strong, .airport-context strong) {
  color: var(--desk-ink);
  font: 600 0.9rem/1.45 var(--desk-mono);
  font-variant-numeric: tabular-nums;
}
#dashboardView .airport-context { gap: 1rem; }
#dashboardView .flight-category-badge.neutral {
  color: var(--desk-muted);
  border-color: var(--desk-line);
  background: var(--desk-inset);
}
html[data-theme="day"] #dashboardView .flight-category-badge.vfr {
  background: #e4f4eb; color: #175c3c; border-color: #97c7ab;
}
html[data-theme="day"] #dashboardView .flight-category-badge.mvfr {
  background: #fff1cc; color: #754800; border-color: #dcbb71;
}
html[data-theme="day"] #dashboardView .flight-category-badge.ifr {
  background: #ffe6e9; color: #932433; border-color: #dfabb2;
}
html[data-theme="day"] #dashboardView .flight-category-badge.lifr {
  background: #f0e7fa; color: #613783; border-color: #c5abd8;
}
html[data-theme="day"] #dashboardView .flight-category-badge.unknown {
  background: var(--desk-inset); color: var(--desk-muted); border-color: var(--desk-line);
}
#dashboardView .combobox-input-wrap {
  height: 44px;
  border: 1px solid var(--desk-line);
  border-radius: 8px;
  background: var(--desk-inset);
  box-shadow: none;
}
#dashboardView .combobox-input-wrap:focus-within { outline: 2px solid var(--desk-accent); outline-offset: 2px; }
#dashboardView #airport-combo-input { color: var(--desk-ink); background: transparent; font-size: 1rem; }
#dashboardView #airport-combo-input::placeholder, #dashboardView :is(.combo-clear, .combo-chevron) { color: var(--desk-muted); }

#dashboardView :is(.weather-grid, .operations-grid) { box-shadow: none; }
#dashboardView .card-heading {
  min-height: 3.65rem;
  background: var(--desk-surface);
  border-color: var(--desk-line);
  box-shadow: none;
}
#dashboardView .card-heading h2 {
  color: var(--desk-ink);
  font: 700 clamp(1rem, 1.2vw, 1.3rem)/1.2 Manrope, "Segoe UI", sans-serif;
  letter-spacing: -0.035em;
}
#dashboardView .weather-icon {
  width: 2rem;
  height: 2rem;
  flex: none;
  border-radius: 8px;
  color: var(--desk-accent);
  background: var(--desk-tint);
}
#dashboardView :is(.report-time, .briefing-status, .operational-alert-timing, .decoded-summary,
  .wind-detail, .briefing-disclaimer, .analyzer-disclaimer, .empty-state, .nas-heading-actions p,
  .airport-context em, #station-meta, #notam-result-count) {
  font: 500 clamp(0.8125rem, 0.78rem + 0.12vw, 0.9375rem)/1.45 var(--desk-ui-font);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.005em;
}
#dashboardView .notam-summary .briefing-status,
#dashboardView :is(.report-time, .operational-alert-timing, .wind-detail, .analyzer-disclaimer, .briefing-disclaimer) {
  color: var(--desk-meta);
}
#dashboardView .report-time { min-width: 0; text-align: right; text-wrap: pretty; }
#dashboardView .weather-card .card-heading h2 { flex-shrink: 0; }
#dashboardView .report-text {
  background: var(--desk-inset);
  border-bottom: 1px solid var(--desk-line);
  color: var(--desk-ink);
  font-size: 0.875rem;
  font-weight: 500;
}
#dashboardView .decoded-report { padding-top: 0.7rem; background: var(--desk-surface); }
#dashboardView .decoded-summary, #dashboardView .decoded-grid dt { color: var(--desk-meta); }
#dashboardView .decoded-grid dt { font: 500 0.8125rem/1.4 var(--desk-ui-font); }
#dashboardView .decoded-grid dd { color: var(--desk-ink); font-size: 0.875rem; }
#dashboardView .decoded-grid { row-gap: 0.4rem; }
#dashboardView .empty-state { color: var(--desk-meta); }
#dashboardView .operations-grid .results-heading {
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  background: var(--desk-inset);
  border-color: var(--desk-line);
}
#dashboardView .results-heading h3, #dashboardView .notam-summary .briefing-section-title {
  color: var(--desk-label);
  font: 700 0.875rem/1.4 var(--desk-ui-font);
  text-transform: none;
  letter-spacing: 0;
}
#dashboardView #notam-result-count { color: var(--desk-meta); }

/* Day uses its own sky exposure and an opaque surface behind every status. */
html[data-theme="day"] #dashboardView .nas-panel {
  border-color: #a9c2dc;
  background:
    linear-gradient(100deg, #e9f5ffd9, #eaf5ff33 47%, #eaf5ffdb 90%),
    url("/assets/dashboard-day-sky.webp") center 49% / cover, #c8e4fa;
}
html[data-theme="day"] #dashboardView .nas-panel :is(#nas-title, #nas-status-message) { color: #102c4a; }
html[data-theme="day"] #dashboardView .nas-panel :is(.nas-source, .nas-heading-actions p) { color: #1d405f; }
html[data-theme="day"] #dashboardView .nas-full-link {
  background: #eef6ff;
  border-color: #8daecb;
  color: #15446f;
}
html[data-theme="day"] #dashboardView .nas-full-link:hover { background: #fff; }
html[data-theme="day"] #dashboardView .nas-item {
  --nas-accent: #385d83;
  --nas-fill: #f2f6fa;
  background: var(--nas-fill);
  border-color: color-mix(in srgb, var(--nas-accent) 36%, white);
  box-shadow: inset 0 1px #ffffffd9, 0 2px 5px #1237580e;
}
html[data-theme="day"] #dashboardView .nas-item.normal { --nas-accent: #24634f; --nas-fill: #edf6f2; }
html[data-theme="day"] #dashboardView .nas-item.warning { --nas-accent: #80500d; --nas-fill: #fff5e3; }
html[data-theme="day"] #dashboardView .nas-item.danger { --nas-accent: #982e45; --nas-fill: #ffedf0; }
html[data-theme="day"] #dashboardView .nas-item :is(.nas-symbol, h3) { color: var(--nas-accent); }
html[data-theme="day"] #dashboardView .nas-item strong { color: var(--desk-ink); }
html[data-theme="day"] #dashboardView .nas-item p { color: #425571; }
html[data-theme="day"] #dashboardView .airport-bar {
  background: linear-gradient(110deg, #e4effb, #f1f6fc 55%, #e8f0f8);
}
html[data-theme="day"] #dashboardView .combobox-input-wrap { background: #fff; border-color: #99afc6; }
html[data-theme="day"] #dashboardView .card-heading {
  background: linear-gradient(105deg, #e5eef9, #f5f8fc);
}
html[data-theme="day"] #dashboardView .weather-icon { background: #d4e4fa; }
html[data-theme="day"] #dashboardView .report-text { background: #f1f5fa; }
html[data-theme="day"] #dashboardView .operations-grid .results-heading {
  background: #e9eff6;
}
html[data-theme="day"] #dashboardView .itws-operational-alert {
  background: #e2f3f5;
  border-color: #9dc6ce;
  border-left-color: #1a7886;
}
html[data-theme="day"] #dashboardView .itws-operational-alert strong { color: #195766; font-size: 0.75rem; }
html[data-theme="day"] #dashboardView .itws-operational-alert span { color: #173946; font-size: 0.875rem; }
html[data-theme="day"] #dashboardView .analyzer-component-row :is(.hw-positive, .rec-active, .rec-best) { color: #175a3c; }
html[data-theme="day"] #dashboardView .analyzer-component-row :is(.hw-negative, .cw-high, .rec-closed) { color: #962c43; }
html[data-theme="day"] #dashboardView .analyzer-component-row :is(.cw-moderate, .rec-ots) { color: #744707; }
html[data-theme="day"] #dashboardView .analyzer-component-row .badge { color: inherit; }

/* Scale the map and compass together when a phone is narrower than the instrument. */
@supports (zoom: calc(100px / 200px)) {
  #dashboardView .analyzer-compass { container-type: inline-size; }
  #dashboardView :is(.airport-map-stage, .airport-diagram-stage) {
    zoom: min(1, calc(100cqi / var(--wind-visual-size)));
  }
}

@media (prefers-reduced-motion: no-preference) {
  #dashboardView :is(.combobox-input-wrap, .nas-full-link, .combo-option) {
    transition: background-color 130ms ease-out, border-color 130ms ease-out;
  }
}
@media (prefers-reduced-motion: reduce) {
  #dashboardView :is(button, .button, .combobox-input-wrap) { transition: none; transform: none; }
}

@media (max-width: 820px) {
  #dashboardView .nas-heading-actions { flex-direction: row; justify-content: flex-start; align-items: center; }
  #dashboardView .airport-details { padding: 0.8rem 0 0; border: 0; border-top: 1px solid var(--desk-line); background: none; box-shadow: none; }
  #dashboardView .airport-context { margin-left: 0; justify-self: stretch; }
}
@media (max-width: 620px) {
  html[data-theme="day"] #dashboardView .nas-panel {
    background-image: linear-gradient(165deg, #ebf6ffed 0%, #eff7ffa8 37%, #f1f7ff42 80%), url("/assets/dashboard-day-sky.webp");
  }
  #dashboardView .nas-panel { padding: 0.85rem; }
  #dashboardView .nas-item { position: relative; grid-template-columns: minmax(0, 1fr); padding: 0.75rem; }
  #dashboardView .nas-symbol { position: absolute; top: 0.75rem; left: 0.75rem; width: 1rem; height: 1rem; }
  #dashboardView .nas-symbol svg { width: 1rem; height: 1rem; }
  #dashboardView .nas-item h3 { min-height: 1rem; padding-left: 1.35rem; }
  #dashboardView .nas-item strong { font-size: 0.875rem; }
  #dashboardView .nas-heading-actions p:first-child { flex-basis: 100%; }
  #dashboardView .airport-facts div { min-width: 0; }
}

/* Day instrument palette for the map, airport diagram, and standalone compass. */
html[data-theme="day"] #analyzer-compass {
  --wind-ink: #16364f;
  --wind-tick: #354f63;
  --wind-course: #00685e;
  --wind-vector: #df007d;
  --dim: var(--wind-tick);
  --text: var(--wind-ink);
  --panel: #f8fbfd;
  --border: var(--wind-ink);
  --border-soft: var(--wind-tick);
}
html[data-theme="day"] #analyzer-compass :is(.airport-map-stage, .airport-diagram-stage) {
  background: transparent;
  border-color: transparent;
}
/* White dial inside the circular scale, with transparent corners. */
html[data-theme="day"] #analyzer-compass :is(.airport-map-stage, .airport-diagram-stage):not(.diagram-missing)::before {
  content: "";
  position: absolute;
  inset: 5.5%;
  border-radius: 50%;
  background-color: #fff;
  pointer-events: none;
}
html[data-theme="day"] #analyzer-compass :is(.wind-map-base, .airport-diagram-image) {
  background-color: #e9eff3;
  box-shadow: 0 0 0 1px #9dafbd;
}
html[data-theme="day"] #analyzer-compass .wind-map-base { filter: saturate(.76); }
html[data-theme="day"] #analyzer-compass .airport-diagram-overlay { filter: none; }
html[data-theme="day"] #analyzer-compass .airport-diagram-overlay circle[fill="none"] { stroke: var(--wind-ink); }
html[data-theme="day"] #analyzer-compass .airport-diagram-overlay line:not([class]) { stroke: var(--wind-tick); }
html[data-theme="day"] #analyzer-compass .airport-diagram-overlay text { fill: var(--wind-ink); }
html[data-theme="day"] #analyzer-compass :is(.airport-diagram-overlay text[fill="#ff5f71"], polygon[fill="#ff5f71"], .wind-center-arrow) { fill: var(--wind-vector); }
html[data-theme="day"] #analyzer-compass :is(.wind-source-line, line[stroke="#ff5f71"]) { stroke: var(--wind-vector); }
html[data-theme="day"] #analyzer-compass .wind-heading-bug path { stroke: var(--wind-course); }
html[data-theme="day"] #analyzer-compass :is(.runway-pair-highlight, .wind-map-runway-highlight) {
  stroke: var(--wind-course);
  filter: drop-shadow(0 0 1px white);
}
html[data-theme="day"] #analyzer-compass [fill="#ff5f71"] { fill: var(--wind-vector); }

/* Compass label positions are shared by the map and airport diagram. */
#analyzer-compass {
  --wind-rim: #91adbf;
  --wind-label-halo: #11243a;
}
html[data-theme="day"] #analyzer-compass {
  --wind-rim: #415d71;
  --wind-label-halo: white;
}
html[data-theme="night"] #analyzer-compass :is(.airport-map-stage, .airport-diagram-stage) {
  background: transparent;
  border-color: transparent;
}
html[data-theme="night"] #analyzer-compass .airport-diagram-overlay {
  filter: none;
}
html[data-theme="night"] #analyzer-compass .airport-diagram-overlay circle:nth-child(2) {
  stroke: #bacfdd;
}
html[data-theme="night"] #analyzer-compass .airport-diagram-overlay text[fill^="rgba"] {
  fill: #cbdde7;
}
html[data-theme] #analyzer-compass :is(.airport-map-stage, .airport-diagram-stage):not(.diagram-missing) {
  overflow: visible;
  transform: scale(.95);
}
html[data-theme] #analyzer-compass .airport-diagram-overlay {
  overflow: visible;
  circle:first-child {
    r: 179px;
    stroke: var(--wind-rim);
    stroke-width: .9px;
  }
  text {
    transform-box: view-box;
    transform-origin: center;
  }
  text[fill^="rgba"] {
    transform: scale(1.016);
    font-family: "Bahnschrift", "DIN Alternate", sans-serif;
    font-size: 9px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
  }
  text[font-size="17"] {
    transform: scale(1.082);
    font-size: 13px;
    font-weight: 750;
  }
  text[font-size="13"] {
    transform: translateY(-8px) scale(.64);
    font-size: 19px;
    font-weight: 750;
    stroke: var(--wind-label-halo);
    stroke-width: 5px;
    stroke-linejoin: round;
    paint-order: stroke fill;
  }
}

#dashboardView .nas-grid a.nas-item {
  color: inherit;
  text-decoration: none;
}
#dashboardView .nas-grid a.nas-item:is(:hover, :focus-visible) h3 {
  text-decoration: underline;
  text-underline-offset: .16em;
}
#dashboardView .nas-grid a.nas-item:focus-visible {
  outline: 2px solid var(--nas-focus, #9ddfff);
  outline-offset: 2px;
}
html[data-theme="day"] #dashboardView .nas-grid { --nas-focus: #105b9c; }

#dashboardView .weather-card:has(#atis-text) {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#dashboardView #atis-text.atis-live-text {
  flex: 1 1 auto;
  min-height: 0;
  border-bottom: 0;
  background: transparent;
}
#atis-text .atis-report-section { display: block; }
#atis-text .atis-report-section h3 {
  margin: 0 0 .4rem;
  color: var(--desk-accent);
  font: 700 1.125rem/1.25 "Barlow Condensed", "Arial Narrow", sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: .025em;
}
#atis-text .atis-report-section p { margin: 0; }
#atis-text .atis-report-section + .atis-report-section {
  margin-top: .7rem;
  padding-top: .7rem;
  border-top: 1px dashed var(--muted);
}
