/*
 * BizoFacto: tokens del sistema de diseño (§21.2 y §21.7 del diseño técnico; dirección visual en
 * 03 §7: «El documento es la interfaz»).
 *
 * Es la primera hoja de cada página: declara el orden de las capas y las propiedades personalizadas.
 * Es el ÚNICO archivo con colores literales (tests/Architecture/CssStyleTest.php): el resto de hojas
 * usan var(--bf-*). Los pares de contraste reales están en resources/design/contrast-pairs.json y
 * los comprueba tests/Architecture/ContrastPairsTest.php.
 *
 * Puntos de ruptura (min-width, mobile-first; las media queries no admiten var()):
 * 480, 768, 1024, 1280 y 1440 px.
 */

@layer reset, tokens, base, layout, components, patterns, utilities, overrides;

@layer tokens {
  /* ---------------------------------------------------------------- fuentes (§21.3) */

  /* Readex Pro 1.205 (OFL, RFN «RevReading Lexend»): HEXP fijado en 0 y wght 500–700, en tres
     subconjuntos. Titulares, nombres de documento y cifras grandes que no se alinean. */
  @font-face {
    font-family: "Readex Pro";
    font-style: normal;
    font-weight: 500 700;
    font-display: swap;
    src: url("../fonts/readex-pro/readex-pro-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  }

  @font-face {
    font-family: "Readex Pro";
    font-style: normal;
    font-weight: 500 700;
    font-display: swap;
    src: url("../fonts/readex-pro/readex-pro-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
  }

  @font-face {
    font-family: "Readex Pro";
    font-style: normal;
    font-weight: 500 700;
    font-display: swap;
    src: url("../fonts/readex-pro/readex-pro-arabic.woff2") format("woff2");
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
  }

  /* IBM Plex Sans 1.1.0 (OFL, RFN «Plex»): subconjuntos originales de IBM sin modificar
     (docs/diseno/fuentes.md), con los unicode-range que publica IBM. Interfaz, cuerpo, tablas y
     todas las cifras que se alinean (§21.1). */
  @font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/plex-sans/plex-sans-400-latin1.woff2") format("woff2");
    unicode-range: U+0000, U+000D, U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+20AC, U+2122, U+2212, U+FB01-FB02;
  }

  @font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/plex-sans/plex-sans-400-latin2.woff2") format("woff2");
    unicode-range: U+0100-0101, U+0104-0130, U+0132-0151, U+0154-017F, U+018F, U+0192, U+01A0-01A1, U+01AF-01B0, U+01FA-01FF, U+0218-021B, U+0237, U+0259, U+1E80-1E85, U+1E9E, U+20A1, U+20A4, U+20A6, U+20A8-20AA, U+20AD-20AE, U+20B1-20B2, U+20B4-20B5, U+20B8-20BA, U+20BD, U+20BF;
  }

  @font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/plex-sans/plex-sans-400-latin3.woff2") format("woff2");
    unicode-range: U+0102-0103, U+01CD-01DC, U+1EA0-1EF9, U+20AB;
  }

  @font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/plex-sans/plex-sans-400-pi.woff2") format("woff2");
    unicode-range: U+0E3F, U+2000-200D, U+2015, U+2028-2029, U+202F, U+2032-2033, U+2070, U+2074-2079, U+2080-2089, U+2113, U+2116, U+2126, U+212E, U+2150-2151, U+2153-215E, U+2190-2199, U+21A9-21AA, U+21B0-21B3, U+21B6-21B7, U+21BA-21BB, U+21C4, U+21C6, U+2202, U+2206, U+220F, U+2211, U+2215, U+221A, U+221E, U+222B, U+2248, U+2260, U+2264-2265, U+25CA, U+2713, U+274C, U+2B0E-2B11, U+ECE0, U+EFCC, U+FEFF, U+FFFD;
  }

  @font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/plex-sans/plex-sans-500-latin1.woff2") format("woff2");
    unicode-range: U+0000, U+000D, U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+20AC, U+2122, U+2212, U+FB01-FB02;
  }

  @font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/plex-sans/plex-sans-500-latin2.woff2") format("woff2");
    unicode-range: U+0100-0101, U+0104-0130, U+0132-0151, U+0154-017F, U+018F, U+0192, U+01A0-01A1, U+01AF-01B0, U+01FA-01FF, U+0218-021B, U+0237, U+0259, U+1E80-1E85, U+1E9E, U+20A1, U+20A4, U+20A6, U+20A8-20AA, U+20AD-20AE, U+20B1-20B2, U+20B4-20B5, U+20B8-20BA, U+20BD, U+20BF;
  }

  @font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/plex-sans/plex-sans-500-latin3.woff2") format("woff2");
    unicode-range: U+0102-0103, U+01CD-01DC, U+1EA0-1EF9, U+20AB;
  }

  @font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/plex-sans/plex-sans-500-pi.woff2") format("woff2");
    unicode-range: U+0E3F, U+2000-200D, U+2015, U+2028-2029, U+202F, U+2032-2033, U+2070, U+2074-2079, U+2080-2089, U+2113, U+2116, U+2126, U+212E, U+2150-2151, U+2153-215E, U+2190-2199, U+21A9-21AA, U+21B0-21B3, U+21B6-21B7, U+21BA-21BB, U+21C4, U+21C6, U+2202, U+2206, U+220F, U+2211, U+2215, U+221A, U+221E, U+222B, U+2248, U+2260, U+2264-2265, U+25CA, U+2713, U+274C, U+2B0E-2B11, U+ECE0, U+EFCC, U+FEFF, U+FFFD;
  }

  @font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/plex-sans/plex-sans-600-latin1.woff2") format("woff2");
    unicode-range: U+0000, U+000D, U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+20AC, U+2122, U+2212, U+FB01-FB02;
  }

  @font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/plex-sans/plex-sans-600-latin2.woff2") format("woff2");
    unicode-range: U+0100-0101, U+0104-0130, U+0132-0151, U+0154-017F, U+018F, U+0192, U+01A0-01A1, U+01AF-01B0, U+01FA-01FF, U+0218-021B, U+0237, U+0259, U+1E80-1E85, U+1E9E, U+20A1, U+20A4, U+20A6, U+20A8-20AA, U+20AD-20AE, U+20B1-20B2, U+20B4-20B5, U+20B8-20BA, U+20BD, U+20BF;
  }

  @font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/plex-sans/plex-sans-600-latin3.woff2") format("woff2");
    unicode-range: U+0102-0103, U+01CD-01DC, U+1EA0-1EF9, U+20AB;
  }

  @font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/plex-sans/plex-sans-600-pi.woff2") format("woff2");
    unicode-range: U+0E3F, U+2000-200D, U+2015, U+2028-2029, U+202F, U+2032-2033, U+2070, U+2074-2079, U+2080-2089, U+2113, U+2116, U+2126, U+212E, U+2150-2151, U+2153-215E, U+2190-2199, U+21A9-21AA, U+21B0-21B3, U+21B6-21B7, U+21BA-21BB, U+21C4, U+21C6, U+2202, U+2206, U+220F, U+2211, U+2215, U+221A, U+221E, U+222B, U+2248, U+2260, U+2264-2265, U+25CA, U+2713, U+274C, U+2B0E-2B11, U+ECE0, U+EFCC, U+FEFF, U+FFFD;
  }

  /* IBM Plex Sans Arabic 1.1.0 (OFL, RFN «Plex»): woff2 completo original de IBM, que solo se
     descarga para texto árabe (unicode-range árabe de §21.3). */
  @font-face {
    font-family: "IBM Plex Sans Arabic";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/plex-sans-arabic/plex-sans-arabic-400.woff2") format("woff2");
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
  }

  @font-face {
    font-family: "IBM Plex Sans Arabic";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/plex-sans-arabic/plex-sans-arabic-500.woff2") format("woff2");
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
  }

  @font-face {
    font-family: "IBM Plex Sans Arabic";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/plex-sans-arabic/plex-sans-arabic-600.woff2") format("woff2");
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
  }

  /* Familias de respaldo con métricas (§21.3): una fuente local ajustada a la anchura media y a
     las alturas de cada fuente web mientras se descarga, para que el texto no salte al cambiar.
     Valores calculados sobre Arial (tools\scripts\fonts_build.py, docs/diseno/fuentes.md). Cada
     una se limita al alfabeto de su fuente web, para no quedarse con caracteres de otra. */
  @font-face {
    font-family: "Readex Pro Fallback";
    src: local("Arial"), local("ArialMT"), local("Helvetica"), local("Liberation Sans");
    size-adjust: 111.99%;
    ascent-override: 89.3%;
    descent-override: 22.32%;
    line-gap-override: 0%;
    unicode-range: U+0000-02FF, U+0304, U+0308, U+0329, U+1E00-1EFF, U+2000-206F, U+20A0-20C0, U+2113, U+2122, U+2191, U+2193, U+2212, U+2215, U+2C60-2C7F, U+A720-A7FF, U+FEFF, U+FFFD;
  }

  @font-face {
    font-family: "Readex Pro Fallback";
    src: local("Arial"), local("ArialMT"), local("Tahoma"), local("Geeza Pro");
    size-adjust: 134.36%;
    ascent-override: 74.43%;
    descent-override: 18.61%;
    line-gap-override: 0%;
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
  }

  @font-face {
    font-family: "IBM Plex Sans Fallback";
    src: local("Arial"), local("ArialMT"), local("Helvetica"), local("Liberation Sans");
    size-adjust: 101.54%;
    ascent-override: 100.94%;
    descent-override: 27.08%;
    line-gap-override: 0%;
    unicode-range: U+0000-02FF, U+0304, U+0308, U+0329, U+1E00-1EFF, U+2000-206F, U+20A0-20C0, U+2113, U+2122, U+2190-2199, U+2212, U+2215, U+2C60-2C7F, U+A720-A7FF, U+FEFF, U+FFFD;
  }

  @font-face {
    font-family: "IBM Plex Sans Arabic Fallback";
    src: local("Arial"), local("ArialMT"), local("Tahoma"), local("Geeza Pro");
    size-adjust: 115.6%;
    ascent-override: 93.86%;
    descent-override: 35.9%;
    line-gap-override: 0%;
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
  }

  /* ---------------------------------------------------------------- propiedades */

  :root {
    color-scheme: light;

    /* Paleta (03 §7 con los refinamientos de contraste de §21.1). */
    --bf-ink: #0C1C3A;              /* Tinta marina */
    --bf-ink-2: #14284D;            /* hover y selección sobre Tinta */
    --bf-on-ink: #FFFFFF;
    --bf-on-ink-muted: #C9D6EA;
    --bf-link-on-ink: #8FBFFF;      /* enlaces, indicador activo y foco sobre Tinta */
    --bf-focus-on-ink: #8FBFFF;
    --bf-rule-on-ink: #2B416B;      /* divisores decorativos sobre Tinta */
    --bf-accent-landing: #12B5A5;   /* único token que cambia brand.color_accent (§17) */

    --bf-blue: #1B6EF3;             /* Azul Facto: fondo primario, selección, gráficos */
    --bf-blue-strong: #1557CF;      /* texto y enlaces */
    --bf-blue-deeper: #0F47B0;      /* hover y pulsado del primario */
    --bf-blue-tint: #E8F0FE;
    --bf-on-blue: #FFFFFF;

    --bf-teal: #12B5A5;             /* Turquesa cobro: solo dinero cobrado, saldo a favor, pagado */
    --bf-teal-mark: #0E9C8E;
    --bf-teal-text: #0A766C;
    --bf-teal-tint: #E7F6F4;

    --bf-paper: #FFFFFF;            /* Papel */
    --bf-canvas: #F3F6FA;           /* Lienzo */
    --bf-rule: #D6DEE9;             /* Regla: divisores y paneles */
    --bf-rule-strong: #7B8AA3;      /* Regla fuerte: bordes de controles */
    --bf-graphite: #4A5873;         /* Grafito: texto secundario */
    --bf-fold: #DCE7F7;             /* pliegue de la esquina doblada (decorativo) */

    /* 1.0.7: barras de desplazamiento finas (base.css). Tinta translúcida: casi invisible en
       reposo (≈ 1,9:1 sobre Papel) y 3,9:1 con el puntero encima, para encontrarla. */
    --bf-scrollbar-thumb: rgb(12 28 58 / 0.3);
    --bf-scrollbar-thumb-hover: rgb(12 28 58 / 0.55);

    /* Estados de documento: marcador (pestaña y punto), texto y tinte. Siempre con texto. */
    --bf-overdue: #D9434B;
    --bf-overdue-text: #B4232C;
    --bf-overdue-tint: #FCEDEE;
    --bf-pending: #C27C0E;
    --bf-pending-text: #8A5A00;
    --bf-pending-tint: #FFF4E0;
    --bf-draft: #7B8AA3;
    --bf-draft-text: #4A5873;
    --bf-draft-tint: #EEF1F5;
    --bf-issued: var(--bf-blue);    /* emitido o enviado: sigue a brand.color_primary (§17) */
    --bf-issued-text: var(--bf-blue-strong);
    --bf-issued-tint: var(--bf-blue-tint);
    --bf-paid: var(--bf-teal-mark);
    --bf-paid-text: var(--bf-teal-text);
    --bf-paid-tint: var(--bf-teal-tint);

    /* Acción destructiva: el rojo de texto de «vencido» como fondo (blanco encima 6,53:1). */
    --bf-danger: #B4232C;
    --bf-danger-deeper: #931C24;
    --bf-on-danger: #FFFFFF;

    /* Series de gráficos: todas ≥ 3:1 sobre Papel y Lienzo, siempre con leyenda y tabla. */
    --bf-chart-1: var(--bf-blue);
    --bf-chart-2: var(--bf-teal-mark);
    --bf-chart-3: var(--bf-ink);
    --bf-chart-4: var(--bf-pending);
    --bf-chart-5: var(--bf-draft);

    /* Alias semánticos: los componentes usan estos y .bf-surface-ink los cambia. */
    --bf-text: var(--bf-ink);
    --bf-text-muted: var(--bf-graphite);
    --bf-surface: var(--bf-paper);
    --bf-background: var(--bf-canvas);
    --bf-border: var(--bf-rule);
    --bf-border-control: var(--bf-rule-strong);
    --bf-link: var(--bf-blue-strong);
    --bf-link-hover: var(--bf-blue-deeper);
    --bf-focus: var(--bf-blue-strong);
    --bf-selection: var(--bf-blue-tint);
    --bf-selection-text: var(--bf-blue-strong);
    --bf-hover: var(--bf-canvas);

    /* Tipografía (§21.2). Readex Pro para titulares; IBM Plex Sans y Plex Sans Arabic para la
       interfaz y para todas las cifras que se alinean o cambian en su sitio (§21.1). */
    --bf-font-display: "Readex Pro", "IBM Plex Sans Arabic", "Readex Pro Fallback", system-ui, sans-serif;
    --bf-font-ui: "IBM Plex Sans", "IBM Plex Sans Arabic", "IBM Plex Sans Fallback", "IBM Plex Sans Arabic Fallback", system-ui, "Segoe UI", sans-serif;
    --bf-type-scale: 1;
    --bf-tracking-display: -0.02em;
    --bf-leading-app: 1.5;
    --bf-leading-landing: 1.6;
    --bf-leading-heading: 1.25;
    --bf-leading-hero: 1.05;
    --bf-measure: 72ch;
    --bf-weight-regular: 400;
    --bf-weight-medium: 500;
    --bf-weight-semibold: 600;
    --bf-weight-bold: 700;

    /* Espaciado, base 4 px. */
    --bf-space-1: 4px;
    --bf-space-2: 8px;
    --bf-space-3: 12px;
    --bf-space-4: 16px;
    --bf-space-5: 20px;
    --bf-space-6: 24px;
    --bf-space-8: 32px;
    --bf-space-10: 40px;
    --bf-space-12: 48px;
    --bf-space-16: 64px;
    --bf-space-20: 80px;
    --bf-space-24: 96px;
    --bf-space-32: 128px;

    /* Forma y profundidad: cuatro radios y cuatro sombras; nada más. raise: el relieve mínimo de
       paneles, tarjetas y botones con relleno (1 px, casi plano); lift: una tarjeta enlazada al
       pasar el puntero. Papel y overlay siguen siendo de documentos y capas superpuestas. */
    --bf-radius-doc: 3px;           /* documentos, con esquina doblada */
    --bf-radius-control: 8px;       /* controles, paneles y contenedores de tabla */
    --bf-radius-overlay: 14px;      /* popovers, menús, diálogos y hojas */
    --bf-radius-pill: 999px;        /* pastillas de estado */
    --bf-shadow-raise: 0 1px 2px rgba(12, 28, 58, 0.06);
    --bf-shadow-lift: 0 1px 2px rgba(12, 28, 58, 0.06), 0 8px 20px -10px rgba(12, 28, 58, 0.22);
    --bf-shadow-paper: 0 1px 0 #D6DEE9, 0 18px 32px -18px rgba(12, 28, 58, 0.28);
    --bf-shadow-overlay: 0 0 0 1px #D6DEE9, 0 24px 48px -16px rgba(12, 28, 58, 0.32);
    --bf-backdrop: rgba(12, 28, 58, 0.48); /* fondo de diálogos y hojas modales (Tinta al 48 %) */
    --bf-fold-size: 18px;           /* lado de la esquina doblada */

    /* Movimiento: solo responde a acciones (salvo el hero de la landing). */
    --bf-dur-fast: 120ms;
    --bf-dur-base: 200ms;
    --bf-dur-slow: 320ms;
    --bf-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    --bf-ease-exit: cubic-bezier(0.4, 0, 1, 1);
    /* Cambio de estado de un control (hover, foco, pulsado): color, fondo, borde, sombra y el
       desplazamiento de 1 px al pulsar. */
    --bf-transition: color var(--bf-dur-fast) var(--bf-ease), background-color var(--bf-dur-fast) var(--bf-ease), border-color var(--bf-dur-fast) var(--bf-ease), box-shadow var(--bf-dur-fast) var(--bf-ease), transform var(--bf-dur-fast) var(--bf-ease);

    /* Capas. */
    --bf-z-sticky: 100;
    --bf-z-header: 200;
    --bf-z-sidebar: 300;
    --bf-z-sheet: 400;
    --bf-z-dialog: 500;
    --bf-z-popover: 600;
    --bf-z-toast: 700;
    --bf-z-skip: 800;

    /* Anchos máximos (requisito 19) y medidas fijas de los shells (§21.10). */
    /* 0.5.0: la web pública centra su contenido en 1200 px (antes, 1440 con el relleno); las
       listas anchas de los paneles siguen en 1440. */
    --bf-max-landing: 1200px;
    --bf-max-wide: 1440px;
    --bf-max-form: 960px;
    --bf-doc-paper-max: 794px;      /* A4 a 96 ppp */
    --bf-installer-column: 640px;
    --bf-sidebar: 240px;
    --bf-sidebar-collapsed: 72px;
    --bf-topbar: 56px;
    --bf-bottombar: 64px;
    --bf-gutter: var(--bf-space-4);

    /* Foco y objetivos: 40 px en escritorio, 32 px solo en barras densas con puntero fino,
       44 px con puntero táctil y 48 px en el TPV. */
    --bf-focus-width: 2px;
    --bf-focus-offset: 2px;
    --bf-control-h: 40px;
    --bf-control-h-dense: 32px;
    --bf-control-h-pos: 48px;
    --bf-icon-stroke: 1.75;
  }

  /* Tamaños de letra: escala ≈ 1,25 (12–61) más 15 (cuerpo de la app) y 18 (cuerpo de la landing).
     Se recalculan en cada elemento con lang para aplicar --bf-type-scale (+6 % en árabe). */
  :root,
  [lang] {
    --bf-fs-12: calc(12px * var(--bf-type-scale));
    --bf-fs-13: calc(13px * var(--bf-type-scale));
    --bf-fs-14: calc(14px * var(--bf-type-scale));
    --bf-fs-15: calc(15px * var(--bf-type-scale));
    --bf-fs-16: calc(16px * var(--bf-type-scale));
    --bf-fs-18: calc(18px * var(--bf-type-scale));
    --bf-fs-20: calc(20px * var(--bf-type-scale));
    --bf-fs-25: calc(25px * var(--bf-type-scale));
    --bf-fs-31: calc(31px * var(--bf-type-scale));
    --bf-fs-39: calc(39px * var(--bf-type-scale));
    --bf-fs-49: calc(49px * var(--bf-type-scale));
    --bf-fs-61: calc(61px * var(--bf-type-scale));
    --bf-fs-hero: calc(clamp(40px, 6vw, 61px) * var(--bf-type-scale));
  }

  /* Árabe: +6 % de tamaño, interlineado 1,7, sin tracking negativo y Plex Sans Arabic delante. */
  :lang(ar) {
    --bf-type-scale: 1.06;
    --bf-tracking-display: 0;
    --bf-leading-app: 1.7;
    --bf-leading-landing: 1.7;
    --bf-leading-heading: 1.45;
    --bf-leading-hero: 1.3;
    --bf-font-ui: "IBM Plex Sans Arabic", "IBM Plex Sans", "IBM Plex Sans Arabic Fallback", "IBM Plex Sans Fallback", system-ui, "Segoe UI", sans-serif;
  }

  /* Un fragmento en otro idioma dentro de una página árabe vuelve a los valores latinos. */
  [lang]:not(:lang(ar)) {
    --bf-type-scale: 1;
    --bf-tracking-display: -0.02em;
    --bf-leading-app: 1.5;
    --bf-leading-landing: 1.6;
    --bf-leading-heading: 1.25;
    --bf-leading-hero: 1.05;
    --bf-font-ui: "IBM Plex Sans", "IBM Plex Sans Arabic", "IBM Plex Sans Fallback", "IBM Plex Sans Arabic Fallback", system-ui, "Segoe UI", sans-serif;
  }

  /* Superficie Tinta: hero y pie de la landing, barra lateral y superior del superadministrador,
     cabecera del TPV y panel de autenticación. Los componentes usan los alias, así que dentro
     cambian solos (foco #8FBFFF, enlaces, texto y bordes). */
  .bf-surface-ink {
    --bf-text: var(--bf-on-ink);
    --bf-text-muted: var(--bf-on-ink-muted);
    --bf-surface: var(--bf-ink);
    --bf-background: var(--bf-ink);
    --bf-border: var(--bf-rule-on-ink);
    --bf-link: var(--bf-link-on-ink);
    --bf-link-hover: var(--bf-on-ink);
    --bf-focus: var(--bf-focus-on-ink);
    --bf-selection: var(--bf-ink-2);
    --bf-selection-text: var(--bf-on-ink);
    --bf-hover: var(--bf-ink-2);
    --bf-scrollbar-thumb: rgb(255 255 255 / 0.28);
    --bf-scrollbar-thumb-hover: rgb(255 255 255 / 0.55);
    color-scheme: dark;
    background-color: var(--bf-ink);
    color: var(--bf-on-ink);
  }

  /* @bundle-omit landing: la web pública no pinta selectores. */
  /* Flecha de los selectores (components.css): el chevron-down del sprite en Grafito como imagen,
     porque un <select> no admite un icono dentro. Es un color literal: por eso vive aquí. */
  .bf-select {
    --bf-select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234A5873' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6l6 -6'/%3E%3C/svg%3E");
  }

  /* Lupa de los campos de búsqueda de las barras de filtros (el icono search del sprite). */
  .bf-filter-bar {
    --bf-search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234A5873' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0'/%3E%3Cpath d='M21 21l-6 -6'/%3E%3C/svg%3E");
  }
  /* @bundle-end */

  @media (pointer: coarse) {
    :root {
      --bf-control-h: 44px;
      --bf-control-h-dense: 44px;
    }
  }

  @media (min-width: 768px) {
    :root {
      --bf-gutter: var(--bf-space-6);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    :root {
      --bf-dur-fast: 0ms;
      --bf-dur-base: 0ms;
      --bf-dur-slow: 0ms;
    }
  }
}
