/* Biblios · sitio web · web-1.0.0+59756f20 */
/* =====================================================================
   BIBLIOS · Sistema de diseño · styles.css
   ---------------------------------------------------------------------
   Concepto: "el lomo y el filete".
   - La barra lateral es el LOMO de un libro: azul marino del logo con
     dos bandas doradas (como los lomos del monograma).
   - El FILETE dorado (1px) marca jerarquía: pestaña activa, elemento
     activo, separadores de marca. Nunca como relleno de fondo grande.
   - Serif (EB Garamond) = la voz de los libros: títulos de obras,
     títulos de página, cifras grandes. Sans (Source Sans 3) = la voz de
     la herramienta: controles, tablas, etiquetas, ayudas.
   Colores medidos en píxeles del logo oficial (src/logo.webp):
     marino mediana #062040 · marino letra #021E39 · realce #0D3558
     dorado mediana #B48641 · reflejo #D2AC60 · sombra #9A6B2E
   Fuentes (van en src/head.html; el ensamblador las pone tras el bloque de estilos):
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400..700;1,400..600&family=Source+Sans+3:ital,wght@0,400..700;1,400..600&family=Source+Code+Pro:wght@400;500&display=swap">
   <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Cinzel:wght@600&text=BIBLIOS&display=swap">
   Iconos: <svg class="b-icon" viewBox="0 0 24 24" aria-hidden="true"> con
   los <path d> de Biblios.brand.ICONS (trazo y color vienen de este CSS).
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. TOKENS · TEMA CLARO (por defecto)
   --------------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* Marca (del logo) */
  --navy: #062040;            /* azul marino del logo: primario, barra lateral */
  --navy-2: #0D3558;          /* realce del lomo: hover del primario */
  --gold: #B48641;            /* dorado del logo: filetes, iconos de marca (decorativo, 3.27:1 sobre blanco) */
  --gold-bright: #D2AC60;     /* reflejo dorado: sobre marino (7.6:1) */
  --gold-ink: #85601F;        /* dorado para TEXTO sobre claro (5.7:1 sobre blanco) */
  --gold-soft: #F5EEDF;       /* fondo dorado tenue: banner demo, etiquetas */
  --mark-ink: #062040;        /* color del monograma fuera de la barra lateral */

  /* Superficies */
  --paper: #EFF2F5;           /* fondo de la app: papel frío */
  --surface: #FFFFFF;         /* tarjetas, tablas, diálogos, barra superior */
  --surface-2: #F6F8FA;       /* cabecera de tabla, zonas hundidas */
  --surface-3: #E6EDF6;       /* fila/elemento seleccionado */
  --hover: #EEF2F6;           /* hover de filas y botones fantasma */
  --line: #DCE2E9;            /* divisores y bordes de contenedor */
  --line-strong: #B3BFCC;     /* bordes de chips, kbd, botón secundario */
  --control-border: #7A889A;  /* borde de campos (3.2:1 sobre papel, 3.6:1 sobre blanco) */

  /* Texto */
  --text: #0E1C2E;            /* texto principal (17.1:1) */
  --text-2: #435266;          /* secundario (7.9:1) */
  --text-3: #5B6878;          /* terciario / placeholder (5.7:1 blanco, 4.8:1 seleccionado) */

  /* Interacción */
  --accent: #1D5A96;          /* enlaces, selección, foco (7.1:1) */
  --accent-soft: #E4ECF6;     /* fondo de aviso informativo / hover de acento */
  --accent-ink: #163E66;      /* texto sobre accent-soft (9.2:1) */
  --focus: #1D5A96;           /* anillo de foco (≥3:1 en todas las superficies claras) */
  --primary: #062040;         /* fondo del botón primario */
  --primary-hover: #0D3558;
  --on-primary: #FFFFFF;      /* 16.3:1 */
  --danger: #B42318;          /* acciones destructivas (6.6:1) */
  --danger-hover: #912018;
  --on-danger: #FFFFFF;
  --danger-soft: #FBE5E3;

  /* Barra lateral (lomo) */
  --side-bg: #062040;
  --side-hover: #0C2B50;
  --side-active: #12345E;
  --side-text: #B9C6D6;       /* 9.4:1 */
  --side-muted: #8FA1B7;      /* 6.2:1 */
  --side-strong: #FFFFFF;
  --side-line: rgba(255, 255, 255, 0.09);
  --side-focus: #D2AC60;

  /* Estados de ejemplares y solicitudes (separados del acento) */
  --st-ok: #1C6A3E;      --st-ok-bg: #E2F1E7;      --st-ok-dot: #2E8B57;       /* disponible */
  --st-loan: #1A5A6F;    --st-loan-bg: #DDEDF3;    --st-loan-dot: #2B7F99;     /* prestado */
  --st-late: #A3231F;    --st-late-bg: #FBE5E3;    --st-late-dot: #CC3A31;     /* vencido */
  --st-lost: #5E4768;    --st-lost-bg: #EEE7F1;    --st-lost-dot: #83679A;     /* perdido */
  --st-off: #535C68;     --st-off-bg: #EBEEF1;     --st-off-dot: #8993A0;      /* retirado / cancelada */
  --st-wait: #80560A;    --st-wait-bg: #FAEFD3;    --st-wait-dot: #C28A1E;     /* pendiente */
  /* Contador de alerta (vencidos) en el lomo y la barra inferior: cifra blanca de 10–12 px (4.98:1) */
  --count-alert-bg: #CC3A31;  --count-alert-ink: #FFFFFF;

  /* Avisos, toasts y gráficos */
  --demo-bg: #F5EEDF;         --demo-text: #5A4214;     --demo-rule: #B48641;
  --toast-bg: #0E1C2E;        --toast-text: #F2F5F8;    --toast-action: #E0BE77;
  --toast-ok: #6FCB95;        --toast-err: #FF9E94;
  --chart-1: #0D3558;         --chart-2: #B48641;       --chart-3: #2B7F99;  --chart-muted: #C9D2DC;
  --backdrop: rgba(4, 14, 28, 0.52);
  --selection: #EEDFBD;
  --skeleton-a: #E9EEF3;      --skeleton-b: #F5F7FA;

  /* Imágenes de controles (color por tema) */
  --i-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23435266' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E");
  --i-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.5 12.5l4 4 9-9'/%3E%3C/svg%3E");
  --i-dash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6.5 12h11'/%3E%3C/svg%3E");

  /* Tipografía */
  --font-brand: "Cinzel", "EB Garamond", Georgia, serif;
  --font-serif: "EB Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-sans: "Source Sans 3", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Source Code Pro", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs-2xs: 0.6875rem;  /* 11px  etiquetas de barra inferior, grupos */
  --fs-xs: 0.75rem;     /* 12px  metadatos, kbd */
  --fs-sm: 0.8125rem;   /* 13px  etiquetas de campo, ayudas */
  --fs-ui: 0.875rem;    /* 14px  tablas, botones, menús, barra lateral */
  --fs-md: 0.9375rem;   /* 15px  = base (nombre del contrato de arquitectura) */
  --fs-base: 0.9375rem; /* 15px  cuerpo */
  --fs-lg: 1.0625rem;   /* 17px  cuerpo destacado, título de libro en tabla (serif) */
  --fs-xl: 1.25rem;     /* 20px  serif: secciones, diálogos */
  --fs-2xl: 1.625rem;   /* 26px  serif: título de página en móvil */
  --fs-3xl: 2.125rem;   /* 34px  serif: título de página */
  --fs-4xl: 2.5rem;     /* 40px  serif: título en ficha, cifras */
  --fs-5xl: 3rem;       /* 48px  serif/marca: bienvenida */
  --lh-tight: 1.15;
  --lh-snug: 1.3;
  --lh-base: 1.5;

  /* Espaciado (base 4) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;

  /* Radios por rol (NO uno para todo) */
  --r-xs: 3px;              /* kbd, casillas, insignias, etiqueta de signatura */
  --r-sm: 5px;              /* botones, campos, elementos de menú */
  --r-md: 8px;              /* tarjetas, tablas, menús, listas */
  --r-lg: 12px;             /* diálogos, cajones, paleta de comandos, barra de lote */
  --r-pill: 999px;          /* chips de filtro, interruptores, avatares, progreso */
  --r-book: 2px 5px 5px 2px;/* portadas: lomo recto, canto redondeado */

  /* Sombras por rol */
  --sh-hairline: 0 1px 0 rgba(6, 32, 64, 0.05);
  --sh-raise: 0 1px 2px rgba(6, 32, 64, 0.06), 0 2px 6px -2px rgba(6, 32, 64, 0.08);
  --sh-pop: 0 10px 28px -8px rgba(6, 32, 64, 0.24), 0 2px 6px rgba(6, 32, 64, 0.08);
  --sh-overlay: 0 28px 64px -16px rgba(4, 20, 40, 0.42), 0 6px 16px rgba(4, 20, 40, 0.12);
  --sh-cover: 0 1px 1px rgba(6, 32, 64, 0.10), 0 8px 18px -8px rgba(6, 32, 64, 0.45);

  /* Movimiento */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur-1: 120ms; --dur-2: 200ms; --dur-3: 280ms;

  /* Layout */
  --sidebar-w: 248px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 56px;
  --bottomnav-h: 60px;
  --content-max: 1200px;
  --gutter: 28px;
  --z-sticky: 10; --z-topbar: 20; --z-sidebar: 30; --z-bottomnav: 30; --z-menu: 40;
  --z-drawer: 50; --z-dialog: 100; --z-cmdk: 110; --z-toast: 200;

  /* ---- Alias del contrato de arquitectura (architecture.md §11.1) ----
     Apuntan a los tokens de arriba; como se resuelven en :root, siguen
     automáticamente al tema oscuro. Úsense indistintamente. */
  --c-bg: var(--paper);            --c-surface: var(--surface);        --c-surface-2: var(--surface-2);
  --c-sunken: var(--surface-2);    --c-border: var(--line);            --c-border-strong: var(--line-strong);
  --c-text: var(--text);           --c-text-2: var(--text-2);          --c-text-3: var(--text-3);
  --c-navy: var(--navy);           --c-navy-2: var(--navy-2);          --c-on-navy: var(--side-strong);
  --c-gold: var(--gold);           --c-gold-2: var(--gold-ink);        --c-on-gold: var(--navy);
  --c-accent: var(--primary);      --c-accent-hover: var(--primary-hover); --c-on-accent: var(--on-primary);
  --c-link: var(--accent);         --c-focus: var(--focus);            --c-selection: var(--selection);
  --c-ok: var(--st-ok);            --c-ok-bg: var(--st-ok-bg);         --c-warn: var(--st-wait);
  --c-warn-bg: var(--st-wait-bg);  --c-danger: var(--danger);          --c-danger-bg: var(--danger-soft);
  --c-info: var(--accent-ink);     --c-info-bg: var(--accent-soft);    --c-overlay: var(--backdrop);
  --c-chart-1: var(--chart-1);     --c-chart-2: var(--chart-2);        --c-chart-3: var(--chart-3);
  --c-chart-4: var(--chart-muted); --c-chart-grid: var(--line);
  --f-brand: var(--font-brand);    --f-serif: var(--font-serif);       --f-sans: var(--font-sans);    --f-mono: var(--font-mono);
  --lh-normal: var(--lh-base);     --fw-regular: 400;                  --fw-semibold: 600;            --fw-bold: 700;
  --s-7: 48px;                     --r-1: var(--r-xs);                 --r-2: var(--r-sm);
  --sh-1: var(--sh-raise);         --sh-2: var(--sh-overlay);
  --sidebar-w-compact: var(--sidebar-w-collapsed);
  --z-nav: var(--z-topbar);        --z-bulk: 30;                       --z-palette: var(--z-cmdk);
}

/* ---------------------------------------------------------------------
   2. TOKENS · TEMA OSCURO (sistema)  — mismo contenido que el bloque 3
   --------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --navy: #062040;
    --navy-2: #0D3558;
    --gold: #D2AC60;
    --gold-bright: #E0BE77;
    --gold-ink: #E0BE77;
    --gold-soft: #2A2415;
    --mark-ink: #E6EBF1;
    --paper: #0B1522;
    --surface: #101C2B;
    --surface-2: #152335;
    --surface-3: #1B3150;
    --hover: #172739;
    --line: #233246;
    --line-strong: #3A4D63;
    --control-border: #6B7D93;
    --text: #E6EBF1;
    --text-2: #A9B6C6;
    --text-3: #8C9AAC;
    --accent: #8DB9E8;
    --accent-soft: #122A44;
    --accent-ink: #A9CCF0;
    --focus: #E0BE77;
    --primary: #D2AC60;
    --primary-hover: #DDBB74;
    --on-primary: #0B1522;
    --danger: #F07A6E;
    --danger-hover: #F59287;
    --on-danger: #0B1522;
    --danger-soft: #3B1818;
    --side-bg: #070F1B;
    --side-hover: #0F1C2E;
    --side-active: #16263A;
    --side-text: #AEBBCB;
    --side-muted: #8190A3;
    --side-strong: #FFFFFF;
    --side-line: rgba(255, 255, 255, 0.07);
    --side-focus: #E0BE77;
    --st-ok: #86D6A6;   --st-ok-bg: #12301F;   --st-ok-dot: #4DB57A;
    --st-loan: #86CDE2; --st-loan-bg: #0F2F3A; --st-loan-dot: #46A5C2;
    --st-late: #FF9E94; --st-late-bg: #3B1818; --st-late-dot: #E5584D;
    --st-lost: #D4BBDF; --st-lost-bg: #2B2131; --st-lost-dot: #A585B8;
    --st-off: #B3BBC5;  --st-off-bg: #222A34;  --st-off-dot: #7F8B99;
    --st-wait: #EDC46C; --st-wait-bg: #33280E; --st-wait-dot: #D39F33;
    --count-alert-bg: #C23B31; --count-alert-ink: #FFFFFF;   /* 5.3:1 (st-late-dot oscuro daba 3.6:1) */
    --demo-bg: #2A2415;  --demo-text: #EDD39A;  --demo-rule: #D2AC60;
    --toast-bg: #E6EBF1; --toast-text: #0E1C2E; --toast-action: #85601F;
    --toast-ok: #1C6A3E; --toast-err: #A3231F;
    --chart-1: #7FA6D4;  --chart-2: #D2AC60;  --chart-3: #46A5C2;  --chart-muted: #2C3D52;
    --backdrop: rgba(1, 5, 12, 0.66);
    --selection: #4A3C1C;
    --skeleton-a: #15222F; --skeleton-b: #1C2B3C;
    --i-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A9B6C6' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E");
    --i-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230B1522' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.5 12.5l4 4 9-9'/%3E%3C/svg%3E");
    --i-dash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230B1522' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6.5 12h11'/%3E%3C/svg%3E");
    --sh-hairline: 0 1px 0 rgba(0, 0, 0, 0.35);
    --sh-raise: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 8px -2px rgba(0, 0, 0, 0.35);
    --sh-pop: 0 12px 32px -8px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.4);
    --sh-overlay: 0 32px 72px -16px rgba(0, 0, 0, 0.75), 0 6px 16px rgba(0, 0, 0, 0.45);
    --sh-cover: 0 1px 1px rgba(0, 0, 0, 0.4), 0 10px 22px -8px rgba(0, 0, 0, 0.75);
  }
}

/* ---------------------------------------------------------------------
   3. TOKENS · TEMA OSCURO (elegido por la persona)
   --------------------------------------------------------------------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --navy: #062040;
  --navy-2: #0D3558;
  --gold: #D2AC60;
  --gold-bright: #E0BE77;
  --gold-ink: #E0BE77;
  --gold-soft: #2A2415;
  --mark-ink: #E6EBF1;
  --paper: #0B1522;
  --surface: #101C2B;
  --surface-2: #152335;
  --surface-3: #1B3150;
  --hover: #172739;
  --line: #233246;
  --line-strong: #3A4D63;
  --control-border: #6B7D93;
  --text: #E6EBF1;
  --text-2: #A9B6C6;
  --text-3: #8C9AAC;
  --accent: #8DB9E8;
  --accent-soft: #122A44;
  --accent-ink: #A9CCF0;
  --focus: #E0BE77;
  --primary: #D2AC60;
  --primary-hover: #DDBB74;
  --on-primary: #0B1522;
  --danger: #F07A6E;
  --danger-hover: #F59287;
  --on-danger: #0B1522;
  --danger-soft: #3B1818;
  --side-bg: #070F1B;
  --side-hover: #0F1C2E;
  --side-active: #16263A;
  --side-text: #AEBBCB;
  --side-muted: #8190A3;
  --side-strong: #FFFFFF;
  --side-line: rgba(255, 255, 255, 0.07);
  --side-focus: #E0BE77;
  --st-ok: #86D6A6;   --st-ok-bg: #12301F;   --st-ok-dot: #4DB57A;
  --st-loan: #86CDE2; --st-loan-bg: #0F2F3A; --st-loan-dot: #46A5C2;
  --st-late: #FF9E94; --st-late-bg: #3B1818; --st-late-dot: #E5584D;
  --st-lost: #D4BBDF; --st-lost-bg: #2B2131; --st-lost-dot: #A585B8;
  --st-off: #B3BBC5;  --st-off-bg: #222A34;  --st-off-dot: #7F8B99;
  --st-wait: #EDC46C; --st-wait-bg: #33280E; --st-wait-dot: #D39F33;
  --count-alert-bg: #C23B31; --count-alert-ink: #FFFFFF;   /* 5.3:1 (st-late-dot oscuro daba 3.6:1) */
  --demo-bg: #2A2415;  --demo-text: #EDD39A;  --demo-rule: #D2AC60;
  --toast-bg: #E6EBF1; --toast-text: #0E1C2E; --toast-action: #85601F;
  --toast-ok: #1C6A3E; --toast-err: #A3231F;
  --chart-1: #7FA6D4;  --chart-2: #D2AC60;  --chart-3: #46A5C2;  --chart-muted: #2C3D52;
  --backdrop: rgba(1, 5, 12, 0.66);
  --selection: #4A3C1C;
  --skeleton-a: #15222F; --skeleton-b: #1C2B3C;
  --i-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A9B6C6' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E");
  --i-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230B1522' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.5 12.5l4 4 9-9'/%3E%3C/svg%3E");
  --i-dash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230B1522' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6.5 12h11'/%3E%3C/svg%3E");
  --sh-hairline: 0 1px 0 rgba(0, 0, 0, 0.35);
  --sh-raise: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 8px -2px rgba(0, 0, 0, 0.35);
  --sh-pop: 0 12px 32px -8px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.4);
  --sh-overlay: 0 32px 72px -16px rgba(0, 0, 0, 0.75), 0 6px 16px rgba(0, 0, 0, 0.45);
  --sh-cover: 0 1px 1px rgba(0, 0, 0, 0.4), 0 10px 22px -8px rgba(0, 0, 0, 0.75);
}

/* ---------------------------------------------------------------------
   4. RESET LIGERO Y BASE
   --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  font-weight: 400;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
#root, #app, #biblios-root { height: 100%; }
/* Mensaje estático previo a React (lo escribe build.mjs en #biblios-root) */
.app-splash { display: grid; place-items: center; height: 100%; padding: var(--s-4); font-family: var(--font-serif); font-size: var(--fs-xl); color: var(--text-2); text-align: center; }
h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 500; line-height: var(--lh-tight); letter-spacing: -0.005em; color: var(--text); }
/* Especificidad 0 con :where(): cualquier clase (.b-timeline, .b-tree, .b-steps…) puede fijar su margen y relleno */
:where(ul[role="list"], ol[role="list"], ul[class^="b-"], ol[class^="b-"]) { list-style: none; margin: 0; padding: 0; }
img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
table { border-collapse: collapse; border-spacing: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-6) 0; }
[hidden] { display: none !important; }
::selection { background: var(--selection); color: var(--text); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-xs); }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* Icono de trazo 24×24 (paths de Biblios.brand.ICONS) */
.b-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.b-icon--sm { width: 16px; height: 16px; }
.b-icon--lg { width: 24px; height: 24px; }
.b-icon--xl { width: 32px; height: 32px; stroke-width: 1.25; }

/* Solo para lectores de pantalla */
.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; }

/* Enlace "Saltar al contenido" (visible solo con foco) */
.b-skip { position: absolute; left: var(--s-4); top: var(--s-2); z-index: var(--z-toast); padding: var(--s-2) var(--s-3); background: var(--surface); color: var(--text); border-radius: var(--r-sm); box-shadow: var(--sh-pop); transform: translateY(-160%); }
.b-skip:focus-visible { transform: none; }

/* ---------------------------------------------------------------------
   5. UTILIDADES MÍNIMAS (prefijo u-)
   --------------------------------------------------------------------- */
.u-num { font-variant-numeric: tabular-nums lining-nums; }            /* cifras tabulares */
.u-mono { font-family: var(--font-mono); font-size: 0.92em; }          /* ISBN, códigos */
.u-serif { font-family: var(--font-serif); }                           /* voz de los libros */
.u-muted { color: var(--text-2); }
.u-subtle { color: var(--text-3); }
.u-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.u-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.u-row { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; min-width: 0; }
.u-stack { display: flex; flex-direction: column; gap: var(--s-4); min-width: 0; }
.u-grow { flex: 1 1 auto; min-width: 0; }
.u-right { margin-left: auto; }
.u-gap-lg { gap: var(--s-6); }

/* Utilidades b-* del contrato de arquitectura (§11.2); equivalentes a las u-* */
.b-stack { display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }
.b-stack--sm { gap: var(--s-2); }
.b-stack--lg { gap: var(--s-6); }
.b-row { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.b-row--between { justify-content: space-between; }
.b-row--wrap { flex-wrap: wrap; }
.b-row--end { justify-content: flex-end; }
.b-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr)); gap: var(--s-4); }
.b-spacer { flex: 1 1 auto; }
.b-muted { color: var(--text-2); }
.b-num { font-variant-numeric: tabular-nums lining-nums; }
.b-mono { font-family: var(--font-mono); font-size: 0.92em; }
.b-serif { font-family: var(--font-serif); }
.b-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.b-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.b-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; }
.b-scroll-x { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.b-container { max-width: var(--content-max); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); min-width: 0; }
.b-h1 { font-family: var(--font-serif); font-size: var(--fs-3xl); font-weight: 500; line-height: var(--lh-tight); letter-spacing: -0.01em; }
.b-h2 { font-family: var(--font-serif); font-size: var(--fs-2xl); font-weight: 500; line-height: var(--lh-tight); }
.b-h3 { font-family: var(--font-serif); font-size: var(--fs-xl); font-weight: 500; line-height: var(--lh-snug); }
.b-eyebrow { font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-ink); }
.b-divider { border: 0; border-top: 1px solid var(--line); margin: var(--s-6) 0; height: 0; }

/* ---------------------------------------------------------------------
   6. LAYOUT DE LA APP
   --------------------------------------------------------------------- */
/* Contenedor raíz: banner (opcional) + barra lateral + barra superior + contenido.
   Atributos: data-sidebar="collapsed" (escritorio) · data-nav-open="true" (cajón ≤900px) */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: auto var(--topbar-h) minmax(0, 1fr);
  grid-template-areas: "banner banner" "side top" "side main";
  height: 100%;
  overflow: hidden;
  background: var(--paper);
}
.app-shell__banner { grid-area: banner; min-width: 0; }  /* aquí va .b-banner--demo */

/* Barra lateral = lomo marino con bandas doradas */
.sidebar {
  grid-area: side;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--side-bg);
  color: var(--side-text);
  border-right: 1px solid var(--side-line);
  padding-left: env(safe-area-inset-left);
  --focus: var(--side-focus);
  z-index: var(--z-sidebar);
}
.sidebar__brand { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-5) var(--s-5) var(--s-4); color: var(--side-strong); text-decoration: none; min-width: 0; }
.sidebar__mark { width: 34px; height: 34px; flex: none; color: #FFFFFF; --gold: var(--gold-bright); }  /* contiene LOGO_MARK_SVG */
.sidebar__mark svg { width: 100%; height: 100%; }
.sidebar__wordmark { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.sidebar__name { font-family: var(--font-brand); font-weight: 600; font-size: 1.125rem; letter-spacing: 0.14em; color: var(--side-strong); }
.sidebar__org { font-size: var(--fs-xs); color: var(--side-muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Doble banda dorada, como los lomos del logo */
.sidebar__bands { height: 5px; margin: 0 var(--s-5) var(--s-3); border-top: 1px solid var(--gold); border-bottom: 1px solid var(--gold); opacity: 0.75; flex: none; }
.sidebar__nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: var(--s-1) var(--s-3) var(--s-4); display: flex; flex-direction: column; gap: 2px; }
.sidebar__section-label { font-size: var(--fs-2xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--side-muted); padding: var(--s-4) var(--s-3) var(--s-1); }
/* Elemento de navegación: <a class="sidebar__item" aria-current="page"> */
.sidebar__item {
  position: relative;
  display: flex; align-items: center; gap: var(--s-3);
  min-height: 38px; padding: 0 var(--s-3);
  border-radius: var(--r-sm);
  color: var(--side-text); text-decoration: none;
  font-size: var(--fs-ui); font-weight: 500;
  transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.sidebar__item:hover { background: var(--side-hover); color: var(--side-strong); text-decoration: none; }
.sidebar__item[aria-current="page"], .sidebar__item.is-active { background: var(--side-active); color: var(--side-strong); font-weight: 600; }
.sidebar__item[aria-current="page"]::before, .sidebar__item.is-active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--gold-bright); }
.sidebar__item[aria-current="page"] .b-icon, .sidebar__item.is-active .b-icon { color: var(--gold-bright); }
.sidebar__label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__count { font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); display: inline-grid; place-items: center; background: rgba(255, 255, 255, 0.1); color: var(--side-strong); }
.sidebar__count--alert { background: var(--count-alert-bg); color: var(--count-alert-ink); }
.sidebar__footer { flex: none; border-top: 1px solid var(--side-line); padding: var(--s-3); display: flex; flex-direction: column; gap: 2px; padding-bottom: max(var(--s-3), env(safe-area-inset-bottom)); }
.sidebar__user { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); color: var(--side-strong); min-width: 0; text-align: left; width: 100%; font-size: var(--fs-ui); }
.sidebar__user:hover { background: var(--side-hover); }
.sidebar__user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.sidebar__user-name { font-size: var(--fs-ui); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__user-role { font-size: var(--fs-xs); color: var(--side-muted); }
.sidebar__collapse { display: flex; align-items: center; gap: var(--s-3); min-height: 34px; padding: 0 var(--s-3); border-radius: var(--r-sm); color: var(--side-muted); font-size: var(--fs-sm); width: 100%; text-align: left; }
.sidebar__collapse:hover { background: var(--side-hover); color: var(--side-strong); }
/* Fondo del cajón móvil (siempre en el DOM; visible solo con data-nav-open) */
.sidebar-backdrop { display: none; }

/* Barra lateral colapsada (solo escritorio) */
@media (min-width: 901px) {
  .app-shell[data-sidebar="collapsed"] { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }
  .app-shell[data-sidebar="collapsed"] .sidebar__brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .app-shell[data-sidebar="collapsed"] .sidebar__wordmark,
  .app-shell[data-sidebar="collapsed"] .sidebar__section-label,
  .app-shell[data-sidebar="collapsed"] .sidebar__user-meta,
  .app-shell[data-sidebar="collapsed"] .sidebar__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .app-shell[data-sidebar="collapsed"] .sidebar__bands { margin-left: var(--s-3); margin-right: var(--s-3); }
  .app-shell[data-sidebar="collapsed"] .sidebar__nav { overflow: visible; padding-left: var(--s-2); padding-right: var(--s-2); }
  .app-shell[data-sidebar="collapsed"] .sidebar__item,
  .app-shell[data-sidebar="collapsed"] .sidebar__collapse,
  .app-shell[data-sidebar="collapsed"] .sidebar__user { justify-content: center; padding: 0; }
  .app-shell[data-sidebar="collapsed"] .sidebar__count { position: absolute; top: 2px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; }
  .app-shell[data-sidebar="collapsed"] .sidebar__collapse .b-icon { transform: scaleX(-1); }
  /* Tooltip con data-tip="Catálogo" */
  .app-shell[data-sidebar="collapsed"] .sidebar__item[data-tip]:hover::after,
  .app-shell[data-sidebar="collapsed"] .sidebar__item[data-tip]:focus-visible::after {
    content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
    white-space: nowrap; padding: 4px 8px; border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 500;
    background: var(--toast-bg); color: var(--toast-text); box-shadow: var(--sh-pop); pointer-events: none; z-index: var(--z-menu);
  }
}

/* Barra superior: menú (≤900) · búsqueda global · acciones */
.topbar {
  grid-area: top;
  display: flex; align-items: center; gap: var(--s-3);
  min-width: 0;
  padding: 0 var(--gutter);
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  z-index: var(--z-topbar);
}
.topbar > .topbar__menu { display: none; }             /* botón hamburguesa (≤900px); selector reforzado para ganar a .b-btn */
.topbar__brand { display: none; width: 30px; height: 30px; color: var(--mark-ink); flex: none; }  /* monograma (≤600px) */
.topbar__brand svg { width: 100%; height: 100%; }
.topbar__search { flex: 1 1 auto; max-width: 560px; min-width: 0; }
.topbar__actions { display: flex; align-items: center; gap: var(--s-1); margin-left: auto; flex: none; }

/* Contenido: único contenedor con scroll vertical */
.main {
  grid-area: main;
  min-width: 0; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain;
  scroll-padding-top: var(--s-4);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
/* Página dentro de .main */
.page { max-width: var(--content-max); margin: 0 auto; padding: var(--s-6) var(--gutter) var(--s-12); min-width: 0; }
.page--wide { max-width: none; }                        /* catálogo, préstamos */
.page--narrow { max-width: 780px; }                     /* formularios, ajustes */
.page--fill { display: flex; flex-direction: column; min-height: 100%; height: 100%; padding-bottom: var(--s-6); } /* tabla que llena el alto */

/* Barra inferior (≤600px): 4 destinos + "Más" */
.bottom-nav { display: none; }
.bottom-nav__item { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 44px; padding: 6px 2px 4px; color: var(--text-2); text-decoration: none; font-size: var(--fs-2xs); font-weight: 600; letter-spacing: 0.01em; border-radius: var(--r-sm); min-width: 0; }
.bottom-nav__item .b-icon { width: 22px; height: 22px; }
.bottom-nav__item:hover { color: var(--text); text-decoration: none; }
.bottom-nav__item[aria-current="page"], .bottom-nav__item.is-active { color: var(--text); }
.bottom-nav__item[aria-current="page"]::before, .bottom-nav__item.is-active::before { content: ""; position: absolute; top: 0; left: 50%; width: 28px; height: 2px; margin-left: -14px; border-radius: 0 0 2px 2px; background: var(--gold); }
.bottom-nav__label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bottom-nav__badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-pill); background: var(--count-alert-bg); color: var(--count-alert-ink); font-size: 10px; line-height: 16px; text-align: center; font-variant-numeric: tabular-nums; }

/* ≤1100px: menos margen */
@media (max-width: 1100px) {
  :root { --gutter: 20px; }
}

/* ≤900px: barra lateral como cajón */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: "banner" "top" "main"; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0;
    width: min(300px, 86vw);
    transform: translateX(-104%);
    transition: transform var(--dur-3) var(--ease), visibility 0s linear var(--dur-3);
    visibility: hidden;
    z-index: var(--z-drawer);
    box-shadow: var(--sh-overlay);
    padding-top: env(safe-area-inset-top);
  }
  .app-shell[data-nav-open="true"] .sidebar { transform: none; visibility: visible; transition: transform var(--dur-3) var(--ease), visibility 0s; }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; background: var(--backdrop); opacity: 0; pointer-events: none; transition: opacity var(--dur-3) var(--ease); z-index: calc(var(--z-drawer) - 1); }
  .app-shell[data-nav-open="true"] .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .topbar > .topbar__menu { display: inline-flex; }
  .sidebar__collapse--toggle { display: none; }   /* el botón colapsar no aplica en cajón */
}

/* ≤600px: barra inferior + búsqueda compacta */
@media (max-width: 600px) {
  :root { --gutter: 16px; --topbar-h: 52px; }
  .topbar { gap: var(--s-2); padding-left: max(var(--gutter), env(safe-area-inset-left)); }
  .topbar > .topbar__menu { display: none; }       /* "Más" de la barra inferior abre el cajón */
  .topbar__brand { display: block; }
  .topbar__hide-sm { display: none !important; }
  .bottom-nav {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0;
    min-height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
    padding: 0 max(6px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(6px, env(safe-area-inset-left));
    background: var(--surface);
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 16px -8px rgba(6, 32, 64, 0.18);
    z-index: var(--z-bottomnav);
  }
  .app-shell--no-bottomnav .bottom-nav { display: none; }   /* visitante: sin barra inferior */
  .app-shell--no-bottomnav .topbar > .topbar__menu { display: inline-flex; }
  .main { padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom)); }
  .app-shell--no-bottomnav .main { padding-bottom: env(safe-area-inset-bottom); }
  .page { padding-top: var(--s-4); padding-bottom: var(--s-8); }
  .page--fill { height: auto; }
}

/* ---------------------------------------------------------------------
   7. ENCABEZADO DE PÁGINA Y MIGAS
   --------------------------------------------------------------------- */
/* Encabezado: títulos a la izquierda, acciones a la derecha (se envuelven) */
.b-page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-3) var(--s-6); margin-bottom: var(--s-5); min-width: 0; }
.b-page-header__titles { min-width: 0; flex: 1 1 320px; }
.b-page-header__eyebrow { font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-ink); margin-bottom: var(--s-1); }
.b-page-header__title { font-family: var(--font-serif); font-size: var(--fs-3xl); font-weight: 500; line-height: var(--lh-tight); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.b-page-header__desc { color: var(--text-2); margin-top: var(--s-1); max-width: 64ch; }
.b-page-header__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
@media (max-width: 600px) {
  .b-page-header { margin-bottom: var(--s-4); }
  .b-page-header__title { font-size: var(--fs-2xl); }
  .b-page-header__actions { width: 100%; }
  .b-page-header__actions > .b-btn--primary { flex: 1 1 auto; }
}

/* Migas de pan: <nav aria-label="Ruta"><ol class="b-breadcrumb"> */
.b-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1); font-size: var(--fs-sm); color: var(--text-2); margin-bottom: var(--s-2); min-width: 0; }
.b-breadcrumb li { display: inline-flex; align-items: center; gap: var(--s-1); min-width: 0; }
.b-breadcrumb li + li::before { content: "/"; color: var(--line-strong); padding: 0 2px; }
.b-breadcrumb a { color: var(--text-2); text-decoration: none; }
.b-breadcrumb a:hover { color: var(--text); text-decoration: underline; }
.b-breadcrumb [aria-current="page"] { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40ch; }

/* Filete dorado de marca con ornamento central (poner un <svg> chevron dentro) */
.b-rule { display: flex; align-items: center; gap: var(--s-3); color: var(--gold); margin: var(--s-5) 0; }
.b-rule::before, .b-rule::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: 0.8; }
.b-rule > svg { width: 22px; height: 12px; flex: none; }

/* Título de sección dentro de una página */
.b-section-title { font-family: var(--font-serif); font-size: var(--fs-xl); font-weight: 500; margin: var(--s-8) 0 var(--s-3); display: flex; align-items: baseline; gap: var(--s-3); }
.b-section-title small { font-family: var(--font-sans); font-size: var(--fs-sm); color: var(--text-2); font-weight: 400; }

/* ---------------------------------------------------------------------
   8. BOTONES
   --------------------------------------------------------------------- */
/* Botón base (secundario por defecto si no hay variante) */
.b-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 36px; padding: 0 var(--s-4);
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-ui); font-weight: 600; line-height: 1.2;
  white-space: nowrap; text-decoration: none; user-select: none;
  transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.b-btn:hover { text-decoration: none; }
.b-btn .b-icon { width: 18px; height: 18px; }
.b-btn:disabled, .b-btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.b-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
/* Primario: una acción principal por vista */
.b-btn--primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.b-btn--primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
/* Secundario: acciones de apoyo */
.b-btn--secondary { background: var(--surface); border-color: var(--line-strong); color: var(--text); box-shadow: var(--sh-hairline); }
.b-btn--secondary:hover:not(:disabled), .b-btn:not([class*="--"]):hover:not(:disabled) { background: var(--hover); border-color: var(--control-border); }
/* Fantasma: acciones terciarias, barras de herramientas, iconos */
.b-btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.b-btn--ghost:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.b-btn--ghost[aria-pressed="true"], .b-btn--ghost[aria-expanded="true"] { background: var(--surface-3); color: var(--text); }
/* Peligro: eliminar definitivamente, confirmar destrucción */
.b-btn--danger { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.b-btn--danger:hover:not(:disabled) { background: var(--danger-hover); border-color: var(--danger-hover); }
/* Peligro discreto: "Enviar a papelera" en menús y pies */
.b-btn--danger-quiet { background: transparent; border-color: transparent; color: var(--danger); }
.b-btn--danger-quiet:hover:not(:disabled) { background: var(--danger-soft); }
/* Tamaños */
.b-btn--sm { min-height: 30px; padding: 0 var(--s-3); font-size: var(--fs-sm); gap: 6px; }
.b-btn--sm .b-icon { width: 16px; height: 16px; }
.b-btn--lg { min-height: 44px; padding: 0 var(--s-5); font-size: var(--fs-base); }
.b-btn--block { width: 100%; }
/* Solo icono: requiere aria-label */
.b-btn--icon { width: 36px; padding: 0; }
.b-btn--icon.b-btn--sm { width: 30px; }
.b-btn--icon.b-btn--lg { width: 44px; }
/* Ocupado: aria-busy="true" muestra un giro y oculta el texto */
.b-btn[aria-busy="true"] { position: relative; color: transparent !important; pointer-events: none; }
.b-btn[aria-busy="true"]::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--text-3); border-right-color: transparent; animation: b-spin 0.7s linear infinite; }
.b-btn--primary[aria-busy="true"]::after { border-color: var(--on-primary); border-right-color: transparent; }
/* Grupo de botones pegados */
.b-btn-group { display: inline-flex; }
.b-btn-group > .b-btn { border-radius: 0; }
.b-btn-group > .b-btn:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.b-btn-group > .b-btn:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.b-btn-group > .b-btn + .b-btn { margin-left: -1px; }

/* Control segmentado (Tabla | Cuadrícula): botones con aria-pressed */
.b-seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); }
.b-seg__btn { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 var(--s-3); border-radius: var(--r-xs); color: var(--text-2); font-size: var(--fs-sm); font-weight: 600; }
.b-seg__btn:hover { color: var(--text); }
.b-seg__btn[aria-pressed="true"], .b-seg__btn[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--sh-raise); }
.b-seg__btn .b-icon { width: 16px; height: 16px; }

/* Enlace de texto con estilo de acción */
.b-link { color: var(--accent); font-weight: 500; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; cursor: pointer; }
.b-link:hover { text-decoration-thickness: 2px; }
.b-link:disabled { color: var(--text-3); text-decoration: none; cursor: not-allowed; }
.b-link--quiet { color: inherit; text-decoration: none; }
.b-link--quiet:hover { text-decoration: underline; }

/* ---------------------------------------------------------------------
   9. CAMPOS DE FORMULARIO
   --------------------------------------------------------------------- */
/* Envoltura de campo: etiqueta + control + ayuda/error */
.b-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.b-label { font-size: var(--fs-sm); font-weight: 600; color: var(--text); line-height: 1.3; }
.b-label__opt { font-weight: 400; color: var(--text-3); margin-left: 4px; }   /* "(opcional)" */
.b-help { font-size: var(--fs-sm); color: var(--text-3); line-height: 1.4; }
.b-error { display: flex; align-items: flex-start; gap: 6px; font-size: var(--fs-sm); font-weight: 500; color: var(--danger); line-height: 1.4; }
.b-error .b-icon { width: 16px; height: 16px; margin-top: 1px; }

/* Entradas de texto, selección y área */
.b-input, .b-select, .b-textarea {
  display: block; width: 100%; min-width: 0;
  min-height: 38px; padding: 0 var(--s-3);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--control-border);
  border-radius: var(--r-sm);
  font-size: var(--fs-base); line-height: 1.4;
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.b-input::placeholder, .b-textarea::placeholder { color: var(--text-3); opacity: 1; }
.b-input:hover, .b-select:hover, .b-textarea:hover { border-color: var(--text-2); }
.b-input:focus-visible, .b-select:focus-visible, .b-textarea:focus-visible,
.b-input:focus, .b-select:focus, .b-textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.b-input[aria-invalid="true"], .b-select[aria-invalid="true"], .b-textarea[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.b-input:disabled, .b-select:disabled, .b-textarea:disabled { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; }
.b-input[readonly] { background: var(--surface-2); }
.b-textarea { min-height: 96px; padding: var(--s-2) var(--s-3); resize: vertical; line-height: var(--lh-base); }
.b-select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: var(--i-chevron); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px 16px; cursor: pointer; }
.b-input--mono, .b-textarea--mono { font-family: var(--font-mono); font-size: var(--fs-ui); letter-spacing: 0.02em; }   /* ISBN, códigos, CSV */
.b-input--sm, .b-select--sm { min-height: 30px; font-size: var(--fs-sm); }
.b-input--lg { min-height: 48px; font-size: var(--fs-lg); padding: 0 var(--s-4); }
input[type="search"].b-input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* Campo con icono al inicio y/o elemento al final (kbd, botón limpiar) */
.b-input-wrap { position: relative; display: flex; align-items: center; min-width: 0; }
.b-input-wrap > .b-input { padding-left: 36px; }
.b-input-wrap__icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-3); pointer-events: none; }
.b-input-wrap__end { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 4px; }
.b-input-wrap--has-end > .b-input { padding-right: 76px; }
/* Búsqueda de la barra superior */
.b-input--search { background: var(--surface-2); border-color: var(--line-strong); }
.b-input--search:hover { background: var(--surface); }

/* Campo con sufijo/prefijo de texto: <div class="b-input-group"><input class="b-input"><span class="b-input-group__addon">días</span></div> */
.b-input-group { display: flex; align-items: stretch; min-width: 0; }
.b-input-group > .b-input { border-top-right-radius: 0; border-bottom-right-radius: 0; flex: 1 1 auto; }
.b-input-group__addon { display: inline-flex; align-items: center; padding: 0 var(--s-3); border: 1px solid var(--control-border); border-left: 0; border-radius: 0 var(--r-sm) var(--r-sm) 0; background: var(--surface-2); color: var(--text-2); font-size: var(--fs-ui); white-space: nowrap; }
.b-input-group--narrow { max-width: 180px; }

/* Campo de fichas (autores, categorías, etiquetas): contenedor con .b-chip y un input interno */
.b-tokens { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 38px; padding: 4px 6px; background: var(--surface); border: 1px solid var(--control-border); border-radius: var(--r-sm); cursor: text; min-width: 0; }
.b-tokens:hover { border-color: var(--text-2); }
.b-tokens:focus-within { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.b-tokens .b-chip { min-height: 26px; padding: 0 var(--s-2); }
.b-tokens__input { flex: 1 1 120px; min-width: 80px; height: 28px; border: 0; background: transparent; font-size: var(--fs-base); color: var(--text); }
.b-tokens__input:focus { outline: none; }
.b-tokens__input::placeholder { color: var(--text-3); }

/* Muestras de color de portada: <button class="b-swatch" style="--swatch:#5C1F27" aria-pressed aria-label="Color burdeos"> */
.b-swatches { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.b-swatch { width: 28px; height: 28px; border-radius: 50%; background: var(--swatch, var(--navy)); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); border: 0; transition: transform var(--dur-1) var(--ease); }
.b-swatch:hover { transform: scale(1.08); }
.b-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--gold); }

/* Rejilla de formulario: columnas automáticas; .b-span-all ocupa toda la fila */
.b-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: var(--s-4) var(--s-5); }
.b-span-all { grid-column: 1 / -1; }
/* Sección de formulario (fieldset) con título serif */
.b-section { border: 0; margin: 0; padding: 0; min-width: 0; }
.b-section + .b-section { margin-top: var(--s-8); padding-top: var(--s-8); border-top: 1px solid var(--line); }
.b-section__title { font-family: var(--font-serif); font-size: var(--fs-xl); font-weight: 500; padding: 0; margin-bottom: var(--s-1); }
.b-section__desc { color: var(--text-2); font-size: var(--fs-ui); margin-bottom: var(--s-4); max-width: 64ch; }
/* Barra fija de acciones de formulario (Guardar / Cancelar).
   Fondo sólido con filete superior: el contenido que pasa por debajo no se transparenta. */
.b-formbar { position: sticky; bottom: 0; z-index: var(--z-sticky); display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--s-2); margin-top: var(--s-8); padding: var(--s-3) 0; background: var(--paper); border-top: 1px solid var(--line); }
.b-formbar__note { margin-right: auto; font-size: var(--fs-sm); color: var(--text-3); }
@media (max-width: 600px) {
  /* bottom: 0 porque .main ya reserva el alto de la barra inferior con su padding-bottom
     (sumarlo aquí dejaba la barra flotando con una franja muerta debajo). Nota en una sola línea. */
  .b-formbar { bottom: 0; gap: var(--s-1) var(--s-2); padding: var(--s-2) 0; }
  .b-formbar__note { flex: 1 1 100%; min-width: 0; margin-right: 0; font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .b-formbar > .b-btn { flex: 1 1 auto; }
}

/* Casilla de verificación: <input type="checkbox" class="b-checkbox"> */
.b-checkbox, .b-radio {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 18px; height: 18px; margin: 0;
  border: 1.5px solid var(--control-border);
  background: var(--surface) center / 14px 14px no-repeat;
  cursor: pointer; vertical-align: middle;
  transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.b-checkbox { border-radius: var(--r-xs); }
.b-checkbox:hover, .b-radio:hover { border-color: var(--text-2); }
.b-checkbox:checked { background-color: var(--primary); border-color: var(--primary); background-image: var(--i-check); }
.b-checkbox:indeterminate { background-color: var(--primary); border-color: var(--primary); background-image: var(--i-dash); }
.b-checkbox:focus-visible, .b-radio:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.b-checkbox:disabled, .b-radio:disabled { opacity: 0.5; cursor: not-allowed; }
/* Radio: <input type="radio" class="b-radio"> */
.b-radio { border-radius: 50%; }
.b-radio:checked { border-color: var(--primary); box-shadow: inset 0 0 0 4px var(--surface); background: var(--primary); }
/* Etiqueta en línea para casilla/radio */
.b-check { display: inline-flex; align-items: flex-start; gap: var(--s-2); cursor: pointer; font-size: var(--fs-base); line-height: 1.35; }
.b-check > .b-checkbox, .b-check > .b-radio { margin-top: 1px; }
.b-check__hint { display: block; font-size: var(--fs-sm); color: var(--text-3); }
/* Opción en tarjeta (p. ej. Combinar / Reemplazar al importar) */
.b-choice { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); cursor: pointer; }
.b-choice:hover { border-color: var(--control-border); }
.b-choice:has(:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: var(--surface-2); }
.b-choice__title { font-weight: 600; }
.b-choice__desc { font-size: var(--fs-sm); color: var(--text-2); }

/* Interruptor: <button role="switch" aria-checked="true" class="b-switch"><span class="b-switch__thumb"></span></button> */
.b-switch { position: relative; flex: none; width: 38px; height: 22px; border-radius: var(--r-pill); background: var(--control-border); border: 0; padding: 0; transition: background-color var(--dur-2) var(--ease); cursor: pointer; }
.b-switch__thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); transition: transform var(--dur-2) var(--ease); }
.b-switch[aria-checked="true"] { background: var(--primary); }
.b-switch[aria-checked="true"] .b-switch__thumb { transform: translateX(16px); }
:root[data-theme="dark"] .b-switch[aria-checked="true"] .b-switch__thumb { background: var(--on-primary); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .b-switch[aria-checked="true"] .b-switch__thumb { background: var(--on-primary); } }
.b-switch:disabled { opacity: 0.5; }
.b-switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-pill); }
/* Fila con etiqueta + interruptor ("Escaneo continuo") */
.b-switch-row { display: inline-flex; align-items: center; gap: var(--s-3); font-size: var(--fs-ui); font-weight: 600; cursor: pointer; }

/* Campo de escaneo (lector USB o teclado): contenedor + input */
.b-scan {
  display: flex; align-items: center; gap: var(--s-3);
  min-height: 54px; padding: 0 var(--s-2) 0 var(--s-4);
  background: var(--surface);
  border: 1.5px solid var(--control-border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-hairline);
  min-width: 0;
}
.b-scan:focus-within { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.b-scan > .b-icon { width: 26px; height: 26px; color: var(--text-2); }
.b-scan__input { flex: 1 1 auto; min-width: 0; height: 50px; border: 0; background: transparent; font-family: var(--font-mono); font-size: 1.125rem; letter-spacing: 0.03em; color: var(--text); }
.b-scan__input::placeholder { font-family: var(--font-sans); letter-spacing: 0; color: var(--text-3); font-size: var(--fs-base); }
.b-scan__input:focus { outline: none; }
.b-scan__status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); white-space: nowrap; }
.b-scan__status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.b-scan:focus-within .b-scan__status::before { background: var(--st-ok-dot); }
.b-scan--continuous { border-left: 4px solid var(--gold); }
.b-scan--continuous:focus-within .b-scan__status::before { background: var(--gold); animation: b-pulse 1.6s var(--ease) infinite; }
.b-scan--compact { min-height: 42px; }
.b-scan--compact .b-scan__input { height: 38px; font-size: var(--fs-base); }
@media (max-width: 600px) { .b-scan__status { display: none; } .b-scan__input { font-size: 1rem; } }

/* Zona para soltar archivos (importar respaldo, foto de índice) */
.b-dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-2); text-align: center; padding: var(--s-8) var(--s-5); border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--surface); color: var(--text-2); cursor: pointer; transition: border-color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease); }
.b-dropzone:hover, .b-dropzone:focus-within { border-color: var(--control-border); }
.b-dropzone[data-drag="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.b-dropzone .b-icon { width: 32px; height: 32px; stroke-width: 1.25; color: var(--gold); }
.b-dropzone__title { font-weight: 600; color: var(--text); }

/* ---------------------------------------------------------------------
   10. TARJETAS, LISTAS, METADATOS
   --------------------------------------------------------------------- */
/* Tarjeta: solo para agrupar algo que se lee como unidad (no envolver todo) */
.b-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); min-width: 0; }
.b-card--pad { padding: var(--s-5); }
.b-card--flat { background: var(--surface-2); border-color: transparent; }
.b-card__header { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line); }
.b-card__title { font-family: var(--font-serif); font-size: var(--fs-lg); font-weight: 600; line-height: var(--lh-snug); }
.b-card__body { padding: var(--s-4) var(--s-5); }
.b-card__footer { padding: var(--s-3) var(--s-5); border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: var(--s-2); }

/* Lista con divisores: préstamos en móvil, personas, solicitudes */
.b-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; min-width: 0; }
.b-list--plain { background: transparent; border: 0; border-radius: 0; }
.b-list__item { display: flex; align-items: center; gap: var(--s-3); min-height: 56px; padding: var(--s-3) var(--s-4); min-width: 0; }
.b-list__item + .b-list__item { border-top: 1px solid var(--line); }
.b-list__item--link { cursor: pointer; color: inherit; text-decoration: none; }
.b-list__item--link:hover { background: var(--hover); text-decoration: none; }
.b-list__item[aria-selected="true"], .b-list__item.is-selected { background: var(--surface-3); box-shadow: inset 3px 0 0 var(--accent); }
.b-list__main { flex: 1 1 auto; min-width: 0; }
.b-list__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-list__title--book { font-family: var(--font-serif); font-size: var(--fs-lg); font-weight: 500; }
.b-list__meta { font-size: var(--fs-sm); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-list__aside { flex: none; display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); color: var(--text-2); }
@media (max-width: 600px) { .b-list__item { flex-wrap: wrap; } .b-list__aside { width: 100%; justify-content: flex-start; padding-left: 0; } .b-list__item > .b-cover + .b-list__main + .b-list__aside { padding-left: 60px; } }

/* Lista de definición para metadatos (ficha del libro) */
.b-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s-2) var(--s-6); font-size: var(--fs-ui); }
.b-dl dt { color: var(--text-2); }
.b-dl dd { color: var(--text); overflow-wrap: anywhere; }
@media (max-width: 600px) { .b-dl { grid-template-columns: minmax(0, 1fr); gap: 2px; } .b-dl dd { margin-bottom: var(--s-2); } }

/* Maestro-detalle (Personas, Ubicaciones): lista izquierda + detalle */
.b-split { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: var(--s-5); align-items: start; min-width: 0; }
.b-split__pane { min-width: 0; }
.b-split__pane--sticky { position: sticky; top: var(--s-4); }
@media (max-width: 1100px) { .b-split { grid-template-columns: minmax(0, 1fr); } .b-split__pane--sticky { position: static; } }

/* Subnavegación vertical (Ajustes) → pestañas horizontales en ≤900px */
.b-subnav { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.b-subnav__item { display: flex; align-items: center; gap: var(--s-3); min-height: 36px; padding: 0 var(--s-3); border-radius: var(--r-sm); color: var(--text-2); font-size: var(--fs-ui); font-weight: 500; text-decoration: none; text-align: left; }
.b-subnav__item:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.b-subnav__item[aria-current="page"], .b-subnav__item[aria-current="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: inset 2px 0 0 var(--gold), var(--sh-hairline); }
.b-settings { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--s-8); align-items: start; }
.b-settings > .b-subnav { position: sticky; top: var(--s-4); }
@media (max-width: 900px) {
  .b-settings { grid-template-columns: minmax(0, 1fr); gap: var(--s-4); }
  .b-settings > .b-subnav { position: static; flex-direction: row; overflow-x: auto; border-bottom: 1px solid var(--line); gap: 0; scrollbar-width: none; }
  .b-settings > .b-subnav .b-subnav__item { flex: none; border-radius: 0; min-height: 42px; }
  .b-settings > .b-subnav .b-subnav__item[aria-current] { background: transparent; box-shadow: inset 0 -2px 0 var(--gold); }
}
/* ≤600px: las 8 secciones se envuelven en varias líneas (ninguna queda fuera de la pantalla) */
@media (max-width: 600px) {
  .b-settings > .b-subnav { flex-wrap: wrap; overflow: visible; gap: var(--s-2); padding-bottom: var(--s-3); }
  .b-settings > .b-subnav .b-subnav__item { min-height: 40px; padding: 0 var(--s-3); gap: var(--s-2); border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--surface); font-size: var(--fs-sm); }
  .b-settings > .b-subnav .b-subnav__item .b-icon { display: none; }   /* solo texto: 3 líneas en vez de 4 */
  .b-settings > .b-subnav .b-subnav__item[aria-current] { background: var(--surface); border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); color: var(--text); }
}

/* ---------------------------------------------------------------------
   11. TABLA DENSA
   --------------------------------------------------------------------- */
/* Contenedor con scroll (horizontal en móvil; vertical con cabecera fija) */
.b-table-wrap { position: relative; overflow: auto; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); -webkit-overflow-scrolling: touch; }
.b-table-wrap--fill { flex: 1 1 auto; min-height: 260px; }   /* dentro de .page--fill */
.b-table-wrap--max { max-height: 560px; }
@media (max-width: 600px) { .b-table-wrap--fill { flex: none; min-height: 0; } }
/* Tabla */
.b-table { width: 100%; font-size: var(--fs-ui); line-height: 1.35; font-variant-numeric: tabular-nums; }
.b-table th, .b-table td { padding: 0 var(--s-3); height: 48px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.b-table tbody tr:last-child td { border-bottom: 0; }
.b-table thead th {
  position: sticky; top: 0; z-index: 2;
  height: 38px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-sm); font-weight: 600;
  white-space: nowrap;
  box-shadow: inset 0 -1px 0 var(--line);
  border-bottom: 0;
}
.b-table th:first-child, .b-table td:first-child { padding-left: var(--s-4); }
.b-table th:last-child, .b-table td:last-child { padding-right: var(--s-4); }
.b-table tbody tr { transition: background-color var(--dur-1) var(--ease); }
.b-table tbody tr:hover { background: var(--hover); }
/* Fila seleccionable/navegable */
.b-table__row--link { cursor: pointer; }
.b-table tbody tr[aria-selected="true"] { background: var(--surface-3); }
.b-table tbody tr[aria-selected="true"] td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.b-table tbody tr.is-late td:first-child { box-shadow: inset 3px 0 0 var(--st-late-dot); }  /* préstamo vencido */
.b-table--dense th, .b-table--dense td { height: 38px; }
.b-table--dense thead th { height: 34px; }
/* Botón de ordenar en cabecera: <th aria-sort="ascending"><button class="b-th-sort"> */
.b-th-sort { display: inline-flex; align-items: center; gap: 4px; color: inherit; font-weight: inherit; padding: 4px 0; }
.b-th-sort:hover { color: var(--text); }
.b-th-sort .b-icon { width: 14px; height: 14px; opacity: 0.5; }
th[aria-sort="ascending"] .b-th-sort, th[aria-sort="descending"] .b-th-sort { color: var(--text); }
th[aria-sort="ascending"] .b-th-sort .b-icon, th[aria-sort="descending"] .b-th-sort .b-icon { opacity: 1; }
th[aria-sort="descending"] .b-th-sort .b-icon { transform: rotate(180deg); }
/* Tipos de celda */
.b-td-check { width: 44px; padding-right: 0 !important; }
.b-td-cover { width: 52px; padding-right: 0 !important; }
.b-td-num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.b-td-mono { font-family: var(--font-mono); font-size: var(--fs-sm); white-space: nowrap; }
.b-td-nowrap { white-space: nowrap; }
.b-td-muted { color: var(--text-2); }
.b-td-title { min-width: 220px; max-width: 460px; }
.b-td-title__main { font-family: var(--font-serif); font-size: var(--fs-lg); font-weight: 500; line-height: 1.2; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.b-td-title__sub { font-size: var(--fs-sm); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-td-title a { color: inherit; text-decoration: none; }
.b-td-title a:hover .b-td-title__main { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.b-td-actions { width: 1%; white-space: nowrap; text-align: right !important; }
.b-td-actions__inner { display: inline-flex; gap: 2px; }
@media (hover: hover) and (min-width: 901px) {
  .b-table--reveal .b-td-actions__inner { opacity: 0; transition: opacity var(--dur-1) var(--ease); }
  .b-table--reveal tr:hover .b-td-actions__inner, .b-table--reveal tr:focus-within .b-td-actions__inner { opacity: 1; }
}
/* Tabla apilada como tarjetas en ≤600px (td con data-label="Vence") */
@media (max-width: 600px) {
  .b-table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .b-table--stack, .b-table--stack tbody, .b-table--stack tr, .b-table--stack td { display: block; width: 100%; }
  .b-table--stack tr { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); }
  .b-table--stack tbody tr:last-child { border-bottom: 0; }
  .b-table--stack td { height: auto; border: 0; padding: 2px 0 !important; display: flex; justify-content: space-between; gap: var(--s-3); text-align: right; max-width: none; min-width: 0; }
  .b-table--stack td[data-label]::before { content: attr(data-label); color: var(--text-2); font-size: var(--fs-sm); text-align: left; flex: none; }
  .b-table--stack td.b-td-title { display: block; text-align: left; padding-bottom: var(--s-1) !important; }
  .b-table--stack td.b-td-check, .b-table--stack td.b-td-cover { display: none; }
  .b-table--stack td.b-td-actions { justify-content: flex-end; padding-top: var(--s-2) !important; }
  .b-table--stack tbody tr[aria-selected="true"] td:first-child, .b-table--stack tbody tr.is-late td:first-child { box-shadow: none; }
  .b-table--stack tbody tr.is-late { box-shadow: inset 3px 0 0 var(--st-late-dot); }
}

/* Barra de herramientas sobre tablas y cuadrículas */
.b-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin-bottom: var(--s-3); min-width: 0; }
.b-toolbar__search { flex: 1 1 280px; min-width: 0; max-width: 520px; }
.b-toolbar__group { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); min-width: 0; }
.b-toolbar__spacer { flex: 1 1 auto; }
.b-toolbar__count { font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Fila de filtros visibles bajo la barra */
.b-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin-bottom: var(--s-3); }
.b-filters .b-select { width: auto; min-width: 140px; min-height: 32px; font-size: var(--fs-ui); }
@media (max-width: 600px) { .b-filters .b-select { flex: 1 1 140px; } .b-toolbar__search { flex-basis: 100%; max-width: none; } }

/* Barra de acciones en lote (aparece con selección) */
.b-bulkbar {
  position: sticky; bottom: var(--s-4); z-index: var(--z-sticky);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2);
  width: fit-content; max-width: 100%;
  margin: var(--s-3) auto 0;
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4);
  background: var(--navy); color: #FFFFFF;
  border-radius: var(--r-lg);
  box-shadow: var(--sh-overlay);
  animation: b-rise var(--dur-2) var(--ease);
  --focus: var(--gold-bright);
}
:root[data-theme="dark"] .b-bulkbar { background: #1C3150; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .b-bulkbar { background: #1C3150; } }
.b-bulkbar__count { font-weight: 600; font-variant-numeric: tabular-nums; margin-right: var(--s-2); white-space: nowrap; }
.b-bulkbar .b-btn { background: transparent; border-color: transparent; color: #FFFFFF; }
.b-bulkbar .b-btn:hover { background: rgba(255, 255, 255, 0.12); }
.b-bulkbar .b-btn--danger-quiet { color: #FFB4AB; }
.b-bulkbar__sep { width: 1px; align-self: stretch; margin: 4px 2px; background: rgba(255, 255, 255, 0.18); }
@media (max-width: 600px) { .b-bulkbar { bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom) + var(--s-2)); width: 100%; justify-content: center; } }

/* ---------------------------------------------------------------------
   12. PESTAÑAS
   --------------------------------------------------------------------- */
/* <div role="tablist" class="b-tabs"><button role="tab" class="b-tab" aria-selected="true"> */
.b-tabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--line); margin-bottom: var(--s-5); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; min-width: 0; }
.b-tabs::-webkit-scrollbar { display: none; }
.b-tab { position: relative; flex: none; display: inline-flex; align-items: center; gap: var(--s-2); min-height: 42px; padding: 0 var(--s-3); color: var(--text-2); font-size: var(--fs-ui); font-weight: 600; white-space: nowrap; border-radius: var(--r-sm) var(--r-sm) 0 0; }
.b-tab:hover { color: var(--text); background: var(--hover); }
.b-tab[aria-selected="true"] { color: var(--text); }
.b-tab[aria-selected="true"]::after { content: ""; position: absolute; left: var(--s-2); right: var(--s-2); bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--gold); }
.b-tab .b-icon { width: 17px; height: 17px; }
.b-tab__count { font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums; min-width: 20px; height: 18px; padding: 0 6px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-2); display: inline-grid; place-items: center; border: 1px solid var(--line); }
.b-tab__count--alert { background: var(--st-late-bg); color: var(--st-late); border-color: transparent; }
.b-tabpanel:focus-visible { outline-offset: 6px; }

/* Señal de desbordamiento horizontal (pestañas y subnavegación de Ajustes en ≤900px):
   desvanecido en el borde que todavía tiene pestañas ocultas.
   - Navegadores con animaciones ligadas al scroll: aparece solo si hay desbordamiento y del lado correcto.
   - Resto: desvanecido fijo a la derecha en ≤900px, con relleno para que la última pestaña no quede tapada. */
@property --b-fade-l { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --b-fade-r { syntax: "<length>"; inherits: false; initial-value: 0px; }
@keyframes b-edge-fade {
  from { --b-fade-l: 0px; --b-fade-r: 32px; }
  6% { --b-fade-l: 32px; }
  94% { --b-fade-r: 32px; }
  to { --b-fade-l: 32px; --b-fade-r: 0px; }
}
@supports (animation-timeline: scroll()) {
  .b-tabs {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--b-fade-l), #000 calc(100% - var(--b-fade-r)), transparent);
    mask-image: linear-gradient(to right, transparent, #000 var(--b-fade-l), #000 calc(100% - var(--b-fade-r)), transparent);
    animation-name: b-edge-fade; animation-duration: auto; animation-timing-function: linear; animation-fill-mode: both;
    animation-timeline: scroll(self inline);
  }
  @media (max-width: 900px) {
    .b-settings > .b-subnav {
      -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--b-fade-l), #000 calc(100% - var(--b-fade-r)), transparent);
      mask-image: linear-gradient(to right, transparent, #000 var(--b-fade-l), #000 calc(100% - var(--b-fade-r)), transparent);
      animation-name: b-edge-fade; animation-duration: auto; animation-timing-function: linear; animation-fill-mode: both;
      animation-timeline: scroll(self inline);
    }
  }
}
@supports not (animation-timeline: scroll()) {
  @media (max-width: 900px) {
    .b-tabs, .b-settings > .b-subnav {
      padding-right: 32px;
      -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
      mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
    }
  }
}
/* ≤600px: la subnavegación de Ajustes se envuelve (sin scroll): sin desvanecido */
@media (max-width: 600px) {
  .b-settings > .b-subnav { -webkit-mask-image: none; mask-image: none; animation: none; padding-right: 0; }
}

/* ---------------------------------------------------------------------
   13. INSIGNIAS DE ESTADO Y CHIPS
   --------------------------------------------------------------------- */
/* Insignia de estado (no interactiva): punto + texto */
.b-badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px;
  border-radius: var(--r-xs);
  font-size: var(--fs-xs); font-weight: 600; line-height: 1;
  white-space: nowrap;
  background: var(--surface-2); color: var(--text-2);
  --dot: var(--text-3);
}
.b-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--dot); flex: none; }
.b-badge--nodot::before { display: none; }
.b-badge--disponible, .b-badge--aprobada { background: var(--st-ok-bg); color: var(--st-ok); --dot: var(--st-ok-dot); }
.b-badge--prestado, .b-badge--entregada { background: var(--st-loan-bg); color: var(--st-loan); --dot: var(--st-loan-dot); }
.b-badge--vencido { background: var(--st-late-bg); color: var(--st-late); --dot: var(--st-late-dot); }
.b-badge--perdido { background: var(--st-lost-bg); color: var(--st-lost); --dot: var(--st-lost-dot); }
.b-badge--retirado, .b-badge--cancelada, .b-badge--rechazada { background: var(--st-off-bg); color: var(--st-off); --dot: var(--st-off-dot); }
.b-badge--pendiente { background: var(--st-wait-bg); color: var(--st-wait); --dot: var(--st-wait-dot); }
.b-badge--neutral { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); --dot: var(--text-3); }
.b-badge--outline { background: transparent; border: 1px solid var(--line-strong); color: var(--text-2); }   /* estado físico: bueno/regular/dañado */
.b-badge--danado { background: transparent; border: 1px solid var(--st-late-dot); color: var(--st-late); --dot: var(--st-late-dot); }
.b-badge--ia { background: var(--gold-soft); color: var(--gold-ink); --dot: var(--gold); }  /* "Sugerido por IA" */
.b-badge--lg { height: 26px; padding: 0 10px; font-size: var(--fs-sm); }

/* Chip interactivo: filtros, prefijos de búsqueda. aria-pressed para activos */
.b-chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 28px; padding: 0 var(--s-3);
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-sm); font-weight: 500;
  white-space: nowrap; max-width: 100%;
  transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
button.b-chip:hover, a.b-chip:hover { border-color: var(--control-border); background: var(--hover); text-decoration: none; }
.b-chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.b-chip .b-icon { width: 14px; height: 14px; }
.b-chip__remove { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: -6px; border-radius: 50%; color: inherit; opacity: 0.75; }
.b-chip__remove:hover { opacity: 1; background: rgba(127, 127, 127, 0.18); }
.b-chip__remove .b-icon { width: 12px; height: 12px; stroke-width: 2; }
/* Prefijo de búsqueda (autor:, título:, capítulo:, #etiqueta) */
.b-chip--prefix { font-family: var(--font-mono); font-size: var(--fs-xs); border-style: dashed; color: var(--text-2); min-height: 26px; }
/* Etiqueta temática (#teología): sabor dorado, radio pequeño */
.b-chip--tag { border-radius: var(--r-xs); border-color: transparent; background: var(--gold-soft); color: var(--gold-ink); min-height: 24px; padding: 0 var(--s-2); font-size: var(--fs-xs); font-weight: 600; }
button.b-chip--tag:hover, a.b-chip--tag:hover { border-color: var(--gold); background: var(--gold-soft); }
.b-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }

/* Etiqueta de signatura (como el marbete del lomo) */
.b-callnumber { display: inline-block; font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 500; line-height: 1.35; padding: 2px 6px; border: 1px solid var(--line-strong); border-top: 2px solid var(--gold); border-radius: var(--r-xs); background: var(--surface); color: var(--text); white-space: nowrap; letter-spacing: 0.02em; }
.b-callnumber--lg { font-size: var(--fs-sm); padding: 4px 10px; white-space: pre-line; text-align: center; }
/* Código de barras / ISBN en texto */
.b-code { font-family: var(--font-mono); font-size: 0.9em; letter-spacing: 0.02em; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-xs); padding: 0 4px; white-space: nowrap; }

/* Disponibilidad "2 de 3" con mini-lomos por ejemplar */
.b-avail { display: inline-flex; align-items: center; gap: var(--s-2); white-space: nowrap; font-size: var(--fs-ui); font-variant-numeric: tabular-nums; }
.b-avail__spines { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.b-avail__spine { width: 4px; height: 14px; border-radius: 1px; background: var(--st-ok-dot); }
.b-avail__spine:nth-child(3n+2) { height: 12px; }
.b-avail__spine:nth-child(3n) { height: 13px; }
.b-avail__spine--prestado { background: var(--st-loan-dot); }
.b-avail__spine--vencido { background: var(--st-late-dot); }
.b-avail__spine--perdido, .b-avail__spine--retirado { background: transparent; box-shadow: inset 0 0 0 1px var(--st-off-dot); }
.b-avail__text--none { color: var(--st-late); font-weight: 600; }

/* Atajo de teclado */
.b-kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; font-family: var(--font-mono); font-size: 11px; font-weight: 500; line-height: 1; color: var(--text-2); background: var(--surface); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: var(--r-xs); white-space: nowrap; }
.b-kbd + .b-kbd { margin-left: 3px; }

/* Avatar con iniciales (color por hash: style="--avatar-bg:#..;--avatar-ink:#..") */
.b-avatar { display: inline-grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--avatar-bg, var(--surface-3)); color: var(--avatar-ink, var(--text)); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.02em; overflow: hidden; text-transform: uppercase; }
.b-avatar img { width: 100%; height: 100%; object-fit: cover; }
.b-avatar--sm { width: 24px; height: 24px; font-size: 10px; }
.b-avatar--lg { width: 48px; height: 48px; font-size: var(--fs-ui); }
.sidebar .b-avatar { box-shadow: 0 0 0 1px var(--gold); }

/* Barra de progreso de lectura */
.b-progress { position: relative; height: 6px; border-radius: var(--r-pill); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; min-width: 60px; }
.b-progress__bar { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--gold); transition: width var(--dur-3) var(--ease); }
.b-progress--ok .b-progress__bar { background: var(--st-ok-dot); }

/* Giro de carga pequeño */
.b-spinner { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: b-spin 0.8s linear infinite; flex: none; }

/* ---------------------------------------------------------------------
   14. CIFRAS (Inicio, Reportes)
   --------------------------------------------------------------------- */
.b-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: var(--s-3); margin-bottom: var(--s-6); }
@media (max-width: 600px) { .b-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); } }
/* Tarjeta de cifra; como <a>/<button> se vuelve clicable */
.b-stat { position: relative; display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-4) var(--s-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--text); text-align: left; text-decoration: none; min-width: 0; transition: box-shadow var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), transform var(--dur-2) var(--ease); }
a.b-stat:hover, button.b-stat:hover { border-color: var(--line-strong); box-shadow: var(--sh-raise); text-decoration: none; }
.b-stat__label { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.b-stat__label .b-icon { width: 17px; height: 17px; color: var(--gold); }
.b-stat__value { font-family: var(--font-serif); font-size: var(--fs-4xl); font-weight: 500; line-height: 1; letter-spacing: -0.01em; font-variant-numeric: lining-nums tabular-nums; margin-top: var(--s-1); }
.b-stat__meta { font-size: var(--fs-sm); color: var(--text-3); }
.b-stat__go { position: absolute; top: var(--s-4); right: var(--s-4); width: 16px; height: 16px; color: var(--text-3); }
/* Vencidos: alerta roja */
.b-stat--alert { border-color: var(--st-late-dot); box-shadow: inset 3px 0 0 var(--st-late-dot); }
.b-stat--alert .b-stat__value, .b-stat--alert .b-stat__label, .b-stat--alert .b-stat__label .b-icon { color: var(--st-late); }
.b-stat--alert.is-zero { border-color: var(--line); box-shadow: none; }
.b-stat--alert.is-zero .b-stat__value, .b-stat--alert.is-zero .b-stat__label { color: inherit; }
.b-stat--alert.is-zero .b-stat__label { color: var(--text-2); }
/* Pendientes (solicitudes) */
.b-stat--wait .b-stat__label .b-icon { color: var(--st-wait-dot); }
@media (max-width: 600px) { .b-stat { padding: var(--s-3) var(--s-4); } .b-stat__value { font-size: var(--fs-3xl); } }

/* Barras horizontales CSS (por categoría/ubicación): fila = etiqueta · barra · cifra */
.b-hbars { display: flex; flex-direction: column; gap: var(--s-2); }
.b-hbar { display: grid; grid-template-columns: minmax(90px, 34%) minmax(0, 1fr) 48px; align-items: center; gap: var(--s-3); font-size: var(--fs-ui); }
.b-hbar__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.b-hbar__track { height: 10px; border-radius: 1px 3px 3px 1px; background: var(--surface-2); overflow: hidden; }
.b-hbar__fill { height: 100%; background: var(--chart-1); border-radius: inherit; }
.b-hbar__value { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
/* Gráfico SVG (préstamos por mes) */
.b-chart { width: 100%; min-width: 0; }
.b-chart svg { width: 100%; height: auto; overflow: visible; }
.b-chart__bar { fill: var(--chart-1); }
.b-chart__bar--current { fill: var(--chart-2); }
.b-chart__bar:hover { opacity: 0.85; }
.b-chart__grid { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.b-chart__axis { stroke: var(--line-strong); stroke-width: 1; shape-rendering: crispEdges; }
.b-chart__label { fill: var(--text-2); font-family: var(--font-sans); font-size: 11px; font-variant-numeric: tabular-nums; }
.b-chart__value { fill: var(--text); font-family: var(--font-sans); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.b-legend { display: flex; flex-wrap: wrap; gap: var(--s-4); font-size: var(--fs-sm); color: var(--text-2); }
.b-legend__key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; background: var(--chart-1); }

/* ---------------------------------------------------------------------
   15. PORTADAS
   --------------------------------------------------------------------- */
/* Portada 2:3 con lomo sombreado; contiene <img> (asset) o <svg> generado */
.b-cover {
  position: relative; flex: none;
  width: var(--cover-w, 120px);
  aspect-ratio: 2 / 3;
  border-radius: var(--r-book);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--sh-cover);
  isolation: isolate;
}
.b-cover > img, .b-cover > svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.b-cover::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; background: linear-gradient(90deg, rgba(0, 0, 0, 0.22) 0, rgba(0, 0, 0, 0.06) 2.5%, rgba(255, 255, 255, 0.14) 4%, rgba(255, 255, 255, 0) 8%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); z-index: 1; }
.b-cover--xs { --cover-w: 30px; box-shadow: 0 1px 2px rgba(6, 32, 64, 0.25); border-radius: 1px 2px 2px 1px; }
.b-cover--sm { --cover-w: 48px; box-shadow: var(--sh-raise); }
.b-cover--md { --cover-w: 120px; }
.b-cover--lg { --cover-w: 220px; }
.b-cover--fluid { --cover-w: 100%; }
.b-cover--empty { display: grid; place-items: center; color: var(--text-3); background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--hover) 6px 7px); }
.b-cover--empty .b-icon { position: relative; z-index: 2; }

/* Cuadrícula de portadas (catálogo en modo cuadrícula, recientes) */
.b-grid-covers { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s-6) var(--s-5); min-width: 0; }
.b-grid-covers--compact { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: var(--s-5) var(--s-4); }
.b-grid-covers__item { position: relative; display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; color: inherit; text-decoration: none; border-radius: var(--r-sm); }
.b-grid-covers__item:hover { text-decoration: none; }
.b-grid-covers__item .b-cover { transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease); }
.b-grid-covers__item:hover .b-cover { transform: translateY(-3px); box-shadow: var(--sh-pop); }
.b-grid-covers__item:focus-visible { outline: none; }
.b-grid-covers__item:focus-visible .b-cover { outline: 2px solid var(--focus); outline-offset: 3px; }
.b-grid-covers__title { font-family: var(--font-serif); font-size: var(--fs-lg); font-weight: 500; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.b-grid-covers__author { font-size: var(--fs-sm); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: -4px; }
.b-grid-covers__check { position: absolute; top: 6px; left: 6px; z-index: 3; }
.b-grid-covers__item[aria-selected="true"] .b-cover { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 600px) { .b-grid-covers { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: var(--s-5) var(--s-3); } .b-grid-covers__title { font-size: var(--fs-base); } }

/* Ficha del libro: portada + cuerpo */
.b-book { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--s-8); align-items: start; }
.b-book__aside { display: flex; flex-direction: column; gap: var(--s-4); position: sticky; top: var(--s-4); }
.b-book__aside .b-cover { --cover-w: 100%; }
.b-book__actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.b-book__actions > .b-btn--primary { grid-column: 1 / -1; }
.b-book__eyebrow { font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-ink); }
.b-book__title { font-family: var(--font-serif); font-size: var(--fs-4xl); font-weight: 500; line-height: 1.08; letter-spacing: -0.012em; margin-top: var(--s-1); overflow-wrap: anywhere; }
.b-book__subtitle { font-family: var(--font-serif); font-style: italic; font-size: var(--fs-xl); color: var(--text-2); margin-top: var(--s-1); line-height: var(--lh-snug); }
.b-book__authors { font-size: var(--fs-lg); margin-top: var(--s-3); }
.b-book__meta { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); color: var(--text-2); font-size: var(--fs-ui); margin-top: var(--s-2); }
.b-book__meta > * + *::before { content: "·"; margin-right: var(--s-3); color: var(--line-strong); }
.b-book__nav { display: flex; align-items: center; gap: var(--s-1); font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; }
.b-prose { font-family: var(--font-serif); font-size: 1.125rem; line-height: 1.6; max-width: 66ch; color: var(--text); }
.b-prose p + p { margin-top: 0.8em; }
@media (max-width: 900px) {
  .b-book { grid-template-columns: 150px minmax(0, 1fr); gap: var(--s-5); }
  .b-book__title { font-size: var(--fs-3xl); }
}
@media (max-width: 600px) {
  .b-book { grid-template-columns: minmax(0, 1fr); gap: var(--s-4); }
  .b-book__aside { position: static; display: grid; grid-template-columns: 104px minmax(0, 1fr); align-items: start; gap: var(--s-4); }
  .b-book__aside .b-cover { --cover-w: 104px; }
  .b-book__title { font-size: var(--fs-2xl); }
  .b-book__actions { grid-template-columns: 1fr 1fr; }
}

/* Índice (tabla de contenido) con niveles data-level="1..4" */
.b-toc { counter-reset: none; display: flex; flex-direction: column; }
.b-toc__item { display: flex; align-items: baseline; gap: var(--s-3); padding: 7px 0; border-bottom: 1px dotted var(--line-strong); font-family: var(--font-serif); font-size: var(--fs-lg); line-height: 1.3; min-width: 0; }
.b-toc__item[data-level="2"] { padding-left: 22px; font-size: var(--fs-base); }
.b-toc__item[data-level="3"] { padding-left: 44px; font-size: var(--fs-base); color: var(--text-2); }
.b-toc__item[data-level="4"] { padding-left: 66px; font-size: var(--fs-ui); color: var(--text-2); }
.b-toc__item mark { background: var(--selection); color: inherit; border-radius: 2px; padding: 0 1px; }
.b-toc__item--done .b-toc__title { color: var(--text-2); text-decoration: line-through; text-decoration-color: var(--gold); }
.b-toc__title { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }

/* Historial (línea de tiempo) */
.b-timeline { position: relative; display: flex; flex-direction: column; gap: var(--s-4); padding-left: 22px; }
.b-timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1px; background: var(--line-strong); }
.b-timeline__item { position: relative; font-size: var(--fs-ui); }
.b-timeline__item::before { content: ""; position: absolute; left: -20px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--gold); }
.b-timeline__time { display: block; font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }

/* Árbol de ubicaciones: filas con style="--level:2" */
.b-tree { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-1); }
.b-tree__row { display: flex; align-items: center; gap: var(--s-2); min-height: 38px; padding: 0 var(--s-2) 0 calc(var(--level, 0) * 22px + 8px); border-radius: var(--r-sm); font-size: var(--fs-ui); color: var(--text); min-width: 0; text-align: left; width: 100%; }
.b-tree__row:hover { background: var(--hover); }
.b-tree__row[aria-selected="true"] { background: var(--surface-3); box-shadow: inset 2px 0 0 var(--accent); }
.b-tree__toggle { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: var(--r-xs); color: var(--text-3); flex: none; }
.b-tree__toggle .b-icon { width: 16px; height: 16px; transition: transform var(--dur-1) var(--ease); transform: rotate(-90deg); }
.b-tree__toggle[aria-expanded="true"] .b-icon { transform: none; }
.b-tree__name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-tree__count { font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------
   16. PASOS (asistente "Nuevo préstamo")
   --------------------------------------------------------------------- */
/* <ol class="b-steps"><li class="b-steps__item is-done|aria-current="step""> */
.b-steps { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-5); min-width: 0; counter-reset: b-step; }
.b-steps__item { display: flex; align-items: center; gap: var(--s-2); flex: 1 1 0; min-width: 0; color: var(--text-3); font-size: var(--fs-ui); font-weight: 600; counter-increment: b-step; }
.b-steps__item:last-child { flex: none; }
.b-steps__num { display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--control-border); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; background: var(--surface); }
.b-steps__num:empty::before { content: counter(b-step); }
.b-steps__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-steps__item:not(:last-child)::after { content: ""; flex: 1 1 auto; height: 1px; min-width: 12px; background: var(--line-strong); margin-left: var(--s-1); }
.b-steps__item[aria-current="step"] { color: var(--text); }
.b-steps__item[aria-current="step"] .b-steps__num { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.b-steps__item.is-done { color: var(--text-2); }
.b-steps__item.is-done .b-steps__num { border-color: var(--st-ok-dot); color: var(--st-ok); background: var(--st-ok-bg); }
.b-steps__item.is-done::after { background: var(--st-ok-dot); }
@media (max-width: 600px) { .b-steps__item:not([aria-current="step"]) .b-steps__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }

/* ---------------------------------------------------------------------
   17. AVISOS: BANNER, VACÍO, ESQUELETO
   --------------------------------------------------------------------- */
/* Banner a todo el ancho (demo, visitante, sin conexión) o en línea (.b-banner--inline) */
.b-banner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); padding: var(--s-2) var(--gutter); min-height: 42px; font-size: var(--fs-ui); line-height: 1.4; background: var(--accent-soft); color: var(--accent-ink); border-bottom: 1px solid var(--line); }
.b-banner > .b-icon { width: 18px; height: 18px; flex: none; }
.b-banner__text { flex: 1 1 240px; min-width: 0; }
.b-banner__text strong { font-weight: 700; }
.b-banner__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin-left: auto; }
.b-banner__actions .b-select { width: auto; min-height: 30px; font-size: var(--fs-sm); background-color: var(--surface); }
.b-banner--inline { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); margin-bottom: var(--s-4); }
.b-banner--info { background: var(--accent-soft); color: var(--accent-ink); }
.b-banner--ok { background: var(--st-ok-bg); color: var(--st-ok); border-color: transparent; }
.b-banner--warn { background: var(--st-wait-bg); color: var(--st-wait); border-color: transparent; }
.b-banner--danger { background: var(--st-late-bg); color: var(--st-late); border-color: transparent; }
/* Modo demostración: dorado con rayado sutil y filete */
.b-banner--demo {
  background-color: var(--demo-bg);
  background-image: repeating-linear-gradient(-45deg, transparent 0 10px, rgba(180, 134, 65, 0.07) 10px 20px);
  color: var(--demo-text);
  border-bottom: 1px solid var(--demo-rule);
  padding-top: max(var(--s-2), env(safe-area-inset-top));
}
.b-banner--demo > .b-icon { color: var(--gold); }
@media (max-width: 600px) { .b-banner { padding-left: var(--s-4); padding-right: var(--s-4); font-size: var(--fs-sm); } .b-banner__actions { margin-left: 0; width: 100%; } }

/* Estado vacío con acción */
.b-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-2); padding: var(--s-12) var(--s-5); color: var(--text-2); max-width: 520px; margin: 0 auto; }
.b-empty__art { position: relative; display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: var(--s-2); color: var(--gold); border-radius: 50%; background: var(--gold-soft); }
.b-empty__art .b-icon { width: 30px; height: 30px; stroke-width: 1.25; }
.b-empty__art::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 1px solid var(--gold); opacity: 0.45; }
.b-empty__title { font-family: var(--font-serif); font-size: var(--fs-xl); font-weight: 500; color: var(--text); }
.b-empty__text { max-width: 46ch; font-size: var(--fs-base); }
.b-empty__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-2); margin-top: var(--s-3); }
.b-empty--compact { padding: var(--s-8) var(--s-4); }
.b-empty--compact .b-empty__art { width: 48px; height: 48px; }
.b-empty--compact .b-empty__art .b-icon { width: 24px; height: 24px; }
.b-empty--error .b-empty__art { color: var(--st-late); background: var(--st-late-bg); }
.b-empty--error .b-empty__art::after { border-color: var(--st-late-dot); }

/* Esqueleto de carga */
.b-skeleton { display: block; background: linear-gradient(90deg, var(--skeleton-a) 0%, var(--skeleton-b) 40%, var(--skeleton-a) 80%); background-size: 300% 100%; animation: b-shimmer 1.4s linear infinite; border-radius: var(--r-xs); }
.b-skeleton--text { height: 0.8em; margin: 0.35em 0; }
.b-skeleton--title { height: 1.4em; width: 60%; margin-bottom: var(--s-2); }
.b-skeleton--cover { aspect-ratio: 2 / 3; width: var(--cover-w, 120px); border-radius: var(--r-book); }
.b-skeleton--circle { border-radius: 50%; width: 30px; height: 30px; }
.b-skeleton--row { height: 48px; border-radius: 0; margin-bottom: 1px; }
.b-skeleton--stat { height: 104px; border-radius: var(--r-md); }

/* ---------------------------------------------------------------------
   18. CAPAS: FONDO, DIÁLOGO, CAJÓN, MENÚ, TOAST, PALETA
   --------------------------------------------------------------------- */
/* Fondo oscurecido que centra un diálogo */
.b-backdrop { position: fixed; inset: 0; z-index: var(--z-dialog); display: flex; align-items: center; justify-content: center; padding: var(--s-4); padding-top: max(var(--s-4), env(safe-area-inset-top)); background: var(--backdrop); animation: b-fade var(--dur-2) var(--ease); }
.b-backdrop--top { align-items: flex-start; padding-top: max(min(12vh, 120px), env(safe-area-inset-top)); z-index: var(--z-cmdk); }  /* paleta de comandos */
.b-backdrop--plain { display: block; padding: 0; z-index: calc(var(--z-drawer) - 1); }                               /* detrás de un cajón */

/* Diálogo: role="dialog" aria-modal="true" aria-labelledby */
.b-dialog { position: relative; display: flex; flex-direction: column; width: min(560px, 100%); max-height: 100%; background: var(--surface); color: var(--text); border-radius: var(--r-lg); box-shadow: var(--sh-overlay); animation: b-pop var(--dur-2) var(--ease); min-width: 0; }
.b-dialog--sm { width: min(420px, 100%); }
.b-dialog--lg { width: min(780px, 100%); }
.b-dialog__header { display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-5) var(--s-5) var(--s-3); }
.b-dialog__icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--gold-soft); color: var(--gold-ink); }
.b-dialog--danger .b-dialog__icon { background: var(--danger-soft); color: var(--danger); }
.b-dialog__title { flex: 1 1 auto; min-width: 0; font-family: var(--font-serif); font-size: var(--fs-xl); font-weight: 500; line-height: var(--lh-snug); padding-top: 4px; }
.b-dialog__close { margin: -4px -8px 0 0; }
.b-dialog__body { padding: 0 var(--s-5) var(--s-5); overflow-y: auto; min-height: 0; color: var(--text-2); }
.b-dialog__body > * + * { margin-top: var(--s-3); }
.b-dialog__footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s-2); padding: var(--s-3) var(--s-5); border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.b-dialog__footer-note { margin-right: auto; align-self: center; font-size: var(--fs-sm); color: var(--text-3); }
@media (max-width: 600px) {
  .b-backdrop:not(.b-backdrop--top):not(.b-backdrop--plain) { align-items: flex-end; padding: 0; }
  .b-dialog { width: 100%; max-height: 92%; border-radius: var(--r-lg) var(--r-lg) 0 0; animation-name: b-sheet; }
  .b-dialog--full { height: 100%; max-height: 100%; border-radius: 0; }
  /* Pantalla completa: el cuerpo ocupa el alto libre y el pie queda abajo */
  .b-dialog--full > .b-dialog__body { flex: 1 1 auto; }
  .b-dialog__footer { border-radius: 0; padding-bottom: max(var(--s-3), env(safe-area-inset-bottom)); flex-direction: column-reverse; }
  .b-dialog__footer > .b-btn { width: 100%; min-height: 44px; }
  .b-dialog__footer-note { margin: 0; text-align: center; }
}

/* Cajón lateral (detalle de persona, filtros en móvil) */
.b-drawer { position: fixed; top: 0; bottom: 0; right: 0; z-index: var(--z-drawer); display: flex; flex-direction: column; width: min(440px, 100%); background: var(--surface); box-shadow: var(--sh-overlay); animation: b-drawer-r var(--dur-3) var(--ease); padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); padding-right: env(safe-area-inset-right); }
.b-drawer--left { right: auto; left: 0; animation-name: b-drawer-l; }
.b-drawer__header { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line); }
.b-drawer__title { flex: 1 1 auto; min-width: 0; font-family: var(--font-serif); font-size: var(--fs-xl); font-weight: 500; }
.b-drawer__body { flex: 1 1 auto; overflow-y: auto; padding: var(--s-5); min-height: 0; }
.b-drawer__footer { display: flex; gap: var(--s-2); justify-content: flex-end; padding: var(--s-3) var(--s-5); border-top: 1px solid var(--line); background: var(--surface-2); }

/* Menú desplegable: .b-menu-anchor (relativo) > botón + .b-menu role="menu" */
.b-menu-anchor { position: relative; display: inline-flex; }
.b-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: var(--z-menu); min-width: 220px; max-width: min(320px, calc(100vw - 32px)); padding: var(--s-1); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh-pop); animation: b-menu-in var(--dur-1) var(--ease); transform-origin: top left; }
.b-menu--end { left: auto; right: 0; transform-origin: top right; }
.b-menu--up { top: auto; bottom: calc(100% + 6px); transform-origin: bottom left; }
.b-menu__label { padding: var(--s-2) var(--s-3) var(--s-1); font-size: var(--fs-2xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.b-menu__item { display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: 34px; padding: 0 var(--s-3); border-radius: var(--r-sm); color: var(--text); font-size: var(--fs-ui); text-align: left; text-decoration: none; }
.b-menu__item:hover, .b-menu__item:focus-visible { background: var(--hover); outline: none; text-decoration: none; }
.b-menu__item:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.b-menu__item .b-icon { width: 18px; height: 18px; color: var(--text-2); }
.b-menu__item[aria-checked="true"]::after { content: ""; margin-left: auto; width: 16px; height: 16px; background: var(--accent); -webkit-mask: var(--i-check) center / 16px no-repeat; mask: var(--i-check) center / 16px no-repeat; }
.b-menu__item[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.b-menu__item--danger, .b-menu__item--danger .b-icon { color: var(--danger); }
.b-menu__item--danger:hover { background: var(--danger-soft); }
.b-menu__hint { margin-left: auto; font-size: var(--fs-xs); color: var(--text-3); }
.b-menu__sep { height: 1px; margin: var(--s-1) calc(-1 * var(--s-1)); background: var(--line); }

/* Toasts: contenedor role="status" aria-live="polite" */
.b-toaster { position: fixed; right: max(var(--s-5), env(safe-area-inset-right)); bottom: max(var(--s-5), env(safe-area-inset-bottom)); z-index: var(--z-toast); display: flex; flex-direction: column; align-items: flex-end; gap: var(--s-2); pointer-events: none; max-width: calc(100vw - 32px); }
.b-toast { pointer-events: auto; position: relative; display: flex; align-items: center; gap: var(--s-3); min-width: min(320px, 100%); max-width: 460px; padding: var(--s-3) var(--s-2) var(--s-3) var(--s-4); background: var(--toast-bg); color: var(--toast-text); border-radius: var(--r-md); box-shadow: var(--sh-pop); font-size: var(--fs-ui); overflow: hidden; animation: b-rise var(--dur-2) var(--ease); --focus: var(--toast-action); }
.b-toast > .b-icon { width: 18px; height: 18px; flex: none; }
.b-toast--ok > .b-icon { color: var(--toast-ok); }
.b-toast--error > .b-icon { color: var(--toast-err); }
.b-toast__msg { flex: 1 1 auto; min-width: 0; }
.b-toast__action { flex: none; padding: 6px 10px; border-radius: var(--r-sm); color: var(--toast-action); font-weight: 700; font-size: var(--fs-ui); }
.b-toast__action:hover { background: rgba(127, 127, 127, 0.18); }
.b-toast__close { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--r-sm); color: inherit; opacity: 0.7; }
.b-toast__close:hover { opacity: 1; background: rgba(127, 127, 127, 0.18); }
/* Cuenta regresiva del Deshacer: style="--toast-duration:10s" */
.b-toast__progress { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--toast-action); transform-origin: left; animation: b-countdown var(--toast-duration, 10s) linear forwards; }
.b-toast:hover .b-toast__progress, .b-toast:focus-within .b-toast__progress { animation-play-state: paused; }
@media (max-width: 600px) {
  .b-toaster { left: var(--s-4); right: var(--s-4); align-items: stretch; bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom) + var(--s-3)); max-width: none; }
  .app-shell--no-bottomnav ~ .b-toaster, .b-toaster--no-bottomnav { bottom: calc(env(safe-area-inset-bottom) + var(--s-4)); }
  .b-toast { max-width: none; }
}

/* Paleta de comandos (Ctrl/⌘+K) */
.b-cmdk { display: flex; flex-direction: column; width: min(640px, 100%); max-height: min(560px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-overlay); overflow: hidden; animation: b-pop var(--dur-2) var(--ease); }
.b-cmdk__input-row { display: flex; align-items: center; gap: var(--s-3); padding: 0 var(--s-4); border-bottom: 1px solid var(--line); }
.b-cmdk__input-row > .b-icon { color: var(--text-3); }
.b-cmdk__input { flex: 1 1 auto; min-width: 0; height: 54px; border: 0; background: transparent; font-size: var(--fs-lg); color: var(--text); }
.b-cmdk__input::placeholder { color: var(--text-3); }
.b-cmdk__input:focus { outline: none; }
.b-cmdk__list { flex: 1 1 auto; overflow-y: auto; padding: var(--s-2); min-height: 0; }
.b-cmdk__group-label { padding: var(--s-3) var(--s-3) var(--s-1); font-size: var(--fs-2xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.b-cmdk__item { position: relative; display: flex; align-items: center; gap: var(--s-3); min-height: 42px; padding: 0 var(--s-3); border-radius: var(--r-sm); color: var(--text); cursor: pointer; min-width: 0; }
.b-cmdk__item .b-icon { color: var(--text-2); }
.b-cmdk__item[aria-selected="true"] { background: var(--surface-3); }
.b-cmdk__item[aria-selected="true"]::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 2px; border-radius: 2px; background: var(--gold); }
.b-cmdk__item-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-cmdk__item-title--book { font-family: var(--font-serif); font-size: var(--fs-lg); }
.b-cmdk__item-meta { flex: none; font-size: var(--fs-xs); color: var(--text-3); max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-cmdk__empty { padding: var(--s-8) var(--s-4); text-align: center; color: var(--text-2); }
.b-cmdk__footer { display: flex; flex-wrap: wrap; gap: var(--s-4); padding: var(--s-2) var(--s-4); border-top: 1px solid var(--line); background: var(--surface-2); font-size: var(--fs-xs); color: var(--text-3); }
.b-cmdk__footer span { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 600px) {
  .b-backdrop--top { padding: 0; padding-top: env(safe-area-inset-top); }
  .b-cmdk { width: 100%; max-height: 100%; height: 100%; border-radius: 0; border: 0; }
  .b-cmdk__footer { display: none; }
}

/* Ayuda de atajos (diálogo "?") */
.b-shortcuts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s-2) var(--s-5); align-items: center; font-size: var(--fs-ui); color: var(--text); }
.b-shortcuts dt { display: flex; gap: 3px; }

/* ---------------------------------------------------------------------
   19. MARCA: EX LIBRIS, BIENVENIDA / SIN ACCESO
   --------------------------------------------------------------------- */
/* Placa "ex libris" para el logo oficial (fondo blanco) en ambos temas */
.b-exlibris { display: inline-block; padding: 10px; background: #FFFFFF; border: 1px solid var(--gold); border-radius: var(--r-xs); box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--gold), var(--sh-raise); }
.b-exlibris img { width: var(--exlibris-w, 168px); height: auto; aspect-ratio: 1; }
/* Palabra de marca en Cinzel (solo "BIBLIOS") */
.b-wordmark { font-family: var(--font-brand); font-weight: 600; letter-spacing: 0.16em; color: var(--text); }

/* Pantalla de bienvenida / sin acceso / carga inicial */
.b-gate { min-height: 100%; display: grid; place-items: center; padding: var(--s-8) var(--s-4); padding-top: max(var(--s-8), env(safe-area-inset-top)); background: radial-gradient(ellipse at 50% 0%, var(--surface) 0%, var(--paper) 60%); }
.b-gate__card { width: min(460px, 100%); display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-3); padding: var(--s-10) var(--s-8); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-raise); }
.b-gate__title { font-family: var(--font-serif); font-size: var(--fs-2xl); font-weight: 500; margin-top: var(--s-2); }
.b-gate__text { color: var(--text-2); max-width: 40ch; }
.b-gate__steps { text-align: left; color: var(--text-2); font-size: var(--fs-ui); padding-left: 1.2em; margin: 0; }
.b-gate__steps li + li { margin-top: var(--s-1); }
.b-gate__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-2); margin-top: var(--s-2); }
.b-gate .b-rule { width: 100%; margin: var(--s-2) 0; }
@media (max-width: 600px) { .b-gate__card { padding: var(--s-8) var(--s-5); } }

/* Saludo del Inicio (lector y bibliotecario) */
.b-greeting { font-family: var(--font-serif); font-size: var(--fs-3xl); font-weight: 500; line-height: var(--lh-tight); }
.b-greeting small { display: block; font-family: var(--font-sans); font-size: var(--fs-base); color: var(--text-2); font-weight: 400; margin-top: var(--s-1); }

/* Accesos rápidos del Inicio */
.b-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: var(--s-3); }
.b-quick__item { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); min-height: 60px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--text); font-weight: 600; text-align: left; text-decoration: none; transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease); }
.b-quick__item:hover { border-color: var(--line-strong); box-shadow: var(--sh-raise); text-decoration: none; }
.b-quick__icon { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: var(--r-sm); background: var(--navy); color: var(--gold-bright); }
:root[data-theme="dark"] .b-quick__icon { background: var(--surface-3); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .b-quick__icon { background: var(--surface-3); } }
.b-quick__hint { display: block; font-size: var(--fs-sm); font-weight: 400; color: var(--text-2); }

/* Rejilla de dos columnas del Inicio/Reportes */
.b-columns { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--s-6); align-items: start; }
@media (max-width: 1100px) { .b-columns { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------------------------------
   20. ANIMACIONES
   --------------------------------------------------------------------- */
@keyframes b-spin { to { transform: rotate(360deg); } }
@keyframes b-fade { from { opacity: 0; } }
@keyframes b-pop { from { opacity: 0; transform: translateY(6px) scale(0.985); } }
@keyframes b-sheet { from { transform: translateY(24px); opacity: 0; } }
@keyframes b-rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes b-menu-in { from { opacity: 0; transform: scale(0.97); } }
@keyframes b-drawer-r { from { transform: translateX(24px); opacity: 0; } }
@keyframes b-drawer-l { from { transform: translateX(-24px); opacity: 0; } }
@keyframes b-shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }
@keyframes b-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(180, 134, 65, 0.55); } 60% { box-shadow: 0 0 0 6px rgba(180, 134, 65, 0); } }
@keyframes b-countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------------------------------------------------------------------
   21. PREFERENCIAS DE ACCESIBILIDAD
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .b-skeleton { animation: none; background: var(--skeleton-a); }
  .b-toast__progress { animation: none; transform: scaleX(0.5); opacity: 0.6; }
  .b-grid-covers__item:hover .b-cover { transform: none; }
  /* El desvanecido de pestañas sigue al scroll (no es movimiento autónomo): conserva su duración automática */
  @supports (animation-timeline: scroll()) { .b-tabs, .b-settings > .b-subnav { animation-duration: auto !important; } }
}
/* Pantallas táctiles: objetivos ≥40px y 16px en campos (evita zoom en iOS) */
@media (pointer: coarse) {
  .b-btn { min-height: 40px; }
  .b-btn--sm { min-height: 36px; }
  .b-btn--icon { width: 40px; }
  .b-btn--icon.b-btn--sm { width: 36px; }
  .b-input, .b-select, .b-textarea { font-size: 1rem; min-height: 42px; }
  .b-menu__item, .b-cmdk__item { min-height: 44px; }
  .b-chip { min-height: 34px; }
  .b-td-actions__inner { opacity: 1 !important; }
}
/* Modo de alto contraste de Windows */
@media (forced-colors: active) {
  .b-badge, .b-chip, .b-callnumber, .b-kbd, .b-card, .b-stat, .b-dialog, .b-menu, .b-cmdk, .b-toast { border: 1px solid CanvasText; }
  .sidebar__item[aria-current="page"], .b-tab[aria-selected="true"], .b-table tbody tr[aria-selected="true"] { outline: 2px solid Highlight; }
  .b-checkbox:checked, .b-checkbox:indeterminate { background-color: Highlight; }
  :focus-visible { outline: 2px solid Highlight; }
}

/* ---------------------------------------------------------------------
   22. AÑADIDOS DEL INTEGRADOR (CONTRACT.md §9.4)
   Clases que los componentes de ui.js necesitan y no existían.
   Solo tokens; ningún color nuevo salvo la placa ex libris (siempre blanca).
   --------------------------------------------------------------------- */
/* Resaltado de coincidencias de búsqueda (ui.Highlight) */
mark, .b-mark { background: var(--selection); color: inherit; border-radius: 2px; padding: 0 1px; }

/* Título de página y <main> reciben foco por código al navegar: sin anillo con ratón */
[data-page-title]:focus:not(:focus-visible), .main:focus:not(:focus-visible) { outline: none; }
/* Bloqueo de scroll de .main mientras hay un diálogo abierto */
.b-noscroll { overflow: hidden !important; }

/* Campos: obligatorio, en línea, contador, ayuda positiva, sugerencia de IA */
.b-label__req { color: var(--danger); margin-left: 2px; font-weight: 600; }
.b-field--inline { flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4); }
.b-field--inline > .b-label { flex: 0 0 180px; }
.b-field--inline > :not(.b-label):not(.b-help):not(.b-error) { flex: 1 1 220px; min-width: 0; }
.b-field--inline > .b-help, .b-field--inline > .b-error { flex-basis: 100%; }
.b-field__foot { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-3); min-width: 0; }
.b-field__count { margin-left: auto; font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.b-field__count--over { color: var(--danger); font-weight: 600; }
.b-help--ok { display: flex; align-items: center; gap: 6px; color: var(--st-ok); font-weight: 500; }
.b-help--ok .b-icon { width: 16px; height: 16px; }
.b-field--suggested .b-input, .b-field--suggested .b-textarea, .b-field--suggested .b-select, .b-field--suggested .b-tokens { border-color: var(--gold); background-color: var(--gold-soft); }

/* Interruptor: texto visible del estado ("Activado"/"Desactivado") */
.b-switch-row__state { font-weight: 400; font-size: var(--fs-sm); color: var(--text-2); }

/* Grupo de radios: <fieldset class="b-radios"><legend class="b-label"> */
.b-radios { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.b-radios > legend { padding: 0; margin-bottom: var(--s-2); }
.b-radios--inline { flex-direction: row; flex-wrap: wrap; gap: var(--s-2) var(--s-5); }
.b-radios--inline > legend { flex-basis: 100%; }

/* Combobox / lista de sugerencias (ui.Combobox, ui.TagInput): role="combobox" + role="listbox" */
.b-combobox { position: relative; min-width: 0; }
.b-listbox { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: var(--z-menu); max-height: 280px; overflow-y: auto; padding: var(--s-1); margin: 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh-pop); animation: b-menu-in var(--dur-1) var(--ease); }
.b-listbox__option { display: flex; align-items: center; gap: var(--s-2); min-height: 34px; padding: 0 var(--s-3); border-radius: var(--r-sm); color: var(--text); font-size: var(--fs-ui); cursor: pointer; min-width: 0; }
.b-listbox__option:hover { background: var(--hover); }
.b-listbox__option[aria-selected="true"] { background: var(--surface-3); box-shadow: inset 2px 0 0 var(--accent); }
.b-listbox__option[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.b-listbox__label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-listbox__hint { flex: none; font-size: var(--fs-xs); color: var(--text-3); }
.b-listbox__group { padding: var(--s-2) var(--s-3) var(--s-1); font-size: var(--fs-2xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.b-listbox__empty { padding: var(--s-3); font-size: var(--fs-sm); color: var(--text-2); }
@media (pointer: coarse) { .b-listbox__option { min-height: 44px; } }

/* "Mostrar N más" bajo tablas y cuadrículas (ui.LoadMore, ui.DataTable) */
.b-loadmore { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--s-2) var(--s-4); padding: var(--s-4) 0; }
.b-loadmore__count { font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; }

/* Paso completado clicable dentro de .b-steps__item */
.b-steps__link { display: inline-flex; align-items: center; gap: var(--s-2); min-width: 0; color: inherit; font: inherit; border-radius: var(--r-sm); }
.b-steps__link:hover .b-steps__label { text-decoration: underline; }

/* Giro de carga en otros tamaños */
.b-spinner--sm { width: 14px; height: 14px; border-width: 2px; }
.b-spinner--lg { width: 28px; height: 28px; border-width: 3px; }

/* Toast de aviso */
.b-toast--warn > .b-icon { color: var(--toast-action); }

/* Disponibilidad: ejemplar apartado */
.b-avail__spine--apartado { background: var(--st-wait-dot); }

/* Insignias: alias de estado para todos los valores de CONTRACT.md §9.2 */
.b-badge--apartado, .b-badge--por-vencer { background: var(--st-wait-bg); color: var(--st-wait); --dot: var(--st-wait-dot); }
.b-badge--activo { background: var(--st-loan-bg); color: var(--st-loan); --dot: var(--st-loan-dot); }
.b-badge--devuelto { background: var(--st-ok-bg); color: var(--st-ok); --dot: var(--st-ok-dot); }
.b-badge--liberada { background: var(--st-off-bg); color: var(--st-off); --dot: var(--st-off-dot); }

/* Acciones al final de una fila del árbol de ubicaciones */
.b-tree__item { display: flex; align-items: center; gap: var(--s-1); min-width: 0; border-radius: var(--r-sm); }
.b-tree__item:hover { background: var(--hover); }
.b-tree__item > .b-tree__row { flex: 1 1 auto; }
.b-tree__item > .b-tree__row:hover { background: transparent; }
.b-tree__actions { display: inline-flex; gap: 2px; flex: none; padding-right: var(--s-1); }
@media (hover: hover) and (min-width: 901px) {
  .b-tree__actions { opacity: 0; transition: opacity var(--dur-1) var(--ease); }
  .b-tree__item:hover .b-tree__actions, .b-tree__item:focus-within .b-tree__actions { opacity: 1; }
}

/* Fila de tabla enfocable con teclado */
.b-table tbody tr:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* Monograma de respaldo dentro de la placa ex libris (placa siempre blanca) */
.b-exlibris__mark { display: block; margin: 10%; color: #062040; --gold: #B48641; }

/* ---- src/css/30-catalog.css ---- */
/* =====================================================================
   BIBLIOS · src/css/30-catalog.css (D3 · catálogo y ficha)
   Solo tokens de styles.css y selectores con prefijo vc-.
   ===================================================================== */

/* Catálogo · barra y filtros */
.vc-search { flex: 1 1 420px; max-width: 720px; }
.vc-sort { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); color: var(--text-2); }
.vc-sort .b-select { width: auto; }
.vc-filter-combo { flex: 0 1 240px; min-width: 180px; }
.vc-filter-combo .b-input { min-height: 32px; font-size: var(--fs-ui); }
.vc-filters-stack .vc-filter-combo { flex: none; min-width: 0; }
.vc-capped { text-align: center; padding: var(--s-3) 0; }

/* Catálogo · celdas de la tabla */
.vc-loc { display: inline-flex; align-items: baseline; gap: 4px; max-width: 240px; min-width: 0; }
.vc-note { display: inline-block; max-width: 220px; vertical-align: middle; }

/* Catálogo · cuadrícula (casilla visible al pasar, al enfocar o con selección) */
.vc-grid-cell { position: relative; min-width: 0; }
.vc-grid-cell .b-cover { --cover-w: 100%; }
.vc-grid-cell .b-grid-covers__check { opacity: 0; transition: opacity var(--dur-1) var(--ease); }
.vc-grid-cell:hover .b-grid-covers__check,
.vc-grid-cell:focus-within .b-grid-covers__check,
.vc-grid--selecting .b-grid-covers__check { opacity: 1; }
.vc-grid-cell .b-grid-covers__check .b-checkbox { box-shadow: var(--sh-raise); }
.vc-grid-cell.is-selected .b-cover { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (hover: none) { .vc-grid-cell .b-grid-covers__check { opacity: 1; } }

/* Catálogo · lista móvil */
.vc-list-item { cursor: pointer; }
.vc-list-item:hover { background: var(--hover); }
.vc-list-check { display: inline-flex; align-items: center; flex: none; }

/* Ficha */
.vc-book-top { margin-bottom: var(--s-3); }
.vc-book-main { display: flex; flex-direction: column; gap: var(--s-5); min-width: 0; }
.vc-book-head { display: flex; flex-direction: column; min-width: 0; }
.vc-book-tags { margin-top: var(--s-3); gap: var(--s-2) var(--s-4); }
.vc-locs { display: flex; flex-direction: column; gap: var(--s-1); font-size: var(--fs-sm); color: var(--text-2); min-width: 0; }
.vc-locs li { display: flex; align-items: flex-start; gap: var(--s-2); min-width: 0; }
.vc-locs li .b-icon { margin-top: 2px; color: var(--text-3); }
.vc-locs .b-link { text-align: left; overflow-wrap: anywhere; font-weight: 400; }
.vc-subhead { margin-bottom: var(--s-3); }
.vc-toc-search { flex: 1 1 280px; min-width: 0; max-width: 420px; }
.vc-hist-by { font-size: var(--fs-sm); flex-wrap: wrap; }

/* Mis notas */
.vc-notes-head { align-items: flex-start; gap: var(--s-3); }
.vc-notes-head__text { min-width: 0; }
.vc-chapter .b-toc__item { align-items: center; }
.vc-chapter__note { padding: var(--s-2) 0 var(--s-3) var(--s-8); }
@media (max-width: 600px) {
  .vc-chapter__note { padding-left: var(--s-4); }
  .vc-search { flex-basis: 100%; max-width: none; }
  .vc-loc, .vc-note { max-width: 100%; }
}

/* ---- src/css/31-add.css ---- */
/* =====================================================================
   BIBLIOS · src/css/31-add.css — ajustes locales de views-add.js (D4)
   Solo selectores con prefijo va-, solo var(--token). CONTRACT.md §0.
   ===================================================================== */

/* Formulario del libro: anclas de sección a la izquierda solo en > 1100 px */
.va-form { max-width: 780px; min-width: 0; }
.va-layout { display: block; min-width: 0; }
.va-sections { min-width: 0; }
.va-anchors { display: none; }
@media (min-width: 1101px) {
  .va-page, .va-form { max-width: 980px; }
  .va-layout { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: var(--s-8); align-items: start; }
  .va-anchors { display: flex; position: sticky; top: var(--s-4); }
}
.va-section { scroll-margin-top: var(--s-4); }
.va-section:focus { outline: none; }
.va-section:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: var(--r-sm); }

/* Portada: vista previa + opciones */
.va-cover-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--s-6); align-items: start; }
.va-cover-preview { min-width: 0; }
@media (max-width: 600px) {
  .va-cover-grid { grid-template-columns: minmax(0, 1fr); }
  .va-cover-preview { max-width: 160px; }
}

/* Editor del índice */
.va-toc-item { align-items: center; }
.va-toc-input { flex: 1 1 auto; min-width: 0; font-family: var(--font-sans); }
.va-toc-actions { display: inline-flex; flex: none; gap: 2px; }
@media (max-width: 600px) {
  .va-toc-item { flex-wrap: wrap; }
  .va-toc-actions { width: 100%; justify-content: flex-end; }
}

/* Cifras compactas del respaldo */
.va-stats .b-stat__value { font-size: var(--fs-2xl); }

/* Listas desplegables de avisos y fallidos */
.va-details > summary { cursor: pointer; padding: var(--s-1) 0; }
.va-details > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-xs); }

/* Lista «Agregados en esta sesión»: resaltado breve (solo opacidad) y filas deshechas */
.va-flash { position: relative; isolation: isolate; }
.va-flash::after { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--accent-soft); opacity: 0; pointer-events: none; animation: va-flash 1s var(--ease); }
@keyframes va-flash { from { opacity: 1; } to { opacity: 0; } }
.va-undone .b-list__title, .va-undone .b-list__meta { color: var(--text-3); }

/* ---- src/css/32-circ.css ---- */
/* BIBLIOS · src/css/32-circ.css — ajustes locales de views-circ.js (D5, prefijo vl-). Solo tokens. */

/* Filas de lista que son botones o enlaces (resultados, directorio): todo el ancho, texto a la izquierda */
.vl-rowbtn { width: 100%; text-align: left; text-decoration: none; }
.vl-rowbtn .b-list__title,
.vl-rowbtn .b-list__meta { display: block; }
.vl-rowbtn:focus-visible { outline-offset: -2px; }

/* Resultados de búsqueda dentro de diálogos: altura acotada con desplazamiento propio */
.vl-results { max-height: 320px; overflow-y: auto; }

/* Asistente de nuevo préstamo: evita saltos de altura entre pasos */
.vl-np { min-height: 320px; }

/* Campo de devolución rápida sobre las pestañas */
.vl-quickscan { max-width: 640px; }

/* Notas escritas por personas: respetan saltos de línea y nunca desbordan */
.vl-note { white-space: pre-line; overflow-wrap: anywhere; }

/* Metadatos largos de un préstamo (detalle de Personas): pueden partirse en dos líneas */
.vl-meta-wrap { white-space: normal; overflow-wrap: anywhere; }

/* Botones de fila que se reacomodan en pantallas angostas */
.vl-actions { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 600px) { .vl-actions { justify-content: flex-start; } }

/* Selector de mes en la barra del historial */
.vl-month { width: auto; min-width: 170px; }

/* Secciones de solicitudes seguidas: menos aire que el título de sección por defecto */
.vl-section .b-section-title { margin-top: var(--s-5); }

/* ---- src/css/33-admin.css ---- */
/* =====================================================================
   BIBLIOS · src/css/33-admin.css (D6, views-admin.js) — ajustes locales
   Solo selectores con prefijo vd- y tokens de styles.css.
   ===================================================================== */

/* Filas desplegables de «Salud del catálogo»: el texto de un <button> se centra por defecto. */
.vd-rowbtn { text-align: left; }

/* ---- src/css/34-auth.css ---- */
/* =====================================================================
   BIBLIOS · src/css/34-auth.css (C, views-auth.js + acción «Entrar» del AppShell)
   Solo en la versión web (--target web). Selectores con prefijo au- y tokens
   de styles.css; sin colores literales ni definición de tokens.
   ===================================================================== */

/* ---------- Entrar: formulario + columna de ayuda ---------- */
.au-split { display: grid; grid-template-columns: minmax(0, 26rem) minmax(0, 1fr); gap: var(--s-8); align-items: start; }
.au-card { box-shadow: var(--sh-raise); }
.au-aside { padding-top: var(--s-2); gap: var(--s-4); }
.au-benefits { display: flex; flex-direction: column; gap: var(--s-3); }
.au-benefits li { display: flex; align-items: flex-start; gap: var(--s-3); color: var(--text); }
.au-benefits .b-icon { color: var(--gold-ink); margin-top: 1px; }
.au-aside .b-rule { margin: var(--s-2) 0; }
@media (max-width: 760px) {
  .au-split { grid-template-columns: minmax(0, 1fr); gap: var(--s-6); }
}

.au-form { gap: var(--s-5); }
.au-note { display: flex; align-items: center; gap: var(--s-2); }
.au-alert:focus { outline: none; }
.au-alert:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-md); }
.au-alert .b-banner--inline { margin-bottom: 0; }
.au-email { overflow-wrap: anywhere; }

/* Separador «o» entre el código por correo y Google */
.au-or { display: flex; align-items: center; gap: var(--s-3); color: var(--text-3); font-size: var(--fs-sm); }
.au-or::before, .au-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Campo del código de 6 dígitos */
.au-code .b-input { font-family: var(--font-mono); font-size: var(--fs-xl); letter-spacing: 0.3em; text-align: center; }
.au-code-actions { gap: var(--s-2) var(--s-4); }

/* ---------- Consentimiento (dentro de .b-gate) ---------- */
.au-gate { text-align: left; gap: var(--s-3); }
.au-gate__list { padding-left: 1.2em; list-style: disc; font-size: var(--fs-ui); }
.au-gate__list li + li { margin-top: var(--s-1); }

/* ---------- Mi cuenta ---------- */
.au-dl { margin-top: var(--s-2); }
.au-gap { margin-top: var(--s-4); }
.au-gap-sm { margin-top: var(--s-2); }
.au-name { max-width: 30rem; }

/* ---------- Miembros ---------- */
.au-h { margin-top: 0; }
.au-roles .b-choice__title, .au-roles .b-choice__desc { display: block; }
.au-self { color: var(--text-3); font-weight: 400; }

/* ---------- Aviso de privacidad ---------- */
.au-prose { max-width: 70ch; color: var(--text); }
.au-prose h2, .au-prose h3 { font-size: var(--fs-xl); margin-top: var(--s-8); margin-bottom: var(--s-2); }
.au-prose h3 { font-size: var(--fs-lg); margin-top: var(--s-6); }
.au-prose p + p, .au-prose p + ul, .au-prose ul + p { margin-top: var(--s-3); }
.au-prose ul { padding-left: 1.25em; list-style: disc; }
.au-prose li + li { margin-top: var(--s-1); }
.au-prose--dialog h3:first-of-type { margin-top: var(--s-5); }
.au-lead { font-family: var(--font-serif); font-size: var(--fs-lg); color: var(--text-2); }
.au-version { margin-top: var(--s-8); }

/* ---------- Botón «Entrar» del lomo (fondo marino): claro para que destaque.
   Clase doble para ganar al primario sin nombrar sus modificadores. ---------- */
.au-signin.au-signin { background: var(--side-strong); border-color: var(--side-strong); color: var(--side-bg); margin-bottom: var(--s-1); }
.au-signin.au-signin:hover:not([aria-disabled="true"]) { background: var(--side-text); border-color: var(--side-text); color: var(--side-bg); }
.au-signin.au-signin:focus-visible { outline-color: var(--side-focus); }
[data-sidebar="collapsed"] .au-signin { padding: 0; }
/* Ya en #entrar: el de la barra superior sobra y el del lomo deja de ser la acción principal. */
.au-signin-top[aria-current="page"] { display: none; }
.au-signin.au-signin[aria-current="page"] { background: transparent; border-color: var(--side-muted); color: var(--side-strong); }
.au-signin.au-signin[aria-current="page"]:hover:not([aria-disabled="true"]) { background: var(--side-line); border-color: var(--side-text); color: var(--side-strong); }

