/* ========================================
   AI Trace - Modern Design System
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Brand: indigo → violet */
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-rgb: 79, 70, 229;
    --accent: #7c3aed;
    --accent-dark: #6d28d9;
    --accent-50: #f5f3ff;
    --grad-brand: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --grad-sidebar: linear-gradient(180deg, #1e1b4b 0%, #2e1065 100%);
    /* Accent palette (icon tiles, categories) */
    --c-indigo: #6366f1;
    --c-violet: #8b5cf6;
    --c-teal: #0d9488;
    --c-sky: #0284c7;
    --c-amber: #d97706;
    --c-rose: #e11d48;
    --c-emerald: #059669;
    /* Dark sidebar */
    --sidebar-bg: #1e1b4b;
    --sidebar-hover: rgba(255, 255, 255, 0.07);
    --sidebar-active: rgba(255, 255, 255, 0.13);
    --sidebar-text: #e0e7ff;
    --sidebar-text-muted: #a5b4fc;
    --sidebar-border: rgba(255, 255, 255, 0.09);
    --bg: #f5f6fd;
    --surface: #ffffff;
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e3e6f3;
    --border-light: #f1f2fa;
    --success: #059669;
    --success-bg: #ecfdf5;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.04);
    --shadow: 0 1px 3px rgb(15 23 42 / 0.06), 0 1px 2px -1px rgb(15 23 42 / 0.06);
    --shadow-md: 0 6px 12px -4px rgb(15 23 42 / 0.08), 0 2px 4px -2px rgb(15 23 42 / 0.06);
    --shadow-lg: 0 10px 15px -3px rgb(15 23 42 / 0.10), 0 4px 6px -4px rgb(15 23 42 / 0.08);
    --radius: 0.625rem;
    --radius-lg: 0.875rem;
    --radius-xl: 1rem;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --topbar-height: 64px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   Base
   ======================================== */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html { font-size: 15px; }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ========================================
   Sidebar
   ======================================== */

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    z-index: 1040;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--sidebar-border);
    min-height: var(--topbar-height);
}

.sidebar-brand .brand-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    color: white;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    margin-left: 0.75rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}

.nav-section-title {
    padding: 0.75rem 1.5rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-text-muted);
    white-space: nowrap;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.6rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
    white-space: nowrap;
}

.sidebar-link:hover {
    color: var(--primary-dark);
    background: var(--sidebar-hover);
    border-left-color: var(--primary);
}

.sidebar-link.active {
    color: var(--primary-dark);
    background: var(--sidebar-active);
    border-left-color: var(--primary);
    font-weight: 600;
}

.sidebar-link .nav-icon {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
    flex-shrink: 0;
    color: var(--sidebar-text-muted);
}

/* Region letter icons (T, A, K, M) */
.region-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--primary);
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
    margin-right: 0.75rem;
}

.sidebar-link:hover .region-letter,
.sidebar-link.active .region-letter {
    background: var(--primary-dark);
}

/* Skip Trace collapsible submenu */
.submenu-toggle .submenu-caret {
    width: 16px;
    height: 16px;
    margin-left: auto;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    color: var(--sidebar-text-muted);
}
.submenu-group.open .submenu-toggle .submenu-caret {
    transform: rotate(180deg);
}
.submenu {
    display: none;
    overflow: hidden;
}
.submenu-group.open .submenu {
    display: block;
}
.submenu-link {
    padding-left: 3.25rem;
    font-size: 0.85rem;
}
/* Keep the caret hidden and submenu closed visuals sane when collapsed to mini strip */
.app-sidebar.collapsed .submenu-caret {
    display: none;
}
.app-sidebar.collapsed .submenu {
    display: none;
}

/* Nav icon box (SVG icons with colored background) */
.nav-icon-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--primary);
    flex-shrink: 0;
    margin-right: 0.75rem;
}
.nav-icon-box svg {
    width: 14px;
    height: 14px;
    color: white;
    stroke: white;
}
.sidebar-link:hover .nav-icon-box,
.sidebar-link.active .nav-icon-box {
    background: var(--primary-dark);
}

.sidebar-link:hover .nav-icon,
.sidebar-link.active .nav-icon {
    color: var(--primary);
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--sidebar-border);
}

.sidebar-footer .sidebar-link {
    padding: 0.6rem 0;
    border-left: none;
}

/* Sidebar Toggle Button (inside sidebar) */
.sidebar-collapse-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--sidebar-text-muted);
    border-radius: var(--radius);
    transition: var(--transition);
    margin-left: auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-collapse-btn:hover {
    background: var(--sidebar-hover);
    color: var(--text);
}

.sidebar-collapse-btn svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

/* ========================================
   Sidebar Collapsed State (desktop)
   ======================================== */

.app-sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.app-sidebar.collapsed .brand-text,
.app-sidebar.collapsed .brand-icon {
    display: none;
}

.app-sidebar.collapsed .nav-section-title {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.app-sidebar.collapsed .sidebar-link {
    padding: 0.75rem 0;
    justify-content: center;
    border-left: none;
}

.app-sidebar.collapsed .sidebar-link .nav-icon {
    margin-right: 0;
    width: 22px;
    height: 22px;
}

.app-sidebar.collapsed .sidebar-link .link-text {
    display: none;
}

.app-sidebar.collapsed .sidebar-brand {
    padding: 0;
    justify-content: center;
    min-height: auto;
    border-bottom: none;
}

.app-sidebar.collapsed .sidebar-collapse-btn {
    width: 100%;
    height: var(--topbar-height);
    margin: 0;
    border-radius: 0;
    background: transparent;
    border-bottom: 1px solid var(--sidebar-border);
    color: var(--text);
}

.app-sidebar.collapsed .sidebar-collapse-btn:hover {
    background: var(--sidebar-hover);
}

.app-sidebar.collapsed .sidebar-collapse-btn svg {
    width: 22px;
    height: 22px;
    transform: none;
}

.app-sidebar.collapsed .sidebar-footer {
    padding: 0.75rem 0.5rem;
}

.app-sidebar.collapsed .sidebar-footer .sidebar-link {
    justify-content: center;
    padding: 0.6rem 0;
}

.app-sidebar.collapsed + .sidebar-overlay + .app-topbar,
.app-sidebar.collapsed ~ .app-topbar {
    left: var(--sidebar-collapsed);
}

.app-sidebar.collapsed ~ .app-content {
    margin-left: var(--sidebar-collapsed);
}

.app-sidebar.collapsed ~ .app-footer {
    margin-left: var(--sidebar-collapsed);
}

/* Tooltip for collapsed sidebar icons */
.app-sidebar.collapsed .sidebar-link {
    position: relative;
}

.app-sidebar.collapsed .sidebar-link:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(var(--sidebar-collapsed) - 4px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--text);
    color: white;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 1050;
    box-shadow: var(--shadow-md);
    pointer-events: none;
}

/* ========================================
   Topbar
   ======================================== */

.app-topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 1030;
    transition: var(--transition);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: var(--radius);
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--bg);
    color: var(--text);
}

.sidebar-toggle svg {
    width: 22px;
    height: 22px;
}

/* Hide collapse button on mobile, show mobile toggle instead */
@media (min-width: 992px) {
    .sidebar-collapse-btn {
        display: flex;
    }
}
@media (max-width: 991px) {
    .sidebar-collapse-btn {
        display: none;
    }
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.expiry-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    background: var(--primary-50);
    color: var(--primary);
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.expiry-badge svg {
    width: 14px;
    height: 14px;
}

/* Skip Trace wallet balance in the top bar (links to My Wallet). */
.wallet-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    background: var(--success-bg);
    color: var(--c-emerald);
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
}
.wallet-badge:hover { color: var(--c-emerald); filter: brightness(0.96); }
.wallet-badge b { font-weight: 700; }
.wallet-badge svg { width: 14px; height: 14px; }
.wallet-badge.wallet-badge-empty { background: var(--danger-bg); color: var(--danger); }
.wallet-badge.wallet-badge-empty:hover { color: var(--danger); }

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 1rem;
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

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

.btn-logout svg {
    width: 16px;
    height: 16px;
}

/* ========================================
   Main Content
   ======================================== */

.app-content {
    margin-left: var(--sidebar-width);
    padding-top: var(--topbar-height);
    min-height: 100vh;
    transition: var(--transition);
    background: var(--bg);
}

.content-wrapper {
    padding: 1.5rem;
}

/* ========================================
   Footer
   ======================================== */

.app-footer {
    margin-left: var(--sidebar-width);
    padding: 1rem 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: var(--surface);
    transition: var(--transition);
}

/* ========================================
   Page Header
   ======================================== */

.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 0.25rem 0;
    letter-spacing: 0.5px;
}

.page-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
}

/* ========================================
   Cards
   ======================================== */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

/* ========================================
   Search Tabs
   ======================================== */

.search-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.search-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 50px;
    border: 1.5px solid #cbd5e1;
    background: #f8fafc;
    color: #555;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    user-select: none;
}

.search-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-100);
}

.search-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.18);
}

.search-input-group {
    margin-top: 0.5rem;
}

.search-input-group .row {
    align-items: center;
    gap: 0;
}

.search-input-group .form-control {
    border-radius: 8px;
    border: 1.5px solid #cbd5e1;
    padding: 10px 14px;
    font-size: 14px;
    transition: border-color 0.2s;
    height: 44px;
}

.search-input-group .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.08);
}

.search-input-group .btn-search {
    flex-shrink: 0;
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    border-radius: var(--radius);
    transition: var(--transition);
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn svg {
    width: 16px;
    height: 16px;
}

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

.btn-primary:hover, .btn-primary:focus {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: white;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.2);
}

.btn-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 32px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    height: 44px;
    flex-shrink: 0;
}

.btn-search svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

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

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

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

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

.btn-success {
    background: var(--success);
    border-color: var(--success);
}

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

.btn-secondary {
    background: var(--text-secondary);
    border-color: var(--text-secondary);
}

.btn-sm {
    padding: 0.35rem 0.85rem;
    font-size: 0.82rem;
}

/* ========================================
   Forms
   ======================================== */

.form-control, .form-select {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.55rem 0.85rem;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    transition: var(--transition);
    background-color: var(--surface);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

/* ========================================
   Tables
   ======================================== */

.custom-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.82rem;
    margin-bottom: 0 !important;
}

.custom-table th,
.custom-table td {
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 12px 14px;
    font-size: 0.82rem;
}

.custom-table thead {
    background-color: var(--primary);
}

.custom-table thead th {
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
    text-transform: uppercase;
    font-size: 0.72rem;
    color: #ffffff !important;
    border-bottom: none;
    padding-right: 26px !important;
    position: relative;
}

/* DataTables sort arrows — remove default, add white arrows */
table.dataTable thead th.sorting,
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc,
table.dataTable thead td.sorting,
table.dataTable thead td.sorting_asc,
table.dataTable thead td.sorting_desc,
.custom-table thead th.sorting,
.custom-table thead th.sorting_asc,
.custom-table thead th.sorting_desc {
    background-image: none !important;
    background: transparent !important;
}
.custom-table thead {
    background-color: var(--primary) !important;
}

/* Up/down arrow for unsorted */
table.dataTable thead th.sorting::before,
table.dataTable thead th.sorting::after,
.custom-table thead th.sorting::before,
.custom-table thead th.sorting::after {
    content: '' !important;
    position: absolute !important;
    right: 10px !important;
    border: 5px solid transparent !important;
    display: block !important;
    opacity: 1 !important;
    bottom: auto !important;
}
table.dataTable thead th.sorting::before,
.custom-table thead th.sorting::before {
    top: calc(50% - 9px) !important;
    border-bottom-color: rgba(255,255,255,0.4) !important;
}
table.dataTable thead th.sorting::after,
.custom-table thead th.sorting::after {
    top: calc(50% + 1px) !important;
    border-top-color: rgba(255,255,255,0.4) !important;
}

/* Ascending sort arrow */
table.dataTable thead th.sorting_asc::before,
.custom-table thead th.sorting_asc::before {
    content: '' !important;
    position: absolute !important;
    right: 10px !important;
    top: calc(50% - 5px) !important;
    border: 5px solid transparent !important;
    border-bottom-color: #fff !important;
    display: block !important;
    opacity: 1 !important;
}
table.dataTable thead th.sorting_asc::after,
.custom-table thead th.sorting_asc::after {
    content: none !important;
}

/* Descending sort arrow */
table.dataTable thead th.sorting_desc::before,
.custom-table thead th.sorting_desc::before {
    content: none !important;
}
table.dataTable thead th.sorting_desc::after,
.custom-table thead th.sorting_desc::after {
    content: '' !important;
    position: absolute !important;
    right: 10px !important;
    top: calc(50% - 3px) !important;
    border: 5px solid transparent !important;
    border-top-color: #fff !important;
    display: block !important;
    opacity: 1 !important;
}

.custom-table tbody td {
    vertical-align: middle;
    color: #1e293b;
    font-weight: 500;
}

.custom-table tbody tr {
    background-color: var(--surface);
    transition: background-color 0.15s;
}

.custom-table tbody tr:nth-child(even) {
    background-color: var(--bg);
}

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

.fixed-address-column {
    width: 180px;
    word-wrap: break-word;
    max-width: 180px;
}

/* ========================================
   Status Badges
   ======================================== */

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.65rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-active {
    background: var(--success-bg);
    color: var(--success);
}

.badge-inactive {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 0.4rem;
    border-radius: 2rem;
    font-size: 0.82rem;
    font-weight: 700;
    background: var(--primary-50);
    color: var(--primary);
}

/* ========================================
   DataTables 2.x Override
   ======================================== */

/* Container */
div.dt-container,
.dataTables_wrapper {
    font-family: 'Inter', sans-serif;
    padding: 8px 16px;
}

/* Search input */
div.dt-container .dt-search input,
.dataTables_filter input {
    border-radius: var(--radius) !important;
    border: 1.5px solid var(--border) !important;
    padding: 8px 14px !important;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: all 0.2s;
    min-width: 220px;
    background: var(--bg);
    color: var(--text);
}
div.dt-container .dt-search input:focus,
.dataTables_filter input:focus {
    border-color: var(--primary) !important;
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

/* Search label */
div.dt-container .dt-search label,
div.dt-container .dt-length label,
.dataTables_length label,
.dataTables_filter label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Page length select */
div.dt-container .dt-length select,
.dataTables_length select {
    border: 1.5px solid var(--border) !important;
    border-radius: var(--radius) !important;
    padding: 8px 2rem 8px 10px !important;
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}
div.dt-container .dt-length select:focus,
.dataTables_length select:focus {
    border-color: var(--primary) !important;
    background-color: var(--surface);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

/* Info text */
div.dt-container .dt-info,
.dataTables_info {
    font-size: 0.8rem !important;
    color: var(--text-muted) !important;
    font-weight: 500;
    padding-top: 8px !important;
}

/* Pagination container */
div.dt-container .dt-paging,
.dataTables_paginate {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-top: 8px;
}

/* Pagination buttons */
div.dt-container .dt-paging .dt-paging-button,
.dataTables_paginate .paginate_button {
    border-radius: var(--radius) !important;
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
    font-weight: 500 !important;
    border: 1px solid var(--border) !important;
    margin: 0 2px !important;
    background: var(--surface) !important;
    color: var(--text-secondary) !important;
    transition: all 0.15s ease !important;
    cursor: pointer;
    min-width: 34px;
    text-align: center;
}

/* Active page */
div.dt-container .dt-paging .dt-paging-button.current,
div.dt-container .dt-paging .dt-paging-button.current:hover,
.dataTables_paginate .paginate_button.current,
.dataTables_paginate .paginate_button.current:hover,
.dataTables_paginate a.paginate_button.current,
.dataTables_paginate a.paginate_button.current:hover {
    background: var(--primary) !important;
    color: #fff !important;
    border-color: var(--primary) !important;
    box-shadow: 0 2px 6px rgba(var(--primary-rgb), 0.25) !important;
    font-weight: 600 !important;
    -webkit-text-fill-color: #fff !important;
}

/* Hover state */
div.dt-container .dt-paging .dt-paging-button:hover:not(.current):not(.disabled),
.dataTables_paginate .paginate_button:hover:not(.current):not(.disabled) {
    background: var(--primary-50) !important;
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}

/* Disabled state */
div.dt-container .dt-paging .dt-paging-button.disabled,
div.dt-container .dt-paging .dt-paging-button.disabled:hover,
.dataTables_paginate .paginate_button.disabled,
.dataTables_paginate .paginate_button.disabled:hover {
    opacity: 0.35 !important;
    cursor: not-allowed !important;
    background: var(--bg) !important;
    color: var(--text-muted) !important;
    border-color: var(--border) !important;
}

/* Scroll body */
.dataTables_scrollBody,
div.dt-container .dt-scroll-body {
    border-top: none !important;
    border-bottom: 1px solid var(--border) !important;
}

/* Hide default DataTables borders */
table.dataTable.no-footer,
table.dataTable {
    border-bottom: none !important;
    border-collapse: collapse !important;
}

/* DT2 sort arrow overrides — white on blue header */
table.dataTable thead th.dt-ordering-asc span.dt-column-order,
table.dataTable thead th.dt-ordering-desc span.dt-column-order,
table.dataTable thead th span.dt-column-order {
    color: #fff !important;
    opacity: 0.7;
}
table.dataTable thead th.dt-ordering-asc span.dt-column-order,
table.dataTable thead th.dt-ordering-desc span.dt-column-order {
    opacity: 1 !important;
}

/* DT1 sort arrow overrides (fallback) */
table.dataTable thead th.sorting,
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc {
    background-image: none !important;
}

/* Sort icons refinement */
table.dataTable thead .sorting::before,
table.dataTable thead .sorting_asc::before,
table.dataTable thead .sorting_desc::before,
table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after {
    opacity: 0.3;
    font-size: 0.65rem;
}

table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after {
    opacity: 0.9;
    color: var(--primary);
}

/* Remove default DataTables borders */
table.dataTable.no-footer {
    border-bottom: none !important;
}

table.dataTable thead th,
table.dataTable thead td {
    border-bottom: 2px solid var(--border) !important;
}

table.dataTable.display tbody tr.odd,
table.dataTable.display tbody tr.even {
    background: transparent;
}

/* ========================================
   Pagination Bar
   ======================================== */

.pagination-bar {
    background: #f8f8fc;
    border-radius: 10px;
    padding: 14px 20px;
    margin: 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-info {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

.pagination-bar .btn {
    padding: 0.4rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.82rem;
}

/* ========================================
   Login Page
   ======================================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    padding: 1rem;
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

.login-header {
    background: var(--primary);
    padding: 2rem;
    text-align: center;
    color: white;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0.5rem 0 0.25rem;
    letter-spacing: -0.02em;
}

.login-header p {
    font-size: 0.85rem;
    opacity: 0.7;
    margin: 0;
}

.login-header .login-icon {
    width: 56px;
    height: 56px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.login-header .login-icon svg {
    width: 28px;
    height: 28px;
}

.login-body {
    padding: 2rem;
}

.login-body .form-group {
    margin-bottom: 1.25rem;
}

.login-body .form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.login-body .form-control {
    padding: 0.65rem 0.85rem;
}

.login-body .btn-login {
    width: 100%;
    padding: 0.7rem;
    font-size: 1rem;
    font-weight: 600;
    background: var(--primary);
    border: none;
    color: white;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    margin-top: 0.5rem;
}

.login-body .btn-login:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

/* ========================================
   Security Notice Popup
   ======================================== */

.notice-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
    overflow-y: auto;          /* scroll if the popup is taller than the screen */
    padding: 24px 12px;        /* keeps the popup off the screen edges */
}

.notice-overlay.notice-hidden {
    opacity: 0;
    pointer-events: none;
}

.notice-popup {
    background: #ffffff;
    border-radius: 16px;
    width: 90%;
    max-width: 520px;
    padding: 2rem 2rem 1.5rem;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: noticeSlideIn 0.4s ease;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);   /* fit within the viewport (mobile-safe) */
}

@keyframes noticeSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.notice-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s;
}

.notice-close:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.notice-close:not(:disabled):hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.notice-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: #ffffff;
}

.notice-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 1.25rem;
    letter-spacing: -0.02em;
}

.notice-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    overflow-y: auto;   /* only the list scrolls; icon/title/close/timer stay pinned */
    min-height: 0;      /* allow the list to shrink inside the flex column */
}

.notice-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 0.85rem 1.1rem;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.55;
    color: #1e293b;
}

.notice-item strong {
    color: #b45309;
    font-weight: 800;
}

.notice-num {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    background: #f59e0b;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    margin-top: 1px;
}

.notice-timer {
    text-align: center;
    font-size: 0.85rem;
    color: #64748b;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

/* Compact the notice on small / short screens so the close button and content fit. */
@media (max-width: 480px), (max-height: 700px) {
    .notice-popup { padding: 1.25rem 1.1rem 1rem; border-radius: 14px; }
    .notice-icon { width: 48px; height: 48px; margin-bottom: 0.6rem; }
    .notice-icon svg { width: 26px; height: 26px; }
    .notice-title { font-size: 1.2rem; margin-bottom: 0.9rem; }
    .notice-body { gap: 0.55rem; margin-bottom: 0.9rem; }
    .notice-item { font-size: 0.88rem; padding: 0.6rem 0.8rem; gap: 0.55rem; line-height: 1.45; }
    .notice-num { width: 22px; height: 22px; font-size: 0.72rem; }
    .notice-timer { font-size: 0.78rem; padding-top: 0.6rem; }
    .notice-close { top: 0.6rem; right: 0.6rem; width: 32px; height: 32px; }
}

/* ========================================
   Toast Notification
   ======================================== */

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
}

.toast-msg {
    background: var(--danger);
    color: white;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
    max-width: 600px;
    margin-bottom: 0.5rem;
}

.toast-msg.success {
    background: var(--success);
}

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

/* ========================================
   Form Card
   ======================================== */

.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    max-width: 720px;
    margin: 0 auto;
}

.form-card .card-header {
    background: var(--primary);
    color: white;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 1.25rem 1.5rem;
}

.form-card .card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.form-card .card-body {
    padding: 1.5rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
}

/* ========================================
   Empty State
   ======================================== */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state p {
    font-size: 0.95rem;
    margin: 0;
}

/* ========================================
   Responsive
   ======================================== */

/* ── Tablet & below (< 992px) ── */
@media (max-width: 991px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    /* Force-hide collapsed sidebar on mobile (override specificity) */
    .app-sidebar.collapsed {
        transform: translateX(-100%);
    }

    .app-sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    /* When sidebar opens on mobile, force full-width regardless of collapsed class */
    .app-sidebar.collapsed.open {
        transform: translateX(0);
        width: var(--sidebar-width);
        box-shadow: var(--shadow-lg);
    }

    /* Show hidden elements when open+collapsed on mobile */
    .app-sidebar.collapsed.open .brand-text,
    .app-sidebar.collapsed.open .brand-icon {
        display: flex;
    }
    .app-sidebar.collapsed.open .sidebar-link .link-text {
        display: inline;
    }
    .app-sidebar.collapsed.open .nav-section-title {
        opacity: 1;
        height: auto;
        padding: 0.75rem 1.25rem 0.4rem;
    }
    .app-sidebar.collapsed.open .sidebar-link {
        padding: 0.55rem 1.25rem;
        justify-content: flex-start;
    }
    .app-sidebar.collapsed.open .sidebar-link .nav-icon {
        margin-right: 0.75rem;
    }

    .sidebar-toggle {
        display: block;
    }

    /* Override collapsed sibling selectors — content must be full-width on mobile */
    .app-topbar {
        left: 0;
    }
    .app-sidebar.collapsed + .sidebar-overlay + .app-topbar,
    .app-sidebar.collapsed ~ .app-topbar {
        left: 0;
    }

    .app-content {
        margin-left: 0;
    }
    .app-sidebar.collapsed ~ .app-content {
        margin-left: 0;
    }

    .app-footer {
        margin-left: 0;
    }
    .app-sidebar.collapsed ~ .app-footer {
        margin-left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1035;
    }

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

    .search-tabs {
        gap: 0.35rem;
    }

    .search-tab {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }

    /* Page headers stack on tablet */
    .page-header.d-flex {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .page-header .d-flex.gap-2 {
        width: 100%;
    }

    .page-header .d-flex.gap-2 .btn {
        flex: 1;
        justify-content: center;
    }
}

/* ── Mobile (< 768px) ── */
@media (max-width: 767px) {
    /* Stats grid: 2 columns on mobile */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .stat-card {
        padding: 14px !important;
    }

    .stat-value {
        font-size: 1.25rem !important;
    }

    .stat-icon {
        width: 38px !important;
        height: 38px !important;
    }

    .stat-icon svg {
        width: 18px !important;
        height: 18px !important;
    }

    /* Table card header */
    .table-header {
        flex-direction: column;
        gap: 4px;
        padding: 12px 16px !important;
    }

    /* Client/User name cells - smaller avatar */
    .client-avatar, .user-avatar {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.7rem !important;
    }

    .client-info .name, .user-info .name {
        font-size: 0.82rem !important;
    }

    .client-info .email-sub, .user-info .client-sub {
        font-size: 0.68rem !important;
    }

    /* Action buttons compact */
    .action-btn {
        padding: 5px 10px !important;
        font-size: 0.72rem !important;
    }

    /* Login card full width */
    .login-card {
        max-width: 100%;
        border-radius: var(--radius) !important;
    }

    .login-header {
        padding: 1.5rem 1.25rem;
    }

    .login-body {
        padding: 1.5rem 1.25rem;
    }

    .login-header h1 {
        font-size: 1.25rem;
    }

    /* Form cards full width */
    .form-card {
        max-width: 100%;
    }

    /* DataTables compact on mobile */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        text-align: left !important;
        float: none !important;
        margin-bottom: 0.75rem;
    }

    .dataTables_filter input {
        min-width: 150px !important;
        width: 100% !important;
    }

    .dataTables_paginate {
        flex-wrap: wrap;
        justify-content: center;
    }

    .dataTables_info {
        text-align: center;
    }

    /* Custom table smaller text */
    .custom-table th,
    .custom-table td {
        padding: 8px 6px !important;
        font-size: 11px !important;
    }

    /* Badges smaller */
    .badge-status {
        padding: 2px 6px !important;
        font-size: 0.68rem !important;
    }

    .badge-count {
        min-width: 24px !important;
        height: 24px !important;
        font-size: 0.75rem !important;
    }

    .days-badge {
        min-width: 30px !important;
        padding: 3px 6px !important;
        font-size: 0.72rem !important;
    }

    .region-badge {
        padding: 3px 7px !important;
        font-size: 0.68rem !important;
    }

    /* Credential cells */
    .credential-cell {
        font-size: 0.72rem !important;
        padding: 2px 5px !important;
    }

    .date-cell {
        font-size: 0.72rem !important;
    }
}

/* ── Small phone (< 576px) ── */
@media (max-width: 576px) {
    .content-wrapper {
        padding: 0.75rem;
    }

    .page-title {
        font-size: 1.15rem;
    }

    .page-subtitle {
        font-size: 0.78rem;
    }

    .topbar-right {
        gap: 0.5rem;
    }

    .expiry-badge {
        display: none;
    }

    .btn-logout span {
        display: none;
    }

    .pagination-bar {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
        padding: 10px 14px;
    }

    /* Buttons stack full width */
    .page-header .btn {
        width: 100%;
        justify-content: center;
    }

    /* Stats grid single column on very small */
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Search input groups stack */
    .search-input-group {
        flex-direction: column !important;
    }

    .search-input-group .form-control {
        width: 100% !important;
    }

    .btn-search {
        width: 100%;
    }

    /* Topbar compact */
    .app-topbar {
        padding: 0 0.75rem;
    }
}

/* ========================================
   Utilities
   ======================================== */

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.2);
}

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

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}


/* ========================================
   Global Toast Notifications
   (moved from inline styles in region views)
   ======================================== */

.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast-message {
    pointer-events: auto;
    background: #fff;
    color: #d32f2f;
    border-left: 4px solid #d32f2f;
    padding: 14px 20px;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.35s ease-out;
    max-width: 420px;
}

.toast-message.toast-success {
    color: #2e7d32;
    border-left-color: #2e7d32;
}

.toast-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
    margin-left: auto;
    padding: 0 0 0 12px;
    line-height: 1;
}

.toast-close:hover { color: #333; }

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

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}


/* ========================================
   Loading Spinner Overlay
   ======================================== */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
    z-index: 10000;
    display: none;
    place-items: center;
}

.loading-overlay.active {
    display: grid;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #e5e7eb;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* Skip Trace search: spinner + message + seconds timer */
.st-loading-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    padding: 0 16px;
}

.st-loading-title {
    margin-top: 8px;
    font-size: 1.1rem;
    font-weight: 700;
}

.st-loading-sub,
.st-loading-slow {
    font-size: .85rem;
    color: #64748b;
}

.st-loading-timer {
    font-size: 1rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--primary);
}


/* ========================================
   Search Page — Common Components
   (moved from inline styles in region views)
   ======================================== */

.search-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.search-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 50px;
    border: 1.5px solid #cbd5e1;
    background: #f8fafc;
    color: #555;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.search-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-100);
}

.search-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.18);
}

.search-tab svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.search-input-group {
    display: none;
    gap: 12px;
    align-items: center;
}

.search-input-group.active {
    display: flex;
}

.search-input-group .form-control {
    border-radius: 8px;
    border: 1.5px solid #cbd5e1;
    padding: 10px 14px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.search-input-group .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.08);
}

.btn-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 32px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    height: 44px;
    flex-shrink: 0;
}

.btn-search svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-search:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.25);
    transform: translateY(-1px);
}

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

.pagination-bar {
    background: #f8fafc;
    border-radius: 10px;
    padding: 14px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-info {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: #999;
}

.empty-state svg {
    width: 48px;
    height: 48px;
    stroke: #ccc;
    fill: none;
    stroke-width: 1.5;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 15px;
    margin: 0;
}

.fixed-address-column {
    width: 150px;
    word-wrap: break-word;
}

/* ========================================
   Know Your IP Popup
   ======================================== */
.ip-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.ip-popup {
    background: #ffffff;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    animation: noticeSlideIn 0.3s ease;
}

.ip-display {
    font-family: monospace;
    font-size: 1.75rem;
    font-weight: bold;
    color: #1e293b;
    background: #f1f5f9;
    padding: 1rem;
    border-radius: 8px;
    letter-spacing: 1px;
}

.btn-ip-copy, .btn-ip-close {
    flex: 1;
    padding: 0.6rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-ip-copy {
    background: var(--primary);
    color: white;
}

.btn-ip-copy:hover {
    background: var(--primary-dark);
}

.btn-ip-close {
    background: #e2e8f0;
    color: #475569;
}

.btn-ip-close:hover {
    background: #cbd5e1;
    color: #1e293b;
}


/* ========================================
   Theme — indigo / violet, dark sidebar
   (layered over the base rules above)
   ======================================== */

/* ── Page background ── */
.app-content {
    background:
        radial-gradient(900px 260px at 12% -80px, rgba(124, 58, 237, 0.10), transparent 70%),
        radial-gradient(900px 260px at 88% -100px, rgba(79, 70, 229, 0.10), transparent 70%),
        var(--bg);
}

/* ── Sidebar ── */
.app-sidebar {
    background: var(--grad-sidebar);
    border-right: none;
    box-shadow: 4px 0 24px rgba(30, 27, 75, 0.18);
}

.sidebar-brand .brand-icon {
    background: var(--grad-brand);
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.45);
}

.sidebar-brand .brand-text {
    color: #ffffff;
    font-weight: 800;
}

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

.nav-section-title {
    color: var(--sidebar-text-muted);
    opacity: 0.85;
}

.sidebar-link {
    margin: 2px 10px;
    padding: 0.5rem 0.75rem;
    border-left: none;
    border-radius: 10px;
}

.sidebar-link:hover {
    color: #ffffff;
    background: var(--sidebar-hover);
}

.sidebar-link.active {
    color: #ffffff;
    background: var(--sidebar-active);
    box-shadow: inset 3px 0 0 #a78bfa, 0 6px 18px rgba(0, 0, 0, 0.18);
}

.submenu-link {
    padding-left: 3.1rem;
    color: var(--sidebar-text-muted);
}

.submenu-link.active {
    box-shadow: inset 3px 0 0 #a78bfa;
}

/* Icon tiles: one colour per item */
.nav-icon-box,
.region-letter {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--c-indigo);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
}

.nav-icon-box svg {
    width: 15px;
    height: 15px;
}

.sidebar-link:hover .nav-icon-box,
.sidebar-link.active .nav-icon-box,
.sidebar-link:hover .region-letter,
.sidebar-link.active .region-letter {
    background: var(--c-indigo);
    filter: brightness(1.12);
}

.nav-icon-box.tile-violet,  .region-letter.tile-violet,
.sidebar-link:hover .tile-violet,  .sidebar-link.active .tile-violet  { background: var(--c-violet); }
.nav-icon-box.tile-teal,    .region-letter.tile-teal,
.sidebar-link:hover .tile-teal,    .sidebar-link.active .tile-teal    { background: var(--c-teal); }
.nav-icon-box.tile-sky,     .region-letter.tile-sky,
.sidebar-link:hover .tile-sky,     .sidebar-link.active .tile-sky     { background: var(--c-sky); }
.nav-icon-box.tile-amber,   .region-letter.tile-amber,
.sidebar-link:hover .tile-amber,   .sidebar-link.active .tile-amber   { background: var(--c-amber); }
.nav-icon-box.tile-rose,    .region-letter.tile-rose,
.sidebar-link:hover .tile-rose,    .sidebar-link.active .tile-rose    { background: var(--c-rose); }
.nav-icon-box.tile-emerald, .region-letter.tile-emerald,
.sidebar-link:hover .tile-emerald, .sidebar-link.active .tile-emerald { background: var(--c-emerald); }
.nav-icon-box.tile-brand,   .region-letter.tile-brand,
.sidebar-link:hover .tile-brand,   .sidebar-link.active .tile-brand   { background: var(--grad-brand); }

.sidebar-footer {
    padding: 0.75rem 0.5rem;
}

.sidebar-footer .sidebar-link {
    padding: 0.5rem 0.75rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem 0.75rem;
    margin: 0 10px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-user .user-name {
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .user-role {
    color: var(--sidebar-text-muted);
    font-size: 0.72rem;
}

.app-sidebar.collapsed .sidebar-user {
    display: none;
}

.sidebar-collapse-btn:hover {
    color: #ffffff;
}

.app-sidebar.collapsed .sidebar-collapse-btn {
    color: #ffffff;
}

.app-sidebar.collapsed .sidebar-link {
    margin: 2px 8px;
    padding: 0.55rem 0;
}

.app-sidebar.collapsed .nav-icon-box,
.app-sidebar.collapsed .region-letter {
    margin-right: 0;
}

.app-sidebar.collapsed .sidebar-link:hover::after {
    background: #1e1b4b;
}

/* ── Topbar ── */
.app-topbar {
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.user-avatar-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--grad-brand);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    flex-shrink: 0;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0.75rem 0.2rem 0.2rem;
    border: 1px solid var(--border);
    border-radius: 2rem;
    background: var(--surface);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.role-badge {
    padding: 0.1rem 0.5rem;
    border-radius: 2rem;
    background: var(--accent-50);
    color: var(--accent-dark);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.expiry-badge {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.btn-logout {
    border-radius: 2rem;
}

/* ── Page header ── */
.page-header {
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.page-header::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 72px;
    height: 3px;
    border-radius: 3px;
    background: var(--grad-brand);
}

.page-title {
    color: #1e1b4b;
    font-weight: 800;
    letter-spacing: 0.02em;
}

/* ── Cards ── */
.card {
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(30, 27, 75, 0.04), 0 8px 24px -12px rgba(30, 27, 75, 0.14);
}

.card:hover {
    box-shadow: 0 1px 2px rgba(30, 27, 75, 0.05), 0 12px 28px -12px rgba(30, 27, 75, 0.20);
}

.card-header {
    color: #1e1b4b;
    background: linear-gradient(90deg, var(--primary-50), transparent 70%);
    border-radius: 14px 14px 0 0 !important;
}

.form-card .card-header {
    background: var(--grad-brand);
    color: #ffffff;
}

/* ── Buttons ── */
.btn-primary,
.btn-search,
.login-body .btn-login,
.btn-ip-copy {
    background: var(--grad-brand);
    border: none;
    color: #ffffff;
    box-shadow: 0 6px 16px -6px rgba(var(--primary-rgb), 0.65);
}

.btn-primary:hover, .btn-primary:focus,
.btn-search:hover,
.login-body .btn-login:hover,
.btn-ip-copy:hover {
    background: var(--grad-brand);
    color: #ffffff;
    filter: brightness(1.08);
    box-shadow: 0 10px 22px -8px rgba(var(--primary-rgb), 0.75);
    transform: translateY(-1px);
}

.btn-search:disabled,
.login-body .btn-login:disabled {
    filter: grayscale(0.35);
    opacity: 0.6;
    transform: none;
    cursor: not-allowed;
}

.btn-search {
    border-radius: 10px;
}

.btn-outline-primary:hover {
    background: var(--grad-brand);
    border-color: transparent;
}

/* ── Forms ── */
.form-control, .form-select {
    border: 1.5px solid var(--border);
}

.form-control:hover, .form-select:hover {
    border-color: #c7cbe8;
}

.form-label, label {
    color: #475569;
    font-weight: 600;
}

/* ── Search tabs ── */
.search-tab {
    border-color: var(--border);
    background: var(--surface);
    color: #475569;
}

.search-tab:hover {
    background: var(--primary-50);
}

.search-tab.active {
    background: var(--grad-brand);
    border-color: transparent;
    box-shadow: 0 6px 16px -6px rgba(var(--primary-rgb), 0.65);
}

/* ── Tables ── */
.custom-table thead {
    background-image: var(--grad-brand) !important;
}

.custom-table thead th:first-child { border-top-left-radius: 10px; }
.custom-table thead th:last-child  { border-top-right-radius: 10px; }

.custom-table tbody td {
    font-variant-numeric: tabular-nums;
}

.custom-table tbody tr:nth-child(even) {
    background-color: #fafaff;
}

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

/* Key/value tables (row headers) */
.custom-table tbody th {
    color: #475569;
    font-weight: 600;
    background: #fafaff;
}

div.dt-container .dt-paging .dt-paging-button.current,
div.dt-container .dt-paging .dt-paging-button.current:hover,
.dataTables_paginate .paginate_button.current,
.dataTables_paginate .paginate_button.current:hover {
    background: var(--grad-brand) !important;
    border-color: transparent !important;
}

.pagination-bar {
    background: var(--primary-50);
    border: 1px solid var(--primary-100);
}

.badge-count {
    background: var(--primary-100);
    color: var(--primary-dark);
}

/* ── Loading layer ── */
.loading-overlay {
    background: rgba(245, 246, 253, 0.78);
    backdrop-filter: blur(3px);
}

.spinner {
    border-color: var(--primary-100);
    border-top-color: var(--accent);
}

/* ── Sign-in pages ── */
.login-page {
    background:
        radial-gradient(700px 420px at 10% 0%, rgba(124, 58, 237, 0.18), transparent 70%),
        radial-gradient(700px 420px at 100% 100%, rgba(79, 70, 229, 0.16), transparent 70%),
        #f5f6fd;
}

.login-card {
    border-radius: 18px;
    border: 1px solid var(--border);
    box-shadow: 0 24px 60px -24px rgba(30, 27, 75, 0.35);
}

.login-header {
    background: var(--grad-brand);
}

.login-header .login-icon {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 16px;
}

/* Split sign-in: brand panel + form */
.login-page.auth-split {
    padding: 0;
    align-items: stretch;
    justify-content: flex-start;
    background: var(--surface);
}

.auth-brand {
    flex: 1.05;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.5rem;
    padding: 3rem 4rem;
    color: #ffffff;
    background:
        radial-gradient(520px 320px at 85% 10%, rgba(167, 139, 250, 0.45), transparent 70%),
        radial-gradient(520px 320px at 0% 100%, rgba(56, 189, 248, 0.22), transparent 70%),
        linear-gradient(135deg, #1e1b4b 0%, #4f46e5 55%, #7c3aed 100%);
    position: relative;
    overflow: hidden;
}

.auth-form {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background:
        radial-gradient(600px 360px at 100% 0%, rgba(124, 58, 237, 0.08), transparent 70%),
        #f5f6fd;
}

.auth-split .login-header {
    background: none;
    color: var(--text);
    text-align: left;
    padding: 2rem 2rem 0;
}

.auth-split .login-header h1 {
    color: #1e1b4b;
    font-size: 1.6rem;
    font-weight: 800;
    margin-top: 0;
}

.auth-split .login-header p {
    color: var(--text-secondary);
    opacity: 1;
}

@media (max-width: 900px) {
    .login-page.auth-split { flex-direction: column; }
    .auth-brand { flex: none; padding: 2rem; }
}


/* ========================================
   Brand — AI Trace logo + wordmark
   ======================================== */

.brand-mark {
    display: block;
    flex-shrink: 0;
    border-radius: 24%;
    filter: drop-shadow(0 6px 14px rgba(124, 58, 237, 0.45));
}

.brand-mark-sm { width: 28px; height: 28px; }
.brand-mark-md { width: 44px; height: 44px; }
.brand-mark-lg { width: 60px; height: 60px; }

.brand-word {
    display: block;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.05;
    color: #ffffff;
    white-space: nowrap;
}

/* "Kart" in a bright gradient — violet → cyan on dark backgrounds */
.brand-word .kart {
    background: linear-gradient(90deg, #c4b5fd 0%, #67e8f9 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* On light backgrounds: dark "Trace", indigo → violet "Kart" */
.brand-on-light .brand-word { color: #1e1b4b; }
.brand-on-light .brand-word .kart {
    background: var(--grad-brand);
    -webkit-background-clip: text;
    background-clip: text;
}

.brand-tagline {
    display: block;
    margin-top: 3px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--sidebar-text-muted);
    white-space: nowrap;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-lockup .brand-word { font-size: 1.6rem; }

.brand-lockup-center {
    justify-content: center;
    margin-bottom: 0.75rem;
}


.auth-split .login-header .brand-lockup { margin-bottom: 1.5rem; }

/* One slow shine across the big sign-in mark */
@media (prefers-reduced-motion: no-preference) {
    .brand-mark-shine { animation: brandPop 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
}

@keyframes brandPop {
    from { opacity: 0; transform: scale(0.7) rotate(-8deg); }
    to   { opacity: 1; transform: scale(1) rotate(0); }
}

/* Sidebar brand block */
.sidebar-brand {
    min-height: 80px;
    padding: 1rem 1rem 1rem 1.1rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0));
}

.sidebar-brand .brand-icon {
    width: auto;
    height: auto;
    background: none;
    box-shadow: none;
    border-radius: 0;
}

.sidebar-brand .brand-text {
    margin-left: 0;
    line-height: 1;
}

.sidebar-brand .brand-word { font-size: 1.55rem; }

/* Collapsed: keep the mark visible, toggle button underneath */
.app-sidebar.collapsed .sidebar-brand {
    flex-direction: column;
    gap: 0;
    padding: 12px 0 0;
    background: none;
}

.app-sidebar.collapsed .brand-icon { display: flex; }

.app-sidebar.collapsed .brand-mark-md { width: 40px; height: 40px; }

.app-sidebar.collapsed .sidebar-collapse-btn { height: 44px; }

.sidebar-brand .brand-text { display: block; }

/* Region search: total still being counted in the background */
.region-counting {
    color: var(--text-secondary);
    font-style: italic;
    font-weight: 500;
}

.pagination-bar > div:first-child,
.pagination-bar > div:last-child {
    min-width: 110px;
}

.pagination-bar > div:last-child {
    text-align: right;
}

/* Sign-in brand panel: big centred logo + name, nothing else */
.auth-brand {
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
}

.brand-mark-hero {
    width: clamp(120px, 13vw, 180px);
    height: clamp(120px, 13vw, 180px);
    filter: drop-shadow(0 18px 40px rgba(15, 10, 60, 0.6));
}

.brand-lockup-hero {
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
    position: relative;
    z-index: 0;
}

.brand-lockup-hero .brand-word {
    font-size: clamp(3.2rem, 6.2vw, 5.6rem);
    margin-top: 0.75rem;
}

.brand-lockup-hero .brand-tagline {
    margin-top: 0;
    font-size: clamp(0.85rem, 1.1vw, 1.1rem);
    letter-spacing: 0.42em;
    padding-left: 0.42em;          /* balances the trailing letter-spacing so it stays centred */
    color: #c7d2fe;
}

/* Soft rings behind the logo */
.brand-lockup-hero::before,
.brand-lockup-hero::after {
    content: '';
    position: absolute;
    left: 50%;
    top: clamp(60px, 6.5vw, 90px);     /* centre of the logo */
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.16);
    transform: translate(-50%, -50%);
    z-index: -1;
    pointer-events: none;
}

.brand-lockup-hero::before {
    width: clamp(240px, 26vw, 360px);
    height: clamp(240px, 26vw, 360px);
    background: radial-gradient(closest-side, rgba(255, 255, 255, 0.10), transparent);
}

.brand-lockup-hero::after {
    width: clamp(380px, 42vw, 580px);
    height: clamp(380px, 42vw, 580px);
    border-color: rgba(255, 255, 255, 0.08);
}

@media (max-width: 900px) {
    .brand-lockup-hero { gap: 0.75rem; }
    .brand-mark-hero { width: 84px; height: 84px; }
    .brand-lockup-hero .brand-word { font-size: 2.4rem; margin-top: 0; }
    .brand-lockup-hero::before, .brand-lockup-hero::after { display: none; }
}


/* ========================================
   Announcement popup
   ======================================== */

.ann-modal .modal-dialog { max-width: 640px; }

.ann-modal .modal-content {
    border: none;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 40px 90px -30px rgba(30, 27, 75, 0.65);
}

.ann-header {
    position: relative;
    padding: 1.6rem 2rem 1.8rem;
    color: #ffffff;
    overflow: hidden;
    background:
        radial-gradient(420px 220px at 90% 0%, rgba(103, 232, 249, 0.35), transparent 70%),
        linear-gradient(135deg, #1e1b4b 0%, #4f46e5 55%, #9333ea 100%);
}

.ann-close { position: absolute; top: 1rem; right: 1rem; z-index: 2; }

.ann-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.1rem;
}

.ann-brand .brand-mark { width: 36px; height: 36px; }
.ann-brand .brand-word { font-size: 1.25rem; }

.ann-badge {
    margin-left: 0.4rem;
    padding: 0.2rem 0.7rem;
    border-radius: 2rem;
    background: #facc15;
    color: #422006;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.ann-title {
    margin: 0;
    font-size: 2.1rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

.ann-body { padding: 1.5rem 2rem 0.5rem; }

.ann-image {
    display: block;
    max-width: 100%;
    max-height: 220px;
    margin: 0 auto 1.1rem;
    border-radius: 12px;
}

.ann-points {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.ann-points li {
    position: relative;
    padding-left: 2rem;
    font-size: 1.02rem;
    font-weight: 500;
    line-height: 1.45;
    color: var(--text);
}

.ann-points li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.15rem;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    background: var(--primary-100) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234f46e5' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 12.5 10.5 17 18 8'/></svg>") center / 70% no-repeat;
}

/* Highlight line (message line that starts with *) */
.ann-points li.ann-highlight {
    padding: 0.85rem 1.1rem 0.85rem 3rem;
    border-radius: 14px;
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.3;
    color: #1e1b4b;
    background: linear-gradient(90deg, #fef3c7, #fde68a);
    border: 1px solid #fcd34d;
}

.ann-points li.ann-highlight::before {
    left: 0.9rem;
    top: 50%;
    width: 1.5rem;
    height: 1.5rem;
    transform: translateY(-50%);
    background-color: #f59e0b;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'><path d='M12 2l2.9 6.3 6.9.8-5.1 4.7 1.4 6.800L12 17.300 5.900 20.600l1.400-6.800L2.200 9.100l6.900-.8z'/></svg>");
}

.ann-footer {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.25rem 2rem 1.75rem;
}

.ann-footer .btn { padding: 0.7rem 2.2rem; font-size: 1rem; font-weight: 700; border-radius: 12px; }

@media (prefers-reduced-motion: no-preference) {
    .ann-modal.show .modal-content { animation: annPop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.15) both; }
    .ann-badge { animation: annPulse 1.4s ease-in-out infinite; }
    .ann-header::after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        left: -40%;
        width: 35%;
        background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.28), transparent);
        animation: annSweep 2.6s ease-in-out 0.4s 2;
        pointer-events: none;
    }
}

@keyframes annPop {
    from { opacity: 0; transform: translateY(24px) scale(0.92); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes annPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.6); }
    50%      { transform: scale(1.08); box-shadow: 0 0 0 8px rgba(250, 204, 21, 0); }
}

@keyframes annSweep {
    from { left: -40%; }
    to   { left: 120%; }
}

/* ========================================
   Skip Trace page header badges (rate, daily limit)
   ======================================== */
.st-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}
.st-header-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.st-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.08);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    max-width: 100%;
}
.st-badge-rate {
    color: var(--c-emerald);
    background: var(--success-bg);
    border-color: rgba(5, 150, 105, 0.25);
}
.st-badge-out {
    color: var(--danger);
    background: var(--danger-bg);
    border-color: rgba(239, 68, 68, 0.3);
}
.st-badge-note { color: var(--text-secondary); font-size: 0.8rem; }
@media (max-width: 768px) {
    .st-page-header { flex-direction: column; }
    .st-header-badges { justify-content: flex-start; }
}

/* ========================================
   Sign-in logo animation (big mark on the login page only)
   ======================================== */
.brand-mark .tk-shine { display: none; }

@media (prefers-reduced-motion: no-preference) {
    /* Pop in, then float gently with a breathing glow */
    .brand-mark-hero.brand-mark-shine {
        animation:
            brandPop 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.2) both,
            tkFloat 4.5s ease-in-out 0.9s infinite;
    }

    /* A light band sweeps across the tile every few seconds */
    .brand-mark-hero .tk-shine { display: inline; }
    .brand-mark-hero .tk-shine rect { animation: tkShine 4.5s ease-in-out 1.2s infinite; }

    /* The lens scans around inside the pin */
    .brand-mark-hero .tk-lens { animation: tkScan 3.6s ease-in-out 1s infinite; }

    /* The trail dots light up one after another */
    .brand-mark-hero .tk-dot { animation: tkTrail 2.4s ease-in-out infinite; }
    .brand-mark-hero .tk-dot2 { animation-delay: 0.3s; }
    .brand-mark-hero .tk-dot3 { animation-delay: 0.6s; }

    /* Rings behind the logo pulse outward */
    .brand-lockup-hero::before { animation: tkRing 4.5s ease-in-out infinite; }
    .brand-lockup-hero::after  { animation: tkRing 4.5s ease-in-out 1.5s infinite; }

    /* Wordmark rises in after the logo; "Kart" gradient drifts */
    .brand-lockup-hero .brand-word { animation: tkRise 0.8s ease-out 0.35s both; }
    .brand-lockup-hero .brand-word .kart {
        background-size: 200% 100%;
        animation: tkHue 6s ease-in-out infinite;
    }
}

@keyframes tkFloat {
    0%, 100% { transform: translateY(0);     filter: drop-shadow(0 18px 40px rgba(15, 10, 60, 0.6)); }
    50%      { transform: translateY(-10px); filter: drop-shadow(0 26px 46px rgba(124, 58, 237, 0.55)); }
}

@keyframes tkShine {
    0%, 55%  { transform: translateX(0); }
    85%,100% { transform: translateX(95px); }
}

@keyframes tkScan {
    0%, 100% { transform: translate(0, 0); }
    25%      { transform: translate(1.6px, -1px); }
    50%      { transform: translate(0.4px, 1.4px); }
    75%      { transform: translate(-1.4px, -0.4px); }
}

@keyframes tkTrail {
    0%, 100% { opacity: 0.25; }
    40%      { opacity: 1; }
}

@keyframes tkRing {
    0%, 100% { transform: translate(-50%, -50%) scale(1);    opacity: 1; }
    50%      { transform: translate(-50%, -50%) scale(1.08); opacity: 0.45; }
}

@keyframes tkRise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes tkHue {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

/* ========================================
   User verification (My Profile, admin review, Verified badge)
   ======================================== */
.vbadge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px 2px 6px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
    text-decoration: none;
}
.vbadge svg { width: 15px; height: 15px; }
.vbadge-ok { color: #047857; background: #d1fae5; border: 1px solid #6ee7b7; }
.vbadge-todo { color: #b45309; background: var(--warning-bg); border: 1px solid #fcd34d; padding-left: 9px; }
a.vbadge-todo:hover { background: #fef3c7; color: #92400e; }
.sidebar-user .vbadge { margin-top: 4px; }
.app-sidebar.collapsed .sidebar-user .vbadge { display: none; }
.topbar-right .vbadge { margin-left: -4px; }

.nav-count {
    margin-left: auto;
    min-width: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #f59e0b;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}
.app-sidebar.collapsed .nav-count { display: none; }

.uv-chip {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
}
.uv-chip-ok   { color: #047857; background: #d1fae5; border-color: #a7f3d0; }
.uv-chip-wait { color: #b45309; background: var(--warning-bg); border-color: #fde68a; }
.uv-chip-bad  { color: var(--danger); background: var(--danger-bg); border-color: #fecaca; }
.uv-chip-none { color: var(--text-secondary); background: var(--bg, #f3f4f6); border-color: var(--border); }

.uv-status-line { margin: 0 0 12px; }
.uv-status-line.uv-ok { color: #047857; font-weight: 600; }
.uv-status-line.uv-bad { color: var(--danger); font-weight: 600; }

.uv-steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0; flex-wrap: wrap; }
.uv-steps li {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 14px 6px 6px;
    border-radius: 999px;
    background: var(--bg, #f3f4f6);
    color: var(--text-secondary);
    font-size: 0.85rem; font-weight: 600;
}
.uv-steps li span {
    width: 24px; height: 24px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: #fff; border: 1px solid var(--border); font-size: 0.8rem;
}
.uv-steps li.active { background: rgba(var(--primary-rgb), 0.1); color: var(--primary); }
.uv-steps li.active span { border-color: var(--primary); color: var(--primary); }
.uv-steps li.done { background: #d1fae5; color: #047857; }
.uv-steps li.done span { background: #10b981; border-color: #10b981; color: #fff; }

.uv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
.uv-card {
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    box-shadow: var(--shadow-sm);
    padding: 18px;
    display: flex; flex-direction: column; gap: 10px;
}
.uv-card-wide { grid-column: 1 / -1; }
.uv-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.uv-card-head h3 { font-size: 1rem; font-weight: 700; margin: 0; color: var(--text); }
.uv-card-head h3 small { font-weight: 500; color: var(--text-muted); font-size: 0.78rem; }
.uv-file { font-size: 0.85rem; word-break: break-all; }
.uv-reject {
    font-size: 0.85rem; color: var(--danger);
    background: var(--danger-bg); border-radius: 8px; padding: 6px 10px;
}
.uv-form { display: flex; flex-direction: column; gap: 6px; }
.uv-form .form-label { margin: 0; font-size: 0.82rem; font-weight: 600; }
.uv-form .btn { align-self: flex-start; }

.uv-meta { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; font-size: 0.85rem; }
.uv-meta dt { color: var(--text-secondary); font-weight: 500; }
.uv-meta dd { margin: 0; word-break: break-all; }
.uv-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.uv-reject-form { display: flex; gap: 6px; }
.uv-reject-form .form-control { flex: 1; }

.uv-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.uv-filter {
    padding: 6px 12px; border-radius: 999px; font-size: 0.85rem; text-decoration: none;
    color: var(--text-secondary); background: var(--surface, #fff); border: 1px solid var(--border);
}
.uv-filter b { margin-left: 4px; color: var(--text); }
.uv-filter.on { color: #fff; background: var(--primary); border-color: var(--primary); }
.uv-filter.on b { color: #fff; }
.uv-search { margin-left: auto; min-width: 220px; }
.uv-count {
    display: inline-block; min-width: 24px; padding: 2px 8px; border-radius: 999px;
    background: #f59e0b; color: #fff; font-weight: 700; font-size: 0.78rem; text-align: center;
}
.uv-side-title { font-size: 1rem; font-weight: 700; margin-bottom: 10px; }

.uv-reminder {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 12px 16px; margin-bottom: 16px;
    border-radius: var(--radius-lg, 12px);
    background: var(--warning-bg); border: 1px solid #fde68a; color: #92400e;
    font-size: 0.9rem;
}
.uv-reminder span { flex: 1; min-width: 200px; }

/* User Verification: agreement strip on top of the admin list */
.uv-agreement-row { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.uv-agreement-info { flex: 1 1 280px; }
.uv-agreement-upload { flex: 1 1 380px; display: flex; flex-direction: column; gap: 4px; }
button.uv-filter { cursor: pointer; }
#uvTable td .btn + .btn, #uvTable td .btn + form, #uvTable td form + .btn { margin-left: 4px; }

/* "Verify your account" reminder popup (uses the announcement popup look) */
.uv-rem-lead { font-size: 1.05rem; font-weight: 600; margin-bottom: 12px; }
.uv-rem-list { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 8px; }
.uv-rem-list li {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface, #fff);
}
.uv-rem-mark {
    flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.85rem;
}
.uv-rem-ok   .uv-rem-mark { background: #10b981; color: #fff; }
.uv-rem-wait .uv-rem-mark { background: #fef3c7; color: #b45309; }
.uv-rem-bad  .uv-rem-mark { background: var(--danger); color: #fff; }
.uv-rem-todo .uv-rem-mark { background: var(--bg, #f3f4f6); color: var(--text-secondary); border: 1px solid var(--border); }
.uv-rem-bad { border-color: #fecaca !important; background: var(--danger-bg) !important; }
.uv-rem-reason { color: var(--danger); font-size: 0.88rem; }
.uv-rem-deadline { color: var(--danger); font-weight: 700; margin: 0 0 6px; }
.uv-rem-extra { color: var(--text-secondary); margin: 0; }

/* ========================================
   Sidebar v2 — edge collapse button, collapsible sections,
   grouped Skip Trace menu, icon rail with fly-outs, menu filter.
   Scoped to .app-sidebar.sb2 so it overrides the older sidebar rules above.
   ======================================== */
.app-sidebar.sb2 {
    overflow: visible;                       /* lets the edge button sit half outside */
    transition: width 0.22s ease, transform 0.22s ease;
}
.app-sidebar.sb2 ~ .app-topbar,
.app-sidebar.sb2 ~ .app-content,
.app-sidebar.sb2 ~ .app-footer { transition: left 0.22s ease, margin-left 0.22s ease; }

/* Brand */
.sb2 .sidebar-brand { padding: 16px 18px 14px; min-height: 72px; border-bottom: 0; }
.sb2 .sb-brand-link { display: flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none; }
.sb2 .sb-brand-link .brand-icon { display: flex; }
.sb2 .sb-brand-link .brand-text { margin-left: 0; }

/* Collapse button on the sidebar edge */
.sb-collapse {
    position: absolute;
    top: 28px;
    right: -13px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid rgba(124, 58, 237, 0.35);
    background: #ffffff;
    color: #5b21b6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    z-index: 1045;
    box-shadow: 0 4px 12px rgba(30, 27, 75, 0.25);
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.sb-collapse svg { width: 14px; height: 14px; transition: transform 0.22s ease; }
.sb-collapse:hover { background: #5b21b6; color: #ffffff; transform: scale(1.08); }
.sb-collapse:focus-visible { outline: 2px solid #c4b5fd; outline-offset: 2px; }
.app-sidebar.sb2.collapsed .sb-collapse svg { transform: rotate(180deg); }

/* Menu filter */
.sb-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 14px 10px;
    padding: 0 10px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--sidebar-text-muted);
    transition: border-color 0.15s ease, background 0.15s ease;
}
.sb-search:focus-within { border-color: #a78bfa; background: rgba(255, 255, 255, 0.11); }
.sb-search > svg { width: 15px; height: 15px; flex-shrink: 0; }
.sb-search input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: 0;
    outline: none;
    color: #ffffff;
    font-size: 0.85rem;
}
.sb-search input::placeholder { color: var(--sidebar-text-muted); opacity: 0.8; }
.sb-search input::-webkit-search-cancel-button { filter: invert(1); opacity: 0.6; }
.sb-search kbd {
    font-family: inherit;
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--sidebar-text-muted);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 5px;
    padding: 1px 5px;
    white-space: nowrap;
}

/* Nav area: soft fade at the top and bottom edges */
.sb2 .sidebar-nav {
    padding: 4px 10px 14px;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 10px, #000 calc(100% - 18px), transparent 100%);
            mask-image: linear-gradient(to bottom, transparent 0, #000 10px, #000 calc(100% - 18px), transparent 100%);
}
.sb2 .sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); }

/* Sections */
.sb-sec + .sb-sec { margin-top: 4px; }
.sb-sec-head {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 0;
    border-radius: 10px;
    background: none;
    color: var(--sidebar-text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.sb-sec-head:hover { background: var(--sidebar-hover); color: #ffffff; }
.sb-sec-head:focus-visible { outline: 2px solid #a78bfa; outline-offset: -2px; }
.sb-sec.has-active > .sb-sec-head { color: #ffffff; }
.sb-sec-icon {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
    transition: width 0.2s ease, height 0.2s ease;
}
.sb-sec-icon svg { width: 14px; height: 14px; }
.sb-sec-icon.tile-brand   { background: var(--grad-brand); }
.sb-sec-icon.tile-teal    { background: var(--c-teal); }
.sb-sec-icon.tile-amber   { background: var(--c-amber); }
.sb-sec-icon.tile-violet  { background: var(--c-violet); }
.sb-sec-icon.tile-sky     { background: var(--c-sky); }
.sb-sec-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-sec-count {
    font-size: 0.66rem;
    letter-spacing: 0;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--sidebar-text-muted);
}
.sb-sec-count.sb-sec-alert { background: #f59e0b; color: #ffffff; }
.sb-chev { width: 14px; height: 14px; flex-shrink: 0; transition: transform 0.2s ease; }
.sb-sec:not(.open) .sb-chev { transform: rotate(-90deg); }

.sb-sec-body { display: none; padding: 2px 0 6px; }
.sb-sec.open > .sb-sec-body,
.sidebar-nav.filtering .sb-sec-body { display: block; }
.sidebar-nav.filtering .sb-group-label,
.sidebar-nav.filtering .sb-divider { display: none; }
.sb-group-label {
    padding: 8px 12px 3px 14px;
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(165, 180, 252, 0.6);
}
.sb-divider { height: 1px; margin: 8px 12px; background: var(--sidebar-border); }
.sb-hide { display: none !important; }
.sb-empty { margin: 10px 12px; font-size: 0.85rem; color: var(--sidebar-text-muted); }

/* Links */
.app-sidebar.sb2 .sb-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 1px 0;
    padding: 7px 10px 7px 12px;
    border-left: 0;
    border-radius: 9px;
    color: var(--sidebar-text);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    justify-content: flex-start;
    transition: background 0.15s ease, color 0.15s ease;
}
.app-sidebar.sb2 .sb-item:hover { background: var(--sidebar-hover); color: #ffffff; }
.app-sidebar.sb2 .sb-item:focus-visible { outline: 2px solid #a78bfa; outline-offset: -2px; }
.app-sidebar.sb2 .sb-item.active {
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.38), rgba(99, 102, 241, 0.12));
    color: #ffffff;
    font-weight: 600;
}
.app-sidebar.sb2 .sb-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 7px;
    bottom: 7px;
    width: 3px;
    border-radius: 3px;
    background: #c4b5fd;
}
.app-sidebar.sb2 .sb-item .link-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.app-sidebar.sb2 .sb-item .nav-icon-box,
.app-sidebar.sb2 .sb-item .region-letter { margin-right: 0; width: 22px; height: 22px; }
.sb-ico {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--sidebar-text-muted);
}
.sb-ico svg { width: 16px; height: 16px; }
.app-sidebar.sb2 .sb-item:hover .sb-ico,
.app-sidebar.sb2 .sb-item.active .sb-ico { color: #ffffff; }
.app-sidebar.sb2 .sb-item .nav-count { margin-left: 0; }

/* Footer: user card with a sign-out icon button */
.sb2 .sidebar-footer { padding: 10px 12px 12px; border-top: 1px solid var(--sidebar-border); }
.sb2 .sidebar-user { margin: 0; padding: 6px 4px; gap: 10px; }
.sb2 .sb-user-text { flex: 1; min-width: 0; }
.sb-logout {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--sidebar-text-muted);
    background: rgba(255, 255, 255, 0.06);
    transition: background 0.15s ease, color 0.15s ease;
}
.sb-logout svg { width: 17px; height: 17px; }
.sb-logout:hover { background: var(--c-rose); color: #ffffff; }

/* Collapsed: icon rail with fly-out menus (desktop only) */
@media (min-width: 992px) {
    .app-sidebar.sb2.collapsed .sidebar-brand { padding: 16px 0 14px; justify-content: center; }
    .app-sidebar.sb2.collapsed .sb-brand-link { justify-content: center; }
    .app-sidebar.sb2.collapsed .brand-text { display: none; }
    .app-sidebar.sb2.collapsed .brand-icon { display: flex; }
    .app-sidebar.sb2.collapsed .sb-search { display: none; }
    /* No edge fade here: a mask would also hide the fly-out panels drawn outside the rail. */
    .app-sidebar.sb2.collapsed .sidebar-nav { padding: 4px 8px 14px; -webkit-mask-image: none; mask-image: none; }
    .app-sidebar.sb2.collapsed .sb-sec-head { justify-content: center; padding: 6px 0; }
    .app-sidebar.sb2.collapsed .sb-sec-title,
    .app-sidebar.sb2.collapsed .sb-sec-count,
    .app-sidebar.sb2.collapsed .sb-chev { display: none; }
    .app-sidebar.sb2.collapsed .sb-sec-count.sb-sec-alert {
        display: block;
        position: absolute;
        top: 2px;
        right: 6px;
        padding: 0 5px;
        font-size: 0.6rem;
        line-height: 16px;
    }
    .app-sidebar.sb2.collapsed .sb-sec-icon { width: 38px; height: 38px; border-radius: 11px; }
    .app-sidebar.sb2.collapsed .sb-sec-icon svg { width: 18px; height: 18px; }
    .app-sidebar.sb2.collapsed .sb-sec.has-active .sb-sec-icon { box-shadow: 0 0 0 2px #1e1b4b, 0 0 0 4px #c4b5fd; }
    .app-sidebar.sb2.collapsed .sb-sec + .sb-sec { margin-top: 6px; }

    .app-sidebar.sb2.collapsed .sb-sec-body { display: none !important; }
    .app-sidebar.sb2.collapsed .sb-sec.fly > .sb-sec-body {
        display: block !important;
        position: fixed;
        width: 260px;
        max-height: calc(100vh - 16px);
        overflow-y: auto;
        padding: 6px 8px 8px;
        background: linear-gradient(180deg, #221d57 0%, #2e1065 100%);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 14px;
        box-shadow: 0 18px 40px rgba(15, 10, 60, 0.45);
        z-index: 1060;
        animation: sbFly 0.14s ease-out;
    }
    .app-sidebar.sb2.collapsed .sb-sec.fly > .sb-sec-body::before {
        content: attr(data-title);
        display: block;
        padding: 8px 12px 6px;
        font-size: 0.7rem;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: #ffffff;
    }
    .app-sidebar.sb2.collapsed .sb-item { margin: 1px 0; padding: 7px 10px 7px 12px; justify-content: flex-start; }
    .app-sidebar.sb2.collapsed .sb-item .link-text { display: block; }
    .app-sidebar.sb2.collapsed .sidebar-link:hover::after { content: none; display: none; }

    .app-sidebar.sb2.collapsed .sidebar-footer { padding: 10px 0 12px; }
    .app-sidebar.sb2.collapsed .sidebar-user { display: flex; flex-direction: column; gap: 8px; padding: 0; align-items: center; }
    .app-sidebar.sb2.collapsed .sb-user-text { display: none; }
}
@media (max-width: 991px) {
    .sb-collapse { display: none; }
}
@keyframes sbFly {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
    .app-sidebar.sb2, .app-sidebar.sb2 *, .sb-collapse, .sb-collapse svg { transition: none !important; animation: none !important; }
}

/* User Verification: Enabled / Disabled switch (page header, top right) */
.uv-feature {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.uv-feature-label { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.uv-feature .form-check-input { width: 2.4em; height: 1.25em; cursor: pointer; }

/* ========================================
   Sign-in v2 — one immersive scene: aurora background, logo inside a radar,
   giant wordmark, frosted-glass sign-in card. Scoped to .login-page.auth-v2.
   ======================================== */
.login-page.auth-v2 {
    position: relative;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, 440px);
    align-items: center;
    justify-content: center;
    gap: clamp(24px, 5vw, 96px);
    padding: clamp(24px, 5vw, 80px);
    overflow: hidden;
    color: #ffffff;
    background:
        radial-gradient(1100px 760px at 12% 18%, #3b2a8c 0%, transparent 62%),
        radial-gradient(900px 700px at 92% 92%, #5b21b6 0%, transparent 58%),
        linear-gradient(135deg, #0c0927 0%, #1a1650 48%, #2a0f5f 100%);
}

/* Background: drifting colour blobs + faint dot grid */
.av-bg { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.av-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.55;
}
.av-b1 { width: 520px; height: 520px; left: -120px; top: -140px; background: #6366f1; animation: avDrift1 22s ease-in-out infinite alternate; }
.av-b2 { width: 460px; height: 460px; right: -100px; bottom: -160px; background: #a855f7; animation: avDrift2 26s ease-in-out infinite alternate; }
.av-b3 { width: 300px; height: 300px; left: 42%; top: 55%; background: #06b6d4; opacity: 0.28; animation: avDrift3 30s ease-in-out infinite alternate; }
.av-grid {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.10) 1px, transparent 1px);
    background-size: 30px 30px;
    -webkit-mask-image: radial-gradient(ellipse at 35% 45%, #000 0%, transparent 70%);
            mask-image: radial-gradient(ellipse at 35% 45%, #000 0%, transparent 70%);
}

/* Hero: radar with the logo, wordmark below */
.av-hero {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(8px, 1.5vw, 20px);
    text-align: center;
}
.av-radar {
    position: relative;
    width: clamp(260px, 30vw, 430px);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
}
.av-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(199, 210, 254, 0.18);
}
.av-r1 { inset: 0; }
.av-r2 { inset: 16%; border-color: rgba(199, 210, 254, 0.22); }
.av-r3 { inset: 32%; border-color: rgba(199, 210, 254, 0.28); background: radial-gradient(closest-side, rgba(139, 92, 246, 0.22), transparent); }
.av-ping {
    position: absolute;
    inset: 32%;
    border-radius: 50%;
    border: 2px solid rgba(167, 139, 250, 0.55);
    animation: avPing 3.2s ease-out infinite;
}
.av-sweep {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg, rgba(167, 139, 250, 0.42), rgba(167, 139, 250, 0.08) 18%, transparent 30%);
    -webkit-mask-image: radial-gradient(circle, transparent 30%, #000 31%);
            mask-image: radial-gradient(circle, transparent 30%, #000 31%);
    animation: avSweep 6s linear infinite;
}
.av-blip {
    position: absolute;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #67e8f9;
    box-shadow: 0 0 12px 3px rgba(103, 232, 249, 0.7);
    opacity: 0;
    animation: avBlip 6s linear infinite;
}
.av-p1 { left: 74%; top: 22%; animation-delay: 0.9s; }
.av-p2 { left: 84%; top: 62%; animation-delay: 2.1s; background: #c4b5fd; box-shadow: 0 0 12px 3px rgba(196, 181, 253, 0.7); }
.av-p3 { left: 22%; top: 76%; animation-delay: 3.8s; }
.av-p4 { left: 14%; top: 30%; animation-delay: 5.0s; background: #f0abfc; box-shadow: 0 0 12px 3px rgba(240, 171, 252, 0.7); }
.av-logo { position: relative; z-index: 2; }
.auth-v2 .brand-mark-hero {
    width: clamp(120px, 12vw, 176px);
    height: clamp(120px, 12vw, 176px);
}
.av-word.brand-word {
    margin: 0;
    font-size: clamp(3.4rem, 7.2vw, 6.6rem);
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 1;
    color: #ffffff;
    text-shadow: 0 10px 40px rgba(15, 10, 60, 0.45);
}
.av-word .kart {
    background: linear-gradient(90deg, #c4b5fd 0%, #67e8f9 50%, #c4b5fd 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
            background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* Sign-in card: bright frosted glass on the dark scene */
.av-panel { position: relative; z-index: 1; }
.av-card {
    position: relative;
    padding: 34px 32px 24px;
    border-radius: 24px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.97), rgba(245, 243, 255, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 30px 80px rgba(8, 4, 40, 0.55), 0 0 0 6px rgba(255, 255, 255, 0.06);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
            backdrop-filter: blur(18px) saturate(140%);
    color: #1e1b4b;
}
.av-card::before {                      /* colour strip on the top edge */
    content: "";
    position: absolute;
    left: 24px;
    right: 24px;
    top: -1px;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, #6366f1, #a855f7, #06b6d4);
}
.av-card-head h1 { margin: 14px 0 4px; font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; color: #1e1b4b; }
.av-card-head p { margin: 0 0 22px; color: #6b7280; font-size: 0.95rem; }
.av-mini { display: inline-flex; align-items: center; gap: 8px; }
.av-mini .brand-word { font-size: 1.05rem; }

.av-form { display: flex; flex-direction: column; }
.av-label { font-size: 0.8rem; font-weight: 600; color: #374151; margin: 0 0 6px; letter-spacing: 0.01em; }
.av-field { position: relative; margin-bottom: 16px; }
.av-field > svg {
    position: absolute;
    left: 14px;
    top: 50%;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
    transition: color 0.15s ease;
}
.auth-v2 .av-field .form-control {
    height: 48px;
    padding: 0 44px 0 44px;
    border-radius: 12px;
    background: #f8f7ff;
    border: 1px solid #e0e0f0;
    color: #1e1b4b;
    font-size: 0.95rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.auth-v2 .av-field .form-control::placeholder { color: #9ca3af; }
.auth-v2 .av-field .form-control:focus {
    outline: none;
    background: #ffffff;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.16);
}
.av-field:focus-within > svg { color: #7c3aed; }
.auth-v2 .av-field .form-control:-webkit-autofill {
    -webkit-text-fill-color: #1e1b4b;
    -webkit-box-shadow: 0 0 0 40px #f3f0ff inset;
    caret-color: #1e1b4b;
}
.av-eye {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #9ca3af;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.av-eye svg { width: 18px; height: 18px; }
.av-eye:hover, .av-eye.on { color: #7c3aed; background: #efeafe; }

.auth-v2 .form-terms { display: flex; align-items: flex-start; gap: 10px; margin: 4px 0 18px; font-size: 0.84rem; line-height: 1.45; color: #4b5563; }
.auth-v2 .form-terms label { color: #4b5563; font-weight: 400; margin: 0; cursor: pointer; }
.auth-v2 .form-terms input[type="checkbox"] { margin-top: 3px; flex-shrink: 0; width: 16px; height: 16px; cursor: pointer; accent-color: #7c3aed; }
.auth-v2 .form-terms a { color: #6d28d9; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.auth-v2 .form-terms a:hover { color: #4c1d95; }

.auth-v2 .av-btn {
    width: 100%;
    height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    border-radius: 12px;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    background-size: 200% 100%;
    box-shadow: 0 12px 26px rgba(124, 58, 237, 0.35);
    transition: background-position 0.4s ease, transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.auth-v2 .av-btn svg { width: 18px; height: 18px; transition: transform 0.2s ease; }
.auth-v2 .av-btn:hover:not(:disabled) { background-position: 100% 0; transform: translateY(-1px); box-shadow: 0 16px 32px rgba(124, 58, 237, 0.45); }
.auth-v2 .av-btn:hover:not(:disabled) svg { transform: translateX(4px); }
.auth-v2 .av-btn:focus-visible { outline: 3px solid #c4b5fd; outline-offset: 2px; }
.auth-v2 .av-btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; filter: grayscale(0.2); }

.av-foot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 18px 0 0;
    font-size: 0.75rem;
    color: #6b7280;
}
.av-foot svg { width: 14px; height: 14px; color: #8b5cf6; }

/* Smaller screens: stack hero above the card */
@media (max-width: 991px) {
    .login-page.auth-v2 { grid-template-columns: 1fr; justify-items: center; gap: 24px; padding: 32px 16px; }
    .av-radar { width: 220px; }
    .auth-v2 .brand-mark-hero { width: 96px; height: 96px; }
    .av-word.brand-word { font-size: 2.8rem; }
    .av-panel { width: 100%; max-width: 440px; }
}

/* Motion */
@media (prefers-reduced-motion: no-preference) {
    .av-word .kart { animation: tkHue 6s ease-in-out infinite; }
    .av-word { animation: tkRise 0.8s ease-out 0.35s both; }
    .av-card { animation: avCardIn 0.7s cubic-bezier(0.2, 0.9, 0.3, 1) 0.15s both; }
}
@media (prefers-reduced-motion: reduce) {
    .av-blob, .av-ping, .av-sweep, .av-blip { animation: none !important; }
    .av-blip { opacity: 0.8; }
}
@keyframes avDrift1 { to { transform: translate(120px, 80px) scale(1.12); } }
@keyframes avDrift2 { to { transform: translate(-110px, -90px) scale(1.08); } }
@keyframes avDrift3 { to { transform: translate(-80px, -60px) scale(1.2); } }
@keyframes avSweep  { to { transform: rotate(360deg); } }
@keyframes avPing {
    0%   { transform: scale(1);   opacity: 0.8; }
    100% { transform: scale(3.1); opacity: 0; }
}
@keyframes avBlip {
    0%, 8%   { opacity: 0; transform: scale(0.4); }
    12%      { opacity: 1; transform: scale(1.25); }
    30%      { opacity: 0.9; transform: scale(1); }
    55%, 100% { opacity: 0; transform: scale(0.6); }
}
@keyframes avCardIn {
    from { opacity: 0; transform: translateY(18px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
