:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --line: #d9dee7;
  --text: #1d2430;
  --muted: #657084;
  --accent: #226f8f;
  --accent-soft: #dff1f7;
  --warn: #8f5b22;
  --bad: #9d2f2f;
  --good: #2f6f4e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar, .status-strip, .section-head, .view-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1, h2 {
  margin: 0;
}

h1 {
  font-size: 34px;
}

h2 {
  font-size: 18px;
}

.subtle, .status-strip span, article span, .facts dt {
  color: var(--muted);
}

.station-control {
  display: grid;
  gap: 6px;
  min-width: 320px;
}

select, button, input {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
}

button {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  cursor: pointer;
}

.button-link {
  align-items: center;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: #fff;
  display: inline-flex;
  min-height: 42px;
  padding: 10px 12px;
  text-decoration: none;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.view-tabs {
  justify-content: flex-start;
  margin-top: 18px;
}

.tab {
  background: var(--surface);
  color: var(--text);
}

.tab.active {
  background: var(--accent);
  color: #fff;
}

.help {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
  font-size: 12px;
}

.status-strip, .panel, .cards article, .notice, .warning {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.status-strip {
  margin: 20px 0;
  padding: 14px;
  flex-wrap: wrap;
}

.status-strip div {
  display: grid;
  gap: 4px;
}

.journal-filters label {
  color: var(--muted);
  display: grid;
  gap: 4px;
}

.journal-shell table {
  min-width: 1400px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.cards article {
  padding: 16px;
  min-height: 100px;
  display: grid;
  gap: 6px;
}

.cards strong {
  font-size: 30px;
  line-height: 1.15;
}

.cards em {
  color: var(--muted);
  font-style: normal;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 14px;
  margin-top: 14px;
}

.panel {
  margin-top: 14px;
  padding: 16px;
}

.facts {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr;
  gap: 10px 16px;
  margin: 14px 0 0;
}

.facts dd {
  margin: 0;
  font-weight: 600;
}

.bar-row {
  display: grid;
  grid-template-columns: 56px 1fr 52px;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.bar-track {
  height: 16px;
  background: #ecf0f4;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--accent);
}

.bar-row.top .bar-fill {
  background: var(--good);
}

.bar-row span {
  text-align: right;
}

.bar-row.top strong {
  color: var(--good);
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 780px;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.contract-table th {
  white-space: normal;
}

.result-block p {
  margin: 8px 0 0;
}

summary {
  cursor: pointer;
  font-weight: 700;
}

.intraday-chart-wrapper {
  position: relative;
  width: 100%;
  height: 420px;
  min-height: 320px;
  max-height: 480px;
  overflow: hidden;
}

.intraday-chart-wrapper canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
}

.chart-empty {
  display: grid;
  inset: 0;
  place-items: center;
  position: absolute;
  color: var(--muted);
}

.decision-cards article:first-child,
.decision-cards article:nth-child(2) {
  border-top: 4px solid var(--accent);
}

.jobs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.job {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.job strong {
  display: block;
}

.healthy {
  color: var(--good);
}

.failed, .Error {
  color: var(--bad);
}

.Stale, .delayed {
  color: var(--warn);
}

.notice, .warning {
  padding: 12px 14px;
  margin-bottom: 12px;
}

.warning {
  color: var(--warn);
}

.hidden {
  display: none;
}

@media (max-width: 860px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .station-control {
    min-width: 0;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .facts {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 768px) {
  .intraday-chart-wrapper {
    height: 320px;
    min-height: 280px;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 14px;
  }

  h1 {
    font-size: 28px;
  }

  .status-strip, .view-tabs {
    align-items: stretch;
    flex-direction: column;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .cards strong {
    font-size: 34px;
  }

  button, select, input, .button-link {
    min-height: 44px;
  }

  table {
    min-width: 680px;
  }
}
