/* =========================================================
   LimaFac Préstamos — hoja de estilos principal
   Tema doble: claro por defecto en :root, oscuro en
   [data-tema="oscuro"]. El sistema arranca en oscuro; el
   conmutador de la barra superior guarda la elección.
   ========================================================= */

:root,
[data-tema="claro"] {
    --serie-neutra: #c3d2cf;
    /* superficies */
    --bg: #f5f7f6;
    --panel: #ffffff;
    --elev: #eef2f1;
    --line: #e2e8e6;
    --line-2: #cfd8d6;
    --field: #ffffff;
    --chip: #eef2f1;

    /* texto */
    --text: #0d1817;
    --text-2: #374644;
    --muted: #5c6b68;
    --dim: #66736f;

    /* marca y estados */
    --teal: #0f7a72;
    --teal-hover: #0b5f59;
    --on-teal: #ffffff;
    --amber: #806210;
    --pagado: #0e7a45;
    --mora: #b4232f;
    --on-mora: #ffffff;

    /* rellenos suaves de estado */
    --teal-soft: #dff3f0;
    --amber-soft: #fbf0d5;
    --pagado-soft: #dcf4e8;
    --mora-soft: #fce8ea;
    --neutro-soft: #eef2f1;

    --sombra: 0 1px 2px rgba(13, 24, 23, .06), 0 1px 3px rgba(13, 24, 23, .04);
    --sombra-md: 0 8px 24px -8px rgba(13, 24, 23, .18);
}

[data-tema="oscuro"] {
    --serie-neutra: #2c4a47;
    --bg: #070d0e;
    --panel: #0a1213;
    --elev: #16221f;
    --line: #16211f;
    --line-2: #24332f;
    --field: #0f1a1b;
    --chip: #101b1c;

    --text: #e6efed;
    --text-2: #c6d5d2;
    --muted: #8b9d9a;
    --dim: #6b807d;

    --teal: #21b2a7;
    --teal-hover: #2abbaf;
    --on-teal: #05231f;
    --amber: #c49a33;
    --pagado: #3fc79a;
    --mora: #ec817d;
    --on-mora: #05231f;

    --teal-soft: rgba(33, 178, 167, .16);
    --amber-soft: rgba(196, 154, 51, .18);
    --pagado-soft: rgba(63, 199, 154, .16);
    --mora-soft: rgba(232, 115, 111, .18);
    --neutro-soft: #101b1c;

    --sombra: 0 1px 2px rgba(0, 0, 0, .5);
    --sombra-md: 0 16px 40px -16px rgba(0, 0, 0, .8);
}

/* Iguales en los dos temas ------------------------------- */
:root {
    /* barra lateral: ancla de marca, siempre oscura */
    --nav-bg: #060b0c;
    --nav-line: #16211f;
    --nav-text: #8fa4a1;
    --nav-text-activo: #05231f;
    --nav-activo: #21b2a7;
    --nav-seccion: #8b9d9a;

    /* series de gráfico: validadas sobre las dos superficies */
    --serie-1: #12a08d;
    --serie-2: #b08e2c;
    --serie-3: #c44e66;

    /* forma y ritmo */
    --r-control: 8px;
    --r-card: 12px;
    --r-pill: 20px;
    --h-control: 40px;
    --sidebar-w: 248px;

    --display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
    --ui: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: light; }
[data-tema="oscuro"] { color-scheme: dark; }

body {
    font-family: var(--ui);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

h1, h2, h3, h4, .display { font-family: var(--display); letter-spacing: -.02em; }

/* Logotipo: mapa de bits de proporción 512×223. Se dimensiona por el alto y
   el ancho va solo, para no deformarlo nunca. */
.marca-logo { display: block; height: 34px; width: auto; max-width: 100%; }
.logo { display: inline-flex; align-items: center; flex-shrink: 0; }

.num, .stat-value, table.data td, table.data-table td, .pagination .page-link {
    font-variant-numeric: tabular-nums;
}
.stat-value, .num { font-family: var(--display); letter-spacing: -.01em; }

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

::selection { background: var(--teal); color: var(--on-teal); }

:where(a, button, .btn, .nav-link, .quick-card, .demo-row, .tab-btn):focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

/* ===================== LAYOUT ===================== */
.app { display: flex; min-height: 100vh; }

/* ===================== BARRA LATERAL ===================== */
.sidebar {
    width: var(--sidebar-w);
    background: var(--nav-bg);
    border-right: 1px solid var(--nav-line);
    color: var(--nav-text);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 40;
    transition: transform .25s ease, width .2s ease;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--nav-line);
    position: relative;
    min-height: 78px;
}

.sidebar__brand .marca-logo { height: 38px; }

.sidebar__nav { flex: 1; overflow-y: auto; padding: 12px; }
.sidebar__nav::-webkit-scrollbar { width: 6px; }
.sidebar__nav::-webkit-scrollbar-thumb { background: #1e2d2a; border-radius: 3px; }

.nav-section {
    font-size: 9.5px; text-transform: uppercase; letter-spacing: .12em;
    color: var(--nav-seccion); font-weight: 600; padding: 18px 10px 7px;
}
.sidebar__nav > .nav-section:first-child { padding-top: 6px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 10px;
    border-radius: var(--r-control);
    color: var(--nav-text);
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 2px;
    transition: background .15s ease, color .15s ease;
}
.nav-link i { font-size: 16px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-link:hover { background: #0e1a19; color: #dfeae8; }
.nav-link.active { background: var(--nav-activo); color: var(--nav-text-activo); font-weight: 600; }

.sidebar__footer {
    padding: 14px 20px 18px;
    border-top: 1px solid var(--nav-line);
    font-size: 10.5px;
    color: #8b9d9a; /* 7.5:1 sobre la barra lateral; #4d605d daba 2.97:1 */
}

/* --- Barra lateral plegada: rail de iconos (solo escritorio) --- */
@media (min-width: 861px) {
    [data-nav="colapsado"] .sidebar { width: 72px; }
    [data-nav="colapsado"] .main { margin-left: 72px; }
    /* A 72px el logotipo se vuelve ilegible (el descriptor desaparece), así que
       se oculta; la cabecera se mantiene para que su filete siga alineado con
       el borde inferior de la barra superior. */
    [data-nav="colapsado"] .sidebar__brand { padding: 0; min-height: 68px; }
    [data-nav="colapsado"] .sidebar__brand .marca-logo { display: none; }
    [data-nav="colapsado"] .sidebar__nav { padding: 12px 10px; }
    /* El primer filete duplicaría el borde de la cabecera */
    [data-nav="colapsado"] .sidebar__nav > .nav-section:first-child { display: none; }
    /* El rótulo de sección se convierte en un filete: los grupos se siguen leyendo */
    [data-nav="colapsado"] .nav-section {
        height: 1px; padding: 0; margin: 14px 6px; overflow: hidden;
        background: var(--nav-line); font-size: 0;
    }
    [data-nav="colapsado"] .nav-link { justify-content: center; padding: 11px 0; gap: 0; }
    [data-nav="colapsado"] .nav-link span { display: none; }
    [data-nav="colapsado"] .sidebar__footer { display: none; }
}

/* ===================== PRINCIPAL ===================== */
.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left .2s ease;
}

.topbar {
    height: 68px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 30;
}

.topbar__left { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* Botón para plegar la barra lateral (solo escritorio; en móvil manda .menu-toggle) */
.nav-toggle {
    display: none;
    width: 34px; height: 34px; flex-shrink: 0;
    align-items: center; justify-content: center;
    border: none; background: none; border-radius: var(--r-control);
    color: var(--muted); font-size: 18px; cursor: pointer;
    transition: color .15s, background .15s;
}
.nav-toggle:hover { color: var(--text); background: var(--chip); }
@media (min-width: 861px) { .nav-toggle { display: inline-flex; } }
.topbar .menu-toggle {
    display: none; background: none; border: none; font-size: 22px;
    cursor: pointer; color: var(--text);
}
.topbar__title { font-family: var(--display); font-size: 16px; font-weight: 600; }

.topbar__search {
    display: flex; align-items: center; gap: 10px;
    background: var(--field);
    border: 1px solid var(--line-2);
    border-radius: 9px;
    padding: 9px 14px;
    width: 380px;
    max-width: 40vw;
    color: var(--muted);
}
.topbar__search input {
    border: none; background: transparent; outline: none; width: 100%;
    font-size: 12.5px; font-family: inherit; color: var(--text);
}
.topbar__search input::placeholder { color: var(--muted); }

.topbar__right { display: flex; align-items: center; gap: 16px; }

.icon-btn {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: var(--r-control);
    font-size: 18px; color: var(--muted); cursor: pointer;
    background: none; border: none; transition: color .15s, background .15s;
}
.icon-btn:hover { color: var(--text); background: var(--chip); }
.icon-btn .badge {
    position: absolute; top: 0; right: 0;
    background: var(--mora); color: var(--on-mora);
    font-size: 9.5px; font-weight: 700; font-family: var(--display);
    min-width: 16px; height: 16px; border-radius: 8px;
    display: grid; place-items: center; padding: 0 4px;
}

/* Conmutador de tema ------------------------------------- */
.tema-toggle {
    display: flex; gap: 2px; padding: 3px;
    border-radius: var(--r-control);
    background: var(--chip);
    border: 1px solid var(--line-2);
}
.tema-toggle button {
    width: 30px; height: 26px; border: none; border-radius: 6px;
    background: transparent; color: var(--muted);
    cursor: pointer; display: grid; place-items: center;
    font-size: 14px; transition: background .15s, color .15s;
}
.tema-toggle button:hover { color: var(--text); }
.tema-toggle button[aria-pressed="true"] { background: var(--teal); color: var(--on-teal); }

/* Notificaciones ---------------------------------------- */
.noti { position: relative; }
.noti-panel {
    position: absolute; top: 44px; right: 0; width: 340px;
    background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-card);
    box-shadow: var(--sombra-md); overflow: hidden; z-index: 50;
    display: none;
}
.noti-panel.open { display: block; }
.noti-head {
    padding: 14px 16px; font-weight: 600; font-size: 13.5px; font-family: var(--display);
    border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px;
}
.noti-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    border-bottom: 1px solid var(--line); transition: background .15s;
}
.noti-item:last-child { border-bottom: none; }
.noti-item:hover { background: var(--elev); }
.noti-ic {
    width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
    font-size: 16px; flex-shrink: 0;
}
.noti-t { font-size: 13px; font-weight: 600; color: var(--text); }
.noti-d { font-size: 12px; color: var(--muted); }
.noti-empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 13px; }

.user-menu { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.user-menu .avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--teal); color: var(--on-teal);
    display: grid; place-items: center; font-weight: 600; font-family: var(--display);
    font-size: 14px; overflow: hidden; flex-shrink: 0;
}
.user-menu .avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-menu .name { font-size: 12.5px; font-weight: 600; line-height: 1.3; }
.user-menu .role { font-size: 10.5px; color: var(--muted); }

.content { padding: 26px 28px 32px; flex: 1; }
.page-title { font-family: var(--display); font-size: 25px; font-weight: 600; margin-bottom: 5px; }
.page-subtitle { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.section-title { font-family: var(--display); font-size: 16px; font-weight: 600; margin: 24px 0 14px; }

/* ===================== TARJETAS DE CIFRA ===================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card {
    --acc: var(--teal);
    --acc-soft: var(--teal-soft);
    position: relative;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r-card);
    padding: 17px 18px 18px;
    color: var(--text);
    min-height: 112px;
    display: flex;
    flex-direction: column;
}
/* El icono lleva el color de acento en un azulejo: da peso a la tarjeta
   sin recurrir al degradado de antes. */
.stat-card .stat-icon {
    position: absolute; right: 16px; top: 15px;
    width: 34px; height: 34px; border-radius: 9px;
    display: grid; place-items: center;
    background: var(--acc-soft); color: var(--acc);
    font-size: 16px;
}
.stat-card .stat-label {
    display: block; padding-right: 46px;
    font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
    color: var(--muted); font-weight: 600; line-height: 1.4;
    /* Alto de dos líneas: así las cifras de la fila arrancan todas a la
       misma altura aunque una etiqueta ocupe dos renglones. */
    min-height: 27px;
}
.stat-card .stat-value {
    font-size: 26px; font-weight: 600; margin-top: 9px; line-height: 1.05; color: var(--text);
}
.stat-card .stat-foot { font-size: 11.5px; color: var(--muted); margin-top: auto; padding-top: 9px; }

/* Los seis degradados anteriores se reducen a cuatro acentos con significado. */
.bg-blue, .bg-teal, .bg-cyan, .bg-indigo { --acc: var(--teal);   --acc-soft: var(--teal-soft); }
.bg-purple, .bg-orange                   { --acc: var(--amber);  --acc-soft: var(--amber-soft); }
.bg-red                                  { --acc: var(--mora);   --acc-soft: var(--mora-soft); }
.bg-green                                { --acc: var(--pagado); --acc-soft: var(--pagado-soft); }

.bg-red.stat-card { border-color: color-mix(in srgb, var(--mora) 32%, var(--line)); }
.bg-red.stat-card .stat-value { color: var(--mora); }

/* ===================== TARJETAS Y GRÁFICOS ===================== */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r-card);
    min-width: 0; /* permite encoger dentro de un grid */
}
.card__header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
    font-family: var(--display);
    font-size: 14.5px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card__body { padding: 20px; }
.card__footer { padding: 14px 20px; border-top: 1px solid var(--line); }
.chart-wrap { position: relative; height: 280px; }

/* ===================== ACCESOS RÁPIDOS ===================== */
.quick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.quick-card {
    --acc: var(--teal);
    --acc-soft: var(--teal-soft);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r-card);
    padding: 17px 18px;
    display: flex; align-items: center; gap: 14px;
    transition: border-color .15s ease, transform .15s ease;
}
.quick-card:hover { border-color: var(--teal); transform: translateY(-2px); }
.quick-card .q-icon {
    width: 42px; height: 42px; border-radius: 10px;
    display: grid; place-items: center; font-size: 20px;
    background: var(--acc-soft); color: var(--acc); flex-shrink: 0;
}
.quick-card .q-title { font-family: var(--display); font-weight: 600; font-size: 14px; }
.quick-card .q-desc { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ===================== TABLAS ===================== */
.table-wrap, .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
table.data, table.data-table { width: 100%; border-collapse: collapse; }
.table-wrap table.data, .table-responsive table.data-table { min-width: 620px; }

table.data th, table.data td,
table.data-table th, table.data-table td {
    padding: 12px 20px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}
table.data th, table.data-table th {
    background: var(--bg);
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: .11em;
    white-space: nowrap;
}
table.data tbody tr:last-child td,
table.data-table tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover, table.data-table tbody tr:hover { background: var(--elev); }
table.data td strong, table.data-table td strong { font-family: var(--display); font-weight: 600; white-space: nowrap; }
table.data td .btn, table.data-table td .btn { white-space: nowrap; }

/* ===================== ETIQUETAS DE ESTADO ===================== */
.badge-pill {
    display: inline-block; padding: 3px 10px; border-radius: var(--r-pill);
    font-size: 10.5px; font-weight: 600; white-space: nowrap;
}
.b-green  { background: var(--pagado-soft); color: var(--pagado); }
.b-red    { background: var(--mora-soft);   color: var(--mora); }
.b-yellow { background: var(--amber-soft);  color: var(--amber); }
.b-blue   { background: var(--teal-soft);   color: var(--teal); }
.b-indigo { background: var(--teal-soft);   color: var(--teal); }
.b-purple { background: var(--amber-soft);  color: var(--amber); }
.b-gray   { background: var(--neutro-soft); color: var(--muted); }

/* ===================== BOTONES ===================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: var(--h-control);
    padding: 0 17px; border-radius: var(--r-control); border: 1px solid transparent;
    font-family: var(--ui); font-weight: 600; font-size: 13.5px;
    cursor: pointer; transition: background .15s ease, border-color .15s ease, color .15s ease;
    line-height: 1;
}
.btn i { font-size: 15px; }

.btn-primary { background: var(--teal); color: var(--on-teal); font-family: var(--display); }
.btn-primary:hover { background: var(--teal-hover); }

.btn-light, .btn-secondary, .btn-outline {
    background: transparent; border-color: var(--line-2); color: var(--text); font-weight: 500;
}
.btn-light:hover, .btn-secondary:hover, .btn-outline:hover { background: var(--elev); border-color: var(--muted); }

.btn-danger { background: var(--mora-soft); color: var(--mora); }
.btn-danger:hover { background: var(--mora); color: var(--on-mora); }

.btn-success { background: var(--pagado-soft); color: var(--pagado); }
.btn-success:hover { background: var(--pagado); color: var(--on-teal); }

.btn-white { background: var(--panel); color: var(--teal); border-color: var(--line-2); }
.btn-white:hover { background: var(--elev); }

.btn-sm { min-height: 32px; padding: 0 11px; font-size: 12.5px; }
.btn-sm i { font-size: 14px; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ===================== FORMULARIOS ===================== */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }

.form-control {
    padding: 0 14px; height: var(--h-control);
    border: 1px solid var(--line-2); border-radius: 9px;
    font-size: 13.5px; outline: none; width: 100%;
    font-family: inherit; background: var(--field); color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
textarea.form-control { height: auto; padding: 11px 14px; line-height: 1.6; }
select.form-control { cursor: pointer; }
.form-control::placeholder { color: var(--muted); }
.form-control:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 18%, transparent);
}
.form-actions { display: flex; gap: 10px; margin-top: 22px; }

/* Las casillas sin estilo miden 13x13: se agrandan y toman el color de marca */
input[type="checkbox"], input[type="radio"] {
    width: 18px; height: 18px; accent-color: var(--teal);
    cursor: pointer; flex-shrink: 0;
}
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) { cursor: pointer; }

/* El input llena su contenedor para que toda la caja sea zona de toque */
.topbar__search input { align-self: stretch; min-height: 22px; }

.input-icon { position: relative; }
.input-icon i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 15px; }
.input-icon .form-control { padding-left: 38px; }

/* ===================== AVISOS ===================== */
.alert {
    padding: 12px 16px; border-radius: 10px; margin-bottom: 18px;
    font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 9px;
    border: 1px solid transparent;
}
.alert-success { background: var(--pagado-soft); color: var(--pagado); border-color: color-mix(in srgb, var(--pagado) 28%, transparent); }
.alert-error   { background: var(--mora-soft);   color: var(--mora);   border-color: color-mix(in srgb, var(--mora) 28%, transparent); }

/* ===================== PAGINACIÓN ===================== */
.pagination { display: flex; gap: 6px; margin-top: 18px; flex-wrap: wrap; list-style: none; padding: 0; align-items: center; }
.pagination .page-item .page-link {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 32px; height: 32px; padding: 0 10px;
    border: 1px solid var(--line-2); border-radius: 7px;
    font-size: 12.5px; background: transparent; color: var(--text-2);
}
.pagination .page-item .page-link:hover { background: var(--elev); }
.pagination .page-item.active .page-link { background: var(--teal); color: var(--on-teal); border-color: var(--teal); font-weight: 600; }
.pagination .page-item.disabled .page-link { color: var(--dim); background: transparent; }
.pagination svg { width: 15px; height: 15px; }

/* ===================== ACCESO (login y afines) ===================== */
.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 560px;
    background: var(--bg);
}

.login-hero {
    position: relative;
    overflow: hidden;
    background: #070d0e;
    color: #e6efed;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 56px 64px;
    border-right: 1px solid #16211f;
}
.login-hero::before {
    content: ''; position: absolute; inset: 0;
    background-image: linear-gradient(#0f1c1d 1px, transparent 1px), linear-gradient(90deg, #0f1c1d 1px, transparent 1px);
    background-size: 72px 72px; opacity: .45;
}
.login-hero::after {
    content: ''; position: absolute; width: 720px; height: 720px; border-radius: 50%;
    background: radial-gradient(circle, rgba(33, 178, 167, .18), transparent 62%);
    top: -280px; left: -180px;
}
.login-hero > * { position: relative; z-index: 1; }

.login-hero h1 { font-size: 46px; font-weight: 700; line-height: 1.02; margin-bottom: 16px; color: #fff; }
.login-hero p { font-size: 15.5px; color: #a8bab7; max-width: 460px; }

.login-hero.centered { align-items: flex-start; text-align: left; }

.login-brand-big { display: inline-flex; align-items: center; }
.login-brand-big .marca-logo { height: 58px; }

.login-feat-list { display: flex; flex-direction: column; gap: 11px; max-width: 460px; margin-top: 26px; }
.login-feat { display: flex; align-items: center; gap: 13px; }
.login-feat .ic {
    width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
    font-size: 17px; color: #21b2a7; background: rgba(33, 178, 167, .13); flex-shrink: 0;
}
.login-feat .t { font-size: 13.5px; font-weight: 600; color: #e6efed; }
.login-feat .d { font-size: 12px; color: #8b9d9a; }

.login-mini-stats { display: flex; gap: 44px; border-top: 1px solid #17231f; padding-top: 26px; }
.login-mini-stats .box { text-align: left; }
.login-mini-stats .num { font-family: var(--display); font-size: 26px; font-weight: 600; color: #fff; line-height: 1; }
.login-mini-stats .lbl { font-size: 12px; color: #8b9d9a; margin-top: 8px; }

.login-form-side {
    display: flex; align-items: center; justify-content: center;
    padding: 48px; background: var(--panel);
}
.login-card { width: 100%; max-width: 400px; }
.login-card .brand-mobile { display: none; }
.login-card .brand-mobile .marca-logo { height: 48px; }
.login-card h2 { font-size: 26px; font-weight: 600; margin-bottom: 6px; }
.login-card .muted { color: var(--muted); margin-bottom: 26px; font-size: 14px; }
.login-card .form-group { margin-bottom: 16px; }
.login-card .check-row {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 22px; font-size: 13px;
}
.login-card .check-row label { display: flex; align-items: center; gap: 8px; color: var(--text-2); cursor: pointer; }
.login-card .check-row a { color: var(--teal); font-weight: 500; }
.login-card .btn-primary { width: 100%; min-height: 48px; font-size: 14.5px; }
.login-hint {
    margin-top: 22px; font-size: 12px; color: var(--muted);
    background: var(--elev); border: 1px solid var(--line); border-radius: 10px;
    padding: 12px; text-align: center;
}

.demo-divider { text-align: center; color: var(--muted); font-size: 12px; margin: 22px 0 14px; position: relative; }
.demo-divider::before, .demo-divider::after { content: ''; position: absolute; top: 50%; width: 30%; height: 1px; background: var(--line); }
.demo-divider::before { left: 0; } .demo-divider::after { right: 0; }
.demo-box { border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px; background: var(--elev); }
.demo-box .head { font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--amber); margin-bottom: 10px; }
.demo-row {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--panel);
    margin-bottom: 8px; cursor: pointer; font-size: 13px; transition: border-color .15s; font-family: inherit;
    color: var(--text);
}
.demo-row:last-child { margin-bottom: 0; }
.demo-row:hover { border-color: var(--teal); }
.login-foot { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 22px; }
.login-foot a { color: var(--teal); font-weight: 600; }

/* ===================== PERFIL ===================== */
.profile-header {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r-card);
    overflow: hidden;
    margin-bottom: 22px;
}
.profile-cover { height: 110px; background: #070d0e; position: relative; overflow: hidden; }
.profile-cover::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at 22% 130%, rgba(33, 178, 167, .34), transparent 60%);
}
.profile-body { padding: 0 26px 22px; display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.profile-avatar {
    width: 96px; height: 96px; border-radius: 20px; margin-top: -46px;
    background: var(--teal); color: var(--on-teal);
    display: grid; place-items: center; font-size: 38px; font-weight: 600; font-family: var(--display);
    border: 4px solid var(--panel); flex-shrink: 0;
    position: relative; overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-cam {
    position: absolute; bottom: 0; right: 0; left: 0;
    background: rgba(7, 13, 14, .7); color: #fff;
    font-size: 12px; padding: 4px 0; text-align: center; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.avatar-cam:hover { background: rgba(7, 13, 14, .88); }
.profile-meta { flex: 1; min-width: 220px; padding-top: 12px; }
.profile-meta h1 { font-size: 22px; font-weight: 600; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-meta .email { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.profile-meta .chips { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11.5px; font-weight: 500; padding: 5px 12px; border-radius: var(--r-pill);
    background: var(--chip); color: var(--muted);
}

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; flex-wrap: wrap; }
.tab-btn {
    padding: 11px 16px; border: none; background: none; cursor: pointer;
    font-family: inherit; font-weight: 500; font-size: 13.5px; color: var(--muted);
    border-bottom: 2px solid transparent; display: inline-flex; align-items: center; gap: 8px;
    margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--teal); border-bottom-color: var(--teal); font-weight: 600; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.info-list { width: 100%; border-collapse: collapse; }
.info-list th { text-align: left; padding: 12px 0; color: var(--muted); font-weight: 500; font-size: 13px; width: 42%; border-bottom: 1px solid var(--line); }
.info-list td { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }

.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.timeline-item { position: relative; padding-bottom: 18px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
    position: absolute; left: -26px; top: 3px; width: 16px; height: 16px; border-radius: 50%;
    border: 3px solid var(--panel); box-shadow: 0 0 0 2px var(--line-2);
}
.timeline-item .t-title { font-weight: 600; font-size: 13.5px; }
.timeline-item .t-time { font-size: 12px; color: var(--muted); }

/* ===================== MÓDULO PENDIENTE ===================== */
.placeholder-box { text-align: center; padding: 80px 20px; }
.placeholder-box .p-icon {
    width: 84px; height: 84px; border-radius: 20px; margin: 0 auto 22px;
    background: var(--teal-soft); color: var(--teal);
    display: grid; place-items: center; font-size: 38px;
}
.placeholder-box h2 { font-size: 24px; font-weight: 600; margin-bottom: 10px; }
.placeholder-box p { color: var(--muted); max-width: 480px; margin: 0 auto 8px; }
.placeholder-box .tag {
    display: inline-block; margin-top: 16px; background: var(--amber-soft); color: var(--amber);
    padding: 6px 14px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600;
}

/* ===================== FACTURACIÓN ELECTRÓNICA ===================== */
.fe-hero {
    position: relative;
    border-radius: var(--r-card);
    padding: 24px 26px;
    margin-bottom: 20px;
    color: #e6efed;
    background: #070d0e;
    border: 1px solid #16211f;
    overflow: hidden;
}
.fe-hero::after {
    content: ""; position: absolute; right: -80px; top: -140px;
    width: 420px; height: 420px; border-radius: 50%;
    background: radial-gradient(circle, rgba(33, 178, 167, .20), transparent 62%);
}
.fe-hero__top { display: flex; align-items: flex-start; gap: 16px; position: relative; z-index: 1; }
.fe-hero__icon {
    flex: 0 0 auto; width: 52px; height: 52px; border-radius: 12px;
    background: rgba(33, 178, 167, .15); color: #21b2a7;
    display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.fe-hero__title { font-family: var(--display); font-size: 21px; font-weight: 600; color: #fff; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fe-hero__flag { font-size: 14px; font-weight: 500; color: #a8bab7; }
.fe-hero__sub { font-size: 13px; color: #8b9d9a; margin-top: 5px; max-width: 640px; }
.fe-hero__brand { margin-left: auto; text-align: right; }
.fe-hero__brand .b1 { font-family: var(--display); font-weight: 600; font-size: 15px; color: #fff; }
.fe-hero__brand .b2 { font-size: 11px; color: #8b9d9a; }
.fe-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; position: relative; z-index: 1; }
.fe-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600;
    background: #101b1c; color: #a8bab7;
}
.fe-pill.is-on   { background: rgba(63, 199, 154, .18); color: #3fc79a; }
.fe-pill.is-off  { background: #101b1c; color: #8b9d9a; }
.fe-pill.is-warn { background: rgba(196, 154, 51, .19); color: #c49a33; }
.fe-pill.is-bad  { background: rgba(232, 115, 111, .18); color: #ec817d; }
.fe-hero__actions { margin-top: 18px; position: relative; z-index: 1; }
.fe-hero__actions .btn-white { background: #21b2a7; color: #05231f; border: none; font-family: var(--display); }
.fe-hero__actions .btn-white:hover { background: #2abbaf; }

.fe-check-row {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-card);
    margin-bottom: 12px;
}
.fe-check-row input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--teal); cursor: pointer; }
.fe-check-row .t { font-weight: 600; color: var(--text); }
.fe-check-row .d { font-size: 12px; color: var(--muted); margin-top: 2px; }

.fe-note {
    background: var(--teal-soft); border: 1px solid color-mix(in srgb, var(--teal) 30%, transparent);
    border-radius: 10px; padding: 12px 14px; font-size: 12.5px; color: var(--teal);
    margin-bottom: 16px; display: flex; gap: 8px; align-items: flex-start;
}
.fe-cert-warn { font-size: 12px; color: var(--mora); margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.fe-cert-ok   { font-size: 12px; color: var(--pagado); margin-top: 6px; display: flex; gap: 6px; align-items: center; }

/* ===================== PORTADA PÚBLICA ===================== */
.lp { background: #070d0e; color: #e6efed; }
.lp a { color: inherit; }

.lp-top { position: relative; overflow: hidden; }
.lp-top::before {
    content: ''; position: absolute; inset: 0;
    background-image: linear-gradient(#0f1c1d 1px, transparent 1px), linear-gradient(90deg, #0f1c1d 1px, transparent 1px);
    background-size: 72px 72px; opacity: .5;
}
.lp-top::after {
    content: ''; position: absolute; width: 760px; height: 760px; border-radius: 50%;
    background: radial-gradient(circle, rgba(33, 178, 167, .20), transparent 62%);
    top: -300px; right: -180px;
}

.lp-nav {
    position: relative; z-index: 5;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 72px; height: 82px;
    border-bottom: 1px solid #17231f;
}
.lp-brand { display: flex; align-items: center; gap: 12px; }
.lp-brand .marca-logo { height: 54px; }


.lp-navlinks { display: flex; align-items: center; gap: 32px; }
.lp-navlinks a:not(.lp-btn) { color: #a8bab7; font-weight: 500; font-size: 13.5px; transition: color .15s; }
.lp-navlinks a:not(.lp-btn):hover { color: #fff; }

.lp-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    padding: 11px 20px; border-radius: 9px; font-weight: 600; font-size: 13.5px;
    border: 1px solid transparent; cursor: pointer; transition: background .15s, color .15s;
    font-family: var(--display);
}
.lp-btn-primary { background: #21b2a7; color: #05231f; }
.lp-btn-primary:hover { background: #2abbaf; }
.lp-btn-ghost { background: transparent; color: #e6efed; border-color: #2a3d3a; }
.lp-btn-ghost:hover { background: #101b1c; }
.lp-btn-light { background: #21b2a7; color: #05231f; }
.lp-btn-light:hover { background: #2abbaf; }

.lp-hero { position: relative; z-index: 2; padding: 92px 72px 76px; display: flex; flex-direction: column; gap: 30px; }
.lp-badge {
    display: inline-flex; align-self: flex-start; align-items: center; gap: 10px;
    background: rgba(33, 178, 167, .08); border: 1px solid #23413c;
    color: #8ccfc4; font-size: 12px; font-weight: 500; padding: 7px 15px; border-radius: 999px;
}
.lp-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #21b2a7; }
.lp-hero h1 {
    font-size: 84px; line-height: .96; font-weight: 700; color: #fff;
    letter-spacing: -.03em; max-width: 1020px; text-wrap: pretty;
}
.lp-hero h1 .grad { color: #21b2a7; }
.lp-hero h1 .grad-2 { color: #c49a33; }
.lp-hero p { font-size: 19px; line-height: 1.55; color: #a8bab7; max-width: 580px; }
.lp-hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.lp-hero-cta .lp-btn { padding: 16px 26px; font-size: 15px; }
.lp-hero-note { display: flex; align-items: center; gap: 16px; font-size: 13px; color: #8b9d9a; flex-wrap: wrap; }
.lp-hero-note span.sep { width: 3px; height: 3px; border-radius: 50%; background: #2a3d3a; }

.lp-stats {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    background: #0a1213; border-top: 1px solid #17231f; border-bottom: 1px solid #17231f;
    position: relative; z-index: 2;
}
.lp-stat { padding: 40px; border-right: 1px solid #17231f; }
.lp-stat:first-child { padding-left: 72px; }
.lp-stat:last-child { border-right: none; padding-right: 72px; }
.lp-stat .num { font-family: var(--display); font-size: 42px; font-weight: 600; color: #fff; line-height: 1; }
.lp-stat.is-teal .num { color: #21b2a7; }
.lp-stat.is-amber .num { color: #c49a33; }
.lp-stat .lbl { font-size: 12.5px; color: #8b9d9a; margin-top: 10px; line-height: 1.5; }
.lp-stat .lbl small { display: block; color: #6b807d; font-size: 12.5px; }

.lp-section { padding: 84px 72px; border-top: 1px solid #17231f; }
.lp-section .eyebrow {
    text-align: center; color: #21b2a7; font-weight: 600; font-size: 12px;
    letter-spacing: .14em; text-transform: uppercase;
}
.lp-section h2 {
    text-align: center; font-size: 46px; font-weight: 700; margin: 16px auto 14px;
    color: #fff; max-width: 760px; line-height: 1.06; text-wrap: pretty;
}
.lp-section .sub { text-align: center; color: #a8bab7; max-width: 560px; margin: 0 auto 44px; font-size: 16px; }

.lp-features {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px; background: #17231f; border: 1px solid #17231f; border-radius: 14px; overflow: hidden;
}
.lp-feature { background: #0a1213; padding: 30px 28px; display: flex; flex-direction: column; gap: 11px; }
.lp-feature .ic { font-size: 22px; color: #21b2a7; }
.lp-feature.is-amber .ic { color: #c49a33; }
.lp-feature h3 { font-family: var(--display); font-size: 16px; font-weight: 600; color: #fff; }
.lp-feature p { color: #a8bab7; font-size: 13.5px; line-height: 1.6; }

.lp-extra { display: flex; align-items: center; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.lp-extra span.lead { font-size: 13px; color: #8b9d9a; }
.lp-extra span.tag { font-size: 12.5px; color: #c6d5d2; border: 1px solid #1e2d2a; border-radius: var(--r-pill); padding: 5px 13px; }

.lp-planes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.lp-plan {
    background: #0a1213; border: 1px solid #1e2d2a; border-radius: 14px;
    padding: 30px; display: flex; flex-direction: column; gap: 20px; position: relative;
}
.lp-plan.is-destacado { background: #0d1618; border-color: #21b2a7; }
.lp-plan .etiqueta {
    position: absolute; top: -11px; left: 30px; font-family: var(--display);
    font-size: 11px; font-weight: 600; background: #21b2a7; color: #05231f;
    border-radius: var(--r-pill); padding: 4px 12px;
}
.lp-plan h3 { font-family: var(--display); font-size: 18px; font-weight: 600; color: #fff; }
.lp-plan .desc { font-size: 13px; color: #8b9d9a; margin-top: 6px; }
.lp-plan .precio { font-family: var(--display); font-size: 32px; font-weight: 700; color: #c49a33; }
.lp-plan .precio small { font-family: var(--ui); font-size: 13px; font-weight: 400; color: #8b9d9a; }
.lp-plan ul { list-style: none; display: flex; flex-direction: column; gap: 11px; border-top: 1px solid #1e2d2a; padding-top: 20px; }
.lp-plan li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: #c6d5d2; }
.lp-plan li b { font-family: var(--display); color: #21b2a7; min-width: 34px; }
.lp-plan .lp-btn { width: 100%; }

.lp-cta {
    position: relative; overflow: hidden;
    text-align: center; padding: 88px 24px 92px;
    border-top: 1px solid #17231f;
}
.lp-cta::after {
    content: ''; position: absolute; width: 900px; height: 500px; border-radius: 50%;
    background: radial-gradient(circle, rgba(33, 178, 167, .16), transparent 65%);
    top: -120px; left: 50%; transform: translateX(-50%);
}
.lp-cta > * { position: relative; z-index: 1; }
.lp-cta h2 { font-size: 50px; font-weight: 700; margin-bottom: 20px; color: #fff; line-height: 1.05; max-width: 760px; margin-inline: auto; text-wrap: pretty; }
.lp-cta p { color: #a8bab7; max-width: 520px; margin: 0 auto 28px; font-size: 17px; }
.lp-cta .lp-hero-cta { justify-content: center; }

.lp-footer { background: #060b0c; border-top: 1px solid #17231f; padding: 44px 72px 36px; }
.lp-footer-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 60px; padding-bottom: 30px; border-bottom: 1px solid #131e1c; flex-wrap: wrap; }
.lp-footer-cols { display: grid; grid-template-columns: repeat(3, 168px); gap: 40px; }
.lp-footer-cols h4 { font-family: var(--ui); font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #6b807d; margin-bottom: 12px; }
.lp-footer-cols a:not(.lp-btn) { display: block; font-size: 13px; color: #a8bab7; margin-bottom: 10px; }
.lp-footer-cols a:hover { color: #fff; }
.lp-footer .marca-logo { height: 42px; }
.lp-footer .desc { font-size: 13px; line-height: 1.6; color: #8b9d9a; max-width: 300px; margin-top: 12px; }
.lp-footer-bottom { display: flex; align-items: center; justify-content: space-between; padding-top: 22px; font-size: 12.5px; color: #6b807d; gap: 16px; flex-wrap: wrap; }

/* ===================== RESPONSIVE ===================== */
.sidebar-close-btn {
    display: none; background: transparent; border: none; color: var(--nav-text);
    font-size: 20px; cursor: pointer; padding: 6px 8px; border-radius: var(--r-control);
}
.sidebar-close-btn:hover { background: #0e1a19; color: #fff; }

.mobile-search-btn { display: none; }

.sidebar-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(7, 13, 14, .7);
    backdrop-filter: blur(2px);
    z-index: 35; opacity: 0; transition: opacity .25s ease;
}
.sidebar-backdrop.show { display: block; opacity: 1; }
@media (min-width: 861px) { .sidebar-backdrop { display: none !important; } }

@media (max-width: 1400px) {
    .lp-hero h1 { font-size: 68px; }
    .lp-section h2, .lp-cta h2 { font-size: 40px; }
}

@media (max-width: 1280px) {
    .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
    .lp-nav, .lp-hero, .lp-section, .lp-footer { padding-left: 40px; padding-right: 40px; }
    .lp-stat:first-child { padding-left: 40px; }
    .lp-stat:last-child { padding-right: 40px; }
}

@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr) !important; }
    .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .lp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .lp-stat { border-bottom: 1px solid #17231f; }
    .lp-stat:nth-child(2) { border-right: none; }
    .lp-features, .lp-planes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .login-page { grid-template-columns: 1fr; }
    .login-hero { display: none; }
    .login-card .brand-mobile { display: flex; flex-direction: column; align-items: center; margin-bottom: 24px; }
}

@media (max-width: 860px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 0 0 40px rgba(0, 0, 0, .6);
        width: 280px; max-width: 85vw;
        -webkit-overflow-scrolling: touch;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close-btn { display: inline-flex; align-items: center; justify-content: center;
        position: absolute; top: 14px; right: 14px; }
    .main { margin-left: 0; }

    .topbar { padding: 0 16px; gap: 12px; }
    .topbar .menu-toggle { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; }
    .topbar > .topbar__search { display: none !important; }
    .mobile-search-btn { display: inline-flex; }
    .topbar__right { gap: 8px; }
    .user-menu .name, .user-menu .role { display: none; }

    .card__header { flex-direction: column; align-items: stretch !important; gap: 12px; }
    /* En varias vistas el buscador ES un <form>, así que heredaba el
       flex-wrap de .card__header form y el icono caía a otra línea. */
    .card__header .topbar__search {
        display: flex !important; width: 100% !important; max-width: 100% !important;
        flex-wrap: nowrap !important; align-items: center;
    }
    .card__header .topbar__search input { min-width: 0; flex: 1 1 auto; }
    .card__header > div:first-child { width: 100%; }
    .card__header form { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
    .card__header form select.form-control { flex: 1 1 140px; }
    .card__header form .btn { flex: 1 1 auto; }

    .card__body > form[style*="display:flex"], .card__body > form[style*="display: flex"] {
        flex-direction: column !important; align-items: stretch !important; gap: 12px !important;
    }
    .card__body > form[style*="display:flex"] .form-group,
    .card__body > form[style*="display: flex"] .form-group { width: 100% !important; }
    .card__body > form[style*="display:flex"] .btn,
    .card__body > form[style*="display: flex"] .btn { width: 100% !important; }

    .content { padding: 18px 16px 26px; }
    .quick-grid { grid-template-columns: minmax(0, 1fr) !important; }

    .lp-navlinks a:not(.lp-btn) { display: none; }
    .lp-hero { padding: 56px 24px 48px; }
    .lp-hero h1 { font-size: 42px; }
    .lp-hero p { font-size: 16px; }
    .lp-nav { padding: 0 24px; height: 72px; }
    .lp-brand .marca-logo { height: 38px; }
    .lp-section { padding: 56px 24px; }
    .lp-footer { padding: 36px 24px 30px; }
    .lp-section h2, .lp-cta h2 { font-size: 30px; }
    .lp-cta { padding: 56px 24px; }
    .lp-features, .lp-planes { grid-template-columns: 1fr; }
    .lp-stats { grid-template-columns: 1fr; }
    .lp-stat, .lp-stat:first-child, .lp-stat:last-child { padding: 26px 24px; border-right: none; }
    .lp-footer-top { flex-direction: column; gap: 30px; }
    .lp-footer-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
}

@media (max-width: 640px) {
    .stats-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 12px; }
    .form-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }

    /* Evita el zoom automático de iOS al enfocar un campo */
    .form-control, select.form-control, textarea.form-control { font-size: 16px !important; }

    /* Objetivo táctil cómodo: el cobrador pulsa de pie y con una mano.
       El mínimo recomendado en móvil es 44 px en ambos ejes. */
    .btn { min-height: 46px; }
    .btn-sm { min-height: 44px; min-width: 44px; padding: 0 14px; }
    .icon-btn { min-width: 44px; min-height: 44px; }
    .nav-link { padding: 12px 12px; }
    .menu-toggle, .mobile-search-btn { flex-shrink: 0; min-width: 44px; min-height: 44px; }

    /* Paginación: 60x32 era difícil de acertar con el pulgar */
    .pagination .page-item .page-link { min-width: 44px; height: 44px; padding: 0 14px; }

    /* Enlaces sueltos dentro de tablas (códigos de préstamo, cliente…):
       eran texto de 15 px de alto, sin área de toque propia. */
    table.data td a:not(.btn), table.data-table td a:not(.btn) {
        display: inline-flex; align-items: center; min-height: 40px;
    }

    /* Conmutador de tema: 30x26 quedaba por debajo del umbral */
    .tema-toggle button { width: 40px; height: 40px; }

    .sidebar-close-btn { min-width: 44px; min-height: 44px; }
    .user-menu { min-height: 44px; }
    .tab-btn { min-height: 44px; }
    input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; }
    .topbar__search { padding: 0 14px; min-height: 44px; }
    .topbar__search input { min-height: 42px; }

    .page-title { font-size: 21px; }
    .page-subtitle { font-size: 13px; margin-bottom: 16px; }
    .content { padding: 14px 12px 24px; }

    .noti-panel {
        position: fixed !important; top: 68px !important; left: 12px !important; right: 12px !important;
        width: auto !important; max-width: calc(100vw - 24px) !important;
        max-height: 75vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
    }

    .profile-body { justify-content: center; }
    .profile-avatar { margin-top: -40px; width: 84px; height: 84px; font-size: 32px; }
    .profile-meta { text-align: left; }

    .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
    .tab-btn { white-space: nowrap; font-size: 13px; padding: 10px 14px; }

    .form-actions { flex-direction: column-reverse; gap: 8px; }
    .form-actions .btn { width: 100%; }

    .card__header { font-size: 14px; padding: 14px 16px; }
    .card__body { padding: 16px 14px; }
    table.data th, table.data td, table.data-table th, table.data-table td { padding: 11px 14px; font-size: 12.5px; }
    .pagination { justify-content: center; }
    .lp-hero h1 { font-size: 34px; }
    .lp-footer-bottom { flex-direction: column; align-items: flex-start; gap: 8px; }
}

@media (max-width: 480px) {
    .content { padding: 12px 10px 22px; }
    .topbar { padding: 0 12px; height: 60px; }
    .topbar__title { font-size: 14px; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .login-form-side { padding: 28px 16px; }
    .login-card h2 { font-size: 22px; }
    .quick-card { padding: 14px; gap: 12px; }
    .quick-card .q-icon { width: 40px; height: 40px; font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
