/*
 * ==============================================================
 * AppFlare Risk Assessment - Theme (Premium Minimal Admin)
 * ==============================================================
 * Design tokens + component overrides for Bootstrap 5.
 * Palette: Neutral (white / soft grey / deep plum-grey text) with
 * ONE deep-violet accent derived from the AppFlare logo flame
 * gradient. The full indigo->violet->magenta gradient is kept but
 * used ONLY on hero/login surfaces (with a glassmorphism card on
 * top), never as a full-bleed background on data screens.
 *
 * PORTING NOTE (for future Blade integration):
 * This file is plain CSS + CSS variables only - no build-tool
 * specific syntax (no @import of Sass, no PostCSS features).
 * It can be copied as-is to `resources/css/theme.css` and loaded
 * via `@vite(['resources/css/theme.css'])` in place of / alongside
 * the current `resources/css/app.css`.
 *
 * Status colors intentionally match the existing risk-matrix hex
 * values already used in the real app (see resources/css/app.css
 * --rap-danger/--rap-warning/--rap-yellow/--rap-success/--rap-info)
 * so heat-map / badge colors stay consistent when this theme is
 * eventually merged with the real data-driven pages.
 *
 * ACCESSIBILITY NOTE: every text/background pairing below has been
 * chosen to keep body text at ~4.5:1 contrast and large/bold text
 * at ~3:1 minimum (WCAG AA). Text placed on the gradient or on
 * glass surfaces is always white/near-white with a subtle
 * text-shadow (--flare-glass-text-shadow) so it never blends into
 * the illustration/gradient behind it.
 */

:root {
    /* Brand - the gradient below matches the AppFlare logo's actual
       flame colors 1:1 (vivid indigo -> vivid violet -> vivid magenta,
       same stops as the logo artwork), since it's used ONLY on the
       hero/login surfaces where we deliberately want the full-strength
       brand gradient. The UI ACCENT color used everywhere else (buttons,
       sidebar, links) is --flare-violet, a separate, deeper/desaturated
       tone chosen for a calmer "premium" feel on data screens - the two
       are intentionally different so the logo gradient stays vivid while
       the rest of the UI stays minimal. */
    --flare-indigo: #3B2A82;
    --flare-logo-violet: #7B2FF7;
    --flare-magenta: #C239B3;
    --flare-pink: #D946A6;

    --flare-violet: #6B21A8;      /* UI accent (buttons/sidebar/links) - deeper & calmer than the logo violet */
    --flare-violet-dark: #4C1780; /* hover/active state for the UI accent */
    --flare-amber: #E8934A;

    --flare-gradient: linear-gradient(135deg, var(--flare-indigo) 0%, var(--flare-logo-violet) 50%, var(--flare-magenta) 80%, var(--flare-pink) 100%);
    --flare-gradient-soft: linear-gradient(135deg, rgba(59, 42, 130, 0.08) 0%, rgba(123, 47, 247, 0.08) 55%, rgba(194, 57, 179, 0.08) 100%);

    /* Status colors (kept in sync with the real app's risk matrix) */
    --flare-danger: #E1435A;
    --flare-warning: #E8934A;
    --flare-yellow: #E4B400;
    --flare-success: #17A672;
    --flare-info: #3D6FE0;

    /* Neutrals - premium light surface */
    --flare-body-bg: #FAFAFB;
    --flare-surface: #FFFFFF;
    --flare-surface-muted: #F3F1F6;
    --flare-border: #E7E5EE;
    --flare-text: #1F1B2E;
    --flare-text-muted: #6E6880;
    --flare-text-on-dark: rgba(255, 255, 255, 0.96);
    --flare-text-on-dark-muted: rgba(255, 255, 255, 0.80);

    /* Glassmorphism (login only). "Smoked" dark glass rather than white
       frosted glass: white-tinted glass over the pink end of the brand
       gradient measured only ~3.3:1 for white text (fails WCAG AA);
       this dark tint measures >= 5.1:1 for muted text at the worst spot. */
    --flare-glass-bg: rgba(25, 12, 50, 0.28);
    --flare-glass-bg-strong: rgba(255, 255, 255, 0.22);
    --flare-glass-border: rgba(255, 255, 255, 0.35);
    --flare-glass-blur: blur(20px);
    --flare-glass-shadow: 0 1.5rem 3rem rgba(20, 10, 40, 0.28);
    --flare-glass-text-shadow: 0 1px 3px rgba(15, 8, 30, 0.35);

    /* Layout */
    --flare-sidebar-width: 17rem;
    --flare-sidebar-width-collapsed: 5.5rem;
    --flare-topbar-height: 4.5rem;
    --flare-radius: 0.85rem;
    --flare-radius-sm: 0.6rem;
    --flare-shadow-sm: 0 0.15rem 0.4rem rgba(31, 27, 46, 0.05);
    --flare-shadow: 0 0.5rem 1.25rem rgba(31, 27, 46, 0.08);
    --flare-shadow-lg: 0 1rem 2.25rem rgba(31, 27, 46, 0.12);

    /* Card depth: layered, violet-tinted shadows (a tight contact shadow
       + a wide soft ambient one) read as "floating" far better than a
       single grey blur. A 1px inner top highlight adds the light edge. */
    --flare-card-shadow:
        0 1px 2px rgba(31, 27, 46, 0.06),
        0 4px 10px -2px rgba(76, 23, 128, 0.07),
        0 14px 32px -8px rgba(76, 23, 128, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    --flare-card-shadow-hover:
        0 2px 4px rgba(31, 27, 46, 0.06),
        0 10px 20px -4px rgba(76, 23, 128, 0.12),
        0 26px 48px -12px rgba(76, 23, 128, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    --flare-card-border: rgba(107, 33, 168, 0.08);

    /* Bootstrap variable overrides */
    --bs-primary: var(--flare-violet);
    --bs-primary-rgb: 107, 33, 168;
    --bs-body-font-family: 'IBM Plex Sans Thai', sans-serif;
    --bs-body-color: var(--flare-text);
    --bs-body-bg: var(--flare-body-bg);
    --bs-border-radius: var(--flare-radius-sm);
    --bs-border-color: var(--flare-border);
    --bs-body-font-size: 1.02rem;
}

/* ------------------------------------------------------------ */
/* Base / Typography                                             */
/* ------------------------------------------------------------ */

* {
    font-family: 'IBM Plex Sans Thai', sans-serif;
}

body {
    background-color: var(--flare-body-bg);
    color: var(--flare-text);
    font-size: 1.02rem;
    font-weight: 400;
}

h1, .h1 { font-size: 2.6rem; }
h2, .h2 { font-size: 2.05rem; }
h3, .h3 { font-size: 1.65rem; }
h4, .h4 { font-size: 1.35rem; }
h5, .h5 { font-size: 1.15rem; }
h6, .h6 { font-size: 1.02rem; }

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: 'IBM Plex Sans Thai', sans-serif;
    font-weight: 600;
    color: var(--flare-text);
    letter-spacing: -0.01em;
}

.small, small { font-size: 0.9rem; }

.btn { font-size: 1rem; font-weight: 500; }

.form-label { font-size: 0.95rem; }

.form-control, .form-select { font-size: 1rem; }

.flare-sidebar-nav .nav-link { font-size: 1rem; }

.flare-navbar .nav-link { font-size: 1rem; }

.table { font-size: 0.95rem; }

a {
    color: var(--flare-violet);
}

a:hover {
    color: var(--flare-violet-dark);
}

.text-muted {
    color: var(--flare-text-muted) !important;
}

.text-flare-gradient {
    background: var(--flare-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

[x-cloak] { display: none !important; }

/* ------------------------------------------------------------ */
/* Buttons - flat accent, gradient reserved for hero/login only  */
/* ------------------------------------------------------------ */

.btn {
    border-radius: var(--flare-radius-sm);
    font-weight: 500;
    -webkit-appearance: none;
}

.btn-primary,
.btn-flare {
    background: var(--flare-violet);
    border: 1px solid var(--flare-violet);
    color: #fff;
    box-shadow: var(--flare-shadow-sm);
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-flare:hover,
.btn-flare:focus {
    background: var(--flare-violet-dark);
    border-color: var(--flare-violet-dark);
    color: #fff;
    box-shadow: var(--flare-shadow);
    transform: translateY(-1px);
}

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

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

.btn-light {
    background: var(--flare-surface-muted);
    border-color: var(--flare-border);
    color: var(--flare-text);
}

/* Accent-on-gradient button used inside hero/login (glass surfaces) */
.btn-flare-on-glass {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.6);
    color: var(--flare-violet-dark);
    font-weight: 600;
}

.btn-flare-on-glass:hover {
    background: #fff;
    color: var(--flare-violet-dark);
}

/* ------------------------------------------------------------ */
/* Cards                                                          */
/* ------------------------------------------------------------ */

.card {
    border: 1px solid var(--flare-border);
    border-radius: var(--flare-radius);
    box-shadow: var(--flare-shadow-sm);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--flare-border);
    font-weight: 600;
    border-top-left-radius: var(--flare-radius) !important;
    border-top-right-radius: var(--flare-radius) !important;
}

.flare-stat-card {
    border-radius: var(--flare-radius);
    border: 1px solid var(--flare-border);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    overflow: hidden;
}

.flare-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--flare-shadow-lg);
}

.flare-stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

/* Soft icon backgrounds - shared by .flare-stat-icon AND .flare-feature-icon
   (previously only .flare-stat-icon was listed, so feature/section icons
   rendered with no background at all). Icon colors are darkened where
   needed so the glyph stays >= 3:1 against its tinted fill. */
.flare-stat-icon.bg-flare-violet-soft,
.flare-feature-icon.bg-flare-violet-soft { background: rgba(107, 33, 168, 0.10); color: var(--flare-violet); }
.flare-stat-icon.bg-flare-danger-soft,
.flare-feature-icon.bg-flare-danger-soft { background: rgba(225, 67, 90, 0.12); color: #C22F47; }
.flare-stat-icon.bg-flare-warning-soft,
.flare-feature-icon.bg-flare-warning-soft { background: rgba(232, 147, 74, 0.15); color: #8a4d16; }
.flare-stat-icon.bg-flare-success-soft,
.flare-feature-icon.bg-flare-success-soft { background: rgba(23, 166, 114, 0.12); color: #0d7a56; }
.flare-stat-icon.bg-flare-info-soft,
.flare-feature-icon.bg-flare-info-soft { background: rgba(61, 111, 224, 0.12); color: #2B58C4; }

/* ------------------------------------------------------------ */
/* Badges - text color always checked for contrast on its fill   */
/* ------------------------------------------------------------ */

.badge {
    font-weight: 500;
    border-radius: 0.5rem;
    padding: 0.4em 0.7em;
}

.badge.bg-flare-primary { background: var(--flare-violet) !important; color: #fff; }
.badge.bg-flare-danger { background-color: var(--flare-danger) !important; color: #fff; }
.badge.bg-flare-warning { background-color: var(--flare-warning) !important; color: #402005; }
.badge.bg-flare-yellow { background-color: var(--flare-yellow) !important; color: #3a2c00; }
.badge.bg-flare-success { background-color: var(--flare-success) !important; color: #fff; }
.badge.bg-flare-info { background-color: var(--flare-info) !important; color: #fff; }

/* ------------------------------------------------------------ */
/* Forms                                                          */
/* ------------------------------------------------------------ */

.form-control,
.form-select {
    border-radius: var(--flare-radius-sm);
    border-color: var(--flare-border);
    padding: 0.6rem 0.85rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--flare-violet);
    box-shadow: 0 0 0 0.2rem rgba(107, 33, 168, 0.15);
}

.form-label {
    font-weight: 500;
    color: var(--flare-text);
    margin-bottom: 0.4rem;
}

.form-control:disabled,
.form-control:read-only {
    background-color: var(--flare-surface-muted);
}

/* Fix iOS Safari input zoom (font-size < 16px causes auto-zoom) */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    input, select, textarea { font-size: 16px; }
}

/* ------------------------------------------------------------ */
/* Tables                                                         */
/* ------------------------------------------------------------ */

.table {
    --bs-table-bg: transparent;
}

.flare-table thead th {
    background: var(--flare-surface-muted);
    color: var(--flare-text);
    font-weight: 600;
    border-bottom: 2px solid var(--flare-violet);
    white-space: nowrap;
}

.flare-table tbody tr:hover {
    background-color: var(--flare-gradient-soft);
}

.table-responsive {
    -webkit-overflow-scrolling: touch;
    border-radius: var(--flare-radius);
}

/* ------------------------------------------------------------ */
/* Backend Sidebar (Modern SaaS Admin - minimal light sidebar)   */
/* ------------------------------------------------------------ */

.flare-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--flare-sidebar-width);
    background: var(--flare-surface);
    border-right: 1px solid var(--flare-border);
    z-index: 1030;
    overflow-y: auto;
    transition: transform 0.2s ease, width 0.2s ease;
}

.flare-sidebar-brand {
    height: var(--flare-topbar-height);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--flare-border);
    overflow: hidden;
}

.flare-sidebar-brand img {
    height: 2.1rem;
    object-fit: contain;
}

/* Fixed-size box for the wordmark logo (logo.png / logo_white.png have a
   wide ~7:1 aspect ratio). Constraining both height AND max-width keeps
   the logo from overflowing the sidebar's fixed width and bleeding into
   the topbar above it. */
.flare-sidebar-logo {
    height: 2.1rem;
    width: auto;
    max-width: calc(var(--flare-sidebar-width) - 2.5rem);
    object-fit: contain;
    object-position: left center;
}

/* Same fixed-size guard for the frontend navbar brand + footer logos,
   which use the same wide wordmark image. */
.flare-navbar-logo {
    height: 2.2rem;
    width: auto;
    max-width: 11rem;
    object-fit: contain;
    object-position: left center;
}

.flare-sidebar-brand-text {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--flare-text);
}

.flare-sidebar-heading {
    padding: 1.1rem 1.25rem 0.4rem;
    font-size: 0.75rem;
    letter-spacing: 0.06rem;
    text-transform: uppercase;
    color: var(--flare-text-muted);
    font-weight: 600;
}

.flare-sidebar-nav {
    padding: 0.5rem 0.75rem 1.5rem;
    list-style: none;
    margin: 0;
}

.flare-sidebar-nav .nav-item {
    margin-bottom: 0.2rem;
}

.flare-sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.9rem;
    border-radius: var(--flare-radius-sm);
    color: var(--flare-text-muted);
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.flare-sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
}

.flare-sidebar-nav .nav-link:hover {
    background: var(--flare-surface-muted);
    color: var(--flare-violet);
}

/* Active nav item: soft accent tint + left accent bar, NOT a full
   gradient fill - this keeps the sidebar reading as minimal/premium. */
.flare-sidebar-nav .nav-item.active .nav-link {
    background: rgba(107, 33, 168, 0.08);
    color: var(--flare-violet-dark);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--flare-violet);
}

/* Content offset for fixed sidebar (desktop) */
.flare-content-wrapper {
    margin-left: var(--flare-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.2s ease;
}

/* ------------------------------------------------------------ */
/* Backend Topbar                                                 */
/* ------------------------------------------------------------ */

.flare-topbar {
    position: sticky;
    top: 0;
    height: var(--flare-topbar-height);
    background: var(--flare-surface);
    border-bottom: 1px solid var(--flare-border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 1020;
    gap: 1rem;
}

.flare-topbar .flare-sidebar-toggle {
    border: none;
    background: transparent;
    font-size: 1.4rem;
    color: var(--flare-text);
    display: none;
}

.flare-topbar .img-profile {
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--flare-violet);
}

.flare-badge-counter {
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: 0.65rem;
    padding: 0.15em 0.4em;
}

/* ------------------------------------------------------------ */
/* Mobile responsive - sidebar becomes off-canvas                */
/* ------------------------------------------------------------ */

@media (max-width: 991.98px) {
    .flare-sidebar {
        transform: translateX(-100%);
        box-shadow: var(--flare-shadow-lg);
    }

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

    .flare-content-wrapper {
        margin-left: 0;
    }

    .flare-topbar .flare-sidebar-toggle {
        display: inline-flex;
        align-items: center;
    }

    .flare-sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(20, 14, 32, 0.5);
        z-index: 1025;
    }

    .flare-sidebar-backdrop.show {
        display: block;
    }
}

@media (min-width: 992px) {
    .flare-sidebar-backdrop { display: none !important; }
}

/* ------------------------------------------------------------ */
/* Login split screen (gradient + glass - the one place the full  */
/* brand gradient is allowed to fill a large surface)             */
/* ------------------------------------------------------------ */

.flare-login-panel {
    /* same 22% contrast tint as .flare-cta-banner */
    background: linear-gradient(rgba(25, 12, 50, 0.22), rgba(25, 12, 50, 0.22)), var(--flare-gradient);
    color: var(--flare-text-on-dark);
    min-height: 40vh;
    position: relative;
    overflow: hidden;
}

.flare-login-panel::before {
    /* soft radial glow for extra depth instead of a flat gradient */
    content: "";
    position: absolute;
    inset: 0;
    /* highlight kept soft (10%) - a brighter glow washed out text on the card */
    background: radial-gradient(circle at 25% 20%, rgba(255, 255, 255, 0.10), transparent 55%),
                radial-gradient(circle at 80% 85%, rgba(255, 255, 255, 0.07), transparent 50%);
    pointer-events: none;
}

.flare-login-panel * {
    position: relative;
    z-index: 1;
}

@media (min-width: 768px) {
    .flare-login-panel { min-height: 100vh; }
}

/* ------------------------------------------------------------ */
/* Glassmorphism - reserved for surfaces that sit ON TOP of the   */
/* gradient (hero / login). Inputs inside keep a solid near-white */
/* background so typed text always stays legible/high-contrast.   */
/* ------------------------------------------------------------ */

.flare-glass-card {
    background: var(--flare-glass-bg);
    -webkit-backdrop-filter: var(--flare-glass-blur) saturate(160%);
    backdrop-filter: var(--flare-glass-blur) saturate(160%);
    border: 1px solid var(--flare-glass-border);
    border-top-color: rgba(255, 255, 255, 0.55);
    border-radius: var(--flare-radius);
    box-shadow: var(--flare-glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    color: var(--flare-text-on-dark);
}

.flare-glass-card h1, .flare-glass-card h2, .flare-glass-card h3,
.flare-glass-card h4, .flare-glass-card h5, .flare-glass-card .form-label,
.flare-glass-card label, .flare-glass-card p {
    color: var(--flare-text-on-dark);
    text-shadow: var(--flare-glass-text-shadow);
}

.flare-glass-card .text-muted {
    color: var(--flare-text-on-dark-muted) !important;
}

/* Inputs stay solid/opaque for readability even inside a glass card */
.flare-glass-card .form-control,
.flare-glass-card .form-select {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.6);
    color: var(--flare-text);
}

.flare-glass-card .input-group-text {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.6);
    color: var(--flare-violet-dark);
}

/* No-backdrop-filter fallback (older browsers): solid translucent
   dark panel keeps text contrast instead of a see-through card. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .flare-glass-card {
        background: rgba(31, 20, 56, 0.55);
    }
}

/* Small glass "chip" - used for hero stat numbers on the gradient.
   Lighter/more translucent than .flare-glass-card so the gradient
   underneath still reads through clearly (avoids looking like a flat
   solid-purple box). */
.flare-glass-chip {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.08) 100%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-top-color: rgba(255, 255, 255, 0.7);
    border-radius: var(--flare-radius);
    box-shadow: 0 0.75rem 1.5rem rgba(20, 10, 40, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    color: #fff;
    padding: 1.1rem 0.75rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Subtle glossy highlight sweeping across the top-left of the chip -
   this is what actually sells the "glass" look; without it a
   translucent box on a flat gradient just reads as a plain purple card. */
.flare-glass-chip::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.35), transparent 55%);
    pointer-events: none;
}

.flare-glass-chip .flare-glass-chip-value {
    font-size: 1.9rem;
    font-weight: 700;
    text-shadow: var(--flare-glass-text-shadow);
}

.flare-glass-chip .flare-glass-chip-label {
    font-size: 0.85rem;
    color: var(--flare-text-on-dark-muted);
    text-shadow: var(--flare-glass-text-shadow);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .flare-glass-chip {
        background: rgba(31, 20, 56, 0.55);
    }
}

/* ------------------------------------------------------------ */
/* Frontend Navbar / Footer                                       */
/* ------------------------------------------------------------ */

/* Frosted white navbar - content scrolls softly underneath it */
.flare-navbar {
    background: rgba(255, 255, 255, 0.86);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    backdrop-filter: blur(14px) saturate(180%);
    border-bottom: 1px solid var(--flare-border);
    box-shadow: none;
}

.flare-navbar .navbar-nav .nav-link {
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.flare-navbar .navbar-nav .nav-link.active {
    background: rgba(107, 33, 168, 0.08);
    font-weight: 600;
}

.flare-navbar .navbar-brand img {
    height: 2.4rem;
}

.flare-navbar .nav-link {
    font-weight: 500;
    color: var(--flare-text);
}

.flare-navbar .nav-link.active,
.flare-navbar .nav-link:hover {
    color: var(--flare-violet);
}

.flare-hero {
    background: var(--flare-gradient);
    color: #fff;
    border-radius: 0 0 2.5rem 2.5rem;
    position: relative;
    overflow: hidden;
}

.flare-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.16), transparent 55%),
                radial-gradient(circle at 85% 90%, rgba(255, 255, 255, 0.10), transparent 50%);
    pointer-events: none;
}

.flare-hero > * {
    position: relative;
    z-index: 1;
}

/* Force white text on every heading/paragraph inside the hero - the global
   "h1,h2,h3{color:var(--flare-text)}" rule above otherwise wins and turns
   the un-highlighted part of hero headings dark, which is unreadable on
   the gradient (this was a real contrast bug, not a stylistic choice). */
.flare-hero, .flare-hero p {
    text-shadow: var(--flare-glass-text-shadow);
}

.flare-hero h1, .flare-hero h2, .flare-hero h3,
.flare-hero .h1, .flare-hero .h2, .flare-hero .h3 {
    color: #fff;
    text-shadow: var(--flare-glass-text-shadow);
}

.flare-footer {
    background: var(--flare-indigo);
    color: var(--flare-text-on-dark-muted);
}

.flare-footer a {
    color: var(--flare-text-on-dark);
}

/* ------------------------------------------------------------ */
/* Utility helpers                                                */
/* ------------------------------------------------------------ */

.flare-shadow-sm { box-shadow: var(--flare-shadow-sm) !important; }
.flare-shadow { box-shadow: var(--flare-shadow) !important; }
.flare-rounded { border-radius: var(--flare-radius) !important; }

.flare-heatmap-cell {
    border-radius: 0.5rem;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.8rem;
}

/* ------------------------------------------------------------ */
/* Risk Matrix heatmap grid (chartdiv1 / chartdiv2 replacement)   */
/* Mirrors the color logic already used by the real app's        */
/* Very-Low5/Low5/Medium5/High5/Critical5 classes in              */
/* resources/views/Backend/dashboard.blade.php, so porting this   */
/* markup back keeps the exact same severity colors.              */
/* ------------------------------------------------------------ */
.flare-risk-matrix {
    display: flex;
    gap: 0.5rem;
    height: 100%;
}

.flare-risk-matrix-axis-y {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 0.75rem;
    color: var(--flare-text-muted);
    font-weight: 600;
    padding: 0.5rem 0;
}

.flare-risk-matrix-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.flare-risk-matrix-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
    flex: 1;
}

.flare-risk-matrix-cell {
    border-radius: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    min-height: 3.2rem;
}

/* Colors match chartPosition1.colors / chartPosition2.colors in the real
   app's dashboard.blade.php (good/medium/bad/critical), which is a 3x3
   Low/Medium/High matrix - NOT a 5x5 grid. */
.flare-risk-matrix-cell.risk-good { background: var(--flare-success); }
.flare-risk-matrix-cell.risk-medium { background: var(--flare-yellow); color: #3a2c00; }
.flare-risk-matrix-cell.risk-bad { background: var(--flare-warning); color: #402005; }
.flare-risk-matrix-cell.risk-critical { background: var(--flare-danger); color: #fff; }

.flare-risk-matrix-axis-x {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--flare-text-muted);
    font-weight: 600;
    margin-left: 1.4rem;
}

/* ------------------------------------------------------------ */
/* Flare List-Card - numbered repeatable rows for "add to list"   */
/* fields (internal/external factors, financial/other impact,    */
/* how_to, risk_management_plan, created_kri, plan_risk,          */
/* performance_hyperlink, etc). Replaces the old plain input-row  */
/* list with a numbered card so long sentences stay readable.     */
/* ------------------------------------------------------------ */

.flare-list-card {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.75rem;
    list-style: none;
    padding: 0;
}

.flare-list-card-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: var(--flare-surface);
    border: 1px solid var(--flare-border);
    border-radius: var(--flare-radius-sm);
    padding: 0.65rem 0.85rem;
    box-shadow: var(--flare-shadow-sm);
}

.flare-list-card-index {
    flex: 0 0 auto;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: rgba(107, 33, 168, 0.10);
    color: var(--flare-violet-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
}

.flare-list-card-text {
    flex: 1 1 auto;
    font-size: 0.95rem;
    color: var(--flare-text);
    word-break: break-word;
    padding-top: 0.15rem;
}

.flare-list-card-remove {
    flex: 0 0 auto;
    border: none;
    background: transparent;
    color: var(--flare-danger);
    font-size: 1.05rem;
    line-height: 1;
    padding: 0.15rem 0.25rem;
    cursor: pointer;
    border-radius: 0.4rem;
}

.flare-list-card-remove:hover {
    background: rgba(225, 67, 90, 0.10);
}

.flare-list-card-empty {
    font-size: 0.88rem;
    color: var(--flare-text-muted);
    padding: 0.4rem 0.1rem;
}

/* ------------------------------------------------------------ */
/* Flare Scale Tile - selectable card tiles used for Likelihood / */
/* Impact (โอกาสเกิด / ผลกระทบ). Flexible flex-wrap layout so it   */
/* keeps working whether the scale has 3, 4 or 5 levels           */
/* (masterdata_risk_number is dynamic in the real app; this       */
/* project's live data currently uses a 3-level scale).           */
/* ------------------------------------------------------------ */

.flare-scale-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.flare-scale-tile-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.flare-scale-tile {
    flex: 1 1 7rem;
    min-width: 6rem;
    display: block;
    cursor: pointer;
    border: 1.5px solid var(--flare-border);
    border-radius: var(--flare-radius-sm);
    padding: 0.75rem 0.5rem;
    text-align: center;
    background: var(--flare-surface);
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.flare-scale-tile .flare-scale-num {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--flare-text);
}

.flare-scale-tile .flare-scale-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--flare-text-muted);
    margin-top: 0.15rem;
}

.flare-scale-tile:hover {
    border-color: var(--flare-violet);
    transform: translateY(-1px);
}

/* Level color accents (soft by default, solid + white text once
   selected - text color always checked against its own fill). */
.flare-scale-tile.level-low .flare-scale-num { color: #0d7a56; }
.flare-scale-tile.level-medium .flare-scale-num { color: #8a6a00; }
.flare-scale-tile.level-high .flare-scale-num { color: #8a4d16; }
.flare-scale-tile.level-critical .flare-scale-num { color: #a5233a; }

.flare-scale-tile-input:checked + .flare-scale-tile {
    box-shadow: var(--flare-shadow);
    transform: translateY(-1px);
}

.flare-scale-tile-input:checked + .flare-scale-tile.level-low {
    background: var(--flare-success);
    border-color: var(--flare-success);
}
.flare-scale-tile-input:checked + .flare-scale-tile.level-medium {
    background: var(--flare-yellow);
    border-color: var(--flare-yellow);
}
.flare-scale-tile-input:checked + .flare-scale-tile.level-high {
    background: var(--flare-warning);
    border-color: var(--flare-warning);
}
.flare-scale-tile-input:checked + .flare-scale-tile.level-critical {
    background: var(--flare-danger);
    border-color: var(--flare-danger);
}

/* Text color once selected: white on the darker success/warning/danger
   fills, near-black on the lighter yellow fill - each checked for
   readable contrast against its own background. */
.flare-scale-tile-input:checked + .flare-scale-tile.level-low .flare-scale-num,
.flare-scale-tile-input:checked + .flare-scale-tile.level-low .flare-scale-label,
.flare-scale-tile-input:checked + .flare-scale-tile.level-high .flare-scale-num,
.flare-scale-tile-input:checked + .flare-scale-tile.level-high .flare-scale-label,
.flare-scale-tile-input:checked + .flare-scale-tile.level-critical .flare-scale-num,
.flare-scale-tile-input:checked + .flare-scale-tile.level-critical .flare-scale-label {
    color: #fff;
}

.flare-scale-tile-input:checked + .flare-scale-tile.level-medium .flare-scale-num,
.flare-scale-tile-input:checked + .flare-scale-tile.level-medium .flare-scale-label {
    color: #3a2c00;
}

.flare-scale-tile-input:focus-visible + .flare-scale-tile {
    outline: 2px solid var(--flare-violet);
    outline-offset: 2px;
}

/* ------------------------------------------------------------ */
/* Flare Wizard - vertical step navigation for long multi-part    */
/* forms (e.g. the questionnaire). Reuses Bootstrap's nav-pills /  */
/* tab-pane engine as the switching mechanism - no extra JS.      */
/* ------------------------------------------------------------ */

.flare-wizard {
    display: flex;
    gap: 1.75rem;
    align-items: flex-start;
}

.flare-wizard-steps {
    flex: 0 0 15rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    position: sticky;
    top: calc(var(--flare-topbar-height) + 1rem);
}

.flare-wizard-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    border-radius: var(--flare-radius-sm);
    color: var(--flare-text-muted);
    font-weight: 500;
    border: none;
    background: transparent;
    text-align: left;
    width: 100%;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.flare-wizard-step:hover {
    background: var(--flare-surface-muted);
    color: var(--flare-violet);
}

.flare-wizard-step-index {
    flex: 0 0 auto;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    background: var(--flare-surface-muted);
    border: 1.5px solid var(--flare-border);
    color: var(--flare-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

.flare-wizard-step-label {
    font-size: 0.95rem;
    line-height: 1.25;
}

.flare-wizard-step.active {
    background: rgba(107, 33, 168, 0.08);
    color: var(--flare-violet-dark);
    box-shadow: inset 3px 0 0 var(--flare-violet);
}

.flare-wizard-step.active .flare-wizard-step-index {
    background: var(--flare-violet);
    border-color: var(--flare-violet);
    color: #fff;
}

.flare-wizard-step.done .flare-wizard-step-index {
    background: var(--flare-success);
    border-color: var(--flare-success);
    color: #fff;
}

.flare-wizard-body {
    flex: 1 1 auto;
    min-width: 0;
}

.flare-wizard-section-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--flare-border);
}

.flare-wizard-section-title .flare-wizard-section-num {
    flex: 0 0 auto;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    background: rgba(107, 33, 168, 0.10);
    color: var(--flare-violet-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.flare-wizard-actions {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--flare-border);
}

/* Mobile: stepper collapses to a horizontal scrollable strip above
   the form body instead of a fixed left rail. */
@media (max-width: 991.98px) {
    .flare-wizard {
        flex-direction: column;
    }

    .flare-wizard-steps {
        position: static;
        flex-direction: row;
        overflow-x: auto;
        gap: 0.5rem;
        padding-bottom: 0.5rem;
        flex: 1 1 auto;
        -webkit-overflow-scrolling: touch;
    }

    .flare-wizard-step {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .flare-wizard-step-label {
        display: none;
    }
}

/* Touch-friendly minimum sizes on small screens */
@media (max-width: 767.98px) {
    .btn, .nav-link { min-height: 44px; display: inline-flex; align-items: center; }
    .flare-sidebar-nav .nav-link { min-height: 44px; }
    .flare-wizard-step { min-height: 44px; }
}

/* ------------------------------------------------------------ */
/* Landing Page (Home) - modern SaaS marketing-page components    */
/* Used only on frontend/home.html: white hero instead of the     */
/* full brand-gradient hero, floating tilted app mockup, badge     */
/* pill, feature icon tiles, avatar stack, stat row, and a         */
/* gradient CTA banner (the ONE place besides login that still      */
/* uses the full vivid brand gradient, kept small/contained).       */
/* ------------------------------------------------------------ */

.flare-hero-light {
    background:
        radial-gradient(60rem 26rem at 90% -10%, rgba(123, 47, 247, 0.10), transparent 60%),
        radial-gradient(40rem 22rem at -5% 10%, rgba(194, 57, 179, 0.07), transparent 60%),
        var(--flare-body-bg);
    padding-top: 4rem;
    padding-bottom: 3rem;
    overflow: hidden;
    position: relative;
}

/* ------------------------------------------------------------ */
/* Inner-page header (every frontend page except Home) - same     */
/* light, tinted look as the Home hero instead of the old         */
/* full-bleed purple gradient banner.                             */
/* ------------------------------------------------------------ */
.flare-page-header {
    background:
        radial-gradient(50rem 18rem at 90% -20%, rgba(123, 47, 247, 0.10), transparent 60%),
        radial-gradient(34rem 16rem at -5% 0%, rgba(194, 57, 179, 0.07), transparent 60%),
        var(--flare-body-bg);
    border-bottom: 1px solid var(--flare-border);
    padding: 2.5rem 0 2rem;
}

.flare-page-title {
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--flare-text);
    margin-bottom: 0.4rem;
}

@media (max-width: 767.98px) {
    .flare-page-title { font-size: 1.7rem; }
}

.flare-breadcrumb {
    font-size: 0.85rem;
    margin-bottom: 0.9rem;
    --bs-breadcrumb-divider-color: var(--flare-text-muted);
}

.flare-breadcrumb a {
    color: var(--flare-text-muted);
    text-decoration: none;
}

.flare-breadcrumb a:hover { color: var(--flare-violet); }

.flare-breadcrumb .breadcrumb-item.active {
    color: var(--flare-violet-dark);
    font-weight: 500;
}

/* Section heading used inside inner pages */
.flare-section-title {
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

/* Section-title icon: circular badge with a soft tinted fill, a thin
   ring in the same hue, and a subtle outer halo so it reads as a
   deliberate avatar-style mark rather than a bare glyph. */
.flare-section-title .flare-feature-icon {
    width: 2.6rem;
    height: 2.6rem;
    font-size: 1.15rem;
    margin-bottom: 0;
    border-radius: 50%;
    flex: 0 0 auto;
    box-shadow: inset 0 0 0 1px rgba(107, 33, 168, 0.18),
                0 0 0 4px rgba(107, 33, 168, 0.05);
}

.flare-section-title .flare-feature-icon.bg-flare-success-soft {
    box-shadow: inset 0 0 0 1px rgba(23, 166, 114, 0.22), 0 0 0 4px rgba(23, 166, 114, 0.06);
}

.flare-section-title .flare-feature-icon.bg-flare-info-soft {
    box-shadow: inset 0 0 0 1px rgba(61, 111, 224, 0.22), 0 0 0 4px rgba(61, 111, 224, 0.06);
}

/* Solid variant: dark brand-gradient circle with a white glyph.
   White on #6B21A8 ~9:1, on the magenta end #C239B3 ~4.6:1. */
.flare-feature-icon.flare-icon-solid,
.flare-section-title .flare-feature-icon.flare-icon-solid {
    background: linear-gradient(135deg, var(--flare-violet) 0%, var(--flare-magenta) 100%);
    color: #fff;
    border-radius: 50%;
    box-shadow: 0 0.35rem 0.9rem rgba(107, 33, 168, 0.28),
                0 0 0 4px rgba(107, 33, 168, 0.08);
}

/* Contact info rows (contact page side panel) */
.flare-info-row {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--flare-border);
}

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

.flare-info-row .flare-feature-icon {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.05rem;
    margin-bottom: 0;
    flex: 0 0 auto;
}

.flare-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(107, 33, 168, 0.08);
    color: var(--flare-violet-dark);
    border: 1px solid rgba(107, 33, 168, 0.16);
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 600;
}

.flare-badge-pill .badge-dot {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: var(--flare-success);
    display: inline-block;
}

.flare-hero-title {
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -0.02em;
    color: var(--flare-text);
}

.flare-hero-title .text-flare-gradient {
    display: inline;
}

@media (max-width: 767.98px) {
    .flare-hero-title { font-size: 2rem; }
}

/* Floating, slightly-tilted "app mockup" card used in the hero -
   a flat abstract dashboard preview instead of a clipart illustration. */
.flare-mockup-frame {
    position: relative;
    transform: rotate(2.5deg);
    transition: transform 0.3s ease;
}

.flare-mockup-frame:hover {
    transform: rotate(0deg);
}

.flare-mockup-card {
    background: var(--flare-surface);
    border: 1px solid var(--flare-border);
    border-radius: 1.25rem;
    box-shadow: var(--flare-shadow-lg);
    padding: 1.25rem;
    position: relative;
    z-index: 2;
}

.flare-mockup-card .flare-mockup-topbar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.flare-mockup-card .flare-mockup-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--flare-border);
}

/* Small floating accent chip that peeks out from behind the mockup card */
.flare-mockup-accent {
    position: absolute;
    bottom: -1.5rem;
    left: -1.5rem;
    width: 6.5rem;
    height: 6.5rem;
    border-radius: 1.25rem;
    background: var(--flare-gradient);
    z-index: 1;
    box-shadow: var(--flare-shadow-lg);
}

.flare-mockup-accent-2 {
    position: absolute;
    top: -1rem;
    right: -1rem;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 50%;
    background: var(--flare-surface);
    border: 1px solid var(--flare-border);
    box-shadow: var(--flare-shadow);
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--flare-violet);
    font-size: 1.2rem;
}

/* Logo/agency strip ("Loved by ...") */
.flare-logo-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.75rem;
    opacity: 0.55;
    filter: grayscale(1);
}

.flare-logo-strip span {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--flare-text-muted);
}

/* Feature icon tiles ("Everything you need") */
.flare-feature-tile {
    border: 1px solid var(--flare-border);
    border-radius: var(--flare-radius);
    padding: 1.5rem;
    height: 100%;
    background: var(--flare-surface);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.flare-feature-tile:hover {
    transform: translateY(-3px);
    box-shadow: var(--flare-shadow);
}

.flare-feature-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    margin-bottom: 1rem;
}

/* Avatar stack (overlapping circular avatars) */
.flare-avatar-stack {
    display: flex;
}

.flare-avatar-stack .flare-avatar {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    border: 2px solid var(--flare-surface);
    background: var(--flare-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    margin-left: -0.6rem;
}

.flare-avatar-stack .flare-avatar:first-child {
    margin-left: 0;
}

/* Stat row (big numbers in a horizontal strip, editorial style) */
.flare-stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 2.5rem;
    justify-content: center;
}

.flare-stat-row-item {
    text-align: center;
}

.flare-stat-row-value {
    font-size: 2.1rem;
    font-weight: 700;
    color: var(--flare-text);
    line-height: 1.1;
}

.flare-stat-row-label {
    font-size: 0.85rem;
    color: var(--flare-text-muted);
    margin-top: 0.2rem;
}

/* Gradient CTA banner - contained, rounded, NOT full-bleed - the second
   (and last) place besides login that uses the full vivid brand gradient. */
.flare-cta-banner {
    /* 22% dark tint over the brand gradient: without it, white body text
       on the light pink end measures only 3.6:1 (fails WCAG AA 4.5:1).
       With the tint it measures ~5.1:1 while the gradient stays vivid. */
    background: linear-gradient(rgba(25, 12, 50, 0.22), rgba(25, 12, 50, 0.22)), var(--flare-gradient);
    border-radius: 1.5rem;
    padding: 2.5rem;
    color: #fff;
    text-shadow: var(--flare-glass-text-shadow);
    position: relative;
    overflow: hidden;
}

.flare-cta-banner::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.18), transparent 55%);
    pointer-events: none;
}

.flare-cta-banner > * {
    position: relative;
    z-index: 1;
}

/* Multi-column footer */
.flare-footer-columns {
    background: var(--flare-text);
    color: rgba(255, 255, 255, 0.65);
}

.flare-footer-columns a {
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
}

.flare-footer-columns a:hover {
    color: #fff;
}

/* Footer brand: same white chip + full-color logo.png as the backend sidebar */
.flare-footer-columns .flare-footer-logo-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 0.9rem;
    padding: 0.6rem 1rem;
    box-shadow: 0 8px 20px -10px rgba(10, 4, 40, 0.6);
    max-width: 100%;
}

.flare-footer-columns .flare-footer-logo-chip:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.flare-footer-columns .flare-footer-logo {
    height: 2.6rem;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.flare-footer-columns h6 {
    color: #fff;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.flare-footer-columns .flare-footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding-top: 1.25rem;
    margin-top: 2rem;
    font-size: 0.85rem;
}

/* ------------------------------------------------------------ */
/* DARK-SURFACE CONTRAST GUARD                                    */
/* The global "h1..h6 { color: var(--flare-text) }" rule turns     */
/* headings near-black everywhere - including on dark/gradient    */
/* surfaces, where dark text on dark background is unreadable.   */
/* Every dark surface below forces light text for headings, body  */
/* copy, labels and muted text, and any LIGHT card placed on top  */
/* of a dark surface resets back to dark text so it never ends up */
/* white-on-white either.                                         */
/* ------------------------------------------------------------ */
.flare-cta-banner h1, .flare-cta-banner h2, .flare-cta-banner h3,
.flare-cta-banner h4, .flare-cta-banner h5, .flare-cta-banner h6,
.flare-footer-columns h1, .flare-footer-columns h2, .flare-footer-columns h3,
.flare-footer-columns h4, .flare-footer-columns h5, .flare-footer-columns h6,
.flare-footer h1, .flare-footer h2, .flare-footer h3,
.flare-footer h4, .flare-footer h5, .flare-footer h6,
.flare-login-panel h1, .flare-login-panel h2, .flare-login-panel h3,
.flare-login-panel h4, .flare-login-panel h5, .flare-login-panel h6,
.flare-surface-dark h1, .flare-surface-dark h2, .flare-surface-dark h3,
.flare-surface-dark h4, .flare-surface-dark h5, .flare-surface-dark h6 {
    color: #fff;
}

/* Body copy on the gradient CTA: the gradient's pink end is fairly
   light, so muted (70%) white drops below readable contrast there -
   use near-solid white plus the subtle text-shadow instead. */
.flare-cta-banner p,
.flare-cta-banner .text-muted {
    color: rgba(255, 255, 255, 0.94) !important;
}

.flare-footer-columns p,
.flare-footer-columns li,
.flare-footer-columns .text-muted,
.flare-surface-dark p,
.flare-surface-dark .text-muted {
    color: rgba(255, 255, 255, 0.72) !important;
}

/* Light cards sitting on a dark surface: back to dark text */
.flare-hero .card, .flare-login-panel .card,
.flare-cta-banner .card, .flare-surface-dark .card {
    color: var(--flare-text);
    text-shadow: none;
}

.flare-hero .card h1, .flare-hero .card h2, .flare-hero .card h3,
.flare-hero .card h4, .flare-hero .card h5, .flare-hero .card h6,
.flare-surface-dark .card h1, .flare-surface-dark .card h2, .flare-surface-dark .card h3,
.flare-surface-dark .card h4, .flare-surface-dark .card h5, .flare-surface-dark .card h6 {
    color: var(--flare-text);
    text-shadow: none;
}

.flare-hero .card .text-muted,
.flare-surface-dark .card .text-muted {
    color: var(--flare-text-muted) !important;
}

/* ------------------------------------------------------------ */
/* CARD DEPTH (light + shadow)                                    */
/* All content cards share the layered --flare-card-shadow. The   */
/* border is lightened so the shadow, not the outline, separates  */
/* the card from the page. Only clickable/summary cards lift on   */
/* hover; form cards stay still so inputs don't move under the    */
/* cursor.                                                        */
/* ------------------------------------------------------------ */
.card,
.flare-stat-card,
.flare-feature-tile,
.qa-response-cycle {
    border-color: var(--flare-card-border);
    box-shadow: var(--flare-card-shadow);
}

.flare-stat-card,
.flare-feature-tile,
.page-card .card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.flare-stat-card:hover,
.flare-feature-tile:hover,
.page-card:hover .card {
    transform: translateY(-4px);
    box-shadow: var(--flare-card-shadow-hover);
}

/* Soft light sheen along the top edge of feature tiles & stat cards */
.flare-feature-tile,
.flare-stat-card {
    background-image: linear-gradient(180deg, rgba(123, 47, 247, 0.025) 0%, rgba(255, 255, 255, 0) 40%);
}

/* Cards inside the old utility class keep the same (stronger) depth */
.card.flare-shadow {
    box-shadow: var(--flare-card-shadow-hover) !important;
}

/* Hero mockup: deepest shadow on the page, it's the focal point */
.flare-mockup-card {
    box-shadow:
        0 2px 4px rgba(31, 27, 46, 0.05),
        0 20px 40px -10px rgba(76, 23, 128, 0.20),
        0 40px 80px -20px rgba(76, 23, 128, 0.25);
}

@media (prefers-reduced-motion: reduce) {
    .flare-stat-card, .flare-feature-tile, .page-card .card { transition: none; }
    .flare-stat-card:hover, .flare-feature-tile:hover, .page-card:hover .card { transform: none; }
}

/* ------------------------------------------------------------ */
/* MOTION                                                          */
/* Subtle, purposeful animation. Everything here is either CSS-    */
/* only or driven by classes theme.js adds at runtime, so a page   */
/* without JS simply shows everything statically (nothing is       */
/* hidden unless JS has opted the element into the reveal).        */
/* All motion is disabled under prefers-reduced-motion.            */
/* ------------------------------------------------------------ */

:root {
    --flare-ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* 1. Scroll reveal - theme.js adds .flare-reveal, then .is-visible
      once the element enters the viewport, and removes both classes
      when the animation ends so hover transforms keep working. */
.flare-reveal {
    opacity: 0;
    transform: translateY(18px);
}

.flare-reveal.is-visible {
    animation: flareReveal 0.65s var(--flare-ease-out) var(--reveal-delay, 0s) both;
}

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

/* 2. Animated gradient text (the highlighted word in every title) */
.text-flare-gradient {
    background-size: 220% auto;
    animation: flareGradientShift 7s ease-in-out infinite alternate;
}

@keyframes flareGradientShift {
    from { background-position: 0% 50%; }
    to   { background-position: 100% 50%; }
}

/* 3. Home hero mockup - gentle float; the accent shapes drift out of
      phase so the composition feels alive without being busy. */
.flare-mockup-card {
    animation: flareFloat 6s ease-in-out infinite;
}

.flare-mockup-accent {
    animation: flareFloat 7s ease-in-out -2s infinite;
}

.flare-mockup-accent-2 {
    animation: flareFloatSmall 5s ease-in-out -1s infinite;
}

@keyframes flareFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

@keyframes flareFloatSmall {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%      { transform: translateY(-6px) rotate(-6deg); }
}

/* 4. Live-status dot in badge pills pulses */
.flare-badge-pill .badge-dot {
    animation: flarePulse 2.2s ease-out infinite;
}

@keyframes flarePulse {
    0%   { box-shadow: 0 0 0 0 rgba(23, 166, 114, 0.55); }
    70%  { box-shadow: 0 0 0 7px rgba(23, 166, 114, 0); }
    100% { box-shadow: 0 0 0 0 rgba(23, 166, 114, 0); }
}

/* 5. Light sweep across primary buttons on hover */
.btn-primary,
.btn-flare,
.btn-flare-on-glass {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.btn-primary::after,
.btn-flare::after,
.btn-flare-on-glass::after {
    content: "";
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    background: linear-gradient(100deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.35) 50%, rgba(255, 255, 255, 0) 100%);
    transform: skewX(-20deg);
    pointer-events: none;
    z-index: -1;
}

.btn-flare-on-glass::after {
    background: linear-gradient(100deg, rgba(123, 47, 247, 0) 0%, rgba(123, 47, 247, 0.14) 50%, rgba(123, 47, 247, 0) 100%);
}

.btn-primary:hover::after,
.btn-flare:hover::after,
.btn-flare-on-glass:hover::after {
    animation: flareSweep 0.75s ease-out;
}

@keyframes flareSweep {
    from { left: -75%; }
    to   { left: 130%; }
}

/* 6. CTA banner & login panel - slow drifting brand gradient
      (second layer only; the 22% contrast tint layer stays put). */
.flare-cta-banner,
.flare-login-panel {
    background-size: 100% 100%, 180% 180%;
    animation: flareGradientDrift 14s ease-in-out infinite alternate;
}

@keyframes flareGradientDrift {
    from { background-position: 0 0, 0% 30%; }
    to   { background-position: 0 0, 100% 70%; }
}

/* 7. Navbar gains a soft shadow once the page is scrolled */
.flare-navbar {
    transition: box-shadow 0.25s ease, background-color 0.25s ease;
}

.flare-navbar.is-scrolled {
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 6px 20px -8px rgba(76, 23, 128, 0.18);
}

/* 8. Wizard steps: panes slide up slightly as they fade in */
.flare-wizard-body .tab-pane.fade {
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.3s var(--flare-ease-out);
}

.flare-wizard-body .tab-pane.fade.show {
    transform: none;
}

.flare-wizard-step-index {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.flare-wizard-step.active .flare-wizard-step-index {
    transform: scale(1.08);
}

/* 9. Likelihood / Impact tiles "pop" when selected */
.flare-scale-tile-input:checked + .flare-scale-tile {
    animation: flarePop 0.28s var(--flare-ease-out);
}

@keyframes flarePop {
    0%   { transform: scale(0.94); }
    60%  { transform: scale(1.04); }
    100% { transform: translateY(-1px); }
}

/* 10. Feature/section icons tilt a little when their card is hovered */
.flare-feature-icon {
    transition: transform 0.25s var(--flare-ease-out);
}

.flare-feature-tile:hover .flare-feature-icon,
.card:hover .flare-section-title .flare-feature-icon {
    transform: translateY(-2px) rotate(-6deg);
}

/* Respect users who ask for less motion */
@media (prefers-reduced-motion: reduce) {
    .flare-reveal { opacity: 1; transform: none; }
    .flare-reveal.is-visible,
    .text-flare-gradient,
    .flare-mockup-card,
    .flare-mockup-accent,
    .flare-mockup-accent-2,
    .flare-badge-pill .badge-dot,
    .flare-cta-banner,
    .flare-login-panel,
    .flare-scale-tile-input:checked + .flare-scale-tile,
    .btn-primary:hover::after,
    .btn-flare:hover::after,
    .btn-flare-on-glass:hover::after {
        animation: none !important;
    }
    .flare-wizard-body .tab-pane.fade { transform: none; transition: opacity 0.15s linear; }
    .flare-feature-tile:hover .flare-feature-icon,
    .card:hover .flare-section-title .flare-feature-icon,
    .flare-wizard-step.active .flare-wizard-step-index { transform: none; }
}

/* ------------------------------------------------------------ */
/* QUESTIONNAIRE UX                                                */
/* Progress bar, step hints, inline validation, computed risk      */
/* level colours, "view all steps" mode, toasts and a sticky        */
/* action bar on mobile. Used by frontend/questionnaire.html.       */
/* ------------------------------------------------------------ */

/* Progress */
.qa-progress-track {
    height: 0.5rem;
    border-radius: 999px;
    background: var(--flare-surface-muted);
}

.qa-progress-bar {
    border-radius: 999px;
    background: linear-gradient(90deg, var(--flare-violet), var(--flare-magenta));
    transition: width 0.4s var(--flare-ease-out, ease);
}

/* Friendly one-line guidance under each step title */
.qa-step-hint {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    background: rgba(107, 33, 168, 0.05);
    border: 1px solid rgba(107, 33, 168, 0.12);
    border-radius: var(--flare-radius-sm);
    padding: 0.65rem 0.85rem;
    font-size: 0.9rem;
    color: #4a3f5e;
    margin: -0.25rem 0 1.25rem;
}

.qa-step-hint .bi {
    color: var(--flare-violet);
    margin-top: 0.1rem;
}

/* Done steps in the rail show a check mark */
.flare-wizard-step.done .flare-wizard-step-index .bi {
    font-size: 0.95rem;
}

/* Inline validation */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--flare-danger);
    box-shadow: 0 0 0 0.2rem rgba(225, 67, 90, 0.12);
}

.qa-field-error {
    flex-basis: 100%;
    font-size: 0.85rem;
    color: #B42340;
    margin-top: 0.25rem;
}

.flare-scale-group.is-invalid .flare-scale-tile {
    border-color: rgba(225, 67, 90, 0.55);
}

.flare-list-card.is-invalid {
    padding: 0.5rem;
    border: 1px dashed rgba(225, 67, 90, 0.55);
    border-radius: var(--flare-radius-sm);
}

/* Computed risk level (Low / Medium / Medium-High / High / Critical).
   Tinted fill + coloured left bar; text stays dark for contrast. */
.qa-readonly-result {
    border-left-width: 4px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.qa-readonly-result.qa-level-low        { background: #E6F6EF !important; border-left-color: var(--flare-success); color: #0B5E43; }
.qa-readonly-result.qa-level-medium     { background: #FFF7D6 !important; border-left-color: var(--flare-yellow);  color: #5C4700; }
.qa-readonly-result.qa-level-mediumhigh { background: #FDEEDF !important; border-left-color: var(--flare-warning); color: #7A3F0E; }
.qa-readonly-result.qa-level-high       { background: #FCE4E4 !important; border-left-color: #E0633F;             color: #8A2A12; }
.qa-readonly-result.qa-level-critical   { background: #FBE0E5 !important; border-left-color: var(--flare-danger);  color: #8E1B31; }

/* List items: enter / leave motion */
.qa-item-enter { animation: qaItemIn 0.25s var(--flare-ease-out, ease); }
.qa-item-leave { opacity: 0; transform: translateX(8px); transition: opacity 0.18s ease, transform 0.18s ease; }

@keyframes qaItemIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}

/* "Done this fiscal year" items */
.qa-list-done-item { transition: background-color 0.2s ease, border-color 0.2s ease; }
.qa-list-done-item.is-done {
    background: #EEF8F3;
    border-color: rgba(23, 166, 114, 0.35);
}

/* Performance status tiles: two-line label */
.qa-performance-status-tile small { color: var(--flare-text-muted); font-size: 0.78rem; }
.qa-performance-status-input:checked + .qa-performance-status-tile small { color: inherit; opacity: 0.85; }

/* View-all mode: every step stacked on one page */
.qa-view-all .tab-content > .tab-pane {
    display: block !important;
    opacity: 1 !important;
    transform: none !important;
    padding-bottom: 2rem;
    margin-bottom: 2rem;
    border-bottom: 1px dashed var(--flare-border);
}

.qa-view-all .tab-content > .tab-pane:last-child { border-bottom: none; }
.qa-view-all .flare-wizard-actions [data-wizard-next],
.qa-view-all .flare-wizard-actions [data-wizard-prev] { display: none; }

/* Toasts */
.qa-toast {
    border: none;
    border-radius: var(--flare-radius-sm);
    box-shadow: var(--flare-card-shadow-hover, var(--flare-shadow-lg));
    min-width: 18rem;
}

.qa-toast-success .bi:first-child { color: var(--flare-success); }
.qa-toast-danger  .bi:first-child { color: var(--flare-danger); }
.qa-toast-info    .bi:first-child { color: var(--flare-violet); }

/* Mobile: keep Back / Next within thumb reach */
@media (max-width: 767.98px) {
    .flare-wizard-body .flare-wizard-actions {
        position: sticky;
        bottom: 0;
        z-index: 5;
        background: rgba(255, 255, 255, 0.95);
        -webkit-backdrop-filter: blur(8px);
        backdrop-filter: blur(8px);
        margin-left: -0.75rem;
        margin-right: -0.75rem;
        padding: 0.75rem;
        flex-wrap: wrap;
    }
    .qa-view-all .flare-wizard-actions { position: static; }
}

@media (prefers-reduced-motion: reduce) {
    .qa-item-enter { animation: none; }
    .qa-progress-bar, .qa-readonly-result { transition: none; }
}

/* ------------------------------------------------------------ */
/* Wizard rail on tablet/mobile: compact numbered stepper.        */
/* Fix: the desktop rule "width: 100%" made every step fill the   */
/* whole row on small screens, so only one stretched pill (with a */
/* scrollbar) was visible. Now all 7 dots fit on one line, joined */
/* by a progress line; the current step name is shown in the      */
/* progress card above instead of under each dot.                 */
/* ------------------------------------------------------------ */
@media (max-width: 991.98px) {
    /* Desktop uses align-items:flex-start (rail + body side by side).
       Stacked vertically that shrinks both to their content width, so the
       rail didn't span the row and the form body could overflow the screen. */
    .flare-wizard {
        align-items: stretch;
        gap: 1rem;
    }

    .flare-wizard-body {
        width: 100%;
    }

    .flare-wizard-steps {
        position: relative;
        top: auto;
        width: 100%;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        gap: 0;
        overflow: visible;
        padding: 0.25rem 0 0.75rem;
        margin-bottom: 0.5rem;
    }

    /* connector line behind the dots */
    .flare-wizard-steps::before {
        content: "";
        position: absolute;
        left: 1.2rem;
        right: 1.2rem;
        top: calc(0.25rem + 1.2rem);
        height: 2px;
        background: var(--flare-border);
        z-index: 0;
    }

    .flare-wizard-step {
        width: auto;
        flex: 0 0 auto;
        padding: 0;
        min-height: 0;
        background: transparent !important;
        box-shadow: none !important;
        justify-content: center;
        position: relative;
        z-index: 1;
    }

    .flare-wizard-step:hover { background: transparent; }

    .flare-wizard-step-index {
        width: 2.4rem;
        height: 2.4rem;
        background: var(--flare-surface);
        font-size: 0.9rem;
    }

    .flare-wizard-step.active .flare-wizard-step-index {
        box-shadow: 0 0 0 4px rgba(107, 33, 168, 0.15);
    }

    .flare-wizard-step-label { display: none; }
}

@media (max-width: 360px) {
    .flare-wizard-step-index { width: 2.1rem; height: 2.1rem; font-size: 0.85rem; }
    .flare-wizard-steps::before { top: calc(0.25rem + 1.05rem); }
}

/* The step you are on always shows its number (violet), even if it
   was already completed - a green tick on the current step read as
   "this step is finished" and looked like a bug. */
.flare-wizard-step.active.done .flare-wizard-step-index {
    background: var(--flare-violet);
    border-color: var(--flare-violet);
    color: #fff;
}

/* ------------------------------------------------------------ */
/* Info "?" button next to field labels (Risk_Categories,          */
/* Likelihood, Impact, KRIs, 4Ts). The Blade markup still uses     */
/* .btn-outline-danger, which rendered as a red ring and read like */
/* an error. Restyled as a soft violet help chip matching the page */
/* (selector is specific enough to win over Bootstrap's colors).   */
/* ------------------------------------------------------------ */
.btn.qa-info-btn,
.btn.infoShowImg {
    width: 1.35rem;
    height: 1.35rem;
    min-height: 0;
    padding: 0;
    margin-left: 0.3rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: 0.1em;
    font-size: 0.8rem;
    line-height: 1;
    color: var(--flare-violet);
    background: rgba(107, 33, 168, 0.08);
    border: 1px solid rgba(107, 33, 168, 0.22);
    box-shadow: none;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.btn.qa-info-btn:hover,
.btn.infoShowImg:hover {
    color: #fff;
    background: var(--flare-violet);
    border-color: var(--flare-violet);
    transform: translateY(-1px);
}

.btn.qa-info-btn:focus-visible,
.btn.infoShowImg:focus-visible {
    outline: 2px solid var(--flare-violet);
    outline-offset: 2px;
    box-shadow: none;
}

/* no light-sweep / lift effects from the generic button rules */
.btn.qa-info-btn::after,
.btn.infoShowImg::after { content: none; }

/* bigger tap target on touch screens without making the chip bigger */
@media (pointer: coarse) {
    .btn.qa-info-btn,
    .btn.infoShowImg { position: relative; }
    .btn.qa-info-btn::before,
    .btn.infoShowImg::before {
        content: "";
        position: absolute;
        inset: -0.6rem;
    }
}

/* Required marker: same red, but a touch lighter so it reads as a
   hint next to the label rather than an alert. */
.qa-required {
    color: #D63A55;
    font-weight: 600;
    margin-left: 0.1rem;
}

/* ------------------------------------------------------------ */
/* FRONTEND TOPBAR (.flare-topbar-front)                           */
/* Logo | centred nav pills with icons | action + user chip.       */
/* On < lg the nav collapses into a card below the bar; the user   */
/* chip and toggle stay visible in the bar.                        */
/* ------------------------------------------------------------ */
.flare-topbar-front {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.flare-topbar-front .navbar-brand {
    padding: 0;
    margin-right: 1.25rem;
}

.flare-topbar-front .flare-navbar-logo {
    height: 2.1rem;
}

/* nav pills */
.flare-topbar-front .flare-topbar-nav {
    align-items: center;
    gap: 0.15rem;
}

.flare-topbar-front .flare-topbar-nav .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--flare-text-muted);
    white-space: nowrap;
}

.flare-topbar-front .flare-topbar-nav .nav-link .bi {
    font-size: 1rem;
    opacity: 0.85;
}

.flare-topbar-front .flare-topbar-nav .nav-link:hover {
    color: var(--flare-violet-dark);
    background: rgba(107, 33, 168, 0.06);
}

.flare-topbar-front .flare-topbar-nav .nav-link.active {
    color: var(--flare-violet-dark);
    background: rgba(107, 33, 168, 0.10);
    font-weight: 600;
}

.flare-topbar-front .flare-topbar-nav .nav-link.active .bi { opacity: 1; }

.flare-topbar-front .flare-topbar-nav .nav-link:focus-visible,
.flare-user-chip:focus-visible,
.flare-topbar-toggler:focus-visible {
    outline: 2px solid var(--flare-violet);
    outline-offset: 2px;
    box-shadow: none;
}

.flare-topbar-front .flare-topbar-nav .flare-topbar-ext {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-left: -0.15rem;
}

/* thin divider between public links and the signed-in app links */
.flare-topbar-sep {
    width: 1px;
    height: 1.25rem;
    background: var(--flare-border);
    margin: 0 0.35rem;
}

/* right-side group */
.flare-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-left: auto;
}

.flare-topbar-cta {
    align-items: center;
    gap: 0.35rem;
    border-radius: 999px;
    padding: 0.45rem 0.95rem;
    white-space: nowrap;
}

/* user chip */
.flare-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.25rem 0.65rem 0.25rem 0.25rem;
    min-height: 2.6rem;
    border: 1px solid var(--flare-border);
    border-radius: 999px;
    background: var(--flare-surface);
    color: var(--flare-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.flare-user-chip:hover,
.flare-user-chip[aria-expanded="true"] {
    border-color: rgba(107, 33, 168, 0.35);
    box-shadow: 0 0 0 3px rgba(107, 33, 168, 0.08);
}

.flare-user-avatar {
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--flare-violet), var(--flare-magenta));
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
}

.flare-user-avatar-lg {
    width: 2.6rem;
    height: 2.6rem;
    font-size: 1.05rem;
}

.flare-user-meta {
    line-height: 1.15;
    text-align: left;
    max-width: 10rem;
    min-width: 0;
}

/* long names / agencies stay on one line (a 2-line agency made the bar taller) */
.flare-user-meta .flare-user-name,
.flare-user-meta .flare-user-role {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.flare-user-name {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--flare-text);
}

.flare-user-role {
    display: block;
    font-size: 0.75rem;
    color: var(--flare-text-muted);
}

.flare-user-caret {
    font-size: 0.75rem;
    color: var(--flare-text-muted);
    transition: transform 0.2s ease;
}

.flare-user-chip[aria-expanded="true"] .flare-user-caret { transform: rotate(180deg); }

/* user dropdown */
.flare-user-menu {
    min-width: 15.5rem;
    padding: 0.5rem;
    margin-top: 0.5rem !important;
    border: 1px solid var(--flare-card-border, var(--flare-border));
    border-radius: var(--flare-radius);
    box-shadow: var(--flare-card-shadow-hover, var(--flare-shadow-lg));
}

.flare-user-menu-header {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.45rem 0.6rem 0.75rem;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid var(--flare-border);
}

.flare-user-menu-id { min-width: 0; }

.flare-user-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.65rem;
    border-radius: 0.55rem;
    font-size: 0.92rem;
    color: var(--flare-text);
}

.flare-user-menu .dropdown-item .bi { color: var(--flare-violet); }

.flare-user-menu .dropdown-item:hover,
.flare-user-menu .dropdown-item:focus {
    background: rgba(107, 33, 168, 0.07);
    color: var(--flare-violet-dark);
}

.flare-user-menu .dropdown-item.active,
.flare-user-menu .dropdown-item:active {
    background: rgba(107, 33, 168, 0.12);
    color: var(--flare-violet-dark);
    font-weight: 600;
}

.flare-user-menu .dropdown-divider { margin: 0.35rem 0; }

.flare-user-menu .flare-dropdown-danger,
.flare-user-menu .flare-dropdown-danger .bi { color: #C22F47; }

.flare-user-menu .flare-dropdown-danger:hover,
.flare-user-menu .flare-dropdown-danger:focus {
    background: rgba(225, 67, 90, 0.08);
    color: #B42340;
}

/* mobile toggle */
.flare-topbar-toggler {
    border: 1px solid var(--flare-border);
    border-radius: 0.7rem;
    padding: 0.3rem 0.6rem;
    font-size: 1.35rem;
    line-height: 1;
    color: var(--flare-text);
}

.flare-topbar-toggler:focus { box-shadow: 0 0 0 3px rgba(107, 33, 168, 0.15); }

/* < lg: nav drops into a card under the bar */
@media (max-width: 991.98px) {
    .flare-topbar-front .navbar-collapse {
        flex-basis: 100%;
    }

    .flare-topbar-front .flare-topbar-nav {
        align-items: stretch;
        gap: 0.1rem;
        margin-top: 0.65rem;
        padding: 0.4rem;
        background: var(--flare-surface);
        border: 1px solid var(--flare-border);
        border-radius: var(--flare-radius);
        box-shadow: var(--flare-card-shadow, var(--flare-shadow));
    }

    .flare-topbar-front .flare-topbar-nav .nav-link {
        width: 100%;
        border-radius: 0.6rem;
        padding: 0.7rem 0.85rem;
    }

    .flare-topbar-sep {
        width: auto;
        height: 1px;
        margin: 0.3rem 0.5rem;
    }

    .flare-topbar-cta-mobile {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 0.35rem;
        margin-top: 0.4rem;
        border-radius: 0.6rem;
    }
}

@media (max-width: 380px) {
    .flare-topbar-front .flare-navbar-logo { height: 1.8rem; max-width: 8.5rem; }
    .flare-topbar-actions { gap: 0.4rem; }
}

@media (prefers-reduced-motion: reduce) {
    .flare-user-caret, .flare-user-chip { transition: none; }
}

/* ------------------------------------------------------------ */
/* Topbar v2: taller bar; nav items run the full bar height and    */
/* the active item is a solid violet block (white text, ~9:1).     */
/* ------------------------------------------------------------ */
.flare-topbar-front {
    --flare-front-bar-h: 4.75rem;
}

/* Active item: brand gradient (deep violet -> magenta, same stops as the
   logo). White text measures ~9:1 on the violet end and 4.6:1 on the
   magenta end, so it passes WCAG AA across the whole block. */
.flare-topbar-front .flare-topbar-nav .nav-link.active,
.flare-topbar-front .flare-topbar-nav .nav-link.active:hover {
    background: linear-gradient(135deg, var(--flare-violet) 0%, var(--flare-magenta) 100%);
    color: #fff;
}

.flare-topbar-front .flare-topbar-nav .nav-link.active .bi { color: #fff; opacity: 1; }

@media (min-width: 992px) {
    .flare-topbar-front {
        padding-top: 0;
        padding-bottom: 0;
    }

    .flare-topbar-front > .container {
        min-height: var(--flare-front-bar-h);
        align-items: stretch;
    }

    .flare-topbar-front .navbar-brand,
    .flare-topbar-front .flare-topbar-actions {
        align-self: center;
    }

    .flare-topbar-front .navbar-collapse {
        align-self: stretch;
        align-items: stretch;
    }

    .flare-topbar-front .flare-topbar-nav {
        align-items: stretch;
        gap: 0;
    }

    .flare-topbar-front .flare-topbar-nav .nav-link {
        display: flex;
        align-items: center;
        height: 100%;
        border-radius: 0;
        padding: 0 1.15rem;
    }

    /* hover: soft tint over the full height */
    .flare-topbar-front .flare-topbar-nav .nav-link:not(.active):hover {
        background: rgba(107, 33, 168, 0.06);
    }

    /* gradient runs top-to-bottom on the tall desktop block so both
       ends are visible; the old magenta bottom line is dropped since
       it would just blend into the magenta end */
    .flare-topbar-front .flare-topbar-nav .nav-link.active,
    .flare-topbar-front .flare-topbar-nav .nav-link.active:hover {
        background: linear-gradient(160deg, var(--flare-violet) 0%, var(--flare-magenta) 100%);
        box-shadow: none;
    }

    .flare-topbar-sep {
        align-self: center;
        margin: 0 0.5rem;
    }
}

/* tablet/mobile: a little taller bar, solid active row in the menu */
@media (max-width: 991.98px) {
    .flare-topbar-front {
        padding-top: 0.85rem;
        padding-bottom: 0.85rem;
    }
}

/* ------------------------------------------------------------ */
/* Front-end login modal (#loginModalCenter)                      */
/* Split layout: gradient brand panel + clean form panel.         */
/* ------------------------------------------------------------ */
.flare-login-modal .modal-dialog { max-width: 52rem; }

.flare-login-modal .modal-content {
    border: 0;
    border-radius: 1.25rem;
    overflow: hidden;
    background: var(--flare-surface);
    box-shadow: 0 2rem 4rem -1rem rgba(20, 10, 40, 0.45);
}

.flare-login-modal-grid {
    display: grid;
    grid-template-columns: 5fr 7fr;
    min-height: 28rem;
}

/* Brand side */
.flare-login-modal-brand {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 2.25rem 2rem;
    color: var(--flare-text-on-dark);
    /* same 22% contrast tint used by .flare-login-panel / CTA banner */
    background: linear-gradient(rgba(25, 12, 50, 0.22), rgba(25, 12, 50, 0.22)), var(--flare-gradient);
    background-size: 100% 100%, 180% 180%;
    animation: flareGradientDrift 14s ease-in-out infinite alternate;
}
.flare-login-modal-brand::before,
.flare-login-modal-brand::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    pointer-events: none;
}
.flare-login-modal-brand::before { width: 18rem; height: 18rem; right: -7rem; bottom: -7rem; }
.flare-login-modal-brand::after  { width: 11rem; height: 11rem; right: -2.5rem; bottom: -2.5rem; background: rgba(255, 255, 255, 0.06); }

.flare-login-modal-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0.5rem 1rem rgba(20, 10, 40, 0.25);
    flex-shrink: 0;
}
.flare-login-modal-mark img { width: 2rem; height: 2rem; object-fit: contain; }

.flare-login-modal-eyebrow {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--flare-text-on-dark-muted);
}
.flare-login-modal-headline {
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.35;
    color: #fff;
}

.flare-login-modal-mark,
.flare-login-modal-brand-text,
.flare-login-modal-points { position: relative; z-index: 1; }
.flare-login-modal-points { margin-top: auto; }
.flare-login-modal-points li {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.9rem;
    color: var(--flare-text-on-dark);
}
.flare-login-modal-points li + li { margin-top: 0.75rem; }
.flare-login-modal-points i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.6rem;
    background: rgba(255, 255, 255, 0.16);
    flex-shrink: 0;
}

/* Form side */
.flare-login-modal-form {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2.75rem 2.5rem 2rem;
}
.flare-login-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border-radius: 50%;
    background-size: 0.8rem;
    background-color: var(--flare-surface-muted);
    opacity: 0.8;
}
.flare-login-modal-close:hover { opacity: 1; }

.flare-login-modal-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--flare-text);
    margin-bottom: 0.25rem;
}
.flare-login-modal-sub {
    color: var(--flare-text-muted);
    font-size: 0.925rem;
    margin-bottom: 1.75rem;
}

.flare-login-modal .form-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--flare-text);
    margin-bottom: 0.4rem;
}

/* Input with leading icon (+ optional trailing eye button) */
.flare-login-field { position: relative; }
.flare-login-field > .bi {
    position: absolute;
    left: 1rem;
    top: 1.5rem;
    transform: translateY(-50%);
    color: var(--flare-text-muted);
    pointer-events: none;
    z-index: 2;
}
.flare-login-field .form-control {
    height: 3rem;
    padding-left: 2.75rem;
    border-radius: 0.75rem;
    border: 1px solid var(--flare-border);
    background-color: var(--flare-body-bg);
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.flare-login-field .form-control::placeholder { color: #A9A3B8; }
.flare-login-field .form-control:focus {
    background-color: #fff;
    border-color: var(--flare-violet);
    box-shadow: 0 0 0 0.25rem rgba(107, 33, 168, 0.14);
}
.flare-login-field:focus-within > .bi { color: var(--flare-violet); }
.flare-login-field #password { padding-right: 3rem; }
/* keep the field clean: no Bootstrap validation icon overlapping the eye */
.flare-login-modal .was-validated .form-control:invalid,
.flare-login-modal .was-validated .form-control:valid { background-image: none; padding-right: 1rem; }
.flare-login-modal .was-validated #password:invalid,
.flare-login-modal .was-validated #password:valid { padding-right: 3rem; }

.flare-login-eye {
    position: absolute;
    right: 0.4rem;
    top: 1.5rem;
    transform: translateY(-50%);
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: var(--flare-text-muted);
    z-index: 2;
}
.flare-login-eye:hover { color: var(--flare-violet); background: var(--flare-surface-muted); }
.flare-login-eye:focus-visible { outline: 2px solid var(--flare-violet); outline-offset: 1px; }

.flare-login-submit {
    height: 3rem;
    border-radius: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.flare-login-submit .bi { transition: transform .2s var(--flare-ease-out, ease); }
.flare-login-submit:hover .bi { transform: translateX(3px); }

.flare-login-modal-help {
    margin: 1.5rem 0 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--flare-text-muted);
}
.flare-login-modal-help a { color: var(--flare-violet); font-weight: 600; text-decoration: none; }
.flare-login-modal-help a:hover { text-decoration: underline; }

/* Mobile: stack, brand becomes a slim header strip */
@media (max-width: 767.98px) {
    .flare-login-modal-grid { grid-template-columns: 1fr; min-height: 0; }
    .flare-login-modal-brand {
        flex-direction: row;
        align-items: center;
        gap: 0.9rem;
        padding: 1.25rem 1.5rem;
    }
    .flare-login-modal-mark { width: 2.75rem; height: 2.75rem; }
    .flare-login-modal-mark img { width: 1.7rem; height: 1.7rem; }
    .flare-login-modal-headline { font-size: 1.05rem; }
    .flare-login-modal-eyebrow { font-size: 0.7rem; margin-bottom: 0.1rem !important; }
    .flare-login-modal-points { display: none; }
    .flare-login-modal-brand { padding-right: 4rem; } /* room for the close button */
    /* static so the close button anchors to .modal-content and sits on the brand strip */
    .flare-login-modal-form { position: static; padding: 1.75rem 1.5rem 1.5rem; }
    .flare-login-modal-close { background-color: rgba(255, 255, 255, 0.9); z-index: 3; }
    .flare-login-modal-title { font-size: 1.35rem; }
    .flare-login-modal-sub { margin-bottom: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
    .flare-login-modal-brand { animation: none; }
    .flare-login-submit .bi { transition: none; }
}
