:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef3f5;
  --text: #17202a;
  --muted: #66717d;
  --border: #d9e0e6;
  --blue: #2563eb;
  --green: #138a4d;
  --amber: #b7791f;
  --red: #c24135;
  --teal: #0f766e;
  --shadow: 0 8px 24px rgba(20, 31, 44, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans GB", "PingFang SC", "Hiragino Sans", "Yu Gothic", "Noto Sans CJK SC", "Noto Sans CJK JP", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
select {
  font: inherit;
}

.app-shell {
  width: min(1200px, calc(100% - 24px));
  margin: 0 auto;
  padding: 14px 0 24px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 700;
}

.clock,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.clock {
  margin: 6px 0 0;
}

.freshness,
.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 7px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.is-ok {
  background: #e7f6ed;
  color: var(--green);
}

.is-warning,
.is-limited {
  background: #fff4db;
  color: var(--amber);
}

.is-danger,
.is-stale {
  background: #fdeceb;
  color: var(--red);
}

.is-neutral {
  background: #eaf0f7;
  color: #415466;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.segment {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.segment.is-active {
  background: var(--text);
  color: #ffffff;
}

.scenario {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.scenario select {
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 0 8px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 12px;
}

.decision-panel {
  border-top: 4px solid var(--blue);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

h2,
h3,
p {
  margin: 0;
}

h2 {
  font-size: 15px;
  line-height: 1.25;
  font-weight: 700;
}

.decision-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.decision-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.recommendation {
  margin-top: 4px;
  font-size: 22px;
  line-height: 1.18;
  font-weight: 700;
}

.times {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.time-box {
  min-height: 64px;
  border-radius: 7px;
  background: var(--surface-2);
  padding: 10px;
}

.time-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.time-value {
  margin-top: 6px;
  font-size: 20px;
  line-height: 1;
  font-weight: 700;
}

.route-list,
.line-list,
.source-list {
  display: grid;
  gap: 8px;
}

.route-row,
.line-row,
.source-row,
.evidence-item {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px;
  background: #ffffff;
}

.route-row.is-recommended {
  border-color: rgba(37, 99, 235, 0.55);
  background: #f5f8ff;
}

.row-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.row-title {
  font-size: 14px;
  font-weight: 700;
}

.row-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.route-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.metric {
  min-height: 44px;
  border-radius: 6px;
  background: #f7f9fb;
  padding: 8px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
}

.status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.source-row {
  background: #fbfcfd;
}

.source-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.evidence-grid {
  display: grid;
  gap: 9px;
}

.evidence-item {
  background: #fbfcfd;
}

.evidence-title {
  font-size: 13px;
  font-weight: 700;
}

.evidence-detail {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.empty-state {
  color: var(--muted);
  font-size: 13px;
}

@media (min-width: 760px) {
  .app-shell {
    width: min(1240px, calc(100% - 40px));
    padding-top: 18px;
  }

  .topbar {
    align-items: center;
  }

  h1 {
    font-size: 28px;
  }

  .controls {
    grid-template-columns: 260px 220px 220px;
    align-items: center;
  }

  .scenario {
    grid-column: auto;
  }

  .dashboard-grid {
    grid-template-columns: minmax(420px, 1.25fr) minmax(280px, 0.85fr) minmax(280px, 0.85fr);
    align-items: start;
  }

  .wide-panel {
    grid-column: 1 / -1;
  }

  .evidence-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1040px) {
  .wide-panel {
    grid-column: 2 / 4;
  }

  .decision-panel {
    grid-row: span 2;
  }

  .recommendation {
    font-size: 24px;
  }
}

@media (max-width: 420px) {
  .app-shell {
    width: min(100% - 16px, 420px);
  }

  .recommendation {
    font-size: 21px;
  }
}
