/* ============================================================================
   Portal de Profesores — ServicesDogs Academy
   assets/css/app.css
   ----------------------------------------------------------------------------
   Índice
     1. Tokens de diseño (claro / oscuro / automático)
     2. Base y utilidades
     3. Componentes: marca, botones, campos, código OTP, tarjetas, toasts
     4. Vistas de acceso (login / verificación)
     5. Portal: sidebar, topbar, tabbar, contenido
     6. Módulos (inicio, perfil, próximamente)
     7. Responsive
     8. Movimiento reducido / impresión
   ----------------------------------------------------------------------------
   Tema: <html data-theme-pref="light|dark|auto">. "auto" sigue al sistema.
   ============================================================================ */

/* 1. TOKENS ================================================================ */

:root {
  /* Marca */
  --sd-yellow: #FFC400;           /* Amarillo ServicesDogs (acento)          */
  --sd-yellow-strong: #E0A800;    /* Hover / presionado                       */
  --sd-black: #0A0A0A;

  /* Tipografía: pila del sistema (SF Pro en Apple, Segoe en Windows, Roboto en Android) */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI",
          Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  /* Radios y espaciado */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --gutter: 16px;

  /* Alturas táctiles */
  --tap: 52px;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --t-fast: 140ms;
  --t-med: 240ms;

  --sidebar-w: 272px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

/* Paleta clara (por defecto) */
:root,
:root[data-theme-pref="light"] {
  color-scheme: light;
  --bg: #F5F5F7;
  --bg-glow: rgba(255, 196, 0, .14);
  --surface: #FFFFFF;
  --surface-2: #F2F2F4;
  --surface-3: #E8E8ED;
  --glass: rgba(255, 255, 255, .72);
  --text: #1D1D1F;
  --text-2: #5E5E63;
  --text-3: #8A8A8F;
  --border: rgba(0, 0, 0, .09);
  --border-strong: rgba(0, 0, 0, .18);
  --accent: var(--sd-yellow);
  --accent-hover: var(--sd-yellow-strong);
  --accent-ink: #111111;
  --accent-soft: rgba(255, 196, 0, .18);
  --accent-text: #8A6A00;           /* amarillo legible sobre blanco (AA) */
  --focus: #1D1D1F;
  --focus-ring: rgba(255, 196, 0, .55);
  --danger: #C4001A;
  --danger-soft: rgba(215, 0, 21, .08);
  --success: #1E7B36;
  --success-soft: rgba(36, 138, 61, .1);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .04), 0 24px 48px rgba(0, 0, 0, .10);
  --logo: url("../img/logo-light.svg");
}

/* Paleta oscura */
:root[data-theme-pref="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --bg-glow: rgba(255, 196, 0, .09);
  --surface: #1C1C1E;
  --surface-2: #2C2C2E;
  --surface-3: #3A3A3C;
  --glass: rgba(28, 28, 30, .72);
  --text: #F5F5F7;
  --text-2: #AEAEB2;
  --text-3: #8E8E93;
  --border: rgba(255, 255, 255, .10);
  --border-strong: rgba(255, 255, 255, .22);
  --accent: #FFCC00;
  --accent-hover: #FFD633;
  --accent-ink: #0A0A0A;
  --accent-soft: rgba(255, 204, 0, .16);
  --accent-text: #FFD60A;
  --focus: #FFCC00;
  --focus-ring: rgba(255, 204, 0, .45);
  --danger: #FF6961;
  --danger-soft: rgba(255, 69, 58, .14);
  --success: #32D74B;
  --success-soft: rgba(48, 209, 88, .14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 24px 48px rgba(0, 0, 0, .5);
  --logo: url("../img/logo-dark.svg");
}

/* Automático: sigue al sistema */
@media (prefers-color-scheme: dark) {
  :root[data-theme-pref="auto"] {
    color-scheme: dark;
    --bg: #000000;
    --bg-glow: rgba(255, 196, 0, .09);
    --surface: #1C1C1E;
    --surface-2: #2C2C2E;
    --surface-3: #3A3A3C;
    --glass: rgba(28, 28, 30, .72);
    --text: #F5F5F7;
    --text-2: #AEAEB2;
    --text-3: #8E8E93;
    --border: rgba(255, 255, 255, .10);
    --border-strong: rgba(255, 255, 255, .22);
    --accent: #FFCC00;
    --accent-hover: #FFD633;
    --accent-ink: #0A0A0A;
    --accent-soft: rgba(255, 204, 0, .16);
    --accent-text: #FFD60A;
    --focus: #FFCC00;
    --focus-ring: rgba(255, 204, 0, .45);
    --danger: #FF6961;
    --danger-soft: rgba(255, 69, 58, .14);
    --success: #32D74B;
    --success-soft: rgba(48, 209, 88, .14);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 24px 48px rgba(0, 0, 0, .5);
    --logo: url("../img/logo-dark.svg");
  }
}

/* 2. BASE ================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--t-med) var(--ease), color var(--t-med) var(--ease);
}

[hidden] { display: none !important; }

h1, h2, h3, p { margin: 0; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }

a { color: inherit; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ico {
  width: 22px; height: 22px; flex: none;
  fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.ico--sm { width: 18px; height: 18px; }
.ico--lg { width: 28px; height: 28px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.noscript {
  position: fixed; inset: auto 16px 16px; padding: 16px; border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--shadow-lg); text-align: center;
}

/* 3. COMPONENTES =========================================================== */

/* — Marca — */
.brand-logo {
  display: inline-block;
  width: 168px; height: 40px;
  background: var(--logo) left center / contain no-repeat;
}
.brand-logo--sm { width: 132px; height: 32px; }
.brand-logo--lg { width: 220px; height: 52px; background-position: center; }

/* — Spinner — */
.spinner {
  display: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  border-right-color: transparent;
  animation: spin .7s linear infinite;
  opacity: .9;
}
.spinner--lg { display: inline-block; width: 28px; height: 28px; color: var(--text-3); }
@keyframes spin { to { transform: rotate(360deg); } }

/* — Botones — */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--r-md);
  font-weight: 600; font-size: 15px; letter-spacing: .01em;
  transition: background-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease), color var(--t-fast) var(--ease), opacity var(--t-fast);
  user-select: none;
}
.btn:active:not(:disabled) { transform: scale(.98); }

.btn--primary {
  min-height: var(--tap);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 16px; font-weight: 700; letter-spacing: .06em;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .06), 0 6px 18px var(--accent-soft);
}
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn--primary:focus-visible { outline-color: var(--focus); box-shadow: 0 0 0 5px var(--focus-ring); }
.btn--primary:disabled { opacity: .55; box-shadow: none; }

.btn--ghost { color: var(--text-2); background: transparent; }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn--ghost:disabled { opacity: .55; }

.btn--secondary { background: var(--surface-2); color: var(--text); }
.btn--secondary:hover:not(:disabled) { background: var(--surface-3); }

.btn--danger { color: var(--danger); background: var(--danger-soft); }
.btn--danger:hover:not(:disabled) { filter: brightness(.97); }

.btn--sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: var(--r-sm); }
.btn--block { width: 100%; }

/* Estado de carga: oculta la etiqueta y muestra el spinner */
.btn.is-loading { pointer-events: none; }
.btn.is-loading .btn__label,
.btn.is-loading > .ico { visibility: hidden; }
.btn.is-loading .spinner { display: inline-block; position: absolute; }

/* Estado de éxito momentáneo */
.btn.is-success { background: var(--success); color: #fff; }

.link-btn {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--text-2); font-size: 14px; font-weight: 500;
  padding: 6px 8px; margin-left: -8px; border-radius: var(--r-sm);
}
.link-btn:hover { color: var(--text); background: var(--surface-2); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  color: var(--text-2);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* — Campos — */
.form { display: grid; gap: 20px; }

.field { display: grid; gap: 8px; }
.field__label { font-size: 14px; font-weight: 600; color: var(--text); }
.field__control { position: relative; }
.field__icon {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); pointer-events: none;
}
.field__hint { font-size: 13px; color: var(--text-3); }
.field__error {
  display: flex; align-items: flex-start; gap: 6px;
  font-size: 14px; color: var(--danger); font-weight: 500;
}
.field__error::before {
  content: "!"; flex: none;
  display: inline-grid; place-items: center;
  width: 18px; height: 18px; margin-top: 1px;
  border-radius: 50%;
  background: var(--danger); color: var(--surface);
  font-size: 12px; font-weight: 800; line-height: 1;
}

.input {
  width: 100%;
  min-height: var(--tap);
  padding: 0 16px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  font-size: 17px; /* ≥16px evita el zoom automático de iOS */
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.input::placeholder { color: var(--text-3); }
.input--icon { padding-left: 48px; }
.input:hover { border-color: var(--text-3); }
.input:focus { border-color: var(--focus); box-shadow: 0 0 0 4px var(--focus-ring); }
.field.has-error .input { border-color: var(--danger); }
.field.has-error .input:focus { box-shadow: 0 0 0 4px var(--danger-soft); }

/* — Código OTP: un input real sobre 6 casillas visuales — */
.otp { position: relative; }
.otp__input {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 100%;
  opacity: 0;                 /* invisible, pero recibe foco, teclado, pegado y autocompletado */
  font-size: 16px;
  caret-color: transparent;
}
.otp__slots {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.otp__slot {
  position: relative;
  flex: 1 1 0; max-width: 56px;
  aspect-ratio: 5 / 6;
  min-height: 56px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 26px; font-weight: 600;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform var(--t-fast);
}
.otp__sep { flex: none; width: 10px; height: 2px; border-radius: 2px; background: var(--border-strong); }
.otp__slot.is-filled { border-color: var(--text-3); }
.otp__slot.is-active {
  border-color: var(--focus);
  box-shadow: 0 0 0 4px var(--focus-ring);
}
.otp__slot.is-active:empty::after {
  content: ""; width: 2px; height: 28px; border-radius: 2px; background: var(--text);
  animation: caret 1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
.field.has-error .otp__slot { border-color: var(--danger); }
.otp.is-shake { animation: shake .4s var(--ease); }
@keyframes shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
.otp.is-disabled .otp__slot { opacity: .6; }

/* — Tarjetas — */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
}

/* — Píldoras y chips — */
.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3);
}
.email-pill {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  padding: 8px 14px; border-radius: 999px;
  background: var(--surface-2); color: var(--text);
  font-weight: 600; font-size: 15px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2);
}
.chip--accent { background: var(--accent-soft); color: var(--accent-text); }
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: var(--surface-2); color: var(--text-3);
}

/* — Avatar — */
.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 15px; letter-spacing: .02em;
}
.avatar--sm { width: 34px; height: 34px; font-size: 13px; }
.avatar--xl { width: 76px; height: 76px; font-size: 28px; }

/* — Control segmentado (tema) — */
.segmented {
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 3px; gap: 2px;
  border-radius: 12px; background: var(--surface-2);
}
.segmented__opt {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 0 8px; border-radius: 9px;
  font-size: 13px; font-weight: 600; color: var(--text-2);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast), box-shadow var(--t-fast);
}
.segmented__opt[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
:root[data-theme-pref="dark"] .segmented__opt[aria-checked="true"] { background: var(--surface-3); }
@media (prefers-color-scheme: dark) {
  :root[data-theme-pref="auto"] .segmented__opt[aria-checked="true"] { background: var(--surface-3); }
}

/* — Toasts — */
.toast-stack {
  position: fixed; z-index: 100;
  left: 50%; transform: translateX(-50%);
  top: calc(12px + var(--safe-t));
  width: min(440px, calc(100% - 24px));
  display: grid; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 16px;
  border-radius: var(--r-lg);
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 15px; font-weight: 500;
  pointer-events: auto;
  animation: toast-in var(--t-med) var(--ease);
}
.toast.is-leaving { animation: toast-out var(--t-med) var(--ease) forwards; }
.toast .ico { margin-top: 1px; }
.toast--error .ico { color: var(--danger); }
.toast--success .ico { color: var(--success); }
.toast--info .ico { color: var(--accent-text); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px) scale(.98); } }

/* — Banner demo — */
.demo-banner {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 16px; padding-top: calc(8px + var(--safe-t));
  background: var(--accent); color: var(--accent-ink);
  font-size: 13px; font-weight: 600; text-align: center;
}
.demo-banner .ico { width: 16px; height: 16px; }
@media (max-width: 560px) { .demo-banner__long { display: none; } }

/* 4. VISTAS DE ACCESO ====================================================== */

.view-boot,
.view-auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px var(--gutter) calc(24px + var(--safe-b));
  background:
    radial-gradient(1200px 500px at 50% -180px, var(--bg-glow), transparent 70%),
    var(--bg);
}

.boot { display: grid; justify-items: center; gap: 28px; text-align: center; }
.boot__text { color: var(--text-3); font-size: 15px; }

.auth {
  width: 100%; max-width: 440px;
  display: grid; gap: 24px;
  animation: rise var(--t-med) var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.auth__brand { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }

.auth__card { padding: 36px 32px 28px; display: grid; gap: 14px; }
.auth__card > .form { margin-top: 14px; }

.auth__title { font-size: 32px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; }
.auth__lead { color: var(--text-2); font-size: 17px; line-height: 1.5; }

.auth__note {
  display: flex; gap: 8px; align-items: flex-start;
  margin-top: 10px; padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--text-3); font-size: 13px; line-height: 1.45;
}
.auth__note .ico { margin-top: 1px; }

.auth__secondary {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px;
  margin-top: 4px;
}
.auth__secondary .btn { font-weight: 600; }

.back-btn { justify-self: start; margin-bottom: 2px; }

.auth__footer { text-align: center; font-size: 13px; color: var(--text-3); }

/* 5. PORTAL ================================================================ */

.view-portal {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}

/* — Sidebar estilo macOS — */
.sidebar {
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 24px;
  padding: 24px 16px 20px;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.sidebar__brand { display: grid; gap: 8px; padding: 4px 8px 0; }
.sidebar__product { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.sidebar nav { flex: 1; }

.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav__link {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 12px;
  border-radius: 12px;
  color: var(--text-2); font-size: 15px; font-weight: 500; text-align: left;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast);
}
.nav__link:hover { background: var(--surface-2); color: var(--text); }
.nav__link[aria-current="page"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.nav__link[aria-current="page"] .ico { color: var(--accent-text); }
.nav__label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav__dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); }
.nav__link.is-soon .nav__label { color: var(--text-3); }

.sidebar__footer { display: grid; gap: 12px; padding-top: 16px; border-top: 1px solid var(--border); }
.sidebar__actions { display: grid; gap: 8px; }
.sidebar__actions .btn--ghost { justify-content: flex-start; }

.user-chip {
  display: flex; align-items: center; gap: 12px;
  padding: 8px; border-radius: 14px; text-align: left;
}
.user-chip:hover { background: var(--surface-2); }
.user-chip__text { display: grid; min-width: 0; }
.user-chip__name, .user-chip__meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip__name { font-weight: 600; font-size: 15px; }
.user-chip__meta { font-size: 13px; color: var(--text-3); }

/* — Topbar (móvil) — */
.topbar {
  display: none;
  position: sticky; top: 0; z-index: 20;
  align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) var(--gutter) 10px;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}
.avatar-btn { border-radius: 50%; }

/* — Contenido — */
.content {
  min-width: 0;
  padding: 48px 48px 64px;
  max-width: 1120px;
  width: 100%;
  animation: rise var(--t-med) var(--ease);
}
.content:focus { outline: none; }

.page-head { display: grid; gap: 6px; margin-bottom: 32px; }
.page-title { font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -.025em; }
.page-sub { color: var(--text-2); font-size: 17px; }

.section-title {
  font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3); margin: 40px 0 14px;
}

/* — Tabbar estilo iOS — */
.tabbar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding-bottom: var(--safe-b);
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--border);
}
.tabbar__list {
  list-style: none; margin: 0 auto; padding: 0 6px;
  max-width: 640px;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
}
.tab {
  width: 100%;
  min-height: var(--tabbar-h);
  display: grid; justify-items: center; align-content: center; gap: 3px;
  padding: 6px 2px;
  color: var(--text-3);
  font-size: 11px; font-weight: 600; letter-spacing: .01em;
  transition: color var(--t-fast);
}
.tab .ico { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--text); }
.tab[aria-current="page"] .ico { color: var(--accent-text); }
.tab__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* 6. MÓDULOS =============================================================== */

/* — Inicio: tarjeta de bienvenida — */
.hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 24px;
  padding: 32px;
  border-radius: var(--r-xl);
  background: var(--sd-black);
  color: #F5F5F7;
  box-shadow: var(--shadow-lg);
}
.hero::after {
  content: "";
  position: absolute; right: -80px; top: -80px;
  width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 196, 0, .35), transparent 70%);
  pointer-events: none;
}
.hero .avatar { box-shadow: 0 0 0 4px rgba(255, 196, 0, .25); }
.hero__body { display: grid; gap: 10px; min-width: 0; position: relative; z-index: 1; }
.hero__hello { font-size: 15px; color: #AEAEB2; font-weight: 500; }
.hero__name { font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; overflow-wrap: anywhere; }
.hero__meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.hero .chip { background: rgba(255, 255, 255, .1); color: #E5E5EA; }
.hero .chip--accent { background: var(--sd-yellow); color: #111; }
.hero .chip .ico { width: 15px; height: 15px; }

/* — Rejilla de módulos — */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.module-card {
  position: relative;
  display: grid; align-content: start; gap: 14px;
  min-height: 176px;
  padding: 22px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-med) var(--ease), border-color var(--t-fast);
}
.module-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.module-card__icon {
  display: grid; place-items: center;
  width: 48px; height: 48px; border-radius: 14px;
  background: var(--surface-2); color: var(--text);
}
.module-card--primary .module-card__icon { background: var(--accent); color: var(--accent-ink); }
.module-card__title { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.module-card__desc { font-size: 14px; color: var(--text-2); line-height: 1.45; }
.module-card__foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.module-card__go { color: var(--text-3); }
.module-card.is-soon { box-shadow: none; }
.module-card.is-soon .module-card__icon { color: var(--text-3); }
.module-card.is-soon:hover { transform: none; }

/* — Listas tipo "Ajustes" de iOS — */
.list {
  margin: 0; padding: 0; list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.list__row {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px;
  min-height: 60px; padding: 12px 18px;
}
.list__row + .list__row { border-top: 1px solid var(--border); }
.list__icon {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-2);
}
.list__icon .ico { width: 18px; height: 18px; }
.list__text { display: grid; min-width: 0; }
.list__label { font-size: 13px; color: var(--text-3); font-weight: 500; }
.list__value { font-size: 16px; font-weight: 500; overflow-wrap: anywhere; }

/* — Perfil — */
.profile-head { display: flex; align-items: center; gap: 20px; margin-bottom: 28px; }
.profile-head__name { font-size: 24px; font-weight: 700; letter-spacing: -.02em; overflow-wrap: anywhere; }
.profile-head__mail { color: var(--text-2); overflow-wrap: anywhere; }
.stack { display: grid; gap: 14px; }
.settings-card { padding: 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); display: grid; gap: 12px; }
.settings-card__label { font-weight: 600; }
.settings-card__hint { font-size: 14px; color: var(--text-3); }

/* — Estado vacío / Próximamente — */
.empty {
  display: grid; justify-items: center; text-align: center; gap: 14px;
  padding: 56px 24px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
}
.empty__icon {
  display: grid; place-items: center;
  width: 72px; height: 72px; border-radius: 22px;
  background: var(--accent-soft); color: var(--accent-text);
}
.empty__title { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.empty__text { color: var(--text-2); max-width: 420px; }

/* 7. RESPONSIVE ============================================================ */

/* Tablet horizontal / portátil pequeño */
@media (max-width: 1180px) {
  :root { --sidebar-w: 248px; }
  .content { padding: 40px 32px 56px; }
}

/* Tablet vertical y celular: topbar + tabbar */
@media (max-width: 900px) {
  .view-portal { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { display: none; }
  .topbar { display: flex; }
  .tabbar { display: block; }
  .content {
    padding: 28px 24px calc(var(--tabbar-h) + var(--safe-b) + 32px);
    margin: 0 auto;
  }
}

/* Celular */
@media (max-width: 560px) {
  .auth { gap: 20px; }
  .auth__card { padding: 28px 20px 22px; border-radius: 24px; }
  .auth__title { font-size: 28px; }
  .auth__lead { font-size: 16px; }
  .otp__slots { gap: 6px; }
  .otp__slot { font-size: 22px; min-height: 52px; }
  .otp__sep { width: 6px; }

  .content { padding: 20px var(--gutter) calc(var(--tabbar-h) + var(--safe-b) + 28px); }
  .page-head { margin-bottom: 22px; }
  .page-title { font-size: 30px; }
  .page-sub { font-size: 16px; }
  .section-title { margin-top: 32px; }

  .hero { grid-template-columns: 1fr; padding: 24px; gap: 16px; }
  .hero .avatar--xl { width: 60px; height: 60px; font-size: 22px; }
  .hero__name { font-size: 24px; }

  .module-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .module-card { min-height: 150px; padding: 16px; gap: 10px; }
  .module-card__icon { width: 42px; height: 42px; border-radius: 12px; }
  .module-card__title { font-size: 15px; }
  .module-card__desc { display: none; }

  .profile-head { flex-direction: column; align-items: flex-start; gap: 14px; }
}

/* Celulares muy angostos */
@media (max-width: 360px) {
  .module-grid { grid-template-columns: 1fr; }
  .module-card { min-height: 0; }
  .tab { font-size: 10px; }
}

/* Pantallas bajas (celular horizontal) */
@media (max-height: 560px) and (orientation: landscape) {
  .view-auth { place-items: start center; }
}

/* 8. ACCESIBILIDAD DE MOVIMIENTO / IMPRESIÓN =============================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .spinner { animation-duration: 1.2s !important; animation-iteration-count: infinite !important; }
}

@media (prefers-contrast: more) {
  :root { --border: rgba(127, 127, 127, .5); --border-strong: rgba(127, 127, 127, .8); }
}

@media print {
  .sidebar, .topbar, .tabbar, .toast-stack, .demo-banner { display: none !important; }
  .view-portal { display: block; }
}
.list + .field__hint { margin-top: 10px; padding: 0 4px; }
