:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-strong: #edf4f1;
  --text: #17211d;
  --muted: #66746e;
  --line: #dce5e1;
  --green: #1f7a4d;
  --green-soft: #dff2ea;
  --amber: #b36b00;
  --amber-soft: #fff0d6;
  --red: #b42318;
  --blue: #246bfe;
  --shadow: 0 18px 45px rgba(23, 33, 29, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}
.shell { width: min(1240px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 40px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1; }
h2 { font-size: 1.05rem; }
.datebox, .metric, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.datebox { width: fit-content; min-width: 0; padding: 12px 14px; text-align: left; }
.datebox-wide { width: 285px; min-width: 285px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; align-items: start; }
.datebox-wide p { grid-column: 1 / -1; color: var(--muted); margin-top: 2px; font-size: 0.82rem; line-height: 1.25; }
.datebox span, .metric span, .metric small, .section-title p, .muted { color: var(--muted); }
.datebox span { font-size: 0.78rem; }
.datebox strong { display: block; margin-top: 3px; font-size: 0.95rem; line-height: 1.2; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric { padding: 18px; min-height: 142px; display: flex; flex-direction: column; justify-content: space-between; }
.metric strong { display: block; font-size: 2.1rem; line-height: 1; }
.metric.primary { background: #16365f; color: #fff; }
.metric.primary span, .metric.primary small { color: rgba(255, 255, 255, 0.78); }
.forecast-card { display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 0; overflow: hidden; min-height: 142px; }
.forecast-side { min-width: 0; padding: 18px 16px; display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.forecast-side + .forecast-side { border-left: 1px solid var(--line); }
.forecast-side strong { font-size: 16px; line-height: 1.25; white-space: nowrap; }
.forecast-side span { font-size: 14px; }
.mini-bar { height: 12px; border-radius: 999px; background: rgba(255,255,255,.22); overflow: hidden; }
.mini-bar span { display: block; height: 100%; background: #fff; }
.panel { margin-top: 16px; padding: 18px; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.visual-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; }
.donut { width: min(230px, 100%); aspect-ratio: 1; margin: 8px auto 0; border-radius: 50%; display: grid; place-items: center; }
.donut > div { width: 58%; aspect-ratio: 1; border-radius: 50%; background: var(--surface); display: grid; place-items: center; align-content: center; box-shadow: inset 0 0 0 1px var(--line); }
.donut strong { font-size: 2rem; }
.donut span { color: var(--muted); font-size: .84rem; }
.macro-list { display: grid; gap: 12px; }
.macro-row { display: grid; grid-template-columns: minmax(210px, 1fr) minmax(220px, 1.3fr) minmax(210px, .9fr); gap: 12px; align-items: center; }
.bar { height: 12px; border-radius: 999px; background: #e9eeec; overflow: hidden; }
.bar > span { display: block; height: 100%; }
.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, .75fr); gap: 16px; }
.line-svg { width: 100%; min-height: 260px; overflow: visible; }
.chart-label { fill: var(--muted); font-size: 11px; }
.weekly-chart { min-height: 260px; display: grid; grid-template-columns: repeat(15, minmax(16px, 1fr)); gap: 6px; align-items: end; padding-top: 10px; }
.week-bar { display: grid; grid-template-rows: 1fr auto; min-height: 240px; gap: 8px; }
.week-track { position: relative; border-radius: 6px 6px 2px 2px; background: #eef2f1; overflow: hidden; }
.week-fill { position: absolute; inset: 0; background: repeating-linear-gradient(45deg, #e8eeeb, #e8eeeb 6px, #f7faf8 6px, #f7faf8 12px); }
.week-bar span { color: var(--muted); font-size: .72rem; text-align: center; }
.period-grid, .alert-metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.period-card { background: var(--surface-strong); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.period-card strong { display: block; margin: 8px 0; font-size: 1.3rem; }
.period-card.waiting { color: var(--muted); }
.alert { border-radius: 8px; padding: 12px; border: 1px solid var(--line); }
.alert.green { background: var(--green-soft); border-color: #a9dec4; }
.alert .value { display: block; margin: 8px 0 4px; font-size: 1.65rem; font-weight: 800; }
.stopped-box { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-strong); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; }
.pill { display: inline-flex; align-items: center; min-height: 24px; padding: 4px 9px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: .82rem; font-weight: 700; }
.pill.warn { background: var(--amber-soft); color: var(--amber); }
@media (max-width: 960px) {
  .topbar, .section-title { align-items: flex-start; flex-direction: column; }
  .datebox-wide { width: 100%; min-width: 0; grid-template-columns: 1fr; }
  .summary-grid, .visual-grid, .split, .period-grid, .alert-metric-grid { grid-template-columns: 1fr; }
  .macro-row { grid-template-columns: 1fr; }
}
