/* ============================================================
   TTR Manager · Hoja de estilos con modo claro / oscuro
   ============================================================ */

/* ---------- Tema CLARO (por defecto) ---------- */
:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f7f9fd;
    --border: #dfe4ee;
    --text: #1f2733;
    --muted: #6b7789;

    --primary: #1f5fd6;
    --primary-d: #17479f;
    --primary-t: rgba(31, 95, 214, .25);

    --ok: #1c8a52;
    --ok-bg: #e5f6ec;
    --ok-b: #bfe7d0;

    --warn: #b57900;
    --warn-bg: #fdf3dd;
    --warn-b: #f0e0b4;

    --bad: #c02b3a;
    --bad-bg: #fdeaec;
    --bad-b: #f2c6cc;

    --excl: #6b4bbd;
    --excl-bg: #efe9fb;
    --excl-b: #d2c6ee;

    --topbar: #14213d;
    --topbar-fg: #ffffff;
    --topbar-mu: #cfd8ea;

    --shadow: 0 1px 2px rgba(20, 32, 55, .06), 0 6px 18px rgba(20, 32, 55, .06);
    --radius: 10px;

    color-scheme: light;
}

/* ---------- Tema OSCURO ---------- */
[data-theme="dark"] {
    --bg: #0e1420;
    --surface: #18202f;
    --surface-2: #1f2a3d;
    --border: #2b364b;
    --text: #e6ecf7;
    --muted: #8a96ab;

    --primary: #4d8bf0;
    --primary-d: #3a72d6;
    --primary-t: rgba(77, 139, 240, .35);

    --ok: #4dd68a;
    --ok-bg: #10301e;
    --ok-b: #1c4c33;

    --warn: #f0b643;
    --warn-bg: #2f2510;
    --warn-b: #4d3c14;

    --bad: #f5707e;
    --bad-bg: #381a20;
    --bad-b: #5a2730;

    --excl: #b39aef;
    --excl-bg: #221a3d;
    --excl-b: #3a2c66;

    --topbar: #0a0f1a;
    --topbar-fg: #ffffff;
    --topbar-mu: #a9b5cc;

    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 22px rgba(0, 0, 0, .35);

    color-scheme: dark;
}

/* ---------- Reset ---------- */
* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    transition: background-color .25s ease, color .25s ease;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: .82rem;
}

.spacer {
    flex: 1;
}

/* ---------- Topbar ---------- */
.topbar {
    background: var(--topbar);
    color: var(--topbar-fg);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 20;
    transition: background-color .25s ease;
}

.topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: .7rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: var(--topbar-fg);
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    background: var(--primary);
    padding: .2rem .55rem;
    border-radius: 6px;
    font-weight: 800;
    letter-spacing: .5px;
    color: #fff;
}

.brand-text {
    font-weight: 600;
    font-size: .92rem;
    opacity: .92;
}

.nav {
    display: flex;
    gap: .25rem;
    flex-wrap: wrap;
}

.nav a {
    color: var(--topbar-mu);
    padding: .4rem .75rem;
    border-radius: 6px;
    font-size: .9rem;
    font-weight: 500;
}

.nav a:hover {
    background: rgba(255, 255, 255, .08);
    text-decoration: none;
    color: #fff;
}

.nav a.active {
    background: var(--primary);
    color: #fff;
}

/* ---------- Botón tema ---------- */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .4rem .7rem;
    border: 1px solid rgba(255, 255, 255, .18);
    background: rgba(255, 255, 255, .06);
    color: var(--topbar-fg);
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
    font-family: inherit;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, .14);
    border-color: rgba(255, 255, 255, .32);
}

.theme-toggle .ico {
    font-size: 1rem;
    line-height: 1;
}

.theme-toggle .lbl {
    display: inline;
}

@media (max-width: 560px) {
    .theme-toggle .lbl {
        display: none;
    }
}

/* ---------- Layout ---------- */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}

.footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 1.1rem 1.25rem;
    color: var(--muted);
    font-size: .82rem;
    transition: background-color .25s ease, border-color .25s ease;
}

.footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.footer-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.footer-row:first-child {
    font-size: .92rem;
    color: var(--text);
}

.footer-row:first-child strong {
    color: var(--primary);
    letter-spacing: .3px;
    font-weight: 800;
}

.footer-row .spacer {
    flex: 1;
}

@media (max-width: 560px) {
    .footer-row:first-child {
        font-size: .85rem;
    }
}

.two-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1.25rem;
}

/* ---------- Encabezado de página ---------- */
.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.page-head h1 {
    font-size: 1.4rem;
    margin: 0 0 .25rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.page-head p {
    margin: 0;
}

.head-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    align-items: center;
}

/* ---------- Botones ---------- */
.btn {
    display: inline-block;
    padding: .5rem .9rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 8px;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    transition: .15s;
    line-height: 1.2;
    font-family: inherit;
}

.btn:hover {
    border-color: var(--primary);
    background: var(--surface-2);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-d);
    border-color: var(--primary-d);
    color: #fff;
}

.btn-danger {
    background: var(--surface);
    color: var(--bad);
    border-color: var(--bad-b);
}

.btn-danger:hover {
    background: var(--bad-bg);
    border-color: var(--bad);
}

.btn-sm {
    padding: .3rem .6rem;
    font-size: .8rem;
}

.inline {
    display: inline;
}

/* ---------- Tarjetas ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
    transition: background-color .25s ease, border-color .25s ease;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .9rem;
    flex-wrap: wrap;
}

.card-head h2 {
    font-size: 1.05rem;
    margin: 0;
}

.card-excl {
    border-left: 4px solid var(--excl);
}

.card-warn {
    border-top: 3px solid var(--warn);
}

.card-danger {
    border-top: 3px solid var(--bad);
}

/* ---------- KPI ---------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.kpi {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.kpi header h2 {
    font-size: 1.1rem;
    margin: 0;
}

.kpi header h3 {
    font-size: .9rem;
    margin: 0;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.kpi-sub {
    font-size: .78rem;
    color: var(--muted);
}

.kpi-value {
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -.5px;
    line-height: 1.1;
}

.kpi-value.small {
    font-size: 1.6rem;
}

.kpi-foot {
    margin: 0;
    font-size: .84rem;
    color: var(--muted);
}

.kpi-main {
    border-top: 3px solid var(--primary);
}

.progress {
    height: 7px;
    background: var(--surface-2);
    border-radius: 99px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 99px;
    transition: width .4s;
}

.progress-bar.bar-2 {
    background: var(--ok);
}

/* ---------- Tablas ---------- */
.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}

.table th,
.table td {
    padding: .55rem .65rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

.table thead th {
    background: var(--surface-2);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--muted);
    font-weight: 700;
}

.table tfoot th {
    background: var(--surface-2);
    border-top: 2px solid var(--border);
}

.table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.table tbody tr:hover {
    background: var(--surface-2);
}

.row-excluded {
    background: var(--excl-bg);
}

.row-muted {
    opacity: .55;
}

.row-actions {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
}

/* ---------- Pills y badges ---------- */
.pill {
    display: inline-block;
    padding: .12rem .5rem;
    border-radius: 99px;
    font-size: .78rem;
    font-weight: 700;
    background: var(--surface-2);
    color: var(--text);
}

.pill-ok {
    background: var(--ok-bg);
    color: var(--ok);
}

.pill-warn {
    background: var(--warn-bg);
    color: var(--warn);
}

.pill-bad {
    background: var(--bad-bg);
    color: var(--bad);
}

.badge {
    display: inline-block;
    padding: .12rem .5rem;
    border-radius: 6px;
    font-size: .74rem;
    font-weight: 700;
    background: var(--surface-2);
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .3px;
}

.badge-ok {
    background: var(--ok-bg);
    color: var(--ok);
}

.badge-excl {
    background: var(--excl-bg);
    color: var(--excl);
}

/* ---------- Filtros ---------- */
.filters {
    display: flex;
    gap: .6rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filters-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}

.filters label {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    font-size: .78rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .3px;
}

.filter-actions {
    display: flex;
    gap: .5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.quick-periods {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
    margin-bottom: 1.1rem;
}

.chip {
    padding: .3rem .75rem;
    border-radius: 99px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: .82rem;
    font-weight: 600;
    color: var(--text);
}

.chip:hover {
    text-decoration: none;
    border-color: var(--primary);
}

.chip-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ---------- Formularios ---------- */
.form label {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    font-size: .82rem;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: .9rem;
}

input[type=text],
input[type=search],
input[type=date],
input[type=number],
input[type=datetime-local],
input[type=file],
input[type=email],
input[type=password],
select,
textarea {
    padding: .5rem .65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .92rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    font-weight: 400;
    width: 100%;
    transition: border-color .15s, background-color .15s;
}

input::placeholder,
textarea::placeholder {
    color: var(--muted);
    opacity: .8;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary-t);
    border-color: var(--primary);
}

textarea {
    resize: vertical;
    min-height: 60px;
}

select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% - 2px),
        calc(100% - 13px) calc(50% - 2px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 2rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0 1rem;
}

.checkbox {
    flex-direction: row !important;
    align-items: center;
    gap: .5rem;
    font-weight: 500 !important;
    color: var(--text) !important;
    margin-bottom: .6rem !important;
}

.checkbox input {
    width: auto;
}

.checkbox span {
    font-size: .92rem;
}

.form-actions {
    display: flex;
    gap: .5rem;
    margin-top: .5rem;
    flex-wrap: wrap;
    align-items: center;
}

.sep {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.1rem 0;
}

.field-hint {
    display: flex;
    align-items: center;
}

.exception-block {
    background: var(--excl-bg);
    border: 1px dashed var(--excl-b);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    margin: .75rem 0 1rem;
}

.exception-block label:last-child {
    margin-bottom: 0;
}

/* ---------- Detalles (dl) ---------- */
.detail {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: .45rem .9rem;
    margin: 0;
}

.detail dt {
    font-weight: 700;
    color: var(--muted);
    font-size: .84rem;
}

.detail dd {
    margin: 0;
    font-size: .92rem;
}

/* ---------- Listas mini ---------- */
.mini-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mini-list li {
    border-bottom: 1px solid var(--border);
}

.mini-list li:last-child {
    border-bottom: none;
}

.mini-list a {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem 0;
    color: var(--text);
}

.mini-list a:hover {
    text-decoration: none;
    background: var(--surface-2);
}

/* ---------- Alertas ---------- */
.alert {
    padding: .75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: .9rem;
}

.alert-ok {
    background: var(--ok-bg);
    color: var(--ok);
    border: 1px solid var(--ok-b);
}

.alert-error {
    background: var(--bad-bg);
    color: var(--bad);
    border: 1px solid var(--bad-b);
}

.alert-error ul {
    margin: 0;
    padding-left: 1.1rem;
}

/* ---------- Vacio ---------- */
.empty {
    color: var(--muted);
    font-size: .9rem;
    padding: .6rem 0;
}

/* ---------- Paginación ---------- */
.pagination {
    display: flex;
    gap: .25rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.pagination a {
    padding: .35rem .7rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .85rem;
    background: var(--surface);
    color: var(--text);
}

.pagination a:hover {
    background: var(--surface-2);
    text-decoration: none;
}

.pagination a.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ---------- Vista Importar ---------- */
.import-help {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    margin: 1rem 0;
}

.import-help h3 {
    font-size: .95rem;
    margin: 0 0 .6rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .4px;
}

.import-cols {
    margin: 0 0 .8rem 1rem;
    padding: 0;
    font-size: .88rem;
    line-height: 1.7;
}

.import-cols code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: .05rem .35rem;
    font-size: .82rem;
}

/* ---------- Vista Cleanup ---------- */
.danger-action {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
}

.danger-action:first-of-type {
    border-top: none;
    padding-top: .5rem;
}

.danger-action h3 {
    font-size: .98rem;
    margin: 0 0 .25rem;
}

.danger-action p {
    margin: 0;
}

.danger-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .5rem;
}

.danger-actions .checkbox {
    margin-bottom: 0 !important;
}

@media (max-width: 720px) {
    .danger-action {
        grid-template-columns: 1fr;
    }

    .danger-actions {
        align-items: stretch;
    }
}

/* ---------- Utilidades de color ---------- */
.text-bad {
    color: var(--bad);
}

.text-warn {
    color: var(--warn);
}

.text-ok {
    color: var(--ok);
}

/* ============================================================
   AUTENTICACIÓN Y MENÚ DE USUARIO
   ============================================================ */

/* ---------- Login ---------- */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: var(--bg);
    margin: 0;
}

.auth-wrap {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 2.25rem 2rem;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    justify-content: center;
    margin-bottom: 1.75rem;
}

.auth-brand-text {
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: .5px;
    color: var(--text);
}

.auth-title {
    font-size: 1.4rem;
    margin: 0 0 .35rem;
    text-align: center;
    font-weight: 700;
    color: var(--text);
}

.auth-sub {
    text-align: center;
    margin: 0 0 1.5rem;
    font-size: .88rem;
    color: var(--muted);
}

.auth-field {
    display: block;
    margin-bottom: 1.1rem;
    width: 100%;
}

.auth-field>span {
    display: block;
    font-size: .76rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: .4rem;
}

.auth-field input {
    width: 100%;
    padding: .7rem .85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .95rem;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
}

.auth-field input::placeholder {
    color: var(--muted);
    opacity: .7;
}

.auth-field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-t);
}

.auth-btn {
    width: 100%;
    padding: .75rem;
    font-size: .95rem;
    margin-top: .5rem;
    font-weight: 700;
}

.auth-foot {
    text-align: center;
    margin: 1.5rem 0 0;
    font-size: .82rem;
    color: var(--muted);
}

@media (max-width: 480px) {
    .auth-card {
        padding: 1.75rem 1.25rem;
    }

    .auth-title {
        font-size: 1.2rem;
    }
}

/* ---------- Topbar acciones ---------- */
.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* ---------- Menú de usuario (desplegable) ---------- */
.user-menu {
    position: relative;
}

.user-btn {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .35rem .65rem .35rem .35rem;
    border: 1px solid rgba(255, 255, 255, .15);
    background: rgba(255, 255, 255, .05);
    color: var(--topbar-fg);
    border-radius: 99px;
    cursor: pointer;
    font-family: inherit;
    transition: background-color .15s, border-color .15s;
}

.user-btn:hover {
    background: rgba(255, 255, 255, .14);
    border-color: rgba(255, 255, 255, .32);
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: .85rem;
    flex-shrink: 0;
}

.user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
}

.user-name {
    font-size: .85rem;
    font-weight: 700;
}

.user-role {
    font-size: .7rem;
    opacity: .75;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.user-caret {
    font-size: .7rem;
    opacity: .6;
    margin-left: .1rem;
}

/* Dropdown del usuario */
.user-dropdown {
    position: absolute;
    top: calc(100% + .35rem);
    right: 0;
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
    z-index: 50;
    overflow: hidden;
}

/* CRÍTICO: ocultar cuando tiene atributo hidden */
.user-dropdown[hidden] {
    display: none !important;
}

.user-dd-head {
    padding: .65rem .85rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: .1rem;
    font-size: .85rem;
    color: var(--text);
}

.user-dd-head small {
    font-size: .75rem;
    color: var(--muted);
}

.user-dropdown a {
    display: block;
    padding: .6rem .85rem;
    color: var(--text);
    font-size: .88rem;
    text-decoration: none;
    transition: background-color .12s;
}

.user-dropdown a:hover {
    background: var(--surface-2);
    text-decoration: none;
}

@media (max-width: 640px) {
    .user-meta {
        display: none;
    }

    .user-btn {
        padding: .35rem;
    }
}

/* ---------- Selección de módulos (user_form) ---------- */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: .75rem;
    margin-bottom: 1rem;
}

.module-card {
    display: block !important;
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .85rem .95rem;
    background: var(--surface);
    transition: border-color .15s, background-color .15s;
    margin-bottom: 0 !important;
}

.module-card:hover {
    border-color: var(--primary);
    background: var(--surface-2);
}

.module-card input {
    display: none;
}

.module-card input:checked+.module-body {
    position: relative;
}

.module-card input:checked+.module-body::after {
    content: '✓';
    position: absolute;
    top: 0;
    right: 0;
    background: var(--primary);
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 800;
}

.module-body {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
}

.module-icon {
    font-size: 1.4rem;
    line-height: 1;
    flex-shrink: 0;
}

.module-label {
    font-weight: 700;
    font-size: .92rem;
}

.module-desc {
    margin-top: .1rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .detail {
        grid-template-columns: 1fr;
    }

    .detail dt {
        margin-top: .35rem;
    }

    .page-head h1 {
        font-size: 1.2rem;
    }

    .kpi-value {
        font-size: 1.7rem;
    }
}

/* ---------- Reducción de movimiento ---------- */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}