/* NexoPanel: tema profesional. Tokens en :root, modo oscuro automático o forzado con data-theme */
:root {
  --bg: #f5f6fa; --bg-grad: radial-gradient(1200px 500px at 100% -10%, #eef0ff 0, transparent 60%);
  --surface: #ffffff; --surface-2: #f7f8fb; --surface-3: #eef0f5;
  --border: #e4e7ee; --border-strong: #d3d8e2;
  --text: #0f172a; --text-2: #334155; --muted: #64748b;
  --brand: #4f46e5; --brand-2: #7c3aed; --brand-ink: #fff; --brand-soft: #eef0ff; --ring: rgba(79,70,229,.28);
  --ok: #059669; --ok-soft: #e7f8f1; --warn: #b45309; --warn-soft: #fef5e6; --bad: #dc2626; --bad-soft: #fdecec;
  --side: #0b1020; --side-2: #121933; --side-text: #a9b2cc; --side-muted: #5f6a88; --side-active: rgba(255,255,255,.07);
  --radius: 14px; --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.05);
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px -6px rgba(15,23,42,.08);
  --shadow-lg: 0 10px 30px -10px rgba(15,23,42,.25);
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #090d1a; --bg-grad: radial-gradient(1200px 500px at 100% -10%, #1a1f45 0, transparent 60%);
    --surface: #10162a; --surface-2: #151c33; --surface-3: #1b2340; --border: #232c48; --border-strong: #2e3a5c;
    --text: #e8ebf5; --text-2: #c3c9db; --muted: #8b94ae;
    --brand: #818cf8; --brand-2: #a78bfa; --brand-ink: #0b1020; --brand-soft: #1e2350; --ring: rgba(129,140,248,.35);
    --ok: #34d399; --ok-soft: #0f2e25; --warn: #fbbf24; --warn-soft: #33270b; --bad: #f87171; --bad-soft: #3a1518;
    --side: #060914; --side-2: #0c1124; --side-active: rgba(255,255,255,.06);
    --shadow-sm: none; --shadow: 0 0 0 1px rgba(255,255,255,.02); --shadow-lg: 0 10px 30px -10px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #090d1a; --bg-grad: radial-gradient(1200px 500px at 100% -10%, #1a1f45 0, transparent 60%);
  --surface: #10162a; --surface-2: #151c33; --surface-3: #1b2340; --border: #232c48; --border-strong: #2e3a5c;
  --text: #e8ebf5; --text-2: #c3c9db; --muted: #8b94ae;
  --brand: #818cf8; --brand-2: #a78bfa; --brand-ink: #0b1020; --brand-soft: #1e2350; --ring: rgba(129,140,248,.35);
  --ok: #34d399; --ok-soft: #0f2e25; --warn: #fbbf24; --warn-soft: #33270b; --bad: #f87171; --bad-soft: #3a1518;
  --side: #060914; --side-2: #0c1124; --side-active: rgba(255,255,255,.06);
  --shadow-sm: none; --shadow: 0 0 0 1px rgba(255,255,255,.02); --shadow-lg: 0 10px 30px -10px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg-grad), var(--bg); background-attachment: fixed; color: var(--text);
  font: 14px/1.55 var(--font); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1 { font-size: 24px; line-height: 1.25; letter-spacing: -.02em; font-weight: 700; margin: 0; }
h2 { font-size: 15px; letter-spacing: -.01em; font-weight: 650; margin: 0 0 14px; }
.muted { color: var(--muted); } .mono { font-family: var(--mono); font-size: 12.5px; }
::selection { background: var(--ring); }

/* ---- Estructura ---- */
.shell { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }
.side { background: linear-gradient(180deg, var(--side-2), var(--side) 40%); color: var(--side-text);
  padding: 18px 12px 24px; display: flex; flex-direction: column; gap: 1px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 1px solid rgba(255,255,255,.04); scrollbar-width: thin; scrollbar-color: #2a3352 transparent; }
.logo { display: flex; align-items: center; gap: 11px; color: #fff; font-weight: 700; font-size: 16.5px; letter-spacing: -.01em; padding: 4px 10px 20px; }
.logo i { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-style: normal; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6 55%, #ec4899); box-shadow: 0 6px 16px -4px rgba(99,102,241,.6), inset 0 1px 0 rgba(255,255,255,.25); }
.side .label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--side-muted); padding: 16px 12px 6px; }
.nav { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 9px; color: inherit; text-decoration: none;
  font-weight: 500; transition: background .15s, color .15s; position: relative; }
.nav:hover { background: var(--side-active); color: #fff; }
.nav.active { background: linear-gradient(90deg, rgba(99,102,241,.22), rgba(99,102,241,.06)); color: #fff; }
.nav.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #818cf8; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav.active svg { opacity: 1; color: #a5b4fc; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 32px; background: color-mix(in srgb, var(--surface) 78%, transparent); backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px); border-bottom: 1px solid var(--border); }
.top > .muted { font-weight: 500; display: flex; align-items: center; gap: 8px; }
.top > .muted::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.who { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border); }
.content { padding: 30px 32px 72px; width: 100%; max-width: 1280px; }
.head { margin-bottom: 22px; }
.banner { background: var(--warn-soft); color: var(--warn); padding: 9px 32px; font-size: 13px; font-weight: 500; border-bottom: 1px solid var(--border); }

/* ---- Tarjetas y datos ---- */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 18px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 22px; margin-bottom: 18px; }
.grid .card { margin: 0; }
.card.stat { position: relative; overflow: hidden; }
.card.stat::after { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); opacity: .85; }
.stat .n { font-size: 30px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .t { color: var(--muted); font-size: 12.5px; font-weight: 500; margin-top: 4px; }
.meter { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 10px 0 6px; }
.meter > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.meter.hot > span { background: linear-gradient(90deg, #f97316, var(--bad)); }
.table-wrap { overflow-x: auto; margin: -4px -6px; padding: 0 6px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
thead th:first-child { border-top-left-radius: var(--radius-sm); } thead th:last-child { border-top-right-radius: var(--radius-sm); }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: color-mix(in srgb, var(--brand-soft) 35%, transparent); }
tr:last-child td { border-bottom: 0; }
td strong { font-weight: 600; }
td select { min-width: 130px; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn + .btn { margin-left: 4px; }
.empty { text-align: center; color: var(--muted); padding: 36px 20px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: var(--surface-3); color: var(--muted); white-space: nowrap; line-height: 1.5; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.info { background: var(--brand-soft); color: var(--brand); }

/* ---- Formularios y botones ---- */
form.row, div.row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 170px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px 12px; width: 100%; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--border-strong)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
.prefix { display: flex; } .prefix span { padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border-strong); border-right: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm); color: var(--muted); }
.prefix input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
textarea.editor { min-height: 440px; font-family: var(--mono); font-size: 13px; tab-size: 2; line-height: 1.6; }
.btn { font: inherit; font-weight: 600; font-size: 13.5px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: var(--radius-sm); padding: 9px 16px; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, box-shadow .15s, transform .08s; }
.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--brand) 30%, var(--border-strong)); }
.btn:active:not(:disabled) { transform: translateY(1px); }
a.btn { display: inline-block; text-decoration: none; }
.btn.primary { background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 88%, #fff), var(--brand)); border-color: var(--brand); color: var(--brand-ink);
  box-shadow: 0 1px 2px rgba(15,23,42,.1), 0 4px 12px -4px color-mix(in srgb, var(--brand) 60%, transparent), inset 0 1px 0 rgba(255,255,255,.18); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); } .btn.danger:hover { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 40%, var(--border-strong)); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible, .nav:focus-visible, .tool:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.crumbs button { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; font-weight: 500; padding: 2px 5px; border-radius: 6px; }
.crumbs button:hover { background: var(--brand-soft); }
.link { background: none; border: 0; color: var(--text); cursor: pointer; font: inherit; padding: 0; text-align: left; }
.link:hover { color: var(--brand); text-decoration: underline; }
.secret { background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px; }
.secret dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 8px 0 0; }
.secret dd { margin: 0; font-family: var(--mono); word-break: break-all; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; }

/* ---- Acceso ---- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(900px 520px at 15% 0%, rgba(99,102,241,.28), transparent 60%),
    radial-gradient(800px 520px at 100% 100%, rgba(236,72,153,.18), transparent 60%), #070b17; }
.login .card { width: 100%; max-width: 400px; padding: 34px 32px; border-radius: 18px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.55); border-color: transparent; }
.login .logo { justify-content: center; font-size: 20px; padding-bottom: 22px; }
.login form { display: grid; gap: 16px; }
.login .btn.primary { padding: 11px 16px; font-size: 14px; }

#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 20; max-width: calc(100vw - 36px); }
.toast { background: #0f172a; color: #f1f5f9; padding: 11px 16px 11px 14px; border-radius: 12px; box-shadow: var(--shadow-lg);
  font-weight: 500; border-left: 4px solid #34d399; animation: in .22s cubic-bezier(.2,.8,.2,1); }
.toast.err { border-left-color: #f87171; }
@keyframes in { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---- Inicio tipo cPanel ---- */
.home { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 20px; align-items: start; }
.home aside { position: sticky; top: 84px; }
.search { position: relative; margin-bottom: 20px; }
.search svg { position: absolute; left: 16px; top: 50%; width: 19px; height: 19px; transform: translateY(-50%); color: var(--muted); }
.search input { padding: 14px 16px 14px 46px; font-size: 15px; border-radius: var(--radius); box-shadow: var(--shadow); }
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.tool { display: flex; gap: 13px; align-items: flex-start; padding: 12px; border-radius: 12px; color: var(--text); text-decoration: none;
  border: 1px solid transparent; transition: background .15s, border-color .15s, transform .15s; }
.tool:hover { background: var(--surface-2); border-color: var(--border); transform: translateY(-1px); }
.tool strong { display: block; font-size: 14px; font-weight: 600; }
.tool small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.45; margin-top: 2px; }
.tool-icon { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h, 243) 75% 62%), hsl(calc(var(--h, 243) + 30) 70% 55%));
  box-shadow: 0 6px 14px -6px hsl(var(--h, 243) 70% 50% / .7), inset 0 1px 0 rgba(255,255,255,.25); }
.tool-icon svg { width: 21px; height: 21px; }
.tools-group h2 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 10px; font-weight: 700; }
.tools-group:nth-of-type(8n+1) { --h: 243; } .tools-group:nth-of-type(8n+2) { --h: 200; } .tools-group:nth-of-type(8n+3) { --h: 330; }
.tools-group:nth-of-type(8n+4) { --h: 28; } .tools-group:nth-of-type(8n+5) { --h: 160; } .tools-group:nth-of-type(8n+6) { --h: 270; }
.tools-group:nth-of-type(8n+7) { --h: 190; } .tools-group:nth-of-type(8n+8) { --h: 350; }
.usage + .usage { margin-top: 14px; }
.usage > span { font-weight: 600; font-size: 13px; }

/* ---- Controles ---- */
.stack { display: grid; gap: 14px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn svg { width: 16px; height: 16px; vertical-align: -3px; }
label.btn { display: inline-block; }
label.btn:focus-within { box-shadow: 0 0 0 4px var(--ring); }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.check input { width: auto; accent-color: var(--brand); box-shadow: none; }
.switch { display: inline-flex; gap: 10px; align-items: center; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 40px; height: 22px; border-radius: 99px; background: var(--border-strong); position: relative; transition: background .18s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform .18s cubic-bezier(.2,.8,.2,1); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 4px var(--ring); }
.switch input:disabled + span { opacity: .6; }
.tabs { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: 10px; }
.tabs button { font: inherit; font-weight: 500; border: 0; background: transparent; color: var(--muted); padding: 6px 14px; cursor: pointer; border-radius: 8px; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
a.badge { text-decoration: none; }

/* ---- Gráficas ---- */
.bars { display: flex; align-items: flex-end; gap: 5px; height: 190px; padding-bottom: 22px; }
.bar { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.bar span { width: 100%; max-width: 36px; background: linear-gradient(180deg, var(--brand-2), var(--brand)); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.bar small { position: absolute; bottom: -20px; font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.bar:hover span { filter: brightness(1.15); }
.spark { width: 100%; height: 130px; display: block; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; margin: 10px 0 6px; }
.spark .load { stroke: var(--brand); } .spark .mem { stroke: var(--ok); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 13px; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: -6px; }
.dot.load { background: var(--brand); } .dot.mem { background: var(--ok); }
pre.log { background: #0b1020; color: #c8d1e8; border-radius: 12px; padding: 16px; margin: 12px 0 0; max-height: 440px; overflow: auto;
  font: 12px/1.6 var(--mono); white-space: pre-wrap; word-break: break-all; border: 1px solid #1c2440; }

/* ---- Archivos ---- */
.dropzone.over { outline: 2px dashed var(--brand); outline-offset: -6px; background: var(--brand-soft); }
.drop-hint { font-size: 13px; margin: -4px 0 12px; }
.progress { height: 4px; background: rgba(255,255,255,.25); border-radius: 99px; margin-top: 6px; overflow: hidden; min-width: 200px; }
.progress span { display: block; height: 100%; width: 0; background: currentColor; transition: width .1s linear; }

/* ---- Planes, recursos ---- */
fieldset.features { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0; background: var(--surface-2);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 18px; }
fieldset.features legend { font-weight: 600; padding: 0 6px; font-size: 13px; }
.meter.mini { height: 5px; margin: 4px 0 2px; max-width: 140px; }
textarea.mono { font-family: var(--mono); font-size: 12.5px; }
tbody td:first-child { min-width: 160px; } /* que el nombre no quede aplastado por los botones */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 980px) {
  .home { grid-template-columns: 1fr; }
  .home aside { position: static; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 10px 16px; gap: 2px; border-right: 0; }
  .side .label { display: none; } .logo { padding: 4px 12px 4px 0; }
  .nav span { white-space: nowrap; } .nav.active::before { display: none; }
  .top { padding: 12px 16px; } .content { padding: 22px 16px 56px; } .banner { padding: 8px 16px; }
  .bar small { display: none; } .bars { padding-bottom: 0; }
  h1 { font-size: 21px; }
}
