:root {
  --bg: #f4f6f9; --surface: #fff; --text: #1b2430; --muted: #6b7686; --border: #e3e7ee;
  --brand: #0f3d5e; --accent: #1f9d6b; --accent-soft: #e5f5ee; --off: #b4bcc8; --off-soft: #f0f2f5;
  --danger: #c0392b; --danger-soft: #fbeceb; --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--brand); }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; } h2 { font-size: 1.15rem; margin: 0 0 .5rem; } h3 { font-size: .95rem; margin: 1.25rem 0 .5rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1.5rem; background: var(--brand); color: #fff; flex-wrap: wrap; }
.topbar a, .topbar .link { color: #fff; text-decoration: none; opacity: .9; }
.topbar a:hover, .topbar .link:hover { opacity: 1; text-decoration: underline; }
.topbar nav { display: flex; align-items: center; gap: 1.1rem; }
.topbar form { margin: 0; }
.brand { font-weight: 600; display: flex; align-items: center; gap: .5rem; }
.logo { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 6px; background: var(--accent); color: #fff; font-weight: 700; font-size: .85rem; }
.who { opacity: .7; font-size: .9rem; }
button.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }

.btn { display: inline-block; padding: .6rem 1.1rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; width: 100%; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.15); }
label { display: block; margin-bottom: 1rem; font-size: .9rem; color: var(--muted); }
input[type=text], input[type=password], select { display: block; width: 100%; margin-top: .3rem; padding: .6rem .7rem; border: 1px solid var(--border); border-radius: 8px; font: inherit; color: var(--text); background: #fff; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.alert { padding: .6rem .8rem; border-radius: 8px; margin-bottom: 1rem; background: var(--accent-soft); }
.alert.error { background: var(--danger-soft); color: var(--danger); }

.login-page { background: linear-gradient(135deg, #0f3d5e 0%, #16567f 60%, #1f9d6b 140%); min-height: 100vh; }
.login-page .container { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 14px; padding: 2rem; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-brand { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.5rem; }
.login-brand .logo { width: 2.6rem; height: 2.6rem; font-size: 1rem; }
.login-brand small { display: block; color: var(--muted); }
.login-card h1 { font-size: 1.3rem; margin-bottom: 1rem; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head p { margin: 0; }
.status { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; }
.crumbs { margin: 0 0 .5rem; font-size: .9rem; color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.panel.narrow { max-width: 460px; }
.panel.empty { text-align: center; padding: 3rem 1rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.panel-head h2 { margin: 0; }
.controls { display: flex; gap: .5rem; } .controls select { width: auto; margin: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; color: inherit; text-decoration: none; transition: box-shadow .15s, border-color .15s; }
.card:hover { border-color: var(--brand); box-shadow: 0 6px 18px rgba(15,61,94,.1); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.card-head h2 { margin: 0; }
.card p { margin: .35rem 0; }
.badge { font-size: .75rem; padding: .15rem .55rem; border-radius: 99px; white-space: nowrap; font-weight: 600; }
.badge.ok { background: var(--accent-soft); color: var(--accent); }
.badge.off { background: var(--off-soft); color: var(--muted); }
.mini-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: .8rem 0; }
.mini-kpis div { background: var(--bg); border-radius: 8px; padding: .45rem .6rem; }
.mini-kpis dt { font-size: .75rem; color: var(--muted); } .mini-kpis dd { margin: 0; font-weight: 600; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.mini-kpis small, .kpi small { color: var(--muted); font-weight: 400; margin-left: .2rem; }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.kpi .label { display: block; font-size: .85rem; color: var(--muted); }
.kpi .value { font-size: 1.75rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.chart { height: 300px; position: relative; }
.chart svg { width: 100%; height: 100%; display: block; }
.chart .axis { font-size: 11px; fill: var(--muted); }
.chart .grid-line { stroke: var(--border); }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2; }
.chart .area { fill: rgba(15,61,94,.08); }
.chart .tip { position: absolute; pointer-events: none; background: var(--text); color: #fff; padding: .3rem .5rem; border-radius: 6px; font-size: .8rem; white-space: nowrap; transform: translate(-50%, -120%); }
.chart .msg { display: grid; place-items: center; height: 100%; color: var(--muted); }

table.values { width: 100%; border-collapse: collapse; table-layout: fixed; }
table.values th:nth-child(2) { width: 9rem; } table.values th:nth-child(3) { width: 5rem; } table.values th:nth-child(4) { width: 10rem; }
table.values th, table.values td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); }
table.values th { font-size: .8rem; color: var(--muted); font-weight: 600; }
table.values .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
table.values code { font-size: .75rem; margin-left: .3rem; }
table.values tbody tr:hover { background: var(--bg); }
@media (max-width: 640px) { table.values code { display: none; } .container { padding: 1rem; } }
