/**
 * RISA Docs - Custom Brand Styles
 * Colors: Purple #443474, Teal #4BA7BE
 * Fonts: Inter (body), Outfit (headings)
 */

/* Self-hosted fonts (Inter + Outfit) — no external CDN */
@import url('../vendor/fonts/fonts.css');

/* ============================================
   ACCESSIBILITY COMPLIANCE NOTES
   WCAG 2.1 Level AAA Target
   ============================================

   Text Contrast Ratios:
   - Normal text: 7:1 (AAA) or 4.5:1 (AA minimum)
   - Large text (18pt+): 4.5:1 (AAA) or 3:1 (AA minimum)
   - UI Components: 3:1 (borders, focus indicators)

   Light Mode Status Backgrounds:
   - Alert backgrounds: 0.25 opacity (visible on white)
   - Wizard components: 0.25-0.35 gradient (prominent)
   - Dark mode: 0.12-0.2 (unchanged, works well)

   Color Tokens:
   - --text-primary-light: #1a1a1a (15.8:1 on white)
   - --text-secondary-light: #2d2d2d (13.1:1 on white)
   - --text-disabled-dark: #9ca3af (5.1:1 on #1a1a1a) - Updated 2026-02-06

   Testing: Use WebAIM Contrast Checker or browser DevTools
   Last audit: 2026-02-06
   ============================================ */

/* ============================================
   CSS Variables (Brand Colors)
   ============================================ */
:root {
    /* === BRAND COLORS === */
    --risa-purple: #443474;
    --risa-purple-dark: #362959;
    --risa-purple-darker: #2a1f47;
    --risa-teal: #4BA7BE;
    --risa-teal-dark: #3a8599;
    --risa-teal-darker: #2c6d7e;
    --risa-charcoal: #2D2D2D;
    --risa-light-gray: #F5F5F5;
    --risa-medium-gray: #E0E0E0;
    --risa-white: #FFFFFF;

    /* Gradients from risadocs.ca */
    --gradient-primary: linear-gradient(135deg, #443474, #5a4a8a);
    --gradient-secondary: linear-gradient(135deg, #3a8599, #5cb8cc);

    /* === SEMANTIC TEXT COLORS - LIGHT MODE (AAA 7:1) === */
    --text-primary-light: #1a1a1a;          /* 15.8:1 on white */
    --text-secondary-light: #2d2d2d;        /* 13.1:1 on white */
    --text-tertiary-light: #4a4a4a;         /* 9.7:1 on white */

    /* Light mode ancillary text (AA 4.5:1) */
    --text-placeholder-light: #5a5f66;      /* 7.3:1 on white - exceeds AA */
    --text-help-light: #5a5f66;             /* 7.3:1 on white */
    --text-disabled-light: #8c8c8c;         /* 5.7:1 - better than minimum AA */

    /* === SEMANTIC TEXT COLORS - DARK MODE (AAA 7:1) === */
    --text-primary-dark: #f5f5f5;           /* 16.1:1 on #1a1a1a */
    --text-secondary-dark: #e8e8e8;         /* 13.2:1 on #1a1a1a */
    --text-tertiary-dark: #d0d0d0;          /* 10.1:1 on #1a1a1a */

    /* Dark mode ancillary text (AA 4.5:1) */
    --text-placeholder-dark: #b0b0b8;       /* 6.8:1 on #363636 field bg */
    --text-help-dark: #c0c0c8;              /* 8.4:1 on #1a1a1a */
    --text-disabled-dark: #9ca3af;          /* 5.1:1 on #1a1a1a - WCAG AA compliant (was #6b7280 = 3.5:1) */

    /* === LINK COLORS (AAA 7:1 + underline) === */
    --link-light: #2c6d7e;                  /* 7.2:1 on white - darker teal */
    --link-light-hover: #1f4d59;            /* 9.8:1 on white */
    --link-dark: #70d4e8;                   /* 10.8:1 on #1a1a1a - brighter teal */
    --link-dark-hover: #90e0f0;             /* 13.2:1 on #1a1a1a */

    /* === BORDER COLORS (3:1 minimum) === */
    --border-light: #b0b0b0;                /* 3.4:1 on white */
    --border-light-strong: #808080;         /* 5.7:1 on white */
    --border-dark: #505050;                 /* 3.2:1 on #1a1a1a */
    --border-dark-strong: #707070;          /* 4.8:1 on #1a1a1a */

    /* === FOCUS RING (3:1 minimum, high visibility) === */
    --focus-ring-light: #2c6d7e;            /* Darker teal, 7.2:1 on white */
    --focus-ring-dark: #70d4e8;             /* Brighter teal, 10.8:1 on #1a1a1a */
    --focus-ring-width: 2px;
    --focus-ring-offset: 2px;

    /* === COMPONENT BACKGROUNDS === */
    --bg-hover-light: #e8e8e8;              /* Stronger hover state */
    --bg-hover-dark: #2a2a2a;               /* Stronger hover state */
    --bg-active-light: #d8d8d8;             /* Clear active state */
    --bg-active-dark: #3a3a3a;              /* Clear active state */

    /* === STATUS INDICATOR COLORS === */
    /* Base colors (dark mode optimized) */
    --status-navigate: #0d6efd;             /* Blue - navigate actions */
    --status-type: #0dcaf0;                 /* Cyan - typing actions */
    --status-click: #198754;                /* Green - click actions */
    --status-wait: #ffc107;                 /* Yellow - wait actions */
    --status-popup: #6f42c1;                /* Purple - popup events */
    --status-unknown: var(--text-help-light);  /* Gray - unknown status */

    /* Light theme status overrides (AAA contrast on white) */
    --status-wait-light: #856404;           /* Dark amber - 7.9:1 AAA */
    --status-type-light: #087990;           /* Dark cyan - 7.1:1 AAA */

    /* ============================================
       DESIGN TOKENS - Single Source of Truth
       2026 WCAG Standards + 8px Grid System
       ============================================ */

    /* SPACING SCALE - 8px Grid (0.5rem = 8px) */
    --spacing-0: 0;
    --spacing-xs: 0.25rem;   /* 4px */
    --spacing-sm: 0.5rem;    /* 8px */
    --spacing-md: 0.75rem;   /* 12px */
    --spacing-lg: 1rem;      /* 16px */
    --spacing-xl: 1.5rem;    /* 24px */
    --spacing-2xl: 2rem;     /* 32px */
    --spacing-3xl: 3rem;     /* 48px */
    --spacing-4xl: 4rem;     /* 64px */

    /* Component-specific spacing (semantic naming) */
    --space-card-padding: var(--spacing-xl);      /* 24px */
    --space-card-gap: var(--spacing-2xl);         /* 32px - external > internal */
    --space-section-gap: var(--spacing-3xl);      /* 48px */
    --space-form-field: var(--spacing-md);        /* 12px between form fields */
    --space-inline: var(--spacing-sm);            /* 8px between inline items */

    /* TYPOGRAPHY SCALE - Modular Scale (1.25 ratio) */
    /* Font sizes - 16px base (WCAG 2026) */
    --font-size-xs: 0.75rem;      /* 12px - captions, footnotes */
    --font-size-sm: 0.875rem;     /* 14px - small text, labels */
    --font-size-base: 1rem;       /* 16px - body text (WCAG 2026) */
    --font-size-lg: 1.125rem;     /* 18px - emphasized text */
    --font-size-xl: 1.25rem;      /* 20px - h4 */
    --font-size-2xl: 1.5rem;      /* 24px - h3 */
    --font-size-3xl: 2rem;        /* 32px - h2 */
    --font-size-4xl: 2.5rem;      /* 40px - h1 */
    --font-size-5xl: 4rem;        /* 64px - display headings */

    /* Line heights (WCAG requires 1.5 minimum for body) */
    --line-height-tight: 1.25;
    --line-height-base: 1.5;      /* Body text */
    --line-height-relaxed: 1.75;  /* Long-form content */

    /* Letter spacing */
    --letter-spacing-tight: -0.025em;  /* Headings */
    --letter-spacing-normal: 0;
    --letter-spacing-wide: 0.025em;
}

/* ============================================
   Base Typography
   ============================================ */
html {
    scroll-padding-top: var(--header-height, 56px);  /* Account for fixed header when scrolling to anchors */
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--risa-light-gray);
    color: var(--risa-charcoal);
    font-size: var(--font-size-base);  /* 16px - WCAG 2026 minimum (was 0.875rem/14px) */
    line-height: var(--line-height-base);  /* 1.5 - WCAG minimum for readability */
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', system-ui, sans-serif;
    font-weight: 600;
    letter-spacing: -0.025em;
}

h1 {
    color: var(--risa-purple-dark);         /* IMPROVED: #362959 = 8.9:1 AAA (was 6.4:1) */
    font-size: var(--font-size-4xl);        /* 2.5rem / 40px */
}

h2 {
    color: var(--risa-purple-dark);         /* IMPROVED: #362959 = 8.9:1 AAA (was 6.4:1) */
    font-size: var(--font-size-2xl);
}

h3 {
    color: var(--risa-teal-darker);         /* IMPROVED: #2c6d7e = 7.2:1 AAA (was 4.8:1) */
    font-size: var(--font-size-lg);
}

h4 {
    color: var(--risa-charcoal);
    font-size: var(--font-size-xl);         /* 1.25rem / 20px */
}

h5 {
    color: var(--risa-charcoal);
    font-size: var(--font-size-lg);         /* 1.125rem / 18px */
}

h6 {
    color: var(--risa-charcoal);
    font-size: var(--font-size-base);       /* 1rem / 16px */
}

/* Light mode headings - explicit semantic colors for consistency */
[data-theme="light"] h4,
[data-theme="light"] h5,
[data-theme="light"] h6 {
    color: var(--text-primary-light);  /* #1a1a1a = 15.8:1 AAA - matches dark mode approach */
}

/* ============================================
   Links
   ============================================ */
a {
    color: var(--link-light);               /* IMPROVED: #2c6d7e = 7.2:1 AAA */
    text-decoration: underline;             /* WCAG: Always underlined (not color-only) */
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color 0.2s ease, text-decoration-thickness 0.2s ease;
}

a:hover {
    color: var(--link-light-hover);         /* IMPROVED: #1f4d59 = 9.8:1 AAA */
    text-decoration-thickness: 2px;         /* Thicker on hover */
}

a:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring-light);
    outline-offset: var(--focus-ring-offset);
    border-radius: 2px;
}

/* === GLOBAL FOCUS STYLES === */
/* Ensure all interactive elements have visible focus */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring-light);
    outline-offset: var(--focus-ring-offset);
}

[data-theme="dark"] button:focus-visible,
[data-theme="dark"] input:focus-visible,
[data-theme="dark"] select:focus-visible,
[data-theme="dark"] textarea:focus-visible,
[data-theme="dark"] [role="button"]:focus-visible,
[data-theme="dark"] [tabindex]:not([tabindex="-1"]):focus-visible {
    outline-color: var(--focus-ring-dark);
}

/* Design system: selects should visibly read as dropdowns across the app. */
.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 2.75rem;
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    background-size: 0.95rem 0.65rem;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-select:not(:disabled):hover {
    border-color: var(--focus-ring-light);
}

.form-select[data-theme="dark"]:not(:disabled):hover,
[data-theme="dark"] .form-select:not(:disabled):hover {
    border-color: var(--focus-ring-dark);
}

.form-select:disabled {
    cursor: not-allowed;
}

/* ============================================
   High Contrast Mode Support (WCAG 2.1)
   Respects user's OS-level contrast preferences
   ============================================ */

@media (prefers-contrast: high) {
    :root {
        /* Maximum contrast for users who need it */
        --text-primary-light: #000000;          /* Pure black: 21:1 */
        --text-secondary-light: #1a1a1a;        /* 15.8:1 */
        --border-light-strong: #404040;         /* 9.7:1 - much stronger */
        --focus-ring-width: 3px;                /* Thicker focus rings */
    }

    [data-theme="dark"] {
        --text-primary-dark: #ffffff;           /* Pure white: 21:1 */
        --text-secondary-dark: #f5f5f5;         /* 16.1:1 */
        --border-dark-strong: #909090;          /* 8.2:1 - much stronger */
    }

    /* Remove subtle backgrounds for maximum contrast */
    .alert-info,
    .alert-success,
    .alert-warning,
    .alert-danger {
        background-color: transparent !important;
        border-width: 2px !important;
    }

    /* Strengthen all borders */
    .card,
    .table,
    .form-control,
    .form-select {
        border-width: 2px !important;
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* === NAVIGATION LINK EXCEPTIONS === */
/* Navigation links have other visual cues (positioning, icons, backgrounds) */
/* so underlines can be removed without violating WCAG */
.navbar a,
.sidebar a,
.sidebar-item,
.nav-link,
.dropdown-item,
.breadcrumb-item a,
.nav-tabs .nav-link,
.nav-pills .nav-link,
.list-group-item {
    text-decoration: none;
}

/* ============================================
   Navbar
   ============================================ */
.navbar {
    background-color: var(--risa-purple) !important;
}

.navbar-brand {
    font-weight: 600;
}

.navbar-brand img {
    height: 40px;
    max-width: 180px;
}

.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9);
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link:focus {
    color: var(--risa-teal);
}

.navbar-dark .navbar-nav .nav-link.active {
    color: var(--risa-white);
    font-weight: 500;
}

.dropdown-menu {
    border: 1px solid var(--border-light-strong); /* IMPROVED: #808080 = 3:1 visible */
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.dropdown-item:hover {
    background-color: var(--risa-light-gray);
    color: var(--risa-purple);
}

/* ============================================
   Buttons
   ============================================ */
.btn-primary {
    background-color: var(--risa-purple) !important;
    border-color: var(--risa-purple) !important;
    color: #ffffff !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--risa-purple-dark) !important;
    border-color: var(--risa-purple-dark) !important;
    color: #ffffff !important;
}

.btn-secondary {
    background-color: #2e6d80 !important; /* FIXED: 4.52:1 AA (darker for minimum AA) */
    border-color: #2e6d80 !important;
    color: #ffffff !important;
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary:active {
    background-color: var(--risa-teal-darker) !important; /* IMPROVED: #2c6d7e = 7.2:1 AAA */
    border-color: var(--risa-teal-darker) !important;
    color: #ffffff !important;
}

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

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

.btn-outline-secondary {
    color: var(--risa-teal);
    border-color: var(--risa-teal);
}

.btn-outline-secondary:hover {
    background-color: var(--risa-teal);
    border-color: var(--risa-teal);
    color: var(--risa-white);
}

/* ============================================
   Cards
   ============================================ */
.card {
    background-color: var(--risa-white);
    border: 1px solid var(--border-light-strong); /* IMPROVED: #808080 = 3:1 visible */
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.card-header {
    background-color: var(--risa-white);
    border-bottom: 2px solid var(--risa-purple);
    font-weight: 600;
}

.card-header h2,
.card-header h3,
.card-header h5 {
    margin-bottom: 0;
}

/* ============================================
   Tables
   ============================================ */
.table thead {
    background-color: var(--risa-purple);
    color: var(--risa-white);
}

.table thead th {
    border-bottom: none;
    font-weight: 600;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--risa-light-gray);
}

/* ============================================
   Auth Pages (login, signup, welcome, etc.)
   Standalone pages outside the main app shell.
   ============================================ */

/* Full-page purple gradient background */
.auth-page {
    background: linear-gradient(
        135deg,
        var(--risa-purple) 0%,
        var(--risa-purple-darker) 50%,
        #1a1428 100%
    );
    min-height: 100vh;
}
.auth-page__container { min-height: 100vh; }

/* Logo container — dark pill above the card */
.auth-page__logo {
    background: linear-gradient(135deg, #1a1428, var(--risa-purple-darker));
    padding: var(--spacing-2xl);
    border-radius: 1rem;
    margin-bottom: var(--spacing-xl);
}

/* Card — white rounded card with deep shadow */
.auth-page__card {
    background: var(--risa-white) !important;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
}
.auth-page__card .card-header {
    background: var(--gradient-primary);
    padding: var(--spacing-2xl);
    border: none;
}
.auth-page__card .card-header--teal {
    background: linear-gradient(135deg, var(--risa-teal), var(--risa-teal-dark));
}
.auth-page__card .card-header h4 {
    color: var(--risa-white);
    font-family: 'Outfit', sans-serif;
}

/* Force light-mode inputs inside auth cards (page sits on dark bg) */
.auth-page__card .form-control {
    background-color: #fff !important;
    border-color: #ced4da !important;
    color: #212529 !important;
}
.auth-page__card .form-control::placeholder { color: #6c757d !important; }
.auth-page__card .form-control:focus {
    background-color: #fff !important;
    border-color: var(--risa-teal) !important;
    color: #212529 !important;
    box-shadow: 0 0 0 0.2rem rgba(75, 167, 190, 0.25);
}
.auth-page__card .form-label { color: #212529 !important; }

/* Org name highlight box (welcome page) */
.auth-page__org-name {
    background: var(--risa-light-gray);
    border: 2px solid var(--risa-teal);
    border-radius: 0.5rem;
    padding: 1rem;
    font-size: var(--font-size-xl);
    text-align: center;
    color: var(--risa-teal-darker);
    font-weight: bold;
}

/* Primary button on auth pages — purple gradient with lift effect */
.auth-page .btn-primary {
    background: var(--gradient-primary);
    border: none;
    padding: 0.75rem var(--spacing-xl);
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}
.auth-page .btn-primary:hover {
    background: linear-gradient(135deg, #5a4a8a, var(--risa-purple));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(68, 52, 116, 0.4);
}

/* Transparent footer on dark background */
.auth-page__footer {
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
}
.auth-page__footer a { color: var(--risa-teal); }

/* Step number badge (welcome page steps list) */
.auth-page__step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--risa-purple);
    color: var(--risa-white);
    border-radius: 50%;
    font-weight: bold;
    font-size: var(--font-size-sm);
    margin-right: var(--spacing-sm);
}

/* Form helpers inside auth cards */
.auth-page__card .form-text { color: #6c757d !important; }
.auth-page__card .form-check-label { color: #212529 !important; }
.auth-page__card .form-check-input {
    background-color: #fff !important;
    border: 2px solid #6c757d !important;
}
.auth-page__card .form-check-input:checked {
    background-color: var(--risa-purple) !important;
    border-color: var(--risa-purple) !important;
}

/* Auth card header variants */
.auth-page__card .card-header--success {
    background: linear-gradient(135deg, #198754, #20c997);
}
.auth-page__card .card-header--error {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

/* Auth status icon (large centered icon for confirmation/error pages) */
.auth-page__status-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}
.auth-page__status-icon--success { color: #198754; }
.auth-page__status-icon--error { color: #dc3545; }
.auth-page__status-icon--auth { color: var(--risa-purple); }

/* OTP input (verify_2fa) — monospace centered digit input */
.auth-input--otp {
    font-size: 1.5rem;
    letter-spacing: 0.5rem;
    text-align: center;
    font-family: monospace;
}
.auth-input--otp::placeholder {
    letter-spacing: normal;
}

/* Auth page logo — transparent variant (no dark pill background) */
.auth-page__logo--transparent {
    background: none;
}

/* Password toggle (eye icon inside input field) */
.password-toggle { position: relative; }
.password-toggle-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    z-index: 10;
}
.password-toggle-btn:hover { color: #212529; }

/* Password requirements validation list */
.password-requirements { font-size: 0.85rem; color: #6c757d; }
.password-requirements li.valid { color: #198754; }
.password-requirements li.invalid { color: #dc3545; }

/* Password match indicator */
.match-indicator {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    z-index: 10;
}
.match-indicator.match { color: #198754; }
.match-indicator.no-match { color: #dc3545; }

/* Organization selector cards (multi-org login) */
.org-selector__card {
    border: 2px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}
.org-selector__card:hover {
    border-color: var(--risa-purple);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.org-selector__card.selected {
    border-color: var(--risa-purple);
    background: rgba(68, 52, 116, 0.05);
}
.org-selector__icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}
.org-selector__name {
    font-weight: 600;
    font-size: 1.1rem;
    color: #212529;
}
.org-selector__role {
    font-size: 0.875rem;
    color: #6c757d;
}

/* Disabled state for auth primary button */
.auth-page .btn-primary:disabled {
    background: #6c757d;
    transform: none;
    box-shadow: none;
}

/* ============================================
   Provider Selector Cards (setup email)
   ============================================ */
.provider-selector__card {
    border: 2px solid var(--card-border, #dee2e6);
    border-radius: 0.5rem;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--card-bg, #fff);
}
.provider-selector__card:hover:not(.provider-selector__card--disabled) {
    border-color: var(--risa-purple);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.provider-selector__card--selected {
    border-color: var(--risa-purple);
    background: rgba(68, 52, 116, 0.05);
}
.provider-selector__card--disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.provider-selector__icon { margin-bottom: 0.75rem; }
.provider-selector__name { font-weight: 600; margin-bottom: 0.5rem; }
.provider-config { display: none; }
.provider-config.active { display: block; }
[data-theme="dark"] .provider-selector__card {
    border-color: rgba(255, 255, 255, 0.1);
}

/* ============================================
   Webhook Status Indicator
   ============================================ */
.webhook-status-indicator {
    font-size: 1.5rem;
    width: 40px;
    text-align: center;
}

/* ============================================
   File / Folder Tree
   ============================================ */
.file-tree ul {
    border-left: 1px dashed var(--sidebar-border, rgba(128, 128, 128, 0.5));
    padding-left: 1rem;
}
.file-tree__item { margin-bottom: 0.5rem; }
.file-tree__container {
    max-height: 300px;
    overflow-y: auto;
}
[data-theme="dark"] .file-tree .form-check-label { color: #e8e8e8; }
[data-theme="dark"] .file-tree .text-muted { color: #a0a0b0 !important; }

/* ============================================
   Confidence Badge (document detail panel)
   ============================================ */
.confidence-badge {
    font-size: 0.75rem;
    padding: 0.25em 0.5em;
}
.confidence-badge--high { background-color: #198754 !important; }
.confidence-badge--medium { background-color: #ffc107 !important; color: #000 !important; }
.confidence-badge--low { background-color: #dc3545 !important; }

/* Dark-mode bg-light subtle override */
[data-theme="dark"] .bg-light--subtle {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Setup status (setup dashboard) */
.setup-status {
    padding: 1rem;
    border-radius: 0.5rem;
}

/* Navbar fallback (in case Bootstrap CSS fails to load) */
.navbar-nav { list-style: none; padding-left: 0; margin-bottom: 0; display: flex; flex-direction: row; }
.navbar-nav .nav-item { list-style: none; }
.navbar-nav .nav-link { display: block; padding: 0.5rem 1rem; color: rgba(255,255,255,0.85); text-decoration: none; }
.navbar-nav .nav-link:hover { color: #fff; }
@media (max-width: 991.98px) { .navbar-nav { flex-direction: column; } }

/* ============================================
   Forms
   ============================================ */
.form-control:focus {
    border-color: var(--focus-ring-light);  /* Use semantic focus color */
    box-shadow: 0 0 0 0.2rem rgba(44, 109, 126, 0.25);
}

.form-label {
    font-weight: 500;
    color: var(--text-primary-light);       /* IMPROVED: Use semantic token */
}

.form-text,
.help-text {
    font-size: var(--font-size-xs);
    color: var(--text-help-light);          /* IMPROVED: #5a5f66 = 7.3:1 AAA (was 4.6:1) */
    margin-top: 0.25rem;
}

/* ============================================
   Accordion (Setup Dashboard)
   ============================================ */
.accordion-button {
    font-weight: 500;
}

.accordion-button:not(.collapsed) {
    background-color: var(--risa-purple);
    color: var(--risa-white);
}

.accordion-button:not(.collapsed)::after {
    filter: brightness(0) invert(1);
}

.accordion-button:focus {
    border-color: var(--risa-teal);
    box-shadow: 0 0 0 0.2rem rgba(75, 167, 190, 0.25);
}

/* ============================================
   Setup Accordion (Reusable Setup Sections)
   ============================================ */

/* Header layout */
.setup-accordion__header {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.setup-accordion__title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.setup-accordion__title {
    font-weight: 600;
    font-size: var(--font-size-base, 1rem);
}

/* Status icons */
.setup-accordion__status-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.setup-accordion__status-icon--complete {
    color: #28a745;
}

.setup-accordion__status-icon--in-progress {
    color: var(--risa-teal);
    animation: setupAccordionPulse 2s ease-in-out infinite;
}

.setup-accordion__status-icon--required {
    color: #e6a817;
}

.setup-accordion__status-icon--optional {
    color: #6c757d;
}

.setup-accordion__status-icon--locked {
    color: #6c757d;
    opacity: 0.5;
}

@keyframes setupAccordionPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Status badges */
.setup-accordion__badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.2em 0.5em;
    border-radius: 0.25rem;
}

.setup-accordion__badge--in-progress {
    background-color: rgba(75, 167, 190, 0.15);
    color: var(--risa-teal);
}

.setup-accordion__badge--required {
    background-color: rgba(230, 168, 23, 0.15);
    color: #b8860b;
}

.setup-accordion__badge--optional {
    background-color: rgba(108, 117, 125, 0.12);
    color: #6c757d;
}

.setup-accordion__badge--locked {
    background-color: rgba(108, 117, 125, 0.08);
    color: #adb5bd;
}

/* Meta row (subtitle + time estimate) */
.setup-accordion__meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.2rem;
    padding-left: 1.6rem; /* Align with title (past status icon) */
}

.setup-accordion__subtitle {
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--text-tertiary-light, #4a4a4a);
    font-weight: 400;
}

.setup-accordion__time {
    font-size: var(--font-size-xs, 0.75rem);
    color: var(--text-help-light, #5a5f66);
    white-space: nowrap;
}

.setup-accordion__time i {
    font-size: 0.7rem;
    margin-right: 0.2rem;
}

/* Locked state */
.setup-accordion__item--locked {
    opacity: 0.6;
    pointer-events: none;
}

.setup-accordion__btn--locked {
    cursor: not-allowed !important;
}

/* Complete state — subtle left border accent */
.setup-accordion__item--complete {
    border-left: 3px solid #28a745;
}

/* Summary (shown inside collapsed complete sections) */
.setup-accordion__summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    font-size: var(--font-size-sm, 0.875rem);
}

.setup-accordion__summary-label {
    color: var(--text-tertiary-light, #4a4a4a);
    font-weight: 500;
}

.setup-accordion__summary-value {
    color: var(--text-primary-light, #1a1a1a);
    margin-left: 0.25rem;
}

/* Dark theme overrides */
[data-theme="dark"] .setup-accordion__status-icon--required {
    color: #ffc107;
}

[data-theme="dark"] .setup-accordion__badge--in-progress {
    background-color: rgba(75, 167, 190, 0.2);
    color: #70d4e8;
}

[data-theme="dark"] .setup-accordion__badge--required {
    background-color: rgba(255, 193, 7, 0.2);
    color: #ffd54f;
}

[data-theme="dark"] .setup-accordion__badge--optional {
    background-color: rgba(108, 117, 125, 0.15);
    color: #adb5bd;
}

[data-theme="dark"] .setup-accordion__badge--locked {
    background-color: rgba(108, 117, 125, 0.1);
    color: #6c757d;
}

[data-theme="dark"] .setup-accordion__subtitle {
    color: var(--text-tertiary-dark, #d0d0d0);
}

[data-theme="dark"] .setup-accordion__time {
    color: var(--text-help-dark, #c0c0c8);
}

[data-theme="dark"] .setup-accordion__summary-label {
    color: var(--text-tertiary-dark, #d0d0d0);
}

[data-theme="dark"] .setup-accordion__summary-value {
    color: var(--text-primary-dark, #f5f5f5);
}

[data-theme="dark"] .setup-accordion__item--complete {
    border-left-color: #5fd87e;
}

/* Light theme explicit */
[data-theme="light"] .setup-accordion__status-icon--complete {
    color: #1e7e34;
}

[data-theme="light"] .setup-accordion__badge--required {
    background-color: rgba(230, 168, 23, 0.12);
    color: #8a6914;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .setup-accordion__status-icon--in-progress {
        animation: none;
    }
}

/* Mobile adjustments */
@media (max-width: 576px) {
    .setup-accordion__meta {
        padding-left: 0;
        flex-direction: column;
        gap: 0.25rem;
    }

    .setup-accordion__title-row {
        flex-wrap: wrap;
    }
}

/* ============================================
   Alerts
   ============================================ */
.alert-info {
    background-color: #e7f5f8;
    border-color: var(--risa-teal);
    color: #0c5460;
}

.alert-success {
    border-left: 4px solid #28a745;
}

.alert-warning {
    border-left: 4px solid #ffc107;
}

.alert-danger,
.alert-error {
    border-left: 4px solid #dc3545;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ============================================
   Status Badges (Legacy Support)
   ============================================ */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.status-configured {
    background: #d4edda;
    color: #155724;
}

.status-not-configured {
    background: #f8d7da;
    color: #721c24;
}

/* ============================================
   Footer - Theme Aware
   Addresses: Footer text barely legible, links fail WCAG AA (3.8:1)
   ============================================ */

/* Base structure */
.footer,
footer {
    padding: 1.5rem 0;
    margin-top: auto;
}

/* Dark mode footer (keep existing) */
[data-theme="dark"] .footer,
[data-theme="dark"] footer {
    background-color: var(--risa-purple);      /* #443474 */
    color: var(--risa-white);                   /* #FFFFFF = 6.3:1 */
}

[data-theme="dark"] .footer a,
[data-theme="dark"] footer a {
    color: #7fc8d8;  /* Lighter teal = 9.2:1 AAA on purple */
}

[data-theme="dark"] .footer a:hover,
[data-theme="dark"] footer a:hover {
    color: var(--risa-white);
}

/* Light mode footer (NEW) - matches sidebar pattern */
[data-theme="light"] .footer,
[data-theme="light"] footer {
    background-color: #f8f9fa;                  /* Light gray background */
    color: var(--text-primary-light);           /* #1a1a1a = 15.8:1 AAA */
    border-top: 1px solid var(--border-light);
}

[data-theme="light"] .footer a,
[data-theme="light"] footer a {
    color: var(--link-light);                   /* #2c6d7e = 7.2:1 AAA */
}

[data-theme="light"] .footer a:hover,
[data-theme="light"] footer a:hover {
    color: var(--risa-purple-dark);             /* Purple hover */
}

/* ============================================
   Login Page
   ============================================ */
.login-card {
    max-width: 400px;
    margin: 0 auto;
}

.login-card .card-header {
    background-color: var(--risa-purple);
    color: var(--risa-white);
    border-bottom: none;
    text-align: center;
    padding: 1.5rem;
}

.login-card .card-header h4 {
    color: var(--risa-white);
    margin-bottom: 0.25rem;
}

.login-logo {
    max-width: 200px;
    margin-bottom: 1rem;
}

/* ============================================
   Setup Progress Icons
   ============================================ */
.setup-status {
    padding: var(--spacing-lg);
    border-radius: 0.5rem;
}

.setup-status.text-success i {
    color: #28a745;
}

.setup-status.text-warning i {
    color: #ffc107;
}

/* ============================================
   Utilities
   ============================================ */
.text-risa-purple {
    color: var(--risa-purple) !important;
}

.text-risa-teal {
    color: var(--risa-teal) !important;
}

.bg-risa-purple {
    background-color: var(--risa-purple) !important;
}

.bg-risa-teal {
    background-color: var(--risa-teal) !important;
}

.border-risa-purple {
    border-color: var(--risa-purple) !important;
}

.border-risa-teal {
    border-color: var(--risa-teal) !important;
}

/* ============================================
   Folder List (IMAP/Storage)
   ============================================ */
.folder-list {
    background: var(--risa-light-gray);
    padding: var(--spacing-lg);
    border-radius: 4px;
    margin-top: 1rem;
}

.folder-list ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

.folder-list li {
    padding: 0.5rem;
    border-bottom: 1px solid var(--risa-medium-gray);
}

.folder-list li:last-child {
    border-bottom: none;
}

.folder-shared {
    color: var(--risa-teal);
    font-weight: 500;
}

/* ============================================
   Bootstrap Tooltip Customization
   ============================================ */
.tooltip-inner {
    background-color: var(--risa-purple);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: var(--font-size-xs);
    max-width: 250px;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 0.375rem;
}

.tooltip.bs-tooltip-top .tooltip-arrow::before {
    border-top-color: var(--risa-purple);
}

.tooltip.bs-tooltip-bottom .tooltip-arrow::before {
    border-bottom-color: var(--risa-purple);
}

.tooltip.bs-tooltip-start .tooltip-arrow::before {
    border-left-color: var(--risa-purple);
}

.tooltip.bs-tooltip-end .tooltip-arrow::before {
    border-right-color: var(--risa-purple);
}

/* ============================================
   RPA Progress Tracker
   ============================================ */
.progress-step-circle {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.progress-connector {
    flex-grow: 1;
    margin-top: var(--spacing-xl);
    padding: 0 0.5rem;
}

.progress-connector-line {
    border-top: 2px solid;
    width: 100%;
}

/* What's Next guidance box */
.whats-next-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-left: 4px solid var(--risa-teal);
    padding: var(--spacing-lg) var(--spacing-xl);
    margin-top: 1rem;
    border-radius: 0 0.375rem 0.375rem 0;
}

.whats-next-box.ready {
    border-left-color: #28a745;
    background: linear-gradient(135deg, #f0fff4 0%, #e8f5e9 100%);
}

.whats-next-box.warning {
    border-left-color: #ffc107;
    background: linear-gradient(135deg, #fffbf0 0%, #fff8e1 100%);
}

/* Credential inline form */
.credential-quick-add {
    background: var(--risa-light-gray);
    border-radius: 0.375rem;
    padding: var(--spacing-lg);
    margin-top: 0.75rem;
}

/* Step list truncation */
.step-value-truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 992px) {
    .step-value-truncate {
        max-width: 150px;
    }
}

/* Sidebar schedule card */
.schedule-card-badge {
    font-size: 0.65rem;
    padding: var(--spacing-xs) var(--spacing-sm);
    vertical-align: middle;
}

/* ============================================
   Guided UI Glow Effects
   ============================================ */

/* Keyframe: Pulse with glow (attention-grabbing) */
@keyframes pulse-glow {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 12px var(--glow-color, rgba(255, 193, 7, 0.6));
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 20px var(--glow-color, rgba(255, 193, 7, 0.8));
    }
}

/* Keyframe: Soft pulse (subtle attention) */
@keyframes pulse-soft {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Keyframe: Border pulse */
@keyframes pulse-border {
    0%, 100% { border-color: rgba(255, 193, 7, 0.4); }
    50% { border-color: rgba(255, 193, 7, 0.9); }
}

/* Utility: Attention glow (amber) - "action needed" */
.glow-attention {
    --glow-color: rgba(255, 193, 7, 0.6);
    animation: pulse-glow 1.5s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(255, 193, 7, 0.6), 0 0 24px rgba(255, 193, 7, 0.3);
}

/* Utility: Active glow (purple) - "current step" */
.glow-active {
    --glow-color: rgba(68, 52, 116, 0.6);
    animation: pulse-glow 1.5s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(68, 52, 116, 0.6), 0 0 24px rgba(68, 52, 116, 0.3);
}

/* Utility: Warning glow (amber card border) */
.glow-warning-card {
    animation: pulse-border 2s ease-in-out infinite;
    border-width: 2px;
    border-style: solid;
}

/* Ensure warning buttons have visible text */
.btn-warning {
    color: #000 !important;  /* Black text on yellow background for maximum contrast */
}

.btn-warning:hover {
    color: #000 !important;
}

/* Utility: CTA button glow */
.glow-cta {
    animation: pulse-soft 2s ease-in-out infinite;
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.4);
}
.glow-cta:hover {
    animation: none;
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.6);
}

/* Utility: Status icon glow (for setup dashboard) */
.glow-status {
    animation: pulse-soft 2s ease-in-out infinite;
}

/* Accessibility: Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .glow-attention,
    .glow-active,
    .glow-warning-card,
    .glow-cta,
    .glow-status {
        animation: none;
    }
    .glow-attention { box-shadow: 0 0 8px rgba(255, 193, 7, 0.5); }
    .glow-active { box-shadow: 0 0 8px rgba(68, 52, 116, 0.5); }
}

/* ============================================
   Execution Step Log Styling
   ============================================ */
.step-item {
    border-left: 3px solid transparent;
    transition: background-color 0.15s ease;
}

.step-item:hover {
    background-color: var(--risa-light-gray);
}

/* Action type color coding - uses themeable variables */
.step-navigate, .status-navigate { border-left-color: var(--status-navigate); }
.step-type, .status-type { border-left-color: var(--status-type); }
.step-click, .status-click { border-left-color: var(--status-click); }
.step-download { border-left-color: var(--risa-purple); }
.step-wait, .status-wait { border-left-color: var(--status-wait); }
.step-popup_opened, .status-popup { border-left-color: var(--status-popup); }
.step-pdf_saved { border-left-color: var(--status-click); }

/* Light theme status adjustments for AAA contrast */
[data-theme="light"] .step-wait,
[data-theme="light"] .status-wait,
[data-theme="light"] .log-level.warning {
    border-left-color: var(--status-wait-light);
    color: var(--status-wait-light);
}

[data-theme="light"] .step-type,
[data-theme="light"] .status-type,
[data-theme="light"] .log-level.info {
    border-left-color: var(--status-type-light);
    color: var(--status-type-light);
}

[data-theme="light"] .status-unknown,
[data-theme="light"] .log-level.debug {
    color: var(--text-tertiary-light);  /* #4a4a4a = 9.7:1 AAA */
}

.step-description {
    font-size: var(--font-size-xs);
    color: var(--text-help-light);          /* IMPROVED: #5a5f66 = 7.3:1 AAA (was 4.5:1) */
    margin-top: 0.25rem;
    word-break: break-word;
}

.step-url {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: var(--font-size-xs);
    color: var(--text-help-light);          /* IMPROVED: #5a5f66 = 7.3:1 AAA (was 4.5:1) */
}

/* Detailed Log JSON styling */
.json-log {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: var(--spacing-lg);
    border-radius: 0 0 0.375rem 0.375rem;
    font-size: var(--font-size-xs);
    line-height: 1.5;
    max-height: 400px;
    overflow-y: auto;
    margin: 0;
}

/* Light theme code blocks */
[data-theme="light"] .json-log,
[data-theme="light"] pre,
[data-theme="light"] code {
    background-color: #f5f5f5;
    color: var(--text-primary-light);
    border: 1px solid var(--border-light);
}

/* Collapsible header styling */
.collapse-header {
    cursor: pointer;
    user-select: none;
}

.collapse-header:hover {
    background-color: var(--risa-light-gray);
}

.collapse-header .collapse-icon {
    transition: transform 0.2s ease;
}

.collapse-header[aria-expanded="true"] .collapse-icon {
    transform: rotate(180deg);
}

/* ============================================
   Sidebar Navigation (Phase 1)
   ============================================ */

:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 64px;
    --sidebar-transition: 0.3s ease;
    --header-height: 56px;
}

/* CSS Variables for Sidebar (Dark Theme) */
[data-theme="dark"] {
    --sidebar-bg: #1A1A2E;
    --sidebar-bg-hover: #242442;
    --sidebar-bg-active: #2D2D54;
    --sidebar-text: #f5f5f5;
    --sidebar-text-muted: #c0c0c8;          /* IMPROVED: was #A0A0B0 - now 8.4:1 */
    --sidebar-border: rgba(255, 255, 255, 0.15); /* IMPROVED: was 0.1 - now 3:1 visible */
    --sidebar-progress-bg: rgba(255, 255, 255, 0.15);
    --sidebar-progress-yellow: #EAB308;
    --content-bg: #1a1a1a;
    --content-text: var(--text-primary-dark);
    --content-text-secondary: var(--text-secondary-dark);
    --content-text-tertiary: var(--text-tertiary-dark);
    --card-bg: #2d2d2d;
    --card-border: rgba(255, 255, 255, 0.15); /* IMPROVED: was 0.1 - now 3:1 visible */
}

/* Light Theme Variables */
[data-theme="light"] {
    --sidebar-bg: #f8f9fa;
    --sidebar-bg-hover: #e9ecef;
    --sidebar-bg-active: #d8d8d8;           /* IMPROVED: was #dee2e6 - stronger active state */
    --sidebar-text: #212529;
    --sidebar-text-muted: #5a5f66;          /* IMPROVED: was #6c757d - now 7.3:1 AAA */
    --sidebar-border: rgba(0, 0, 0, 0.15);  /* IMPROVED: was 0.1 - now 3:1 visible */
    --sidebar-progress-bg: rgba(0, 0, 0, 0.15);
    --sidebar-progress-yellow: #B8860B;
    --content-bg: #ffffff;
    --content-text: var(--text-primary-light);
    --content-text-secondary: var(--text-secondary-light);
    --content-text-tertiary: var(--text-tertiary-light);
    --card-bg: #ffffff;
    --card-border: rgba(0, 0, 0, 0.15);     /* IMPROVED: was 0.125 - now 3:1 visible */
}

/* Light theme text utilities - complete Bootstrap override */
[data-theme="light"] .text-secondary {
    color: var(--text-secondary-light) !important;  /* #2d2d2d = 13.1:1 AAA */
}

[data-theme="light"] .text-disabled {
    color: var(--text-disabled-light) !important;   /* #8c8c8c = 5.7:1 AA+ */
}

/* Additional visual feedback for disabled elements */
[data-theme="light"] button[disabled],
[data-theme="light"] input[disabled],
[data-theme="light"] textarea[disabled],
[data-theme="light"] select[disabled],
[data-theme="light"] .btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

[data-theme="light"] .text-body {
    color: var(--text-primary-light) !important;    /* #1a1a1a = 15.8:1 AAA */
}

[data-theme="light"] small,
[data-theme="light"] .small {
    color: var(--text-secondary-light);             /* #2d2d2d = 13.1:1 AAA */
}

/* Apply theme to body and main content */
body {
    background-color: var(--content-bg);
    color: var(--content-text);
    transition: background-color 0.3s, color 0.3s;
}

.main-content {
    background-color: var(--content-bg);
}

.card {
    background-color: var(--card-bg, #fff);
    border-color: var(--card-border, rgba(0, 0, 0, 0.125));
}

/* ============================================
   Dark Theme Overrides for Bootstrap Components
   ============================================ */
[data-theme="dark"] {
    /* Ensure base text colors work */
    --bs-body-color: #f5f5f5;
    --bs-body-bg: #1a1a1a;
}

/* Dark theme text colors */
[data-theme="dark"] .text-muted {
    color: var(--text-help-dark) !important; /* IMPROVED: #c0c0c8 = 8.4:1 AAA (was 5.8:1) */
}

[data-theme="dark"] .text-secondary {
    color: var(--text-secondary-dark) !important; /* IMPROVED: #e8e8e8 = 13.2:1 AAA */
}

[data-theme="dark"] .text-danger {
    color: #f08090 !important;                  /* 8.2:1 on #2d2d2d — AAA */
}

[data-theme="dark"] .text-warning {
    color: #ffd54f !important;                  /* 12.5:1 on #2d2d2d — AAA */
}

[data-theme="dark"] .text-success {
    color: #75d695 !important;                  /* 8.9:1 on #2d2d2d — AAA */
}

[data-theme="dark"] .small, [data-theme="dark"] small {
    color: var(--text-secondary-dark);      /* IMPROVED: Use semantic token */
}

/* Dark theme headings */
[data-theme="dark"] h1, [data-theme="dark"] h2 {
    color: #c9b5e6;                         /* IMPROVED: 9.5:1 AAA (was 7.8:1) */
}

[data-theme="dark"] h3 {
    color: #90dce8;                         /* IMPROVED: 12.1:1 AAA (was 10.2:1) */
}

[data-theme="dark"] h4, [data-theme="dark"] h5, [data-theme="dark"] h6 {
    color: var(--text-primary-dark);        /* Use semantic token */
}

/* Dark theme cards */
[data-theme="dark"] .card {
    background-color: #2d2d2d;
    border-color: var(--card-border);       /* IMPROVED: rgba(255,255,255,0.15) = 3:1 visible */
    color: var(--text-primary-dark);
}

[data-theme="dark"] .card-header {
    background-color: #363636;
    border-bottom-color: var(--risa-purple);
    color: #f5f5f5;
}

[data-theme="dark"] .card-body {
    color: #e8e8e8;
}

[data-theme="dark"] .card-text {
    color: #d0d0d8;
}

[data-theme="dark"] .card-title {
    color: #f5f5f5;
}

[data-theme="dark"] .card-footer {
    background-color: #363636;
    border-top-color: rgba(255, 255, 255, 0.1);
    color: #d0d0d8;
}

/* Dark theme tables */
[data-theme="dark"] .table {
    --bs-table-bg: #2d2d2d;
    --bs-table-color: var(--text-primary-dark);
    --bs-table-border-color: rgba(255, 255, 255, 0.15); /* IMPROVED: 3:1 visible */
    --bs-table-striped-bg: rgba(255, 255, 255, 0.04); /* IMPROVED: More visible */
    --bs-table-hover-bg: var(--bg-hover-dark); /* IMPROVED: #2a2a2a = stronger hover */
    color: var(--text-primary-dark);
}

[data-theme="dark"] .table td, [data-theme="dark"] .table th {
    color: var(--text-primary-dark);
    border-color: rgba(255, 255, 255, 0.15); /* IMPROVED: 3:1 visible */
}

[data-theme="dark"] .table thead {
    background-color: var(--risa-purple);
    color: #ffffff;
}

/* Dark theme forms */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: #363636;
    border-color: rgba(255, 255, 255, 0.3); /* IMPROVED: 3:1 visible (was 0.2) */
    color: var(--text-primary-dark);
}

[data-theme="dark"] .form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10' fill='none'%3E%3Cpath d='M2 2.25L7 7.25L12 2.25' stroke='%23bfefff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

[data-theme="dark"] .form-control::placeholder {
    color: var(--text-placeholder-dark);    /* FIXED: #b0b0b8 = 6.8:1 AA+ (was 3.8:1 FAIL) */
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: #404040;
    border-color: var(--focus-ring-dark);   /* Use semantic focus color */
    color: var(--text-primary-dark);
    box-shadow: 0 0 0 0.2rem rgba(112, 212, 232, 0.25);
}

[data-theme="dark"] .form-control:disabled,
[data-theme="dark"] .form-control[readonly] {
    background-color: #2a2a2a;
    color: var(--text-disabled-dark);       /* Use semantic token */
}

[data-theme="dark"] .form-label {
    color: var(--text-primary-dark);        /* IMPROVED: Use semantic token */
}

[data-theme="dark"] .form-text,
[data-theme="dark"] .help-text {
    color: var(--text-help-dark) !important; /* IMPROVED: #c0c0c8 = 8.4:1 AAA (was 5.8:1) */
}

[data-theme="dark"] .form-check-label {
    color: var(--text-primary-dark) !important; /* IMPROVED: Use semantic token */
}

/* Ensure form labels are visible in both themes */
.form-check-label {
    color: inherit;
}

[data-theme="dark"] .form-check-input {
    background-color: #363636;
    border-color: rgba(255, 255, 255, 0.4); /* IMPROVED: Stronger border for 3:1 visibility */
}

[data-theme="dark"] .form-check-input:checked {
    background-color: var(--risa-purple);
    border-color: var(--risa-purple);
}

[data-theme="dark"] .form-check-input:focus {
    border-color: var(--focus-ring-dark);
    box-shadow: 0 0 0 0.2rem rgba(112, 212, 232, 0.25);
}

/* Dark theme input groups */
[data-theme="dark"] .input-group-text {
    background-color: #363636;
    border-color: rgba(255, 255, 255, 0.2);
    color: #d0d0d8;
}

/* Dark theme dropdowns */
[data-theme="dark"] .dropdown-menu {
    background-color: #2d2d2d;
    border-color: rgba(255, 255, 255, 0.2); /* IMPROVED: 3:1 visible (was 0.15) */
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .dropdown-item {
    color: #e8e8e8;
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background-color: #3d3d3d;
    color: #f5f5f5;
}

[data-theme="dark"] .dropdown-header {
    color: #a0a0b0;
}

[data-theme="dark"] .dropdown-divider {
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* Dark theme modals */
[data-theme="dark"] .modal-content {
    background-color: #2d2d2d;
    border-color: rgba(255, 255, 255, 0.2); /* IMPROVED: 3:1 visible */
    color: var(--text-primary-dark);
}

[data-theme="dark"] .modal-header {
    border-bottom-color: rgba(255, 255, 255, 0.15); /* IMPROVED: Visible separator */
}

[data-theme="dark"] .modal-footer {
    border-top-color: rgba(255, 255, 255, 0.15); /* IMPROVED: Visible separator */
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

[data-theme="dark"] .alert-light {
    background-color: #f8f9fa;
    border-color: rgba(0, 0, 0, 0.125);
    color: var(--text-primary-light) !important;
}

[data-theme="dark"] .alert-light .small,
[data-theme="dark"] .alert-light small,
[data-theme="dark"] .alert-light .text-muted {
    color: var(--text-help-light) !important;
}

/* Dark theme list groups */
[data-theme="dark"] .list-group-item {
    background-color: #2d2d2d;
    border-color: rgba(255, 255, 255, 0.1);
    color: #e8e8e8;
}

[data-theme="dark"] .list-group-item:hover {
    background-color: #363636;
}

[data-theme="dark"] .list-group-item.active {
    background-color: var(--risa-purple);
    border-color: var(--risa-purple);
}

/* Dark theme nav tabs */
[data-theme="dark"] .nav-tabs {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .nav-tabs .nav-link {
    color: #a0a0b0;
}

[data-theme="dark"] .nav-tabs .nav-link:hover {
    border-color: rgba(255, 255, 255, 0.1) rgba(255, 255, 255, 0.1) transparent;
    color: #e8e8e8;
}

[data-theme="dark"] .nav-tabs .nav-link.active {
    background-color: #2d2d2d;
    border-color: rgba(255, 255, 255, 0.1) rgba(255, 255, 255, 0.1) #2d2d2d;
    color: #f5f5f5;
}

/* Dark theme pills */
[data-theme="dark"] .nav-pills .nav-link {
    color: #a0a0b0;
}

[data-theme="dark"] .nav-pills .nav-link.active {
    background-color: var(--risa-purple);
    color: #ffffff;
}

/* Dark theme alerts */
[data-theme="dark"] .alert-info {
    background-color: rgba(75, 167, 190, 0.15);
    border-color: rgba(75, 167, 190, 0.3);
    color: #7fc8d8;
}

[data-theme="dark"] .alert-success {
    background-color: rgba(40, 167, 69, 0.15);
    border-left: 4px solid #28a745;
    color: #75d695;
}

[data-theme="dark"] .alert-warning {
    background-color: rgba(255, 193, 7, 0.15);
    border-left: 4px solid #ffc107;
    color: #ffd54f;
}

[data-theme="dark"] .alert-danger {
    background-color: rgba(220, 53, 69, 0.15);
    border-left: 4px solid #dc3545;
    color: #f08090;
}

[data-theme="dark"] .alert-secondary {
    background-color: rgba(108, 117, 125, 0.15);
    border-color: rgba(108, 117, 125, 0.3);
    color: #c0c0c8;
}

/* Dark theme badges */
[data-theme="dark"] .badge.bg-secondary {
    background-color: #4a4a5a !important;
    color: #e8e8e8;
}

[data-theme="dark"] .badge.bg-light {
    background-color: #3a3a4a !important;
    color: #e8e8e8;
}

/* Dark theme breadcrumbs */
[data-theme="dark"] .breadcrumb {
    background-color: #2d2d2d;
}

[data-theme="dark"] .breadcrumb-item a {
    color: var(--risa-teal);
}

[data-theme="dark"] .breadcrumb-item.active {
    color: #a0a0b0;
}

/* Dark theme accordions */
[data-theme="dark"] .accordion-item {
    background-color: #2d2d2d;
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .accordion-button {
    background-color: #363636;
    color: #e8e8e8;
}

[data-theme="dark"] .accordion-button:not(.collapsed) {
    background-color: var(--risa-purple);
    color: #ffffff;
}

[data-theme="dark"] .accordion-body {
    background-color: #2d2d2d;
    color: #e8e8e8;
}

/* Dark theme links */
[data-theme="dark"] a {
    color: var(--link-dark);                /* IMPROVED: #70d4e8 = 10.8:1 AAA (was 6.5:1) */
}

[data-theme="dark"] a:hover {
    color: var(--link-dark-hover);          /* IMPROVED: #90e0f0 = 13.2:1 AAA */
}

[data-theme="dark"] a:focus-visible {
    outline-color: var(--focus-ring-dark);
}

/* Dark theme folder list */
[data-theme="dark"] .folder-list {
    background-color: #2a2a2a;
}

[data-theme="dark"] .folder-list li {
    border-bottom-color: rgba(255, 255, 255, 0.1);
    color: #e8e8e8;
}

/* Dark theme progress bars */
[data-theme="dark"] .progress {
    background-color: #363636;
}

/* Dark theme borders */
[data-theme="dark"] .border {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .border-bottom {
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .border-top {
    border-top-color: rgba(255, 255, 255, 0.1) !important;
}

/* Dark theme "What's Next" box */
[data-theme="dark"] .whats-next-box {
    background: linear-gradient(135deg, #2a2a3a 0%, #252535 100%);
    color: #e8e8e8;
}

[data-theme="dark"] .whats-next-box.ready {
    background: linear-gradient(135deg, #1a2a1a 0%, #1a301a 100%);
}

[data-theme="dark"] .whats-next-box.warning {
    background: linear-gradient(135deg, #2a2a1a 0%, #302a1a 100%);
}

/* Dark theme step descriptions */
[data-theme="dark"] .step-description {
    color: var(--text-help-dark);           /* IMPROVED: #c0c0c8 = 8.4:1 AAA (was 5.8:1) */
}

[data-theme="dark"] .step-url {
    color: var(--text-help-dark);           /* IMPROVED: #c0c0c8 = 8.4:1 AAA (was 4.9:1) */
}

/* Dark theme misc text */
[data-theme="dark"] p {
    color: #d8d8e0;
}

[data-theme="dark"] label {
    color: #e8e8e8;
}

[data-theme="dark"] .text-dark {
    color: #e8e8e8 !important;
}

[data-theme="dark"] .bg-light {
    background-color: #2d2d2d !important;
}

/* Dark theme code blocks */
[data-theme="dark"] code {
    background-color: #363636;
    color: #f08080;
}

[data-theme="dark"] pre {
    background-color: #1e1e1e;
    color: #d4d4d4;
}

/* ============================================
   Light Theme Overrides for Bootstrap Components
   ============================================ */
[data-theme="light"] .table {
    --bs-table-bg: var(--card-bg);
    --bs-table-color: var(--content-text);
    --bs-table-border-color: var(--card-border);
    --bs-table-striped-bg: rgba(0, 0, 0, 0.03); /* IMPROVED: More visible */
    --bs-table-hover-bg: var(--bg-hover-light); /* IMPROVED: #e8e8e8 = stronger hover */
}

[data-theme="light"] .form-control,
[data-theme="light"] .form-select {
    background-color: #fff;
    border-color: var(--border-light-strong); /* IMPROVED: #808080 = 5.7:1 visible */
    color: var(--text-primary-light);
}

[data-theme="light"] .form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10' fill='none'%3E%3Cpath d='M2 2.25L7 7.25L12 2.25' stroke='%232c6d7e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

[data-theme="light"] .form-control::placeholder {
    color: var(--text-placeholder-light);   /* Explicit placeholder color */
}

[data-theme="light"] .form-control:focus,
[data-theme="light"] .form-select:focus {
    background-color: #fff;
    border-color: var(--focus-ring-light);  /* Use semantic focus color */
}

[data-theme="light"] .form-label {
    color: var(--text-primary-light);       /* Ensure label visibility */
}

[data-theme="light"] .form-text,
[data-theme="light"] .help-text {
    color: var(--text-help-light);          /* Consistent help text */
}

[data-theme="light"] .dropdown-menu {
    background-color: #fff;
    border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .dropdown-item {
    color: var(--text-primary-light);
}

[data-theme="light"] .dropdown-item:hover {
    background-color: #f8f9fa;
}

[data-theme="light"] .dropdown-header {
    color: var(--text-help-light);  /* #5a5f66 = 7.3:1 AAA */
}

[data-theme="light"] .modal-content {
    background-color: #fff;
    color: var(--text-primary-light);
}

[data-theme="light"] .risa-dialog__content,
[data-theme="dark"] .risa-dialog__content,
.risa-dialog__content {
    border-radius: 1rem;
    border: 1px solid var(--card-border, rgba(0, 0, 0, 0.125));
    overflow: hidden;
    box-shadow: 0 1.5rem 3.5rem rgba(0, 0, 0, 0.22);
}

.risa-dialog .modal-dialog {
    max-width: 31rem;
}

.risa-dialog__body {
    padding: var(--spacing-xl, 1.5rem);
}

.risa-dialog__hero {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-lg, 1rem);
    margin-bottom: var(--spacing-lg, 1rem);
}

.risa-dialog__icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.25rem;
}

.risa-dialog__icon--info {
    color: var(--risa-purple);
    background: linear-gradient(135deg, rgba(68, 52, 116, 0.16), rgba(75, 167, 190, 0.16));
}

.risa-dialog__icon--success {
    color: #1f7a3d;
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.14), rgba(40, 167, 69, 0.18));
}

.risa-dialog__icon--warning {
    color: #8a5a00;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.16), rgba(255, 153, 0, 0.14));
}

.risa-dialog__icon--danger,
.risa-dialog__icon--error {
    color: #b42318;
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.14), rgba(180, 35, 24, 0.18));
}

.risa-dialog__title {
    margin: 0;
    color: var(--text-primary-light);
}

.risa-dialog__message {
    margin: 0;
    color: var(--text-secondary-light);
    white-space: pre-line;
}

.risa-dialog__footer {
    padding: 0 var(--spacing-xl, 1.5rem) var(--spacing-xl, 1.5rem);
    border-top: 0;
    gap: var(--spacing-sm, 0.5rem);
}

[data-theme="dark"] .risa-dialog__content {
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 1.5rem 3.5rem rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .risa-dialog__icon--info {
    color: #d7c8f3;
    background: linear-gradient(135deg, rgba(104, 85, 166, 0.28), rgba(75, 167, 190, 0.2));
}

[data-theme="dark"] .risa-dialog__icon--success {
    color: #a7e0b6;
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.24), rgba(40, 167, 69, 0.28));
}

[data-theme="dark"] .risa-dialog__icon--warning {
    color: #ffd37a;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.2), rgba(255, 153, 0, 0.22));
}

[data-theme="dark"] .risa-dialog__icon--danger,
[data-theme="dark"] .risa-dialog__icon--error {
    color: #ffb4ab;
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.22), rgba(180, 35, 24, 0.24));
}

[data-theme="dark"] .risa-dialog__title {
    color: var(--text-primary-dark);
}

[data-theme="dark"] .risa-dialog__message {
    color: var(--text-secondary-dark);
}

@media (max-width: 575.98px) {
    .risa-dialog .modal-dialog {
        margin: var(--spacing-lg, 1rem);
    }
}

[data-theme="light"] .list-group-item {
    background-color: #fff;
    border-color: rgba(0, 0, 0, 0.125);
    color: var(--text-primary-light);
}

/* Light theme accordions */
[data-theme="light"] .accordion-item {
    background-color: #fff;
    border-color: rgba(0, 0, 0, 0.125);
}

[data-theme="light"] .accordion-button {
    background-color: #f8f9fa;          /* Light gray background for collapsed */
    color: var(--text-primary-light);
}

[data-theme="light"] .accordion-button:not(.collapsed) {
    background-color: var(--risa-purple);  /* Purple when expanded */
    color: #ffffff;
}

[data-theme="light"] .accordion-body {
    background-color: #fff;
    color: var(--text-primary-light);
}

[data-theme="light"] .text-muted {
    color: var(--text-help-light) !important; /* IMPROVED: #5a5f66 = 7.3:1 AAA (was 4.6:1) */
}

[data-theme="light"] h1, [data-theme="light"] h2, [data-theme="light"] h3,
[data-theme="light"] h4, [data-theme="light"] h5, [data-theme="light"] h6 {
    color: inherit;                         /* Use default heading colors (already AAA) */
}

[data-theme="light"] a {
    color: var(--link-light);               /* Uses semantic token already */
}

[data-theme="light"] a:hover {
    color: var(--link-light-hover);         /* Uses semantic token already */
}

[data-theme="light"] a:focus-visible {
    outline-color: var(--focus-ring-light);
}

/* Light theme alerts */
[data-theme="light"] .alert-info {
    background-color: rgba(13, 202, 240, 0.25);  /* Was 0.1 - increased for visibility */
    border-color: rgba(13, 202, 240, 0.4);       /* Strengthen from 0.3 */
    color: #055160;                               /* 7.8:1 AAA */
}

[data-theme="light"] .alert-success {
    background-color: rgba(25, 135, 84, 0.25);   /* Was 0.1 - increased for visibility */
    border-left: 4px solid #198754;
    color: #0a3622;                               /* AAA */
}

[data-theme="light"] .alert-warning {
    background-color: rgba(255, 193, 7, 0.25);   /* Was 0.1 - increased for visibility */
    border-left: 4px solid #ffc107;
    color: #664d03;                               /* AAA */
}

[data-theme="light"] .alert-danger {
    background-color: rgba(220, 53, 69, 0.25);   /* Was 0.1 - increased for visibility */
    border-left: 4px solid #dc3545;
    color: #58151c;                               /* AAA */
}

[data-theme="light"] .alert-secondary {
    background-color: rgba(108, 117, 125, 0.25); /* Was 0.1 - increased for visibility */
    border-color: rgba(108, 117, 125, 0.4);      /* Strengthen from 0.3 */
    color: #41464b;                               /* AAA */
}

/* ============================================
   Light Mode Card Components - Explicit Colors
   Match dark mode completeness (lines 1065-1086)
   Addresses: Card titles, headers, body text barely legible
   ============================================ */

[data-theme="light"] .card-header {
    color: var(--text-primary-light);  /* #1a1a1a = 15.8:1 AAA */
}

[data-theme="light"] .card-body {
    color: var(--text-primary-light);  /* Explicit instead of inherit */
}

[data-theme="light"] .card-title {
    color: var(--text-primary-light);  /* Ensure card titles are dark */
}

[data-theme="light"] .card-text {
    color: var(--text-primary-light);  /* All card text explicit */
}

/* Info box header - light mode override (matches dark mode at line 2293)
   Addresses: "How to Use RPA Automations" barely legible */
[data-theme="light"] .card-header.bg-info.bg-opacity-10 {
    background-color: rgba(13, 202, 240, 0.15) !important;  /* Slightly stronger than 0.1 */
    color: #055160 !important;  /* Dark cyan = 7.8:1 AAA on light background */
    border: 1px solid rgba(13, 202, 240, 0.3);
}

/* Stronger background for better visibility on any bg-info with low opacity */
[data-theme="light"] .bg-info.bg-opacity-10 {
    background-color: rgba(13, 202, 240, 0.15) !important;  /* Global override */
}

/* Light theme badges - strengthen specificity for badge overrides */
[data-theme="light"] .badge.bg-secondary,
[data-theme="light"] span.badge.bg-secondary,
[data-theme="light"] .btn .badge.bg-secondary {
    background-color: #2d2d2d !important;  /* 13.1:1 AAA with white text */
    color: #ffffff !important;
}

[data-theme="light"] .badge.bg-light {
    background-color: #f8f9fa !important;
    color: var(--text-primary-light);
    border: 1px solid var(--border-light-strong);
}

/* Wizard step indicators - improve inactive step visibility */
[data-theme="light"] .bg-secondary.bg-opacity-25 {
    background-color: rgba(45, 45, 45, 0.15) !important;  /* Darker base */
}

[data-theme="light"] .bg-secondary.bg-opacity-25 .text-muted {
    color: var(--text-tertiary-light) !important;  /* #4a4a4a = 9.7:1 AAA */
}

/* RPA component light mode overrides */
[data-theme="light"] .rpa-record-page .typing-flow-step .flow-num {
    background: #2d2d2d;
    color: #ffffff;
}

/* Light theme breadcrumbs */
[data-theme="light"] .breadcrumb {
    background-color: #f8f9fa;
}

[data-theme="light"] .breadcrumb-item a {
    color: var(--link-light);
}

[data-theme="light"] .breadcrumb-item.active {
    color: var(--text-help-light);
}

/* Light theme nav tabs */
[data-theme="light"] .nav-tabs {
    border-bottom-color: var(--border-light-strong);
}

[data-theme="light"] .nav-tabs .nav-link {
    color: var(--text-secondary-light);
}

[data-theme="light"] .nav-tabs .nav-link:hover {
    border-color: #e9ecef #e9ecef var(--border-light-strong);
    color: var(--text-primary-light);
}

[data-theme="light"] .nav-tabs .nav-link.active {
    background-color: #fff;
    border-color: var(--border-light-strong) var(--border-light-strong) #fff;
    color: var(--text-primary-light);
}

/* Light theme nav pills */
[data-theme="light"] .nav-pills .nav-link {
    color: var(--text-secondary-light);
}

[data-theme="light"] .nav-pills .nav-link.active {
    background-color: var(--risa-purple);
    color: #ffffff;
}

/* Light theme RPA page elements - improve text contrast */
[data-theme="light"] .rpa-record-page .browser-placeholder {
    color: var(--text-help-light); /* #5a5f66 = 7.3:1 AAA */
}

[data-theme="light"] .rpa-record-page .typing-flow-arrow {
    color: var(--text-help-light); /* #5a5f66 = 7.3:1 AAA */
}

[data-theme="light"] .rpa-record-page .date-template-select optgroup {
    color: var(--text-secondary-light); /* #2d2d2d = 13.1:1 AAA */
    background: #f8f9fa;
}

[data-theme="light"] .rpa-record-page .mode-override-btn {
    color: var(--text-help-light); /* #5a5f66 = 7.3:1 AAA */
}

/* Main Layout with Sidebar */
.layout-with-sidebar {
    display: flex;
    min-height: 100vh;
    padding-top: 56px !important;  /* Account for fixed header - must match --header-height */
    scroll-padding-top: 56px;  /* For smooth scrolling anchors */
}

.layout-with-sidebar .main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 1.5rem;
    transition: margin-left var(--sidebar-transition);
    min-width: 0; /* Prevent flex item from overflowing */
}

/* Ensure headings don't get hidden under fixed header when scrolled to */
.layout-with-sidebar h1,
.layout-with-sidebar h2,
.layout-with-sidebar h3,
.layout-with-sidebar [id] {
    scroll-margin-top: calc(var(--header-height) + 1rem);
}

.layout-with-sidebar.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Sidebar Container */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    transition: width var(--sidebar-transition);
    z-index: 1030;
    overflow: hidden;
}

.sidebar[data-collapsed="true"] {
    width: var(--sidebar-collapsed-width);
}

/* Sidebar Header with Toggle */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--sidebar-border);
    min-height: 48px;
}

.sidebar-toggle {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--sidebar-bg-hover);
    border: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: var(--font-size-sm);
}

.sidebar-toggle i {
    transition: transform 0.3s ease;
}

.sidebar-toggle:hover {
    background: var(--risa-purple);
    border-color: var(--risa-purple);
    color: #ffffff;
}

.sidebar-toggle:focus {
    outline: 2px solid var(--risa-teal);
    outline-offset: 2px;
}

.sidebar[data-collapsed="true"] .sidebar-toggle i {
    transform: rotate(180deg);
}

.sidebar[data-collapsed="true"] .sidebar-header {
    justify-content: center;
    padding: 0.75rem 0.5rem;
}

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

/* Sidebar Item */
.sidebar-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
    position: relative;
    margin: 0.25rem 0.5rem;
    border-radius: 0.5rem;
}

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

.sidebar-item--active {
    background: var(--sidebar-bg-active);
    color: white;
}

.sidebar-item--active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--risa-teal);
    border-radius: 0 2px 2px 0;
}

/* Sidebar Item - Incomplete (needs attention) */
.sidebar-item--incomplete {
    border: 1px solid rgba(234, 179, 8, 0.3);
}

[data-theme="light"] .sidebar-item--incomplete {
    border: 1px solid rgba(184, 134, 11, 0.35);
}

/* Sidebar Item Icon */
.sidebar-item__icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: var(--font-size-lg);
}

/* Sidebar Item Content (label + progress) */
.sidebar-item__content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    min-width: 0;
    margin-left: 0.75rem;
    opacity: 1;
    transition: opacity var(--sidebar-transition);
}

.sidebar[data-collapsed="true"] .sidebar-item__content {
    opacity: 0;
    width: 0;
    margin-left: 0;
}

.sidebar-item__label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-item__progress {
    flex-shrink: 0;
    margin-left: var(--spacing-sm);
}

/* Progress Ring */
.progress-ring {
    display: block;
}

.progress-ring__background {
    stroke: var(--sidebar-progress-bg);
}

.progress-ring__progress {
    transition: stroke-dashoffset 0.5s ease;
}

/* Sidebar Badges */
.sidebar-badge {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--font-size-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 0.25rem;
    font-weight: 600;
}

.sidebar-badge--error {
    background: #dc2626;                    /* IMPROVED: 7.1:1 AAA (was 5.2:1) */
    color: white;
}

.sidebar-badge--warning {
    background: #F59E0B;
    color: #000000;                         /* Black text for maximum contrast */
    font-weight: 700;
}

.sidebar-badge--success {
    background: #047857;                    /* FIXED: 4.51:1 AA (darker for minimum AA) */
    color: white;
}

.sidebar-badge--count {
    background: #2e6d80;                    /* FIXED: 4.52:1 AA (matches btn-secondary) */
    color: white;
}

.sidebar[data-collapsed="true"] .sidebar-badge {
    right: 0.5rem;
    top: 0.5rem;
    transform: none;
    padding: var(--spacing-xs) var(--spacing-xs);
    font-size: 0.6rem;
}

/* Sidebar Separator */
.sidebar-separator {
    height: 1px;
    background: var(--sidebar-border);
    margin: 0.75rem 1rem;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--sidebar-border);
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    gap: 4px;
    justify-content: center;
    align-items: center;
    background: var(--sidebar-bg-hover);
    padding: var(--spacing-xs);
    border-radius: 8px;
    border: 1px solid var(--sidebar-border);
}

.theme-toggle__btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border: none;
    background: transparent;
    color: var(--sidebar-text-muted);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
    font-size: var(--font-size-sm);
    padding: 0;
}

.theme-toggle__btn i {
    font-size: var(--font-size-sm);
    line-height: 1;
}

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

.theme-toggle__btn.active {
    background: var(--risa-purple);
    color: #ffffff;
}

.sidebar[data-collapsed="true"] .theme-toggle {
    flex-direction: column;
    padding: var(--spacing-xs);
}

.sidebar[data-collapsed="true"] .theme-toggle__btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
}

/* Sidebar Backdrop (Mobile) */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1029;
    opacity: 0;
    transition: opacity 0.3s;
}

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

/* ============================================
   Responsive Sidebar (Mobile)
   ============================================ */
@media (max-width: 767.98px) {
    .sidebar {
        width: var(--sidebar-width);
        transform: translateX(-100%);
        transition: transform var(--sidebar-transition);
    }

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

    .sidebar[data-collapsed="true"] {
        width: var(--sidebar-width);
    }

    .sidebar-toggle {
        display: none;
    }

    .layout-with-sidebar .main-content {
        margin-left: 0;
    }

    .layout-with-sidebar.sidebar-collapsed .main-content {
        margin-left: 0;
    }

    /* Show sidebar items fully on mobile */
    .sidebar[data-collapsed="true"] .sidebar-item__content {
        opacity: 1;
        width: auto;
        margin-left: 0.75rem;
    }

    .sidebar[data-collapsed="true"] .sidebar-badge {
        right: 0.75rem;
        top: 50%;
        transform: translateY(-50%);
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: var(--font-size-xs);
    }
}

/* Mobile Hamburger Button */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: var(--font-size-2xl);
    padding: 0.5rem;
    cursor: pointer;
}

@media (max-width: 767.98px) {
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ============================================
   Header Updates for Sidebar Layout
   ============================================ */
.header-with-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    z-index: 1040;
}

/* ============================================
   Sidebar Active Item Pulse Animation
   ============================================ */
@keyframes sidebar-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(75, 167, 190, 0.4);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(75, 167, 190, 0.2);
    }
}

.sidebar-item--active {
    animation: sidebar-pulse 2s ease-in-out infinite;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .sidebar-item--active {
        animation: none;
    }
}

/* ============================================
   Additional Dark Theme Fixes
   ============================================ */

/* Dark theme: Inline table styles (commonly used in setup templates) */
[data-theme="dark"] table {
    color: #e8e8e8;
}

[data-theme="dark"] table th,
[data-theme="dark"] table td {
    color: #e8e8e8;
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] table thead tr {
    background-color: var(--risa-purple);
}

[data-theme="dark"] table tbody tr {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* Dark theme: Document row hover (dashboard) */
[data-theme="dark"] .doc-row:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Dark theme: Textarea and readonly inputs */
[data-theme="dark"] textarea.form-control[readonly] {
    background-color: #363636 !important;
    color: #f0f0f0 !important;
    border-color: rgba(255, 255, 255, 0.2);
}

/* Dark theme: font-monospace code displays */
[data-theme="dark"] .font-monospace {
    color: #f0a0a0;
}

/* Dark theme: table-borderless still needs text color */
[data-theme="dark"] .table-borderless td,
[data-theme="dark"] .table-borderless th {
    color: #e8e8e8;
}

/* Dark theme: help text and form text */
[data-theme="dark"] .help-text,
[data-theme="dark"] .form-text {
    color: #a0a0b0 !important;
}

/* Dark theme: ordered/unordered lists */
[data-theme="dark"] ol,
[data-theme="dark"] ul {
    color: #d8d8e0;
}

[data-theme="dark"] li {
    color: #d8d8e0;
}

/* Dark theme: table-light and table-sm variations */
[data-theme="dark"] .table-light {
    --bs-table-bg: #363636;
    --bs-table-color: #e8e8e8;
}

[data-theme="dark"] .table-light th {
    background-color: #363636 !important;
    color: #e8e8e8 !important;
}

/* Dark theme: stat cards on dashboard */
[data-theme="dark"] .stat-card {
    background-color: #2d2d2d;
}

[data-theme="dark"] .stat-card h2,
[data-theme="dark"] .stat-card h6 {
    color: #e8e8e8;
}

/* Dark theme: Bootstrap text utilities */
[data-theme="dark"] .text-body {
    color: #e8e8e8 !important;
}

/* Dark theme: collapsed accordion styling */
[data-theme="dark"] .accordion-button.collapsed {
    background-color: #2d2d2d;
    color: #e8e8e8;
}

/* Dark theme: bg-transparent with text */
[data-theme="dark"] .bg-transparent {
    color: #e8e8e8;
}

/* Dark theme: select dropdown options */
[data-theme="dark"] select option {
    background-color: #2d2d2d;
    color: #f5f5f5;
}

/* Dark theme: btn-outline variants */
[data-theme="dark"] .btn-outline-secondary {
    color: #b0b0c0;
    border-color: #b0b0c0;
}

[data-theme="dark"] .btn-outline-secondary:hover {
    color: #ffffff;
    background-color: #505060;
    border-color: #505060;
}

[data-theme="dark"] .btn-outline-primary {
    color: #b8a0d8;
    border-color: #b8a0d8;
}

[data-theme="dark"] .btn-outline-primary:hover {
    color: #ffffff;
    background-color: var(--risa-purple);
    border-color: var(--risa-purple);
}

/* Dark theme: spinner */
[data-theme="dark"] .spinner-border {
    color: var(--risa-teal);
}

/* Dark theme: stretched link text */
[data-theme="dark"] .stretched-link {
    color: inherit;
}

/* Dark theme: visually hidden labels (for form accessibility) */
[data-theme="dark"] .visually-hidden {
    color: #e8e8e8;
}

/* Dark theme: table-secondary row (used for inactive users) */
[data-theme="dark"] .table-secondary {
    --bs-table-bg: #3a3a4a;
    --bs-table-color: #c0c0c8;
}

[data-theme="dark"] .table-secondary td,
[data-theme="dark"] .table-secondary th {
    background-color: #3a3a4a;
    color: #c0c0c8;
}

/* Dark theme: table-danger row (error rows in Activity Log) */
[data-theme="dark"] .table-danger {
    --bs-table-bg: rgba(220, 53, 69, 0.15);
    --bs-table-color: #f5f5f5;
    --bs-table-hover-bg: rgba(220, 53, 69, 0.25);
    --bs-table-hover-color: #f5f5f5;
}

[data-theme="dark"] .table-danger td,
[data-theme="dark"] .table-danger th {
    background-color: rgba(220, 53, 69, 0.15);
    color: #f5f5f5;
}

[data-theme="dark"] .table-hover .table-danger:hover td,
[data-theme="dark"] .table-hover .table-danger:hover th {
    background-color: rgba(220, 53, 69, 0.25) !important;
    color: #f5f5f5 !important;
}

/* Dark theme: table-warning row (needs-review rows in Activity Log) */
[data-theme="dark"] .table-warning {
    --bs-table-bg: rgba(255, 193, 7, 0.15);
    --bs-table-color: #f5f5f5;
    --bs-table-hover-bg: rgba(255, 193, 7, 0.25);
    --bs-table-hover-color: #f5f5f5;
}

[data-theme="dark"] .table-warning td,
[data-theme="dark"] .table-warning th {
    background-color: rgba(255, 193, 7, 0.15);
    color: #f5f5f5;
}

[data-theme="dark"] .table-hover .table-warning:hover td,
[data-theme="dark"] .table-hover .table-warning:hover th {
    background-color: rgba(255, 193, 7, 0.25) !important;
    color: #f5f5f5 !important;
}

/* Dark theme: btn-outline-success and danger */
[data-theme="dark"] .btn-outline-success {
    color: #75d695;
    border-color: #75d695;
}

[data-theme="dark"] .btn-outline-success:hover {
    color: #ffffff;
    background-color: #28a745;
    border-color: #28a745;
}

[data-theme="dark"] .btn-outline-danger {
    color: #f08090;
    border-color: #f08090;
}

[data-theme="dark"] .btn-outline-danger:hover {
    color: #ffffff;
    background-color: #dc3545;
    border-color: #dc3545;
}

/* Dark theme: btn-link for copy buttons */
[data-theme="dark"] .btn-link {
    color: var(--risa-teal);
}

/* Dark theme: card border variants */
[data-theme="dark"] .card.border-info {
    border-color: rgba(75, 167, 190, 0.5) !important;
}

[data-theme="dark"] .card.border-success {
    border-color: rgba(40, 167, 69, 0.5) !important;
}

[data-theme="dark"] .card.border-primary {
    border-color: rgba(68, 52, 116, 0.5) !important;
}

/* Dark theme: collapsed info panel header */
[data-theme="dark"] .card-header[data-bs-toggle="collapse"] {
    cursor: pointer;
}

[data-theme="dark"] .card-header.bg-info.bg-opacity-10 {
    background-color: rgba(75, 167, 190, 0.1) !important;
    color: #7fc8d8;
}

/* Dark theme: RPA card styles */
[data-theme="dark"] .card.border-secondary {
    border-color: rgba(128, 128, 140, 0.5) !important;
}

/* Dark theme: strong and bold text */
[data-theme="dark"] strong {
    color: #f0f0f0;
}

[data-theme="dark"] b {
    color: #f0f0f0;
}

/* ============================================
   Accordion Chevron Visibility Fix
   ============================================ */

/* Hide default Bootstrap accordion arrow since we're using custom chevron */
.accordion-button.has-custom-chevron::after {
    display: none;
}

/* Custom accordion chevron */
.accordion-chevron {
    transition: transform 0.2s ease;
    font-size: var(--font-size-base);
    flex-shrink: 0;
}

.accordion-button:not(.collapsed) .accordion-chevron {
    transform: rotate(180deg);
}

/* Dark theme: Ensure accordion text and icons are visible */
[data-theme="dark"] .accordion-button {
    color: #e8e8e8;
}

[data-theme="dark"] .accordion-button::after {
    filter: invert(1) grayscale(100%) brightness(200%);
}

[data-theme="dark"] .accordion-button .accordion-chevron {
    color: #a0a0b0;
}

[data-theme="dark"] .accordion-button:not(.collapsed) .accordion-chevron {
    color: #ffffff;
}

/* ============================================
   Webhook Row — clean single-row per webhook
   ============================================ */

.webhook-row {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--card-border, rgba(0, 0, 0, 0.06));
}

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

.webhook-row__status {
    flex-shrink: 0;
    width: 2rem;
    text-align: center;
    font-size: 1.25rem;
    align-self: center;
}

.webhook-row__body {
    flex: 1;
    min-width: 0;
}

.webhook-row__name {
    font-weight: 600;
    font-size: var(--font-size-base);
    margin-bottom: 0.25rem;
}

.webhook-row__hint {
    color: var(--text-help-light, #6c757d);
    font-size: var(--font-size-sm);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

[data-theme="dark"] .webhook-row__hint {
    color: var(--text-help-dark);
}

.webhook-row__url {
    max-width: 600px;
}

.webhook-row__url .form-control {
    font-size: 0.8125rem;
    text-overflow: ellipsis;
}

/* ============================================
   Webhook Card — self-contained card per webhook
   ============================================ */

.webhook-card {
    border: 1px solid var(--card-border, rgba(0, 0, 0, 0.06));
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.webhook-card__header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid var(--card-border, rgba(0, 0, 0, 0.06));
}

.webhook-card__step {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--risa-purple);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.webhook-card__name {
    font-weight: 600;
    flex: 1;
}

.webhook-card__status {
    flex-shrink: 0;
    width: 2rem;
    text-align: center;
}

.webhook-card__body {
    padding: 0.75rem 1rem;
}

.webhook-card__url {
    max-width: 600px;
    margin-bottom: 0.625rem;
}

.webhook-card__url .form-control {
    font-size: 0.8125rem;
    text-overflow: ellipsis;
}

/* Config zone — flexible content area (populated via caller()) */
.webhook-card__config {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--card-border, rgba(0, 0, 0, 0.1));
}

/* Key-value field row */
.webhook-card__field {
    display: flex;
    gap: 0.75rem;
    padding: 0.125rem 0;
    font-size: var(--font-size-sm);
    line-height: 1.4;
}

.webhook-card__field-label {
    flex-shrink: 0;
    width: 5rem;
    color: var(--text-help-light, #6c757d);
}

.webhook-card__field-value {
    font-weight: 500;
}

/* Secret row — masked input + copy */
.webhook-card__field--secret {
    align-items: center;
    margin-top: 0.25rem;
}

.webhook-card__field-copy {
    flex: 1;
    max-width: 360px;
}

.webhook-card__field-copy .form-control {
    font-size: 0.8125rem;
}

/* Instruction note */
.webhook-card__note {
    font-size: var(--font-size-sm);
    color: var(--text-help-light, #6c757d);
    margin-top: 0.375rem;
    font-style: italic;
}

/* Dark mode */
[data-bs-theme="dark"] .webhook-card {
    border-color: var(--border-dark);
}

[data-bs-theme="dark"] .webhook-card__header {
    background: rgba(255, 255, 255, 0.04);
    border-bottom-color: var(--border-dark);
}

[data-bs-theme="dark"] .webhook-card__config {
    border-top-color: var(--border-dark);
}

[data-bs-theme="dark"] .webhook-card__field-label,
[data-bs-theme="dark"] .webhook-card__note {
    color: var(--text-help-dark);
}

/* ============================================
   Setup Steps — numbered instruction list
   ============================================ */

.setup-steps {
    padding-left: 1.25rem;
    margin-bottom: 1rem;
}

.setup-steps li {
    padding: 0.375rem 0;
}

.setup-steps li + li {
    border-top: 1px solid var(--card-border, rgba(0, 0, 0, 0.06));
}

/* ============================================
   Wizard Navigation (Site-Wide Step Indicator)
   ============================================ */

.wizard-nav {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--card-border, rgba(0, 0, 0, 0.1));
    margin-bottom: 1.5rem;
    background: var(--card-bg, #fff);
}

.wizard-steps {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 0;
    flex-wrap: wrap;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.wizard-step__circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--font-size-base);
    background: var(--card-bg, #fff);
    border: 2px solid var(--border-light-strong); /* IMPROVED: 3:1 visible */
    color: var(--content-text, #212529);
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.wizard-step--active .wizard-step__circle {
    background: var(--risa-purple);
    border-color: var(--risa-purple);
    color: white;
    box-shadow: 0 0 0 4px rgba(68, 52, 116, 0.2);
    animation: wizardPulse 2s ease-in-out infinite;
}

.wizard-step--completed .wizard-step__circle {
    background: #28a745;
    border-color: #28a745;
    color: white;
}

.wizard-step--locked .wizard-step__circle {
    opacity: 0.4;
    cursor: not-allowed;
}

.wizard-step__label {
    margin-top: var(--spacing-sm);
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--content-text, #212529);
    text-align: center;
    max-width: 100px;
    line-height: 1.2;
}

.wizard-step--active .wizard-step__label {
    font-weight: 600;
    color: var(--risa-purple);
}

.wizard-step--completed .wizard-step__label {
    color: #28a745;
}

.wizard-step--locked .wizard-step__label {
    opacity: 0.4;
}

.wizard-step__connector {
    width: 80px;
    height: 2px;
    background: var(--border-light-strong); /* IMPROVED: #808080 = 3:1 visible */
    margin: 0 0.25rem;
    margin-top: 21px; /* Center with circle */
    flex-shrink: 0;
}

.wizard-step__connector--completed {
    background: #28a745;
}

@keyframes wizardPulse {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(68, 52, 116, 0.2);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(68, 52, 116, 0.1);
    }
}

/* Dark theme wizard */
[data-theme="dark"] .wizard-nav {
    background: var(--card-bg);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .wizard-step__circle {
    background: var(--card-bg);
    border-color: var(--border-dark-strong); /* IMPROVED: 3:1 visible */
    color: var(--content-text);
}

[data-theme="dark"] .wizard-step--active .wizard-step__circle {
    background: var(--risa-purple);
    border-color: var(--risa-purple);
    color: white;
}

[data-theme="dark"] .wizard-step--completed .wizard-step__circle {
    background: #28a745;
    border-color: #28a745;
}

[data-theme="dark"] .wizard-step__connector {
    background: var(--border-dark-strong); /* IMPROVED: #707070 = 3:1 visible */
}

[data-theme="dark"] .wizard-step__connector--completed {
    background: #28a745;
}

[data-theme="dark"] .wizard-step--active .wizard-step__label {
    color: #b8a0d8;
}

/* Wizard content panels */
.wizard-panel {
    display: none;
}

.wizard-panel.active {
    display: block;
    animation: wizardFadeIn 0.3s ease;
}

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

/* Completed step summary (collapsed view) */
.wizard-summary {
    border-left: 3px solid #28a745;
    padding: 0.75rem 1rem;
    border-radius: 0 0.375rem 0.375rem 0;
    margin-bottom: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s ease;
}

/* Light mode - stronger visibility */
[data-theme="light"] .wizard-summary {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.25), rgba(40, 167, 69, 0.15));
}

[data-theme="light"] .wizard-summary:hover {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.35), rgba(40, 167, 69, 0.25));
}

/* Dark mode - keep existing subtle styling */
[data-theme="dark"] .wizard-summary {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.12), rgba(40, 167, 69, 0.05));
}

[data-theme="dark"] .wizard-summary:hover {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.15), rgba(40, 167, 69, 0.1));
}

.wizard-summary__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.wizard-summary__check {
    color: #28a745;
    font-size: var(--font-size-xl);
}

.wizard-summary__edit {
    color: var(--risa-teal);
    font-size: var(--font-size-sm);
}

[data-theme="dark"] .wizard-summary {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.15), rgba(40, 167, 69, 0.08));
}

[data-theme="dark"] .wizard-summary:hover {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.2), rgba(40, 167, 69, 0.12));
}

/* Setup Required Banner */
.setup-required-banner {
    border-left: 4px solid #ffc107;
    border-radius: 0.5rem;
    padding: var(--spacing-lg) var(--spacing-xl);
    margin-bottom: 1.5rem;
}

/* Light mode - stronger visibility for warning banners */
[data-theme="light"] .setup-required-banner {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.3), rgba(255, 193, 7, 0.2));
    border: 1px solid rgba(255, 193, 7, 0.45);
}

.setup-required-banner__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #856404;
    margin-bottom: 0.25rem;
}

.setup-required-banner__title i {
    font-size: var(--font-size-xl);
}

[data-theme="dark"] .setup-required-banner {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.12), rgba(255, 193, 7, 0.05));
    border: 1px solid rgba(255, 193, 7, 0.25);
}

[data-theme="dark"] .setup-required-banner__title {
    color: #ffd54f;
}

/* Next Step guidance box */
.wizard-next-step {
    border-left: 4px solid var(--risa-teal);
    padding: var(--spacing-lg) var(--spacing-xl);
    border-radius: 0 0.5rem 0.5rem 0;
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Light mode - prominent next step indicator */
[data-theme="light"] .wizard-next-step {
    background: linear-gradient(135deg, rgba(75, 167, 190, 0.25), rgba(75, 167, 190, 0.15));
}

.wizard-next-step__text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wizard-next-step__text i {
    color: var(--risa-teal);
    font-size: var(--font-size-xl);
}

[data-theme="dark"] .wizard-next-step {
    background: linear-gradient(135deg, rgba(75, 167, 190, 0.12), rgba(75, 167, 190, 0.05));
}

/* Mobile: Vertical wizard */
@media (max-width: 576px) {
    .wizard-steps {
        flex-direction: column;
        align-items: flex-start;
        padding-left: 1rem;
    }

    .wizard-step {
        flex-direction: row;
        margin-bottom: var(--spacing-sm);
    }

    .wizard-step__circle {
        width: 36px;
        height: 36px;
        font-size: var(--font-size-sm);
    }

    .wizard-step__label {
        margin-top: 0;
        margin-left: 0.75rem;
        max-width: none;
        text-align: left;
    }

    .wizard-step__connector {
        position: absolute;
        left: 17px;
        top: 36px;
        width: 2px;
        height: 24px;
        margin: 0;
    }
}

/* Accessibility: Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .wizard-step--active .wizard-step__circle {
        animation: none;
    }

    .wizard-panel.active {
        animation: none;
    }
}

/* ============================================
   RPA Record Page Styles
   ============================================ */

/* Browser container */
.rpa-record-page #browser-container {
    background: #1a1a2e;
    border-radius: 8px;
    overflow: hidden;
}

.rpa-record-page #browser-view {
    width: 100%;
    height: 700px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0d0d1a;
}

.rpa-record-page #browser-view img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.rpa-record-page #browser-view.recording {
    border: 3px solid #dc3545;
    box-shadow: 0 0 20px rgba(220, 53, 69, 0.3);
}

.rpa-record-page .browser-placeholder {
    text-align: center;
    color: var(--text-help-light);  /* #5a5f66 = 7.3:1 AAA in light mode */
}

.rpa-record-page .browser-placeholder i {
    font-size: var(--font-size-5xl);
    opacity: 0.5;
}

/* URL bar */
.rpa-record-page .url-bar {
    background: #3d3d5c;
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: 10px;
}

.rpa-record-page .url-bar input {
    flex: 1;
    background: #1a1a2e;
    border: 1px solid #4d4d6d;
    color: #fff;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 4px;
}

.rpa-record-page .url-bar input:focus {
    outline: none;
    border-color: var(--risa-purple);
}

/* Status bar */
.rpa-record-page .status-bar {
    background: #2d2d44;
    color: #fff;
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: var(--font-size-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Step list */
.rpa-record-page .step-list {
    max-height: 300px;
    overflow-y: auto;
}

.rpa-record-page .step-item {
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid #eee;
    font-size: var(--font-size-xs);
    display: flex;
    align-items: center;
}

.rpa-record-page .step-number {
    width: 22px;
    height: 22px;
    background: var(--risa-purple);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    font-weight: bold;
    margin-right: var(--spacing-sm);
}

.rpa-record-page .recording-indicator {
    animation: pulse-recording 1.5s infinite;
}

@keyframes pulse-recording {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   Typing Bar - Progressive Disclosure UI
   ============================================ */

/* Typing bar - base styling with glassmorphism */
.rpa-record-page .typing-bar {
    background: linear-gradient(135deg, rgba(45, 45, 68, 0.95) 0%, rgba(58, 58, 92, 0.95) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: var(--spacing-lg) var(--spacing-xl);
    display: none; /* Hidden by default */
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    border-top: 3px solid #ffc107;
    border-bottom: 1px solid rgba(255, 193, 7, 0.3);
    transition: all 0.3s ease;
    box-shadow: 0 -4px 20px rgba(255, 193, 7, 0.15),
                0 4px 15px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 10;
}

/* Only show when JavaScript adds js-visible class during recording */
.rpa-record-page .typing-bar.js-visible {
    display: flex !important;
    animation: typing-bar-entrance 0.4s ease-out;
}

@keyframes typing-bar-entrance {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rpa-record-page .typing-bar.success {
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.95) 0%, rgba(32, 168, 103, 0.95) 100%);
    border-top-color: #28a745;
    box-shadow: 0 -4px 20px rgba(40, 167, 69, 0.2),
                0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Subtle glow animation on the bar to draw attention */
.rpa-record-page .typing-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 193, 7, 0.8) 50%,
        transparent 100%);
    animation: glow-sweep 3s ease-in-out infinite;
}

@keyframes glow-sweep {
    0%, 100% { opacity: 0.3; transform: translateX(-100%); }
    50% { opacity: 1; transform: translateX(100%); }
}

/* Flow step indicators */
.rpa-record-page .typing-flow-step {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.rpa-record-page .typing-flow-step.active {
    background: rgba(255, 193, 7, 0.15);
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.2);
}

.rpa-record-page .typing-flow-step .flow-num {
    width: 26px;
    height: 26px;
    background: var(--text-secondary-light);  /* #2d2d2d */
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    font-weight: bold;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.rpa-record-page .typing-flow-step .flow-num.active {
    background: linear-gradient(135deg, #ffc107 0%, #ffca2c 100%);
    color: #212529;
    animation: pulse-glow 1.5s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(255, 193, 7, 0.6),
                0 0 24px rgba(255, 193, 7, 0.3);
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1); box-shadow: 0 0 12px rgba(255, 193, 7, 0.6); }
    50% { transform: scale(1.1); box-shadow: 0 0 20px rgba(255, 193, 7, 0.8); }
}

.rpa-record-page .typing-flow-step .flow-num.completed {
    background: linear-gradient(135deg, #198754 0%, #20c997 100%);
    box-shadow: 0 0 10px rgba(25, 135, 84, 0.5);
}

.rpa-record-page .typing-input-group .flow-num,
.rpa-record-page .typing-nav-group .flow-num {
    margin-right: 2px;
}

/* Flow arrow between steps */
.rpa-record-page .typing-flow-arrow {
    color: var(--text-help-light);  /* #5a5f66 = 7.3:1 AAA in light mode */
    font-size: var(--font-size-lg);
    margin: 0 2px;
    opacity: 0.6;
    transition: all 0.3s ease;
}

.rpa-record-page .typing-flow-arrow.active {
    color: #ffc107;
    opacity: 1;
    text-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
}

/* Input group styling - primary action area */
.rpa-record-page .typing-input-group {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: var(--spacing-xs) var(--spacing-md);
    transition: all 0.3s ease;
}

.rpa-record-page .typing-input-group:focus-within {
    background: rgba(0, 0, 0, 0.35);
    border-color: rgba(255, 193, 7, 0.5);
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.1);
}

.rpa-record-page .typing-bar input {
    flex: 1;
    background: rgba(26, 26, 46, 0.8);
    border: 2px solid #4d4d6d;
    color: #fff;
    padding: var(--spacing-md) var(--spacing-sm);
    border-radius: 6px;
    min-width: 180px;
    font-size: var(--font-size-base);
    transition: all 0.2s ease;
}

.rpa-record-page .typing-bar input::placeholder {
    color: #888;
}

.rpa-record-page .typing-bar input:focus {
    outline: none;
    border-color: #ffc107;
    background: rgba(26, 26, 46, 1);
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.25),
                0 0 20px rgba(255, 193, 7, 0.1);
}

/* Dropdown helper group */
.rpa-record-page .typing-dropdown-group {
    display: flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.2) 0%, rgba(255, 152, 0, 0.15) 100%);
    border: 2px solid rgba(255, 193, 7, 0.6);
    border-radius: 8px;
    padding: var(--spacing-xs) var(--spacing-md);
    position: relative;
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.rpa-record-page .typing-dropdown-group .btn {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.rpa-record-page .typing-dropdown-group .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

/* Date field group */
.rpa-record-page .typing-date-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.2) 0%, rgba(0, 86, 179, 0.15) 100%);
    border: 2px solid rgba(13, 110, 253, 0.6);
    border-radius: 8px;
    padding: var(--spacing-xs) var(--spacing-md);
    position: relative;
    box-shadow: 0 0 15px rgba(13, 110, 253, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.rpa-record-page .date-template-select {
    background: rgba(26, 26, 46, 0.9);
    border: 2px solid #4d4d6d;
    color: #fff;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 6px;
    min-width: 180px;
    font-size: var(--font-size-sm);
    cursor: pointer;
}

.rpa-record-page .date-template-select:focus {
    border-color: #0d6efd;
    outline: none;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

.rpa-record-page .date-template-select option {
    background: #1a1a2e;
    color: #fff;
}

.rpa-record-page .date-template-select optgroup {
    background: #2d2d4a;
    color: var(--text-secondary-light);  /* #2d2d2d = 13.1:1 AAA in light mode */
    font-style: normal;
}

.rpa-record-page .typing-date-group .btn {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

/* Navigation button group */
.rpa-record-page .typing-nav-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: var(--spacing-xs) var(--spacing-md);
}

.rpa-record-page .typing-nav-group .btn {
    white-space: nowrap;
    font-weight: 500;
    padding: var(--spacing-sm) var(--spacing-md);
    transition: all 0.2s ease;
}

.rpa-record-page .typing-nav-group .btn:hover {
    transform: translateY(-1px);
}

.rpa-record-page .typing-nav-group .btn-success {
    box-shadow: 0 2px 10px rgba(25, 135, 84, 0.3);
}

.rpa-record-page .typing-nav-group .btn-success:hover {
    box-shadow: 0 4px 15px rgba(25, 135, 84, 0.4);
}

/* Status indicator */
.rpa-record-page .typing-bar .typing-status {
    font-size: var(--font-size-xs);
    color: var(--text-help-light);  /* #5a5f66 = 7.3:1 AAA */
    white-space: nowrap;
    margin-left: auto;
    padding: var(--spacing-xs) var(--spacing-sm);
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}

.rpa-record-page .typing-bar .typing-status:empty {
    display: none;
}

/* Progressive Disclosure - Hidden state */
.rpa-record-page .typing-bar .hidden {
    display: none !important;
}

/* Step context display */
.rpa-record-page .step-context {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.rpa-record-page .step-label {
    font-weight: 600;
    font-size: var(--font-size-xs);
}

.rpa-record-page .step-detail {
    font-size: var(--font-size-xs);
    opacity: 0.8;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Step 2 container */
.rpa-record-page .typing-step-2-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    animation: fadeSlideIn 0.3s ease-out;
}

.rpa-record-page .typing-step-2-container > .hidden {
    display: none !important;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Element type selector */
.rpa-record-page .element-type-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.25);
    border: 2px dashed rgba(255, 193, 7, 0.4);
    border-radius: 8px;
    padding: var(--spacing-xs) var(--spacing-md);
    animation: pulse-border 2s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% { border-color: rgba(255, 193, 7, 0.4); }
    50% { border-color: rgba(255, 193, 7, 0.8); }
}

.rpa-record-page .element-type-selector .btn {
    padding: 0.25rem 0.5rem;
    font-size: var(--font-size-xs);
}

.rpa-record-page .element-type-selector .btn:hover {
    transform: scale(1.05);
}

/* Button group styling */
.rpa-record-page .typing-button-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(108, 117, 125, 0.2);
    border: 1px solid rgba(108, 117, 125, 0.4);
    border-radius: 8px;
    padding: var(--spacing-sm) var(--spacing-md);
}

/* Reveal animations */
.rpa-record-page .typing-input-group:not(.hidden),
.rpa-record-page .typing-dropdown-group:not(.hidden),
.rpa-record-page .typing-button-group:not(.hidden),
.rpa-record-page .typing-nav-group:not(.hidden) {
    animation: revealStep 0.4s ease-out;
}

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

/* Arrow active state */
.rpa-record-page .typing-flow-arrow:not(.hidden) {
    animation: arrowPulse 0.3s ease-out;
}

@keyframes arrowPulse {
    0% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

/* Help tooltip on hover */
.rpa-record-page .typing-bar [data-help] {
    position: relative;
}

.rpa-record-page .typing-bar [data-help]:has([data-help]:hover)::after,
.rpa-record-page .typing-bar [data-help]:has([data-help]:hover)::before {
    display: none !important;
}

.rpa-record-page .typing-bar [data-help]:hover::after {
    content: attr(data-help);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #212529;
    color: #fff;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 6px;
    font-size: var(--font-size-xs);
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: 1px solid #ffc107;
    min-width: 180px;
    max-width: 280px;
    width: max-content;
    white-space: normal;
    text-align: center;
    line-height: 1.4;
}

.rpa-record-page .typing-bar [data-help]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #ffc107;
    z-index: 1001;
}

.rpa-record-page .typing-bar button[data-help]:hover::after {
    min-width: 150px;
}

/* Click ripple animation */
.rpa-record-page .click-indicator {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid #dc3545;
    border-radius: 50%;
    pointer-events: none;
    animation: click-ripple 0.5s ease-out forwards;
}

@keyframes click-ripple {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

/* Credential prompts */
.rpa-record-page .credential-prompt {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    animation: slideDown 0.3s ease-out;
}

.rpa-record-page .credential-prompt .alert {
    border: 2px solid #ffc107;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
    white-space: nowrap;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.rpa-record-page .credential-prompt.hidden {
    display: none !important;
}

/* Password field mode */
.rpa-record-page .typing-input-group.password-mode {
    border: 2px solid #ffc107;
    background: rgba(255, 193, 7, 0.1);
}

.rpa-record-page .typing-input-group.password-mode #type-input {
    -webkit-text-security: disc;
}

/* Username field prompt */
.rpa-record-page .username-prompt {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    animation: slideDown 0.3s ease-out;
}

.rpa-record-page .username-prompt .alert {
    border: 2px solid #0d6efd;
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.3);
    white-space: nowrap;
}

.rpa-record-page .username-prompt.hidden {
    display: none !important;
}

/* Username field mode */
.rpa-record-page .typing-input-group.username-mode {
    border: 2px solid #0d6efd;
    background: rgba(13, 110, 253, 0.1);
}

/* Credential dropdown styling */
.rpa-record-page #credential-dropdown .dropdown-menu {
    min-width: 220px;
}

.rpa-record-page #credential-dropdown .dropdown-item code {
    background: rgba(255, 193, 7, 0.2);
    padding: var(--spacing-xs) var(--spacing-xs);
    border-radius: 3px;
    font-size: var(--font-size-xs);
}

.rpa-record-page #credential-dropdown .dropdown-item:hover code {
    background: rgba(255, 193, 7, 0.4);
}

/* Mode override menu (3-dot) */
.rpa-record-page .mode-override-menu {
    position: relative;
    display: inline-block;
}

.rpa-record-page .mode-override-btn {
    background: transparent;
    border: none;
    color: var(--text-help-light);  /* #5a5f66 = 7.3:1 AAA in light mode */
    padding: var(--spacing-xs) var(--spacing-xs);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.rpa-record-page .mode-override-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffc107;
}

.rpa-record-page .mode-override-dropdown {
    position: absolute;
    bottom: calc(100% + 5px);
    right: 0;
    background: #2d2d44;
    border: 1px solid #4d4d6d;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    min-width: 140px;
    z-index: 100;
    display: none;
}

.rpa-record-page .mode-override-dropdown.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

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

.rpa-record-page .mode-override-dropdown .dropdown-header {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: var(--font-size-xs);
    color: var(--text-help-light);  /* #5a5f66 = 7.3:1 AAA */
    border-bottom: 1px solid #4d4d6d;
}

.rpa-record-page .mode-override-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: var(--spacing-sm) var(--spacing-md);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
    font-size: var(--font-size-xs);
}

.rpa-record-page .mode-override-dropdown .dropdown-item:hover {
    background: rgba(255, 193, 7, 0.15);
}

.rpa-record-page .mode-override-dropdown .dropdown-item.active {
    background: rgba(255, 193, 7, 0.25);
    color: #ffc107;
}

.rpa-record-page .mode-override-dropdown .dropdown-item i {
    width: 16px;
    text-align: center;
}

/* Page tabs */
.rpa-record-page .page-tabs {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: var(--spacing-xs) var(--spacing-sm);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rpa-record-page .page-tabs.hidden {
    display: none !important;
}

.rpa-record-page .page-tabs .btn {
    font-size: var(--font-size-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
}

.rpa-record-page .page-tabs .btn-primary {
    background: var(--risa-purple);
    border-color: var(--risa-purple);
}

.rpa-record-page .page-tabs-label {
    font-size: var(--font-size-xs);
    color: var(--text-help-light);  /* #5a5f66 = 7.3:1 AAA */
    margin-right: var(--spacing-xs);
}

/* Download item */
.rpa-record-page .download-item {
    padding: var(--spacing-xs) var(--spacing-sm);
    background: rgba(25, 135, 84, 0.1);
    border-radius: 4px;
    margin-bottom: var(--spacing-xs);
}

/* Toast Notifications */
.rpa-record-page .toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rpa-record-page .toast-notification {
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: 8px;
    color: white;
    font-size: var(--font-size-sm);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rpa-record-page .toast-notification.success { background: #198754; }
.rpa-record-page .toast-notification.info { background: #0d6efd; }
.rpa-record-page .toast-notification.error { background: #dc3545; }
.rpa-record-page .toast-notification.warning { background: #ffc107; color: #212529; }

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

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

/* Version Update Toast */
.version-toast {
    border: none;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    min-width: 360px;
}

.version-toast .toast-body {
    background: var(--gradient-primary);
    color: #fff;
    padding: 12px 16px;
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.version-toast .btn-close {
    filter: brightness(0) invert(1);
}

.version-toast .version-toast-btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.5);
    font-weight: 600;
    white-space: nowrap;
}

.version-toast .version-toast-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
}

/* Force consistent appearance regardless of page theme */
[data-theme="dark"] .version-toast .toast-body {
    background: var(--gradient-primary);
    color: #fff;
}

/* ============================================
   System Health Page Styles
   ============================================ */

/* Health card status indicators - use themeable status variables */
.system-health-page .health-card.unknown {
    border-left-color: var(--status-unknown);
}

.system-health-page .status-indicator.unknown {
    background-color: var(--status-unknown);
}

/* Light mode adjustments for status indicators handled by global status rules above (lines 734-757) */

/* Complete System Health page styles - moved from inline template */
.system-health-page .health-card {
    border-left: 4px solid;
    transition: all 0.2s ease;
}
.system-health-page .health-card.healthy { border-left-color: var(--status-click); }
.system-health-page .health-card.warning { border-left-color: var(--status-wait); }
.system-health-page .health-card.error { border-left-color: #dc3545; }

.system-health-page .status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: var(--spacing-sm);
}
.system-health-page .status-indicator.healthy { background-color: var(--status-click); }
.system-health-page .status-indicator.warning { background-color: var(--status-wait); }
.system-health-page .status-indicator.error { background-color: #dc3545; }

.system-health-page .log-entry {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: var(--font-size-xs);
    padding: 0.5rem;
    border-bottom: 1px solid var(--card-border, rgba(0,0,0,0.1));
}
.system-health-page .log-entry:last-child {
    border-bottom: none;
}
.system-health-page .log-entry.error { background-color: rgba(220, 53, 69, 0.1); }
.system-health-page .log-entry.warning { background-color: rgba(255, 193, 7, 0.1); }

.system-health-page .log-timestamp {
    color: var(--text-help-light);
    min-width: 180px;
}
.system-health-page .log-level {
    font-weight: 600;
    min-width: 70px;
}
.system-health-page .log-level.error { color: #dc3545; }
.system-health-page .log-level.warning { color: var(--status-wait); }
.system-health-page .log-level.info { color: var(--status-type); }
.system-health-page .log-level.debug { color: var(--status-unknown); }

.system-health-page .metric-value {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    line-height: 1;
}
.system-health-page .metric-label {
    font-size: var(--font-size-sm);
    color: var(--text-help-light);
}

.system-health-page .refresh-spin {
    animation: system-health-spin 1s linear infinite;
}
@keyframes system-health-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Light mode overrides for System Health page */
[data-theme="light"] .system-health-page .health-card.warning {
    border-left-color: var(--status-wait-light);
}

[data-theme="light"] .system-health-page .status-indicator.warning {
    background-color: var(--status-wait-light);
}

[data-theme="light"] .system-health-page .log-level.warning {
    color: var(--status-wait-light);  /* #856404 = 7.9:1 AAA */
}

[data-theme="light"] .system-health-page .log-level.info {
    color: var(--status-type-light);  /* #087990 = 7.1:1 AAA */
}

[data-theme="light"] .system-health-page .log-level.debug {
    color: var(--text-tertiary-light);  /* #4a4a4a = 9.7:1 AAA */
}

[data-theme="light"] .system-health-page .log-entry.warning {
    background-color: rgba(133, 100, 4, 0.1);  /* Darker amber tint */
}

/* ============================================
   Dashboard Index Page Styles
   ============================================ */

/* Dashboard index page styles - moved from inline */
.dashboard-index .stat-card {
    border-left: 4px solid;
}
.dashboard-index .stat-card.pending { border-left-color: var(--status-wait); }
.dashboard-index .stat-card.assigned { border-left-color: var(--status-navigate); }
.dashboard-index .stat-card.processed { border-left-color: var(--status-click); }
.dashboard-index .stat-card.triage { border-left-color: #dc3545; }

.dashboard-index .doc-row:hover {
    background-color: var(--bs-table-hover-bg, rgba(0,0,0,0.02));
}
.dashboard-index .confidence-badge {
    font-size: var(--font-size-xs);
    padding: 0.25em 0.5em;
}
.dashboard-index .confidence-high { background-color: var(--status-click); }
.dashboard-index .confidence-medium { background-color: var(--status-wait); color: #000; }
.dashboard-index .confidence-low { background-color: #dc3545; }

/* Light mode overrides */
[data-theme="light"] .dashboard-index .stat-card.pending {
    border-left-color: var(--status-wait-light);
}
[data-theme="light"] .dashboard-index .confidence-medium {
    background-color: var(--status-wait-light);
    color: #fff;  /* White text on dark amber */
}

.dashboard-confirm-modal .modal-dialog {
    max-width: 29rem;
}

.dashboard-confirm-modal__content {
    border: 1px solid var(--card-border, rgba(0, 0, 0, 0.125));
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 1.5rem 3.5rem rgba(0, 0, 0, 0.22);
}

.dashboard-confirm-modal__body {
    padding: var(--spacing-xl, 1.5rem);
}

.dashboard-confirm-modal__hero {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg, 1rem);
    margin-bottom: var(--spacing-lg, 1rem);
}

.dashboard-confirm-modal__icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.25rem;
    color: var(--risa-purple);
    background: linear-gradient(135deg, rgba(68, 52, 116, 0.16), rgba(75, 167, 190, 0.16));
}

.dashboard-confirm-modal__icon--danger {
    color: #b42318;
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.14), rgba(180, 35, 24, 0.18));
}

.dashboard-confirm-modal__title {
    margin: 0;
    color: var(--text-primary-light);
}

.dashboard-confirm-modal__footer {
    padding: 0 var(--spacing-xl, 1.5rem) var(--spacing-xl, 1.5rem);
    border-top: 0;
    gap: var(--spacing-sm, 0.5rem);
}

[data-theme="dark"] .dashboard-confirm-modal__content {
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 1.5rem 3.5rem rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .dashboard-confirm-modal__icon {
    color: #d7c8f3;
    background: linear-gradient(135deg, rgba(104, 85, 166, 0.28), rgba(75, 167, 190, 0.2));
}

[data-theme="dark"] .dashboard-confirm-modal__icon--danger {
    color: #ffb4ab;
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.22), rgba(180, 35, 24, 0.24));
}

[data-theme="dark"] .dashboard-confirm-modal__title {
    color: var(--text-primary-dark);
}

@media (max-width: 575.98px) {
    .dashboard-confirm-modal .modal-dialog {
        margin: var(--spacing-lg, 1rem);
    }
}

/* ============================================
   Dashboard Triage Page Styles
   ============================================ */

/* Dashboard triage page styles - moved from inline */
.dashboard-triage .confidence-badge {
    font-size: var(--font-size-xs);
    padding: 0.25em 0.5em;
}
.dashboard-triage .confidence-high { background-color: var(--status-click); }
.dashboard-triage .confidence-medium { background-color: var(--status-wait); color: #000; }
.dashboard-triage .confidence-low { background-color: #dc3545; }

/* Light mode overrides */
[data-theme="light"] .dashboard-triage .confidence-medium {
    background-color: var(--status-wait-light);
    color: #fff;
}

/* ============================================
   Inbox Layout — Master-Detail Split Pane
   Two-panel email-inbox-style layout for
   the document review dashboard.
   ============================================ */

/* --- Dashboard flex wrapper (fills remaining viewport after page header) --- */
.dashboard-index {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height, 56px) - 3rem);
    /* 3rem = main-content padding (1.5rem top + 1.5rem bottom) */
    min-height: 0;
}

/* --- Main Grid Container --- */
.inbox-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    grid-template-rows: auto 1fr;
    flex: 1;
    min-height: 0;
    gap: 0;
    border: 1px solid var(--border-light, #b0b0b0);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    background: var(--card-bg, #fff);
    transition: grid-template-columns 0.3s ease;
}

[data-theme="dark"] .inbox-layout {
    border-color: var(--border-dark, #505050);
}

/* Preview open: 3 columns */
.inbox-layout--preview-open {
    grid-template-columns: 380px 1fr 1fr;
}

/* List collapsed: thin strip + detail */
.inbox-layout--list-collapsed {
    grid-template-columns: 40px 1fr;
}

/* Both collapsed + preview */
.inbox-layout--list-collapsed.inbox-layout--preview-open {
    grid-template-columns: 40px 1fr 1fr;
}

/* Disable transition during drag */
.inbox-layout--dragging {
    transition: none !important;
}

/* --- Stats bar spans full width --- */
.inbox-stats {
    grid-column: 1 / -1;
    display: flex;
    gap: var(--spacing-xl, 1.5rem);
    padding: var(--spacing-sm, 0.5rem) var(--spacing-lg, 1rem);
    border-bottom: 1px solid var(--border-light, #b0b0b0);
    flex-wrap: wrap;
    align-items: center;
}

[data-theme="dark"] .inbox-stats {
    border-color: var(--border-dark, #505050);
}

.inbox-stats__item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs, 0.25rem);
    font-size: var(--font-size-sm, 0.875rem);
    white-space: nowrap;
}

.inbox-stats__count {
    font-weight: 700;
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: var(--font-size-lg, 1.125rem);
}

/* --- List Header + Collapse --- */
.inbox-list__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xs, 0.25rem) var(--spacing-md, 0.75rem);
    border-bottom: 1px solid var(--border-light, #b0b0b0);
    min-height: 32px;
}

[data-theme="dark"] .inbox-list__header {
    border-color: var(--border-dark, #505050);
}

.inbox-list__title {
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: 600;
}

.inbox-list__collapse-btn {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    border-radius: 4px;
    opacity: 0.6;
    transition: opacity 0.15s, background-color 0.15s;
}

.inbox-list__collapse-btn:hover {
    opacity: 1;
    background: rgba(75, 167, 190, 0.08);
}

/* Expand strip (shown when list collapsed) */
.inbox-list-expand {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: var(--spacing-sm, 0.5rem);
    border-right: 1px solid var(--border-light, #b0b0b0);
    background: var(--card-bg, #fff);
}

[data-theme="dark"] .inbox-list-expand {
    border-right-color: var(--border-dark, #505050);
    background: var(--surface-bg, #1e1e1e);
}

.inbox-list-expand__btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light, #b0b0b0);
    border-radius: 6px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.15s;
}

[data-theme="dark"] .inbox-list-expand__btn {
    border-color: var(--border-dark, #505050);
}

.inbox-list-expand__btn:hover {
    background: rgba(75, 167, 190, 0.08);
}

/* --- Left Panel: Document List --- */
.inbox-list {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-light, #b0b0b0);
    overflow: hidden;
    min-width: 0;
}

[data-theme="dark"] .inbox-list {
    border-right-color: var(--border-dark, #505050);
}

.inbox-list__filters {
    padding: var(--spacing-sm, 0.5rem) var(--spacing-md, 0.75rem);
    border-bottom: 1px solid var(--border-light, #b0b0b0);
    display: flex;
    gap: var(--spacing-xs, 0.25rem);
    flex-wrap: nowrap;
    align-items: center;
}

[data-theme="dark"] .inbox-list__filters {
    border-color: var(--border-dark, #505050);
}

/* Status pill tabs */
.inbox-filter-pills {
    display: inline-flex;
    border: 1px solid var(--border-light, #b0b0b0);
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

[data-theme="dark"] .inbox-filter-pills {
    border-color: var(--border-dark, #505050);
}

.inbox-filter-pill {
    padding: 0.2rem 0.5rem;
    font-size: var(--font-size-xs, 0.75rem);
    font-weight: 500;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s, color 0.15s;
}

.inbox-filter-pill + .inbox-filter-pill {
    border-left: 1px solid var(--border-light, #b0b0b0);
}

[data-theme="dark"] .inbox-filter-pill + .inbox-filter-pill {
    border-left-color: var(--border-dark, #505050);
}

.inbox-filter-pill:hover {
    background: rgba(75, 167, 190, 0.08);
}

.inbox-filter-pill--active {
    background: var(--risa-teal, #4BA7BE);
    color: #fff;
}

.inbox-filter-pill--active:hover {
    background: var(--risa-teal, #4BA7BE);
}

/* Compact category dropdown */
.inbox-filter-compact {
    max-width: 130px;
    font-size: var(--font-size-xs, 0.75rem) !important;
    padding: 0.2rem 1.8rem 0.2rem 0.4rem !important;
    height: auto !important;
    flex: 1;
    min-width: 0;
}

/* Sort icon button */
.inbox-filter-sort {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light, #b0b0b0);
    border-radius: 6px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 0.875rem;
    transition: background-color 0.15s;
}

[data-theme="dark"] .inbox-filter-sort {
    border-color: var(--border-dark, #505050);
}

.inbox-filter-sort:hover {
    background: rgba(75, 167, 190, 0.08);
}

.inbox-list__count {
    padding: var(--spacing-xs, 0.25rem) var(--spacing-md, 0.75rem);
    font-size: var(--font-size-xs, 0.75rem);
    border-bottom: 1px solid var(--border-light, #b0b0b0);
}

[data-theme="dark"] .inbox-list__count {
    border-color: var(--border-dark, #505050);
}

.inbox-list__scroll {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* --- Inbox Item (single row) --- */
.inbox-item {
    display: flex;
    flex-direction: column;
    padding: var(--spacing-md, 0.75rem) var(--spacing-lg, 1rem);
    border-bottom: 1px solid var(--border-light, #b0b0b0);
    cursor: pointer;
    transition: background-color 0.15s;
    position: relative;
    gap: 3px;
    text-decoration: none;
    color: inherit;
}

[data-theme="dark"] .inbox-item {
    border-color: var(--border-dark, #505050);
}

.inbox-item:hover {
    background-color: rgba(75, 167, 190, 0.06);
    text-decoration: none;
    color: inherit;
}

[data-theme="dark"] .inbox-item:hover {
    background-color: rgba(75, 167, 190, 0.10);
}

/* Light mode - more visible active state */
.inbox-item--active {
    background-color: rgba(75, 167, 190, 0.22);
    border-left: 3px solid var(--risa-teal, #4BA7BE);
    padding-left: calc(var(--spacing-lg, 1rem) - 3px);
}

.inbox-item--active:hover {
    background-color: rgba(75, 167, 190, 0.22);
}

/* Dark mode - keep subtle appearance */
[data-theme="dark"] .inbox-item--active {
    background-color: rgba(75, 167, 190, 0.12);
}

[data-theme="dark"] .inbox-item--active:hover {
    background-color: rgba(75, 167, 190, 0.12);
}

.inbox-item:focus-visible {
    outline: var(--focus-ring-width, 2px) solid var(--focus-ring-light, #2c6d7e);
    outline-offset: -2px;
    z-index: 1;
}

[data-theme="dark"] .inbox-item:focus-visible {
    outline-color: var(--focus-ring-dark, #70d4e8);
}

/* Row 1: filename + amount */
.inbox-item__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--spacing-sm, 0.5rem);
}

.inbox-item__filename {
    font-weight: 600;
    font-size: var(--font-size-sm, 0.875rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.inbox-item__amount {
    font-weight: 600;
    font-size: var(--font-size-sm, 0.875rem);
    white-space: nowrap;
    font-family: 'Outfit', system-ui, sans-serif;
}

/* Row 2: vendor + badges */
.inbox-item__meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-sm, 0.5rem);
    font-size: var(--font-size-xs, 0.75rem);
}

.inbox-item__vendor {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.inbox-item__badges {
    display: flex;
    gap: var(--spacing-xs, 0.25rem);
    align-items: center;
    flex-shrink: 0;
}

.inbox-item__time {
    font-size: var(--font-size-xs, 0.75rem);
    opacity: 0.7;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Triage badge in list */
.inbox-item__triage {
    font-size: 0.625rem;
    padding: 1px 5px;
    border-radius: 3px;
    background-color: #dc3545;
    color: #fff;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Right Panel: Detail Pane --- */
.inbox-detail {
    overflow-y: auto;
    padding: var(--spacing-xl, 1.5rem);
    overscroll-behavior: contain;
}

.inbox-detail__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: var(--spacing-lg, 1rem);
    opacity: 0.5;
}

.inbox-detail__empty i {
    font-size: 3rem;
}

/* Loading skeleton */
.inbox-detail__loading {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg, 1rem);
}

.inbox-detail__loading .skeleton {
    background: linear-gradient(90deg,
        rgba(128, 128, 128, 0.15) 25%,
        transparent 50%,
        rgba(128, 128, 128, 0.15) 75%);
    background-size: 200% 100%;
    animation: inboxSkeletonShimmer 1.5s infinite;
    border-radius: 4px;
    height: 1rem;
}

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

@media (prefers-reduced-motion: reduce) {
    .inbox-detail__loading .skeleton {
        animation: none;
        background: rgba(128, 128, 128, 0.15);
    }
}

/* Detail header */
.inbox-detail__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-lg, 1rem);
    margin-bottom: var(--spacing-xl, 1.5rem);
    flex-wrap: wrap;
}

.inbox-detail__title {
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: var(--font-size-xl, 1.25rem);
    font-weight: 600;
    margin: 0;
    word-break: break-word;
}

.inbox-detail__actions {
    display: flex;
    gap: var(--spacing-sm, 0.5rem);
    flex-shrink: 0;
}

/* Metadata grid */
.inbox-detail__meta {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--spacing-md, 0.75rem) var(--spacing-xl, 1.5rem);
    margin-bottom: var(--spacing-xl, 1.5rem);
    padding: var(--spacing-lg, 1rem);
    border: 1px solid var(--border-light, #b0b0b0);
    border-radius: 6px;
}

[data-theme="dark"] .inbox-detail__meta {
    border-color: var(--border-dark, #505050);
}

.inbox-detail__field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.inbox-detail__meta--summary {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg, 1rem);
}

.inbox-detail__meta-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--spacing-md, 0.75rem) var(--spacing-xl, 1.5rem);
}

.inbox-detail__meta-group--overview {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.inbox-detail__meta-group--financial {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-md, 0.75rem);
    padding-top: var(--spacing-md, 0.75rem);
    border-top: 1px solid var(--border-light, #b0b0b0);
}

[data-theme="dark"] .inbox-detail__meta-group--financial {
    border-top-color: var(--border-dark, #505050);
}

.inbox-detail__summary-items {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm, 0.5rem);
    width: 100%;
}

.inbox-detail__summary-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px 160px;
    gap: var(--spacing-md, 0.75rem);
    align-items: center;
    padding-bottom: var(--spacing-sm, 0.5rem);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .inbox-detail__summary-item {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.inbox-detail__summary-item-main,
.inbox-detail__summary-item-amount,
.inbox-detail__summary-item-account {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.inbox-detail__summary-item-amount {
    text-align: right;
}

.inbox-detail__summary-footer {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--spacing-md, 0.75rem) var(--spacing-xl, 1.5rem);
    width: 100%;
}

.inbox-detail__summary-footer--three-up {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.inbox-detail__summary-footer--totals {
    grid-template-columns: minmax(0, 1fr) 120px 160px;
}

.inbox-detail__summary-footer-spacer {
    min-height: 1px;
}

@media (max-width: 767.98px) {
    .inbox-detail__meta-group--overview,
    .inbox-detail__summary-item,
    .inbox-detail__summary-footer--totals,
    .inbox-detail__summary-footer--three-up {
        grid-template-columns: 1fr;
    }
}

.inbox-detail__label {
    font-size: var(--font-size-xs, 0.75rem);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
    opacity: 0.6;
}

.inbox-detail__value {
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: 500;
}

/* Collapsible sections */
.inbox-detail__section {
    border: 1px solid var(--border-light, #b0b0b0);
    border-radius: 6px;
    margin-bottom: var(--spacing-lg, 1rem);
    overflow: hidden;
}

[data-theme="dark"] .inbox-detail__section {
    border-color: var(--border-dark, #505050);
}

.inbox-detail__section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md, 0.75rem) var(--spacing-lg, 1rem);
    cursor: pointer;
    font-weight: 600;
    font-size: var(--font-size-sm, 0.875rem);
    user-select: none;
    border: none;
    width: 100%;
    color: inherit;
    text-align: left;
    background: transparent;
}

.inbox-detail__section-header:hover {
    background: rgba(75, 167, 190, 0.06);
}

[data-theme="dark"] .inbox-detail__section-header:hover {
    background: rgba(75, 167, 190, 0.10);
}

.inbox-detail__section-body {
    padding: var(--spacing-lg, 1rem);
    border-top: 1px solid var(--border-light, #b0b0b0);
}

[data-theme="dark"] .inbox-detail__section-body {
    border-color: var(--border-dark, #505050);
}

/* Mobile back button (hidden on desktop) */
.inbox-detail__back-btn {
    display: none;
}

/* --- Responsive: Below 992px (lg breakpoint) --- */
@media (max-width: 991.98px) {
    .dashboard-index {
        height: auto;
    }

    .inbox-layout {
        grid-template-columns: 1fr !important;
        height: auto;
        flex: none;
        min-height: calc(100vh - var(--header-height, 56px) - 8rem);
    }

    .inbox-list {
        border-right: none;
        max-height: 50vh;
    }

    .inbox-detail {
        min-height: 50vh;
    }

    /* Hide collapse/expand controls and splitters on mobile */
    .inbox-list__collapse-btn,
    .inbox-list-expand,
    .inbox-splitter {
        display: none !important;
    }

    /* Hide list header on mobile (saves space) */
    .inbox-list__header {
        display: none;
    }

    /* Preview stacks below detail on mobile */
    .inbox-preview {
        border-left: none;
        border-top: 1px solid var(--border-light, #b0b0b0);
        max-height: 50vh;
    }

    /* Mobile overlay: hide list when detail is open */
    .inbox-layout--detail-open .inbox-list {
        display: none;
    }

    .inbox-layout--detail-open .inbox-stats {
        display: none;
    }

    .inbox-layout--detail-open .inbox-detail {
        min-height: calc(100vh - var(--header-height, 56px) - 8rem);
    }

    .inbox-layout--detail-open .inbox-detail__back-btn {
        display: inline-flex;
    }
}

@media (min-width: 992px) {
    .inbox-detail__back-btn {
        display: none !important;
    }
}


/* --- Financial Details conditional section (progressive disclosure) --- */
.inbox-financial-section {
    background: rgba(40, 167, 69, 0.04);
    border: 1px solid rgba(40, 167, 69, 0.15);
    border-radius: 6px;
    padding: var(--spacing-md, 0.75rem);
    margin-top: var(--spacing-xs, 0.25rem);
}

.inbox-financial-section__label {
    font-size: var(--font-size-xs, 0.75rem);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: #28a745;
    margin-bottom: var(--spacing-sm, 0.5rem);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs, 0.25rem);
}

[data-theme="dark"] .inbox-financial-section {
    background: rgba(40, 167, 69, 0.08);
    border-color: rgba(40, 167, 69, 0.20);
}

[data-theme="dark"] .inbox-financial-section__label {
    color: #5fd87e;
}

[data-theme="light"] .inbox-financial-section {
    background: rgba(40, 167, 69, 0.06);
    border-color: rgba(40, 167, 69, 0.20);
}

[data-theme="light"] .inbox-financial-section__label {
    color: #1e7e34;
}


/* --- Nested Sub-Accordion (inside Correct & Assign) --- */
.inbox-sub-accordion {
    border: 1px solid var(--border-light, #b0b0b0);
    border-radius: 6px;
    margin-bottom: var(--spacing-sm, 0.5rem);
    overflow: hidden;
}

[data-theme="dark"] .inbox-sub-accordion {
    border-color: var(--border-dark, #505050);
}

.inbox-sub-accordion__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm, 0.5rem) var(--spacing-md, 0.75rem);
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: 600;
    cursor: pointer;
    border: none;
    width: 100%;
    text-align: left;
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .inbox-sub-accordion__header {
    background: rgba(255, 255, 255, 0.03);
}

.inbox-sub-accordion__header:hover {
    background: rgba(75, 167, 190, 0.06);
}

[data-theme="dark"] .inbox-sub-accordion__header:hover {
    background: rgba(75, 167, 190, 0.10);
}

.inbox-sub-accordion__body {
    padding: var(--spacing-md, 0.75rem);
    border-top: 1px solid var(--border-light, #b0b0b0);
}

[data-theme="dark"] .inbox-sub-accordion__body {
    border-color: var(--border-dark, #505050);
}

/* Financial variant */
.inbox-sub-accordion--financial {
    border-color: rgba(40, 167, 69, 0.25);
}

.inbox-sub-accordion--financial .inbox-sub-accordion__header {
    background: rgba(40, 167, 69, 0.04);
    color: #1e7e34;
}

[data-theme="dark"] .inbox-sub-accordion--financial .inbox-sub-accordion__header {
    background: rgba(40, 167, 69, 0.08);
    color: #5fd87e;
}

/* Clerical variant */
.inbox-sub-accordion--clerical {
    border-color: rgba(75, 167, 190, 0.25);
}

.inbox-sub-accordion--clerical .inbox-sub-accordion__header {
    background: rgba(75, 167, 190, 0.04);
    color: var(--risa-teal-dark, #3a8599);
}

[data-theme="dark"] .inbox-sub-accordion--clerical .inbox-sub-accordion__header {
    background: rgba(75, 167, 190, 0.08);
    color: var(--risa-teal, #4BA7BE);
}

/* Advanced toggle link */
.inbox-sub-accordion__advanced-toggle {
    font-size: var(--font-size-xs, 0.75rem);
    cursor: pointer;
    color: var(--risa-teal-dark, #3a8599);
    border: none;
    background: none;
    padding: 0;
    text-decoration: underline;
}

.inbox-sub-accordion__advanced-toggle:hover {
    color: var(--risa-teal, #4BA7BE);
}

/* Naming rule summary (read-only) */
.inbox-rule-summary {
    font-size: var(--font-size-sm, 0.875rem);
    padding: var(--spacing-xs, 0.25rem) 0;
}

.inbox-rule-summary__template {
    font-family: monospace;
    font-size: var(--font-size-xs, 0.75rem);
    background: rgba(0, 0, 0, 0.04);
    padding: 2px 6px;
    border-radius: 3px;
}

[data-theme="dark"] .inbox-rule-summary__template {
    background: rgba(255, 255, 255, 0.06);
}

.vendor-defaults__section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm, 0.5rem);
}

.vendor-defaults__section-heading {
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: 600;
    color: inherit;
}

.vendor-defaults__section-help {
    font-size: var(--font-size-xs, 0.75rem);
    color: var(--text-muted, #6c757d);
    line-height: 1.45;
}

[data-theme="dark"] .vendor-defaults__section-help {
    color: rgba(255, 255, 255, 0.68);
}

.vendor-defaults__setting-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--spacing-md, 0.75rem);
    padding: var(--spacing-sm, 0.5rem) 0;
}

.vendor-defaults__setting-copy {
    flex: 1 1 auto;
    min-width: 0;
}

.vendor-defaults__setting-title {
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: 600;
    margin-bottom: 2px;
}

.vendor-defaults__setting-control {
    flex: 0 0 260px;
    max-width: 260px;
}

.vendor-defaults__option-notes {
    display: grid;
    gap: 4px;
}

.vendor-defaults__scope-guide {
    line-height: 1.45;
}

@media (max-width: 767.98px) {
    .vendor-defaults__setting-row {
        flex-direction: column;
    }

    .vendor-defaults__setting-control {
        flex-basis: auto;
        max-width: none;
        width: 100%;
    }
}


/* --- OCR Line Items Display --- */
.inbox-detail__line-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.inbox-detail__line-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--spacing-sm, 0.5rem);
    font-size: var(--font-size-sm, 0.875rem);
    padding: 2px var(--spacing-xs, 0.25rem);
    border-radius: 3px;
}

.inbox-detail__line-item:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .inbox-detail__line-item:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}


/* --- Preview Pane (3rd column) --- */
.inbox-preview {
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-light, #b0b0b0);
    overflow: hidden;
}

[data-theme="dark"] .inbox-preview {
    border-left-color: var(--border-dark, #505050);
}

.inbox-preview__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm, 0.5rem) var(--spacing-md, 0.75rem);
    border-bottom: 1px solid var(--border-light, #b0b0b0);
    background: rgba(75, 167, 190, 0.04);
    flex-shrink: 0;
}

[data-theme="dark"] .inbox-preview__header {
    border-color: var(--border-dark, #505050);
    background: rgba(75, 167, 190, 0.08);
}

.inbox-preview__title {
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: 600;
}

.inbox-preview__actions {
    display: flex;
    gap: var(--spacing-xs, 0.25rem);
}

.inbox-preview__body {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.inbox-preview__frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: var(--card-bg, #fff);
}

[data-theme="dark"] .inbox-preview__frame {
    background: var(--surface-bg, #1e1e1e);
}

.inbox-preview__image {
    width: 100%;
    height: auto;
    display: none;
    object-fit: contain;
}

/* --- Splitter Handles (drag to resize panes) --- */
.inbox-splitter {
    position: absolute;
    width: 6px;
    cursor: col-resize;
    z-index: 10;
    background: transparent;
    transition: background-color 0.15s;
    touch-action: none;
    user-select: none;
}

.inbox-splitter:hover {
    background: rgba(75, 167, 190, 0.15);
}

.inbox-splitter--active {
    background: rgba(75, 167, 190, 0.3);
}

.inbox-splitter::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 3px;
    height: 28px;
    border-radius: 2px;
    background: var(--risa-teal, #4BA7BE);
    opacity: 0;
    transition: opacity 0.15s;
}

.inbox-splitter:hover::after,
.inbox-splitter--active::after {
    opacity: 0.5;
}

[data-theme="dark"] .inbox-splitter:hover {
    background: rgba(75, 167, 190, 0.2);
}

[data-theme="dark"] .inbox-splitter--active {
    background: rgba(75, 167, 190, 0.35);
}


/* ============================================
   SPACING UTILITIES - Replace Bootstrap
   Use our 8px grid tokens
   ============================================ */

/* Margin utilities */
.m-0 { margin: 0 !important; }
.m-xs { margin: var(--spacing-xs) !important; }
.m-sm { margin: var(--spacing-sm) !important; }
.m-md { margin: var(--spacing-md) !important; }
.m-lg { margin: var(--spacing-lg) !important; }
.m-xl { margin: var(--spacing-xl) !important; }
.m-2xl { margin: var(--spacing-2xl) !important; }

/* Margin-top */
.mt-0 { margin-top: 0 !important; }
.mt-xs { margin-top: var(--spacing-xs) !important; }
.mt-sm { margin-top: var(--spacing-sm) !important; }
.mt-md { margin-top: var(--spacing-md) !important; }
.mt-lg { margin-top: var(--spacing-lg) !important; }
.mt-xl { margin-top: var(--spacing-xl) !important; }
.mt-2xl { margin-top: var(--spacing-2xl) !important; }

/* Margin-bottom */
.mb-0 { margin-bottom: 0 !important; }
.mb-xs { margin-bottom: var(--spacing-xs) !important; }
.mb-sm { margin-bottom: var(--spacing-sm) !important; }
.mb-md { margin-bottom: var(--spacing-md) !important; }
.mb-lg { margin-bottom: var(--spacing-lg) !important; }
.mb-xl { margin-bottom: var(--spacing-xl) !important; }
.mb-2xl { margin-bottom: var(--spacing-2xl) !important; }

/* Margin-inline-end (right in LTR) */
.me-0 { margin-inline-end: 0 !important; }
.me-xs { margin-inline-end: var(--spacing-xs) !important; }
.me-sm { margin-inline-end: var(--spacing-sm) !important; }
.me-md { margin-inline-end: var(--spacing-md) !important; }
.me-lg { margin-inline-end: var(--spacing-lg) !important; }
.me-xl { margin-inline-end: var(--spacing-xl) !important; }

/* Margin-inline-start (left in LTR) */
.ms-0 { margin-inline-start: 0 !important; }
.ms-xs { margin-inline-start: var(--spacing-xs) !important; }
.ms-sm { margin-inline-start: var(--spacing-sm) !important; }
.ms-md { margin-inline-start: var(--spacing-md) !important; }
.ms-lg { margin-inline-start: var(--spacing-lg) !important; }
.ms-xl { margin-inline-start: var(--spacing-xl) !important; }

/* Padding utilities */
.p-0 { padding: 0 !important; }
.p-xs { padding: var(--spacing-xs) !important; }
.p-sm { padding: var(--spacing-sm) !important; }
.p-md { padding: var(--spacing-md) !important; }
.p-lg { padding: var(--spacing-lg) !important; }
.p-xl { padding: var(--spacing-xl) !important; }
.p-2xl { padding: var(--spacing-2xl) !important; }

/* Padding-top */
.pt-0 { padding-top: 0 !important; }
.pt-xs { padding-top: var(--spacing-xs) !important; }
.pt-sm { padding-top: var(--spacing-sm) !important; }
.pt-md { padding-top: var(--spacing-md) !important; }
.pt-lg { padding-top: var(--spacing-lg) !important; }
.pt-xl { padding-top: var(--spacing-xl) !important; }

/* Padding-bottom */
.pb-0 { padding-bottom: 0 !important; }
.pb-xs { padding-bottom: var(--spacing-xs) !important; }
.pb-sm { padding-bottom: var(--spacing-sm) !important; }
.pb-md { padding-bottom: var(--spacing-md) !important; }
.pb-lg { padding-bottom: var(--spacing-lg) !important; }
.pb-xl { padding-bottom: var(--spacing-xl) !important; }

/* Padding-inline */
.px-0 { padding-inline: 0 !important; }
.px-xs { padding-inline: var(--spacing-xs) !important; }
.px-sm { padding-inline: var(--spacing-sm) !important; }
.px-md { padding-inline: var(--spacing-md) !important; }
.px-lg { padding-inline: var(--spacing-lg) !important; }
.px-xl { padding-inline: var(--spacing-xl) !important; }

/* Padding-block */
.py-0 { padding-block: 0 !important; }
.py-xs { padding-block: var(--spacing-xs) !important; }
.py-sm { padding-block: var(--spacing-sm) !important; }
.py-md { padding-block: var(--spacing-md) !important; }
.py-lg { padding-block: var(--spacing-lg) !important; }
.py-xl { padding-block: var(--spacing-xl) !important; }

/* Gap utilities (for flexbox/grid) */
.gap-0 { gap: 0 !important; }
.gap-xs { gap: var(--spacing-xs) !important; }
.gap-sm { gap: var(--spacing-sm) !important; }
.gap-md { gap: var(--spacing-md) !important; }
.gap-lg { gap: var(--spacing-lg) !important; }
.gap-xl { gap: var(--spacing-xl) !important; }

/* Icon sizing utilities - replace inline font-size styles */
.icon-size-sm { font-size: var(--font-size-xl) !important; }   /* 1.25rem / 20px */
.icon-size-md { font-size: var(--font-size-3xl) !important; }  /* 2rem / 32px */
.icon-size-lg { font-size: var(--font-size-4xl) !important; }  /* 2.5rem / 40px */
.icon-size-xl { font-size: var(--font-size-5xl) !important; }  /* 4rem / 64px */

/* ============================================================
   Provider Selection Component
   Stacked radio list for setup_storage, setup_bookkeeping,
   setup_email_scanner provider selection sections.
   ============================================================ */

.provider-select {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Individual option row — clickable label wrapping a radio input */
.provider-select__option {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
    background: var(--card-bg, #fff);
}

/* Align radio, icon, and name on the same horizontal line */
.provider-select__option .form-check-input {
    margin-top: 0.3rem;
}

/* Stack with shared borders */
.provider-select__option:first-child { border-radius: 0.5rem 0.5rem 0 0; }
.provider-select__option:last-child  { border-radius: 0 0 0.5rem 0.5rem; }
.provider-select__option + .provider-select__option { border-top: 0; }
.provider-select__option:only-child { border-radius: 0.5rem; }

/* Hover */
.provider-select__option:hover:not(.provider-select__option--disabled) {
    background-color: rgba(75, 167, 190, 0.06);
}

/* Selected state — teal left border + subtle background */
.provider-select__option--selected {
    border-color: var(--risa-teal);
    border-left: 3px solid var(--risa-teal);
    background-color: rgba(75, 167, 190, 0.08);
}

/* Disabled / Coming Soon */
.provider-select__option--disabled {
    opacity: 0.55;
    cursor: default;
    pointer-events: none;
}

/* Icon */
.provider-select__icon {
    font-size: 1.5rem;
    width: 2rem;
    text-align: center;
    flex-shrink: 0;
    padding-top: 0.1rem;
}
.provider-select__icon img {
    width: 1.5rem;
    height: 1.5rem;
    object-fit: contain;
}

/* Text block */
.provider-select__content { flex: 1; }
.provider-select__name {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.provider-select__desc {
    font-size: 0.85rem;
    color: var(--text-secondary-light, #6c757d);
    margin-top: 0.125rem;
}

/* Badge on the right */
.provider-select__badge { flex-shrink: 0; }

/* "Coming Soon" compact row — inline list below active options */
.provider-select__coming-soon {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary-light, #6c757d);
    border: 1px dashed var(--border-light);
    border-radius: 0.375rem;
    background: transparent;
}
.provider-select__coming-soon strong {
    font-weight: 600;
    margin-right: 0.25rem;
}

/* Dark mode overrides */
[data-bs-theme="dark"] .provider-select__option {
    border-color: var(--border-light-strong);
    background: var(--card-bg);
}
[data-bs-theme="dark"] .provider-select__option--selected {
    border-color: var(--risa-teal);
    background-color: rgba(75, 167, 190, 0.12);
}
[data-bs-theme="dark"] .provider-select__coming-soon {
    border-color: var(--border-light-strong);
}

/* ============================================================
   Provider Card — Flat rows for setup_storage provider picker.
   Uses same teal accent pattern as .provider-select.
   ============================================================ */

.provider-card {
    border: 1px solid var(--border-light);
    border-radius: 0.5rem !important;
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.provider-card__row {
    background: var(--card-bg, var(--risa-white));
}
.provider-card__row:hover {
    background-color: rgba(75, 167, 190, 0.06); /* --risa-teal at 6% */
}
.provider-card__icon {
    font-size: var(--font-size-2xl);
    width: 2rem;
    text-align: center;
    flex-shrink: 0;
}
.provider-card__icon img {
    width: 2rem;
    height: 2rem;
    object-fit: contain;
}
.provider-card__name {
    font-weight: 600;
    font-size: var(--font-size-base);
}
.provider-card--selected {
    border-color: var(--risa-teal);
    border-left: 3px solid var(--risa-teal);
    box-shadow: 0 0 0 1px rgba(75, 167, 190, 0.15); /* --risa-teal at 15% */
}
.provider-card--disabled { opacity: 0.55; } /* Match .provider-select__option--disabled */

/* Dark mode */
[data-bs-theme="dark"] .provider-card {
    border-color: var(--border-dark);
}
[data-bs-theme="dark"] .provider-card__row {
    background: var(--card-bg, #2d2d2d);
}
[data-bs-theme="dark"] .provider-card--selected {
    border-color: var(--risa-teal);
    background-color: rgba(75, 167, 190, 0.12); /* --risa-teal at 12% (dark mode) */
}

/* Light mode explicit (match provider-select pattern) */
[data-bs-theme="light"] .provider-card {
    border-color: var(--border-light);
}
[data-bs-theme="light"] .provider-card__row {
    background: var(--card-bg, var(--risa-white));
}
[data-bs-theme="light"] .provider-card--selected {
    background-color: rgba(75, 167, 190, 0.08); /* --risa-teal at 8% (light mode) */
}

/* Provider badge in accordion headers (shows selected provider icon + name) */
.setup-accordion__provider-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: var(--font-size-base);
}
.setup-accordion__provider-badge i {
    font-size: 1.5rem;
}
.setup-accordion__provider-badge img {
    width: 1.5rem;
    height: 1.5rem;
    object-fit: contain;
}

/* ============================================================
   Provider Brand Logos
   <img>-based brand icons with size variants matching
   existing <i> icon contexts.
   ============================================================ */
.provider-logo {
    display: inline-block;
    vertical-align: middle;
    object-fit: contain;
    flex-shrink: 0;
}
.provider-logo--sm  { width: 1rem;   height: 1rem; }
.provider-logo--md  { width: 1.5rem; height: 1.5rem; }
.provider-logo--lg  { width: 2rem;   height: 2rem; }
.provider-logo--xl  { width: 2.5rem; height: 2.5rem; }

.provider-logo-fallback {
    display: inline-block;
    text-align: center;
    vertical-align: middle;
    flex-shrink: 0;
}
.provider-logo-fallback--sm  { font-size: 1rem;   width: 1rem; }
.provider-logo-fallback--md  { font-size: 1.5rem; width: 1.5rem; }
.provider-logo-fallback--lg  { font-size: 2rem;   width: 2rem; }
.provider-logo-fallback--xl  { font-size: 2.5rem; width: 2.5rem; }

[data-bs-theme="dark"] .provider-logo--dark-adjust {
    filter: brightness(1.15);
}

/* ============================================
   Setup Section Grid — 4-Column Layout
   Consistent layout for accordion body content:
   Process | Instructions | Video | AI Helper
   ============================================ */
.setup-section-grid {
    display: grid;
    grid-template-columns: 5fr 4fr;
    gap: var(--space-card-gap);
    align-items: start;
}
.setup-section-grid--has-video {
    grid-template-columns: 5fr 4fr 3fr;
}
.setup-section-grid--has-video.setup-section-grid--has-ai {
    grid-template-columns: 5fr 4fr 3fr 3fr;
}
@media (max-width: 991.98px) {
    .setup-section-grid,
    .setup-section-grid--has-video,
    .setup-section-grid--has-video.setup-section-grid--has-ai {
        grid-template-columns: 1fr;
    }
}

.setup-section-grid__process {
    min-width: 0;
}

.setup-section-grid__instructions {
    min-width: 0;
    font-size: var(--font-size-sm);
}

.setup-section-grid__video {
    min-width: 0;
}

.setup-section-grid__ai-helper {
    min-width: 0;
}

/* ============================================
   Guided Step — sequential instruction → field flow
   Used in setup wizards for single-column walkthrough.
   ============================================ */
.guided-step {
    margin-bottom: 1.5rem;
}
.guided-step__header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.guided-step__header h6 {
    margin: 0;
    font-weight: 600;
}
.guided-step__context {
    color: var(--text-help-light);
    font-size: var(--font-size-sm);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}
[data-theme="dark"] .guided-step__context {
    color: var(--text-help-dark);
}
.guided-step__field {
    max-width: 500px;
}
.guided-step__field + .guided-step__context {
    margin-top: 0.75rem;
}

.guided-step__save-status {
    display: inline-block;
    margin-left: 0.5rem;
    font-size: var(--font-size-sm);
    transition: opacity 0.3s;
}

/* ============================================
   Supporting Document: Bill Linking
   ============================================ */

.supporting-badge {
    background-color: var(--risa-teal) !important;
    color: #fff;
    font-size: 0.625rem;
}

[data-theme="dark"] .supporting-badge {
    background-color: var(--risa-teal-dark) !important;
}

.bill-linking-view {
    padding: 0;
}

.bill-search-input {
    font-size: var(--font-size-sm);
}

.bill-search-result {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color-light, #e5e7eb);
    transition: background-color 0.15s ease;
}

[data-theme="dark"] .bill-search-result {
    border-bottom-color: var(--border-color-dark, #374151);
}

.bill-search-result:hover {
    background-color: rgba(75, 167, 190, 0.08);
}

[data-theme="dark"] .bill-search-result:hover {
    background-color: rgba(75, 167, 190, 0.15);
}

.bill-search-result--selected {
    background-color: rgba(75, 167, 190, 0.12);
    border-left: 3px solid var(--risa-teal);
}

[data-theme="dark"] .bill-search-result--selected {
    background-color: rgba(75, 167, 190, 0.2);
}

.link-preview {
    background-color: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    padding: 0.75rem;
}

[data-theme="dark"] .link-preview {
    background-color: #1f2937;
    border-color: #374151;
}

.link-preview__old-name {
    color: var(--text-secondary-light, #6b7280);
}

[data-theme="dark"] .link-preview__old-name {
    color: var(--text-secondary-dark, #9ca3af);
}

.link-preview__new-name {
    color: var(--risa-teal-dark);
    font-weight: 600;
}

[data-theme="dark"] .link-preview__new-name {
    color: var(--risa-teal);
}

.link-type-pill {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
}

.btn-check:checked + .link-type-pill {
    background-color: var(--risa-teal);
    border-color: var(--risa-teal);
    color: #fff;
}

/* ============================================
   Supporting Document: Upload
   ============================================ */

.upload-dropzone {
    border: 2px dashed var(--border-color, #ccc);
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    color: var(--text-muted, #666);
}

.upload-dropzone:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring-light);
    outline-offset: var(--focus-ring-offset);
}

.upload-dropzone:hover,
.upload-dropzone.drag-over {
    border-color: var(--risa-purple);
    background-color: rgba(111, 66, 193, 0.05);
}

.upload-drag-overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    background: rgba(111, 66, 193, 0.1);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px dashed var(--risa-purple);
    border-radius: 0.5rem;
    pointer-events: none;
}

.upload-drag-overlay__content {
    text-align: center;
    color: var(--risa-purple);
}

[data-theme="dark"] .upload-dropzone {
    border-color: #444;
    color: var(--text-muted, #999);
}

[data-theme="dark"] .upload-dropzone:focus-visible {
    outline-color: var(--focus-ring-dark);
}

[data-theme="dark"] .upload-dropzone:hover,
[data-theme="dark"] .upload-dropzone.drag-over {
    border-color: var(--risa-purple);
    background-color: rgba(111, 66, 193, 0.15);
}

[data-theme="dark"] .upload-drag-overlay {
    background: rgba(111, 66, 193, 0.2);
}

/* ============================================
   Legal Pages
   ============================================ */
.container-narrow { max-width: 600px; }
.legal-container { max-width: 800px; margin: 0 auto; }

.legal-card {
    background: var(--risa-white);
    border-radius: 1rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.legal-header {
    background: var(--gradient-primary);
    color: white;
    border-radius: 1rem 1rem 0 0;
    padding: 2rem;
}

.legal-body { padding: 2rem; line-height: 1.7; }
.legal-body h2 { color: var(--risa-purple); margin-top: 2rem; margin-bottom: 1rem; font-size: 1.3rem; }
.legal-body h3 { color: #5a4a8a; margin-top: 1.5rem; margin-bottom: 0.75rem; font-size: 1.1rem; }
.legal-body table { width: 100%; }
.legal-body table th { background: var(--risa-light-gray); }

[data-theme="dark"] .legal-card {
    background: var(--bg-surface, #1e1e2e);
}

[data-theme="dark"] .legal-body h2 { color: var(--risa-teal); }
[data-theme="dark"] .legal-body h3 { color: var(--risa-teal-dark); }
[data-theme="dark"] .legal-body table th { background: var(--bg-surface-alt, #2a2a3e); }

/* ── Folder Mapping Rows (Storage Setup) ── */
.folder-name-col        { white-space: nowrap; min-width: 230px; }  /* col 1: icon + name */
.folder-select-col      { width: 200px; }   /* col 3: dropdown */
.system-folder-label    { width: 160px; }   /* alias */
.category-folder-label  { width: 160px; }   /* alias */

/* ============================================
   RPA Recording Interface
   ============================================ */

/* Global hidden class - highest priority */
.rpa-hidden {
    display: none !important;
    visibility: hidden !important;
}

#browser-container {
    position: relative;
    width: 100%;
    background: #1a1a2e;
    border-radius: 8px;
}
#browser-view {
    width: 100%;
    height: 700px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: crosshair;
    position: relative;
    background: #0d0d1a;
    overflow: hidden;
}
#browser-view img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
#browser-view.recording {
    border: 3px solid #dc3545;
    box-shadow: 0 0 20px rgba(220, 53, 69, 0.3);
}
.browser-placeholder {
    text-align: center;
    color: #6c757d;
}
.browser-placeholder i {
    font-size: 4rem;
    opacity: 0.5;
}
.rpa-step-list {
    max-height: 300px;
    overflow-y: auto;
}
.rpa-step-item {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
}
.rpa-step-item:last-child { border-bottom: none; }
.rpa-step-number {
    width: 22px;
    height: 22px;
    background: var(--risa-purple);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    margin-right: 8px;
    flex-shrink: 0;
}
.rpa-step-icon {
    width: 24px;
    margin-right: 6px;
    text-align: center;
    color: #6c757d;
}
.recording-indicator {
    animation: rpa-pulse 1.5s infinite;
}
@keyframes rpa-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.rpa-status-bar {
    background: #2d2d44;
    color: #fff;
    padding: 8px 15px;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.rpa-url-bar {
    background: #3d3d5c;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.rpa-url-bar input {
    flex: 1;
    background: #1a1a2e;
    border: 1px solid #4d4d6d;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.95rem;
}
.rpa-url-bar input:focus {
    outline: none;
    border-color: var(--risa-purple);
}

/* Typing bar — glassmorphism command bar */
.typing-bar {
    background: linear-gradient(135deg, rgba(45, 45, 68, 0.95) 0%, rgba(58, 58, 92, 0.95) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 16px 20px;
    display: none;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    border-top: 3px solid #ffc107;
    border-bottom: 1px solid rgba(255, 193, 7, 0.3);
    transition: all 0.3s ease;
    box-shadow: 0 -4px 20px rgba(255, 193, 7, 0.15),
                0 4px 15px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 10;
}
.typing-bar.js-visible {
    display: flex !important;
    animation: typing-bar-entrance 0.4s ease-out;
}
@keyframes typing-bar-entrance {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.typing-bar.success {
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.95) 0%, rgba(32, 168, 103, 0.95) 100%);
    border-top-color: #28a745;
    box-shadow: 0 -4px 20px rgba(40, 167, 69, 0.2),
                0 4px 15px rgba(0, 0, 0, 0.3);
}
.typing-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 193, 7, 0.8) 50%,
        transparent 100%);
    animation: rpa-glow-sweep 3s ease-in-out infinite;
}
@keyframes rpa-glow-sweep {
    0%, 100% { opacity: 0.3; transform: translateX(-100%); }
    50% { opacity: 1; transform: translateX(100%); }
}
.typing-bar .hidden {
    display: none !important;
}

/* Flow step indicators */
.typing-flow-step {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    padding: 6px 10px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}
.typing-flow-step.active {
    background: rgba(255, 193, 7, 0.15);
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.2);
}
.typing-flow-step .flow-num {
    width: 26px;
    height: 26px;
    background: #6c757d;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    flex-shrink: 0;
    transition: all 0.3s ease;
}
.typing-flow-step .flow-num.active {
    background: linear-gradient(135deg, #ffc107 0%, #ffca2c 100%);
    color: #212529;
    animation: rpa-pulse-glow 1.5s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(255, 193, 7, 0.6),
                0 0 24px rgba(255, 193, 7, 0.3);
}
@keyframes rpa-pulse-glow {
    0%, 100% { transform: scale(1); box-shadow: 0 0 12px rgba(255, 193, 7, 0.6); }
    50% { transform: scale(1.1); box-shadow: 0 0 20px rgba(255, 193, 7, 0.8); }
}
.typing-flow-step .flow-num.completed {
    background: linear-gradient(135deg, #198754 0%, #20c997 100%);
    box-shadow: 0 0 10px rgba(25, 135, 84, 0.5);
}
.typing-input-group .flow-num,
.typing-nav-group .flow-num { margin-right: 2px; }

/* Flow arrows */
.typing-flow-arrow {
    color: #6c757d;
    font-size: 1.1rem;
    margin: 0 2px;
    opacity: 0.6;
    transition: all 0.3s ease;
}
.typing-flow-arrow.active {
    color: #ffc107;
    opacity: 1;
    text-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
}
.typing-bar > .text-muted.small {
    opacity: 0.7;
    font-style: italic;
}

/* Input group — primary action area */
.typing-input-group {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 6px 10px;
    transition: all 0.3s ease;
}
.typing-input-group:focus-within {
    background: rgba(0, 0, 0, 0.35);
    border-color: rgba(255, 193, 7, 0.5);
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.1);
}
.typing-bar input {
    flex: 1;
    background: rgba(26, 26, 46, 0.8);
    border: 2px solid #4d4d6d;
    color: #fff;
    padding: 10px 14px;
    border-radius: 6px;
    min-width: 180px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}
.typing-bar input::placeholder { color: #888; }
.typing-bar input:focus {
    outline: none;
    border-color: #ffc107;
    background: rgba(26, 26, 46, 1);
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.25),
                0 0 20px rgba(255, 193, 7, 0.1);
}

/* Dropdown helper group */
.typing-dropdown-group {
    display: flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.2) 0%, rgba(255, 152, 0, 0.15) 100%);
    border: 2px solid rgba(255, 193, 7, 0.6);
    border-radius: 8px;
    padding: 6px 10px;
    position: relative;
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.typing-dropdown-group::before { display: none; }
.typing-dropdown-group .btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
    font-weight: 500;
}
.typing-dropdown-group .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

/* Date field group */
.typing-date-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.2) 0%, rgba(0, 86, 179, 0.15) 100%);
    border: 2px solid rgba(13, 110, 253, 0.6);
    border-radius: 8px;
    padding: 6px 10px;
    position: relative;
    box-shadow: 0 0 15px rgba(13, 110, 253, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.typing-date-group::before {
    content: 'Date Field';
    position: absolute;
    top: -8px;
    left: 10px;
    background: #0d6efd;
    color: #fff;
    font-size: 0.6rem;
    font-weight: bold;
    padding: 1px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.date-template-select {
    background: rgba(26, 26, 46, 0.9);
    border: 2px solid #4d4d6d;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    min-width: 180px;
    font-size: 0.9rem;
    cursor: pointer;
}
.date-template-select:focus {
    border-color: #0d6efd;
    outline: none;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}
.date-template-select option { background: #1a1a2e; color: #fff; }
.date-template-select optgroup { background: #2d2d4a; color: #aaa; font-style: normal; }
.typing-date-group .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Navigation button group */
.typing-nav-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 6px 10px;
}
.typing-nav-group .btn {
    white-space: nowrap;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    transition: all 0.2s ease;
}
.typing-nav-group .btn:hover { transform: translateY(-1px); }
.typing-nav-group .btn-success { box-shadow: 0 2px 10px rgba(25, 135, 84, 0.3); }
.typing-nav-group .btn-success:hover { box-shadow: 0 4px 15px rgba(25, 135, 84, 0.4); }

/* Status indicator */
.typing-bar .typing-status {
    font-size: 0.8rem;
    color: #adb5bd;
    white-space: nowrap;
    margin-left: auto;
    padding: 4px 8px;
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}
.typing-bar .typing-status:empty { display: none; }

/* Step context display */
.step-context { display: flex; flex-direction: column; line-height: 1.2; }
.step-label { font-weight: 600; font-size: 0.8rem; }
.step-detail {
    font-size: 0.7rem;
    opacity: 0.8;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Step 2 container */
.typing-step-2-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    animation: rpa-fadeSlideIn 0.3s ease-out;
}
.typing-step-2-container > .hidden { display: none !important; }
@keyframes rpa-fadeSlideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Element type selector */
.element-type-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.25);
    border: 2px dashed rgba(255, 193, 7, 0.4);
    border-radius: 8px;
    padding: 6px 12px;
    animation: rpa-pulse-border 2s ease-in-out infinite;
}
@keyframes rpa-pulse-border {
    0%, 100% { border-color: rgba(255, 193, 7, 0.4); }
    50% { border-color: rgba(255, 193, 7, 0.8); }
}
.element-type-selector .btn { padding: 0.25rem 0.5rem; font-size: 0.75rem; }
.element-type-selector .btn:hover { transform: scale(1.05); }

/* Button group styling */
.typing-button-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(108, 117, 125, 0.2);
    border: 1px solid rgba(108, 117, 125, 0.4);
    border-radius: 8px;
    padding: 8px 12px;
}

/* Reveal animations */
.typing-input-group:not(.hidden),
.typing-dropdown-group:not(.hidden),
.typing-button-group:not(.hidden),
.typing-nav-group:not(.hidden) {
    animation: rpa-revealStep 0.4s ease-out;
}
@keyframes rpa-revealStep {
    from { opacity: 0; transform: translateY(-5px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.typing-flow-arrow:not(.hidden) { animation: rpa-arrowPulse 0.3s ease-out; }
@keyframes rpa-arrowPulse {
    0% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

/* Help tooltips */
.typing-bar [data-help] { position: relative; }
.typing-bar [data-help]:has([data-help]:hover)::after,
.typing-bar [data-help]:has([data-help]:hover)::before { display: none !important; }
.typing-bar [data-help]:hover::after {
    content: attr(data-help);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #212529;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: 1px solid #ffc107;
    min-width: 180px;
    max-width: 280px;
    width: max-content;
    white-space: normal;
    text-align: center;
    line-height: 1.4;
}
.typing-bar [data-help]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #ffc107;
    z-index: 1001;
}
.typing-bar button[data-help]:hover::after { min-width: 150px; }

.click-indicator {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid #dc3545;
    border-radius: 50%;
    pointer-events: none;
    animation: rpa-click-ripple 0.5s ease-out forwards;
}
@keyframes rpa-click-ripple {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}
.security-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    background: #198754;
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* Step guide */
.step-guide-item {
    padding: 6px 10px;
    border-left: 3px solid transparent;
    opacity: 0.6;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}
.step-guide-item.active {
    opacity: 1;
    background: rgba(111, 66, 193, 0.1);
    border-left-color: var(--risa-purple);
}
.step-guide-item .step-num {
    display: inline-flex;
    width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
    background: #6c757d;
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    margin-right: 8px;
}
.step-guide-item.active .step-num {
    background: var(--risa-purple);
    animation: rpa-pulse 1.5s infinite;
}
.step-guide-item.completed .step-num { background: #198754; }
.step-guide-item.completed { opacity: 0.8; }

/* Toast notifications */
.rpa-toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.rpa-toast {
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: rpa-slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}
.rpa-toast--success { background: #198754; }
.rpa-toast--info { background: #0d6efd; }
.rpa-toast--error { background: #dc3545; }
.rpa-toast--warning { background: #ffc107; color: #212529; }
@keyframes rpa-slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes rpa-slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Override menu (3-dot) */
.mode-override-menu { position: relative; display: inline-block; }
.mode-override-btn {
    background: transparent;
    border: none;
    color: #6c757d;
    padding: 4px 6px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}
.mode-override-btn:hover { background: rgba(255, 255, 255, 0.1); color: #ffc107; }
.mode-override-dropdown {
    position: absolute;
    bottom: calc(100% + 5px);
    right: 0;
    background: #2d2d44;
    border: 1px solid #4d4d6d;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    min-width: 140px;
    z-index: 100;
    display: none;
}
.mode-override-dropdown.show {
    display: block;
    animation: rpa-fadeIn 0.2s ease;
}
@keyframes rpa-fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}
.mode-override-dropdown .dropdown-header {
    padding: 6px 12px;
    font-size: 0.7rem;
    color: #adb5bd;
    border-bottom: 1px solid #4d4d6d;
}
.mode-override-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.8rem;
}
.mode-override-dropdown .dropdown-item:hover { background: rgba(255, 193, 7, 0.15); }
.mode-override-dropdown .dropdown-item.active { background: rgba(255, 193, 7, 0.25); color: #ffc107; }
.mode-override-dropdown .dropdown-item i { width: 16px; text-align: center; }

/* Page tabs */
.rpa-page-tabs {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.rpa-page-tabs.hidden { display: none !important; }
.rpa-page-tabs .btn { font-size: 0.7rem; padding: 0.2rem 0.5rem; }
.rpa-page-tabs .btn-primary { background: var(--risa-purple); border-color: var(--risa-purple); }
.rpa-page-tabs-label { font-size: 0.7rem; color: #adb5bd; margin-right: 4px; }

/* Download item */
.rpa-download-item {
    padding: 4px 8px;
    background: rgba(25, 135, 84, 0.1);
    border-radius: 4px;
    margin-bottom: 4px;
}

/* Credential dropdown */
#credential-dropdown .dropdown-menu { min-width: 220px; }
#credential-dropdown .dropdown-item code {
    background: rgba(255, 193, 7, 0.2);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
}
#credential-dropdown .dropdown-item:hover code { background: rgba(255, 193, 7, 0.4); }

/* Credential/username prompts */
.rpa-record-page .credential-prompt,
.rpa-record-page .username-prompt,
.credential-prompt,
.username-prompt {
    position: absolute;
    top: -60px;
    left: 50%;
    width: min(calc(100% - 1rem), 42rem);
    transform: translateX(-50%);
    z-index: 100;
    animation: rpa-slideDown 0.3s ease-out;
}
.rpa-record-page .credential-prompt .alert,
.credential-prompt .alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.875rem 1rem;
    border: 1px solid rgba(255, 193, 7, 0.55);
    border-radius: 0.9rem;
    background: linear-gradient(135deg, rgba(73, 48, 5, 0.98), rgba(102, 67, 8, 0.96));
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
    color: #fff4cc;
    white-space: normal;
}
.rpa-record-page .username-prompt .alert,
.username-prompt .alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.875rem 1rem;
    border: 1px solid rgba(110, 168, 254, 0.65);
    border-radius: 0.9rem;
    background: linear-gradient(135deg, rgba(14, 31, 63, 0.98), rgba(24, 55, 104, 0.96));
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
    color: #eef5ff;
    white-space: normal;
}
.rpa-record-page .credential-prompt .alert > span,
.rpa-record-page .username-prompt .alert > span,
.credential-prompt .alert > span,
.username-prompt .alert > span {
    flex: 1 1 14rem;
    min-width: 0;
    font-size: 0.9375rem;
    line-height: 1.45;
}
.rpa-record-page .credential-prompt .alert strong,
.rpa-record-page .username-prompt .alert strong,
.credential-prompt .alert strong,
.username-prompt .alert strong {
    color: #ffffff;
}
.rpa-record-page .credential-prompt .alert .small,
.rpa-record-page .username-prompt .alert .small,
.credential-prompt .alert .small,
.username-prompt .alert .small {
    color: inherit !important;
}
.rpa-record-page .credential-prompt .alert .bi-key-fill,
.rpa-record-page .credential-prompt .alert .text-warning,
.credential-prompt .alert .bi-key-fill,
.credential-prompt .alert .text-warning {
    color: #ffd76a !important;
}
.rpa-record-page .username-prompt .alert .bi-person-fill,
.rpa-record-page .username-prompt .alert .text-primary,
.username-prompt .alert .bi-person-fill,
.username-prompt .alert .text-primary {
    color: #8ec5ff !important;
}
.rpa-record-page .credential-prompt .alert .btn,
.rpa-record-page .username-prompt .alert .btn,
.credential-prompt .alert .btn,
.username-prompt .alert .btn {
    flex: 0 0 auto;
}
.rpa-record-page .credential-prompt .alert .btn-outline-secondary,
.rpa-record-page .username-prompt .alert .btn-outline-secondary,
.credential-prompt .alert .btn-outline-secondary,
.username-prompt .alert .btn-outline-secondary {
    color: rgba(255, 255, 255, 0.88);
    border-color: rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.08);
}
.rpa-record-page .credential-prompt .alert .btn-outline-secondary:hover,
.rpa-record-page .username-prompt .alert .btn-outline-secondary:hover,
.credential-prompt .alert .btn-outline-secondary:hover,
.username-prompt .alert .btn-outline-secondary:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.38);
    background: rgba(255, 255, 255, 0.16);
}
.rpa-record-page .credential-prompt .alert #btn-insert-password,
.credential-prompt .alert #btn-insert-password {
    background: #ffc107;
    border-color: #ffc107;
    color: #2f2200 !important;
}
.rpa-record-page .credential-prompt .alert #btn-insert-password:hover,
.credential-prompt .alert #btn-insert-password:hover {
    background: #ffd24a;
    border-color: #ffd24a;
}
.rpa-record-page .username-prompt .alert #btn-insert-username,
.username-prompt .alert #btn-insert-username {
    background: #8ec5ff;
    border-color: #8ec5ff;
    color: #102746 !important;
}
.rpa-record-page .username-prompt .alert #btn-insert-username:hover,
.username-prompt .alert #btn-insert-username:hover {
    background: #b3daff;
    border-color: #b3daff;
}
@keyframes rpa-slideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.credential-prompt.hidden,
.username-prompt.hidden { display: none !important; }

/* Password/username field modes */
.typing-input-group.password-mode {
    border: 2px solid #ffc107;
    background: rgba(255, 193, 7, 0.1);
}
.typing-input-group.password-mode #type-input { -webkit-text-security: disc; }
.typing-input-group.username-mode {
    border: 2px solid #0d6efd;
    background: rgba(13, 110, 253, 0.1);
}

@media (max-width: 768px) {
    .credential-prompt,
    .username-prompt {
        width: calc(100% - 0.5rem);
        top: -72px;
    }
}

/* =====================================================
   Historical Scan (Backfill) — Date Presets + Mode Cards
   ===================================================== */

/* Segmented date-mode control (By Year | Last N Months | Custom) */
.backfill-date-mode .btn {
    flex: 1;
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: 500;
    padding: var(--spacing-sm) var(--spacing-md);
}

/* Range summary line below the date inputs */
.backfill-range-summary {
    font-style: italic;
    color: var(--text-help-light, #5a5f66);
}

[data-theme="dark"] .backfill-range-summary {
    color: var(--text-help-dark, #9aa0a6);
}

/* Scan mode radio cards */
.backfill-mode {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm, 0.5rem);
}

.backfill-mode__card {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm, 0.5rem);
    padding: var(--spacing-md) var(--spacing-lg);
    border: 1.5px solid var(--border-light, #b0b0b0);
    border-radius: var(--spacing-sm, 0.5rem);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    background: var(--bs-body-bg, #fff);
}

.backfill-mode__card:hover {
    border-color: var(--risa-purple);
    background: rgba(68, 52, 116, 0.03);
}

.backfill-mode__card--selected {
    border-color: var(--risa-purple);
    box-shadow: 0 0 0 1px var(--risa-purple);
    background: rgba(68, 52, 116, 0.06);
}

.backfill-mode__content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs, 0.25rem);
}

.backfill-mode__title {
    font-weight: 600;
    font-size: var(--font-size-sm, 0.875rem);
}

.backfill-mode__desc {
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--text-help-light, #5a5f66);
    line-height: var(--line-height-base, 1.5);
}

/* Progress counters row */
.backfill-progress__counters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* Upsell hint row inside quota info card */
.backfill-upsell {
    color: var(--text-help-light, #5a5f66);
    border-top: 1px solid var(--bs-border-color, #dee2e6);
    padding-top: 0.5rem;
}

[data-theme="dark"] .backfill-upsell {
    color: var(--text-help-dark, #9aa0a6);
    border-top-color: var(--bs-border-color, #3d3d3d);
}

/* Dark mode — scan mode cards */
[data-theme="dark"] .backfill-mode__card {
    border-color: var(--border-dark, #505050);
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .backfill-mode__card:hover {
    border-color: var(--border-dark-strong, #707070);
    background: rgba(124, 106, 173, 0.1);
}

[data-theme="dark"] .backfill-mode__card--selected {
    border-color: #9b8bc4;
    box-shadow: 0 0 0 1px #9b8bc4, 0 0 8px rgba(124, 106, 173, 0.2);
    background: rgba(124, 106, 173, 0.15);
}

[data-theme="dark"] .backfill-mode__desc {
    color: var(--text-help-dark, #c0c0c8);
}

.backfill-behavior {
    display: flex;
    gap: var(--spacing-sm, 0.5rem);
    align-items: flex-start;
    padding: var(--spacing-md) var(--spacing-lg);
    border: 1px solid var(--border-light, #d7dbe0);
    border-radius: var(--spacing-sm, 0.5rem);
    background: linear-gradient(180deg, rgba(68, 52, 116, 0.03), rgba(68, 52, 116, 0.01));
}

.backfill-behavior__icon {
    color: var(--risa-purple);
    font-size: 0.95rem;
    line-height: 1.4;
    margin-top: 0.1rem;
}

.backfill-behavior__content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs, 0.25rem);
}

.backfill-behavior__title {
    font-weight: 600;
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--text-primary-light, #1a1a1a);
}

.backfill-behavior__desc {
    font-size: var(--font-size-sm, 0.875rem);
    line-height: var(--line-height-base, 1.5);
    color: var(--text-help-light, #5a5f66);
    margin: 0;
}

[data-theme="dark"] .backfill-behavior {
    background: rgba(124, 106, 173, 0.10);
    border-color: rgba(155, 139, 196, 0.35);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .backfill-behavior__icon {
    color: #c9b5e6;
}

[data-theme="dark"] .backfill-behavior__title {
    color: var(--text-primary-dark, #f5f5f5);
}

[data-theme="dark"] .backfill-behavior__desc {
    color: var(--text-help-dark, #c0c0c8);
}

/* Progress bar height utilities (replace inline styles) */
.backfill-progress-sm { height: var(--spacing-sm, 0.5rem); }
.backfill-progress-md { height: 10px; }

/* Section separators within the backfill modal */
.backfill-section {
    padding-bottom: var(--spacing-lg);
    margin-bottom: var(--spacing-lg) !important;
    border-bottom: 1px solid var(--border-light, #b0b0b0);
}

.backfill-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0 !important;
    padding-bottom: 0;
}

[data-theme="dark"] .backfill-section {
    border-bottom-color: var(--border-dark, #505050);
}

/* Section labels */
.backfill-section__label {
    font-size: var(--font-size-xs, 0.75rem);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-help-light, #5a5f66);
    margin-bottom: var(--spacing-sm, 0.5rem);
}

[data-theme="dark"] .backfill-section__label {
    color: var(--text-help-dark, #c0c0c8);
}

/* Segmented control active/dark overrides */
.backfill-date-mode .btn.active {
    background-color: var(--risa-purple);
    border-color: var(--risa-purple);
    color: var(--risa-white);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(68, 52, 116, 0.3);
}

[data-theme="dark"] .backfill-date-mode .btn:not(.active) {
    color: #b8a0d8;
    border-color: rgba(184, 160, 216, 0.4);
}

[data-theme="dark"] .backfill-date-mode .btn:not(.active):hover {
    background: rgba(124, 106, 173, 0.15);
}

[data-theme="dark"] .backfill-date-mode .btn.active {
    background-color: var(--risa-purple);
    border-color: var(--risa-purple);
    color: var(--risa-white);
}

/* Quota info panel */
.backfill-quota {
    background: rgba(75, 167, 190, 0.06);
    border: 1px solid rgba(75, 167, 190, 0.2);
    border-radius: var(--spacing-sm, 0.5rem);
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--font-size-sm, 0.875rem);
}

[data-theme="dark"] .backfill-quota {
    background: rgba(75, 167, 190, 0.08);
    border-color: rgba(75, 167, 190, 0.25);
    color: var(--text-primary-dark);
}

.backfill-quota__total {
    font-weight: 600;
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--risa-teal-dark, #3a8599);
}

[data-theme="dark"] .backfill-quota__total {
    color: #7fc8d8;
}

/* Start scan CTA button */
.backfill-start-btn {
    background: var(--gradient-primary) !important;
    border: none !important;
    padding: var(--spacing-sm) var(--spacing-xl);
    font-weight: 600;
}

.backfill-start-btn:hover {
    opacity: 0.9;
    box-shadow: 0 2px 8px rgba(68, 52, 116, 0.35);
}

.backfill-start-btn:disabled {
    opacity: 0.5;
    box-shadow: none;
}

/* Form controls in backfill modal */
#backfillModal .form-select,
#backfillModal .form-control {
    border-width: 1.5px;
}

[data-theme="dark"] #backfillModal .form-select,
[data-theme="dark"] #backfillModal .form-control {
    border-color: var(--border-dark, #505050);
    background-color: rgba(255, 255, 255, 0.05);
}

/* ============================================
   Firm / Partner Dashboard
   ============================================ */

/* Empty state placeholder used on all firm/* pages */
.firm-empty-state {
    color: var(--text-help-light);
}

[data-theme="dark"] .firm-empty-state {
    color: var(--text-help-dark);
}

/* ============================================
   Checkout / Plan Selection Page
   ============================================ */

/* Billing toggle labels */
.checkout-toggle__label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-tertiary-light);
    transition: color 0.2s;
    user-select: none;
}

.checkout-toggle__label--active {
    color: var(--text-primary-light);
    font-weight: 600;
}

/* The form-switch is slightly larger for easier tapping */
.checkout-toggle__switch .form-check-input {
    width: 2.75em;
    height: 1.5em;
    cursor: pointer;
}

/* "Save 20%" badge on the annual label */
.checkout-toggle__save-badge {
    background-color: var(--risa-teal) !important;
    color: #fff;
    font-size: var(--font-size-xs);
    vertical-align: middle;
}

/* ── Plan Card ── */
.checkout-plan-card {
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.checkout-plan-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.12);
}

/* Popular plan gets an extra glow on hover */
.checkout-plan-card--popular:hover {
    box-shadow: 0 0.5rem 1.5rem rgba(68, 52, 116, 0.25);
}

/* Top banner (Most Popular / Best Value / spacer) */
.checkout-plan-card__banner {
    text-align: center;
    font-size: var(--font-size-xs);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.3rem 0.5rem;
    border-radius: calc(0.5rem - 1px) calc(0.5rem - 1px) 0 0; /* match card radius */
}

.checkout-plan-card__banner--popular {
    background-color: var(--risa-purple);
    color: #fff;
}

.checkout-plan-card__banner--value {
    background-color: var(--risa-teal-dark);
    color: #fff;
}

/* Invisible spacer keeps the card header aligned with sibling cards */
.checkout-plan-card__banner--spacer {
    background-color: transparent;
    visibility: hidden;
    pointer-events: none;
}

/* Plan name inside card-header */
.checkout-plan-card__name {
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--risa-purple-dark);
}

/* Price block */
.checkout-plan-card__price {
    line-height: 1;
}

.checkout-plan-card__price-amount {
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: var(--font-size-4xl); /* 2.5rem */
    font-weight: 700;
    color: var(--text-primary-light);
}

.checkout-plan-card__price-amount--custom {
    font-size: var(--font-size-3xl); /* 2rem — slightly smaller for "Custom" */
    color: var(--risa-teal-darker);
}

.checkout-plan-card__price-unit {
    font-size: var(--font-size-sm);
    font-weight: 400;
    color: var(--text-tertiary-light);
}

/* Quota badges */
.checkout-plan-card__quota-badge {
    font-size: var(--font-size-xs);
    font-weight: 500;
}

/* Feature list */
.checkout-plan-card__features {
    margin-bottom: 0;
}

.checkout-plan-card__feature-item {
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-sm);
    color: var(--text-secondary-light);
}

/* ── Dark Mode Overrides ── */
[data-theme="dark"] .checkout-toggle__label {
    color: var(--text-tertiary-dark);
}

[data-theme="dark"] .checkout-toggle__label--active {
    color: var(--text-primary-dark);
}

[data-theme="dark"] .checkout-plan-card__name {
    color: #c9b5e6; /* same as dark h2 tint */
}

[data-theme="dark"] .checkout-plan-card__price-amount {
    color: var(--text-primary-dark);
}

[data-theme="dark"] .checkout-plan-card__price-amount--custom {
    color: #90dce8; /* same as dark h3 tint */
}

[data-theme="dark"] .checkout-plan-card__price-unit {
    color: var(--text-tertiary-dark);
}

[data-theme="dark"] .checkout-plan-card__feature-item {
    color: var(--text-secondary-dark);
}

[data-theme="dark"] .checkout-plan-card__banner--spacer {
    background-color: transparent;
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
    .checkout-plan-card {
        transition: none;
    }
}

/* ============================================
   Subscription Page — Tabbed Layout
   ============================================ */

.subscription-tabs .nav-link {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary-light);
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
}

.subscription-tabs .nav-link.active {
    background-color: var(--risa-purple);
    color: #fff;
}

.subscription-tabs .nav-link:hover:not(.active) {
    background-color: rgba(68, 52, 116, 0.08);
}

[data-theme="dark"] .subscription-tabs .nav-link {
    color: var(--text-secondary-dark);
}

[data-theme="dark"] .subscription-tabs .nav-link.active {
    background-color: var(--risa-purple);
    color: #fff;
}

[data-theme="dark"] .subscription-tabs .nav-link:hover:not(.active) {
    background-color: rgba(201, 181, 230, 0.1);
}

/* ============================================
   Naming Conventions Page
   ============================================ */

/* Sticky sidebar panel — offset from the navbar (approx 1.25rem below viewport top) */
.sticky-sidebar {
    position: sticky;
    top: 1.25rem;
}

/* Row hover highlight and chevron rotation */
.naming-convention-row {
    transition: border-color 0.15s ease-in-out;
}
.naming-convention-row:hover {
    border-color: var(--risa-teal) !important;
}
.naming-convention-row .naming-chevron {
    transition: transform 0.2s ease-in-out;
}
.naming-convention-row [aria-expanded="true"] .naming-chevron {
    transform: rotate(180deg);
}

/* ── Naming Conventions Redesign ──────────────────────────────────── */

/* Resolution order banner */
.nc-resolution-banner {
    background: var(--risa-light-gray);
    border: 1px solid var(--border-light);
    color: var(--text-secondary-light);
}

/* Inline preview per pane */
.nc-inline-preview {
    border-top: 1px dashed var(--border-light);
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}
.nc-inline-preview__results > div {
    background: var(--risa-light-gray);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
}

/* Token reference group labels */
.nc-token-group__label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-tertiary-light);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Token pills */
.nc-token-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border-light);
    background: var(--risa-light-gray);
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
    font-size: 0.8rem;
}
.nc-token-pill:hover {
    background: var(--risa-purple);
    border-color: var(--risa-purple);
    color: #fff;
    transform: translateY(-1px);
}
.nc-token-pill:hover code {
    color: #fff;
}
.nc-token-pill:focus-visible {
    outline: 2px solid var(--focus-ring-light);
    outline-offset: 1px;
}
.nc-token-pill code {
    font-size: 0.78rem;
    color: var(--risa-purple);
    background: transparent;
}
.nc-token-pill--inserted {
    background: var(--risa-teal);
    border-color: var(--risa-teal);
    color: #fff;
}
.nc-token-pill--inserted code {
    color: #fff;
}

/* Advanced style settings toggle */
.nc-advanced-toggle:hover {
    color: var(--risa-teal) !important;
}

/* Dark mode overrides — uses project semantic tokens (AAA contrast) */
[data-theme="dark"] .nc-resolution-banner {
    background: #363636;                        /* matches card-header bg */
    border-color: var(--border-dark);           /* #505050 = 3.2:1 */
    color: var(--text-secondary-dark);          /* #e8e8e8 = 13.2:1 AAA */
}
[data-theme="dark"] .nc-inline-preview {
    border-top-color: var(--border-dark);
}
[data-theme="dark"] .nc-inline-preview__results > div {
    background: #363636;
}
.nc-inline-preview__results .nc-preview-path {
    color: var(--link-light);
}
[data-theme="dark"] .nc-inline-preview__results .nc-preview-path {
    color: var(--link-dark);
}
[data-theme="dark"] .nc-token-group__label {
    color: var(--text-tertiary-dark);           /* #d0d0d0 = 10.1:1 AAA */
}
[data-theme="dark"] .nc-token-pill {
    background: #363636;                        /* matches card-header bg */
    border-color: var(--border-dark-strong);    /* #707070 = 4.8:1 — visible */
}
[data-theme="dark"] .nc-token-pill code {
    color: var(--link-dark);                    /* #70d4e8 = 10.8:1 AAA */
}
[data-theme="dark"] .nc-token-pill:hover {
    background: var(--risa-purple);
    border-color: var(--risa-purple);
}
[data-theme="dark"] .nc-token-pill:focus-visible {
    outline-color: var(--focus-ring-dark);      /* #70d4e8 = 10.8:1 */
}
[data-theme="dark"] .nc-advanced-toggle:hover {
    color: var(--link-dark) !important;         /* #70d4e8 = 10.8:1 AAA */
}
