/* ════════════════════════════════════════════════════════════════════
   KC UI — capa de diseño común de KC Systems
   ────────────────────────────────────────────────────────────────────
   Se carga DESPUÉS del <style> de cada pantalla y le gana por orden y
   especificidad (html[data-theme]). Las pantallas siguen escribiendo sus
   variables de siempre (--text, --surface, --gold, --text-3...): acá se
   redefinen todas, así que la lógica de cada plantilla no se toca.

   Regla de animación: solo transform y opacity, 150–300 ms en UI,
   y nada se mueve con prefers-reduced-motion.
   ════════════════════════════════════════════════════════════════════ */

/* ─── Tokens: claro ─────────────────────────────────────────────────── */
html:root,
html[data-theme="light"] {
  --kc-font: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --kc-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', monospace;
  --kc-acc: #0891b2;           /* cian */
  --kc-acc-2: #7c3aed;         /* violeta */
  --kc-acc-rgb: 8,145,178;
  --kc-grad: linear-gradient(135deg, #06b6d4 0%, #6366f1 55%, #8b5cf6 100%);
  --kc-glow: 0 8px 28px -10px rgba(14,116,144,.45);
  --kc-glass: rgba(255,255,255,.78);
  --kc-grid: rgba(15,23,42,.045);
  --kc-ease: cubic-bezier(.22,1,.36,1);
  --kc-spring: cubic-bezier(.34,1.56,.64,1);

  --bg: #f2f5fa; --bg2: #e9eef6; --bg-2: #e9eef6;
  --surface: #ffffff; --surface-2: #f5f7fb; --surface-3: #eef2f8; --surface-hover: #f3f6fb;
  --border: #dde3ee; --border-2: #c7d0df; --border-light: #e8ecf3;
  --text: #0b1220; --text-2: #334155; --text-3: #5b6578; --text-4: #8a93a6;
  --text-muted: #5b6578; --text-subtle: #8a93a6;
  --accent: #0891b2; --accent-dim: rgba(8,145,178,.10);
  --gold: #0891b2; --gold-dim: rgba(8,145,178,.10); --gold-glow: rgba(8,145,178,.18);
  --blue: #2563eb; --blue-dim: rgba(37,99,235,.10); --blue-bg: rgba(37,99,235,.08); --blue-bd: rgba(37,99,235,.25);
  --green: #059669; --green-dim: rgba(5,150,105,.10); --green-bg: rgba(5,150,105,.08); --green-bd: rgba(5,150,105,.28);
  --red: #dc2626; --red-dim: rgba(220,38,38,.09); --red-bg: rgba(220,38,38,.07); --red-bd: rgba(220,38,38,.28);
  --amber: #d97706; --amber-bg: rgba(217,119,6,.09); --amber-bd: rgba(217,119,6,.3);
  --orange: #d97706; --orange-dim: rgba(217,119,6,.10);
  --purple: #7c3aed; --purple-dim: rgba(124,58,237,.10);
  --font: var(--kc-font); --font-serif: var(--kc-font);
  --radius-sm: 9px; --radius: 13px; --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow: 0 6px 22px -8px rgba(15,23,42,.14);
  --shadow-lg: 0 24px 60px -18px rgba(15,23,42,.25);
  --ease: var(--kc-ease);
  color-scheme: light;
}

/* ─── Tokens: oscuro (el de la casa) ───────────────────────────────── */
html[data-theme="dark"] {
  --kc-acc: #22d3ee;
  --kc-acc-2: #a78bfa;
  --kc-acc-rgb: 34,211,238;
  --kc-grad: linear-gradient(135deg, #22d3ee 0%, #6366f1 55%, #a855f7 100%);
  --kc-glow: 0 0 0 1px rgba(34,211,238,.25), 0 10px 34px -10px rgba(34,211,238,.45);
  --kc-glass: rgba(13,18,28,.72);
  --kc-grid: rgba(148,163,200,.05);

  --bg: #05070c; --bg2: #090d15; --bg-2: #090d15;
  --surface: #0c111b; --surface-2: #111724; --surface-3: #161e2d; --surface-hover: #131a28;
  --border: rgba(148,163,200,.12); --border-2: rgba(148,163,200,.22); --border-light: rgba(148,163,200,.08);
  --text: #e8edf7; --text-2: #c2cadb; --text-3: #8b95a9; --text-4: #5c6679;
  --text-muted: #8b95a9; --text-subtle: #5c6679;
  --accent: #22d3ee; --accent-dim: rgba(34,211,238,.12);
  --gold: #22d3ee; --gold-dim: rgba(34,211,238,.12); --gold-glow: rgba(34,211,238,.22);
  --blue: #60a5fa; --blue-dim: rgba(96,165,250,.13); --blue-bg: rgba(96,165,250,.10); --blue-bd: rgba(96,165,250,.3);
  --green: #34d399; --green-dim: rgba(52,211,153,.13); --green-bg: rgba(52,211,153,.09); --green-bd: rgba(52,211,153,.3);
  --red: #fb7185; --red-dim: rgba(251,113,133,.12); --red-bg: rgba(251,113,133,.09); --red-bd: rgba(251,113,133,.32);
  --amber: #fbbf24; --amber-bg: rgba(251,191,36,.10); --amber-bd: rgba(251,191,36,.3);
  --orange: #fbbf24; --orange-dim: rgba(251,191,36,.12);
  --purple: #a78bfa; --purple-dim: rgba(167,139,250,.14);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 10px 30px -12px rgba(0,0,0,.7);
  --shadow-lg: 0 30px 80px -20px rgba(0,0,0,.85);
  color-scheme: dark;
}

/* ─── Base ──────────────────────────────────────────────────────────── */
html body {
  font-family: var(--kc-font);
  background-color: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html body * { font-family: inherit; }
html body code, html body kbd, html body .td-mono, html body .kc-mono { font-family: var(--kc-mono); }
::selection { background: rgba(var(--kc-acc-rgb), .28); color: var(--text); }

/* Fondo: cuadrícula tenue + dos halos. Fijo y sin eventos: no afecta layout. */
html body::before {
  content: '';
  position: fixed; inset: 0;
  width: auto; height: auto; top: 0; left: 0;
  background:
    radial-gradient(900px 520px at 8% -10%, rgba(var(--kc-acc-rgb), .10), transparent 60%),
    radial-gradient(800px 600px at 105% 110%, rgba(139,92,246,.10), transparent 60%),
    linear-gradient(var(--kc-grid) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, var(--kc-grid) 1px, transparent 1px) 0 0 / 44px 44px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,.55) 70%, rgba(0,0,0,.25) 100%);
          mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,.55) 70%, rgba(0,0,0,.25) 100%);
  pointer-events: none;
  z-index: 0;
}

/* Los contenedores flex/grid crecen hasta el ancho de su contenido si no se
   les dice lo contrario: con una tabla llena, .main empujaba la página entera
   fuera de la pantalla. Así la tabla scrollea adentro de su caja. */
html body .main, html body .content, html body .layout-grid > *,
html body .table-wrap, html body .panel-card, html body .table-card { min-width: 0; }

/* Scrollbar fina */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 9px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* Foco visible para teclado */
html body :focus-visible {
  outline: 2px solid var(--kc-acc);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Títulos con la fuente de la casa (las serif viejas se ven fuera de lugar) */
html body h1, html body h2, html body h3,
html body .page-title, html body .title, html body .serif,
html body .form-title, html body .brand-headline, html body .section-title {
  font-family: var(--kc-font);
  letter-spacing: -.02em;
}

/* Números: monoespaciados y tabulares → los contadores no "bailan" */
html body .stat-value, html body .stat-num, html body .kpi-value, html body .kpi-v,
html body .clock, html body .pg-info, html body .table-count, html body .table-card-count,
html body .price-amount, html body .plan-price, html body .pay-amount, html body .dp-stat-num,
html body .client-stat-num, html body .fc-value, html body .hora, html body .veh-count {
  font-family: var(--kc-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
}

/* Etiquetas chicas en mayúsculas espaciadas (estilo HUD) */
html body .stat-label, html body .kpi-label, html body .kpi-l, html body .nav-section,
html body thead th, html body .section-lbl, html body .r-lbl, html body .hora-lbl,
html body .fc-label, html body .periodo-label {
  font-family: var(--kc-mono);
  letter-spacing: .09em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ─── Superficies de vidrio ─────────────────────────────────────────── */
html body .sidebar,
html body .topbar,
html body .header {
  background: var(--kc-glass);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
          backdrop-filter: blur(16px) saturate(140%);
  border-color: var(--border);
}
html body .topbar { position: sticky; top: 0; z-index: 9; }

html body .stat-card, html body .panel-card, html body .table-wrap, html body .card,
html body .kpi-card, html body .chart-card, html body .table-card,
html body .chofer-card, html body .form-card, html body .plan-card, html body .price-card,
html body .feature-card, html body .testi-card, html body .user-card,
html body .kpi {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, transparent), color-mix(in srgb, var(--surface) 80%, transparent));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,.04);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  position: relative;
  transition: transform .25s var(--kc-ease), border-color .25s, box-shadow .25s;
}

/* Tarjetas que se pueden "levantar" */
html body .stat-card:hover, html body .kpi-card:hover, html body .chofer-card:hover,
html body .feature-card:hover, html body .plan-card:hover, html body .price-card:hover,
html body .testi-card:hover {
  transform: translateY(-3px);
  border-color: rgba(var(--kc-acc-rgb), .35);
  box-shadow: var(--shadow), 0 0 0 1px rgba(var(--kc-acc-rgb), .08);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, transparent), color-mix(in srgb, var(--surface) 80%, transparent));
}

/* Borde superior de color de las stat-cards → línea de neón */
html body .stat-card::before {
  height: 2px;
  opacity: .9;
  box-shadow: 0 0 14px currentColor;
}
html body .stat-card.gold::before { background: var(--kc-grad); }
html body .stat-card.gold .stat-value { color: var(--text); }
html body .stat-card.gold .stat-icon { background: var(--accent-dim); color: var(--kc-acc); }
html body .stat-icon, html body .stat-icon-wrap, html body .feature-icon {
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px var(--border);
}

/* ─── Sidebar y navegación ──────────────────────────────────────────── */
html body .sidebar { border-right: 1px solid var(--border); }
html body .nav-item {
  position: relative;
  border-radius: 10px;
  color: var(--text-3);
  transition: color .2s, background .2s, transform .2s var(--kc-ease);
}
html body .nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
  transform: translateX(2px);
}
html body .nav-item.active {
  background: linear-gradient(90deg, rgba(var(--kc-acc-rgb), .16), rgba(var(--kc-acc-rgb), .03));
  color: var(--text);
  border: 1px solid rgba(var(--kc-acc-rgb), .22);
  box-shadow: inset 0 0 18px -8px rgba(var(--kc-acc-rgb), .5);
}
html body .nav-item.active::before {
  content: '';
  position: absolute; left: -10px; top: 22%; bottom: 22%;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--kc-grad);
  box-shadow: 0 0 12px rgba(var(--kc-acc-rgb), .9);
}
html body .sidebar.collapsed .nav-item.active::before { left: -6px; }
html body .nav-section { color: var(--text-4); font-size: 9.5px; }
html body .s-logo, html body .logo-icon, html body .nav-logo-icon, html body .footer-logo-icon,
html body .user-avatar, html body .chofer-avatar, html body .testi-avatar {
  border-radius: 11px;
  box-shadow: 0 0 0 1px var(--border), 0 6px 18px -8px rgba(var(--kc-acc-rgb), .5);
}
html body .logo-icon, html body .nav-logo-icon, html body .footer-logo-icon {
  background: var(--kc-grad);
  color: #fff;
}
html body .user-avatar {
  background: linear-gradient(135deg, rgba(var(--kc-acc-rgb), .25), rgba(139,92,246,.25));
  color: var(--text);
}

/* ─── Botones ──────────────────────────────────────────────────────── */
html body button, html body .btn, html body a[class*="btn"], html body [class*="btn-"] {
  transition: transform .18s var(--kc-ease), box-shadow .25s, background .2s, border-color .2s, color .2s, opacity .2s, filter .2s;
}
html body button:active:not(:disabled), html body .btn:active, html body a[class*="btn"]:active {
  transform: scale(.97);
}

/* Primarios: antes eran "color del texto" invertido. Ahora degradado neón. */
html body .btn-primary, html body .btn-nueva-res, html body .submit-btn, html body .btn-apply,
html body .btn-contratar.filled, html body .btn-pagar, html body .btn-modal-primary,
html body .btn-hero, html body .btn-plan.featured, html body .nav-cta, html body .btn-founding,
html body .upgrade-btn, html body .btn-success, html body .kc-btn-primary {
  background: var(--kc-grad) !important;
  background-size: 160% 160% !important;
  background-position: 0% 50% !important;
  color: #fff !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  box-shadow: var(--kc-glow);
  font-weight: 600;
  text-shadow: 0 1px 0 rgba(0,0,0,.15);
}
html body .btn-primary:hover, html body .btn-nueva-res:hover, html body .submit-btn:hover,
html body .btn-apply:hover, html body .btn-contratar.filled:hover, html body .btn-pagar:hover,
html body .btn-modal-primary:hover, html body .btn-hero:hover, html body .nav-cta:hover,
html body .btn-founding:hover, html body .upgrade-btn:hover, html body .btn-success:hover,
html body .kc-btn-primary:hover {
  opacity: 1;
  background-position: 100% 50% !important;
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(var(--kc-acc-rgb), .4), 0 14px 38px -10px rgba(var(--kc-acc-rgb), .6);
}
html body .btn-secondary, html body .btn-cancelar, html body .btn-ghost, html body .btn-hero-ghost,
html body .btn-export, html body .btn-sm, html body .link-btn, html body .btn-contratar:not(.filled),
html body .btn-login, html body .logout-btn, html body .collapse-btn {
  border-color: var(--border-2);
}
html body .btn-secondary:hover, html body .btn-cancelar:hover, html body .btn-ghost:hover,
html body .btn-hero-ghost:hover, html body .btn-export:hover, html body .btn-contratar:not(.filled):hover,
html body .btn-login:hover {
  border-color: rgba(var(--kc-acc-rgb), .45);
  color: var(--text);
  box-shadow: 0 0 0 3px rgba(var(--kc-acc-rgb), .08);
}
html body .btn-danger { box-shadow: 0 8px 24px -12px rgba(251,113,133,.6); }

/* Reflejo que cruza el botón primario al pasar el mouse */
html body .kc-shine { position: relative; overflow: hidden; isolation: isolate; }
html body .kc-shine::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform .7s var(--kc-ease);
  pointer-events: none;
}
html body .kc-shine:hover::after { transform: translateX(120%); }

/* Onda de clic (la crea kc-ui.js) */
.kc-ripple {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: rgba(255,255,255,.35);
  transform: scale(0); opacity: .7;
  animation: kc-ripple .6s var(--kc-ease) forwards;
}
@keyframes kc-ripple { to { transform: scale(2.6); opacity: 0; } }

/* ─── Pestañas ─────────────────────────────────────────────────────── */
html body .tabs, html body .periodo-tabs, html body .period-tabs, html body .dp-tabs {
  background: var(--kc-glass);
  border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
html body .tab, html body .periodo-tab, html body .period-tab { color: var(--text-3); }
html body .tab.active, html body .periodo-tab.active, html body .period-tab.active, html body .dp-tab.active {
  background: linear-gradient(135deg, rgba(var(--kc-acc-rgb), .22), rgba(139,92,246,.18)) !important;
  color: var(--text) !important;
  box-shadow: inset 0 0 0 1px rgba(var(--kc-acc-rgb), .35), 0 0 18px -6px rgba(var(--kc-acc-rgb), .55);
}

/* ─── Formularios ──────────────────────────────────────────────────── */
html body input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]),
html body select, html body textarea {
  background-color: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
html body input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):hover,
html body select:hover, html body textarea:hover { border-color: var(--border-2); }
html body input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):focus,
html body select:focus, html body textarea:focus {
  outline: none;
  border-color: rgba(var(--kc-acc-rgb), .6);
  box-shadow: 0 0 0 4px rgba(var(--kc-acc-rgb), .14);
  background-color: var(--surface);
}
html body input::placeholder, html body textarea::placeholder { color: var(--text-4); }
html body select option { background: var(--surface-2); color: var(--text); }
html body input[type=checkbox], html body input[type=radio] { accent-color: var(--kc-acc); }
html body label { color: var(--text-2); }

/* ─── Tablas ───────────────────────────────────────────────────────── */
html body thead th {
  background: color-mix(in srgb, var(--surface-2) 85%, transparent);
  color: var(--text-4);
  font-size: 10px;
  border-bottom: 1px solid var(--border);
}
html body tbody tr { transition: background .18s, box-shadow .18s; border-color: var(--border-light); }
html body tbody tr:hover {
  background: linear-gradient(90deg, rgba(var(--kc-acc-rgb), .07), transparent 70%);
  box-shadow: inset 2px 0 0 var(--kc-acc);
}
html body tbody td { border-color: var(--border-light); }

/* El fondo del encabezado va en la fila, no en cada celda: hay tablas cuya
   última columna (acciones) no tiene <th> y el fondo se cortaba ahí. */
html body thead tr { background: color-mix(in srgb, var(--surface-2) 85%, transparent); }
html body thead th { background: transparent; }

/* ─── Login ────────────────────────────────────────────────────────── */
html body .form-card { padding: 32px 30px; }
html body .brand-panel {
  background:
    radial-gradient(700px 420px at 0% 0%, rgba(var(--kc-acc-rgb), .14), transparent 60%),
    radial-gradient(600px 500px at 100% 100%, rgba(139,92,246,.14), transparent 60%),
    var(--surface);
}
html body .brand-headline em {
  font-style: normal;
  background: var(--kc-grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
html body .form-panel { background: transparent; }

/* ─── Badges y chips ───────────────────────────────────────────────── */
html body .badge, html body .chip, html body .plan-badge, html body .plan-chip, html body .sa-badge,
html body .user-role-badge, html body .live-badge, html body .hero-badge, html body .price-badge,
html body .dp-badge, html body .nav-badge, html body .table-count, html body .table-card-count {
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: .02em;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 22%, transparent);
}
html body .live-dot, html body .dp-dot, html body .trust-dot {
  box-shadow: 0 0 0 0 currentColor;
  animation: kc-pulse 1.8s ease-out infinite;
}
@keyframes kc-pulse {
  0% { box-shadow: 0 0 0 0 rgba(52,211,153,.6); }
  100% { box-shadow: 0 0 0 9px rgba(52,211,153,0); }
}

/* ─── Modales ──────────────────────────────────────────────────────── */
html body .modal-overlay, html body .modal-bg {
  background: rgba(3,6,12,.62);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
html body .modal {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(var(--kc-acc-rgb), .06), 0 0 60px -20px rgba(var(--kc-acc-rgb), .35);
  border-radius: 20px;
}
html body .modal-overlay.show .modal, html body .modal-overlay.open .modal,
html body .modal-overlay[style*="flex"] .modal, html body .modal.show, html body .modal.open {
  animation: kc-modal-in .38s var(--kc-spring) both;
}
@keyframes kc-modal-in {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

/* ─── Avisos / flash / toast ───────────────────────────────────────── */
html body .flash, html body .alert, html body .aviso, html body .errors, html body .error-msg,
html body .upgrade-banner, html body .dp-alert, html body .toast {
  border-radius: 12px;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  animation: kc-drop .45s var(--kc-ease) both;
}
@keyframes kc-drop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Arriba a la derecha: abajo tapaban los botones de los paneles laterales
   (el "Cancelar" del detalle de una reservación quedaba debajo del aviso). */
#kc-toasts {
  position: fixed; right: 18px; top: 78px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.kc-toast {
  pointer-events: auto;
  min-width: 240px; max-width: 360px;
  padding: 12px 16px 12px 14px;
  border-radius: 12px;
  background: var(--kc-glass);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid var(--border-2);
  color: var(--text);
  font: 500 13px/1.4 var(--kc-font);
  box-shadow: var(--shadow-lg);
  display: flex; gap: 10px; align-items: flex-start;
  animation: kc-toast-in .4s var(--kc-spring) both;
}
.kc-toast::before {
  content: ''; flex: 0 0 3px; align-self: stretch; border-radius: 3px;
  background: var(--kc-grad); box-shadow: 0 0 10px rgba(var(--kc-acc-rgb), .8);
}
.kc-toast.err::before { background: var(--red); box-shadow: 0 0 10px var(--red); }
.kc-toast.ok::before { background: var(--green); box-shadow: 0 0 10px var(--green); }
.kc-toast.out { animation: kc-toast-out .3s var(--kc-ease) forwards; }
@keyframes kc-toast-in { from { opacity: 0; transform: translateY(-12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes kc-toast-out { to { opacity: 0; transform: translateX(30px); } }

/* ─── Estados vacíos y carga ───────────────────────────────────────── */
html body .empty-state, html body .empty, html body .audit-empty { color: var(--text-3); }
html body .empty-icon, html body .empty-ico {
  filter: drop-shadow(0 8px 20px rgba(var(--kc-acc-rgb), .35));
  animation: kc-float 3.2s ease-in-out infinite;
}
@keyframes kc-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
html body .loading, html body .skel, .kc-skel {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 40%, var(--surface-2) 80%) !important;
  background-size: 200% 100% !important;
  animation: kc-shimmer 1.3s linear infinite;
  color: transparent !important;
  border-radius: 8px;
}
@keyframes kc-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Barras de uso / progreso */
html body .res-usage-fill, html body .bar-fill, html body .meter > *, html body .progress > *,
html body .pw-meter > * {
  background: var(--kc-grad) !important;
  box-shadow: 0 0 12px rgba(var(--kc-acc-rgb), .55);
  transition: width .9s var(--kc-ease);
}

/* ─── Entrada escalonada (kc-ui.js pone .kc-in y el retraso) ───────── */
.kc-enter { opacity: 0; transform: translateY(12px); }
.kc-enter.kc-in {
  opacity: 1; transform: none;
  transition: opacity .5s var(--kc-ease), transform .55s var(--kc-ease);
  transition-delay: var(--kc-d, 0ms);
}
tr.kc-row-in { animation: kc-row .42s var(--kc-ease) both; animation-delay: var(--kc-d, 0ms); }
@keyframes kc-row { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }

/* Destello en un número que acaba de cambiar */
.kc-bump { animation: kc-bump .6s var(--kc-ease); }
@keyframes kc-bump {
  0% { text-shadow: 0 0 0 transparent; }
  30% { text-shadow: 0 0 18px rgba(var(--kc-acc-rgb), .9); }
  100% { text-shadow: 0 0 0 transparent; }
}

/* Spotlight que sigue al mouse dentro de tarjetas (variables desde JS) */
.kc-spot::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--kc-acc-rgb), .10), transparent 45%);
  opacity: 0; transition: opacity .3s;
}
.kc-spot:hover::after { opacity: 1; }

/* Barra de progreso de navegación */
#kc-bar {
  position: fixed; top: 0; left: 0; height: 2px; width: 100%; z-index: 10000;
  background: var(--kc-grad); box-shadow: 0 0 12px rgba(var(--kc-acc-rgb), .9);
  transform-origin: 0 50%; transform: scaleX(0); opacity: 0; pointer-events: none;
}
#kc-bar.go { opacity: 1; animation: kc-bar 2.5s var(--kc-ease) forwards; }
@keyframes kc-bar { 0% { transform: scaleX(0); } 100% { transform: scaleX(.85); } }

/* Botón de tema */
html body .kc-theme-btn, html body .theme-btn, html body .theme-toggle {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: transform .4s var(--kc-spring), border-color .2s;
}
html body .kc-theme-btn:hover, html body .theme-btn:hover, html body .theme-toggle:hover {
  transform: rotate(25deg);
  border-color: rgba(var(--kc-acc-rgb), .5);
}

/* ─── Banda DEMO ───────────────────────────────────────────────────── */
.kc-demo-bar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  z-index: 9000;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 8px 8px 16px;
  border-radius: 999px;
  background: var(--kc-glass);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid rgba(var(--kc-acc-rgb), .35);
  box-shadow: var(--shadow-lg), 0 0 30px -10px rgba(var(--kc-acc-rgb), .6);
  font: 500 12.5px/1.2 var(--kc-font);
  color: var(--text-2);
  animation: kc-demo-in .5s var(--kc-spring) .4s both;
  max-width: calc(100vw - 24px);
}
@keyframes kc-demo-in { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }
.kc-demo-bar b { color: var(--text); font-weight: 600; }
.kc-demo-bar .kc-demo-tag {
  font: 600 10px/1 var(--kc-mono); letter-spacing: .12em;
  padding: 5px 8px; border-radius: 6px;
  background: var(--kc-grad); color: #fff;
}
.kc-demo-bar form { display: contents; }
.kc-demo-bar a, .kc-demo-bar button {
  padding: 8px 14px; border-radius: 999px; text-decoration: none; border: none; cursor: pointer;
  background: var(--kc-grad); color: #fff; font: 600 12.5px/1.2 var(--kc-font); white-space: nowrap;
}
.kc-demo-bar button.sec { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-2); }
.kc-demo-bar button.sec:hover { box-shadow: inset 0 0 0 1px rgba(var(--kc-acc-rgb), .6); }
/* Que la banda no tape los botones de una ventana o un panel abierto */
body:has(.modal-overlay.show) .kc-demo-bar,
body:has(.d-det.on) .kc-demo-bar { opacity: 0; pointer-events: none; transition: opacity .2s; }
@media (max-width: 760px) {
  .kc-demo-bar { bottom: 74px; font-size: 11.5px; }
  .kc-demo-bar .kc-demo-txt { display: none; }
}

/* ─── Movimiento reducido ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .kc-enter { opacity: 1; transform: none; }
}
