
/* ================================================================
   ORG-LEVEL BRANDING — CSS Variables
   Defaults are FDIC-branded; overridden dynamically on init.
   ================================================================ */
:root {
    --primary-color: #003256;
    --secondary-color: #004a7c;
    --fdic-gold: #FDB736;
    --text-color: #333333;
    --light-gray: #F5F5F5;
    --org-primary: #003256;
    --org-primary-light: #004a7c;
    --org-accent: #0071bc;
    --org-secondary: #54585a;
    --org-bg: #f4f6f8;
    --org-surface: #ffffff;
    --org-border: #dde2e8;
    --org-text: #1a1a2e;
    --org-text-muted: #5a6474;
    --org-green: #2e8540;
    --org-red: #c0392b;
    --org-orange: #e67e22;
    --org-light-gray: #f1f3f5;
    --radius: 6px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --transition: 0.2s ease;
}

/* ================================================================
   RESET & BASE
   ================================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: var(--org-bg);
    color: var(--org-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ================================================================
   LOADING OVERLAY
   ================================================================ */
.loading-overlay {
    position: fixed; inset: 0;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    flex-direction: column;
    gap: 16px;
}
.loading-overlay.active { display: flex; }

.spinner {
    width: 44px; height: 44px;
    border: 4px solid var(--org-border);
    border-top-color: var(--org-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.loading-overlay span {
    color: var(--org-text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================================
   STANDARD HEADER (matches adminportal.html)
   ================================================================ */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    height: 50px;
    border-radius: 6px;
    transition: transform 0.3s ease;
    object-fit: contain;
}

.logo:hover {
    transform: scale(1.05);
}

.header-text {
    flex-grow: 1;
}

.header-text h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
    color: white;
    letter-spacing: 0;
}

.user-welcome {
    font-size: 0.95rem;
    opacity: 0.95;
    margin-top: 0.25rem;
}

.signout-btn {
    background-color: white;
    color: var(--primary-color);
    padding: 0.65rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
}

.signout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* ================================================================
   STANDARD NAV (matches adminportal.html)
   ================================================================ */
nav {
    background: var(--primary-color);
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 0.6rem 1.25rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    background-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-size: 0.95rem;
}

nav a:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

nav a.active {
    background-color: var(--fdic-gold);
    color: var(--primary-color);
    font-weight: 600;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--org-light-gray);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--org-text-muted);
}
.user-badge span { color: var(--org-primary); }

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--org-primary);
    color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--org-primary-light); }

.btn-secondary {
    background: transparent;
    color: var(--org-primary);
    border: 1.5px solid var(--org-primary);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--org-primary);
    color: #fff;
}

.btn-success {
    background: var(--org-green);
    color: #fff;
}
.btn-success:hover:not(:disabled) { background: #236b33; }

.btn-danger {
    background: var(--org-red);
    color: #fff;
}
.btn-danger:hover:not(:disabled) { opacity: 0.85; }

.btn-ghost {
    background: transparent;
    color: var(--org-text-muted);
    padding: 6px 10px;
}
.btn-ghost:hover { color: var(--org-primary); background: var(--org-light-gray); }

.btn-sm { padding: 5px 12px; font-size: 0.8rem; }

/* ================================================================
   PAGE LAYOUT
   ================================================================ */
.page-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

.page-header {
    margin-bottom: 28px;
}
.page-header h1 {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--org-primary);
    letter-spacing: -0.02em;
}
.page-header p {
    color: var(--org-text-muted);
    margin-top: 4px;
    font-size: 0.95rem;
}

/* ================================================================
   SECTION CARDS
   ================================================================ */
.section {
    background: var(--org-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--org-border);
    flex-wrap: wrap;
    gap: 12px;
}

.section-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--org-text);
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-header h2 > span:first-child {
    color: var(--org-primary);
    font-size: 1rem;
}

.section-body {
    padding: 24px;
}

.section-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ================================================================
   ADMIN TABS
   ================================================================ */
.admin-tabs {
    display: flex;
    gap: 2px;
    background: var(--org-light-gray);
    padding: 4px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.admin-tab {
    padding: 10px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--org-text-muted);
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
}
.admin-tab:hover { color: var(--primary-color); }
.admin-tab.active {
    background: var(--primary-color);
    color: #fff;
}
.admin-tab span { font-size: 0.85rem; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ================================================================
   NAV TABS (header)
   ================================================================ */
.nav-tabs {
    display: flex;
    gap: 2px;
    background: var(--org-light-gray);
    padding: 4px;
    border-radius: var(--radius);
}
.nav-tab {
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--org-text-muted);
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}
.nav-tab:hover { color: var(--org-primary); }
.nav-tab.active {
    background: var(--org-primary);
    color: #fff;
}

/* ================================================================
   DATA TABLE
   ================================================================ */
.data-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.data-table th {
    text-align: left;
    padding: 10px 14px;
    background: var(--org-light-gray);
    font-weight: 600;
    color: var(--org-text);
    border-bottom: 2px solid var(--org-border);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
.data-table th:hover { color: var(--org-primary); }
.data-table th .sort-icon { margin-left: 4px; font-size: 0.7rem; opacity: 0.4; }
.data-table th.sorted .sort-icon { opacity: 1; color: var(--org-primary); }

.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--org-border);
    color: var(--org-text);
    vertical-align: middle;
}
.data-table tr:hover td { background: var(--org-light-gray); }

.data-table .actions-cell {
    white-space: nowrap;
}
.data-table .actions-cell .actions-wrap {
    display: inline-flex;
    gap: 6px;
}

/* ================================================================
   BADGES
   ================================================================ */
.comp-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.comp-badge.leadership { background: rgba(0,51,102,0.15); color: var(--org-primary); }
.comp-badge.technical { background: rgba(46,133,64,0.15); color: var(--org-green); }
.comp-badge.active { background: rgba(46,133,64,0.15); color: var(--org-green); }
.comp-badge.inactive { background: rgba(192,57,43,0.15); color: var(--org-red); }

.profile-comps-table-wrap { overflow-x: auto; }
.profile-comps-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.profile-comps-table th {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 2px solid var(--org-border);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--org-text-muted);
}
.profile-comps-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--org-border);
}
.level-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: capitalize;
}
.level-badge.basic { background: rgba(0,51,102,0.12); color: var(--org-primary); }
.level-badge.intermediate { background: rgba(46,133,64,0.12); color: var(--org-green); }
.level-badge.advanced { background: rgba(253,183,54,0.2); color: #b8860b; }
.level-badge.expert { background: rgba(192,57,43,0.12); color: var(--org-red); }

.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: var(--org-primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
}

/* ================================================================
   FILTERS
   ================================================================ */
.filters-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 14px 0;
    flex-wrap: wrap;
}

.filter-input, .filter-select {
    padding: 8px 12px;
    border: 1.5px solid var(--org-border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--org-text);
    background: var(--org-surface);
    transition: border-color var(--transition);
}
.filter-input:focus, .filter-select:focus {
    outline: none;
    border-color: var(--org-primary);
    box-shadow: 0 0 0 3px rgba(0,51,102,0.1);
}
.filter-input { min-width: 220px; }
.filter-select { min-width: 160px; }

/* ================================================================
   MODAL
   ================================================================ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: flex-start;
    z-index: 5000;
    padding: 40px 20px;
    overflow-y: auto;
}
.modal-overlay.active { display: flex; }

.modal {
    background: var(--org-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 640px;
    animation: modalIn 0.2s ease-out;
}
@keyframes modalIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
}
.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
}
.modal-close {
    background: rgba(255,255,255,0.15);
    border: none;
    font-size: 1.2rem;
    color: #ffffff;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all var(--transition);
}
.modal-close:hover { background: rgba(255,255,255,0.3); color: #fff; }

.modal-body {
    padding: 24px;
}

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

/* ================================================================
   FORM FIELDS
   ================================================================ */
.form-group {
    margin-bottom: 18px;
}
.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--org-text);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 6px;
}
.form-group label .required { color: var(--org-red); }

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--org-border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--org-text);
    background: var(--org-surface);
    transition: border-color var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--org-primary);
    box-shadow: 0 0 0 3px rgba(0,51,102,0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-help {
    font-size: 0.78rem;
    color: var(--org-text-muted);
    margin-top: 4px;
}

.modal-wide { max-width: 820px; }

.modal-body-scroll {
    max-height: 70vh;
    overflow-y: auto;
}

.form-fieldset {
    border: 1.5px solid var(--org-border);
    border-radius: var(--radius);
    padding: 16px 18px 8px;
    margin-bottom: 18px;
}
.form-fieldset legend {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--org-primary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0 8px;
}

.list-input-group { margin-bottom: 10px; }
.list-input-group .list-items { margin-bottom: 6px; }
.list-input-group .list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    padding: 4px 8px;
    background: var(--org-light-gray);
    border-radius: 4px;
    font-size: 0.85rem;
}
.list-input-group .list-item .remove-item {
    background: none;
    border: none;
    color: var(--org-text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0 4px;
}
.list-input-group .list-item .remove-item:hover { color: var(--org-red); }
.list-input-group .add-row {
    display: flex;
    gap: 8px;
}
.list-input-group .add-row input { flex: 1; }
.list-input-group .add-row button {
    padding: 6px 12px;
    font-size: 0.82rem;
}

/* ================================================================
   INFO GRID (stats)
   ================================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    padding: 14px 16px;
    background: var(--org-light-gray);
    border-radius: var(--radius);
    border-left: 3px solid var(--org-primary);
    text-align: center;
}
.stat-card label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--org-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}
.stat-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--org-primary);
}

/* ================================================================
   EMPTY STATE
   ================================================================ */
.empty-state {
    text-align: center;
    padding: 32px;
    color: var(--org-text-muted);
    font-size: 0.9rem;
}
.empty-state span {
    display: block;
    font-size: 2rem;
    margin-bottom: 10px;
    opacity: 0.4;
}

/* ================================================================
   TOGGLE SWITCH
   ================================================================ */
.toggle-setting {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 0;
}
.toggle-setting + .toggle-setting {
    border-top: 1px solid var(--org-border, #e0e0e0);
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #ccc;
    border-radius: 24px;
    transition: background 0.25s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--primary-color, #1a5276);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}
.toggle-label h4 {
    margin: 0 0 4px 0;
    font-size: 0.92rem;
    font-weight: 600;
}
.toggle-label p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--org-text-muted, #6c757d);
    line-height: 1.45;
}

/* ================================================================
   TOAST NOTIFICATIONS
   ================================================================ */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 500;
    z-index: 10001;
    animation: toastIn 0.3s ease-out;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.toast.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.toast.error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.toast.warning { background: #fff3cd; color: #856404; border: 1px solid #ffc107; }

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ================================================================
   INDICATOR CHIPS (for mappings)
   ================================================================ */
.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: rgba(0,51,102,0.06);
    border: 1px solid rgba(0,51,102,0.15);
    border-radius: 14px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--org-primary);
}
.chip .remove-chip {
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--org-red);
    margin-left: 2px;
    line-height: 1;
}
.chip .remove-chip:hover { opacity: 0.7; }

/* ================================================================
   BULK UPLOAD AREA
   ================================================================ */
.upload-area {
    border: 2px dashed var(--org-border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--org-light-gray);
}
.upload-area:hover, .upload-area.dragover {
    border-color: var(--org-primary);
    background: rgba(0,51,102,0.03);
}
.upload-area span {
    font-size: 2rem;
    color: var(--org-primary);
    margin-bottom: 10px;
    display: block;
}
.upload-area p {
    color: var(--org-text-muted);
    font-size: 0.9rem;
}
.upload-area .upload-hint {
    font-size: 0.78rem;
    color: var(--org-text-muted);
    margin-top: 6px;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
    .header-content { flex-direction: column; align-items: flex-start; gap: 1rem; }
    nav a { width: 100%; text-align: center; }
    .section-header { flex-direction: column; align-items: flex-start; }
    .section-actions { width: 100%; }
    .admin-tabs { overflow-x: auto; flex-wrap: nowrap; }
    .data-table { font-size: 0.82rem; }
    .data-table th, .data-table td { padding: 8px 10px; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .filter-input { min-width: 100%; }
    .modal { max-width: 100%; }
}

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

/* ================================================================
   PRINT
   ================================================================ */
@media print {
    header, nav, .admin-tabs, .section-actions, .btn, .filters-bar { display: none !important; }
    .section { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}
