:root {
  --bg: #f6f8f6; --card: #ffffff; --text: #1c2a22; --muted: #5b6b60;
  --accent: #1a4731; --border: #dde5df;
  --green: #2e7d32; --amber: #ef6c00; --red: #c62828; --blue: #1565c0; --grey: #90a4ae;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #131a16; --card: #1d2620; --text: #e4ece6; --muted: #9db3a4; --border: #2c3a30; }
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, sans-serif; background: var(--bg); color: var(--text); }
header { background: var(--accent); color: #fff; padding: .6rem 1rem; }
header h1 { margin: 0; font-size: 1.1rem; }
#stale-banner { background: #b71c1c; color: #fff; padding: .3rem .6rem; border-radius: 6px; margin-top: .4rem; font-size: .85rem; }
nav { display: flex; flex-wrap: wrap; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
nav button { flex: 0 0 auto; border: 0; background: none; color: var(--text); padding: .6rem .8rem; cursor: pointer; font-size: .9rem; border-bottom: 3px solid transparent; }
nav button.active { border-bottom-color: var(--accent); font-weight: 600; }
nav button:disabled { color: var(--muted); cursor: default; }
main { padding: 1rem; max-width: 1200px; margin: 0 auto; }
.tab { display: none; }
.tab.active { display: block; }
.hidden { display: none !important; }
.controls { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; margin-bottom: 1rem; }
.controls a { color: var(--accent); }
button { background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: .45rem .9rem; cursor: pointer; }
select, input { background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: .35rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .8rem; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: .8rem; }
.card h3 { margin: 0 0 .3rem; font-size: .82rem; color: var(--muted); font-weight: 600; }
.card .value { font-size: 1.6rem; font-weight: 700; }
.card .meta { font-size: .72rem; color: var(--muted); margin-top: .3rem; }
.card .unit { font-size: .9rem; color: var(--muted); }
.status-card { border-left: 6px solid var(--grey); }
.status-card.green { border-left-color: var(--green); }
.status-card.amber { border-left-color: var(--amber); }
.status-card.red { border-left-color: var(--red); }
.status-card.blue { border-left-color: var(--blue); }
.status-card.grey { border-left-color: var(--grey); }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 10px; color: #fff; font-size: .75rem; font-weight: 600; }
.badge.green { background: var(--green); } .badge.amber { background: var(--amber); }
.badge.red { background: var(--red); } .badge.blue { background: var(--blue); } .badge.grey { background: var(--grey); }
.estimate { font-style: italic; }
.chart { width: 100%; height: 320px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.chart.tall { height: 420px; }
table { border-collapse: collapse; width: 100%; font-size: .8rem; background: var(--card); }
th, td { border: 1px solid var(--border); padding: .3rem .5rem; text-align: right; white-space: nowrap; }
th { background: var(--bg); position: sticky; top: 0; }
td:first-child, th:first-child { text-align: left; }
.scroll-x { overflow-x: auto; }
.alert-item { border-left: 5px solid var(--amber); background: var(--card); border-radius: 8px; padding: .6rem .8rem; margin-bottom: .6rem; }
.alert-item.critical { border-left-color: var(--red); }
.alert-item.resolved { opacity: .6; border-left-color: var(--green); }
h2 { font-size: 1rem; margin: 1.2rem 0 .6rem; }
fieldset { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 1rem; background: var(--card); }
fieldset label { display: inline-block; margin: .3rem .8rem .3rem 0; font-size: .85rem; }
fieldset input { width: 5.5rem; }
#login-overlay { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 50; }
#login-form { background: var(--card); padding: 2rem; border-radius: 12px; display: flex; flex-direction: column; gap: .8rem; min-width: 260px; }
#login-error { color: var(--red); font-size: .85rem; }
.mono { font-family: monospace; font-size: .78rem; }

.inline-form { display: inline-flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.disclaimer { font-size: .78rem; color: var(--amber); font-style: italic; margin: .3rem 0; }
