/* =====================================================================
   FactuDesk web: sistema visual
   ---------------------------------------------------------------------
   Se carga DESPUÉS de Bootstrap 5.3 y Bootstrap Icons (jsdelivr) y de
   Nunito (Google Fonts). Todas las clases propias llevan el prefijo
   «fd-». Los colores, espacios, radios y sombras salen de los tokens
   de :root; ningún módulo debe escribir colores sueltos.

   Índice
     1. Tokens: tema claro
     2. Tokens: tema oscuro
     3. Puente con Bootstrap (variables --bs-*)
     4. Base y tipografía
     5. Armazón (shell): rejilla de la página
     6. Barra superior
     7. Selector de contribuyente (RFC)
     8. Menú lateral y cajón móvil
     9. Página: encabezado, paneles y pie
    10. Botones
    11. Formularios
    12. Avisos
    13. Tarjetas de indicador y saldo de timbres
    14. Accesos rápidos
    15. Barra de filtros y chips
    15b. Sección colapsable (filtros y resúmenes)
    16. Totales por moneda
    17. Tabla de datos, estados y acciones por fila
    18. Tabla como tarjetas en móvil
    19. Paginación
    20. Modal, menú desplegable y toast
    21. Estado vacío y espacio reservado
    22. edit-table (web component de Induxsoft)
    23. Inicio de sesión
    24. Utilidades y movimiento reducido
    25. Botón flotante de ayuda (NIA)
   ===================================================================== */


/* ---------------------------------------------------------------------
   1. Tokens: tema claro
   --------------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* Marca: el verde FactuDesk (#28a745) se usa en rellenos y acentos.
     Para texto y botones con texto blanco se usa el tono 600, que
     cumple AA (5.1:1 sobre blanco). */
  --fd-green-50:  #edf7f0;
  --fd-green-100: #d5eedd;
  --fd-green-200: #a9dcb8;
  --fd-green-500: #28a745;
  --fd-green-600: #1e7e42;
  --fd-green-700: #17673a;
  --fd-green-800: #0f5130;

  --fd-brand:        var(--fd-green-500);   /* acento, barras, indicadores */
  --fd-brand-strong: var(--fd-green-600);   /* texto y botón principal */
  --fd-brand-hover:  var(--fd-green-700);
  --fd-brand-soft:   var(--fd-green-50);    /* fondo de elemento activo */
  --fd-on-brand:     #ffffff;

  /* Barra superior y pie: el gris oscuro de siempre */
  --fd-bar:          #343a40;
  --fd-bar-raised:   #3d444b;               /* botones sobre la barra */
  --fd-bar-line:     #4a5259;
  --fd-on-bar:       #f8f9fa;
  --fd-on-bar-muted: #c3cad0;

  /* Acentos heredados */
  --fd-yellow:       #ffc107;               /* Suscripción, nombre del usuario */
  --fd-yellow-hover: #ffcd39;
  --fd-on-yellow:    #212529;
  --fd-blue:         #0b6bd6;               /* Emitir CFDI (el #007bff de siempre, oscurecido para AA) */
  --fd-blue-hover:   #0959b3;
  --fd-on-blue:      #ffffff;

  /* Superficies y texto */
  --fd-canvas:       #ffffff;               /* zona de trabajo */
  --fd-surface:      #ffffff;               /* paneles */
  --fd-surface-alt:  #f6f8f7;               /* filas alternas, pies de panel */
  --fd-sidebar:      #f8f9fa;               /* menú lateral (bg-light) */
  --fd-border:       #e1e6e3;
  --fd-border-strong:#c9d1cc;
  --fd-text:         #1f2528;
  --fd-text-muted:   #5a646b;               /* 5.9:1 sobre blanco */
  --fd-text-subtle:  #737d84;               /* solo para texto ≥ 14 px seminegrita */
  --fd-heading:      #172023;

  /* Estados (texto / fondo / borde) */
  --fd-info:          #0b6bd6;  --fd-info-bg:    #eaf2fd;  --fd-info-line:    #b9d3f6;
  --fd-success:       #1e7e42;  --fd-success-bg: #edf7f0;  --fd-success-line: #a9dcb8;
  --fd-warning:       #8a5300;  --fd-warning-bg: #fff7e0;  --fd-warning-line: #ffd666;
  --fd-danger:        #b42318;  --fd-danger-bg:  #fdecea;  --fd-danger-line:  #f4b4ad;

  /* Etiquetas de color de comprobantes (0 a 4, como hoy) */
  --fd-tag-0: #d5dad7;
  --fd-tag-1: #28a745;
  --fd-tag-2: #f0ad4e;
  --fd-tag-3: #d9534f;
  --fd-tag-4: #0275d8;

  /* Espacios (escala de 4 px) */
  --fd-space-1: .25rem;
  --fd-space-2: .5rem;
  --fd-space-3: .75rem;
  --fd-space-4: 1rem;
  --fd-space-5: 1.5rem;
  --fd-space-6: 2rem;
  --fd-space-7: 3rem;

  /* Radios. --fd-radius-sig es la esquina asimétrica de las tarjetas
     de contribuyente del FactuDesk actual (border-radius: 0 15px). */
  --fd-radius-xs:  4px;
  --fd-radius-sm:  6px;
  --fd-radius:     10px;
  --fd-radius-lg:  14px;
  --fd-radius-sig: 4px 16px 4px 16px;
  --fd-radius-pill: 999px;

  /* Sombras: pocas y discretas; los paneles usan borde, no sombra */
  --fd-shadow-xs: 0 1px 2px rgba(23, 32, 35, .06);
  --fd-shadow-sm: 0 2px 6px -2px rgba(23, 32, 35, .12);
  --fd-shadow-md: 0 12px 28px -12px rgba(23, 32, 35, .28);
  --fd-shadow-lg: 0 24px 56px -16px rgba(23, 32, 35, .38);

  /* Foco accesible */
  --fd-focus-color: #1e7e42;
  --fd-focus-ring:  0 0 0 3px rgba(40, 167, 69, .32);

  /* Tipografía: solo Nunito. Escala modular 1.2 sobre 15 px. */
  --fd-font: "Nunito", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --fd-fs-xs:   .75rem;     /* 12 px: ayudas, metadatos */
  --fd-fs-sm:   .8125rem;   /* 13 px: celdas secundarias */
  --fd-fs-base: .9375rem;   /* 15 px: cuerpo */
  --fd-fs-md:   1.0625rem;  /* 17 px: títulos de panel */
  --fd-fs-lg:   1.3125rem;  /* 21 px: subtítulos */
  --fd-fs-xl:   1.625rem;   /* 26 px: título de página */
  --fd-fs-2xl:  2.125rem;   /* 34 px: cifras principales */
  --fd-lh-tight: 1.2;
  --fd-lh:       1.5;

  /* Medidas del armazón */
  --fd-topbar-h:  58px;
  --fd-sidebar-w: 264px;
  --fd-rail-w:    72px;
  --fd-page-max:  1360px;
  --fd-gutter:    clamp(1rem, 2.4vw, 2rem);

  /* Movimiento */
  --fd-ease: cubic-bezier(.2, .7, .2, 1);
  --fd-dur:  180ms;
}


/* ---------------------------------------------------------------------
   2. Tokens: tema oscuro
   Se activa con el sistema (prefers-color-scheme) salvo que la página
   fije data-theme="light", o a mano con data-theme="dark" en <html>.
   --------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --fd-brand:        #34b357;
    --fd-brand-strong: #5cc97c;
    --fd-brand-hover:  #7dd697;
    --fd-brand-soft:   rgba(52, 179, 87, .14);
    --fd-on-brand:     #ffffff;

    --fd-bar:          #2b3035;
    --fd-bar-raised:   #363c42;
    --fd-bar-line:     #444b52;

    --fd-blue:         #2f80e4;
    --fd-blue-hover:   #4a92ea;

    --fd-canvas:       #1a1e21;
    --fd-surface:      #212629;
    --fd-surface-alt:  #262c30;
    --fd-sidebar:      #1e2326;
    --fd-border:       #343b40;
    --fd-border-strong:#465057;
    --fd-text:         #e4e8e6;
    --fd-text-muted:   #a7b0b6;
    --fd-text-subtle:  #8f999f;
    --fd-heading:      #f2f5f3;

    --fd-info:    #7fb2f0;  --fd-info-bg:    rgba(47, 128, 228, .14);  --fd-info-line:    rgba(127, 178, 240, .35);
    --fd-success: #6fd08c;  --fd-success-bg: rgba(52, 179, 87, .14);   --fd-success-line: rgba(111, 208, 140, .35);
    --fd-warning: #ffcf5c;  --fd-warning-bg: rgba(255, 193, 7, .12);   --fd-warning-line: rgba(255, 207, 92, .35);
    --fd-danger:  #ff8f86;  --fd-danger-bg:  rgba(240, 82, 70, .14);   --fd-danger-line:  rgba(255, 143, 134, .35);

    --fd-tag-0: #59636a;

    --fd-shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --fd-shadow-sm: 0 2px 6px -2px rgba(0, 0, 0, .5);
    --fd-shadow-md: 0 12px 28px -12px rgba(0, 0, 0, .7);
    --fd-shadow-lg: 0 24px 56px -16px rgba(0, 0, 0, .8);

    --fd-focus-color: #7dd697;
    --fd-focus-ring:  0 0 0 3px rgba(92, 201, 124, .35);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --fd-brand:        #34b357;
  --fd-brand-strong: #5cc97c;
  --fd-brand-hover:  #7dd697;
  --fd-brand-soft:   rgba(52, 179, 87, .14);
  --fd-on-brand:     #ffffff;

  --fd-bar:          #2b3035;
  --fd-bar-raised:   #363c42;
  --fd-bar-line:     #444b52;

  --fd-blue:         #2f80e4;
  --fd-blue-hover:   #4a92ea;

  --fd-canvas:       #1a1e21;
  --fd-surface:      #212629;
  --fd-surface-alt:  #262c30;
  --fd-sidebar:      #1e2326;
  --fd-border:       #343b40;
  --fd-border-strong:#465057;
  --fd-text:         #e4e8e6;
  --fd-text-muted:   #a7b0b6;
  --fd-text-subtle:  #8f999f;
  --fd-heading:      #f2f5f3;

  --fd-info:    #7fb2f0;  --fd-info-bg:    rgba(47, 128, 228, .14);  --fd-info-line:    rgba(127, 178, 240, .35);
  --fd-success: #6fd08c;  --fd-success-bg: rgba(52, 179, 87, .14);   --fd-success-line: rgba(111, 208, 140, .35);
  --fd-warning: #ffcf5c;  --fd-warning-bg: rgba(255, 193, 7, .12);   --fd-warning-line: rgba(255, 207, 92, .35);
  --fd-danger:  #ff8f86;  --fd-danger-bg:  rgba(240, 82, 70, .14);   --fd-danger-line:  rgba(255, 143, 134, .35);

  --fd-tag-0: #59636a;

  --fd-shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --fd-shadow-sm: 0 2px 6px -2px rgba(0, 0, 0, .5);
  --fd-shadow-md: 0 12px 28px -12px rgba(0, 0, 0, .7);
  --fd-shadow-lg: 0 24px 56px -16px rgba(0, 0, 0, .8);

  --fd-focus-color: #7dd697;
  --fd-focus-ring:  0 0 0 3px rgba(92, 201, 124, .35);
}


/* ---------------------------------------------------------------------
   3. Puente con Bootstrap
   Bootstrap 5.3 lee estas variables en tiempo de ejecución, así que sus
   componentes (formularios, modal, menús) siguen los tokens y el tema.
   --------------------------------------------------------------------- */
:root {
  --bs-body-font-family: var(--fd-font);
  --bs-body-font-size: var(--fd-fs-base);
  --bs-body-line-height: var(--fd-lh);
  --bs-body-color: var(--fd-text);
  --bs-body-bg: var(--fd-surface);
  --bs-emphasis-color: var(--fd-heading);
  --bs-secondary-color: var(--fd-text-muted);
  --bs-secondary-bg: var(--fd-surface-alt);
  --bs-tertiary-bg: var(--fd-surface-alt);
  --bs-heading-color: var(--fd-heading);
  --bs-border-color: var(--fd-border-strong);
  --bs-border-color-translucent: var(--fd-border);
  --bs-border-radius: var(--fd-radius-sm);
  --bs-border-radius-sm: var(--fd-radius-xs);
  --bs-border-radius-lg: var(--fd-radius);
  --bs-link-color: var(--fd-brand-strong);
  --bs-link-color-rgb: 30, 126, 66;
  --bs-link-hover-color: var(--fd-brand-hover);
  --bs-link-hover-color-rgb: 23, 103, 58;
  --bs-success: var(--fd-green-500);
  --bs-success-rgb: 40, 167, 69;
  --bs-primary: var(--fd-blue);
  --bs-primary-rgb: 11, 107, 214;
  --bs-warning: var(--fd-yellow);
  --bs-warning-rgb: 255, 193, 7;
  --bs-dark: var(--fd-bar);
  --bs-focus-ring-color: rgba(40, 167, 69, .32);
  --bs-form-valid-color: var(--fd-success);
  --bs-form-valid-border-color: var(--fd-success);
  --bs-form-invalid-color: var(--fd-danger);
  --bs-form-invalid-border-color: var(--fd-danger);
}

/* En oscuro la flecha de los <select> debe ser clara. Bootstrap define
   la variable en el propio .form-select, por eso se redefine ahí. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .form-select {
    --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23dee2e6' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  }
}
:root[data-theme="dark"] .form-select {
  --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23dee2e6' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

/* Enlaces en oscuro */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
      --bs-link-color-rgb: 92, 201, 124;
    --bs-link-hover-color-rgb: 125, 214, 151;
  }
}
:root[data-theme="dark"] {
  --bs-link-color-rgb: 92, 201, 124;
  --bs-link-hover-color-rgb: 125, 214, 151;
}


/* ---------------------------------------------------------------------
   4. Base y tipografía
   --------------------------------------------------------------------- */
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fd-canvas);
  color: var(--fd-text);
  font-family: var(--fd-font);
  font-size: var(--fd-fs-base);
  line-height: var(--fd-lh);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--fd-heading);
  font-family: var(--fd-font);
  line-height: var(--fd-lh-tight);
  margin: 0;
}
h1, .fd-h1 { font-size: var(--fd-fs-xl);  font-weight: 800; letter-spacing: -.01em; }
h2, .fd-h2 { font-size: var(--fd-fs-lg);  font-weight: 800; }
h3, .fd-h3 { font-size: var(--fd-fs-md);  font-weight: 700; }
h4, .fd-h4 { font-size: var(--fd-fs-base); font-weight: 700; }

p { margin: 0 0 var(--fd-space-3); }

/* Cifras: siempre tabulares para que las columnas de importes alineen */
.fd-num, .fd-money, td, .fd-kpi__value { font-variant-numeric: tabular-nums; }

/* Identificadores fiscales (RFC, UUID): un poco de tracking, sin monoespaciada */
.fd-id { letter-spacing: .02em; font-weight: 700; }
.fd-uuid { font-size: var(--fd-fs-xs); letter-spacing: .02em; color: var(--fd-text-muted); word-break: break-all; }

.fd-muted { color: var(--fd-text-muted); }

/* Foco visible y consistente en todo lo interactivo */
:where(a, button, [role="button"], summary, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--fd-focus-color);
  outline-offset: 2px;
}

/* Enlace para saltar al contenido */
.fd-skip {
  position: absolute;
  left: var(--fd-space-4);
  top: -100px;
  z-index: 2000;
  padding: var(--fd-space-2) var(--fd-space-4);
  border-radius: var(--fd-radius-sm);
  background: var(--fd-yellow);
  color: var(--fd-on-yellow);
  font-weight: 700;
}
.fd-skip:focus { top: var(--fd-space-2); }


/* ---------------------------------------------------------------------
   5. Armazón (shell)
   <body class="fd-shell"> contiene: .fd-topbar, .fd-sidebar, .fd-main
   y opcionalmente .fd-footer. Sin menú lateral: .fd-shell--bare.
   --------------------------------------------------------------------- */
.fd-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--fd-sidebar-w) minmax(0, 1fr);
  grid-template-rows: var(--fd-topbar-h) 1fr auto;
  grid-template-areas:
    "top  top"
    "side main"
    "foot foot";
}
.fd-shell > .fd-topbar  { grid-area: top; }
.fd-shell > .fd-sidebar { grid-area: side; }
.fd-shell > .fd-main    { grid-area: main; min-width: 0; }
.fd-shell > .fd-footer  { grid-area: foot; }

/* Fondo del menú hasta el pie aunque la página sea más alta que la ventana
   (el menú es sticky y mide una ventana). Un pseudoelemento es una celda
   más de la rejilla y pinta la columna completa. */
@media (min-width: 992px) {
  .fd-shell:not(.fd-shell--bare)::before {
    content: "";
    grid-area: side;
    border-right: 1px solid var(--fd-border);
    background: var(--fd-sidebar);
  }
  .fd-shell > .fd-sidebar { z-index: 1; border-right: 0; }
}

/* Menú en modo riel (solo íconos) en escritorio */
.fd-shell.is-rail { grid-template-columns: var(--fd-rail-w) minmax(0, 1fr); }

/* Página sin menú lateral (inicio de sesión, selector de contribuyentes) */
.fd-shell--bare {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "top" "main" "foot";
}

/* Debajo de 992 px el menú sale de la rejilla y se vuelve cajón */
@media (max-width: 991.98px) {
  .fd-shell,
  .fd-shell.is-rail {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "top" "main" "foot";
  }
}


/* ---------------------------------------------------------------------
   6. Barra superior
   --------------------------------------------------------------------- */
.fd-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  gap: var(--fd-space-3);
  height: var(--fd-topbar-h);
  padding: 0 var(--fd-space-4);
  background: var(--fd-bar);
  color: var(--fd-on-bar);
  /* La raya verde inferior une la barra con la marca */
  box-shadow: inset 0 -3px 0 var(--fd-brand), var(--fd-shadow-sm);
}

.fd-topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--fd-space-2);
  color: var(--fd-on-bar);
  font-size: 1.1875rem;
  font-weight: 800;
  letter-spacing: -.01em;
  text-decoration: none;
  white-space: nowrap;
}
.fd-topbar__brand:hover { color: #fff; }

/* Marca: cuadro verde con el corte diagonal de la portada */
.fd-mark {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 4px 9px 4px 9px;
  background:
    linear-gradient(135deg, transparent 0 46%, rgba(255, 255, 255, .22) 46% 58%, transparent 58%),
    var(--fd-brand);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: .8125rem;
  font-weight: 800;
}

.fd-topbar__spacer { flex: 1 1 auto; }

.fd-topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--fd-space-2);
}

/* Botón cuadrado de ícono sobre la barra oscura */
.fd-iconbtn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: var(--fd-radius-sm);
  background: transparent;
  color: var(--fd-on-bar);
  font-size: 1.15rem;
  line-height: 1;
  transition: background-color var(--fd-dur) var(--fd-ease);
}
.fd-iconbtn:hover { background: var(--fd-bar-raised); color: #fff; }
.fd-iconbtn img { width: 28px; height: 28px; border-radius: var(--fd-radius-xs); object-fit: cover; }
.fd-iconbtn .fd-avatar { width: 30px; height: 30px; }

/* Ícono sobre fondo claro (dentro de paneles o tablas) */
.fd-iconbtn--light { color: var(--fd-text-muted); }
.fd-iconbtn--light:hover { background: var(--fd-surface-alt); color: var(--fd-heading); }

.fd-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px var(--fd-bar-raised);
}

/* Botón «Suscripción y precios» (amarillo de siempre) */
.fd-btn-subscription {
  display: inline-flex;
  align-items: center;
  gap: var(--fd-space-2);
  height: 34px;
  padding: 0 var(--fd-space-3);
  border-radius: var(--fd-radius-sm);
  background: var(--fd-yellow);
  color: var(--fd-on-yellow);
  font-size: var(--fd-fs-sm);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}
.fd-btn-subscription:hover { background: var(--fd-yellow-hover); color: var(--fd-on-yellow); }
.fd-btn-subscription .fd-long { display: inline; }

/* Usuario: nombre en amarillo, como hoy */
.fd-user {
  display: inline-flex;
  align-items: center;
  gap: var(--fd-space-2);
  max-width: 180px;
  padding: 4px 6px 4px 10px;
  border: 0;
  border-radius: var(--fd-radius-pill);
  background: transparent;
  color: var(--fd-yellow);
  font-weight: 700;
  font-size: var(--fd-fs-sm);
}
.fd-user:hover { background: var(--fd-bar-raised); }
.fd-user__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-user__initials {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: var(--fd-bar-raised);
  color: var(--fd-on-bar);
  font-size: var(--fd-fs-xs);
  font-weight: 800;
}

/* Separador vertical entre grupos de la barra */
.fd-topbar__sep { width: 1px; height: 24px; background: var(--fd-bar-line); }

@media (max-width: 767.98px) {
  .fd-topbar { gap: var(--fd-space-2); padding: 0 var(--fd-space-3); }
  .fd-topbar__brand .fd-brand-text { display: none; }
  .fd-topbar__sep,
  .fd-user__name { display: none; }
  .fd-user { padding: 4px; }
  /* «★ Suscripción» sin «y precios»: con el texto completo tapaba el selector de RFC a 600 px (T002) */
  .fd-btn-subscription .fd-long { display: none; }
}
@media (max-width: 599.98px) {
  /* Solo botones: Suscripción como ícono, con IVÁN y Herramientas con IA a su lado (T002). Hasta 599 px
     y no 450 (T004): de 451 a 599 el selector no tenía espacio para el RFC y se encimaba a «★ Suscripción» */
  .fd-btn-subscription {
    width: 34px;
    flex: none;
    padding: 0;
    justify-content: center;
  }
  .fd-btn-subscription__text { display: none; }
  .fd-topbar .fd-hide-xs { display: none; }
  /* Botones y separaciones más chicos para que el RFC completo quepa desde 360 px */
  .fd-topbar__spacer { display: none; }
  .fd-topbar__actions { gap: 4px; margin-left: auto; }
  .fd-topbar .fd-iconbtn { width: 34px; }
}
@media (max-width: 450px) {
  .fd-hide-xs { display: none; }
}
@media (min-width: 768px) and (max-width: 1023.98px) {
  /* Usuario solo con sus iniciales (el botón conserva title y aria-label con el nombre) y barra más
     compacta, para que quepa el RFC completo sin encimarse a «★ Suscripción» (T004) */
  .fd-topbar { gap: var(--fd-space-2); padding: 0 var(--fd-space-3); }
  .fd-user__name { display: none; }
  .fd-user { padding: 4px; }
}


/* ---------------------------------------------------------------------
   7. Selector de contribuyente (RFC)
   Botón en la barra que abre un menú con los contribuyentes del perfil.
   --------------------------------------------------------------------- */
.fd-rfc {
  display: inline-flex;
  align-items: center;
  gap: var(--fd-space-2);
  min-width: 0;
  max-width: 340px;
  height: 40px;
  padding: 0 var(--fd-space-3) 0 var(--fd-space-2);
  border: 1px solid var(--fd-bar-line);
  border-radius: var(--fd-radius-sm);
  background: var(--fd-bar-raised);
  color: var(--fd-on-bar);
  text-align: left;
}
.fd-rfc:hover { border-color: var(--fd-on-bar-muted); }
.fd-rfc__icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: var(--fd-radius-xs);
  background: rgba(40, 167, 69, .22);
  color: #7fd897;
}
.fd-rfc__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.fd-rfc__code { font-size: var(--fd-fs-sm); font-weight: 800; letter-spacing: .03em; }
.fd-rfc__name {
  overflow: hidden;
  color: var(--fd-on-bar-muted);
  font-size: var(--fd-fs-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fd-rfc__caret { margin-left: auto; color: var(--fd-on-bar-muted); font-size: .75rem; }

/* Menú desplegable del selector */
.fd-rfc-menu { width: 340px; max-width: calc(100vw - 24px); padding: var(--fd-space-2); }
.fd-rfc-menu .dropdown-header { padding: var(--fd-space-2) var(--fd-space-3); font-size: var(--fd-fs-xs); font-weight: 700; color: var(--fd-text-muted); }
.fd-rfc-option {
  display: flex;
  align-items: center;
  gap: var(--fd-space-3);
  border-radius: var(--fd-radius-sm);
  padding: var(--fd-space-2) var(--fd-space-3);
  white-space: normal;
}
.fd-rfc-option__code { display: block; font-weight: 800; letter-spacing: .03em; font-size: var(--fd-fs-sm); }
.fd-rfc-option__name { display: block; color: var(--fd-text-muted); font-size: var(--fd-fs-xs); }
.fd-rfc-option.active,
.fd-rfc-option:active { background: var(--fd-brand-soft); color: var(--fd-text); }
.fd-rfc-option .bi-check2 { margin-left: auto; color: var(--fd-brand-strong); font-size: 1.1rem; }

@media (max-width: 767.98px) {
  .fd-rfc { max-width: 168px; padding-right: var(--fd-space-2); }
  .fd-rfc__name { display: none; }
}
.fd-topbar > .dropdown { min-width: 0; }
/* El selector se encoge con su espacio en vez de dibujarse encima de «★ Suscripción»: se recorta el
   nombre del emisor, y el RFC cabe completo por los cortes de la barra (T004) */
.fd-topbar > .dropdown .fd-rfc { max-width: min(340px, 100%); }
.fd-rfc__code { white-space: nowrap; }
@media (max-width: 767.98px) {
  .fd-topbar > .dropdown .fd-rfc { max-width: 100%; }
}
/* Sin el ícono del edificio donde no cabe junto al RFC (debajo de 600 px ya lo quita el bloque siguiente) */
@media (min-width: 600px) and (max-width: 639.98px), (min-width: 768px) and (max-width: 829.98px) {
  .fd-rfc__icon { display: none; }
}
@media (max-width: 599.98px) {
  .fd-rfc { max-width: 100%; gap: 4px; padding: 0 6px; }
  .fd-rfc__icon { display: none; }
  .fd-rfc__code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: 0; }
  .fd-btn-subscription { padding: 0 var(--fd-space-2); }
}


/* ---------------------------------------------------------------------
   8. Menú lateral y cajón móvil
   <nav class="fd-sidebar"> con grupos <details class="fd-nav__group">.
   --------------------------------------------------------------------- */
.fd-sidebar {
  position: sticky;
  top: var(--fd-topbar-h);
  height: calc(100vh - var(--fd-topbar-h));
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid var(--fd-border);
  background: var(--fd-sidebar);
  scrollbar-width: thin;
}

.fd-nav { padding: var(--fd-space-3) var(--fd-space-3) var(--fd-space-5); }

.fd-nav__group + .fd-nav__group { margin-top: var(--fd-space-2); }

.fd-nav__heading {
  display: flex;
  align-items: center;
  gap: var(--fd-space-2);
  padding: var(--fd-space-2) var(--fd-space-3);
  border-radius: var(--fd-radius-sm);
  color: var(--fd-text-muted);
  font-size: var(--fd-fs-xs);
  font-weight: 800;
  letter-spacing: .02em;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.fd-nav__heading::-webkit-details-marker { display: none; }
.fd-nav__heading:hover { color: var(--fd-heading); }
/* La doble flecha «»» del menú actual, ahora como chevrón que gira */
.fd-nav__heading::after {
  content: "\F282";               /* bi-chevron-down */
  font-family: "bootstrap-icons";
  margin-left: auto;
  font-size: .7rem;
  transition: transform var(--fd-dur) var(--fd-ease);
}
.fd-nav__group:not([open]) > .fd-nav__heading::after { transform: rotate(-90deg); }

.fd-nav__list { list-style: none; margin: 0; padding: 0; }

/* Bloque de la cuenta: [NIC] nombre, como encabezado del primer grupo */
.fd-nav__account {
  gap: var(--fd-space-3);
  padding: var(--fd-space-3);
  margin-bottom: var(--fd-space-1);
  border: 1px solid var(--fd-border);
  border-radius: var(--fd-radius-sig);
  background: var(--fd-surface);
  color: var(--fd-heading);
  font-size: var(--fd-fs-sm);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.25;
}
.fd-nav__account > .bi { color: var(--fd-brand-strong); font-size: 1.1rem; }
.fd-nav__account .fd-nav__text { white-space: normal; }
.fd-nav__account-nic { display: block; color: var(--fd-text-muted); font-size: var(--fd-fs-xs); font-weight: 700; }
.fd-shell.is-rail .fd-nav__account { font-size: inherit; border: 0; background: transparent; }
.fd-shell.is-rail .fd-nav__account::before { content: none; }
.fd-nav__link--button { width: 100%; border: 0; background: transparent; text-align: left; }

.fd-nav__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--fd-space-3);
  min-height: 38px;
  padding: var(--fd-space-2) var(--fd-space-3);
  border-radius: var(--fd-radius-sm);
  color: var(--fd-brand-strong);   /* enlaces verdes, como siempre */
  font-weight: 600;
  text-decoration: none;
  transition: background-color var(--fd-dur) var(--fd-ease);
}
.fd-nav__link > .bi { width: 20px; flex: none; font-size: 1.05rem; text-align: center; }
.fd-nav__link:hover { background: var(--fd-brand-soft); color: var(--fd-brand-hover); }
.fd-nav__link.is-active,
.fd-nav__link[aria-current="page"] {
  background: var(--fd-surface);
  color: var(--fd-heading);
  font-weight: 800;
  box-shadow: var(--fd-shadow-xs), inset 0 0 0 1px var(--fd-border);
}
/* Marca activa: barrita verde a la izquierda */
.fd-nav__link.is-active::before,
.fd-nav__link[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--fd-brand);
}
.fd-nav__link.is-active > .bi,
.fd-nav__link[aria-current="page"] > .bi { color: var(--fd-brand-strong); }

/* Contador a la derecha (timbres, pendientes) */
.fd-nav__count {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: var(--fd-radius-pill);
  background: var(--fd-surface);
  box-shadow: inset 0 0 0 1px var(--fd-border);
  color: var(--fd-text-muted);
  font-size: var(--fd-fs-xs);
  font-weight: 700;
}
.fd-nav__count--warn { background: var(--fd-warning-bg); color: var(--fd-warning); box-shadow: inset 0 0 0 1px var(--fd-warning-line); }

.fd-nav__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fd-sidebar__footer {
  margin-top: auto;
  padding: var(--fd-space-3);
  border-top: 1px solid var(--fd-border);
}

/* Riel: solo íconos (escritorio, botón de la barra) */
.fd-shell.is-rail .fd-nav { padding-inline: var(--fd-space-2); }
.fd-shell.is-rail .fd-nav__heading { justify-content: center; padding-inline: 0; font-size: 0; }
.fd-shell.is-rail .fd-nav__heading::after { content: none; }
.fd-shell.is-rail .fd-nav__heading::before {
  content: "";
  display: block;
  width: 24px;
  height: 1px;
  background: var(--fd-border-strong);
}
.fd-shell.is-rail .fd-nav__text,
.fd-shell.is-rail .fd-nav__count { display: none; }
.fd-shell.is-rail .fd-nav__link { justify-content: center; padding-inline: 0; }
.fd-shell.is-rail .fd-nav__link.is-active::before { left: -8px; }
/* En riel todos los grupos se ven completos */
.fd-shell.is-rail .fd-nav__group:not([open]) > .fd-nav__list { display: block; }

/* Cajón móvil */
.fd-scrim { display: none; }

@media (max-width: 991.98px) {
  .fd-sidebar {
    position: fixed;
    z-index: 1045;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(86vw, 320px);
    height: 100%;
    border-right: 0;
    box-shadow: var(--fd-shadow-lg);
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform 240ms var(--fd-ease), visibility 0s linear 240ms;
  }
  .fd-shell.is-drawer-open .fd-sidebar {
    transform: none;
    visibility: visible;
    transition: transform 240ms var(--fd-ease);
  }
  .fd-shell.is-drawer-open .fd-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(20, 24, 27, .48);
  }
  /* Cabecera del cajón: repite la marca y el botón de cerrar */
  .fd-sidebar__head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: var(--fd-space-2);
    height: var(--fd-topbar-h);
    padding: 0 var(--fd-space-3) 0 var(--fd-space-4);
    background: var(--fd-bar);
    color: var(--fd-on-bar);
    box-shadow: inset 0 -3px 0 var(--fd-brand);
    font-weight: 800;
  }
  .fd-sidebar__head .fd-iconbtn { margin-left: auto; }
}
@media (min-width: 992px) {
  .fd-sidebar__head { display: none; }
}


/* ---------------------------------------------------------------------
   9. Página: encabezado, paneles y pie
   --------------------------------------------------------------------- */
.fd-main { background: var(--fd-canvas); }

.fd-page {
  width: 100%;
  max-width: var(--fd-page-max);
  margin: 0 auto;
  padding: var(--fd-space-5) var(--fd-gutter) var(--fd-space-7);
}

/* Encabezado de página: título a la izquierda, acciones a la derecha */
.fd-page__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--fd-space-3) var(--fd-space-5);
  margin-bottom: var(--fd-space-5);
}
.fd-page__title { font-size: var(--fd-fs-xl); font-weight: 800; }
.fd-page__lead { margin: var(--fd-space-1) 0 0; color: var(--fd-text-muted); }
.fd-page__actions { display: flex; flex-wrap: wrap; gap: var(--fd-space-2); min-width: 0; }
@media (max-width: 575.98px) {
  .fd-page__header { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
  .fd-page__header > * { min-width: 0; }
  .fd-page__actions > .btn,
  .fd-page__actions > .btn-group,
  .fd-page__actions > .dropdown { flex: 1 1 auto; }
  .fd-page__actions > .btn-group { display: flex; }
  .fd-page__actions > .btn-group > .btn:first-child { flex: 1 1 auto; }
  .fd-page__actions > .dropdown > .btn { width: 100%; }
}

/* Migas: ruta corta encima del título */
.fd-crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--fd-space-1);
  margin-bottom: var(--fd-space-1);
  color: var(--fd-text-muted);
  font-size: var(--fd-fs-sm);
}
.fd-crumbs a { color: inherit; text-decoration: none; }
.fd-crumbs a:hover { color: var(--fd-brand-strong); text-decoration: underline; }
.fd-crumbs .bi { font-size: .7rem; align-self: center; }

/* Sección: separa bloques verticales de la página */
.fd-section + .fd-section { margin-top: var(--fd-space-6); }
.fd-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--fd-space-3);
  margin-bottom: var(--fd-space-3);
}
.fd-section__title { font-size: var(--fd-fs-md); font-weight: 800; }

/* Panel: superficie con borde (no sombra) */
.fd-panel {
  border: 1px solid var(--fd-border);
  border-radius: var(--fd-radius);
  background: var(--fd-surface);
}
.fd-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--fd-space-3);
  padding: var(--fd-space-3) var(--fd-space-4);
  border-bottom: 1px solid var(--fd-border);
}
.fd-panel__title { font-size: var(--fd-fs-md); font-weight: 800; display: flex; align-items: center; gap: var(--fd-space-2); }
.fd-panel__title .bi { color: var(--fd-brand-strong); }
.fd-panel__body { padding: var(--fd-space-4); }
.fd-panel__foot {
  padding: var(--fd-space-3) var(--fd-space-4);
  border-top: 1px solid var(--fd-border);
  background: var(--fd-surface-alt);
  border-radius: 0 0 var(--fd-radius) var(--fd-radius);
}
@media (min-width: 768px) {
  .fd-panel__body { padding: var(--fd-space-5); }
  .fd-panel__head { padding: var(--fd-space-4) var(--fd-space-5); }
}

/* Pie de página oscuro, igual que la barra */
.fd-footer {
  padding: var(--fd-space-4) var(--fd-gutter);
  background: var(--fd-bar);
  color: var(--fd-on-bar-muted);
  font-size: var(--fd-fs-xs);
  text-align: center;
}
.fd-footer a { color: var(--fd-on-bar); text-decoration: none; }
.fd-footer a:hover { text-decoration: underline; }
.fd-footer__links { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--fd-space-1) var(--fd-space-4); margin-top: var(--fd-space-1); }


/* ---------------------------------------------------------------------
   10. Botones
   Se usan las clases de Bootstrap (.btn .btn-success, etc.) con estos
   ajustes. Principal = verde. Emitir = azul (.btn-primary).
   --------------------------------------------------------------------- */
.btn {
  --bs-btn-font-family: var(--fd-font);
  --bs-btn-font-weight: 700;
  --bs-btn-font-size: var(--fd-fs-base);
  --bs-btn-padding-x: 1rem;
  --bs-btn-padding-y: .5rem;
  --bs-btn-border-radius: var(--fd-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--fd-space-2);
  white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--fd-focus-color); outline-offset: 2px; box-shadow: none; }
.btn-sm { --bs-btn-padding-x: .75rem; --bs-btn-padding-y: .3125rem; --bs-btn-font-size: var(--fd-fs-sm); }
.btn-lg { --bs-btn-padding-x: 1.25rem; --bs-btn-padding-y: .6875rem; --bs-btn-font-size: 1rem; }

/* Verde FactuDesk: acción principal */
.btn-success {
  --bs-btn-color: var(--fd-on-brand);
  --bs-btn-bg: var(--fd-green-600);
  --bs-btn-border-color: var(--fd-green-600);
  --bs-btn-hover-color: var(--fd-on-brand);
  --bs-btn-hover-bg: var(--fd-green-700);
  --bs-btn-hover-border-color: var(--fd-green-700);
  --bs-btn-active-color: var(--fd-on-brand);
  --bs-btn-active-bg: var(--fd-green-800);
  --bs-btn-active-border-color: var(--fd-green-800);
  --bs-btn-disabled-color: var(--fd-on-brand);
  --bs-btn-disabled-bg: var(--fd-green-600);
  --bs-btn-disabled-border-color: var(--fd-green-600);
}

/* Azul: Emitir CFDI */
.btn-primary {
  --bs-btn-color: var(--fd-on-blue);
  --bs-btn-bg: var(--fd-blue);
  --bs-btn-border-color: var(--fd-blue);
  --bs-btn-hover-color: var(--fd-on-blue);
  --bs-btn-hover-bg: var(--fd-blue-hover);
  --bs-btn-hover-border-color: var(--fd-blue-hover);
  --bs-btn-active-color: var(--fd-on-blue);
  --bs-btn-active-bg: var(--fd-blue-hover);
  --bs-btn-active-border-color: var(--fd-blue-hover);
  --bs-btn-disabled-bg: var(--fd-blue);
  --bs-btn-disabled-border-color: var(--fd-blue);
}

/* Amarillo: Suscripción */
.btn-warning {
  --bs-btn-color: var(--fd-on-yellow);
  --bs-btn-bg: var(--fd-yellow);
  --bs-btn-border-color: var(--fd-yellow);
  --bs-btn-hover-color: var(--fd-on-yellow);
  --bs-btn-hover-bg: var(--fd-yellow-hover);
  --bs-btn-hover-border-color: var(--fd-yellow-hover);
}

/* Secundario: contorno neutro */
.btn-outline-secondary,
.btn-light {
  --bs-btn-color: var(--fd-text);
  --bs-btn-bg: var(--fd-surface);
  --bs-btn-border-color: var(--fd-border-strong);
  --bs-btn-hover-color: var(--fd-heading);
  --bs-btn-hover-bg: var(--fd-surface-alt);
  --bs-btn-hover-border-color: var(--fd-border-strong);
  --bs-btn-active-color: var(--fd-heading);
  --bs-btn-active-bg: var(--fd-surface-alt);
  --bs-btn-active-border-color: var(--fd-text-subtle);
  --bs-btn-disabled-color: var(--fd-text-subtle);
  --bs-btn-disabled-bg: var(--fd-surface);
  --bs-btn-disabled-border-color: var(--fd-border);
}

/* Peligro: cancelar comprobante */
.btn-danger {
  --bs-btn-color: #fff;
  --bs-btn-bg: #b42318;
  --bs-btn-border-color: #b42318;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #93190f;
  --bs-btn-hover-border-color: #93190f;
  --bs-btn-active-bg: #7a140c;
  --bs-btn-active-border-color: #7a140c;
}

/* Texto: acción terciaria sin caja */
.btn-link {
  --bs-btn-color: var(--fd-brand-strong);
  --bs-btn-hover-color: var(--fd-brand-hover);
  --bs-btn-font-weight: 700;
  text-decoration: none;
}
.btn-link:hover { text-decoration: underline; }

/* Botón dividido: el menú del dropdown queda a la derecha */
.btn-group > .btn { flex: 0 0 auto; }


/* ---------------------------------------------------------------------
   11. Formularios
   Estructura: .fd-field > label.form-label + control + .fd-hint
   --------------------------------------------------------------------- */
.form-label {
  margin-bottom: var(--fd-space-1);
  color: var(--fd-heading);
  font-size: var(--fd-fs-sm);
  font-weight: 700;
}
.fd-req::after { content: " *"; color: var(--fd-danger); }

.form-control,
.form-select {
  min-height: 40px;
  border-color: var(--fd-border-strong);
  border-radius: var(--fd-radius-sm);
  background-color: var(--fd-surface);
  color: var(--fd-text);
  font-size: var(--fd-fs-base);
}
.form-control::placeholder { color: var(--fd-text-subtle); }
.form-control:focus,
.form-select:focus {
  border-color: var(--fd-brand);
  background-color: var(--fd-surface);
  color: var(--fd-text);
  box-shadow: var(--fd-focus-ring);
}
.form-control:disabled,
.form-select:disabled,
.form-control[readonly] { background-color: var(--fd-surface-alt); color: var(--fd-text-muted); }
.form-control-sm, .form-select-sm { min-height: 34px; font-size: var(--fd-fs-sm); }

.form-check-input { border-color: var(--fd-border-strong); background-color: var(--fd-surface); }
.form-check-input:checked { border-color: var(--fd-green-600); background-color: var(--fd-green-600); }
.form-check-input:focus { border-color: var(--fd-brand); box-shadow: var(--fd-focus-ring); }
.form-check-input:indeterminate { border-color: var(--fd-green-600); background-color: var(--fd-green-600); }

.input-group-text {
  border-color: var(--fd-border-strong);
  background: var(--fd-surface-alt);
  color: var(--fd-text-muted);
}

.fd-hint { margin-top: var(--fd-space-1); color: var(--fd-text-muted); font-size: var(--fd-fs-xs); }
.invalid-feedback { font-size: var(--fd-fs-xs); font-weight: 600; }

/* Rejilla de formulario: columnas automáticas con ancho mínimo */
.fd-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: var(--fd-space-4);
}
.fd-form-grid .fd-span-2 { grid-column: span 2; }
.fd-form-grid .fd-span-all { grid-column: 1 / -1; }
@media (max-width: 575.98px) {
  .fd-form-grid .fd-span-2 { grid-column: 1 / -1; }
}

/* Dato de solo lectura (emisor, lugar de expedición) */
.fd-readout { display: flex; flex-direction: column; gap: 2px; }
.fd-readout__label { color: var(--fd-text-muted); font-size: var(--fd-fs-xs); font-weight: 700; }
.fd-readout__value { color: var(--fd-heading); font-weight: 700; }
/* Dato fijo dentro de una rejilla de formulario: alineado con los campos */
.fd-readout--field .fd-readout__label { margin-bottom: var(--fd-space-1); color: var(--fd-heading); font-size: var(--fd-fs-sm); }
.fd-readout--field .fd-readout__value { display: flex; align-items: center; min-height: 40px; }
.fd-readout--field .fd-hint { margin-top: 0; }


/* ---------------------------------------------------------------------
   12. Avisos
   <div class="fd-alert fd-alert--warning" role="status">
     <i class="fd-alert__icon bi …"></i>
     <div class="fd-alert__body"><p class="fd-alert__title">…</p><p>…</p></div>
     <a class="fd-alert__action btn btn-sm …">…</a>
   </div>
   --------------------------------------------------------------------- */
.fd-alert {
  --fd-alert-fg: var(--fd-info);
  --fd-alert-bg: var(--fd-info-bg);
  --fd-alert-line: var(--fd-info-line);
  display: flex;
  align-items: flex-start;
  gap: var(--fd-space-3);
  padding: var(--fd-space-3) var(--fd-space-4);
  border: 1px solid var(--fd-alert-line);
  border-left-width: 4px;
  border-left-color: var(--fd-alert-fg);
  border-radius: var(--fd-radius-sm);
  background: var(--fd-alert-bg);
  color: var(--fd-text);
}
.fd-alert--info    { --fd-alert-fg: var(--fd-info);    --fd-alert-bg: var(--fd-info-bg);    --fd-alert-line: var(--fd-info-line); }
.fd-alert--success { --fd-alert-fg: var(--fd-success); --fd-alert-bg: var(--fd-success-bg); --fd-alert-line: var(--fd-success-line); }
.fd-alert--warning { --fd-alert-fg: var(--fd-warning); --fd-alert-bg: var(--fd-warning-bg); --fd-alert-line: var(--fd-warning-line); }
.fd-alert--danger  { --fd-alert-fg: var(--fd-danger);  --fd-alert-bg: var(--fd-danger-bg);  --fd-alert-line: var(--fd-danger-line); }
/* En aviso de advertencia la franja usa el amarillo de marca */
.fd-alert--warning { border-left-color: var(--fd-yellow); }

.fd-alert__icon { flex: none; margin-top: 1px; color: var(--fd-alert-fg); font-size: 1.2rem; line-height: 1.2; }
.fd-alert--warning .fd-alert__icon { color: var(--fd-warning); }
.fd-alert__body { flex: 1 1 auto; min-width: 0; }
.fd-alert__body p { margin: 0; }
.fd-alert__title { color: var(--fd-heading); font-weight: 800; }
.fd-alert__body p + p { margin-top: 2px; color: var(--fd-text-muted); font-size: var(--fd-fs-sm); }
.fd-alert__action { flex: none; align-self: center; }

.fd-alerts { display: grid; gap: var(--fd-space-2); }

@media (max-width: 575.98px) {
  .fd-alert { flex-wrap: wrap; }
  .fd-alert__body { flex-basis: calc(100% - 2rem); }
  .fd-alert__action { margin-left: calc(1.2rem + var(--fd-space-3)); }
}


/* ---------------------------------------------------------------------
   13. Tarjetas de indicador y saldo de timbres
   --------------------------------------------------------------------- */
.fd-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: var(--fd-space-3);
}
/* En el tablero los cuatro indicadores van en 2 × 2 junto al saldo */
.fd-dash-top .fd-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 479.98px) {
  .fd-kpi { padding: var(--fd-space-3); }
  .fd-kpi__value { font-size: 1.25rem; }
  .fd-kpi__value small { display: block; margin: 2px 0 0; font-size: .6rem; }
}

.fd-kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--fd-space-1);
  padding: var(--fd-space-4);
  border: 1px solid var(--fd-border);
  border-radius: var(--fd-radius-sig);    /* esquina asimétrica de FactuDesk */
  background: var(--fd-surface);
}
.fd-kpi__label {
  display: flex;
  align-items: center;
  gap: var(--fd-space-2);
  color: var(--fd-text-muted);
  font-size: var(--fd-fs-sm);
  font-weight: 700;
}
.fd-kpi__label .bi { color: var(--fd-brand-strong); }
.fd-kpi__value {
  color: var(--fd-heading);
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.01em;
}
.fd-kpi__value small { font-size: .5em; font-weight: 700; color: var(--fd-text-muted); margin-left: 2px; }
.fd-kpi__meta { color: var(--fd-text-muted); font-size: var(--fd-fs-xs); }
.fd-kpi__meta a { font-weight: 700; }
.fd-kpi__trend { font-weight: 800; }
.fd-kpi__trend--up   { color: var(--fd-success); }
.fd-kpi__trend--down { color: var(--fd-danger); }
.fd-kpi--danger .fd-kpi__label .bi { color: var(--fd-danger); }
.fd-kpi--warning .fd-kpi__label .bi { color: var(--fd-warning); }

/* Saldo de timbres: el bloque protagonista del tablero.
   Fondo de la barra con las diagonales verdes de la portada. */
.fd-stamps {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: var(--fd-space-3);
  padding: var(--fd-space-5);
  border-radius: var(--fd-radius-sig);
  background: var(--fd-bar);
  color: var(--fd-on-bar);
  isolation: isolate;
}
.fd-stamps::before,
.fd-stamps::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  right: 0;
  width: 46%;
  background: var(--fd-green-600);
  clip-path: polygon(38% 0, 100% 0, 100% 100%, 0 100%);
  opacity: .9;
}
.fd-stamps::after {
  width: 30%;
  background: var(--fd-green-500);
  clip-path: polygon(62% 0, 100% 0, 100% 100%, 28% 100%);
  opacity: 1;
}
.fd-stamps__label { color: var(--fd-on-bar-muted); font-size: var(--fd-fs-sm); font-weight: 700; display: flex; align-items: center; gap: var(--fd-space-2); }
.fd-stamps__value { font-size: 2.75rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; color: #fff; }
.fd-stamps__value small { font-size: var(--fd-fs-base); font-weight: 700; color: var(--fd-on-bar-muted); margin-left: var(--fd-space-1); letter-spacing: 0; }
.fd-stamps__meta { color: var(--fd-on-bar-muted); font-size: var(--fd-fs-sm); max-width: 32ch; }
.fd-stamps__meta strong { color: var(--fd-yellow); }
.fd-stamps__actions { display: flex; flex-wrap: wrap; gap: var(--fd-space-2); margin-top: var(--fd-space-2); }
.fd-stamps .btn-outline-light {
  --bs-btn-color: #fff;
  --bs-btn-border-color: rgba(255, 255, 255, .55);
  --bs-btn-hover-bg: rgba(255, 255, 255, .12);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-border-color: #fff;
}

/* Medidor (barra de consumo) */
.fd-meter {
  position: relative;
  height: 8px;
  max-width: 340px;
  border-radius: var(--fd-radius-pill);
  background: rgba(255, 255, 255, .16);
  overflow: hidden;
}
.fd-meter__bar { height: 100%; border-radius: inherit; background: var(--fd-yellow); }
.fd-meter--light { background: var(--fd-surface-alt); box-shadow: inset 0 0 0 1px var(--fd-border); }
.fd-meter--light .fd-meter__bar { background: var(--fd-brand); }


/* ---------------------------------------------------------------------
   14. Accesos rápidos
   Enlaces grandes a las acciones frecuentes de emisión.
   --------------------------------------------------------------------- */
.fd-quick {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: var(--fd-space-3);
}
.fd-quick__item {
  display: flex;
  align-items: center;
  gap: var(--fd-space-3);
  padding: var(--fd-space-3) var(--fd-space-4);
  border: 1px solid var(--fd-border);
  border-radius: var(--fd-radius);
  background: var(--fd-surface);
  color: var(--fd-text);
  text-decoration: none;
  transition: border-color var(--fd-dur) var(--fd-ease), background-color var(--fd-dur) var(--fd-ease);
}
.fd-quick__item:hover { border-color: var(--fd-blue); background: var(--fd-info-bg); color: var(--fd-text); }
.fd-quick__icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: var(--fd-radius-sm);
  background: var(--fd-blue);
  color: var(--fd-on-blue);
  font-size: 1.25rem;
}
.fd-quick__title { display: block; color: var(--fd-heading); font-weight: 800; }
.fd-quick__desc { display: block; color: var(--fd-text-muted); font-size: var(--fd-fs-xs); }
.fd-quick__item > .bi-chevron-right { margin-left: auto; color: var(--fd-text-subtle); }


/* ---------------------------------------------------------------------
   15. Barra de filtros y chips
   --------------------------------------------------------------------- */
.fd-filters {
  padding: var(--fd-space-4);
  border: 1px solid var(--fd-border);
  border-radius: var(--fd-radius);
  background: var(--fd-surface-alt);
}
.fd-filters__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr));
  gap: var(--fd-space-3);
  align-items: end;
}
.fd-filters__grid .form-label { font-size: var(--fd-fs-xs); }
.fd-filters__grid .fd-span-2 { grid-column: span 2; }
@media (max-width: 575.98px) {
  .fd-filters { padding: var(--fd-space-3); }
  .fd-filters__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fd-filters__grid .fd-span-2,
  .fd-filters__grid .fd-filters__actions { grid-column: 1 / -1; }
  .fd-filters__actions .btn-success { flex: 1 1 auto; }
}
.fd-filters__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--fd-space-2);
  grid-column: 1 / -1;
}

/* Rango de fechas: dos campos juntos */
.fd-daterange { display: flex; align-items: center; gap: var(--fd-space-1); }
.fd-daterange .form-control { min-width: 0; }
.fd-daterange__sep { color: var(--fd-text-muted); font-size: var(--fd-fs-xs); }

/* Fila de chips con los filtros activos */
.fd-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--fd-space-2);
  margin-top: var(--fd-space-3);
}
.fd-chips__label { color: var(--fd-text-muted); font-size: var(--fd-fs-xs); font-weight: 700; margin-right: var(--fd-space-1); }

.fd-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--fd-space-1);
  height: 30px;
  padding: 0 4px 0 12px;
  border: 1px solid var(--fd-success-line);
  border-radius: var(--fd-radius-pill);
  background: var(--fd-surface);
  color: var(--fd-text);
  font-size: var(--fd-fs-sm);
  font-weight: 600;
  white-space: nowrap;
}
.fd-chip b { font-weight: 800; color: var(--fd-heading); }
.fd-chip__remove {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--fd-text-muted);
  font-size: .85rem;
}
.fd-chip__remove:hover { background: var(--fd-danger-bg); color: var(--fd-danger); }
.fd-chip--plain { padding-right: 12px; }

/* Segmentado de etiquetas de color (filtro por color) */
.fd-swatches { display: flex; gap: 5px; flex-wrap: wrap; min-height: 40px; align-items: center; }
.fd-swatch {
  width: 24px;
  height: 24px;
  border: 2px solid var(--fd-surface);
  border-radius: 50%;
  background: var(--fd-tag-0);
  box-shadow: 0 0 0 1px var(--fd-border-strong);
  padding: 0;
}
.fd-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--fd-heading); }
.fd-swatch--all { background: conic-gradient(var(--fd-tag-1) 0 25%, var(--fd-tag-2) 0 50%, var(--fd-tag-3) 0 75%, var(--fd-tag-4) 0); }
.fd-swatch--1 { background: var(--fd-tag-1); }
.fd-swatch--2 { background: var(--fd-tag-2); }
.fd-swatch--3 { background: var(--fd-tag-3); }
.fd-swatch--4 { background: var(--fd-tag-4); }


/* ---------------------------------------------------------------------
   15b. Sección colapsable
   Para filtros y resúmenes: abierta muestra el cuerpo; cerrada queda en
   una sola línea (chips de filtros activos o el total principal).
   <section class="fd-collapsible" data-fd-collapsible="clave"
            data-fd-default="open|closed" data-fd-default-mobile="open|closed">
     <div class="fd-collapsible__bar">
       <button class="fd-collapsible__toggle" aria-expanded aria-controls>…</button>
       <div class="fd-collapsible__line">…</div>
     </div>
     <div class="fd-collapsible__body" id="…">…</div>
   </section>
   El estado lo pone shell.js con la clase .is-collapsed y aria-expanded.
   --------------------------------------------------------------------- */
.fd-collapsible {
  border: 1px solid var(--fd-border);
  border-radius: var(--fd-radius);
  background: var(--fd-surface);
}
.fd-collapsible + .fd-collapsible,
.fd-collapsible + .fd-section,
.fd-alerts + .fd-collapsible,
.fd-section--tight { margin-top: var(--fd-space-3); }

.fd-collapsible__bar {
  display: flex;
  align-items: center;
  gap: var(--fd-space-2) var(--fd-space-3);
  min-height: 52px;
  padding: var(--fd-space-2) var(--fd-space-3);
}
.fd-collapsible__toggle {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: var(--fd-space-2);
  height: 36px;
  padding: 0 var(--fd-space-3);
  border: 1px solid var(--fd-border-strong);
  border-radius: var(--fd-radius-sm);
  background: var(--fd-surface);
  color: var(--fd-heading);
  font-size: var(--fd-fs-sm);
  font-weight: 800;
  white-space: nowrap;
}
.fd-collapsible__toggle:hover { background: var(--fd-surface-alt); }
.fd-collapsible__toggle > .bi:first-child { color: var(--fd-brand-strong); }
.fd-collapsible__count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--fd-radius-pill);
  background: var(--fd-green-600);
  color: var(--fd-on-brand);
  font-size: .6875rem;
  font-weight: 800;
}
.fd-collapsible__chevron { color: var(--fd-text-muted); font-size: .75rem; transition: transform var(--fd-dur) var(--fd-ease); }
.fd-collapsible.is-collapsed .fd-collapsible__chevron { transform: rotate(-90deg); }

/* Línea de resumen: siempre de un solo renglón; lo que no cabe se recorta */
.fd-collapsible__line {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--fd-space-2) var(--fd-space-4);
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--fd-text-muted);
  font-size: var(--fd-fs-sm);
  white-space: nowrap;
  mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
}
.fd-collapsible__line b { color: var(--fd-heading); font-weight: 800; }
.fd-collapsible__line.fd-chips { margin: 0; }
.fd-collapsible__line > * { flex: none; }
/* La línea de cifras solo tiene sentido cuando el cuerpo está oculto */
.fd-collapsible:not(.is-collapsed) .fd-collapsible__line--closed { display: none; }

/* Cuerpo: se pega a la barra sin doble borde */
.fd-collapsible__body { border-top: 1px solid var(--fd-border); }
.fd-collapsible.is-collapsed > .fd-collapsible__body { display: none; }
.fd-collapsible > .fd-collapsible__body.fd-filters,
.fd-collapsible > .fd-collapsible__body.fd-totals {
  border-width: 1px 0 0;
  border-radius: 0 0 var(--fd-radius) var(--fd-radius);
}
.fd-collapsible > .fd-collapsible__body.fd-dash-top { padding: var(--fd-space-3); }

/* Filtros: barra gris como el panel de filtros */
.fd-collapsible--filters { background: var(--fd-surface-alt); }
.fd-collapsible--filters > .fd-collapsible__body { background: var(--fd-surface-alt); }

@media (max-width: 575.98px) {
  .fd-collapsible__bar { flex-wrap: wrap; }
  .fd-collapsible__line { flex-basis: 100%; }
  .fd-collapsible__line:empty { display: none; }
}


/* ---------------------------------------------------------------------
   16. Totales por moneda
   Una fila por divisa; nunca se suman divisas distintas.
   --------------------------------------------------------------------- */
.fd-totals {
  display: grid;
  gap: 0;
  border: 1px solid var(--fd-border);
  border-radius: var(--fd-radius);
  background: var(--fd-surface);
  overflow: hidden;
}
.fd-totals__row {
  display: grid;
  grid-template-columns: 96px repeat(5, minmax(0, 1fr));
  align-items: center;
  gap: var(--fd-space-3);
  padding: var(--fd-space-3) var(--fd-space-4);
}
.fd-totals__row + .fd-totals__row { border-top: 1px solid var(--fd-border); }
.fd-totals__currency { display: flex; flex-direction: column; }
.fd-totals__currency b { color: var(--fd-heading); font-weight: 800; letter-spacing: .03em; }
.fd-totals__currency span { color: var(--fd-text-muted); font-size: var(--fd-fs-xs); }
.fd-totals__item { display: flex; flex-direction: column; text-align: right; min-width: 0; }
.fd-totals__item span { color: var(--fd-text-muted); font-size: var(--fd-fs-xs); font-weight: 700; }
.fd-totals__item b { color: var(--fd-text); font-weight: 700; white-space: nowrap; }
.fd-totals__item--total b { color: var(--fd-heading); font-weight: 800; font-size: var(--fd-fs-md); }

@media (max-width: 991.98px) {
  .fd-totals__row { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: var(--fd-space-2); }
  .fd-totals__currency { grid-column: 1 / -1; flex-direction: row; gap: var(--fd-space-2); align-items: baseline; }
  .fd-totals__item { text-align: left; }
}


/* ---------------------------------------------------------------------
   17. Tabla de datos, estados y acciones por fila
   <div class="fd-table-wrap"><table class="fd-table fd-table--cards">…
   --------------------------------------------------------------------- */
.fd-table-wrap {
  border: 1px solid var(--fd-border);
  border-radius: var(--fd-radius);
  background: var(--fd-surface);
  overflow-x: auto;
}
/* Barra encima de la tabla: selección, conteo y acciones masivas */
.fd-table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--fd-space-2) var(--fd-space-3);
  padding: var(--fd-space-3) var(--fd-space-4);
  border-bottom: 1px solid var(--fd-border);
}
.fd-table-toolbar__count { color: var(--fd-text-muted); font-size: var(--fd-fs-sm); }
.fd-table-toolbar__count b { color: var(--fd-heading); }
.fd-table-toolbar .ms-auto { display: flex; gap: var(--fd-space-2); flex-wrap: wrap; }

.fd-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fd-fs-sm);
}
.fd-table th {
  position: sticky;
  top: 0;
  padding: var(--fd-space-2) var(--fd-space-3);
  border-bottom: 1px solid var(--fd-border);
  background: var(--fd-surface-alt);
  color: var(--fd-text-muted);
  font-size: var(--fd-fs-xs);
  font-weight: 800;
  text-align: left;
  white-space: nowrap;
}
.fd-table td {
  padding: var(--fd-space-3);
  border-bottom: 1px solid var(--fd-border);
  vertical-align: middle;
}
.fd-table tbody tr:last-child td { border-bottom: 0; }
.fd-table tbody tr:hover td { background: var(--fd-surface-alt); }
.fd-table tbody tr.is-selected td { background: var(--fd-brand-soft); }
.fd-table th:first-child,
.fd-table td:first-child { padding-left: var(--fd-space-4); }
.fd-table th:last-child,
.fd-table td:last-child { padding-right: var(--fd-space-4); }

.fd-table .fd-col-check { width: 44px; }
.fd-table .fd-col-num,
.fd-table .fd-money { text-align: right; white-space: nowrap; }
.fd-table .fd-col-actions { width: 1%; text-align: right; white-space: nowrap; }

/* Celda con dato principal y secundario */
.fd-cell-main { display: block; color: var(--fd-heading); font-weight: 700; }
.fd-cell-sub { display: block; color: var(--fd-text-muted); font-size: var(--fd-fs-xs); }
.fd-cell-main a { color: inherit; text-decoration: none; }
.fd-cell-main a:hover { color: var(--fd-brand-strong); text-decoration: underline; }
.fd-folio { color: var(--fd-heading); font-weight: 800; white-space: nowrap; }
.fd-money b { color: var(--fd-heading); font-weight: 800; }
.fd-money .fd-cell-sub { white-space: nowrap; }

/* Fila de comprobante cancelado: se apaga, pero se lee */
.fd-table tr.is-cancelled .fd-folio,
.fd-table tr.is-cancelled .fd-money b { color: var(--fd-text-muted); text-decoration: line-through; text-decoration-thickness: 1px; }

/* Etiqueta de color del comprobante (0 a 4): marca a la izquierda */
.fd-table tr[data-tag] td:first-child { box-shadow: inset 4px 0 0 var(--fd-row-tag, transparent); }
.fd-table tr[data-tag="1"] { --fd-row-tag: var(--fd-tag-1); }
.fd-table tr[data-tag="2"] { --fd-row-tag: var(--fd-tag-2); }
.fd-table tr[data-tag="3"] { --fd-row-tag: var(--fd-tag-3); }
.fd-table tr[data-tag="4"] { --fd-row-tag: var(--fd-tag-4); }

/* Estado del comprobante */
.fd-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 8px;
  border-radius: var(--fd-radius-pill);
  font-size: var(--fd-fs-xs);
  font-weight: 800;
  white-space: nowrap;
}
.fd-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.fd-status--vigente   { background: var(--fd-success-bg); color: var(--fd-success); }
.fd-status--cancelado { background: var(--fd-danger-bg);  color: var(--fd-danger); }
.fd-status--proceso   { background: var(--fd-warning-bg); color: var(--fd-warning); }
.fd-status--proceso::before { background: transparent; border: 2px solid currentColor; border-right-color: transparent; width: 9px; height: 9px; }
.fd-status--neutral   { background: var(--fd-surface-alt); color: var(--fd-text-muted); box-shadow: inset 0 0 0 1px var(--fd-border); }

/* Tipo de comprobante: insignia breve (I, E, P, T, N) */
.fd-type {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: 6px;
  border-radius: var(--fd-radius-xs);
  background: var(--fd-surface-alt);
  box-shadow: inset 0 0 0 1px var(--fd-border);
  color: var(--fd-heading);
  font-size: .6875rem;
  font-weight: 800;
  vertical-align: middle;
}

/* Acciones por fila: íconos con texto oculto + menú «más» */
.fd-row-actions { display: inline-flex; align-items: center; gap: 2px; }
.fd-row-actions .fd-iconbtn { width: 32px; height: 32px; font-size: 1rem; }
.fd-row-actions .fd-iconbtn--pdf { color: var(--fd-danger); }
.fd-row-actions .fd-iconbtn--xml { color: var(--fd-info); }

/* Columnas opcionales: se ocultan en pantallas medianas; mientras se ven,
   el dato repetido bajo el total sobra */
@media (max-width: 1279.98px) {
  .fd-table .fd-col-opt { display: none; }
}
@media (min-width: 1280px) {
  .fd-table:has(.fd-col-opt) .fd-money .fd-cell-sub { display: none; }
}


/* ---------------------------------------------------------------------
   18. Tabla como tarjetas en móvil
   Cada <td> lleva data-label con el nombre de la columna.
   --------------------------------------------------------------------- */
@media (max-width: 767.98px) {
  .fd-table-wrap:has(.fd-table--cards) { border: 0; background: transparent; overflow: visible; }
  .fd-table--cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .fd-table--cards,
  .fd-table--cards tbody { display: block; }
  .fd-table--cards tbody { display: grid; gap: var(--fd-space-3); }
  .fd-table--cards tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--fd-space-1) var(--fd-space-3);
    padding: var(--fd-space-3) var(--fd-space-4);
    border: 1px solid var(--fd-border);
    border-radius: var(--fd-radius-sig);
    background: var(--fd-surface);
  }
  .fd-table--cards tr[data-tag] { box-shadow: inset 4px 0 0 var(--fd-row-tag, transparent); }
  .fd-table--cards tr[data-tag] td:first-child { box-shadow: none; }
  .fd-table--cards td,
  .fd-table--cards td:first-child,
  .fd-table--cards td:last-child { display: block; padding: 0; border: 0; background: transparent; }
  .fd-table--cards tbody tr:hover td { background: transparent; }

  /* Ranuras de la tarjeta */
  .fd-table--cards [data-slot="check"]   { grid-column: 1; grid-row: 1; }
  .fd-table--cards [data-slot="title"]   { grid-column: 2; grid-row: 1; }
  .fd-table--cards [data-slot="status"]  { grid-column: 3; grid-row: 1; justify-self: end; }
  .fd-table--cards [data-slot="body"]    { grid-column: 2 / -1; }
  .fd-table--cards [data-slot="meta-a"]  { grid-column: 2; }
  .fd-table--cards [data-slot="meta-b"]  { grid-column: 3; }
  .fd-table--cards [data-slot="amount"]  { grid-column: 2 / -1; text-align: left; }
  .fd-table--cards [data-slot="actions"] {
    grid-column: 1 / -1;
    margin-top: var(--fd-space-2);
    padding-top: var(--fd-space-2);
    border-top: 1px dashed var(--fd-border);
    text-align: left;
  }
  .fd-table--cards [data-slot="actions"] .fd-row-actions { width: 100%; justify-content: space-between; }
  .fd-table--cards [data-slot="hide"] { display: none; }

  /* Campos con etiqueta visible */
  .fd-table--cards td[data-label]:not([data-slot="title"]):not([data-slot="status"]):not([data-slot="actions"])::before {
    content: attr(data-label);
    display: block;
    color: var(--fd-text-muted);
    font-size: .6875rem;
    font-weight: 700;
  }
  .fd-table--cards .fd-money .fd-cell-sub { display: none; }
  .fd-table--cards .fd-col-opt { display: block; }
  .fd-table--cards .fd-cell-main { font-size: var(--fd-fs-sm); }
}


/* ---------------------------------------------------------------------
   19. Paginación
   <nav class="fd-pager"> con info a la izquierda y .pagination de Bootstrap.
   --------------------------------------------------------------------- */
.fd-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--fd-space-3);
  padding: var(--fd-space-3) var(--fd-space-4);
  border-top: 1px solid var(--fd-border);
}
.fd-pager__info { color: var(--fd-text-muted); font-size: var(--fd-fs-sm); }
.fd-pager__info b { color: var(--fd-heading); }
.fd-pager__size { display: flex; align-items: center; gap: var(--fd-space-2); color: var(--fd-text-muted); font-size: var(--fd-fs-sm); }
.fd-pager__size .form-select { width: auto; }

.pagination {
  --bs-pagination-color: var(--fd-text);
  --bs-pagination-bg: var(--fd-surface);
  --bs-pagination-border-color: var(--fd-border-strong);
  --bs-pagination-hover-color: var(--fd-heading);
  --bs-pagination-hover-bg: var(--fd-surface-alt);
  --bs-pagination-hover-border-color: var(--fd-border-strong);
  --bs-pagination-focus-color: var(--fd-heading);
  --bs-pagination-focus-bg: var(--fd-surface-alt);
  --bs-pagination-focus-box-shadow: var(--fd-focus-ring);
  --bs-pagination-active-color: var(--fd-on-brand);
  --bs-pagination-active-bg: var(--fd-green-600);
  --bs-pagination-active-border-color: var(--fd-green-600);
  --bs-pagination-disabled-color: var(--fd-text-subtle);
  --bs-pagination-disabled-bg: var(--fd-surface);
  --bs-pagination-disabled-border-color: var(--fd-border);
  --bs-pagination-border-radius: var(--fd-radius-sm);
  --bs-pagination-font-size: var(--fd-fs-sm);
  --bs-pagination-padding-x: .75rem;
  margin: 0;
  font-weight: 700;
}
@media (max-width: 767.98px) {
  .fd-table-wrap:has(.fd-table--cards) .fd-pager { border-top: 0; padding-inline: 0; }
  .fd-table-wrap:has(.fd-table--cards) .fd-table-toolbar { border: 0; padding-inline: 0; }
}


/* ---------------------------------------------------------------------
   20. Modal, menú desplegable y toast
   --------------------------------------------------------------------- */
.modal {
  --bs-modal-bg: var(--fd-surface);
  --bs-modal-color: var(--fd-text);
  --bs-modal-border-color: var(--fd-border);
  --bs-modal-border-radius: var(--fd-radius-lg);
  --bs-modal-inner-border-radius: calc(var(--fd-radius-lg) - 1px);
  --bs-modal-box-shadow: var(--fd-shadow-lg);
  --bs-modal-header-padding: 1.125rem 1.5rem;
  --bs-modal-padding: 1.5rem;
  --bs-modal-footer-gap: .5rem;
  --bs-modal-header-border-color: var(--fd-border);
  --bs-modal-footer-border-color: var(--fd-border);
  --bs-modal-footer-bg: var(--fd-surface-alt);
}
.modal-backdrop { --bs-backdrop-bg: #14181b; --bs-backdrop-opacity: .55; }
.modal-title { display: flex; align-items: center; gap: var(--fd-space-2); font-size: var(--fd-fs-lg); font-weight: 800; }
.modal-footer { background: var(--bs-modal-footer-bg); }
.btn-close { --bs-btn-close-focus-shadow: var(--fd-focus-ring); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-close { filter: invert(1) grayscale(100%) brightness(200%); } }
:root[data-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* Resumen del documento dentro de un modal */
.fd-docsum {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px var(--fd-space-4);
  padding: var(--fd-space-3) var(--fd-space-4);
  border: 1px solid var(--fd-border);
  border-radius: var(--fd-radius-sm);
  background: var(--fd-surface-alt);
  font-size: var(--fd-fs-sm);
}
.fd-docsum dt { color: var(--fd-text-muted); font-weight: 700; }
.fd-docsum dd { margin: 0; color: var(--fd-heading); font-weight: 700; min-width: 0; overflow-wrap: anywhere; }

.dropdown-menu {
  --bs-dropdown-bg: var(--fd-surface);
  --bs-dropdown-color: var(--fd-text);
  --bs-dropdown-border-color: var(--fd-border);
  --bs-dropdown-border-radius: var(--fd-radius);
  --bs-dropdown-box-shadow: var(--fd-shadow-md);
  --bs-dropdown-link-color: var(--fd-text);
  --bs-dropdown-link-hover-color: var(--fd-heading);
  --bs-dropdown-link-hover-bg: var(--fd-surface-alt);
  --bs-dropdown-link-active-color: var(--fd-heading);
  --bs-dropdown-link-active-bg: var(--fd-brand-soft);
  --bs-dropdown-header-color: var(--fd-text-muted);
  --bs-dropdown-divider-bg: var(--fd-border);
  --bs-dropdown-item-padding-y: .5rem;
  --bs-dropdown-font-size: var(--fd-fs-base);
  padding: var(--fd-space-1);
  box-shadow: var(--bs-dropdown-box-shadow);
}
.dropdown-item { display: flex; align-items: center; gap: var(--fd-space-2); border-radius: var(--fd-radius-xs); font-weight: 600; }
.dropdown-item > .bi { width: 18px; color: var(--fd-text-muted); }
.dropdown-item.text-danger > .bi { color: inherit; }
.dropdown-item.text-danger { color: var(--fd-danger); }
/* Menú «Emitir CFDI»: el azul de siempre como encabezado */
.fd-menu-emit .dropdown-header { color: var(--fd-blue); font-weight: 800; }

.toast-container { z-index: 1090; }
.toast {
  --bs-toast-bg: var(--fd-surface);
  --bs-toast-color: var(--fd-text);
  --bs-toast-border-color: var(--fd-border);
  --bs-toast-border-radius: var(--fd-radius);
  --bs-toast-box-shadow: var(--fd-shadow-md);
  --bs-toast-max-width: 380px;
  --bs-toast-font-size: var(--fd-fs-sm);
}
.fd-toast { display: flex; align-items: flex-start; gap: var(--fd-space-3); padding: var(--fd-space-3) var(--fd-space-4); border-left: 4px solid var(--fd-toast-fg, var(--fd-info)); border-radius: var(--fd-radius); }
.fd-toast__icon { color: var(--fd-toast-fg, var(--fd-info)); font-size: 1.15rem; line-height: 1.2; }
.fd-toast__title { margin: 0; color: var(--fd-heading); font-weight: 800; font-size: var(--fd-fs-base); }
.fd-toast__body { flex: 1; min-width: 0; }
.fd-toast__body p { margin: 0; }
.fd-toast--success { --fd-toast-fg: var(--fd-success); }
.fd-toast--warning { --fd-toast-fg: var(--fd-warning); }
.fd-toast--danger  { --fd-toast-fg: var(--fd-danger); }


/* ---------------------------------------------------------------------
   21. Estado vacío y espacio reservado
   --------------------------------------------------------------------- */
.fd-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--fd-space-2);
  padding: var(--fd-space-7) var(--fd-space-4);
  text-align: center;
}
.fd-empty__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: var(--fd-space-2);
  border-radius: var(--fd-radius-sig);
  background: var(--fd-brand-soft);
  color: var(--fd-brand-strong);
  font-size: 1.6rem;
}
.fd-empty__title { color: var(--fd-heading); font-size: var(--fd-fs-md); font-weight: 800; }
.fd-empty__text { max-width: 44ch; margin: 0; color: var(--fd-text-muted); }
.fd-empty .btn { margin-top: var(--fd-space-3); }

/* Espacio para HTML externo (tablero de reports.api) */
.fd-embed { min-height: 260px; }
.fd-embed--loading {
  display: grid;
  place-items: center;
  border: 1px dashed var(--fd-border-strong);
  border-radius: var(--fd-radius-sm);
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, var(--fd-surface-alt) 14px 28px);
  color: var(--fd-text-muted);
  font-size: var(--fd-fs-sm);
  text-align: center;
}

/* Barras esqueleto para cargas */
.fd-skeleton {
  display: block;
  height: 12px;
  border-radius: var(--fd-radius-pill);
  background: linear-gradient(90deg, var(--fd-surface-alt) 0, var(--fd-border) 50%, var(--fd-surface-alt) 100%);
  background-size: 200% 100%;
  animation: fd-shimmer 1.4s linear infinite;
}
@keyframes fd-shimmer { to { background-position: -200% 0; } }


/* ---------------------------------------------------------------------
   22. edit-table (web component de Induxsoft)
   El componente dibuja en un shadow DOM cerrado; solo acepta estilos
   por su atributo control-styles. Las variables CSS sí atraviesan el
   shadow DOM, así que el atributo usa los tokens (ver guia.md).
   Aquí se estiliza el contenedor y las tablas con «apariencia» de
   edit-table hechas a mano (.fd-lines).
   --------------------------------------------------------------------- */
.fd-edittable {
  display: block;
  overflow-x: auto;
  border: 1px solid var(--fd-border);
  border-radius: var(--fd-radius-sm);
  background: var(--fd-surface);
}
.fd-edittable edit-table { display: block; width: 100%; min-width: 720px; }
.fd-edittable-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--fd-space-2);
  margin-bottom: var(--fd-space-2);
}
.fd-edittable-toolbar .fd-hint { margin: 0 0 0 auto; }
.fd-kbd {
  display: inline-block;
  padding: 0 5px;
  border: 1px solid var(--fd-border-strong);
  border-bottom-width: 2px;
  border-radius: var(--fd-radius-xs);
  background: var(--fd-surface);
  color: var(--fd-text);
  font-size: .6875rem;
  font-weight: 700;
}


/* ---------------------------------------------------------------------
   Resumen de importes (panel de totales de una factura)
   --------------------------------------------------------------------- */
.fd-summary { display: grid; gap: var(--fd-space-2); margin: 0; }
.fd-summary__row { display: flex; justify-content: space-between; gap: var(--fd-space-3); font-size: var(--fd-fs-sm); }
.fd-summary__row dt { color: var(--fd-text-muted); font-weight: 600; }
.fd-summary__row dd { margin: 0; color: var(--fd-text); font-weight: 700; font-variant-numeric: tabular-nums; }
.fd-summary__row--sub dt { padding-left: var(--fd-space-3); font-size: var(--fd-fs-xs); }
.fd-summary__row--total {
  align-items: baseline;
  margin-top: var(--fd-space-2);
  padding-top: var(--fd-space-3);
  border-top: 2px solid var(--fd-heading);
}
.fd-summary__row--total dt { color: var(--fd-heading); font-size: var(--fd-fs-base); font-weight: 800; }
.fd-summary__row--total dd { color: var(--fd-heading); font-size: 1.625rem; font-weight: 800; letter-spacing: -.01em; }
.fd-summary__words { color: var(--fd-text-muted); font-size: var(--fd-fs-xs); text-align: right; }

/* Encabezado de panel que abre un <details> */
.fd-panel__head--summary { flex-wrap: nowrap; border-bottom: 0; cursor: pointer; list-style: none; }
.fd-panel__head--summary::-webkit-details-marker { display: none; }
.fd-panel__head--summary > .bi { flex: none; transition: transform var(--fd-dur) var(--fd-ease); }
details[open] > .fd-panel__head--summary > .bi { transform: rotate(180deg); }

/* Columna lateral fija para el resumen en escritorio */
.fd-aside-sticky { position: sticky; top: calc(var(--fd-topbar-h) + var(--fd-space-4)); }

/* Barra de acciones fija abajo en móvil (Vista previa / Timbrar) */
.fd-actionbar {
  display: flex;
  gap: var(--fd-space-2);
}
.fd-actionbar .btn { flex: 1 1 0; }
@media (max-width: 991.98px) {
  .fd-actionbar--sticky {
    position: sticky;
    bottom: 0;
    z-index: 1020;
    padding: var(--fd-space-3) 0;
    border-top: 1px solid var(--fd-border);
    /* La franja blanca llega a los bordes de la pantalla sin ensanchar la página */
    box-shadow: 0 0 0 100vmax var(--fd-surface);
    clip-path: inset(0 -100vmax -100vmax);
    background: var(--fd-surface);
  }
}

/* Indicador de borrador guardado */
.fd-saved { display: inline-flex; align-items: center; gap: 6px; color: var(--fd-text-muted); font-size: var(--fd-fs-xs); font-weight: 600; }
.fd-saved .bi { color: var(--fd-success); }

/* Pestañas segmentadas (tipo de comprobante) */
.fd-segment {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--fd-border);
  border-radius: var(--fd-radius-sm);
  background: var(--fd-surface-alt);
}
.fd-segment a,
.fd-segment button {
  padding: 5px 12px;
  border: 0;
  border-radius: var(--fd-radius-xs);
  background: transparent;
  color: var(--fd-text-muted);
  font-size: var(--fd-fs-sm);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
/* En pantallas chicas el segmentado se desliza en vez de partirse */
@media (max-width: 767.98px) {
  .fd-segment--scroll { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
}
.fd-segment a:hover,
.fd-segment button:hover { color: var(--fd-heading); }
.fd-segment [aria-current="page"],
.fd-segment [aria-pressed="true"] {
  background: var(--fd-surface);
  color: var(--fd-heading);
  box-shadow: var(--fd-shadow-xs), inset 0 0 0 1px var(--fd-border);
}


/* ---------------------------------------------------------------------
   23. Inicio de sesión
   La página reutiliza la barra superior; el cuerpo es un panel dividido
   con las diagonales verdes de la portada actual.
   --------------------------------------------------------------------- */
.fd-login {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  min-height: calc(100vh - var(--fd-topbar-h) - 64px);
}
.fd-login__form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--fd-space-6) var(--fd-gutter);
}
.fd-login__card { width: 100%; max-width: 400px; }
.fd-login__logo { display: block; height: 30px; width: auto; margin-bottom: var(--fd-space-5); }
/* El logotipo de Induxsoft es gris sobre transparente: en oscuro va sobre una placa blanca */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .fd-login__logo { box-sizing: content-box; padding: 6px 10px; border-radius: var(--fd-radius-sm); background: #fff; }
}
:root[data-theme="dark"] .fd-login__logo { box-sizing: content-box; padding: 6px 10px; border-radius: var(--fd-radius-sm); background: #fff; }
.fd-login__title { font-size: 1.875rem; font-weight: 800; letter-spacing: -.015em; }
.fd-login__lead { margin: var(--fd-space-2) 0 var(--fd-space-5); color: var(--fd-text-muted); }
.fd-login__form { display: grid; gap: var(--fd-space-4); }
.fd-login__row { display: flex; justify-content: space-between; align-items: center; gap: var(--fd-space-3); font-size: var(--fd-fs-sm); }
.fd-login__signup {
  margin-top: var(--fd-space-5);
  padding-top: var(--fd-space-4);
  border-top: 1px solid var(--fd-border);
  color: var(--fd-text-muted);
  font-size: var(--fd-fs-sm);
}
.fd-login__signup a { font-weight: 800; }

/* Lado de la imagen: foto de la portada con triángulos verdes */
.fd-login__art {
  position: relative;
  overflow: hidden;
  background: var(--fd-green-800);
  isolation: isolate;
}
.fd-login__art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 32% 30%;
  filter: grayscale(1) contrast(1.05);
  opacity: .9;
  z-index: -2;
}
.fd-login__art::before,
.fd-login__art::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
}
/* Diagonal ancha verde oscuro y una más angosta verde FactuDesk */
.fd-login__art::before {
  background: var(--fd-green-700);
  clip-path: polygon(0 0, 34% 0, 12% 100%, 0 100%);
}
.fd-login__art::after {
  background: var(--fd-green-500);
  clip-path: polygon(78% 100%, 100% 58%, 100% 100%);
}
.fd-login__quote {
  position: absolute;
  left: 18%;
  right: var(--fd-space-6);
  bottom: var(--fd-space-6);
  padding: var(--fd-space-4) var(--fd-space-5);
  border-radius: var(--fd-radius-sig);
  background: rgba(20, 30, 25, .78);
  color: #fff;
  backdrop-filter: blur(4px);
}
.fd-login__quote b { display: block; font-size: var(--fd-fs-lg); font-weight: 800; line-height: 1.2; }
.fd-login__quote span { color: #d5e4da; font-size: var(--fd-fs-sm); }
.fd-login__list { margin: var(--fd-space-3) 0 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: var(--fd-fs-sm); color: #e7efe9; }
.fd-login__list .bi { color: #7fd897; margin-right: 6px; }

@media (max-width: 991.98px) {
  .fd-login { grid-template-columns: minmax(0, 1fr); }
  .fd-login__art { order: -1; min-height: 168px; }
  .fd-login__quote { left: var(--fd-space-4); right: var(--fd-space-4); bottom: var(--fd-space-4); padding: var(--fd-space-3) var(--fd-space-4); }
  .fd-login__list { display: none; }
  .fd-login__form-side { align-items: flex-start; padding-top: var(--fd-space-5); }
}

/* Botón «Ingresar» y enlace «Información y precios» en la barra */
.fd-topbar__link {
  color: var(--fd-yellow);
  font-size: var(--fd-fs-sm);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.fd-topbar__link:hover { color: var(--fd-yellow-hover); text-decoration: underline; }


/* ---------------------------------------------------------------------
   24. Utilidades y movimiento reducido
   --------------------------------------------------------------------- */
.fd-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--fd-space-4); }
.fd-stack-lg { display: grid; gap: var(--fd-space-6); }
.fd-row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--fd-space-3); }
.fd-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Rejilla del tablero: timbres + indicadores */
.fd-dash-top {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--fd-space-3);
}
@media (max-width: 1199.98px) {
  .fd-dash-top { grid-template-columns: minmax(0, 1fr); }
}

/* Rejilla de la pantalla de emisión: formulario + resumen */
/* Rejilla de la pantalla de emisión, en el orden de una factura en papel:
   receptor y comprobante arriba, conceptos a todo el ancho, y abajo
   los opcionales a la izquierda y los importes a la derecha. */
.fd-emit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "receptor comprobante"
    "conceptos conceptos"
    "extra importes"
    ".     acciones";
  gap: var(--fd-space-4);
  align-items: start;
}
.fd-emit-grid > [data-area="receptor"]    { grid-area: receptor; }
.fd-emit-grid > [data-area="comprobante"] { grid-area: comprobante; }
.fd-emit-grid > [data-area="conceptos"]   { grid-area: conceptos; }
.fd-emit-grid > [data-area="extra"]       { grid-area: extra; }
.fd-emit-grid > [data-area="importes"]    { grid-area: importes; }
.fd-emit-grid > [data-area="acciones"]    { grid-area: acciones; }
.fd-emit-grid > [data-area="receptor"],
.fd-emit-grid > [data-area="comprobante"] { align-self: stretch; }
@media (max-width: 1199.98px) {
  .fd-emit-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "receptor" "comprobante" "conceptos" "importes" "extra" "acciones";
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    /* Justificado: el usuario pidió quitar animaciones; debe ganar a todo */
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ---------------------------------------------------------------------
   25. Botón flotante de ayuda (NIA)
   Morado, abajo a la derecha, como en el sitio actual. En producción lo
   pinta nia-globe.js; esta clase es para la maqueta y como referencia.
   --------------------------------------------------------------------- */
.fd-help {
  position: fixed;
  z-index: 1035;
  right: var(--fd-space-4);
  bottom: var(--fd-space-4);
  display: inline-flex;
  align-items: center;
  gap: var(--fd-space-2);
  height: 46px;
  padding: 0 var(--fd-space-4);
  border: 0;
  border-radius: var(--fd-radius-pill);
  background: #7a1f86;
  color: #fff;
  font-weight: 700;
  font-size: var(--fd-fs-sm);
  box-shadow: var(--fd-shadow-md);
}
.fd-help:hover { background: #64196e; }
.fd-help .bi { font-size: 1.1rem; }
@media (max-width: 767.98px) {
  .fd-help { width: 48px; height: 48px; padding: 0; justify-content: center; }
  .fd-help__text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
/* Con la barra de acciones fija de Emitir, el botón sube para no taparla */
@media (max-width: 991.98px) {
  body:has(.fd-actionbar--sticky) .fd-help { bottom: 84px; }
}

/* Capa de espera al cambiar de página (shell.js). El velo toma el lienzo del tema (claro u oscuro). */
.pg-espera {
  --pg-espera-velo:   color-mix(in srgb, var(--fd-canvas) 60%, transparent);
  --pg-espera-fondo:  var(--fd-surface);
  --pg-espera-texto:  var(--fd-text);
  --pg-espera-borde:  var(--fd-border-strong);
  --pg-espera-acento: var(--fd-brand);
  --pg-espera-radio:  var(--fd-radius);
}
.pg-espera {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--pg-espera-velo);
  cursor: progress;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s ease, visibility 0s linear .15s;
}
.pg-espera.is-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity .15s ease;
}
.pg-espera__caja {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--pg-espera-fondo);
  color: var(--pg-espera-texto);
  border: 1px solid var(--pg-espera-borde);
  border-radius: var(--pg-espera-radio);
  box-shadow: 0 12px 28px -12px rgba(0, 0, 0, .35);
  font-weight: 500;
}
.pg-espera__giro {
  flex: none;
  width: 22px;
  height: 22px;
  border: 3px solid var(--pg-espera-borde);
  border-top-color: var(--pg-espera-acento);
  border-radius: 50%;
  animation: pg-espera-giro .8s linear infinite;
}
@keyframes pg-espera-giro { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .pg-espera__giro { animation-duration: 2.4s; }
}

/* ---- PROMO26FDSK (lib/promo-vista.dk, assets/js/promo.js) ---- */
.fd-promo-banner {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  margin: 0 0 1.25rem; padding: 1rem 1.25rem; border-radius: .75rem;
  background: linear-gradient(135deg, #fff7d6 0%, #ffe8a3 100%); border: 1px solid #f3c74b; color: #4a3800;
}
.fd-promo-banner__icono { font-size: 2rem; color: #d99a00; line-height: 1; }
.fd-promo-banner__texto { flex: 1 1 16rem; }
.fd-promo-banner__titulo { margin: 0; font-size: 1.05rem; font-weight: 500; }
.fd-promo-banner__accion { font-weight: 600; white-space: nowrap; }
.fd-promo-destacado { box-shadow: 0 0 0 .25rem rgba(40, 167, 69, .35); animation: fd-promo-pulso 1.6s ease-in-out infinite; font-weight: 600; }
@keyframes fd-promo-pulso { 0%, 100% { box-shadow: 0 0 0 .15rem rgba(40, 167, 69, .45); } 50% { box-shadow: 0 0 0 .5rem rgba(40, 167, 69, .1); } }
@media (prefers-reduced-motion: reduce) { .fd-promo-destacado { animation: none; } }

.fd-promo .modal-title .bi { color: #d99a00; }
.fd-promo-ruleta { position: relative; width: min(18rem, 78vw); aspect-ratio: 1; margin: .5rem auto 1rem; }
.fd-promo-ruleta__rueda {
  position: absolute; inset: 0; border-radius: 50%; border: 6px solid #343a40;
  background: conic-gradient(#28a745 0deg 60deg, #ffc107 60deg 120deg, #17a2b8 120deg 180deg,
                             #fd7e14 180deg 240deg, #6f42c1 240deg 300deg, #e83e8c 300deg 360deg);
  box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .2);
}
.fd-promo-ruleta__rueda.is-girando { transition: transform 4s cubic-bezier(.17, .67, .16, 1); }
.fd-promo-ruleta__casilla {
  position: absolute; inset: 0; padding: 11% 34% 0; text-align: center; transform: rotate(var(--giro));
  color: #fff; font-weight: 700; font-size: .78rem; line-height: 1.1; text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
}
.fd-promo-ruleta__puntero {
  position: absolute; z-index: 2; left: 50%; top: -.6rem; margin-left: -.8rem;
  border-left: .8rem solid transparent; border-right: .8rem solid transparent; border-top: 1.4rem solid #dc3545;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .4));
}
.fd-promo-ruleta__girar { position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: 50%; width: 5.5rem; height: 5.5rem; font-weight: 800; border: 4px solid #fff; box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .3); }
.fd-promo-intro { text-align: center; color: var(--bs-secondary-color, #6c757d); margin-bottom: .75rem; }
.fd-promo-oferta { display: none; }
.fd-promo-oferta.is-visible, .fd-promo-oferta[aria-hidden="false"] { display: block; }
.fd-promo-oferta__ganaste { text-align: center; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: #d99a00; margin: 0; }
.fd-promo-oferta__titulo { text-align: center; font-size: 1.35rem; font-weight: 700; margin: .25rem 0 1rem; }
.fd-promo-oferta__opciones { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.fd-promo-opcion { border: 1px solid var(--bs-border-color, #dee2e6); border-radius: .75rem; padding: 1rem; display: flex; flex-direction: column; justify-content: flex-end; gap: .5rem; }
.fd-promo-opcion--compra { border-color: #28a745; background: #edf7f0; }
.fd-promo-opcion--unica { grid-column: 1 / -1; text-align: center; border-color: #28a745; background: #edf7f0; }
.fd-promo-opcion__precio { font-size: 2rem; font-weight: 800; margin: 0; color: #17673a; }
.fd-promo-opcion__precio small { font-size: .9rem; font-weight: 500; }
.fd-promo-opcion__texto { margin: 0; }
.fd-promo-opcion__o { margin: 0; font-size: .85rem; text-transform: uppercase; color: var(--bs-secondary-color, #6c757d); }
.fd-promo-oferta__nota { font-size: .8rem; color: var(--bs-secondary-color, #6c757d); text-align: center; margin: 1rem 0 0; }
.fd-promo--con-premio .fd-promo-ruleta { width: min(11rem, 50vw); }

/* PROMO26FDSK en «3. Creando…» del alta (promo.vista_espera): ruleta que gira sola y la mecánica */
.fd-promo-espera { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; border: 1px solid #f0d68a; background: #fffaf0; border-radius: .75rem; padding: 1rem; }
.fd-promo-ruleta--espera { width: min(12rem, 60vw); margin: .75rem auto; flex: 0 0 auto; }
.fd-promo-ruleta--espera .fd-promo-ruleta__rueda { animation: fd-promo-giro 6s linear infinite; }
.fd-promo-ruleta--espera .fd-promo-ruleta__casilla { font-size: .62rem; }
@keyframes fd-promo-giro { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .fd-promo-ruleta--espera .fd-promo-ruleta__rueda { animation-duration: 30s; } }
.fd-promo-espera__texto { flex: 1 1 18rem; min-width: 0; }
.fd-promo-espera__titulo { font-size: 1.1rem; font-weight: 700; margin: 0 0 .5rem; }
.fd-promo-espera__titulo .bi { color: #d99a00; }
.fd-promo-espera__premios { columns: 2 12rem; margin: 0 0 .75rem; padding-left: 1.25rem; }
.fd-promo-espera__premios li { break-inside: avoid; }
.fd-promo-espera__csd { margin: 0 0 .5rem; font-weight: 500; }
.fd-promo-espera__csd--falta { color: #8a5a00; }
.fd-promo-espera__nota { margin: 0; font-size: .85rem; color: var(--bs-secondary-color, #6c757d); }
