:root {
  --bg: #0a0a0b;
  --card: #141416;
  --card-hi: #1a1a1d;
  --line: #26262b;
  --text: #f4f4f5;
  --muted: #8b8b94;
  --dim: #5c5c66;
  --ok: #22c55e;
  --bad: #ef4444;
  --warn: #f59e0b;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  background-image: radial-gradient(1200px 500px at 15% -10%, #1b1430 0%, transparent 60%), radial-gradient(900px 400px at 100% 0%, #0d2230 0%, transparent 55%);
  background-attachment: fixed;
  color: var(--text);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding: 0 clamp(16px, 4vw, 48px) 40px;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
small { color: var(--muted); font-size: 12px; }

/* ---------- topo ---------- */
.top {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  max-width: 1400px; margin: 0 auto; padding: 22px 0 18px;
  position: sticky; top: 0; z-index: 5;
  background: linear-gradient(var(--bg) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { border-radius: 9px; object-fit: contain; }
.brand h1 { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.brand p { color: var(--muted); font-size: 12.5px; }
.summary { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.actions { display: flex; gap: 8px; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--card); border: 1px solid var(--line);
  max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pill.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px #22c55e22; }
.pill.bad { border-color: #ef444455; color: #fca5a5; }
.pill.bad .dot { background: var(--bad); }
.pill.warn .dot { background: var(--warn); }

.btn {
  display: inline-grid; place-items: center; height: 36px; min-width: 36px; padding: 0 10px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--muted);
  cursor: pointer; font: inherit; font-weight: 600; transition: .15s;
}
.btn:hover { color: var(--text); border-color: #3a3a42; background: var(--card-hi); }
.btn.spin svg { animation: spin .8s linear infinite; }
.btn.primary { background: #6d28d9; border-color: #7c3aed; color: #fff; height: 42px; }
.btn.primary:hover { background: #7c3aed; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- grupos ---------- */
main { max-width: 1400px; margin: 0 auto; }
.loading { color: var(--muted); padding: 60px 0; text-align: center; }
.group { margin-top: 26px; }
.group h2 {
  font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: baseline; gap: 10px; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--line);
}
.group h2 span { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--dim); }
.group h2 em { color: #fca5a5; font-style: normal; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); grid-auto-flow: dense; gap: 14px; }

/* ---------- tile ---------- */
.tile {
  position: relative; display: flex; flex-direction: column; gap: 14px;
  padding: 16px; min-height: 168px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform .15s, border-color .15s, background .15s; overflow: hidden;
}
.tile::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, var(--c), transparent 70%); opacity: .55;
}
.tile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--c) 45%, var(--line)); background: var(--card-hi); }
.tile:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
.tile.wide { grid-column: span 2; }
.tile.s-down { border-color: #ef444455; }

.tile-head { display: flex; align-items: center; gap: 12px; }
.app-ico {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 12px;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 28%, transparent);
}
.tile-name { min-width: 0; flex: 1; }
.tile-name h3 { font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-name p { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.go { color: var(--dim); opacity: 0; transition: .15s; }
.tile:hover .go { opacity: 1; color: var(--c); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; display: inline-block; }
.s-up .dot { background: var(--ok); box-shadow: 0 0 0 3px #22c55e22; }
.s-down .dot { background: var(--bad); box-shadow: 0 0 0 3px #ef444422; animation: pulse 1.6s infinite; }
.s-warn .dot { background: var(--warn); }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- prévias ---------- */
.pv { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; min-height: 0; }
.pv.empty { color: var(--dim); font-size: 12.5px; justify-content: center; }
.sub { color: var(--muted); font-size: 12px; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.spark { width: 100%; height: 44px; display: block; margin-top: 6px; }

.sp-head, .st { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.st { flex-direction: column; align-items: flex-start; gap: 0; justify-content: flex-end; }
.sp-head b, .st b { font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.sp.pos .sp-head b { color: #4ade80; }
.sp.neg .sp-head b { color: #fca5a5; }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 44px; margin-top: 8px; }
.bars i { flex: 1; background: currentColor; border-radius: 3px 3px 1px 1px; opacity: .8; }
.bars i.zero { opacity: .18; }

.tx { flex-direction: row; align-items: flex-start; gap: 10px; justify-content: flex-start; margin-top: auto;
  background: #0f0f11; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; flex: none; }
.tx-ico { color: var(--c); margin-top: 1px; flex: none; }
.tx > div { min-width: 0; }
.tx-title { font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* VPS */
.vps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: start; justify-content: start; }
.meter { min-width: 0; }
.meter-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.meter-head b { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }
.meter.warm .meter-head b { color: #fcd34d; }
.meter.hot .meter-head b { color: #fca5a5; }
.track { height: 5px; background: #222227; border-radius: 99px; overflow: hidden; }
.track span { display: block; height: 100%; border-radius: 99px; transition: width .6s; }
.meter small { display: block; margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter .spark { height: 34px; }
.meter .big { font-size: 22px; display: block; letter-spacing: -.02em; }
.uptime { align-self: start; }
.vps.offline { opacity: .4; filter: grayscale(1); }
.tile.static { cursor: default; }
.tile.static:hover { transform: none; }

/* GitHub */
.gh { display: grid; grid-template-columns: auto 1fr; gap: 10px 22px; align-items: end; }
.gh-stats { display: flex; gap: 18px; grid-column: 1 / -1; }
.gh-stats b { font-size: 20px; font-weight: 700; display: block; letter-spacing: -.02em; }
.gh .hint { grid-column: 1 / -1; color: #fcd34d; font-size: 12px; }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 9px); gap: 3px; }
.heat i { width: 9px; height: 9px; border-radius: 2px; background: #1f1f24; }
.heat i.pad { background: transparent; }
.heat .l1 { background: #0e4429; } .heat .l2 { background: #006d32; } .heat .l3 { background: #26a641; } .heat .l4 { background: #39d353; }
.gh-recent { list-style: none; margin: 0; padding: 0; font-size: 12.5px; min-width: 0; }
.gh-recent li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px dashed #222227; }
.gh-recent li:last-child { border: 0; }
.gh-recent span { display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gh-recent svg { color: var(--dim); }
.gh-recent time { color: var(--dim); white-space: nowrap; }

.foot { max-width: 1400px; margin: 30px auto 0; color: var(--dim); font-size: 12px; text-align: center; }

/* ---------- login ---------- */
body.login { display: grid; place-items: center; padding: 16px; }
.login-card {
  width: min(360px, 100%); display: flex; flex-direction: column; gap: 12px; align-items: stretch; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 32px 28px;
}
.login-card img { align-self: center; object-fit: contain; }
.login-card h1 { font-size: 22px; }
.muted { color: var(--muted); }
.login-card input {
  height: 42px; border-radius: 10px; border: 1px solid var(--line); background: #0f0f11; color: var(--text);
  padding: 0 14px; font: inherit; margin-top: 8px;
}
.login-card input:focus { outline: none; border-color: #7c3aed; }
.err { color: #fca5a5; font-size: 13px; }

/* ---------- telas menores ---------- */
@media (max-width: 900px) {
  .vps { grid-template-columns: repeat(2, 1fr); }
  .gh { grid-template-columns: 1fr; }
  .heat { overflow: hidden; }
}
@media (max-width: 620px) {
  .tile.wide { grid-column: auto; }
  .grid { grid-template-columns: 1fr; }
  .summary { margin-left: 0; order: 3; width: 100%; }
  .actions { margin-left: auto; }
}
