/* =========================================================================
   Asistente Admin · sistema de diseño
   Tokens → base → layout → componentes → páginas → utilidades
   ========================================================================= */

/* ---------- Tokens (claro) ---------- */
:root {
  color-scheme: light;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "Cascadia Mono", Consolas, ui-monospace, monospace;

  --page: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eff1f5;
  --border: #e4e7ec;
  --border-strong: #d3d8e0;
  --text: #0f1729;
  --text-2: #4a5468;
  --muted: #7d8699;
  --accent: #4f46e5;
  --accent-2: #6366f1;
  --accent-soft: #eef0ff;
  --accent-ink: #ffffff;
  --ring: rgba(79, 70, 229, .28);
  --shadow-sm: 0 1px 2px rgba(15, 23, 41, .05);
  --shadow: 0 1px 2px rgba(15, 23, 41, .04), 0 4px 16px -4px rgba(15, 23, 41, .08);
  --shadow-lg: 0 24px 64px -16px rgba(15, 23, 41, .28), 0 2px 6px rgba(15, 23, 41, .06);
  --sidebar: #0f1324;
  --sidebar-2: #171c33;
  --sidebar-text: #c9cde0;
  --sidebar-muted: #7c829e;

  /* Estado (fijos, siempre con ícono + texto) */
  --good: #0ca30c;      --good-ink: #067406;  --good-soft: #e8f7e8;
  --warning: #fab219;   --warning-ink: #8a5a00; --warning-soft: #fff5dc;
  --serious: #ec835a;   --serious-ink: #a4441c; --serious-soft: #fdeee7;
  --critical: #d03b3b;  --critical-ink: #b32a2a; --critical-soft: #fdecec;
  --neutral-soft: #eef0f4; --neutral-ink: #4a5468;

  /* Serie categórica (orden fijo, validado para daltonismo) */
  --series-0: #2a78d6; --series-1: #eb6834; --series-2: #1baf7a; --series-3: #eda100;
  --series-4: #e87ba4; --series-5: #008300; --series-6: #6250d6; --series-7: #e34948;

  /* Gráficos */
  --grid: #e9eaee;
  --axis: #c3c2b7;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

/* ---------- Tokens (oscuro) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0b0d13;
    --surface: #12151d;
    --surface-2: #161a24;
    --surface-3: #1c2130;
    --border: #232838;
    --border-strong: #2f3548;
    --text: #e9ecf3;
    --text-2: #a9b0c2;
    --muted: #6f7890;
    --accent: #8b8cf8;
    --accent-2: #a5a6fb;
    --accent-soft: #1f2142;
    --accent-ink: #0b0d13;
    --ring: rgba(139, 140, 248, .35);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 64px -12px rgba(0, 0, 0, .7);
    --sidebar: #0a0c12;
    --sidebar-2: #141826;
    --good-ink: #3ccf3c; --good-soft: rgba(12, 163, 12, .14);
    --warning-ink: #fac552; --warning-soft: rgba(250, 178, 25, .14);
    --serious-ink: #f2a283; --serious-soft: rgba(236, 131, 90, .14);
    --critical-ink: #f07272; --critical-soft: rgba(208, 59, 59, .16);
    --neutral-soft: #1f2433; --neutral-ink: #a9b0c2;
    --series-0: #3987e5; --series-1: #d95926; --series-2: #199e70; --series-3: #c98500;
    --series-4: #d55181; --series-5: #008300; --series-6: #9085e9; --series-7: #e66767;
    --grid: #22273a;
    --axis: #383d50;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b0d13;
  --surface: #12151d;
  --surface-2: #161a24;
  --surface-3: #1c2130;
  --border: #232838;
  --border-strong: #2f3548;
  --text: #e9ecf3;
  --text-2: #a9b0c2;
  --muted: #6f7890;
  --accent: #8b8cf8;
  --accent-2: #a5a6fb;
  --accent-soft: #1f2142;
  --accent-ink: #0b0d13;
  --ring: rgba(139, 140, 248, .35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .5);
  --shadow-lg: 0 24px 64px -12px rgba(0, 0, 0, .7);
  --sidebar: #0a0c12;
  --sidebar-2: #141826;
  --good-ink: #3ccf3c; --good-soft: rgba(12, 163, 12, .14);
  --warning-ink: #fac552; --warning-soft: rgba(250, 178, 25, .14);
  --serious-ink: #f2a283; --serious-soft: rgba(236, 131, 90, .14);
  --critical-ink: #f07272; --critical-soft: rgba(208, 59, 59, .16);
  --neutral-soft: #1f2433; --neutral-ink: #a9b0c2;
  --series-0: #3987e5; --series-1: #d95926; --series-2: #199e70; --series-3: #c98500;
  --series-4: #d55181; --series-5: #008300; --series-6: #9085e9; --series-7: #e66767;
  --grid: #22273a;
  --axis: #383d50;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 14px/1.5 var(--font);
  color: var(--text);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--ring); }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: var(--sidebar-text);
  padding: 18px 14px;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 22px; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  color: #fff; background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #ec4899 120%);
  box-shadow: 0 6px 20px -6px rgba(99, 102, 241, .8), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand-mark .i { width: 19px; height: 19px; }
.brand-mark.lg { width: 56px; height: 56px; border-radius: 16px; }
.brand-mark.lg .i { width: 28px; height: 28px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { color: #fff; font-size: 15px; }
.brand-text small { color: var(--sidebar-muted); font-size: 12px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--sidebar-muted); padding: 14px 10px 6px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 9px; font-weight: 500; color: var(--sidebar-text);
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav-item.active { background: rgba(139, 140, 248, .14); color: #fff; }
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #818cf8, #c084fc);
}
.nav-item.active .i { color: #a5b4fc; }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  display: grid; place-items: center; font-size: 11.5px; font-weight: 700;
  background: var(--warning); color: #1a1200;
  animation: pop .4s var(--ease);
}
.sidebar-foot { display: flex; align-items: center; gap: 8px; padding: 12px 8px 4px; border-top: 1px solid rgba(255, 255, 255, .07); }
.me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.me-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.me-text strong { color: #fff; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.me-text small { color: var(--sidebar-muted); font-size: 11.5px; }
.sidebar .icon-btn { color: var(--sidebar-text); }
.sidebar .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sidebar .avatar { background: rgba(255, 255, 255, .1); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  height: 64px; padding: 0 28px;
  background: color-mix(in srgb, var(--page) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-title h1 { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb { color: var(--muted); font-weight: 500; }
.crumb:hover { color: var(--text); }
.crumb-sep { width: 14px; height: 14px; color: var(--muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search-trigger {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 12px; min-width: 240px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--muted); cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.search-trigger:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.search-trigger span { flex: 1; text-align: left; }
kbd {
  font: 600 11px var(--font); padding: 2px 6px; border-radius: 6px;
  background: var(--surface-3); border: 1px solid var(--border); color: var(--text-2);
}

.content { padding: 28px; max-width: 1320px; width: 100%; margin: 0 auto; animation: rise .35s var(--ease); }
.scrim { display: none; }
.only-mobile { display: none !important; }

/* ---------- Encabezados de página ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.eyebrow { font-size: 12.5px; font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.page-title { font-size: 24px; font-weight: 650; letter-spacing: -.02em; }
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; cursor: pointer; white-space: nowrap; user-select: none;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .1s, color .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.primary {
  color: #fff; background: linear-gradient(180deg, #5b54f0 0%, #4f46e5 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .2) inset, 0 4px 14px -4px rgba(79, 70, 229, .6);
}
.btn.primary:hover { background: linear-gradient(180deg, #6760f3 0%, #5850ea 100%); box-shadow: 0 1px 0 rgba(255, 255, 255, .2) inset, 0 8px 22px -6px rgba(79, 70, 229, .7); }
.btn.ghost { background: var(--surface); border-color: var(--border); color: var(--text); box-shadow: var(--shadow-sm); }
.btn.ghost:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn.danger { background: var(--critical); color: #fff; }
.btn.danger:hover { background: #b93131; }
.btn.danger-outline { background: transparent; border-color: color-mix(in srgb, var(--critical) 45%, transparent); color: var(--critical-ink); }
.btn.danger-outline:hover { background: var(--critical-soft); }
.btn.good-soft { background: var(--good-soft); color: var(--good-ink); }
.btn.good-soft:hover { background: color-mix(in srgb, var(--good) 22%, transparent); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; gap: 6px; }
.btn.sm .i { width: 15px; height: 15px; }
.btn.lg { height: 46px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn .spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  border: 0; background: transparent; color: var(--text-2); cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn.sm .i { width: 16px; height: 16px; }
.icon-btn.danger-hover:hover { background: var(--critical-soft); color: var(--critical-ink); }
.show-dark { display: none; }
:root[data-theme="dark"] .show-dark { display: block; }
:root[data-theme="dark"] .show-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .show-dark { display: block; }
  :root:not([data-theme="light"]) .show-light { display: none; }
}

.link { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 13px; color: var(--accent); }
.link .i { width: 15px; height: 15px; transition: transform .15s; }
.link:hover .i { transform: translateX(2px); }

/* ---------- Tarjetas ---------- */
.card {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 20px;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.span-2 { grid-column: span 2; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.kpi {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 18px 16px; box-shadow: var(--shadow);
  transition: transform .2s var(--ease), box-shadow .2s, border-color .2s;
}
.kpi::after {
  content: ""; position: absolute; inset: -60% -30% auto auto; width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--accent-soft), transparent); opacity: .9; pointer-events: none;
}
.kpi-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.kpi-top { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-weight: 500; font-size: 13px; position: relative; z-index: 1; }
.kpi-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); }
.kpi-icon .i { width: 16px; height: 16px; }
.kpi-value { font-family: var(--font-display); font-size: 30px; font-weight: 650; letter-spacing: -.03em; margin: 12px 0 4px; position: relative; z-index: 1; }
.kpi-value small { font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.kpi-foot { color: var(--muted); font-size: 12.5px; position: relative; z-index: 1; }
.kpi.attention { border-color: color-mix(in srgb, var(--warning) 55%, var(--border)); }
.kpi.attention .kpi-icon { background: var(--warning-soft); color: var(--warning-ink); }
.kpi.attention::after { background: radial-gradient(closest-side, var(--warning-soft), transparent); }

/* ---------- En vivo ---------- */
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 rgba(12, 163, 12, .6); animation: pulse 2s infinite; }
.live.stale .live-dot { background: var(--muted); animation: none; }

/* ---------- Badges, chips, tags ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px 0 7px;
  border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge .i { width: 14px; height: 14px; stroke-width: 2; }
.badge.good { background: var(--good-soft); color: var(--good-ink); }
.badge.warning { background: var(--warning-soft); color: var(--warning-ink); }
.badge.serious { background: var(--serious-soft); color: var(--serious-ink); }
.badge.critical { background: var(--critical-soft); color: var(--critical-ink); }
.badge.neutral { background: var(--neutral-soft); color: var(--neutral-ink); }
.pill { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; font-size: 11px; font-weight: 700; }
.pill.warning { background: var(--warning); color: #1a1200; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); padding: 3px 8px; border-radius: 7px; background: var(--surface-3); }
.tag .i { width: 13px; height: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.good { background: var(--good); } .dot.warning { background: var(--warning); } .dot.critical { background: var(--critical); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 500; font-size: 13px;
  transition: all .15s;
}
.chip span:last-child:not(.dot) { font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--surface-3); border-radius: 999px; padding: 1px 7px; }
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--text); border-color: var(--text); color: var(--surface); }
.chip.active span:last-child:not(.dot) { background: color-mix(in srgb, var(--surface) 20%, transparent); color: var(--surface); }

.tenant-chip { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; white-space: nowrap; }
.swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }

/* Colores categóricos por entorno */
.c-0 { --c: var(--series-0); } .c-1 { --c: var(--series-1); } .c-2 { --c: var(--series-2); } .c-3 { --c: var(--series-3); }
.c-4 { --c: var(--series-4); } .c-5 { --c: var(--series-5); } .c-6 { --c: var(--series-6); } .c-7 { --c: var(--series-7); }

/* ---------- Avatares ---------- */
.avatar {
  display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 11px;
  font-weight: 700; font-size: 13px; letter-spacing: .02em;
  background: color-mix(in srgb, var(--c, var(--accent)) 16%, transparent);
  color: color-mix(in srgb, var(--c, var(--accent)) 80%, var(--text));
  border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 25%, transparent);
}
.avatar.sm { width: 32px; height: 32px; border-radius: 9px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 19px; }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > span:first-child { font-weight: 600; font-size: 13px; }
.field input:not([type="checkbox"]), .field select, .field textarea, .select-sm, .input-icon input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.55; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border-strong)); }
.field input:focus, .field select:focus, .field textarea:focus, .input-icon input:focus, .select-sm:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring);
}
.field .input-validation-error { border-color: var(--critical) !important; box-shadow: 0 0 0 4px var(--critical-soft) !important; }
.field-error { color: var(--critical-ink); font-size: 12.5px; font-weight: 500; }
.field-error:empty { display: none; }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.counter { float: right; font-variant-numeric: tabular-nums; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 22px; }
.form-grid .field.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 16px; }

.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > .i { position: absolute; left: 12px; color: var(--muted); pointer-events: none; width: 17px; height: 17px; }
.input-icon input { padding-left: 38px !important; }
.input-icon .input-action ~ input, .input-icon input:has(~ .input-action) { padding-right: 42px !important; }
.input-action {
  position: absolute; right: 4px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.input-action:hover { background: var(--surface-3); color: var(--text); }
.input-icon.search input { width: 260px; height: 38px; }
.input-icon.search.sm input { width: 220px; height: 34px; }
.input-suffix { display: flex; align-items: stretch; }
.input-suffix input { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }
.input-suffix span {
  display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-left: 0;
  border-radius: 0 10px 10px 0; background: var(--surface-2); color: var(--muted); font-size: 13px;
}
.select-sm { height: 34px; width: auto; padding-right: 28px; }

.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; color: var(--text-2); font-size: 13.5px; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

/* Switch */
.switch { position: relative; display: inline-flex; cursor: pointer; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch-track {
  width: 42px; height: 24px; border-radius: 999px; background: var(--border-strong); padding: 3px;
  transition: background .2s var(--ease);
}
.switch-thumb {
  display: block; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .25s var(--ease);
}
.switch input:checked + .switch-track { background: var(--good); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 4px var(--ring); }

.setting-list { margin-top: 24px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 18px; cursor: pointer; transition: background .15s; }
.setting + .setting { border-top: 1px solid var(--border); }
.setting:hover { background: var(--surface-2); }
.setting strong { display: block; font-size: 14px; }
.setting span { color: var(--muted); font-size: 13px; }

/* Contraseña: fuerza */
.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.strength span { height: 4px; border-radius: 2px; background: var(--surface-3); transition: background .2s; }
.strength[data-score="1"] span:nth-child(-n+1) { background: var(--critical); }
.strength[data-score="2"] span:nth-child(-n+2) { background: var(--serious); }
.strength[data-score="3"] span:nth-child(-n+3) { background: var(--warning); }
.strength[data-score="4"] span { background: var(--good); }

/* ---------- Alertas y banners ---------- */
.alert { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; font-weight: 500; font-size: 13.5px; }
.alert.critical { background: var(--critical-soft); color: var(--critical-ink); }
.validation-summary ul { margin: 0; padding-left: 18px; }
.validation-summary.validation-summary-valid { display: none; }
.validation-summary { margin-bottom: 14px; }
.info-banner {
  display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; margin-bottom: 18px; border-radius: var(--radius);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent); color: var(--text-2);
}
.info-banner > .i { color: var(--accent); margin-top: 1px; }
.info-banner strong { display: block; color: var(--text); margin-bottom: 2px; }
.info-banner.subtle { background: var(--surface); border-color: var(--border); padding: 10px 14px; font-size: 13px; }
.info-banner.subtle > .i { color: var(--muted); }

/* ---------- Vacíos ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 36px 20px; color: var(--muted); }
.empty > .i { width: 40px; height: 40px; padding: 9px; border-radius: 12px; background: var(--surface-3); color: var(--text-2); margin-bottom: 6px; }
.empty strong { color: var(--text); font-size: 14.5px; }
.empty span { max-width: 340px; font-size: 13px; }
.empty .btn { margin-top: 10px; }
.filter-empty { text-align: center; color: var(--muted); padding: 24px; }
.hero-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 56px 24px; }
.hero-empty h3 { font-size: 20px; margin-top: 8px; }
.hero-empty p { color: var(--text-2); max-width: 520px; }

/* ---------- Medidores ---------- */
.meter { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter.lg { height: 10px; }
.meter > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--c, var(--accent)); transition: width .9s var(--ease); }
.meter.warning > span { background: var(--warning); }
.meter.critical > span { background: var(--critical); }

/* ---------- Lista de uso por entorno ---------- */
.usage-list { list-style: none; margin: 0 -10px; padding: 0; display: flex; flex-direction: column; }
.usage-row { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; transition: background .15s; }
.usage-row:hover { background: var(--surface-2); }
.usage-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.usage-top { display: flex; align-items: center; gap: 8px; }
.usage-top strong { font-weight: 600; }
.usage-num { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; }
.usage-num small { color: var(--muted); font-weight: 500; }
.usage-foot { font-size: 12px; color: var(--muted); }

/* ---------- Usuarios ---------- */
.user-list { display: flex; flex-direction: column; container-type: inline-size; }
/* En tarjetas angostas, estado y acciones pasan a una segunda línea. */
@container (max-width: 620px) {
  .user-row { grid-template-columns: auto 1fr auto; row-gap: 8px; }
  .user-row .row-actions { grid-column: 2 / -1; }
  .user-row .row-actions .btn span { display: none; }
}
.card:not(.flush) .user-list { margin: 0 -10px; }
.user-row {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 14px;
  padding: 12px 14px; border-radius: 12px; transition: background .2s, opacity .3s, transform .3s;
}
.card.flush .user-row { border-radius: 0; padding: 14px 20px; }
.card.flush .user-row + .user-row { border-top: 1px solid var(--border); }
.user-row:hover { background: var(--surface-2); }
.user-row.leaving { opacity: 0; transform: translateX(16px); }
.user-main { min-width: 0; }
.user-name { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.editable { border-radius: 6px; padding: 1px 4px; margin: -1px -4px; cursor: text; outline: none; transition: background .15s, box-shadow .15s; }
.editable:hover { background: var(--surface-3); }
.editable[contenteditable="true"] { background: var(--surface); box-shadow: 0 0 0 2px var(--accent); }
.edit-hint { width: 13px; height: 13px; color: var(--muted); opacity: 0; transition: opacity .15s; }
.user-row:hover .edit-hint { opacity: 1; }
.user-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.row-actions { display: flex; align-items: center; gap: 6px; }
.user-row[data-status="1"] [data-user-action="approve"] { display: none; }
.user-row[data-status="2"] [data-user-action="block"] { display: none; }
.user-row[data-status="2"] [data-user-action="approve"] span { display: none; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px -20px; }
.card.flush .table-wrap { margin: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em;
  padding: 10px 20px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr.fresh { animation: flash 1.6s var(--ease); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-top: 1px solid var(--border); }
.pager div { display: flex; gap: 8px; }

/* ---------- Segmentado ---------- */
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-3); gap: 2px; }
.seg-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 8px; border: 0;
  background: transparent; color: var(--text-2); font-weight: 600; font-size: 12.5px; cursor: pointer;
}
.seg-btn .i { width: 15px; height: 15px; }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Gráficos ---------- */
.chart { position: relative; min-height: 260px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar { transition: opacity .15s; }
.chart.hovering .col:not(.hot) .bar { opacity: .35; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .col.hot .hit { fill: var(--surface-3); opacity: .6; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: -4px 0 12px; font-size: 12.5px; color: var(--text-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.chart-empty { display: grid; place-items: center; height: 240px; color: var(--muted); text-align: center; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 170px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg);
  padding: 10px 12px; font-size: 12.5px; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
.chart-tip.show { opacity: 1; transform: none; }
.chart-tip strong { display: block; margin-bottom: 6px; font-size: 12px; color: var(--text-2); }
.chart-tip .row { display: flex; align-items: center; gap: 8px; padding: 1px 0; }
.chart-tip .row b { margin-left: auto; font-variant-numeric: tabular-nums; }
.chart-tip .total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; font-weight: 600; }
.chart-table { max-height: 320px; overflow: auto; }
.chart-table .table th, .chart-table .table td { padding: 7px 14px; }

/* ---------- Entornos ---------- */
.tenant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.tenant-card {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow);
  transition: transform .2s var(--ease), box-shadow .2s, border-color .2s, opacity .2s;
}
.tenant-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.tenant-card.is-off { opacity: .72; }
.tenant-card.is-off .tenant-accent { filter: grayscale(1); opacity: .5; }
.tenant-accent { position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--c); }
.tenant-head { display: flex; align-items: center; gap: 12px; }
.tenant-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tenant-title strong { font-size: 15.5px; }
.tenant-title a:hover strong { color: var(--accent); }
.skill-id {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 0; border: 0; background: none;
  color: var(--muted); cursor: pointer; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.skill-id .i { width: 13px; height: 13px; opacity: 0; transition: opacity .15s; flex: none; }
.skill-id:hover { color: var(--text); }
.skill-id:hover .i { opacity: 1; }
.skill-id.block { display: flex; width: 100%; padding: 8px 10px; border-radius: 8px; background: var(--surface-3); margin: 8px 0 6px; }
.skill-id.block .i { opacity: .7; margin-left: auto; }
.tenant-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.tenant-stats div { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.tenant-stats dt { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.tenant-stats dd { margin: 2px 0 0; font-size: 15px; white-space: nowrap; font-weight: 650; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 6px; }
.tenant-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.tenant-state { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--good-ink); }
.is-off .tenant-state { color: var(--muted); }
.add-card {
  align-items: center; justify-content: center; text-align: center; gap: 6px; min-height: 236px;
  border: 1.5px dashed var(--border-strong); background: transparent; box-shadow: none; color: var(--muted);
}
.add-card:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.add-card strong { color: var(--text); }
.add-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--surface-3); margin-bottom: 6px; transition: transform .2s var(--ease); }
.add-card:hover .add-icon { transform: rotate(90deg) scale(1.05); background: var(--surface); }

/* ---------- Edición ---------- */
.edit-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.edit-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.sticky { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 10px; }
.sticky h3 { font-size: 15px; }
.sticky .muted { font-size: 13px; margin-bottom: 4px; }
.sticky hr { margin: 8px 0; }
.side-help strong { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.side-help strong .i { width: 15px; height: 15px; color: var(--accent); }
.side-help small { color: var(--muted); font-size: 12px; }

.tenant-hero { display: flex; align-items: center; gap: 16px; overflow: hidden; flex-wrap: wrap; }
.tenant-hero-main { flex: 1; min-width: 200px; }
.tenant-hero-main h2 { font-size: 21px; }
.hero-stats { display: flex; gap: 26px; margin: 0; }
.hero-stats dt { font-size: 12px; color: var(--muted); }
.hero-stats dd { margin: 2px 0 0; font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px;
  border: 0; background: none; color: var(--text-2); font-weight: 600; cursor: pointer; white-space: nowrap;
}
.tab .i { width: 16px; height: 16px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); }
.tab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; border-radius: 2px; background: var(--accent); }
.tab-panel { animation: rise .25s var(--ease); }
.panel-intro { color: var(--text-2); margin-bottom: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.danger-zone {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 24px; padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--critical) 30%, var(--border)); border-radius: var(--radius); background: color-mix(in srgb, var(--critical-soft) 50%, transparent);
}
.danger-zone strong { display: block; }
.danger-zone span { color: var(--muted); font-size: 13px; }
.test-box {
  display: grid; grid-template-columns: 1fr auto; gap: 12px 18px; align-items: center; margin-top: 22px; padding: 16px 18px;
  border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border);
}
.test-box strong { display: block; }
.test-box > div > span { color: var(--muted); font-size: 13px; }
.test-result { grid-column: 1 / -1; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; font-size: 13.5px; animation: rise .25s var(--ease); }
.test-result.good { background: var(--good-soft); color: var(--good-ink); }
.test-result.critical { background: var(--critical-soft); color: var(--critical-ink); }
.test-result small { display: block; opacity: .8; }
.limit-now { margin-top: 22px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- Cuenta ---------- */
.profile { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.profile h3 { font-size: 18px; }
.facts { display: grid; gap: 0; margin: 0; border-top: 1px solid var(--border); }
.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; text-align: right; }
.account { align-items: start; }

/* ---------- Dispositivos ---------- */
.device-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.device-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 8px; border-radius: 8px;
  background: var(--surface-3); border: 1px solid var(--border); font-size: 12px; color: var(--text-2);
}
.device-chip > .i { width: 14px; height: 14px; color: var(--muted); }
.device-chip .editable { font-weight: 600; color: var(--text); }
.device-chip time { font-size: 11.5px; }
.cell-sub { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ---------- Salud ---------- */
.tenant-health { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); min-height: 24px; }
.tenant-health > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health-banner {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 18px; border-radius: var(--radius);
  border: 1px solid; animation: rise .3s var(--ease);
}
.health-banner > .i { flex: none; }
.health-banner > div { flex: 1; min-width: 0; }
.health-banner strong { display: block; color: var(--text); }
.health-banner span { color: var(--text-2); font-size: 13px; }
.health-banner.warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 45%, transparent); }
.health-banner.warning > .i { color: var(--warning-ink); }
.health-banner.critical { background: var(--critical-soft); border-color: color-mix(in srgb, var(--critical) 40%, transparent); }
.health-banner.critical > .i { color: var(--critical-ink); }
.health-panel { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 22px; background: var(--surface-2); }
.health-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.health-head > div { flex: 1; }
.health-head strong { display: block; }
.health-head span { color: var(--text-2); font-size: 13px; }
.health-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; flex: none; }
.health-panel.good .health-icon { background: var(--good-soft); color: var(--good-ink); }
.health-panel.warning .health-icon { background: var(--warning-soft); color: var(--warning-ink); }
.health-panel.critical .health-icon { background: var(--critical-soft); color: var(--critical-ink); }
.health-panel.neutral .health-icon { background: var(--neutral-soft); color: var(--neutral-ink); }
.health-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
.health-stats div { padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); min-width: 0; }
.health-stats dt { font-size: 11.5px; color: var(--muted); }
.health-stats dd { margin: 2px 0 0; font-weight: 650; font-variant-numeric: tabular-nums; font-size: 14px; }
.tenant-hero-main h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Dueños ---------- */
.invite-form { display: flex; gap: 10px; margin-bottom: 14px; }
.invite-form .input-icon { flex: 1; }
.invite-form .input-icon input {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface);
}
.invite-link {
  display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; margin-bottom: 16px; border-radius: var(--radius);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); animation: rise .3s var(--ease);
}
.invite-link strong { display: block; }
.invite-link > div > span { color: var(--text-2); font-size: 13px; }
.invite-url { display: flex; align-items: center; gap: 10px; }
.invite-url code {
  flex: 1; min-width: 0; padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border);
  font: 12px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.owner-list { display: flex; flex-direction: column; margin: 0 -10px; }
.owner-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; transition: background .2s, opacity .3s, transform .3s; }
.owner-row:hover { background: var(--surface-2); }
.owner-row.leaving { opacity: 0; transform: translateX(16px); }

/* ---------- Solo lectura (dueños) ---------- */
.readonly-note { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.readonly-note .i { color: var(--accent); width: 16px; height: 16px; }
.field input:disabled, .field select:disabled { background: var(--surface-2); color: var(--text-2); cursor: default; }
.setting-list.is-readonly .setting { cursor: default; }
.setting-list.is-readonly .switch { opacity: .7; pointer-events: none; }
.info-banner.tight { margin: 20px 0 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Diálogos ---------- */
dialog { border: 0; padding: 0; background: transparent; color: inherit; max-width: calc(100vw - 32px); }
dialog::backdrop { background: rgba(8, 10, 18, .55); backdrop-filter: blur(4px); animation: fade .2s; }
.modal-box {
  width: 420px; max-width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 24px; box-shadow: var(--shadow-lg); animation: zoom .22s var(--ease);
}
.modal-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--critical-soft); color: var(--critical-ink); margin-bottom: 14px; }
.modal-box h2 { font-size: 17px; margin-bottom: 6px; }
.modal-box p { color: var(--text-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

.palette { margin-top: 12vh; }
.palette-box { width: 580px; max-width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; animation: zoom .18s var(--ease); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.palette-input .i { color: var(--muted); }
.palette-input input { flex: 1; height: 54px; border: 0; background: transparent; outline: none; font-size: 15px; }
.palette-list { list-style: none; margin: 0; padding: 8px; max-height: 360px; overflow-y: auto; }
.palette-list li a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); }
.palette-list li a .meta { margin-left: auto; font-size: 12px; color: var(--muted); }
.palette-list li.sel a { background: var(--accent-soft); color: var(--text); }
.palette-list li.sel a .i { color: var(--accent); }
.palette-list .group { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 10px 12px 4px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; min-width: 280px; max-width: 420px;
  padding: 12px 14px; border-radius: 12px; background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg);
  font-weight: 500; animation: toast-in .3s var(--ease);
}
.toast .i { flex: none; }
.toast.good .i { color: #4ade80; }
.toast.critical .i { color: #f87171; }
.toast.leaving { animation: toast-out .25s var(--ease) forwards; }

/* ---------- Login ---------- */
body.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; background: var(--surface); }
.auth-hero {
  position: relative; overflow: hidden; display: flex; align-items: center; padding: 64px;
  color: #e6e8f5; background:
    radial-gradient(900px 500px at 10% 0%, rgba(99, 102, 241, .45), transparent 60%),
    radial-gradient(700px 500px at 100% 100%, rgba(236, 72, 153, .28), transparent 60%),
    linear-gradient(160deg, #0d1022 0%, #151a36 100%);
}
.auth-hero::before {
  content: ""; position: absolute; inset: 0; opacity: .25;
  background-image: linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(closest-side, #000, transparent);
}
.auth-hero-inner { position: relative; max-width: 480px; display: flex; flex-direction: column; gap: 20px; }
.auth-hero h2 { font-size: 40px; line-height: 1.1; font-weight: 700; color: #fff; letter-spacing: -.03em; }
.auth-hero p { color: #aeb3d1; font-size: 16px; }
.auth-points { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 12px; }
.auth-points li { display: flex; align-items: center; gap: 12px; color: #d4d7ea; }
.auth-points .i { width: 32px; height: 32px; padding: 7px; border-radius: 9px; background: rgba(255, 255, 255, .08); color: #a5b4fc; }
.voice-wave { display: flex; align-items: center; gap: 6px; height: 54px; margin-top: 20px; }
.voice-wave span { width: 6px; border-radius: 3px; background: linear-gradient(180deg, #a5b4fc, #f0abfc); animation: wave 1.4s ease-in-out infinite; }
.voice-wave span:nth-child(1) { animation-delay: -1.2s; } .voice-wave span:nth-child(2) { animation-delay: -1.1s; }
.voice-wave span:nth-child(3) { animation-delay: -.9s; }  .voice-wave span:nth-child(4) { animation-delay: -.7s; }
.voice-wave span:nth-child(5) { animation-delay: -.5s; }  .voice-wave span:nth-child(6) { animation-delay: -.65s; }
.voice-wave span:nth-child(7) { animation-delay: -.85s; } .voice-wave span:nth-child(8) { animation-delay: -1s; }
.voice-wave span:nth-child(9) { animation-delay: -1.15s; }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; background: var(--page); }
.auth-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; animation: rise .4s var(--ease); }
.auth-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.auth-head p { color: var(--muted); margin-top: 4px; }
.auth-head .brand-mark { margin-bottom: 16px; }
.auth-foot { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 12px; text-align: center; }
.auth-foot .i { width: 14px; height: 14px; }

/* ---------- Animaciones ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes zoom { from { opacity: 0; transform: scale(.96) translateY(6px); } }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(12, 163, 12, .55); } 70% { box-shadow: 0 0 0 8px rgba(12, 163, 12, 0); } 100% { box-shadow: 0 0 0 0 rgba(12, 163, 12, 0); } }
@keyframes wave { 0%, 100% { height: 12px; opacity: .6; } 50% { height: 50px; opacity: 1; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }
@keyframes flash { from { background: var(--accent-soft); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .edit-layout { grid-template-columns: 1fr; }
  .sticky { position: static; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; transform: translateX(-100%); transition: transform .28s var(--ease); }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(8, 10, 18, .5); }
  .only-mobile { display: inline-grid !important; }
  .topbar { padding: 0 16px; }
  .search-trigger { min-width: 0; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .content { padding: 20px 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .field.span-2 { grid-column: auto; }
  body.auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-head .brand-mark.only-mobile { display: grid !important; }
  .hero-stats { width: 100%; justify-content: space-between; gap: 12px; }
  .user-row { grid-template-columns: auto 1fr; }
  .user-row .badge, .user-row .row-actions { grid-column: 2; justify-self: start; }
  .row-actions .btn span { display: none; }
  .input-icon.search input, .input-icon.search.sm input { width: 100%; }
  .head-actions, .toolbar-right { width: 100%; }
  .head-actions .search { flex: 1; }
  .danger-zone, .panel-head { flex-direction: column; align-items: flex-start; }
  .test-box { grid-template-columns: 1fr; }
  .health-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .health-banner { flex-wrap: wrap; }
  .invite-form, .invite-url { flex-direction: column; align-items: stretch; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr; }
  .tenant-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 20px; }
}
