/* Cerebro — capa de diseño sobre Paperclip (estilo Arcana: oscuro profundo, violeta→azul, bordes suaves). */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Outfit:wght@500;600;700&display=swap");
:root {
  --radius: 0.625rem;
  --background: #ffffff;
  --background-alt: #f7f6fb;
  --foreground: #17151f;
  --card: #ffffff;
  --card-foreground: #17151f;
  --popover: #ffffff;
  --popover-foreground: #17151f;
  --primary: #6d28d9;
  --primary-foreground: #ffffff;
  --secondary: #f3f1f9;
  --secondary-foreground: #2a2440;
  --muted: #f5f4f9;
  --muted-foreground: #6b6880;
  --accent: #f1edfd;
  --accent-foreground: #2a2440;
  --border: #e6e3ef;
  --input: #e2dfec;
  --ring: #8b5cf6;
  --sidebar: #f8f7fc;
  --sidebar-foreground: #1f1b2e;
  --sidebar-primary: #6d28d9;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: #ece6fd;
  --sidebar-accent-foreground: #2a1f4d;
  --sidebar-border: #e6e3ef;
  --sidebar-ring: #8b5cf6;
  --collection-filter-active: #7c3aed;
  --collection-filter-badge: #7c3aed;
  --cerebro-grad: linear-gradient(135deg, #7c3aed 0%, #5f4df0 48%, #2563eb 100%);
}

.dark {
  --background: #09090b;
  --background-alt: #060608;
  --foreground: #f4f3f8;
  --card: #111115;
  --card-foreground: #f4f3f8;
  --popover: #131318;
  --popover-foreground: #f4f3f8;
  --primary: #8b5cf6;
  --primary-foreground: #ffffff;
  --secondary: #18171f;
  --secondary-foreground: #f4f3f8;
  --muted: #17161d;
  --muted-highlight: #22202c;
  --muted-foreground: #a09cb3;
  --accent: #1b1926;
  --accent-foreground: #f4f3f8;
  --border: rgb(255 255 255 / 0.08);
  --input: rgb(255 255 255 / 0.12);
  --ring: #7c3aed;
  --bubble-agent: #141419;
  --side-panel-bg: #0c0c10;
  --sidebar: #0c0c10;
  --sidebar-foreground: #e9e7f2;
  --sidebar-primary: #8b5cf6;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: #1d1930;
  --sidebar-accent-foreground: #ffffff;
  --sidebar-border: rgb(255 255 255 / 0.07);
  --sidebar-ring: #7c3aed;
  --collection-filter-active: #a78bfa;
  --collection-filter-badge: #7c3aed;
  --scrollbar-thumb: #2c2a38;
  --scrollbar-thumb-hover: #3b3850;
}

/* Botón principal con degradado y brillo, como Arcana */
[data-slot="button"].bg-primary {
  background-color: transparent;
  background-image: var(--cerebro-grad);
  color: #fff;
  box-shadow:
    0 0 0 1px rgb(124 58 237 / 0.45),
    0 8px 20px -10px rgb(95 77 240 / 0.75),
    inset 0 1px 0 rgb(255 255 255 / 0.22);
}
[data-slot="button"].bg-primary:hover { filter: brightness(1.08); background-color: transparent; }
[data-slot="button"].bg-primary:disabled { filter: grayscale(0.35); box-shadow: none; }

/* Títulos más "display" */
h1, h2 { letter-spacing: -0.02em; font-weight: 650; }

/* Barra lateral: elemento activo con barrita de color */
.dark [data-sidebar="menu-button"][data-active="true"],
[data-sidebar="menu-button"][data-active="true"] {
  box-shadow: inset 3px 0 0 #8b5cf6;
}

/* Tarjetas y ventanas con bordes más suaves */
.dark [data-slot="card"], .dark [role="dialog"] { box-shadow: 0 0 0 1px rgb(255 255 255 / 0.06), 0 24px 48px -24px rgb(0 0 0 / 0.6); }

::selection { background: rgb(139 92 246 / 0.35); }

/* Logo: "Paperclip" -> "🧠 Cerebro" */
svg[viewBox="22.5 22.5 121 27"] { display: none !important; }
:has(> svg[viewBox="22.5 22.5 121 27"])::after {
  content: "🧠 Cerebro";
  font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em;
  background: var(--cerebro-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Ojito para ver la contraseña */
.cb-eye {
  position: absolute; right: 8px; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent;
  color: var(--muted-foreground); cursor: pointer;
}
.cb-eye:hover { color: var(--foreground); background: var(--accent); }
.cb-eye:focus-visible { outline: 2px solid var(--ring); }
input.cb-has-eye { padding-right: 42px !important; }

/* ================= ETAPA 2: estilo Arcana + personajes vivos ================= */
body { font-family: "Inter", ui-sans-serif, system-ui, sans-serif; }
h1, h2, h3, .cb-hero-title { font-family: "Outfit", "Inter", sans-serif; }

/* Título de cada página: más grande y con su ícono en una cajita */
header h1, main > div h1.uppercase, h1.text-sm.uppercase {
  text-transform: none !important; letter-spacing: -0.02em !important;
  font-size: 1.15rem !important; font-weight: 600 !important;
  display: inline-flex; align-items: center; gap: 10px;
}
h1.text-sm.uppercase::before {
  content: var(--cb-page-icon, "✦");
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 9px; font-size: 15px;
  background: rgb(139 92 246 / 0.14); box-shadow: inset 0 0 0 1px rgb(139 92 246 / 0.28);
}
html[data-cb-page="dashboard"] { --cb-page-icon: "🏠"; }
html[data-cb-page="agents"] { --cb-page-icon: "🤖"; }
html[data-cb-page="chats"] { --cb-page-icon: "💬"; }
html[data-cb-page="issues"] { --cb-page-icon: "✅"; }
html[data-cb-page="decisions"], html[data-cb-page="inbox"] { --cb-page-icon: "📥"; }
html[data-cb-page="routines"] { --cb-page-icon: "⏰"; }
html[data-cb-page="projects"] { --cb-page-icon: "📁"; }
html[data-cb-page="goals"] { --cb-page-icon: "🎯"; }
html[data-cb-page="costs"] { --cb-page-icon: "💰"; }
html[data-cb-page="approvals"] { --cb-page-icon: "🛡️"; }
html[data-cb-page="apps"], html[data-cb-page="tools"] { --cb-page-icon: "🔌"; }
html[data-cb-page="skills"] { --cb-page-icon: "🧩"; }
html[data-cb-page="activity"] { --cb-page-icon: "📜"; }
html[data-cb-page="company"], html[data-cb-page="settings"] { --cb-page-icon: "⚙️"; }
html[data-cb-page="org"] { --cb-page-icon: "🧭"; }

/* Menú lateral: cada ícono en su cajita de color */
[data-slot="sidebar-nav-icon"] {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 8px;
  background: rgb(var(--cb-c, 139 92 246) / 0.14); color: rgb(var(--cb-c, 139 92 246));
}
a[href$="/chats"] { --cb-c: 59 130 246; }
a[href$="/issues"] { --cb-c: 34 197 94; }
a[href$="/decisions"], a[href$="/inbox"] { --cb-c: 236 72 153; }
a[href$="/agents"], a[href*="/agents/all"] { --cb-c: 139 92 246; }
a[href$="/routines"] { --cb-c: 245 158 11; }
a[href$="/costs"] { --cb-c: 16 185 129; }
a[href$="/approvals"] { --cb-c: 239 68 68; }
a[href$="/projects"] { --cb-c: 14 165 233; }
a[href$="/dashboard"] { --cb-c: 168 85 247; }
.design-sidebar-item { border-radius: 10px !important; }

/* Botones de acción principales con degradado */
.cb-cta {
  background-image: var(--cerebro-grad) !important; color: #fff !important; border-color: transparent !important;
  box-shadow: 0 0 0 1px rgb(124 58 237 / 0.45), 0 8px 20px -10px rgb(95 77 240 / 0.75), inset 0 1px 0 rgb(255 255 255 / 0.22) !important;
}
.cb-cta:hover { filter: brightness(1.08); }

/* Tarjetas con esquinas de 14 px */
[data-slot="card"] { border-radius: 14px !important; }

/* Personajes: flotan suavemente, saltan al pasar el mouse y brillan cuando trabajan */
@keyframes cb-bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-2.5px) rotate(-1.5deg); } }
@keyframes cb-work { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-3px) rotate(4deg); } }
@keyframes cb-hop { 0% { transform: translateY(0) scale(1); } 35% { transform: translateY(-6px) scale(1.06, 0.95); } 70% { transform: translateY(0) scale(0.96, 1.04); } 100% { transform: none; } }
@keyframes cb-ring { 0% { box-shadow: 0 0 0 0 rgb(34 197 94 / 0.55); } 100% { box-shadow: 0 0 0 9px rgb(34 197 94 / 0); } }
[data-slot="agent-avatar"] img {
  animation: cb-bob var(--cb-dur, 3s) ease-in-out var(--cb-delay, 0s) infinite;
  transform-origin: 50% 100%;
}
a:hover [data-slot="agent-avatar"] img, [data-slot="agent-avatar"]:hover img { animation: cb-hop 0.55s ease-out; }
[data-slot="agent-avatar"].cb-busy { border-radius: 999px; animation: cb-ring 1.4s ease-out infinite; }
[data-slot="agent-avatar"].cb-busy img { animation: cb-work 0.9s ease-in-out infinite; }

/* Estados con color */
.cb-st { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 999px;
  background: rgb(148 163 184 / 0.14); color: var(--muted-foreground); }
.cb-st-run { background: rgb(34 197 94 / 0.16); color: #4ade80; }
.cb-st-err { background: rgb(239 68 68 / 0.16); color: #f87171; }
.cb-st-off { background: rgb(148 163 184 / 0.1); }
.cb-dots { display: inline-flex; gap: 2px; margin-left: 2px; }
.cb-dots b { width: 3px; height: 3px; border-radius: 50%; background: currentColor; animation: cb-dot 1.2s infinite; }
.cb-dots b:nth-child(2) { animation-delay: 0.2s; } .cb-dots b:nth-child(3) { animation-delay: 0.4s; }
@keyframes cb-dot { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }

/* Banner "Tu equipo" del Panel */
.cb-hero {
  position: relative; overflow: hidden; margin: 0 0 20px; padding: 22px 22px 18px; border-radius: 18px;
  background:
    radial-gradient(120% 140% at 0% 0%, rgb(124 58 237 / 0.35), transparent 55%),
    radial-gradient(90% 120% at 100% 100%, rgb(37 99 235 / 0.30), transparent 60%),
    var(--card);
  box-shadow: 0 0 0 1px rgb(139 92 246 / 0.25), 0 24px 48px -28px rgb(95 77 240 / 0.7);
}
.cb-hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.cb-kicker { font-size: 11px; letter-spacing: 0.14em; font-weight: 600; color: #c4b5fd; }
.cb-hero-title { margin: 6px 0 4px; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; color: var(--foreground); }
.cb-hero-sub { margin: 0; font-size: 13.5px; color: var(--muted-foreground); max-width: 520px; }
.cb-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cb-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 10px; font-size: 13px; font-weight: 500;
  text-decoration: none; color: var(--foreground); background: rgb(255 255 255 / 0.06); box-shadow: inset 0 0 0 1px var(--border); }
.cb-btn:hover { background: rgb(255 255 255 / 0.1); }
.cb-btn-main { color: #fff; background-image: var(--cerebro-grad); box-shadow: 0 8px 20px -10px rgb(95 77 240 / 0.9), inset 0 1px 0 rgb(255 255 255 / 0.22); }
.cb-crew { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-top: 18px; }
.cb-member {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 12px 8px 10px; border-radius: 14px; text-decoration: none;
  background: rgb(255 255 255 / 0.035); box-shadow: inset 0 0 0 1px var(--border); color: var(--foreground);
  transition: transform 0.2s, background 0.2s;
  animation: cb-in 0.5s ease-out both; animation-delay: calc(var(--i) * 60ms);
}
.cb-member:hover { transform: translateY(-3px); background: rgb(255 255 255 / 0.07); }
.cb-member.is-busy { box-shadow: inset 0 0 0 1px rgb(34 197 94 / 0.45), 0 0 24px -8px rgb(34 197 94 / 0.6); }
.cb-member.is-boss { box-shadow: inset 0 0 0 1px rgb(250 204 21 / 0.35); }
.cb-char { width: 64px; height: 64px; display: block; }
.cb-char img { width: 64px; height: 64px; animation: cb-bob calc(2.6s + var(--i) * 0.17s) ease-in-out calc(var(--i) * -0.4s) infinite; transform-origin: 50% 100%; }
.cb-member:hover .cb-char img { animation: cb-hop 0.55s ease-out; }
.cb-member.is-busy .cb-char img { animation: cb-work 0.9s ease-in-out infinite; }
.cb-name { font-weight: 600; font-size: 13px; margin-top: 4px; text-align: center; }
.cb-role { font-size: 11px; color: var(--muted-foreground); text-align: center; line-height: 1.25; min-height: 14px; }
@keyframes cb-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.cb-spark { position: absolute; color: #c4b5fd; pointer-events: none; animation: cb-twinkle 3s ease-in-out infinite; }
.cb-spark.s1 { top: 14px; right: 38%; font-size: 14px; }
.cb-spark.s2 { top: 54px; right: 26%; font-size: 9px; animation-delay: 1s; }
.cb-spark.s3 { top: 20px; right: 18%; font-size: 11px; animation-delay: 2s; }
@keyframes cb-twinkle { 0%, 100% { opacity: 0.2; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.15); } }
:root:not(.dark) .cb-hero { background: radial-gradient(120% 140% at 0% 0%, rgb(124 58 237 / 0.16), transparent 55%), radial-gradient(90% 120% at 100% 100%, rgb(37 99 235 / 0.12), transparent 60%), var(--card); }
:root:not(.dark) .cb-member { background: rgb(124 58 237 / 0.04); }
:root:not(.dark) .cb-kicker { color: #6d28d9; }
:root:not(.dark) .cb-spark { color: #8b5cf6; }

@media (max-width: 640px) {
  .cb-hero { padding: 16px; }
  .cb-hero-title { font-size: 21px; }
  .cb-crew { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  [data-slot="agent-avatar"] img, .cb-char img, .cb-member, .cb-spark, [data-slot="agent-avatar"].cb-busy, .cb-dots b { animation: none !important; }
}
