/* Portal Blessed · Accesibilidad visual global v2
   - Aumenta suavemente la legibilidad en modo claro y nocturno.
   - El modo nocturno usa superficies oscuras y texto claro de forma consistente.
   - Solo pantalla: no afecta PDFs, flejes ni impresión. */

:root{
  --portal-readable-xs:9.5px;
  --portal-readable-sm:10.5px;
  --portal-readable-md:11.5px;
  --portal-readable-nav:12px;
}

body{font-size:15px}
.portal-nav a{font-size:var(--portal-readable-nav)!important}
.user-name{font-size:13.5px!important}
.user-copy .role{font-size:10.5px!important}
.theme-toggle,.security-link,.logout-link{font-size:11.5px!important}

#portal-content .eyebrow{font-size:10px!important}
#portal-content small{font-size:var(--portal-readable-xs)!important;line-height:1.45!important}
#portal-content label{font-size:var(--portal-readable-sm)!important}
#portal-content input,#portal-content select,#portal-content textarea,#portal-content button,#portal-content .button{font-size:var(--portal-readable-md)!important}
#portal-content table th{font-size:10px!important}
#portal-content table td{font-size:11px!important}
#portal-content :is(.module-card,.category-card,.ops-card,[class*="-panel"],[class*="-card"]) p{font-size:11.5px;line-height:1.6}
#portal-content .module-card h3,#portal-content .category-card>strong{font-size:16px!important}
#portal-content .ops-card h2{font-size:18px!important}
#portal-content .leadership-action strong,#portal-content .home-action-v8 strong{font-size:11.5px!important}
#portal-content .leadership-action small,#portal-content .home-action-v8 small,#portal-content .shortcut-grid small{font-size:9.5px!important}
#portal-content .shortcut-grid strong{font-size:11px!important}
#portal-content .daily-checklist-items span{font-size:11px!important}
#portal-content .purchase-priority-routes strong,#portal-content .supplier-summary-row strong{font-size:11px}

/* Tema nocturno uniforme. */
html[data-portal-theme="night"]{
  --night-bg:#0b140e;
  --night-surface:#132019;
  --night-surface-2:#1a2a20;
  --night-border:#385044;
  --night-text:#f7faf7;
  --night-muted:#c1cec4;
  --night-green:#76dd6d;
  --v6-bg:#0b140e;
  --v6-surface:#132019;
  --v6-ink:#f7faf7;
  --v6-text:#f1f6f2;
  --v6-muted:#c1cec4;
  --v6-line:#385044;
  --v6-dark:#132019;
}

html[data-portal-theme="night"] body,
html[data-portal-theme="night"] #portal-content{background:var(--night-bg)!important;color:var(--night-text)!important}

/* Contenedores principales: no deben quedar superficies blancas. */
html[data-portal-theme="night"] #portal-content :is(
  section,
  .panel,
  [class*="-panel"],
  [class*="-summary"],
  [class*="-toolbar"],
  [class*="-filter"],
  [class*="-switcher"],
  .page-head,
  .wo-head,
  .gp-head,
  .leadership-hero,
  .portal-welcome-v6,
  .home-command-v8,
  .work-center-v6,
  .v6-workflow,
  .purchase-route-board,
  .view-tabs,
  .filterbar
){background:var(--night-surface)!important;color:var(--night-text)!important;border-color:var(--night-border)!important;box-shadow:none!important}

/* Tarjetas, métricas, filas y controles secundarios. */
html[data-portal-theme="night"] #portal-content :is(
  article,
  [class*="-card"],
  [class*="-stat"],
  [class*="-metric"],
  [class*="-row"],
  .module-card,
  .category-card,
  .ops-card,
  .leadership-date,
  .leadership-kpis article,
  .leadership-action,
  .shortcut-grid a,
  .leadership-log-list>a,
  .daily-checklist-items span,
  .purchase-route-metrics article,
  .purchase-priority-routes a,
  .purchase-branch-provider,
  .purchase-group,
  .supplier-summary-row,
  .wc-prep-toolbar-v9,
  .wc-readiness-v9>div,
  .transfer-route-v9>div,
  .wbs-guide-v9>div,
  .wo-batch-toolbar,
  .inventory-kpis>a,
  .inventory-shortcuts a,
  .cash-shift-list>a,
  .reconciliation-group,
  .result-grid article,
  .receiving-rows>a,
  .receipt-line,
  .lot-list>span,
  .expiry-horizons a,
  .expiry-row,
  .waste-list>article
){background:var(--night-surface-2)!important;color:var(--night-text)!important;border-color:var(--night-border)!important;box-shadow:none!important}

/* Encabezados/zonas visuales que antes mantenían gradientes claros. */
html[data-portal-theme="night"] #portal-content :is(.page-head,.wo-head,.gp-head,.leadership-hero,.portal-welcome-v6){background:linear-gradient(115deg,#132019 0 72%,#183321 72%)!important}
html[data-portal-theme="night"] #portal-content .portal-welcome-visual-v6{background:linear-gradient(135deg,#1c3624,#102019)!important}
html[data-portal-theme="night"] #portal-content .leadership-date{background:#1a2a20!important}

/* Texto: blanco como regla principal; gris claro solo para información secundaria. */
html[data-portal-theme="night"] #portal-content :is(h1,h2,h3,h4,h5,h6,strong,b,label,th,td){color:var(--night-text)!important}
html[data-portal-theme="night"] #portal-content :is(p,small,.muted,.subtitle,.role,.completed-meta,.home-updated-v8){color:var(--night-muted)!important}
html[data-portal-theme="night"] #portal-content :is(.eyebrow,.branch-badge,.stock-ok){color:var(--night-green)!important}
html[data-portal-theme="night"] #portal-content a:not(.button):not(.primary){color:#eff8f0}
html[data-portal-theme="night"] #portal-content .module-footer,
html[data-portal-theme="night"] #portal-content .category-action{color:#dce8df!important}

/* Formularios. */
html[data-portal-theme="night"] #portal-content :is(input,select,textarea){background:#0f1a13!important;color:#fff!important;border-color:#4a6252!important}
html[data-portal-theme="night"] #portal-content :is(input,textarea)::placeholder{color:#9eaea2!important}
html[data-portal-theme="night"] #portal-content option{background:#132019;color:#fff}

/* Botones mantienen identidad Blessed y contraste. */
html[data-portal-theme="night"] #portal-content :is(.button,button){color:#fff!important}
html[data-portal-theme="night"] #portal-content :is(.button.secondary,button.secondary,.secondary-btn){background:#1a2a20!important;color:#f7faf7!important;border-color:#506858!important}
html[data-portal-theme="night"] #portal-content :is(.work-actions-v6 a.primary,.receipt-complete button){background:#ffd400!important;color:#172018!important;border-color:#ffd400!important}

/* Tablas y separadores. */
html[data-portal-theme="night"] #portal-content table{background:#132019!important;color:#fff!important}
html[data-portal-theme="night"] #portal-content th{background:#1a2a20!important;color:#fff!important;border-color:#385044!important}
html[data-portal-theme="night"] #portal-content td{background:#132019!important;color:#f3f7f4!important;border-color:#30463a!important}
html[data-portal-theme="night"] #portal-content hr{border-color:#385044!important}

/* Estados semánticos conservan el color como acento, no como fondo blanco. */
html[data-portal-theme="night"] #portal-content :is(.is-warning,.warning,.tone-amber){border-color:#8a7427!important}
html[data-portal-theme="night"] #portal-content :is(.is-danger,.danger,.tone-red){border-color:#8b4548!important}
html[data-portal-theme="night"] #portal-content :is(.is-blue,.tone-blue){border-color:#426f9b!important}

@media(max-width:720px){
  .portal-nav a{font-size:11px!important}
  #portal-content small{font-size:9px!important}
  #portal-content input,#portal-content select,#portal-content textarea,#portal-content button,#portal-content .button{font-size:11px!important}
}
