/* Contratos transversales de controles, formularios y capas. */
@media screen {
    :root { --muted-2:#66616d; }
    html[data-theme="dark"] { --muted-2:#aaa7b0; }
    html[data-theme="light"][data-accent="ua"] { --data-accent:var(--ua-800); --data-accent-line:var(--ua-800); }
}
/* Contraste final: conservar texto y estados sin atenuar su legibilidad. */
html .app-shell main .kpi-index { opacity:1; }
html .transversal-kpis .kpi-comparison.is-unavailable { opacity:1; }
html[data-theme="light"] .hero-copy h1 em,html[data-theme="light"] .admin-hero h1 em,
html[data-theme="light"] .admin-empty a { color:var(--ua-800); }
html[data-theme="dark"][data-accent="pre"] .hero-heading h1 em { color:var(--pre-200); }
html[data-theme="dark"][data-accent="pre"] .history-eyebrow,
html[data-theme="dark"][data-accent="pre"] .history-panel-heading>div>p,
html[data-theme="dark"][data-accent="pre"] .history-methodology>div>p,
html[data-theme="dark"][data-accent="pre"] .history-controls-heading>p,
html[data-theme="dark"] .comparison-page a[href^="#"]>span { color:var(--pre-200); }
html[data-theme="light"] .period-pos-page .flow-chip.is-origin,
html[data-theme="light"] .comparison-pos-insight-grid>article>span { color:var(--pos-800); }
html[data-theme="light"] .comparison-pos-base { color:var(--pos-800); }
html .history-pos-page .history-view-switch button.is-active,
html .admin-page [data-funnel="POS"]>header>span { background:var(--pos-700); color:#fff; }
html .admin-health>p small { color:var(--muted); }
html[data-theme="light"] #home-title em { color:var(--ua-800); }
html[data-theme="light"] .period-close-page .flow-chip.is-result,
html[data-theme="light"] .period-close-page .flow-chip.is-result b { color:var(--pos-800); }
html[data-theme="light"] .period-close-page .flow-chip.is-origin { color:var(--pre-700); }
html[data-theme="dark"] .period-close-page .flow-chip.is-origin { color:var(--pre-200); }
html[data-theme="light"] .comparison-pos-page [data-sort-program],
html[data-theme="light"] .history-page .is-up { color:var(--pos-800); }
html[data-theme="light"] .history-pos-page .history-eyebrow,
html[data-theme="light"] .history-pos-page .history-hero h1 em,
html[data-theme="light"] .history-pos-page .history-controls-heading>p,
html[data-theme="light"] .history-pos-page .history-panel-heading>div>p,
html[data-theme="light"] .history-pos-page .history-methodology>div>p { color:var(--pos-800); }
.profile-stage-control button.is-active,.comparison-pos-stage-switch button.is-active,
html[data-accent="pos"] .filter-modal-dialog>footer .primary { background:var(--pos-700); border-color:var(--pos-700); color:#fff; }
.profile-stack>div em,.modality-stack em { color:var(--ink-900); }
.period-pos-page .period-total,.period-pos-page .pos-kpis .is-highlighted,.period-pos-page .funnel-stage { background:linear-gradient(145deg,var(--pos-800),var(--pos-700)); }
main button,.drawer button { min-height:44px; min-width:44px; font-weight:560; }
.report-error button,.pos-data-error button,.admin-page main button { min-height:44px; min-width:44px; font-weight:560; }
.schools-table th button { font-weight:560; font-size:.8rem; }
.stage-switch button,.history-view-switch button,.history-panel-actions>button,.profile-stage-control button { min-height:44px; font-size:.8rem; }
.global-search input,.drawer-search input { min-height:44px; }
.catalog-modal,.filter-modal-dialog,.history-filter-dialog,.kpi-detail-dialog { border-radius:20px; }
.catalog-modal-header,.drawer-header { background:var(--data-accent-soft); }
.catalog-modal-header h2,.drawer-header h2 { color:var(--pre-800); }
[data-theme="dark"] .catalog-modal-header h2,[data-theme="dark"] .drawer-header h2 { color:var(--pre-300); }
[data-accent="ua"] .drawer-header h2 { color:var(--text); }
.drawer { height:100dvh; overflow-y:auto; overscroll-behavior:contain; }
.drawer-header { position:sticky; top:-26px; z-index:1; margin:-26px -26px 0; padding:24px 26px; flex-shrink:0; }
.drawer-header .icon-button { flex-shrink:0; }
.drawer-search { flex-shrink:0; }
.dictionary-front-state,.demo-status,.prototype-status,.data-error,.history-data-state,.admin-inline-empty,.admin-login-error { font-size:.9rem; background:var(--surface); }
.demo-status.is-error,.comparison-pos-data-status.is-error { background:var(--surface); }
.demo-status>span:last-child,.prototype-status>span:last-child { white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere; }
.form-error-summary { margin:16px 0; padding:16px; border:1px solid var(--line); border-left:4px solid var(--rose-600); border-radius:12px; background:var(--surface); color:var(--text); font-size:.9rem; }
.form-error-summary strong { display:block; font-weight:600; }
.form-error-summary ul { margin:8px 0 0; padding-left:20px; }
.form-error-summary a { color:var(--text); text-underline-offset:3px; }
.form-field-error { display:block; grid-column:1 / -1; flex-basis:100%; min-width:0; margin:6px 0; font-size:.9rem; line-height:1.5; white-space:normal; color:var(--rose-700); }
.form-field-label { display:block; grid-column:1 / -1; margin-top:8px; color:var(--muted); font-size:.8rem; }
[data-theme="dark"] .form-field-error { color:var(--rose-200); }
[aria-invalid="true"] { border-color:var(--rose-600) !important; }
.admin-page .config-editor,.admin-page .form-grid,.admin-page .editor-block { min-width:0; }
.admin-page input:not([type=checkbox]):not([type=radio]):not([type=hidden]),.admin-page select,.admin-page textarea { max-width:100%; min-height:44px; }
.admin-page .load-report-link { font-weight:560; }
.admin-page .funnel-stage-edit input[type="checkbox"] { width:20px; height:20px; min-height:0; padding:0; }
.admin-page .funnel-stage-edit>label { min-height:44px; align-items:center; gap:8px; }
.admin-page .funnel-stage-edit>span>small { grid-column:1 / -1; color:var(--muted-2); line-height:1.5; }
.admin-page .funnel-stage-edit>span { grid-template-columns:minmax(0,1fr); }
.admin-page .feature-switch .switch-track { width:20px; height:20px; border-radius:4px; }
.admin-page .feature-switch .switch-track i { display:none; }
.admin-page .feature-switch input:checked+.switch-track::after { content:''; display:block; width:6px; height:10px; margin:2px 5px; border:solid currentColor; border-width:0 2px 2px 0; transform:rotate(45deg); }
.admin-page .feature-switch input:focus-visible+.switch-track { outline:3px solid var(--data-accent-line); outline-offset:3px; }
@media(max-width:600px) {
    .admin-section-tabs { position:static; }
    .drawer { padding:20px; }
    .drawer-header { top:-20px; margin:-20px -20px 0; padding:20px; }
    .catalog-modal,.filter-modal-dialog,.history-filter-dialog { border-radius:18px; }
    .catalog-modal { min-height:0; max-height:100dvh; overflow-y:auto; }
    .catalog-modal-body { min-height:0; }
}
@media(max-height:500px) {
    .admin-section-tabs { position:static; }
    .catalog-modal,.filter-modal-dialog,.history-filter-dialog,.kpi-detail-dialog { max-height:calc(100dvh - 16px); overflow-y:auto; }
    .catalog-modal { display:block; scroll-padding-block:16px 100px; }
    .catalog-modal-header { min-height:0; }
    .catalog-modal-body { overflow:visible; padding-bottom:100px; }
    .catalog-modal-footer { position:sticky; bottom:0; }
}
@media(prefers-reduced-motion:reduce) { .drawer { transition:none; } }
@media print { .form-error-summary,.form-field-error { display:none !important; } }
