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

html, body {
    min-height: 100%;
}

body {
    font-family: "Inter", Arial, sans-serif;
    background: linear-gradient(180deg, #eaf3fb 0%, #f8fafc 100%);
    color: #1f2d3d;
    padding: 20px;
}

img {
    max-width: 100%;
    display: block;
}

.page-shell {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* ── Layout principal: sidebar + contenido ── */
.layout-body {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

/* ── Sidebar de navegación ── */
.sidebar {
    flex: 0 0 230px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(31, 93, 155, 0.13);
    overflow: hidden;
    position: sticky;
    top: 20px;
    border: 1px solid #dce8f5;
}

.sidebar-header {
    background: linear-gradient(135deg, #1f5d9b 0%, #163f73 100%);
    padding: 18px 20px 16px;
}

.sidebar-header .sidebar-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    color: rgba(255,255,255,0.65);
    margin-bottom: 2px;
}

.sidebar-header .sidebar-subtitle {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 10px 10px;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 12px;
    font-size: 0.93rem;
    font-weight: 600;
    color: #374a5e;
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
    border-left: 3px solid transparent;
    margin-bottom: 2px;
}

.sidebar a:hover {
    background: #eaf3fb;
    color: #1f5d9b;
    border-left-color: #a8c8f0;
}

.sidebar a.active {
    background: linear-gradient(90deg, #eaf3fb 0%, #dceeff 100%);
    color: #1f5d9b;
    border-left-color: #1f5d9b;
    font-weight: 700;
}

.nav-bullet {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
    background: #e6eef8;
    color: #1f5d9b;
    transition: background 0.18s ease, color 0.18s ease;
}

.sidebar a:hover .nav-bullet {
    background: #c5dcf5;
    color: #163f73;
}

.sidebar a.active .nav-bullet {
    background: #1f5d9b;
    color: #fff;
}

.sidebar-logout {
    color: #9f1f2f !important;
}

.sidebar-logout .nav-bullet {
    background: #f9dde2;
    color: #9f1f2f;
}

.sidebar-logout:hover {
    background: #fdeff2 !important;
    color: #8c1627 !important;
    border-left-color: #d43f57 !important;
}

.sidebar-divider {
    height: 1px;
    background: #e8eef6;
    margin: 6px 4px;
}

/* ── Área de contenido principal ── */
.main-content {
    flex: 1;
    min-width: 0;
}

.hero {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    border-radius: 24px;
    background: linear-gradient(135deg, #1f5d9b 0%, #e02424 100%);
    color: #fff;
    box-shadow: 0 18px 40px rgba(32, 64, 120, 0.16);
    margin-bottom: 24px;
}

.hero img {
    width: 110px;
    height: auto;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.14);
    padding: 12px;
    border: 2px solid rgba(255,255,255,0.3);
}

.hero-text h1 {
    font-size: clamp(2rem, 2.5vw, 2.8rem);
    line-height: 1.05;
    margin-bottom: 10px;
}

.hero-text p {
    max-width: 640px;
    font-size: 1rem;
    opacity: 0.92;
    line-height: 1.65;
}

.tagline {
    font-weight: 600;
    color: #f9e183;
}

.container {
    margin: auto;
    background: rgba(255, 255, 255, 0.96);
    padding: 26px;
    border-radius: 24px;
    box-shadow: 0 18px 40px rgba(47, 67, 104, 0.08);
    border-left: 8px solid #f1c40f;
}

h1, h2 {
    color: #172337;
}

h2 {
    margin-bottom: 20px;
    font-size: 1.75rem;
}

form {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 20px;
}

input,
select {
    flex: 1 1 240px;
    min-width: 220px;
    padding: 14px 16px;
    border: 1px solid #d8dde5;
    border-radius: 16px;
    background: #f7f9fc;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus {
    outline: none;
    border-color: #1f5d9b;
    box-shadow: 0 0 0 4px rgba(31, 93, 155, 0.12);
}

button,
a.button {
    padding: 14px 22px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #f39c12 0%, #d35400 100%);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover,
a.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(211, 84, 0, 0.2);
}

a.dashboard-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    color: #fff;
    background: #1f5d9b;
    padding: 12px 18px;
    border-radius: 14px;
}

a.dashboard-link:hover {
    background: #163f73;
}

.info-text {
    margin-top: 8px;
    color: #4b5f78;
    font-size: 0.98rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.summary-card {
    background: linear-gradient(135deg, #f8fbff 0%, #eaf3fb 100%);
    border: 1px solid #d6e7f9;
    border-radius: 16px;
    padding: 10px 12px;
    box-shadow: 0 8px 20px rgba(31, 93, 155, 0.08);
}

.summary-label {
    color: #5f748f;
    font-size: 0.86rem;
    margin-bottom: 6px;
    font-weight: 600;
}

.summary-value {
    color: #163f73;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.filters-panel {
    background: #f7fbff;
    border: 1px solid #dce8f5;
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 16px;
}

.filters-panel h3 {
    margin-bottom: 10px;
    color: #1f5d9b;
    font-size: 1rem;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.cliente-detectado {
    margin-top: 10px;
    background: #f0f7ff;
    border: 1px solid #c8dcf5;
    border-radius: 12px;
    padding: 8px 10px;
}

.cliente-detectado.recurrente {
    background: #f2fbf4;
    border-color: #a6d8b1;
}

.cliente-detectado.nuevo {
    background: #fff7ec;
    border-color: #ebc386;
}

.cliente-detectado-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1f5d9b;
    margin-bottom: 4px;
}

.cliente-detectado.recurrente .cliente-detectado-title {
    color: #1f6a34;
}

.cliente-detectado.nuevo .cliente-detectado-title {
    color: #9a6312;
}

.cliente-detectado-info {
    font-size: 0.84rem;
    color: #2f4661;
    line-height: 1.35;
}

.cliente-estado-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
}

.cliente-estado-badge.recurrente {
    color: #1f6a34;
    background: #eaf8ee;
    border-color: #a6d8b1;
}

.cliente-estado-badge.nuevo {
    color: #8b5b0a;
    background: #fff2df;
    border-color: #ebc386;
}

.filters-grid input,
.filters-grid select,
.filters-grid button {
    min-width: 0;
    width: 100%;
}

.grid-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(200px, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.table-wrap {
    overflow-x: auto;
    border-radius: 20px;
    -webkit-overflow-scrolling: touch;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 25, 45, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 100;
}

.hidden {
    display: none !important;
}

.operator-barrier-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.barrier-choice-panel {
    padding: 14px;
    border: 2px solid #2f80ed;
    border-radius: 12px;
    background: #eef6ff;
}

.barrier-choice-label {
    flex-basis: 100%;
    margin: 0;
    font-weight: 700;
    color: #173f7a;
}

.modal {
    width: min(540px, 100%);
    background: #fff;
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 24px 80px rgba(15, 25, 45, 0.18);
}

.modal h3 {
    margin-bottom: 10px;
    color: #172337;
}

.modal p {
    margin-bottom: 16px;
    color: #515d6a;
}

.modal label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #243447;
}

.modal input {
    width: 100%;
    margin-bottom: 18px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-close {
    background: #e6eaf0;
    color: #1f2d3d;
}

/* ── Modal de notificaciones corporativo ── */
.notify-overlay {
    position: fixed;
    inset: 0;
    background: rgba(23, 35, 55, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    animation: notifyFadeIn 0.2s ease;
}

.notify-overlay.toast-mode {
    pointer-events: none;
    background: transparent;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 18px;
    backdrop-filter: none;
}

.notify-overlay[hidden] {
    display: none;
}

.notify-box {
    background: #fff;
    border-radius: 24px;
    padding: 36px 40px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 24px 60px rgba(31, 93, 155, 0.22);
    animation: notifySlideUp 0.25s ease;
    border-top: 6px solid #1f5d9b;
}

.notify-overlay.toast-mode .notify-box {
    pointer-events: auto;
    max-width: 360px;
    width: min(360px, calc(100vw - 36px));
    padding: 18px 20px;
    text-align: left;
    border-radius: 18px;
}

.notify-box.success { border-top-color: #27ae60; }
.notify-box.error   { border-top-color: #e02424; }
.notify-box.warning { border-top-color: #f39c12; }

.notify-icon {
    font-size: 2.4rem;
    margin-bottom: 14px;
    line-height: 1;
}

.notify-box h3 {
    font-size: 1.25rem;
    color: #172337;
    margin-bottom: 10px;
}

.notify-box p {
    color: #4b5f78;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 24px;
    white-space: pre-line;
}

.notify-overlay.toast-mode .notify-icon {
    display: none;
}

.notify-overlay.toast-mode .notify-box h3 {
    margin-bottom: 6px;
    font-size: 1rem;
}

.notify-overlay.toast-mode .notify-box p {
    margin-bottom: 0;
    font-size: 0.92rem;
    line-height: 1.45;
}

.notify-overlay.toast-mode .notify-btn {
    display: none;
}

.notify-btn {
    padding: 12px 36px;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, #1f5d9b 0%, #163f73 100%);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.notify-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(31, 93, 155, 0.25);
}

.notify-btn.success { background: linear-gradient(135deg, #27ae60 0%, #1e8449 100%); }
.notify-btn.error   { background: linear-gradient(135deg, #e02424 0%, #a93226 100%); }
.notify-btn.warning { background: linear-gradient(135deg, #f39c12 0%, #d35400 100%); }

@keyframes notifyFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes notifySlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ── Botón lápiz (editar) ── */
.btn-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: #eaf3fb;
    color: #1f5d9b;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, transform 0.15s ease;
    padding: 0;
}

.btn-edit svg {
    width: 16px;
    height: 16px;
    display: block;
}

.btn-edit:hover {
    background: #1f5d9b;
    color: #fff;
    transform: translateY(-1px);
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    padding: 20px;
    overflow: hidden;
}

/* Fondo animado con imágenes */
.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.bg-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    animation: slideShow 20s infinite;
}

.bg-slide:nth-child(1) {
    animation-delay: 0s;
}

.bg-slide:nth-child(2) {
    animation-delay: 5s;
}

.bg-slide:nth-child(3) {
    animation-delay: 10s;
}

.bg-slide:nth-child(4) {
    animation-delay: 15s;
}

@keyframes slideShow {
    0% {
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    25% {
        opacity: 1;
    }
    35% {
        opacity: 0;
    }
    100% {
        opacity: 0;
    }
}

.bg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(15, 53, 89, 0.65) 0%, rgba(31, 93, 155, 0.55) 50%, rgba(224, 36, 36, 0.5) 100%);
    z-index: 1;
}

.login-shell {
    width: min(460px, 92vw);
    position: relative;
    z-index: 10;
}

.login-card {
    background: rgba(255, 255, 255, 0.96);
    border-radius: 24px;
    padding: 28px;
    text-align: center;
    box-shadow: 0 24px 70px rgba(16, 33, 58, 0.3);
}

.login-logo {
    width: 92px;
    margin: 0 auto 12px;
    border-radius: 16px;
    border: 2px solid #dce8f5;
    padding: 8px;
}

.login-card h1 {
    font-size: 1.8rem;
    color: #163f73;
    margin-bottom: 8px;
}

.login-card p {
    color: #4b5f78;
    margin-bottom: 16px;
}

.login-form {
    display: grid;
    gap: 12px;
}

.login-help {
    margin-top: 16px;
    font-size: 0.92rem;
}

@media (max-width: 1024px) {
    body {
        padding: 16px;
    }

    .layout-body {
        flex-direction: column;
    }

    .sidebar {
        position: static;
        top: auto;
        width: 100%;
        flex: 1 1 auto;
    }

    .sidebar nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 10px;
        gap: 8px;
        scroll-snap-type: x proximity;
    }

    .sidebar a {
        flex: 0 0 auto;
        min-width: max-content;
        margin-bottom: 0;
        border-left: none;
        border-bottom: 3px solid transparent;
        white-space: nowrap;
        scroll-snap-align: start;
    }

    .sidebar a:hover {
        border-left-color: transparent;
        border-bottom-color: #a8c8f0;
    }

    .sidebar a.active {
        border-left-color: transparent;
        border-bottom-color: #1f5d9b;
    }

    .sidebar-divider {
        width: 1px;
        min-width: 1px;
        height: auto;
        margin: 4px 2px;
    }

    .hero {
        padding: 20px;
    }

    .container {
        padding: 22px;
    }
}

.btn-close:hover {
    background: #cfd8e6;
}

.notification-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 200;
}

.notification-box {
    pointer-events: auto;
    min-width: 280px;
    max-width: 420px;
    padding: 18px 22px;
    border-radius: 22px;
    box-shadow: 0 24px 50px rgba(23, 47, 88, 0.18);
    background: linear-gradient(135deg, #1f5d9b 0%, #e02424 100%);
    color: #fff;
    text-align: center;
    font-weight: 700;
    letter-spacing: 0.01em;
    animation: popIn 0.24s ease-out;
}

.notification-box.success {
    background: linear-gradient(135deg, #1f5d9b 0%, #f1c40f 100%);
    color: #10213a;
}

.notification-box.error {
    background: linear-gradient(135deg, #d64541 0%, #7a1f28 100%);
}

.notification-box p {
    margin: 0;
    font-size: 0.98rem;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 16px;
    overflow: hidden;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(31, 93, 155, 0.08);
}

thead {
    background: linear-gradient(135deg, #1f5d9b 0%, #2c82d1 100%);
    color: #fff;
}

th, td {
    padding: 9px 14px;
    text-align: center;
}

tbody tr {
    background: #fff;
}

tbody tr:nth-child(even) {
    background: #f7fafe;
}

tbody tr:hover {
    background: #edf5fb;
}

/* ── MÓDULO DE INFORMES ── */
.informe-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.informe-header h2 {
    margin-bottom: 6px;
}

.btn-excel {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #1a7a3c 0%, #145e2d 100%);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    flex-shrink: 0;
}

.btn-excel:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(26, 122, 60, 0.3);
}

.btn-excel:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.preview-section {
    margin-top: 4px;
}

.preview-loading {
    color: #5f748f;
    font-size: 0.97rem;
    padding: 14px 0;
}

.preview-empty {
    color: #7a8fa8;
    font-size: 0.97rem;
    padding: 14px 0;
    font-style: italic;
}

.date-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1f5d9b;
}

.date-label input[type="date"] {
    min-width: 0;
    width: 100%;
}

.informes-page .informe-general-panel {
    padding: 14px 16px;
}

.informes-page .informe-general-filters {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    align-items: end;
}

.informes-page .informe-date-label {
    gap: 4px;
    font-size: 0.8rem;
    line-height: 1.15;
}

.informes-page .informe-date-label input[type="date"] {
    min-width: 0;
    width: 100%;
    flex: initial;
    padding: 8px 10px;
    min-height: 38px;
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.2;
}

.informes-page .informe-general-btn {
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 10px;
}

.badge-estado {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.badge-estado.dentro {
    background: #e8f5ee;
    color: #1a7a3c;
    border: 1px solid #b2ddc6;
}

.badge-estado.fuera {
    background: #f0f4fa;
    color: #3a5070;
    border: 1px solid #c4d3e8;
}

.badge-usuario {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    background: #eaf3fb;
    color: #1f5d9b;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid #c5dcf5;
}

@media (max-width: 768px) {
    .informe-header {
        flex-direction: column;
    }

    .btn-excel {
        width: 100%;
        justify-content: center;
    }
}

th:first-child,
td:first-child {
    text-align: left;
}

.btn-salida {
    background: #e74c3c;
    min-width: 120px;
}

.btn-salida:hover {
    background: #c0392b;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
}

.estado-dentro {
    color: #117a12;
    background: rgba(17, 122, 18, 0.1);
}

.estado-fuera {
    color: #b03a2e;
    background: rgba(176, 58, 46, 0.12);
}

@media (max-width: 720px) {
    body {
        padding: 12px;
    }

    .page-shell {
        width: 100%;
    }

    .hero {
        flex-direction: column;
        text-align: center;
        gap: 14px;
        padding: 18px;
        border-radius: 20px;
    }

    .hero-text {
        width: 100%;
    }

    .hero img {
        width: 88px;
    }

    .hero-text h1 {
        font-size: 1.55rem;
    }

    .hero-text p {
        font-size: 0.94rem;
        line-height: 1.5;
    }

    form {
        flex-direction: column;
    }

    .container {
        padding: 18px 14px;
        border-radius: 18px;
        border-left-width: 5px;
    }

    h2 {
        font-size: 1.35rem;
        margin-bottom: 16px;
    }

    input,
    select,
    button,
    a.button {
        width: 100%;
        min-width: 0;
    }

    .summary-grid,
    .filters-grid,
    .grid-buttons {
        grid-template-columns: 1fr;
    }

    .summary-card {
        padding: 12px;
    }

    .summary-value {
        font-size: 1.2rem;
    }

    .modal-overlay,
    .notify-overlay {
        padding: 12px;
        align-items: flex-end;
    }

    .modal,
    .notify-box {
        width: 100%;
        max-width: none;
        border-radius: 18px 18px 0 0;
    }

    .modal {
        padding: 20px 16px;
        max-height: 88vh;
    }

    .notify-box {
        padding: 24px 18px;
    }

    .modal-actions,
    .form-actions,
    .action-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .action-buttons .btn-icon,
    .action-buttons .btn,
    .form-actions .btn,
    .form-actions button,
    .modal-actions button {
        width: 100%;
        justify-content: center;
    }

    table {
        min-width: 640px;
    }

    th,
    td {
        padding: 10px 12px;
        font-size: 0.88rem;
    }

    .btn-salida {
        min-width: 0;
    }

    .login-body {
        position: relative;
        min-height: 100vh;
        height: auto;
        overflow: auto;
        padding: 16px;
    }

    .login-shell {
        width: 100%;
        max-width: 420px;
    }

    .login-card {
        padding: 22px 18px;
        border-radius: 20px;
    }

    .login-card h1 {
        font-size: 1.5rem;
    }

    .login-help {
        font-size: 0.86rem;
    }

    .busqueda-resultado {
        padding: 12px 14px;
        font-size: 0.92rem;
    }

    .sidebar nav::-webkit-scrollbar,
    .table-wrap::-webkit-scrollbar {
        height: 8px;
    }

    .sidebar nav::-webkit-scrollbar-thumb,
    .table-wrap::-webkit-scrollbar-thumb {
        background: rgba(31, 93, 155, 0.28);
        border-radius: 999px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .sidebar-header {
        padding: 14px 16px;
    }

    .sidebar nav {
        padding: 8px;
    }

    .sidebar a {
        padding: 10px 12px;
        font-size: 0.88rem;
    }

    .nav-bullet {
        width: 24px;
        height: 24px;
        font-size: 0.68rem;
    }

    .container {
        padding: 16px 12px;
    }

    .hero-text h1 {
        font-size: 1.35rem;
    }

    .summary-label {
        font-size: 0.8rem;
    }

    .summary-value {
        font-size: 1.08rem;
    }

    .notify-box h3,
    .modal h3 {
        font-size: 1.05rem;
    }
}

/* ── REGISTRO PAGE — nuevos componentes ── */
.btn-refrescar {
    padding: 8px 16px;
    border-radius: 12px;
    background: #eaf3fb;
    color: #1f5d9b;
    border: 1px solid #c5dcf5;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}
.btn-refrescar:hover {
    background: #1f5d9b;
    color: #fff;
}

.busqueda-resultado {
    margin-top: 14px;
    padding: 14px 18px;
    border-radius: 14px;
    font-size: 0.97rem;
    font-weight: 600;
    border-left: 5px solid #1f5d9b;
    background: #f0f7ff;
    color: #163f73;
}
.busqueda-dentro {
    background: #e8f5ee;
    border-left-color: #1a7a3c;
    color: #145e2d;
}
.busqueda-fuera {
    background: #f4f6fa;
    border-left-color: #5f748f;
    color: #374a5e;
}
.busqueda-noregistro {
    background: #f8f9fc;
    border-left-color: #aab4c2;
    color: #5f748f;
}
.busqueda-warning {
    background: #fff8ec;
    border-left-color: #f39c12;
    color: #7d5100;
}

/* ── MÓDULO DE ESTADÍSTICAS ── */
.stats-toolbar {
    margin-bottom: 18px;
}

.stats-filters-grid {
    align-items: center;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) minmax(160px, 200px);
}

.stats-inline-field {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.stats-inline-field span {
    color: #1f5d9b;
    font-weight: 700;
}

.stats-inline-field input {
    min-width: 0;
    padding: 10px 14px;
}

.stats-cta-btn {
    min-height: 46px;
}

.stats-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.stats-quick-btn {
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid #c7dbf4;
    background: #eef6ff;
    color: #1f5d9b;
    font-size: 0.9rem;
    font-weight: 700;
}

.stats-quick-btn:hover {
    box-shadow: 0 8px 20px rgba(31, 93, 155, 0.16);
}

.stats-quick-btn.active {
    background: linear-gradient(135deg, #1f5d9b 0%, #163f73 100%);
    color: #fff;
    border-color: #1f5d9b;
}

.stats-insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

.stats-delta {
    margin-top: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.45;
    color: #6b7e93;
}

.stats-delta.is-up {
    color: #1a7a3c;
}

.stats-delta.is-down {
    color: #b03a2e;
}

.stats-delta.is-flat {
    color: #5f748f;
}

.stats-insight-card {
    background: linear-gradient(135deg, #fffef7 0%, #fff7dd 100%);
    border: 1px solid #f4df9c;
    border-radius: 18px;
    padding: 16px 18px;
    box-shadow: 0 12px 26px rgba(204, 158, 28, 0.08);
}

.stats-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    align-items: start;
}

.stats-layout > .chart-card {
    margin: 0;
    width: 100%;
    min-width: 0;
}

.chart-card {
    border-left-color: #1f5d9b;
    overflow: hidden;
}

.chart-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.chart-head h2 {
    margin-bottom: 4px;
}

.chart-stage {
    min-height: 280px;
    min-width: 0;
    overflow: hidden;
}

.chart-stage-wide {
    min-height: 320px;
}

.chart-empty {
    min-height: 220px;
    display: grid;
    place-items: center;
    text-align: center;
    color: #72879f;
    font-style: italic;
    border: 1px dashed #c9d9ea;
    border-radius: 18px;
    background: #f9fbfe;
    padding: 24px;
}

.chart-bars {
    min-height: 250px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 0 6px;
    overflow-x: auto;
}

.chart-bar-item {
    flex: 0 0 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.chart-bar-value {
    font-size: 0.78rem;
    font-weight: 700;
    color: #37506b;
}

.chart-bar-track {
    width: 100%;
    height: 190px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: linear-gradient(180deg, #f6faff 0%, #eef5fc 100%);
    border: 1px solid #dce8f5;
    border-radius: 14px;
    padding: 6px;
}

.chart-bar-fill {
    width: 100%;
    border-radius: 10px;
    background: linear-gradient(180deg, #4ea0ff 0%, #1f5d9b 100%);
}

.chart-bar-primary {
    background: linear-gradient(180deg, #63b2ff 0%, #1f5d9b 100%);
}

.chart-bar-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #60748b;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    min-height: 52px;
    text-align: center;
}

.hbar-list {
    display: grid;
    gap: 14px;
    padding-top: 8px;
    min-height: 250px;
}

.hbar-row {
    display: grid;
    gap: 8px;
}

.hbar-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.94rem;
    color: #28425e;
}

.hbar-head strong {
    color: #163f73;
}

.hbar-track {
    width: 100%;
    height: 16px;
    border-radius: 999px;
    background: #edf3fa;
    overflow: hidden;
    border: 1px solid #d7e4f2;
}

.hbar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #f1c40f 0%, #d68910 100%);
}

.line-chart-wrap {
    width: 100%;
    min-height: 280px;
}

.line-chart-svg {
    width: 100%;
    height: 280px;
    overflow: visible;
}

.line-axis {
    stroke: #bfd0e2;
    stroke-width: 1.2;
}

.line-area {
    fill: rgba(31, 93, 155, 0.12);
}

.line-path {
    fill: none;
    stroke: #1f5d9b;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.line-chart-svg circle {
    fill: #1f5d9b;
    stroke: #ffffff;
    stroke-width: 2;
}

.line-chart-svg text {
    font-size: 10px;
    fill: #526c87;
    font-weight: 600;
}

.stats-analysis-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.stats-select {
    max-width: 280px;
    min-width: 220px;
}

@media (max-width: 980px) {
    .stats-layout {
        grid-template-columns: 1fr;
    }

    .stats-filters-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .stats-inline-field {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .stats-quick-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chart-bar-item {
        flex-basis: 30px;
    }

    .stats-select {
        max-width: 100%;
        width: 100%;
    }
}

/* ═══════════════════════════════════════ */
/* USUARIOS MODULE STYLES                   */
/* ═══════════════════════════════════════ */

/* Tab Buttons */
.users-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid #e0e8f0;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px 14px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: #6b7d94;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: #1f5d9b;
}

.tab-btn.active {
    color: #1f5d9b;
    border-bottom-color: #1f5d9b;
}

.tab-btn svg {
    width: 18px;
    height: 18px;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Cards & Sections */
.section-card {
    background: #fff;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 4px 16px rgba(31, 93, 155, 0.08);
    border: 1px solid #e0e8f0;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e8f0;
}

.card-header h3 {
    font-size: 1.25rem;
    color: #172337;
    margin: 0;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    border-radius: 12px;
}

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

.users-table thead {
    background: #f8fafc;
    border-bottom: 2px solid #e0e8f0;
}

.users-table th {
    padding: 9px 12px;
    text-align: left;
    font-weight: 700;
    color: #374a5e;
}

.users-table td {
    padding: 9px 12px;
    border-bottom: 1px solid #f0f4f8;
    color: #515d6a;
}

.users-table tbody tr {
    transition: background 0.15s ease;
}

.users-table tbody tr:hover {
    background: #f8fafc;
}

.users-table tbody tr.inactive {
    opacity: 0.7;
}

.clientes-table td,
.clientes-table th {
    vertical-align: middle;
}

.clientes-table td {
    line-height: 1.25;
}

.loading-row,
.error-row,
.no-data {
    text-align: center;
    color: #8c99a8;
    font-style: italic;
    padding: 32px !important;
}

.error-row {
    color: #e02424;
}

/* Role Badge */
.role-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: capitalize;
}

.role-badge.role-administrador {
    background: #fee2e2;
    color: #b03a2e;
}

.role-badge.role-operador {
    background: #dbeafe;
    color: #1e40af;
}

.role-badge.role-contador {
    background: #dcfce7;
    color: #166534;
}

.role-badge.role-sin_rol {
    background: #f3f4f6;
    color: #6b7280;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-badge.active {
    background: #dcfce7;
    color: #166534;
}

.status-badge.inactive {
    background: #fee2e2;
    color: #b03a2e;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: #f0f4f8;
    color: #1f5d9b;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.btn-icon:hover {
    background: #e0e8f0;
    transform: scale(1.05);
}

.btn-icon svg {
    width: 16px;
    height: 16px;
}

/* Role Cards Grid */
.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.role-card {
    background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
    border: 2px solid #e0e8f0;
    border-radius: 16px;
    padding: 20px;
    transition: all 0.2s ease;
}

.role-card:hover {
    border-color: #1f5d9b;
    box-shadow: 0 8px 24px rgba(31, 93, 155, 0.1);
    transform: translateY(-2px);
}

.role-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e0e8f0;
}

.role-header h4 {
    font-size: 1.1rem;
    color: #172337;
    margin: 0 0 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.role-desc {
    font-size: 0.9rem;
    color: #6b7d94;
    margin: 0;
}

.role-permissions h5 {
    font-size: 0.9rem;
    color: #374a5e;
    margin: 0 0 10px 0;
    font-weight: 600;
}

.role-permissions ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.role-permissions li {
    font-size: 0.9rem;
    color: #515d6a;
    margin-bottom: 8px;
    padding-left: 18px;
    position: relative;
}

.role-permissions li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #27ae60;
    font-weight: bold;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 600px) {
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Form Group */
.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #243447;
    margin-bottom: 8px;
}

.form-group input,
.form-group select {
    padding: 10px 12px;
    border: 1px solid #d0d8e0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #1f5d9b;
    box-shadow: 0 0 0 3px rgba(31, 93, 155, 0.1);
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 8px;
}

.form-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(23, 35, 55, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none;
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    position: relative;
    max-width: 500px;
    width: 100%;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(31, 93, 155, 0.2);
    z-index: 1001;
    overflow-y: auto;
    max-height: 90vh;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-content {
    padding: 24px;
}

.clientes-page .modal-cliente {
    max-width: 720px;
    max-height: min(88vh, 760px);
}

.clientes-page .cliente-form {
    gap: 12px;
}

.clientes-page .cliente-form .form-group {
    min-width: 0;
}

.clientes-page .cliente-form .form-group label {
    margin-bottom: 5px;
    font-size: 0.82rem;
    line-height: 1.2;
}

.clientes-page .cliente-form .form-group input,
.clientes-page .cliente-form .form-group select {
    width: 100%;
    min-width: 0;
    flex: initial;
    margin-bottom: 0;
    padding: 9px 12px;
    min-height: 40px;
    border-radius: 10px;
    background: #fff;
    font-size: 0.92rem;
    line-height: 1.25;
}

.clientes-page .cliente-form .form-actions {
    margin-top: 4px;
}

.clientes-page .cliente-form .form-actions .btn {
    min-height: 40px;
    padding: 9px 16px;
}

#quickClienteModal .modal-body {
    max-width: 640px;
}

.quick-cliente-modal {
    max-width: 560px;
    padding: 18px 18px 16px;
}

.quick-cliente-title {
    margin: 0 0 12px;
    font-size: 1.08rem;
    line-height: 1.2;
    color: #172337;
}

.quick-cliente-form {
    gap: 10px;
}

.quick-cliente-form .form-group {
    min-width: 0;
}

.quick-cliente-form .form-group label {
    margin-bottom: 4px;
    font-size: 0.8rem;
    line-height: 1.15;
}

.quick-cliente-form input,
.quick-cliente-form select,
.quick-cliente-form .form-group input,
.quick-cliente-form .form-group select,
#quickClienteModal.modal-overlay .modal input,
#quickClienteModal.modal-overlay .modal select {
    width: 100%;
    min-width: 0;
    flex: initial;
    margin-bottom: 0;
    padding: 8px 10px;
    min-height: 38px;
    border-radius: 10px;
    font-size: 0.92rem;
    line-height: 1.2;
}

.quick-cliente-form .form-actions {
    margin-top: 2px;
    gap: 8px;
}

.quick-cliente-form .form-actions .btn {
    min-height: 38px;
    padding: 8px 14px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 1.25rem;
    color: #172337;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: #8c99a8;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: #1f2d3d;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #1f5d9b 0%, #163f73 100%);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(31, 93, 155, 0.3);
}

.btn-secondary {
    background: #e0e8f0;
    color: #1f2d3d;
}

.btn-secondary:hover {
    background: #d0d8e0;
}

.btn-danger {
    background: #e02424;
    color: #fff;
}

.btn-danger:hover {
    background: #c01717;
}

/* Notification Modal */
.notify-modal {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 16px 20px;
    background: #fff;
    border-radius: 12px;
    border-left: 4px solid #1f5d9b;
    box-shadow: 0 8px 24px rgba(31, 93, 155, 0.15);
    z-index: 2000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    max-width: 300px;
    pointer-events: none;
}

.notify-modal.hidden {
    display: none;
}

.notify-modal:not(.hidden) {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.notify-content {
    font-size: 0.95rem;
    color: #243447;
}

.notify-modal.notify-success {
    border-left-color: #27ae60;
}

.notify-modal.notify-error {
    border-left-color: #e02424;
}

.notify-modal.notify-warning {
    border-left-color: #f39c12;
}

/* Responsive */
@media (max-width: 768px) {
    .users-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        white-space: nowrap;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .roles-grid {
        grid-template-columns: 1fr;
    }

    .users-table {
        font-size: 0.85rem;
    }

    .users-table th,
    .users-table td {
        padding: 10px 12px;
    }

    .action-buttons {
        gap: 6px;
    }

    .btn-icon {
        width: 32px;
        height: 32px;
    }

    .clientes-page .modal-overlay {
        padding: 12px;
        align-items: flex-end;
    }

    .clientes-page .modal-cliente {
        max-width: none;
        width: 100%;
        max-height: 92vh;
        border-radius: 18px 18px 0 0;
    }

    .clientes-page .modal-content {
        padding: 18px 16px 16px;
    }

    .clientes-page .cliente-form {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .clientes-page .cliente-form .form-group label {
        font-size: 0.79rem;
    }

    .clientes-page .cliente-form .form-group input,
    .clientes-page .cliente-form .form-group select {
        padding: 8px 10px;
        min-height: 38px;
        font-size: 0.9rem;
    }

    .clientes-page .cliente-form .form-actions {
        justify-content: stretch;
        flex-direction: column-reverse;
        gap: 8px;
    }

    .clientes-page .cliente-form .form-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .quick-cliente-modal {
        max-width: none;
        width: 100%;
        max-height: 92vh;
        border-radius: 18px 18px 0 0;
        padding: 16px 14px 14px;
    }

    .quick-cliente-title {
        margin-bottom: 10px;
        font-size: 1rem;
    }

    .quick-cliente-form {
        grid-template-columns: 1fr;
        gap: 9px;
    }

    .quick-cliente-form .form-group label {
        font-size: 0.78rem;
    }

    .quick-cliente-form input,
    .quick-cliente-form select,
    .quick-cliente-form .form-group input,
    .quick-cliente-form .form-group select,
    #quickClienteModal.modal-overlay .modal input,
    #quickClienteModal.modal-overlay .modal select {
        padding: 7px 10px;
        min-height: 36px;
        font-size: 0.89rem;
    }

    .quick-cliente-form .form-actions {
        flex-direction: column-reverse;
    }

    .quick-cliente-form .form-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .clientes-table thead {
        display: none;
    }

    .informes-page .informe-general-panel {
        padding: 12px;
    }

    .informes-page .informe-general-filters {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .informes-page .informe-date-label {
        font-size: 0.78rem;
    }

    .informes-page .informe-date-label input[type="date"] {
        padding: 7px 10px;
        min-height: 36px;
        font-size: 0.88rem;
    }

    .informes-page .informe-general-btn {
        width: 100%;
        min-height: 36px;
        justify-content: center;
    }

    .clientes-table,
    .clientes-table tbody,
    .clientes-table tr,
    .clientes-table td {
        display: block;
        width: 100%;
    }

    .clientes-table tbody {
        display: grid;
        gap: 12px;
    }

    .clientes-table tr {
        border: 1px solid #e5edf4;
        border-radius: 14px;
        background: #fff;
        padding: 10px 12px;
        box-shadow: 0 8px 24px rgba(17, 44, 74, 0.06);
    }

    .clientes-table td {
        border-bottom: 1px solid #eef3f7;
        padding: 8px 0;
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        text-align: right;
    }

    .clientes-table td:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    .clientes-table td::before {
        content: attr(data-label);
        flex: 0 0 92px;
        color: #5d6b79;
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        text-align: left;
    }

    .clientes-table .action-buttons {
        justify-content: flex-end;
        flex-wrap: wrap;
    }
}

/* Live Audit Console */
.audit-live-body {
    background:
        radial-gradient(circle at 18% 12%, rgba(43, 95, 255, 0.17), transparent 45%),
        radial-gradient(circle at 82% 88%, rgba(0, 214, 143, 0.15), transparent 40%),
        #0a0d13;
    color: #d7deea;
}

.audit-hero {
    background: linear-gradient(120deg, #0f1724 0%, #151f33 62%, #1b0f29 100%);
    border: 1px solid rgba(125, 149, 190, 0.35);
    box-shadow: 0 18px 44px rgba(2, 8, 20, 0.58);
}

.audit-console-wrap {
    background: linear-gradient(180deg, rgba(13, 18, 29, 0.95), rgba(8, 11, 19, 0.97));
    border: 1px solid rgba(113, 138, 176, 0.35);
    border-radius: 20px;
    box-shadow: 0 20px 42px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.audit-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(96, 119, 155, 0.28);
    background: #0f1523;
}

.audit-title {
    font-family: Consolas, "Courier New", monospace;
    letter-spacing: 0.11em;
    font-size: 0.84rem;
    color: #6ec8ff;
}

.audit-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.audit-badge,
.audit-chip {
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    padding: 6px 10px;
    border: 1px solid rgba(90, 113, 147, 0.45);
    color: #c8d6eb;
    background: rgba(23, 31, 48, 0.75);
}

.audit-badge.ok {
    color: #7fffc3;
    border-color: rgba(81, 183, 133, 0.6);
}

.audit-badge.warn,
.audit-chip.danger {
    color: #ffd17a;
    border-color: rgba(201, 151, 53, 0.62);
}

.audit-badge.danger {
    color: #ff98a7;
    border-color: rgba(208, 86, 86, 0.62);
}

.audit-reauth {
    padding: 24px;
}

.audit-filter-bar {
    display: grid;
    grid-template-columns: repeat(5, minmax(140px, 1fr)) auto auto;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(87, 110, 145, 0.28);
    background: #10192a;
}

.audit-filter-bar input,
.audit-filter-bar select {
    background: #0f1726;
    color: #dcf0ff;
    border: 1px solid rgba(111, 138, 177, 0.45);
    border-radius: 10px;
    padding: 10px 10px;
    min-width: 120px;
}

.audit-filter-bar input::placeholder {
    color: #86a0c2;
}

.audit-reauth h3 {
    color: #cfe4ff;
    margin-bottom: 8px;
}

.audit-reauth p {
    color: #9db2cc;
    margin-bottom: 14px;
}

.audit-reauth-form {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.audit-reauth-form input {
    flex: 1 1 280px;
    min-width: 230px;
    background: #0f1726;
    color: #dcf0ff;
    border: 1px solid rgba(111, 138, 177, 0.45);
}

.audit-reauth-form button {
    background: linear-gradient(135deg, #1556b2, #20a7d8);
}

.audit-msg {
    margin-top: 10px;
    color: #ffb5b5;
}

.audit-console {
    border-top: 1px solid rgba(87, 110, 145, 0.28);
}

.audit-console-header {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.86rem;
    letter-spacing: 0.08em;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #9ec4ff;
    background: #0d1422;
}

.audit-mini-btn {
    border: 1px solid rgba(112, 140, 182, 0.45);
    background: #152136;
    color: #c5dcff;
    padding: 7px 10px;
    border-radius: 9px;
    font-size: 0.78rem;
}

.audit-feed {
    height: 68vh;
    overflow: auto;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.82rem;
    background:
        linear-gradient(rgba(154, 192, 255, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(154, 192, 255, 0.05) 1px, transparent 1px),
        #0b111b;
    background-size: 100% 28px, 28px 100%, auto;
    padding: 8px;
}

.audit-line {
    display: grid;
    grid-template-columns: 170px 150px 210px 1fr;
    gap: 12px;
    align-items: start;
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 6px;
    color: #cfdeef;
    background: rgba(14, 21, 34, 0.72);
    border: 1px solid rgba(67, 90, 120, 0.35);
}

.audit-line .col-time {
    color: #8bb8ff;
}

.audit-line .col-event {
    color: #93f1ff;
    font-weight: 700;
}

.audit-line .col-actor {
    color: #b6ccff;
}

.audit-line .col-msg {
    color: #d8e8ff;
}

.audit-line.level-media,
.audit-line.level-alta,
.audit-line.is-anomaly {
    border-color: rgba(219, 89, 89, 0.56);
    background: rgba(51, 15, 20, 0.5);
}

.audit-line.level-media .col-event,
.audit-line.level-alta .col-event,
.audit-line.is-anomaly .col-event {
    color: #ff8c9c;
}

.hidden {
    display: none !important;
}

@media (max-width: 1100px) {
    .audit-filter-bar {
        grid-template-columns: 1fr 1fr;
    }

    .audit-line {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .audit-feed {
        height: 62vh;
    }
}

/* Mobile hard overrides for shared app layout */
@media screen and (max-width: 768px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    body {
        padding: 10px !important;
    }

    .page-shell {
        width: 100% !important;
        max-width: 100% !important;
    }

    .layout-body {
        display: flex !important;
        flex-direction: column !important;
        gap: 14px !important;
        align-items: stretch !important;
    }

    .sidebar {
        position: static !important;
        top: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
        overflow: hidden !important;
    }

    .sidebar nav {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        padding: 10px !important;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar a {
        flex: 0 0 auto !important;
        min-width: max-content !important;
        white-space: nowrap !important;
        border-left: none !important;
        border-bottom: 3px solid transparent !important;
        margin-bottom: 0 !important;
    }

    .sidebar a.active {
        border-bottom-color: #1f5d9b !important;
    }

    .sidebar-divider {
        width: 1px !important;
        min-width: 1px !important;
        height: auto !important;
        margin: 4px 2px !important;
    }

    .main-content {
        width: 100% !important;
        min-width: 0 !important;
    }

    .hero {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 14px !important;
        padding: 18px !important;
        margin-bottom: 16px !important;
    }

    .hero img {
        width: 86px !important;
    }

    .hero-text,
    .hero-text p {
        width: 100% !important;
        max-width: 100% !important;
    }

    .hero-text h1 {
        font-size: 1.35rem !important;
        line-height: 1.1 !important;
    }

    .hero-text p {
        font-size: 0.95rem !important;
        line-height: 1.45 !important;
    }

    .container {
        width: 100% !important;
        margin: 0 !important;
        padding: 16px 12px !important;
        border-radius: 18px !important;
        border-left-width: 5px !important;
    }

    form {
        display: flex !important;
        flex-direction: column !important;
    }

    input,
    select,
    button,
    .btn,
    .btn-refrescar,
    .btn-excel,
    a.button {
        width: 100% !important;
        min-width: 0 !important;
    }

    input,
    select {
        flex: 0 0 auto !important;
        min-height: 46px !important;
        padding: 12px 14px !important;
    }

    button,
    .btn,
    .btn-refrescar,
    .btn-excel,
    a.button {
        flex: 0 0 auto !important;
        min-height: 46px !important;
        padding: 12px 16px !important;
    }

    .summary-grid,
    .filters-grid,
    .grid-buttons,
    .roles-grid {
        grid-template-columns: 1fr !important;
    }

    .table-wrap {
        width: 100% !important;
        overflow-x: auto !important;
    }

    table {
        min-width: 620px !important;
    }

    .modal-overlay,
    .notify-overlay {
        align-items: flex-end !important;
        padding: 10px !important;
    }

    .modal,
    .notify-box,
    .quick-cliente-modal {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 18px 18px 0 0 !important;
    }

    .notify-overlay.toast-mode {
        align-items: flex-start !important;
        justify-content: flex-end !important;
        padding: 12px !important;
    }

    .notify-overlay.toast-mode .notify-box {
        width: min(360px, calc(100vw - 24px)) !important;
        max-width: 360px !important;
        border-radius: 18px !important;
    }

    .login-body {
        position: relative !important;
        width: 100% !important;
        min-height: 100vh !important;
        height: auto !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    .login-shell {
        width: 100% !important;
        max-width: 420px !important;
    }

.login-card {
        padding: 22px 16px !important;
    }
}

.integration-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.integration-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, #173f7a, #2d6bb5);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.integration-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    align-items: end;
}

.integration-result {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid #d5dfeb;
    background: #f7fbff;
    color: #20344e;
    line-height: 1.5;
}

.integration-result.success {
    background: #edf9f0;
    border-color: #9cd5a7;
    color: #14532d;
}

.integration-result.warning {
    background: #fff9eb;
    border-color: #f0c96d;
    color: #8a5b00;
}

.integration-result.error {
    background: #fff1f1;
    border-color: #ea9b9b;
    color: #8f1d1d;
}

.receipt-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px solid #dce8f5;
    border-radius: 16px;
    background: #f8fbff;
    flex-wrap: wrap;
}

.receipt-toolbar-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: #173f7a;
    margin-bottom: 4px;
}

.receipt-body {
    background: #eef4fa;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, sans-serif;
}

.receipt-shell {
    max-width: 480px;
    margin: 0 auto;
}

.receipt-card {
    background: #fff;
    border-radius: 24px;
    padding: 12px 10px;
    box-shadow: 0 18px 40px rgba(32, 64, 120, 0.12);
    border: 1px solid #dbe6f2;
    font-weight: 700;
    line-height: 1.12;
}

.receipt-header {
    text-align: center;
    margin-bottom: 2px;
}

.receipt-kicker {
    color: #1f5d9b;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 2px 0;
}

.receipt-header h1 {
    font-size: 1.35rem;
    margin: 0 0 2px 0;
}

.receipt-subtitle {
    color: #5d718a;
    font-size: 0.86rem;
}

.receipt-status {
    padding: 14px;
    border-radius: 14px;
    background: #f4f8fc;
    border: 1px solid #d7e3ef;
    color: #38506d;
    text-align: center;
}

.receipt-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 4px;
}

.receipt-summary > div {
    background: #f8fbff;
    border: 1px solid #dbe8f5;
    border-radius: 16px;
    padding: 5px;
}

.receipt-label {
    color: #5f748f;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 1px 0;
    font-weight: 700;
    line-height: 1.05;
}

.receipt-value {
    color: #172337;
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.05;
    margin: 0;
}

.receipt-grid {
    display: grid;
    gap: 0;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 1px 0;
    border-bottom: 1px dashed #d8e1eb;
}

.receipt-row span {
    color: #536982;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.05;
    margin: 0;
}

.receipt-row strong {
    color: #172337;
    font-size: 0.9rem;
    text-align: right;
    font-weight: 700;
    line-height: 1.05;
    margin: 0;
}

.receipt-row.total strong {
    color: #0d6a35;
    font-size: 1.06rem;
}

.receipt-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #d7e1ec 20%, #d7e1ec 80%, transparent);
    margin: 4px 0;
}

.receipt-footer {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px dashed #d8e1eb;
    color: #5e738d;
    font-size: 0.8rem;
    text-align: center;
    line-height: 1.2;
    font-weight: 700;
}

.receipt-footer p {
    margin: 0 0 2px 0;
}

.receipt-footer p:last-child {
    margin-bottom: 0;
}

.receipt-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.receipt-actions button {
    flex: 1 1 180px;
}

@media print {
    @page {
        size: 58mm auto;
        margin: 2mm;
    }

    body.receipt-body {
        background: #fff;
        padding: 0;
        width: 58mm;
        font-size: 10px;
        color: #000;
    }

    .receipt-shell {
        max-width: 58mm;
        margin: 0;
    }

    .receipt-card {
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding: 0;
        color: #000;
    }

    .receipt-card * {
        color: #000 !important;
        background: transparent !important;
        text-shadow: none !important;
        box-shadow: none !important;
    }

    .no-print {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .integration-form {
        grid-template-columns: 1fr !important;
    }

    .integration-header {
        flex-direction: column;
        align-items: stretch;
    }

    .receipt-summary {
        grid-template-columns: 1fr;
    }

    .receipt-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
}
