:root {
  --bg: #0b0d10;
  --panel: #12161b;
  --panel-2: #171c22;
  --line: #222932;
  --text: #e6e9ed;
  --muted: #8a94a1;
  --dim: #5c6672;
  --ok: #3ddc97;
  --warn: #f5b041;
  --err: #ff5d5d;
  --info: #5aa9ff;
  --accent: #b6f36a;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, ui-monospace, monospace;
  --sans: "Inter", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; }
a { color: inherit; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }

/* layout com sidebar */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 12px; gap: 18px; z-index: 20;
}
.side-top { padding: 0 8px; display: grid; gap: 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-label { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-size: 13.5px; position: relative;
}
.nav a svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.active { background: var(--panel-2); color: var(--text); }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.badge { margin-left: auto; font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--dim); }
.badge.err { color: #fff; background: var(--err); border-radius: 99px; padding: 1px 7px; }
.badge.warn { color: var(--warn); }
.badge.ok { color: var(--ok); }
.side-bottom { display: grid; gap: 6px; padding: 0 4px; }
.side-bottom button, .side-bottom .btn { text-align: left; }
.side-clock { font-size: 11px; padding: 4px 4px 0; }

.content { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 18px 24px 0; max-width: 1600px; margin: 0 auto;
}
.topbar h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.menu-btn { display: none; padding: 6px; line-height: 0; }
.menu-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.scrim { display: none; }
[data-views].hidden { display: none !important; }
.card.full { grid-column: span 12; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; }
  body.menu-open .sidebar { transform: none; }
  body.menu-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 15; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 14px 12px 0; }
}

.brand { font-family: var(--mono); font-weight: 700; letter-spacing: .04em; font-size: 15px; }
.brand span { color: var(--accent); }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-family: var(--mono); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.live.on i { background: var(--ok); box-shadow: 0 0 0 0 rgba(61,220,151,.6); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(61,220,151,.5);} 70% { box-shadow: 0 0 0 8px rgba(61,220,151,0);} 100% { box-shadow: 0 0 0 0 rgba(61,220,151,0);} }
button, .btn {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 12px; font: inherit; font-size: 13px; cursor: pointer; text-decoration: none;
}
button:hover, .btn:hover { border-color: var(--muted); }

main { padding: 20px 24px 40px; display: grid; gap: 16px; grid-template-columns: repeat(12, 1fr); max-width: 1600px; margin: 0 auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; min-width: 0; }
.card h2 { margin: 0 0 12px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.card h2 .count { font-family: var(--mono); color: var(--dim); font-weight: 400; }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-6 { grid-column: span 6; } .span-4 { grid-column: span 4; } .span-3 { grid-column: span 3; }
@media (max-width: 1100px) { .span-8, .span-6, .span-4 { grid-column: span 12; } .span-3 { grid-column: span 6; } }
@media (max-width: 600px) { main { padding: 12px; } .span-3 { grid-column: span 12; } }

.tile .label { font-size: 12px; color: var(--muted); }
.tile .value { font-family: var(--mono); font-size: 28px; font-weight: 600; margin-top: 6px; }
.tile .sub { font-size: 12px; color: var(--dim); margin-top: 2px; }
.tile.bad .value { color: var(--err); } .tile.good .value { color: var(--ok); } .tile.mid .value { color: var(--warn); }

.alerts { display: grid; gap: 8px; }
.alert { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 8px; background: var(--panel-2); border-left: 3px solid var(--err); }
.alert.warn { border-color: var(--warn); } .alert.info { border-color: var(--info); }
.empty { color: var(--dim); font-size: 13px; padding: 6px 0; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; font-weight: 500; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num { font-family: var(--mono); text-align: right; white-space: nowrap; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--dim); margin-right: 8px; vertical-align: middle; }
.dot.ok, .dot.online, .dot.running { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.err, .dot.offline, .dot.error { background: var(--err); }
.pill { font-size: 11px; font-family: var(--mono); padding: 2px 8px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.ok { color: var(--ok); border-color: rgba(61,220,151,.3); }
.pill.warn { color: var(--warn); border-color: rgba(245,176,65,.3); }
.pill.err { color: var(--err); border-color: rgba(255,93,93,.3); }

.vps-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.vps-head .host { font-family: var(--mono); font-size: 15px; }
.gauges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
.gauge .g-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.gauge .g-label b { font-family: var(--mono); color: var(--text); font-weight: 500; }
.bar { height: 6px; background: var(--panel-2); border-radius: 99px; margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); border-radius: 99px; transition: width .6s; }
.bar i.warn { background: var(--warn); } .bar i.err { background: var(--err); }
.kv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.kv div { font-size: 12px; color: var(--muted); } .kv b { display: block; font-family: var(--mono); color: var(--text); font-weight: 500; font-size: 13px; margin-top: 2px; }
@media (max-width: 600px) { .kv { grid-template-columns: repeat(2, 1fr); } }
svg.spark { width: 100%; height: 48px; margin-top: 14px; display: block; }

.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.project { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.project .p-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.project .p-name { font-weight: 600; }
.project .p-desc { font-size: 12px; color: var(--muted); margin-top: 6px; min-height: 16px; }
.project .p-links { margin-top: 8px; font-size: 12px; display: flex; gap: 10px; }
.project .p-links a { color: var(--info); text-decoration: none; }

.events { display: grid; gap: 2px; max-height: 340px; overflow: auto; }
.event { display: grid; grid-template-columns: 110px 1fr; gap: 10px; font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.event time { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.banner { grid-column: span 12; padding: 10px 14px; border-radius: 8px; background: rgba(245,176,65,.08); border: 1px solid rgba(245,176,65,.3); color: var(--warn); font-size: 13px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; }
.login { width: 320px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.login .brand { font-size: 20px; margin-bottom: 18px; }
.login input { width: 100%; padding: 10px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); color: var(--text); font: inherit; margin-bottom: 12px; }
.login button { width: 100%; background: var(--accent); color: #111; border: 0; font-weight: 600; padding: 10px; }
.login .error { color: var(--err); font-size: 13px; margin-bottom: 10px; }
