/* believable-studio: el design system de la UI de Believable (design.md + src/renderer/src/theme.css).
   Mismos tokens que la app: navy, Signal cian glossy para la acción principal, Fraunces 500 en el
   wordmark y los títulos, Inter en la interfaz, JetBrains Mono en datos. No es el sistema de la casa
   Believe (papel y tinta). Un token nuevo pasa por George Beltrán. */

@font-face { font-family: 'Fraunces'; src: url('/fonts/Fraunces.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/Inter.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #0f1527;
  --bg-raised: #161f36;
  --bg-overlay: #1e2845;
  --bg-hover: #273454;
  --border: #2a3654;
  --border-strong: #3f4c78;
  --text: #f4f6fb;
  --text-dim: #9aa6c0;
  --text-faint: #5c6784;
  --primary: #2b6bff;
  --signal: #1fb6ff;
  --signal-soft: #6fd3ff;
  --signal-bright: color-mix(in oklch, var(--signal) 55%, white 45%);
  --signal-deep: color-mix(in oklch, var(--signal) 65%, black 35%);
  --ok: #34d399;
  --warn: #f5c542;
  --error: #f8717a;
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-sans: 'Inter', -apple-system, 'SF Pro Text', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  position: relative;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font-sans);
  /* Sin 'calt': Inter cambia la x entre cifras por un signo de multiplicar (k3x9 → k3×9). */
  font-feature-settings: 'calt' 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
/* Grano (.app-grain de la app): que el navy no se vea plástico. */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: 0.035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
::selection { background: color-mix(in oklch, var(--signal) 35%, transparent); }
a { color: var(--signal); text-decoration: none; }
code { font-family: var(--font-mono); font-size: 0.92em; background: var(--bg-raised); border: 1px solid var(--border); border-radius: 4px; padding: 0.05em 0.35em; color: var(--text); }
strong { font-weight: 600; color: var(--text); }
.ic { flex: none; }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.small { font-size: 12px; }
.mono { font-family: var(--font-mono); }

/* Campo de luz (auroras de WelcomeShell): lo que el vidrio desenfoca. */
.aurora { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.aurora span { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.22; animation: respira 30s ease-in-out infinite; }
.aurora span:nth-child(1) { width: 520px; height: 520px; left: -140px; top: -160px; background: var(--signal); }
.aurora span:nth-child(2) { width: 460px; height: 460px; right: -160px; top: 30%; background: #1d4fd0; opacity: 0.28; animation-duration: 36s; }
.aurora span:nth-child(3) { width: 380px; height: 380px; left: 30%; bottom: -220px; background: var(--signal); opacity: 0.12; animation-duration: 42s; }
.is-app .aurora span { opacity: 0.08; }
@keyframes respira { 0%, 100% { transform: translate3d(0, 0, 0) scale(1); } 50% { transform: translate3d(3%, -4%, 0) scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .aurora span { animation: none; } }

/* Tipografía de marca */
.display { font-family: var(--font-display); font-weight: 500; font-optical-sizing: auto; font-variation-settings: 'opsz' 96, 'SOFT' 0, 'WONK' 0; letter-spacing: -0.01em; font-size: 30px; line-height: 1.15; margin: 0; }
.display-sm { font-family: var(--font-display); font-weight: 500; font-variation-settings: 'opsz' 28, 'SOFT' 0, 'WONK' 0; font-size: 18px; margin: 0; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.wordmark .sym { width: 26px; height: 26px; }
.wordmark span { font-family: var(--font-display); font-weight: 500; font-variation-settings: 'opsz' 48, 'SOFT' 0, 'WONK' 0; font-size: 21px; letter-spacing: -0.01em; }
.wordmark i { font-style: normal; color: var(--signal); }

/* Botones */
button, .btn-glossy-signal, .btn-secondary, .btn-ghost { font: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; padding: 10px 16px; font-weight: 600; font-size: 14px; border: 0; text-decoration: none; }
.btn-block { width: 100%; }
/* Acabado premium: el .btn-glossy-signal de theme.css, igual. */
.btn-glossy-signal {
  position: relative; overflow: hidden; color: #04121c;
  background: radial-gradient(circle at 30% 22%, var(--signal-bright) 0%, var(--signal) 45%, var(--signal-deep) 100%);
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.55), inset 0 -5px 9px -3px rgba(0, 60, 90, 0.5), 0 3px 10px -2px color-mix(in oklch, var(--signal) 60%, transparent), 0 10px 26px -8px color-mix(in oklch, var(--signal) 45%, transparent);
  transition: all 150ms ease;
}
.btn-glossy-signal:hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.6), inset 0 -5px 9px -3px rgba(0, 60, 90, 0.5), 0 5px 16px -2px color-mix(in oklch, var(--signal) 75%, transparent), 0 14px 32px -8px color-mix(in oklch, var(--signal) 60%, transparent); }
.btn-glossy-signal::before { content: ''; position: absolute; pointer-events: none; top: 3px; left: 8px; right: 8px; height: 10px; border-radius: 999px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent); }
.btn-glossy-signal > * { position: relative; }
.btn-secondary { color: var(--text); background: var(--bg-overlay); border: 1px solid var(--border-strong); transition: all 150ms ease; }
.btn-secondary:hover { border-color: color-mix(in oklch, var(--signal) 55%, var(--border-strong)); box-shadow: 0 0 0 3px color-mix(in oklch, var(--signal) 14%, transparent); }
.btn-ghost { color: var(--text-dim); background: transparent; padding: 6px 10px; font-weight: 500; }
.btn-ghost:hover { color: var(--text); background: var(--bg-hover); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

/* Vidrio (tarjetas flotantes, como el login de la app) */
.glass { background: color-mix(in srgb, var(--bg-raised) 72%, transparent); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); border: 1px solid color-mix(in srgb, var(--border-strong) 70%, transparent); border-radius: 16px; box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.05) inset, 0 24px 60px -24px rgba(0, 0, 0, 0.6); }

/* Login */
.login { max-width: none; position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 32px 20px; }
.login-card { width: 100%; max-width: 420px; padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.login-card h1 { font-size: 28px; }
.login-card p { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-dim); font-weight: 500; }
.field input { font: inherit; font-size: 14px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.field input::placeholder { color: var(--text-faint); }
.field input:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px color-mix(in oklch, var(--signal) 22%, transparent); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-faint); font-size: 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.alert { margin: 0; padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.alert-error { color: var(--error); background: color-mix(in srgb, var(--error) 10%, transparent); border: 1px solid color-mix(in srgb, var(--error) 35%, transparent); }
.alert-ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }

/* Shell: sidebar de vidrio + contenido */
.shell { position: relative; z-index: 1; display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 20px 14px; background: color-mix(in srgb, #071023 72%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-right: 1px solid var(--border); }
.sidebar-brand { padding: 2px 8px 6px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 12px; padding: 4px 8px; border-radius: 8px; }
.back:hover { color: var(--text); background: var(--bg-hover); }
.project-name { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; overflow-wrap: anywhere; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--text-dim); font-size: 13px; font-weight: 500; border: 1px solid transparent; transition: all 150ms ease; }
.nav-item:hover { color: var(--text); background: var(--bg-hover); box-shadow: 0 0 18px -8px color-mix(in oklch, var(--signal) 60%, transparent); }
.nav-item.is-active { color: var(--text); background: var(--bg-overlay); border-color: color-mix(in oklch, var(--signal) 35%, var(--border)); box-shadow: 0 0 22px -10px color-mix(in oklch, var(--signal) 80%, transparent); }
.nav-item.is-active .ic { color: var(--signal); }
.soon { margin-left: auto; font-style: normal; font-size: 10px; color: var(--text-faint); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; line-height: 17px; }
.content { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 14px 32px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg-raised) 55%, transparent); }
.topbar-brand { display: none; margin-right: auto; }
.account { display: flex; align-items: center; gap: 10px; min-width: 0; }
.account form { margin: 0; }
.email { color: var(--text-dim); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; color: var(--text-dim); background: var(--bg-hover); border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px; line-height: 18px; white-space: nowrap; }
.chip-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
main { padding: 32px; max-width: 1100px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; }

/* Tarjetas (superficie, no sombra: la regla de las superficies grandes) */
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: 14px; background: var(--bg-raised); border: 1px solid var(--border); min-width: 0; }
.card-link { color: var(--text); transition: all 150ms ease; }
.card-link:hover { border-color: color-mix(in oklch, var(--signal) 50%, var(--border)); background: var(--bg-overlay); box-shadow: 0 0 26px -12px color-mix(in oklch, var(--signal) 80%, transparent); }
.card-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin-bottom: 8px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-hover); color: var(--text-dim); }
.card-title { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.card .mono { overflow-wrap: anywhere; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { font-family: var(--font-display); font-weight: 500; font-variation-settings: 'opsz' 28; font-size: 18px; overflow-wrap: anywhere; }
.stat.mono { font-family: var(--font-mono); font-size: 13px; font-weight: 500; }
.panel { padding: 18px; border-radius: 14px; background: var(--bg-raised); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.panel p { margin: 0; }
.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rows li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.rows li:first-child { border-top: 0; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 48px 24px; border-radius: 16px; border: 1px dashed var(--border-strong); color: var(--text-dim); position: relative; z-index: 1; }
.empty.glass { border-style: solid; }
.empty p { margin: 0; max-width: 460px; }
.empty h1, .empty h2 { color: var(--text); }
.empty .ic { color: var(--signal); }

/* Móvil: la sidebar se vuelve una fila de pestañas arriba */
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; align-content: start; }
  .shell > * { min-width: 0; }
  .sidebar { position: static; height: auto; padding: 12px 16px 10px; gap: 10px; border-right: 0; border-bottom: 1px solid var(--border); order: 2; }
  .sidebar-brand { display: none; }
  .project-name { flex-direction: row; align-items: baseline; gap: 8px; }
  .nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { flex: none; padding: 7px 11px; }
  .soon { display: none; }
  .content { display: contents; }
  .topbar { order: 1; padding: 12px 16px; position: relative; z-index: 1; }
  .topbar-brand { display: block; }
  .topbar .email { display: none; }
  main { order: 3; padding: 20px 16px 40px; position: relative; z-index: 1; }
  .display { font-size: 26px; }
  .login-card { padding: 24px 20px; }
}
