:root {
  --bg: #102418;
  --bg-2: #163022;
  --panel: #1c3a2a;
  --ink: #eef4ef;
  --muted: #a9c0b0;
  --gold: #d4a017;
  --gold-2: #f0c24b;
  --line: #2d5340;
  --danger: #c45c4a;
  --ok: #7dbe6a;
  --shadow: 0 10px 30px rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(212,160,23,.12), transparent 50%),
    linear-gradient(180deg, var(--bg), #0c1c13 100%);
  color: var(--ink);
  min-height: 100vh;
}
a { color: var(--gold-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(16,36,24,.85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-family: Georgia, "Times New Roman", serif; font-size: 1.25rem; letter-spacing: .04em; color: var(--ink); flex: 0 0 auto; }
.brand small { display: block; font-family: "Segoe UI", sans-serif; font-size: .7rem; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
nav { display: flex; flex-wrap: wrap; gap: .2rem .9rem; justify-content: flex-end; align-items: center; }
nav a { color: var(--muted); font-size: .92rem; }
nav a.active, nav a:hover { color: var(--gold-2); text-decoration: none; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 1.5rem; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; }
h1 { font-size: 1.8rem; margin: 0 0 .4rem; }
.lede { color: var(--muted); margin: 0 0 1.4rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.9rem; margin-bottom: 1.4rem; }
.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
}
.kpi .lbl { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.kpi .val { font-size: 1.35rem; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--muted); font-size: .8rem; }
.kpi.dim { opacity: .55; border-left-color: var(--line); }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.2rem;
}
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .55rem .45rem; border-bottom: 1px solid var(--line); font-size: .92rem; }
th { color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
td.num, th.num { text-align: right; }
.flash { background: #3a2a16; border: 1px solid var(--gold); color: var(--gold-2); padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.err { background: #3a1e1a; border: 1px solid var(--danger); color: #f3c7c0; padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.muted { color: var(--muted); }
.note { color: var(--muted); font-size: .85rem; margin: 0 0 1rem; }
.btn {
  display: inline-block; background: var(--gold); color: #1a1404; border: 0;
  padding: .55rem 1rem; border-radius: 6px; font-weight: 600; cursor: pointer;
}
.btn.secondary { background: transparent; color: var(--gold-2); border: 1px solid var(--gold); }
.btn.danger { background: var(--danger); color: white; }
.btn.tiny { padding: .2rem .55rem; font-size: .75rem; margin-left: .35rem; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.key-cell { max-width: 22rem; word-break: break-all; }
.form { display: grid; gap: .7rem; max-width: 28rem; }
.form.wide { max-width: 100%; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
label { display: grid; gap: .25rem; font-size: .85rem; color: var(--muted); }
input, select {
  background: var(--bg); color: var(--ink); border: 1px solid var(--line);
  border-radius: 6px; padding: .5rem .6rem; font: inherit;
}
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 2rem; }
.login-card { width: min(28rem, 100%); }
.foot { color: var(--muted); font-size: .8rem; padding: 2rem 1.5rem 2.5rem; text-align: center; }
.tag { display: inline-block; padding: .1rem .45rem; border-radius: 999px; font-size: .75rem; border: 1px solid var(--line); }
.tag.ok { color: var(--ok); border-color: var(--ok); }
.tag.off { color: var(--danger); border-color: var(--danger); }
.tag.wait { color: var(--gold-2); border-color: var(--gold); }
.key-once { background: #0c1c13; border: 1px dashed var(--gold); padding: 1rem; border-radius: 8px; font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
canvas { max-width: 100%; }
.charts { display: grid; grid-template-columns: 1fr; gap: 1.2rem; margin-bottom: 1.2rem; }
@media (min-width: 900px) {
  .charts { grid-template-columns: 1fr 1fr; }
}
.chart-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.2rem;
}
.charts .chart-box { margin-bottom: 0; }
.chart-box h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
.chart-h { position: relative; height: 280px; }
.chart-h-sm { position: relative; height: 88px; }
.desk-hint { color: var(--muted); font-size: .82rem; margin: 0 0 .75rem; }
.desk-toggles { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0 0 .85rem; }
.desk-toggles label {
  display: inline-flex; align-items: center; gap: .35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .28rem .85rem;
  color: var(--muted);
  font-size: .88rem;
  cursor: pointer;
  user-select: none;
}
.desk-toggles label:has(input:checked) {
  border-color: var(--gold);
  color: var(--gold-2);
  background: rgba(212,160,23,.12);
}
.desk-toggles input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
tr.desk-row { cursor: pointer; }
tr.desk-row:hover { background: rgba(212,160,23,.08); }
tr.desk-sel { background: rgba(212,160,23,.2); }
.filters { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: end; margin: 0 0 1rem; }
.filters .btn { height: 2.2rem; }
.jump { display: flex; flex-wrap: wrap; gap: .6rem .9rem; margin: 0 0 1.2rem; }
.jump a { border: 1px solid var(--line); border-radius: 999px; padding: .25rem .7rem; color: var(--muted); }
.jump a:hover { border-color: var(--gold); color: var(--gold-2); text-decoration: none; }
.table-scroll { overflow: auto; max-height: 28rem; }
