:root {
  color-scheme: dark;
  --bg: #0b0b0c;
  --card: #161617;
  --card-2: #1d1d1f;
  --line: #2a2a2d;
  --track: #242427;
  --text: #f2f2f3;
  --text-2: #9c9ca1;
  --text-3: #6c6c72;
  --s0: #338ced; --s1: #e76624; --s2: #00a888; --s3: #d28e05;
  --s4: #e24d8b; --s5: #0aac23; --s6: #9887ef; --s7: #eb6263;
  --other: #77777d;
  --sys: #4a4a50;
  --good: #0aac23; --warn: #fbb315; --serious: #f18a59; --crit: #dc3c3d;
  --r: 20px;
  --pad: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  overscroll-behavior-y: none;
}
.hidden { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

main {
  max-width: 560px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px) 16px calc(env(safe-area-inset-bottom) + 28px);
}
section { margin-top: 26px; }

.top { display: flex; justify-content: space-between; align-items: flex-end; padding: 6px 4px 2px; }
h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; margin: 0; line-height: 1.05; }
h2 { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
.sub { color: var(--text-2); margin: 3px 0 0; font-size: 13px; }

.livebadge { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2);
  background: var(--card); border: 1px solid var(--line); padding: 6px 11px; border-radius: 999px; }
.livebadge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.livebadge.on .dot { background: var(--good); box-shadow: 0 0 0 0 rgba(10,172,35,.6); animation: pulse 2s infinite; }
.livebadge.off .dot { background: var(--crit); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(10,172,35,.55); } 70% { box-shadow: 0 0 0 7px rgba(10,172,35,0); } 100% { box-shadow: 0 0 0 0 rgba(10,172,35,0); } }

.card { background: var(--card); border-radius: var(--r); border: 1px solid #1f1f22; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 4px 10px; }
.sec-note { font-size: 12px; color: var(--text-3); }

/* ---------- hero almacenamiento ---------- */
.hero { margin-top: 18px; padding: var(--pad); }
.hero-head { display: flex; justify-content: space-between; align-items: center; }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); font-weight: 600; }
.ghost { font-size: 13px; color: var(--text-2); padding: 6px 10px; margin: -6px -8px -6px 0; border-radius: 10px; }
.ghost:active { background: var(--card-2); }
.ghost.busy { opacity: .5; pointer-events: none; }
.hero-num { margin-top: 10px; display: flex; align-items: baseline; gap: 8px; }
.big { font-size: 46px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.of { color: var(--text-2); font-size: 17px; }
.hero-meta { margin-top: 6px; color: var(--text-2); font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--card-2); color: var(--text); }
.pill .ic { font-size: 11px; }
.pill.good .ic { color: var(--good); } .pill.warn .ic { color: var(--warn); } .pill.crit .ic { color: var(--crit); }

.stack { margin-top: 18px; height: 34px; display: flex; gap: 2px; border-radius: 10px; overflow: hidden; background: var(--track); }
.seg { height: 100%; min-width: 3px; transition: flex-grow .6s ease, opacity .2s; cursor: pointer; }
.seg.free { background: var(--track); }
.stack.focus .seg { opacity: .35; } .stack.focus .seg.on { opacity: 1; }

.legend { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--text-2); }
.legend .it { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sw.free { background: var(--track); outline: 1px solid #3a3a3e; outline-offset: -1px; }
.legend b { color: var(--text); font-weight: 600; }

.forecast { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--text-2); display: flex; gap: 10px; align-items: flex-start; }
.forecast .fi { font-size: 16px; line-height: 1.2; }
.forecast b { color: var(--text); font-weight: 600; }

/* ---------- listas (proyectos / sistema) ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.row { background: var(--card); border: 1px solid #1f1f22; border-radius: 16px; padding: 14px 16px; }
.row-main { display: block; width: 100%; text-align: left; }
.row-top { display: flex; align-items: center; gap: 10px; }
.row-name { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-size { font-weight: 650; }
.bar { margin-top: 10px; height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; transition: width .6s ease; }
.row-sub { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--text-2); }
.row-sub .up { color: var(--text); }
.chev { color: var(--text-3); font-size: 13px; transition: transform .2s; }
.row.open .chev { transform: rotate(90deg); }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #20242b; color: #b9cff0; }
.badge .bd { width: 6px; height: 6px; border-radius: 50%; background: var(--s0); animation: pulse2 1.6s infinite; }
@keyframes pulse2 { 50% { opacity: .3; } }

.detail { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.detail h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); font-weight: 600; }
.detail .blk + .blk { margin-top: 16px; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kv > div { background: var(--card-2); border-radius: 12px; padding: 9px 10px; }
.kv .k { font-size: 11px; color: var(--text-3); }
.kv .v { font-size: 15px; font-weight: 650; margin-top: 2px; }
.child { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 13px; padding: 5px 0; }
.child .cn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.child .cs { color: var(--text-2); }
.child .cb { grid-column: 1 / -1; height: 4px; background: var(--track); border-radius: 2px; overflow: hidden; }
.child .cb > i { display: block; height: 100%; border-radius: 2px; }
.path { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-3); word-break: break-all; }
.muted { color: var(--text-3); font-size: 12.5px; }

/* ---------- tiles en vivo ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { padding: 14px 14px 10px; display: flex; flex-direction: column; min-height: 150px; }
.t-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); font-weight: 600; }
.t-aux { font-weight: 500; color: var(--text-3); font-size: 12px; }
.t-val { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; }
.t-val.dual { font-size: 15px; font-weight: 650; display: flex; flex-direction: column; gap: 1px; letter-spacing: 0; }
.t-val.dual span::before { display: inline-block; width: 14px; color: var(--text-3); }
#rx-val::before, #dr-val::before { content: "↓"; } #tx-val::before, #dw-val::before { content: "↑"; }
.t-val small { font-size: 15px; color: var(--text-2); font-weight: 600; margin-left: 2px; }
.spark { margin-top: auto; height: 54px; position: relative; touch-action: pan-y; }
.spark svg, .hspark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.hspark { height: 90px; position: relative; touch-action: pan-y; }
.xh { stroke: var(--text-3); stroke-width: 1; }

.facts { margin-top: 8px; padding: 6px 16px; display: grid; grid-template-columns: 1fr 1fr; }
.fact { padding: 10px 0; display: flex; flex-direction: column; }
.fact:nth-child(n+3) { border-top: 1px solid var(--line); }
.fact .k { font-size: 12px; color: var(--text-3); }
.fact .v { font-weight: 650; margin-top: 1px; }

/* ---------- contenedores / procesos ---------- */
.list-card { padding: 4px 16px; }
.li { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; align-items: center; padding: 11px 0; }
.li + .li { border-top: 1px solid var(--line); }
.li .n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .m { grid-column: 2 / -1; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .r { font-size: 13px; color: var(--text-2); text-align: right; white-space: nowrap; }
.st { width: 8px; height: 8px; border-radius: 50%; }
.st.ok { background: var(--good); } .st.bad { background: var(--crit); } .st.mid { background: var(--warn); }
.mini { display: inline-block; width: 46px; height: 4px; background: var(--track); border-radius: 2px; vertical-align: middle; margin-left: 6px; overflow: hidden; }
.mini > i { display: block; height: 100%; background: var(--text-2); border-radius: 2px; }

footer { margin-top: 30px; display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-3); padding: 0 4px; }
.link { color: var(--text-3); font-size: 12px; text-decoration: underline; }

/* ---------- tooltip ---------- */
.tip { position: fixed; z-index: 50; pointer-events: none; background: #2c2c30; color: var(--text); border: 1px solid #3a3a3f;
  font-size: 12.5px; padding: 7px 10px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.5); opacity: 0; transition: opacity .12s; max-width: 240px; }
.tip.show { opacity: 1; }
.tip .tk { color: var(--text-2); font-size: 11.5px; }
.tip b { font-weight: 650; }

/* ---------- login ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login form { width: 100%; max-width: 320px; text-align: center; }
.login .logo img { width: 76px; height: 76px; border-radius: 18px; }
.login h1 { font-size: 26px; margin-top: 14px; }
.login input { width: 100%; margin-top: 22px; padding: 15px 16px; font: inherit; font-size: 17px; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 14px; outline: none; }
.login input:focus { border-color: var(--s0); }
.login button { width: 100%; margin-top: 10px; padding: 15px; font-size: 17px; font-weight: 600; background: var(--text); color: #000; border-radius: 14px; }
.err { color: var(--crit); font-size: 14px; min-height: 20px; }

@media (min-width: 700px) { main { padding-top: 40px; } }
