/* ============================================================
   NinjaMIO · Tema "Terminal Moderno" (app-pro-004 aprobado)
   Panel claro y legible que habla terminal en los detalles:
   prompts $, paths ~/, prefijos [CRIT]/[WARN], LEDs, mono.
   Vanilla JS sin build step: este CSS es EL estilo final.
   ============================================================ */

/* ---------- Design tokens ---------- */
/* Fuentes locales (Inter + JetBrains Mono, woff2) — sin CDN de Google.
   Generado por scripts/fetch_fonts.py; los @font-face viven en fonts.css. */
@import url("../fonts/fonts.css");

:root {
  /* Acción (ASYS) */
  --primary: #0067E6;
  --primary-hover: #0056C2;
  --primary-active: #004AA8;
  --primary-glow: rgba(0, 103, 230, .25);
  --accent: #7C3AED;
  --accent-hover: #6D28D9;
  --accent2: #A78BFA;
  --accent-soft: rgba(124, 58, 237, .09);
  --grad: linear-gradient(120deg, #0067E6, #7C3AED);
  --grad-soft: linear-gradient(120deg, rgba(0, 103, 230, .07), rgba(124, 58, 237, .07));
  /* Terminal */
  --term: #0D1220;
  --term-2: #131A2E;
  --term-line: rgba(255, 255, 255, .07);
  --phosphor: #10B981;
  --phosphor-d: #0F7A4D;
  --phosphor-bg: rgba(16, 185, 129, .1);
  --amber: #F79009;
  /* Neutros ASYS */
  --ink: #0D1220;
  --slate: #45506A;
  --slate-soft: #7A869E;
  --bg: #EEF1F7;
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --border: #E2E7F0;
  --border-strong: #CFD7E4;
  --muted: #667085;
  --muted2: #7A869E;
  /* Estados */
  --ok: var(--ok);     --ok-bg: #E6F7F0;
  --warn: #92400E;   --warn-bg: #FEF3C7;
  --crit: #B42318;   --crit-bg: #FEE4E2;
  --off: #667085;    --off-bg: #F2F4F7;
  --info: #2563EB;   --info-soft: rgba(37, 99, 235, .10);
  /* Radios / sombras / ring verde terminal */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(13, 18, 32, .05);
  --shadow: 0 1px 2px rgba(13, 18, 32, .05), 0 4px 16px rgba(13, 18, 32, .06);
  --shadow-lg: 0 18px 46px rgba(13, 18, 32, .16);
  --ring: 0 0 0 3px rgba(16, 185, 129, .22);
  /* Tipografía */
  --font: "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  /* Aliases legado (migración transparente a los tokens nuevos) */
  --surface2: var(--surface-2);
  --surface3: var(--bg);
  --border2: var(--bg);
  --text: var(--ink);
  --ok-soft: rgba(6, 102, 71, .10);
  --warn-soft: rgba(217, 119, 6, .10);
  --crit-soft: rgba(220, 38, 38, .10);
  --off-soft: rgba(102, 112, 133, .14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: light; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  height: 100vh; overflow: hidden; display: flex; -webkit-font-smoothing: antialiased;
  line-height: 1.45; font-size: 14px;
}
.mono { font-family: var(--mono); }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px;
  border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--slate-soft); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Componentes terminal (mockup 004) ---------- */
/* Fondo del contenido: papel de terminal con grid de puntos sutil.
   Aplicado a los contenedores de scroll (background, no pseudo): no
   rompe clicks, no toca el sticky del topbar y las superficies opacas
   (tarjetas, tabla) lo tapan donde no debe verse. */
.dash-view, .remote-view, .detail-pane, .split, .agents-card {
  background-image: radial-gradient(rgba(69, 80, 106, .07) 1px, transparent 1px);
  background-size: 22px 22px;
}

/* Prompt + cursor parpadeante */
.prompt { font-family: var(--mono); font-size: 12px; color: var(--phosphor-d);
  font-weight: 700; line-height: 1; }
.prompt::after { content: "▊"; animation: blink 1.1s steps(1) infinite;
  margin-left: 1px; color: var(--phosphor-d); }
@keyframes blink { 50% { opacity: 0; } }

/* Breadcrumb terminal */
.path { display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 12px; color: var(--slate); white-space: nowrap; }
.path .home { color: var(--muted); }
.path .sep { color: var(--border-strong); }
.path .seg { color: var(--primary); font-weight: 700; }

/* Chip de comando de cabecera (tail -f …) */
.cmd { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono);
  font-size: 11px; color: var(--slate); background: var(--surface);
  border: 1px solid var(--border); border-radius: 99px; padding: 5px 13px; white-space: nowrap; }

/* Línea de log */
.logline { font-family: var(--mono); font-size: 11px; letter-spacing: .2px; color: var(--slate); }
.logline .ts { color: var(--slate-soft); }
.logline .tag { font-weight: 700; }
.logline .tag.crit { color: var(--crit); }
.logline .tag.warn { color: var(--warn); }
.logline .tag.info { color: var(--primary); }
.logline .tag.ok { color: var(--phosphor-d); }

/* LED de estado (● ◐ ○) */
.led { font-family: var(--mono); font-size: 11px; line-height: 1; }
.led.on { color: var(--phosphor-d); }
.led.av { color: var(--warn); }
.led.of { color: var(--slate-soft); }
.led.cr { color: var(--crit); }

/* Botón terminal (oscuro + glow verde + $) */
.btn.term { background: var(--term); border: 1px solid rgba(255, 255, 255, .14);
  color: #d5dcea; font-family: var(--mono); font-size: 12px; }
.btn.term:hover { border-color: var(--phosphor); color: var(--phosphor);
  box-shadow: 0 0 12px rgba(16, 185, 129, .25); }
.btn.term::before { content: "$"; color: var(--phosphor); font-weight: 700; }

/* Empty state terminal */
.term-empty { font-family: var(--mono); font-size: 12px; color: var(--slate);
  background: var(--surface); border: 1px dashed var(--border-strong);
  border-radius: var(--radius); padding: 22px 18px; text-align: center; }
.term-empty .pm { color: var(--phosphor-d); font-weight: 700; }
.term-empty b { color: var(--ink); }
.term-empty .te-sub { color: var(--muted); font-size: 11.5px; }
.term-empty .btn { margin-top: 10px; }

/* Caption de tablas (mono, tipo ls -la) */
caption { caption-side: top; text-align: left; font-family: var(--mono);
  font-size: 11px; color: var(--muted); padding: 9px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border); }

/* Cabecera de tarjeta con # (mono) */
.card-h h2::before { content: "#"; color: var(--phosphor-d); margin-right: 4px; }

/* Banner de incidencias del dashboard: log oscuro con borde ámbar */
.banner { display: flex; align-items: center; gap: 12px; background: var(--term);
  color: #d5dcea; border-radius: var(--radius); padding: 12px 16px;
  margin-bottom: 14px; border: 1px solid rgba(255, 255, 255, .07);
  box-shadow: 0 6px 24px rgba(13, 18, 32, .28); position: relative; overflow: hidden; }
.banner::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--amber); }
.banner .bi { width: 34px; height: 34px; border-radius: 10px;
  background: rgba(247, 144, 9, .15); color: var(--amber); display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  font-family: var(--mono); font-weight: 700; }
.banner .bt { font-weight: 700; font-size: 13px; font-family: var(--mono); }
.banner .bd { font-size: 12px; color: #8b97ac; margin-top: 1px; }
.banner .ba { margin-left: auto; display: flex; flex-shrink: 0; }
.banner .ba .btn { flex-shrink: 0; }

/* ---------- Iconos SVG inline (sin emoji) ---------- */
.ic { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Sidebar (terminal oscuro con glows) ---------- */
aside.side {
  width: 224px;
  background:
    radial-gradient(1100px 380px at 15% -10%, rgba(124, 58, 237, .2), transparent 60%),
    radial-gradient(800px 400px at 120% 110%, rgba(0, 103, 230, .16), transparent 55%),
    var(--term);
  border-right: 1px solid var(--term-line);
  display: flex; flex-direction: column; flex-shrink: 0; z-index: 20;
}
.side .logo { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px;
  border-bottom: 1px solid var(--term-line); color: #fff; }
.side .logo .ninja { width: 30px; height: 30px; border-radius: 9px; object-fit: contain;
  background: linear-gradient(135deg, var(--accent), #a855f7); padding: 5px;
  box-shadow: 0 0 18px rgba(124, 58, 237, .5); }
.side .logo .brand { font-weight: 800; font-size: 15px; letter-spacing: -.2px;
  font-family: var(--mono); }
.side .logo .brand .p { color: var(--phosphor); }
.side .logo .brand .c { color: #fff; }
.side .logo .brand .d { color: #5b6a85; }
.side .logo .ver { margin-left: auto; font-family: var(--mono); font-size: 9px;
  color: #5b6a85; border: 1px solid var(--term-line); border-radius: 99px;
  padding: 1px 7px; white-space: nowrap; }
.side .nav-group { padding: 14px 16px 6px; font-size: 10px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase; color: #5b6a85;
  font-family: var(--mono); }
.side nav { flex: 1; padding: 0 10px 8px; overflow-y: auto; }
.side nav a { display: flex; align-items: center; gap: 11px; padding: 8.5px 11px; border-radius: 9px;
  color: #a8b3c7; text-decoration: none; font-size: 13.5px;
  font-weight: 500; margin-bottom: 2px; position: relative; transition: background .12s, color .12s; }
.side nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side nav a.on { background: var(--grad); color: #fff; font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 103, 230, .4); }
.side nav a.on::before { content: "▸"; font-family: var(--mono); color: var(--phosphor);
  font-weight: 700; font-size: 11px; }
.side nav a.on .nav-badge { background: rgba(255, 255, 255, .25); color: #fff; }
.side nav a .ic { width: 18px; height: 18px; flex-shrink: 0; }
.side nav a .nav-badge { margin-left: auto; background: rgba(254, 243, 199, .16);
  color: #fde68a; font-size: 10.5px; font-weight: 700; border-radius: 999px;
  padding: 1px 7px; min-width: 18px; text-align: center; font-family: var(--mono); }
.side .user { padding: 14px 16px; border-top: 1px solid var(--term-line);
  display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.side .user .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--grad);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff;
  flex-shrink: 0; box-shadow: 0 2px 10px rgba(124, 58, 237, .5); }
.side .user > div { color: #fff; font-weight: 600; font-size: 12.5px; }
.side .user .m { color: #5b6a85; font-size: 11px; font-weight: 400; }
.side .user .out { margin-left: auto; background: none; border: none; color: #5b6a85; padding: 6px;
  border-radius: 7px; font-size: 13px; }
.side .user .out:hover { background: rgba(220, 38, 38, .15); color: #f87171; }

/* ---------- Main / topbar ---------- */
main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 22px;
  background: rgba(255, 255, 255, .85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.topbar h1 { font-size: 16.5px; font-weight: 700; letter-spacing: -.2px; }
.topbar .crumb { display: flex; align-items: center; gap: 8px; min-width: 0; }
/* La vista Equipos sustituye la topbar por su cabecera de página (mockup 006) */
body.view-agents .topbar { display: none; }
.menu-btn { display: none; background: none; border: 1px solid var(--border); border-radius: 9px;
  color: var(--text); font-size: 19px; line-height: 1; padding: 3px 10px; flex-shrink: 0; }
.menu-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Cabecera de página (solo vista Equipos) ---------- */
.page-h { display: none; padding: 18px 24px 0; align-items: flex-end; gap: 16px; flex-wrap: wrap; flex-shrink: 0; }
body.view-agents .page-h { display: flex; }
.page-h .t { font-size: 20px; font-weight: 700; letter-spacing: -.2px; }
.page-h .st { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.page-h .st b { color: var(--text); font-weight: 600; }
.page-h .st b.ok { color: var(--ok); }
.page-h .st b.warn { color: var(--warn); }
.page-h .st b.crit { color: var(--crit); }
.page-h .fresh { margin-left: auto; display: flex; align-items: center; gap: 7px; background: #fff;
  border: 1px solid var(--border); border-radius: 99px; padding: 6px 13px; font-size: 12px;
  color: var(--muted); box-shadow: 0 1px 2px rgba(16, 24, 40, .04); white-space: nowrap; }
.page-h .fresh .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 3px rgba(18, 183, 106, .15); }
.page-h .fresh.off .dot { background: var(--crit); box-shadow: 0 0 0 3px rgba(220, 38, 38, .15); }
.page-h .fresh .agt-fresh.off { color: var(--crit); font-weight: 600; }
.page-h .tools { width: 100%; display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.page-h .search { flex: 1; max-width: 380px; position: relative; }
.page-h .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none; }
.page-h .search input { width: 100%; padding: 9px 12px 9px 34px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 13px; font-family: inherit; background: #fff; outline: none;
  transition: border .15s, box-shadow .15s; }
.page-h .search input::placeholder { color: var(--muted2); }
.page-h .search input:focus { border-color: var(--phosphor-d); box-shadow: var(--ring); }
.page-h .org { padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff;
  font-size: 13px; font-family: inherit; color: var(--muted); cursor: pointer; max-width: 240px; }
.page-h .org:focus { outline: none; border-color: var(--accent); }
.page-h .agt-count { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.page-h .agt-count .rec-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); vertical-align: middle; margin-right: 6px;
  animation: rec-pulse 1s ease-in-out infinite; }
@keyframes rec-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; background: var(--surface);
  border: 1px solid var(--border); border-color: var(--border-strong); color: var(--slate);
  font-size: 13px; font-weight: 600;
  padding: 7px 14px; border-radius: 9px; transition: all .15s; }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff;
  box-shadow: 0 3px 12px rgba(0, 103, 230, .32); }
.btn.primary:hover { filter: brightness(1.08); box-shadow: 0 4px 16px rgba(0, 103, 230, .42); color: #fff; }
.btn.primary:active { filter: brightness(.96); }
.btn.primary:disabled { background: #9db4d6; box-shadow: none; }
.btn.danger { color: var(--crit); border-color: #f3c1c1; }
.btn.danger:hover { background: var(--crit-soft); border-color: var(--crit); color: var(--crit); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
/* Variantes del mockup 006 (detalle expandido) */
.btn.p { background: var(--grad); border-color: transparent; color: #fff;
  box-shadow: 0 2px 8px rgba(0, 103, 230, .3); }
.btn.p:hover { filter: brightness(1.08); color: #fff; }
.btn.d { color: var(--crit); border-color: var(--crit-bg); }
.btn.d:hover { background: var(--crit-bg); color: var(--crit); }
.btn.x { padding: 7px 10px; border-radius: 99px; color: var(--muted); }
.btn.x:hover { background: var(--off-bg); color: var(--text); border-color: var(--border); }

/* ---------- Pills / badges / dots ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700;
  padding: 2.5px 9px; border-radius: 999px; letter-spacing: .3px; text-transform: uppercase; white-space: nowrap; }
.pill.online, .pill.running, .pill.cmd-done, .pill.sec-on, .pill.bot-on { color: var(--ok); background: var(--ok-soft); }
.pill.warning, .pill.cmd-pending { color: var(--warn); background: var(--warn-soft); }
.pill.offline, .pill.cmd-failed, .pill.sec-off, .pill.bot-off { color: var(--off); background: var(--off-soft); }
.pill.critical, .pill.sev-critica { color: var(--crit); background: var(--crit-soft); }
.pill.sev-alta { color: var(--warn); background: var(--warn-soft); }
.pill.sev-media { color: var(--info); background: var(--info-soft); }
.pill.org { color: var(--accent); background: var(--accent-soft); }
.pill.ok { color: var(--ok); background: var(--ok-soft); }
.pill.warn { color: var(--warn); background: var(--warn-soft); }
.pill.crit { color: var(--crit); background: var(--crit-soft); }
.pill.off { color: var(--off); background: var(--off-soft); }
.pill.stopped { color: var(--crit); background: var(--crit-soft); }
.pill.lang-powershell { color: var(--info); background: var(--info-soft); }
.pill.lang-bat { color: var(--warn); background: var(--warn-soft); }
.pill.cmd-running { color: var(--info); background: var(--info-soft); }
.pill.thresh { color: var(--info); background: var(--info-soft); }
.pill.plain { color: var(--muted); background: var(--surface3); }
.pill.sec-on { color: var(--ok); background: var(--ok-soft); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.online { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.warning { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.dot.offline { background: var(--off); }
.dot.critical { background: var(--crit); box-shadow: 0 0 0 3px var(--crit-soft); }

/* ---------- Split master-detail (resto de vistas) ---------- */
.split { flex: 1; display: flex; min-height: 0; }
body.view-dashboard .split, body.view-remote .split, body.view-agents .split { display: none; }

.list-pane { width: 336px; border-right: 1px solid var(--border); background: var(--surface);
  overflow: auto; flex-shrink: 0; display: flex; flex-direction: column; }
body.view-orgs .list-pane, body.view-config .list-pane, body.view-alerts .list-pane,
body.view-scripts .list-pane, body.view-groups .list-pane,
body.view-deployments .list-pane, body.view-packages .list-pane { display: none; }

.list-pane .seg { display: flex; gap: 5px; padding: 13px 14px 10px; flex-shrink: 0; }
.seg button { flex: 1; font-size: 11.5px; padding: 5.5px 0; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); font-weight: 600; }
.seg button:hover { border-color: var(--accent2); color: var(--text); }
.seg button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.seg-count { padding: 2px 14px 10px; color: var(--muted); font-size: 11.5px; flex-shrink: 0; }

/* Cabecera ordenable */
.list-head { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 6px;
  padding: 8px 14px 8px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.lh-btn { background: none; border: none; color: var(--muted); font-size: 10px; text-transform: uppercase;
  letter-spacing: .5px; font-weight: 700; cursor: pointer; padding: 2px 0; font-family: inherit;
  display: flex; align-items: center; gap: 4px; }
.lh-btn:hover { color: var(--text); }
.lh-btn.on { color: var(--accent); font-weight: 700; }
.lh-btn.lh-right { justify-content: flex-end; }
.lh-arrow { font-size: 9px; }

/* Filas de la lista */
#list { flex: 1; overflow-y: auto; }
.row { padding: 11px 14px; border-bottom: 1px solid var(--border2); cursor: pointer; transition: background .1s; }
.row:hover { background: var(--surface2); }
.row:focus-visible { outline: 2px solid var(--phosphor-d); outline-offset: -2px; }
.row.sel { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.row .r1 { display: flex; align-items: center; gap: 9px; }
.row .r1 b { font-size: 13.5px; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.row .r1 .pill { font-size: 9.5px; }
.row .r1-side { margin-left: auto; display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.row .mbars { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 8px; }
.mbar { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mbar .bar { flex: 1; height: 5px; border-radius: 999px; background: var(--surface3); overflow: hidden; }
.mbar .bar i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.mbar .bar i.hi { background: var(--warn); }
.mbar .bar i.crit { background: var(--crit); }
.mbar span { font-family: var(--mono); font-size: 10.5px; color: var(--muted); width: 32px; text-align: right; }
.mbar span.hi { color: var(--warn); }
.mbar span.crit { color: var(--crit); }
.mbar.empty span { color: var(--off); }
.row .meta { font-size: 11px; color: var(--muted); margin-top: 7px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; display: flex; align-items: center; gap: 7px; }
.row .meta .sep { color: var(--border); }

/* Checkbox de selección múltiple (acciones masivas) */
.row-cb { display: inline-flex; align-items: center; flex-shrink: 0; cursor: pointer; }
.row-cb input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.row.checked { background: var(--accent-soft); }
.row.checked:hover { background: var(--accent-soft); }

/* Barra de acciones masivas (fija abajo de la lista) */
.bulk-bar { position: sticky; bottom: 0; z-index: 8; display: flex; align-items: center;
  gap: 10px; flex-wrap: wrap; padding: 10px 12px; margin-top: 8px;
  background: var(--surface); border: 1px solid var(--accent); border-radius: 12px 12px 0 0;
  box-shadow: 0 -6px 18px rgba(16, 24, 40, .08); }
.bulk-bar[hidden] { display: none; }
.bulk-bar .bulk-info { font-size: 12.5px; color: var(--text); white-space: nowrap; }
.bulk-bar .bulk-info b { color: var(--accent); font-family: var(--mono); }
.bulk-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.bulk-bar .btn.sm { padding: 4px 9px; font-size: 11.5px; }
.bulk-target { font-size: 12.5px; padding: 8px 11px; border-radius: 9px; background: var(--accent-soft);
  border: 1px solid rgba(124, 58, 237, .25); color: var(--text); }
.bulk-target b { color: var(--accent); font-family: var(--mono); }
.bulk-target.warn { background: var(--warn-soft); border-color: rgba(217, 119, 6, .25); color: var(--warn); }
.bulk-cb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.bulk-cb input { width: 15px; height: 15px; accent-color: var(--accent); }

/* KPIs mini-tarjetas de la lista (barra superior de la vista Equipos, mockup 006) */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px;
  padding: 14px 14px 12px; border-bottom: 1px solid var(--border); background: var(--surface); flex-shrink: 0; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; cursor: pointer; display: flex; align-items: center; gap: 11px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  transition: border .15s, box-shadow .15s, transform .1s; }
.kpi:hover { border-color: var(--border2); box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 58, 237, .1);
  background: var(--accent-soft); }
.kpi .ico { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; }
.kpi .ico.t { background: var(--accent-soft); color: var(--accent); }
.kpi .ico.on { background: var(--ok-bg); color: var(--ok); }
.kpi .ico.av { background: var(--warn-bg); color: var(--warn); }
.kpi .ico.of { background: var(--off-bg); color: var(--slate); }
.kpi .ico.al { background: var(--crit-bg); color: var(--crit); }
.kpi .n { font-family: var(--mono); font-size: 19px; font-weight: 700; line-height: 1; }
.kpi .l { font-size: 9.5px; letter-spacing: .4px; color: var(--slate); margin-top: 3px;
  font-family: var(--mono); text-transform: none; }
.kpi .dlt { font-size: 10.5px; font-weight: 600; margin-left: auto; display: flex; align-items: center; gap: 2px; }
.kpi .dlt.up { color: var(--crit); }
.kpi .dlt.ok { color: var(--ok); }

/* ---------- Vista Equipos: tabla con expansión inline (mockup 005/006) ---------- */
.agents-card { display: none; }
body.view-agents .agents-card { display: flex; flex: 1; min-height: 0; flex-direction: column;
  margin: 16px 24px 24px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }

/* Tabla */
.agt-tbl-wrap { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; }
.agt-table { width: 100%; border-collapse: collapse; }
.agt-table thead th { position: sticky; top: 0; z-index: 2; text-align: left; font-size: 10px;
  text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700;
  padding: 11px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2);
  white-space: nowrap; user-select: none; transition: color .12s; }
.agt-table thead th:hover { color: var(--accent); }
.agt-table thead th.th-ch { width: 56px; }
.agt-table thead th[data-key] { cursor: pointer; }
.agt-table thead th[data-key] .th-sort { margin-left: 4px; font-size: 9px; color: var(--muted2); }
.agt-table thead th.on { color: var(--accent); }
.agt-table thead th.on .th-sort { color: var(--accent); }
.agt-table thead th.num, .agt-table tbody td.num { text-align: right; }
.agt-table tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border2); vertical-align: middle;
  transition: background .15s; }
.agt-table tbody tr:nth-child(4n+3) td { background: var(--surface-2); } /* zebra sutil entre filas + detail rows */
.agt-table tbody tr.row { cursor: pointer; border-bottom: none; padding: 0;
  transition: background-color .15s ease; }
.agt-table tbody tr.row:hover td { background: var(--grad-soft); }
.agt-table tbody tr.row:hover .chev-b { background: var(--accent-soft); color: var(--accent); }
.agt-table tbody tr.row:focus-visible td { outline: 2px solid var(--phosphor-d); outline-offset: -2px; }
.agt-table tbody tr.row.checked td, .agt-table tbody tr.row.checked:hover td { background: var(--accent-soft); }
.agt-table tbody tr.row.open td { background: var(--accent-soft); border-bottom-color: transparent; }
.agt-table tbody tr.row.open:hover td { background: var(--accent-soft); }
.agt-table tr.skel { cursor: default; pointer-events: none; }
.agt-table td.td-ch { width: 56px; white-space: nowrap; }
/* Chevron circular: hover lila suave, abierto lila sólido + girado 180º */
.chev-b { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center;
  justify-content: center; color: var(--muted); font-size: 9px;
  transition: background .15s, color .15s, transform .2s; }
.agt-table tbody tr.row.open .chev-b { transform: rotate(180deg); background: var(--accent); color: #fff; }
.host { font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.host .ip { color: var(--muted); font-weight: 400; font-size: 11px; }
/* Alias visible: nombre en negrita + hostname secundario entre paréntesis */
.host .a-alias { font-weight: 700; color: var(--text); }
.host .a-host { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.hb { font-size: 11.5px; white-space: nowrap; color: var(--muted); }
.hb.ok { color: var(--ok); }
.hb.old { color: var(--warn); }
.hb.dead { color: var(--crit); }
/* Estado: LED terminal ●◐○ + texto (mockup 006/004) */
.st { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.st .pt { width: 8px; height: 8px; border-radius: 50%; }
.st .led { font-family: var(--mono); font-size: 11px; line-height: 1; }
.st.on .led { color: var(--phosphor-d); }
.st.av .led { color: var(--warn); }
.st.of .led { color: var(--slate-soft); }
.st.cr .led { color: var(--crit); }
.st.on .pt { background: var(--ok); box-shadow: 0 0 0 3px rgba(18, 183, 106, .15); }
.st.av .pt { background: var(--warn); box-shadow: 0 0 0 3px rgba(247, 144, 9, .15); }
.st.of .pt { background: var(--off); }
.st.cr .pt { background: var(--crit); box-shadow: 0 0 0 3px rgba(217, 45, 32, .15); }
/* Barras de métrica: 6px, gradiente accent, ámbar si >90%, grow en cada render */
.met-cell { display: flex; align-items: center; gap: 9px; justify-content: flex-end; }
.met-cell .bar { height: 6px; border-radius: 99px; background: var(--border2); overflow: hidden; min-width: 64px; }
.met-cell .bar i { display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent2), var(--accent)); animation: grow .5s ease-out; }
.met-cell .bar i.w { background: linear-gradient(90deg, #fbbf24, var(--amber)); }
.met-cell .v { font-family: var(--mono); font-size: 11.5px; min-width: 36px; text-align: right; }
@keyframes grow { from { width: 0; } }
.alerts { font-size: 11px; font-weight: 600; color: var(--crit); background: var(--crit-bg);
  padding: 2px 9px; border-radius: 99px; display: inline-block; min-width: 22px; text-align: center;
  cursor: pointer; transition: filter .12s; }
.alerts:hover { filter: brightness(.96); }
.alerts.none { background: transparent; color: var(--muted); font-weight: 400; }
.grp { font-size: 10px; font-weight: 600; padding: 2px 9px; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent-hover); white-space: nowrap; }

/* Fila "Mostrar más" de la pila de equipos (>50 filtrados) */
.agt-table tbody tr.more-row td { text-align: center; background: var(--surface-2);
  padding: 10px 16px; border-bottom: 1px solid var(--border); }
.more-inner { display: inline-flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 12px; }
.more-inner .btn { flex-shrink: 0; }

/* Fila expandida: detalle inline a lo ancho de la tabla (mockup 006) */
tr.detail-row td { padding: 0; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.det { padding: 18px 20px 20px; border-top: 2px solid var(--accent); }
.det-anim { animation: det-in .18s ease; }
@keyframes det-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.det-h { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.det-h .nm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 15px; font-weight: 700; letter-spacing: -.2px; font-family: var(--mono); }
.det-h .nm .nm-prompt { color: var(--phosphor-d); }
.det-h .nm .nm-a { font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.det-h .nm .nm-h { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.det-h .nm-sub { color: var(--muted); font-size: 11.5px; margin-top: 1px; }
/* Lápiz de edición del nombre visible: aparece al pasar el ratón */
.det-h .nm .alias-pen { padding: 3px 7px; border-radius: 8px; flex-shrink: 0;
  border-color: transparent; background: none; opacity: 0; transition: opacity .15s, background .15s; }
.det-h .nm:hover .alias-pen, .det-h .nm .alias-pen:focus-visible { opacity: 1; }
.alias-input { font-family: var(--font); font-size: 14px; font-weight: 600; color: var(--text);
  padding: 4px 9px; border: 1px solid var(--phosphor-d); border-radius: 8px; background: #fff;
  outline: none; box-shadow: var(--ring); width: min(300px, 100%); }
.det-h .dsub { color: var(--muted); font-size: 12px; margin-top: 3px; display: flex; align-items: center;
  gap: 8px; flex-wrap: wrap; }
.det-h .acts { margin-left: auto; display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
.det-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px;
  overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; scrollbar-width: thin; }
.det-tabs::-webkit-scrollbar { height: 4px; }
.det-tabs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
.det-tabs button { border: none; background: none; padding: 9px 12px; font-size: 12.5px; font-weight: 500;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; font-family: inherit;
  white-space: nowrap; transition: color .12s; }
.det-tabs button:hover { color: var(--text); }
.det-tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.det-body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; }
.det-body .col2 { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.det .panel { padding: 12px 14px; margin-bottom: 12px; }
.det .panel h4 { font-size: 10px; }
.kpis-mini { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.det .mini { background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px; text-align: center; box-shadow: 0 1px 2px rgba(16, 24, 40, .03); }
.det .mini .l { font-size: 8.5px; letter-spacing: .4px; color: var(--muted);
  font-family: var(--mono); text-transform: none; }
.det .mini .v { font-family: var(--mono); font-size: 14px; font-weight: 600; }
.det .mini .v.hi { color: var(--warn); }
.det .chart-wrap { height: 110px; }
.det .chart-wrap canvas { width: 100%; height: 100%; }
.det #alerts-box { display: flex; flex-direction: column; gap: 8px; }
.det .alert-card { border: 1px solid var(--crit-bg); background: var(--crit-bg); border-radius: 10px;
  padding: 10px 12px; font-size: 12px; color: var(--crit); display: flex; align-items: center;
  gap: 8px; margin-bottom: 8px; }
.det .alert-card.ok { border-color: var(--ok-bg); background: var(--ok-bg); color: var(--ok); }
.det .sec-title { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted);
  font-weight: 700; margin: 12px 0 8px; }
.row-ph { border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; font-size: 12px;
  display: flex; justify-content: space-between; gap: 10px; color: var(--muted);
  background: var(--surface); margin-bottom: 6px; }
.row-ph b { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-ph span { flex-shrink: 0; white-space: nowrap; }
.det .detail-actions .btn { padding: 5px 11px; font-size: 12px; }

/* ---------- Detalle (contenido principal) ---------- */
.detail-pane { flex: 1; overflow-y: auto; padding: 22px 26px; min-width: 0; }
.detail-pane .dhead { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.detail-pane .dhead h2 { font-size: 21px; font-weight: 700; letter-spacing: -.3px; }
.detail-pane .dsub { color: var(--muted); font-size: 12.5px; margin-top: 3px; display: flex;
  align-items: center; gap: 8px; flex-wrap: wrap; }
.dhead-btns { margin-left: auto; display: flex; gap: 8px; flex-shrink: 0; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Pestañas del detalle */
.seg.tabs { display: flex; gap: 4px; max-width: 640px; margin: 0 0 18px; padding: 0;
  border-bottom: 1px solid var(--border); }
.seg.tabs button, .tab-btn { flex: none; background: none; border: none; padding: 9px 14px; font-size: 13px;
  font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
  border-radius: 0; }
.seg.tabs button:hover, .tab-btn:hover { color: var(--text); border-color: transparent; }
.seg.tabs button.on, .tab-btn.on { background: transparent; border-color: var(--accent); color: var(--accent); }
.tab-pane { display: none; min-height: 120px; }
.tab-pane.on { display: block; }

/* Paneles / tarjetas genéricas */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.panel h4 { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .7px;
  font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.panel h4 .n { color: var(--accent); font-family: var(--mono); text-transform: none; letter-spacing: 0; }
.chart-wrap { position: relative; height: 230px; }
.chart-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Tablas */
.mtable, .cmd-tbl, .remote-tbl, .disk-tbl, .dep-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mtable th, .cmd-tbl th, .remote-tbl th, .disk-tbl th, .dep-tbl th { text-align: left; color: var(--muted);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; padding: 7px 9px;
  border-bottom: 1px solid var(--border); font-weight: 700; }
.mtable td, .cmd-tbl td, .remote-tbl td, .disk-tbl td, .dep-tbl td { padding: 7px 9px;
  border-bottom: 1px solid var(--border2); vertical-align: middle; }
.mtable tr:last-child td, .cmd-tbl tr:last-child td, .remote-tbl tr:last-child td, .dep-tbl tr:last-child td { border-bottom: none; }
.mtable tr:hover td, .cmd-tbl tr:hover td, .dep-tbl tr:hover td { background: var(--surface2); }
.mtable .mempty { color: var(--muted); text-align: center; padding: 14px; }
.cmd-tbl .c-date, .remote-tbl .c-date { color: var(--muted); white-space: nowrap; }
.cmd-tbl .c-host { font-weight: 600; white-space: nowrap; }
.cmd-tbl .c-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-tbl .c-exit { text-align: right; color: var(--muted); }
.cmd-tbl .c-out td { background: var(--surface2); padding: 0; border-bottom: 1px solid var(--border); }
.remote-tbl td:last-child { text-align: right; }
.cmd-pre { max-height: 300px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  font-family: var(--mono); font-size: 11.5px; color: var(--text); padding: 12px 14px; line-height: 1.55; }

/* Wrapper de tablas con scroll horizontal (móvil) */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl-wrap table { min-width: 640px; }
.tbl-wrap.tbl-short table { min-width: 480px; }

/* Despliegues (campañas masivas) */
.dep-tbl { min-width: 800px; }
.dep-tbl .dep-row { cursor: pointer; }
.dep-tbl .dep-row:hover td { background: var(--accent-soft); }
.dep-tbl .dep-row .c-actions .chev-b { width: 20px; height: 20px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 13px; color: var(--muted);
  background: var(--surface3); flex-shrink: 0; transition: all .12s; }
.dep-tbl .dep-row:hover .chev-b { background: var(--accent); color: #fff; }
.dep-tbl th[data-depsort] { cursor: pointer; user-select: none; white-space: nowrap; }
.dep-tbl th[data-depsort]:hover { color: var(--accent); }
.dep-tbl th .th-sort { margin-left: 4px; font-size: 9px; color: var(--muted2); }
.dep-tbl th[data-depsort] .th-sort { color: var(--accent); }
.dep-id { color: var(--accent); font-size: 11px; white-space: nowrap; }
.dep-label { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dep-prog { min-width: 150px; }
.dep-bar { display: flex; gap: 2px; height: 6px; border-radius: 999px; background: var(--surface3);
  overflow: hidden; min-width: 60px; }
.dep-bar i { display: block; height: 100%; }
.dep-bar i.dep-ok { background: var(--ok); }
.dep-bar i.dep-fail { background: var(--crit); }
.dep-bar.lg { height: 10px; margin-bottom: 10px; }
.dep-nm { font-size: 10.5px; color: var(--muted); margin-left: 8px; white-space: nowrap; }
.dep-fail { color: var(--crit); font-weight: 600; }
.dep-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
td.c-actions { text-align: right; white-space: nowrap; }

/* Pill de campaña en curso: ámbar pulsante (el resto usan ok/crit) */
.pill.dep-on { color: var(--warn); background: var(--warn-soft);
  animation: dep-pulse 1.6s ease-in-out infinite; }
@keyframes dep-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

/* Salida de comando del detalle: truncada con tooltip (patrón ejecuciones) */
.dep-out { position: relative; max-width: 240px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--text); cursor: help; }
.dep-out.muted { color: var(--off); cursor: default; }
.dep-out::after { content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 6px);
  z-index: 60; background: var(--term); color: #e8eaf2; border-radius: 8px; font-size: 11px;
  line-height: 1.5; padding: 8px 10px; box-shadow: var(--shadow-lg);
  white-space: pre-wrap; word-break: break-word; max-width: 420px; min-width: 220px;
  font-family: var(--mono); opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .15s, transform .15s; pointer-events: none; }
.dep-out:hover::after { opacity: 1; visibility: visible; transform: translateY(0); }

/* Pill de estado junto al nombre en la cabecera del detalle */
.detail-pane .dhead h2 .pill { font-size: 10.5px; margin-left: 8px; vertical-align: middle; }

/* Empty state con CTA (patrón catálogo de scripts) */
.dep-empty { display: flex; flex-direction: column; align-items: center; }
.dep-empty .btn { margin-top: 6px; }
/* Catálogo de software (vista Software) */
.pkg-empty { display: flex; flex-direction: column; align-items: center; }
.pkg-empty .btn { margin-top: 6px; }
.pkg-tbl { min-width: 800px; }
.pkg-tbl .pkg-row { cursor: pointer; }
.pkg-tbl .pkg-row:hover td { background: var(--accent-soft); }
.pkg-tbl .pkg-row .td-ch .chev-b { width: 20px; height: 20px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 9px; color: var(--muted);
  background: var(--surface3); flex-shrink: 0; transition: all .12s; }
.pkg-tbl .pkg-row:hover .chev-b { background: var(--accent); color: #fff; }
.pkg-tbl .pkg-row.open td { background: var(--accent-soft); }
.pkg-tbl .pkg-row.open .chev-b { background: var(--accent); color: #fff; }
.pkg-tbl tr.detail-row td { background: var(--surface2); }
.pkg-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pkg-name .host { white-space: nowrap; }
.pkg-file, .pkg-args { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.pkg-detect { white-space: nowrap; }
.pkg-size { white-space: nowrap; }
.pkg-det-grid { margin-bottom: 14px; }
.pkg-args-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 8px; flex-wrap: wrap; }
.pkg-args-head .sec-title { margin: 0; }
.pkg-args-box { background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
  padding: 12px 14px; font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.pkg-det-h .nm .pill { font-size: 9.5px; }
.log-tail-title { margin: 14px 0 8px; }
.log-tail { background: var(--surface2); border: 1px solid var(--border); border-radius: 9px; }
.sw-item .btn.sm { flex-shrink: 0; }

/* Propiedades clave-valor */
.props { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 26px; font-size: 13px; }
.props div { display: flex; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--border2);
  padding: 7px 0; }
.props span:first-child { color: var(--muted); }
.props span:last-child { font-weight: 500; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.props select.org-move { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 12px; font-family: inherit; padding: 3px 7px; max-width: 230px; }
.props select.org-move:focus { outline: none; border-color: var(--accent); }

/* Mini KPIs de fila — el estilo actual vive en la sección de la vista Equipos
   (.kpis-mini / .det .mini, mockup 005). Este bloque legacy se retiró. */

/* ---------- Dashboard (Inicio) ---------- */
.dash-view, .remote-view { flex: 1; min-height: 0; overflow: auto; padding: 20px 26px; }
.dash-sub { color: var(--muted); font-size: 12.5px; }

/* Cabecera del dashboard: subtítulo + pill fresh + refrescar + accesos rápidos */
.dash-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.dash-head .dash-sub { margin-right: auto; }
.dash-head .fresh { display: flex; align-items: center; gap: 7px; background: #fff;
  border: 1px solid var(--border); border-radius: 99px; padding: 6px 13px; font-size: 12px;
  color: var(--muted); box-shadow: 0 1px 2px rgba(16, 24, 40, .04); white-space: nowrap; }
.dash-head .fresh .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 3px rgba(18, 183, 106, .15); }
.dash-head .fresh.off .dot { background: var(--crit); box-shadow: 0 0 0 3px rgba(220, 38, 38, .15); }
.dash-head .fresh.off { color: var(--crit); font-weight: 600; }
.dash-refresh { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border);
  background: #fff; color: var(--muted); display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .2s; }
.dash-refresh:hover { color: var(--accent); border-color: var(--accent); transform: rotate(180deg); }
.dash-shortcuts { display: flex; gap: 6px; flex-wrap: wrap; }

.dash-note { color: var(--muted); font-size: 11.5px; margin: 6px 0 2px; }

/* KPIs mini-tarjetas D2 (icono + número + etiqueta + delta), como Equipos */
.dash-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.dash-kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; cursor: pointer; display: flex; align-items: center; gap: 11px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  transition: border .15s, box-shadow .15s, transform .1s; }
.dash-kpi:hover { border-color: var(--border2); box-shadow: var(--shadow); transform: translateY(-1px); }
.dash-kpi .ico { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; }
.dash-kpi .ico.t { background: var(--accent-soft); color: var(--accent); }
.dash-kpi .ico.on { background: var(--ok-bg); color: var(--ok); }
.dash-kpi .ico.av { background: var(--warn-bg); color: var(--warn); }
.dash-kpi .ico.al { background: var(--crit-bg); color: var(--crit); }
.dash-kpi .ico.sc { background: var(--accent-soft); color: var(--accent); }
.dash-kpi .ico.up { background: var(--ok-bg); color: var(--ok); }
.dash-kpi .n { font-family: var(--mono); font-size: 19px; font-weight: 700; line-height: 1; }
.dash-kpi .l { font-size: 9.5px; letter-spacing: .4px; color: var(--slate); margin-top: 3px;
  font-family: var(--mono); text-transform: none; }
.dash-kpi .dlt { font-size: 10.5px; font-weight: 600; margin-left: auto; display: flex; align-items: center; gap: 2px; }
.dash-kpi .dlt.up { color: var(--crit); }
.dash-kpi .dlt.ok { color: var(--ok); }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding-bottom: 30px; }
.dash-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); }
.dash-card h3 { font-size: 12px; letter-spacing: .6px; color: var(--muted); text-transform: uppercase;
  margin-bottom: 8px; display: flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
.dash-card h3 .more { margin-left: auto; color: var(--accent); cursor: pointer; font-size: 11px;
  letter-spacing: .3px; text-transform: none; font-weight: 600; flex-shrink: 0; }
.dash-card h3 .more:hover { text-decoration: underline; }

/* Tarjeta "Requiere atención": filas de acción por urgencia */
.dash-attn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.dash-attn { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 10px;
  border: 1px solid; cursor: pointer; font-size: 12.5px; transition: filter .12s; }
.dash-attn:hover { filter: brightness(.97); }
.dash-attn.crit { background: var(--crit-bg); border-color: rgba(220, 38, 38, .3); color: var(--crit); }
.dash-attn.warn { background: var(--warn-bg); border-color: rgba(217, 119, 6, .3); color: var(--warn); }
.dash-attn.off { background: var(--off-soft); border-color: rgba(152, 162, 179, .4); color: var(--slate); }
.dash-attn-ico { display: inline-flex; flex-shrink: 0; }
.dash-attn-n { font-size: 16px; font-weight: 700; line-height: 1; }
.dash-attn-t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-attn-ver { margin-left: auto; font-size: 11px; font-weight: 500; text-decoration: underline;
  text-underline-offset: 2px; flex-shrink: 0; white-space: nowrap; }
.dash-attn-ok .dash-attn-todo { display: flex; align-items: center; gap: 9px; color: var(--ok);
  font-size: 12.5px; font-weight: 600; padding: 4px 0; }
.dash-attn-ok .dash-attn-todo .dash-attn-ico { color: var(--ok); }

.dash-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border2);
  font-size: 12.5px; cursor: pointer; }
.dash-row:last-child { border-bottom: none; }
.dash-row:hover b.dash-host { color: var(--accent); }
.dash-row b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-row .dash-host { flex: 1; min-width: 0; font-size: 12.5px; }
.dash-org { font-size: 10.5px; color: var(--muted); background: var(--surface3); padding: 1px 8px;
  border-radius: 999px; letter-spacing: .3px; flex-shrink: 0; }
.dash-bar { flex: 1; min-width: 40px; height: 6px; border-radius: 999px; background: var(--surface3); overflow: hidden; }
.dash-bar i { display: block; height: 100%; border-radius: 999px; background: var(--ok); }
.dash-bar i.warn { background: var(--warn); }
.dash-bar i.bad { background: var(--crit); }
.dash-nm { font-family: var(--mono); font-size: 11px; color: var(--muted); width: 72px; text-align: right; flex-shrink: 0; }
.dash-n { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-left: auto; flex-shrink: 0; white-space: nowrap; }
.dash-kind { font-size: 10.5px; color: var(--muted); background: var(--surface3); padding: 1px 8px;
  border-radius: 999px; letter-spacing: .3px; flex-shrink: 0; }
.dash-t { color: var(--muted); font-size: 11px; margin-left: auto; flex-shrink: 0; }
.dash-row .pill { flex-shrink: 0; }

/* Estado por cliente: nombre + uptime medio 24 h en columna */
.dash-org-nm { display: flex; flex-direction: column; min-width: 0; }
.dash-org-nm b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-up { font-size: 10px; color: var(--muted); margin-top: 1px; }

/* Alertas con severidad visible: borde izquierdo rojo/ámbar + tiempo desde que ocurrió */
.dash-alert { display: flex; align-items: center; gap: 9px; padding: 8px 11px; margin: 6px 0 0;
  border: 1px solid var(--border); border-left-width: 3px; border-radius: 9px; background: var(--surface2);
  font-size: 12.5px; }
.dash-alert:last-child { margin-bottom: 2px; }
.dash-alert.crit { background: var(--crit-bg); border-color: rgba(220, 38, 38, .22); border-left-color: var(--crit); }
.dash-alert.warn { background: var(--warn-bg); border-color: rgba(217, 119, 6, .2); border-left-color: var(--warn); }
.dash-alert .dash-host { flex: 1; min-width: 0; }
.dash-alert .dash-t { margin-left: 0; }

/* Equipos problemáticos: punto+texto de estado + mini-barras CPU/RAM/disco (4 px) */
.dash-off { flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 2px; }
.dash-off-top { display: flex; align-items: center; gap: 9px; min-width: 0; }
.dash-off-top .st { font-size: 11px; }
.dash-off-top .dash-host { flex: 1; min-width: 0; }
.dash-off-top .dash-n { margin-left: auto; }
.dash-mets { display: flex; gap: 12px; }
.dash-met { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.dash-met .bar { width: 40px; height: 4px; border-radius: 999px; background: var(--surface3); overflow: hidden; }
.dash-met .bar i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.dash-met .bar i.hi { background: var(--warn); }
.dash-met .bar i.crit { background: var(--crit); }
.dash-met .v { font-family: var(--mono); font-size: 9.5px; color: var(--muted); }

/* Tendencia: selector de rango compacto en la cabecera de la tarjeta */
.dash-trend-h { white-space: normal !important; }
.dash-trend-h .seg-mini { margin-left: auto; display: inline-flex; gap: 3px; flex-shrink: 0; }
.dash-trend-h .seg-mini button { padding: 3px 10px; font-size: 10.5px; font-weight: 600; border-radius: 7px;
  border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer;
  font-family: inherit; transition: all .12s; }
.dash-trend-h .seg-mini button:hover { border-color: var(--accent2); color: var(--text); }
.dash-trend-h .seg-mini button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.dash-trend-canvas { width: 100%; height: 86px; display: block; }
.dash-trend-wrap { position: relative; }
.dash-empty { color: var(--muted); font-size: 12px; padding: 6px 0; }

/* Selector de organización de la cabecera (junto a la pill fresh) */
.dash-org-select select { padding: 6px 12px; border: 1px solid var(--border); border-radius: 99px;
  background: #fff; color: var(--text); font-size: 12px; font-family: inherit; cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04); max-width: 220px; }
.dash-org-select select:hover { border-color: var(--border2); }
.dash-org-select select:focus { outline: none; border-color: var(--accent); }

/* Histograma de alertas 14 días */
.dash-alerts-canvas { width: 100%; height: 84px; display: block; }

/* Donut de distribución por estado + leyenda clicable */
.dash-donut-canvas { width: 120px; height: 120px; display: block; margin: 2px auto 10px; }
.dash-donut-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.dash-donut-item { display: flex; align-items: center; gap: 7px; font-size: 12px; cursor: pointer;
  padding: 4px 6px; border-radius: 7px; }
.dash-donut-item:hover { background: var(--surface2); }
.dash-donut-item:hover .dash-donut-l { color: var(--accent); }
.dash-donut-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dash-donut-l { color: var(--muted); }
.dash-donut-n { margin-left: auto; font-size: 11px; color: var(--text); }

/* Tooltip flotante de los canvas (tendencia del dashboard y detalle):
   fondo oscuro var(--term), texto blanco, radius 8 px, fuente 11 px */
.dash-chart-tip { position: absolute; z-index: 40; background: var(--term); color: #fff;
  border-radius: 8px; font-size: 11px; padding: 8px 10px; pointer-events: none;
  box-shadow: 0 18px 46px rgba(16, 24, 40, .22); white-space: nowrap; font-family: var(--font); }
.dash-chart-tip .tip-date { color: var(--muted2); font-size: 10px; text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 5px; }
.dash-chart-tip .tip-row { display: flex; align-items: center; justify-content: space-between;
  gap: 14px; line-height: 1.5; }
.dash-chart-tip .tip-row b { font-family: var(--mono); font-weight: 600; }

/* Skeleton del dashboard en la primera carga (mismo patrón que Equipos) */
.dash-skel-attn { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.dash-skel-attn .skel-bar { display: block; }
.dash-card.skel .skel-bar { display: block; margin-top: 10px; }
.dash-kpi.skel { cursor: default; box-shadow: none; }
.dash-kpi.skel:hover { border-color: var(--border); box-shadow: none; transform: none; }
.dash-kpi .skel-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--border2);
  animation: skel-pulse 1.2s ease-in-out infinite; flex-shrink: 0; }
.dash-kpi.skel .skel-bar { display: block; margin: 4px 0; }
.dash-org-select.skel .skel-bar { display: block; border-radius: 99px; }
.dash-head .dash-org-select.skel { display: inline-flex; align-items: center; }

/* ---------- Alertas ---------- */
.alerts-seg { max-width: 460px; margin-bottom: 14px; }
.alerts-list { display: flex; flex-direction: column; gap: 9px; }
.alerts-list .alert-item { margin-bottom: 0; }

/* KPIs mini-tarjeta de la vista Alertas (misma anatomía que Equipos) */
.alerts-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px;
  margin-bottom: 14px; }
.alerts-kpis .kpi .ico.cr, .alerts-kpis .kpi .ico.al { background: var(--crit-bg); color: var(--crit); }
.alerts-kpis .kpi .ico.ck { background: var(--ok-bg); color: var(--ok); }
.alerts-kpis .kpi .ico.td { background: var(--accent-soft); color: var(--accent); }
.alerts-kpis .kpi .ico.si { background: var(--warn-bg); color: var(--warn); }
.alerts-kpis .kpi .ico.av { background: var(--warn-bg); color: var(--warn); }
.alerts-kpis .dash-kpi.skel { display: flex; gap: 9px; align-items: center; }

/* KPIs mini-tarjeta de la vista Despliegues (4 tarjetas) */
.dep-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dep-kpis .kpi .ico.ru { background: rgba(0, 103, 230, .09); color: var(--primary); }
.dep-kpis .kpi .ico.ck { background: var(--ok-bg); color: var(--ok); }

/* KPIs mini-tarjeta del catálogo de software (3 tarjetas) */
.pkg-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pkg-kpis .kpi .ico.sz { background: var(--warn-bg); color: var(--warn); }
.pkg-kpis .kpi .ico.fm { background: rgba(0, 103, 230, .09); color: var(--primary); }
.pkg-kpis .pkg-fmt-n { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.pkg-kpis .pkg-fmt-n .pill { font-size: 10px; padding: 2px 8px; }
.pkg-kpis .kpi .n { font-size: 16px; }

/* Pill de formato del paquete: MSI azul suave / EXE lila suave */
.pill.pkg-msi { color: var(--primary); background: rgba(0, 103, 230, .09); }
.pill.pkg-exe { color: var(--accent); background: var(--accent-soft); }

/* Barra de herramientas: severidad + tipo + búsqueda + orden + CSV */
.alerts-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 12px; }
.alerts-tools .seg-mini { display: inline-flex; gap: 3px; }
.alerts-tools .seg-mini button { padding: 5px 11px; font-size: 11px; font-weight: 600;
  border-radius: 8px; border: 1px solid var(--border); background: #fff; color: var(--muted);
  cursor: pointer; font-family: inherit; transition: all .12s; }
.alerts-tools .seg-mini button:hover { border-color: var(--accent2); color: var(--text); }
.alerts-tools .seg-mini button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.alerts-tools select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; color: var(--text); font-size: 11.5px; font-family: inherit; cursor: pointer;
  max-width: 180px; }
.alerts-tools select:hover { border-color: var(--border2); }
.alerts-tools select:focus { outline: none; border-color: var(--accent); }
.alerts-tools input[type="search"] { padding: 6px 11px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 11.5px; font-family: inherit; color: var(--text); background: #fff;
  width: 220px; }
.alerts-tools input[type="search"]:focus { outline: none; border-color: var(--accent); }

/* Fila de alerta: wrapper (borde+radio+atenuados) + cabecera clicable + detalle */
.alert-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-sm); overflow: hidden; }
.alert-item.sev-critica, .alert-item.critical { background: var(--crit-soft); border-color: rgba(220, 38, 38, .28); }
.alert-item.sev-alta { background: var(--warn-soft); border-color: rgba(217, 119, 6, .25); }
.alert-item.sev-media { background: var(--surface2); border-color: var(--border); }
.alert-item.offline { background: var(--off-soft); border-color: rgba(152, 162, 179, .35); }
.alert-item.resolved { opacity: .8; }
.alert-item.acked { opacity: .7; }
.alert-item.muted { opacity: .7; }
.alert-item.open { border-color: var(--accent2); box-shadow: 0 0 0 1px rgba(124, 58, 237, .12); }
.alert-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  font-size: 12.5px; flex-wrap: wrap; cursor: pointer; }
.alert-row:hover { background: rgba(124, 58, 237, .05); }
.alert-item.resolved .alert-row:hover { background: transparent; }
.alert-item.acked .alert-row:hover, .alert-item.muted .alert-row:hover { background: transparent; }
.alert-row .row-cb { cursor: pointer; }
.alert-row .host { cursor: pointer; white-space: nowrap; font-weight: 600; }
.alert-row .host:hover { color: var(--accent); text-decoration: underline; }
.alert-row .host.net { color: var(--accent2); cursor: default; }
.alert-row .kind { font-size: 10.5px; color: var(--muted); background: var(--surface3); padding: 1px 8px;
  border-radius: 999px; letter-spacing: .3px; }
.alert-row .msg { flex: 1; min-width: 140px; font-size: 12.5px; }
.alert-row time { margin-left: auto; color: var(--muted); font-size: 11px; flex-shrink: 0; }
.alert-row .alerts-actions { display: inline-flex; gap: 5px; flex-shrink: 0; }
.alert-row .alert-badges { display: inline-flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
.alert-row .chev-b { width: 20px; height: 20px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 9px; color: var(--muted);
  background: var(--surface3); flex-shrink: 0; transition: all .12s; }
.alert-item.open .chev-b { transform: rotate(180deg); background: var(--accent); color: #fff; }
.pill.ack { color: var(--ok); background: var(--ok-bg); }
.pill.muted { color: var(--warn); background: var(--warn-bg); }
.pill.res { color: var(--off); background: var(--off-soft); }
.pill svg { flex-shrink: 0; }

/* Botones de acción por icono (reconocer/resolver/silenciar) */
.alr-btn { display: inline-flex; align-items: center; justify-content: center; width: 26px;
  height: 26px; border-radius: 8px; border: 1px solid var(--border); background: #fff;
  color: var(--muted); cursor: pointer; transition: all .12s; flex-shrink: 0; }
.alr-btn:hover { border-color: var(--accent2); color: var(--accent); }
.alr-btn svg { width: 14px; height: 14px; }
.alr-btn.ok:hover { border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }
.alr-btn.crit:hover { border-color: var(--crit); color: var(--crit); background: var(--crit-bg); }
.alr-btn.warn:hover { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); }

/* Detalle expandible de una alerta */
.alert-detail { border-top: 1px dashed var(--border); padding: 12px 14px 14px;
  font-size: 12.5px; display: flex; flex-direction: column; gap: 12px; }
.ad-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 9px 18px; }
.ad-l { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); margin-bottom: 2px; }
.ad-v { font-size: 12.5px; color: var(--text); word-break: break-word; }
.ad-v .host { cursor: pointer; font-weight: 600; }
.ad-v .host:hover { color: var(--accent); text-decoration: underline; }
.ad-estado { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ad-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ad-actions .btn { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; }
.ad-actions .btn svg { width: 13px; height: 13px; }

/* Skeleton de la primera carga */
.alert-item.skel .alert-row { gap: 12px; padding: 13px 14px; cursor: default; }
.alert-item.skel .alert-row:hover { background: transparent; }
.alert-item.skel .skel-bar { display: block; }

/* Barra de acciones masivas de la vista Alertas (ancho completo) */

/* Empty state verde ("Sin alertas activas ✓") */
.empty-state-wrap.ok { background: rgba(6, 102, 71, .06); border-color: rgba(6, 102, 71, .28); }
.empty-state-wrap.ok .empty-ico { background: var(--ok-bg); color: var(--ok); }
.no-alerts { color: var(--muted); font-size: 12.5px; }

/* ---------- Checks de red (Configuración) ---------- */
.nc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  margin-bottom: 8px; }
.nc-row .nc-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.nc-row .nc-main b { font-size: 13px; }
.nc-row .nc-target { font-size: 11px; color: var(--muted); }
.nc-row .nc-side { display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
.nc-row .nc-meta { font-size: 10.5px; color: var(--muted); }

/* ---------- Estado del servidor (Configuración) ---------- */
.health-box { display: flex; flex-direction: column; gap: 6px; }
.health-meta { display: flex; gap: 8px; color: var(--muted); font-size: 11.5px; margin-bottom: 6px; flex-wrap: wrap; }
.health-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); font-size: 12.5px; }
.health-row .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.health-row .dot.ok { background: var(--ok); }
.health-row .dot.warn { background: var(--warn); }
.health-row .dot.crit { background: var(--crit); }
.health-row b { min-width: 170px; }
.health-row .health-age { margin-left: auto; color: var(--muted); font-size: 11px; }

/* ---------- Acceso remoto ---------- */
/* KPIs mini-tarjeta (misma anatomía que Alertas/Equipos) */
.remote-kpis .kpi .ico.ts { background: var(--accent-soft); color: var(--accent); }
.remote-kpis .kpi .ico.ac { background: var(--ok-bg); color: var(--ok); }
.remote-kpis .kpi .ico.hy { background: var(--accent-soft); color: var(--accent); }
.remote-kpis .kpi .ico.pv { background: var(--warn-bg); color: var(--warn); }

/* Pill "actualizado hace X s" de la cabecera (patrón dashboard) */
.remote-head .fresh { display: flex; align-items: center; gap: 7px; background: #fff;
  border: 1px solid var(--border); border-radius: 99px; padding: 5px 12px;
  font-size: 11px; color: var(--muted); }
.remote-head .fresh .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 3px rgba(6, 102, 71, .15); }
.remote-head .fresh.off .dot { background: var(--crit); box-shadow: 0 0 0 3px rgba(220, 38, 38, .15); }
.remote-head .fresh.off { color: var(--crit); font-weight: 600; }

/* Punto verde de las sesiones activas (pill de estado) */
.dot-live { width: 6px; height: 6px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 3px rgba(6, 102, 71, .15); flex-shrink: 0; }

/* Panel Nueva sesión: búsqueda inline + listbox de equipos */
.remote-new { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.rn-box { position: relative; flex: 1; min-width: 240px; max-width: 460px; }
.rn-field { position: relative; display: flex; align-items: center; }
.rn-field input { width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 9px; padding: 8px 34px 8px 11px; color: var(--text); font-size: 13px;
  font-family: inherit; }
.rn-field input:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft); }
.rn-clear { position: absolute; right: 6px; width: 22px; height: 22px; border-radius: 50%;
  border: none; background: var(--surface3); color: var(--muted); font-size: 11px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.rn-clear:hover { color: var(--crit); background: var(--crit-bg); }
.rn-list { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); max-height: 260px; overflow-y: auto; padding: 4px; }
.rn-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 7px 10px; border: none; border-radius: 7px; background: transparent;
  font-size: 12.5px; font-family: inherit; color: var(--text); cursor: pointer; }
.rn-item:hover { background: var(--accent-soft); }
.rn-item.on { background: var(--accent); color: #fff; }
.rn-item .rn-host { font-weight: 600; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.rn-item .rn-ip { margin-left: auto; font-size: 11px; color: var(--muted); flex-shrink: 0; }
.rn-item.on .rn-ip { color: rgba(255, 255, 255, .8); }
.rn-empty { padding: 10px; font-size: 12px; color: var(--muted); text-align: center; }

/* Tarjeta de resultado de la sesión creada */
.rn-card { margin-top: 12px; border: 1px solid rgba(6, 102, 71, .35); border-radius: 10px;
  background: var(--ok-bg); padding: 13px 15px; display: flex; flex-direction: column; gap: 11px; }
.rn-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rn-card-head b { font-size: 13.5px; }
.rn-cmd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--term-2);
  border-radius: 9px; padding: 9px 11px; }
.rn-cmd code { flex: 1; min-width: 0; color: #a5b4fc; font-size: 12px; word-break: break-all; }
.rn-cmd .btn { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .2); color: #fff; }
.rn-cmd .btn:hover { background: rgba(255, 255, 255, .18); border-color: #fff; }
.rn-hint { font-size: 12px; color: var(--warn); background: var(--warn-soft);
  border-radius: 8px; padding: 8px 11px; }
.rn-card-actions { display: flex; gap: 6px; }

/* Tabla del historial: fila clicable + detalle expandible */
.remote-tbl .remote-row { cursor: pointer; }
.cmd-tbl .remote-row.open td { background: var(--accent-soft); }
.remote-row .host { cursor: pointer; font-weight: 600; }
.remote-row .host:hover { color: var(--accent); text-decoration: underline; }
.remote-acts { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }
.remote-acts .btn { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px;
  font-size: 11.5px; }
.remote-acts .btn svg { width: 13px; height: 13px; }
.cmd-tbl .remote-det-row td { background: var(--surface2); padding: 0; border-bottom: 1px solid var(--border); }
.remote-det { padding: 13px 15px; display: flex; flex-direction: column; gap: 12px; }
.remote-det-cmd { display: flex; }
.remote-skel td { padding: 12px 9px; }
.remote-skel .skel-bar { display: block; }
.remote-empty { text-align: center; padding: 10px 0; }
.remote-empty .btn { margin-top: 4px; }

/* ---------- Scripts ---------- */
/* KPIs mini-tarjeta (misma anatomía que Alertas/Remoto) */
.scripts-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.scripts-kpis .kpi .ico.sc { background: var(--accent-soft); color: var(--accent); }
.scripts-kpis .kpi .ico.ru { background: rgba(0, 103, 230, .09); color: var(--primary); }

/* Pestañas Catálogo | Ejecuciones (patrón Alertas) */
.scripts-seg { margin-bottom: 12px; }

/* Grid de tarjetas del catálogo */
.sc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 12px; padding-bottom: 26px; }
.sc-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden;
  display: flex; flex-direction: column; }
.sc-card.skel { cursor: default; pointer-events: none; }
.sc-card.skel .sc-card-top, .sc-card.skel .sc-card-actions { padding: 14px 15px; }
.sc-card.skel .sc-card-actions { border-top: 1px solid var(--border2); }
.sc-card.skel .skel-bar { display: block; }
.sc-card.open { border-color: var(--accent2);
  box-shadow: 0 0 0 1px rgba(124, 58, 237, .12), var(--shadow); }

/* Cabecera de la tarjeta: clicable, expande el detalle (una sola) */
.sc-card-top { display: flex; align-items: center; gap: 8px; padding: 13px 14px;
  flex-wrap: wrap; cursor: pointer; transition: background .12s; }
.sc-card-top:hover { background: var(--accent-soft); }
.sc-card-top:focus-visible { outline: 2px solid var(--phosphor-d); outline-offset: -2px; }
.sc-card-top .sc-name { flex: 1; min-width: 130px; font-size: 13.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-card-top .pill { font-size: 9.5px; }
.sc-stats { display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; }
.sc-count { font-size: 11px; color: var(--muted); white-space: nowrap; }
.sc-card-top .chev-b { width: 20px; height: 20px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: 9px;
  color: var(--muted); background: var(--surface3); flex-shrink: 0;
  transition: all .12s; }
.sc-card.open .sc-card-top .chev-b { transform: rotate(180deg); background: var(--accent); color: #fff; }

/* Acciones de la tarjeta: ejecutar (select + botón) y editar/eliminar */
.sc-card-actions { display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  border-top: 1px solid var(--border2); flex-wrap: wrap; }
.sc-run { display: flex; align-items: center; gap: 8px; flex: 1 1 220px; min-width: 0; }
.sc-run select { flex: 1; min-width: 120px; max-width: none; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px; color: var(--text);
  font-size: 12.5px; font-family: inherit; cursor: pointer; }
.sc-run select:focus { outline: none; border-color: var(--accent); }
.sc-run .btn { flex-shrink: 0; }
.sc-btns { display: flex; gap: 6px; flex-shrink: 0; margin-left: auto; }

/* Detalle expandido: código (máx 15 líneas + ver todo) e historial */
.sc-detail { border-top: 1px dashed var(--border); background: var(--surface2);
  padding: 13px 14px 14px; display: flex; flex-direction: column; gap: 13px; }
.sc-code-head { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 7px; font-size: 10.5px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.sc-code-head .btn { text-transform: none; letter-spacing: 0; font-weight: 600; }
.sc-pre { background: var(--term-2); color: #d7dcf0; border-radius: 9px; padding: 11px 13px;
  font-size: 11.5px; line-height: 1.55; max-height: calc(15 * 1.55em + 22px);
  overflow: auto; white-space: pre-wrap; word-break: break-word; }
.sc-h4 { font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .7px; font-weight: 700; margin-bottom: 8px; }
.sc-history .hint-inline { padding: 8px 0; text-align: left; }
.sc-hist-tbl { font-size: 12px; }
.sc-hist-tbl .c-dur { color: var(--muted); white-space: nowrap; }
.sc-empty { display: flex; flex-direction: column; align-items: center; }
.sc-empty .btn { margin-top: 6px; }

/* Tabla de ejecuciones: cabeceras ordenables + salida con tooltip */
.run-tbl .th-sort { margin-left: 4px; font-size: 9px; color: var(--muted2); }
.run-tbl th[data-rsort] { cursor: pointer; user-select: none; }
.run-tbl th[data-rsort]:hover { color: var(--accent); }
.run-tbl th[data-rsort].on { color: var(--accent); }
.run-tbl th[data-rsort].on .th-sort { color: var(--accent); }
.run-tbl .c-name { max-width: 200px; font-weight: 600; }
.run-tbl td .pill { font-size: 9.5px; }
.run-out { position: relative; max-width: 240px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--text); cursor: help; }
.run-out.muted { color: var(--off); }
/* Tooltip CSS puro: salida completa (pre-wrap) al pasar el ratón */
.run-out::after { content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 6px);
  z-index: 60; background: var(--term); color: #e8eaf2; border-radius: 8px; font-size: 11px;
  line-height: 1.5; padding: 8px 10px; box-shadow: var(--shadow-lg);
  white-space: pre-wrap; word-break: break-word; max-width: 420px; min-width: 220px;
  font-family: var(--mono); opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .15s, transform .15s; pointer-events: none; }
.run-out:hover::after { opacity: 1; visibility: visible; transform: translateY(0); }

/* ---------- Grupos ---------- */
.grp-table { min-width: 760px; }
.grp-thresh { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.grp-n { color: var(--text); font-weight: 600; }
.grp-alert { font-size: 11px; font-weight: 700; color: #fff; background: var(--crit);
  padding: 2px 9px; border-radius: 99px; display: inline-block; min-width: 22px; text-align: center; }
.grp-alert.ok { background: var(--ok); }
.grp-alert.none { background: var(--surface3); color: var(--muted); font-weight: 600; }
/* Pills de umbrales con estado: ok = nadie supera el umbral, warn = alguien lo supera */
.pill.thresh .th-edit { cursor: text; border-bottom: 1px dashed currentColor; padding: 0 2px; }
.pill.thresh .th-edit:hover { background: rgba(16, 24, 40, .06); border-radius: 4px; }
.th-input { width: 66px; font-family: var(--mono); font-size: 11.5px; font-weight: 600;
  color: var(--text); background: #fff; border: 1px solid var(--phosphor-d); border-radius: 6px;
  padding: 1px 5px; outline: none; box-shadow: var(--ring); }
.grp-det-h .nm { font-size: 15px; }
.grp-det-h .nm .pill { font-size: 9.5px; }
.grp-policy-empty { background: var(--surface2); border: 1px dashed var(--border);
  border-radius: 9px; padding: 10px 12px; color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.grp-equipos-head { display: flex; align-items: center; gap: 10px; margin: 12px 0 8px; }
.grp-equipos-head .sec-title { margin: 0; }
.grp-equipos-head .btn { margin-left: auto; }
.grp-agents { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.grp-agents th { text-align: left; color: var(--muted); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .5px; padding: 7px 9px; border-bottom: 1px solid var(--border); font-weight: 700; }
.grp-agents td { padding: 7px 9px; border-bottom: 1px solid var(--border2); vertical-align: middle; }
.grp-agents tbody tr:last-child td { border-bottom: none; }
.grp-agents tbody tr { cursor: pointer; transition: background-color .12s; }
.grp-agents tbody tr:hover td { background: var(--surface2); }
.grp-agents td.c-host { font-weight: 600; white-space: nowrap; max-width: 220px;
  overflow: hidden; text-overflow: ellipsis; }
.grp-agents td.c-date { color: var(--muted); white-space: nowrap; }
.grp-agents .met-cell { justify-content: flex-end; }
.grp-quitar { padding: 2px 8px !important; font-size: 11px !important; }
.grp-quitar:hover { color: var(--crit) !important; border-color: var(--crit) !important; }
/* Modal "Añadir equipo": lista con checkboxes y búsqueda */
.ga-list { margin-top: 10px; max-height: 300px; overflow-y: auto; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 9px; }
.ga-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-bottom: 1px solid var(--border2); cursor: pointer; font-size: 12.5px; }
.ga-item:last-child { border-bottom: none; }
.ga-item:hover { background: var(--accent-soft); }
.ga-item input { width: 15px; height: 15px; accent-color: var(--accent); flex-shrink: 0; cursor: pointer; }
.ga-item .ga-host { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ga-item .ga-ip { color: var(--muted); font-size: 11px; flex-shrink: 0; }
.ga-item .ga-st { margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 11px; text-transform: capitalize; flex-shrink: 0; }
/* Contador de grupos del sidebar (acento, no rojo de alertas) */
.side nav a .nav-badge.nm-count { background: var(--accent); }
.side nav a.on .nav-badge.nm-count { background: rgba(255, 255, 255, .25); }

/* ---------- Organizaciones ---------- */
/* KPIs D2: 2 mini-tarjetas (Clientes · Equipos), misma anatomía que el resto */
.orgs-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
  margin-bottom: 14px; }
.orgs-kpis .dash-kpi.skel { display: flex; gap: 9px; align-items: center; }
.orgs-kpis .kpi .ico.t { background: var(--accent-soft); color: var(--accent); }
.orgs-kpis .kpi .ico.eq { background: rgba(0, 103, 230, .09); color: var(--primary); }

/* Búsqueda por nombre en la cabecera */
.orgs-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.orgs-tools input[type="search"] { padding: 7px 12px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--text); font-size: 13px;
  font-family: inherit; width: 240px; }
.orgs-tools input[type="search"]:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft); }
.orgs-tools input[type="search"]::placeholder { color: var(--muted2); }

.org-create { display: flex; gap: 8px; }
.org-create input { flex: 1; margin: 0; }
.key-box { margin-top: 12px; background: var(--surface2); border: 1px solid rgba(124, 58, 237, .3);
  border-radius: 10px; padding: 10px 12px; }
.key-box .k { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.krow { display: flex; align-items: center; gap: 10px; }
.krow code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--accent);
  font-size: 12px; }

/* Grid de tarjetas de cliente (estilo D2) */
.orgs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 12px; padding-bottom: 26px; }
.org-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden;
  display: flex; flex-direction: column; }
.org-card.skel { cursor: default; pointer-events: none; }
.org-card.skel .skel-bar { display: block; }
.org-card-top { display: flex; align-items: center; gap: 8px; padding: 13px 14px; flex-wrap: wrap; }
.org-card-top .org-name { flex: 1; min-width: 130px; font-size: 14px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-card-top .pill { font-size: 9.5px; }
.org-key-row { display: flex; align-items: center; gap: 8px; padding: 0 14px 12px; flex-wrap: wrap; }
.org-key-row code { flex: 1; min-width: 120px; font-size: 12px; color: var(--accent);
  background: var(--accent-soft); padding: 5px 10px; border-radius: 7px; word-break: break-all; }
.org-key-btns { display: flex; gap: 6px; flex-shrink: 0; }
.org-card-actions { display: flex; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--border2);
  flex-wrap: wrap; }
.org-rd { padding: 12px 14px 14px; border-top: 1px dashed var(--border); background: var(--surface2); }
.org-rd .rd-title { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px;
  margin-bottom: 10px; display: flex; align-items: baseline; gap: 8px; }
.org-rd .rd-hint { text-transform: none; letter-spacing: 0; font-size: 11px; color: var(--off); }
.org-rd .cfg-actions { margin-top: 12px; }
.orgs-empty { display: flex; flex-direction: column; align-items: center; }
.orgs-empty .btn { margin-top: 6px; }

/* ---------- Configuración ---------- */
.cfg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 18px; }
.cfg-field label { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .5px; font-weight: 700; margin-bottom: 5px; }
.cfg-field input, .cfg-field select, .cfg-field textarea { width: 100%; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 9px; padding: 8px 11px; color: var(--text);
  font-size: 13px; font-family: inherit; }
.cfg-field input:focus, .cfg-field select:focus, .cfg-field textarea:focus { outline: none;
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cfg-field input::placeholder, .cfg-field textarea::placeholder { color: var(--muted2); }
.cfg-field textarea, .scr-textarea { resize: vertical; font-family: var(--mono); font-size: 12.5px;
  width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 9px;
  padding: 8px 11px; color: var(--text); }
.cfg-field textarea:focus, .scr-textarea:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft); }
.cfg-field.full { grid-column: 1 / -1; }
.cfg-field input[type="time"], .cfg-field input[type="file"] { color-scheme: light; }
.cfg-field input[type="file"] { padding: 5px 8px; }
.cfg-field input[type="file"]::file-selector-button { background: var(--surface3);
  border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 5px 12px;
  font-family: inherit; font-size: 12px; cursor: pointer; margin-right: 10px; }
.cfg-field input[type="file"]::file-selector-button:hover { border-color: var(--accent); }
.cfg-actions { display: flex; gap: 8px; margin-top: 14px; }
.cfg-actions .btn:disabled { opacity: .55; cursor: default; }

/* ---------- Tarjetas D2 de Configuración ---------- */
/* Tarjeta con cabecera clicable (colapsable): icono SVG + título uppercase
   12px + pill de estado + chevron; el cuerpo mantiene .cfg-grid. */
.cfg-card { padding: 0; overflow: hidden; }
.cfg-head { display: flex; align-items: center; gap: 11px; width: 100%; padding: 13px 16px;
  background: none; border: none; cursor: pointer; text-align: left; color: inherit;
  font: inherit; border-radius: var(--radius) var(--radius) 0 0; transition: background .12s; }
.cfg-head:hover { background: var(--surface2); }
.cfg-head .h-ico { width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.cfg-head .h-ico .ic { width: 17px; height: 17px; }
.cfg-head .h-txt { flex: 1; min-width: 0; font-size: 12px; font-weight: 700;
  color: var(--text); text-transform: uppercase; letter-spacing: .7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cfg-head .pill { flex-shrink: 0; }
.cfg-che { width: 18px; height: 18px; flex-shrink: 0; color: var(--muted2);
  fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round;
  stroke-linejoin: round; transition: transform .18s ease; }
.cfg-card.collapsed .cfg-che { transform: rotate(-90deg); }
.cfg-body { padding: 0 16px 16px; }
.cfg-card.collapsed .cfg-body { display: none; }
.cfg-body > .cfg-grid { margin-top: 2px; }

/* Resumen de canales (cabecera D2): mini-pills clicables hacia su sección */
.cfg-chans { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 16px; }
.chan { display: inline-flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 7px 11px 7px 8px;
  box-shadow: var(--shadow-sm); cursor: pointer; font: inherit; color: var(--text);
  transition: border-color .12s ease, box-shadow .12s ease; }
.chan:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.chan .c-ico { width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--surface3); color: var(--muted); }
.chan .c-ico .ic { width: 14px; height: 14px; }
.chan b { font-size: 12.5px; font-weight: 600; }
.chan .pill { font-size: 9.5px; padding: 2px 8px; }
.chan.skel { pointer-events: none; min-width: 130px; justify-content: center; }
.chan.skel .skel-bar { margin: 5px 0; }

/* Clave pública RustDesk: visibilidad Ver/Ocultar + máscara */
.cfg-label-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.cfg-label-row label { margin-bottom: 5px; }
.cfg-eye { background: none; border: none; color: var(--accent); font-size: 11px;
  font-weight: 700; cursor: pointer; padding: 2px 4px; border-radius: 6px;
  text-transform: uppercase; letter-spacing: .4px; font-family: inherit; margin-bottom: 5px; }
.cfg-eye:hover { background: var(--accent-soft); }
.rd-key-mask { width: 100%; background: var(--surface2); border: 1px dashed var(--border);
  border-radius: 9px; padding: 8px 11px; font-size: 12.5px; color: var(--muted);
  word-break: break-all; min-height: 72px; }

/* Skeleton de la vista Configuración */
.cfg-head-sk { display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--border2); }
.cfg-card.skel .cfg-grid { padding: 14px 16px 18px; gap: 12px; }
.cfg-card.skel .skel-bar { margin: 6px 0; }
.cfg-select { background: var(--surface2); border: 1px solid var(--border); border-radius: 9px;
  padding: 7px 10px; color: var(--text); font-size: 12.5px; font-family: inherit; cursor: pointer; }
.cfg-select:focus { outline: none; border-color: var(--accent); }

/* Ventanas de mantenimiento e informes */
.win-item, .rep-item { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px; font-size: 12.5px; margin-bottom: 8px; }
.win-item b, .rep-item b { flex: 1; min-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-time, .rep-sched { color: var(--accent); font-family: var(--mono); font-size: 11.5px; font-weight: 600; }
.win-days-pill { color: var(--muted); font-size: 11px; }
.win-days { display: flex; gap: 6px; flex-wrap: wrap; }
.day-cb { display: inline-flex; align-items: center; gap: 5px; background: var(--surface3);
  border: 1px solid var(--border); border-radius: 8px; padding: 5px 9px; font-size: 11.5px;
  color: var(--muted); cursor: pointer; user-select: none; }
.day-cb input { appearance: none; -webkit-appearance: none; width: 13px; height: 13px; margin: 0;
  border: 1px solid var(--border); border-radius: 3px; background: var(--surface); cursor: pointer; position: relative; }
.day-cb input:checked { background: var(--accent); border-color: var(--accent); }
.day-cb input:checked::after { content: ''; position: absolute; left: 3px; top: 0; width: 5px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.day-cb:hover { border-color: var(--accent); color: var(--text); }

/* Toggle activar/parar */
.switch { position: relative; width: 38px; height: 20px; border-radius: 999px; background: var(--surface3);
  border: 1px solid var(--border); cursor: pointer; transition: background .15s, border-color .15s;
  flex-shrink: 0; padding: 0; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch.on { background: var(--accent); border-color: var(--accent); }
.switch.on::after { transform: translateX(18px); background: #fff; }

/* Updates pendientes (detalle de equipo) */
.upd-actions { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.upd-list { max-height: 260px; overflow-y: auto; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 9px; }
.upd-item { display: flex; align-items: flex-start; gap: 12px; padding: 8px 11px;
  border-bottom: 1px solid var(--border2); font-size: 12.5px; }
.upd-item:last-child { border-bottom: none; }
.upd-kb { color: var(--accent); font-size: 11.5px; flex-shrink: 0; width: 130px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upd-title { flex: 1; min-width: 0; }
.upd-item .pill { flex-shrink: 0; align-self: center; }

/* Software / servicios (detalle) */
.sw-head, .svc-head { display: flex; align-items: center; justify-content: space-between; cursor: pointer;
  width: 100%; background: none; border: 0; padding: 0; text-align: left; color: inherit; font: inherit; border-radius: 4px; }
.sw-head h4, .svc-head h4 { margin-bottom: 0; }
.sw-head:focus-visible, .svc-head:focus-visible { outline: 2px solid var(--phosphor-d); outline-offset: 2px; }
.sw-count, .svc-count { color: var(--accent); font-family: var(--mono); font-size: 11px; margin-left: 4px; }
.upd-count, .tags-count { color: var(--accent); font-family: var(--mono); font-size: 11px; margin-left: 4px; }
.sw-toggle, .svc-toggle { color: var(--muted); font-size: 13px; }
.upd-toggle { color: var(--muted); font-size: 13px; }
.sw-filter { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 11px; color: var(--text); font-size: 12.5px; font-family: inherit; margin: 4px 0 10px; }
.sw-filter::placeholder { color: var(--muted); }
.sw-filter:focus { outline: none; border-color: var(--accent); }
.sw-list, .svc-list { max-height: 240px; overflow-y: auto; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 9px; }
.sw-item { padding: 7px 11px; border-bottom: 1px solid var(--border2); }
.sw-item:last-child, .svc-item:last-child { border-bottom: none; }
.sw-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.sw-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sw-ver { color: var(--muted); font-size: 11px; flex-shrink: 0; }
.sw-pub { color: var(--muted); font-size: 11px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.svc-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 11px;
  border-bottom: 1px solid var(--border2); font-size: 12.5px; }
.svc-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Discos */
.disk-tbl { margin-top: 10px; }
.disk-tbl tr:last-child td { border-bottom: none; }
.disk-tbl td:nth-child(2), .disk-tbl td:nth-child(3) { text-align: right; color: var(--muted); }
.disk-tbl td.d-mount { font-weight: 600; }
.disk-tbl td.d-num { text-align: right; color: var(--muted); }
.disk-tbl td.d-pct { text-align: right; }
.disk-pct { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 120px; }
.disk-bar { flex: 1; min-width: 40px; height: 5px; border-radius: 999px; background: var(--surface3); overflow: hidden; }
.disk-bar i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.disk-bar i.hi { background: var(--warn); }
.disk-bar i.crit { background: var(--crit); }
.disk-pct span { font-family: var(--mono); font-size: 10.5px; color: var(--muted); width: 38px; text-align: right; flex-shrink: 0; }

/* ---------- Etiquetas (chips editables) ---------- */
.tags-box { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; min-height: 24px; }
.tag-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft);
  border: 1px solid rgba(124, 58, 237, .35); color: var(--accent); font-size: 11.5px; padding: 3px 6px 3px 11px;
  border-radius: 999px; line-height: 1.4; }
.tag-x { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 10px;
  padding: 1px 3px; border-radius: 50%; line-height: 1.2; }
.tag-x:hover { color: #fff; background: var(--crit); }
.tag-add { display: flex; gap: 8px; }
.tag-add input { flex: 1; min-width: 0; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 11px; color: var(--text); font-size: 12.5px; font-family: inherit; }
.tag-add input:focus { outline: none; border-color: var(--accent); }
.tag-add input::placeholder { color: var(--muted); }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); backdrop-filter: blur(2px);
  display: grid; place-items: center; z-index: 100; opacity: 0; pointer-events: none; transition: opacity .18s; padding: 20px; }
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal-box { width: 460px; max-width: 100%; max-height: 84vh; overflow-y: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(.98); transition: transform .18s; }
.modal-overlay.show .modal-box { transform: translateY(0) scale(1); }
.modal-box.wide { width: 660px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 15.5px; font-weight: 700; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-x { background: none; border: none; color: var(--muted); font-size: 15px; cursor: pointer;
  padding: 4px 8px; border-radius: 8px; flex-shrink: 0; }
.modal-x:hover { color: var(--text); background: var(--surface3); }
.modal-body { padding: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* Modal sesión remota */
.rd-loading { color: var(--muted); font-size: 12.5px; padding: 8px 0; }
.rd-field { margin-bottom: 14px; }
.rd-field .rd-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px; }
.rd-value { display: flex; align-items: center; gap: 10px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px; }
.rd-value code { flex: 1; min-width: 0; font-size: 13px; color: var(--accent); word-break: break-all; user-select: all; }
.rd-value .btn { flex-shrink: 0; padding: 4px 12px; }
.rd-exp { color: var(--warn); font-size: 11.5px; margin: 2px 0 16px; }
.rd-connect { display: flex; justify-content: center; padding: 2px 0 12px; }
.rd-connect .btn { font-size: 13px; padding: 8px 34px; }
.rd-none { color: var(--text); font-size: 13px; margin-bottom: 10px; }
.rd-hint-box { background: var(--surface2); border: 1px solid var(--border); border-radius: 9px;
  padding: 10px 12px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.rd-hint-box b { color: var(--accent); font-weight: 600; }

/* Modal seguridad (2FA) */
.sec-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sec-title { font-size: 13.5px; font-weight: 600; }
.sec-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.sec-status { flex-shrink: 0; }
.sec-field { margin-bottom: 12px; }
.sec-field input { width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 9px; padding: 8px 11px; color: var(--text); font-size: 13px; font-family: inherit; }
.sec-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sec-field input::placeholder { color: var(--muted); }
.sec-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 5px; }
.sec-qr { display: flex; justify-content: center; margin: 4px 0 16px; }
.sec-qr img { width: 180px; height: 180px; object-fit: contain; background: #fff; border: 1px solid var(--border);
  border-radius: 12px; padding: 8px; box-shadow: var(--shadow); }
.sec-secret { background: var(--surface2); border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px;
  font-size: 13px; color: var(--accent); letter-spacing: 1px; text-align: center; word-break: break-all; user-select: all; }
.sec-codes { width: 100%; min-height: 132px; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 9px; padding: 10px 12px; color: var(--text); font-size: 12px; resize: none; font-family: var(--mono); }
.sec-codes:focus { outline: none; border-color: var(--accent); }
.sec-codes-actions { display: flex; justify-content: flex-end; margin-top: 6px; }
.sec-codes-actions .btn { padding: 4px 12px; }
.sec-warn { color: var(--warn); font-size: 12px; line-height: 1.5; background: var(--warn-soft);
  border: 1px solid rgba(217, 119, 6, .25); padding: 8px 11px; border-radius: 9px; margin-bottom: 12px; }
.sec-code-field { margin-top: 12px; }
.sec-code-field input { letter-spacing: 1px; }

/* Modal confirmación */
.confirm-text { font-size: 13px; color: var(--text); line-height: 1.55; white-space: pre-wrap; }

/* Búsqueda global (Ctrl+K) */
.search-box { width: 560px; }
.search-field { width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 9px; padding: 10px 14px; color: var(--text); font-size: 14px; font-family: inherit; }
.search-field::placeholder { color: var(--muted); }
.search-field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-results { margin-top: 10px; max-height: 420px; overflow-y: auto; }
.sr-group-label { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px;
  padding: 10px 6px 4px; font-weight: 700; }
.sr-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.sr-item:hover { background: var(--surface2); }
.sr-item.on { background: var(--accent-soft); }
.sr-item .sr-ico { width: 20px; text-align: center; flex-shrink: 0; }
.sr-item b { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-item .sr-sub { margin-left: auto; color: var(--muted); font-size: 11px; flex-shrink: 0; }
.sr-hint, .sr-none { color: var(--muted); font-size: 12.5px; padding: 16px 6px; text-align: center; }

/* ---------- Empty states ---------- */
.empty-state-wrap { background: rgba(124, 58, 237, 0.06); border: 1px solid rgba(124, 58, 237, 0.25);
  border-radius: 12px; margin-top: 14px; padding: 36px 20px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-state-wrap .empty-ico { width: 56px; height: 56px; border-radius: 50%;
  background: rgba(124, 58, 237, 0.12); display: flex; align-items: center; justify-content: center;
  font-size: 28px; line-height: 1; margin: 0 auto 4px; }
.empty-state-wrap .empty-titulo { font-size: 15px; font-weight: 700; color: var(--text); }
.empty-state-wrap .empty-texto { font-size: 12.5px; color: var(--muted); max-width: 320px; line-height: 1.5; margin: 0 auto; }
.empty-state-wrap .btn { margin-top: 6px; }
.empty-state { color: var(--muted); font-size: 13px; padding: 60px 0; text-align: center; }

/* ---------- Toast (línea de log con timestamp) ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(16px);
  background: var(--term); color: #d5dcea; padding: 9px 16px; border-radius: 9px;
  font-size: 12px; font-weight: 500; font-family: var(--mono); border-left: 3px solid var(--primary);
  box-shadow: var(--shadow-lg); opacity: 0; transition: all .25s; z-index: 200;
  pointer-events: none; display: flex; align-items: center; gap: 6px;
  max-width: min(560px, 92vw); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { border-left-color: var(--phosphor); }
.toast.err { border-left-color: var(--crit); }
.toast .ts { color: #5b6a85; }
.toast .t-ico { font-weight: 700; }
.toast.ok .t-ico { color: var(--phosphor); }
.toast.err .t-ico { color: #f87171; }
.toast.info .t-ico { color: var(--primary); }

/* ---------- NinjaBot ---------- */
.chat-fab { position: fixed; right: 22px; bottom: 22px; width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #a855f7); border: none; cursor: pointer; z-index: 90;
  box-shadow: 0 6px 20px rgba(124, 58, 237, .45); display: grid; place-items: center; padding: 0;
  transition: transform .15s; }
.chat-fab:hover { transform: scale(1.06); }
.chat-fab svg { width: 27px; height: 27px; }
.chat-ping { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: var(--crit); border: 2px solid var(--bg); color: #fff; font-size: 10px;
  font-weight: 700; line-height: 14px; text-align: center; }

.chat-box { position: fixed; right: 22px; bottom: 86px; width: 350px; height: 460px; z-index: 91;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; display: flex;
  flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 13px 15px; background: var(--surface2);
  border-bottom: 1px solid var(--border); }
.chat-head .bot { width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), #a855f7);
  display: grid; place-items: center; flex: none; }
.chat-head .bot svg { width: 20px; height: 20px; }
.chat-head b { font-size: 13.5px; }
.chat-head .st { font-size: 11px; color: var(--muted); }
.chat-head .x { margin-left: auto; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 9px; }
.msg { max-width: 85%; padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45; color: var(--text); }
.msg.bot { align-self: flex-start; background: var(--surface3); border-bottom-left-radius: 4px; }
.msg.me, .msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg table { border-collapse: collapse; margin-top: 6px; width: 100%; }
.msg th, .msg td { border: 1px solid var(--border); padding: 3px 7px; font-size: 12px; text-align: left; }
.msg th { color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; }
.chip { background: var(--accent-soft); border: 1px solid rgba(124, 58, 237, .25); color: var(--accent);
  font-size: 11.5px; padding: 4px 11px; border-radius: 999px; cursor: pointer; font-family: inherit; font-weight: 600; }
.chip:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.chat-in { display: flex; gap: 8px; padding: 11px 14px; border-top: 1px solid var(--border); }
.chat-in input { flex: 1; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; color: var(--text); font-size: 13px; font-family: inherit; }
.chat-in input:focus { outline: none; border-color: var(--accent); }
.chat-in button { background: var(--accent); border: none; border-radius: 10px; padding: 0 15px; color: #fff;
  font-weight: 700; cursor: pointer; font-size: 14px; }

/* ---------- Hint inline ---------- */
.hint-inline { color: var(--muted); font-size: 12.5px; }
.hint-inline.pad { padding: 10px; text-align: center; }

/* ---------- Micro-interacciones + accesibilidad ---------- */
.row, .btn, .dash-card, .dash-kpi, .dash-row, .seg button,
.grp-card, .sc-card, .org-card, .win-item, .rep-item, .alert-row, .tag-chip, .switch {
  transition: background-color .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease;
}
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--phosphor-d) !important;
  outline-offset: 2px !important;
}
/* Foco de inputs por teclado: anillo verde terminal */
input:focus-visible, select:focus-visible, textarea:focus-visible {
  border-color: var(--phosphor-d);
  box-shadow: var(--ring);
  outline: none !important;
}

/* Skeleton shimmer (lista de equipos mientras carga): rectángulos grises
   pulsantes por celda, sin contenido real */
.skel { pointer-events: none; }
.skel-bar { display: block; height: 10px; border-radius: 99px; background: var(--border2);
  animation: skel-pulse 1.2s ease-in-out infinite; }
.skel-bar.w20 { width: 20%; }
.skel-bar.w24 { width: 24%; }
.skel-bar.w28 { width: 28%; }
.skel-bar.w30 { width: 30%; }
.skel-bar.w40 { width: 40%; }
.skel-bar.w45 { width: 45%; }
.skel-bar.w50 { width: 50%; }
.skel-bar.w55 { width: 55%; }
.skel-bar.w60 { width: 60%; }
.skel-bar.w70 { width: 70%; }
.skel-bar.w80 { width: 80%; }
.skel-bar.w85 { width: 85%; }
.skel-bar.w90 { width: 90%; }
.agt-table tr.skel .skel-bar { margin: 4px 0; }
@keyframes skel-pulse {
  0%, 100% { opacity: .4; }
  50% { opacity: 1; }
}

/* ---------- Login (Dark tech · terminal) ---------- */
body.login-body {
  min-height: 100vh; overflow: auto; display: flex; align-items: center; justify-content: center;
  padding: 20px; color: #e8eaf2; color-scheme: dark;
  background: radial-gradient(ellipse at 50% -20%, #2b1a5e 0%, #0c0e15 60%) #0c0e15;
}
.login-wrap { width: 100%; max-width: 400px; }
.login-notice { background: rgba(251, 191, 36, .12); border: 1px solid rgba(251, 191, 36, .3);
  color: #fbbf24; border-radius: 10px; padding: 9px 13px; font-size: 12px; font-weight: 500;
  font-family: var(--mono); margin-bottom: 14px; }
.login-term { background: #12141d; border: 1px solid #23273a; border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5), 0 0 40px rgba(124, 58, 237, .12);
  overflow: hidden; }
.login-term-head { display: flex; align-items: center; gap: 7px; padding: 12px 16px;
  border-bottom: 1px solid #23273a; }
.login-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.login-term-title { margin-left: 8px; font-family: var(--mono); font-size: 12px; color: #8b90a5; }
.login-term-body { padding: 28px 26px; font-family: var(--mono); }
.login-logo-line { display: flex; align-items: center; gap: 8px; font-size: 15px;
  color: #a78bfa; margin-bottom: 6px; }
.login-logo-line img { width: 18px; height: 18px; object-fit: contain; }
.login-logo-line b { color: #fff; font-weight: 700; }
.login-welcome { display: flex; align-items: center; gap: 7px; color: #8b90a5;
  font-size: 12px; margin-bottom: 22px; }
.login-welcome .login-ok { width: 7px; height: 7px; background: #34d399; border-radius: 2px;
  display: inline-block; flex-shrink: 0; }
.login-form label.login-label { display: block; font-size: 11px; color: #8b90a5;
  text-transform: uppercase; letter-spacing: 1.2px; font-weight: 600; margin: 16px 0 7px; }
.login-form input { width: 100%; padding: 11px 13px; background: #0d0f17;
  border: 1px solid #23273a; border-radius: 9px; color: #e8eaf2; font-size: 13.5px;
  font-family: inherit; outline: none; transition: border .15s, box-shadow .15s; }
.login-form input::placeholder { color: #565b72; }
.login-form input:focus { border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124, 58, 237, .2); }
.login-field { position: relative; }
.login-field input { padding-right: 42px; }
.login-eye { position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  cursor: pointer; user-select: none; color: #8b90a5; display: flex; padding: 0;
  border: none; background: none; line-height: 1; }
.login-eye:hover { color: #a78bfa; }
.login-eye svg { width: 18px; height: 18px; display: block; }
.login-eye .eye-off { display: none; }
.login-eye.show .eye-off { display: block; }
.login-eye.show .eye-open { display: none; }
.login-caps { display: none; color: #fbbf24; font-size: 11px; margin-top: 5px; }
.login-caps.on { display: block; }
.login-remember { display: flex; align-items: center; gap: 8px; font-size: 12.5px;
  color: #8b90a5; margin: 16px 0 18px; cursor: pointer; user-select: none; }
.login-remember input { width: auto; margin: 0; accent-color: #7c3aed; }
.login-error { display: none; color: #f87171; font-size: 12px; margin-top: 12px; min-height: 15px; }
.login-error:not(:empty) { display: block; }
.login-btn { width: 100%; padding: 12px; border: none; border-radius: 9px;
  background: linear-gradient(135deg, #7c3aed, #6d28d9); color: #fff; font-size: 13.5px;
  font-weight: 600; font-family: inherit; cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 8px; letter-spacing: .5px; transition: filter .15s; }
.login-btn:hover { filter: brightness(1.15); }
.login-btn:disabled { opacity: .6; cursor: default; }
.login-btn .spinner { display: inline-flex; width: 14px; height: 14px;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.login-2fa-title { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; color: #a78bfa;
  text-transform: uppercase; margin-bottom: 14px; }
.login-2fa-hint { color: #8b90a5; font-size: 12px; line-height: 1.55; margin: 14px 0 18px; }
.login-back { display: block; margin: 14px auto 0; background: none; border: none;
  color: #8b90a5; font-size: 12px; font-weight: 500; cursor: pointer; font-family: inherit;
  text-decoration: underline; text-underline-offset: 3px; }
.login-back:hover { color: #a78bfa; }
.login-foot { text-align: center; font-size: 11px; color: #8b90a5; margin-top: 18px;
  font-family: var(--mono); }
.login-foot .login-v { color: #a78bfa; }
@media (max-width: 480px) {
  body.login-body { padding: 12px; }
  .login-term { width: 100%; }
  .login-term-body { padding: 20px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  aside.side { width: 64px; }
  .side .logo { justify-content: center; padding: 16px 0 18px; }
  .side .logo { font-size: 0; }
  .side nav { padding: 6px 8px; }
  .side nav a { justify-content: center; padding: 10px 0; font-size: 0; gap: 0; }
  .side nav a .ic { width: 20px; height: 20px; }
  .side nav a .nav-badge { position: absolute; top: 2px; right: 4px; margin-left: 0; }
  .side .user { justify-content: center; padding: 12px 0; }
  .side .user div { display: none; }
  .side .user .out { margin-left: 0; }
  .dash-kpis { grid-template-columns: repeat(3, 1fr); }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .alerts-kpis, .remote-kpis, .scripts-kpis, .dep-kpis, .pkg-kpis { grid-template-columns: repeat(3, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .list-pane { width: 280px; }
  .topbar { padding: 0 14px; }
  .props { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  /* Menú móvil: sidebar off-canvas + hamburguesa + overlay */
  .menu-btn { display: block; }
  .topbar { padding: 0 12px; gap: 10px; }
  aside.side { position: fixed; top: 0; bottom: 0; left: -230px; width: 224px; z-index: 300;
    box-shadow: var(--shadow); transition: left .2s ease, box-shadow .2s ease; }
  body.sidebar-open aside.side { left: 0; box-shadow: var(--shadow-lg); }
  .menu-overlay { position: fixed; inset: 0; background: rgba(16, 24, 40, .45);
    backdrop-filter: blur(2px); z-index: 290; opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.sidebar-open .menu-overlay { opacity: 1; pointer-events: auto; }
  /* Revertir el colapso a 64px del breakpoint 1100px: iconos + etiquetas siempre visibles */
  aside.side { width: 224px; }
  .side .logo { justify-content: flex-start; padding: 18px 18px 16px; font-size: 15px; }
  .side nav { padding: 6px 12px; }
  .side nav a { justify-content: flex-start; font-size: 13.5px; gap: 11px; padding: 8.5px 11px; }
  .side nav a .ic { width: 18px; height: 18px; }
  .side nav a .nav-badge { position: static; top: auto; right: auto; margin-left: auto; }
  .side .user { justify-content: flex-start; padding: 14px 16px; }
  .side .user div { display: block; }
  .side .user .out { margin-left: auto; }
  .dash-kpis, .kpis { grid-template-columns: repeat(2, 1fr); }
  .alerts-kpis, .remote-kpis, .scripts-kpis, .dep-kpis, .pkg-kpis { grid-template-columns: repeat(2, 1fr); }
  /* Organizaciones: grid de tarjetas a 1 columna y búsqueda a ancho completo */
  .orgs-grid { grid-template-columns: 1fr; }
  .dhead { flex-wrap: wrap; }
  .orgs-tools { width: 100%; margin-left: 0; }
  .orgs-tools input[type="search"] { width: 100%; }
  .alerts-tools input[type="search"] { width: 100%; }
  .alerts-tools select { max-width: none; flex: 1 1 140px; }
  .alerts-tools .seg-mini { width: 100%; }
  /* Catálogo de scripts: grid a una columna */
  .sc-grid { grid-template-columns: 1fr; }
  .sc-card-top .sc-name { min-width: 100px; }
  .sc-btns { margin-left: 0; }
  .split { flex-direction: column; }
  .list-pane { width: 100%; border-right: none; border-bottom: 1px solid var(--border); max-height: 46vh; }
  .cfg-grid { grid-template-columns: 1fr; }
  .detail-pane { padding: 16px; }
  .dash-view, .remote-view { padding: 16px; }
  .chat-box { width: calc(100vw - 24px); right: 12px; }

  /* Cabecera de página (Equipos): padding y herramientas en columna */
  .page-h { padding: 14px 16px 0; }
  .page-h .tools { flex-direction: column; align-items: stretch; }
  .page-h .search { max-width: none; }
  .page-h .org { width: 100%; max-width: none; }
  .page-h .tools .btn.sm { align-self: flex-start; }
  .page-h .agt-count { margin-left: 0; }

  /* Pestañas del detalle: scroll horizontal fino, sin salir del viewport */
  .seg.tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap;
    max-width: 100%; scrollbar-width: thin; }
  .seg.tabs::-webkit-scrollbar { height: 4px; }
  .seg.tabs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
  .seg.tabs::-webkit-scrollbar-track { background: transparent; }

  /* Empty states: que no se corten en ventanas estrechas */
  .empty-state-wrap { padding-left: 14px; padding-right: 14px; }
}
/* Vista Equipos (tabla + expansión inline): el detalle se apila en una columna */
@media (max-width: 860px) {
  .det-body { grid-template-columns: 1fr; }
  .det-body .col2 { flex-direction: row; flex-wrap: wrap; }
  .det-body .col2 > div { flex: 1 1 220px; min-width: 0; }
}
@media (max-width: 760px) {
  .agents-card { margin: 12px 16px 16px; }
  /* La tabla mantiene su ancho: scroll horizontal con thead y barras visibles */
  .agt-tbl-wrap { overflow-x: auto; }
  .agt-table { min-width: 720px; }
  .det-h .acts { margin-left: 0; }
  .kpis-mini { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .topbar { padding: 0 12px; }
  .detail-pane, .dash-view, .remote-view { padding: 12px; }
  .dash-kpis, .kpis { gap: 6px; }
  .alerts-kpis, .remote-kpis, .scripts-kpis, .dep-kpis, .pkg-kpis { gap: 6px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .orgs-kpis { gap: 6px; }
  /* Tarjetas de cliente: acciones y fila de clave en columna para no desbordar */
  .org-key-row { flex-direction: column; align-items: stretch; }
  .org-key-btns { justify-content: flex-end; }
  .org-card-actions .btn { flex: 1 1 46%; }
  /* Panel Nueva sesión: botón a ancho completo bajo la búsqueda */
  .remote-new { flex-direction: column; }
  .remote-new .btn { width: 100%; }
  .rn-box { max-width: none; }
  /* Etiquetas en mayúsculas: nowrap + 8px para que no se corten en ventanas estrechas */
  .kpi .l, .det .mini .l, .panel h4, .dash-card h3, .dash-kpi span { font-size: 8px; letter-spacing: .4px; }
  .kpis-mini { gap: 6px; }
  .cfg-chans { gap: 6px; }
  .chan { padding: 6px 9px 6px 7px; }
  .chan b { font-size: 12px; }
  .cfg-body { padding: 0 13px 14px; }
  .modal-overlay { padding: 0; align-items: flex-start; }
  .modal-box { width: 100vw; max-width: 100vw; border-radius: 0 0 var(--radius) var(--radius); }
  .dhead-btns, .detail-actions { flex-direction: column; align-items: stretch; }
  .list-pane { max-height: 40vh; }
}

/* ---------- Terminal Moderno · ajustes responsive ---------- */
/* Sidebar colapsada a 64 px (≤1100): ocultar grupos y versión pill */
@media (max-width: 1100px) {
  .side .nav-group { display: none; }
  .side .logo .ver { display: none; }
}
/* Sidebar off-canvas completa (≤760): restaurar grupos y versión pill */
@media (max-width: 760px) {
  .side .nav-group { display: block; }
  .side .logo .ver { display: inline-block; }
  .topbar .crumb { display: none; }
}
@media (max-width: 480px) {
  .banner { flex-wrap: wrap; }
  .banner .ba { margin-left: 0; width: 100%; }
  .banner .ba .btn { width: 100%; justify-content: center; }
}
