/* ═══════════════════════════════════════════════════════════════════════════
   FICAP – Global Styles
   Font: Inter (loaded via Google Fonts in App.razor)
   Primary: #3b82f6  |  Client: light  |  Admin: dark (#0f172a sidebar)
═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Variables (overridden per-company via injected <style>) ─────────── */
:root {
    --primary:       #3b82f6;
    --primary-dark:  #2563eb;
    --primary-light: #eff6ff;
    --primary-ring:  #93c5fd;
    --primary-rgb:   59, 130, 246;
    color-scheme: light;
}

/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1e293b;
    background: #f8fafc;
    margin: 0; padding: 0;
    height: 100%;
    overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }

/* ── Typography ──────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.3; margin: 0; }
.page-title       { font-size: 20px; font-weight: 700; color: #0f172a; }
.page-subtitle    { font-size: 13px; color: #64748b; margin-top: 2px; }

/* ── Layout Shell ────────────────────────────────────────────────────────── */
.ficap-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar (CLIENT – light) ────────────────────────────────────────────── */
.sidebar {
    width: 230px;
    min-width: 230px;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    z-index: 100;
    transition: width 0.22s cubic-bezier(.4,0,.2,1), min-width 0.22s cubic-bezier(.4,0,.2,1);
}

.sidebar-collapsed {
    width: 0 !important;
    min-width: 0 !important;
    border-right: none;
}

.sidebar-dimmed {
    filter: brightness(0.55);
    pointer-events: none;
    user-select: none;
}

/* Desktop sidebar collapse button */
.sidebar-collapse-btn {
    width: 34px; height: 34px;
    border: none; background: transparent;
    border-radius: 8px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #64748b; flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.sidebar-collapse-btn:hover { background: #f1f5f9; color: #1e293b; }


.sidebar-logo {
    padding: 16px 20px;
    border-bottom: none;
    display: flex;
    align-items: center;
    gap: 10px;
}


.sidebar-logo img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.sidebar-logo-text {
    font-size: 11px;
    color: #64748b;
    line-height: 1.3;
}

.sidebar-nav { flex: 1; padding: 8px 0; }

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    padding: 12px 20px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    margin: 2px 10px;
    color: #475569;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    border-radius: 8px;
    text-decoration: none;
    white-space: nowrap;
}

.nav-item:hover { background: #f1f5f9; color: #1e293b; text-decoration: none; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.nav-item.active .nav-icon { stroke: #fff; }
.nav-item .nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.nav-item .badge-coming {
    font-size: 9px; font-weight: 600;
    background: #f59e0b; color: #fff;
    padding: 1px 6px; border-radius: 20px;
    margin-left: auto;
}

.nav-item .badge-register {
    font-size: 8px; font-weight: 700;
    background: transparent;
    color: #d97706;
    padding: 2px 7px;
    border-radius: 4px;
    border: 1.5px solid #d97706;
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.4;
}

.nav-item.active .badge-register {
    color: rgba(255,255,255,0.9);
    border-color: rgba(255,255,255,0.65);
}

.nav-sub { padding-left: 18px; }

.nav-chevron {
    margin-left: auto;
    transition: transform 0.2s;
    width: 14px; height: 14px;
}

.nav-chevron.open { transform: rotate(90deg); }

/* Sidebar user footer */
.sidebar-user {
    padding: 12px 16px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 12px; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.user-info { overflow: hidden; }
.user-name { font-size: 13px; font-weight: 600; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 11px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Sidebar (ADMIN – light) ─────────────────────────────────────────────── */
.sidebar-admin {
    background: #fff;
    border-right: 1px solid #e2e8f0;
}

/* ── Main content area ───────────────────────────────────────────────────── */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f8fafc;
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 24px;
    gap: 12px;
    flex-shrink: 0;
}

.topbar-admin { background: #fff; border-bottom-color: #e2e8f0; }

.topbar-btn {
    width: 36px; height: 36px;
    border: none; background: transparent;
    border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #475569;
    transition: background 0.15s;
    position: relative;
}

.topbar-btn:hover { background: #f1f5f9; }
.topbar-admin .topbar-btn { background: transparent; color: #475569; }
.topbar-admin .topbar-btn:hover { background: #f1f5f9; }

.notif-badge {
    position: absolute; top: 5px; right: 5px;
    width: 8px; height: 8px;
    background: #ef4444; border-radius: 50%;
    border: 2px solid #fff;
}

.topbar-admin .notif-badge { border-color: #fff; }

.topbar-user {
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; padding: 4px 8px; border-radius: 8px;
    transition: background 0.15s;
}

.topbar-user:hover { background: #f1f5f9; }
.topbar-admin .topbar-user:hover { background: #f1f5f9; }
.topbar-user-name { font-size: 13px; font-weight: 500; color: #1e293b; }

/* ── User dropdown popup ─────────────────────────────────────────────────── */
.al-popup-item {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 16px;
    color: #374151; font-size: 13.5px; font-weight: 500;
    text-decoration: none;
    transition: background 0.12s;
}
.al-popup-item:hover { background: #f8fafc; color: #1e293b; text-decoration: none; }
.al-popup-item-danger { color: #ef4444; }
.al-popup-item-danger:hover { background: #fef2f2; color: #dc2626; }

/* ── Page content ────────────────────────────────────────────────────────── */
.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

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

.page-header-left { display: flex; align-items: center; gap: 12px; }
.page-header-icon {
    width: 50px; height: 50px;
    background: var(--primary-light); border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: var(--primary);
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}

.card-title { font-size: 16px; font-weight: 700; color: #1e293b; letter-spacing: -0.1px; }
.card-subtitle { font-size: 12px; color: #64748b; }

/* ── Stat cards ──────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 0; }

.stat-card {
    background: #fff;
    border: 1px solid #e8edf2;
    border-radius: 14px;
    padding: 18px 20px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s;
}

.stat-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.10); }
.stat-label { font-size: 13px; font-weight: 500; color: #64748b; margin-bottom: 4px; white-space: nowrap; }
.stat-value { font-size: 26px; font-weight: 700; color: #1e293b; line-height: 1; }

.stat-icon {
    width: 46px; height: 46px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.stat-icon-blue   { background: var(--primary); color: #fff; }
.stat-icon-orange { background: #f97316; color: #fff; }
.stat-icon-purple { background: #7c3aed; color: #fff; }
.stat-icon-indigo { background: #6366f1; color: #fff; }
.stat-icon-teal   { background: #14b8a6; color: #fff; }

/* ── Welcome banner ──────────────────────────────────────────────────────── */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 12px;
    padding: 34px 28px;
    color: #fff;
    margin-bottom: 20px;
}

.welcome-banner h2 { font-size: 26px; font-weight: 800; margin: 0 0 6px; letter-spacing: -0.3px; }
.welcome-banner p { font-size: 14px; font-weight: 400; opacity: 0.9; margin: 0; }

/* ── Risk distribution ───────────────────────────────────────────────────── */
.risk-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

.risk-card {
    background: #f8fafc;
    border: 1px solid #e8edf2;
    border-radius: 14px;
    padding: 20px 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}

.risk-icon { font-size: 32px; margin-bottom: 8px; }
.risk-count { font-size: 26px; font-weight: 700; margin: 10px 0 4px; }
.risk-label { font-size: 12px; color: #64748b; }

.risk-count-high   { color: #ef4444; }
.risk-count-medium { color: #f59e0b; }
.risk-count-low    { color: #22c55e; }

.risk-circle {
    width: 64px; height: 64px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto;
}
.risk-circle-high   { background: #fef2f2; color: #ef4444; stroke: #ef4444; }
.risk-circle-medium { background: #fffbeb; color: #f59e0b; stroke: #f59e0b; }
.risk-circle-low    { background: #f0fdf4; color: #22c55e; stroke: #22c55e; }
.risk-circle svg    { stroke: inherit; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 500;
    white-space: nowrap;
}

.badge-risk-high   { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }
.badge-risk-medium { background: #fef3c7; color: #d97706; border: 1px solid #fcd34d; }
.badge-risk-low    { background: #dcfce7; color: #16a34a; border: 1px solid #86efac; }
.badge-risk-none   { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }

.badge-status-new    { background: var(--primary-light); color: var(--primary); }
.badge-status-sent   { background: #f5f3ff; color: #7c3aed; }
.badge-status-bureau { background: #fef3c7; color: #d97706; }
.badge-status-live   { background: #dcfce7; color: #16a34a; }

/* ── Tables / Grids ──────────────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    font-family: inherit;
}

.data-table th {
    height: 42px;
    padding: 0 0.5rem;
    font-size: 12.5px;
    font-weight: 500;
    color: #6b7280;
    text-align: left;
    vertical-align: middle;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.data-table td {
    padding: 0.5rem;
    font-size: 0.9375rem;
    font-family: inherit;
    color: #000;
    vertical-align: middle;
    border-bottom: 1px solid #e5e7eb;
}

.data-table .table-row { border-bottom: 1px solid #e5e7eb; transition: color 0.15s, background-color 0.15s; }
.data-table .table-row:hover { background: #f8fafc; }
.data-table tr:last-child td { border-bottom: none; }

.data-table .td-name  { font-weight: 600; color: #000; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
.data-table .td-mono  { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-variant-numeric: tabular-nums; color: #000; }
.data-table .td-muted { color: #000; }
.data-table .td-date  { color: #000; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-variant-numeric: tabular-nums; }
.data-table .td-sub   { font-size: 12px; color: #9ca3af; }

/* Status icons (verified/not-verified) */
.status-icon { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.icon-verified     { color: #22c55e; display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.icon-not-verified { color: #ef4444; display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.icon-pending      { color: #d1d5db; display: inline-flex; align-items: center; justify-content: center; line-height: 0; }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabs-card {
    background: #fff;
    border: 1px solid #e8edf2;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    margin-bottom: 16px;
    padding: 6px;
}

.tabs {
    display: flex;
    border-radius: 10px;
    gap: 4px;
    padding: 4px;
    background: #f1f5f9;
}

.tab-item {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    flex: 1;
    padding: 5px 16px;
    font-size: 13.5px; font-weight: 500;
    color: #64748b;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    text-decoration: none;
}
.tab-item svg { transition: color 0.15s, stroke 0.15s; }
.tab-item:hover { background: #e8edf2; color: #334155; }
.tab-item.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,0.10); text-decoration: none; }
.tab-item.active svg { color: var(--primary); }
.tab-item:hover, .tab-item:focus, .tab-item:active { text-decoration: none; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 16px;
    border-radius: 8px;
    font-size: 14px; font-weight: 500;
    border: 1px solid transparent; cursor: pointer;
    transition: background 0.15s, opacity 0.15s, box-shadow 0.15s;
    white-space: nowrap;
    text-decoration: none;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn:hover:not(:disabled) { filter: brightness(0.96); text-decoration: none !important; }
.btn { text-decoration: none !important; }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); filter: none; }

.btn-secondary { background: #fff; color: #1e293b; border-color: #e2e8f0; }
.btn-secondary:hover:not(:disabled) { background: #e9eef4; border-color: #cbd5e1; filter: none; }

.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-danger:hover:not(:disabled) { background: #fecaca; filter: none; }

.btn-success { background: #dcfce7; color: #16a34a; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.btn-full { width: 100%; justify-content: center; }

.btn-dark { background: var(--primary); color: #fff; }
.btn-dark:hover:not(:disabled) { background: var(--primary-dark); filter: none; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 13px; font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.form-label .required { color: #ef4444; margin-left: 2px; }
.req { color: #ef4444; }

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13.5px;
    font-family: inherit;
    color: #1e293b;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-control.is-invalid,
.form-control.input-error { border-color: #ef4444; }
.form-control.is-invalid:focus,
.form-control.input-error:focus { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1); }

.form-error, .field-error {
    font-size: 12px; color: #dc2626;
    margin-top: 4px;
}

.form-select {
    width: 100%;
    padding: 9px 32px 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13.5px;
    font-family: inherit;
    color: #1e293b;
    background: #fff;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-section { padding: 16px; border: 1px solid #f1f5f9; border-radius: 10px; margin-bottom: 16px; }
.form-section-title { font-size: 13px; font-weight: 600; color: #1e293b; margin-bottom: 12px; }

/* ── Modal / Dialog ──────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.15s ease;
}

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

.modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    animation: slideUp 0.2s ease;
}

@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-lg { max-width: 720px; }

.modal-header {
    padding: 20px 24px 0;
    display: flex; align-items: flex-start; justify-content: space-between;
}

.modal-header-left { display: flex; align-items: center; gap: 12px; }
.modal-icon {
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--primary-light); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
}

.modal-title { font-size: 16px; font-weight: 700; color: #0f172a; }
.modal-subtitle { font-size: 12.5px; color: #64748b; margin-top: 2px; }

.modal-close {
    width: 32px; height: 32px;
    background: #f1f5f9; border: none; border-radius: 8px;
    cursor: pointer; color: #64748b;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}

.modal-close:hover { background: #e2e8f0; color: #1e293b; }

.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #f1f5f9;
    display: flex; justify-content: flex-end; gap: 10px;
}

/* ── Search bar ──────────────────────────────────────────────────────────── */
.search-bar {
    position: relative;
    display: flex; align-items: center;
}

.search-bar svg {
    position: absolute; left: 12px;
    color: #94a3b8;
    pointer-events: none;
}

.search-input {
    width: 100%; padding: 9px 12px 9px 36px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13.5px; font-family: inherit;
    color: #1e293b; background: #fff;
    outline: none;
    transition: border-color 0.15s;
}

.search-input:focus { border-color: var(--primary); }

/* ── Notifications panel ─────────────────────────────────────────────────── */
.notif-panel {
    position: fixed; top: 56px; right: 24px;
    width: 360px; max-height: 480px;
    background: #fff; border: 1px solid #e2e8f0;
    border-radius: 12px; overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    z-index: 500;
    display: flex; flex-direction: column;
}

.notif-panel-header {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 600; font-size: 14px;
}

.notif-list { overflow-y: auto; flex: 1; }

.notif-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #f8fafc;
    cursor: pointer;
    transition: background 0.15s;
}

.notif-item:hover { background: #f8fafc; }
.notif-item.unread { background: #f0f9ff; }

.notif-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--primary); margin-top: 5px; flex-shrink: 0;
}

.notif-item-title { font-size: 13px; font-weight: 600; color: #1e293b; }
.notif-item-body  { font-size: 12px; color: #64748b; margin-top: 2px; }
.notif-item-time  { font-size: 11px; color: #94a3b8; margin-top: 4px; }

/* ── Toolbar row ─────────────────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-left  { display: flex; gap: 10px; flex: 1; }
.toolbar-right { display: flex; gap: 8px; }

/* ── Filters ─────────────────────────────────────────────────────────────── */
.filter-select {
    padding: 8px 28px 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px; font-family: inherit;
    color: #374151; background: #fff;
    cursor: pointer; outline: none;
    -webkit-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* ── Action buttons in table ─────────────────────────────────────────────── */
.action-btn-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.action-btn {
    width: 30px; height: 30px;
    border: none; background: transparent;
    border-radius: 6px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    color: #64748b;
    transition: background 0.15s, color 0.15s;
}

.action-btn:hover { background: #f1f5f9; color: #1e293b; }
.action-btn.danger:hover { background: #fee2e2; color: #dc2626; }

/* ── Linked individuals row ──────────────────────────────────────────────── */
.linked-member-row {
    display: grid; grid-template-columns: 1fr 1fr auto;
    gap: 10px; align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}

.linked-member-row:last-child { border-bottom: none; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #94a3b8;
}

.empty-state svg { width: 48px; height: 48px; opacity: 0.4; margin-bottom: 12px; }
.empty-state p { font-size: 14px; margin: 0; }

/* ── Skeleton loader ─────────────────────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 6px;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-row { height: 48px; margin-bottom: 4px; }
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text-sm { height: 10px; width: 60%; margin-bottom: 8px; }

/* ── Document card ───────────────────────────────────────────────────────── */
.doc-card {
    display: flex; align-items: center;
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    gap: 12px;
    transition: box-shadow 0.15s;
}

.doc-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.06); }

.doc-icon {
    width: 40px; height: 40px;
    background: var(--primary-light);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.doc-info { flex: 1; overflow: hidden; }
.doc-name { font-size: 13.5px; font-weight: 600; color: #1e293b; }
.doc-meta { font-size: 12px; color: #94a3b8; margin-top: 2px; }
.doc-actions { display: flex; gap: 8px; }

/* ── Login page ──────────────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 50%, #f5f3ff 100%);
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.10);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo img { width: 60px; height: 60px; object-fit: contain; }
.login-title { font-size: 22px; font-weight: 700; text-align: center; color: #0f172a; margin-bottom: 6px; }
.login-subtitle { font-size: 13px; color: #64748b; text-align: center; margin-bottom: 28px; }

.password-wrapper { position: relative; }
.password-toggle {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; color: #94a3b8;
    padding: 4px; display: flex; align-items: center;
}

.password-toggle:hover { color: #475569; }

/* ── Alert ───────────────────────────────────────────────────────────────── */
.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}

.alert-danger, .alert-error { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }
.alert-success { background: #dcfce7; color: #16a34a; border: 1px solid #86efac; }
.alert-info    { background: var(--primary-light); color: var(--primary); border: 1px solid #93c5fd; }
.alert-warning { background: #fffbeb; color: #d97706; border: 1px solid #fcd34d; }

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.spinner {
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

.spinner-primary { border-color: rgba(var(--primary-rgb),0.3); border-top-color: var(--primary); }

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

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid #f1f5f9;
    font-size: 13px; color: #64748b;
}

.pagination-btns { display: flex; gap: 4px; }

.page-btn {
    width: 32px; height: 32px;
    border: 1px solid #e2e8f0;
    border-radius: 6px; background: #fff;
    cursor: pointer; font-size: 13px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}

.page-btn:hover { background: #f1f5f9; }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Admin stat card (light) ─────────────────────────────────────────────── */
.admin-stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 20px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: box-shadow 0.2s;
    gap: 8px;
    min-height: 120px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.admin-stat-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,0.12); }
.admin-stat-card .stat-label { font-size: 13px; font-weight: 500; color: #64748b; margin-bottom: 4px; white-space: nowrap; }
.admin-stat-card .stat-value { font-size: 28px; font-weight: 800; color: #0f172a; line-height: 1; }

.stat-icon-box {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* ── Table row hover ─────────────────────────────────────────────────────── */
.table-row-hover:hover td,
.table-row-hover:hover { background: #f8fafc; }

/* ── Button label (hidden on mobile, visible on desktop) ─────────────────── */
.btn-label { display: inline; }

/* ── Utility ─────────────────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-16 { margin-bottom: 16px; }
.text-muted { color: #94a3b8; }
.text-sm    { font-size: 12px; }
.text-danger { color: #dc2626; }
.fw-600 { font-weight: 600; }
.d-none { display: none; }

/* ── Mobile-only: flex-between stacks vertically ──────────────────────────── */
@media (max-width: 600px) {
    .flex-between { flex-wrap: wrap; gap: 10px; }
}

/* ── Hamburger toggle (mobile only) ─────────────────────────────────────── */
.sidebar-toggle {
    display: none;
    width: 36px; height: 36px;
    border: none; background: transparent;
    border-radius: 8px; cursor: pointer;
    color: #475569;
    align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
    margin-right: 4px;
}
.sidebar-toggle:hover { background: #f1f5f9; }

/* ── Sidebar overlay backdrop ────────────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15,23,42,0.45);
    z-index: 299;
    backdrop-filter: blur(2px);
}

/* ── Responsive Grid Utilities ───────────────────────────────────────────── */
.grid-2col    { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3col    { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.grid-4col    { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid-2fr-1fr { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

/* ── Responsive: Tablet (≤ 1024px) ──────────────────────────────────────── */
@media (max-width: 1024px) {
    .stats-grid    { grid-template-columns: repeat(2, 1fr); }
    .risk-grid     { grid-template-columns: repeat(4, 1fr); }
    .page-content  { padding: 18px; }
    .al-content    { padding: 18px; }
    .card          { padding: 16px; }
    .grid-3col     { grid-template-columns: repeat(2, 1fr); }
    .grid-4col     { grid-template-columns: repeat(2, 1fr); }
    .grid-2fr-1fr  { grid-template-columns: 1fr; }
}

/* ── Responsive: Mobile (≤ 768px) ───────────────────────────────────────── */
@media (max-width: 768px) {
    .welcome-banner {
        padding: 36px;
    }

    /* Client sidebar: slide-in overlay */
    .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        z-index: 300;
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(.4,0,.2,1);
        box-shadow: 4px 0 32px rgba(0,0,0,.18);
    }
    .sidebar.sidebar-open  { transform: translateX(0); }
    /* Also restore label visibility inside mobile overlay */
    .sidebar-overlay { display: block; }
    .sidebar-collapse-btn { display: none; }

    /* Admin sidebar: same slide-in */
    .al-sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        z-index: 300;
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(.4,0,.2,1);
        box-shadow: 4px 0 32px rgba(0,0,0,.18);
    }
    .al-sidebar.sidebar-open { transform: translateX(0); }

    /* Main area fills full width */
    .main-area { width: 100%; }
    .al-body   { width: 100%; }

    /* Topbar adjustments */
    .topbar           { padding: 0 12px; justify-content: flex-start; }
    .topbar-user-name { display: none; }
    .al-topbar        { padding: 0 12px; }
    .al-topbar-username { display: none; }

    /* Notification panel: full width on mobile */
    .notif-panel { left: 8px; right: 8px; width: auto; min-width: 0; }

    /* Grids */
    .stats-grid  { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .risk-grid   { grid-template-columns: repeat(4, 1fr); gap: 8px; }
    .risk-card   { padding: 12px 6px; }
    .grid-2col   { grid-template-columns: 1fr; }
    .grid-3col   { grid-template-columns: 1fr; }
    .grid-4col   { grid-template-columns: repeat(2, 1fr); }
    .grid-2fr-1fr { grid-template-columns: 1fr; }

    /* Cards & content */
    .card         { padding: 14px; }
    .stat-card    { padding: 14px; }
    .page-content { padding: 1.5rem 1.5rem 12px; }
    .al-content   { padding: 12px; }

    /* Tabs: horizontal scroll so items don't squish */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        scrollbar-width: none;
        padding-bottom: 2px;
    }
    .tabs::-webkit-scrollbar { display: none; }
    .tab-item { flex: 0 0 auto; min-width: fit-content; }

    /* Linked member rows: Full Name spans full width; ID Number + × sit side by side */
    .linked-member-row {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 8px;
    }
    .linked-member-row > input:nth-child(1) { grid-column: 1 / 3; }
    .linked-member-row > input:nth-child(2) { grid-column: 1; }
    .linked-member-row > button.action-btn  { grid-column: 2; align-self: center; }

    /* Table containers: allow horizontal scroll */
    .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Page header: keep in one row, title shrinks */
    .page-header { align-items: center; gap: 8px; }
    .page-header-left { min-width: 0; flex: 1; }
    .page-title  { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

    /* Pagination wraps on small screens */
    .pagination { flex-wrap: wrap; gap: 4px; }
    .pagination-btns { flex-wrap: wrap; }

    /* Buttons: icon-only on mobile */
    .btn-label { display: none; }
    .btn { min-width: 36px; justify-content: center; }

    /* Vertical scroll fix */
    .al-content   { overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .page-content { overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .al-shell     { height: 100dvh; }
    .ficap-shell  { height: 100dvh; }

    /* Search bar: full width */
    .search-input { font-size: 14px; }

    /* Filter row: wrap filters below search */
    .toolbar-left { flex-wrap: wrap; }
    .toolbar-right { flex-wrap: wrap; }

    /* Stat cards: keep two per row but allow text wrap */
    .stat-label { white-space: normal; }
    .admin-stat-card { padding: 14px; min-height: auto; gap: 6px; }
    .admin-stat-card .stat-label { white-space: normal; font-size: 12px; }
    .admin-stat-card .stat-value { font-size: 22px; }
    .stat-icon-box { width: 36px; height: 36px; }
    .stat-icon-box svg { width: 18px; height: 18px; }

    /* Page header: stack vertically */
    .page-header { align-items: center; gap: 8px; }

    /* Toolbar: wrap filters */
    .toolbar { flex-wrap: wrap; gap: 8px; }

    /* Forms */
    .form-row { grid-template-columns: 1fr; }

    /* Tables: horizontal scroll */
    .data-table       { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table-container  { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Modals: full-width */
    .modal { max-width: calc(100vw - 16px); margin: 8px; border-radius: 12px; }

    /* Buttons: slightly tighter */
    .btn    { padding: 8px 14px; font-size: 12.5px; }
    .btn-sm { padding: 5px 10px; font-size: 11px; }

    /* Welcome banner */
    .welcome-banner { padding: 36px; }
    .welcome-banner h2 { font-size: 1.5rem; }

    /* Pagination */
    .pagination { flex-wrap: wrap; gap: 4px; }
}

/* ── Responsive: Mobile S (≤ 480px) ─────────────────────────────────────── */
@media (max-width: 480px) {
    .stats-grid   { grid-template-columns: repeat(2, 1fr); }
    .risk-grid    { grid-template-columns: repeat(4, 1fr); }
    .grid-4col    { grid-template-columns: repeat(2, 1fr); }
    .page-content { padding: 1.5rem 1.5rem 8px; }
    .al-content   { padding: 8px; }
    .card         { padding: 12px; }
    .stat-card    { padding: 12px; height: auto; min-height: 90px; }
    .modal        { max-width: calc(100vw - 8px); margin: 4px; padding: 16px; }
    .modal-body   { padding: 16px; }
    .modal-header { padding: 16px 16px 0; }
    .modal-footer { padding: 12px 16px; }
    .page-header h1, .page-header h2 { font-size: 18px; }
    .page-title   { font-size: 17px; }
    .btn          { padding: 7px 12px; font-size: 12px; }
    .stat-label   { white-space: normal; font-size: 12px; }
    .stat-value   { font-size: 22px; }
    .stat-icon    { width: 38px; height: 38px; }
    .welcome-banner { padding: 26px; }
    .welcome-banner h2 { font-size: 1.5rem; }
    .welcome-banner p  { font-size: 13px; }
    .tabs-card    { padding: 4px; }
    .card-title   { font-size: 14px; }
    .form-row     { grid-template-columns: 1fr; }
}

/* ── Responsive: Extra-small (≤ 360px) ──────────────────────────────────── */
@media (max-width: 360px) {
    .stats-grid   { grid-template-columns: 1fr; }
    .grid-4col    { grid-template-columns: 1fr; }
    .tab-item     { font-size: 11px; padding: 5px 8px; }
}
/* ===== TABLE CONTAINER ===== */
.table-container {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e5eaf0;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(16,24,40,0.06);
}

/* ===== TABLE ===== */
.modern-table {
    width: 100%;
    border-collapse: collapse;
}

    /* ===== HEADER ===== */
    .modern-table thead {
        background: #f9fafb;
    }

    .modern-table th {
        padding: 14px 18px;
        font-size: 12.5px;
        font-weight: 600;
        color: #667085;
        text-align: left;
        border-bottom: 1px solid #eaecf0;
    }

    /* ===== ROW ===== */
    .modern-table tbody tr {
        border-bottom: 1px solid #f2f4f7;
        transition: background 0.2s;
    }

        .modern-table tbody tr:hover {
            background: #f9fafb;        
        }

    /* ===== CELL ===== */
    .modern-table td {
        padding: 16px 18px;
        font-size: 13.5px;
        color: #344054;
    }

/* ===== NAME ===== */
.td-name {
    font-weight: 600;
    color: #101828;
}

/* ===== MUTED ===== */
.td-muted {
    color: #98a2b3;
}

/* ===== CENTER / RIGHT ===== */
.text-center {
    text-align: center;
}

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

/* ===== ICON STYLE (KEY FIX) ===== */
.status-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

    /* COLORS */
    .status-icon.success {
        background: #ecfdf3;
        color: #16a34a;
    }

    .status-icon.fail {
        background: #fef3f2;
        color: #dc2626;
    }

    .status-icon.pending {
        background: #f2f4f7;
        color: #98a2b3;
    }

/* ===== BADGE ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}

/* RISK COLORS */
.badge-risk-low {
    background: #ecfdf3;
    color: #027a48;
}

.badge-risk-medium {
    background: #fffaeb;
    color: #b54708;
}

.badge-risk-high {
    background: #fef3f2;
    color: #b42318;
}

.badge-risk-none {
    background: #f2f4f7;
    color: #667085;
}

/* ===== ACTION BUTTONS ===== */
.action-btn-group {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: #98a2b3;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

    .action-btn:hover {
        background: #f2f4f7;
        color: #344054;
    }