/* site-03-components.css: Grids, cards, person profile, Bootstrap overrides, buttons, badges, forms, search (06-13).
   Part of the old site.css, split by sections (same order: _Styles.cshtml links them one after the other,
   so the cascade is exactly the same). */

/* =====================================================================
   06. GRIDS
   ===================================================================== */
.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

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


/* =====================================================================
   07. CARDS AND SECTIONS
   ===================================================================== */
.card,
.card-modern,
.section {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card {
    padding: 0;
}

.card-modern {
    position: relative;
    padding: 20px;
    transition: var(--transition);
}

    .card-modern:hover {
        box-shadow: var(--shadow-glow);
        border-color: rgba(79, 109, 245, 0.35);
        transform: translateY(-3px);
    }

.section {
    padding: 20px;
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    color: var(--primary-soft);
    font-size: 1rem;
    font-weight: 600;
}

    .section-header i {
        font-size: 18px;
    }

.card-user-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text) !important;
    font-size: clamp(0.92rem, 1vw + 0.6rem, 1.05rem);
    font-weight: 600;
}

    .card-user-title i {
        color: var(--primary-soft);
        font-size: 1.1rem;
    }

/* --- User and office cards (lists) --- */
.user-card,
.office-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    height: 100%;
}

.user-card-head,
.office-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.user-card-identity {
    display: flex;
    gap: 12px;
    min-width: 0;
}

.user-avatar {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(59, 130, 246, 0.25), rgba(6, 182, 212, 0.12));
    border: 1px solid rgba(96, 165, 250, 0.28);
    color: #93c5fd;
    font-size: 1rem;
    font-weight: 700;
}

.user-card-name {
    margin: 0;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}

.user-card-rank {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.user-card .record-row {
    grid-template-columns: 95px minmax(0, 1fr);
    padding: 9px 0;
}

    .user-card .record-row:last-child {
        border-bottom: none;
    }

.user-card-actions,
.office-card-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

    .user-card-actions form,
    .office-card-actions form {
        display: inline-flex;
        width: auto;
        max-width: none;
        margin: 0;
    }

.user-info-card {
    background-color: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 15px;
}


/* =====================================================================
   08. PERSON PROFILE
   ===================================================================== */
.person-page {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.person-top {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 26px;
    margin-bottom: 20px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

.person-main {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 0;
}

.person-avatar {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--primary-glow);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: var(--radius);
    color: var(--primary-soft);
    font-size: 23px;
}

.person-identity {
    min-width: 0;
}

    .person-identity h1 {
        margin: 0;
        color: var(--text);
        font-size: clamp(1.05rem, 1.6vw + 0.7rem, 1.45rem);
        font-weight: 700;
        letter-spacing: -0.02em;
    }

.person-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    margin-bottom: 6px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--radius-sm);
    color: #34d399;
    font-size: 0.7rem;
    font-weight: 600;
}

    .person-status i {
        font-size: 0.7rem;
    }

.person-dni {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.8rem;
}

    .person-dni i {
        color: #60a5fa;
    }

    .person-dni strong {
        color: var(--text-soft);
        font-weight: 600;
    }

/* Summary */
.person-summary {
    display: flex;
    align-items: center;
    gap: 38px;
    margin-left: auto;
}

    .person-summary div {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .person-summary span {
        color: var(--muted);
        font-size: 0.62rem;
        font-weight: 600;
        letter-spacing: 0.07em;
        text-transform: uppercase;
    }

    .person-summary strong {
        color: var(--text);
        font-size: 0.86rem;
        font-weight: 600;
    }

/* Content */
.person-content {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.person-section {
    padding: 25px 28px;
}

    .person-section + .person-section {
        border-top: 1px solid var(--border);
    }

.section-heading {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 18px;
}

.section-heading-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--primary-glow);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-sm);
    color: var(--primary-soft);
    font-size: 15px;
}

.section-heading h2 {
    margin: 0;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 655;
    letter-spacing: -0.01em;
}

.section-heading span {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.7rem;
}

/* Data */
.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.physical-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.location-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.data-item,
.physical-item {
    padding: 12px 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
}

.data-item {
    min-height: 72px;
}

.physical-item {
    min-height: 68px;
}

    .data-item:hover,
    .physical-item:hover {
        background: var(--panel-2);
        border-color: rgba(59, 130, 246, 0.25);
    }

.data-item:hover {
    transform: translateY(-1px);
}

.data-item span,
.physical-item span {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 0.63rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.data-item strong,
.physical-item strong {
    color: var(--text);
    font-size: 0.84rem;
    font-weight: 550;
    overflow-wrap: anywhere;
}

/* Detail cards (addresses, etc.) */
.detail-card {
    padding: 17px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
}

    .detail-card:hover {
        background: var(--panel-2);
        border-color: rgba(59, 130, 246, 0.25);
    }

.detail-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--text-soft);
    font-size: 0.78rem;
    font-weight: 600;
}

    .detail-title i {
        color: var(--primary-soft);
        font-size: 0.95rem;
    }

.detail-main {
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.45;
}

.detail-secondary {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 7px;
    color: var(--muted);
    font-size: 0.73rem;
    line-height: 1.4;
}

    .detail-secondary i {
        color: #60a5fa;
        font-size: 0.75rem;
        margin-top: 2px;
    }

/* --- Record sheet (person detail: label / value rows) --- */
.record-sheet {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--form-shadow);
    overflow: hidden;
}

.record-section {
    padding: 22px 26px;
}

    .record-section + .record-section {
        border-top: 1px solid var(--border);
    }

.record-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 18px;
    color: #2a3a5c;
    font-size: 1rem;
    font-weight: 650;
    letter-spacing: -0.01em;
}

    .record-section-title i {
        width: 38px;
        height: 38px;
        flex: 0 0 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 11px;
        background: rgba(56, 189, 248, 0.14);
        color: #0284c7;
        font-size: 1.05rem;
    }

    .record-section-title small {
        display: block;
        margin-top: 3px;
        color: var(--muted);
        font-size: 0.74rem;
        font-weight: 500;
        letter-spacing: 0;
    }

/* Two columns of rows on desktop */
.record-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 40px;
}

.record-row {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    align-items: baseline;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
}

.record-label {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.record-value {
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 550;
    overflow-wrap: anywhere;
}

/* One-column variant (inside cards) */
.record-grid--single {
    grid-template-columns: 1fr;
    column-gap: 0;
}

/* Empty values: muted so real data stands out */
.record-value.is-empty {
    color: var(--muted);
    font-weight: 400;
    font-style: italic;
}

/* --- Ficha del ciudadano: filas como "campos" en grilla fluida --- */
.record-sheet .record-grid {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    column-gap: 14px;
    row-gap: 10px;
}

.record-sheet .record-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.06);
    transition: border-color .15s ease, background .15s ease;
}

    .record-sheet .record-row:hover {
        border-color: rgba(2, 132, 199, 0.45);
        background: rgba(56, 189, 248, 0.06);
    }

.record-sheet .record-label {
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.07em;
}

.record-sheet .record-value {
    color: #475569;        /* slate suave, menos duro que el casi-negro */
    font-size: 0.92rem;
    font-weight: 500;
}

.record-sheet .record-label {
    color: #8793a6;        /* etiqueta aún más tenue */
}

.record-sheet .record-value.is-empty {
    color: #94a3b8;
}

/* Empty state */
.person-empty {
    min-height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    color: var(--muted);
    font-size: 0.82rem;
}


/* =====================================================================
   09. BOOTSTRAP OVERRIDES
   ===================================================================== */
.bg-white {
    background: var(--panel) !important;
}

.text-dark {
    color: var(--text) !important;
}

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

.dropdown-menu {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.dropdown-item {
    color: var(--text-soft);
    font-size: 0.88rem;
}

    .dropdown-item:hover {
        background: var(--primary-glow);
        color: var(--primary-soft);
    }

.modal-content {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header,
.modal-footer {
    border-color: var(--border);
}

.offcanvas {
    background: var(--panel);
    color: var(--text);
}

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-border-color: transparent;
}


/* =====================================================================
   10. BUTTONS
   ===================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-weight: 500;
    font-size: 0.85rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

/* --- Primary --- */
.btn-primary-modern {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 43px;
    padding: 0.62rem 1.8rem;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border: 1px solid #2563eb;
    border-radius: 9px;
    font-weight: 650;
    box-shadow: 0 5px 14px rgba(37, 99, 235, 0.22);
    transition: all 0.2s ease;
}

    /* Shine on hover */
    .btn-primary-modern::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%);
        transform: translateX(-120%);
        transition: transform 0.6s ease;
        pointer-events: none;
    }

    .btn-primary-modern:hover {
        color: #fff;
        background: linear-gradient(135deg, #1d4ed8, #1e40af);
        border-color: #1d4ed8;
        box-shadow: 0 7px 18px rgba(37, 99, 235, 0.3);
        transform: translateY(-1px);
    }

        .btn-primary-modern:hover::before {
            transform: translateX(120%);
        }

    .btn-primary-modern:active {
        transform: translateY(0);
        box-shadow: 0 2px 8px -2px rgba(79, 109, 245, 0.4);
    }

/* --- Secondary --- */
.btn-secondary-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 43px;
    padding: 0.62rem 1.8rem;
    color: var(--text-soft);
    background: var(--panel-2);
    border: 1px solid var(--border-light);
    border-radius: 9px;
    font-weight: 650;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

    .btn-secondary-modern:hover {
        color: var(--text);
        background: var(--panel-3);
        border-color: #475569;
        transform: translateY(-1px);
    }

    .btn-secondary-modern:active {
        transform: translateY(0);
    }

/* --- Success / Danger --- */
.btn-success-modern {
    background: var(--success);
    color: white;
}

    .btn-success-modern:hover {
        background: #059669;
        color: white;
    }

.btn-danger-modern {
    background: var(--danger);
    color: white;
}

    .btn-danger-modern:hover {
        background: #dc2626;
        color: white;
    }

/* --- "New" button --- */
.btn-new {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--primary-glow);
    color: var(--primary-soft);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

    .btn-new i {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 20px;
        height: 20px;
        background: var(--gradient-primary);
        color: white;
        border-radius: 4px;
        font-size: 12px;
        transition: var(--transition-spring);
    }

    .btn-new:hover {
        background: linear-gradient(135deg, #2563eb, #1d4ed8);
        color: #fff;
        border-color: #2563eb;
        box-shadow: 0 7px 18px rgba(37, 99, 235, 0.3);
        transform: translateY(-1px);
    }

        .btn-new:hover i {
            transform: rotate(90deg);
        }

/* --- Table actions (icons) --- */
.btn-action {
    width: 36px;
    height: 36px;
    min-width: 36px;
    flex: 0 0 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    transition: var(--transition);
}

.btn-action:hover {
    background: var(--panel-3);
    border-color: var(--border-light);
    color: var(--text);
}

.btn-view-blue {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-soft);
    border-color: rgba(59, 130, 246, 0.2);
}

    .btn-view-blue:hover {
        background: #2563eb;
        color: #fff;
        border-color: #2563eb;
    }

.btn-view,
.btn-warning-action {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.2);
}

    .btn-view:hover,
    .btn-warning-action:hover {
        background: var(--warning);
        color: #030712;
        border-color: var(--warning);
    }

.btn-delete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

    .btn-delete:hover {
        background: var(--danger);
        color: white;
        border-color: var(--danger);
    }

/* --- "Back" button (person profile) --- */
.person-back-form {
    margin-left: 4px;
}

.person-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 13px;
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    color: var(--text-soft);
    font-size: 0.8rem;
    font-weight: 500;
    transition: var(--transition);
}

    .person-back:hover {
        background: var(--panel-2);
        border-color: var(--primary);
        color: var(--primary-soft);
    }


/* =====================================================================
   11. BADGES
   ===================================================================== */
.page-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--primary-glow);
    color: var(--primary-soft);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.8rem;
}

.badge-role-glow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
    background: rgba(22, 201, 141, 0.1);
    color: var(--success);
    border: 1px solid rgba(22, 201, 141, 0.25);
    box-shadow: 0 0 0 0 rgba(22, 201, 141, 0.4);
    animation: badgePulse 2.4s ease-in-out infinite;
}


/* Chips under a card title (city, departmental, ...) */
.card-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}

.badge-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.22rem 0.6rem;
    background: var(--panel-2);
    border: 1px solid var(--border-light);
    border-radius: 999px;
    color: var(--text-soft);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

    .badge-chip i {
        color: #60a5fa;
        font-size: 0.75rem;
    }

/* Narrower labels inside cards: more room for long values */
.office-card .record-row {
    grid-template-columns: 95px minmax(0, 1fr);
    padding: 9px 0;
}

    .office-card .record-row:last-child {
        border-bottom: none;
    }

/* --- Prosecution units inside an office card --- */
.unit-list-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.unit-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.unit-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}

    .unit-item:last-child {
        border-bottom: none;
    }

.unit-details {
    min-width: 0;
}

/* Clickable row that opens the unit details */
.unit-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
    cursor: pointer;
    list-style: none;
}

    .unit-summary::-webkit-details-marker {
        display: none;
    }

    .unit-summary:hover .unit-name {
        color: #60a5fa;
    }

.unit-chevron {
    color: var(--muted);
    font-size: 0.7rem;
    transition: var(--transition);
}

.unit-details[open] .unit-chevron {
    transform: rotate(90deg);
}

.unit-name {
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 550;
    overflow-wrap: anywhere;
}

/* Details shown when the row is expanded */
.unit-info {
    margin: 6px 0 2px 20px;
}

    .unit-info .record-row {
        grid-template-columns: 100px minmax(0, 1fr);
        padding: 6px 0;
    }

        .unit-info .record-row:last-child {
            border-bottom: none;
        }

.unit-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding-top: 1px;
}

    .unit-actions form {
        display: inline-flex;
        width: auto;
        max-width: none;
        margin: 0;
    }

    /* Smaller icon buttons for the unit rows */
    .unit-actions .btn-action,
    .unit-list-title .btn-action {
        width: 28px;
        height: 28px;
        min-width: 28px;
        flex: 0 0 28px;
        font-size: 0.8rem;
    }

.unit-empty {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
    font-style: italic;
}


/* --- Tabs (panel sections) --- */
.tab-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.tab-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text-soft);
    font-size: 0.85rem;
    font-weight: 650;
    text-decoration: none;
    background-image: none;
    transition: var(--transition);
}

    .tab-link:hover {
        background: var(--panel-3);
        color: var(--text);
        background-image: none;
    }

    .tab-link.is-active {
        background: linear-gradient(135deg, #2563eb, #1d4ed8);
        border-color: #2563eb;
        color: #fff;
    }

.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: rgba(255, 255, 255, 0.10);
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
}

.tab-link.is-active .tab-count {
    background: rgba(255, 255, 255, 0.22);
}

/* --- "Something new" indicator --- */
.dot-new {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 0 rgba(22, 201, 141, 0.5);
    animation: badgePulse 2.4s ease-in-out infinite;
}

.page-badge--alert {
    background: rgba(22, 201, 141, 0.1);
    border-color: rgba(22, 201, 141, 0.3);
    color: var(--success);
}

.badge-state--alert {
    background: rgba(22, 201, 141, 0.1);
    color: var(--success);
    border: 1px solid rgba(22, 201, 141, 0.3);
}


/* --- Account state --- */
.badge-state {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-state--on {
    background: rgba(22, 201, 141, 0.1);
    color: var(--success);
    border: 1px solid rgba(22, 201, 141, 0.25);
}

.badge-state--off {
    background: rgba(244, 80, 107, 0.1);
    color: var(--danger);
    border: 1px solid rgba(244, 80, 107, 0.25);
}


/* =====================================================================
   12. FORMS AND INPUTS
   ===================================================================== */
form {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* --- Form sections --- */
.form-section {
    background-color: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-sm);
}

.form-section-title {
    min-height: 42px;
    margin: 0 0 20px;
    padding: 0 0 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #f8fafc;
    border-bottom: 1px solid #334155;
    font-size: 1rem;
    font-weight: 750;
    letter-spacing: -0.01em;
    text-transform: none;
}

    .form-section-title > span {
        display: inline-flex;
        align-items: center;
        gap: 9px;
    }

        .form-section-title > span > i {
            width: 32px;
            height: 32px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 9px;
            background: #1e293b;
            color: #38bdf8;
            font-size: 0.95rem;
        }

/* --- Labels --- */
.form-label,
.form-section label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    color: var(--text-soft);
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.01em;
}

    .form-section label i {
        color: var(--primary);
        font-size: 0.9rem;
    }

form label,
.form-container label {
    display: block;
    margin-bottom: 7px;
    color: #94a3b8;
    font-size: 0.84rem;
    font-weight: 650;
    line-height: 1.25;
}

    form label i,
    .form-container label i {
        color: #64748b;
        margin-right: 4px;
        font-size: 0.82rem;
    }

/* --- Input base (.cool-input) --- */
.cool-input {
    width: 100%;
    height: 42px;
    padding: 0 0.85rem;
    background-color: var(--input-bg);
    color: var(--input-text);
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    transition: var(--transition);
}

    .cool-input::placeholder {
        color: var(--input-placeholder);
        font-weight: 400;
    }

    .cool-input:focus {
        background-color: var(--input-bg-focus);
        color: var(--input-text);
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-glow);
        outline: none;
    }

/* --- Input inside forms --- */
form .cool-input,
.form-container .cool-input {
    width: 100%;
    min-height: 43px;
    padding: 0.58rem 0.78rem;
    background: #0f172a;
    color: #f1f5f9;
    border: 1px solid #334155;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

    form .cool-input:hover,
    .form-container .cool-input:hover {
        background: #1e293b;
        border-color: #475569;
    }

    form .cool-input:focus,
    .form-container .cool-input:focus {
        background: #0f172a;
        color: #f1f5f9;
        border-color: #3b82f6;
        outline: none;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    }

    form .cool-input::placeholder,
    .form-container .cool-input::placeholder {
        color: #64748b;
        font-weight: 400;
    }

form textarea.cool-input,
.form-container textarea.cool-input {
    min-height: 280px;
    padding: 0.85rem 0.95rem;
    resize: vertical;
    line-height: 1.6;
}

/* --- Select (must come after "form .cool-input") --- */
select.cool-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #0f172a; /* dark, same as the other inputs */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    background-size: 15px;
    padding-right: 2.4rem;
    cursor: pointer;
}

.cool-input option {
    background-color: #0f172a;
    color: #e2e8f0;
}

    .cool-input option:disabled,
    .cool-input option[value=""] {
        color: #94a3b8;
    }

/* --- Date / time --- */
input[type="date"].cool-input,
input[type="time"].cool-input {
    cursor: pointer;
}

.cool-input::-webkit-calendar-picker-indicator {
    filter: invert(0.3);
    opacity: 0.7;
    cursor: pointer;
}

/* --- States: disabled and validation --- */
.cool-input:disabled,
.cool-input[readonly] {
    background: #e2e8f0; /* REVIEW: light background, looks like a leftover from the light theme */
    color: #64748b;
    cursor: not-allowed;
    opacity: 0.85;
}

.input-validation-error {
    border-color: #f87171 !important;
    background: rgba(244, 80, 107, 0.06) !important; /* dark-theme error tint */
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08) !important;
}

.text-danger,
.field-validation-error {
    display: block;
    margin-top: 5px;
    color: #dc2626 !important;
    font-size: 0.76rem;
    font-weight: 600;
}


/* --- Filters above the checkbox groups --- */
.check-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

    .check-filters .cool-input {
        width: auto;
        min-width: 220px;
        flex: 1 1 220px;
        max-width: 320px;
    }

/* Groups of checkboxes (one per departmental) */
.check-groups {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 340px;
    overflow-y: auto;
    padding: 14px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
}

.check-group-title {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Inside a group the grid has no frame of its own */
.check-groups .check-grid {
    padding: 0;
    background: transparent;
    border: none;
}


/* --- Checkbox grid (multi selection, e.g. supervised stations) --- */
.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 8px;
    padding: 14px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    padding: 7px 10px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-soft);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

    .check-item:hover {
        background: var(--panel-3);
        color: var(--text);
    }

    .check-item input {
        width: 17px;
        height: 17px;
        flex: 0 0 17px;
        margin: 0;
        background-color: #0f172a;
        border: 1px solid #475569;
        cursor: pointer;
    }

        .check-item input:checked {
            background-color: #2563eb;
            border-color: #2563eb;
        }

    .check-item:has(input:checked) {
        background: rgba(37, 99, 235, 0.12);
        border-color: rgba(96, 165, 250, 0.4);
        color: var(--text);
    }

.field-hint {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.76rem;
}


/* --- Form actions (Cancel / Save) --- */
.form-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}


/* =====================================================================
   13. SEARCH (input-group)
   ===================================================================== */
.input-group {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
}

    .input-group .cool-input {
        width: auto;
        flex: 1 1 auto;
        min-width: 0;
        border-right: none;
        border-radius: 8px 0 0 8px; /* joins the button on the right */
    }

        /* Search boxes never show validation errors: same look as the other inputs */
        .input-group .cool-input.input-validation-error {
            background: #0f172a !important;
            border-color: #334155 !important;
            box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2) !important;
        }

            .input-group .cool-input.input-validation-error:hover {
                background: #1e293b !important;
                border-color: #475569 !important;
            }

            .input-group .cool-input.input-validation-error:focus {
                background: #0f172a !important;
                border-color: #3b82f6 !important;
                box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
            }

.search-modern {
    display: flex;
    align-items: center;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.input-group .btn,
#btnSearchDni,
#btnSearchName {
    width: auto !important;
    height: 42px;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    margin-left: 0 !important;
    background: var(--gradient-primary) !important;
    color: white !important;
    border: none !important;
    border-radius: 0 8px 8px 0 !important;
    box-shadow: none;
    transition: var(--transition);
}

    .input-group .btn i,
    #btnSearchDni i,
    #btnSearchName i {
        font-size: 1rem;
    }

    .input-group .btn:hover,
    #btnSearchDni:hover,
    #btnSearchName:hover {
        background: var(--gradient-primary-hover) !important;
        color: #ffffff !important;
    }

/* --- Filters next to the search bar --- */
.status-filter {
    width: auto;
    min-width: 190px;
    cursor: pointer;
}


/* --- Retrato por rasgos (Imputación / faceComposer.js) --- */
.face-composer-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.face-composer {
    background: #fbfaf6;
    border: 1px solid #e6e2d6;
    border-radius: 12px;
    padding: 10px;
    width: 240px;
    max-width: 100%;
}

    .face-composer svg {
        width: 100%;
        height: auto;
        display: block;
    }

.face-composer-cap {
    text-align: center;
    font-size: 0.72rem;
    color: #8a8172;
    margin-top: 5px;
}


/* --- Datos filiatorios: rasgos a la izquierda + cara grande a la derecha --- */
.filiatorios {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 24px;
    align-items: start;
}

.filiatorios-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

    .filiatorios-fields .fil-field { min-width: 0; }
    .filiatorios-fields .fil-field.fil-span { grid-column: 1 / -1; }

.filiatorios-face { position: sticky; top: 14px; }

    .filiatorios-face .face-composer {
        width: 100%;
        max-width: 360px;
        margin: 0 auto;
    }

@media (max-width: 991px) {
    .filiatorios { grid-template-columns: 1fr; }
    .filiatorios-face { position: static; order: -1; margin-bottom: 8px; }
}

@media (max-width: 560px) {
    .filiatorios-fields { grid-template-columns: 1fr; }
}
