:root {
  --bg: #0e1116; --panel: #161a21; --panel2: #1c212a; --line: #272e39; --text: #e7eaf0; --muted: #8b95a6;
  --accent: #ff7a2f; --ok: #3ecf8e; --warn: #f5a524; --crit: #f2555a; --blue: #5aa9ff; --violet: #b08cff;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; }
.muted { color: var(--muted); } .small { font-size: 12px; } .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.right { text-align: right; } .nowrap { white-space: nowrap; }

/* layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100%; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; font-weight: 700; font-size: 16px; }
.brand span.logo { font-size: 22px; }
.navlabel { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 6px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--muted); cursor: pointer; }
.nav:hover { background: var(--panel2); color: var(--text); }
.nav.active { background: var(--panel2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.nav .grow { flex: 1; min-width: 0; }
.nav .name { color: var(--text); font-weight: 600; }
.nav .sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav .count { background: var(--crit); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; font-weight: 700; }
.side .spacer { flex: 1; }
.main { padding: 26px 30px 60px; min-width: 0; max-width: 1500px; }
.head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.subhead { color: var(--muted); margin-bottom: 20px; }

/* status */
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(62, 207, 142, .16); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(245, 165, 36, .16); }
.dot.crit { background: var(--crit); box-shadow: 0 0 0 3px rgba(242, 85, 90, .18); }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { color: var(--ok); border-color: rgba(62, 207, 142, .4); background: rgba(62, 207, 142, .08); }
.pill.warn { color: var(--warn); border-color: rgba(245, 165, 36, .4); background: rgba(245, 165, 36, .08); }
.pill.crit { color: var(--crit); border-color: rgba(242, 85, 90, .45); background: rgba(242, 85, 90, .1); }
.pill.off { color: var(--muted); }

/* cards */
.grid { display: grid; gap: 16px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.tiles { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-bottom: 16px; }
.two { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; min-width: 0; }
.card.link { cursor: pointer; transition: border-color .15s; }
.card.link:hover { border-color: var(--accent); }
.card.crit { border-color: rgba(242, 85, 90, .55); }
.card + .card.block, .block { margin-bottom: 16px; }
.cardhead { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cardhead .title { font-size: 17px; font-weight: 700; }
.cardhead .grow { flex: 1; min-width: 0; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.kv .k { font-size: 11.5px; color: var(--muted); }
.kv .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.tile .k { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.tile .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.bar { height: 6px; background: var(--panel2); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar > i.ok { background: var(--ok); } .bar > i.warn { background: var(--warn); } .bar > i.crit { background: var(--crit); }
.deflist { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; }
.deflist .k { color: var(--muted); }

/* banners */
.banner { border-radius: 12px; padding: 14px 18px; margin-bottom: 16px; border: 1px solid var(--line); background: var(--panel); display: flex; gap: 12px; align-items: flex-start; }
.banner.ok { border-color: rgba(62, 207, 142, .35); }
.banner.crit { border-color: rgba(242, 85, 90, .6); background: rgba(242, 85, 90, .07); }
.banner.warn { border-color: rgba(245, 165, 36, .5); background: rgba(245, 165, 36, .06); }
.banner .t { font-weight: 700; }
.alertrow { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); }
.alertrow:first-child { border-top: 0; padding-top: 0; }
.alertrow .dot { margin-top: 5px; }
.tag { font-size: 11px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; color: var(--muted); margin-left: 6px; white-space: nowrap; }

/* tables */
.tablewrap { overflow: auto; max-height: 460px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 6px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); white-space: nowrap; }
td { padding: 7px 10px; border-bottom: 1px solid rgba(39, 46, 57, .6); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.dim td { color: var(--muted); }
td .bar { width: 90px; margin: 0; display: inline-block; vertical-align: middle; margin-right: 8px; }
td.clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: var(--panel2); }
.chip b { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.chip.on { border-color: rgba(62, 207, 142, .4); } .chip.offc { opacity: .55; }

/* charts */
.charts { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); margin-bottom: 16px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 4px; flex-wrap: wrap; }
.chart .legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }
.chart .now { margin-left: auto; color: var(--text); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { background: transparent; border: 0; padding: 5px 12px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--panel2); color: var(--text); }
.rowhead { display: flex; align-items: center; gap: 12px; margin: 22px 0 12px; }
.rowhead h2 { margin: 0; flex: 1; }

/* auth */
.authwrap { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.auth { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.auth .logo { font-size: 34px; }
.auth h1 { margin: 6px 0 4px; }
.auth p { color: var(--muted); margin: 0 0 18px; }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 0 5px; }
input[type=email], input[type=password] { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; outline: none; }
input:focus { border-color: var(--accent); }
.btn { background: var(--accent); color: #1a0d04; border: 0; border-radius: 8px; padding: 10px 16px; font-weight: 700; cursor: pointer; }
.btn.wide { width: 100%; margin-top: 18px; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 600; }
.btn:disabled { opacity: .6; cursor: default; }
.formerr { color: var(--crit); margin-top: 12px; min-height: 20px; }
.formok { color: var(--ok); margin-top: 12px; }
.narrow { max-width: 460px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--line); align-items: center; }
  .brand { padding: 4px 8px; } .brand b, .navlabel, .side .spacer, .nav .sub { display: none; }
  .nav { white-space: nowrap; } .nav.active { box-shadow: inset 0 -3px 0 var(--accent); }
  .main { padding: 18px 14px 50px; }
  .two, .charts { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
}
