/* ==========================================================================
   CONSOLIDATED STYLES - All CSS for Kosmo ID Application
   Includes: Form Styles, Dashboard Styles, Treeview Styles, Admin Panel Styles
   ========================================================================== */

/* ==========================================================================
   CSS VARIABLES / ROOT
   ========================================================================== */

:root {
    /* Layout Variables */
    --sidebar-width: 260px;
    --header-height: 60px;
    --desktop-navbar-height: 60px;

    /* Professional Purple-Gray Palette (Admin Theme) */
    --primary-purple: #5D3A8A;
    --primary-purple-dark: #3E2866;
    --primary-purple-light: #7C5BA8;
    --accent-purple: #8B7AB8;
    --light-purple: #E8E4F0;
    --very-light-purple: #F5F3F8;

    /* Navbar - Professional dark purple-gray */
    --navbar-purple: #3E2866;
    --navbar-purple-dark: #2D1F4A;

    /* Primary Colors (Blue) */
    --primary-500: #3B82F6;
    --primary-600: #2563EB;
    --primary-700: #1D4ED8;
    --primary-50:  #F0F6FF;
    --primary-100: #DBEAFE;
    --primary-200: #BFDBFE;
    --primary-300: #93C5FD;
    --primary-400: #60A5FA;

    /* Accent Colors (Purple) */
    --accent-500: #8B5CF6;
    --accent-400: #A78BFA;
    --accent-50:  #F5F3FF;
    --accent-100: #EDE9FE;

    /* Semantic Colors */
    --success: #059669;
    --success-light: #D1FAE5;
    --success-500: #10B981;
    --success-50:  #ECFDF5;
    --warning: #D97706;
    --warning-light: #FEF3C7;
    --warning-500: #F59E0B;
    --warning-50:  #FFFBEB;
    --danger: #DC2626;
    --danger-light: #FEE2E2;
    --error-500:   #EF4444;
    --error-50:    #FEF2F2;

    /* Neutral / Gray Palette */
    --gray-50: #FAFAFA;
    --gray-100: #F5F5F5;
    --gray-200: #E5E5E5;
    --gray-300: #D4D4D4;
    --gray-400: #A3A3A3;
    --gray-500: #737373;
    --gray-600: #525252;
    --gray-700: #404040;
    --gray-800: #262626;
    --gray-900: #171717;

    /* Neutral Palette (aliases) */
    --neutral-50:  #FAFAFA;
    --neutral-100: #F4F4F5;
    --neutral-200: #E5E7EB;
    --neutral-300: #D4D4D8;
    --neutral-400: #9CA3AF;
    --neutral-500: #6B7280;
    --neutral-600: #4B5563;
    --neutral-700: #374151;
    --neutral-800: #1F2937;
    --neutral-900: #111827;

    /* Override Bootstrap's default link blue (#0d6efd) so every bare <a>
       inherits the brand purple. Affects links only — buttons, alerts and
       form-validation states still use their own Bootstrap variables. */
    --bs-link-color: var(--primary-purple);
    --bs-link-color-rgb: 93, 58, 138;
    --bs-link-hover-color: var(--primary-purple-dark);
    --bs-link-hover-color-rgb: 62, 40, 102;
}


/* ==========================================================================
   GLOBAL / BASE STYLES
   ========================================================================== */

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--gray-50);
    color: var(--neutral-900);
    line-height: 1.6;
    min-height: 100vh;
}

.icon-link {
    color: var(--accent-500) !important;
}


/* ==========================================================================
   MOBILE NAVBAR
   ========================================================================== */

.mobile-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: linear-gradient(90deg, var(--navbar-purple) 0%, var(--primary-purple) 100%);
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 1100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mobile-navbar-brand {
    font-size: 1.125rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-navbar-brand img {
    filter: brightness(0) invert(1);
    vertical-align: middle;
}

.mobile-navbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: white;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: background 0.2s;
    padding: 0;
    z-index: 1200;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-menu-toggle:active {
    background: rgba(255, 255, 255, 0.2);
}

/* Mobile Notification Button */
.mobile-notification-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.mobile-notification-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.mobile-notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: white;
    color: var(--primary-purple);
    font-size: 0.625rem;
    min-width: 16px;
    height: 16px;
    padding: 0 0.25rem;
    border-radius: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-toggle i {
    pointer-events: none;
}


/* ==========================================================================
   SIDEBAR
   ========================================================================== */

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--navbar-purple) 0%, var(--primary-purple) 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1050;
    top: 0;
    left: 0;
}

/* Mobile sidebar behavior */
@media (max-width: 991px) {
    .sidebar {
        transition: transform 0.3s ease;
        transform: translateY(-100%);
        top: 56px;
        height: auto;
        max-height: calc(100vh - 56px);
        left: 0;
        right: 0;
        width: 100%;
    }

    .sidebar.show {
        transform: translateY(0);
    }
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-brand {
    padding: 1.5rem 1.25rem;
    font-size: 1.5rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex: 1;
}

.sidebar-nav {
    padding: 1.5rem 0 1rem 0;
}

.nav-item {
    margin: 0.25rem 0.75rem;
}

.nav-link {
    color: rgba(255,255,255,0.8);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-link i {
    width: 20px;
    text-align: center;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}


/* ==========================================================================
   DESKTOP NAVIGATION BAR
   ========================================================================== */

.desktop-navbar {
    background: linear-gradient(90deg, var(--navbar-purple) 0%, var(--primary-purple) 100%);
    color: white;
    height: var(--desktop-navbar-height);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    gap: 2rem;
}

.desktop-navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.desktop-navbar .navbar-brand img {
    filter: brightness(0) invert(1);
    vertical-align: middle;
}

/* Top-level items: the tint is an inset rounded block, the same space on both sides, a gap between items
   (owner 2026-11-06, replaces the full-height square tint of FR D21). The item keeps the full header height,
   so the dropdown menus still open at the bottom of the bar. */
.desktop-navbar > .container-fluid,
.desktop-navbar .navbar-nav {
    align-self: stretch;
}

.desktop-navbar .navbar-nav > .nav-item {
    display: flex;
    align-items: center;
    margin: 0 0.25rem;
}

.desktop-navbar .navbar-nav > .nav-item > .nav-link {
    display: flex;
    align-items: center;
    height: 2.5rem;
    padding: 0 0.875rem;
    border-radius: 0.5rem;
}

.desktop-navbar .navbar-nav > .nav-item > .nav-link:hover,
.desktop-navbar .navbar-nav > .nav-item > .nav-link.show {
    background: rgba(255,255,255,0.1);
}

.desktop-navbar .navbar-nav > .nav-item > .nav-link.active {
    background: rgba(255,255,255,0.15);
}

.desktop-nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.25rem;
    flex: 1;
    overflow-x: auto;
}

.desktop-nav-item {
    flex-shrink: 0;
}

.desktop-nav-link {
    color: rgba(255,255,255,0.85);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
    font-size: 0.9375rem;
}

.desktop-nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.desktop-nav-link.active {
    background: rgba(255,255,255,0.15);
    color: white;
}

.desktop-nav-link i {
    font-size: 1rem;
}


/* ==========================================================================
   LAYOUT
   ========================================================================== */

.flex-col { display: flex; flex-direction: column; }
.items-start { align-items: flex-start; }
.m0 { margin: 0 !important; }

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

.main-content {
    flex: 1;
    background: var(--gray-50);
    min-width: 0;
}

@media (min-width: 992px) {
    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 991px) {
    .main-content {
        margin-left: 0;
    }
}

/* Top Header */
.top-header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 1rem;
}

@media (min-width: 992px) {
    .top-header {
        position: relative;
    }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Content Area */
.content-area {
    padding: 1rem;
}

@media (max-width: 991px) {
    .content-area {
        padding-top: 1rem;
        margin-top: 56px;
    }
}


/* ==========================================================================
   STATS CARDS
   ========================================================================== */

.stats-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

@media (min-width: 992px) {
    .stats-cards {
        margin-top: 2rem;
        margin-bottom: 2rem;
        justify-content: flex-end;
    }
}

.stat-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--gray-200);
    border-left: 4px solid;
    min-width: 150px;
}

.stat-card.entities {
    border-left-color: var(--primary-purple);
}

.stat-card.users {
    border-left-color: var(--success);
}

.stat-card.pending {
    border-left-color: var(--warning);
}

.stat-label {
    color: var(--gray-500);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--gray-900);
}


/* ==========================================================================
   SEARCH BAR
   ========================================================================== */

.search-bar {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-bar input {
    padding-left: 2.5rem;
    width: 100%;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
}

.search-bar input:focus {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px var(--very-light-purple);
}

.search-bar i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}


/* ==========================================================================
   FILTER TAGS
   ========================================================================== */

.filter-tags {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-tag {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    color: var(--gray-600);
}

.filter-tag:hover {
    border-color: var(--primary-purple-light);
    background: var(--very-light-purple);
}

.filter-tag.active {
    background: var(--light-purple);
    color: var(--primary-purple-dark);
    border-color: #D4CFE0;
}

/* Sort Dropdown in Filter Tags */
.filter-tag.dropdown-toggle::after {
    display: none;
}

.filter-tag .bi-chevron-down {
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.filter-tag[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}

.sort-dropdown-menu {
    min-width: 180px;
    padding: 0.5rem 0;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.sort-dropdown-menu .dropdown-item {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-dropdown-menu .dropdown-item:hover {
    background: var(--very-light-purple);
    color: var(--primary-purple);
}

.sort-dropdown-menu .dropdown-item.active {
    background: var(--light-purple);
    color: var(--primary-purple-dark);
}

.sort-dropdown-menu .dropdown-item i {
    width: 16px;
    text-align: center;
}

.ccr-resolve > .btn { width: 24rem; max-width: 100%; }
.ccr-resolve-menu { width: 24rem; max-width: 90vw; }
.ccr-resolve-item { white-space: normal; }
.ccr-resolve-item:hover, .ccr-resolve-item:focus { background: var(--very-light-purple); color: var(--primary-purple); }
.ccr-resolve-item.active, .ccr-resolve-item.active:hover, .ccr-resolve-item.active:focus { background: var(--light-purple); color: var(--primary-purple-dark); }
.fld-label { font-size: .68rem; letter-spacing: .04em; text-transform: uppercase; color: #6c757d; }
.fld-value { font-weight: 500; }
.ccr-needs-decision { border-left: 3px solid var(--bs-warning); }

/* Clear Filter Button */
.filter-tag.clear-filter {
    border-color: var(--gray-300);
    color: var(--gray-500);
}

.filter-tag.clear-filter:hover {
    border-color: var(--danger);
    background: var(--danger-light);
    color: var(--danger);
}

/* Active sort indicator */
.filter-tag.has-sort {
    background: var(--light-purple);
    color: var(--primary-purple-dark);
    border-color: #D4CFE0;
}


/* ==========================================================================
   CUSTOM MULTI-SELECT COMPONENT
   ========================================================================== */

/* Main filter bar container */
.filter-bar {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

/* Multi-select container */
.multi-select {
    position: relative;
    min-width: 200px;
    flex: 1;
    max-width: 320px;
}

/* The clickable select box */
.multi-select-box {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.375rem;
    min-height: 42px;
    padding: 0.375rem 2.25rem 0.375rem 0.75rem;
    background: white;
    border: 1.5px solid var(--neutral-300);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.multi-select-box:hover {
    border-color: var(--primary-purple-light);
}

.multi-select.open .multi-select-box {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(93, 58, 138, 0.15);
}

/* Placeholder text */
.multi-select-placeholder {
    color: var(--neutral-400);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.multi-select-placeholder i {
    font-size: 1rem;
    color: var(--neutral-400);
}

/* Dropdown arrow */
.multi-select-arrow {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--neutral-400);
    font-size: 0.75rem;
    pointer-events: none;
    transition: transform 0.2s;
}

.multi-select.open .multi-select-arrow {
    transform: translateY(-50%) rotate(180deg);
}

/* Selected chips inside the box */
.multi-select-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--light-purple);
    border-radius: 4px;
    font-size: 0.8125rem;
    color: var(--primary-purple-dark);
    white-space: nowrap;
    max-width: 150px;
}

.multi-select-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.multi-select-chip .chip-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 0.125rem;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--primary-purple);
    font-size: 0.75rem;
    padding: 0;
    transition: all 0.15s;
    flex-shrink: 0;
}

.multi-select-chip .chip-remove:hover {
    background: var(--primary-purple);
    color: white;
}

/* Tag chips with custom colors */
.multi-select-chip.tag-chip {
    background: var(--light-purple);
}

/* Dropdown panel */
.multi-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--neutral-200);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 1050;
    display: none;
    max-height: 300px;
    overflow: hidden;
}

.multi-select.open .multi-select-dropdown {
    display: block;
}

/* Search input inside dropdown */
.multi-select-search {
    padding: 0.75rem;
    border-bottom: 1px solid var(--neutral-100);
}

.multi-select-search input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--neutral-200);
    border-radius: 6px;
    font-size: 0.875rem;
    outline: none;
}

.multi-select-search input:focus {
    border-color: var(--primary-purple-light);
}

.multi-select-search input::placeholder {
    color: var(--neutral-400);
}

/* Options list */
.multi-select-options {
    max-height: 240px;
    overflow-y: auto;
    padding: 0.375rem 0;
}

/* Option group header */
.multi-select-group {
    padding: 0.5rem 0.75rem 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--neutral-500);
}

/* Individual option */
.multi-select-option {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background 0.15s;
}

.multi-select-option:hover {
    background: var(--very-light-purple);
}

.multi-select-option.selected {
    background: var(--light-purple);
}

/* Custom checkbox */
.multi-select-option .option-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid var(--neutral-300);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

.multi-select-option.selected .option-checkbox {
    background: var(--primary-purple);
    border-color: var(--primary-purple);
}

.multi-select-option .option-checkbox i {
    color: white;
    font-size: 0.75rem;
    opacity: 0;
}

.multi-select-option.selected .option-checkbox i {
    opacity: 1;
}

/* Option icon and label */
.multi-select-option .option-icon {
    width: 20px;
    text-align: center;
    color: var(--neutral-500);
    font-size: 0.9375rem;
}

.multi-select-option.selected .option-icon {
    color: var(--primary-purple);
}

.multi-select-option .option-label {
    flex: 1;
    font-size: 0.875rem;
    color: var(--neutral-700);
}

.multi-select-option.selected .option-label {
    color: var(--primary-purple-dark);
    font-weight: 500;
}

/* Tag color dot */
.tag-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* No results message */
.multi-select-empty {
    padding: 1rem;
    text-align: center;
    color: var(--neutral-400);
    font-size: 0.875rem;
}

/* Search bar */
.filter-search-bar {
    position: relative;
    flex: 0 0 360px;
    min-width: 180px;
    max-width: 100%;
}

.filter-search-bar input {
    width: 100%;
    height: 42px;
    padding: 0.5rem 0.875rem 0.5rem 2.5rem;
    border: 1.5px solid var(--neutral-300);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s;
    background: white;
}

.filter-search-bar input:hover {
    border-color: var(--primary-purple-light);
}

.filter-search-bar input:focus {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(93, 58, 138, 0.15);
    outline: none;
}

.filter-search-bar input::placeholder {
    color: var(--neutral-400);
}

.filter-search-bar .search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--neutral-400);
    font-size: 1rem;
    pointer-events: none;
}

/* Filter bar spacer - pushes stats to right */
.filter-spacer {
    flex: 1;
    min-width: 0;
}

/* Inline stats text */
.filter-stats {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.stats-text {
    font-size: 0.875rem;
    color: var(--gray-500);
    white-space: nowrap;
}

.stats-total {
    color: var(--gray-600);
}

.stats-separator {
    margin: 0 0.5rem;
    color: var(--gray-400);
}

.stats-pending {
    color: var(--warning);
    font-weight: 500;
}

/* Sortable table headers */
.entity-table thead th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s;
}

.entity-table thead th.sortable:hover {
    background: var(--gray-100);
}

.entity-table thead th.sortable .sort-icon {
    display: inline-flex;
    align-items: center;
    margin-left: 0.375rem;
    color: var(--gray-400);
    font-size: 0.75rem;
}

.entity-table thead th.sortable.sorted .sort-icon {
    color: var(--primary-purple);
}

.entity-table thead th.sortable .sort-icon i {
    transition: transform 0.15s;
}

/* Mobile responsive */
@media (max-width: 767.98px) {
    .filter-bar {
        flex-direction: column;
        gap: 0.5rem;
    }

    .multi-select {
        max-width: none;
        width: 100%;
    }

    .filter-search-bar {
        flex: none;
        max-width: none;
        width: 100%;
    }
    
    .filter-spacer {
        display: none;
    }
    
    .filter-stats {
        width: 100%;
        justify-content: flex-end;
        padding-top: 0.25rem;
    }

    .multi-select-chip {
        font-size: 0.75rem;
        padding: 0.1875rem 0.375rem;
        max-width: 120px;
    }

    .multi-select-dropdown {
        position: fixed;
        left: 1rem;
        right: 1rem;
        top: auto;
        bottom: 0;
        max-height: 50vh;
        border-radius: 12px 12px 0 0;
    }
}


/* ==========================================================================
   ENTITY TABLE
   ========================================================================== */

.entity-table-container {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--gray-200);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.table-header h4 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
}

/* Entity Table */
.entity-table {
    margin-bottom: 1.5rem;
    border: none;
}

.entity-table thead th {
    background: var(--gray-50);
    border: none;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-600);
    padding: 0.875rem 0.75rem;
    white-space: nowrap;
}

.entity-table tbody tr {
    transition: background-color 0.2s;
    border-bottom: 1px solid var(--gray-100);
}

.entity-table tbody tr:last-child {
    border-bottom: none;
}

.entity-table tbody tr:first-child td {
    border-top: none;
}

.entity-table tbody tr:hover {
    background-color: var(--gray-50);
}

.entity-table tbody td {
    vertical-align: middle;
    padding: 1rem 0.75rem;
    border: none;
}

/* Entity Type Icon */
.entity-type-icon {
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
}

.entity-type-icon.company {
    background: var(--light-purple);
    color: var(--primary-purple-dark);
}

.entity-type-icon.person {
    background: var(--light-purple);
    color: var(--primary-purple-dark);
}

/* Entity Name Cell */
.entity-name-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.entity-name-cell .name {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 0.9375rem;
}

/* Clickable entity name link */
.entity-name-link {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 0.9375rem;
    text-decoration: none;
    transition: color 0.15s;
}

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

.uuid-mobile {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Entity UUID */
.entity-uuid {
    font-size: 0.8125rem;
    color: var(--gray-500);
    background: var(--gray-50);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

/* Creator and Time */
.creator-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.creator-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    line-height: 1.3;
    display: block;
}

.creator-email {
    font-size: 0.75rem;
    color: var(--gray-400);
    line-height: 1.3;
    display: block;
}

.update-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.update-date {
    font-size: 0.8125rem;
    color: var(--gray-600);
    line-height: 1.3;
    display: block;
}

.update-time {
    font-size: 0.75rem;
    color: var(--gray-400);
    line-height: 1.3;
    display: block;
}

/* Relations Icons */
.relations-icons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.relation-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--very-light-purple);
    color: var(--primary-purple);
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.relation-icon i {
    font-size: 0.875rem;
}

/* Structure badges for admin dashboard */
.structure-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-500);
}

.structure-badge i {
    font-size: 0.875rem;
}

.structure-badges {
    flex-wrap: nowrap;
}

/* ==========================================================================
   ENTITY PROGRESS BAR
   ========================================================================== */

.entity-progress {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-width: 90px;
    max-width: 140px;
}

/* Progress bar wrapper */
.progress-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.progress-bar-track {
    flex: 1;
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-bar-fill.complete {
    background: var(--success);
}

.progress-bar-fill.partial {
    background: var(--warning);
}

.progress-bar-fill.low {
    background: var(--gray-400);
}

.progress-percentage {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-600);
    min-width: 32px;
    text-align: right;
}

/* Section indicators */
.progress-sections {
    display: flex;
    gap: 0.25rem;
}

.section-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    transition: all 0.15s ease;
    cursor: default;
}

.section-dot.complete {
    background: var(--success-light);
    color: var(--success);
}

.section-dot.partial {
    background: var(--warning-light);
    color: var(--warning);
}

.section-dot.incomplete {
    background: var(--gray-100);
    color: var(--gray-400);
}

.section-dot:hover {
    transform: scale(1.1);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .entity-progress {
        min-width: 70px;
        max-width: 100px;
    }
    
    .progress-percentage {
        font-size: 0.6875rem;
        min-width: 28px;
    }
    
    .section-dot {
        width: 18px;
        height: 18px;
        font-size: 0.625rem;
    }
}


/* ==========================================================================
   STATUS BADGES
   ========================================================================== */

.status-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.status-badge.complete {
    background: var(--success-light);
    color: var(--success);
}

.status-badge.incomplete {
    background: var(--warning-light);
    color: var(--warning);
}

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

/* Approval Status Badges */
.approval-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.approval-badge:hover {
    filter: brightness(0.95);
}

.approval-badge:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}

.approval-badge.dropdown-toggle::after {
    margin-left: 0.5rem;
    vertical-align: middle;
}

.approval-badge.pending {
    background: var(--warning-light);
    color: var(--warning);
}

.approval-badge.draft {
    background: var(--neutral-200);
    color: var(--neutral-500);
}

.approval-badge.info-required {
    background: #DBEAFE;
    color: #2563EB;
}

.approval-badge.approved {
    background: var(--success-light);
    color: var(--success);
}

.approval-badge.rejected {
    background: var(--danger-light);
    color: var(--danger);
}


/* ==========================================================================
   ACTION BUTTONS
   ========================================================================== */

.action-btns {
    display: flex;
    gap: 0.5rem;
}

.btn-action {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gray-200);
    background: white;
    color: var(--gray-600);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-action:hover {
    background: var(--gray-50);
    border-color: var(--primary-purple);
    color: var(--primary-purple);
}

.btn-action.btn-warning {
    border-color: var(--warning);
    color: var(--warning);
}

.btn-action.btn-warning:hover {
    background: var(--warning-light);
}

/* Table Footer */
.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.showing-text {
    color: var(--gray-500);
}

/* User Avatar */
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    flex-shrink: 0;
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    border-radius: 1rem;
    font-weight: 600;
}


/* ==========================================================================
   PAGINATION
   ========================================================================== */

.pagination .page-link {
    color: var(--primary-purple);
    border-color: var(--gray-200);
    background-color: white;
}

.pagination .page-link:hover {
    color: var(--primary-purple-dark);
    background-color: var(--very-light-purple);
    border-color: var(--primary-purple-light);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-purple);
    border-color: var(--primary-purple);
    color: white;
}

.pagination .page-item.disabled .page-link {
    color: var(--gray-400);
    background-color: var(--gray-50);
    border-color: var(--gray-200);
}


/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn-primary {
    background-color: var(--primary-purple);
    border-color: var(--primary-purple);
    color: white;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover {
    background-color: var(--primary-purple-dark);
    border-color: var(--primary-purple-dark);
    color: white;
    box-shadow: 0 4px 12px rgba(93, 58, 138, 0.25);
    transform: translateY(-1px);
}

/* Disabled: the house purple, faded — Bootstrap's own disabled colour (blue) showed through otherwise */
.btn-primary:disabled,
.btn-primary.disabled {
    background-color: var(--primary-purple);
    border-color: var(--primary-purple);
    color: white;
    opacity: .45;
}

.btn-secondary {
    background: var(--neutral-100);
    border: 1.5px solid var(--neutral-300);
    color: var(--neutral-700);
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
}

.btn-secondary:hover {
    background: var(--neutral-200);
    border-color: var(--neutral-400);
    color: var(--neutral-800);
}

.btn-outline-secondary {
    color: var(--gray-600);
    border-color: var(--gray-300);
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
}

.btn-primary.btn-sm,
.btn-secondary.btn-sm,
.btn-outline-secondary.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-outline-secondary:hover {
    background-color: var(--gray-100);
    border-color: var(--gray-400);
    color: var(--gray-700);
}

.btn {
    margin-top: 1rem;
}

/* Align the height of the buttons in input groups */
.input-group button {
    margin: initial;
}


/* ==========================================================================
   FORMS
   ========================================================================== */

/* Form Container */
.form-container {
    background: white;
    padding: 0 0 0 0;
    max-width: 720px;
    margin: 0 auto;
}

/* Fieldset */
fieldset {
    border: 1.5px solid var(--neutral-200);
    border-radius: 12px;
    background: var(--neutral-50);
    padding: 1.5rem;
    margin-bottom: 2rem;
    transition: border-color 0.25s, background 0.25s;
}

fieldset:focus-within {
    border-color: var(--neutral-200);
    background: var(--neutral-50);
    box-shadow: none;
}

fieldset legend {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-500) !important;
}

.surrounded-legend {
    color: var(--neutral-600) !important;
}

.progress-bar {
    background-color: var(--primary-purple);
}

.accordion-button:not(.collapsed) {
    background-color: var(--very-light-purple);
    color: var(--primary-purple);
}

/* Form Groups */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--neutral-600);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Inputs & Selects */
.form-control,
.form-select {
    display: block;
    width: 100%;
    border: 1.5px solid var(--neutral-300);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    font-size: 0.95rem;
    line-height: 1.4;
    background: white;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-control:hover,
.form-select:hover {
    border-color: var(--primary-purple-light);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-purple);
    background: var(--very-light-purple);
    box-shadow: 0 0 0 3px rgba(93, 58, 138, 0.15);
}

.form-control:disabled,
.form-select:disabled {
    background: var(--neutral-100);
    border-color: var(--neutral-200);
    color: var(--neutral-500);
}

/* Placeholder */
.form-control::placeholder,
.form-select::placeholder {
    color: var(--neutral-400);
}

/* Checkbox */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.form-check-input {
    border: 1.5px solid var(--neutral-400);
    border-radius: 4px;
    width: 1.2em;
    height: 1.2em;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-check-input:checked {
    background-color: var(--primary-purple);
    border-color: var(--primary-purple);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(93, 58, 138, 0.2);
}

.form-check-label {
    color: var(--neutral-600);
    font-weight: 500;
}

/* Validation */
.is-valid {
    border-color: var(--success) !important;
    background: var(--success-50);
}

.is-invalid {
    border-color: var(--error-500) !important;
    background: var(--error-50);
}

.valid-feedback {
    color: var(--success);
}

.invalid-feedback {
    color: var(--error-500);
}

/* Section Headers */
.form-section-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-purple);
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--light-purple);
}

/* Custom select arrow */
.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23374151' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 16 16'%3e%3cpath d='m1 6 7 7 7-7'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    /* Bug-fix 2026-05-20: parent .form-control/.form-select rule sets
       symmetric `padding: 0.7rem 0.9rem`, leaving no room for the chevron.
       Reserve ~2.5rem on the right so the text never collides with the arrow. */
    padding-right: 2.5rem;
}
.form-select.form-select-sm {
    /* Smaller chevron room for compact selects (e.g. conditional-logic rule
       rows in the admin question editor). */
    padding-right: 2rem;
}

/* E-sign flow card — signer-actions dropdown. The global .form-select rule
   above overrides .form-select-sm's compact metrics, leaving the "Replace
   with" picker taller than the btn-sm Replace button beside it. Restore
   compact metrics scoped to that row (both controls land at 35px), and kill
   the global `.btn { margin-top }` inside the dropdown + on its trigger. */
.esign-replace-row .form-select {
    padding: 0.375rem 2rem 0.375rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-width: 1px;
    background-position: right 0.75rem center;
}
.esign-replace-row .btn,
.esign-flow-step .dropdown > .btn {
    margin-top: 0;
    white-space: nowrap;
}


/* ==========================================================================
   HTMX LOADING STATES
   ========================================================================== */

.htmx-indicator {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.htmx-indicator.htmx-request {
    display: flex;
}

.htmx-overlay-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.htmx-overlay-content {
    position: relative;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.htmx-overlay-content img {
    width: 60px;
    height: 60px;
}

.htmx-request .form-control,
.htmx-request .form-select {
    background: var(--neutral-100);
    cursor: wait;
}

/* Target the select element ONLY when the htmx-request class is present */
.htmx-request.form-select {
    color: transparent;
    background-image: url("data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M8 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13zM0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8z' fill='%236c757d' fill-rule='evenodd'/%3e%3cpath d='M8 1.5A6.5 6.5 0 1 0 8 15V1.5z' fill='%23fff'%3e%3canimateTransform attributeName='transform' type='rotate' from='0 8 8' to='360 8 8' dur='1s' repeatCount='indefinite'/%3e%3c/path%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 1rem 1rem;
}


/* ==========================================================================
   MODALS
   ========================================================================== */

#networkModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 9999;
}

#statusChangeModal .modal-header {
    border-bottom: 1px solid var(--neutral-200);
}

#statusChangeModal .modal-footer {
    border-top: 1px solid var(--neutral-200);
}

#statusChangeModal textarea {
    resize: vertical;
    min-height: 100px;
}

#statusChangeModal .form-text {
    color: var(--neutral-500);
    font-size: 0.8rem;
}

#email-notification-info {
    background-color: var(--very-light-purple);
    border-color: var(--light-purple);
    color: var(--primary-purple);
}


/* ==========================================================================
   TIMELINE
   ========================================================================== */

.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--neutral-200);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -30px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
}

.timeline-content {
    background: var(--neutral-50);
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid var(--neutral-200);
    transition: border-color 0.15s ease;
}

.timeline-content:hover {
    border-color: var(--neutral-300);
}


/* ==========================================================================
   BADGE OVERRIDES
   ========================================================================== */

.badge.text-bg-secondary {
    background-color: var(--neutral-500) !important;
}

.badge.text-bg-warning {
    background-color: var(--warning) !important;
    color: white !important;
}

.badge.text-bg-success {
    background-color: var(--success) !important;
}

.badge.text-bg-danger {
    background-color: var(--error-500) !important;
}

.badge.text-bg-info {
    background-color: var(--primary-400) !important;
    color: white !important;
}

.badge.bg-danger {
    background-color: var(--error-500) !important;
}

.badge.bg-warning {
    background-color: var(--warning) !important;
}

.badge.bg-secondary {
    background-color: var(--neutral-500) !important;
}

.badge.bg-item-count {
    background-color: var(--gray-400) !important;
}


/* ==========================================================================
   STATUS LEGEND
   ========================================================================== */

.status-legend {
    background: var(--neutral-50);
    border: 1px solid var(--neutral-200);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1.5rem;
}

.status-legend h6 {
    color: var(--neutral-700);
    margin-bottom: 0.75rem;
}

.status-legend .badge {
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}


/* ==========================================================================
   ENTITY VIEW PAGE
   ========================================================================== */

/* Purple text utility classes */
.text-purple {
    color: var(--primary-purple) !important;
}

.text-purple-light {
    color: var(--primary-purple-light) !important;
}

/* Section headers in entity view */
.entity-section-header {
    font-weight: 700;
    color: var(--primary-purple);
    margin-bottom: 0.75rem;
}

/* Entity reference link — used in breadcrumb, Associations panel, and any
   inline entity reference. Matches the brand purple so navigation doesn't
   compete with primary CTAs (which keep the default blue). */
.entity-link {
    color: var(--primary-purple);
    text-decoration: none;
    transition: color 0.15s;
}
.entity-link:hover,
.entity-link:focus {
    color: var(--primary-purple-dark);
    text-decoration: underline;
}

/* Collapsible card header styling */
.card-header[data-bs-toggle="collapse"] {
    cursor: pointer;
    transition: background-color 0.2s;
}

.card-header[data-bs-toggle="collapse"]:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.card-header[data-bs-toggle="collapse"] .bi-chevron-down {
    transition: transform 0.3s;
}

.card-header[data-bs-toggle="collapse"].collapsed .bi-chevron-down {
    transform: rotate(-90deg);
}

.card-header[data-bs-toggle="collapse"][aria-expanded="false"] .bi-chevron-down {
    transform: rotate(-90deg);
}

/* Collapse toggle for sections with action buttons in the header
   (Shareholders, Principals, UBOs) — only title and chevron trigger collapse */
.collapse-toggle {
    cursor: pointer;
}

.card-header .collapse-toggle.bi-chevron-down {
    transition: transform 0.3s;
}

.card-header .collapse-toggle.bi-chevron-down.collapsed,
.card-header .collapse-toggle.bi-chevron-down[aria-expanded="false"] {
    transform: rotate(-90deg);
}

/* Button-style toggles (Associations, Screening, ID Verification Data,
   ID Document Discrepancies) */
.entity-view-card .card-header button[data-bs-toggle="collapse"] {
    display: inline-flex;
    margin-top: 0;
}

.entity-view-card .card-header button[data-bs-toggle="collapse"] .bi-chevron-down {
    transition: transform 0.3s;
}

.entity-view-card .card-header button[data-bs-toggle="collapse"][aria-expanded="false"] .bi-chevron-down {
    transform: rotate(-90deg);
}

/* Definition list styling for entity details */
.entity-details dl.row dt {
    font-weight: 500;
    color: var(--neutral-500);
}

.entity-details dl.row dd {
    color: var(--neutral-800);
}

/* Address styling */
.entity-details address {
    font-style: normal;
    line-height: 1.6;
    color: var(--neutral-700);
}

/* Entity view card styling */
.entity-view-card {
    border: 1px solid var(--neutral-200);
    /* border-radius: 0.75rem; */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.entity-view-card .card-header {
    background-color: var(--neutral-50);
    border-bottom: 1px solid var(--neutral-200);
}

.entity-view-card .card-title {
    color: var(--neutral-800);
    font-weight: 600;
}

/* Children section badges */
.entity-view-card .badge.bg-secondary {
    background-color: var(--accent-purple) !important;
}

/* Action buttons in entity view */
.entity-view-actions .btn-outline-secondary {
    border-color: var(--neutral-300);
    color: var(--neutral-700);
}

.entity-view-actions .btn-outline-secondary:hover {
    background-color: var(--neutral-100);
    border-color: var(--neutral-400);
}

.entity-view-actions .btn-outline-primary {
    border-color: var(--primary-purple-light);
    color: var(--primary-purple);
}

.entity-view-actions .btn-outline-primary:hover {
    background-color: var(--very-light-purple);
    border-color: var(--primary-purple);
}

/* Section cards must never scroll horizontally — content wraps instead.
   Overrides Bootstrap's .table-responsive overflow-x: auto when the table
   sits inside an entity view card. We use 'hidden' (not 'visible') so
   wide content gets clipped at the card edge rather than leaking out and
   pushing the page itself into horizontal scroll. */
.entity-view-card .table-responsive,
.entity-view-card .table-responsive-sm,
.entity-view-card .table-responsive-md,
.entity-view-card .table-responsive-lg {
    overflow-x: hidden;
}

/* Action-cell buttons wrap onto a second line when the column would
   otherwise force horizontal overflow (e.g. Principals row with
   Edit + Resend + Revoke icons during a pending registration). */
.entity-children-table td.actions-cell {
    white-space: normal;
}
.entity-children-table td.actions-cell .actions-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    justify-content: flex-end;
}

/* Children tables styling */
.entity-children-table {
    font-size: 0.9rem;
    table-layout: auto;
}

.entity-children-table td,
.entity-children-table th {
    word-break: break-word;
    overflow-wrap: anywhere;
}

.entity-children-table thead {
    background-color: var(--neutral-50);
}

.entity-children-table th {
    font-weight: 600;
    color: var(--neutral-600);
    border-bottom: 2px solid var(--neutral-200);
}

.entity-children-table td {
    vertical-align: middle;
    border-bottom: none;
}

.entity-children-table tbody tr:hover {
    background-color: var(--neutral-50);
}

/* Remove borders from all table rows in entity view (except headers) */
.entity-view-card table td {
    border: none;
}

.entity-view-card table tbody tr {
    border: none;
}

.entity-view-card table thead th {
    font-weight: 600;
    color: var(--neutral-600);
    border-bottom: 1px solid var(--neutral-200);
    border-top: none;
    border-left: none;
    border-right: none;
}

.entity-view-card table tbody tr:hover {
    background-color: var(--neutral-50);
}

/* Pending invitation table styling */
.entity-view-card .alert table {
    font-size: 0.85rem;
}

.entity-view-card .alert table td {
    vertical-align: middle;
}

.entity-view-card .alert table td small {
    font-size: 0.75rem;
}

/* Compact pending invitations */
.pending-invitations-compact {
    background-color: var(--warning-50);
    border: 1px solid var(--warning-light);
    border-radius: 0.375rem;
    padding: 0.25rem 0.75rem;
}

.pending-invitation-row {
    font-size: 0.85rem;
}

.pending-invitation-row .border-bottom {
    border-color: var(--warning-light) !important;
}

/* Entity type badge in invitation tables */
.entity-view-card .badge-entity-type {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.25em 0.5em;
}

.entity-view-card .badge-entity-type.company {
    background-color: var(--primary-purple) !important;
    color: #fff;
}

.entity-view-card .badge-entity-type.individual {
    background-color: var(--primary-purple-light) !important;
    color: #fff;
}

/* Type badges in children tables - keeping for backwards compatibility */
.entity-children-table .badge.bg-primary {
    background-color: var(--primary-purple) !important;
}

/* AML Screening Hit List Styles */
.aml-hit-list {
    padding-left: 0.5rem;
}

.aml-hit-item {
    padding-left: 0.5rem;
    border-left: 2px solid var(--neutral-200);
}

.aml-hit-name {
    font-size: 0.85rem;
    color: var(--neutral-800);
    font-weight: 500;
    line-height: 1.3;
}

.aml-hit-source {
    font-size: 0.75rem;
    color: var(--neutral-400);
    line-height: 1.3;
    margin-top: 1px;
}

/* ID Document Discrepancy Badges */
.badge-discrepancy {
    background-color: var(--danger-light);
    color: var(--danger);
}

.badge-discrepancy-mild {
    background-color: var(--neutral-200);
    color: var(--neutral-600);
}

/* ID Document Discrepancy Table */
.discrepancy-col-field  { width: 25%; }
.discrepancy-col-document { width: 30%; }
.discrepancy-col-manual { width: 30%; }
.discrepancy-col-status { width: 15%; }

.discrepancy-extracted {
    color: var(--primary-purple);
    font-weight: 500;
}

.entity-children-table .badge.bg-info {
    background-color: var(--primary-purple-light) !important;
}


/* ==========================================================================
   VERIFF SUGGESTION STYLES
   ========================================================================== */

/* Border highlight for fields with suggestions */
.border-purple {
    border-color: var(--primary-purple-light) !important;
}

/* Suggestion hint container */
.veriff-suggestion {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    background-color: var(--warning-light);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    width: 100%;
}

/* Purple outline button for Apply action */
.btn-outline-purple {
    color: var(--primary-purple);
    border-color: var(--primary-purple-light);
    background-color: transparent;
    padding: 0.1875rem 0.625rem;
    font-size: 0.8125rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 1.625rem;
    margin-left: auto;
    white-space: nowrap;
}

.btn-outline-purple:hover {
    color: #fff;
    background-color: var(--primary-purple);
    border-color: var(--primary-purple);
}

.btn-outline-purple:focus {
    box-shadow: 0 0 0 0.2rem rgba(93, 58, 138, 0.25);
}

/* Filled purple button — the primary "power" action (e.g. Review & create from
   registry) that must stand out beside the outline search button. */
.btn-purple {
    color: #fff;
    background-color: var(--primary-purple);
    border: 1px solid var(--primary-purple);
}
.btn-purple:hover,
.btn-purple:focus {
    color: #fff;
    background-color: var(--primary-purple-dark);
    border-color: var(--primary-purple-dark);
}
.btn-purple:focus {
    box-shadow: 0 0 0 0.2rem rgba(93, 58, 138, 0.25);
}

/* Purple text utility */
.text-purple {
    color: var(--primary-purple) !important;
}

/* Purple background utility — several modal headers use
   `modal-header bg-purple text-white`; without this class they rendered
   white-on-white (invisible title/close). */
.bg-purple {
    background-color: var(--primary-purple) !important;
}

/* Purple-tinted info alert — matches the app theme instead of Bootstrap's
   default cyan `alert-info` / `text-info`. Also reused for the Kyckr toast body. */
.alert-purple {
    background-color: rgba(93, 58, 138, 0.08);
    border-color: var(--primary-purple-light);
    color: var(--primary-purple-dark);
}

/* A compact dismissible alert (py-1 / py-2): Bootstrap places the close button
   for a normal-height alert (top: 0, padding 1.25rem), so it sat low. Centre it. */
.alert-dismissible.py-1 .btn-close,
.alert-dismissible.py-2 .btn-close {
    top: 50%;
    transform: translateY(-50%);
    padding: .5rem 1rem;
}

/* Screening card, "Ignore words when screening" row: the input sits on one line
   with a small switch label and small text, so it takes the height and font of
   the small purple buttons (.btn-outline-purple) instead of the full-size
   .form-control rule above, which overrides Bootstrap's form-control-sm. */
.screening-ignore-row .form-control {
    height: 1.625rem;
    padding: 0.1875rem 0.625rem;
    font-size: 0.8125rem;
    line-height: 1.2;
    border-radius: 6px;
}

/* ID Document Discrepancies, "Not Latin" row: the box prefilled with the
   document value and its Save button sit on one line in the Manual Entry
   column. Same small shape as the screening-ignore input; the button loses
   the .btn top margin and the .btn-outline-purple auto left margin, which
   would push it against the status badge. */
.discrepancy-transcribe .form-control {
    height: 1.625rem;
    padding: 0.1875rem 0.625rem;
    font-size: 0.8125rem;
    line-height: 1.2;
    border-radius: 6px;
    width: 14rem;
}
.discrepancy-transcribe .btn {
    margin-top: 0;
    margin-left: 0;
}
/* Place-of-birth row: the country list under the box, same small shape. */
.discrepancy-transcribe .form-select {
    height: 1.625rem;
    padding: 0.1875rem 2rem 0.1875rem 0.625rem;
    font-size: 0.8125rem;
    line-height: 1.2;
    border-radius: 6px;
    width: 14rem;
    background-position: right 0.5rem center;
}

/* Tooltips follow the palette (dark purple, white text) instead of the stock
   black Bootstrap box. */
.tooltip {
    --bs-tooltip-bg: var(--primary-purple-dark);
    --bs-tooltip-color: #fff;
    --bs-tooltip-opacity: 1;
}


/* LEI field on the company form: the input and, on the same line, the answer of
   the LEI database as plain text (no box). The fonts shrink with the width of
   the field so the two stay on one line. */
.lei-field {
    container-type: inline-size;
}

.lei-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.lei-row .form-control {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    font-size: clamp(0.68rem, 3.3cqw, 0.95rem);
    padding-inline: clamp(0.4rem, 2.2cqw, 0.9rem);
}

.lei-note {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
    font-size: clamp(0.6rem, 2.6cqw, 0.8rem);
    padding: 0 0.25rem;
    color: var(--neutral-600);
}

.lei-note:empty {
    display: none;
}

.lei-note.found {
    color: var(--primary-purple-dark);
}

.lei-note.warn {
    color: var(--bs-warning-text-emphasis);
}


/* ==========================================================================
   TREEVIEW COMPONENT
   ========================================================================== */

/* Base container for the treeview instance */
.custom-treeview-wrapper {
    background-color: #fff;
    padding: 15px;
    border-radius: 5px;
    margin: 10px auto;
}

/* Wrapper for search input and clear button */
.treeview-search-input-wrapper {
    position: relative;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

/* Search input specific to the library */
.treeview-search-input {
    width: 100%;
    padding: 8px 30px 8px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 0.9em;
}

/* Styling for the clear button */
.treeview-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #888;
    font-size: 1.2em;
    border: none;
    padding: 0;
    line-height: 1;
    display: none;
}

.treeview-search-clear:hover {
    color: #555;
}

/* Tree structure styling */
.custom-treeview-wrapper ul {
    list-style: none;
    padding-left: 20px;
    margin: 0;
}

.custom-treeview-wrapper li > ul {
    height: 0;
    overflow: hidden;
    transition: height 0.3s ease-out;
}

.custom-treeview-wrapper li {
    margin: 5px 0;
    position: relative;
    font-size: 0.95em;
    color: #333;
    cursor: default;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Wrapper for expander icon and text (flexbox container) */
.custom-treeview-wrapper .treeview-node-content {
    display: flex;
    align-items: center;
    padding-left: 0;
    cursor: pointer;
    user-select: none;
    padding: 2px 0;
}

/* Style for non-selectable nodes */
.custom-treeview-wrapper .treeview-node-content.not-selectable {
    cursor: default;
    opacity: 0.6;
}

/* Style the actual text span for the node name */
.custom-treeview-wrapper .treeview-node-text {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Styling for the explicit expander icon element */
.treeview-expander {
    display: inline-block;
    width: 20px;
    text-align: center;
    color: #666;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
    margin-right: 5px;
    transition: transform 0.2s ease-in-out;
}

/* Styling for the placeholder span for leaf nodes */
.treeview-expander-placeholder {
    display: inline-block;
    width: 20px;
    flex-shrink: 0;
    margin-right: 5px;
}

.custom-treeview-wrapper li * {
    transition: background-color 0.2s ease-in-out;
}

.custom-treeview-wrapper li.selected > .treeview-node-content {
    background-color: rgba(93, 58, 138, 0.15);
    color: var(--primary-purple);
    border-radius: 3px;
}

/* For search results */
.custom-treeview-wrapper li.hidden {
    display: none !important;
}

/* Apply highlight to the node content wrapper */
.custom-treeview-wrapper li.highlight > .treeview-node-content {
    font-style: italic;
    color: var(--primary-purple-dark);
    border-radius: 3px;
}

/* Reset styles for ALL descendant <li> elements of a highlighted <li> */
.custom-treeview-wrapper li.highlight li {
    font-style: normal;
    color: #333;
    background-color: transparent;
}

/* Ensure that if a nested LI is also a match, it still gets its own highlight. */
.custom-treeview-wrapper li.highlight li.highlight > .treeview-node-content {
    font-style: italic;
    color: var(--primary-purple-dark);
}

.treeview-control-button {
    padding: 8px 15px;
    margin-right: 5px;
    margin-bottom: 3px;
    border: none;
    border-radius: 4px;
    background-color: var(--primary-purple);
    color: white;
    font-size: 0.9em;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-grow: 1;
    min-width: 110px;
    max-width: 48%;
}

.treeview-control-button:hover {
    background-color: var(--primary-purple-dark);
}

.treeview-control-button:active {
    transform: translateY(1px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.treeview-checkbox {
    margin-right: 5px;
    flex-shrink: 0;
    cursor: pointer;
    transform: scale(1.1);
}


/* ==========================================================================
   CHEVRON ICON ANIMATION
   ========================================================================== */

.toggle-icon .bi-chevron-right {
    display: inline-block;
    transition: transform 0.3s ease-in-out;
    transform: rotate(0deg);
}

.toggle-icon[aria-expanded="true"] .bi-chevron-right {
    transform: rotate(90deg);
}


/* ==========================================================================
   RESPONSIVE STYLES
   ========================================================================== */

@media (max-width: 991px) {
    .mobile-navbar {
        display: flex;
    }
}

@media (min-width: 992px) {
    .mobile-navbar {
        display: none;
    }

    .sidebar-overlay {
        display: none !important;
    }

    .content-area {
        padding: 2rem;
    }

    .entity-table-container {
        padding: 2rem;
    }
}

@media (max-width: 768px) {
    .form-container {
        padding: 1.25rem;
    }

    fieldset {
        padding: 1rem;
    }

    fieldset legend {
        font-size: 0.9rem;
    }

    .form-control,
    .form-select {
        padding: 0.65rem 0.9rem;
        font-size: 0.9rem;
    }

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

    .search-bar {
        width: 100%;
    }

    #status-filter-tabs {
        flex-wrap: wrap;
    }

    #status-filter-tabs .nav-link {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
    }

    .status-select {
        min-width: 140px;
    }

    .entity-type-icon {
        width: 28px;
        height: 28px;
        font-size: 0.875rem;
    }

    .status-notes {
        max-width: 100%;
    }

    .timeline {
        padding-left: 25px;
    }

    .timeline-marker {
        left: -25px;
        width: 18px;
        height: 18px;
        font-size: 8px;
    }
}

@media (max-width: 767px) {
    .entity-table-container {
        padding: 1rem;
    }

    .entity-table thead th {
        padding: 0.75rem 0.5rem;
        font-size: 0.75rem;
    }

    .entity-table tbody td {
        padding: 0.75rem 0.5rem;
    }

    .entity-type-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .entity-name-cell .name {
        font-size: 0.875rem;
    }

    .relations-icons {
        flex-direction: column;
        gap: 0.25rem;
    }

    .table-footer {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 576px) {
    .btn-group-sm .btn {
        padding: 0.25rem 0.4rem;
    }
}

@media (max-width: 575px) {
    .stat-card {
        padding: 0.75rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .entity-table-container {
        padding: 0.75rem;
    }

    .table-header h4 {
        font-size: 1.25rem;
    }

    .entity-table thead th {
        padding: 0.5rem 0.375rem;
        font-size: 0.7rem;
    }

    .entity-table tbody td {
        padding: 0.5rem 0.375rem;
    }

    .btn-action {
        width: 28px;
        height: 28px;
    }

    .status-badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    .relation-icon {
        font-size: 0.7rem;
        padding: 0.125rem 0.375rem;
    }
}

/* ============================================
   Subject User Form Styles (Token-based forms)
   ============================================ */

.subject-form-page {
    background: var(--very-light-purple, #F5F3F8);
    min-height: 100vh;
    padding: 2.5rem 1rem;
}

.subject-form-container {
    max-width: 720px;
    margin: 0 auto;
}

.subject-context-bar {
    font-size: 0.85rem;
    color: var(--neutral-500, #6B7280);
    line-height: 1.6;
    margin-bottom: 1.25rem;
    padding: 0 0.25rem;
}

.subject-context-bar strong {
    color: var(--neutral-800, #1F2937);
}

.declaration-item {
    padding: 0.6rem 0;
}

.declaration-item + .declaration-item {
    border-top: 1px solid var(--gray-100, #F5F5F5);
}

.subject-form-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    border: 1px solid var(--gray-200, #E5E5E5);
}

.subject-brand-header {
    text-align: center;
    margin-bottom: 2rem;
}

.subject-brand-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary-purple, #5D3A8A) 0%, var(--primary-purple-light, #7C5BA8) 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: white;
    font-size: 1.75rem;
    box-shadow: 0 4px 12px rgba(93, 58, 138, 0.3);
}

.subject-brand-header h1 {
    color: var(--neutral-800, #1F2937);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.subject-brand-header p {
    color: var(--neutral-500, #6B7280);
}

.subject-context-box {
    background: var(--light-purple, #E8E4F0);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary-purple, #5D3A8A);
}

.subject-context-box p {
    color: var(--neutral-700, #374151);
    margin-bottom: 0.5rem;
}

.subject-context-box strong {
    color: var(--primary-purple, #5D3A8A);
}

.subject-email-display {
    background: white;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.875rem;
    color: var(--neutral-700, #374151);
    border: 1px solid var(--gray-200, #E5E5E5);
    display: inline-block;
}

.subject-message-box {
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid #C7D2FE;
    color: var(--neutral-700, #374151);
}

.subject-message-box strong {
    color: #4338CA;
}

.subject-message-box i {
    color: #6366F1;
}

.subject-warning-box {
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid #F59E0B;
    color: var(--neutral-700, #374151);
}

.subject-warning-box i {
    color: #D97706;
}

.subject-warning-box strong {
    color: #B45309;
}

.subject-form-card h5 {
    color: var(--neutral-800, #1F2937);
    font-weight: 600;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-200, #E5E5E5);
    margin-bottom: 1.5rem;
}

.subject-form-card h5 i {
    color: var(--primary-purple, #5D3A8A);
}

.subject-form-card .form-label {
    font-weight: 500;
    color: var(--neutral-700, #374151);
    font-size: 0.875rem;
}

.subject-form-card .form-control,
.subject-form-card .form-select {
    border-radius: 8px;
    border: 1px solid var(--gray-300, #D4D4D4);
    padding: 0.625rem 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.subject-form-card .form-control:focus,
.subject-form-card .form-select:focus {
    border-color: var(--primary-purple, #5D3A8A);
    box-shadow: 0 0 0 3px rgba(93, 58, 138, 0.15);
}

.subject-form-card .btn-primary {
    background: linear-gradient(135deg, var(--primary-purple, #5D3A8A) 0%, var(--primary-purple-light, #7C5BA8) 100%);
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.2s;
}

.subject-form-card .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(93, 58, 138, 0.4);
}

.subject-form-card .btn-primary:active {
    transform: translateY(0);
}

.subject-form-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
}

.subject-form-footer small {
    color: var(--neutral-400, #9CA3AF);
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .subject-form-page {
        padding: 1rem 0.75rem;
    }

    .subject-form-card {
        padding: 1.5rem;
        border-radius: 10px;
    }

    .subject-brand-logo {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }
}

/* =========================================
   Mobile Entity Cards
   ========================================= */
.entity-card {
    background: var(--neutral-50, #f8f9fa);
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid var(--neutral-200, #e9ecef);
}

.entity-card .entity-type-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.entity-card .entity-type-icon.company {
    background: var(--purple-light, #e8e0f0);
    color: var(--purple, #6c4f9e);
}

.entity-card .entity-type-icon.person {
    background: var(--purple-lighter, #f0ebf5);
    color: var(--purple-light, #8b6fb0);
}

/* ============================================
   Entity View Page Styles
   ============================================ */

/* Purple outline button for View Network */
.btn.btn-outline-purple {
    border: 1px solid var(--primary-purple, #5D3A8A);
    color: var(--primary-purple, #5D3A8A);
    background-color: transparent;
}

.btn.btn-outline-purple:hover,
.btn.btn-outline-purple:focus {
    background-color: var(--primary-purple, #5D3A8A);
    border-color: var(--primary-purple, #5D3A8A);
    color: white;
}

/* Entity view tags */
.entity-view-tag {
    padding: 0.4em 0.7em;
}

/* Screening questions table */
.screening-questions-table th.col-question {
    width: 60%;
}

.screening-questions-table th.col-required,
.screening-questions-table th.col-status {
    width: 20%;
}

/* Invitation status text */
.invitation-status-text {
    color: var(--primary-purple, #5D3A8A);
}

/* Back link - minimal text style */
.back-link {
    color: #6c757d;
    text-decoration: none;
    font-size: 0.9rem;
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0;
    margin: 0;
    cursor: pointer;
    transition: color 0.15s ease;
    font-family: inherit;
    outline: none;
}

.back-link:hover,
.back-link:focus {
    color: var(--primary-purple, #5D3A8A);
    text-decoration: underline;
    background: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
    outline: none;
}

.back-link:active {
    background: none !important;
    box-shadow: none !important;
}

.back-link i {
    transition: transform 0.15s ease;
}

.back-link:hover i {
    transform: translateX(-2px);
}

/* ==========================================================================
   Identity verification
   ========================================================================== */
.verification {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}
.verification h1 {
    text-align: center;
}
/* ==========================================================================
   RISK MATRIX STYLES
   ========================================================================== */

/* Risk Matrix Container */
.risk-matrix-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Risk Matrix Tabs */
.risk-matrix-tabs.nav-tabs {
    border-bottom: 1px solid var(--gray-200);
}

.risk-matrix-tabs.nav-tabs .nav-item .nav-link {
    color: #6c757d !important;
    border: none !important;
    padding: 0.75rem 1.25rem;
    font-weight: 400;
    transition: all 0.2s;
    background: transparent !important;
    opacity: 1 !important;
    border-radius: 0;
}

.risk-matrix-tabs.nav-tabs .nav-item .nav-link:hover {
    color: var(--primary-purple) !important;
    background: transparent !important;
}

.risk-matrix-tabs.nav-tabs .nav-item .nav-link.active {
    color: var(--primary-purple) !important;
    font-weight: 600;
    background: transparent !important;
    border: none !important;
}

/* Risk Matrix Filter Dropdown Fix */
.risk-matrix-container .dropdown-toggle {
    padding-right: 2rem !important;
}

.risk-matrix-container .dropdown-toggle::after {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
}

.risk-matrix-container .form-select {
    padding-right: 2.5rem;
}

/* Risk Matrix Modal Button Fixes */
.modal-footer .btn {
    min-height: 38px;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.modal-footer .btn-outline-secondary,
.modal-footer .btn-secondary {
    min-height: 38px;
}

/* Risk Category Card */
.risk-category-card {
    background: white;
    border-radius: 0.5rem;
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.risk-category-header {
    padding: 1rem 1.25rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
    transition: background 0.2s;
}

.risk-category-header:hover {
    background: var(--gray-100);
}

.risk-category-header h5 {
    color: var(--gray-800);
}

.category-chevron {
    transition: transform 0.2s;
}

.risk-category-header[aria-expanded="false"] .category-chevron,
.risk-category-header.collapsed .category-chevron {
    transform: rotate(-90deg);
}

/* Risk Factors Table */
.risk-factors-table-wrapper {
    padding: 0;
}

.risk-factors-table {
    margin-bottom: 0;
}

.risk-factors-table thead th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-600);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.risk-factors-table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

.risk-factors-table tbody tr.inactive-factor {
    opacity: 0.6;
    background: var(--gray-50);
}

.factor-name {
    font-weight: 500;
    color: var(--gray-800);
}

.weight-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--light-purple);
    color: var(--primary-purple-dark);
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.875rem;
}

.default-score {
    color: var(--gray-600);
}

/* Country Scores Table */
.risk-countries-table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

.country-flag {
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.risk-score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 600;
    font-size: 0.875rem;
}

.risk-score-badge.risk-low {
    background: #d1fae5;
    color: #047857;
}

.risk-score-badge.risk-medium {
    background: #fef3c7;
    color: #b45309;
}

.risk-score-badge.risk-high {
    background: #fee2e2;
    color: #b91c1c;
}

.risk-score-badge.risk-unknown {
    background: var(--gray-200);
    color: var(--gray-600);
}

.risk-score-badge.risk-incomplete {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc10740;
}

.risk-score-circle.incomplete {
    border-color: #6c757d;
    color: #6c757d;
}

.risk-level-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.risk-level-badge.risk-low {
    background: #d1fae5;
    color: #047857;
}

.risk-level-badge.risk-medium {
    background: #fef3c7;
    color: #b45309;
}

.risk-level-badge.risk-high {
    background: #fee2e2;
    color: #b91c1c;
}

.risk-level-badge.risk-unknown {
    background: var(--gray-200);
    color: var(--gray-600);
}

/* Thresholds Styles */
.threshold-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
}

.threshold-color-indicator {
    width: 8px;
    height: 50px;
    border-radius: 4px;
    flex-shrink: 0;
}

.risk-scale-visual {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    padding: 1.5rem;
}

.risk-scale-bar {
    display: flex;
    height: 24px;
    border-radius: 4px;
    overflow: hidden;
}

.risk-scale-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
}

.risk-scale-labels {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.risk-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}

/* Entity Risk Panel */
.entity-risk-panel {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    width: 100%;
}

.risk-score-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--risk-color) 0%, color-mix(in srgb, var(--risk-color) 80%, black) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--risk-color) 40%, transparent);
}

.risk-score-circle-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--risk-color) 0%, color-mix(in srgb, var(--risk-color) 80%, black) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--risk-color) 40%, transparent);
}

.risk-level-label {
    font-weight: 600;
    font-size: 1.125rem;
}

.risk-categories-mini {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
}

.risk-category-mini-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem;
    background: var(--gray-50);
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

.risk-category-mini-item .category-name {
    color: var(--gray-600);
}

.risk-category-mini-item .category-score {
    font-weight: 600;
    color: var(--gray-800);
}

/* Risk Details Table */
.risk-details-table thead th {
    background: var(--gray-50);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-600);
}

.risk-details-table tbody td {
    font-size: 0.875rem;
}

.factor-score {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-weight: 600;
    font-size: 0.8125rem;
}

.factor-score.low {
    background: #d1fae5;
    color: #047857;
}

.factor-score.medium {
    background: #fef3c7;
    color: #b45309;
}

.factor-score.high {
    background: #fee2e2;
    color: #b91c1c;
}

.factor-weight {
    color: var(--gray-500);
    font-size: 0.8125rem;
}

/* Risk History */
.risk-history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.risk-history-item {
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: 0.375rem;
}

.risk-score-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
}

/* Entity Badge colors for risk factors */
.badge.bg-purple-light {
    background-color: var(--light-purple) !important;
}

.badge.text-purple {
    color: var(--primary-purple) !important;
}

.badge.bg-purple-lighter {
    background-color: var(--very-light-purple) !important;
}

.badge.text-purple-light {
    color: var(--primary-purple-light) !important;
}

/* Risk Panel Actions */
.risk-panel-actions {
    display: flex;
    gap: 0.25rem;
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .risk-matrix-tabs .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .risk-factors-table thead th,
    .risk-factors-table tbody td {
        padding: 0.5rem 0.75rem;
    }
    
    .risk-score-circle {
        width: 50px;
        height: 50px;
        font-size: 1rem;
    }
}

/* =========================================================================
   SETTINGS PAGES
   ========================================================================= */

/* Settings page container - constrained width for readability */
.section-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* =========================================================================
   TAGS MANAGEMENT
   ========================================================================= */

/* Tags table column widths */
.tags-table th.col-color { width: 5%; }
.tags-table th.col-name { width: 25%; }
.tags-table th.col-description { width: 35%; }
.tags-table th.col-entities { width: 15%; }
.tags-table th.col-actions { width: 20%; }

/* Tag color preview swatch */
.tag-color-preview {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: inline-block;
}

/* Tag preview badge */
.tag-preview-badge {
    font-size: 0.9em;
}

/* Empty state icon */
.tags-empty-icon {
    font-size: 3rem;
}

/* Color picker input sizing */
.tag-color-picker {
    width: 60px;
    height: 40px;
}

/* =========================================================================
   RISK DETAILS MODAL
   ========================================================================= */

/* Large risk score circle for modal */
.risk-score-circle-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: var(--risk-color, #6c757d);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
}

/* Risk details table column widths */
.risk-details-table th.col-score,
.risk-details-table td.col-score { width: 70px; }
.risk-details-table th.col-weight,
.risk-details-table td.col-weight { width: 70px; }
.risk-details-table th.col-weighted,
.risk-details-table td.col-weighted { width: 90px; }

/* Factor score badges */
.factor-score {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.875rem;
}

.factor-score.high {
    background-color: #f8d7da;
    color: #721c24;
}

.factor-score.medium {
    background-color: #fff3cd;
    color: #856404;
}

.factor-score.low {
    background-color: #d4edda;
    color: #155724;
}

.factor-weight {
    color: #6c757d;
    font-size: 0.875rem;
}

/* Risk history mini score */
.risk-score-mini {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    border-radius: 50%;
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
}

/* Risk history list */
.risk-history-list {
    max-height: 200px;
    overflow-y: auto;
}

.risk-history-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

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

/* ==========================================================================
   DATA STATUS CARD (Country Risk)
   ========================================================================== */

.data-status-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    overflow: hidden;
}

.data-status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--gray-50);
    border-bottom: 1px solid transparent;
}

.data-status-card.expanded .data-status-header {
    border-bottom-color: var(--gray-200);
}

.data-status-info {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.data-status-icon {
    width: 40px;
    height: 40px;
    background: var(--light-purple);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-purple);
    font-size: 1.25rem;
}

.data-status-title {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 0.9375rem;
}

.data-status-meta {
    color: var(--gray-500);
    font-size: 0.8125rem;
    margin-top: 0.125rem;
}

.data-status-meta .status-synced {
    color: var(--success);
}

.data-status-meta .status-changes {
    color: var(--primary-purple);
    font-weight: 500;
}

.data-status-toggle {
    font-size: 0.8125rem;
    padding: 0.375rem 0.75rem;
}

.data-status-toggle .toggle-chevron {
    transition: transform 0.2s;
    font-size: 0.75rem;
}

.data-status-card.expanded .toggle-chevron {
    transform: rotate(180deg);
}

/* History Panel */
.data-status-history {
    background: white;
    max-height: 400px;
    overflow: hidden;
}

.history-panel-header {
    padding: 0.75rem 1.25rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.history-panel-header h6 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.history-list {
    max-height: 320px;
    overflow-y: auto;
}

/* History Item */
.history-item {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.15s;
}

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

.history-item:hover {
    background: var(--gray-50);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.375rem;
}

.history-item-date {
    font-weight: 500;
    color: var(--gray-800);
    font-size: 0.875rem;
}

.history-item-badge {
    font-size: 0.6875rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 500;
}

.history-item-badge.initial {
    background: var(--light-purple);
    color: var(--primary-purple-dark);
}

.history-item-badge.update {
    background: var(--primary-100);
    color: var(--primary-700);
}

.history-item-stats {
    font-size: 0.8125rem;
    color: var(--gray-600);
    margin-bottom: 0.375rem;
}

.history-item-stats .stat-highlight {
    color: var(--primary-purple);
    font-weight: 500;
}

.history-item-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.source-tag {
    font-size: 0.6875rem;
    padding: 0.125rem 0.375rem;
    background: var(--gray-100);
    color: var(--gray-600);
    border-radius: 0.25rem;
}

/* Changes Details (collapsible within each history item) */
.history-item-changes {
    margin-top: 0.625rem;
    padding-top: 0.625rem;
    border-top: 1px dashed var(--gray-200);
}

.changes-toggle {
    font-size: 0.75rem;
    color: var(--primary-purple);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.changes-toggle:hover {
    text-decoration: underline;
}

.changes-detail-list {
    margin-top: 0.5rem;
    max-height: 150px;
    overflow-y: auto;
}

.change-item {
    font-size: 0.75rem;
    color: var(--gray-600);
    padding: 0.25rem 0;
    border-bottom: 1px dotted var(--gray-100);
}

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

.change-item i {
    margin-right: 0.375rem;
    font-size: 0.6875rem;
}

.change-item.increase i { color: var(--warning); }
.change-item.decrease i { color: var(--success); }
.change-item.escalate i { color: var(--danger); }

/* Responsive adjustments for data status card */
@media (max-width: 576px) {
    .data-status-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    
    .data-status-toggle {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================================================
   THRESHOLD SLIDER
   ========================================================================== */

.threshold-slider-container {
    padding: 1rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
}

.threshold-slider-wrapper {
    position: relative;
    height: 40px;
    margin: 0.5rem 0;
}

.threshold-bar {
    position: absolute;
    top: 8px;
    left: 0;
    right: 0;
    height: 24px;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.threshold-segment {
    height: 100%;
    transition: width 0.1s ease-out;
}

.segment-low {
    background: linear-gradient(180deg, #34d399 0%, #22c55e 100%);
}

.segment-medium {
    background: linear-gradient(180deg, #fcd34d 0%, #f59e0b 100%);
}

.segment-high {
    background: linear-gradient(180deg, #f87171 0%, #ef4444 100%);
}

.slider-track {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    cursor: pointer;
}

.slider-handle {
    position: absolute;
    top: 0;
    width: 28px;
    height: 40px;
    margin-left: -14px;
    cursor: ew-resize;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider-handle::before {
    content: '';
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    border: 3px solid var(--primary-purple);
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.slider-handle:hover::before {
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
    border-color: var(--primary-purple-dark);
}

.slider-handle.dragging::before {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(93, 58, 138, 0.4);
    border-color: var(--primary-purple-dark);
    background: var(--light-purple);
}

.slider-handle.dragging {
    z-index: 20;
}

.handle-tooltip {
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
}

.handle-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -4px;
    border-width: 4px;
    border-style: solid;
    border-color: var(--gray-800) transparent transparent transparent;
}

.slider-handle:hover .handle-tooltip,
.slider-handle.dragging .handle-tooltip {
    opacity: 1;
}

.threshold-scale-labels {
    font-size: 0.75rem;
    color: var(--gray-500);
    padding: 0 2px;
}

.threshold-badge {
    min-width: 60px;
    font-weight: 600;
    transition: all 0.1s;
}

/* Threshold slider action area */
.threshold-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-100);
}

.threshold-actions .btn-apply-thresholds {
    background-color: var(--primary-purple);
    border-color: var(--primary-purple);
    color: white;
    border-radius: 8px;
    padding: 0.5rem 1.25rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 0;
}

.threshold-actions .btn-apply-thresholds:hover:not(:disabled) {
    background-color: var(--primary-purple-dark);
    border-color: var(--primary-purple-dark);
    box-shadow: 0 4px 12px rgba(93, 58, 138, 0.25);
    transform: translateY(-1px);
}

.threshold-actions .btn-apply-thresholds:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.threshold-actions .save-status {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.threshold-actions .save-status.saved {
    color: var(--success);
}

.threshold-actions .save-status.error {
    color: var(--danger);
}

/* Threshold card styles */
.threshold-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
}

.threshold-color-indicator {
    width: 6px;
    height: 48px;
    border-radius: 3px;
    flex-shrink: 0;
}

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

/* Spin animation utility */
@keyframes spin-animation {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    display: inline-block;
    animation: spin-animation 1s linear infinite;
}

/* ==========================================================================
   RISK INCOMPLETE STATUS
   ========================================================================== */

.risk-score-circle.incomplete {
    background: var(--gray-200);
    border: 2px dashed var(--warning);
    color: var(--warning);
}

.risk-score-circle.incomplete i {
    font-size: 1.75rem;
}

.entity-risk-panel .alert-warning {
    background-color: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 0.5rem;
}

.entity-risk-panel .alert-warning ul {
    margin-bottom: 0;
}

/* Risk badge for incomplete status in lists */
.risk-badge-incomplete {
    background: var(--gray-200);
    color: var(--gray-600);
    border: 1px dashed var(--warning);
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

/* Required factor badge */
.badge.bg-warning-subtle {
    background-color: rgba(255, 193, 7, 0.15) !important;
    font-size: 0.65rem;
    font-weight: 500;
    padding: 0.2rem 0.4rem;
}

/* Risk override trigger indicators */
.risk-override-list {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

/* Panel: compact single-line items */
.risk-override-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.4;
}

.risk-override-item i {
    font-size: 0.65rem;
    flex-shrink: 0;
}

/* Modal: label + detail below */
.risk-override-item-detail {
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
    line-height: 1.4;
}

.risk-override-item-detail i {
    font-size: 0.75rem;
    margin-right: 0.25rem;
}

.risk-override-detail-text {
    font-size: 0.75rem;
    padding-left: 1.15rem;
    line-height: 1.3;
}

/* Separator when triggers appear inside summary section */
.risk-summary-section > .risk-override-list {
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200, #e9ecef);
}


/* Wizard accordion numbering (manual-qa-bug-sweep-2026-06-10, Phase 1).
   Display numbers are positional CSS counters, so they stay correct as
   blocks are added/removed without renumbering DOM ids (renumbering ids
   silently retargeted saved Edit/Delete buttons' hx-target). */
#forms-container {
    counter-reset: acc-item;
}
#forms-container > .accordion-item {
    counter-increment: acc-item;
}
#forms-container .acc-no::before {
    content: "#" counter(acc-item);
}

/* === Retire/resign: former position-holder rows (feature-requests/retire-resign-position-holder.md) === */
.former-row { display: none; }
.show-former .former-row { display: table-row; }
.former-row td { background: #faf9fc; color: #6c757d; }
.former-row .fw-medium { color: #6c757d !important; text-decoration: line-through; text-decoration-color: #c9c2d6; }
.role-end-chip { display: inline-block; font-size: .72rem; padding: .12rem .5rem; border-radius: 1rem;
  background: rgba(93,58,138,.08); color: var(--primary-purple-dark); white-space: nowrap; margin-top: .2rem; }
.show-former-switch { font-size: .8rem; color: #6c757d; }
