/* Valores de mobile/theme/tokens.ts. Esta copia se verifica en tests. */
:root { color-scheme: light; --ink: #29282f; --paper: #fcfbf2; --blue: #224375; --stone: #fae8d7; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; padding: 24px; background: var(--paper); color: var(--ink); font: 1rem/1.5 system-ui, sans-serif; }
header { border-bottom: 2px solid var(--ink); margin-bottom: 24px; }
h1, h2, h3 { line-height: 1.2; }
nav, .filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin: 20px 0; }
form { display: grid; gap: 16px; margin: 16px 0; }
label { display: grid; gap: 6px; }
button, input, select, textarea, a { font: inherit; }
button, input, select, textarea { min-height: 44px; border: 2px solid var(--ink); border-radius: 6px; padding: 10px 12px; color: var(--ink); background: var(--paper); max-width: 100%; }
input::placeholder, textarea::placeholder { color: var(--ink); opacity: 1; }
button { cursor: pointer; background: var(--blue); color: var(--paper); box-shadow: 2px 2px 0 var(--ink); }
button:disabled { background: var(--stone); color: var(--ink); cursor: default; box-shadow: none; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
button:focus-visible { outline-color: var(--ink); }
a { color: var(--blue); display: inline-flex; align-items: center; min-height: 44px; }
.skip { position: absolute; top: -100px; background: var(--paper); padding: 12px; }
.skip:focus { top: 0; }
.login { width: 100%; max-width: 480px; margin: 8vh auto; border: 2px solid var(--ink); border-radius: 8px; padding: 24px; box-shadow: 3px 3px 0 var(--ink); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr)); gap: 20px; height: auto; overflow: visible; }
article { background: var(--stone); border: 2px solid var(--ink); border-radius: 8px; padding: 20px; box-shadow: 3px 3px 0 var(--ink); height: auto; overflow: visible; }
article button:not(.info-tip) { width: 100%; }
.number { font-size: 2rem; font-weight: bold; margin: 8px 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
caption { text-align: left; padding: 12px 0; }
th, td { padding: 12px; border-bottom: 1px solid var(--ink); text-align: left; vertical-align: top; }
th { background: var(--stone); }
td p { max-width: 32rem; margin-bottom: 0; }
.detail { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 32px; }
img { width: 100%; max-width: 480px; border: 2px solid var(--ink); background: var(--paper); }
textarea { min-height: 100px; resize: vertical; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }
#message { font-weight: bold; }
.sandbox-notice { background: var(--stone); border: 2px solid var(--ink); border-radius: 6px; padding: 10px 14px; font-weight: bold; }
.error-notice { background: var(--stone); border: 2px solid var(--ink); border-radius: 6px; padding: 10px 14px; font-weight: bold; margin: 16px 0; }
.revealed-email { font-weight: bold; color: var(--blue); }
#reports-subnav { display: inline-flex; gap: 8px; flex-wrap: wrap; }
#email-reveal-container { margin: 12px 0; }
dialog { border: 2px solid var(--ink); border-radius: 8px; background: var(--paper); color: var(--ink); padding: 24px; max-width: 480px; box-shadow: 4px 4px 0 var(--ink); margin: auto; }
dialog::backdrop { background: rgba(41, 40, 47, 0.5); }
.dialog-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.backup-codes-box { background: var(--stone); border: 2px solid var(--ink); border-radius: 6px; padding: 12px; margin: 12px 0; }
.summary-preview { background: var(--stone); border: 2px solid var(--ink); border-radius: 6px; padding: 10px 14px; font-weight: bold; }
.totp-setup { margin: 16px 0; }
.totp-setup code { word-break: break-all; }
.user-suspension-banner { background: var(--stone); border: 3px solid var(--ink); border-radius: 8px; padding: 16px 20px; margin: 16px 0 24px 0; box-shadow: 3px 3px 0 var(--ink); }
.user-status-notice { margin: 12px 0; font-size: 1.05rem; }
.badge-urgent { color: #8b0000; font-weight: bold; }
.badge-warning { color: #5c3d10; font-weight: bold; }
.export-result-box { background: var(--stone); border: 2px solid var(--ink); border-radius: 8px; padding: 16px; margin: 16px 0; }
.export-result-box a { word-break: break-all; }
.link-button { background: transparent; border: none; color: var(--blue); text-decoration: underline; cursor: pointer; padding: 0; min-height: 44px; display: inline-flex; align-items: center; box-shadow: none; font-weight: bold; }
.actions-cell { display: flex; gap: 8px; flex-wrap: wrap; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-weight: normal; min-height: 44px; }
.reset-result-banner { background: var(--stone); border: 3px solid var(--ink); border-radius: 8px; padding: 16px 20px; margin: 16px 0 24px 0; box-shadow: 3px 3px 0 var(--ink); }
.metric-chart { display: block; width: 100%; max-width: 1100px; height: auto; overflow: visible; margin: 12px 0; border: 2px solid var(--ink); border-radius: 6px; background: var(--paper); }
.chart-container { margin: 16px 0 32px 0; width: 100%; max-width: 1100px; height: auto; overflow: visible; }
.metrics-stage { margin: 24px 0; height: auto; overflow: visible; }
.chart-table { margin-top: 12px; }
.cohort-table td, .cohort-table th { text-align: center; }
.cohort-table th[scope="row"] { text-align: left; }
.retention-cell { font-weight: bold; }
.retention-high { background-color: #d1e7dd; color: var(--ink); }
.retention-medium { background-color: #fff3cd; color: var(--ink); }
.retention-low { background-color: #f8d7da; color: var(--ink); }
.retention-empty { color: var(--ink); }
.metrics-definitions dl { display: grid; gap: 12px; margin: 16px 0; }
.metrics-definitions dt { margin-top: 8px; font-size: 1.05rem; }
.metrics-definitions dd { margin-left: 0; }

/* Sin animaciones: respeta cualquier preferencia de movimiento reducido. */

h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
body.authenticated { padding-left: 280px; }
main#content, #message, .topbar { max-width: 1200px; margin-left: auto; margin-right: auto; }
.topbar { display: flex; align-items: center; gap: 16px; padding-bottom: 16px; }
.session-controls { margin-left: auto; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
#navigation { position: fixed; inset: 0 auto 0 0; width: 248px; padding: 24px 12px; margin: 0; overflow-y: auto; background: var(--ink); color: var(--paper); display: block; z-index: 10; }
.brand { font-weight: 750; padding: 0 12px 16px; }
#navigation h2 { font-size: .8rem; letter-spacing: .06em; margin: 24px 12px 6px; }
#navigation button { width: 100%; text-align: left; border: 0; border-left: 4px solid transparent; border-radius: 0; box-shadow: none; background: var(--ink); color: var(--paper); font-weight: 400; }
#navigation button[aria-current="page"] { border-left: 4px solid var(--paper); font-weight: 750; text-decoration: underline; }
#navigation button:focus-visible { outline-color: var(--paper); outline-offset: -4px; }
#reports-subnav { display: grid; margin-left: 12px; border-left: 1px solid var(--paper); }
#menu-toggle { display: none; }
.skip { z-index: 20; left: 16px; }
.table-wrap { max-height: 70vh; }
thead th { position: sticky; top: 0; background: var(--stone); z-index: 1; }
th, td { padding: 8px 12px; }
.filters { display: flex; align-items: end; flex-wrap: wrap; }
.filters label { flex: 1 1 180px; }
.badge { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid currentColor; border-radius: 4px; padding: 2px 8px; font-size: .875rem; font-weight: 700; background: var(--stone); color: var(--ink); }
.badge::before { content: "•"; }
.badge.badge-urgent { color: #8b0000; border-style: double; }
.badge.badge-urgent::before { content: "!"; }
.badge.badge-warning { color: #5c3d10; border-style: dashed; }
.badge.badge-warning::before { content: "△"; }
.empty-state { border: 1.5px dashed var(--ink); border-radius: 8px; padding: 24px; }
.home-block { margin-top: 24px; border: 1.5px solid var(--ink); border-radius: 8px; padding: 20px; box-shadow: 2px 2px 0 var(--ink); }
.home-block ul { padding-left: 20px; }
.home-block li { padding: 8px 0; border-bottom: 1px solid var(--ink); overflow-wrap: anywhere; }
#home-activity ul { list-style: none; padding-left: 0; }
#home-activity li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; gap: 12px; align-items: center; border-bottom: 1px solid var(--stone); }
@media (max-width: 859px) {
  body, body.authenticated { padding: 16px; }
  #menu-toggle { display: inline-flex; }
  #navigation { display: none; top: 92px; width: 248px; }
  body.menu-open #navigation { display: block; }
  .topbar { flex-wrap: wrap; }
  .session-controls { gap: 8px; }
}

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; }
.change-value { white-space: pre-wrap; overflow-wrap: anywhere; }
footer { margin-top: 32px; border-top: 1.5px solid var(--ink); }

/* Consola: densidad, jerarquía y lectura sin depender del color. */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.page-description, #breadcrumb, .switch-description { font-size: .9rem; color: var(--ink); font-weight: 400; }
.page-description { margin: 0 0 24px; }
#breadcrumb { margin: 0 0 6px; }
.page-heading { min-width: 0; flex: 1 1 200px; overflow-wrap: anywhere; }
.page-heading h1 { margin: 0; }
.topbar { flex-wrap: wrap; }
.session-controls { min-width: 0; gap: 12px; }
#admin-role { font-size: .9rem; }
button { background: var(--paper); color: var(--ink); box-shadow: none; }
.button-primary, form button:not([type="button"]):last-child { background: var(--blue); color: var(--paper); }
.button-danger, form .button-danger:last-child { background: var(--paper); border-color: #8b0000; color: #8b0000; }
td:last-child:has(button), th:last-child:has(+ :empty) { text-align: right; }
td button { font-size: .875rem; white-space: nowrap; padding: 8px 12px; }
.cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; align-items: start; height: auto; overflow: visible; }
.cards article, .metric-card, .support-card { background: var(--paper); border: 1.5px solid var(--ink); padding: 16px; box-shadow: none; height: auto; overflow: visible; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 6px 8px; }
.cards article > *, .metric-card > *, .support-card > * { grid-column: 1 / -1; min-width: 0; }
.cards article > h3, .metric-card > h3 { grid-column: 1; grid-row: 1; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; margin: 0; align-self: center; }
.cards article > .info-tip-wrap, .metric-card > .info-tip-wrap { grid-column: 2; grid-row: 1; justify-self: end; align-self: center; }
.number { font-size: 1.75rem; margin: 0; }
.kpi-variation { margin: 4px 0 0; font-size: .9rem; font-weight: 600; }
.kpi-variation-muted { color: #52505c; font-weight: 400; }
.home-block { box-shadow: none; height: auto; overflow: visible; }
#home-attention ul { list-style: none; padding: 0; margin: 0; }
#home-attention li { display: flex; align-items: center; gap: 12px; }
.attention-label { flex: 1; }
.attention-count { font-size: 1.25rem; }
.key-values { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(0, 2fr); gap: 10px 16px; }
.key-values dt { font-weight: 600; }
.key-values dt::after { content: ":"; }
.key-values dd { margin: 0; overflow-wrap: anywhere; }
.table-wrap { width: 100%; min-width: 0; overflow-x: auto; }
th, td { padding: 10px 12px; }
.cell-text { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-width: 140px; max-width: 32rem; overflow-wrap: anywhere; }
#navigation summary { cursor: pointer; min-height: 44px; padding: 12px; }
#navigation summary h2 { display: inline; font-size: .85rem; margin: 0; }
#navigation summary:focus-visible { outline-color: var(--paper); outline-offset: -3px; }
#navigation [data-section] { display: flex; align-items: center; gap: 8px; }
.nav-count { margin-left: auto; padding: 0 6px; border: 1px solid var(--paper); border-radius: 4px; font-size: .8rem; font-weight: 700; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 20px; }
.settings-grid > section { min-width: 0; margin-top: 0; }
.settings-change .form-grid { grid-template-columns: 1fr; }
.switch-list { display: grid; gap: 12px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--ink); min-height: 44px; }
.switch-description { display: block; margin-top: 4px; }
.switch-row input { flex: 0 0 44px; width: 44px; height: 44px; margin: 0; accent-color: var(--blue); }
.notice { border: 1.5px solid currentColor; border-left: 5px solid currentColor; border-radius: 6px; padding: 12px 16px; font-weight: 400; overflow-wrap: anywhere; }
.notice-info { color: var(--blue); background: var(--paper); }
.notice-warning { color: #5c3d10; background: var(--stone); }
.notice-danger { color: #8b0000; background: var(--paper); }
body:not(.authenticated) { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; }
body:not(.authenticated) .topbar { display: none; }
body:not(.authenticated) main { width: 100%; }
.login { margin: 0 auto; box-shadow: none; }
.login .brand { padding: 0; margin-top: 0; color: var(--blue); }
main#content { min-width: 0; }
@media (max-width: 859px) {
  .topbar { gap: 12px; align-items: flex-start; }
  .session-controls { flex: 1 1 100%; margin-left: 0; }
  #home-attention li { flex-wrap: wrap; }
  .attention-label { flex-basis: 55%; }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .table-wrap table { min-width: 620px; }
  #navigation { max-height: calc(100dvh - 92px); }
}

.technical-code { font-size: .8em; }
.switch-row .technical-code, td > .technical-code { display: block; }
.field-help { display: block; font-size: .8em; font-weight: normal; margin-top: .25rem; }
.compact-table th, .compact-table td { padding: .4rem .65rem; }

/* Ayudas y acentos por área. Los pares AA se verifican con getContrastRatio. */
:root { --blue-tint: #e9eff8; --stone-light: #f4eee5; --green: #24543b; --green-tint: #eaf3ed; --amber: #67450e; --amber-tint: #fff0ce; --danger: #782b42; --danger-tint: #fae9ee; }
#page-what { margin: 8px 0 0; max-width: 65ch; font-size: .95rem; }
.topbar { border-top: 5px solid var(--blue); padding-top: 12px; }
.topbar[data-area="Legal y cumplimiento"] { border-top-color: var(--danger); background: var(--danger-tint); }
.topbar[data-area="Aplicación"], .topbar[data-area="Contenido"] { background: var(--blue-tint); }
.topbar[data-area="Negocio"] { border-top-color: var(--green); background: var(--green-tint); }
.topbar[data-area="Sistema"], .topbar[data-area="Personas"] { background: var(--stone-light); }
#navigation [data-nav-group] { margin: 12px 0; border-left: 3px solid var(--stone); padding-left: 6px; }
#navigation [data-nav-group]:has([data-section="reports"]), #navigation [data-nav-group]:has([data-section="app-versions"]) { border-left-color: var(--blue-tint); }
#navigation [data-nav-group]:has([data-section="economy"]) { border-left-color: var(--green-tint); }
#navigation [data-nav-group]:has([data-section="data-requests"]) { border-left-color: var(--danger-tint); }
#navigation #reports-subnav button { background: var(--stone-light); color: var(--ink); padding-left: 24px; }
#navigation #reports-subnav button:focus-visible { outline-color: var(--blue); }
#navigation > [data-section="help"] { margin-top: 24px; border-top: 1px solid var(--paper); }
.settings-current { background: var(--stone-light); }
.settings-change { background: var(--blue-tint); border-top: 4px solid var(--blue); }
.notice-success, .badge-success { color: var(--green); background: var(--green-tint); }
.badge-success::before { content: "✓"; }
.context-help { margin-top: 24px; padding: 20px; border: 2px solid var(--blue); background: var(--blue-tint); max-width: 75ch; }
.context-help dt, #help-glossary dt, [data-help-entry] dt { font-weight: 700; margin-top: 16px; }
.context-help dd, #help-glossary dd, [data-help-entry] dd { margin: 4px 0; }
[data-help-entry] { margin: 24px 0; background: var(--paper); box-shadow: none; }
#help-index { align-items: center; padding: 12px; background: var(--stone-light); }
#help-index a { padding: 0 8px; }
.info-tip-wrap { display: inline-flex; align-items: center; position: relative; vertical-align: middle; text-transform: none; letter-spacing: normal; font-weight: 400; }
.info-tip { width: 24px; height: 24px; min-width: 24px; min-height: 24px; padding: 0; margin: 0 0 0 6px; border: 1.5px solid var(--blue); border-radius: 50%; color: var(--blue); background: var(--paper); font-size: .75rem; line-height: 1; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; position: relative; }
.info-tip::before { content: ""; position: absolute; inset: -10px; min-width: 44px; min-height: 44px; }
.info-tip-wrap [role="tooltip"] { display: block; position: absolute; top: calc(100% + 6px); right: 0; width: min(280px, 75vw); padding: 12px; border: 2px solid var(--blue); border-radius: 6px; background: var(--paper); color: var(--ink); z-index: 30; font-size: .9rem; white-space: normal; text-align: left; }
.help-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 0 8px; }
.help-field > label { grid-column: 1 / -1; grid-row: 1; }
.help-field > .info-tip-wrap { grid-column: 2; grid-row: 1; justify-self: end; align-self: start; z-index: 2; }
.help-field:has(.switch-row) > label { grid-column: 1; }
.help-field:has(.switch-row) > .info-tip-wrap { align-self: center; }
th:has(.info-tip-wrap) { position: static; }
.audit-description { display: block; font-size: .9rem; overflow-wrap: anywhere; }
.economy-chart { display: block; width: 100%; max-width: 1100px; height: auto; overflow: visible; margin: 12px 0; border: 2px solid var(--ink); border-radius: 6px; color: var(--ink); fill: var(--ink); background: var(--paper); font: 14px system-ui, sans-serif; }
#request-user-results { display: grid; gap: 8px; }
.list-header-actions { display: flex; justify-content: flex-start; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.legal-status-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin: 16px 0; border: 1.5px solid var(--ink); border-radius: 8px; background: var(--stone-light); height: auto; overflow: visible; }
.legal-editor-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 24px; align-items: start; margin: 16px 0; height: auto; overflow: visible; }
.legal-editor-pane, .legal-preview-pane { margin-top: 0; height: auto; overflow: visible; min-width: 0; }
.legal-preview-pane { position: sticky; top: 16px; }
.legal-body-textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; min-height: 36rem; line-height: 1.5; width: 100%; }
.legal-technical-details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.publish-checklist { padding-left: 20px; margin: 8px 0; }
@media (max-width: 859px) {
  .legal-editor-layout { grid-template-columns: minmax(0, 1fr); }
  .legal-preview-pane { position: static; }
}
