/* Identidad visual común. Las hojas de cada pantalla conservan su estructura y estados. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/source-serif-4-latin.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-400.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-500.woff2") format("woff2");
}

:root {
  --smartpaper-navy: #0b2545;
  --smartpaper-context: #13315c;
  --smartpaper-blue: #1b4a7e;
  --smartpaper-blue-hover: #2e5f9c;
  --smartpaper-blue-border: #3c5a85;
  --smartpaper-blue-muted: #8fa9c9;
  --smartpaper-blue-light: #c3d3e6;
  --smartpaper-desk: #eef1f5;
  --smartpaper-paper: #fff;
  --smartpaper-row: #f7f9fb;
  --smartpaper-ink: #1e2a38;
  --smartpaper-ink-title: #13315c;
  --smartpaper-muted: #5c6b7e;
  --smartpaper-line: #e1e5eb;
  --smartpaper-line-strong: #c9d3df;
  --smartpaper-field: #7d8ca0;
  --smartpaper-clay: #d97757;
  /* El hover conserva contraste AA con la tinta sobre clay. */
  --smartpaper-clay-hover: #d47352;
  --smartpaper-clay-border: #c2603c;
  --smartpaper-clay-tint: #f7e8e1;
  --smartpaper-clay-ink: #9e4726;
  --smartpaper-on-clay: #46180b;
  --smartpaper-success: #1f7a5c;
  --smartpaper-success-tint: #e4f1ec;
  --smartpaper-success-ink: #14543f;
  --smartpaper-warning: #8a6100;
  --smartpaper-warning-tint: #f5eedc;
  --smartpaper-warning-ink: #6b4b00;
  --smartpaper-danger: #9b2c2c;
  --smartpaper-danger-tint: #f7e5e5;
  --smartpaper-danger-ink: #7a1f1f;
  --smartpaper-veil: rgba(11, 37, 69, .55);
  --smartpaper-focus: var(--smartpaper-blue-hover);
  --smartpaper-control-radius: 8px;
  --smartpaper-card-radius: 10px;
  --smartpaper-window-radius: 12px;
  --smartpaper-font-ui: Inter, "Segoe UI", system-ui, sans-serif;
  --smartpaper-font-serif: "Source Serif 4", Georgia, serif;
  --smartpaper-font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}

body {
  font-family: var(--smartpaper-font-ui);
  font-variant-numeric: tabular-nums;
}

:where(button, input, select, textarea) {
  font-family: inherit;
}

.font-ui,
.font-label,
.font-body,
.font-display,
.font-headline,
.font-sans {
  font-family: var(--smartpaper-font-ui);
}

/* Conservar las fuentes de iconos que resuelven ligaduras o glifos propios. */
.font-mono,
code,
kbd {
  font-family: var(--smartpaper-font-mono);
}

:is(.sidebar, .glass-sidebar, .sigplan-sidebar, .plans-sidebar, .downloads-sidebar) {
  --smartpaper-focus: var(--smartpaper-paper);
}

:is(.sidebar, .glass-sidebar, .sigplan-sidebar, .plans-sidebar, .downloads-sidebar) a[aria-current="page"] {
  color: var(--smartpaper-paper);
  background-color: var(--smartpaper-context);
  box-shadow: inset 2px 0 var(--smartpaper-paper);
}

/* Contexto de las cabeceras existentes, sin cambiar su estructura. */
.smartpaper-context-header {
  --smartpaper-focus: var(--smartpaper-paper);
  color: var(--smartpaper-paper);
  background-color: var(--smartpaper-context);
  border-color: var(--smartpaper-blue-border);
}

.smartpaper-context-header :is(h1, h2, h3) {
  color: var(--smartpaper-paper);
  font-weight: 500;
}

.smartpaper-context-header p:not([role="alert"]) {
  color: var(--smartpaper-blue-light);
}

.smartpaper-context-header a:not([class^="bg-"], [class*=" bg-"]) {
  color: var(--smartpaper-paper);
  border-color: var(--smartpaper-blue-border);
}

.smartpaper-context-header a:not([class^="bg-"], [class*=" bg-"]):hover {
  background-color: var(--smartpaper-blue);
}

.smartpaper-context-header :is(#user_modal_close, button[title="Notificaciones"]) {
  color: var(--smartpaper-paper);
  background-color: transparent;
  border-color: var(--smartpaper-blue-border);
}

.smartpaper-context-header :is(#user_modal_close, button[title="Notificaciones"]):hover {
  background-color: var(--smartpaper-blue);
}

#user_modal {
  background: var(--smartpaper-veil);
}

#user_modal > div {
  border-radius: var(--smartpaper-window-radius);
  box-shadow: none;
}

#user_modal .smartpaper-context-header {
  border-radius: var(--smartpaper-control-radius);
  padding: .5rem .75rem;
}

.glass-sidebar :is(.text-slate-500, .text-on-surface-variant, .text-primary) {
  color: var(--smartpaper-blue-light);
}

a.smartpaper-module-card {
  --module-accent: var(--smartpaper-blue);
  background: var(--smartpaper-paper);
  color: var(--smartpaper-ink);
  border-radius: var(--smartpaper-card-radius);
  outline: .5px solid var(--smartpaper-line);
  box-shadow: inset 2px 0 var(--module-accent);
}

a.smartpaper-module-card:hover {
  background: var(--smartpaper-row);
}

.smartpaper-module-card :is(h2, h3, h4, p, .text-white) {
  color: var(--smartpaper-ink-title);
}

.smartpaper-module-card i {
  color: var(--module-accent);
}

#urgent-action-card.smartpaper-module-card {
  --module-accent: var(--smartpaper-danger);
}

/* El indicador de foco no ocupa espacio ni modifica el área de clic. */
:where(a[href], button, input, textarea, select, summary, [tabindex], [role="button"], [role="tab"]):focus-visible {
  outline: 2px solid var(--smartpaper-focus) !important;
  outline-offset: 2px;
}

:is(.sidebar, .glass-sidebar, .sigplan-sidebar, .plans-sidebar, .downloads-sidebar)
  :where(a[href], button, [tabindex]):focus-visible {
  outline-offset: -3px;
}

:where(input:not([type="hidden"], [type="checkbox"], [type="radio"], [type="range"], [type="color"]), select, textarea):not(:disabled) {
  border-color: var(--smartpaper-field);
}

:where(input:not([type="hidden"], [type="checkbox"], [type="radio"], [type="range"], [type="color"]), select, textarea):not(:disabled):focus {
  border-color: var(--smartpaper-blue-hover);
}

:where(input, textarea):not(:disabled)::placeholder {
  color: var(--smartpaper-muted);
  opacity: 1;
}

:where(input, select, textarea)[aria-invalid="true"]:not(:disabled) {
  border-color: var(--smartpaper-danger);
}

:where(input[type="checkbox"], input[type="radio"]) {
  accent-color: var(--smartpaper-blue);
}

/* Los controles mantienen sus dimensiones, incluidos los objetivos táctiles existentes. */
:is(.btn-primary, .btn-secondary, .button-primary, .button-secondary, .su-btn-primary, .su-btn-secondary,
    .manual-primary, .manual-secondary, .manual-toolbar-button, .manual-matrix-button, .flow-primary-button,
    .freq-btn, .rh-button, .open-plan, .excel-primary, .rename-project-primary) {
  border-radius: var(--smartpaper-control-radius);
  font-weight: 500;
}

:is(.main-card, .surface-card, .sysadmin-card, .plan-row, .flow-card, .downloads-card,
    .execution-card, .rule-preview, .automation-guide-card, .manual-card, .ai-card) {
  border-radius: var(--smartpaper-card-radius);
}

/* Avance se asigna a las acciones existentes de guardar, revisar o continuar. */
:is(.smartpaper-advance, .login-submit, #freq-advance,
    #flow-wizard-next, #btn-governance, #send-btn, #institution_save_button,
    #language-save-button, #btn_apply_changes, #evidences-view,
    #summary-rename-save, #rename-project-save, .mv-upload-primary) {
  background: var(--smartpaper-clay);
  border-color: var(--smartpaper-clay-border);
  border-radius: var(--smartpaper-control-radius);
  color: var(--smartpaper-on-clay);
  font-weight: 500;
}

:is(.smartpaper-advance, .login-submit, #freq-advance,
    #flow-wizard-next, #btn-governance, #send-btn, #institution_save_button,
    #language-save-button, #btn_apply_changes, #evidences-view,
    #summary-rename-save, #rename-project-save, .mv-upload-primary):hover:not(:disabled, [aria-disabled="true"]) {
  background: var(--smartpaper-clay-hover);
  border-color: var(--smartpaper-clay-border);
  color: var(--smartpaper-on-clay);
}

:is(.smartpaper-advance, .login-submit, #freq-advance,
    #flow-wizard-next, #btn-governance, #send-btn, #institution_save_button,
    #language-save-button, #btn_apply_changes, #evidences-view,
    #summary-rename-save, #rename-project-save, .mv-upload-primary):is(:disabled, [aria-disabled="true"]) {
  background: #eadfd9;
  border-color: #eadfd9;
  color: #785f55;
}

/* La hoja de Planes puede cargarse sola. En el sistema se usa el azul sólido compartido. */
.open-plan,
.open-plan::before {
  background: var(--smartpaper-blue);
}

.open-plan:hover,
.open-plan:hover::before {
  background: var(--smartpaper-blue-hover);
}

.matrix-count-recommendation {
  color: var(--smartpaper-muted);
}

/* La capa visual distingue los diálogos sin intervenir en su apertura ni cierre. */
dialog[open]::backdrop {
  background: var(--smartpaper-veil);
}

:is(.smartpaper-modal-veil, .sysadmin-modal, .evidences-modal-backdrop, .flow-modal-backdrop,
    .manual-dialog-backdrop, .task-resolution-modal, .times-advance-modal,
    .ai-modal, .modal-overlay, .sigplan-duplicate-overlay, .rename-project-backdrop,
    .expost-overlay) {
  background: var(--smartpaper-veil);
}

:is(.smartpaper-modal-surface, dialog:not(.rh-dialog), .sysadmin-modal-card, .evidences-modal-card, .flow-modal-card,
    .rh-dialog__surface, .task-resolution-modal__shell, .manual-dialog-panel,
    .rename-project-card, .times-advance-window, .ai-modal-box, .modal-container,
    .sigplan-duplicate-card, .expost-card) {
  border-radius: var(--smartpaper-window-radius);
  border-color: var(--smartpaper-line);
  background-color: var(--smartpaper-paper);
  box-shadow: none;
}

:is(.smartpaper-modal-header, .dialog-header, .sysadmin-modal-head, .evidences-modal-header, .rh-dialog__header,
    .task-resolution-modal__header, .manual-dialog-header, .rename-project-header,
    .times-advance-header, .mv-upload-hero, .expost-head) {
  --smartpaper-focus: var(--smartpaper-paper);
  color: var(--smartpaper-paper);
  background: var(--smartpaper-context);
  border-color: var(--smartpaper-blue-border);
  border-radius: var(--smartpaper-window-radius) var(--smartpaper-window-radius) 0 0;
}

:is(.smartpaper-modal-header, .dialog-header, .sysadmin-modal-head, .evidences-modal-header, .rh-dialog__header,
    .task-resolution-modal__header, .manual-dialog-header, .rename-project-header,
    .times-advance-header, .mv-upload-hero, .expost-head) :is(h1, h2, h3, .times-advance-title) {
  color: var(--smartpaper-paper);
  font-weight: 500;
}

:is(.smartpaper-modal-header, .dialog-header, .sysadmin-modal-head, .evidences-modal-header, .rh-dialog__header,
    .task-resolution-modal__header, .manual-dialog-header, .rename-project-header,
    .times-advance-header, .mv-upload-hero, .expost-head) p,
:is(.times-advance-subtitle, .rh-dialog__meta, .evidences-modal-kicker) {
  color: var(--smartpaper-blue-light);
}

:is(.smartpaper-modal-header, .dialog-header, .sysadmin-modal-head, .evidences-modal-header, .rh-dialog__header,
    .task-resolution-modal__header, .manual-dialog-header, .rename-project-header,
    .mv-upload-hero, .expost-head) :where(button, a) {
  color: var(--smartpaper-paper);
  border-color: var(--smartpaper-blue-border);
}

:is(.smartpaper-modal-actions, .dialog-actions, .evidences-modal-actions, .rh-dialog__footer, .task-resolution-modal__actions,
    .manual-dialog-footer, .rename-project-actions, .ai-modal-actions) {
  border-color: var(--smartpaper-line);
}

/* En la hoja documental rige Ultra formal. Los controles de sus visores siguen usando Inter. */
:is(.su-report-document, #printable-plan, #report-html-viewer, .rh-viewer-content) {
  background-color: #fff;
  color: #000;
  font-family: Arial, "Liberation Sans", sans-serif;
  font-size: 12pt;
  line-height: 1.15;
}

:is(.su-report-document, #printable-plan, #report-html-viewer, .rh-viewer-content)
  :is(.su-document-title, h1) {
  color: #000;
  font-family: inherit;
  font-size: 16pt;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

:is(.su-report-document, #printable-plan, #report-html-viewer, .rh-viewer-content)
  :is(.su-section-heading, h2, h3) {
  color: #000;
  font-family: inherit;
  font-size: 14pt;
  font-weight: 700;
}

:is(.su-report-document, #printable-plan, #report-html-viewer, .rh-viewer-content)
  :is(p, li, td) {
  color: #000;
  line-height: 1.15;
}

:is(.su-report-document, #printable-plan, #report-html-viewer, .rh-viewer-content)
  :is(p, td:not([scope])) {
  text-align: justify;
}

:is(.su-report-document, #printable-plan, #report-html-viewer, .rh-viewer-content)
  :is(table, th, td, .su-section-number, .su-document-meta, .su-document-header, .su-document-footer) {
  background-color: #fff;
  border-color: #000;
  color: #000;
}

:is(.su-report-document, #printable-plan, #report-html-viewer, .rh-viewer-content)
  :is(.su-document-brand, .su-document-subtitle, .su-document-context, dt, dd, caption, figcaption) {
  color: #000;
}

:is(.su-report-document, #printable-plan, #report-html-viewer, .rh-viewer-content) th {
  font-weight: 700;
}

@media (forced-colors: active) {
  :where(a[href], button, input, textarea, select, summary, [tabindex]):focus-visible {
    outline-color: Highlight !important;
  }
}
