/* =========================================================================
   Centro de mando · sistema de diseño
   Dirección: software minimalista (Apple + Grok + Notion). Superficies neutras,
   bordes 1px de bajo contraste, un único acento usado con moderación, sombras casi nulas.
   - Variables de diseño en :root. Los módulos deben usar SOLO esas variables.
   - Tema: data-theme="system" (por defecto) | "light" | "dark" en <html>; los colores usan light-dark(),
     así «Sistema» sigue prefers-color-scheme al cambiar sin JS. Contraste AA (≥ 4.5:1) de todo el texto.
   - Movimiento: springs en JS (public/js/app.js); aquí solo transiciones cortas de estado.
   ========================================================================= */

:root {
  /* Espaciado · rejilla 8pt (s-1 = medio paso). En rem para respetar el tamaño de texto del usuario */
  --s-1: .25rem; --s-2: .5rem; --s-3: 1rem; --s-4: 1.5rem; --s-5: 2rem; --s-6: 3rem; --s-7: 4rem;
  /* Radios */
  --r-xs: 6px; --r-sm: 8px; --r-md: 10px; --r-lg: 16px; --r-xl: 20px; --r-pill: 999px;
  /* Tipografía */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", Inter, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --text-xs: .71875rem;  /* 11.5 */
  --text-sm: .8125rem;   /* 13 */
  --text-md: .875rem;    /* 14 · cuerpo de la interfaz */
  --text-lg: .9375rem;   /* 15 */
  /* Layout */
  --sidebar-w: 248px;
  --topbar-h: 48px;
  --tabbar-h: 60px;
  --content-max: 1080px;
  /* Movimiento (transiciones de estado; lo físico va con springs en JS) */
  --ease: cubic-bezier(.25, .1, .25, 1);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --dur-1: 120ms; --dur-2: 200ms; --dur-3: 280ms;
  /* Spring crítico (damping 1, response ~0.3 s) muestreado para transiciones CSS */
  --spring: linear(0, 0.057, 0.179, 0.319, 0.453, 0.571, 0.669, 0.748, 0.811, 0.859, 0.895, 0.923, 0.944, 0.959, 0.97, 0.979, 0.985, 0.989, 0.992, 0.994, 0.996, 0.998, 0.999, 1);
}

/* ---------- Color · un único juego de variables con light-dark() ---------- */
:root, [data-theme="system"] { color-scheme: light dark; }
[data-theme="dark"] { color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }

:root {
  /* Fondos y superficies (neutros) */
  --bg:            light-dark(#ffffff, #0b0b0c);
  --bg-elevated:   light-dark(#fbfbfa, #111112);   /* barra lateral, cabeceras de tabla */
  --sidebar-bg:    light-dark(#f8f8f7, #101011);
  --surface:       light-dark(#ffffff, #131315);   /* tarjetas */
  --surface-2:     light-dark(#f5f5f4, #19191b);   /* campos, filas destacadas */
  --surface-3:     light-dark(#ffffff, #242427);   /* segmento activo, elementos elevados */
  --surface-raised:light-dark(#ffffff, #1b1b1e);   /* toasts, diálogos, menús */
  --material:      light-dark(rgba(255, 255, 255, .78), rgba(11, 11, 12, .74));
  --scrim:         light-dark(rgba(15, 15, 20, .18), rgba(0, 0, 0, .52));
  /* Líneas 1px de bajo contraste */
  --separator:        light-dark(rgba(15, 15, 20, .08), rgba(255, 255, 255, .07));
  --separator-strong: light-dark(rgba(15, 15, 20, .14), rgba(255, 255, 255, .12));
  /* Texto · AA en ambos temas: label-2 ≥ 6:1 y label-3 ≥ 4.5:1 sobre fondo, superficies y rellenos.
     label-4 NO es para texto: solo glifos decorativos junto a un texto (chevrons, separadores, iconos de lista). */
  --label:   light-dark(#1b1b1d, #ececee);
  --label-2: light-dark(#5b5b61, #a3a3aa);
  --label-3: light-dark(#6c6c72, #8a8a91);
  --label-4: light-dark(#9a9aa0, #6b6b72);
  /* Rellenos neutros (hover, pistas de controles) */
  --fill:   light-dark(rgba(15, 15, 20, .09), rgba(255, 255, 255, .10));
  --fill-2: light-dark(rgba(15, 15, 20, .045), rgba(255, 255, 255, .055));
  --fill-3: light-dark(rgba(15, 15, 20, .025), rgba(255, 255, 255, .03));
  /* Acento único: foco, estado activo, botón primario */
  --accent:      light-dark(#0b63d6, #5aa2ff);   /* texto/enlaces */
  --accent-fill: light-dark(#0b63d6, #1f6ae0);   /* fondo con texto blanco (≥ 4.5:1) */
  --accent-tint: light-dark(rgba(11, 99, 214, .08), rgba(90, 162, 255, .12));
  --on-accent: #ffffff;
  /* Colores semánticos de estado (solo para etiquetas/indicadores, nunca decorativos) */
  --green:  light-dark(#167532, #4fcf70); --green-tint:  light-dark(rgba(22, 117, 50, .09), rgba(79, 207, 112, .12));
  --orange: light-dark(#a64b00, #f5a524); --orange-tint: light-dark(rgba(214, 120, 0, .10), rgba(245, 165, 36, .12));
  --red-fill: light-dark(#c4161c, #d92d2d); /* fondo de botón con texto blanco (≥ 4.5:1) */
  --red:    light-dark(#c4161c, #ff6b63); --red-tint:    light-dark(rgba(196, 22, 28, .08), rgba(255, 107, 99, .12));
  --yellow: light-dark(#7d6200, #e9c63b); --yellow-tint: light-dark(rgba(200, 160, 0, .12), rgba(233, 198, 59, .11));
  --purple: light-dark(#7a35b0, #c08cf5); --purple-tint: light-dark(rgba(122, 53, 176, .08), rgba(192, 140, 245, .12));
  --gray:   light-dark(#66666c, #a1a1a8); --gray-tint:   light-dark(rgba(15, 15, 20, .055), rgba(255, 255, 255, .07));
  /* Profundidad casi nula; solo lo flotante (toasts/diálogos) tiene sombra perceptible */
  --shadow: 0 1px 2px light-dark(rgba(0, 0, 0, .03), rgba(0, 0, 0, .25));
  --shadow-pop: 0 12px 32px light-dark(rgba(0, 0, 0, .10), rgba(0, 0, 0, .45)), 0 2px 6px light-dark(rgba(0, 0, 0, .04), rgba(0, 0, 0, .3));
  --focus-ring: light-dark(rgba(11, 99, 214, .55), rgba(90, 162, 255, .6));
  --focus: 0 0 0 3px light-dark(rgba(11, 99, 214, .18), rgba(90, 162, 255, .22));
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; font-size: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--label);
  font: 400 var(--text-md)/1.5 var(--font); letter-spacing: -.006em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  font-optical-sizing: auto;
}
::selection { background: var(--accent-tint); }
a { color: var(--accent); text-decoration: none; text-underline-offset: 2px; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; }
/* Enlaces dentro de un texto: subrayado fino además del color (no solo color, WCAG 1.4.1) */
:is(p:not(.eyebrow), .subheadline, .footnote:not(.eyebrow), .caption, .field-hint, .alert) > a:not(.btn):not([class*="-row"]):not(.chip) { text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
:is(p:not(.eyebrow), .subheadline, .footnote:not(.eyebrow), .caption, .field-hint, .alert) > a:not(.btn):not([class*="-row"]):not(.chip):hover { text-decoration-color: currentColor; }
code { font: 500 .9em var(--mono); background: var(--fill-2); padding: 1px 5px; border-radius: 5px; letter-spacing: 0; }
img, svg { display: block; }
hr { border: 0; border-top: 1px solid var(--separator); margin: var(--s-3) 0; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
[hidden] { display: none !important; }
/* !important: debe ganar a reglas más específicas (p. ej. la de campos, width: 100%) */
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; margin: -1px !important; padding: 0 !important; border: 0 !important; overflow: hidden !important; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: var(--s-3); top: -100px; z-index: 100; background: var(--accent-fill); color: var(--on-accent); padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); }
.skip-link:focus { top: var(--s-3); }
p { margin: 0 0 var(--s-2); }
p:last-child { margin-bottom: 0; }

/* Cambio de tema suave (evita saltos bruscos de brillo); lo activa app.js durante 260 ms */
.theme-switching, .theme-switching *, .theme-switching *::before, .theme-switching *::after {
  transition: background-color var(--dur-3) var(--ease), border-color var(--dur-3) var(--ease), color var(--dur-3) var(--ease), fill var(--dur-3) var(--ease) !important;
}

/* ---------- Tipografía (jerarquía HIG: tracking y leading por tamaño) ---------- */
.large-title { font-size: 1.875rem; line-height: 1.15; font-weight: 650; letter-spacing: -.025em; margin: 0; }
.title-1 { font-size: 1.625rem; line-height: 1.2; font-weight: 650; letter-spacing: -.022em; margin: 0; }
.title-2 { font-size: 1.3125rem; line-height: 1.25; font-weight: 600; letter-spacing: -.018em; margin: 0; }
.title-3 { font-size: 1.125rem; line-height: 1.3; font-weight: 600; letter-spacing: -.014em; margin: 0; }
.headline { font-size: var(--text-lg); line-height: 1.35; font-weight: 600; letter-spacing: -.011em; margin: 0; }
.body { font-size: var(--text-lg); line-height: 1.55; }
.callout { font-size: var(--text-md); line-height: 1.5; }
.subheadline { font-size: var(--text-md); line-height: 1.5; }
.footnote { font-size: var(--text-sm); line-height: 1.45; letter-spacing: -.003em; }
.caption { font-size: var(--text-xs); line-height: 1.4; letter-spacing: .005em; }
.eyebrow { font-size: var(--text-sm); line-height: 1.4; font-weight: 500; color: var(--label-2); margin: 0 0 var(--s-1); letter-spacing: -.003em; }
.eyebrow a { color: inherit; }
.eyebrow a:hover { color: var(--label); text-decoration: none; }
.secondary { color: var(--label-2); }
.tertiary { color: var(--label-3); }
.num, .tabular { font-variant-numeric: tabular-nums; }
.kbd { font: 500 var(--text-xs)/1 var(--mono); padding: 2px 5px; border: 1px solid var(--separator-strong); border-bottom-width: 2px; border-radius: 5px; color: var(--label-2); }

/* ---------- Iconos (lineales, trazo fino 1.5) ---------- */
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
.icon-xs { width: 14px; height: 14px; }

/* ---------- Material translúcido (solo barras; blur muy sutil) ---------- */
.material { background: var(--material); -webkit-backdrop-filter: saturate(150%) blur(12px); backdrop-filter: saturate(150%) blur(12px); }
@media (prefers-reduced-transparency: reduce) { .material { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; } }

/* ---------- Barra lateral (tipo Notion: sobria, texto pequeño, sin bloques de color) ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 20;
  display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-3) var(--s-2) var(--s-2);
  background: var(--sidebar-bg); border-right: 1px solid var(--separator); overflow-y: auto; overscroll-behavior: contain;
}
.sidebar.material { -webkit-backdrop-filter: none; backdrop-filter: none; } /* opaca: nada pasa por debajo */
.brand { display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 0 var(--s-2); margin-bottom: var(--s-2); color: var(--label); font-weight: 600; font-size: var(--text-md); letter-spacing: -.01em; border-radius: var(--r-xs); }
.brand:hover { text-decoration: none; background: var(--fill-2); }
.brand-mark { display: grid; place-items: center; width: 22px; height: 22px; flex: none; }
/* Logo B3: se muestra la variante del tema activo (oscuro por defecto) */
.logo { display: block; width: 100%; height: 100%; }
.logo-light { display: none; }
[data-theme="light"] .logo-dark { display: none; }
[data-theme="light"] .logo-light { display: block; }
@media (prefers-color-scheme: light) {
  [data-theme="system"] .logo-dark { display: none; }
  [data-theme="system"] .logo-light { display: block; }
}
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.nav-label { margin: var(--s-3) var(--s-2) var(--s-1); font-size: var(--text-xs); font-weight: 500; color: var(--label-3); letter-spacing: .01em; }
.nav-item, .nav-subitem {
  display: flex; align-items: center; gap: 10px; min-height: 30px; padding: 4px var(--s-2);
  border-radius: var(--r-xs); color: var(--label-2); font-size: var(--text-sm); font-weight: 500;
  transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.nav-item .icon, .nav-subitem .icon { width: 16px; height: 16px; color: var(--label-4); transition: color var(--dur-1) var(--ease); }
.nav-item:hover, .nav-subitem:hover { background: var(--fill-2); color: var(--label); text-decoration: none; }
.nav-item:hover .icon, .nav-subitem:hover .icon { color: var(--label-2); }
.nav-item:active, .nav-subitem:active { background: var(--fill); }
.nav-item.is-active, .nav-subitem.is-active { background: var(--fill); color: var(--label); }
.nav-item.is-active .icon, .nav-subitem.is-active .icon { color: var(--label); }
.nav-item.is-open { color: var(--label); }
.nav-item.is-open .icon { color: var(--label-2); }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-sub { display: flex; flex-direction: column; gap: 1px; margin: 0 0 var(--s-1) 17px; padding-left: 9px; border-left: 1px solid var(--separator); }
.nav-subitem { min-height: 28px; }
.nav-subitem .icon { width: 15px; height: 15px; }
.sidebar-footer { display: flex; align-items: center; gap: 2px; padding-top: var(--s-2); border-top: 1px solid var(--separator); }
.sidebar-footer form { margin: 0; }
.sidebar-footer .btn-icon { color: var(--label-3); }
.sidebar-footer .btn-icon:hover { color: var(--label); }
.account-row { display: flex; align-items: center; gap: 2px; }
.account-chip { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px var(--s-2); border-radius: var(--r-xs); color: var(--label); transition: background-color var(--dur-1) var(--ease); }
.account-chip:hover, .account-chip.is-active { background: var(--fill-2); text-decoration: none; }
.account-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.account-name { font-weight: 500; font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-role { font-size: var(--text-xs); color: var(--label-2); }
.avatar {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: var(--surface-2); border: 1px solid var(--separator-strong); color: var(--label-2);
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
}
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-lg { width: 40px; height: 40px; font-size: 14px; }

/* ---------- Shell ---------- */
.shell { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 15;
  height: var(--topbar-h); border-bottom: 1px solid transparent;
  transition: border-color var(--dur-2) var(--ease);
}
.topbar-inner { display: flex; align-items: center; gap: var(--s-2); height: 100%; width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 0 var(--s-6); }
.topbar-spacer { display: none; }
.topbar.is-scrolled { border-bottom-color: var(--separator); }
.topbar-brand { display: none; }
.topbar-title { display: none; }
.breadcrumbs { display: flex; align-items: center; gap: 2px; min-width: 0; font-size: var(--text-sm); color: var(--label-2); list-style: none; margin: 0; padding: 0; }
.breadcrumbs li { display: flex; align-items: center; gap: 2px; min-width: 0; }
.breadcrumbs li + li::before { content: "/"; color: var(--label-4); padding: 0 6px; }
.breadcrumbs a { color: var(--label-2); padding: 3px 6px; margin: 0 -6px; border-radius: var(--r-xs); white-space: nowrap; }
.breadcrumbs a:hover { background: var(--fill-2); color: var(--label); text-decoration: none; }
.breadcrumbs a:active, .brand:active, .account-chip:active { background: var(--fill); }
.breadcrumbs [aria-current] { color: var(--label); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--s-4) var(--s-6) var(--s-7); display: flex; flex-direction: column; gap: var(--s-4); }
.content:focus { outline: none; }
.tabbar { display: none; }

.page-header { display: flex; flex-direction: column; gap: 2px; margin-bottom: var(--s-1); }
.page-header .subheadline { max-width: 68ch; margin-top: var(--s-1); color: var(--label-2); }
.page-header-row { flex-direction: row; justify-content: space-between; align-items: flex-start; gap: var(--s-3); flex-wrap: wrap; }
.page-header-row > .btn { margin-top: 2px; }
.section-title { margin-top: var(--s-3); }
.footnote.section-title { margin: var(--s-2) 0 calc(-1 * var(--s-2)); font-weight: 500; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); margin: var(--s-3) 0 calc(-1 * var(--s-2)); }
.section-head .headline { font-size: var(--text-md); }

/* ---------- Tarjetas (borde 1px, sin sombras gordas) ---------- */
.card {
  background: var(--surface); border: 1px solid var(--separator); border-radius: var(--r-lg);
  padding: var(--s-4); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: var(--s-3);
}
.card-flush { padding: 0; gap: 0; overflow: hidden; }
.card-head { display: flex; flex-direction: column; gap: 2px; padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--separator); }
.card-head-row { flex-direction: row; align-items: center; justify-content: space-between; gap: var(--s-3); }
.card-head .footnote { margin: 0; }
.card-body { padding: var(--s-3) var(--s-4); }
.card-foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--s-2); padding: var(--s-2) var(--s-3); border-top: 1px solid var(--separator); background: var(--fill-3); }
.card-interactive { transition: border-color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease); }
.card-interactive:hover { border-color: var(--separator-strong); }
.narrow { max-width: 560px; width: 100%; }
.grid { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: var(--s-3); }
.row { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.module-card { gap: var(--s-2); }
.module-head { display: flex; gap: 12px; align-items: center; }
.module-head a { color: var(--label); }
.icon-tile { display: grid; place-items: center; width: 20px; height: 20px; color: var(--label-2); flex: none; }
.icon-tile .icon { width: 18px; height: 18px; }

.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: var(--s-7) var(--s-4) var(--s-6); gap: var(--s-1); background: none; border: 0; box-shadow: none; }
.empty-state .secondary { max-width: 44ch; }
.empty-state .btn { margin-top: var(--s-3); }
.empty-icon { display: grid; place-items: center; margin-bottom: var(--s-2); color: var(--label-4); }
.empty-icon .icon { width: 24px; height: 24px; }

/* Errores (403/404/…): centrados en el centro óptico del área de contenido (algo por encima de la mitad) */
.error-wrap { display: grid; place-items: center; min-height: calc(100vh - var(--topbar-h) - var(--s-4) - var(--s-7)); padding-bottom: 8vh; }
.error-state { padding: 0 var(--s-4); gap: 0; max-width: 420px; }
.error-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: var(--s-3); border: 1px solid var(--separator-strong); border-radius: 12px; color: var(--label-2); background: var(--surface); }
.error-icon .icon { width: 20px; height: 20px; }
.error-code { margin: 0 0 6px; font-size: var(--text-xs); font-weight: 500; color: var(--label-3); letter-spacing: .02em; }
.error-state .title-2 { margin-bottom: var(--s-2); }
.error-state .secondary { max-width: 38ch; font-size: var(--text-md); line-height: 1.55; }
.error-actions { display: flex; align-items: center; justify-content: center; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-4); }
.error-state .error-actions .btn { margin-top: 0; }
.error-search { display: none; }
.js .error-search { display: inline-flex; }
.error-search .nav-search-key { margin-left: 2px; }

/* ---------- Listas ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--separator); }
.list-row { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: var(--s-1) 0; color: var(--label); flex-wrap: wrap; }
.list-row > .icon { color: var(--label-2); }
a.list-row { transition: background-color var(--dur-1) var(--ease); }
a.list-row:hover { text-decoration: none; }
.card-flush > .list > li > a.list-row:active, .list-inset > li > a.list-row:active { background: var(--fill-2); transition-duration: 40ms; }
a.list-row:hover .chevron { color: var(--label-2); transform: translateX(2px); }
.list-row .chevron { margin-left: auto; width: 16px; height: 16px; color: var(--label-4); transition: transform var(--dur-2) var(--ease-out), color var(--dur-1); }
.list-row .meta { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--label-2); }
.list-row .meta .avatar { width: 20px; height: 20px; font-size: 9px; }
.list-row .meta + .chevron { margin-left: var(--s-1); }
/* Lista dentro de tarjeta flush: filas con padding horizontal y hover de fila completa */
.card-flush > .list > li > .list-row, .list-inset > li > .list-row { padding: 0 var(--s-4); }
.card-flush > .list > li > a.list-row:hover, .list-inset > li > a.list-row:hover { background: var(--fill-3); }
.list-inset > li.list-row { padding: var(--s-1) var(--s-4); }
.push-right { margin-left: auto; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s-3); margin: 0; }
.kv dt { font-size: var(--text-sm); color: var(--label-2); }
.kv dd { margin: 2px 0 0; font-weight: 500; }

/* Grupos tipo «Ajustes»: etiqueta a la izquierda, valor/control a la derecha */
.settings { display: flex; flex-direction: column; margin: 0; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: 52px; padding: 10px var(--s-4); }
.settings-row + .settings-row { border-top: 1px solid var(--separator); }
.settings-row dt, .settings-label { color: var(--label-2); font-size: var(--text-sm); }
.settings-row dd { margin: 0; font-weight: 500; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.settings-row .theme-switch { align-self: center; }

/* ---------- Botones ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 5px 12px; border-radius: var(--r-sm); border: 1px solid transparent; background-color: transparent; color: inherit;
  font: 500 var(--text-sm)/20px var(--font); letter-spacing: -.003em; cursor: pointer; text-decoration: none !important; white-space: nowrap;
  user-select: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease), transform 90ms var(--ease-out), opacity var(--dur-1);
}
/* Feedback en el instante de pulsar (pointer-down), no al soltar */
.btn:active { transform: scale(.97); transition-duration: 40ms; }
.btn .icon { width: 16px; height: 16px; }
.btn-filled { background: var(--accent-fill); color: var(--on-accent); }
.btn-filled:hover { background: color-mix(in srgb, var(--accent-fill) 88%, white); }
.btn-filled:active { background: color-mix(in srgb, var(--accent-fill) 88%, black); }
/* Secundario neutro (el acento se reserva para el primario) */
.btn-tinted { background: var(--surface); color: var(--label); border-color: var(--separator-strong); box-shadow: var(--shadow); }
.btn-tinted:hover { background: var(--surface-2); }
.btn-tinted:active { background: var(--fill); }
.btn-plain { background: transparent; color: var(--label-2); }
.btn-plain:hover { background: var(--fill-2); color: var(--label); }
.btn-plain:active { background: var(--fill); }
.btn-destructive { color: var(--red); }
.btn-plain.btn-destructive:hover { background: var(--red-tint); color: var(--red); }
/* Relleno rojo propio: el --red del tema oscuro es claro (texto) y con blanco encima no llega a AA */
.btn-filled.btn-destructive { background: var(--red-fill); color: #fff; }
.btn-filled.btn-destructive:hover { background: color-mix(in srgb, var(--red-fill) 90%, black); }
.btn-sm { min-height: 28px; padding: 3px 9px; font-size: var(--text-sm); border-radius: var(--r-xs); }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-large { min-height: 40px; padding: 8px 16px; font-size: var(--text-md); border-radius: var(--r-md); }
.btn-block { width: 100%; }
.btn-icon { padding: 0; width: 32px; }
.btn-icon.btn-sm { width: 28px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn.is-busy { pointer-events: none; color: transparent !important; }
.btn.is-busy::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid currentColor; border-color: var(--label-2) var(--label-2) transparent transparent; animation: spin .7s linear infinite;
}
.btn-filled.is-busy::after { border-color: #fff #fff transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.actions { display: flex; gap: var(--s-2); justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.actions-start { justify-content: flex-start; }
.actions-sticky {
  position: sticky; bottom: var(--s-3); z-index: 5; align-self: stretch; justify-content: flex-end;
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-3); border-radius: var(--r-md); border: 1px solid var(--separator-strong); box-shadow: 0 4px 16px light-dark(rgba(0, 0, 0, .05), rgba(0, 0, 0, .3));
}

/* ---------- Formularios ---------- */
.form { display: flex; flex-direction: column; gap: var(--s-3); }
.form-inline { flex-direction: row; align-items: flex-end; flex-wrap: wrap; padding-top: var(--s-3); border-top: 1px solid var(--separator); }
.form-inline .field { flex: 1 1 180px; }
/* Altas en línea: mismo estilo que las filas «añadir» de los módulos (relleno discreto, borde solo con foco) */
.form-inline input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="color"]) { border-color: transparent; background: var(--fill-3); }
.form-inline input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="color"]):hover { border-color: transparent; background: var(--fill-2); }
.form-inline input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="color"]):focus { border-color: var(--accent); background: var(--surface); }
.form-inline .field-label { font-weight: 500; color: var(--label-2); font-size: var(--text-xs); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: var(--text-sm); font-weight: 500; color: var(--label); }
.field-hint { font-size: var(--text-xs); color: var(--label-2); }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="color"]), select, textarea {
  width: 100%; min-height: 36px; padding: 7px 11px; border-radius: var(--r-sm);
  border: 1px solid var(--separator-strong); background: light-dark(#fff, rgba(255, 255, 255, .03)); color: var(--label);
  font: 400 var(--text-md)/20px var(--font); letter-spacing: -.006em;
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease);
}
input:not([type="checkbox"]):not([type="radio"]):hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--label) 22%, transparent); }
/* Chevron lineal (trazo ~1.5px, como el set de iconos) dibujado con dos medias diagonales */
select { appearance: none; padding-right: 32px; cursor: pointer;
  --chev: var(--label-3);
  background-image:
    linear-gradient(45deg, transparent calc(50% - .8px), var(--chev) calc(50% - .8px), var(--chev) calc(50% + .8px), transparent calc(50% + .8px)),
    linear-gradient(135deg, transparent calc(50% - .8px), var(--chev) calc(50% - .8px), var(--chev) calc(50% + .8px), transparent calc(50% + .8px));
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
select:hover { --chev: var(--label-2); }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible, input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
input::placeholder, textarea::placeholder { color: var(--label-3); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--red); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent-fill); }
fieldset { border: 0; margin: 0; padding: 0; }

/* Casilla refinada (opt-in): <input type="checkbox" class="checkbox"> */
.checkbox {
  appearance: none; -webkit-appearance: none; position: relative; flex: none; margin: 0; cursor: pointer;
  width: 18px; height: 18px; border-radius: 5px; border: 1px solid color-mix(in srgb, var(--label) 28%, transparent);
  background: light-dark(#fff, rgba(255, 255, 255, .02));
  transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), transform 90ms var(--ease-out);
}
.checkbox::after {
  content: ""; position: absolute; left: 5.5px; top: 2px; width: 5px; height: 9.5px;
  border: solid var(--bg); border-width: 0 1.75px 1.75px 0; transform: rotate(45deg) scale(.4); opacity: 0;
  transition: transform var(--dur-2) var(--ease-out), opacity var(--dur-1) var(--ease);
}
.checkbox:hover { border-color: color-mix(in srgb, var(--label) 45%, transparent); }
.checkbox:active { transform: scale(.9); transition-duration: 40ms; }
.checkbox:checked { background: var(--label); border-color: var(--label); }
.checkbox:checked::after { transform: rotate(45deg) scale(1); opacity: 1; }
.checkbox:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.checkbox:disabled { opacity: .4; cursor: not-allowed; }

/* Toggle tipo iOS (checkbox nativo accesible) */
.toggle { position: relative; display: inline-flex; align-items: center; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.toggle input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.toggle-track { width: 34px; height: 20px; border-radius: var(--r-pill); background: var(--fill); position: relative; transition: background-color var(--dur-2) var(--ease); box-shadow: inset 0 0 0 1px var(--separator); }
.toggle-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 0 0 .5px rgba(0, 0, 0, .06);
  transition: transform var(--dur-3) var(--spring), width var(--dur-1) var(--ease);
}
.toggle:active .toggle-track::after { width: 19px; }
.toggle input:checked + .toggle-track { background: var(--accent-fill); box-shadow: none; }
.toggle input:checked + .toggle-track::after { transform: translateX(14px); }
.toggle:active input:checked + .toggle-track::after { transform: translateX(11px); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.toggle input:disabled + .toggle-track { opacity: .4; }

/* Segmented control (con «pulgar» que se desliza con spring cuando hay JS) */
.segmented { position: relative; isolation: isolate; display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--r-sm); background: var(--fill-2); align-self: flex-start; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segment {
  position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 28px; padding: 3px 12px;
  border: 0; border-radius: var(--r-xs); background: transparent; color: var(--label-2); font: 500 var(--text-sm)/20px var(--font);
  cursor: pointer; white-space: nowrap; text-decoration: none !important; -webkit-tap-highlight-color: transparent;
  transition: color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease);
}
.segment:hover { color: var(--label); }
.segment:active { color: var(--label); background: var(--fill-2); }
.segment.is-active, .segment[aria-checked="true"], .segment[aria-selected="true"] { background: var(--surface-3); color: var(--label); box-shadow: 0 0 0 1px var(--separator), 0 1px 2px light-dark(rgba(0, 0, 0, .06), rgba(0, 0, 0, .3)); }
.segment .icon { width: 15px; height: 15px; }
.segmented-thumb { position: absolute; z-index: 0; top: 2px; bottom: 2px; left: 0; width: 0; border-radius: var(--r-xs); background: var(--surface-3); box-shadow: 0 0 0 1px var(--separator), 0 1px 2px light-dark(rgba(0, 0, 0, .06), rgba(0, 0, 0, .3)); pointer-events: none; will-change: transform, width; }
.segmented.has-thumb .segment { background: transparent !important; box-shadow: none !important; }
.segmented-sm .segment { min-height: 24px; padding: 2px 8px; }
.theme-switch { align-self: stretch; }
.theme-switch .segment { flex: 1; }
.theme-switch .segment-label { font-size: var(--text-sm); }

/* Pestañas de sección (navegación entre secciones de un módulo): subrayado fino */
.segmented-tabs { background: transparent; padding: 0; gap: var(--s-4); border-radius: 0; align-self: stretch; box-shadow: inset 0 -1px 0 var(--separator); margin-bottom: calc(-1 * var(--s-2)); }
.segmented-tabs .segment { min-height: 38px; padding: 0 1px; border-radius: 0; color: var(--label-2); box-shadow: none !important; background: transparent !important; }
.segmented-tabs .segment::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 1px; background: transparent; transition: background-color var(--dur-2) var(--ease); }
.segmented-tabs .segment:hover { color: var(--label); }
.segmented-tabs .segment.is-active { color: var(--label); }
.segmented-tabs .segment.is-active::after { background: var(--accent); }

/* ---------- Avisos y etiquetas ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); font-size: var(--text-md); border: 1px solid; }
.alert > .icon { margin-top: 1px; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-success { background: var(--green-tint); color: var(--green); border-color: color-mix(in srgb, var(--green) 22%, transparent); }
.alert-error { background: var(--red-tint); color: var(--red); border-color: color-mix(in srgb, var(--red) 22%, transparent); }
.alert-warning { background: var(--orange-tint); color: var(--orange); border-color: color-mix(in srgb, var(--orange) 22%, transparent); }
.alert-info { background: var(--fill-2); color: var(--label); border-color: var(--separator); }
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: var(--r-xs);
  font-size: var(--text-xs); font-weight: 500; line-height: 1; white-space: nowrap; letter-spacing: 0; vertical-align: middle;
  background: var(--gray-tint); color: var(--gray);
}
.badge .icon { width: 12px; height: 12px; }
.badge-blue { background: var(--accent-tint); color: var(--accent); }
.badge-green { background: var(--green-tint); color: var(--green); }
.badge-orange { background: var(--orange-tint); color: var(--orange); }
.badge-red { background: var(--red-tint); color: var(--red); }
.badge-yellow { background: var(--yellow-tint); color: var(--yellow); }
.badge-purple { background: var(--purple-tint); color: var(--purple); }
.badge-gray { background: var(--gray-tint); color: var(--gray); }
/* Variante sobria: texto neutro + punto de color (combinable: class="badge badge-dot badge-green") */
.badge-dot { background: transparent; color: var(--label-2); padding: 0 6px 0 0; }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-dot.badge-blue::before { background: var(--accent); }
.badge-dot.badge-green::before { background: var(--green); }
.badge-dot.badge-orange::before { background: var(--orange); }
.badge-dot.badge-red::before { background: var(--red); }
.badge-dot.badge-yellow::before { background: var(--yellow); }
.badge-dot.badge-purple::before { background: var(--purple); }
.badge-dot.badge-gray::before { background: var(--label-3); }
.badge-dot[class*="badge-"] { color: var(--label-2); background: transparent; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--label-3); flex: none; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-md); }
.table th, .table td { padding: 10px var(--s-3); text-align: left; border-bottom: 1px solid var(--separator); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: var(--s-4); }
.table th:last-child, .table td:last-child { padding-right: var(--s-4); }
.table thead th { font-size: var(--text-xs); font-weight: 500; color: var(--label-2); background: var(--bg-elevated); padding-top: 8px; padding-bottom: 8px; white-space: nowrap; }
.table tbody tr:last-child > * { border-bottom: 0; }
.table tbody tr { transition: background-color var(--dur-1) var(--ease); }
.table tbody tr:hover { background: var(--fill-3); }
.cell-user { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; margin-right: var(--s-2); }
.cell-user-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.cell-user-text .caption { font-weight: 400; color: var(--label-2); }
.table code { font: inherit; background: none; padding: 0; color: var(--label-2); letter-spacing: inherit; }
.table .col-actions { width: 1%; white-space: nowrap; }
.cell-actions { display: flex; gap: 2px; justify-content: flex-end; }
.cell-actions form { margin: 0; }
.cell-actions .btn { color: var(--label-3); }
.cell-actions .btn:hover { color: var(--label); }
.cell-actions .btn-destructive:hover { color: var(--red); }
.cell-actions .btn-placeholder { visibility: hidden; }
.table .col-muted { color: var(--label-2); font-size: var(--text-sm); }
.cell-warn { color: var(--orange); }
.role-name { font-weight: 500; }

/* ---------- Matriz de permisos usuario × sección ---------- */
.matrix-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.matrix { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--text-sm); }
.matrix th, .matrix td { border-bottom: 1px solid var(--separator); padding: 0; }
.matrix thead th { background: var(--bg-elevated); font-weight: 500; color: var(--label-2); }
.matrix .matrix-corner {
  position: sticky; left: 0; z-index: 3; text-align: left; vertical-align: bottom; padding: 10px var(--s-4);
  min-width: 220px; font-size: var(--text-xs); border-right: 1px solid var(--separator);
}
.matrix-module { padding: 10px var(--s-3) 6px !important; text-align: left; font-size: var(--text-sm); color: var(--label) !important; border-bottom: 0 !important; white-space: nowrap; }
.matrix-module-name { display: inline-flex; align-items: center; gap: 8px; }
.matrix-module .icon { width: 15px; height: 15px; color: var(--label-2); }
.matrix-section { padding: 0 6px 10px !important; text-align: center; font-size: var(--text-xs); white-space: nowrap; min-width: 104px; transition: color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease); }
.matrix-section-inner { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
.matrix-section .icon { width: 15px; height: 15px; color: var(--label-4); transition: color var(--dur-1) var(--ease); }
.matrix-section.is-col-hover { color: var(--label); }
.matrix-section.is-col-hover .icon { color: var(--label-2); }
.matrix .is-group-start { border-left: 1px solid var(--separator); }
.matrix tbody th[scope="row"] {
  position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; font-weight: 500; white-space: nowrap;
  padding: 10px var(--s-4); border-right: 1px solid var(--separator); transition: background-color var(--dur-1) var(--ease);
}
.matrix tbody tr:last-child > * { border-bottom: 0; }
.matrix tbody tr:hover th[scope="row"] { background: color-mix(in srgb, var(--surface) 100%, var(--label) 3%); }
.matrix tbody tr:hover td { background: var(--fill-3); }
.matrix-count { font-size: var(--text-xs); color: var(--label-2); font-weight: 400; font-variant-numeric: tabular-nums; }
.matrix-count.is-zero { color: var(--label-3); }
.matrix-cell { text-align: center; height: 52px; transition: background-color var(--dur-1) var(--ease); }
.matrix-cell .toggle { justify-content: center; }
.matrix-hit { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 52px; cursor: pointer; }
.matrix td.matrix-cell:hover { background: var(--fill-2) !important; }
.matrix td.matrix-cell:active { background: var(--fill) !important; }
.matrix-cell.is-changed { background: var(--fill-2) !important; box-shadow: inset 0 -2px 0 var(--accent); }
.matrix-row-admin th[scope="row"], .matrix-row-admin td { background: var(--fill-3); }
.matrix-all { padding: 0 var(--s-3) !important; color: var(--label-2); font-size: var(--text-sm); }
.matrix-all-inner { display: flex; align-items: center; gap: 8px; }
.matrix-all .icon { width: 15px; height: 15px; color: var(--label-4); }
.matrix-legend { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); align-items: center; font-size: var(--text-sm); color: var(--label-2); }
.matrix-legend span { display: inline-flex; align-items: center; gap: 8px; }
.matrix-legend .checkbox { pointer-events: none; }
.save-status { margin-right: auto; display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--label-2); }
.save-status .dot { transition: background-color var(--dur-2) var(--ease); }
.is-dirty .save-status { color: var(--label); }
.is-dirty .save-status .dot { background: var(--accent); }
/* Con JS, el primario solo se enciende cuando hay algo que guardar */
.js [data-save-bar]:not(.is-dirty) > .btn-filled { background: var(--fill-2); color: var(--label-3); pointer-events: none; }

/* Desplegable sencillo (opciones avanzadas) */
.disclosure > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: var(--s-3) var(--s-4); border-radius: var(--r-lg); }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary .chevron-toggle { width: 16px; height: 16px; color: var(--label-2); transition: transform var(--dur-2) var(--ease-out); }
.disclosure[open] > summary .chevron-toggle { transform: rotate(90deg); }
.disclosure > summary:hover { background: var(--fill-3); }
.disclosure > summary:active { background: var(--fill-2); }
.disclosure[open] > summary { border-bottom: 1px solid var(--separator); border-radius: var(--r-lg) var(--r-lg) 0 0; }

/* ---------- Login y pantallas sin shell ---------- */
.bare-main { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--s-4); }
.login-wrap { width: 100%; max-width: 320px; margin-top: -8vh; display: flex; flex-direction: column; gap: var(--s-4); align-items: center; }
.login-card { width: 100%; display: flex; flex-direction: column; text-align: center; gap: var(--s-1); }
.login-card .form { text-align: left; margin-top: var(--s-5); }
.login-card .alert { text-align: left; margin-top: var(--s-4); margin-bottom: calc(-1 * var(--s-3)); }
.login-mark { display: grid; place-items: center; margin: 0 auto var(--s-3); }
.login-logo { display: block; width: 32px; height: 32px; }
.login-theme .theme-switch { align-self: center; }
.login-foot { font-size: var(--text-xs); color: var(--label-3); }

.secret-box { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-2) var(--s-2) var(--s-3); border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--separator-strong); }
.secret-box code { flex: 1; font-size: 1rem; background: none; padding: 0; word-break: break-all; user-select: all; letter-spacing: .02em; }

/* ---------- Avisos (toasts) · window.dashToast (cola, «Deshacer», pausa) ---------- */
.toast-region {
  position: fixed; z-index: 60; right: var(--s-4); bottom: calc(var(--s-4) + env(safe-area-inset-bottom)); width: min(380px, calc(100vw - 2 * var(--s-3)));
  display: flex; flex-direction: column-reverse; gap: var(--s-2); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 10px 8px 10px 12px;
  background: var(--surface-raised); color: var(--label); border: 1px solid var(--separator-strong); border-radius: var(--r-md);
  box-shadow: var(--shadow-pop); font-size: var(--text-md); line-height: 1.4; touch-action: pan-y; user-select: none; will-change: transform, opacity;
}
.toast[data-leaving] { pointer-events: none; }
.toast-text { flex: 1; padding-top: 1px; min-width: 0; overflow-wrap: anywhere; }
.toast > .icon { margin-top: 1px; }
.toast-success > .icon { color: var(--green); }
.toast-error > .icon { color: var(--red); }
.toast-warning > .icon { color: var(--orange); }
.toast-info > .icon, .toast-neutral > .icon { color: var(--label-2); }
.toast-close { flex: none; display: grid; place-items: center; width: 24px; height: 24px; margin: -2px 0; border: 0; border-radius: var(--r-xs); background: transparent; color: var(--label-3); cursor: pointer; transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.toast-close:hover { background: var(--fill-2); color: var(--label); }
.toast-close .icon { width: 14px; height: 14px; }
/* «Deshacer»: texto con el acento (es la acción del aviso), sin caja hasta el hover */
.toast-undo {
  flex: none; align-self: center; margin: -4px 0; padding: 3px 8px; min-height: 26px; border: 0; border-radius: var(--r-xs);
  background: transparent; color: var(--accent); font: 600 var(--text-sm)/20px var(--font); letter-spacing: -.003em; cursor: pointer;
  transition: background-color var(--dur-1) var(--ease), opacity var(--dur-1);
}
.toast-undo:hover { background: var(--accent-tint); }
.toast-undo:active { background: color-mix(in srgb, var(--accent-tint) 100%, var(--accent) 8%); }
.toast-undo.is-busy { opacity: .55; cursor: progress; }
.toast-undo:focus-visible, .toast-close:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
/* Mismo aviso otra vez: un leve pulso de borde en vez de apilar duplicados */
.toast.is-repeat { animation: toast-repeat 420ms var(--ease-out); }
@keyframes toast-repeat { 40% { border-color: var(--label-3); } }

/* ---------- Esqueleto (carga) · ui.skeleton(): líneas neutras con un pulso lento ---------- */
.skeleton { display: flex; flex-direction: column; gap: 10px; padding: var(--s-2) 0; }
.skeleton-line { display: block; height: 10px; border-radius: var(--r-pill); background: var(--fill-2); animation: skeleton-pulse 1.6s var(--ease) infinite; }
.skeleton-line:nth-child(3n + 1) { width: 92%; }
.skeleton-line:nth-child(3n + 2) { width: 76%; }
.skeleton-line:nth-child(3n) { width: 58%; }
.skeleton-line.skeleton-title { width: 34%; height: 12px; background: var(--fill); margin-bottom: 4px; }
.skeleton-compact { gap: 8px; padding: 0; }
@keyframes skeleton-pulse { 50% { opacity: .45; } }
/* Bloque ocupado (ui.busy): solo tras un retardo, sin bloquear el resto de la página */
.is-loading { opacity: .6; transition: opacity var(--dur-2) var(--ease); pointer-events: none; }

/* ---------- Estado vacío común (views/partials/empty-state.ejs): una frase y una acción ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: var(--s-6) var(--s-3); color: var(--label-2); }
.empty-glyph { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--separator); background: var(--surface); color: var(--label-3); }
.empty-glyph .icon, .empty-glyph svg { width: 20px; height: 20px; }
.empty-text { margin: 0; max-width: 46ch; font-size: var(--text-md); line-height: 1.5; color: var(--label-2); }
.empty-text strong { color: var(--label); font-weight: 600; }
.empty .btn { margin-top: 2px; }
.empty-compact { flex-direction: row; justify-content: flex-start; text-align: left; gap: 10px; padding: 10px 0; }
.empty-compact .empty-glyph { width: 28px; height: 28px; border-radius: 8px; }
.empty-compact .empty-glyph .icon, .empty-compact .empty-glyph svg { width: 15px; height: 15px; }
.empty-compact .empty-text { font-size: var(--text-sm); flex: 1; min-width: 0; }
.empty-compact .btn { margin: 0; }

/* ---------- Navegación: barra de progreso solo si la página tarda (app.js) ---------- */
.nav-progress { position: fixed; z-index: 90; top: 0; left: 0; right: 0; height: 2px; pointer-events: none; overflow: hidden; opacity: 0; transition: opacity var(--dur-2) var(--ease); }
.nav-progress::before { content: ""; position: absolute; inset: 0; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }
.nav-progress.is-on { opacity: 1; }
.nav-progress.is-on::before { animation: nav-progress 8s cubic-bezier(.1, .7, .2, 1) forwards; }
@keyframes nav-progress { from { transform: scaleX(.05); } to { transform: scaleX(.92); } }

/* ---------- Transiciones de página (View Transitions entre documentos; fundido de respaldo) ----------
   Barra lateral, cabecera y barra inferior quedan quietas; solo el contenido funde y sube 4 px. */
@view-transition { navigation: auto; }
.sidebar { view-transition-name: dash-sidebar; }
.topbar { view-transition-name: dash-topbar; }
.tabbar { view-transition-name: dash-tabbar; }
::view-transition-group(dash-sidebar), ::view-transition-group(dash-topbar), ::view-transition-group(dash-tabbar) { animation: none; }
::view-transition-old(dash-sidebar), ::view-transition-old(dash-topbar), ::view-transition-old(dash-tabbar) { display: none; }
::view-transition-new(dash-sidebar), ::view-transition-new(dash-topbar), ::view-transition-new(dash-tabbar) { animation: none; }
::view-transition-old(root) { animation: vt-out 120ms var(--ease) both; }
::view-transition-new(root) { animation: vt-in 220ms var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(4px); } }
/* Navegadores sin View Transitions: entrada suave del contenido (sin parpadeo: no hay salida) */
@supports not (view-transition-name: none) {
  .content { animation: page-in 200ms var(--ease-out) both; }
}
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } }

/* ---------- Diálogo de confirmación (atenúa para enfocar) ---------- */
.dialog {
  width: min(400px, calc(100vw - 2 * var(--s-3))); padding: 0; border: 1px solid var(--separator-strong); border-radius: var(--r-lg);
  background: var(--surface-raised); color: var(--label); box-shadow: var(--shadow-pop);
}
/* El velo acompaña al diálogo en la entrada y en la salida (--presence lo pone app.js) */
.dialog::backdrop { background: var(--scrim); opacity: var(--presence, 1); }
.dialog-body { padding: var(--s-4) var(--s-4) var(--s-3); display: flex; flex-direction: column; gap: 6px; }
.dialog-body .secondary { font-size: var(--text-md); }
.dialog .actions { padding: var(--s-2) var(--s-3) var(--s-3); }

/* ---------- Paleta de comandos (⌘K) · estilo Linear/Notion ---------- */
/* Pista en la barra lateral: solo con JS (sin JS no hay paleta) */
.nav-search {
  display: none; align-items: center; gap: 10px; width: 100%; min-height: 30px; padding: 4px 6px 4px var(--s-2); margin: calc(-1 * var(--s-1)) 0 0;
  border: 0; border-radius: var(--r-xs); background: transparent; color: var(--label-2); font: 500 var(--text-sm)/1.2 var(--font); letter-spacing: -.003em;
  text-align: left; cursor: pointer; transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.js .nav-search { display: flex; }
.nav-search .icon { width: 16px; height: 16px; color: var(--label-4); transition: color var(--dur-1) var(--ease); }
.nav-search span { flex: 1; }
.nav-search:hover { background: var(--fill-2); color: var(--label); }
.nav-search:hover .icon { color: var(--label-2); }
.nav-search:active { background: var(--fill); }
.nav-search-key { font: 500 11px/1 var(--font); letter-spacing: .02em; color: var(--label-3); padding: 3px 5px; border: 1px solid var(--separator); border-radius: 5px; }
.nav-search-key:empty { visibility: hidden; }
.topbar-search { display: none; }

.cmdk {
  /* El <dialog> ocupa la pantalla y hace de velo; el panel flota arriba, como en Linear */
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 14vh var(--s-3) var(--s-3);
  border: 0; background: transparent; color: var(--label); overflow: hidden;
}
.cmdk[open] { display: flex; flex-direction: column; align-items: center; }
.cmdk::backdrop { background: light-dark(rgba(15, 15, 20, .12), rgba(0, 0, 0, .42)); opacity: var(--presence, 1); }
.cmdk-panel {
  width: min(600px, 100%); max-height: min(480px, 72vh); display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface-raised); border: 1px solid var(--separator-strong); border-radius: 14px; box-shadow: var(--shadow-pop);
  transform-origin: 50% 0; will-change: transform, opacity;
}
.cmdk-field { position: relative; display: flex; align-items: center; gap: 10px; padding: 0 var(--s-3); border-bottom: 1px solid var(--separator); }
.cmdk-field-icon { width: 18px; height: 18px; color: var(--label-4); }
/* Selector con id: gana a la regla global de campos sin !important */
#cmdk-q {
  flex: 1; min-width: 0; min-height: 52px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none;
  font: 400 var(--text-lg)/1.4 var(--font); letter-spacing: -.011em; color: var(--label);
}
#cmdk-q:focus, #cmdk-q:focus-visible { box-shadow: none; outline: none; }
#cmdk-q::placeholder { color: var(--label-3); }
.cmdk-esc { flex: none; border-bottom-width: 1px; color: var(--label-3); font-family: var(--font); letter-spacing: .02em; }
.cmdk-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 6px; scroll-padding: 6px; }
.cmdk-group + .cmdk-group { margin-top: 6px; }
.cmdk-group-label { padding: 8px 10px 4px; font-size: var(--text-xs); font-weight: 500; color: var(--label-3); letter-spacing: .01em; }
.cmdk-option {
  display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; border-radius: var(--r-sm);
  color: var(--label-2); font-size: var(--text-md); cursor: pointer; user-select: none;
}
.cmdk-option .cmdk-icon { width: 16px; height: 16px; color: var(--label-4); }
.cmdk-label { flex: 1; min-width: 0; color: var(--label); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-hint { flex: none; font-size: var(--text-sm); color: var(--label-3); }
.cmdk-check { display: none; width: 15px; height: 15px; color: var(--label-2); }
.cmdk-option.is-current .cmdk-check { display: block; }
.cmdk-enter { width: 14px; height: 14px; color: var(--label-4); opacity: 0; }
.cmdk-option[aria-selected="true"] { background: var(--fill); }
.cmdk-option[aria-selected="true"] .cmdk-icon { color: var(--label); }
.cmdk-option[aria-selected="true"] .cmdk-enter { opacity: 1; }
.cmdk-empty { margin: 0; padding: var(--s-5) var(--s-3) var(--s-6); text-align: center; color: var(--label-2); font-size: var(--text-md); }
.cmdk-foot { display: flex; align-items: center; gap: var(--s-3); padding: 8px var(--s-3); border-top: 1px solid var(--separator); font-size: var(--text-xs); color: var(--label-3); }
.cmdk-foot span { display: inline-flex; align-items: center; gap: 4px; }
.cmdk-foot .kbd { border-bottom-width: 1px; min-width: 18px; text-align: center; font-family: var(--font); padding: 2px 4px; }
.cmdk-foot-end { margin-left: auto; }
/* Modo texto (acciones como «Nueva idea…»): etiqueta del modo en el campo y barra Volver/Guardar */
.cmdk-mode { flex: none; display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-xs); background: var(--fill-2); color: var(--label-2); font-size: var(--text-xs); font-weight: 500; white-space: nowrap; }
.cmdk-mode[hidden], .cmdk-prompt-bar[hidden] { display: none; }
.cmdk.is-prompt .cmdk-field-icon, .cmdk.is-prompt .cmdk-foot { display: none; }
.cmdk-prompt-bar { display: flex; align-items: center; gap: var(--s-2); padding: 8px 8px 8px var(--s-3); }
.cmdk-prompt-text { flex: 1; min-width: 0; font-size: var(--text-sm); color: var(--label-2); }
@media (prefers-reduced-transparency: reduce) { .cmdk::backdrop { background: var(--scrim); } }

/* ---------- Utilidades para módulos ---------- */
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-value { font-size: 1.5rem; line-height: 1.15; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: var(--text-sm); color: var(--label-2); }
.progress { height: 4px; border-radius: var(--r-pill); background: var(--fill); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width var(--dur-3) var(--ease-out); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--r-pill); border: 1px solid var(--separator-strong); background: transparent; color: var(--label-2); font: 500 var(--text-sm)/1 var(--font); cursor: pointer; transition: background-color var(--dur-1), color var(--dur-1), border-color var(--dur-1); }
.chip:hover { color: var(--label); background: var(--fill-2); }
.chip:active { background: var(--fill); transform: scale(.97); transition-duration: 40ms; }
.chip.is-active, .chip[aria-pressed="true"] { color: var(--label); background: var(--fill); border-color: transparent; }
.divider { height: 1px; background: var(--separator); border: 0; margin: 0; }

/* ---------- Scroll horizontal propio (tablas anchas) con sombra en el borde que oculta contenido ----------
   app.js envuelve .table-wrap / .matrix-wrap / [data-scroll-x] en .scroll-shadow y pone can-left / can-right. */
.scroll-shadow { position: relative; min-width: 0; }
.scroll-shadow::before, .scroll-shadow::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 16px; z-index: 4; pointer-events: none; opacity: 0;
  transition: opacity var(--dur-2) var(--ease);
}
.scroll-shadow::before { left: 0; border-left: 1px solid var(--separator-strong); box-shadow: inset 14px 0 12px -12px var(--edge-shadow); }
.scroll-shadow::after { right: 0; border-right: 1px solid var(--separator-strong); box-shadow: inset -14px 0 12px -12px var(--edge-shadow); }
.scroll-shadow.can-left::before, .scroll-shadow.can-right::after { opacity: 1; }
:root { --edge-shadow: light-dark(rgba(0, 0, 0, .16), rgba(0, 0, 0, .7)); }

/* ---------- Hoja inferior «Más» (barra de navegación móvil) ---------- */
.sheet {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0;
  padding: calc(env(safe-area-inset-top) + var(--s-5)) 0 0; border: 0; background: transparent; color: var(--label); overflow: hidden;
}
.sheet[open] { display: flex; flex-direction: column; justify-content: flex-end; }
.sheet::backdrop { background: var(--scrim); opacity: var(--presence, 1); }
.sheet-panel {
  display: flex; flex-direction: column; min-height: 0; max-height: 100%; width: 100%; max-width: 560px; margin: 0 auto;
  background: var(--surface-raised); border: 1px solid var(--separator-strong); border-bottom: 0; border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow-pop); padding-bottom: env(safe-area-inset-bottom); will-change: transform;
}
.sheet-grabber { flex: none; width: 36px; height: 5px; margin: 6px auto 0; border-radius: 3px; background: var(--fill); }
.sheet-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding: 2px var(--s-2) 2px var(--s-4); touch-action: none; cursor: grab; user-select: none; }
.sheet-head .headline { font-size: var(--text-lg); }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--s-3) var(--s-4); }
.sheet-label { margin: var(--s-3) var(--s-2) 6px; font-size: var(--text-xs); font-weight: 500; color: var(--label-3); letter-spacing: .01em; }
.sheet-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--separator); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.sheet-list > li + li { border-top: 1px solid var(--separator); }
.sheet-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 var(--s-3); margin: 0;
  border: 0; background: transparent; color: var(--label); font: 400 var(--text-lg)/1.3 var(--font); letter-spacing: -.01em; text-align: left;
  cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color var(--dur-1) var(--ease);
}
.sheet-row:hover { text-decoration: none; background: var(--fill-3); }
.sheet-row:active { background: var(--fill-2); transition-duration: 40ms; }
.sheet-row > .icon { width: 20px; height: 20px; color: var(--label-2); }
.sheet-row .chevron { margin-left: auto; width: 16px; height: 16px; color: var(--label-4); }
.sheet-row.is-active { font-weight: 600; }
.sheet-row.is-active > .icon:first-child { color: var(--accent); }
.sheet-row .avatar { width: 24px; height: 24px; }
.sheet-search { display: none; margin-top: var(--s-1); border: 1px solid var(--separator); border-radius: var(--r-md); background: var(--fill-3); color: var(--label-2); }
.js .sheet-search { display: flex; }
/* Sin JS: «Más» navega a #mas y la hoja se muestra como capa fija (cerrar = enlace a #) */
html:not(.js) .sheet:target { display: flex; flex-direction: column; justify-content: flex-end; z-index: 70; background: var(--scrim); }

/* ---------- Responsive: móvil con cabecera y barra inferior ---------- */
@media (max-width: 860px) {
  .sidebar { display: none; }
  .shell { margin-left: 0; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .topbar { height: auto; min-height: var(--topbar-h); padding-top: env(safe-area-inset-top); border-bottom-color: var(--separator); }
  .topbar-inner { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; min-height: var(--topbar-h); padding: 0 var(--s-2); }
  .topbar-spacer { display: block; }
  /* Con JS, el hueco derecho de la cabecera móvil abre la paleta (búsqueda) */
  .js .topbar-spacer { display: none; }
  .js .topbar-search { display: grid; place-items: center; width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--label-2); cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .js .topbar-search:active { background: var(--fill); }
  .cmdk { padding: calc(env(safe-area-inset-top) + var(--s-2)) var(--s-2) var(--s-2); }
  .cmdk-panel { max-height: min(520px, 64vh); }
  .cmdk-foot, .cmdk-esc, .error-search .nav-search-key { display: none; }
  .error-wrap { min-height: calc(100vh - var(--topbar-h) - var(--tabbar-h) - var(--s-3) - var(--s-6)); padding-bottom: 4vh; }
  #cmdk-q { font-size: 16px; min-height: 50px; }
  .cmdk-option { min-height: 42px; }
  .topbar.material { background: var(--material); }
  .topbar-brand { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: var(--r-sm); color: var(--label); }
  .topbar-brand:hover { text-decoration: none; }
  .topbar-title { display: block; font-weight: 600; font-size: var(--text-lg); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
  .topbar nav { display: none; }
  .content { padding: var(--s-3) var(--s-3) var(--s-6); gap: var(--s-3); }
  .large-title { font-size: 1.625rem; }
  .card { padding: var(--s-3); border-radius: 14px; }
  .card-flush { padding: 0; }
  .card-head, .settings-row { padding-left: var(--s-3); padding-right: var(--s-3); }
  .card-flush > .list > li > .list-row, .list-inset > li > .list-row { padding: 0 var(--s-3); }
  .list-inset > li.list-row { padding: var(--s-1) var(--s-3); }
  .list-row .meta.hide-mobile + .chevron { margin-left: auto; }
  .table th:first-child, .table td:first-child, .matrix .matrix-corner, .matrix tbody th[scope="row"] { padding-left: var(--s-3); }
  .matrix .matrix-corner { min-width: 0; }
  .matrix tbody th[scope="row"] .avatar { display: none; }
  .matrix-all { white-space: normal; min-width: 220px; }
  .matrix-section { min-width: 84px; }
  /* 16px en campos para que iOS no haga zoom */
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea { font-size: 16px; min-height: 40px; }
  .tabbar {
    display: flex; position: fixed; inset: auto 0 0 0; z-index: 30; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 4px var(--s-1) env(safe-area-inset-bottom); border-top: 1px solid var(--separator); justify-content: space-around;
  }
  .tab { flex: 1 1 0; min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; font-weight: 500; color: var(--label-2); min-width: 0; -webkit-tap-highlight-color: transparent; border-radius: var(--r-sm); transition: color var(--dur-1), transform 90ms var(--ease-out); }
  .tab:active { transform: scale(.94); }
  .tab span:not(.sr-only) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tab .icon { width: 22px; height: 22px; }
  .tab:hover { text-decoration: none; }
  .tab.is-active { color: var(--label); }
  .tab.is-active .icon { color: var(--accent); }
  .tab:focus-visible { outline-offset: -2px; }
  .settings-row { flex-wrap: wrap; }
  .segmented-tabs { gap: var(--s-3); overflow-x: auto; margin: 0 calc(-1 * var(--s-3)); padding: 0 var(--s-3); align-self: auto;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--s-3), #000 calc(100% - var(--s-5)), transparent 100%);
            mask-image: linear-gradient(to right, transparent 0, #000 var(--s-3), #000 calc(100% - var(--s-5)), transparent 100%); }
  .table .hide-mobile { display: none; }
  .actions-sticky { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--s-2)); }
  .toast-region { right: var(--s-3); left: var(--s-3); width: auto; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--s-2)); }
  .is-bare .toast-region { bottom: calc(var(--s-3) + env(safe-area-inset-bottom)); }
  .hide-mobile { display: none !important; }
}
@media (min-width: 861px) { .hide-desktop { display: none !important; } }

/* ---------- Objetivos táctiles ≥ 44 px (móvil y cualquier puntero grueso) ----------
   Los controles crecen hasta 44 px; los enlaces de texto sueltos amplían su zona con padding y margen
   negativo (no mueven el diseño). Campos a 16 px: iOS no hace zoom al enfocarlos. */
@media (max-width: 860px), (pointer: coarse) {
  .btn, .btn-sm, .btn-large { min-height: 44px; }
  .btn-icon, .btn-icon.btn-sm { width: 44px; min-height: 44px; }
  .segment, .segmented-sm .segment, .segmented-tabs .segment { min-height: 44px; }
  .chip { height: auto; min-height: 44px; padding: 0 14px; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="color"]), select, textarea { min-height: 44px; font-size: 16px; }
  .toast-close { width: 44px; height: 44px; margin: -10px -4px -10px 0; }
  .toast-undo { min-height: 44px; margin: -10px 0; padding: 0 12px; }
  .cmdk-option { min-height: 44px; }
  .disclosure > summary { min-height: 48px; }
  .eyebrow a, a.footnote, .breadcrumbs a { display: inline-flex; align-items: center; min-height: 44px; margin-top: -12px; margin-bottom: -12px; }
  .checkbox { width: 22px; height: 22px; }
  .checkbox::after { left: 7px; top: 3px; width: 6px; height: 11px; }
}

/* ---------- Accesibilidad: movimiento, contraste ---------- */
@media (prefers-reduced-motion: reduce) {
  /* Sin desplazamientos ni rebotes: solo fundidos y cambios de color */
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important;
    transition-property: opacity, color, background-color, border-color !important;
  }
  .btn:active, .tab:active, .checkbox:active, .chip:active { transform: none; }
  a.list-row:hover .chevron { transform: none; }
  .btn.is-busy::after { animation: none; border-color: currentColor; opacity: .5; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
  .skeleton-line { animation: none; }
  .nav-progress.is-on::before { animation: none; transform: scaleX(.6); }
}
@media (prefers-contrast: more) {
  :root { --separator: light-dark(rgba(0, 0, 0, .35), rgba(255, 255, 255, .4)); --separator-strong: light-dark(rgba(0, 0, 0, .55), rgba(255, 255, 255, .6)); --label-2: var(--label); }
  .material { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media print {
  .sidebar, .topbar, .tabbar, .toast-region, .actions-sticky, .nav-progress { display: none !important; }
  .shell { margin: 0; }
}

/* <details> no admite bien display:flex en todos los navegadores */
.card.disclosure { display: block; }

/* Bloques de navegación (barra lateral): un bloque por módulo, título en mayúsculas + subpestañas */
.nav { gap: var(--s-3); padding-top: var(--s-2); }
.nav-block { display: flex; flex-direction: column; gap: 2px; }
.nav-block-title { display: flex; align-items: center; gap: 8px; min-height: 28px; padding: 0 var(--s-2); color: var(--label-3); font-size: var(--text-xs); font-weight: 650; letter-spacing: .08em; text-transform: uppercase; border-radius: var(--r-xs); }
.nav-block-title .icon { width: 14px; height: 14px; color: var(--label-4); }
.nav-block-title:hover { color: var(--label); text-decoration: none; }
.nav-block.is-current .nav-block-title { color: var(--label); }
.nav-block.is-current .nav-block-title .icon { color: var(--accent); }
.nav-block .nav-sub { margin: 0 0 0 var(--s-3); padding-left: var(--s-2); }
.nav-block .nav-subitem { position: relative; min-height: 30px; }
.nav-block .nav-subitem.is-active { background: var(--accent-tint); color: var(--label); font-weight: 600; }
.nav-block .nav-subitem.is-active .icon { color: var(--accent); }
.nav-block .nav-subitem.is-active::before { content: ""; position: absolute; left: calc(-1 * var(--s-2) - 1px); top: 6px; bottom: 6px; width: 2px; border-radius: 1px; background: var(--accent); }
