/* Portal Blessed · legibilidad global v1
   Capa final de pantalla: una sola fuente, tamaños cómodos y contraste seguro.
   No afecta impresiones, flejes ni documentos PDF. */
:root{
  --portal-font:'Poppins','Segoe UI',system-ui,sans-serif;
  --portal-ink-strong:#101711;
  --portal-ink:#18221b;
  --portal-ink-secondary:#303b33;
  --portal-placeholder:#536057;
  --portal-size-xs:13px;
  --portal-size-sm:14px;
  --portal-size-md:16px;
  --portal-size-lg:19px;
  --portal-size-h3:21px;
  --portal-size-h2:30px;
  --portal-size-h1:clamp(38px,4vw,56px);
  --font-display:var(--portal-font);
  --font-body:var(--portal-font);
  --v6-title:var(--portal-font);
  --v6-body:var(--portal-font);
  --blessed-ink:var(--portal-ink-strong);
  --blessed-text:var(--portal-ink);
  --blessed-muted:var(--portal-ink-secondary);
  --v6-ink:var(--portal-ink-strong);
  --v6-text:var(--portal-ink);
  --v6-muted:var(--portal-ink-secondary);
  --ink:var(--portal-ink-strong);
  --muted:var(--portal-ink-secondary);
}
html[data-portal-text="large"]{
  --portal-size-xs:15px;
  --portal-size-sm:16px;
  --portal-size-md:18px;
  --portal-size-lg:21px;
  --portal-size-h3:24px;
  --portal-size-h2:34px;
  --portal-size-h1:clamp(42px,4.4vw,62px);
}
html[data-portal-contrast="soft"]{
  --portal-ink-strong:#172019;
  --portal-ink:#273129;
  --portal-ink-secondary:#465149;
  --portal-placeholder:#606b63;
}
html,body,body *,button,input,select,textarea{font-family:var(--portal-font)!important}
body{font-size:var(--portal-size-md)!important;line-height:1.6}

/* Jerarquía general. */
#portal-content h1{font-size:var(--portal-size-h1)!important;line-height:1.08!important;font-weight:800!important;letter-spacing:-.035em!important}
#portal-content h2{font-size:var(--portal-size-h2)!important;line-height:1.18!important;font-weight:800!important;letter-spacing:-.025em!important}
#portal-content h3{font-size:var(--portal-size-h3)!important;line-height:1.25!important;font-weight:700!important}
#portal-content h4{font-size:var(--portal-size-lg)!important;line-height:1.3!important;font-weight:700!important}
#portal-content :is(.card,.panel,[class*="-card"],[class*="-panel"],.ops-card,.category-card) :is(h2,h3){font-size:var(--portal-size-lg)!important}
#portal-content :is(p,li,dd,dt,blockquote){font-size:var(--portal-size-md)!important;line-height:1.65!important}
#portal-content :is(small,.muted,.subtitle,[class*="-meta"],[class*="-note"],.system-health-v6,.home-updated-v8){font-size:var(--portal-size-sm)!important;line-height:1.55!important}
#portal-content :is(.eyebrow,[class*="-tag"],[class*="-badge"],[class*="-state"],[class*="-status"]){font-size:var(--portal-size-xs)!important;line-height:1.35!important}
#portal-content :is(label,input,select,textarea,button,.button){font-size:var(--portal-size-md)!important;line-height:1.45!important}
#portal-content :is(input,select,textarea){min-height:46px!important}
#portal-content :is(button,.button){min-height:44px}
#portal-content table th{font-size:var(--portal-size-sm)!important;line-height:1.45!important}
#portal-content table td{font-size:var(--portal-size-md)!important;line-height:1.55!important}

/* Componentes que históricamente quedaban entre 8 y 11 px. */
#portal-content :is(.module-card,.category-card,.ops-card,[class*="-panel"],[class*="-card"]) p{font-size:var(--portal-size-md)!important}
#portal-content :is(.module-card,.category-card,.ops-card,[class*="-panel"],[class*="-card"]) small{font-size:var(--portal-size-sm)!important}
#portal-content :is(.module-footer,.category-action,.work-actions-v6 a,.home-command-status-v8 button,.home-scope-v8){font-size:var(--portal-size-sm)!important}
#portal-content :is(.home-metric-v8>span,.home-live-v8,.home-attention-head-v8>div>span){font-size:var(--portal-size-xs)!important}
#portal-content :is(.home-metric-v8>small,.home-action-v8 small,.home-action-loading-v8 small){font-size:var(--portal-size-sm)!important}
#portal-content :is(.home-action-v8 strong,.home-action-loading-v8 strong,.shortcut-grid strong,.leadership-action strong){font-size:var(--portal-size-sm)!important}
#portal-content :is(.daily-checklist-items span,.purchase-priority-routes strong,.supplier-summary-row strong,.receiving-rows strong,.receipt-line-head p){font-size:var(--portal-size-sm)!important}
#portal-content :is(.operations-screen .ops-card h2,.people-page .gp-card h3,.employee-resources-page .er-card h3,.my-blessed-page .mb-card h3){font-size:var(--portal-size-lg)!important}

/* Contraste claro: negro y tonos oscuros; nunca gris lavado. */
html:not([data-portal-theme="night"]) body,
html:not([data-portal-theme="night"]) #portal-content{color:var(--portal-ink)!important}
html:not([data-portal-theme="night"]) #portal-content :is(h1,h2,h3,h4,h5,h6,strong,b,label,th){color:var(--portal-ink-strong)!important}
html:not([data-portal-theme="night"]) #portal-content :is(p,li,dd,dt,small,.muted,.subtitle,.role,[class*="-meta"],[class*="-note"]){color:var(--portal-ink-secondary)!important}
html:not([data-portal-theme="night"]) #portal-content :is(input,select,textarea){color:var(--portal-ink-strong)!important}
html:not([data-portal-theme="night"]) #portal-content :is(input,textarea)::placeholder{color:var(--portal-placeholder)!important;opacity:1!important}
html:not([data-portal-theme="night"]) .portal-nav a{color:#28342b!important}
html:not([data-portal-theme="night"]) .portal-nav a.active{color:#1e7311!important}
html:not([data-portal-theme="night"]) :is(.security-link,.logout-link,.theme-toggle,.appearance-open){color:#18221b!important}

/* Superficies oscuras conservan texto claro. */
html:not([data-portal-theme="night"]) #portal-content :is(.home-attention-v8,.work-center-v6,.security-hardening-panel,.receipt-complete) :is(h1,h2,h3,h4,strong,b,label,p,small,.muted,.subtitle){color:#fff!important}
html:not([data-portal-theme="night"]) #portal-content :is(.home-attention-v8,.work-center-v6,.security-hardening-panel,.receipt-complete) :is(p,small,.muted,.subtitle){color:#d8e2da!important}

/* Cabecera legible. */
.portal-nav a{font-size:var(--portal-size-sm)!important;font-weight:600!important}
.user-name{font-size:var(--portal-size-sm)!important;font-weight:700!important}
.user-copy .role{font-size:var(--portal-size-xs)!important}
:is(.theme-toggle,.appearance-open,.security-link,.logout-link){font-size:var(--portal-size-sm)!important;font-weight:600!important}
.appearance-open{display:inline-flex;align-items:center;gap:7px;min-height:38px;padding:0 12px;border:1px solid #dfe6e1;border-radius:11px;background:#fff;cursor:pointer;white-space:nowrap}
.appearance-open>span:first-child{font-weight:800}

/* Configuración administrativa de apariencia. */
.appearance-dialog{width:min(720px,calc(100% - 28px));max-height:calc(100dvh - 32px);padding:0;border:1px solid #dce4dd;border-radius:22px;background:#fff;color:#18221b;box-shadow:0 28px 80px rgba(16,28,18,.24)}
.appearance-dialog::backdrop{background:rgba(10,20,12,.58);backdrop-filter:blur(4px)}
.appearance-form{padding:26px}
.appearance-head{display:flex;justify-content:space-between;gap:20px;margin-bottom:22px}
.appearance-head>div>span{color:#278f16;font-size:13px;font-weight:700;letter-spacing:.12em}
.appearance-head h2{margin:5px 0 7px;color:#101711;font-size:28px;line-height:1.2;font-weight:800}
.appearance-head p{margin:0;color:#354038;font-size:15px;line-height:1.55}
.appearance-close{width:42px;height:42px;min-height:42px;padding:0;flex:0 0 42px;border:1px solid #dce4dd;border-radius:12px;background:#fff;color:#18221b;font-size:27px;cursor:pointer}
.appearance-form fieldset{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:0 0 15px;padding:14px;border:1px solid #dfe6e1;border-radius:15px}
.appearance-form legend{padding:0 6px;color:#101711;font-size:15px;font-weight:700}
.appearance-form fieldset label{min-height:76px;padding:13px;display:flex;align-items:flex-start;gap:10px;border:1px solid #e1e7e2;border-radius:12px;background:#fafcf9;cursor:pointer}
.appearance-form fieldset label:has(input:checked){border-color:#278f16;background:#f0f8ed;box-shadow:0 0 0 2px rgba(39,143,22,.09)}
.appearance-form input{width:18px;height:18px;margin:3px 0 0;accent-color:#278f16}
.appearance-form label span{display:block}
.appearance-form label strong{display:block;color:#101711;font-size:15px}
.appearance-form label small{display:block;margin-top:4px;color:#465149;font-size:13px;line-height:1.45}
.appearance-note{margin:6px 0 0;padding:12px 14px;border-left:4px solid #ffd400;border-radius:10px;background:#fffaf0;color:#303b33;font-size:13px;line-height:1.5}
.appearance-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}
.appearance-actions .button{min-height:44px;font-size:15px}

html[data-portal-theme="night"] .appearance-open{background:#18241c;color:#eef6ef!important;border-color:#3a4c3f}
html[data-portal-theme="night"] .appearance-dialog{background:#132019;color:#f7faf7;border-color:#385044}
html[data-portal-theme="night"] .appearance-head h2,
html[data-portal-theme="night"] .appearance-form legend,
html[data-portal-theme="night"] .appearance-form label strong{color:#f7faf7}
html[data-portal-theme="night"] .appearance-head p,
html[data-portal-theme="night"] .appearance-form label small,
html[data-portal-theme="night"] .appearance-note{color:#c1cec4}
html[data-portal-theme="night"] .appearance-close,
html[data-portal-theme="night"] .appearance-form fieldset label{background:#1a2a20;color:#f7faf7;border-color:#385044}
html[data-portal-theme="night"] .appearance-form fieldset{border-color:#385044}
html[data-portal-theme="night"] .appearance-form fieldset label:has(input:checked){background:#203a26;border-color:#69d35f}
html[data-portal-theme="night"] .appearance-note{background:#2e2a17;border-left-color:#ffd400}

@media(max-width:900px){
  .appearance-open-label{display:none}
  .appearance-open{width:40px;padding:0;justify-content:center}
}
@media(max-width:720px){
  .portal-nav a{font-size:var(--portal-size-xs)!important}
  #portal-content :is(p,li,dd,dt,blockquote){font-size:var(--portal-size-md)!important}
  #portal-content :is(small,.muted,.subtitle,[class*="-meta"],[class*="-note"]){font-size:var(--portal-size-sm)!important}
  .appearance-form{padding:20px}
  .appearance-form fieldset{grid-template-columns:1fr}
  .appearance-head h2{font-size:25px}
  .appearance-actions{flex-direction:column-reverse}
  .appearance-actions .button{width:100%}
}
