/* ═════════════════════════════════════════════════════════════════════════
   RTX · LM STUDIO MONITOR — diseño
   Tema oscuro tipo "sala de control": fondos profundos, glassmorphism sutil,
   acentos cian→violeta, gauges de temperatura y consola de log en vivo.
   ═════════════════════════════════════════════════════════════════════════ */

:root {
  --bg-0: #05070d;
  --bg-1: #0a0f1c;
  --panel: rgba(15, 21, 38, 0.72);
  --panel-solid: #0f1526;
  --inset: #0a0f1e;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.28);
  --text: #e8edf7;
  --text-2: #9aa7bd;
  --text-3: #5f6d87;
  --cyan: #22d3ee;
  --violet: #818cf8;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --grad: linear-gradient(135deg, #22d3ee, #818cf8);
  --radius: 16px;
  --mono: "Cascadia Code", "JetBrains Mono", "Consolas", ui-monospace, monospace;
  --sans: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* el atributo hidden debe ganar a los display de .view-login / .view-app */
[hidden] { display: none !important; }

html { height: 100%; }

body {
  min-height: 100%;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: rgba(34, 211, 238, 0.3); }

/* ────────────────────────── fondo animado ────────────────────────── */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background:
  radial-gradient(1200px 700px at 80% -10%, rgba(129, 140, 248, 0.10), transparent 60%),
  radial-gradient(1000px 600px at 10% 110%, rgba(34, 211, 238, 0.08), transparent 60%),
  var(--bg-0);
}
.bg-blob {
  position: absolute; border-radius: 50%;
  filter: blur(90px); opacity: 0.5;
  will-change: transform;
}
.b1 { width: 55vmax; height: 55vmax; top: -25vmax; right: -15vmax;
  background: radial-gradient(circle, rgba(129, 140, 248, 0.22), transparent 65%);
  animation: drift1 26s ease-in-out infinite alternate; }
.b2 { width: 45vmax; height: 45vmax; bottom: -20vmax; left: -12vmax;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.16), transparent 65%);
  animation: drift2 32s ease-in-out infinite alternate; }
.b3 { width: 30vmax; height: 30vmax; top: 40%; left: 45%;
  background: radial-gradient(circle, rgba(52, 211, 153, 0.07), transparent 65%);
  animation: drift1 40s ease-in-out infinite alternate-reverse; }
@keyframes drift1 { to { transform: translate(-6vmax, 4vmax) scale(1.08); } }
@keyframes drift2 { to { transform: translate(5vmax, -5vmax) scale(1.12); } }
.bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, black 30%, transparent 100%);
}

/* ────────────────────────── utilidades ────────────────────────── */
.muted { color: var(--text-3); font-size: 12.5px; }
.grad {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

.btn {
  font: inherit; font-weight: 600; letter-spacing: 0.01em;
  color: var(--text); background: transparent;
  border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 10px 18px; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: wait; transform: none; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-primary {
  background: var(--grad); border: none; color: #05070d;
  box-shadow: 0 8px 24px -8px rgba(34, 211, 238, 0.5);
}
.btn-primary:hover { box-shadow: 0 10px 28px -6px rgba(34, 211, 238, 0.65); filter: brightness(1.06); }
.btn-block { width: 100%; padding: 13px; font-size: 15.5px; }
.btn-ghost { background: rgba(148, 163, 184, 0.06); }
.btn-ghost:hover { background: rgba(148, 163, 184, 0.14); border-color: var(--line-strong); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-family: var(--mono);
  color: var(--text-2); background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px;
  white-space: nowrap;
}

/* ────────────────────────── login ────────────────────────── */
.view-login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: min(410px, 100%);
  background: var(--panel);
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  border: 1px solid var(--line); border-radius: 22px;
  padding: 42px 38px 30px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: fadeUp 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px) scale(0.985); } }

.login-logo { width: 58px; height: 58px; margin-bottom: 18px; filter: drop-shadow(0 6px 18px rgba(34, 211, 238, 0.35)); }
.login-logo svg { width: 100%; height: 100%; }
.login-card h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.login-sub { color: var(--text-2); font-size: 13.5px; margin: 4px 0 26px; }

.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-3); margin-bottom: 7px;
}
.field input {
  width: 100%; font: inherit; color: var(--text);
  background: var(--inset); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input::placeholder { color: var(--text-3); }
.field input:focus {
  outline: none; border-color: rgba(34, 211, 238, 0.6);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 44px; }
.peek {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; display: grid; place-items: center;
  background: none; border: none; border-radius: 8px;
  color: var(--text-3); cursor: pointer; transition: color 0.15s, background 0.15s;
}
.peek:hover { color: var(--text-2); background: rgba(148, 163, 184, 0.1); }
.peek svg { width: 18px; height: 18px; }

.login-error {
  background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fca5a5; border-radius: 10px; padding: 10px 14px;
  font-size: 13.5px; margin-bottom: 16px;
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}
.login-foot {
  margin-top: 18px; text-align: center;
  color: var(--text-3); font-size: 11.5px;
}

/* ────────────────────────── topbar ────────────────────────── */
.view-app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 22px;
  background: rgba(7, 10, 18, 0.78);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-icon { width: 30px; height: 30px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 14.5px; letter-spacing: 0.01em; }
.brand-text span { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.14em; }

.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600;
  padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(148, 163, 184, 0.06);
  color: var(--text-2);
}
.status-pill.online { border-color: rgba(52, 211, 153, 0.4); color: #6ee7b7; background: rgba(52, 211, 153, 0.08); }
.status-pill.offline { border-color: rgba(248, 113, 113, 0.4); color: #fca5a5; background: rgba(248, 113, 113, 0.08); }
.pill-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-pill.online .pill-dot { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.8); } }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--text-2);
  background: rgba(148, 163, 184, 0.07); border: 1px solid var(--line);
  padding: 6px 13px; border-radius: 999px;
}
.user-chip svg { width: 15px; height: 15px; color: var(--cyan); }

/* ────────────────────────── layout ────────────────────────── */
.layout {
  display: grid; grid-template-columns: minmax(400px, 5fr) 7fr;
  gap: 18px; padding: 20px 22px 28px;
  width: 100%; max-width: 1720px; margin: 0 auto;
  align-items: start;
}
.lms-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.panel {
  background: var(--panel);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: fadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.lms-col .panel:nth-child(2) { animation-delay: 0.08s; }

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
}
.panel-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.panel-title > svg { width: 19px; height: 19px; color: var(--cyan); flex: none; }
.panel-title h2 { font-size: 15.5px; font-weight: 700; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ────────────────────────── GPU: gauges ────────────────────────── */
.temps-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin-bottom: 6px;
}
.temp-tile {
  background: var(--inset); border: 1px solid var(--line);
  border-radius: 14px; padding: 15px 8px 12px;
  display: flex; flex-direction: column; align-items: center;
  transition: border-color 0.3s;
}
.temp-tile.hot { border-color: rgba(248, 113, 113, 0.45); }
.temp-tile.nodata { border-style: dashed; opacity: 0.85; }

.gauge-wrap { position: relative; width: 104px; height: 104px; }
.gauge { width: 100%; height: 100%; display: block; transform: rotate(135deg); }
.gauge circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.gauge-track { stroke: rgba(148, 163, 184, 0.13); stroke-dasharray: 245.04 326.73; }
.gauge-fill {
  stroke: var(--cyan);
  stroke-dasharray: 0 326.73;
  transition: stroke-dasharray 0.7s cubic-bezier(0.22, 1, 0.36, 1), stroke 0.4s;
}
.temp-tile.ok .gauge-fill { stroke: var(--green); }
.temp-tile.warn .gauge-fill { stroke: var(--amber); }
.temp-tile.hot .gauge-fill { stroke: var(--red); }
.temp-tile.nodata .gauge-track { stroke: rgba(148, 163, 184, 0.1); }

.temp-value {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0;
}
.temp-value span:first-child {
  font-family: var(--mono); font-weight: 700; font-size: 30px; line-height: 1;
}
.temp-value .unit { font-size: 12px; color: var(--text-3); font-weight: 600; margin-top: 2px; }
.temp-tile.hot .temp-value span:first-child { color: var(--red); animation: hotPulse 1.6s ease-in-out infinite; }
@keyframes hotPulse { 50% { opacity: 0.6; } }
.temp-label {
  margin-top: 10px;
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--text-3);
}

.nodata-note {
  font-size: 12px; color: var(--text-3);
  background: rgba(148, 163, 184, 0.06);
  border: 1px dashed var(--line); border-radius: 10px;
  padding: 9px 13px; margin: 10px 0 4px;
}

/* memoria */
.mem-block { margin-top: 18px; }
.mem-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.mem-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-2); }
.mem-text { font-family: var(--mono); font-size: 13px; color: var(--text); }

.bar {
  height: 10px; border-radius: 999px;
  background: var(--inset); border: 1px solid var(--line);
  overflow: hidden;
}
.bar-sm { height: 5px; margin-top: 8px; }
.bar-fill {
  height: 100%; width: 0%;
  background: var(--grad); border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.4);
}
.bar-fill.warn { background: linear-gradient(90deg, var(--amber), #f59e0b); box-shadow: 0 0 12px rgba(251, 191, 36, 0.4); }
.bar-fill.hot { background: linear-gradient(90deg, var(--red), #ef4444); box-shadow: 0 0 12px rgba(248, 113, 113, 0.45); }

/* stats */
.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 11px; margin-top: 18px;
}
.stat {
  background: var(--inset); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px;
}
.stat-label {
  display: block; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-3); margin-bottom: 5px;
}
.stat-value { font-family: var(--mono); font-size: 19px; font-weight: 700; }
.stat-sub { display: block; font-size: 11px; color: var(--text-3); margin-top: 3px; }

/* sparkline */
.spark-wrap { margin-top: 18px; }
.spark-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-3); margin-bottom: 8px;
}
.legend { display: flex; align-items: center; gap: 6px; font-weight: 600; letter-spacing: 0.03em; text-transform: none; font-size: 12px; }
.legend .lg { width: 14px; height: 3px; border-radius: 2px; display: inline-block; margin: 0 2px 0 10px; }
.lg-temp { background: var(--cyan); }
.lg-util { background: var(--violet); }
#spark { width: 100%; height: 110px; display: block; background: var(--inset); border: 1px solid var(--line); border-radius: 12px; }

/* ────────────────────────── modelos ────────────────────────── */
.models-list { display: flex; flex-direction: column; gap: 10px; max-height: 400px; overflow-y: auto; padding-right: 4px; }

.model-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  background: var(--inset); border: 1px solid var(--line);
  border-radius: 13px; padding: 13px 15px;
  transition: border-color 0.2s, transform 0.15s;
}
.model-row:hover { border-color: var(--line-strong); }
.model-row.loaded {
  border-color: rgba(52, 211, 153, 0.4);
  background: linear-gradient(90deg, rgba(52, 211, 153, 0.07), var(--inset) 45%);
  box-shadow: inset 3px 0 0 var(--green);
}
.model-main { min-width: 0; flex: 1; }
.model-name {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 14.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.loaded-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; animation: pulse 2s infinite; }
.model-meta { font-size: 12px; color: var(--text-3); font-family: var(--mono); margin-top: 2px; }
.model-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.badge {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  color: var(--text-2); background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--line); border-radius: 6px; padding: 2.5px 7px;
}
.badge-cap { color: var(--cyan); border-color: rgba(34, 211, 238, 0.3); background: rgba(34, 211, 238, 0.07); }
.badge-embed { color: var(--violet); border-color: rgba(129, 140, 248, 0.35); background: rgba(129, 140, 248, 0.08); }
.model-config { font-family: var(--mono); font-size: 11.5px; color: #6ee7b7; margin-top: 6px; }

.model-actions { display: flex; flex-direction: column; gap: 7px; flex: none; align-items: stretch; }
.btn-load {
  background: var(--grad); border: none; color: #05070d;
  padding: 8px 16px; font-size: 13px; border-radius: 9px; font-weight: 700;
}
.btn-load:hover { filter: brightness(1.07); box-shadow: 0 6px 18px -6px rgba(34, 211, 238, 0.55); }
.btn-load:disabled { opacity: 0.6; }
.btn-unload {
  background: transparent; border: 1px solid rgba(248, 113, 113, 0.45);
  color: #fca5a5; padding: 7px 16px; font-size: 13px; border-radius: 9px; font-weight: 700;
}
.btn-unload:hover { background: rgba(248, 113, 113, 0.12); }

.offline-box {
  border: 1px dashed var(--line-strong); border-radius: 13px;
  padding: 26px 20px; text-align: center;
}
.offline-title { font-weight: 700; color: #fca5a5; margin-bottom: 6px; }
.offline-msg { color: var(--text-2); font-size: 13.5px; margin-bottom: 14px; }

/* ────────────────────────── log ────────────────────────── */
.logs-panel { flex: none; }
.logs-head { margin-bottom: 12px; }
.logs-title h2 { font-size: 14.5px; }
.log-file { font-family: var(--mono); }
.logs-tools { display: flex; gap: 7px; }

.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: none; animation: pulse 2s infinite; }
.live-dot.paused { background: var(--text-3); animation: none; }

.log-body {
  height: 300px; overflow-y: auto;
  background: #05080f; border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 14px;
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
  position: relative;
}
.log-entry { display: flex; gap: 9px; padding: 1px 0; }
.log-ts { color: var(--text-3); flex: none; }
.log-lv { flex: none; width: 52px; font-weight: 700; }
.log-msg { white-space: pre-wrap; word-break: break-word; color: var(--text-2); min-width: 0; }
.lv-INFO .log-lv { color: var(--cyan); }
.lv-DEBUG .log-lv, .lv-DEBUG .log-msg { color: var(--text-3); }
.lv-WARN .log-lv, .lv-WARNING .log-lv { color: var(--amber); }
.lv-WARN .log-msg, .lv-WARNING .log-msg { color: #fcd34d; }
.lv-ERROR .log-lv { color: var(--red); }
.lv-ERROR .log-msg { color: #fca5a5; }
.log-cont { color: var(--text-3); padding-left: 22px; white-space: pre-wrap; word-break: break-word; }

.log-new {
  position: absolute; right: 18px; bottom: 14px;
  background: var(--grad); color: #05070d;
  font-size: 12px; font-weight: 700;
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  box-shadow: 0 8px 20px -6px rgba(34, 211, 238, 0.6);
  animation: fadeUp 0.25s ease;
}

/* scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.22); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.4); background-clip: content-box; }

/* toasts */
#toastHost { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--panel-solid); border: 1px solid var(--line-strong);
  border-radius: 12px; padding: 12px 18px;
  font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow);
  animation: fadeUp 0.3s ease;
  max-width: 360px;
}
.toast.ok { border-color: rgba(52, 211, 153, 0.5); color: #6ee7b7; }
.toast.err { border-color: rgba(248, 113, 113, 0.5); color: #fca5a5; }

/* ────────────────────────── pestañas ────────────────────────── */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--inset); border: 1px solid var(--line); border-radius: 12px; }
.tab-btn {
  background: none; border: 1px solid transparent; border-radius: 9px;
  color: var(--text-2); font: 600 13px var(--sans);
  padding: 7px 16px; cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: #05070d; background: var(--cyan);
  box-shadow: 0 4px 14px -4px rgba(34, 211, 238, 0.6);
}

/* ────────────────────────── pestaña sesión ────────────────────────── */
.layout-session { grid-template-columns: 5fr 7fr; align-items: start; }
.layout-session .panel { min-height: 0; }

.kv-note { font-size: 12px; color: var(--text-3); margin: 0 0 10px; }
.kv-note-sub { margin-top: 18px; }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.kv { background: var(--inset); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; min-width: 0; }
.kv-k { display: block; font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 3px; }
.kv-v { font-family: var(--mono); font-size: 12.5px; color: var(--text); word-break: break-word; }

.chip-warn { color: var(--amber); border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.08); }

.apps-note { font-size: 12.5px; color: var(--text-2); line-height: 1.55; background: var(--inset); border: 1px solid var(--line); border-radius: 10px; padding: 10px 13px; margin: 0 0 14px; }
.apps-note b { color: var(--text); }

.app-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.app-card { background: var(--inset); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.app-card-head { display: flex; align-items: center; gap: 9px; }
.app-card-head h3 { font-size: 15px; font-weight: 700; margin: 0; }
.app-port { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }
.app-dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(148, 163, 184, 0.3); flex: none; }
.app-dot.on { background: var(--green); box-shadow: 0 0 10px rgba(52, 211, 153, 0.7); }
.app-state { font-size: 12.5px; color: var(--text-2); font-family: var(--mono); }
.app-rules { font-size: 11.5px; color: var(--text-3); margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.app-rules-label { margin-right: 2px; }
.ip-chip {
  font-family: var(--mono); font-size: 11px; color: var(--cyan);
  background: rgba(34, 211, 238, 0.08); border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: 999px; padding: 2px 9px; cursor: default;
}

.switch-log { margin-top: 14px; background: #04060c; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-family: var(--mono); font-size: 12px; line-height: 1.7; }
.switch-log-title { font-weight: 700; margin-bottom: 6px; }
.switch-log-title.ok { color: #6ee7b7; }
.switch-log-title.fail { color: #fca5a5; }
.switch-step.ok { color: #6ee7b7; }
.switch-step.fail { color: #fca5a5; }
.switch-step.skip { color: var(--text-3); }

/* ────────────────────────── pestaña actividad ────────────────────────── */
.layout-activity { grid-template-columns: 1fr; }
.act-body {
  height: 380px; overflow-y: auto;
  background: #05080f; border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 10px;
  font-size: 12.5px; line-height: 1.5;
}
.act-row { display: flex; gap: 10px; align-items: baseline; padding: 5px 8px; border-bottom: 1px solid rgba(148, 163, 184, 0.07); }
.act-row:last-child { border-bottom: none; }
.act-ts { font-family: var(--mono); font-size: 11px; color: var(--text-3); flex: none; }
.act-badge {
  flex: none; font-size: 9.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text-2);
}
.act-row.act-login .act-badge { color: var(--cyan); border-color: rgba(34, 211, 238, 0.4); background: rgba(34, 211, 238, 0.08); }
.act-row.act-logout .act-badge { color: var(--text-3); }
.act-row.act-switch .act-badge { color: var(--violet); border-color: rgba(129, 140, 248, 0.4); background: rgba(129, 140, 248, 0.08); }
.act-row.act-load .act-badge { color: var(--green); border-color: rgba(52, 211, 153, 0.4); background: rgba(52, 211, 153, 0.08); }
.act-row.act-unload .act-badge { color: var(--amber); border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.08); }
.act-who { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); flex: none; }
.act-msg { font-family: var(--mono); font-size: 11.5px; color: var(--text); word-break: break-word; }

/* Prompts enviados a LM Studio / ComfyUI: resaltados */
.act-row.act-prompt {
  flex-wrap: wrap;
  background: rgba(244, 114, 182, 0.05);
  border-left: 3px solid #f472b6;
  border-radius: 6px;
  margin: 3px 0;
}
.act-row.act-prompt .act-badge { color: #f472b6; border-color: rgba(244, 114, 182, 0.5); background: rgba(244, 114, 182, 0.12); }
.act-prompt-text {
  flex-basis: 100%;
  margin-top: 4px; padding: 7px 11px;
  font-family: var(--mono); font-size: 12px; line-height: 1.55;
  color: #fde7f3; white-space: pre-wrap; word-break: break-word;
  background: rgba(244, 114, 182, 0.09);
  border: 1px solid rgba(244, 114, 182, 0.28); border-radius: 8px;
  max-height: 9.5em; overflow: hidden; cursor: pointer;
  -webkit-mask-image: linear-gradient(#000 70%, transparent);
          mask-image: linear-gradient(#000 70%, transparent);
}
.act-prompt-text.expanded { max-height: none; -webkit-mask-image: none; mask-image: none; }
.act-body.only-prompts .act-row:not(.act-prompt) { display: none; }
.act-row.act-key .act-badge { color: var(--amber); border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.08); }

/* Clave de acceso (pestaña Sesión) */
.layout-session > .panel { min-width: 0; } /* el ejemplo de uso no debe ensanchar la rejilla */
.key-status { font-size: 12.5px; color: var(--text-2); margin-bottom: 12px; }
.key-reveal {
  background: rgba(251, 191, 36, 0.06); border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 12px;
}
.key-warn { margin: 0 0 8px; font-size: 12.5px; color: #fde68a; }
.key-row { display: flex; gap: 8px; align-items: center; }
.key-value {
  flex: 1; min-width: 0; overflow-wrap: anywhere; user-select: all;
  font-family: var(--mono); font-size: 12.5px; color: var(--text);
  background: #04060c; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px;
}
.key-example {
  margin: 10px 0 0; padding: 10px 12px; overflow-x: auto;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.55; color: var(--text-2);
  background: #04060c; border: 1px solid var(--line); border-radius: 8px; white-space: pre;
}
.key-actions { display: flex; gap: 8px; }
.key-admin-row {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; background: var(--inset);
}
.key-admin-user { font-weight: 600; color: var(--text); }
.key-admin-meta { flex: 1; min-width: 0; font-family: var(--mono); font-size: 11px; color: var(--text-3); }
#actOnlyPromptsBtn.active { color: #f472b6; border-color: rgba(244, 114, 182, 0.5); }

/* ────────────────────────── responsive ────────────────────────── */
@media (max-width: 1120px) {
  .layout, .layout-session { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .layout { padding: 14px; }
  .temps-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .gauge-wrap { width: 84px; height: 84px; }
  .temp-value span:first-child { font-size: 23px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .topbar { flex-wrap: wrap; padding: 10px 14px; }
  .app-cards { grid-template-columns: 1fr; }
  .kv-grid { grid-template-columns: 1fr; }
  .model-row { flex-direction: column; align-items: stretch; }
  .model-actions { flex-direction: row; }
  .model-actions .btn { flex: 1; }
}
