:root {
  color-scheme: light;
  --ink: #17231d;
  --muted: #66746c;
  --line: #dce5df;
  --paper: #ffffff;
  --wash: #f4f7f4;
  --green: #206a43;
  --lime: #b9db63;
  --orange: #d97732;
  --red: #bd3d3d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--wash); color: var(--ink); }
button, select { font: inherit; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 238px; padding: 28px 20px;
  display: flex; flex-direction: column; background: #183f2c; color: white;
}
.brand { display: flex; align-items: center; gap: 12px; color: white; text-decoration: none; font-size: 1.05rem; }
.brand span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--lime); color: #173521; font-weight: 900; }
nav { display: grid; gap: 8px; margin-top: 54px; }
nav a { padding: 11px 13px; border-radius: 9px; color: #b9cec1; text-decoration: none; font-weight: 650; }
nav a:hover, nav a.active { background: #24563c; color: white; }
.source-card { margin-top: auto; padding: 15px; display: grid; gap: 4px; border: 1px solid #37664c; border-radius: 12px; background: #204b35; }
.source-card small { color: #aac3b4; }
.status-dot { width: 9px; height: 9px; margin-bottom: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 5px #bd3d3d22; }
.status-dot.online { background: var(--lime); box-shadow: 0 0 0 5px #b9db6322; }

main { margin-left: 238px; padding: 38px; max-width: 1600px; }
header { display: flex; justify-content: space-between; gap: 32px; align-items: flex-start; margin-bottom: 28px; }
.account { min-width: 130px; display: grid; gap: 8px; font-size: .8rem; }
.account button { min-height: 34px; }
h1, h2, p { margin: 0; }
h1 { max-width: 700px; margin-top: 7px; font-family: Georgia, serif; font-size: clamp(2.2rem, 4vw, 4.4rem); line-height: .98; letter-spacing: -.04em; }
h2 { font-size: 1.25rem; }
.eyebrow { color: var(--green); font-size: .72rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.subtitle { max-width: 620px; margin-top: 16px; color: var(--muted); line-height: 1.6; }
.updated { min-width: 160px; padding: 13px 16px; border-left: 3px solid var(--lime); display: grid; gap: 4px; }
.updated span { color: var(--muted); font-size: .78rem; }

.filters { padding: 16px; display: grid; grid-template-columns: 1.4fr 1fr .7fr auto; gap: 12px; align-items: end; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: .75rem; font-weight: 750; }
select, button { min-height: 43px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); }
button { border-color: var(--green); background: var(--green); color: white; font-weight: 750; cursor: pointer; }
button:disabled { opacity: .55; }

.metrics { margin: 18px 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.metrics article { min-height: 132px; padding: 20px; display: grid; align-content: space-between; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.metrics span, .metrics small { color: var(--muted); }
.metrics strong { font-family: Georgia, serif; font-size: clamp(1.5rem, 2.4vw, 2.25rem); }
.metrics small.up { color: var(--green); }
.metrics small.down { color: var(--red); }

.panel { margin-top: 18px; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 22px; }
.panel-head h2 { margin-top: 4px; }
.panel-head > span { color: var(--muted); font-size: .82rem; }
.panel-copy { max-width: 620px; margin-top: 8px; color: var(--muted); line-height: 1.5; }
.legend { display: flex; align-items: center; gap: 8px; }
.legend i { width: 24px; height: 3px; border-radius: 3px; background: var(--green); }
.chart { min-height: 300px; display: grid; place-items: center; }
.chart svg { width: 100%; overflow: visible; }
.grid line { stroke: #e5ebe7; stroke-width: 1; }
.grid text, .labels text { fill: #78847d; font-size: 12px; }
.area { fill: url(#none); fill: #206a4312; }
.line { fill: none; stroke: var(--green); stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }
.dots circle { fill: white; stroke: var(--green); stroke-width: 3; }
.empty { color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 820px; border-collapse: collapse; }
th, td { padding: 14px 11px; border-bottom: 1px solid var(--line); text-align: left; font-size: .87rem; }
th { color: var(--muted); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
tbody tr:hover { background: #f7faf8; }
.source { padding: 5px 8px; border-radius: 999px; background: #eaf3ed; color: var(--green); font-size: .74rem; font-weight: 750; }
.database-panel { scroll-margin-top: 18px; }
.database-filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) auto; gap: 12px; align-items: end; margin-bottom: 16px; }
.database-filters input { width: 100%; min-height: 43px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); }
.database-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0; }
.database-summary div { padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #f8faf8; }
.database-summary span, .database-summary strong { display: block; }
.database-summary span { color: var(--muted); font-size: .73rem; }
.database-summary strong { margin-top: 5px; font-size: 1.05rem; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 18px; color: var(--muted); font-size: .84rem; }
button.secondary { border-color: var(--line); background: white; color: var(--ink); }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 420px; padding: 13px 16px; border-radius: 10px; background: #17231d; color: white; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: none; }
.auth-screen { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 24px; background: #183f2cee; }
.auth-card { width: min(100%, 440px); padding: 30px; border-radius: 16px; background: white; box-shadow: 0 24px 70px #071b1044; }
.auth-card h1 { margin-top: 8px; font-size: 2.25rem; }
.auth-copy { margin-top: 14px; color: var(--muted); line-height: 1.55; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; margin: 24px 0 16px; border-bottom: 1px solid var(--line); }
.auth-tabs button { min-height: 39px; border: 0; border-radius: 0; background: transparent; color: var(--muted); }
.auth-tabs button.active { border-bottom: 2px solid var(--green); color: var(--green); }
.auth-form { display: grid; gap: 14px; }
.auth-form input { min-height: 43px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; font: inherit; }
.text-button { min-height: auto; padding: 0; border: 0; background: transparent; color: var(--green); text-align: left; }
.auth-error { min-height: 1.25em; margin-top: 14px; color: var(--red); font-size: .86rem; }

@media (max-width: 1000px) {
  .sidebar { position: static; width: auto; min-height: auto; flex-direction: row; align-items: center; }
  nav { margin: 0 0 0 auto; grid-auto-flow: column; }
  .source-card { display: none; }
  main { margin-left: 0; padding: 24px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .database-filters { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 680px) {
  .sidebar { padding: 14px; }
  .brand strong, nav { display: none; }
  main { padding: 18px 14px; }
  header { display: grid; }
  h1 { font-size: 2.65rem; }
  .filters, .metrics, .database-filters, .database-summary { grid-template-columns: 1fr; }
  .updated { display: none; }
  .panel { padding: 16px; }
}
