:root {
  color-scheme: light;
  --bg: #f3f5f2;
  --surface: #ffffff;
  --surface-soft: #eef3ed;
  --text: #1e2a22;
  --muted: #657168;
  --line: #dce3dc;
  --accent: #2f7550;
  --accent-dark: #1f5a3b;
  --warn: #946200;
  --danger: #a23b3b;
  --shadow: 0 12px 35px rgba(35, 61, 45, .08);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent-dark); }
button, input, select { font: inherit; min-height: 44px; }
button, input, select, a { outline-offset: 3px; }
:focus-visible { outline: 3px solid #83b89a; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 24px; padding: 14px 28px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 750; white-space: nowrap; }
.brand-mark { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; color: white; background: var(--accent); font-weight: 800; }
nav { display: flex; gap: 8px; flex: 1; }
nav a { padding: 9px 12px; border-radius: 9px; color: var(--muted); text-decoration: none; }
nav a.active, nav a:hover { color: var(--text); background: var(--surface-soft); }
.quiet-button, .primary-button { border: 0; border-radius: 10px; cursor: pointer; padding: 0 18px; }
.quiet-button { background: transparent; color: var(--muted); }
.primary-button { background: var(--accent); color: white; font-weight: 700; }
.primary-button:hover { background: var(--accent-dark); }
.dashboard { max-width: 1440px; margin: 0 auto; padding: 32px 28px 60px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 24px; }
h1 { margin: 0 0 7px; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.03em; }
h2 { margin: 0 0 18px; font-size: 21px; }
.muted, .loading { color: var(--muted); }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.card { padding: 19px; }
.card-label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 9px; }
.card-value { display: block; font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.panel { padding: 22px; margin-top: 18px; }
.status { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; border-radius: 999px; background: var(--surface-soft); font-size: 12px; font-weight: 700; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.status.warn::before { background: var(--warn); }
.status.error::before { background: var(--danger); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 0 0 18px; }
.toolbar label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.toolbar input, .toolbar select { border: 1px solid var(--line); border-radius: 9px; background: white; padding: 0 11px; color: var(--text); }
.table-wrap { max-height: min(70vh, calc(100dvh - 220px)); overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; min-width: 820px; background: white; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; background: #f7faf7; color: var(--muted); font-size: 12px; z-index: 1; }
td { font-size: 14px; }
tr:last-child td { border-bottom: 0; }
.chart-wrap { position: relative; width: 100%; }
.chart { width: 100%; min-height: 260px; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart-line.secondary { stroke: #6e8fa8; }
.chart-axis-label { fill: var(--muted); font-size: 12px; }
.chart-data-point { fill: var(--accent); stroke: white; stroke-width: 1.5; cursor: crosshair; }
.chart-data-point.secondary { fill: #6e8fa8; }
.chart-data-point:focus { outline: none; stroke: #183e2a; stroke-width: 3; }
.chart-hover-line { stroke: #33443a; stroke-width: 1.5; }
.chart-hover-point { fill: var(--accent); stroke: white; stroke-width: 3; pointer-events: none; }
.chart-hover-point.secondary { fill: #6e8fa8; }
.chart-hit-point { fill: transparent; stroke: transparent; cursor: crosshair; }
.chart-hit-point:focus { stroke: rgba(47,117,80,.3); stroke-width: 8; outline: none; }
.chart-tooltip { position: absolute; top: 20px; z-index: 3; min-width: 210px; max-width: 280px; padding: 15px 17px; transform: translateX(-50%); border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.97); box-shadow: var(--shadow); pointer-events: none; }
.tooltip-date { display: block; margin-bottom: 9px; color: var(--muted); }
.tooltip-metric { display: grid; gap: 2px; margin-top: 7px; }
.tooltip-metric small { color: var(--muted); }
.sort-button { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
.sort-indicator { min-width: 1em; color: var(--accent); font-size: 15px; }
.empty, .alert { padding: 14px 16px; border-radius: 10px; background: #fff7df; color: #704d00; }
.hidden { display: none !important; }
.metrika-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 20px; }
.metrika-note { font-size: 13px; line-height: 1.6; max-width: 1050px; }
.metrika-chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.metrika-chart-grid > .panel { min-width: 0; }
.metrika-chart-panel { min-width: 0; }
.metrika-chart-panel h2 { margin-bottom: 12px; }
.metrika-legend { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 14px; }
.metrika-legend-button { background: transparent; border: 1px solid currentColor; border-radius: 20px; padding: 6px 11px; min-height: 34px; font-size: 12px; cursor: pointer; }
.metrika-legend-button[aria-pressed="false"] { opacity: .45; text-decoration: line-through; }
.legend-0 { color: #287d58; } .legend-1 { color: #517daf; } .legend-2 { color: #c78031; }
.legend-3 { color: #8e6bb3; } .legend-4 { color: #b34f72; } .legend-5 { color: #5b9294; }
.metrika-plot-wrap { position: relative; width: 100%; }
.metrika-plot { width: 100%; height: auto; min-height: 210px; display: block; overflow: hidden; }
.metrika-line { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.metrika-dot { stroke: white; stroke-width: 1.5; }
.metrika-hit { cursor: crosshair; }
.metrika-hit:focus { outline: none; stroke: #53695a; stroke-width: 1; }
.metrika-cursor { stroke: #53695a; stroke-width: 1.5; }
.metrika-tooltip { transform: none; top: 12px; min-width: 0; width: max-content; max-width: min(280px, 100%); font-size: 13px; box-sizing: border-box; }
.metrika-choice { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 12px; }
.metrika-choice select { min-width: 0; max-width: 100%; border: 1px solid var(--line); background: white; border-radius: 8px; padding: 8px; }
@media (max-width: 1050px) { .metrika-chart-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .metrika-cards { grid-template-columns: 1fr; } .metrika-chart-panel { padding: 16px 10px; } .metrika-plot { min-height: 180px; } .metrika-period { font-size: 13px; } }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top left, #dfeee2, var(--bg) 50%); }
.login-card { width: min(430px, 100%); padding: 34px; background: white; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.login-card .brand-mark { margin-bottom: 22px; }
.login-form { display: grid; gap: 16px; margin-top: 24px; }
.login-form label { display: grid; gap: 7px; font-weight: 650; }
.login-form input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; }
@media (max-width: 980px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .topbar { flex-wrap: wrap; gap: 10px; } nav { order: 3; width: 100%; overflow-x: auto; } }
@media (max-width: 600px) { .dashboard { padding: 24px 14px 48px; } .topbar { padding: 12px 14px; } .card-grid { grid-template-columns: 1fr; } .page-heading { align-items: start; flex-direction: column; } .login-card { padding: 25px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }

.chart-panels { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:24px; }
.coverage { margin:16px 0; }
.source-freshness { margin-top:16px; }
@media (max-width:800px) { .chart-panels { grid-template-columns:1fr; } }

.cloud-billing .billing-amount { display: block; margin: 12px 0; font-size: clamp(24px, 4vw, 34px); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cloud-billing .billing-error { color: var(--warn); font-size: 14px; }
