.app-shell--fiscal:has(.tools-page) {
  --tools-navy: #123B43;
  --tools-navy-deep: #0D2E35;
  --tools-navy-soft: #1B4B55;
  --tools-blue: #16866F;
  --tools-blue-strong: #126A57;
  --tools-sky: #EAF5F0;
  --tools-canvas: #F5F4EC;
  --tools-panel: #ffffff;
  --tools-ink: #123B43;
  --tools-muted: #587075;
  --tools-line: #D8DED5;
  --tools-success: #16866F;
  --tools-success-soft: #EAF5F0;
  --tools-warning: #D9B84C;
  --tools-warning-soft: #FBF6DF;
  --tools-danger: #E98268;
  --tools-danger-soft: #FBEDE8;
  --fiscal-petroleum: var(--tools-navy);
  --fiscal-jade: var(--tools-success);
  --fiscal-jade-ink: #126A57;
  --fiscal-ivory: var(--tools-canvas);
  --fiscal-sand: #E4E6D8;
  --fiscal-coral: var(--tools-danger);
  --fiscal-validation: var(--tools-warning);
  --fiscal-text-secondary: #355A5B;
  --fiscal-muted: var(--tools-muted);
  --fiscal-line: var(--tools-line);
  --fiscal-primary: var(--tools-blue);
  --fiscal-primary-strong: var(--tools-blue-strong);
  --island-focus-color: var(--tools-navy);
  --island-focus-accent: var(--tools-blue);
  --island-focus-ring: 0 0 0 3px #ffffff, 0 0 0 6px var(--tools-blue);
  /* Fase 5e: superficies que los CSS de Herramientas usaban como hex
     fijo; en claro valen lo mismo que antes, en oscuro se sobrescriben
     abajo, así el tema claro no cambia ni un píxel. */
  --tools-panel-warm: #FFFEFA;
  --tools-hover: #EDF3EF;
  --tools-line-soft: #DCE3DA;
  --tools-line-strong: #B9CCC5;
  --tools-warning-text: #765B1B;
  --tools-warning-border: #E4D48F;
  --tools-danger-text: #7B322B;
  --tools-danger-border: #E5B2A4;
  --tools-danger-strong: #9E3B2E;
  --tools-danger-pale: #FBF1EC;
  --tools-on-amber: #20372D;
  --tools-success-text: #1F694F;
}

/* Fase 5e · Modo oscuro de Herramientas (opt-in, por defecto claro).
   Solo se activa con `data-tools-theme="dark"` en el `.app-shell--fiscal`
   (lo pone main.js desde localStorage `contaia.tools.theme.v1`). La
   barra lateral y la superior ya son oscuras y no cambian; solo se
   oscurecen lienzo, paneles, texto, líneas y rellenos. Los botones con
   texto blanco sobre jade/petróleo/ámbar conservan sus colores. */
.app-shell--fiscal[data-tools-theme="dark"]:has(.tools-page) {
  color-scheme: dark;
  --tools-navy: #0E2A31;
  --tools-navy-deep: #0A1F24;
  --tools-navy-soft: #16323A;
  --tools-blue: #35A98B;
  --tools-blue-strong: #2B8A72;
  --tools-sky: #1B3238;
  --tools-canvas: #101D21;
  --tools-panel: #16282D;
  --tools-ink: #E6EFEA;
  --tools-muted: #9DBFB2;
  --tools-line: #2C434A;
  --tools-success: #35A98B;
  --tools-success-soft: #14332C;
  --tools-warning: #D9B84C;
  --tools-warning-soft: #3A2F10;
  --tools-danger: #F2A894;
  --tools-danger-soft: #3A1F1A;
  --fiscal-jade-ink: #7CD3AE;
  --fiscal-sand: #1B2B30;
  --fiscal-text-secondary: #B9CFC2;
  --island-focus-ring: 0 0 0 3px #16282D, 0 0 0 6px var(--tools-blue);
  --tools-panel-warm: #1A2E33;
  --tools-hover: #1E3238;
  --tools-line-soft: #2C434A;
  --tools-line-strong: #3D5A60;
  --tools-warning-text: #F0E3B0;
  --tools-warning-border: #6B5B23;
  --tools-danger-text: #F2A894;
  --tools-danger-border: #7A463C;
  --tools-danger-strong: #F2A894;
  --tools-danger-pale: #3A1F1A;
  --tools-success-text: #7CD3AE;
  /* Tokens canónicos heredados dentro de las Herramientas. */
  --color-surface: #16282D;
  --color-ink: #E6EFEA;
  --color-muted: #9DBFB2;
  --color-line: #2C434A;
  --color-ivory: #101D21;
  --color-sand: #1B2B30;
  --color-jade-soft: #14332C;
  --color-amber-soft: #3A2F10;
  --color-coral-soft: #3A1F1A;
  --color-coral-ink: #F2A894;
  --color-text-secondary: #B9CFC2;
  --badge-ready-bg: #14332C;
  --badge-ready-border: #2B5A4A;
  --badge-ready-text: #7CD3AE;
  --badge-review-bg: #3A2F10;
  --badge-review-border: #6B5B23;
  --badge-review-text: #F0E3B0;
  --badge-demo-bg: #3A1F1A;
  --badge-demo-border: #7A463C;
  --badge-demo-text: #F2A894;
  --badge-preparation-bg: #1B2B30;
  --badge-preparation-border: #2C434A;
  --badge-preparation-text: #9DBFB2;
}

.app-shell--fiscal:has(.tools-page),
.app-shell--fiscal:has(.tools-page) .main-shell {
  background: var(--tools-canvas);
  color: var(--tools-ink);
}

/* Distribución tipo plataforma contable: barra superior y navegación lateral. */
.app-shell--fiscal:has(.tools-page) .sidebar {
  width: 244px;
  padding: 18px 12px 16px;
  background: linear-gradient(180deg, var(--tools-navy) 0%, var(--tools-navy-deep) 100%);
  border-right: 1px solid rgba(255, 255, 255, .08);
  color: #F5F7F2;
}
.app-shell--fiscal:has(.tools-page) .brand-button { padding: 4px 8px 18px; color: #ffffff; }
.app-shell--fiscal:has(.tools-page) .brand-mark { color: #5CC9A7; }
.app-shell--fiscal:has(.tools-page) .brand-copy strong { color: #CFE3D6; }
.app-shell--fiscal:has(.tools-page) .brand-copy b { color: #ffffff; }
.app-shell--fiscal:has(.tools-page) .brand-copy b span { color: #8FD8C0; }
.app-shell--fiscal:has(.tools-page) .sidebar-divider { background: rgba(220, 235, 225, .18); }
.app-shell--fiscal:has(.tools-page) .nav-item { min-height: 46px; border-radius: 8px; color: #E3EFE8; }
.app-shell--fiscal:has(.tools-page) .nav-item:hover { background: rgba(22, 134, 111, .22); color: #ffffff; }
.app-shell--fiscal:has(.tools-page) .nav-item.is-active { background: linear-gradient(135deg, #16866F, #126A57); color: #ffffff; box-shadow: 0 8px 18px rgba(18, 59, 67, .28); }
.app-shell--fiscal:has(.tools-page) .nav-label { color: #9DBFB2; }
.app-shell--fiscal:has(.tools-page) .nav-index { color: #8FB5A8; }
.app-shell--fiscal:has(.tools-page) .is-active .nav-index { color: #D8EFE6; }
.app-shell--fiscal:has(.tools-page) .nav-done { color: #7CD3AE; }
.app-shell--fiscal:has(.tools-page) .folio-stamp { border-color: rgba(220, 235, 225, .2); background: rgba(13, 46, 53, .32); }
.app-shell--fiscal:has(.tools-page) .folio-stamp b { color: #9FD8C4; }
.app-shell--fiscal:has(.tools-page) .folio-stamp small,
.app-shell--fiscal:has(.tools-page) .data-link { color: #B9CFC2; }
.app-shell--fiscal:has(.tools-page) .stamp-dot { background: #5CC9A7; box-shadow: 0 0 0 3px rgba(92, 201, 167, .18); }

.app-shell--fiscal:has(.tools-page) .main-shell { margin-left: 244px; }
.app-shell--fiscal:has(.tools-page) .topbar {
  min-height: 64px;
  height: 64px;
  padding-inline: clamp(18px, 3vw, 42px);
  background: var(--tools-navy);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  color: #EFF6F1;
}
.app-shell--fiscal:has(.tools-page) .breadcrumb,
.app-shell--fiscal:has(.tools-page) .topbar-right { color: #B9CFC2; }
.app-shell--fiscal:has(.tools-page) .breadcrumb i { color: #7FA99B; }
.app-shell--fiscal:has(.tools-page) .breadcrumb strong { color: #ffffff; }
.app-shell--fiscal:has(.tools-page) .edition-dot { background: #5CC9A7; }
.app-shell--fiscal:has(.tools-page) .section-tab { color: #CFE3D6; border-radius: 7px; }
.app-shell--fiscal:has(.tools-page) .section-tab b { color: #9DBFB2; }
.app-shell--fiscal:has(.tools-page) .section-tab:hover { border-color: rgba(140, 200, 180, .35); background: rgba(22, 134, 111, .25); color: #fff; }
.app-shell--fiscal:has(.tools-page) .section-tab.is-active { border-color: #16866F; background: var(--tools-blue); color: #fff; box-shadow: 0 5px 12px rgba(18, 59, 67, .2); }
.app-shell--fiscal:has(.tools-page) .section-tab.is-active b { color: #D8EFE6; }
.app-shell--fiscal:has(.tools-page) .tools-menu > summary { color: #EFF6F1; }
.app-shell--fiscal:has(.tools-page) .tools-menu > summary i { color: #9DBFB2; }
.app-shell--fiscal:has(.tools-page) .tools-menu-popover { border-color: var(--tools-line); background: var(--tools-panel); box-shadow: 0 18px 38px rgba(18, 59, 67, .18); }
.app-shell--fiscal:has(.tools-page) .tools-menu-popover .section-tab { color: var(--tools-ink); }
.app-shell--fiscal:has(.tools-page) .tools-menu-popover .section-tab:hover,
.app-shell--fiscal:has(.tools-page) .tools-menu-popover .section-tab.is-active { border-color: var(--tools-line-soft); background: var(--tools-sky); color: var(--tools-ink); }

/* Cabecera y tarjetas principales de Herramientas. */
.app-shell--fiscal:has(.tools-page) .tools-page { width: min(1380px, 100%); padding: 24px clamp(16px, 3vw, 38px) 58px; }
.app-shell--fiscal:has(.tools-page) .tool-shell-header {
  border-color: var(--tools-line);
  border-radius: 10px;
  background: var(--tools-panel);
  box-shadow: 0 10px 26px rgba(18, 59, 67, .07);
}
.app-shell--fiscal:has(.tools-page) .tool-shell-header::before { background: var(--tools-blue); }
.app-shell--fiscal:has(.tools-page) .tool-shell-eyebrow,
.app-shell--fiscal:has(.tools-page) .tools-page-kicker { color: var(--tools-blue-strong); }
.app-shell--fiscal:has(.tools-page) .tool-shell-header h1,
.app-shell--fiscal:has(.tools-page) .tools-section-heading h2,
.app-shell--fiscal:has(.tools-page) .tools-profile-strip h2 { color: var(--tools-ink); }
.app-shell--fiscal:has(.tools-page) .tool-shell-description,
.app-shell--fiscal:has(.tools-page) .tools-profile-strip p:last-child,
.app-shell--fiscal:has(.tools-page) .tools-card-description,
.app-shell--fiscal:has(.tools-page) .tools-form-privacy,
.app-shell--fiscal:has(.tools-page) .tools-connections-note { color: var(--tools-muted); }
.app-shell--fiscal:has(.tools-page) .tool-shell-status { border-color: var(--tools-line); background: var(--tools-hover); color: var(--tools-ink); white-space: normal; }
.app-shell--fiscal:has(.tools-page) .tools-overview-card,
.app-shell--fiscal:has(.tools-page) .tools-card {
  border-color: var(--tools-line);
  background: var(--tools-panel);
  box-shadow: 0 7px 18px rgba(18, 59, 67, .045);
}
.app-shell--fiscal:has(.tools-page) .tools-overview-card:hover,
.app-shell--fiscal:has(.tools-page) .tools-card:hover { border-color: var(--tools-line-strong); box-shadow: 0 12px 26px rgba(18, 59, 67, .1); }
.app-shell--fiscal:has(.tools-page) .tools-overview-icon,
.app-shell--fiscal:has(.tools-page) .tools-card-icon,
.app-shell--fiscal:has(.tools-page) .tools-profile-mark { border-color: var(--tools-line-soft); background: var(--tools-sky); color: var(--tools-blue-strong); }
.app-shell--fiscal:has(.tools-page) .tools-card h2 { color: var(--tools-ink); }
.app-shell--fiscal:has(.tools-page) .tools-card-eyebrow,
.app-shell--fiscal:has(.tools-page) .tools-profile-strip .eyebrow,
.app-shell--fiscal:has(.tools-page) .tools-card-connection-label,
.app-shell--fiscal:has(.tools-page) .tools-status-legend-label { color: var(--tools-blue-strong); }
.app-shell--fiscal:has(.tools-page) .tools-card-action { border-color: var(--tools-line-soft); color: var(--tools-blue-strong); background: var(--tools-panel); }
.app-shell--fiscal:has(.tools-page) .tools-card-action:hover { border-color: var(--tools-blue); background: var(--tools-sky); }
.app-shell--fiscal:has(.tools-page) .tools-card-action.button-primary,
.app-shell--fiscal:has(.tools-page) .button-primary,
.app-shell--fiscal:has(.tools-page) .island-frame-action.button-primary {
  border-color: var(--tools-blue);
  background: var(--tools-blue);
  color: #fff;
  box-shadow: 0 5px 12px rgba(22, 134, 111, .18);
}
.app-shell--fiscal:has(.tools-page) .tools-card-action.button-primary:hover:not(:disabled),
.app-shell--fiscal:has(.tools-page) .button-primary:hover:not(:disabled),
.app-shell--fiscal:has(.tools-page) .island-frame-action.button-primary:hover:not(:disabled) { border-color: var(--tools-blue-strong); background: var(--tools-blue-strong); box-shadow: 0 8px 18px rgba(22, 134, 111, .25); }
.app-shell--fiscal:has(.tools-page) .tools-profile-strip { border-color: var(--tools-line-soft); background: linear-gradient(110deg, var(--tools-hover), var(--tools-panel)); }
.app-shell--fiscal:has(.tools-page) .tools-profile-select,
.app-shell--fiscal:has(.tools-page) .tools-data-form input:not([type="checkbox"]):not([type="hidden"]),
.app-shell--fiscal:has(.tools-page) .tools-data-form select { border-color: var(--tools-line-soft); background: var(--tools-panel); color: var(--tools-ink); }
.app-shell--fiscal:has(.tools-page) .tools-data-form input:focus-visible,
.app-shell--fiscal:has(.tools-page) .tools-data-form select:focus-visible,
.app-shell--fiscal:has(.tools-page) .tools-profile-select:focus-visible,
.app-shell--fiscal:has(.tools-page) :is(button, input, select, textarea):focus-visible { border-color: var(--tools-blue); outline: 2px solid var(--tools-blue); outline-offset: 3px; box-shadow: 0 0 0 3px var(--tools-panel)fff, 0 0 0 6px var(--tools-blue); }
.app-shell--fiscal:has(.tools-page) .tools-notice { border-left-color: var(--tools-blue); background: var(--tools-sky); color: var(--fiscal-text-secondary); }
.app-shell--fiscal:has(.tools-page) .tools-disclaimer { border-color: var(--tools-line); background: var(--tools-hover); color: var(--tools-muted); }
.app-shell--fiscal:has(.tools-page) .tools-disclaimer > span { background: var(--tools-blue); color: #fff; }

/* Variante hero heredada y estados de conexión. */
.app-shell--fiscal:has(.tools-page) .tools-hero { background: linear-gradient(115deg, var(--tools-navy-deep), var(--tools-navy-soft)); }
.app-shell--fiscal:has(.tools-page) .tools-hero .eyebrow { color: #BFE6D8; }
.app-shell--fiscal:has(.tools-page) .tools-hero h1 em,
.app-shell--fiscal:has(.tools-page) .tools-hero-mark { color: #8FD8C0; }
.app-shell--fiscal:has(.tools-page) .tools-hero-mark { border-color: rgba(143, 216, 192, .62); }
.app-shell--fiscal:has(.tools-page) .tools-hero-mark::before,
.app-shell--fiscal:has(.tools-page) .tools-hero-mark::after { border-color: rgba(143, 216, 192, .28); }
.app-shell--fiscal:has(.tools-page) .tools-hero-mark i { background: #5CC9A7; }
.app-shell--fiscal:has(.tools-page) .tools-connection-status.is-not-configured { border-color: var(--tools-line); background: var(--color-sand-soft); color: var(--tools-muted); }
.app-shell--fiscal:has(.tools-page) .tools-connection-status.is-pending { border-color: var(--badge-review-border); background: var(--tools-warning-soft); color: var(--color-amber-ink); }
.app-shell--fiscal:has(.tools-page) .tools-connection-status.is-connected { border-color: var(--badge-ready-border); background: var(--tools-success-soft); color: var(--fiscal-jade-ink); }
.app-shell--fiscal:has(.tools-page) .tools-connection-status.is-review { border-color: var(--badge-review-border); background: var(--tools-warning-soft); color: var(--color-amber-ink); }
.app-shell--fiscal:has(.tools-page) .tools-connection-status.is-error { border-color: var(--badge-demo-border); background: var(--tools-danger-soft); color: var(--color-coral-ink); }
.app-shell--fiscal:has(.tools-page) .tools-connection-status.is-disabled,
.app-shell--fiscal:has(.tools-page) .tools-connection-status.is-unknown { border-color: var(--tools-line); background: var(--color-sand-soft); color: var(--tools-muted); }

@media (max-width: 1000px) {
  .app-shell--fiscal:has(.tools-page) .sidebar { width: 226px; }
  .app-shell--fiscal:has(.tools-page) .main-shell { margin-left: 226px; }
  /* Bloque 36: la barra tiene altura fija de 64 px; al colapsar en dos
     filas (styles.css) debe crecer, si no la segunda fila se superpone
     al contenido. */
  .app-shell--fiscal:has(.tools-page) .topbar { height: auto; }
}

@media (max-width: 760px) {
  .app-shell--fiscal:has(.tools-page) .sidebar { width: 100%; padding: 8px 14px; background: var(--tools-navy); border-bottom-color: rgba(255, 255, 255, .12); }
  .app-shell--fiscal:has(.tools-page) .main-shell { margin-left: 0; }
  .app-shell--fiscal:has(.tools-page) .topbar { min-height: 50px; height: auto; background: var(--tools-navy-deep); }
  .app-shell--fiscal:has(.tools-page) .tools-page { padding-inline: 12px; }
  .app-shell--fiscal:has(.tools-page) .tools-profile-actions { width: 100%; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  /* Con movimiento reducido se apaga el movimiento decorativo del
     shell, pero no la respuesta de botones, enlaces, controles y
     tarjetas: su transición es la confirmación visible de la acción. */
  .app-shell--fiscal:has(.tools-page) *:not(button):not(a):not(input):not(select):not(textarea):not([role="button"]):not(summary):not(.tools-card),
  .app-shell--fiscal:has(.tools-page) *:not(button):not(a):not(input):not(select):not(textarea):not([role="button"]):not(summary):not(.tools-card)::before,
  .app-shell--fiscal:has(.tools-page) *:not(button):not(a):not(input):not(select):not(textarea):not([role="button"]):not(summary):not(.tools-card)::after { animation: none !important; transition: none !important; }
}

/* Extensión del tema de plataforma a las vistas individuales de herramientas. */
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) {
  --tools-navy: #123B43;
  --tools-navy-deep: #0D2E35;
  --tools-navy-soft: #1B4B55;
  --tools-blue: #16866F;
  --tools-blue-strong: #126A57;
  --tools-sky: var(--tools-success-soft);
  --tools-canvas: #F5F4EC;
  --tools-panel: #ffffff;
  --tools-ink: #123B43;
  --tools-success: #16866F;
  --tools-danger: #E98268;
  --fiscal-petroleum: var(--tools-navy);
  --fiscal-jade: var(--tools-success);
  --fiscal-jade-ink: #126A57;
  --fiscal-ivory: var(--tools-canvas);
  --fiscal-sand: #E4E6D8;
  --fiscal-coral: var(--tools-danger);
  --fiscal-validation: var(--tools-warning);
  --fiscal-muted: var(--tools-muted);
  --fiscal-line: var(--tools-line);
  --fiscal-primary: var(--tools-blue);
  --fiscal-primary-strong: var(--tools-blue-strong);
  --island-focus-color: var(--tools-ink);
  --island-focus-accent: var(--tools-blue);
  --island-focus-ring: 0 0 0 3px #ffffff, 0 0 0 6px var(--tools-blue);
}

.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)),
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .main-shell {
  background: var(--tools-canvas);
  color: var(--tools-ink);
}
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .sidebar {
  width: 244px;
  padding: 18px 12px 16px;
  border-right: 1px solid rgba(255, 255, 255, .08);
  background: linear-gradient(180deg, var(--tools-navy) 0%, var(--tools-navy-deep) 100%);
  color: var(--tools-hover);
}
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .main-shell { margin-left: 244px; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .topbar {
  min-height: 64px;
  height: 64px;
  padding-inline: clamp(18px, 3vw, 42px);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  background: var(--tools-navy);
  color: #EFF6F1;
}
/* El Analizador CFDI monta su contenido por isla asíncrona: antes de
   que llegue .tool-shell-header, la barra superior caía en el fondo
   blanco de styles.css, mientras en el resto de Herramientas es
   oscura desde el primer pintado. El host de la isla existe desde el
   inicio, así que con este alcance la barra es oscura al entrar. */
.app-shell--fiscal:has([data-cfdi-island-host]) .topbar {
  min-height: 64px;
  height: 64px;
  padding-inline: clamp(18px, 3vw, 42px);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  background: var(--tools-navy);
  color: #EFF6F1;
}
.app-shell--fiscal:has([data-cfdi-island-host]) .breadcrumb,
.app-shell--fiscal:has([data-cfdi-island-host]) .topbar-right { color: #B9CFC2; }
.app-shell--fiscal:has([data-cfdi-island-host]) .breadcrumb i { color: #7FA99B; }
.app-shell--fiscal:has([data-cfdi-island-host]) .breadcrumb strong { color: #fff; }
.app-shell--fiscal:has([data-cfdi-island-host]) .edition-dot { background: #5CC9A7; }
.app-shell--fiscal:has([data-cfdi-island-host]) .section-tab { color: #CFE3D6; border-radius: 7px; }
.app-shell--fiscal:has([data-cfdi-island-host]) .section-tab b { color: #9DBFB2; }
.app-shell--fiscal:has([data-cfdi-island-host]) .section-tab:hover { border-color: rgba(140, 200, 180, .35); background: rgba(22, 134, 111, .25); color: #fff; }
.app-shell--fiscal:has([data-cfdi-island-host]) .section-tab.is-active { border-color: #16866F; background: var(--tools-blue); color: #fff; box-shadow: 0 5px 12px rgba(18, 59, 67, .2); }
.app-shell--fiscal:has([data-cfdi-island-host]) .section-tab.is-active b { color: #D8EFE6; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .brand-button { padding: 4px 8px 18px; color: #fff; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .brand-mark { color: #5CC9A7; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .brand-copy strong { color: #CFE3D6; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .brand-copy b { color: #fff; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .brand-copy b span { color: #8FD8C0; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .sidebar-divider { background: rgba(220, 235, 225, .18); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .nav-item { min-height: 46px; border-radius: 8px; color: #E3EFE8; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .nav-item:hover { background: rgba(22, 134, 111, .22); color: #fff; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .nav-item.is-active { background: linear-gradient(135deg, #16866F, var(--fiscal-jade-ink)); color: #fff; box-shadow: 0 8px 18px rgba(18, 59, 67, .28); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .nav-label { color: #9DBFB2; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .nav-index { color: #8FB5A8; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .is-active .nav-index { color: #D8EFE6; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .nav-done { color: #7CD3AE; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .folio-stamp { border-color: rgba(220, 235, 225, .2); background: rgba(13, 46, 53, .32); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .folio-stamp b { color: #9FD8C4; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .folio-stamp small,
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .data-link { color: #B9CFC2; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .stamp-dot { background: #5CC9A7; box-shadow: 0 0 0 3px rgba(92, 201, 167, .18); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .breadcrumb,
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .topbar-right { color: #B9CFC2; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .breadcrumb i { color: #7FA99B; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .breadcrumb strong { color: #fff; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .edition-dot { background: #5CC9A7; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .section-tab { color: #CFE3D6; border-radius: 7px; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .section-tab b { color: #9DBFB2; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .section-tab:hover { border-color: rgba(140, 200, 180, .35); background: rgba(22, 134, 111, .25); color: #fff; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .section-tab.is-active { border-color: #16866F; background: var(--tools-blue); color: #fff; box-shadow: 0 5px 12px rgba(18, 59, 67, .2); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .section-tab.is-active b { color: #D8EFE6; }
/* Bloque 36: el desplegable Herramientas tiene fondo blanco, pero la regla
   de arriba pinta TODOS los .section-tab de la cáscara fiscal en menta
   claro (#CFE3D6, pensado para la barra oscura). Sin esta anulación los
   ítems inactivos del menú eran casi invisibles (contraste ~1,2:1). */
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .tools-menu-popover .section-tab { color: var(--tools-ink); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .tools-menu-popover .section-tab:hover,
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .tools-menu-popover .section-tab.is-active { border-color: var(--tools-line-soft); background: var(--tools-sky); color: var(--tools-ink); }

.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content:is(.cfdi-page, .diot-page, .journal-page, .recon-page, .workpapers-page) {
  width: min(100%, 1380px);
  color: var(--tools-ink);
}
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .tool-shell-header {
  margin-bottom: 14px;
  border-color: var(--tools-line);
  border-radius: 10px;
  background: var(--tools-panel);
  box-shadow: 0 10px 26px rgba(18, 59, 67, .07);
}
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .tool-shell-header::before { background: var(--tools-blue); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .tool-shell-eyebrow { color: var(--tools-blue-strong); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .tool-shell-header h1 { color: var(--tools-ink); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .tool-shell-description { color: var(--tools-muted); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .tool-shell-status { border-color: var(--tools-line); background: var(--tools-hover); color: var(--tools-ink); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .tool-shell-action { border-color: var(--tools-line-soft); color: var(--tools-blue-strong); background: var(--tools-panel); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .tool-shell-action:hover:not(:disabled) { border-color: var(--tools-blue); background: var(--tools-sky); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .button-primary,
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .button-primary,
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .island-frame-action.button-primary {
  border-color: var(--tools-blue) !important;
  background: var(--tools-blue) !important;
  color: #fff;
  box-shadow: 0 5px 12px rgba(22, 134, 111, .18);
}
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .button-primary:hover:not(:disabled),
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .button-primary:hover:not(:disabled),
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .island-frame-action.button-primary:hover:not(:disabled) { border-color: var(--tools-blue-strong) !important; background: var(--tools-blue-strong) !important; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content :is(button, input, select, textarea):focus-visible { border-color: var(--tools-blue); outline: 2px solid var(--tools-blue); outline-offset: 3px; box-shadow: 0 0 0 3px var(--tools-panel), 0 0 0 6px var(--tools-blue); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content :is(.diot-stage, .diot-review-stage, .diot-download-stage, .journal-source-stage, .journal-rule-stage, .journal-review-stage, .journal-config-stage, .recon-step-card, .recon-results-empty, .workpapers-dashboard, .workpapers-flow-stage, .workpapers-sheet-card, .workpapers-provenance, .workpapers-plans) {
  border-color: var(--tools-line);
  border-radius: 10px;
  background-color: #fff;
  box-shadow: 0 7px 20px rgba(18, 59, 67, .045);
}
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content :is(.diot-privacy-banner, .journal-privacy-banner, .recon-privacy-banner, .workpapers-privacy-banner) {
  border-color: var(--tools-line-soft);
  border-left-color: var(--tools-blue);
  background: linear-gradient(110deg, var(--tools-hover), #fff);
  color: var(--fiscal-text-secondary);
}
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content :is(.diot-disclaimer, .journal-disclaimer, .recon-disclaimer, .workpapers-disclaimer) {
  border-color: var(--tools-line);
  background: var(--tools-hover);
  color: var(--tools-muted);
}
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content :is(.diot-section-heading .eyebrow, .journal-section-heading .eyebrow, .recon-section-title .eyebrow, .recon-results-heading .eyebrow) { color: var(--tools-blue-strong); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content :is(.diot-stepper button.is-active, .journal-tabs button.is-active, .workpapers-tabs button[aria-selected="true"]) {
  border-color: var(--tools-line-soft);
  border-bottom-color: var(--tools-blue);
  background: var(--tools-sky);
  color: var(--tools-ink);
}
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content :is(.diot-field input, .diot-field select, .diot-row textarea, .diot-assistant textarea, .journal-field input, .journal-field select, .journal-assistant textarea, .recon-field input, .recon-field select, .recon-filter select, .workpapers-period-control select) {
  border-color: var(--tools-line-soft);
  background: var(--tools-panel);
  color: var(--tools-ink);
}
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content :is(.diot-empty, .journal-empty-source, .journal-empty-drafts, .journal-detail-empty, .recon-results-empty) { border-color: var(--tools-line); background: var(--tools-hover); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content :is(.diot-row, .diot-issues, .diot-aggregates, .diot-preview, .journal-source-card, .journal-draft-item, .journal-draft-detail, .journal-rule-card, .recon-summary-card, .workpapers-source-card) { border-color: var(--tools-line); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-guidance {
  display: grid;
  grid-template-columns: minmax(135px, .8fr) minmax(190px, 1.2fr) minmax(190px, 1.2fr) minmax(220px, 1.6fr);
  gap: 14px;
  margin: 0 0 18px;
  padding: 16px 18px;
  border: 1px solid var(--tools-line);
  border-radius: 10px;
  background: linear-gradient(110deg, var(--tools-hover), #fff 72%);
  color: var(--tools-ink);
  box-shadow: 0 5px 16px rgba(18, 59, 67, .035);
}
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-guidance-item { min-width: 0; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-guidance-item > span { display: block; margin-bottom: 5px; color: var(--tools-blue-strong); font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-guidance-item > b { color: var(--tools-ink); font-size: .92rem; line-height: 1.45; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-guidance-item > p,
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-guidance-item > ul { margin: 0; color: var(--tools-muted); font-size: .82rem; line-height: 1.5; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-guidance-item > ul { padding-left: 17px; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-guidance-state > b { display: flex; align-items: flex-start; gap: 8px; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-guidance-state > b > i { display: grid; width: 23px; height: 23px; flex: none; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-size: .8rem; font-style: normal; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-guidance-state.is-info > b > i { color: var(--fiscal-jade-ink); background: var(--tools-success-soft); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-guidance-state.is-ready > b > i,
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-guidance-pending > p > i { color: var(--fiscal-jade-ink); background: var(--tools-success-soft); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-guidance-state.is-pending > b > i { color: var(--fiscal-jade-ink); background: var(--tools-success-soft); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-guidance-state.is-attention > b > i { color: var(--color-amber-ink); background: var(--tools-warning-soft); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-guidance-state.is-error > b > i { color: var(--color-coral-ink); background: var(--tools-danger-soft); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-guidance-boundary { align-self: stretch; padding: 10px 12px; border: 1px solid var(--badge-review-border); border-left: 4px solid var(--tools-warning); border-radius: 8px; background: var(--tools-warning-soft); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-guidance-boundary > span { color: var(--color-amber-ink); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-guidance-boundary > span > i { margin-right: 4px; font-style: normal; }

/* Progress states remain distinguishable by label, icon and shape—not color alone. */
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .diot-stepper button { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; gap: 2px 7px; min-width: 112px; min-height: 58px; padding: 7px 9px; border: 1px solid transparent; border-bottom: 3px solid transparent; border-radius: 8px 8px 0 0; text-align: left; white-space: normal; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .diot-stepper button .diot-step-label { font-size: .76rem; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .diot-stepper button small { grid-column: 2 / 4; color: inherit; font-size: .64rem; font-weight: 600; opacity: .82; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .diot-stepper button.is-complete { border-color: var(--badge-ready-border); border-bottom-color: #16866F; background: var(--tools-success-soft); color: var(--fiscal-jade-ink); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .diot-stepper button.is-upcoming { color: var(--tools-muted); background: var(--tools-hover); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .workpapers-stage-rail button { min-height: 64px; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .workpapers-stage-rail .is-upcoming button { border-style: dashed; color: var(--tools-muted); background: var(--tools-hover); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .workpapers-stage-rail .is-complete button { border-color: var(--badge-ready-border); background: var(--tools-success-soft); color: var(--fiscal-jade-ink); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .workpapers-stage-copy { display: grid; width: auto; min-width: 0; flex: 1; gap: 3px; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .workpapers-stage-copy b { white-space: normal; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .workpapers-stage-copy small { color: inherit; font-size: .63rem; line-height: 1.25; opacity: .8; }

/* Form labels and controls use consistent spacing, legible type and touch targets. */
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content :is(.diot-field > span, .journal-field > span, .recon-field > span, .workpapers-period-control label) { color: var(--tools-ink); font-size: .78rem; font-weight: 750; line-height: 1.4; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content :is(.diot-field input, .diot-field select, .diot-row textarea, .diot-assistant textarea, .journal-field input, .journal-field select, .journal-assistant textarea, .recon-field input, .recon-field select, .recon-filter select, .workpapers-period-control select) { min-height: 44px; font-size: .9rem; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content :is(.diot-field, .journal-field, .recon-field) :is(input, select, textarea)[required] { border-left: 3px solid #7FA99B; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content :is(.diot-field, .journal-field):has(:is(input, select, textarea)[required]) > span::after { content: " · obligatorio"; color: var(--tools-muted); font-size: .68rem; font-weight: 600; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content :is(.diot-field, .journal-field, .recon-field) :is(input, select, textarea)[aria-invalid="true"] { border-color: var(--tools-danger-strong); background: var(--tools-danger-pale); box-shadow: 0 0 0 1px var(--tools-danger-strong); }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content :is(.tool-shell-action, .diot-filter, .diot-download-actions .button, .journal-tabs button, .recon-remove-file, .recon-run-actions .button, .workpapers-stage-rail button, .workpapers-tabs button) { min-height: 44px; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content :is(.diot-exclude, .diot-acknowledge) input { width: 20px; height: 20px; flex: none; }

/* Confirmation messages are persistent, announced and visually different from errors. */
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content :is(.cfdi-progress.is-ready[role="status"], .cfdi-operation-confirmation[role="status"], .cfdi-workbook-message.is-success[role="status"], .cfdi-success-text[role="status"], .cfdi-db-status.is-ready[role="status"], .diot-source-note[role="status"], .journal-inline-note[role="status"], .recon-notice[role="status"], .recon-source-ok[role="status"], .workpapers-notice[role="status"]) { display: flex; align-items: flex-start; gap: 9px; padding: 10px 12px; border: 1px solid var(--badge-ready-border); border-left: 4px solid #16866F; border-radius: 7px; background: var(--tools-success-soft); color: var(--fiscal-jade-ink); font-size: .82rem; line-height: 1.5; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content :is(.cfdi-progress.is-ready[role="status"], .cfdi-operation-confirmation[role="status"], .cfdi-workbook-message.is-success[role="status"], .cfdi-success-text[role="status"], .cfdi-db-status.is-ready[role="status"], .diot-source-note[role="status"], .journal-inline-note[role="status"], .recon-notice[role="status"], .recon-source-ok[role="status"], .workpapers-notice[role="status"])::before { content: "✓"; display: grid; width: 21px; height: 21px; flex: none; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-weight: 800; }
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content :is(.cfdi-workbook-message.is-error[role="status"], .recon-source-warning[role="status"], .cfdi-batch-message[role="alert"], .journal-inline-error[role="alert"], .recon-inline-error[role="alert"], .recon-error[role="alert"]) { border-left: 4px solid var(--tools-danger-strong); background: var(--tools-danger-pale); color: var(--color-coral-ink); }

/* Privacy and product limits have a separate visual panel from progress and errors. */
.app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content :is(.cfdi-privacy-note, .diot-privacy-banner, .journal-privacy-banner, .recon-privacy-banner, .workpapers-privacy-banner) { border-left: 4px solid var(--tools-blue); background: var(--tools-hover); color: var(--fiscal-text-secondary); }

@media (max-width: 1000px) {
  .app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .sidebar { width: 226px; }
  .app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .main-shell { margin-left: 226px; }
  /* Bloque 36: igual que en la página Herramientas: la barra de 64 px
     debe crecer al colapsar en dos filas. */
  .app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .topbar { height: auto; }
  .app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-guidance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .workpapers-stage-rail { display: flex; overflow-x: auto; padding-bottom: 3px; scroll-snap-type: x proximity; }
  .app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .workpapers-stage-rail li { flex: 0 0 132px; scroll-snap-align: start; }
}
@media (max-width: 760px) {
  .app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .sidebar { width: 100%; padding: 8px 14px; border-bottom-color: rgba(255, 255, 255, .12); background: var(--tools-navy); }
  .app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .main-shell { margin-left: 0; }
  .app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .topbar { min-height: 50px; height: auto; background: var(--tools-navy-deep); }
  .app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-guidance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-shell-header { align-items: stretch; }
  .app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-shell-actions { display: grid; grid-template-columns: minmax(0, 1fr); align-items: stretch; }
  .app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-shell-action { width: 100%; justify-content: center; }
}
@media (max-width: 520px) {
  .app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content .tool-guidance { grid-template-columns: minmax(0, 1fr); gap: 11px; padding: 14px; }
  .app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content :is(.diot-form-grid, .recon-file-options, .recon-form-grid) { grid-template-columns: minmax(0, 1fr); }
  .app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) .content :is(input, select, textarea) { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  /* Con movimiento reducido se apaga el movimiento decorativo del
     shell, pero no la respuesta de botones, enlaces, controles y
     tarjetas: su transición es la confirmación visible de la acción. */
  .app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) *:not(button):not(a):not(input):not(select):not(textarea):not([role="button"]):not(summary):not(.tools-card),
  .app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) *:not(button):not(a):not(input):not(select):not(textarea):not([role="button"]):not(summary):not(.tools-card)::before,
  .app-shell--fiscal:has(.tool-shell-header):not(:has(.tools-page)) *:not(button):not(a):not(input):not(select):not(textarea):not([role="button"]):not(summary):not(.tools-card)::after { animation: none !important; transition: none !important; }
}


/* Tema de Herramientas fiscales como identidad común del shell autenticado. */
.app-shell--platform {
  color-scheme: light;
  --tools-navy: #123B43;
  --tools-navy-deep: #0D2E35;
  --tools-navy-soft: #1B4B55;
  --tools-blue: #16866F;
  --tools-blue-strong: #126A57;
  --tools-sky: #EAF5F0;
  --tools-canvas: #F5F4EC;
  --tools-panel: #ffffff;
  --tools-ink: #123B43;
  --tools-muted: #587075;
  --tools-line: #D8DED5;
  --tools-success: #16866F;
  --tools-success-soft: #EAF5F0;
  --tools-warning: #D9B84C;
  --tools-warning-soft: #FBF6DF;
  --tools-danger: #E98268;
  --tools-danger-soft: #FBEDE8;
  --wine: var(--tools-navy);
  --wine-dark: var(--tools-navy-deep);
  --gold: var(--tools-blue);
  --gold-pale: var(--tools-sky);
  --paper: var(--tools-canvas);
  --paper-bright: var(--tools-panel);
  --ink: var(--tools-ink);
  --muted: var(--tools-muted);
  --line: var(--tools-line);
  --green: var(--tools-success);
  --green-pale: var(--tools-success-soft);
  --red-pale: var(--tools-danger-soft);
  --fiscal-petroleum: var(--tools-navy);
  --fiscal-jade: var(--tools-success);
  --fiscal-jade-ink: #126A57;
  --fiscal-ivory: var(--tools-canvas);
  --fiscal-sand: #E4E6D8;
  --fiscal-coral: var(--tools-danger);
  --fiscal-validation: var(--tools-warning);
  --fiscal-text-secondary: #355A5B;
  --fiscal-muted: var(--tools-muted);
  --fiscal-line: var(--tools-line);
  --fiscal-primary: var(--tools-blue);
  --fiscal-primary-strong: var(--tools-blue-strong);
  --island-focus-color: var(--tools-navy);
  --island-focus-accent: var(--tools-blue);
  --island-focus-ring: 0 0 0 3px #ffffff, 0 0 0 6px var(--tools-blue);
}

.app-shell--platform:not(.app-shell--fiscal) {
  background: var(--tools-canvas);
  color: var(--tools-ink);
}
.app-shell--platform:not(.app-shell--fiscal) .main-shell,
.app-shell--platform:not(.app-shell--fiscal) .main-shell-live { background: var(--tools-canvas); color: var(--tools-ink); }
.app-shell--platform:not(.app-shell--fiscal) .main-shell:not(.main-shell-live) { margin-left: 244px; }
.app-shell--platform:not(.app-shell--fiscal) .sidebar {
  width: 244px;
  padding: 18px 12px 16px;
  border-right: 1px solid rgba(255, 255, 255, .08);
  background: linear-gradient(180deg, var(--tools-navy) 0%, var(--tools-navy-deep) 100%);
  color: #F5F7F2;
}
.app-shell--platform:not(.app-shell--fiscal) .brand-button { padding: 4px 8px 18px; color: #ffffff; }
.app-shell--platform:not(.app-shell--fiscal) .brand-mark { color: #5CC9A7; }
.app-shell--platform:not(.app-shell--fiscal) .brand-copy strong { color: #CFE3D6; }
.app-shell--platform:not(.app-shell--fiscal) .brand-copy b { color: #ffffff; }
.app-shell--platform:not(.app-shell--fiscal) .brand-copy b span { color: #8FD8C0; }
.app-shell--platform:not(.app-shell--fiscal) .sidebar-divider { background: rgba(220, 235, 225, .18); }
.app-shell--platform:not(.app-shell--fiscal) .nav-item { min-height: 46px; border-radius: 8px; color: #E3EFE8; }
.app-shell--platform:not(.app-shell--fiscal) .nav-item:hover { background: rgba(22, 134, 111, .22); color: #ffffff; }
.app-shell--platform:not(.app-shell--fiscal) .nav-item.is-active { background: linear-gradient(135deg, #16866F, #126A57); color: #ffffff; box-shadow: 0 8px 18px rgba(18, 59, 67, .28); }
.app-shell--platform:not(.app-shell--fiscal) .nav-label { color: #9DBFB2; }
.app-shell--platform:not(.app-shell--fiscal) .nav-index { color: #8FB5A8; }
.app-shell--platform:not(.app-shell--fiscal) .is-active .nav-index { color: #D8EFE6; }
.app-shell--platform:not(.app-shell--fiscal) .nav-done { color: #7CD3AE; }
.app-shell--platform:not(.app-shell--fiscal) .folio-stamp { border-color: rgba(220, 235, 225, .2); background: rgba(13, 46, 53, .32); }
.app-shell--platform:not(.app-shell--fiscal) .folio-stamp b { color: #9FD8C4; }
.app-shell--platform:not(.app-shell--fiscal) .folio-stamp small,
.app-shell--platform:not(.app-shell--fiscal) .data-link { color: #B9CFC2; }
.app-shell--platform:not(.app-shell--fiscal) .stamp-dot { background: #5CC9A7; box-shadow: 0 0 0 3px rgba(92, 201, 167, .18); }
.app-shell--platform:not(.app-shell--fiscal) .topbar {
  min-height: 64px;
  height: 64px;
  padding-inline: clamp(18px, 3vw, 42px);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  background: var(--tools-navy);
  color: #EFF6F1;
}
.app-shell--platform:not(.app-shell--fiscal) .breadcrumb,
.app-shell--platform:not(.app-shell--fiscal) .topbar-right { color: #B9CFC2; }
.app-shell--platform:not(.app-shell--fiscal) .breadcrumb i { color: #7FA99B; }
.app-shell--platform:not(.app-shell--fiscal) .breadcrumb strong { color: #ffffff; }
.app-shell--platform:not(.app-shell--fiscal) .edition-dot { background: #5CC9A7; }
.app-shell--platform:not(.app-shell--fiscal) .section-tab { border-radius: 7px; color: #CFE3D6; }
.app-shell--platform:not(.app-shell--fiscal) .section-tab b { color: #9DBFB2; }
.app-shell--platform:not(.app-shell--fiscal) .section-tab:hover { border-color: rgba(140, 200, 180, .35); background: rgba(22, 134, 111, .25); color: #ffffff; }
.app-shell--platform:not(.app-shell--fiscal) .section-tab.is-active { border-color: #16866F; background: var(--tools-blue); color: #ffffff; box-shadow: 0 5px 12px rgba(18, 59, 67, .2); }
.app-shell--platform:not(.app-shell--fiscal) .section-tab.is-active b { color: #D8EFE6; }
.app-shell--platform:not(.app-shell--fiscal) .tools-menu > summary i,
.app-shell--platform:not(.app-shell--fiscal) .class-menu > summary i { color: #9DBFB2; }
.app-shell--platform:not(.app-shell--fiscal) .tools-menu-popover,
.app-shell--platform:not(.app-shell--fiscal) .class-menu-popover {
  border-color: var(--tools-line);
  background: #ffffff;
  color: var(--tools-ink);
  box-shadow: 0 18px 38px rgba(18, 59, 67, .18);
}
.app-shell--platform:not(.app-shell--fiscal) .tools-menu-popover .section-tab,
.app-shell--platform:not(.app-shell--fiscal) .class-menu-popover .section-tab { color: var(--tools-ink); }
.app-shell--platform:not(.app-shell--fiscal) .tools-menu-popover .section-tab:hover,
.app-shell--platform:not(.app-shell--fiscal) .tools-menu-popover .section-tab.is-active,
.app-shell--platform:not(.app-shell--fiscal) .class-menu-popover .section-tab:hover,
.app-shell--platform:not(.app-shell--fiscal) .class-menu-popover .section-tab.is-active { border-color: #BFD8CC; background: var(--tools-sky); color: var(--tools-navy); }
.app-shell--platform:not(.app-shell--fiscal) .button-primary { border-color: var(--tools-blue); background: var(--tools-blue); color: #ffffff; }
.app-shell--platform:not(.app-shell--fiscal) .button-primary:hover:not(:disabled) { border-color: var(--tools-blue-strong); background: var(--tools-blue-strong); }
.app-shell--platform:not(.app-shell--fiscal) :is(button, input, select, textarea, a):focus-visible { outline: 2px solid var(--tools-blue); outline-offset: 3px; box-shadow: 0 0 0 3px #ffffff, 0 0 0 6px var(--tools-blue); }

/* Aprende usa una subpaleta propia; se remapea para conservar el estilo de Herramientas. */
.app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) {
  --wine: var(--tools-navy);
  --wine-dark: var(--tools-navy-deep);
  --gold: var(--tools-blue);
  --gold-pale: var(--tools-sky);
  --paper: var(--tools-canvas);
  --paper-bright: #ffffff;
  --ink: var(--tools-ink);
  --muted: var(--tools-muted);
  --line: var(--tools-line);
  --green: var(--tools-success);
  --green-pale: var(--tools-success-soft);
  --fiscal-petroleum: var(--tools-navy);
  --fiscal-jade: var(--tools-success);
  --fiscal-ivory: var(--tools-canvas);
  --fiscal-line: var(--tools-line);
  --classroom-action: var(--tools-blue);
  --classroom-action-hover: var(--tools-blue-strong);
  --classroom-soft: var(--tools-sky);
  --classroom-jade-rgb: 22, 134, 111;
  background: var(--tools-canvas);
  color: var(--tools-ink);
}
.app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) .topbar { border-color: rgba(255, 255, 255, .1); background: var(--tools-navy); color: #EFF6F1; }
.app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) .breadcrumb,
.app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) .topbar-right { color: #B9CFC2; }
.app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) .breadcrumb strong { color: #ffffff; }
.app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) .section-tab { color: #CFE3D6; }
.app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) .section-tab:hover,
.app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) .section-tab.is-active { border-color: #16866F; background: var(--tools-blue); color: #ffffff; }
.app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) .section-tab.is-active b { color: #D8EFE6; }
.app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) .class-menu-popover,
.app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) .tools-menu-popover { border-color: var(--tools-line); background: #ffffff; color: var(--tools-ink); }
/* El desplegable Herramientas tiene fondo blanco, pero la regla de
   .section-tab del aula pinta sus ítems en menta claro (#CFE3D6,
   pensado para la barra oscura): sin esta anulación eran casi
   invisibles (contraste ~1,2:1). Es el mismo caso que el Bloque 36
   corrigió en las otras cáscaras; en el aula faltaba. */
.app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) .tools-menu-popover .section-tab,
.app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) .class-menu-popover .section-tab { color: var(--tools-ink); }
.app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) .tools-menu-popover .section-tab:hover,
.app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) .tools-menu-popover .section-tab.is-active,
.app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) .class-menu-popover .section-tab:hover,
.app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) .class-menu-popover .section-tab.is-active { border-color: #BFD8CC; background: var(--tools-sky); color: var(--tools-navy); }
.app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) .classroom-route-cta { border-color: var(--tools-blue); background: var(--tools-blue); color: #ffffff; }
.app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) .classroom-route-cta:hover:not(:disabled) { border-color: var(--tools-blue-strong); background: var(--tools-blue-strong); }

@media (max-width: 1000px) {
  .app-shell--platform:not(.app-shell--fiscal) .sidebar { width: 226px; }
  .app-shell--platform:not(.app-shell--fiscal) .main-shell:not(.main-shell-live) { margin-left: 226px; }
  /* Bloque 36: la barra de 64 px debe crecer al colapsar en dos filas. */
  .app-shell--platform:not(.app-shell--fiscal) .topbar { height: auto; }
  .app-shell--platform:not(.app-shell--fiscal) .section-tabs { min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
}
@media (max-width: 760px) {
  .app-shell--platform:not(.app-shell--fiscal) .topbar { min-height: 50px; height: auto; padding: 7px 10px; }
  .app-shell--platform:not(.app-shell--fiscal) .main-shell:not(.main-shell-live) { margin-left: 0; }
  .app-shell--platform:not(.app-shell--fiscal) .main-shell-live { padding-bottom: 8px; }
  .app-shell--platform:not(.app-shell--fiscal) .mobile-bottom-nav { border-top-color: var(--tools-line); background: rgba(255, 255, 255, .97); box-shadow: 0 -8px 25px rgba(18, 59, 67, .1); }
  .app-shell--platform:not(.app-shell--fiscal) .mobile-nav-item { color: var(--tools-muted); }
  .app-shell--platform:not(.app-shell--fiscal) .mobile-nav-item span { color: #7A8A80; }
  .app-shell--platform:not(.app-shell--fiscal) .mobile-nav-item.is-active { background: var(--tools-sky); color: var(--tools-navy); }
  .app-shell--platform:not(.app-shell--fiscal) .mobile-nav-item.is-active span { color: var(--tools-blue); }
  .app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) .topbar { min-height: 50px; height: auto; background: var(--tools-navy-deep); }
  .app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) .mobile-bottom-nav { border-top-color: var(--tools-line); background: rgba(255, 255, 255, .97); }
  .app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) .mobile-nav-item.is-active { background: var(--tools-sky); color: var(--tools-navy); }
  .app-shell--platform:not(.app-shell--fiscal):has(.classroom-content) .mobile-nav-item.is-active span { color: var(--tools-blue); }
}
@media (prefers-reduced-motion: reduce) {
  /* Con movimiento reducido se apaga el movimiento decorativo del
     shell, pero no la respuesta de botones, enlaces, controles y
     tarjetas: su transición es la confirmación visible de la acción. */
  .app-shell--platform:not(.app-shell--fiscal) *:not(button):not(a):not(input):not(select):not(textarea):not([role="button"]):not(summary):not(.tools-card),
  .app-shell--platform:not(.app-shell--fiscal) *:not(button):not(a):not(input):not(select):not(textarea):not([role="button"]):not(summary):not(.tools-card)::before,
  .app-shell--platform:not(.app-shell--fiscal) *:not(button):not(a):not(input):not(select):not(textarea):not([role="button"]):not(summary):not(.tools-card)::after { animation: none !important; transition: none !important; }
}

