.alerta {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 14px 18px;
    margin-bottom: 25px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--white);
    font-size: 13px;
}
.alerta.success {
    color: #166534;
    background: #f0fdf4;
    border-color: #bbf7d0;
}
.alerta.error {
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
}
.alerta button {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: currentColor;
    font-size: 20px;
    cursor: pointer;
    border-radius: 6px;
}
.alerta button:hover {
    background: rgba(0, 0, 0, 0.05);
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}
.stat-card {
    min-height: 105px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    transition: 0.2s ease;
}
.stat-card:hover {
    border-color: #dfe1e6;
    transform: translateY(-1px);
}
.stat-icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #f4f5f7;
    color: #17181c;
}
.stat-card > div:last-child {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.stat-card span {
    color: var(--text-light);
    font-size: 12px;
}
.stat-card strong {
    color: var(--text);
    font-size: 19px;
    line-height: 1;
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}
.section-header h2 {
    margin-bottom: 5px;
    color: var(--text);
    font-size: 21px;
    font-weight: 700;
}
.section-header p {
    color: var(--text-light);
    font-size: 12px;
}
.btn-primary {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 17px;
    border: 1px solid #111111;
    border-radius: 9px;
    background: #111111;
    color: #ffffff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: 0.2s ease;
}
.btn-primary:hover {
    background: #2a2a2a;
    border-color: #2a2a2a;
}
.btn-primary span {
    font-size: 18px;
    line-height: 1;
}
.filters {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    margin-bottom: 18px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.search-box {
    min-width: 280px;
    height: 40px;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text-muted);
    transition: 0.2s ease;
}
.search-box:focus-within {
    border-color: #c8cbd1;
    box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.04);
}
.search-box svg {
    flex-shrink: 0;
}
.search-box input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
}
.search-box input::placeholder {
    color: #a0a3aa;
}
.filters select {
    height: 40px;
    min-width: 155px;
    padding: 0 32px 0 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    outline: none;
    cursor: pointer;
}
.filters select:focus {
    border-color: #c8cbd1;
    box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.04);
}
.btn-filter {
    height: 40px;
    padding: 0 16px;
    border: 1px solid #111111;
    border-radius: 8px;
    background: #111111;
    color: #ffffff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s ease;
}
.btn-filter:hover {
    background: #2a2a2a;
}
.btn-clear {
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text-light);
    font-size: 11px;
    text-decoration: none;
    transition: 0.2s ease;
}
.btn-clear:hover {
    background: #f6f7f9;
    color: var(--text);
}
.table-card {
    width: 100%;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}
.table-wrapper {
    width: 100%;
    overflow-x: auto;
}
.table-wrapper table {
    width: 100%;
    min-width: 1050px;
    border-collapse: collapse;
}
.table-wrapper thead {
    background: #fafafa;
}
.table-wrapper th {
    height: 48px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    color: #888c95;
    font-size: 10px;
    font-weight: 700;
    text-align: left;
    letter-spacing: 0.7px;
    white-space: nowrap;
}
.table-wrapper td {
    height: 68px;
    padding: 10px 16px;
    border-bottom: 1px solid #f0f1f3;
    color: var(--text);
    font-size: 12px;
    vertical-align: middle;
}
.table-wrapper tbody tr:last-child td {
    border-bottom: none;
}
.table-wrapper tbody tr {
    transition: 0.15s ease;
}
.table-wrapper tbody tr:hover {
    background: #fafbfc;
}
.person-cell {
    display: flex;
    align-items: center;
    gap: 11px;
}
.person-avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f0f1f3;
    color: #17181c;
    font-size: 12px;
    font-weight: 700;
}
.person-cell > div:last-child {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.person-cell strong {
    max-width: 210px;
    overflow: hidden;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.person-cell small {
    color: var(--text-muted);
    font-size: 13px;
}
.tipo-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 6px;
    font-size: 8px;
    font-weight: 600;
    white-space: nowrap;
}
.tipo-badge.residente {
    background: #f1f5f9;
    color: #475569;
}
.tipo-badge.visitante {
    background: #f5f3ff;
    color: #6d5aa8;
}
.tipo-badge.personal {
    background: #f0fdf4;
    color: #3f7650;
}
.estado {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 9px;
    font-weight: 600;
}
.estado::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.estado.activo {
    color: #3f7650;
}
.estado.activo::before {
    background: #4ade80;
}
.estado.inactivo {
    color: #888c95;
}
.estado.inactivo::before {
    background: #c4c7cc;
}
.qr-code-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}
.qr-code-cell > span {
    color: var(--text-light);
    font-family: "Courier New", monospace;
    font-size: 12px;
    white-space: nowrap;
}
.qr-mini {
    height: 27px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #ffffff;
    color: #555960;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
}
.qr-mini:hover {
    background: #f4f5f7;
    color: #111111;
}
.acciones {
    display: flex;
    align-items: center;
    gap: 5px;
}
.accion {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    text-decoration: none;
    transition: 0.2s ease;
}
.accion.editar {
    color: #555960;
}
.accion.editar:hover {
    background: #f1f2f4;
    color: #111111;
}
.accion.estado-btn {
    color: #777b85;
}
.accion.estado-btn:hover {
    background: #f1f2f4;
    color: #111111;
}
.accion.eliminar {
    color: #a1a4aa;
}
.accion.eliminar:hover {
    background: #fef2f2;
    color: #dc2626;
}
.empty {
    color: #b2b5bb;
}
.empty-state {
    min-height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
}
.empty-icon {
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    border-radius: 50%;
    background: #f4f5f7;
    color: #8b8f97;
}
.empty-state h3 {
    margin-bottom: 6px;
    color: var(--text);
    font-size: 15px;
}
.empty-state p {
    color: var(--text-muted);
    font-size: 12px;
}
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 16, 20, 0.45);
    backdrop-filter: blur(2px);
}
.modal-overlay.show {
    display: flex;
}
.modal {
    width: 100%;
    max-width: 650px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    animation: modalShow 0.2s ease;
}
@keyframes modalShow {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.modal-header {
    min-height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 {
    margin-bottom: 5px;
    color: var(--text);
    font-size: 18px;
}
.modal-header p {
    color: var(--text-light);
    font-size: 12px;
}
.modal-close {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #777b85;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: 0.2s ease;
}
.modal-close:hover {
    background: #f1f2f4;
    color: #111111;
}
.persona-form {
    padding: 24px;
}
.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 {
    color: #555960;
    font-size: 10px;
    font-weight: 600;
}
.form-group input,
.form-group select {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    background: #ffffff;
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    transition: 0.2s ease;
}
.form-group input::placeholder {
    color: #b0b3b9;
}
.form-group input:focus,
.form-group select:focus {
    border-color: #bfc2c8;
    box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.04);
}
.qr-info {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-top: 22px;
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fafafa;
}
.qr-info > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.qr-info span {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.qr-info strong {
    color: var(--text);
    font-family: "Courier New", monospace;
    font-size: 12px;
}
.btn-secondary {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
    color: #555960;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s ease;
}
.btn-secondary:hover {
    background: #f4f5f7;
    color: #111111;
}
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.qr-modal {
    position: relative;
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    text-align: center;
    animation: modalShow 0.2s ease;
}
.qr-modal .modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
}
.qr-modal h2 {
    margin-bottom: 5px;
    color: var(--text);
    font-size: 18px;
}
.qr-modal p {
    margin-bottom: 20px;
    color: var(--text-light);
    font-family: "Courier New", monospace;
    font-size: 12px;
}
#qrcode {
    min-width: 220px;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 22px;
    padding: 10px;
    background: #ffffff;
}
#qrcode img,
#qrcode canvas {
    display: block;
    max-width: 100%;
    height: auto;
}
@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .filters {
        flex-wrap: wrap;
    }
    .search-box {
        min-width: 100%;
        flex: 1 1 100%;
    }
    .filters select {
        flex: 1;
        min-width: 140px;
    }
}
@media (max-width: 850px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .section-header {
        align-items: flex-start;
        flex-direction: column;
    }
    .section-header .btn-primary {
        width: 100%;
    }
}
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-bottom: 22px;
    }
    .stat-card {
        min-height: 90px;
        padding: 15px;
        gap: 10px;
    }
    .stat-icon {
        width: 36px;
        height: 36px;
    }
    .stat-card strong {
        font-size: 19px;
    }
    .section-header {
        margin-bottom: 15px;
    }
    .filters {
        padding: 12px;
        gap: 8px;
    }
    .filters select {
        width: 100%;
        flex: 1 1 100%;
    }
    .btn-filter,
    .btn-clear {
        flex: 1;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-group.full {
        grid-column: auto;
    }
    .modal {
        max-height: calc(100vh - 25px);
        border-radius: 12px;
    }
    .persona-form {
        padding: 20px;
    }
    .modal-header {
        padding: 18px 20px;
    }
    .qr-info {
        align-items: flex-start;
        flex-direction: column;
    }
    .qr-info .btn-secondary {
        width: 100%;
    }
    .modal-footer {
        flex-direction: column-reverse;
    }
    .modal-footer button {
        width: 100%;
    }
}
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .stat-card {
        min-height: 80px;
    }
    .alerta {
        align-items: flex-start;
    }
    .filters {
        padding: 10px;
    }
    .search-box {
        min-width: 0;
    }
    .btn-filter,
    .btn-clear {
        width: 100%;
        flex: 1 1 100%;
    }
    .qr-modal {
        padding: 25px 18px;
    }
    #qrcode {
        min-width: 200px;
        min-height: 200px;
    }
}
@media print {
    body * {
        visibility: hidden;
    }
    #modalQR,
    #modalQR * {
        visibility: visible;
    }
    #modalQR {
        position: absolute;
        inset: 0;
        display: flex !important;
        background: #ffffff;
    }
    #modalQR .modal-close,
    #modalQR .btn-primary {
        display: none;
    }
    .qr-modal {
        box-shadow: none;
        border: none;
    }
}


/* Mover solamente el texto NOMBRES Y APELLIDOS */
.table-card table thead th:nth-child(1) {
    text-indent: 30px;
}

/* Mover solamente el texto DNI */
.table-card table thead th:nth-child(2) {
    text-indent: 18px;
}

/* Mover solamente el texto DNI */
.table-card table thead th:nth-child(3) {
    text-indent: 15px;
}

/* LOGO */
.logo {
    width: 100%;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    margin-bottom: 25px;
    flex-shrink: 0;
    overflow: hidden;
}
.logo-image {
    display: block;
    width: 115px;
    height: 115px;
    max-width: 100%;
    object-fit: contain;
    border-radius: 6px;
    flex-shrink: 0;
}




/* FIJAR CERRAR SESIÓN EN LA PARTE INFERIOR */

.sidebar {
    display: flex;
    flex-direction: column;
    height: calc(100vh + 5px);
    min-height: calc(100vh + 5px);
    box-sizing: border-box;
    transform: translateY(3px);
}


.sidebar-bottom {
    margin-top: auto;
    padding-top: 18px;
    padding-bottom: 6px;
    border-top: 1px solid #e7e8ec;
    flex-shrink: 0;
}

.sidebar-bottom .menu-item.logout {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
}

