/* Diseño común de las páginas de gestión (estudio, agencia, mi cuenta, entrar, invitación) y de la barra de perfil.
   Los colores son tokens: las páginas usan var(--…) y nunca repiten la paleta. Los selectores de elementos van en
   :where() (especificidad 0) para que cada página pueda ajustar lo suyo sin pelear con este archivo. */
:root {
  color-scheme: dark;
  --fondo: #0a0f1e; --fondo2: #0e1530;
  --panel: #121a31; --panel2: #182140; --campo: #0c1329;
  --borde: #263256; --borde-fuerte: #34437a; --linea: rgba(255, 255, 255, 0.06);
  --texto: #eef2ff; --suave: #9aa6c7; --tenue: #6d79a0;
  --acento: #5fd4ff; --acento2: #1e6bff; --degradado: linear-gradient(135deg, var(--acento2), var(--acento));
  --ok: #3ddc97; --aviso: #ffb547; --error: #ff5d7a;
  --ok-fondo: rgba(61, 220, 151, 0.12); --aviso-fondo: rgba(255, 181, 71, 0.12); --error-fondo: rgba(255, 93, 122, 0.12);
  --tarjeta: var(--panel2); /* nombre antiguo de algunas páginas */
  --r1: 8px; --r2: 12px; --r3: 16px; --r4: 22px;
  --sombra: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --sombra-menu: 0 18px 50px -10px rgba(0, 0, 0, 0.75);
  --rapido: 150ms cubic-bezier(0.2, 0.7, 0.2, 1); --suavemente: 250ms cubic-bezier(0.2, 0.7, 0.2, 1);
  --letra: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --alto-barra: 56px;
}

:where(*, *::before, *::after) { box-sizing: border-box; }
:where(html) { -webkit-text-size-adjust: 100%; }
:where(body) {
  margin: 0; min-height: 100vh; color: var(--texto); font: 15px/1.5 var(--letra);
  background: radial-gradient(1200px 600px at 50% -15%, #182a5c 0%, transparent 60%), var(--fondo);
  background-attachment: fixed; overflow-x: hidden;
}
:where(h1, h2, h3, h4) { line-height: 1.25; overflow-wrap: anywhere; }
:where(a) { color: var(--acento); }
:where(img, video) { max-width: 100%; }
:where(button, input, select, textarea) { font: inherit; color: inherit; }
:where(input, select, textarea) {
  width: 100%; min-width: 0; background: var(--campo); color: var(--texto); border: 1px solid var(--borde);
  border-radius: var(--r2); padding: 9px 11px; transition: border-color var(--rapido), box-shadow var(--rapido);
}
:where(input, select, textarea):focus { outline: none; border-color: var(--acento); box-shadow: 0 0 0 3px rgba(95, 212, 255, 0.18); }
:where(input[type="checkbox"], input[type="radio"]) { width: auto; accent-color: var(--acento); }
:where(:focus-visible) { outline: 2px solid var(--acento); outline-offset: 2px; }

/* Botones: .btn (o <button> dentro de las páginas que ya los usan) */
.btn, :where(.ui) :where(button) {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none;
  border: 1px solid var(--borde); background: var(--panel2); color: var(--texto); border-radius: var(--r2);
  padding: 8px 14px; font-weight: 600; font-size: 14px; line-height: 1.2; white-space: normal; text-align: center;
  transition: background var(--rapido), border-color var(--rapido), transform var(--rapido), opacity var(--rapido);
}
.btn:hover, :where(.ui) :where(button):hover { border-color: var(--borde-fuerte); background: #1e2850; }
.btn:active, :where(.ui) :where(button):active { transform: translateY(1px); }
.btn:disabled, :where(.ui) :where(button):disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.primario, :where(.ui) :where(button.primario) { background: var(--degradado); border-color: transparent; color: #fff; font-weight: 700; }
.btn.primario:hover, :where(.ui) :where(button.primario):hover { filter: brightness(1.08); }
.btn.peligro, :where(.ui) :where(button.peligro) { color: var(--error); }
.btn.peligro:hover, :where(.ui) :where(button.peligro):hover { background: var(--error-fondo); border-color: rgba(255, 93, 122, 0.4); }
.btn.fantasma { background: transparent; border-color: transparent; color: var(--suave); }
.btn.fantasma:hover { background: var(--panel2); color: var(--texto); }
.btn.chico { padding: 5px 10px; font-size: 13px; border-radius: var(--r1); }

/* Chips e insignias: nunca empujan el ancho (el texto largo se parte) */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; max-width: 100%;
  background: var(--panel2); border: 1px solid var(--borde); font-size: 12.5px; color: var(--suave);
  flex: 0 1 auto; min-width: 0; overflow-wrap: anywhere; line-height: 1.35;
}
.chip.ok { color: var(--ok); border-color: rgba(61, 220, 151, 0.35); background: var(--ok-fondo); }
.chip.aviso { color: var(--aviso); border-color: rgba(255, 181, 71, 0.35); background: var(--aviso-fondo); }
.chip.error { color: var(--error); border-color: rgba(255, 93, 122, 0.35); background: var(--error-fondo); }
.insignia { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em;
  padding: 2px 8px; border-radius: 999px; background: rgba(95, 212, 255, 0.12); color: var(--acento); white-space: nowrap; }
.insignia.ambar { background: rgba(255, 181, 71, 0.14); color: var(--aviso); }

/* Tarjetas, cifras y listas */
.tarjeta { background: var(--panel2); border: 1px solid var(--borde); border-radius: var(--r3); padding: 16px; display: grid; gap: 12px; min-width: 0; }
.cifras { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }
.cifra { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--r3); padding: 14px; min-width: 0; }
.cifra b { display: block; font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cifra span { color: var(--suave); font-size: 13px; }
.cifra.ok b { color: var(--ok); } .cifra.aviso b { color: var(--aviso); } .cifra.error b { color: var(--error); }
.rejilla { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
.vacio { padding: 22px; text-align: center; color: var(--suave); border: 1px dashed var(--borde); border-radius: var(--r3); }
.suave { color: var(--suave); }
.tenue { color: var(--tenue); }
.oculto, [hidden] { display: none !important; }

/* Actividad (auditoría) */
.actividad { display: grid; gap: 0; }
.actividad > div { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 8px 0; border-top: 1px solid var(--linea); font-size: 13.5px; }
.actividad > div:first-child { border-top: 0; }
.actividad .cuando { color: var(--tenue); font-size: 12px; grid-row: span 2; white-space: nowrap; padding-top: 2px; min-width: 88px; }
.actividad .quien { color: var(--suave); font-size: 12.5px; overflow-wrap: anywhere; }

/* Aviso flotante */
.toast, #aviso {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60; max-width: min(560px, calc(100% - 32px));
  background: #1d2750; border: 1px solid var(--borde-fuerte); border-radius: var(--r3); padding: 11px 18px; box-shadow: var(--sombra-menu);
  font-weight: 600; text-align: center; animation: ui-entra var(--suavemente);
}
@keyframes ui-entra { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes ui-brillo { 0% { background-position: -200px 0; } 100% { background-position: 200px 0; } }
.esqueleto { border-radius: var(--r2); min-height: 18px; background: linear-gradient(90deg, var(--panel2) 0, #212c52 40px, var(--panel2) 80px) var(--panel2); background-size: 400px 100%; animation: ui-brillo 1.2s linear infinite; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Concha de las páginas de gestión: menú lateral #menu (en el celular, pestañas arriba) y el contenido */
.concha { display: grid; grid-template-columns: 228px minmax(0, 1fr); max-width: 1480px; margin: 0 auto; }
#menu { position: sticky; top: var(--alto-barra, 56px); align-self: start; height: calc(100vh - var(--alto-barra, 56px)); padding: 18px 12px; display: grid; align-content: start; gap: 2px; border-right: 1px solid var(--linea); }
#menu a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: var(--r2); color: var(--suave); text-decoration: none; font-weight: 600; font-size: 14.5px; transition: background var(--rapido), color var(--rapido); }
#menu a:hover { background: var(--panel); color: var(--texto); }
#menu a[aria-current="page"] { background: rgba(95, 212, 255, 0.1); color: var(--texto); box-shadow: inset 3px 0 0 var(--acento); }
#menu a .n { margin-left: auto; font-size: 12px; color: var(--tenue); font-variant-numeric: tabular-nums; }
#menu .pie { margin-top: 14px; padding: 12px; border-top: 1px solid var(--linea); font-size: 12px; color: var(--tenue); }
@media (max-width: 860px) {
  .concha { grid-template-columns: minmax(0, 1fr); }
  #menu { z-index: 30; height: auto; display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--linea); background: rgba(10, 15, 30, 0.92); backdrop-filter: blur(10px); padding: 6px 10px; gap: 4px; scrollbar-width: none; }
  #menu a { white-space: nowrap; padding: 7px 12px; }
  #menu a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--acento); }
  #menu a .n, #menu .pie { display: none; }
}
