/* INFRALAB · estilo "laboratorio alienígena" */
:root {
  --bg: #050a07; --bg2: #07140c; --panel: #0a1a10; --panel2: #0d2416; --line: #1c4a2c; --line2: #2a6a40;
  --neon: #39ff88; --neon-ink: #03200f; --neon-soft: #9dffc4; --sel: #0f3d22;
  --text: #e8fff0; --muted: #93b9a0; --soft: #b8d8c2; --code: #a6ffc8;
  --warn: #ffc27a; --warn-bg: #1f1408; --warn-line: #6b4a1c;
  --bad: #ffb0aa; --bad-bg: #3a1414; --bad-line: #6b2a2a;
  --info: #8cc8ff; --info-bg: #13283a;
  --violet: #8f5bea;
  --r: 14px;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --title: Orbitron, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: radial-gradient(circle at 20% 0%, #0c2416 0%, var(--bg) 55%) fixed; color: var(--text); font-family: Inter, 'Segoe UI', system-ui, sans-serif; font-size: 14px; }
a { color: var(--neon); } a:hover { color: var(--neon-soft); }
button, input, select, textarea { font-family: inherit; font-size: 14px; }
h1, h2, h3 { margin: 0; }
h1 { font-family: var(--title); font-size: 24px; font-weight: 800; letter-spacing: .06em; color: var(--neon); text-shadow: 0 0 14px #39ff8855; }
h2 { font-family: var(--title); font-size: 16px; letter-spacing: .05em; }
h3 { font-size: 15px; }
code, pre, .mono { font-family: var(--mono); }
.muted { color: var(--muted); } .small { font-size: 12px; }
.hidden { display: none !important; }

/* Layout */
.app { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 220px; max-width: 250px; background: var(--bg2); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; }
.brand b { font-family: var(--title); font-weight: 800; letter-spacing: .08em; color: var(--neon); text-shadow: 0 0 10px #39ff8866; font-size: 16px; display: block; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--soft); text-decoration: none; }
.nav a.on { background: #123b22; color: var(--text); font-weight: 600; box-shadow: inset 3px 0 0 var(--neon); }
.nav a:hover { background: #0f2a19; color: var(--text); }
.side { padding-bottom: 70px; }
a.btn { text-decoration: none; }
.card > .btn, .card > a.btn { align-self: flex-start; }
.side .foot { margin-top: auto; padding: 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; color: var(--muted); }
.main { flex: 999 1 560px; min-width: 0; padding: 24px 28px 120px; display: flex; flex-direction: column; gap: 20px; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px; }
.head p { margin: 6px 0 0; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.cols > .grow { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.cols > .aside { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }

/* Paneles */
.card { background: linear-gradient(160deg, var(--panel2), #08140c); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 0 18px #39ff880a; }
.card.bad { border-color: var(--bad-line); }
.card.warnbox { background: var(--warn-bg); border-color: var(--warn-line); }
.card h3 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.stat .v { font-family: var(--title); font-size: 26px; font-weight: 800; color: var(--neon); text-shadow: 0 0 10px #39ff8855; margin-top: 4px; }
.stat .k { font-size: 12px; color: var(--muted); } .stat .s { font-size: 12px; color: #7ee2a8; }
.label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sep { border-top: 1px solid var(--line); margin: 2px 0; }

/* Botones y chips */
.btn { min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line2); background: transparent; color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.btn:hover { border-color: var(--neon); color: var(--neon-soft); }
.btn.pri { background: var(--neon); color: var(--neon-ink); border-color: var(--neon); font-weight: 700; box-shadow: 0 0 12px #39ff8844; }
.btn.pri:hover { background: #6bffa8; color: var(--neon-ink); }
.btn.danger { border-color: var(--bad-line); color: #ff9b94; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.sm { min-height: 34px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.chip { min-height: 38px; padding: 0 13px; border-radius: 20px; border: 1px solid var(--line2); background: transparent; color: #cdeed7; cursor: pointer; font-size: 13px; }
.chip.on { background: var(--neon); color: var(--neon-ink); border-color: var(--neon); font-weight: 700; box-shadow: 0 0 12px #39ff8866; }
.chip.disk { border-radius: 8px; font-family: var(--mono); }
.chip.disk.on { background: var(--sel); color: var(--neon-soft); border-color: var(--neon); font-weight: 500; }
.chip.busy { border-style: dashed; color: #5f7d69; text-decoration: line-through; cursor: not-allowed; background: #0a0f0c; }
.tile { text-align: left; padding: 16px; border-radius: 12px; color: var(--text); background: var(--bg2); border: 2px solid var(--line); cursor: pointer; min-height: 44px; }
.tile.on { background: var(--sel); border-color: var(--neon); box-shadow: 0 0 18px #39ff8840; }
.tile b { display: block; font-size: 16px; } .tile span { font-size: 13px; color: var(--soft); }
.badge { font-size: 12px; padding: 3px 10px; border-radius: 20px; font-weight: 600; white-space: nowrap; }
.b-ok { background: #123524; color: #7ee2a8; } .b-info { background: var(--info-bg); color: var(--info); }
.b-warn { background: #3a2a10; color: #f5c26b; } .b-bad { background: var(--bad-bg); color: var(--bad); } .b-off { background: #1f2733; color: #b3bfcb; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #3fb950; }

/* Formularios */
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); flex: 1 1 150px; }
input, select, textarea { min-height: 40px; border-radius: 8px; border: 1px solid var(--line2); background: var(--bg2); color: var(--text); padding: 0 10px; }
textarea { padding: 10px; min-height: 80px; font-family: var(--mono); font-size: 12px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .chip:focus-visible, .tile:focus-visible { outline: 2px solid var(--neon); outline-offset: 1px; }
input.mono { font-family: var(--mono); font-size: 13px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--soft); cursor: pointer; }
.check input { min-height: 0; width: 18px; height: 18px; accent-color: var(--neon); }
.msg { font-size: 13px; padding: 10px 12px; border-radius: 8px; }
.msg.ok { background: var(--sel); color: var(--neon-soft); } .msg.bad { background: var(--bad-bg); color: var(--bad); } .msg.warn { background: #3a2a10; color: #f5c26b; } .msg.info { background: var(--info-bg); color: var(--info); }

/* Tablas */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 8px; border-bottom: 1px solid #12301d; vertical-align: top; }
.scroll { overflow-x: auto; }

/* Terminal */
.term { background: #030805; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.term .bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg2); font-family: var(--title); font-size: 12px; letter-spacing: .06em; }
.term pre { margin: 0; padding: 14px; font-size: 12px; line-height: 1.6; color: var(--code); white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto; }
.l-cmd { color: #8cc8ff; } .l-err { color: #ff8f86; } .l-ok { color: #7ee2a8; font-weight: 600; } .l-step { color: var(--warn); font-weight: 600; } .l-script { color: #6f9d80; }

/* Consola flotante */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #030805f2; border-top: 1px solid var(--neon); box-shadow: 0 -6px 30px #000a; }
.dock .bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 16px; }
.dock .bar b { font-family: var(--title); font-size: 12px; letter-spacing: .06em; color: var(--neon); }
.dock pre { margin: 0; padding: 10px 16px 16px; height: 300px; overflow: auto; font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--code); white-space: pre-wrap; word-break: break-word; }
.dock.min pre { display: none; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: #000b; z-index: 40; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; }
.modal { width: min(900px, 100%); background: var(--panel); border: 1px solid var(--neon); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 0 40px #39ff8833; }
.modal pre { margin: 0; max-height: 380px; overflow: auto; background: #030805; border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 12px; line-height: 1.55; color: var(--code); white-space: pre-wrap; word-break: break-word; }

/* Toasts */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast { padding: 12px 14px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line2); box-shadow: 0 6px 20px #000a; font-size: 13px; }
.toast.bad { border-color: var(--bad-line); color: var(--bad); } .toast.ok { border-color: var(--neon); }

/* Zibo */
.zibo { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; padding: 14px 18px; border-radius: 16px; border: 1px solid var(--line); background: linear-gradient(90deg, #0f2a19, var(--bg2)); }
.zibo .pet { background: none; border: 0; padding: 0; cursor: pointer; animation: flot 3s ease-in-out infinite; }
.zibo .t { font-family: var(--title); font-size: 13px; letter-spacing: .08em; }
@keyframes flot { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .zibo .pet { animation: none; } }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login .card { width: min(420px, 100%); }

/* Barra de uso */
.bar-use { height: 12px; border-radius: 6px; background: var(--bg2); border: 1px solid var(--line); overflow: hidden; }
.bar-use > div { height: 100%; background: var(--neon); box-shadow: 0 0 10px #39ff8888; }
.bar-use.over > div { background: #ff6b62; }

@media (max-width: 720px) { .main { padding: 18px 14px 120px; } .side { max-width: none; } }

/* Terminal web */
.webbox { background: #020604; border: 1px solid var(--neon); border-radius: 12px; padding: 12px; cursor: text; box-shadow: inset 0 0 30px #39ff880d; }
.webterm { margin: 0; height: 52vh; overflow: auto; font-family: var(--mono); font-size: 13px; line-height: 1.5; color: #d6ffe4; white-space: pre-wrap; word-break: break-word; }
.webline { display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 6px; }
.webprompt { color: var(--neon); white-space: nowrap; font-size: 13px; }
.webinput { flex: 1; min-height: 32px; border: 0; background: transparent; color: var(--text); padding: 0; font-size: 13px; }
.webinput:focus { outline: none; }
