:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --ink: #2b2b2b;
  --ink-2: #5c5a57;
  --line: #e6e0d6;
  --accent: #d9620b;
  --accent-ink: #a84a05;
  --accent-soft: #fbe9db;
  --neutral: #d8d2c8;
  --good: #2e7d32;
  --bad: #b3261e;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { font-size: 18px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
}
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.nav {
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 1rem .75rem; display: flex; flex-direction: column; gap: .25rem;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; padding: .4rem .6rem 1rem; color: var(--ink); text-decoration: none; }
.brand svg { width: 30px; height: 30px; stroke: var(--accent); }
svg { fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item {
  display: flex; align-items: center; gap: .7rem; padding: .65rem .7rem; border-radius: 8px;
  color: var(--ink); text-decoration: none; font-weight: 500; border-left: 4px solid transparent;
}
.nav-item svg { width: 24px; height: 24px; stroke: var(--ink-2); flex: none; }
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: var(--accent-soft); border-left-color: var(--accent); font-weight: 700; }
.nav-item.active svg { stroke: var(--accent-ink); }
.nav-item:focus-visible, .brand:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.main { padding: 1.25rem 1.75rem 3rem; min-width: 0; }
.topbar { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
h1 { font-size: 1.9rem; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; font-weight: 700; }
.status { color: var(--ink-2); font-size: .85rem; display: flex; align-items: center; gap: .4rem; }
.dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--neutral); display: inline-block; }
.dot.live { background: var(--good); }
.dot.pulse { animation: pulse .9s ease-out; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(217,98,11,.6); } 100% { box-shadow: 0 0 0 10px rgba(217,98,11,0); } }
.banner { background: #fdeceb; border: 1px solid #f0b8b4; color: var(--bad); padding: .6rem .9rem; border-radius: var(--radius); margin-bottom: 1rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .9rem; margin-bottom: 1.1rem; }
.tile { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: var(--radius); padding: .8rem 1rem; }
.tile-label { color: var(--ink-2); font-size: .85rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.tile-value { font-size: 2.4rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile-sub { color: var(--ink-2); font-size: .85rem; min-height: 1.2em; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: .9rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; min-width: 0; }
.card.wide { grid-column: 1 / -1; }
.chart-box { position: relative; height: 300px; }
.chart-box.tall { height: 460px; }
.empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-2); margin: 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); padding: .4rem .6rem; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.empty-row { color: var(--ink-2); text-align: center; padding: 1.2rem; }
.pill { display: inline-block; padding: .05rem .55rem; border-radius: 99px; font-size: .8rem; font-weight: 600; background: var(--neutral); color: var(--ink); }
.pill.warn { background: var(--accent-soft); color: var(--accent-ink); }
.pill.bad { background: #fdeceb; color: var(--bad); }
.bar { height: .7rem; background: var(--neutral); border-radius: 99px; overflow: hidden; display: flex; min-width: 110px; }
.bar i { display: block; height: 100%; }
.bar .a { background: var(--accent); }
.bar .r { background: var(--ink); }

.toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 20; max-width: min(380px, calc(100vw - 2rem)); }
.toast { background: var(--ink); color: #fff; border-left: 5px solid var(--accent); border-radius: 8px; padding: .6rem .85rem; font-size: .9rem; box-shadow: 0 6px 18px rgba(0,0,0,.2); animation: in .25s ease-out; }
.toast b { color: #ffd2b0; }
.toast small { display: block; color: #cfcac2; margin-top: .15rem; }
@keyframes in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 800px) {
  html { font-size: 17px; }
  .app { grid-template-columns: 1fr; }
  .nav { position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto; flex-direction: row; justify-content: space-around; z-index: 10; border-right: 0; border-top: 1px solid var(--line); padding: .3rem; gap: 0; }
  .brand { display: none; }
  .nav-item { flex-direction: column; gap: .1rem; font-size: .72rem; padding: .35rem .4rem; border-left: 0; border-top: 3px solid transparent; border-radius: 0; flex: 1; align-items: center; }
  .nav-item.active { border-top-color: var(--accent); border-left-color: transparent; }
  .main { padding: 1rem 1rem 6rem; }
  h1 { font-size: 1.5rem; }
  .tile-value { font-size: 2rem; }
  .chart-box.tall { height: 420px; }
  .toasts { bottom: 4.6rem; }
}
@media (prefers-reduced-motion: reduce) { .toast, .dot.pulse { animation: none; } }
