/* Sistema de diseño "cyberdeck" — Alto Rendimiento Cognitivo.
   Tema único (sin fork claro/oscuro): esta app se piensa siempre oscura,
   como un terminal de control, no una web de marketing con preferencia de
   sistema. Si en algún momento se quiere reintroducir un modo claro,
   agregar un fork acá, no asumir que hace falta. */
:root {
  --bg: #0a0a12;
  --surface: #12121d;
  --surface-2: #1a1a29;
  --ink: #f2f2f7;
  --ink-2: #a6a6bf;
  --ink-3: #6c6c85;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.16);
  --accent: #8b7ff5;
  --accent-soft: #8b7ff524;
  --accent-ink: #ffffff;
  --danger: #f0576b;
  --danger-soft: #f0576b1f;
  --ok: #4ade80;
  --ok-soft: #4ade801f;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4), 0 1px 1px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 28px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.4);
  --glow-accent: 0 0 0 3px var(--accent-soft), 0 0 18px rgba(139,127,245,0.18);
  --radius: 14px;
  --radius-sm: 8px;
  --font-sans: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --font-display: 'Space Grotesk', var(--font-sans);
}
* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  position: relative;
}
/* Escena de fondo "cyberdeck" — líneas tipo gráfico de bolsa + dos blobs de
   luz, ambos a la deriva muy lentamente (animación por transform, liviana:
   no repinta las tablas de datos que van encima). Marcado en <body> vía
   bgScene() en src/layout.php, fijo detrás de todo (z-index:-1). Casi
   invisible a propósito — es atmósfera, no debe competir con datos densos
   (KPIs, calendario). Se apaga con prefers-reduced-motion. */
.bg-scene { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-lines { position: absolute; inset: -15% -8%; width: 130%; height: 130%; opacity: .6; animation: bg-lines-drift 23s ease-in-out infinite alternate; }
.bg-blob { position: absolute; border-radius: 50%; filter: blur(90px); }
.bg-blob-a {
  width: 620px; height: 620px; left: -160px; top: -180px;
  background: radial-gradient(circle, var(--accent), transparent 70%); opacity: .28;
  animation: bg-blob-a 16s ease-in-out infinite;
}
.bg-blob-b {
  width: 520px; height: 520px; right: -160px; bottom: -140px;
  background: radial-gradient(circle, var(--ok), transparent 70%); opacity: .14;
  animation: bg-blob-b 20s ease-in-out infinite;
}
/* Punto violeta que sigue al cursor (ver bg-scene.js) — arranca centrado
   arriba (misma posición que tenía el glow estático viejo) hasta el primer
   mousemove, así no hay salto visual en la carga. Desactivado en touch. */
.bg-cursor-glow {
  position: absolute; left: 0; top: 0; width: 520px; height: 520px;
  border-radius: 50%; background: radial-gradient(circle, rgba(139,127,245,0.22), transparent 70%);
  filter: blur(60px); opacity: 0; transition: opacity .5s ease; will-change: transform;
}
.bg-cursor-glow.bg-cursor-active { opacity: 1; }
@keyframes bg-lines-drift { from { transform: translate(0,0); } to { transform: translate(-140px,-70px); } }
@keyframes bg-blob-a { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(70px,50px) scale(1.1); } }
@keyframes bg-blob-b { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-60px,-40px) scale(1.06); } }
@media (prefers-reduced-motion: reduce) {
  .bg-lines, .bg-blob-a, .bg-blob-b { animation: none !important; }
}
::selection { background: var(--accent-soft); }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; box-shadow: var(--glow-accent); }

/* Scrollbar discreto, en tema (solo navegadores webkit/blink) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* Lockup ícono + wordmark real (ver brandMark() en layout.php) — logos
   procesados a PNG transparente a partir del paquete de identidad visual. */
.brand-mark { display: inline-flex; align-items: center; gap: .5rem; vertical-align: middle; }
.brand-mark-icon { height: 20px; width: auto; display: block; }
.brand-mark-logo { height: 13px; width: auto; display: block; }
.brand-mark-admin { font-family: var(--font-mono); font-size: .68rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; margin-left: .1rem; }

.wrap { max-width: 420px; margin: 8vh auto; padding: 0 1.2rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem;
  box-shadow: var(--shadow-md);
}
h1 {
  font-size: 1.35rem; margin: 0 0 .3rem; font-weight: 700;
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: .01em;
  text-shadow: 0 0 26px rgba(139,127,245,.35);
}
p.sub { color: var(--ink-2); margin: 0 0 1.4rem; font-size: .92rem; }
label {
  display:block; font-size:.68rem; font-weight: 600; color:var(--ink-3); margin-bottom:.4rem;
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .07em;
}

input[type=email], input[type=password], input[type=text], input[type=date], input[type=time], input[type=number],
select, textarea {
  width: 100%; padding: .62rem .75rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--ink);
  font-size: .92rem; font-family: inherit; margin-bottom: 1rem;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'><path d='M5.5 8L10 12.5L14.5 8' stroke='%236c6c85' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right .65rem center;
  background-size: 18px;
  padding-right: 2.2rem;
  cursor: pointer;
}

/* Reemplazo de <input type="time"> (ver assets/timeinput.js) — dos <select>
   fijos en 24h, independientes del locale del dispositivo. */
.timesel { display:inline-flex; align-items:center; gap:.25rem; margin-bottom:1rem; }
.timesel select {
  width: auto; margin-bottom: 0; padding: .62rem .5rem; padding-right: 1.8rem;
  background-position: right .35rem center; background-size: 15px;
}
.timesel-sep { color: var(--ink-2); font-weight: 600; }

button, .abtn {
  padding: .62rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--ink); font-size: .88rem; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: transform .08s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
  display: inline-flex; align-items: center; gap: .4rem;
}
button:hover, .abtn:hover { border-color: var(--ink-3); box-shadow: var(--shadow-sm); }
button:active, .abtn:active { transform: translateY(1px); }
.wrap button, .card > form > button { width: 100%; justify-content: center; }
button.abtn.primary, .abtn.primary, button[type=submit] {
  background: var(--accent); color: var(--accent-ink); border-color: transparent;
}
button.abtn.primary:hover, .abtn.primary:hover, button[type=submit]:hover { filter: brightness(1.1); box-shadow: var(--shadow-md), var(--glow-accent); }
button.abtn.primary:focus-visible, .abtn.primary:focus-visible, button[type=submit]:focus-visible { outline-color: var(--accent-ink); }
.abtn.danger { background: transparent; color: var(--danger); border-color: var(--danger-soft); }
.abtn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }

.error { background: var(--danger-soft); border:1px solid var(--danger); color:var(--danger); padding:.65rem .9rem; border-radius:var(--radius-sm); font-size:.85rem; margin-bottom:1rem; }

/* Modal genérico — vive en app.css (no client.css) porque lo usan también
   las páginas de admin, que no cargan client.css. Bug real encontrado
   2026-07-31: el modal de "Editar KPI" de admin/kpi_plantillas.php y
   admin/cliente.php se renderizaba sin backdrop ni posición fija porque
   estas clases solo existían en client.css. */
.modal-backdrop { position:fixed; inset:0; background:rgba(0,0,0,.5); display:flex; align-items:center; justify-content:center; z-index:100; padding:1rem; }
.modal-box { background:var(--surface); border-radius:var(--radius); padding:1.5rem; width:100%; max-width:420px; box-shadow:var(--shadow-md); max-height:88vh; overflow-y:auto; }
.modal-box h3 { margin:0 0 1rem; }
.modal-actions { display:flex; gap:.5rem; margin-top:1rem; }
.modal-actions .abtn { flex:1; }

/* Título de marca del dashboard general (ver .welcome en index.php) —
   mismo lenguaje visual que el boot-title del login, pero como contenido
   normal de página, no overlay. */
.brand-banner { margin-bottom: 2rem; }
.brand-eyebrow {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .16em; color: var(--ink-3);
  text-transform: uppercase; margin-bottom: .6rem;
}
.brand-title {
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(1.6rem, 4.5vw, 2.6rem); letter-spacing: -.005em; line-height: 1.1;
  text-shadow: 0 0 30px rgba(139,127,245,.35);
}
.brand-title .accent { color: var(--accent); }

/* Boot intro — overlay de bienvenida, una vez por login (ver index.php +
   auth.php: $_SESSION['show_boot_intro']). Saltable (botón, click afuera,
   Esc/Enter) y se auto-cierra sola a los ~2.4s. boot-intro.js maneja la
   secuencia; acá solo el look. */
.boot-intro {
  position: fixed; inset: 0; z-index: 500; display:flex; align-items:center; justify-content:center;
  padding: 1.5rem;
  background: radial-gradient(ellipse 900px 600px at 50% 25%, rgba(139,127,245,0.14), transparent 65%), var(--bg);
  transition: opacity .5s ease;
}
.boot-intro.boot-hide { opacity: 0; pointer-events: none; }
.boot-card { max-width: 460px; width: 100%; text-align: center; }

/* Fase 1 del login: wordmark real (logo-principal.png) gigante a pantalla
   completa (ver login.php). Entra con blur+scale sobre ~1.8s con la curva
   "expo-out" cinematográfica, después .boot-reveal (el resto: tagline) se
   desvanece hacia adentro — timing coordinado por data-t/data-reveal-at,
   ver boot-intro.js. */
.boot-stage { display: flex; flex-direction: column; align-items: center; text-align: center; max-width: 900px; width: 100%; padding: 0 1rem; }
.boot-logo-img {
  width: min(85vw, 620px); height: auto; display: block; margin-bottom: 1.8rem;
  opacity: 0; transform: scale(.94); filter: blur(6px) drop-shadow(0 0 46px rgba(139,127,245,.4));
  animation: boot-logo-in 1.8s cubic-bezier(.16,1,.3,1) forwards;
}
@keyframes boot-logo-in {
  0% { opacity: 0; transform: scale(.94); filter: blur(6px) drop-shadow(0 0 46px rgba(139,127,245,.4)); }
  55% { opacity: 1; filter: blur(0) drop-shadow(0 0 46px rgba(139,127,245,.4)); }
  100% { opacity: 1; transform: scale(1); filter: blur(0) drop-shadow(0 0 46px rgba(139,127,245,.4)); }
}
.boot-reveal { opacity: 0; transform: translateY(10px); transition: opacity .6s ease, transform .6s ease; max-width: 460px; width: 100%; }
.boot-reveal.boot-reveal-show { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .boot-logo-img { animation: none; opacity: 1; transform: none; filter: drop-shadow(0 0 46px rgba(139,127,245,.4)); }
  .boot-reveal { transition: none; }
}
.boot-eyebrow {
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .16em; color: var(--ink-3);
  text-transform: uppercase; margin-bottom: 1.5rem;
}
.boot-title {
  font-family: var(--font-display); font-size: clamp(1.6rem, 6vw, 2.4rem); font-weight: 700;
  letter-spacing: .01em; line-height: 1.15; margin-bottom: .7rem; text-transform: uppercase;
  text-shadow: 0 0 34px rgba(139,127,245,.45);
}
.boot-title span { color: var(--accent); }
.boot-title sup { font-size: .4em; top: -.6em; color: var(--ink-3); }
.boot-sub { color: var(--ink-2); font-size: .92rem; margin-bottom: 2.2rem; }
.boot-tagline {
  font-family: var(--font-display); font-size: clamp(1rem, 2.6vw, 1.25rem); font-weight: 500;
  color: var(--accent); margin-bottom: .5rem;
}
.boot-position {
  font-family: var(--font-mono); font-size: .7rem; letter-spacing: .14em; color: var(--ink-3);
  text-transform: uppercase; margin-bottom: 2.2rem;
}
.boot-log { list-style: none; margin: 0 0 2rem; padding: 0; text-align: left; display: inline-block; min-width: 280px; }
.boot-log li {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  font-family: var(--font-mono); font-size: .78rem; color: var(--ink-2); padding: .35rem 0;
  opacity: 0; transform: translateY(6px); transition: opacity .4s ease, transform .4s ease;
}
.boot-log li.boot-show { opacity: 1; transform: none; }
.boot-log li.boot-ready { color: var(--ink); font-weight: 600; }
.boot-ok {
  font-family: var(--font-mono); font-size: .66rem; font-weight: 700; color: var(--ok);
  border: 1px solid var(--ok-soft); background: var(--ok-soft); padding: .12rem .5rem;
  border-radius: 4px; letter-spacing: .05em; flex: 0 0 auto;
}
.boot-skip {
  background: none; border: 1px solid var(--border-strong); color: var(--ink-3);
  font-family: var(--font-mono); font-size: .7rem; letter-spacing: .05em; text-transform: uppercase;
  padding: .45rem 1rem; border-radius: 999px; cursor: pointer; opacity: 0;
  animation: boot-skip-in .3s ease .3s forwards;
}
.boot-skip:hover { color: var(--ink); border-color: var(--ink-3); }
@keyframes boot-skip-in { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .boot-log li { transition: none; }
}
.shell { max-width: 960px; margin: 0 auto; padding: 2rem 1.2rem; }
.topbar { display:flex; justify-content:space-between; align-items:center; margin-bottom:1.6rem; }
.topbar a { color: var(--ink-2); font-size:.85rem; text-decoration:none; }

/* Segmented control — reemplaza <select> feos para 2-4 opciones mutuamente excluyentes */
.seg { display:inline-flex; border:1px solid var(--border-strong); border-radius: var(--radius-sm); overflow:hidden; background: var(--surface-2); margin-bottom: 1rem; }
.seg input { position:absolute; opacity:0; pointer-events:none; width:0; height:0; margin:0; }
.seg label {
  margin:0; padding:.64rem 1rem; font-size:.85rem; font-weight:600; color:var(--ink-2); line-height:1.1;
  font-family: var(--font-sans); text-transform: none; letter-spacing: normal;
  cursor:pointer; transition: background .12s ease, color .12s ease; user-select:none;
  border-right: 1px solid var(--border-strong);
}
.seg label:last-child { border-right:none; }
.seg input:checked + label { background: var(--accent); color: var(--accent-ink); }
.seg input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: -2px; }
.seg label:hover { background: var(--border); }
.seg input:checked + label:hover { background: var(--accent); }
