* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", Arial, sans-serif;
}

body {
    background: #0f1115;
    color: #ffffff;
}

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 270px;
    background: linear-gradient(180deg, #11151c 0%, #0b0e13 100%);
    border-right: 1px solid rgba(255,255,255,0.08);
    padding: 24px 18px;
    transition: all 0.3s ease;
}

.brand {
    margin-bottom: 28px;
}

.brand h1 {
    font-size: 28px;
    margin-bottom: 4px;
    font-weight: 800;
}

.brand p {
    color: #9ca3af;
    margin-bottom: 0;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.menu a,
.logout-btn {
    text-decoration: none;
    color: #ffffff;
    background: #171b22;
    padding: 13px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.06);
    transition: 0.2s ease;
    display: block;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
}

.menu a:hover,
.logout-btn:hover {
    background: #202632;
    transform: translateY(-1px);
}

.content {
    flex: 1;
    padding: 24px;
    min-width: 0;
}

.topbar {
    background: #141922;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 18px;
    padding: 18px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.role-badge {
    display: inline-block;
    margin-left: 10px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.page-header {
    margin-bottom: 20px;
}

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

.page-header h2 {
    font-size: 30px;
    margin-bottom: 8px;
    font-weight: 800;
}

.page-header p {
    color: #9ca3af;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 18px;
}

.card {
    background: #141922;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.stat-card {
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-label {
    color: #9ca3af;
    margin-bottom: 10px;
}

.stat-number {
    font-size: 36px;
    font-weight: 800;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at top right, rgba(37,99,235,0.25), transparent 30%),
        radial-gradient(circle at bottom left, rgba(16,185,129,0.20), transparent 30%),
        #0f1115;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #141922;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 22px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}

.login-card h1 {
    text-align: center;
    margin-bottom: 8px;
    font-size: 34px;
    font-weight: 800;
}

.subtitle {
    text-align: center;
    color: #9ca3af;
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label,
.form-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #d1d5db;
    font-weight: 700;
}

.form-group input,
.form-control,
.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 13px 14px;
    border-radius: 14px;
    border: 1px solid #2b3240;
    background: #0f131a;
    color: white;
    outline: none;
    transition: .18s ease;
}

.form-group input:focus,
.form-control:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: #2563eb;
}

.btn-primary,
.btn-secondary,
.btn-table,
.btn-link {
    display: inline-block;
    padding: 12px 16px;
    border: none;
    border-radius: 12px;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: .18s ease;
}

.btn-primary,
.btn-link {
    background: linear-gradient(90deg, #2563eb, #1d4ed8);
    color: white;
}

.btn-secondary {
    background: #1f2937;
    color: white;
    border: 1px solid rgba(255,255,255,0.08);
}

.btn-table {
    background: #1d4ed8;
    color: white;
    padding: 8px 12px;
    font-size: 13px;
}

.btn-table-danger {
    background: #b91c1c;
}

.btn-search {
    min-width: 120px;
}

.error-box {
    margin-top: 16px;
    background: rgba(220,38,38,0.15);
    border: 1px solid rgba(220,38,38,0.35);
    color: #fecaca;
    padding: 12px;
    border-radius: 12px;
    text-align: center;
}

.alert-box {
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 18px;
    border: 1px solid transparent;
}

.success-box {
    background: rgba(16,185,129,0.12);
    border-color: rgba(16,185,129,0.35);
    color: #bbf7d0;
}

.error-box-strong {
    background: rgba(220,38,38,0.15);
    border: 1px solid rgba(220,38,38,0.35);
    color: #fecaca;
    margin-bottom: 18px;
}

.search-bar {
    display: flex;
    gap: 12px;
    align-items: center;
}

.table-wrap {
    overflow-x: auto;
}

.table-dark {
    width: 100%;
    border-collapse: collapse;
}

.table-dark thead th {
    text-align: left;
    font-size: 13px;
    color: #cbd5e1;
    padding: 14px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    white-space: nowrap;
}

.table-dark tbody td {
    padding: 14px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    vertical-align: middle;
}

.table-dark tbody tr:hover {
    background: rgba(255,255,255,0.03);
}

.empty-row {
    text-align: center;
    color: #9ca3af;
    padding: 24px !important;
}

.badge-success,
.badge-danger {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge-success {
    background: rgba(16,185,129,0.18);
    color: #bbf7d0;
}

.badge-danger {
    background: rgba(220,38,38,0.18);
    color: #fecaca;
}

.actions-inline {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.form-card {
    max-width: 1100px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: 18px;
}

.form-field ul.errorlist {
    list-style: none;
    margin-top: 6px;
    color: #fca5a5;
    font-size: 13px;
}

.checks-row {
    display: flex;
    gap: 24px;
    margin-top: 20px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #e5e7eb;
}

.form-check-input {
    width: 18px;
    height: 18px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 10px;
    flex-wrap: wrap;
}

.form-control-lg {
    font-size: 18px;
    padding: 16px 18px;
}

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

.section-title {
    margin-bottom: 16px;
    font-size: 22px;
    font-weight: 800;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 16px;
}

.result-box {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 16px;
}

.result-label {
    display: block;
    color: #9ca3af;
    font-size: 13px;
    margin-bottom: 8px;
}

.warning-box {
    background: rgba(245,158,11,0.12);
    border: 1px solid rgba(245,158,11,0.35);
    color: #fde68a;
}

.dashboard-cards-5 {
    grid-template-columns: repeat(5, minmax(170px, 1fr));
}

.dashboard-grid-2 {
    display: grid;
    grid-template-columns: 2fr 1.2fr;
    gap: 20px;
}

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

.section-head h3 {
    font-size: 22px;
}

.section-subtitle {
    color: #9ca3af;
    font-size: 13px;
}

.mini-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mini-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
}

.mini-list-item p {
    margin-top: 4px;
    color: #9ca3af;
    font-size: 13px;
}

.empty-state-box {
    padding: 18px;
    border-radius: 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    color: #9ca3af;
}

.badge-warning {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(245,158,11,0.18);
    color: #fde68a;
}

.full-width {
    grid-column: 1 / -1;
}

.table-dark small {
    color: #9ca3af;
}

.mini-list-item-column {
    align-items: flex-start;
}

.dashboard-cards-3 {
    grid-template-columns: repeat(3, minmax(170px, 1fr));
}

.stat-number-small {
    font-size: 28px;
    font-weight: 700;
}

.report-filter-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* UI PRO */
a {
    transition: .18s ease;
}

.table thead th,
.func-table thead th {
    color: #dbe6f3;
}

.alert-success,
.message-success {
    border-left: 4px solid var(--brand-primary);
}

.kpi-accent,
.stat-accent,
.icon-accent {
    color: var(--brand-primary);
}

.border-accent {
    border-color: var(--brand-border) !important;
}

.shadow-accent {
    box-shadow: 0 10px 24px var(--brand-shadow);
}

.glass-soft {
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.05);
    backdrop-filter: blur(10px);
}

.section-kicker {
    color: var(--brand-primary);
    font-weight: 800;
    letter-spacing: .4px;
    text-transform: uppercase;
    font-size: 12px;
}

.input-icon-wrap {
    position: relative;
}

.input-icon-wrap .form-control {
    padding-left: 42px;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 14px;
    pointer-events: none;
}

#menu-toggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 10001;
    background: #111;
    color: white;
    border: none;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 18px;
    box-shadow: 0 10px 24px rgba(0,0,0,.25);
}

.table-responsive {
    overflow-x: auto;
}

.progress-bar {
    max-width: 100%;
}

.tabla-deudas {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tabla-header,
.tabla-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.2fr 1.2fr 1.2fr 1.5fr 1fr 1.5fr;
    gap: 12px;
    align-items: center;
}

.tabla-header {
    font-size: 13px;
    color: #94a3b8;
    padding: 0 10px;
}

.tabla-row {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 16px;
    padding: 14px 12px;
}

.funcionario strong {
    display: block;
    color: #fff;
}

.funcionario span {
    font-size: 12px;
    color: #94a3b8;
}

.sub {
    display: block;
    font-size: 12px;
    color: #94a3b8;
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.acciones {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.btn-editar,
.btn-toggle {
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    text-decoration: none;
}

.btn-editar {
    background: #2563eb;
    color: white;
}

.btn-toggle {
    background: #334155;
    color: white;
}

.badge-activa {
    background: rgba(34,197,94,0.15);
    color: #4ade80;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
}

.badge-inactiva {
    background: rgba(239,68,68,0.15);
    color: #f87171;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
}

.badge {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
}

.badge-danger {
    background: #ff4d4d;
    color: white;
}

.badge-success {
    background: #2ecc71;
    color: white;
}

/* RESPONSIVE */
@media (max-width: 1200px) {
    .dashboard-cards-5 {
        grid-template-columns: repeat(3, minmax(170px, 1fr));
    }

    .dashboard-grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .cards-grid {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
    }

    .page-header-flex {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-bar {
        flex-direction: column;
        align-items: stretch;
    }

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

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

@media (max-width: 900px) {
    #menu-toggle {
        display: block;
    }

    body.menu-open {
        overflow: hidden;
        height: 100vh;
    }

    .layout {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 86%;
        max-width: 360px;
        height: 100dvh;
        background: #05070b;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        transition: left 0.25s ease;
        z-index: 9999;
        padding: 24px 16px 40px;
        box-shadow: 8px 0 30px rgba(0, 0, 0, 0.35);
    }

    .sidebar.active {
        left: 0;
    }

    .content {
        width: 100%;
        position: relative;
        z-index: 1;
        padding: 14px;
    }

    .menu {
        display: flex;
        flex-direction: column;
        gap: 14px;
    }

    .sidebar::after {
        content: "";
        display: block;
        height: 35px;
    }

    .cards-grid,
    .dashboard-grid-2,
    .dashboard-cards-3 {
        grid-template-columns: 1fr !important;
    }

    .table-wrap {
        overflow-x: auto;
    }

    table {
        min-width: 600px;
    }

    button, .btn-primary {
        width: 100%;
        padding: 12px;
        font-size: 16px;
    }

    input, select {
        padding: 12px;
        font-size: 16px;
    }

    h2 {
        font-size: 22px;
    }
}

@media (max-width: 780px) {
    .dashboard-cards-5 {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
    }

    .section-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .mini-list-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-cards-3 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

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

@media (max-width: 560px) {
    .dashboard-cards-5 {
        grid-template-columns: 1fr;
    }
}
.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.chip {
    background: rgba(59,130,246,.15);
    border: 1px solid rgba(59,130,246,.3);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chip button {
    background: none;
    border: none;
    color: #f87171;
    font-weight: bold;
    cursor: pointer;
}
/* ===== FIX ROSTRO + ESTADO (PRO) ===== */

.func-table td:nth-child(8),
.func-table td:nth-child(9) {
    white-space: normal !important;
}

/* Contenedor visual más cómodo */
.func-table td:nth-child(8),
.func-table td:nth-child(9) {
    display: flex;
    align-items: center;
}

/* Mejora visual de badges */
.badge-soft {
    max-width: 100%;
    text-align: center;
    justify-content: center;
    padding: 6px 12px;
    font-size: 11px;
}

/* Evita que se monten visualmente */
.func-table td:nth-child(8) .badge-soft,
.func-table td:nth-child(9) .badge-soft {
    margin: 2px 0;
}

/* Ajuste fino de columnas */
.func-table th:nth-child(8), .func-table td:nth-child(8) {
    width: 14%;
}

.func-table th:nth-child(9), .func-table td:nth-child(9) {
    width: 10%;
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.form-field {
    display: flex;
    flex-direction: column;
}

.form-field label {
    margin-bottom: 8px;
    font-weight: 700;
    color: #f8fafc;
}

.form-field input,
.form-field select {
    background: #0f1722;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 14px;
    padding: 14px 16px;
    color: #fff;
    outline: none;
    transition: .18s ease;
}

.form-field input:focus,
.form-field select:focus {
    border-color: rgba(59,130,246,.55);
    box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}

.checks-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.check-item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 12px;
    padding: 12px 14px;
    color: #fff;
}

.check-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
}

@media (max-width: 900px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}