 :root {
    --page-bg: #f3f6fb;
    --page-text: #111827;
    --text-muted: #4b5563;
    --text-soft: #6b7280;
    --surface: #ffffff;
    --surface-2: #fafafa;
    --surface-3: #f8f9fb;
    --surface-4: #f3f4f6;
    --surface-accent: #fff4e6;
    --surface-accent-border: #f0e1d1;
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    --border-soft: #eeeeee;
    --border-soft-2: #f5f5f5;
    --border-table: #e6e6e6;
    --shadow: rgba(0,0,0,0.06);
    --shadow-soft: rgba(0,0,0,0.08);
    --shadow-strong: rgba(0,0,0,0.2);
    --accent: #0b7cff;
    --accent-strong: #111827;
    --accent-soft: #2563eb;
    --on-accent: #ffffff;
    --overlay-bg: rgba(15, 23, 42, 0.6);
    --button-shadow: rgba(17,24,39,0.18);
    --button-bg: #111827;
    --button-text: #ffffff;
    --shadow-md: 0 8px 24px rgba(0,0,0,0.2);
    --error-soft: #f59e0b;
  --card-bg: #ffffff;
  --header-bg: #fff4e6;
  --header-border: #f0e1d1;
    --panel-bg: #1f2937;
    --panel-text: #e5e7eb;
    --panel-muted: #9ca3af;
    --input-bg: #ffffff;
    --input-text: #111827;
    --input-placeholder: #9ca3af;
    --error: #b91c1c;
    --error-strong: #dc2626;
    --success-bg: #e8f5e9;
    --success-text: #166534;
    --info-bg: #dbeafe;
    --info-text: #1d4ed8;
    --danger-bg: #fee2e2;
    --danger-text: #b91c1c;
    --purple-bg: #ede9fe;
    --purple-text: #6b21a8;
    --neutral-text: #888888;
    --table-head-bg: #f8fafc;
    --table-head-text: #64748b;
  }

  body.dark-mode {
    --page-bg: #0f172a;
    --page-text: #e5e7eb;
    --text-muted: #cbd5e1;
    --text-soft: #94a3b8;
    --surface: #1f2937;
    --surface-2: #111827;
    --surface-3: #0b1220;
    --surface-4: #111827;
    --surface-accent: #1e293b;
    --surface-accent-border: #334155;
    --border: #334155;
    --border-strong: #475569;
    --border-soft: #334155;
    --border-soft-2: #334155;
    --border-table: #334155;
    --shadow: rgba(0,0,0,0.45);
    --shadow-soft: rgba(0,0,0,0.35);
    --shadow-strong: rgba(0,0,0,0.5);
    --accent: #3b82f6;
    --accent-strong: #e5e7eb;
    --accent-soft: #60a5fa;
    --on-accent: #ffffff;
    --overlay-bg: rgba(2, 6, 23, 0.72);
    --button-shadow: rgba(0,0,0,0.35);
    --button-bg: #374151;
    --button-text: #ffffff;
    --shadow-md: 0 8px 24px rgba(0,0,0,0.35);
    --error-soft: #fb7185;
  --card-bg: #1f2937;
  --header-bg: #172033;
  --header-border: #334155;
    --panel-bg: #1f2937;
    --panel-text: #e5e7eb;
    --panel-muted: #94a3b8;
    --input-bg: #0f172a;
    --input-text: #e5e7eb;
    --input-placeholder: #94a3b8;
    --error: #f87171;
    --error-strong: #ef4444;
    --success-bg: #18311d;
    --success-text: #86efac;
    --info-bg: #172554;
    --info-text: #bfdbfe;
    --danger-bg: #3f1d1d;
    --danger-text: #fca5a5;
    --purple-bg: #2e1065;
    --purple-text: #e9d5ff;
    --neutral-text: #94a3b8;
    --table-head-bg: #111827;
    --table-head-text: #cbd5e1;
  }

  body {
    background: var(--page-bg);
    color: var(--page-text);
  }

  body, button, input, select, textarea {
    font-family: Arial, sans-serif;
  }

  input, select, textarea {
    background: var(--input-bg);
    color: var(--input-text);
  }

  ::selection {
    background: rgba(11,124,255,0.22);
  }

  .theme-toggle {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 9999;
    padding: 8px 12px;
    border: 0;
    border-radius: 10px;
    background: var(--button-bg);
    color: var(--button-text);
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-md);
  }

  .sf-upcoming-button {
    padding: 6px 10px;
    border-radius: 6px;
    border: 0;
    background: var(--accent);
    color: var(--surface);
    font-weight: 600;
    cursor: pointer;
  }
.refresh-success {
  background: #22c55e !important;
  color: white !important;
  transform: scale(1.05);
  transition: all 0.15s ease;
}
  .modal {
    position: relative;
    width: min(960px, 100%);
    max-height: calc(100vh - 40px);
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 10px 30px var(--shadow-strong);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .modal-header {
    position: relative;
    padding: 16px 52px 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 18px;
    background: var(--surface);
    flex: 0 0 auto;
  }

  .close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: var(--surface-4);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
  }

  .close-button:hover {
    background: #e8e8e8;
  }

  body.dark-mode .close-button:hover {
    background: #374151;
  }

  .modal-body {
    padding: 0 16px 16px;
    overflow-y: auto;
    flex: 1 1 auto;
  }

  .hidden {
    display: none !important;
  }

  .overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--overlay-bg);
    z-index: 9998;
    box-sizing: border-box;
  }

  .sf-muted {
    color: var(--panel-muted);
    font-style: italic;
    font-size: 14px;
  }

  body.dark-mode .sf-muted {
    color: var(--panel-muted) !important;
  }

  body.dark-mode strong,
  body.dark-mode b {
    color: #f9fafb !important;
  }

  body.dark-mode [style*="color:#111"],
  body.dark-mode [style*="color: #111"],
  body.dark-mode [style*="color:#000"],
  body.dark-mode [style*="color: #000"],
  body.dark-mode [style*="color:var(--page-text)"],
  body.dark-mode [style*="color: var(--page-text)"],
  body.dark-mode [style*="color:var(--text-soft)"],
  body.dark-mode [style*="color:var(--text-soft)"],
  body.dark-mode [style*="color:var(--text-soft)"],
  body.dark-mode [style*="color: var(--text-soft)"],
  body.dark-mode [style*="color:var(--text-muted)"],
  body.dark-mode [style*="color: var(--text-muted)"] {
    color: inherit !important;
  }
body.dark-mode .txt-main {
  color: #e5e7eb !important;
}

body.dark-mode .txt-muted {
  color: #94a3b8 !important;
}

body.dark-mode .txt-heading {
  color: #f9fafb !important;
}

body.dark-mode .txt-soft {
  color: #cbd5e1 !important;
}
body.dark-mode .city-label {
  color: var(--accent-soft);
}

body.dark-mode #result,
body.dark-mode #events-widget,
body.dark-mode #aps-left,
body.dark-mode #aps-right,
body.dark-mode #ba-511-card,
body.dark-mode #ba-sf-current-body,
body.dark-mode #ba-incident-groups-other,
body.dark-mode #ba-511-incident-body,
body.dark-mode #ba-511-construction-body {
  color: #e5e7eb !important;
}


  .page-shell {
    font-family: Arial, sans-serif;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0 16px;
    box-sizing: border-box;
  }

  .dashboard-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
  }

  .dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
    width: 100%;
  }

  .dashboard-grid--two {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    align-items: stretch;
  }

  .controls-panel {
    grid-column: 1 / span 2;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 12px;
    align-items: flex-end;
    padding: 16px;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    width: 100%;
    box-sizing: border-box;
  }

  .select-input {
    flex: 1 1 220px;
    min-width: 220px;
    padding: 12px 14px;
    font-size: 14px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--surface);
    box-sizing: border-box;
  }

  .select-input--destination {
    flex: 1 1 280px;
    min-width: 240px;
  }

  .button-primary {
    flex: 0 0 auto;
    height: 44px;
    padding: 0 18px;
    font-size: 14px;
    cursor: pointer;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--button-bg);
    color: var(--button-text);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(17,24,39,0.18);
    white-space: nowrap;
  }

  .column-left {
    grid-column: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  .column-middle {
    grid-column: 2;
    min-width: 0;
  }

  .column-right {
    grid-column: 3;
    min-width: 0;
    align-self: start;
  }

  .result-card {
    font-size: 16px;
    line-height: 1.6;
    padding: 14px 16px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 8px 22px rgba(0,0,0,0.05);
  }

  .result-card--hint {
    color: var(--text-muted);
  }

  .result-card--error {
    color: var(--error);
    border-color: var(--danger-bg);
  }

  .map-card {
    width: 100%;
    height: 400px;
    min-height: 400px;
    border: 1px solid #d9d9d9;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  }

  .panel-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 12px;
    box-sizing: border-box;
    width: 100%;
  }

  .panel-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }

  .panel-header {
    margin: 0 0 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
  }

  .panel-header--tight {
    margin: 0 0 2px 0;
  }

  .panel-title {
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 10px;
  }

  .panel-label,
  .fw-700 {
    font-weight: 700;
  }

  .status-line,
  .panel-muted {
    font-size: 12px;
    color: var(--text-soft);
    flex: 0 0 auto;
  }

  .status-line {
    margin: 0 0 6px 0;
  }

  .status-line--compact {
    margin: 8px 0 0 0;
  }

  .error-line,
  .weather-error {
    font-size: 12px;
    color: hotpink;
    flex: 0 0 auto;
  }

  .error-line {
    margin: 0;
  }

  .error-line--compact {
    margin: 0 0 8px 0;
  }

  .weather-error {
    margin: 6px 0 0 0;
  }

  .weather-error--compact {
    margin: 0 0 8px 0;
  }

  .sticky-panel {
    position: sticky;
    top: 8px;
    height: calc(100vh - 16px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 12px;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .weather-map {
    width: 100%;
    height: 520px;
    border-radius: 6px;
    overflow: hidden;
    background: #f8f9fb;
  }

  .fa-scroll {
    height: 520px;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
  }

  .table-shell {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 5px;
    table-layout: fixed;
  }

  .table-head-cell {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--table-head-bg);
    backdrop-filter: saturate(180%) blur(6px);
    padding: 6px 4px;
    border-bottom: 1px solid var(--border-table);
    font-size: 10px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--table-head-text);
  }

  .table-head-cell--left { text-align: left; }
  .table-head-cell--center { text-align: center; }
  .th-w24 { width: 24%; }
  .th-w16 { width: 16%; }
  .th-w12 { width: 12%; }
  .th-w10 { width: 10%; }

  .card-split {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    min-height: 0;
	overflow:hidden;
  }

  .card-split-header {
    padding: 10px 12px;
    background: #eef7ff;
	color:black;
    border-bottom: 1px solid #e6f0fb;
    flex: 0 0 auto;
  }

  .card-split-body {
    padding: 8px;
    overflow: auto;
    flex: 1 1 auto;
    min-height: 0;
  }

  .card-split-body--soft {
    color: var(--text-soft);
  }

  .events-block {
    background: var(--surface);
    border: 1px solid var(--border-soft);
	 border-radius: 8px;
    overflow: hidden;
  }

  .events-block-header {
    padding: 8px 12px 12px;
    background: var(--surface-accent);
      border-radius: 8px;
  margin-bottom: 4px;
  }

  .events-block-header--split {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .events-block-body {
    padding: 8px 12px 12px;
    background: var(--surface);
  }

  .events-block-body--soft {
    padding: 8px;
    color: var(--text-soft);
  }

  .group-title,
  .event-title,
  .card-title,
  .ground-card-title,
  .detail-card-title {
    font-weight: 700;
  }

  .city-label {
    font-size: 16px;
    font-weight: 700;
	color: var(--accent);
    margin-bottom: 4px;
    color: #0a3d75;
  }

  .incident-item {
	  border-radius: 8px;
    padding: 4px;
    border-bottom: 1px solid var(--border-soft-2);
  }

  .incident-text {
    font-size: 13px;
    line-height: 1.35;
    color: var(--page-text);
  }
.incident-top-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.incident-item {
  padding: 12px 12px 12px 14px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--border-soft-2);
  border-left-width: 10px;
  border-left-style: solid;
  border-left-color: transparent;
  border-radius: 8px;
  box-sizing: border-box;
}

.incident-item--severe {
  border-left-color: #991b1b;
  background: rgba(220, 38, 38, 0.06); /* ~6% red tint */
}

.incident-item--major {
  border-left-color: #f97316;
}

.incident-item--moderate {
  border-left-color: #facc15;
}

.incident-item--minor {
  border-left-color: #2563eb;
}

body.dark-mode .incident-item {
  background: var(--surface);
  border-color: var(--border-soft);
}

body.dark-mode .incident-item--severe {
  border-left-color: #f87171;
    background: rgba(239, 68, 68, 0.12); /* slightly stronger for dark bg */
}

body.dark-mode .incident-item--major {
  border-left-color: #fb923c;
}

body.dark-mode .incident-item--moderate {
  border-left-color: #fde047;
}

body.dark-mode .incident-item--minor {
  border-left-color: #60a5fa;
}


  .event-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 2px;
  }

  .event-card {
    border: 1px solid var(--border-soft);
    background: var(--card-bg);
    margin: 8px;
    overflow: hidden;
  }

  .event-card__title {
    font-size: 14px;
    font-weight: 700;
    padding: 10px 12px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
  }



  .empty-state {
    font-size: 14px;
    color: #666;
    padding: 8px;
  }

  .detail-card {
    margin-top: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 8px 22px var(--shadow);
  }

  .detail-card__body {
    font-size: 14px;
    line-height: 1.5;
    color: var(--page-text);
  }

  .detail-card__line {
    margin-top: 4px;
  }

  .ground-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 8px 22px var(--shadow);
  }

  .ground-card__title {
    font-size: 16px;
    margin-bottom: 10px;
  }

  .ground-card__line {
    font-size: 15px;
    margin-bottom: 6px;
  }

  .ground-card__updated {
    margin-top: 10px;
  }

  .inline-refresh-btn {
    margin-top: 10px;
    padding: 6px 12px;
    border-radius: 6px;
    border: 0;
    background: #0b7cff;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
  }

  .state-error {
    padding: 10px;
    color: var(--error);
  }

  .state-error--small {
    font-size: 14px;
  }

  .awos-row-muted {
    opacity: 0.65;
  }

  .is-loading {
    opacity: 0.8;
  }

  .sf-muted--italic {
    font-weight: 400;
    font-style: italic;
  }

  .awos-cell {
    padding: 2px 2px;
    vertical-align: middle;
    text-align: center;
	font-size: 12px;
    border-bottom: 1px solid #f5f5f5;
    border-right: 1px solid #f7f7f7;
    background: var(--card-bg);
  }

  .awos-cell--station {
    text-align: left;
    width: 24%;
    overflow: hidden;
    border-bottom: 1px solid #fafafa;
  }

  .awos-station {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
  }

  .awos-station-code {
    font-weight: 700;
    font-size: 14px;
    color: var(--page-text);
  }

  .awos-station-name {
    font-size: 11px;
    color: var(--text-soft);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .awos-chip {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
  }

  .awos-chip--disabled {
    background: #f0f0f0;
    color: #888;
  }

  .awos-chip--vfr {
    background: #e2f7e2;
    color: #155724;
  }

  .awos-chip--mvfr {
    background: #dcecff;
    color: #0b4b86;
  }

  .awos-chip--ifr {
    background: #ffe0e0;
    color: #8a0303;
  }

  .awos-chip--lifr {
    background: #f0d9ff;
    color: #4a0066;
  }

  .awos-chip--other {
    background: #f0f0f0;
    color: #444;
  }
  
  #ba-sf-upcoming-button {
  display: none !important;
}