/* ============================================================
   CertTrack - Roadmap Certificações WebApp
   Mobile-first responsive design
   ============================================================ */

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1B63B5;
    --primary-dark: #144A8A;
    --primary-light: #E8F0FA;
    --accent: #C4008C;
    --bg: #F5F5F5;
    --card-bg: #ffffff;
    --text: #2D2926;
    --text-muted: #6b7280;
    --border: #e0e0e0;
    --ok: #059669;
    --ok-bg: #d1fae5;
    --doing: #d97706;
    --doing-bg: #fef3c7;
    --missing: #dc2626;
    --missing-bg: #fee2e2;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --radius: 10px;
    --radius-sm: 6px;
    --transition: 0.2s ease;
    --nav-bg: #0D2B52;
}

html, body {
    height: 100%;
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    -webkit-font-smoothing: antialiased;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    overflow-x: hidden;
}

/* ============================================================
   Top Navigation
   ============================================================ */
.topnav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--nav-bg);
    color: white;
    box-shadow: var(--shadow);
}

.topnav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.15em;
}

.brand-icon {
    font-size: 1.4em;
}

.roadmap-select {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.15);
    color: white;
    font-size: 0.85em;
    font-weight: 500;
    max-width: 200px;
    cursor: pointer;
    outline: none;
}

.roadmap-select option {
    color: var(--text);
    background: white;
}

/* ============================================================
   App Container
   ============================================================ */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

/* ============================================================
   States
   ============================================================ */
.state-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    text-align: center;
    color: var(--text-muted);
    gap: 16px;
}

.state-icon {
    font-size: 3em;
}

.hidden {
    display: none !important;
}

/* Spinner */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   Summary Cards
   ============================================================ */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.summary-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border-top: 3px solid var(--primary);
}

.summary-card.ok { border-top-color: var(--ok); }
.summary-card.doing { border-top-color: var(--doing); }
.summary-card.missing { border-top-color: var(--missing); }

.summary-card .card-value {
    font-size: 1.8em;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}

.summary-card.ok .card-value { color: var(--ok); }
.summary-card.doing .card-value { color: var(--doing); }
.summary-card.missing .card-value { color: var(--missing); }

.summary-card .card-label {
    font-size: 0.75em;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.summary-card .card-hint {
    font-size: 0.6em;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.2;
    opacity: 0.75;
}

/* ============================================================
   Tabs
   ============================================================ */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    font-size: 0.85em;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    position: relative;
}

.tab-btn.active {
    color: var(--primary);
    background: var(--primary-light);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
}

/* ============================================================
   Content: Tier Sections
   ============================================================ */
.tier-section {
    margin-bottom: 20px;
}

.tier-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius) var(--radius) 0 0;
    font-weight: 700;
    font-size: 0.95em;
}

.tier-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tier-badge.silver { background: #C0C0C0; color: #333; }
.tier-badge.gold { background: #FFD700; color: #333; }
.tier-badge.platinum { background: #E5E4E2; color: #333; }
.tier-badge.business { background: #4a90d9; color: white; }

/* BU Section */
.bu-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-top: none;
}

.bu-section:last-child {
    border-radius: 0 0 var(--radius) var(--radius);
}

.bu-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.9em;
    color: var(--primary-dark);
    cursor: pointer;
    user-select: none;
}

.bu-header .bu-icon {
    font-size: 1.1em;
}

.bu-header .chevron {
    margin-left: auto;
    transition: transform var(--transition);
    font-size: 0.8em;
    color: var(--text-muted);
}

.bu-header.collapsed .chevron {
    transform: rotate(-90deg);
}

/* Role Section */
.role-section {
    border-bottom: 1px solid var(--border);
}

.role-section:last-child {
    border-bottom: none;
}

.role-header {
    padding: 8px 16px 8px 28px;
    font-size: 0.8em;
    color: var(--text-muted);
    font-weight: 600;
    background: #fafbfc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.role-req {
    font-weight: 400;
    font-size: 0.9em;
    color: #9ca3af;
}

/* Person Cards */
.person-list {
    padding: 0;
}

.person-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px 12px 28px;
    border-top: 1px solid #f3f4f6;
    transition: background var(--transition);
}

.person-card:hover {
    background: #fafbfc;
}

.person-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8em;
    flex-shrink: 0;
}

.person-info {
    flex: 1;
    min-width: 0;
}

.person-name {
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text);
    margin-bottom: 2px;
}

.person-name.missing-name {
    color: var(--missing);
    font-style: italic;
}

.person-task {
    font-size: 0.8em;
    color: var(--text-muted);
    white-space: pre-line;
    line-height: 1.4;
}

.person-bu-tag {
    display: inline-block;
    font-size: 0.7em;
    padding: 1px 6px;
    background: #e8f4fd;
    color: #1565c0;
    border-radius: 4px;
    font-weight: 600;
    margin-bottom: 2px;
}

.bu-tags-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.bu-mini-tag {
    display: inline-block;
    font-size: 0.75em;
    padding: 2px 8px;
    background: #e8f4fd;
    color: #1565c0;
    border-radius: 5px;
    font-weight: 500;
    white-space: nowrap;
}

.person-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-badge.ok {
    background: var(--ok-bg);
    color: var(--ok);
}

.status-badge.doing {
    background: var(--doing-bg);
    color: var(--doing);
}

.status-badge.missing {
    background: var(--missing-bg);
    color: var(--missing);
}

.status-badge.unknown {
    background: #f3f4f6;
    color: #9ca3af;
}

/* Validity date */
.validity {
    font-size: 0.7em;
    color: var(--text-muted);
}

.validity.expired {
    color: var(--missing);
    font-weight: 600;
}

.validity.expiring-soon {
    color: var(--doing);
    font-weight: 600;
}

/* ============================================================
   Progress Bar
   ============================================================ */
.progress-bar-container {
    margin-bottom: 16px;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.progress-label {
    font-size: 0.8em;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.progress-bar {
    height: 8px;
    border-radius: 4px;
    background: #e5e7eb;
    overflow: hidden;
    display: flex;
}

.progress-segment {
    height: 100%;
    transition: width 0.5s ease;
}

.progress-segment.ok { background: var(--ok); }
.progress-segment.doing { background: var(--doing); }
.progress-segment.missing { background: var(--missing); }

/* ============================================================
   Filter Bar
   ============================================================ */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--card-bg);
    font-size: 0.8em;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.filter-btn .filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 4px;
    border-radius: 9px;
    font-size: 0.85em;
    font-weight: 700;
    background: rgba(0,0,0,0.1);
}

.filter-btn.active .filter-count {
    background: rgba(255,255,255,0.3);
}

/* ============================================================
   Search
   ============================================================ */
.search-bar {
    margin-bottom: 16px;
}

.search-input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9em;
    background: var(--card-bg);
    color: var(--text);
    outline: none;
    transition: border-color var(--transition);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,132,61,0.1);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 640px) {
    .app-container {
        padding: 12px;
    }

    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .summary-card {
        padding: 12px 8px;
    }

    .summary-card .card-value {
        font-size: 1.5em;
    }

    .person-card {
        padding: 10px 12px 10px 16px;
    }

    .person-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.7em;
    }

    .tier-header {
        font-size: 0.85em;
        padding: 10px 12px;
    }

    .roadmap-select {
        max-width: 150px;
        font-size: 0.8em;
    }
}

@media (min-width: 769px) {
    .app-container {
        padding: 24px;
    }

    .summary-cards {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Safe area for iPhone */
@supports (padding: max(0px)) {
    .topnav {
        padding-top: max(12px, env(safe-area-inset-top));
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }

    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ============================================================
   Scrollbar
   ============================================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-sm { padding: 6px 14px; font-size: 0.8em; }

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-outline {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-outline:hover { background: #f3f4f6; }

.btn-success { background: var(--ok); color: white; }
.btn-error { background: var(--missing); color: white; }

/* ============================================================
   Top Actions Bar
   ============================================================ */
.top-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
    gap: 8px;
}

.back-bar {
    margin-bottom: 16px;
}

/* ============================================================
   Clickable elements
   ============================================================ */
.clickable {
    cursor: pointer;
    transition: color var(--transition);
}
.clickable:hover {
    color: var(--primary);
    text-decoration: underline;
}

.clickable-cert {
    cursor: pointer;
    transition: opacity var(--transition);
}
.clickable-cert:hover {
    opacity: 0.7;
}

/* ============================================================
   Person Profile Page
   ============================================================ */
.person-profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.profile-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.4em;
    flex-shrink: 0;
}

.profile-info h2 {
    font-size: 1.3em;
    color: var(--text);
}

.profile-bu {
    color: #1565c0;
    font-size: 0.85em;
    font-weight: 500;
    margin-bottom: 2px;
}

.profile-email {
    color: var(--text-muted);
    font-size: 0.85em;
}

/* Partner Group in Person Page */
.partner-group {
    margin-bottom: 16px;
}

.partner-group-header {
    padding: 10px 16px;
    background: var(--primary);
    color: white;
    font-weight: 700;
    font-size: 0.9em;
    border-radius: var(--radius) var(--radius) 0 0;
}

.cert-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-top: none;
    transition: background var(--transition);
}

.cert-card:last-child {
    border-radius: 0 0 var(--radius) var(--radius);
}

.cert-card:hover {
    background: #f8fafc;
}

.cert-card-left { flex: 1; min-width: 0; }

.cert-name {
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text);
    margin-bottom: 4px;
}

.cert-details {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}

.cert-tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.7em;
    font-weight: 600;
    background: #f3f4f6;
    color: var(--text-muted);
}

.cert-req {
    font-size: 0.75em;
    color: #9ca3af;
}

.cert-card-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    animation: fadeIn 0.15s ease;
}

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

.modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.1em;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5em;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.modal-body {
    padding: 20px;
}

.modal-info {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.modal-person {
    font-weight: 700;
    font-size: 1em;
    color: var(--text);
    margin-bottom: 16px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

/* Form elements */
.form-label {
    display: block;
    font-size: 0.8em;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
    margin-top: 12px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9em;
    color: var(--text);
    background: white;
    outline: none;
    transition: border-color var(--transition);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,132,61,0.1);
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}

/* Status selector */
.status-selector {
    display: flex;
    gap: 8px;
}

.status-opt {
    flex: 1;
    padding: 8px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: var(--transition);
    color: var(--text-muted);
}

.status-opt.ok { border-color: #d1fae5; }
.status-opt.doing { border-color: #fef3c7; }
.status-opt.missing { border-color: #fee2e2; }

.status-opt.active.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.status-opt.active.doing { background: var(--doing-bg); color: var(--doing); border-color: var(--doing); }
.status-opt.active.missing { background: var(--missing-bg); color: var(--missing); border-color: var(--missing); }

/* ============================================================
   Import Page
   ============================================================ */
.page-title {
    font-size: 1.3em;
    color: var(--text);
    margin-bottom: 4px;
}

.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.page-header-row .page-title {
    margin-bottom: 0;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-bottom: 20px;
}

.import-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.import-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    gap: 12px;
}

.import-name {
    font-weight: 600;
    font-size: 0.9em;
}

.import-file {
    font-size: 0.75em;
    color: var(--text-muted);
}

/* Country tabs spacing */
.country-tabs {
    margin-top: 12px;
}

/* Summary cards 5-wide on desktop */
@media (min-width: 769px) {
    .summary-cards {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* ============================================================
   People Management Page
   ============================================================ */
.people-table-wrap {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.people-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.people-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: #f8fafc;
    border-bottom: 2px solid var(--border);
}

.people-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.people-row:hover {
    background: #fafbfc;
}

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

.people-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mini-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.7em;
    flex-shrink: 0;
}

.people-link {
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: color var(--transition);
}

.people-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

.cert-counts {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.mini-count {
    font-weight: 700;
    font-size: 1em;
    color: var(--text);
    margin-right: 4px;
}

.mini-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    font-size: 0.7em;
    font-weight: 700;
}

.mini-badge.ok { background: var(--ok-bg); color: var(--ok); }
.mini-badge.doing { background: var(--doing-bg); color: var(--doing); }
.mini-badge.missing { background: var(--missing-bg); color: var(--missing); }

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

.inactive-badge {
    background: #f3f4f6;
    color: #9ca3af;
}

/* Expandable cert sub-rows in People page */
.cert-counts-toggle {
    cursor: pointer;
    border-radius: 6px;
    padding: 2px 6px;
    transition: background 0.2s;
}
.cert-counts-toggle:hover {
    background: var(--primary-light);
}
.people-row.expanded > td:first-child {
    border-left: 3px solid var(--primary);
}
.person-certs-subrow > td {
    padding: 0 !important;
    background: #f8fafc;
    border-left: 3px solid var(--primary);
}
.subrow-content {
    padding: 8px 16px 12px;
}
.subrow-loading {
    padding: 16px;
    text-align: center;
}
.subrow-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
}
.subrow-table thead th {
    background: var(--primary-light);
    color: var(--primary);
    padding: 6px 10px;
    font-weight: 600;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}
.subrow-table tbody td {
    padding: 5px 10px;
    border-bottom: 1px solid #f1f5f9;
}
.subrow-table tbody tr:hover {
    background: #eef2ff;
}

/* ============================================================
   Em Falta Cards
   ============================================================ */
.em-falta-card {
    background: #fffbf0;
    border-left: 3px solid var(--doing);
}

.em-falta-avatar {
    background: var(--missing-bg) !important;
    color: var(--missing) !important;
    font-style: italic;
}

/* ============================================================
   Add/Remove Buttons
   ============================================================ */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.7em;
    cursor: pointer;
    transition: var(--transition);
    opacity: 0;
}

.person-card:hover .btn-icon {
    opacity: 1;
}

.btn-remove:hover {
    background: var(--missing-bg);
    color: var(--missing);
}

.add-person-row {
    padding: 8px 16px 8px 28px;
}

.btn-add-person {
    background: transparent;
    color: var(--primary);
    border: 1px dashed var(--primary);
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
}

.btn-add-person:hover {
    background: var(--primary-light);
}

.btn-icon-tiny {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,0.1);
    color: inherit;
    font-size: 0.7em;
    cursor: pointer;
    margin-left: 6px;
    vertical-align: middle;
}

/* ============================================================
   Role Header Updates
   ============================================================ */
.role-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.role-count {
    font-size: 0.8em;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    padding: 1px 8px;
    border-radius: 10px;
}

/* ============================================================
   Inactive Styles
   ============================================================ */
.inactive-person {
    opacity: 0.55;
}

.inactive-tag {
    font-size: 0.65em;
    font-weight: 600;
    color: #9ca3af;
    background: #f3f4f6;
    padding: 1px 6px;
    border-radius: 8px;
    vertical-align: middle;
    margin-left: 4px;
}

.inactive-avatar {
    background: #d1d5db !important;
    color: #6b7280 !important;
}

/* ============================================================
   Danger / Success-outline Buttons
   ============================================================ */
.btn-danger {
    background: var(--missing);
    color: white;
    border: none;
}

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

.btn-success-outline {
    background: transparent;
    color: #A20067;
    border: 1px solid #A20067;
}

.btn-success-outline:hover {
    background: #F5E6F0;
}

/* ============================================================
   Profile Actions
   ============================================================ */
.profile-actions {
    margin-left: auto;
    flex-shrink: 0;
}

/* ============================================================
   Add Person Modal Extras
   ============================================================ */
.person-select-list {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-top: 4px;
}

.person-select-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background var(--transition);
    border-bottom: 1px solid #f3f4f6;
}

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

.person-select-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.selected-person-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9em;
}

.divider-line {
    height: 1px;
    background: var(--border);
    margin: 16px 0;
}

.form-hint {
    font-size: 0.8em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.modal-subtitle {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* ============================================================
   Mobile responsive for people table
   ============================================================ */
@media (max-width: 640px) {
    .people-table th,
    .people-table td {
        padding: 10px 8px;
        font-size: 0.85em;
    }

    .people-actions {
        flex-direction: column;
        gap: 4px;
    }

    .mini-avatar {
        width: 28px;
        height: 28px;
    }

    .btn-icon {
        opacity: 1;
    }

    .profile-actions {
        margin-left: 0;
        margin-top: 8px;
    }

    .person-profile-header {
        flex-wrap: wrap;
    }
}

/* ============================================================
   FALTA Cards (red)
   ============================================================ */
.falta-card {
    background: #fef2f2 !important;
    border-left: 3px solid var(--missing);
}

.falta-avatar {
    background: var(--missing-bg) !important;
    color: var(--missing) !important;
    font-weight: 800;
    font-size: 1em !important;
}

.falta-name {
    color: var(--missing) !important;
    font-weight: 700 !important;
    font-size: 0.95em !important;
}

.falta-badge {
    background: var(--missing-bg) !important;
    color: var(--missing) !important;
    font-weight: 800;
}

/* ============================================================
   EXPIRADO Badge
   ============================================================ */
.expired-badge {
    background: var(--missing-bg) !important;
    color: var(--missing) !important;
    animation: pulse-expired 2s infinite;
}

@keyframes pulse-expired {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.expired-alert {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
    color: var(--missing);
    font-size: 0.9em;
}

/* ============================================================
   Cert Group (within role)
   ============================================================ */
.cert-group {
    border-bottom: 1px solid #f3f4f6;
}

.cert-group:last-of-type {
    border-bottom: none;
}

.cert-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px 6px 28px;
    background: #f8fafc;
    border-bottom: 1px solid #f0f1f3;
}

.cert-group-name {
    font-size: 0.82em;
    font-weight: 600;
    color: var(--primary-dark);
}

.cert-group-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cert-group-count {
    font-size: 0.78em;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary);
}

.cert-count-warning {
    background: var(--missing-bg) !important;
    color: var(--missing) !important;
}

.cert-count-ok {
    background: var(--ok-bg) !important;
    color: var(--ok) !important;
}

/* ============================================================
   Renewal Section
   ============================================================ */
.renew-section {
    margin-top: 12px;
    padding: 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-sm);
}

.renew-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ============================================================
   History Section
   ============================================================ */
.history-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    gap: 12px;
    padding: 8px 12px;
    background: #fafbfc;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
    font-size: 0.82em;
}

.history-date {
    color: var(--text-muted);
    font-size: 0.9em;
    white-space: nowrap;
    min-width: 100px;
}

.history-detail {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-change {
    color: var(--text);
    font-weight: 500;
}

.history-note {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9em;
}

/* ============================================================
   Roadmap Management Page
   ============================================================ */
.roadmap-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.control-group {
    display: flex;
    flex-direction: column;
}

.control-row {
    display: flex;
    gap: 8px;
}

.control-row .form-input {
    flex: 1;
}

.roadmap-empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-muted);
}

/* Roadmap Tree */
.rm-tier {
    margin-bottom: 16px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.rm-tier-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--primary);
    color: white;
}

.rm-area {
    border-bottom: 1px solid var(--border);
}

.rm-area:last-of-type {
    border-bottom: none;
}

.rm-area-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 10px 24px;
    background: #f1f5f9;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.9em;
    color: var(--primary-dark);
}

.rm-area-name {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rm-role {
    border-bottom: 1px solid #f3f4f6;
}

.rm-role:last-of-type {
    border-bottom: none;
}

.rm-role-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px 8px 40px;
    background: #fafbfc;
    font-size: 0.85em;
    font-weight: 600;
    color: var(--text);
}

.rm-role-name {
    color: var(--text);
}

.rm-cert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px 8px 56px;
    border-top: 1px solid #f3f4f6;
    font-size: 0.85em;
}

.rm-cert-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rm-cert-name {
    color: var(--text);
}

.rm-cert-qty {
    color: var(--text-muted);
    font-size: 0.9em;
}

.rm-cert-qty strong {
    color: var(--primary);
}

.rm-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition);
}

.rm-tier-header .rm-actions,
.rm-area-header:hover .rm-actions,
.rm-role-header:hover .rm-actions,
.rm-cert:hover .rm-actions {
    opacity: 1;
}

.rm-tier-header .rm-actions {
    opacity: 1;
}

.rm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    font-size: 0.85em;
    transition: var(--transition);
}

.rm-btn-edit {
    color: var(--text-muted);
}

.rm-btn-edit:hover {
    background: #e0f2fe;
    color: #0369a1;
}

.rm-btn-delete {
    color: var(--text-muted);
}

.rm-btn-delete:hover {
    background: var(--missing-bg);
    color: var(--missing);
}

.rm-tier-header .rm-btn {
    color: rgba(255,255,255,0.7);
}

.rm-tier-header .rm-btn:hover {
    color: white;
    background: rgba(255,255,255,0.2);
}

.rm-add-row {
    padding: 6px 16px 6px 56px;
}

.rm-btn-add {
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 12px;
    font-size: 0.8em;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    text-align: center;
}

.rm-btn-add:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.rm-add-tier-row {
    text-align: center;
    padding: 16px;
}

@media (max-width: 640px) {
    .roadmap-controls {
        grid-template-columns: 1fr;
    }

    .rm-cert {
        padding-left: 40px;
    }

    .rm-role-header {
        padding-left: 32px;
    }

    .rm-add-row {
        padding-left: 40px;
    }

    .rm-actions {
        opacity: 1;
    }
}

/* ============================================================
   Multi-Cert Modal
   ============================================================ */
.modal-wide {
    max-width: 520px;
}

.modal-subtitle {
    font-size: 13px;
    color: #666;
    margin: 0 0 12px;
}

.mc-cert-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.mc-cert-row .mc-cert-name {
    flex: 1;
    min-width: 0;
}

.mc-cert-row .mc-cert-qty {
    width: 70px !important;
    flex-shrink: 0;
}

.mc-cert-row .rm-btn-delete {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #fee;
    color: #c00;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.mc-cert-row .rm-btn-delete:hover {
    background: #fcc;
}

.btn-outline {
    background: transparent;
    border: 1px solid #A20067;
    color: #A20067;
}

.btn-outline:hover {
    background: #F5E6F0;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 13px;
}

/* ============================================================
   Requirement Rows (OR groups) in Modal
   ============================================================ */
.mc-req-row {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
}

.mc-req-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.mc-req-label {
    font-weight: 600;
    font-size: 13px;
    color: #333;
    flex: 1;
}

.mc-req-qty-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}

.mc-qty-label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.mc-alt-list {
    margin-bottom: 4px;
}

.mc-alt-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.mc-alt-row .mc-alt-name {
    flex: 1;
    min-width: 0;
}

.mc-alt-row .mc-alt-rm {
    width: 28px;
    height: 28px;
    font-size: 12px;
    flex-shrink: 0;
}

.mc-ou-tag {
    background: #fff3cd;
    color: #856404;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.btn-xs {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 6px;
}

.btn-alt-add {
    background: transparent;
    border: 1px dashed #ffc107;
    color: #856404;
    cursor: pointer;
    width: 100%;
    text-align: center;
    transition: background 0.2s;
}

.btn-alt-add:hover {
    background: #fff8e1;
}

/* ============================================================
   OR Group display in Roadmap Tree
   ============================================================ */
.rm-cert-group-block {
    background: #fffbeb;
    border-left: 3px solid #ffc107;
}

.rm-cert-names {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

.rm-ou-tag {
    background: #fff3cd;
    color: #856404;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
}

/* ============================================================
   OR Group display in Dashboard
   ============================================================ */
.cert-group-or .cert-group-header {
    border-left: 3px solid #ffc107;
    padding-left: 8px;
}

.cert-group-or .cert-group-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.cert-alt-name {
    font-weight: 500;
}

.cert-ou-tag {
    background: #fff3cd;
    color: #856404;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
}

/* ============================================================
   Level Banner (Dashboard)
   ============================================================ */
.level-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #f0f9f5 0%, #e8f5ef 100%);
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid #d4edda;
}

.level-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.level-label {
    font-size: 11px;
    color: #666;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.level-value {
    font-size: 15px;
    font-weight: 700;
}

.level-arrow {
    font-size: 24px;
    color: #01a982;
    font-weight: 700;
    margin-top: 12px;
}

/* ============================================================
   Level Fields (Roadmap Management)
   ============================================================ */
.rm-level-section {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.rm-level-fields {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.rm-level-field {
    flex: 1;
}

.rm-level-arrow {
    font-size: 20px;
    color: #01a982;
    font-weight: 700;
    padding-bottom: 8px;
}

.rm-fy-fields {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-top: 10px;
}

/* Dashboard FY Badge */
.fy-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #00843D;
    color: #fff;
    border-radius: 10px;
    padding: 8px 16px;
    margin-right: 12px;
}

.fy-label {
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 1px;
}

.fy-period {
    font-size: 11px;
    opacity: 0.85;
    margin-top: 2px;
    white-space: nowrap;
}

/* ============================================================
   Duplicate Modal
   ============================================================ */
.dup-section {
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 4px;
}

.dup-source {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
}

.dup-dest {
    background: #e6f9f3;
    border: 1px solid #b8e8d8;
}

.dup-section-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 10px;
    color: #333;
}

.dup-row {
    display: flex;
    gap: 10px;
}

.dup-field {
    flex: 1;
    min-width: 0;
}

.dup-arrow-row {
    text-align: center;
    font-size: 20px;
    color: #01a982;
    padding: 4px 0;
    font-weight: 700;
}

@media (max-width: 480px) {
    .dup-row {
        flex-direction: column;
        gap: 6px;
    }
}

/* Roadmap controls actions */
.control-group-actions {
    display: flex;
    align-items: flex-end;
    padding-bottom: 2px;
    gap: 8px;
}

@media (max-width: 600px) {
    .level-banner {
        flex-direction: row;
        gap: 10px;
        padding: 10px 12px;
    }
    .level-arrow {
        font-size: 18px;
        margin-top: 10px;
    }
    .rm-level-fields {
        flex-wrap: wrap;
        gap: 8px;
    }
    .rm-fy-fields {
        flex-wrap: wrap;
        gap: 8px;
    }
    .rm-level-field {
        flex: 1 1 120px;
    }
    .rm-level-arrow {
        flex: 0 0 auto;
    }
}

/* ============================================================
   Deactivate Roadmap
   ============================================================ */
.rm-deactivate-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.rm-inactive-banner {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 14px;
    font-size: 14px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* ============================================================
   Roadmap History Page
   ============================================================ */
.history-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 14px 16px;
}

.history-filter-group {
    flex: 1;
    min-width: 120px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
}

.history-card-inactive {
    background: #fafafa;
    border-color: #e0e0e0;
    opacity: 0.85;
}

.history-card-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.history-card-info {
    flex: 1;
    min-width: 0;
}

.history-card-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
    margin-bottom: 6px;
}

.history-card-details {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}

.history-tag {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    background: #f0f0f0;
    border-radius: 6px;
    color: #555;
    font-weight: 500;
}

.history-tag-fy {
    background: #00843D;
    color: #fff;
    font-weight: 700;
}

.history-card-period {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.history-card-status {
    flex-shrink: 0;
}

.history-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-end;
}

.inactive-badge {
    background: #e5e7eb !important;
    color: #6b7280 !important;
}

@media (max-width: 480px) {
    .history-filters {
        flex-direction: column;
        gap: 8px;
    }
    .history-card-main {
        flex-direction: column;
        gap: 8px;
    }
    .history-card-actions {
        flex-wrap: wrap;
    }
}

/* ============================================================
   Advanced Search Page
   ============================================================ */
.search-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.search-tab {
    flex: 1;
    padding: 12px 8px;
    border: none;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.search-tab + .search-tab {
    border-left: 1px solid var(--border);
}

.search-tab.active {
    background: var(--primary);
    color: white;
}

.search-filters-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-action-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

/* Multi-select combo dropdown */
.multi-combo {
    position: relative;
    flex: 1;
    min-width: 250px;
}
.multi-combo-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}
.multi-combo-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 14px;
    padding: 2px 8px;
    font-size: 0.78em;
    font-weight: 500;
    white-space: nowrap;
}
.multi-combo-tag button {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.1em;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}
.multi-combo-tag button:hover { color: var(--danger); }
.multi-combo-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9em;
    background: #fff;
    outline: none;
    transition: border-color 0.2s;
}
.multi-combo-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27, 99, 181, 0.1);
}
.multi-combo-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    margin-top: 4px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 320px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.multi-combo-dropdown:not(.open) { display: none; }
.multi-combo-dropdown.open { display: flex; }
.multi-combo-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
    background: #fafbfc;
}
.multi-combo-actions .search-selected-count {
    margin-left: auto;
    font-size: 0.78em;
    color: var(--primary);
    font-weight: 600;
}
.multi-combo-list {
    overflow-y: auto;
    max-height: 260px;
    padding: 4px 0;
}
.multi-combo-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 0.88em;
    transition: background 0.15s;
}
.multi-combo-option:hover { background: #f1f5f9; }
.multi-combo-option.selected { background: var(--primary-light); }
.multi-combo-check {
    font-size: 1.1em;
    color: #9ca3af;
    flex-shrink: 0;
}
.multi-combo-option.selected .multi-combo-check {
    color: var(--primary);
}
.search-filters-row-secondary {
    margin-bottom: 16px;
    max-width: 300px;
}

.export-btn {
    white-space: nowrap;
    font-size: 0.8em !important;
    padding: 8px 14px !important;
}

.export-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.search-select {
    min-width: 140px;
    flex: 1;
}

.search-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.search-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.search-hint {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 16px;
    font-size: 0.9em;
}

.search-results-count {
    font-size: 0.8em;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding: 0 4px;
}

/* Search Multi-Select Lists */
.search-people-selector,
.search-cert-selector {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 16px;
}

.search-select-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.search-selected-count {
    font-size: 0.8em;
    color: var(--text-muted);
    margin-left: auto;
}

.btn-xs {
    padding: 4px 8px !important;
    font-size: 0.75em !important;
}

.search-people-list,
.search-cert-list {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-page);
}

.search-people-item,
.search-cert-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    cursor: pointer;
    font-size: 0.85em;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.search-people-item:hover,
.search-cert-item:hover {
    background: #f0faf0;
}

.search-people-item:last-child,
.search-cert-item:last-child {
    border-bottom: none;
}

.search-people-item input[type="checkbox"],
.search-cert-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.mini-avatar.sm {
    width: 24px;
    height: 24px;
    font-size: 0.6em;
    flex-shrink: 0;
}

.search-person-bu-inline {
    font-size: 0.8em;
    color: #1565c0;
    font-weight: 400;
}

/* Search Person Cards */
.search-person-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
}

.search-person-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8faf8;
    border-bottom: 1px solid var(--border);
    gap: 10px;
    flex-wrap: wrap;
}

.search-person-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-person-bu {
    font-size: 0.8em;
    color: #1565c0;
    margin-top: 2px;
}

.search-person-stats {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.search-no-data {
    padding: 16px;
    color: var(--text-muted);
    font-size: 0.85em;
    text-align: center;
}

/* Search Detail Table */
.search-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82em;
}

.search-detail-table th {
    background: #f1f5f1;
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9em;
    white-space: nowrap;
}

.search-detail-table .filter-row th {
    padding: 4px 6px;
    background: #f8faf8;
}

.search-detail-table .col-filter {
    width: 100%;
    padding: 4px 6px;
    font-size: 0.8em;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
    color: var(--text-primary);
    box-sizing: border-box;
}

.search-detail-table .col-filter:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 169, 103, 0.15);
}

.search-detail-table td {
    padding: 8px 10px;
    border-top: 1px solid var(--border);
}

.search-detail-table tr:hover td {
    background: #f8faf8;
}

.expiring-cell {
    color: #e65100;
    font-weight: 500;
}

.expired-cell {
    color: #c62828;
    font-weight: 500;
}

/* Search Certification Groups */
.search-cert-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
}

.search-cert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f0f4ff;
    border-bottom: 1px solid var(--border);
    gap: 10px;
    flex-wrap: wrap;
}

.search-cert-stats {
    display: flex;
    gap: 6px;
}

/* Search Roadmap Cards */
.search-roadmap-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
}

.search-roadmap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f0faf0;
    border-bottom: 1px solid var(--border);
    gap: 10px;
    flex-wrap: wrap;
}

.search-roadmap-levels {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
}

.level-tag {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 500;
}

.level-tag.target {
    background: #fff3e0;
    color: #e65100;
}

.search-roadmap-progress {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
}

.search-roadmap-stats {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.progress-bar-bg {
    flex: 1;
    min-width: 80px;
    height: 8px;
    background: #e8e8e8;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s;
}

.progress-text {
    font-size: 0.8em;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .search-tabs {
        flex-direction: column;
    }
    .search-tab + .search-tab {
        border-left: none;
        border-top: 1px solid var(--border);
    }
    .search-filters-row {
        flex-direction: column;
    }
    .search-select {
        width: 100%;
    }
    .search-detail-table {
        font-size: 0.75em;
    }
    .search-detail-table th,
    .search-detail-table td {
        padding: 6px 6px;
    }
    .search-person-header,
    .search-cert-header,
    .search-roadmap-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .search-roadmap-progress {
        flex-direction: column;
        align-items: stretch;
    }
    .search-roadmap-stats {
        margin-left: 0;
    }
}

/* ============================================================
   Login Screen
   ============================================================ */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0D2B52 0%, #1B63B5 50%, #0D2B52 100%);
    z-index: 9999;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 40px 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-logo {
    margin-bottom: 24px;
}

.login-logo-img {
    height: 48px;
    width: auto;
}

.login-title {
    font-size: 1.5em;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.login-error {
    background: var(--missing-bg);
    color: var(--missing);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85em;
    margin-bottom: 16px;
    text-align: left;
}

.login-form {
    text-align: left;
}

.login-form .form-label {
    display: block;
    margin-bottom: 4px;
    margin-top: 12px;
}

.login-form .form-input {
    width: 100%;
}

.login-btn {
    width: 100%;
    margin-top: 20px;
    padding: 12px;
    font-size: 1em;
    font-weight: 600;
}

/* ============================================================
   Nav Right / User Info
   ============================================================ */
.topnav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info {
    font-size: 0.8em;
    opacity: 0.85;
    font-weight: 500;
}

.nav-logo {
    height: 24px;
    width: auto;
    filter: brightness(0) invert(1);
}

.btn-nav-outline {
    border: 1px solid rgba(255,255,255,0.3);
    background: transparent;
    color: white;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75em;
    cursor: pointer;
    transition: var(--transition);
}

.btn-nav-outline:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.6);
}

/* ============================================================
   Users Management Page
   ============================================================ */
.users-table-wrap {
    overflow-x: auto;
    margin-top: 16px;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.users-table th {
    background: var(--bg);
    color: var(--text);
    font-size: 0.75em;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid var(--border);
}

.users-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.85em;
}

.users-table tr:last-child td {
    border-bottom: none;
}

.users-table tr:hover {
    background: var(--primary-light);
}

.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
}

.role-badge.admin {
    background: var(--primary-light);
    color: var(--primary);
}

.role-badge.viewer {
    background: #F5E6F0;
    color: #C4008C;
}

/* ============================================================
   Table Column Filters (all tables)
   ============================================================ */
.filter-row th {
    padding: 4px 6px !important;
    background: var(--card-bg) !important;
    border-bottom: 2px solid var(--primary) !important;
}

.col-filter {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85em;
    background: var(--bg);
    outline: none;
    transition: var(--transition);
}

.col-filter:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 2px var(--primary-light);
}

.col-filter::placeholder {
    color: #aaa;
    font-size: 0.9em;
}

/* People table filter row */
.people-table .filter-row th {
    padding: 4px 8px !important;
    background: var(--card-bg) !important;
    border-bottom: 2px solid var(--primary) !important;
}

/* Read-only badge for viewer mode */
.readonly-banner {
    background: #FFF3CD;
    color: #856404;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85em;
    text-align: center;
    margin-bottom: 16px;
    border: 1px solid #FFEEBA;
}

@media (max-width: 600px) {
    .login-card {
        margin: 16px;
        padding: 32px 24px;
    }
    .topnav-right {
        gap: 6px;
    }
    .user-info {
        display: none;
    }
}
}
