
html,
body {
  margin: 0;
  background: #f4f7fb;
  color: #172033;
  font-family: Arial, Helvetica, sans-serif;
  overflow-x: hidden;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

.dashboard-page {
  min-height: 100vh;
}

.station-story {
  background: #ffffff;
  border-bottom: 1px solid #dbe4ee;
  padding: 24px 18px 18px;
  position: relative;
}

.station-story__toggle {
  position: absolute;
  top: 16px;
  right: 28px;
  z-index: 2;
  border: 1px solid #b8c6d6;
  border-radius: 6px;
  background: #ffffff;
  color: #253348;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.15;
  padding: 7px 10px;
}

.station-story.is-collapsed {
  padding: 12px 18px;
}

.station-story.is-collapsed .station-story__inner {
  display: none;
}

.station-story__inner {
  max-width: 1560px;
  width: calc(100vw - 72px);
  margin: 0 auto;
}

.station-story__copy {
  display: grid;
  grid-template-columns: minmax(420px, 0.52fr) minmax(340px, 0.48fr);
  gap: 28px;
  align-items: end;
  margin-bottom: 14px;
  padding-right: 180px;
}

.station-story__copy h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: 0;
}

.station-story__copy p {
  margin: 0;
  color: #4b5b6b;
  font-size: 15px;
  line-height: 1.55;
}

.station-story__canvas {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.station-story__svg {
  display: block;
  width: 100%;
  min-width: 820px;
  height: auto;
}

.station-story__mobile-flow {
  display: none;
}

.mobile-flow__node {
  border: 1px solid #bfd0dc;
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.mobile-flow__node strong,
.mobile-flow__node span,
.mobile-flow__dashboard {
  display: block;
  overflow-wrap: anywhere;
}

.mobile-flow__node strong {
  margin-bottom: 8px;
  color: #243242;
  font-size: 15px;
  line-height: 1.25;
}

.mobile-flow__node span {
  color: #4b5b6b;
  font-size: 13px;
  line-height: 1.35;
}

.mobile-flow__node--incoming {
  border-color: #c8d5e2;
  background: #f4f8fc;
}

.mobile-flow__node--station {
  border-color: #76a683;
  background: #eff8f2;
}

.mobile-flow__node--outgoing {
  border-color: #86b995;
  background: #f0fbf4;
}

.mobile-flow__arrow {
  color: #315f3d;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.mobile-flow__dashboard {
  color: #315f3d;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

.story-label {
  fill: #253348;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

.story-label--muted {
  fill: #4b5b6b;
}

.story-label--dashboard {
  fill: #315f3d;
  font-size: 18px;
}

.story-small {
  fill: #253348;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
}

.station-title {
  fill: #1f3d2b;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
}

.station-chip {
  fill: #243242;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
}

.flow-line {
  stroke: #2f5f8f;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 16 13;
  animation: flow-dash 1.2s linear infinite;
}

.flow-line--station-out {
  animation-delay: -0.35s;
}

.flow-line--departing {
  animation-delay: -0.7s;
}

@keyframes flow-dash {
  to {
    stroke-dashoffset: -58;
  }
}

.week-summary {
  background: #ffffff;
  border-bottom: 1px solid #dbe4ee;
  padding: 16px 24px 18px;
}

.week-summary__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  max-width: 1560px;
  margin: 0 auto;
}

.week-summary__card {
  min-height: 72px;
  border: 1px solid #d8e1ea;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 12px;
}

.week-summary__label {
  color: #536172;
  font-size: 12px;
  line-height: 1.25;
}

.week-summary__value {
  margin-top: 7px;
  color: #172033;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
}

.week-summary__sub {
  margin-top: 4px;
  color: #697789;
  font-size: 12px;
  line-height: 1.25;
}

.plot-area {
  max-width: none;
  width: 100%;
  margin: 0 auto;
  padding: 8px 24px 36px;
}

.panel-toggle-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 10px auto 8px;
  padding: 0 8px;
  font-family: Arial, sans-serif;
}

.panel-toggle {
  border: 1px solid #b8c6d6;
  border-radius: 6px;
  background: #ffffff;
  color: #253348;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.15;
  padding: 7px 9px;
}

.panel-toggle[aria-pressed="false"] {
  background: #e9eef5;
  color: #697789;
  text-decoration: line-through;
}

@media (max-width: 760px) {
  .station-story {
    padding: 18px 12px 14px;
  }

  .station-story__toggle {
    position: static;
    display: block;
    margin-left: auto;
  }

  .station-story.is-collapsed {
    padding: 10px 12px;
  }

  .station-story__copy {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-right: 0;
  }

  .station-story__inner {
    width: calc(100vw - 24px);
  }

  .station-story__copy h1 {
    font-size: 24px;
  }

  .station-story__copy p {
    font-size: 14px;
    max-width: min(100%, 38ch);
    overflow-wrap: anywhere;
  }

  .station-story__canvas {
    display: none;
  }

  .station-story__mobile-flow {
    display: grid;
    gap: 8px;
    margin-top: 14px;
  }

  .station-story__svg {
    width: 820px;
  }

  .plot-area {
    width: calc(100vw - 8px);
    padding: 4px 4px 28px;
    overflow-x: auto;
  }

  .week-summary {
    padding: 12px 10px 14px;
  }

  .week-summary__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .week-summary__value {
    font-size: 16px;
  }
}


:root {
  --ink: #172334;
  --muted: #617084;
  --line: #cfd9e5;
  --panel: #ffffff;
  --soft: #f4f7fb;
  --blue: #2f6690;
  --green: #22966f;
  --gold: #e5a823;
  --red: #c54f43;
}
* { box-sizing: border-box; }
html { min-width: 320px; }
body {
  margin: 0;
  background: var(--soft);
  color: var(--ink);
  font-family: "Times New Roman", Georgia, serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 5px 18px rgba(28, 44, 68, 0.07);
}
.brand { min-width: 260px; }
.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
h1 { margin: 0; font-size: 23px; line-height: 1.05; }
.controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
.controls label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
select, input, .controls button, .view-nav button, .diagnostics-head button {
  height: 34px;
  padding: 4px 9px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #b8c6d4;
  border-radius: 6px;
  font-weight: 700;
}
input { width: 64px; }
input:disabled { color: #8996a6; background: #eef2f6; }
.mode-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid #b8c6d4;
  border-radius: 6px;
  overflow: hidden;
}
.mode-switch button {
  min-width: 62px;
  border: 0;
  border-radius: 0;
}
.mode-switch button + button { border-left: 1px solid #b8c6d4; }
.mode-switch button[aria-pressed="true"] {
  color: #fff;
  background: var(--ink);
}
#diagnostics-toggle { color: #fff; background: var(--blue); border-color: var(--blue); }

main { width: min(1680px, 100%); margin: 0 auto; padding: 14px 20px 30px; }
.statusbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  margin-bottom: 12px;
  padding: 8px 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
}
.statusbar strong { color: var(--blue); }
.statusbar #scenario-summary { flex: 1; color: var(--muted); }
.statusbar #window-status { padding-left: 10px; border-left: 1px solid var(--line); white-space: nowrap; }

.home-view, .dashboard-view { display: none; }
.home-view.active, .dashboard-view.active { display: block; }
.home-intro {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(360px, 2fr);
  gap: 24px;
  align-items: baseline;
  padding: 16px 2px 14px;
}
.home-intro h2 { margin: 0; font-size: 22px; }
.home-intro p { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.42; }
.operation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(230px, 1fr));
  gap: 12px;
}
.operation-card {
  --card-accent: var(--blue);
  position: relative;
  min-height: 312px;
  overflow: hidden;
  padding: 164px 18px 18px;
  color: var(--ink);
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 5px solid var(--card-accent);
  border-radius: 7px;
  box-shadow: 0 9px 24px rgba(28, 44, 68, 0.09);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.operation-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 146px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  border-bottom: 1px solid var(--line);
}
.operation-card:hover, .operation-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--card-accent);
  box-shadow: 0 15px 30px rgba(28, 44, 68, 0.18);
}
.operation-card:focus-visible { outline: 3px solid var(--card-accent); outline-offset: 3px; }
.card-vehicle::before { background-image: url("card-vehicle-scheduling.png"); }
.card-energy { --card-accent: var(--green); }
.card-energy::before { background-image: url("card-energy-dispatch.png"); }
.card-balance { --card-accent: var(--gold); }
.card-balance::before { background-image: url("card-supply-demand-balance.png"); }
.operation-card span { display: block; }
.card-index { margin-bottom: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
.card-title { font-size: 22px; font-weight: 700; line-height: 1.12; }
.card-copy { margin-top: 9px; color: #506074; font-size: 15px; line-height: 1.34; }
.card-action {
  margin-top: 13px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--card-accent);
  font-size: 15px;
  font-weight: 700;
}
.card-action::after {
  content: "\2192";
  display: inline-block;
  margin-left: 7px;
  font-size: 19px;
  line-height: 0;
  transition: transform 160ms ease;
}
.operation-card:hover .card-action::after,
.operation-card:focus-visible .card-action::after { transform: translateX(4px); }

.operating-guide { margin-top: 18px; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.operating-guide > div:first-child { display: grid; grid-template-columns: minmax(230px, 0.8fr) minmax(360px, 2fr); gap: 24px; align-items: baseline; }
.operating-guide h2 { margin: 0; font-size: 19px; }
.operating-guide p { margin: 0; color: var(--muted); line-height: 1.38; }

.home-view .station-story { padding: 16px 18px 10px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.home-view .station-story__inner { width: 100%; }
.home-view .station-story__copy { padding-right: 160px; margin-bottom: 4px; align-items: center; }
.home-view .station-story__copy h1 { font-size: 24px; }
.home-view .station-story__copy p { font-size: 14px; line-height: 1.4; }
.home-view .station-story__svg { max-width: 1050px; margin-inline: auto; }
.week-summary__grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }

.view-nav { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 11px; }
.view-nav button[aria-current="true"] { color: #fff; background: var(--ink); border-color: var(--ink); }
.readme-panel {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 38px 38px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.readme-content { color: var(--ink); font-size: 16px; line-height: 1.62; }
.readme-content h1 { margin: 0 0 12px; font-size: 30px; }
.readme-content h2 { margin: 30px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); font-size: 23px; }
.readme-content h3 { margin: 22px 0 8px; font-size: 19px; }
.readme-content p { margin: 9px 0; }
.readme-content ul, .readme-content ol { margin: 9px 0; padding-left: 26px; }
.readme-content li { margin: 4px 0; }
.readme-content blockquote { margin: 14px 0; padding: 10px 16px; border-left: 4px solid var(--blue); background: var(--soft); }
.readme-content blockquote p { margin: 0; }
.readme-content table { width: 100%; margin: 14px 0 20px; border-collapse: collapse; font-size: 14px; }
.readme-content th, .readme-content td { padding: 9px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.readme-content th { background: var(--soft); }
.readme-content code { padding: 1px 4px; background: var(--soft); border-radius: 3px; }
.view-heading { display: flex; align-items: baseline; gap: 16px; margin: 0 2px 10px; }
.view-heading h2 { margin: 0; font-size: 21px; }
.view-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.plot-grid { display: grid; gap: 12px; }
.plot-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.plot-grid.single { grid-template-columns: minmax(0, 1fr); }
.plot-grid article, .diagnostics-grid article {
  min-width: 0;
  padding: 10px 10px 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
}
.plot-grid article { min-height: 390px; }
.plot-grid article.wide { grid-column: 1 / -1; }
.plot-grid h3, .diagnostics-grid h3 { margin: 0; text-align: center; font-size: 17px; }
.plot { width: 100%; height: 350px; min-width: 0; }
.plot.is-rendering { opacity: 0.45; }
.plot-error { margin: 120px auto 0; color: var(--red); text-align: center; }

.diagnostics-backdrop { position: fixed; inset: 0; z-index: 39; background: rgba(17, 31, 50, 0.35); }
.diagnostics-panel {
  position: fixed;
  top: 24px;
  right: 24px;
  bottom: 24px;
  left: 24px;
  z-index: 40;
  width: min(1120px, calc(100vw - 48px));
  height: fit-content;
  max-height: calc(100vh - 48px);
  margin-left: auto;
  overflow-y: auto;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 22px 60px rgba(17, 31, 50, 0.24);
}
.diagnostics-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.diagnostics-head h2 { margin: 0; font-size: 22px; }
#diagnostics-caption { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.diagnostics-grid { display: grid; grid-template-columns: 1.35fr 0.65fr; gap: 12px; }
.diagnostics-grid article { min-height: 390px; }
.diagnostic-plot { width: 100%; height: 350px; min-width: 0; }

@media (max-width: 1120px) {
  .topbar { position: static; align-items: flex-start; flex-direction: column; }
  .controls { justify-content: flex-start; }
  .operation-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
  .week-summary__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .diagnostics-grid { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  main { padding: 10px; }
  .home-intro, .operating-guide > div:first-child, .operation-grid, .plot-grid.two { grid-template-columns: 1fr; }
  .statusbar, .view-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .statusbar #window-status { padding-left: 0; border-left: 0; }
  .diagnostics-panel { inset: 10px; width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
  .week-summary__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plot, .diagnostic-plot { height: 330px; }
  .readme-panel { padding: 20px 16px 28px; overflow-x: auto; }
}
