/* ObsidianPlus — Design System Global
   Importar en todas las páginas de la app */

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

/* Fondo gestionado por js/shader-bg.js (WebGL2) */

:root {
  --bg:       #080908;
  --s0:       #0d0e0d;
  --s1:       #131413;
  --s2:       #1a1b1a;
  --s3:       #232423;
  --border:   rgba(255,255,255,.07);
  --border-g: rgba(0,255,65,.2);
  --neon:     #00ff41;
  --neon2:    #00cc34;
  --text:     #e4e8e2;
  --muted:    #6b7f67;
  --muted2:   #9aad96;
  --crit:     #ff4444;
  --high:     #ff7a2f;
  --med:      #ffc107;
  --low:      #4d9de0;
  --ok:       #00ff41;
  --r:        12px;
  --r2:       20px;
  --sidebar:  240px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,255,65,.15); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,255,65,.3); }

/* ── Layout ── */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar);
  background: rgba(8,9,8,.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow-y: auto;
}

.main-content {
  margin-left: var(--sidebar);
  flex: 1;
  min-height: 100vh;
  padding: 32px;
}

/* ── Sidebar internals ── */
.sb-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 24px 20px 16px;
  font-family: 'Manrope', sans-serif;
  font-size: 18px;
  font-weight: 900;
  color: var(--neon);
  letter-spacing: -.03em;
  border-bottom: 1px solid var(--border);
  text-decoration: none;          /* es un <a>: sin subrayado de enlace */
  cursor: pointer;
  transition: opacity .15s ease;
}
.sb-logo:hover { opacity: .8; }

.sb-user {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.sb-user-email { font-size: 11px; color: var(--muted2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-tier  { font-size: 10px; color: var(--muted); margin-top: 2px; }

.sb-nav { flex: 1; padding: 12px 10px; }

.sb-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r);
  color: var(--muted2);
  font-size: 13px;
  font-weight: 500;
  transition: all .18s;
  margin-bottom: 2px;
  white-space: nowrap;
}
.sb-link:hover { background: var(--s2); color: var(--text); }
.sb-link.active { background: rgba(0,255,65,.1); color: var(--neon); border: 1px solid var(--border-g); }
.sb-link .icon { font-size: 16px; flex-shrink: 0; opacity: .8; }
.sb-link.active .icon { opacity: 1; }

.sb-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 12px 6px;
}

.sb-footer {
  padding: 14px 10px;
  border-top: 1px solid var(--border);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 13px;
  transition: all .18s;
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary { background: var(--neon); color: #003907; }
.btn-primary:hover { background: var(--neon2); transform: translateY(-1px); box-shadow: 0 4px 20px rgba(0,255,65,.3); }
.btn-outline { border: 1px solid var(--border-g); color: var(--neon); background: rgba(0,255,65,.06); }
.btn-outline:hover { background: rgba(0,255,65,.12); }
.btn-ghost  { border: 1px solid var(--border); color: var(--muted2); background: transparent; }
.btn-ghost:hover  { border-color: var(--border-g); color: var(--neon); }
.btn-danger { border: 1px solid rgba(255,68,68,.3); color: var(--crit); background: rgba(255,68,68,.06); }
.btn-danger:hover { background: rgba(255,68,68,.12); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-icon { padding: 8px; border-radius: var(--r); width: 34px; height: 34px; justify-content: center; }

/* ── Cards — semi-transparentes para que el shader se vea ── */
.card {
  background: rgba(13,14,13,.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-family: 'Manrope', sans-serif; font-weight: 700; font-size: 15px; }
.card-body { padding: 20px 22px; }

/* ── Stat cards ── */
.stat-card {
  background: rgba(13,14,13,.75);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 22px;
}
.stat-card .val {
  font-family: 'Manrope', sans-serif;
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 6px;
}
.stat-card .lbl { font-size: 12px; color: var(--muted); }

/* ── Severity badges ── */
.sev {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid;
}
.sev-critical { color: var(--crit); border-color: rgba(255,68,68,.35); background: rgba(255,68,68,.08); }
.sev-high     { color: var(--high); border-color: rgba(255,122,47,.35); background: rgba(255,122,47,.08); }
.sev-medium   { color: var(--med);  border-color: rgba(255,193,7,.35);  background: rgba(255,193,7,.08);  }
.sev-low      { color: var(--low);  border-color: rgba(77,157,224,.35); background: rgba(77,157,224,.08); }
.sev-ok       { color: var(--ok);   border-color: rgba(0,255,65,.35);   background: rgba(0,255,65,.08);   }

/* ── Source chips ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--s2);
  color: var(--muted2);
}

/* ── Risk ring (SVG) ── */
.risk-ring-wrap { position: relative; display: inline-flex; }
.risk-ring-val {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
}

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}
.page-title { font-family: 'Manrope', sans-serif; font-size: 26px; font-weight: 900; letter-spacing: -.02em; }
.page-title span { color: var(--neon); }
.page-sub   { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ── Tables ── */
.table { width: 100%; border-collapse: collapse; }
.table th { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.table td { padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,.03); font-size: 13px; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255,255,255,.02); }

/* ── Forms ── */
.field-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; display: block; }
.field-input {
  width: 100%;
  background: var(--s0);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 14px;
  color: var(--text);
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  outline: none;
  transition: border-color .18s;
}
.field-input:focus { border-color: rgba(0,255,65,.4); }
.field-input::placeholder { color: var(--muted); }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  padding: 12px 20px;
  border-radius: var(--r);
  font-weight: 700;
  font-size: 13px;
  pointer-events: none;
  transition: opacity .3s;
}

/* ── Animations ── */
.fade-in { animation: fadeIn .35s ease forwards; }
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.3;transform:scale(.6)} }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state .icon { font-size: 48px; color: var(--muted); margin-bottom: 16px; display: block; opacity: .4; }
.empty-state h3 { font-family: 'Manrope', sans-serif; font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.empty-state p { font-size: 13px; color: var(--muted); max-width: 340px; margin: 0 auto 20px; }

/* ── Log terminal ── */
.terminal {
  background: var(--s0);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  overflow: hidden;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(0,0,0,.3);
  border-bottom: 1px solid var(--border);
}
.terminal-dot { width: 11px; height: 11px; border-radius: 50%; }
.terminal-body { padding: 16px; min-height: 200px; max-height: 380px; overflow-y: auto; line-height: 1.8; }
.t-line { display: flex; gap: 10px; opacity: 0; animation: fadeIn .3s ease forwards; }
.t-prefix { color: var(--neon); user-select: none; }
.t-thought  { color: #7a9ef5; font-style: italic; }
.t-decision { color: var(--med); }
.t-finding  { color: var(--text); }
.t-chain    { color: var(--crit); font-weight: 700; }
.t-impact   { color: var(--high); }
.t-done     { color: var(--neon); font-weight: 700; }
.t-error    { color: var(--crit); }

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — celulares (iOS / Android). El sidebar pasa a
   cajón deslizable con botón hamburguesa (lo inyecta sidebar.js).
   ════════════════════════════════════════════════════════════ */
.sb-toggle { display: none; }
.sb-overlay { display: none; }

@media (max-width: 820px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    width: 270px;
    box-shadow: 0 0 50px rgba(0,0,0,.7);
  }
  .sidebar.open { transform: translateX(0); }

  .main-content { margin-left: 0; padding: 68px 16px 28px; }

  .sb-toggle {
    display: flex; align-items: center; justify-content: center;
    position: fixed; top: 12px; left: 12px; z-index: 60;
    width: 44px; height: 44px; border-radius: 11px;
    background: rgba(8,9,8,.92); border: 1px solid var(--border);
    color: var(--neon); font-size: 22px; line-height: 1;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  }
  .sb-overlay.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 49; }

  .page-title { font-size: 22px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }

  .sum-grid, .settings-grid, .stat-grid, .cards-grid,
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; }

  table { display: block; overflow-x: auto; white-space: nowrap; }
}

@media (max-width: 430px) {
  .main-content { padding: 64px 12px 24px; }
  .page-title { font-size: 19px; }
}

/* ════════════════════════════════════════════════════════════
   Ajustes finos iOS/Android: sin zoom al enfocar inputs, alturas
   estables (svh) y respeto del notch / barra inferior (safe-area).
   ════════════════════════════════════════════════════════════ */
@media (max-width: 820px) {
  /* iOS hace zoom si el input mide <16px. Forzamos 16px en móvil. */
  input, select, textarea { font-size: 16px; }
  /* 100svh evita el salto del 100vh con la barra de Safari iOS. */
  .app-layout { min-height: 100svh; }
  /* El cajón del menú y el contenido respetan el notch y el home indicator. */
  .sb-toggle   { top: max(12px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); }
  .sidebar     { padding-top: env(safe-area-inset-top); }
  .main-content{ padding-bottom: max(28px, env(safe-area-inset-bottom)); }
}

/* ════════════════════════════════════════════════════════════
   Accesibilidad y seguridad de layout en movil
   ════════════════════════════════════════════════════════════ */
/* Evita el scroll horizontal si algun elemento se pasa de ancho en pantallas chicas. */
@media (max-width: 820px) {
  html, body { overflow-x: hidden; }
}
/* Respeta "reducir movimiento" del sistema operativo: acorta transiciones/animaciones.
   Complementa la pausa del fondo WebGL que ya se hace en JS. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ════════════════════════════════════════════════════════════
   SIDEBAR COLAPSABLE (escritorio): rail angosto que se expande
   al pasar el mouse y se cierra solo al salir. El contenido usa
   ancho completo — la barra flota encima, no empuja.
   ════════════════════════════════════════════════════════════ */
@media (min-width: 821px) {
  .sidebar {
    width: 66px;
    overflow-x: hidden;
    background: rgba(8,9,8,.97);
    transition: width .22s ease, box-shadow .22s ease;
  }
  .sidebar:hover {
    width: 248px;
    box-shadow: 12px 0 48px rgba(0,0,0,.55);
  }
  .main-content { margin-left: 66px; }

  /* Textos ocultos cuando está colapsado; visibles al expandir */
  .sb-txt, .sb-logo-text, .sb-user, .sb-label {
    opacity: 0;
    white-space: nowrap;
    transition: opacity .12s ease;
    pointer-events: none;
  }
  .sidebar:hover .sb-txt,
  .sidebar:hover .sb-logo-text,
  .sidebar:hover .sb-user,
  .sidebar:hover .sb-label { opacity: 1; pointer-events: auto; }
}

/* ════════════════════════════════════════════════════════════
   REFINAMIENTO v2 — capa de pulido "premium" sobre el sistema
   existente. Solo añade profundidad, micro-interacciones, foco
   accesible y tipografía afinada. No cambia la identidad ni la
   estructura: el verde/oscuro y el shader siguen mandando.
   ════════════════════════════════════════════════════════════ */
:root {
  --ease: cubic-bezier(.22,.61,.36,1);          /* easing suave para todo */
  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 8px 28px -8px rgba(0,0,0,.55), 0 2px 8px rgba(0,0,0,.35);
  --shadow-glow: 0 0 0 1px rgba(0,255,65,.12), 0 10px 36px -10px rgba(0,255,65,.18);
  --grad-neon: linear-gradient(90deg, var(--neon), #5bffa0 55%, var(--neon2));
}

/* Números tabulares: las cifras no "bailan" al actualizarse (look de dashboard pro) */
.stat-card .val, .sum-num, .gnum, .table td, .mono,
[class*="num"], code { font-variant-numeric: tabular-nums; }

/* Selección de texto en verde tenue (detalle de marca) */
::selection { background: rgba(0,255,65,.22); color: #eafff0; }

/* Foco accesible y elegante (teclado): anillo verde en vez del outline del navegador */
a:focus-visible, button:focus-visible, .btn:focus-visible,
.field-input:focus-visible, .sb-link:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px rgba(0,255,65,.45);
  border-radius: var(--r);
}

/* Cards con profundidad real + brillo hairline superior + leve elevación al hover */
.card, .stat-card {
  box-shadow: var(--shadow-2);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
  position: relative;
}
.card::before, .stat-card::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding-top: 1px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), transparent 40%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}
.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-g);
  box-shadow: var(--shadow-2), var(--shadow-glow);
}

/* Encabezado de página: el acento ahora es un degradado sutil (no plano) */
.page-title span {
  background: var(--grad-neon);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Botones: easing afinado, sombra al elevar y micro-presión al hacer click */
.btn { transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease), filter .2s var(--ease); }
.btn-primary:hover { box-shadow: 0 6px 24px -6px rgba(0,255,65,.45); }
.btn:active { transform: translateY(0) scale(.985); }

/* Inputs: halo verde al enfocar (más vivo que solo el borde) */
.field-input:focus {
  border-color: rgba(0,255,65,.5);
  box-shadow: 0 0 0 3px rgba(0,255,65,.10);
}

/* Badges de severidad con un brillo diagonal muy sutil (acabado "vidrio") */
.sev { backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); transition: transform .15s var(--ease); }
.sev:hover { transform: translateY(-1px); }

/* Filas de tabla: transición suave del realce */
.table tr td { transition: background .15s var(--ease); }

/* Link de navegación activo: barra de acento a la izquierda */
.sb-link.active { position: relative; }
.sb-link.active::before {
  content: ""; position: absolute; left: -1px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 60%; border-radius: 3px; background: var(--grad-neon);
}

/* Aparición escalonada de contenido (se aplica con .reveal en el contenedor) */
.reveal > * { opacity: 0; animation: rise .5s var(--ease) forwards; }
.reveal > *:nth-child(1){animation-delay:.02s}
.reveal > *:nth-child(2){animation-delay:.06s}
.reveal > *:nth-child(3){animation-delay:.10s}
.reveal > *:nth-child(4){animation-delay:.14s}
.reveal > *:nth-child(5){animation-delay:.18s}
.reveal > *:nth-child(n+6){animation-delay:.22s}
@keyframes rise { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform:none; } }

@media (prefers-reduced-motion: reduce) {
  .card, .stat-card, .btn, .sev { transition: none !important; }
  .reveal > * { animation: none !important; opacity: 1 !important; }
}

/* ════════════════════════════════════════════════════════════
   REFINAMIENTO v3 — cambios VISIBLES (no solo micro-detalles).
   Bordes con tinte de marca, glow en cifras y CTA, encabezados
   con acento. La identidad verde/oscura se mantiene intacta.
   ════════════════════════════════════════════════════════════ */

/* Cards: borde superior con tinte neón visible + esquinas más generosas */
.card, .stat-card, .sum-card, .terminal {
  border-color: rgba(0,255,65,.13);
  border-top-color: rgba(0,255,65,.28);
}
.card-header {
  background: linear-gradient(180deg, rgba(0,255,65,.045), transparent);
}
.card-title { display: inline-flex; align-items: center; gap: 9px; }
.card-title::before {
  content: ""; width: 7px; height: 7px; border-radius: 2px;
  background: var(--grad-neon);
  box-shadow: 0 0 10px rgba(0,255,65,.7);
  flex-shrink: 0;
}

/* Cifras de dashboard: más grandes y con glow de fósforo (look SOC) */
.stat-card .val, .sum-num {
  font-size: 36px;
  letter-spacing: -.02em;
  text-shadow: 0 0 22px rgba(0,255,65,.18);
}
.stat-card .lbl, .sum-lbl { letter-spacing: .12em; text-transform: uppercase; font-size: 10.5px; }

/* Stat-cards con línea de energía inferior que se enciende al hover */
.stat-card, .sum-card { position: relative; }
.stat-card::after, .sum-card::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--grad-neon);
  opacity: .22; transition: opacity .25s var(--ease), box-shadow .25s var(--ease);
}
.stat-card:hover::after, .sum-card:hover::after {
  opacity: .9; box-shadow: 0 0 14px rgba(0,255,65,.5);
}

/* CTA primario: glow permanente (el botón "manda" en la página) */
.btn-primary, .sca-btn {
  box-shadow: 0 0 0 1px rgba(0,255,65,.25), 0 4px 22px -4px rgba(0,255,65,.45);
}
.btn-primary:hover, .sca-btn:hover {
  box-shadow: 0 0 0 1px rgba(0,255,65,.4), 0 6px 30px -4px rgba(0,255,65,.65);
}

/* Título de página: más presencia + subrayado de energía */
.page-title { font-size: 30px; }
.page-sub { display: inline-flex; align-items: center; gap: 8px; }
.page-sub::before {
  content: ""; width: 26px; height: 2px; border-radius: 2px;
  background: var(--grad-neon); opacity: .7;
}

/* Sidebar: link activo con glow del icono */
.sb-link.active .icon { filter: drop-shadow(0 0 6px rgba(0,255,65,.8)); }

/* Inputs: fondo levemente más profundo para más contraste con las cards */
.field-input, .inp, .sel { background: rgba(0,0,0,.35); }

/* Tablas: hover de fila con tinte de marca (antes casi invisible) */
.table tr:hover td { background: rgba(0,255,65,.035); }

/* Empty-states: icono con halo (se siente diseñado, no vacío) */
.empty-state .icon {
  opacity: 1; color: rgba(0,255,65,.5);
  filter: drop-shadow(0 0 18px rgba(0,255,65,.35));
}

/* Scrollbar un poco más visible */
::-webkit-scrollbar { width: 6px; height: 6px; }

/* ════════════════════════════════════════════════════════════
   TOPBAR GLOBAL + PALETA DE COMANDOS (⌘K) — interfaz v4
   Barra superior persistente con búsqueda/acciones y un command
   palette estilo Linear/Vercel. Lo inyecta js/sidebar.js.
   ════════════════════════════════════════════════════════════ */
.topbar {
  position: fixed; top: 0; right: 0; left: 66px; z-index: 48;
  height: 58px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 0 22px;
  background: rgba(8,9,8,.78);
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  border-bottom: 1px solid rgba(0,255,65,.10);
}
.has-topbar .main-content { padding-top: 86px; }

.tb-search {
  display: inline-flex; align-items: center; gap: 10px;
  min-width: 280px; max-width: 420px; flex: 1;
  padding: 9px 14px;
  background: rgba(0,0,0,.35);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.tb-search:hover { border-color: var(--border-g); color: var(--muted2); }
.tb-search-txt { flex: 1; text-align: left; }
.tb-kbd {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  color: var(--muted2);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 2px 7px; background: rgba(255,255,255,.03);
}
.tb-right { display: flex; align-items: center; gap: 10px; }
.tb-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 11px;
  border: 1px solid var(--border); color: var(--muted2);
  transition: all .18s var(--ease);
}
.tb-icon:hover { border-color: var(--border-g); color: var(--neon); }
.tb-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,255,65,.12);
  border: 1px solid var(--border-g);
  color: var(--neon);
  font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 14px;
  transition: box-shadow .2s var(--ease);
}
.tb-avatar:hover { box-shadow: 0 0 16px rgba(0,255,65,.35); }

/* Paleta de comandos */
.cmdk {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 14vh 16px 0;
}
.cmdk[hidden] { display: none; }
.cmdk-box {
  width: 100%; max-width: 560px;
  background: rgba(11,12,11,.97);
  border: 1px solid rgba(0,255,65,.22);
  border-radius: 18px;
  box-shadow: 0 24px 80px -12px rgba(0,0,0,.8), 0 0 60px -20px rgba(0,255,65,.25);
  overflow: hidden;
  animation: cmdkIn .18s var(--ease);
}
@keyframes cmdkIn { from { opacity: 0; transform: translateY(-8px) scale(.985); } to { opacity: 1; transform: none; } }
.cmdk-input-row {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.cmdk-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 15px; font-family: 'Inter', sans-serif;
}
.cmdk-input::placeholder { color: var(--muted); }
.cmdk-list { max-height: 46vh; overflow-y: auto; padding: 8px; }
.cmdk-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 11px;
  color: var(--muted2); font-size: 13.5px; cursor: pointer;
}
.cmdk-item .material-symbols-outlined { color: var(--muted); }
.cmdk-item.sel {
  background: rgba(0,255,65,.09);
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--neon);
}
.cmdk-item.sel .material-symbols-outlined { color: var(--neon); }
.cmdk-lbl { flex: 1; }
.cmdk-hint { font-size: 11px; color: var(--muted); font-family: 'JetBrains Mono', monospace; }
.cmdk-empty { padding: 26px; text-align: center; color: var(--muted); font-size: 13px; }

/* Responsive del topbar */
@media (max-width: 820px) {
  .topbar { left: 0; padding-left: 64px; }   /* deja sitio al botón hamburguesa */
  .tb-search { min-width: 0; }
  .tb-search-txt, .tb-cta-txt, .tb-kbd { display: none; }
  .has-topbar .main-content { padding-top: 84px; }
}
