/* ThirdGuardian Main Stylesheet */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ========================================
   CSS Custom Properties for Dark Mode
   ======================================== */

:root {
    /* Brand Colors - Consistent Across Themes */
    --brand-gradient-start: #0F6CBD;
    --brand-gradient-end: #2B88D8;
    --brand-gradient: linear-gradient(135deg, #0F6CBD 0%, #2B88D8 100%);

    /* Primary Colors */
    --primary-blue: #0F6CBD;
    --primary-blue-hover: #115EA3;
    --primary-blue-light: rgba(15, 108, 189, 0.1);
    /* Filled-element color (buttons, avatar, badges). Branding overrides these, not --primary-blue,
       so text and lines that use --primary-blue stay readable on any brand color. */
    --btn-fill: var(--primary-blue);
    --btn-fill-hover: var(--primary-blue-hover);

    /* Background Colors */
    --bg-body: #f5f5f5;
    --bg-card: #ffffff;
    --bg-card-secondary: #fafafa;
    --bg-hover: #f3f2f1;
    --bg-overlay: rgba(0, 0, 0, 0.4);

    /* Neutral surface aliases. These token names originated in vendor.css
       (loaded only by the vendor portal); a lot of internal-app CSS and inline
       styles reference them too (skeleton loaders, UC metrics timeline, chips
       and table header rows across technology/contract/dashboard views), where
       they previously resolved to nothing — e.g. the metrics-tab skeleton bars
       rendered with no fill and read as empty boxes. */
    --bg-primary: var(--bg-card);
    --bg-secondary: #edeef0;
    --bg-tertiary: #e3e5e8;
    --border-color: var(--border-primary);
    --success-color: var(--status-success-bg);
    --danger-color: #b91c1c;

    /* Skeleton loaders: a clearly-visible fill (independent of the subtle
       --bg-secondary chip colour) plus the moving highlight sweep. */
    --skeleton-bg: #dfe1e5;
    --skeleton-shimmer: rgba(255, 255, 255, 0.65);

    /* Text Colors */
    --text-primary: #242424;
    --text-secondary: #616161;
    --text-tertiary: #8a8886;
    --text-muted: #a19f9d;
    --text-inverse: #ffffff;

    /* Border Colors */
    --border-primary: #d1d1d1;
    --border-secondary: #e0e0e0;
    --border-light: #edebe9;
    --border-highlight: #f3f2f1;

    /* Shadow Colors */
    --shadow-sm: rgba(0, 0, 0, 0.10);
    --shadow-md: rgba(0, 0, 0, 0.12);
    --shadow-lg: rgba(0, 0, 0, 0.14);
    --shadow-xl: rgba(0, 0, 0, 0.18);

    /* Status Badge Colors */
    --status-success-bg: #0e700e;
    --status-success-text: white;
    --status-warning-bg: #9d5d00;
    --status-warning-text: white;
    --status-info-bg: #0c6c9c;
    --status-info-text: white;
    --status-purple-bg: #8764b8;
    --status-purple-text: white;
    --status-inactive-bg: #616161;
    --status-inactive-text: white;

    /* Severity/Priority Colors */
    --severity-critical: #b10e1c;
    --severity-high: #9d5010;
    --severity-medium: #8a7400;
    --severity-low: #616161;
    --severity-none: #a19f9d;

    /* Alert Colors */
    --alert-success-bg: #e7f5e7;
    --alert-success-border: #9fd89f;
    --alert-success-text: #0e700e;
    --alert-success-light-bg: #f3fbf3;
    --alert-success-light-border: #bfe6bf;
    --alert-error-bg: #fde7e9;
    --alert-error-border: #f1a9af;
    --alert-error-text: #b10e1c;
    --alert-error-light-bg: #fef3f4;
    --alert-error-light-border: #f6c4c8;
    --alert-info-bg: #e5f2f8;
    --alert-info-border: #a9d3e5;
    --alert-info-text: #0c6c9c;
    --alert-info-light-bg: #f2f9fc;
    --alert-info-light-border: #c7e4ef;
    --alert-warning-bg: #fff4ce;
    --alert-warning-border: #f0c36d;
    --alert-warning-text: #9d5d00;
    --color-danger: #b10e1c;

    /* Sidebar Colors */
    --sidebar-bg: #fafafa;
    --sidebar-border: #e0e0e0;
    --sidebar-text: #424242;
    --sidebar-text-muted: #616161;
    --sidebar-hover-bg: #f3f2f1;
    --sidebar-active-bg: #ebf3fc;
    --sidebar-active-border: #0f6cbd;
    --sidebar-width: 248px;
    --sidebar-collapsed-width: 64px;

    /* Stat Card Accent Colors */
    --stat-blue: #0f6cbd;
    --stat-orange: #ca5010;
    --stat-purple: #8764b8;
    --stat-green: #0e700e;
    --stat-red: #b10e1c;
    --stat-cyan: #038387;

    /* Link Colors */
    --link-color: #0f6cbd;
    --link-hover: #115ea3;
    --link-visited: #8764b8;

    /* Tab Colors */
    --tab-border: #d1d1d1;
    --tab-text: #616161;
    --tab-text-hover: #242424;
    --tab-hover-bg: transparent;
    --tab-active-color: #0f6cbd;
    --tab-badge-bg: #f3f2f1;
    --tab-badge-text: #424242;
    --tab-badge-active-bg: #ebf3fc;
    --tab-badge-active-text: #0f6cbd;

    /* Stepper Colors -- DO NOT CHANGE (frozen, see Task 2) */
    --stepper-inactive-bg: #e0e0e0;
    --stepper-inactive-text: #666666;
    --stepper-active-bg: #3498db;
    --stepper-active-text: white;
    --stepper-complete-bg: #28a745;
    --stepper-complete-text: white;

    /* Form Colors */
    --form-bg: #ffffff;
    --form-border: #d1d1d1;
    --form-text: #242424;
    --form-placeholder: #8a8886;
    --form-disabled-bg: #f3f2f1;

    /* Button Colors */
    --btn-bg: white;
    --btn-border: #d1d1d1;
    --btn-text: #242424;

    /* Notification Colors */
    --notification-bell-bg: #0f6cbd;
    --notification-bell-text: var(--bg-card);
    --notification-unread-bg: #ebf3fc;
    --notification-badge-bg: #b10e1c;

    /* Login Page Colors */
    --login-title-text: #242424;
    --login-subtitle-text: #616161;
    --login-help-text: #616161;
    --login-box-bg: white;

    /* Scrollbar Colors */
    --scrollbar-track-bg: #f5f5f5;
    --scrollbar-thumb-bg: #d1d1d1;
    --scrollbar-thumb-hover-bg: #a19f9d;

    /* Fluent reskin additions */
    --accent-primary: var(--primary-blue);
    --radius-sm: 4px;
}

[data-theme="dark"] {
    /* Dark Mode Color Overrides */

    /* Primary Colors -- now overridden for dark (previously invariant across themes) */
    --primary-blue: #479ef5;
    --primary-blue-hover: #62abf5;
    --primary-blue-light: rgba(71, 158, 245, 0.15);

    /* Background Colors */
    --bg-body: #1f1f1f;
    --bg-card: #292929;
    --bg-card-secondary: #242424;
    --bg-hover: #333333;
    --bg-overlay: rgba(0, 0, 0, 0.6);

    /* Neutral surface aliases (see :root) — dark values */
    --bg-primary: var(--bg-card);
    --bg-secondary: #383838;
    --bg-tertiary: #404040;
    --border-color: var(--border-primary);
    --success-color: #4ade80;
    --danger-color: #f87171;
    --skeleton-bg: #3a3a3a;
    --skeleton-shimmer: rgba(255, 255, 255, 0.08);

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #c8c6c4;
    --text-tertiary: #a19f9d;
    --text-muted: #797775;
    --text-inverse: #1f1f1f;

    /* Border Colors */
    --border-primary: #4b4a48;
    --border-secondary: #3b3a39;
    --border-light: #3b3a39;
    --border-highlight: #3b3a39;

    /* Shadow Colors */
    --shadow-sm: rgba(0, 0, 0, 0.4);
    --shadow-md: rgba(0, 0, 0, 0.45);
    --shadow-lg: rgba(0, 0, 0, 0.5);
    --shadow-xl: rgba(0, 0, 0, 0.6);

    /* Status Badges - Adjusted for Dark Mode Visibility */
    --status-success-bg: #0f7b0f;
    --status-success-text: white;
    --status-warning-bg: #986f0b;
    --status-warning-text: white;
    --status-info-bg: #0e7490;
    --status-info-text: white;
    --status-purple-bg: #8764b8;
    --status-purple-text: white;
    --status-inactive-bg: #797775;
    --status-inactive-text: white;

    /* Severity/Priority Colors -- kept saturated enough for white text contrast */
    --severity-critical: #c4314b;
    --severity-high: #c26a1d;
    --severity-medium: #a98a00;
    --severity-low: #797775;
    --severity-none: #8a8886;

    /* Alert Colors for Dark Mode */
    --alert-success-bg: #0f2e13;
    --alert-success-border: #175a20;
    --alert-success-text: #6ccb6c;
    --alert-success-light-bg: #0f2e13;
    --alert-success-light-border: #175a20;
    --alert-error-bg: #3b0f13;
    --alert-error-border: #601410;
    --alert-error-text: #f1707b;
    --alert-error-light-bg: #3b0f13;
    --alert-error-light-border: #601410;
    --alert-info-bg: #0f2a33;
    --alert-info-border: #114d5c;
    --alert-info-text: #62c4e0;
    --alert-info-light-bg: #0f2a33;
    --alert-info-light-border: #114d5c;
    --alert-warning-bg: #3b3000;
    --alert-warning-border: #6b5300;
    --alert-warning-text: #fce100;
    --color-danger: #f1707b;

    /* Sidebar Colors */
    --sidebar-bg: #201f1e;
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-text: rgba(255, 255, 255, 0.8);
    --sidebar-text-muted: rgba(255, 255, 255, 0.5);
    --sidebar-hover-bg: rgba(255, 255, 255, 0.06);
    --sidebar-active-bg: #25384d;
    --sidebar-active-border: #479ef5;

    /* Stat Card Accent Colors */
    --stat-blue: #479ef5;
    --stat-orange: #e0793b;
    --stat-purple: #b292d6;
    --stat-green: #6ccb6c;
    --stat-red: #f1707b;
    --stat-cyan: #28b8c4;

    /* Link Colors - Brighter for Dark Mode */
    --link-color: #479ef5;
    --link-hover: #62abf5;
    --link-visited: #b292d6;

    /* Tab Colors */
    --tab-border: #4b4a48;
    --tab-text: #c8c6c4;
    --tab-text-hover: #ffffff;
    --tab-hover-bg: transparent;
    --tab-active-color: #479ef5;
    --tab-badge-bg: #3b3a39;
    --tab-badge-text: #c8c6c4;
    --tab-badge-active-bg: #25384d;
    --tab-badge-active-text: #479ef5;

    /* Stepper Colors -- DO NOT CHANGE (frozen, see Task 2) */
    --stepper-inactive-bg: #334155;
    --stepper-inactive-text: #94a3b8;
    --stepper-active-bg: #3b82f6;
    --stepper-active-text: white;
    --stepper-complete-bg: #059669;
    --stepper-complete-text: white;

    /* Form Colors */
    --form-bg: #292929;
    --form-border: #4b4a48;
    --form-text: #ffffff;
    --form-placeholder: #a19f9d;
    --form-disabled-bg: #1f1f1f;

    /* Button Colors */
    --btn-bg: #292929;
    --btn-border: #4b4a48;
    --btn-text: #ffffff;

    /* Notification Colors */
    --notification-bell-bg: #479ef5;
    --notification-bell-text: var(--bg-card);
    --notification-unread-bg: #25384d;
    --notification-badge-bg: #f1707b;

    /* Login Page Colors */
    --login-title-text: #ffffff;
    --login-subtitle-text: #c8c6c4;
    --login-help-text: #a19f9d;
    --login-box-bg: #292929;

    /* Scrollbar Colors */
    --scrollbar-track-bg: #1f1f1f;
    --scrollbar-thumb-bg: #4b4a48;
    --scrollbar-thumb-hover-bg: #616161;
}

body {
    font-family: 'Segoe UI Variable Display', 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-body);
}

/* ========================================
   Scrollbar Styling - Theme-Aware
   ======================================== */

/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track-bg);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb-bg);
    border-radius: 5px;
    transition: background-color 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover-bg);
}

/* Firefox */
* {
    scrollbar-color: var(--scrollbar-thumb-bg) var(--scrollbar-track-bg);
    scrollbar-width: thin;
}

/* Links */
a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* All links show as unclicked (visited links use same color as regular links) */
a:visited {
    color: var(--link-color);
}

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

.admin-dashboard .tab-content {
    display: none;
}

.admin-dashboard .tab-content.active {
    display: block;
    animation: fadeIn 0.5s;
}

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

/* Admin grid specific styles */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.admin-card {
    background: linear-gradient(to bottom, var(--bg-card), var(--bg-card-secondary));
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.admin-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.admin-card h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.125rem;
}

.admin-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.admin-card .btn {
    width: 100%;
    margin-top: auto;
}

.admin-card-placeholder {
    background: linear-gradient(to bottom, var(--bg-card), var(--bg-card-secondary));
    border: 1px dashed var(--border-primary);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    opacity: 0.6;
}

.admin-card-placeholder p {
    color: var(--text-secondary);
    text-align: center;
    margin: 0;
}

/* Badge styles — modifier classes only declare colors; base .badge class provides layout */
.badge-info {
    background: var(--status-info-bg);
    color: var(--status-info-text);
}

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

/* Warning keeps its own visible border to distinguish from transparent-border siblings */
.badge-warning {
    background: var(--alert-warning-bg);
    color: var(--alert-warning-text);
    border-color: var(--alert-warning-border);
}

/* Top Navigation Bar */
.navbar {
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    height: 52px;
    box-shadow: 0 1px 0 var(--sidebar-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.25rem;
    gap: 1rem;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--sidebar-text);
    text-decoration: none;
    letter-spacing: -0.5px;
}

/* Override general link colors for nav-brand - keep it white without underline */
.nav-brand:hover,
.nav-brand:visited,
.nav-brand:active {
    color: var(--sidebar-text);
    text-decoration: none;
}

/* Override general link colors for buttons - use button text color, not link color */
.btn,
.btn:visited,
.btn:hover,
.btn:active,
button a,
button a:visited,
button a:hover,
button a:active {
    color: var(--btn-text);
    text-decoration: none;
}

.nav-user {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-user span {
    font-size: 0.9rem;
    opacity: 0.95;
}

.logout-btn {
    color: var(--sidebar-text);
    text-decoration: none;
    padding: 0.5rem 1rem;
    background: var(--sidebar-hover-bg);
    border-radius: 6px;
    transition: background 0.3s;
    font-size: 0.9rem;
}

.logout-btn:hover,
.logout-btn:visited,
.logout-btn:active {
    color: var(--sidebar-text);
}

.logout-btn:hover {
    background: var(--sidebar-active-bg);
}

/* Hamburger Menu Toggle */
.menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-right: 1rem;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s;
}

.menu-toggle:hover span {
    background: rgba(255,255,255,0.8);
}

/* ========================================
   Sidebar — Persistent desktop, overlay mobile
   ======================================== */

/* Desktop: always-visible persistent sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    transition: width 0.25s ease;
    z-index: 200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Collapsed state on desktop */
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

/* App layout: sidebar + main content */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    transition: margin-left 0.25s ease;
}

body.sidebar-collapsed .app-main {
    margin-left: var(--sidebar-collapsed-width);
}

/* Mobile: overlay behavior */
@media (max-width: 1023px) {
    .sidebar {
        left: calc(-1 * var(--sidebar-width));
        width: var(--sidebar-width) !important; /* always full width on mobile */
    }

    .sidebar.mobile-open {
        left: 0;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
    }

    .app-main {
        margin-left: 0 !important;
    }
}

/* Collapsed sidebar: hide text labels */
body.sidebar-collapsed .sidebar-link span:last-child,
body.sidebar-collapsed .sidebar-group-toggle span:nth-child(2),
body.sidebar-collapsed .sidebar-group-toggle .sidebar-group-arrow,
body.sidebar-collapsed .sidebar-header .sidebar-brand-text,
body.sidebar-collapsed .user-details,
body.sidebar-collapsed .sidebar-theme-toggle .theme-toggle-text,
body.sidebar-collapsed .sidebar-group-items {
    display: none;
}

body.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding: 1rem 0;
}

body.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: 0.875rem 0;
}

body.sidebar-collapsed .sidebar-icon {
    margin-right: 0;
}

body.sidebar-collapsed .sidebar-group-toggle {
    justify-content: center;
    padding: 0.875rem 0;
}

body.sidebar-collapsed .sidebar-footer {
    padding: 1rem 0;
    display: flex;
    justify-content: center;
}

body.sidebar-collapsed .user-avatar {
    margin: 0;
}

.sidebar-header {
    padding: 0 1rem;
    height: 52px;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.sidebar-brand-text {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--sidebar-text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: none; /* hidden on desktop, shown on mobile */
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

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

/* Show close button only on mobile */
@media (max-width: 1023px) {
    .sidebar-close {
        display: flex;
    }
}

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

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.625rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    border-left: 3px solid transparent;
    font-size: 0.875rem;
    white-space: nowrap;
}

.sidebar-link:hover {
    background: var(--sidebar-hover-bg);
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar-link.active {
    background: var(--sidebar-active-bg);
    border-left-color: var(--sidebar-active-border);
    color: var(--sidebar-active-text, var(--sidebar-active-border));
    font-weight: 600;
}

/* Override general link colors for sidebar */
.sidebar a,
.sidebar a:visited,
.sidebar a:hover {
    color: var(--sidebar-text);
}

.sidebar a:hover {
    text-decoration: none;
}

.sidebar-icon {
    font-size: 1.1rem;
    margin-right: 0.75rem;
    width: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-icon-svg {
    width: 24px;
    height: 24px;
    color: var(--sidebar-text);
    stroke-width: 2;
}

/* ---- Sidebar collapsible group (Management, etc.) ---- */

.sidebar-group {
    /* No extra margin — blends with the link list */
}

.sidebar-group-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.625rem 1rem;
    background: transparent;
    border: none;
    border-left: 2px solid transparent;
    cursor: pointer;
    color: var(--sidebar-text);
    font-size: 0.875rem;
    transition: background 0.15s ease, color 0.15s ease;
    text-align: left;
    white-space: nowrap;
}

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

.sidebar-group-toggle.open {
    color: var(--text-primary);
}

.sidebar-group-toggle .sidebar-icon {
    display: flex;
    align-items: center;
    margin-right: 0.75rem;
    opacity: 0.8;
    flex-shrink: 0;
}

.sidebar-group-toggle > span:nth-child(2) {
    flex: 1;
}

.sidebar-group-arrow {
    display: flex;
    align-items: center;
    margin-left: auto;
    opacity: 0.6;
    transition: transform 0.25s ease;
}

.sidebar-group-toggle.open .sidebar-group-arrow {
    transform: rotate(90deg);
}

.sidebar-group-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

/* Set from the top of <body> until the first frame is painted, so restoring the saved sidebar
   state (collapsed, open groups) happens in place instead of animating and shifting the page. */
body.sidebar-restoring .sidebar,
body.sidebar-restoring .app-main,
body.sidebar-restoring .sidebar-group-items,
body.sidebar-restoring .sidebar-group-arrow {
    transition: none !important;
}

.sidebar-group-items.open {
    /* Management is the only group using this class and now has 17 possible
       items (Special Permissions grants) at ~40px each -- 400px silently
       clipped anything past the 9th/10th via overflow:hidden with no
       scrollbar. Sized with headroom above the current 17-item ceiling. */
    max-height: 900px;
}

.sidebar-sub-link {
    padding-left: 3rem !important;
    font-size: 0.9rem;
}

/* ---- End sidebar group ---- */

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

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--btn-fill);
    color: var(--btn-primary-text, var(--bg-card));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
}

.user-name {
    color: var(--sidebar-text);
    font-weight: 500;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    color: var(--sidebar-text-muted);
    font-size: 0.7rem;
    margin-top: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sidebar Overlay — mobile only */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s;
    z-index: 199;
    display: none;
}

@media (max-width: 1023px) {
    .sidebar-overlay {
        display: block;
    }
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem;
}

/* Flash Messages */
.flash-messages {
    margin-bottom: 1rem;
}

.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.alert-success {
    background-color: var(--alert-success-bg);
    border-color: var(--alert-success-border);
    color: var(--alert-success-text);
}

.alert-error {
    background-color: var(--alert-error-bg);
    border-color: var(--alert-error-border);
    color: var(--alert-error-text);
}

.alert-info {
    background-color: var(--alert-info-bg);
    border-color: var(--alert-info-border);
    color: var(--alert-info-text);
}

.alert-danger {
    background-color: var(--alert-error-bg);
    border-color: var(--alert-error-border);
    color: var(--alert-error-text);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--btn-border);
    border-radius: 4px;
    background-color: var(--btn-bg);
    color: var(--btn-text);
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
}

/* Ensure button elements match anchor elements */
button.btn {
    font-family: inherit;
    line-height: 1.5;
}

.btn-primary {
    background-color: var(--btn-fill);
    border-color: var(--btn-fill);
    color: var(--btn-primary-text, var(--bg-card)) !important;
}

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

.btn-danger {
    background-color: var(--severity-critical);
    border-color: var(--severity-critical);
    color: white !important;
}

.btn-danger:hover {
    background-color: #8c0b16;
    border-color: #8c0b16;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 12px;
}

/* Compact header-row action buttons (matches the Export CSV button) */
.btn-xs {
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
}

.btn-xs > svg {
    width: 12px;
    height: 12px;
    margin-right: 0.35rem;
    display: inline-block;
    vertical-align: middle;
}

/* Smallest: in-table row actions */
.btn-xxs {
    padding: 0.125rem 0.4rem;
    font-size: 0.6875rem;
}

.btn-warning {
    background-color: var(--severity-high);
    border-color: var(--severity-high);
    color: white !important;
}

/* Fixed width for Policy Exception decision actions (Greenlight/Approve/
   Reject/Return to Initiator) so buttons of different label lengths line
   up, and the reason/notes fields beside them end up the same size too. */
.pe-action-btn {
    width: 160px;
    text-align: center;
    flex-shrink: 0;
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-primary);
    box-shadow: 0 1px 2px var(--shadow-sm);
    position: relative;
}


.stat-card-link {
    display: block;
}

.stat-card-link .stat-card {
    transition: all 0.2s ease;
}

.stat-card-link:hover .stat-card {
    box-shadow: 0 2px 4px var(--shadow-md);
}

[data-theme="dark"] .stat-card-link:hover .stat-card {
    box-shadow: 0 2px 4px var(--shadow-md);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-primary);
}

/* Section */
.section {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 4px var(--shadow-sm);
    margin-bottom: 1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    margin: 0;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background-color: var(--bg-card-secondary);
}

.data-table th {
    padding: 0.5rem 0.875rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: none;
    letter-spacing: normal;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-primary);
}

.data-table td {
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--border-primary);
    font-size: 0.875rem;
}

.data-table tbody tr:hover {
    background-color: var(--bg-hover);
}

/* Data-classification row accent (assessment detail → Technologies &
   Subprocessors tabs). No room for a full column, so the row carries a
   rounded colored bar keyed to the assessor-set DataClassificationType; the
   name is in the row's title. Technologies can carry a classification too
   -- e.g. one that was a subprocessor before being reclassified. */
#subprocessors-tbody tr.has-classification td:first-child,
#technologies-tbody tr.has-classification td:first-child {
    position: relative;
    padding-left: 1.25rem;
}
#subprocessors-tbody tr.has-classification td:first-child::before,
#technologies-tbody tr.has-classification td:first-child::before {
    content: "";
    position: absolute;
    left: 0;
    top: 5px;
    bottom: 5px;
    width: 4px;
    border-radius: 0 3px 3px 0;
    background: var(--subproc-accent, transparent);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    border: 1px solid transparent;
    vertical-align: middle;
}

.badge-danger {
    background-color: var(--severity-critical);
    color: white;
}

/* Attention-pulse for count badges that need to pull the eye (e.g. a tab
   badge for an item awaiting the viewer's decision). Compose with a colour
   class: `class="badge badge-danger badge-pulse"`. */
.badge-pulse {
    animation: badge-pulse 1.2s ease-in-out infinite;
}
@keyframes badge-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}
@media (prefers-reduced-motion: reduce) {
    .badge-pulse { animation: none; }
}

.badge-secondary {
    background-color: var(--status-inactive-bg);
    color: white;
}

.badge-primary {
    background-color: var(--btn-fill);
    color: var(--btn-primary-text, var(--bg-card));
}

.badge-blue {
    background-color: var(--btn-fill);
    color: var(--btn-primary-text, var(--bg-card));
}

.badge-yellow {
    background-color: var(--status-warning-bg);
    color: white;
}

.badge-green {
    background-color: var(--status-success-bg);
    color: white;
}

.badge-gray {
    background-color: var(--status-inactive-bg);
    color: white;
}

.badge-orange {
    background-color: var(--severity-high);
    color: white;
}

/* Fixed-width variant for Policy Exception request/issue state pills
   (Pending Assessor Review, Approved, Revoked, ...) so labels of very
   different lengths render as the same size instead of shrink-wrapping
   to their text. */
.pe-state-badge {
    min-width: 150px;
    text-align: center;
}

/* Color by PolicyExceptionRequest.state, via data-pe-state — templates set
   the attribute (raw enum value, e.g. "pending_assessor_review"), one rule
   covers every pe-state-badge occurrence in the app. */
.pe-state-badge[data-pe-state="approved"] {
    background-color: var(--status-success-bg);
    color: var(--status-success-text);
}
.pe-state-badge[data-pe-state="rejected"],
.pe-state-badge[data-pe-state="revoked"],
.pe-state-badge[data-pe-state="invalidated"],
.pe-state-badge[data-pe-state="superseded"] {
    background-color: var(--severity-critical);
    color: white;
}
.pe-state-badge[data-pe-state="pending_assessor_review"],
.pe-state-badge[data-pe-state="pending"],
.pe-state-badge[data-pe-state="returned"] {
    background-color: var(--status-warning-bg);
    color: var(--status-warning-text);
}

.badge-awaiting-legal {
    background-color: var(--status-purple-bg);
    color: var(--status-purple-text);
}

.badge-merged {
    background-color: var(--status-purple-bg);
    color: var(--status-purple-text);
}

.badge-draft {
    background-color: var(--status-inactive-bg);
    color: var(--status-inactive-text);
}

.badge-awaiting-requester {
    background-color: var(--status-warning-bg);
    color: var(--status-warning-text);
}

.badge-awaiting-third-party {
    background-color: var(--status-info-bg);
    color: var(--status-info-text);
}

.badge-awaiting-assessor {
    background-color: var(--status-purple-bg);
    color: var(--status-purple-text);
}

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

/* AssessmentStatus badges (assessment/list.html, assessment/detail.html
   build the class as badge-{status.name.lower().replace('_','-')}).
   Fixed width so "Awaiting Third Party" and "Completed" render as the
   same size pill, matching the .pe-state-badge convention above. */
.assessment-status-badge {
    min-width: 150px;
    text-align: center;
}

.badge-not-started {
    background-color: var(--status-inactive-bg);
    color: var(--status-inactive-text);
}

.badge-under-review {
    background-color: var(--status-purple-bg);
    color: var(--status-purple-text);
}

.badge-completed {
    background-color: var(--status-success-bg);
    color: var(--status-success-text);
}

.badge-cancelled {
    background-color: var(--severity-critical);
    color: white;
}

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

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

.badge-blocked {
    background-color: var(--severity-critical);
    color: white;
}

.badge-cvss-critical {
    background-color: var(--severity-critical);
    color: white;
}

.badge-cvss-high {
    background-color: var(--severity-high);
    color: white;
}

.badge-cvss-medium {
    background-color: var(--severity-medium);
    color: white;
}

.badge-cvss-low {
    background-color: var(--severity-low);
    color: white;
}

/* Questionnaire status badges */
.badge-not_started {
    background-color: var(--status-inactive-bg);
    color: var(--status-inactive-text);
}

.badge-in_progress {
    background-color: var(--status-info-bg);
    color: var(--status-info-text);
}

.badge-submitted {
    background-color: var(--status-success-bg);
    color: var(--status-success-text);
}

.badge-reviewed {
    background-color: var(--status-purple-bg);
    color: var(--status-purple-text);
}

/* Contract status badges */
.badge-executed {
    background-color: var(--status-success-bg);
    color: var(--status-success-text);
}

.badge-expired {
    background-color: var(--status-inactive-bg);
    color: var(--status-inactive-text);
}

.badge-terminated {
    background-color: var(--status-danger-bg, #fee2e2);
    color: var(--status-danger-text, #8c0b16);
}

/* Forms */
.form {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-sm);
    max-width: 600px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem; /* Added this for consistency */
}

/* Bordered intake fields (yes_no fields) */
.intake-field-bordered {
    border: 1px solid var(--border-primary);
    padding: 1rem;
    border-radius: 8px;
    background: var(--bg-card-secondary);
    margin-bottom: 1.5rem;
    transition: all 0.2s ease;
}

.intake-field-bordered:hover {
    border-color: var(--primary-blue);
    box-shadow: 0 2px 8px var(--shadow-sm);
}

.form-group input,
.form-group select,
.form-group textarea,
.form-input, /* Added this */
.form-select /* Added this */ {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--form-border);
    border-radius: 4px;
    font-size: 14px;
    background-color: var(--form-bg);
    color: var(--form-text);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--form-placeholder);
    font-size: 12px;
}

/* Browser autofill (Chrome/Safari/Edge) paints its own background via UA
   stylesheet, ignoring background-color entirely. Override with an inset
   box-shadow instead so autofilled inputs respect the current theme. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--form-bg) inset;
    -webkit-text-fill-color: var(--form-text);
    caret-color: var(--form-text);
    transition: background-color 5000s ease-in-out 0s;
}

/* Styled search input with icon prefix */
.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-icon {
    position: absolute;
    left: 0.65rem;
    color: var(--text-secondary);
    font-size: 1rem;
    pointer-events: none;
    line-height: 1;
}

.search-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1px solid var(--form-border);
    border-radius: 20px;
    font-size: 0.875rem;
    background-color: var(--form-bg);
    color: var(--form-text);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06), 0 0 0 3px var(--primary-blue-light);
}

.search-input::placeholder {
    color: var(--form-placeholder);
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Custom styles for data elements filter grid and actions */
.data-elements-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: stretch; /* All grid items same height */
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end; /* Align buttons to the bottom of the flex container */
}

.filter-actions .btn {
    flex: 1;
    text-align: center;
    height: 2.4375rem; /* Explicitly set height to match input fields */
    display: flex; /* Re-add flex to allow vertical centering of text */
    align-items: center; /* Vertically center text in button */
    justify-content: center; /* Horizontally center text in button */
}

/* Login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f6cbd 0%, #2b88d8 100%);
}

.login-box {
    background: var(--login-box-bg);
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px var(--shadow-xl);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    margin-bottom: 0.5rem;
    color: var(--login-title-text);
}

.login-box h2 {
    font-size: 1rem;
    color: var(--login-subtitle-text);
    margin-bottom: 2rem;
}

.help-text {
    text-align: center;
    margin-top: 1rem;
    color: var(--login-help-text);
    font-size: 12px;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    margin: 0;
}

/* Detail Grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.detail-section {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-primary);
    box-shadow: 0 1px 2px var(--shadow-sm);
}

.detail-section h2 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--btn-fill);
}

.detail-section dl {
    margin: 0;
}

.detail-item dt { /* Added these rules */
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}
.detail-item dd { /* Added these rules */
    margin: 0;
}

.detail-section dt {
    font-weight: 600;
    margin-top: 0.25rem; /* Reduced from 0.75rem */
    color: var(--text-secondary);
}

.detail-section dd {
    margin-left: 0;
    margin-top: 0; /* Reduced from 0.25rem */
}

.detail-section dd input,
.detail-section dd select,
.detail-section dd textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--form-border);
    border-radius: 4px;
    font-size: 14px;
    background-color: var(--form-bg);
    color: var(--form-text);
}

/* Choices.js wrapper in detail sections */
.detail-section dd .choices {
    width: 100%;
    max-width: 100%;
}

.detail-section dd .choices__inner {
    padding: 0.5rem;
    min-height: auto;
    font-size: 14px;
}

/* ========================================
   Use Case Stepper — Ribbon + Chip
   ======================================== */

.uc-stepper {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 6px var(--shadow-sm);
    position: relative;
}

/* Fluent reskin: .uc-stepper is explicitly excluded from the redesign.
   It draws its chrome from shared tokens that changed value in the
   Task 1 rewrite -- pin them back to their pre-reskin literals here so
   the stepper stays pixel-identical. Stepper-exclusive tokens
   (--stepper-*) were never touched by Task 1, so they don't need pinning. */
.uc-stepper {
    --bg-card: #ffffff;
    --bg-card-secondary: #f9fafb;
    --border-primary: #e5e7eb;
    --text-primary: #333333;
    --text-secondary: #666666;
    --shadow-sm: rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .uc-stepper {
    --bg-card: #292929;
    --bg-card-secondary: #242424;
    --border-primary: #4b4a48;
    --text-primary: #ffffff;
    --text-secondary: #a19f9d;
    --shadow-sm: rgba(0, 0, 0, 0.3);
}

.stepper-ribbon {
    height: 5px;
    background: var(--border-primary);
    position: relative;
    border-radius: 10px 10px 0 0;
    overflow: visible;
}

.stepper-ribbon-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--stepper-active-bg), color-mix(in srgb, var(--stepper-active-bg) 60%, white));
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 10px color-mix(in srgb, var(--stepper-active-bg) 45%, transparent);
    animation: ribbonGrow 0.9s cubic-bezier(.22, 1, .36, 1) forwards;
}

.stepper-ribbon-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--stepper-active-bg);
    top: 2.5px;
    left: 0;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--stepper-active-bg) 25%, transparent);
    animation: dotMove 0.9s cubic-bezier(.22, 1, .36, 1) forwards,
               ribbonDot 2s ease-in-out 0.9s infinite;
    z-index: 1;
}

@keyframes ribbonGrow {
    from { width: 0; }
    to   { width: var(--pct); }
}

@keyframes dotMove {
    from { left: 0; }
    to   { left: var(--pct); }
}

@keyframes ribbonDot {
    0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--stepper-active-bg) 25%, transparent); }
    50%       { box-shadow: 0 0 0 9px color-mix(in srgb, var(--stepper-active-bg) 0%, transparent); }
}

.stepper-body {
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.stepper-chips {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.chip {
    border-radius: 99px;
    padding: 0.28rem 0.75rem;
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.chip-done {
    background: var(--stepper-complete-bg);
    color: var(--stepper-complete-text);
    border: 1px solid var(--stepper-complete-bg);
    opacity: 0.85;
}

.chip-done::before {
    content: '✓ ';
}

.chip-active {
    background: color-mix(in srgb, var(--stepper-active-bg) 12%, transparent);
    color: var(--stepper-active-ink, var(--stepper-active-bg));
    border: 1.5px solid var(--stepper-active-bg);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--stepper-active-bg) 15%, transparent);
}

.chip-active-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--stepper-active-bg);
    animation: chipDot 1.3s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes chipDot {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.8); }
}

.chip-future {
    background: var(--bg-card-secondary);
    color: var(--stepper-inactive-text);
    border: 1px dashed var(--border-primary);
}

.stepper-meta {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.stepper-pct {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--stepper-active-ink, var(--stepper-active-bg));
    line-height: 1;
    letter-spacing: -0.03em;
}

.stepper-desc strong {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.1rem;
}

.stepper-desc span {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

@media (max-width: 640px) {
    .stepper-meta {
        margin-left: 0;
        width: 100%;
    }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.no-data {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

/* ========================================
   Dark Mode Theme Toggle
   ======================================== */

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

.theme-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--sidebar-hover-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: 6px;
    color: var(--sidebar-text);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
    font-weight: 500;
}

.theme-toggle-btn:hover {
    background: var(--sidebar-active-bg);
    border-color: var(--primary-blue);
}

.theme-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: all 0.3s;
}

.theme-icon-sun {
    display: block;
}

.theme-icon-moon {
    display: none;
}

[data-theme="dark"] .theme-icon-sun {
    display: none;
}

[data-theme="dark"] .theme-icon-moon {
    display: block;
}

.theme-toggle-text {
    flex: 1;
    text-align: left;
}

/* ── Tooltip ──────────────────────────────────────────────── */
[data-tooltip] {
    position: relative;
}
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    font-size: 0.72rem;
    white-space: nowrap;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 9999;
}
[data-tooltip]:hover::after {
    opacity: 1;
}

/* Smooth Theme Transitions */
body,
.navbar,
.sidebar,
.sidebar-overlay,
.stat-card,
.section,
.detail-section,
.uc-stepper,
.data-table,
.form,
.login-box,
.btn {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ========================================
   Choices.js Light and Dark Mode Support
   ======================================== */

/* Light mode */
.choices__inner {
    background-color: var(--form-bg) !important;
    border-color: var(--form-border) !important;
    border-radius: var(--radius-sm) !important;
    color: var(--form-text) !important;
}

.choices__list--dropdown {
    background-color: var(--form-bg) !important;
    border-color: var(--form-border) !important;
    border-radius: var(--radius-sm) !important;
}

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

[data-theme="dark"] .choices__item--choice:hover,
[data-theme="dark"] .choices__item--choice.is-highlighted {
    background-color: var(--btn-fill);
    color: var(--btn-primary-text, white);
}

[data-theme="dark"] .choices__item {
    color: var(--form-text) !important;
}

[data-theme="dark"] .choices__item--choice {
    color: var(--form-text) !important;
}

[data-theme="dark"] .choices__input {
    background-color: var(--form-bg) !important;
    color: var(--form-text) !important;
}

[data-theme="dark"] .choices__placeholder {
    color: var(--form-placeholder) !important;
}

/* Choices.js Selected Items - Remove blue background, make it match form controls */
.choices__item--selectable {
    background-color: transparent !important;
    border: none !important;
    color: var(--form-text) !important;
    padding-left: 0 !important;
}

.choices__button {
    background-color: rgba(0, 0, 0, 0.12) !important;
    border-left-color: rgba(0, 0, 0, 0.12) !important;
    opacity: 0.8;
}

[data-theme="dark"] .choices__button {
    background-color: rgba(255, 255, 255, 0.3) !important;
    border-left-color: rgba(255, 255, 255, 0.3) !important;
}

.choices__button:hover {
    opacity: 1;
}

/* Dropdown highlight and focus states */
.choices__item--choice.is-highlighted {
    background-color: var(--btn-fill) !important;
    color: var(--btn-primary-text, white) !important;
}

.choices.is-focused .choices__inner {
    border-color: var(--primary-blue) !important;
    box-shadow: 0 0 0 1px var(--primary-blue) !important;
}

/* Remove extra margin from Choices.js in form groups to eliminate gap before small text */
.form-group .choices {
    margin-bottom: 0 !important;
}

/* Match Choices.js inner height to standard form inputs (form-input uses padding:0.5rem + 1px border = 36px) */
.form-group .choices__inner {
    padding: 2.5px 0.5rem !important;
    min-height: 0 !important;
}

/* Restore dropdown list item padding. Choices.js reuses .choices__item--selectable for both
   selected chips and dropdown options; the chip-only padding-left:0 rule above unintentionally
   strips left padding from dropdown options too. Apply globally (not just .form-group) so
   detail-page edit fields (rendered under dd/.detail-section) get it as well. */
.choices__list--dropdown .choices__item {
    padding: 8px 12px !important;
}

/* =====================
   LEGAL PROCESS STEPPER
   ===================== */
.legal-process-stepper {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.lp-step {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    position: relative;
}

.lp-step-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border-primary);
    background: var(--bg-card);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 1;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.lp-step.lp-active .lp-step-icon {
    border-color: var(--lp-step-active, var(--primary-blue, #3498db));
    background: var(--lp-step-active-bg, rgba(52,152,219,0.12));
    color: var(--lp-step-active-ink, var(--primary-blue, #3498db));
}

.lp-step.lp-complete .lp-step-icon {
    border-color: var(--status-success-bg, #10b981);
    background: rgba(16,185,129,0.12);
    color: var(--status-success-bg);
}

.lp-step-body {
    padding-bottom: 1.5rem;
    flex: 1;
}

.lp-step:last-child .lp-step-body {
    padding-bottom: 0;
}

.lp-step-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.lp-step.lp-active .lp-step-title,
.lp-step.lp-complete .lp-step-title {
    color: var(--text-primary);
}

.lp-step-desc {
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.lp-step-meta {
    margin-top: 0.3rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.lp-connector {
    width: 2px;
    height: 1.5rem;
    background: var(--border-primary);
    margin-left: 15px;
    transition: background 0.2s;
}

.lp-connector-done {
    background: rgba(16,185,129,0.4);
}

/* ========================================
   Layout Utilities — UI Revamp
   ======================================== */

/* 2-panel detail layout */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    align-items: start;
}

.detail-panel {
    position: sticky;
    top: 1rem;
    margin-top: calc(3.62rem + 1px);
}

.detail-panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px var(--shadow-sm);
}

.detail-panel-card + .detail-panel-card {
    margin-top: 1rem;
}

.detail-panel-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.detail-panel-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
}

.detail-panel-row {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0;
}

.detail-panel-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-primary);
}

@media (max-width: 1024px) {
    .detail-layout {
        grid-template-columns: 1fr;
    }
    .detail-panel {
        position: static;
    }
}

/* Stat card row — 4 across */
.stat-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 1200px) {
    .stat-row { grid-template-columns: repeat(2, 1fr); }
}

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

.stat-row-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    box-shadow: 0 1px 3px var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-decoration: none;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.stat-row-card:hover {
    box-shadow: 0 4px 12px var(--shadow-md);
    transform: translateY(-1px);
    text-decoration: none;
}

.stat-row-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-row-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-row-number.overdue {
    color: var(--severity-critical);
}

.stat-row-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

/* ── Skeleton loading ───────────────────────────────────────────────────── */
.skeleton {
    background: var(--skeleton-bg);
    border-radius: 0.25rem;
    position: relative;
    overflow: hidden;
}
.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--skeleton-shimmer, rgba(255,255,255,0.6)) 50%,
        transparent 100%
    );
    animation: skeleton-shimmer 1.6s infinite;
}
@keyframes skeleton-shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.skeleton-text  { height: 0.875rem; margin-bottom: 0.5rem; border-radius: 0.25rem; }
.skeleton-title { height: 1.125rem; width: 40%; margin-bottom: 1rem; border-radius: 0.25rem; }
.skeleton-card  {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
}

/* ── UC State Timeline ──────────────────────────────────────────────────── */
.uc-timeline {
    position: relative;
    padding: 0.25rem 0 0.25rem 3.25rem;
}
.uc-timeline::before {
    content: '';
    position: absolute;
    left: 1.5625rem;
    top: 0.375rem;
    bottom: 0.375rem;
    width: 2px;
    background: var(--border-color);
    border-radius: 1px;
}
.uc-timeline-item {
    position: relative;
    padding-bottom: 1.75rem;
}
.uc-timeline-item:last-child {
    padding-bottom: 0;
}
.uc-timeline-marker {
    position: absolute;
    left: -2.5rem;
    top: 0;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1;
    color: #fff;
    background: var(--text-muted);
    border: 2.5px solid var(--bg-primary);
    z-index: 1;
}
.uc-timeline-marker.completed {
    background: var(--status-success-bg);
}
.uc-timeline-marker.current {
    position: absolute;
    background: var(--status-warning-bg);
    width: 1.875rem;
    height: 1.875rem;
    left: -2.5625rem;
    top: -0.0625rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}
.uc-timeline-marker.current::after {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid var(--status-warning-bg);
    animation: uc-dot-ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes uc-dot-ping {
    0%   { transform: scale(0.8); opacity: 0.7; }
    100% { transform: scale(1.8); opacity: 0; }
}
.uc-timeline-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.875rem 1rem;
}
.uc-timeline-card.completed {
    border-color: var(--status-success-bg);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.07);
}
.uc-timeline-card.current {
    border-color: var(--status-warning-bg);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.07);
}
.uc-timeline-state {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
}
.uc-timeline-meta {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin-top: 0.3125rem;
}
.uc-timeline-meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.uc-timeline-duration {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-tertiary, var(--bg-secondary));
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 0.125rem 0.625rem;
}
.uc-timeline-duration.completed {
    color: var(--status-success-bg);
    background: rgba(22, 163, 74, 0.07);
    border-color: rgba(22, 163, 74, 0.35);
}
.uc-timeline-duration.current {
    color: var(--status-warning-bg);
    background: rgba(217, 119, 6, 0.07);
    border-color: rgba(217, 119, 6, 0.35);
}
.uc-timeline-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Side-by-side table split */
.table-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
    .table-split { grid-template-columns: 1fr; }
}

/* Always-visible filter bar */
.filter-bar {
    display: flex;
    gap: 0.625rem;
    align-items: flex-end;
    flex-wrap: wrap;
    padding: 0.875rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    margin-bottom: 1rem;
}

.filter-bar .filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 140px;
}

.filter-bar .filter-field label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.filter-bar .filter-search {
    flex: 1;
    min-width: 200px;
}

/* Page header with summary line */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

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

/* Dashboard header banner (Admin > Branding > Dashboard Header Banner).
   Every pattern is built from --btn-fill, so it follows the admin's button color in
   both themes. The dark base + scrim keep white text readable for any chosen color. */
.page-banner,
.banner-swatch {
    --bn-base: color-mix(in srgb, var(--btn-fill) 55%, #0b1220);
    --bn-hi: color-mix(in srgb, var(--btn-fill) 85%, #ffffff);
    --bn-line: color-mix(in srgb, var(--bn-hi) 22%, transparent);
    --bn-soft: color-mix(in srgb, var(--bn-hi) 40%, transparent);
    --bn-solid: linear-gradient(135deg, var(--bn-base), color-mix(in srgb, var(--bn-base) 60%, var(--bn-hi)));
    position: relative;
    isolation: isolate;
    background-color: var(--bn-base);
}

/* Browsers without color-mix(): fixed neutral-blue palette so the white header text stays readable. */
@supports not (color: color-mix(in srgb, red, blue)) {
    .page-banner,
    .banner-swatch {
        --bn-base: #1f3a5a;
        --bn-hi: #5a8fc8;
        --bn-line: rgba(255, 255, 255, 0.18);
        --bn-soft: rgba(255, 255, 255, 0.3);
        --bn-solid: linear-gradient(135deg, #1f3a5a, #2c5282);
    }
}

/* No overflow:hidden on the header itself (it would clip dropdown menus); the art layers
   round their own corners instead. */
.banner-swatch {
    overflow: hidden;
}

.page-banner::before,
.banner-swatch::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    z-index: -2;
    background: var(--bn-art, var(--bn-solid));
}

.page-banner::after,
.banner-swatch::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    z-index: -1;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.05) 100%);
}

.page-banner {
    z-index: 5; /* stay above the content below so open dropdown menus are not covered */
    padding: 1.25rem 1.5rem;
    border-radius: 6px;
    border-bottom: 3px solid var(--btn-fill);
    color: #fff;
}

.page-banner h1 {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* The !important overrides below (here, .btn-icon, p a) exist only to beat inline styles in the
   header templates; drop them if those inline colors are ever moved into classes. */
.page-banner p {
    color: rgba(255, 255, 255, 0.9) !important;
}

.page-banner .btn-primary {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.65);
}

/* Icon-only controls in a banner header (e.g. use case "More actions", attention flag) */
.page-banner .btn-icon {
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.55) !important;
}

.page-banner #uc-attention-icon[fill="none"],
.page-banner #as-attention-icon[fill="none"] {
    stroke: rgba(255, 255, 255, 0.85);
}

/* Link in the header summary line (e.g. assessment "Use Case: ...") */
.page-banner p a {
    color: #fff !important;
    text-decoration: underline;
}

/* Tinted status chips keep a light chip behind them on the dark banner */
.page-banner .banner-chip {
    background: rgba(255, 255, 255, 0.92) !important;
}

[data-banner="solid"] { --bn-art: var(--bn-solid); }
[data-banner="grid"] {
    --bn-art:
        linear-gradient(var(--bn-line) 1px, transparent 1px) 0 0 / 28px 28px,
        linear-gradient(90deg, var(--bn-line) 1px, transparent 1px) 0 0 / 28px 28px,
        var(--bn-solid);
}
[data-banner="dots"] {
    --bn-art: radial-gradient(var(--bn-soft) 1.5px, transparent 1.7px) 0 0 / 18px 18px, var(--bn-solid);
}
[data-banner="stripes"] {
    --bn-art: repeating-linear-gradient(135deg, var(--bn-line) 0 2px, transparent 2px 14px), var(--bn-solid);
}
[data-banner="glow"] {
    --bn-art:
        radial-gradient(ellipse at 85% 15%, color-mix(in srgb, var(--bn-hi) 55%, transparent), transparent 60%),
        var(--bn-base);
}
[data-banner="mesh"] {
    --bn-art:
        radial-gradient(circle at 10% 20%, color-mix(in srgb, var(--bn-hi) 38%, transparent), transparent 45%),
        radial-gradient(circle at 80% 10%, color-mix(in srgb, var(--btn-fill) 70%, transparent), transparent 50%),
        radial-gradient(circle at 60% 110%, color-mix(in srgb, var(--bn-hi) 30%, transparent), transparent 50%),
        var(--bn-base);
}
[data-banner="blueprint"] {
    --bn-art:
        linear-gradient(var(--bn-line) 1px, transparent 1px) 0 0 / 56px 56px,
        linear-gradient(90deg, var(--bn-line) 1px, transparent 1px) 0 0 / 56px 56px,
        linear-gradient(color-mix(in srgb, var(--bn-hi) 9%, transparent) 1px, transparent 1px) 0 0 / 14px 14px,
        linear-gradient(90deg, color-mix(in srgb, var(--bn-hi) 9%, transparent) 1px, transparent 1px) 0 0 / 14px 14px,
        var(--bn-base);
}
[data-banner="rings"] {
    --bn-art:
        repeating-radial-gradient(circle at 92% 130%, transparent 0 22px, var(--bn-line) 22px 24px),
        var(--bn-solid);
}
[data-banner="chevrons"] {
    --bn-art:
        linear-gradient(135deg, var(--bn-line) 25%, transparent 25%) -20px 0 / 40px 40px,
        linear-gradient(225deg, var(--bn-line) 25%, transparent 25%) -20px 0 / 40px 40px,
        var(--bn-base);
}
[data-banner="aurora"] {
    --bn-art:
        conic-gradient(from 210deg at 85% -10%, transparent 0deg, color-mix(in srgb, var(--bn-hi) 45%, transparent) 40deg, transparent 90deg, color-mix(in srgb, var(--btn-fill) 60%, transparent) 130deg, transparent 180deg),
        var(--bn-base);
}

/* Admin picker tile */
.banner-swatch {
    display: block;
    height: 56px;
    border-radius: 4px;
    border: 1px solid var(--border-primary);
}

/* Navbar collapse toggle button */
.sidebar-collapse-btn {
    background: none;
    border: none;
    color: var(--sidebar-text-muted);
    cursor: pointer;
    padding: 0.375rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

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

/* Sidebar nav scroll */
.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Dark mode toggle in navbar */
.navbar-theme-btn {
    background: none;
    border: none;
    color: var(--sidebar-text-muted);
    cursor: pointer;
    padding: 0.375rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.navbar-theme-btn:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-text);
}

/* Nav right group */
.nav-right {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;
}

/* Global smart search (navbar) */
.global-search {
    position: relative;
    flex: 0 1 420px;
    max-width: 420px;
    margin-left: 0.75rem;
}

.global-search input {
    width: 100%;
    background: var(--sidebar-hover-bg);
    border: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.15s;
}

.global-search input:focus {
    border-color: var(--sidebar-text-muted);
}

.global-search-results {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    max-height: 60vh;
    overflow-y: auto;
    z-index: 200;
}

.global-search-results:empty {
    display: none;
}

.search-result-group-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem 0.25rem;
}

.search-result-item,
.search-result-item:visited {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.85rem;
}

.search-result-item:hover,
.search-result-item.active {
    background: var(--sidebar-hover-bg);
}

.search-result-id {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.search-no-matches {
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

@media (max-width: 1023px) {
    .global-search {
        display: none;
    }
}

/* ========================================
   Recent Visited Panel
   ======================================== */

.rv-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    height: 32px;
    padding: 0 0.6rem;
    background: none;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}
.rv-btn:hover {
    background: var(--bg-hover);
}
.rv-btn--active {
    background: var(--btn-fill);
    border-color: var(--btn-fill);
    color: var(--btn-primary-text, #fff);
}
.rv-btn--active:hover {
    background: var(--btn-fill-hover);
    color: var(--btn-primary-text, #fff);
}

.rv-panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    margin: 0 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.14);
    z-index: 500;
    overflow: hidden;
}
.rv-panel--open {
    display: block;
    animation: rvSlideDown 0.14s ease;
}
[data-theme="dark"] .rv-panel {
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}
@keyframes rvSlideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.rv-tabbar {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-card-secondary);
    padding: 0 1rem;
}
.rv-tab {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0 1rem;
    height: 44px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-muted);
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-family: inherit;
    white-space: nowrap;
    transition: color 0.12s;
}
.rv-tab:hover {
    color: var(--text-primary);
}
.rv-tab--active {
    color: var(--primary-blue);
    border-bottom-color: var(--primary-blue);
}
.rv-tabbar-end {
    margin-left: auto;
    display: flex;
    align-items: center;
    padding-left: 1rem;
}
.rv-clear-btn {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: none;
    border: none;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
}
.rv-clear-btn:hover {
    color: var(--alert-error-text, #b10e1c);
    text-decoration: underline;
}

.rv-pill {
    font-size: 0.62rem;
    font-weight: 700;
    border-radius: 4px;
    padding: 0.1rem 0.38rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.rv-pill--all { background: var(--tab-badge-bg); color: var(--tab-badge-text); }
.rv-pill--uc  { background: #ebf3fc; color: #0f6cbd; }
.rv-pill--is  { background: #fde7e9; color: #b10e1c; }
.rv-pill--as  { background: #f0f0ff; color: #5c5cc0; }
.rv-pill--tk  { background: #e7f9ee; color: #0e700e; }
[data-theme="dark"] .rv-pill--uc { background: #1a3a5c; color: #479ef5; }
[data-theme="dark"] .rv-pill--is { background: #3b1418; color: #f1707b; }
[data-theme="dark"] .rv-pill--as { background: #22205a; color: #a0a0f0; }
[data-theme="dark"] .rv-pill--tk { background: #0f2e13; color: #6ccb6c; }

.rv-count {
    font-size: 0.65rem;
    background: var(--tab-badge-bg);
    color: var(--tab-badge-text);
    border-radius: 10px;
    padding: 0.05rem 0.42rem;
    font-weight: 600;
    margin-left: 0.1rem;
}
.rv-tab--active .rv-count {
    background: var(--tab-badge-active-bg);
    color: var(--primary-blue);
}

.rv-body {
    max-height: 360px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.rv-tab-content { display: none; }
.rv-tab-content--active { display: block; }

.rv-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.65rem 1.25rem 0.2rem;
}
.rv-section-divider {
    border: none;
    border-top: 1px solid var(--border-secondary);
    margin: 0.25rem 0 0;
}

.rv-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.52rem 1.25rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.1s;
    width: 100%;
}
.rv-row:hover {
    background: var(--bg-hover);
    text-decoration: none;
    color: var(--text-primary);
}
.rv-row:visited {
    color: var(--text-primary);
}

.rv-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.rv-dot--green  { background: #0e700e; }
.rv-dot--orange { background: #ca5010; }
.rv-dot--purple { background: #8764b8; }
.rv-dot--grey   { background: #8a8886; }
[data-theme="dark"] .rv-dot--green  { background: #6ccb6c; }
[data-theme="dark"] .rv-dot--orange { background: #e0793b; }
[data-theme="dark"] .rv-dot--purple { background: #b292d6; }
[data-theme="dark"] .rv-dot--grey   { background: #797775; }

.rv-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
}
.rv-name {
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}
.rv-sep {
    color: var(--border-primary);
    flex-shrink: 0;
    font-size: 0.72rem;
}
.rv-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.rv-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: auto;
    padding-left: 1rem;
}
.rv-empty {
    padding: 1.75rem 1.25rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
}

[data-theme="dark"] .lp-step.lp-active .lp-step-icon {
    background: var(--lp-step-active-bg, rgba(52,152,219,0.2));
}

[data-theme="dark"] .lp-step.lp-complete .lp-step-icon {
    background: rgba(16,185,129,0.2);
}

/* ─── Page Tour FAB ─── */
#tour-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--brand-gradient, linear-gradient(135deg, var(--primary-blue) 0%, #7c3aed 100%));
  color: white;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s;
}
#tour-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* ─── Driver.js popover overrides (.tg-tour-popover) ─── */
.tg-tour-popover {
  font-family: inherit;
  border-radius: 8px !important;
  max-width: 320px !important;
  padding: 1rem !important;
}
.tg-tour-popover .driver-popover-title {
  font-size: 0.9375rem;
  font-weight: 700;
  margin-bottom: 0.375rem;
  color: #0f172a;
}
.tg-tour-popover .driver-popover-description {
  font-size: 0.8125rem;
  color: #475569;
  line-height: 1.55;
}
.tg-tour-popover .driver-popover-footer {
  margin-top: 0.875rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tg-tour-popover .driver-popover-progress-text {
  font-size: 0.75rem;
  color: #94a3b8;
}
.tg-tour-popover .driver-popover-navigation-btns button,
.tg-tour-popover .driver-popover-footer button {
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 5px;
  padding: 0.375rem 0.875rem;
  cursor: pointer;
  border: none;
}
.tg-tour-popover #driver-popover-next-btn {
  background: var(--btn-fill);
  color: var(--btn-primary-text, white);
}
.tg-tour-popover #driver-popover-next-btn:hover {
  background: var(--btn-fill-hover);
}
.tg-tour-popover #driver-popover-prev-btn {
  background: transparent;
  color: #64748b;
  border: 1px solid #e2e8f0 !important;
}
.tg-tour-popover #driver-popover-prev-btn:hover {
  background: #f8fafc;
}
.tg-tour-popover #driver-popover-close-btn {
  color: #94a3b8;
  font-size: 1rem;
  cursor: pointer;
  background: none;
  border: none;
}
.tg-tour-popover #driver-popover-close-btn:hover {
  color: #475569;
}

/* ─── Field Help FAB ─── */
#field-help-fab {
  position: fixed;
  bottom: 5.25rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--primary-blue);
  background: white;
  color: var(--primary-blue);
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s, color 0.15s;
}
#field-help-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
#field-help-fab.active {
  background: var(--brand-gradient, linear-gradient(135deg, var(--primary-blue) 0%, #7c3aed 100%));
  color: white;
  border-color: transparent;
}

/* ─── Field Help highlight ring (spotlights the active field, no page dimming) ─── */
.tg-field-help-highlight {
  outline: 2px solid var(--primary-blue) !important;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.25) !important;
  border-radius: 4px;
  transition: box-shadow 0.15s, outline-color 0.15s;
}

/* ─── Field Help tooltip (reacts to focused form field) ─── */
.tg-field-help-tooltip {
  position: fixed;
  z-index: 950;
  max-width: 280px;
  padding: 0.625rem 0.875rem;
  background: white;
  color: #334155;
  font-size: 0.8125rem;
  line-height: 1.5;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  display: none;
}
.tg-field-help-tooltip::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  background: white;
  transform: rotate(45deg);
}
.tg-field-help-tooltip.tg-field-help-tooltip--right::after {
  left: -5px;
  top: 1rem;
  box-shadow: -2px 2px 2px rgba(0, 0, 0, 0.05);
}
.tg-field-help-tooltip.tg-field-help-tooltip--left::after {
  right: -5px;
  top: 1rem;
  box-shadow: 2px -2px 2px rgba(0, 0, 0, 0.03);
}

/* ─── Fluent Pivot Tab Style (global) ─── */
.tab-group {
  margin: 0 0 1rem 0;
}

.tab-nav {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  background: transparent;
  border-bottom: 1px solid var(--tab-border);
  gap: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.tab-nav-item {
  margin: 0;
}

.tab-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--tab-text);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  border-radius: 0;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  font-family: inherit;
}

.tab-nav-link:hover {
  background: transparent;
  color: var(--tab-text-hover);
}

.tab-nav-link.active {
  background: transparent;
  color: var(--tab-active-color);
  font-weight: 600;
  box-shadow: none;
  border-bottom: 2px solid var(--tab-active-color);
}

.tab-nav-link .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--tab-badge-bg);
  color: var(--tab-badge-text);
  border: 1px solid var(--border-primary);
}

.tab-nav-link.active .badge {
  background: var(--tab-badge-active-bg);
  color: var(--tab-badge-active-text);
  border-color: var(--tab-badge-active-bg);
}

/* A colour modifier on a tab badge must survive the neutral defaults above
   (which otherwise win on specificity) — e.g. a red "needs your decision"
   badge stays red whether or not its tab is active. */
.tab-nav-link .badge.badge-danger,
.tab-nav-link.active .badge.badge-danger {
  background: var(--severity-critical);
  color: #fff;
  border-color: var(--severity-critical);
}

.tab-content {
  padding: 1rem 0;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* ─── Bump tabs (all tab bars) ───
   Bar with a raised pill that slides to the active tab. The .tab-bump element is
   injected by initBumpTabs() in main.js. Desktop only; narrow screens keep the
   standard underline tabs. */
.tab-bump { display: none; }

@media (min-width: 701px) {
  .tab-nav {
    --bump-bar: #e6e8ed;
    --bump-text: #4b5563;
    --bump-text-hover: #111827;
    --bump-badge-bg: rgba(0, 0, 0, 0.08);
    --bump-badge-text: #1f2937;
    --bump-lift: 30px;
    --bump-r: 16px;   /* top corner radius of the bump */
    --bump-sr: 14px;  /* radius of the shoulders where the bump meets the bar */
    --bump-ease: cubic-bezier(0.22, 1, 0.36, 1);  /* ease-out, no overshoot */
  }
  [data-theme="dark"] .tab-nav {
    --bump-bar: #3a3a3a;
    --bump-text: rgba(255, 255, 255, 0.7);
    --bump-text-hover: #fff;
    --bump-badge-bg: rgba(255, 255, 255, 0.16);
    --bump-badge-text: #fff;
  }

  .tab-nav {
    position: relative;
    overflow: visible;
    padding: var(--bump-lift) 1.5rem 0;
    border-bottom: none;
  }
  .tab-nav::before {
    content: "";
    position: absolute;
    inset: var(--bump-lift) 0 0 0;
    background: var(--bump-bar);
    border-radius: 12px;
  }
  .tab-nav .tab-nav-item { position: relative; z-index: 2; }
  .tab-nav .tab-nav-link {
    position: relative;
    z-index: 2;
    padding: 0.8rem 1.1rem;
    margin-bottom: 0;
    border-bottom: none;
    color: var(--bump-text);
    transition: color 0.2s, transform 0.45s var(--bump-ease);
  }
  .tab-nav .tab-nav-link:hover { color: var(--bump-text-hover); }
  .tab-nav .tab-nav-link.active {
    color: var(--btn-primary-text, var(--bg-card));
    border-bottom: none;
    transform: translateY(-12px);
  }
  .tab-nav .tab-nav-link .badge,
  .tab-nav .tab-nav-link.active .badge {
    background: var(--bump-badge-bg);
    color: var(--bump-badge-text);
    border-color: transparent;
  }
  .tab-nav .tab-nav-link .badge.badge-danger,
  .tab-nav .tab-nav-link.active .badge.badge-danger {
    background: var(--severity-critical);
  }

  /* The bump: bar-coloured shoulders (::before/::after) with an accent pill inside. */
  .tab-nav .tab-bump {
    display: block;
    position: absolute;
    z-index: 1;
    top: 0;
    bottom: 0;
    left: 0;
    width: 0;
    pointer-events: none;
    background: transparent;  /* no bar-coloured bulge above the pill */
    border-radius: var(--bump-r) var(--bump-r) 0 0;
    transition: left 0.45s var(--bump-ease), width 0.45s var(--bump-ease), opacity 0.2s;
    opacity: 0;
  }
  .tab-nav .tab-bump.ready { opacity: 1; }
  .tab-nav .tab-bump::before,
  .tab-nav .tab-bump::after {
    display: none;  /* shoulders only make sense with the bulge */
    content: "";
    position: absolute;
    top: calc(var(--bump-lift) - var(--bump-sr));
    width: var(--bump-sr);
    height: var(--bump-sr);
  }
  .tab-nav .tab-bump::before {
    left: calc(var(--bump-sr) * -1);
    background: radial-gradient(circle at 0 0, transparent calc(var(--bump-sr) - 0.5px), var(--bump-bar) var(--bump-sr));
  }
  .tab-nav .tab-bump::after {
    right: calc(var(--bump-sr) * -1);
    background: radial-gradient(circle at 100% 0, transparent calc(var(--bump-sr) - 0.5px), var(--bump-bar) var(--bump-sr));
  }
  .tab-nav .tab-bump-pill {
    position: absolute;
    inset: 22px 4px 16px;
    border-radius: 10px;
    background: var(--btn-fill);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tab-nav .tab-bump,
  .tab-nav .tab-nav-link { transition: none; }
}

/* ========================================
   Admin Portal — rail nav + dense list rows
   (replaces the old admin-grid card tabs on
   the /admin dashboard specifically)
   ======================================== */

.admin-rail-app {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 900px) {
    .admin-rail-app {
        grid-template-columns: 1fr;
    }
}

.admin-rail {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 0.75rem;
    position: sticky;
    top: 1.5rem;
    box-shadow: 0 2px 4px var(--shadow-sm);
}

.admin-rail-search {
    position: relative;
    margin-bottom: 0.75rem;
}

.admin-rail-search input {
    width: 100%;
    font-family: inherit;
    font-size: 0.8125rem;
    color: var(--text-primary);
    background: var(--bg-card-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 0.55rem 0.7rem 0.55rem 2.1rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.admin-rail-search input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px var(--primary-blue-light);
}

.admin-rail-search svg {
    position: absolute;
    left: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 14px;
    height: 14px;
}

.admin-rail-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 1px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: background 0.12s, color 0.12s;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.admin-rail-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.admin-rail-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text, var(--primary-blue));
}

.admin-rail-item.is-danger {
    color: var(--severity-critical);
}

.admin-rail-item.is-danger:hover {
    background: var(--alert-error-light-bg);
}

.admin-rail-item.is-danger.active {
    background: var(--alert-error-light-bg);
}

.admin-rail-count {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.admin-rail-item.active .admin-rail-count {
    color: inherit;
}

.admin-rail-sep {
    height: 1px;
    background: var(--border-highlight);
    margin: 0.5rem 0.25rem;
}

.admin-pane-head {
    margin-bottom: 1rem;
}

.admin-pane-head h2 {
    font-size: 1.0625rem;
    font-weight: 700;
    margin: 0 0 0.2rem;
    color: var(--text-primary);
}

.admin-pane-head p {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.admin-group-section {
    display: none;
}

.admin-group-section.active {
    display: block;
}

/* While searching, every group with a match becomes visible regardless
   of which one is "active" in the rail. */
.admin-rail-app.is-searching .admin-group-section {
    display: block;
}

.admin-rail-app.is-searching .admin-group-section.no-matches {
    display: none;
}

.admin-rail-app.is-searching .admin-group-section .admin-group-label {
    display: block;
}

.admin-group-label {
    display: none;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin: 0 0 0.5rem 0.25rem;
}

.admin-group-section + .admin-group-section {
    margin-top: 1.5rem;
}

.admin-row-list {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px var(--shadow-sm);
}

.admin-row {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-highlight);
    text-decoration: none;
    transition: background 0.12s;
}

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

.admin-row:hover {
    background: var(--bg-hover);
    text-decoration: none;
}

.admin-row.is-hidden {
    display: none;
}

.admin-row-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text, var(--primary-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.admin-row-icon svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    color: inherit;
}

.admin-danger-list .admin-row-icon {
    background: var(--alert-error-light-bg);
    color: var(--severity-critical);
}

.admin-danger-list .admin-row:hover {
    background: var(--alert-error-light-bg);
}

.admin-row-body {
    flex: 1;
    min-width: 0;
}

.admin-row-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.admin-row-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 1px;
    line-height: 1.45;
}

.admin-row-warning {
    font-size: 0.8125rem;
    color: var(--severity-critical);
    font-weight: 600;
    margin-top: 0.25rem;
}

.admin-row mark {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text, var(--primary-blue));
    border-radius: 3px;
    padding: 0 1px;
}

.admin-row-chevron {
    color: var(--text-muted);
    flex-shrink: 0;
    margin-top: 6px;
}

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

/* ========================================
   Shared in-app confirm/alert modal
   (replaces window.confirm/alert — see main.js confirmModal/alertModal)
   ======================================== */
.tg-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background-color: rgba(0, 0, 0, 0.5);
}

.tg-modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.tg-modal-box {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 0.5rem;
    border-top: 4px solid var(--alert-info-border);
    max-width: 440px;
    width: 90%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.tg-modal-box.tg-modal-warning { border-top-color: var(--alert-warning-border); }
.tg-modal-box.tg-modal-danger { border-top-color: var(--alert-error-border); }
.tg-modal-box.tg-modal-success { border-top-color: var(--alert-success-border); }

.tg-modal-header {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--alert-info-text);
}

.tg-modal-header.tg-modal-warning { color: var(--alert-warning-text); }
.tg-modal-header.tg-modal-danger { color: var(--alert-error-text); }
.tg-modal-header.tg-modal-success { color: var(--alert-success-text); }

.tg-modal-body {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    line-height: 1.5;
}

.tg-modal-footer {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}
