/* Chesapeake command-center presentation. Existing data and category semantics stay in their owning components. */
:root {
  color-scheme: dark;
  --bg-primary: #050b17;
  --bg-sidebar: #070e1d;
  --bg-card: #0b172b;
  --bg-card-hover: #102139;
  --border-card: #203654;
  --text-primary: #e8f1ff;
  --text-secondary: #9bacbf;
  --accent-cyan: #35d9ed;
  --accent-blue: #4997ff;
  --accent-purple: #a58aff;
  --accent-green: #40d9a2;
  --accent-yellow: #f1c95b;
  --accent-magenta: #eb7ad9;
  --accent-orange: #f4a462;
  --status-good: #40d9a2;
  --status-warning: #f1c95b;
  --status-error: #ff738e;
  --radius-card: 7px;
  --space-grid: 12px;
  --sidebar-width: 190px;
  --header-height: 62px;
  --shadow-card: 0 3px 18px #00000020, inset 0 1px 0 #a6caff05;
  /* Compatibility aliases keep existing inline colors and components working. */
  --bg: var(--bg-primary);
  --card: var(--bg-card);
  --line: var(--border-card);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --blue: var(--accent-blue);
  --green: var(--accent-green);
  --yellow: var(--accent-yellow);
  --orange: var(--accent-orange);
  --red: var(--status-error);
  --purple: var(--accent-purple);
}
html { background: var(--bg-primary); scroll-behavior: smooth; }
body {
  background: radial-gradient(ellipse at 65% 0, #12213b65, transparent 55%), var(--bg-primary);
  color: var(--text-primary);
  font: 13px/1.45 "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, select, input, textarea {
  border: 1px solid var(--border-card);
  border-radius: 5px;
  background: #0b182c;
  color: var(--text-primary);
  padding: 7px 10px;
  min-width: 0;
}
button { transition: background .15s, border-color .15s; }
button:hover { background: var(--bg-card-hover); border-color: #3d648b; }
button:disabled { opacity: .6; cursor: wait; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent-cyan); outline-offset: 3px;
}
input[type="checkbox"] { accent-color: var(--accent-cyan); }
a { color: var(--accent-cyan); }
a:hover { color: #a4f5ff; }
p, small { color: var(--text-secondary); }
svg.ui-icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.skip:focus { z-index: 2500; background: var(--bg-card); color: var(--accent-cyan); }
.shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
#nav {
  position: sticky; top: 0; height: 100vh; width: auto; padding: 0 10px 12px;
  transform: none; overflow-y: auto; background: linear-gradient(180deg, #0a1425, var(--bg-sidebar) 38%);
  border-right: 1px solid var(--border-card); display: flex; flex-direction: column;
  scrollbar-width: thin; scrollbar-color: var(--border-card) transparent; z-index: 1100;
}
.sidebar-brand { display: flex; align-items: center; gap: 9px; min-height: var(--header-height); border-bottom: 1px solid var(--border-card); margin-bottom: 14px; padding: 0 6px; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #3984b7; border-radius: 7px; color: var(--accent-cyan); background: #12233e; box-shadow: 0 0 16px #31c5ee12; flex: none; }
.sidebar-brand b { font-size: 12px; letter-spacing: .08em; display: block; }
.sidebar-brand small { display: block; font-size: 9px; letter-spacing: .12em; margin-top: 2px; }
#nav button[data-page] { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 8px 9px; margin: 2px 0; font-size: 12px; color: #a4b6cc; border: 1px solid transparent; border-radius: 5px; flex: none; }
#nav button[data-page] .ui-icon { color: #728ba8; }
#nav button[data-page]:hover { color: var(--text-primary); background: #13253e; }
#nav button[data-page].active { color: #d9eeff; background: linear-gradient(90deg, #163f65, #15233b); border-color: #2b527c; box-shadow: inset 3px 0 0 var(--accent-cyan), 0 0 16px #35c8ee08; }
#nav button[data-page].active .ui-icon { color: var(--accent-cyan); }
#nav em { margin: 15px 10px 5px; color: #6f849f; font-size: 9px; letter-spacing: .13em; font-style: normal; }
#nav footer { position: static; width: auto; margin-top: auto; padding: 10px; border: 1px solid var(--border-card); background: #0b1728; font-size: 10px; flex: none; }
#nav footer b { font-size: 10px; font-weight: 500; }
#nav footer small { font-size: 9px; line-height: 1.5; margin-top: 4px; }
#nav footer i { background: var(--status-good); box-shadow: 0 0 8px #40d9a255; }
#main { width: 100%; max-width: none; min-width: 0; padding: 0; outline: none; }
.command-header {
  position: sticky; top: 0; z-index: 1000; min-height: var(--header-height); height: auto;
  padding: 10px 20px; display: flex; align-items: center; gap: 12px;
  background: #071020f5; backdrop-filter: blur(12px); border-bottom: 1px solid var(--border-card);
}
.brand { min-width: 0; margin-right: auto; }
.brand b { font-size: 17px; font-weight: 600; letter-spacing: -.025em; }
.brand small { display: block; font-size: 10px; color: #7f96b0; margin-top: 2px; }
.header-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.command-header #clock { color: #a8bad2; font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.command-header #refresh { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; white-space: nowrap; }
.command-header #refresh .ui-icon { width: 14px; height: 14px; }
.command-header label { display: flex; align-items: center; gap: 5px; font-size: 10px; white-space: nowrap; }
.command-header label small { font-size: 9px; }
.command-header select { font-size: 11px; padding: 7px 9px; }
#menu { display: none; }
.workspace { padding: 17px 20px 24px; }
.title { gap: 12px; align-items: center; margin-bottom: 13px; }
.title h1 { font-size: 18px; font-weight: 600; letter-spacing: -.025em; }
.title p { margin: 2px 0 0; font-size: 11px; }
.title > small { font-size: 10px; }
.title > input { width: 230px; font-size: 12px; }
.card, .news article { padding: 13px; border: 1px solid var(--border-card); border-radius: var(--radius-card); background: linear-gradient(135deg, #10223a75, transparent 60%), var(--bg-card); box-shadow: var(--shadow-card); }
.card { min-width: 0; }
.card h2, .news h2 { font-size: 12px; font-weight: 600; letter-spacing: .01em; }
.card-head { gap: 10px; align-items: flex-start; margin-bottom: 11px; }
.card-head p { font-size: 10px; margin: 3px 0 0; }
.card-head > div { min-width: 0; }
.card-head button { border: 1px solid var(--border-card); background: #122139; font-size: 10px; }
#kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-grid); margin-bottom: var(--space-grid); }
.kpi { position: relative; min-height: 100px; padding: 13px 14px 10px; border: 1px solid var(--border-card); border-top: 2px solid var(--accent, var(--accent-cyan)); border-radius: var(--radius-card); background: linear-gradient(150deg, #142540aa, #0b1629 75%); box-shadow: var(--shadow-card); font-variant-numeric: tabular-nums; }
.kpi::after { content: ""; position: absolute; bottom: 0; left: 14px; right: 14px; height: 1px; background: var(--accent, var(--accent-cyan)); opacity: .18; }
.kpi i { float: right; margin: 0 0 0 8px; width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--border-card); border-radius: 5px; font-size: 16px; background: #10203a; }
.kpi span { font-size: 10px; font-weight: 500; color: #adbed5; }
.kpi b { margin-top: 5px; font-size: 27px; line-height: 1.2; font-weight: 600; letter-spacing: -.035em; }
.kpi small { font-size: 9px; color: var(--text-secondary); margin-top: 7px; }
#overview-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-grid); align-items: stretch; }
#overview-grid > .card { display: flex; flex-direction: column; min-height: 219px; }
#overview-grid > .card:nth-child(1) { grid-column: span 3; }
#overview-grid > .card:nth-child(2) { grid-column: span 5; }
#overview-grid > .card:nth-child(3) { grid-column: span 4; }
#overview-grid > .card:nth-child(4), #overview-grid > .card:nth-child(5), #overview-grid > .card:nth-child(6), #overview-grid > .card:nth-child(7) { grid-column: span 4; }
#overview-grid > .card:nth-child(8) { grid-column: span 3; }
#overview-grid > .card:nth-child(9) { grid-column: span 5; }
#overview-grid .chart { height: 174px; flex: 0 0 174px; min-height: 0; }
#overview-grid .card > .list { flex: 1; }
.chart { height: 245px; min-width: 0; }
#overview-grid .split { grid-template-columns: minmax(135px, 43%) minmax(0, 1fr); height: 174px; gap: 13px; }
#overview-grid .split > .donut, #overview-grid .split > .donut > .donut { height: 160px; }
#overview-grid .split .donut canvas { height: 160px !important; }
.legend { font-size: 10px; gap: 9px; }
.legend span { align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.legend b { font-weight: 500; }
.dot { width: 6px; height: 6px; }
.list { gap: 0; align-content: start; }
.row { min-width: 0; font-size: 11px; grid-template-columns: minmax(0, 1.45fr) minmax(0, .7fr) minmax(0, 1fr); align-items: center; gap: 8px; padding: 8px 0; border-color: #21334e; }
.row b { font-weight: 500; overflow-wrap: anywhere; }
.row small { font-size: 10px; overflow-wrap: anywhere; }
#overview-grid .row { grid-template-columns: minmax(0, 1.3fr) auto minmax(0, 1fr); padding: 7px 0; align-items: center; }
#overview-grid .row > small { line-height: 1.35; }
#overview-grid > .card:first-child .row { grid-template-columns: minmax(0, 1fr) auto; }
#overview-grid > .card:first-child .row > small { grid-column: 1 / -1; }
#overview-grid .row b small { display: block; margin-top: 2px; }
#overview-grid > .card:nth-child(7) .row b small { display: inline; margin: 0 0 0 5px; }
#overview-grid > .card:nth-child(8) .row { grid-template-columns: 1fr auto auto; }
#overview-grid > .card:nth-child(8) .row > small { grid-column: auto; }
#overview-grid > .card:nth-child(9) .row { grid-template-columns: minmax(0, 1fr) 110px; gap: 3px 10px; }
#overview-grid > .card:nth-child(9) .row > b { grid-column: 1 / -1; }
#overview-grid > .card:nth-child(9) .row > small:last-child { text-align: right; }
.badge { font-size: 9px; padding: 3px 6px; border-radius: 4px; line-height: 1.25; }
.bad-red { background: #ff738e15; color: #ff9eb1; border: 1px solid #ff738e36; }
.bad-orange { background: #f4a46215; color: #f6bc8f; border: 1px solid #f4a46236; }
.bad-yellow { background: #f1c95b15; color: #f1d78d; border: 1px solid #f1c95b36; }
.bad-green { background: #40d9a215; color: #85e3bd; border: 1px solid #40d9a236; }
.flight-badge { border: 0; }
.two { gap: var(--space-grid); align-items: start; }
.table { max-height: 65vh; min-width: 0; border: 1px solid #20344e; border-radius: 5px; scrollbar-width: thin; scrollbar-color: #324d70 #0b172b; }
table { font-size: 11px; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 10px; border-bottom: 1px solid #20344e; }
th { font-size: 10px; font-weight: 500; background: #12233a; color: #b0c4dd; position: sticky; top: 0; z-index: 1; white-space: nowrap; }
td b { font-weight: 500; }
td small { display: block; margin-top: 3px; }
tbody tr:hover { background: #10253c; }
tbody tr:last-child td { border-bottom: 0; }
.airport-name, .metar-raw { color: var(--text-secondary); }
#weather-content > .two > .list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-grid); grid-column: 1 / -1; }
#weather-content .card > p { font-size: 12px; line-height: 1.6; }
#map { height: calc(100vh - 225px); min-height: 430px; margin-top: 13px; border: 1px solid var(--border-card); }
.small-map { height: 390px; border: 1px solid var(--border-card); margin-top: 10px; }
.map-workspace > label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; font-size: 10px; border: 1px solid var(--border-card); background: #102139; border-radius: 4px; margin: 0 4px 6px 0; }
.leaflet-container { background: #101e30; font-family: inherit; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--bg-card); color: var(--text-primary); }
.leaflet-popup-content-wrapper { border: 1px solid #3e5a7a; border-radius: 7px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--text-secondary); }
.leaflet-popup-content { font-size: 11px; line-height: 1.6; }
.leaflet-container .leaflet-control-attribution { background: #071020e8; color: #9bacbf; font-size: 9px; }
.leaflet-container .leaflet-control-attribution a { color: var(--accent-cyan); }
.leaflet-bar { border-color: #31496c !important; }
.leaflet-bar a { background: #0b1b30; color: var(--text-primary); border-color: #31496c; }
.leaflet-bar a:hover { background: #17324c; color: var(--text-primary); }
.zip-legend, .airport-legend, .alert-map-legend { background: #081526f2; color: var(--text-primary); border-color: #31496c; border-radius: 5px; box-shadow: var(--shadow-card); font: 10px/1.4 "Segoe UI", system-ui, sans-serif; padding: 8px; }
.outage-current-layout { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--space-grid); margin-bottom: var(--space-grid); }
.outage-current-layout .outage-snapshot { min-height: 0; }
.outage-current-layout .outage-snapshot .table { max-height: 868px; }
.outage-map-stack { gap: var(--space-grid); }
#gas-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-grid); margin-bottom: var(--space-grid); }
.news { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-grid); }
.news h2 { line-height: 1.5; }
.news article > small { display: block; margin-top: 7px; font-size: 10px; }
.news article > p { line-height: 1.6; font-size: 12px; }
.news article > a { font-size: 11px; }
.tabs { display: flex; flex-wrap: wrap; gap: 5px; padding: 5px; margin-bottom: 12px; width: fit-content; border: 1px solid var(--border-card); border-radius: 6px; background: #071120; }
.tabs button { font-size: 11px; border-color: transparent; background: transparent; }
.tabs button.active { background: #17324f; color: var(--accent-cyan); border-color: #2d5173; }
#history-view { padding: 12px; border: 1px solid var(--border-card); border-radius: var(--radius-card); background: var(--bg-card); }
#events-content { display: grid; gap: var(--space-grid); }
.event-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(160px, .7fr) auto; gap: var(--space-grid); }
.event-form label, .event-comment-form label { font-size: 11px; color: var(--text-secondary); }
.event-form input, .event-form textarea { border-color: var(--border-card); background: #081527; font-size: 12px; }
.event-form textarea { min-height: 60px; }
.event-form button { white-space: nowrap; font-size: 11px; }
#events-content .row { display: flex; flex-wrap: wrap; align-items: center; font-size: 11px; }
#events-content .row > b { min-width: 160px; }
#events-content .row > span { flex: 1; min-width: 180px; }
.event-interval { display: flex; align-items: center; gap: 5px; color: var(--text-secondary); }
.event-comments-card { margin-top: 0; }
.event-comment { background: #091629; border-color: var(--border-card); }
.event-comment-form { gap: var(--space-grid); }
.event-comment-form input { width: 100%; }
.event-comment-form textarea { width: 100%; }
.source-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-grid); }
.source-intro { margin-bottom: var(--space-grid); }
.source-intro p { font-size: 12px; }
.source-card { min-height: 155px; }
.source-card-head h2 { font-size: 12px; }
.source-card-head img { width: 26px; height: 26px; }
.source-card > p { font-size: 11px; line-height: 1.6; }
.source-fresh { font-size: 10px; border-color: var(--border-card); color: #9bb6d0; }
#report dl { display: grid; grid-template-columns: 230px minmax(0, 1fr); margin-top: 16px; }
#report dt, #report dd { padding: 12px 0; margin: 0; border-bottom: 1px solid var(--border-card); font-size: 12px; }
#report dt { color: var(--text-secondary); }
.alert-modal { backdrop-filter: blur(4px); }
.alert-modal article { background: var(--bg-card); border: 1px solid #375c80; border-radius: var(--radius-card); box-shadow: 0 20px 80px #0009; }
.alert-modal h2 { font-size: 17px; }
.alert-modal dt { color: #a0b9d5; font-size: 11px; }
.alert-modal dd { font-size: 12px; }
.alert-choice { border-color: var(--border-card); background: #10213a; font-size: 12px; }
.alert-choice:hover { background: #183354; border-color: #3d7395; }
.spc-discussion-text { font: 12px/1.6 ui-monospace, "Cascadia Code", Consolas, monospace; }
#message { font-size: 12px; border-color: #8c6941; background: #312517; }
.empty { padding: 18px 10px; font-size: 12px; }
@media (min-width: 2200px) {
  :root { --sidebar-width: 205px; --space-grid: 16px; }
  .workspace { padding: 22px 26px 28px; }
  #overview-grid > .card { min-height: 270px; }
  #overview-grid .chart, #overview-grid .split { height: 220px; }
  #overview-grid .row { padding: 9px 0; font-size: 12px; }
  .kpi { min-height: 112px; }
}
@media (max-width: 1500px) {
  :root { --sidebar-width: 176px; --space-grid: 10px; }
  .command-header, .workspace { padding-left: 15px; padding-right: 15px; }
  .brand b { font-size: 15px; }
  .header-controls { gap: 7px; }
  .command-header #clock { font-size: 10px; }
  .kpi { padding: 11px; min-height: 96px; }
  .kpi b { font-size: 25px; }
  .kpi i { width: 23px; height: 23px; }
  #overview-grid > .card { min-height: 216px; }
  #overview-grid .split { grid-template-columns: minmax(115px, 43%) minmax(0, 1fr); gap: 9px; }
  .card { padding: 11px; }
  .event-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 801px) and (max-width: 1199px) {
  :root { --sidebar-width: 62px; }
  #nav { padding: 0 6px 12px; overflow: visible; }
  .sidebar-brand { justify-content: center; padding: 0; }
  .sidebar-brand > div:last-child, #nav .nav-label, #nav em, #nav footer { display: none; }
  #nav button[data-page] { justify-content: center; padding: 10px; position: relative; }
  #nav button[data-page]:hover::after, #nav button[data-page]:focus-visible::after { content: attr(aria-label); position: absolute; left: 53px; padding: 7px 10px; background: #16304d; border: 1px solid #375c80; border-radius: 4px; white-space: nowrap; color: var(--text-primary); z-index: 1200; }
  .brand small { display: none; }
  #kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #overview-grid > .card:nth-child(n) { grid-column: span 6; }
  #overview-grid > .card:nth-child(9) { grid-column: 1 / -1; }
  .news, .source-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  :root { --header-height: 106px; }
  .shell { display: block; }
  #nav { position: fixed; top: 0; bottom: 0; width: 225px; height: 100dvh; transform: translateX(-100%); overflow-y: auto; padding-top: 8px; transition: transform .2s; box-shadow: none; }
  #nav.open { transform: translateX(0); box-shadow: 12px 0 60px #0009; }
  .sidebar-brand { min-height: 55px; }
  #nav button[data-page] { min-height: 41px; }
  #menu { display: inline-flex; align-items: center; justify-content: center; padding: 7px; }
  #menu .ui-icon { width: 19px; height: 19px; }
  .command-header { flex-wrap: wrap; gap: 9px; padding: 11px 12px 9px; }
  .brand { flex: 1; }
  .brand b { font-size: 15px; }
  .brand small { display: block; font-size: 9px; }
  .header-controls { width: 100%; justify-content: space-between; gap: 6px; }
  .command-header #clock { display: block; font-size: 10px; }
  .command-header label small { display: none; }
  .workspace { padding: 13px 12px 24px; }
  .title { flex-wrap: wrap; align-items: center; }
  .title h1 { font-size: 17px; }
  #kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #overview-grid > .card:nth-child(n) { grid-column: span 6; }
  #overview-grid > .card:nth-child(9) { grid-column: 1 / -1; }
  .two, .outage-current-layout { grid-template-columns: minmax(0, 1fr); }
  .news, .source-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #weather-content > .two > .list { grid-template-columns: minmax(0, 1fr); }
  .outage-current-layout .outage-snapshot .table { max-height: 440px; }
  .small-map { height: 340px; }
  #map { height: 62vh; min-height: 350px; }
  .event-comment-form { grid-template-columns: minmax(0, 1fr); }
  #events-content .card-head { flex-wrap: wrap; }
  #report dl { grid-template-columns: 180px minmax(0, 1fr); }
}
@media (max-width: 540px) {
  .brand b { font-size: 13px; }
  .brand small { font-size: 8px; }
  .header-controls { gap: 5px; }
  .command-header #clock { flex-basis: 100%; font-size: 10px; }
  .command-header label { font-size: 10px; }
  .command-header select { max-width: 150px; }
  #kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { min-height: 90px; }
  .kpi b { font-size: 24px; }
  #overview-grid > .card:nth-child(n) { grid-column: 1 / -1; min-height: 195px; }
  #overview-grid .split { grid-template-columns: minmax(115px, 43%) minmax(0, 1fr); height: 174px; }
  #overview-grid .split > .donut, #overview-grid .split > .donut > .donut { margin: 0; }
  .news, .source-grid, .event-form { grid-template-columns: minmax(0, 1fr); }
  #gas-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #report dl { grid-template-columns: minmax(0, 1fr); }
  #report dt { padding-bottom: 0; border: 0; }
  #report dd { padding-top: 5px; }
  .title > input { width: 100%; max-width: none; }
  .alert-modal { padding: 10px; }
  .alert-modal article { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  button, #nav { transition: none; }
}
@media print {
  .shell { display: block; }
  #nav, .command-header { display: none !important; }
  #main, .workspace { width: 100%; padding: 0; }
  #report { color: #111; background: white; box-shadow: none; }
  #report dt, #report dd, #report p { color: #111; border-color: #ccc; }
}
