:root {
  color-scheme: light;
  --ink: #16312c;
  --muted: #6f827d;
  --line: #e2ebe7;
  --paper: #f4f8f5;
  --card: #ffffff;
  --green: #287966;
  --green-dark: #155c4d;
  --mint: #dff2e9;
  --orange: #e6a454;
  --shadow: 0 14px 36px rgba(25, 65, 54, 0.07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 90% 0%, rgba(195, 232, 213, .34), transparent 28rem),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  min-height: 84px;
  padding: 14px clamp(18px, 4vw, 64px);
  display: flex;
  align-items: center;
  gap: 14px;
  background: #10231f;
  color: white;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: #214d40;
}

.topbar h1 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.topbar .eyebrow { color: #90b9aa; }
.topbar-status { margin-left: auto; display: flex; align-items: center; gap: 9px; color: #c3d4ce; font-size: 13px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #68d39e; box-shadow: 0 0 0 4px rgba(104, 211, 158, .13); }

.page { width: min(1440px, calc(100% - 36px)); margin: 34px auto 24px; }
.intro { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 22px; }
.eyebrow { margin: 0 0 7px; color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .15em; }
h2, h3, p { margin-top: 0; }
h2 { margin-bottom: 7px; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.045em; }
h3 { margin-bottom: 0; font-size: 17px; letter-spacing: -.02em; }
.muted { color: var(--muted); }
.intro .muted { margin-bottom: 0; max-width: 650px; line-height: 1.5; font-size: 14px; }
.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.controls label { color: var(--muted); font-size: 12px; }
select, .button { min-height: 39px; border-radius: 11px; font: inherit; }
select { padding: 0 32px 0 12px; border: 1px solid var(--line); color: var(--ink); background: white; }
.button { border: 0; padding: 0 15px; font-size: 12px; font-weight: 750; cursor: pointer; transition: transform .15s ease, background .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .6; cursor: wait; transform: none; }
.button-primary { background: var(--green); color: white; }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { border: 1px solid var(--line); background: white; color: var(--ink); }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat-card, .panel { border: 1px solid rgba(216, 231, 224, .9); background: var(--card); border-radius: 18px; box-shadow: var(--shadow); }
.stat-card { padding: 19px 20px 17px; min-height: 137px; }
.stat-label { margin-bottom: 13px; color: var(--muted); font-size: 12px; font-weight: 650; }
.stat-value { margin: 0 0 7px; font-size: clamp(25px, 3vw, 34px); font-weight: 760; letter-spacing: -.06em; }
.unit { margin-left: 5px; color: #7a9189; font-size: 12px; font-weight: 650; letter-spacing: 0; }
.stat-caption { margin: 0; color: #8b9b95; font-size: 11px; }

.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.panel { padding: 21px; min-width: 0; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.chart-unit { color: var(--muted); font-size: 11px; }
.chart { width: 100%; height: 260px; overflow: visible; margin-top: 14px; }
.chart text { fill: #82918c; font-family: inherit; font-size: 10px; }
.chart .grid-line { stroke: #e9efec; stroke-width: 1; }
.chart .axis-line { stroke: #cbd9d2; stroke-width: 1; }
.chart .bar { rx: 4; }
.chart .empty-chart { fill: #91a39b; font-size: 13px; }

.lower-grid { display: grid; grid-template-columns: 1.35fr .9fr; gap: 14px; }
.small { font-size: 11px; }
.table-wrap { overflow-x: auto; margin-top: 15px; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; text-align: left; }
th { padding: 10px 9px; border-bottom: 1px solid var(--line); color: #82918c; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
td { padding: 11px 9px; border-bottom: 1px solid #eef3f0; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
.event-badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 99px; background: var(--mint); color: var(--green-dark); font-size: 10px; font-weight: 800; }
.event-badge.refill { background: #fff1dc; color: #956022; }
.empty-cell { color: var(--muted); text-align: center; }
.ai-chip { display: grid; place-items: center; min-width: 30px; height: 26px; border-radius: 8px; background: #e7eafe; color: #5d66a7; font-size: 10px; font-weight: 850; }
.analysis-help { margin: 13px 0; font-size: 12px; line-height: 1.5; }
.analysis-result { min-height: 104px; margin-top: 13px; padding: 14px; border-radius: 13px; background: #f6f8ff; color: #344064; white-space: pre-wrap; font-size: 12px; line-height: 1.6; }
.analysis-result.status-unusual { border-left: 3px solid #e0a249; }
.analysis-result.status-normal { border-left: 3px solid #55a783; }
.footer { display: flex; justify-content: space-between; gap: 14px; padding: 18px 3px 4px; color: #84948d; font-size: 10px; }

@media (max-width: 980px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .lower-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .topbar { padding-inline: 18px; }
  .page { width: min(100% - 24px, 1440px); margin-top: 24px; }
  .intro { align-items: start; flex-direction: column; }
  .controls { width: 100%; }
  .chart-grid { grid-template-columns: 1fr; }
  .stats-grid { gap: 9px; }
  .stat-card { padding: 15px; min-height: 128px; }
  .panel { padding: 16px; }
  .footer { flex-direction: column; }
}

