/* Design tokens — mapped onto daisyUI's official "lofi" (light) and "black"
   (dark) theme palettes (exact OKLCH values pulled from the installed
   daisyui npm package: node_modules/daisyui/theme/lofi.css and black.css),
   keeping the app's existing shadcn-style token NAMES so every one of the
   ~2,357 inline var(--x) usages and 348 custom classes across the app
   re-themes with zero markup changes. See buzzing-skipping-pebble.md for
   the full token-mapping rationale (which daisyUI semantic color feeds
   which app token, and why --gain/--loss pick whichever of base/-content
   has adequate contrast against that theme's own background). */

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

:root {
    /* lofi (light) — default, and also the no-JS/pre-hydration fallback */
    /* Sharp square corners in both themes (user preference) — daisyUI's
       authentic lofi theme ships rounded radii (0.5rem/0.25rem/2rem box/
       field/selector), which would make light mode look rounded while dark
       mode (daisyUI's authentic black theme) is sharp. Zeroed here, and the
       daisyUI radius vars below are overridden the same way --color-success
       etc. are — same class of "daisyUI's own var, not just this app's
       token" issue documented elsewhere in this file. */
    --radius: 0rem;
    --background: oklch(97% 0 0);
    --foreground: oklch(0% 0 0);
    --card: oklch(100% 0 0);
    --card-foreground: oklch(0% 0 0);
    --popover: oklch(100% 0 0);
    --popover-foreground: oklch(0% 0 0);
    --primary: oklch(15.906% 0 0);
    --primary-foreground: oklch(100% 0 0);
    --secondary: oklch(21.455% 0.001 17.278);
    --secondary-foreground: oklch(100% 0 0);
    --muted: oklch(97% 0 0);
    /* Was oklch(0% 0 0 / 55%) — 55%-alpha black over this theme's near-white
       background effectively renders as a mid-gray with borderline/failing
       contrast for small text (labels, timestamps, descriptions — used at
       ~100 call sites app-wide). Switched to a solid, darker gray so every
       one of those secondary-text spots stays legible without touching each
       call site individually. */
    --muted-foreground: oklch(35% 0 0);
    --accent: oklch(94% 0 0);
    --accent-foreground: oklch(0% 0 0);
    /* --destructive/--gain/--loss deliberately break from the daisyUI-derived
       palette above: lofi's own success/error tokens are very low-chroma by
       design (its whole aesthetic is muted/near-monochrome), which made
       heatmaps and gain/loss figures look washed-out and hard to read at a
       glance — exactly the one place a trading app needs unambiguous, vivid
       red/green. These are the same proven values the app used before this
       migration. */
    --destructive: #dc2626;
    --destructive-foreground: #ffffff;
    /* Named --border-color, not --border: daisyUI's own theme vars use the
       bare name --border for something completely different (a *width*,
       e.g. "1px", used internally by its component CSS for proportional
       padding math) — since theme.css loads after daisyui.build.css so our
       color overrides above can win, an unrenamed --border here would
       silently clobber daisyUI's width variable with a color, breaking
       padding/sizing on every daisyUI component (found via a du-badge
       rendering with zero padding). Every var(--border-color) usage across the
       app (~176 call sites) was renamed to var(--border-color) to match. */
    /* Was 94% (barely distinguishable from --card's 100% white / --background's
       97%) — darkened so card and field borders are actually visible in
       light mode instead of nearly disappearing. */
    --border-color: oklch(85% 0 0);
    --input: oklch(85% 0 0);
    --ring: oklch(15.906% 0 0);
    --chart-1: oklch(15.906% 0 0);
    --chart-2: oklch(79.54% 0.103 205.9);
    --chart-3: oklch(90.13% 0.153 164.14);
    --chart-4: oklch(88.37% 0.135 79.94);
    --chart-5: oklch(78.66% 0.15 28.47);
    --sidebar: oklch(100% 0 0);
    --sidebar-foreground: oklch(0% 0 0);
    --sidebar-primary: oklch(15.906% 0 0);
    --sidebar-primary-foreground: oklch(100% 0 0);
    --sidebar-accent: oklch(94% 0 0);
    --sidebar-accent-foreground: oklch(0% 0 0);
    --sidebar-border: oklch(85% 0 0);
    --sidebar-ring: oklch(15.906% 0 0);
    --gain: #059669;
    --gain-foreground: #ffffff;
    --loss: #dc2626;
    --loss-foreground: #ffffff;
    /* daisyUI's own semantic color vars (theme.css loads after
       daisyui.build.css specifically so these win) — same reasoning as
       --gain/--loss above: daisyUI's real lofi success/error are too
       low-chroma for financial red/green, so every du-badge-success,
       du-alert-error, du-btn-success etc. used anywhere in the app stays
       consistent with --gain/--loss instead of reverting to muddy tones. */
    --color-success: var(--gain);
    --color-success-content: var(--gain-foreground);
    --color-error: var(--loss);
    --color-error-content: var(--loss-foreground);
    /* Same low-chroma issue as success/error above: daisyUI's real lofi
       warning is a very pale, washed-out yellow with poor text contrast
       (found on the "Email Not Verified" banner in light mode). amber-600
       (#d97706) was tried first but only clears ~3:1 against the pale
       du-alert-soft background — bumped to amber-700 for ~4.8:1, AA-safe
       for the banner's small text. */
    --color-warning: #b45309;
    --color-warning-content: #ffffff;
    --color-primary: var(--primary);
    --color-primary-content: var(--primary-foreground);
    /* Same barely-visible-border bug --border-color was already fixed for
       (see its comment above), but that fix only covers the ~176 call
       sites using var(--border-color) directly — every du-card/du-badge/etc.
       styled with daisyUI's own `border-base-300` utility class reads THIS
       variable instead and was still getting the unfixed 94%-vs-100%
       lofi default (near-invisible against --color-base-100's white),
       e.g. every stacked card on Portfolio/Retirement/Settings/Support
       looking borderless. Matches --border-color/--card-border's already-
       chosen value for consistency. Dark mode's real black-theme value
       (22% vs 0% background) has plenty of contrast already, untouched. */
    --color-base-300: oklch(85% 0 0);
    --radius-selector: 0rem;
    --radius-field: 0rem;
    --radius-box: 0rem;
    --card-gradient-end: oklch(100% 0 0);
    --card-border: oklch(85% 0 0);
    --font-sans: 'Montserrat', ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    --font-mono: 'Montserrat', ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

/* Same legibility bug as --muted-foreground above, different color system:
   Tailwind's text-base-content/60 (149 call sites across the daisyUI-migrated
   pages) compiles to color-mix(in oklab, var(--color-base-content) 60%,
   transparent) — daisyUI's authentic lofi --color-base-content is pure
   black, so at 60% it alpha-blends down to a washed-out mid-gray on this
   theme's near-white background, same as the old --muted-foreground did.
   Unlayered here beats Tailwind's own layered utility (same cascade rule
   used throughout this file), scoped to light mode only since dark mode's
   base-content (already light-on-dark) doesn't have this problem. */
html:not([data-theme="black"]) .text-base-content\/60 {
    color: oklch(35% 0 0);
}

html[data-theme="black"] {
    --radius: 0rem;
    --background: oklch(0% 0 0);
    --foreground: oklch(87.609% 0 0);
    --card: oklch(19% 0 0);
    --card-foreground: oklch(87.609% 0 0);
    --popover: oklch(19% 0 0);
    --popover-foreground: oklch(87.609% 0 0);
    /* --primary (and --ring/--sidebar-primary/--sidebar-ring/--chart-1 below,
       which all derive their "this is active/interactive" meaning from it)
       deliberately breaks from daisyUI's real black-theme primary — that's
       an intentionally monochrome oklch(35% 0 0) dark gray, which has almost
       no contrast against this theme's near-black background/card surfaces.
       Found via the collapsed sidebar's active nav icon actually looking
       *dimmer* than the inactive ones (color-mix'd primary tint blended
       into the dark background instead of standing out). Same reasoning as
       --gain/--loss in this file: restored the vivid blue this app used
       before the daisyUI migration, which has real contrast against black. */
    --primary: #3b82f6;
    --primary-foreground: oklch(100% 0 0);
    --secondary: oklch(35% 0 0);
    --secondary-foreground: oklch(100% 0 0);
    --muted: oklch(19% 0 0);
    --muted-foreground: oklch(87.609% 0 0 / 65%);
    --accent: oklch(22% 0 0);
    --accent-foreground: oklch(87.609% 0 0);
    --destructive: #f87171;
    --destructive-foreground: #ffffff;
    --border-color: oklch(22% 0 0);
    --input: oklch(22% 0 0);
    --ring: #3b82f6;
    --chart-1: #3b82f6;
    --chart-2: oklch(45.201% 0.313 264.052);
    --chart-3: oklch(51.975% 0.176 142.495);
    --chart-4: oklch(96.798% 0.211 109.769);
    --chart-5: oklch(62.795% 0.257 29.233);
    --sidebar: oklch(19% 0 0);
    --sidebar-foreground: oklch(87.609% 0 0);
    --sidebar-primary: #3b82f6;
    --sidebar-primary-foreground: oklch(100% 0 0);
    --sidebar-accent: oklch(22% 0 0);
    --sidebar-accent-foreground: oklch(87.609% 0 0);
    --sidebar-border: oklch(22% 0 0);
    --sidebar-ring: #3b82f6;
    --gain: #34d399;
    --gain-foreground: #022c1a;
    --loss: #f87171;
    --loss-foreground: #450a0a;
    --color-success: var(--gain);
    --color-success-content: var(--gain-foreground);
    --color-error: var(--loss);
    --color-error-content: var(--loss-foreground);
    --color-warning: #fbbf24;
    --color-warning-content: #451a03;
    --color-primary: var(--primary);
    --color-primary-content: var(--primary-foreground);
    --card-gradient-end: oklch(19% 0 0);
    --card-border: oklch(22% 0 0);
}

* {
    border-color: var(--border-color);
}

/* daisyUI's .input/.select/.textarea use a low-contrast component-local
   border color by default. The real reason it was invisible pre-fix wasn't
   contrast though — the "Global parity fix" rule below was forcing every
   plain input/select/textarea's border-color to transparent with !important
   at much higher specificity, daisyUI fields included, until the :not(.du-*)
   exclusions were added to it above. With that fixed, this just sets a
   thin, clearly-visible border using the same token every un-migrated
   field already renders correctly in both themes. */
.du-input, .du-select, .du-textarea {
    border-color: var(--input);
}

/* Elements with the native `hidden` attribute must stay hidden even when a
   class (e.g. .btn's display:inline-flex) also sets `display` — otherwise
   the cascade lets that class win since author rules always beat the UA
   default `[hidden] { display: none }`. */
[hidden] {
    display: none !important;
}

/* Chrome/Edge/Safari force a light autofill background (yellow or pale
   blue) via UA styles with near-unbeatable specificity — the only override
   that works is this box-shadow trick, painting the field's own background
   color over a huge inset shadow so it reads as "not filled" instead of
   flashing light in an otherwise dark-themed form. Without this, every
   input a real user's password manager fills would ignore the site theme. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-text-fill-color: var(--foreground) !important;
    caret-color: var(--foreground);
    transition: background-color 5000s ease-in-out 0s;
    -webkit-box-shadow: 0 0 0 1000px var(--background) inset !important;
    box-shadow: 0 0 0 1000px var(--background) inset !important;
}
html[data-theme="black"] input:-webkit-autofill,
html[data-theme="black"] input:-webkit-autofill:hover,
html[data-theme="black"] input:-webkit-autofill:focus,
html[data-theme="black"] input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--card) inset !important;
    box-shadow: 0 0 0 1000px var(--card) inset !important;
}

/* The live reference site is Tailwind-based, which zeroes paragraph margins
   as part of its preflight reset — every gap there is explicit utility
   spacing (mt-0.5, gap-2, etc). Match that baseline so a bare <p> never
   silently inherits the browser's ~1em default margin. */
p {
    margin: 0;
}

html, body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

body {
    background: var(--background);
    color: var(--foreground);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

/* Form controls don't inherit the body font by default in any browser —
   without this they render in the OS UI font (Arial on Windows) even
   though every other element correctly uses --font-sans. */
input, button, select, textarea, optgroup {
    font-family: inherit;
    font-size: inherit;
}

.font-mono { font-family: var(--font-mono); }

/* ---------------------------------------------------------------- */
/* Layout                                                             */
/* ---------------------------------------------------------------- */

.app-shell {
    display: flex;
    height: 100dvh;
    overflow: hidden;
    background: var(--background);
}

/* Sidebar collapse/expand is driven by the real daisyUI drawer checkbox
   (#app-drawer, see includes/header.php) via :has() — pure CSS, reactive to
   the same checked state that also drives daisyUI's own mobile off-canvas
   overlay (drawer-toggle:checked ~ drawer-side) and the desktop
   is-drawer-close:/is-drawer-open: utility variants used directly in
   includes/sidebar.php for simple show/hide toggles (labels, tooltips).
   :has() carries the *shape*-changing rules below (grid-vs-column layout,
   tile-vs-row nav items, icon sizing, active indicator) since expressing
   those as repeated is-drawer-*: utility classes on every one of the ~12
   nav items would be far more verbose than one selector here. Below the lg
   breakpoint this app's own rules don't apply at all — daisyUI's drawer-side
   already owns the fixed-position/translate off-canvas mechanics there, and
   the mobile-open state always shows the full labeled tile grid (no
   icon-only rail on mobile — collapse is a desktop-only affordance). */
.sidebar {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 260px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--sidebar), color-mix(in srgb, var(--sidebar) 92%, var(--primary)));
    border-right: 1px solid var(--sidebar-border);
    color: var(--sidebar-foreground);
    overflow: hidden;
    transition: width 0.2s ease;
}

@media (min-width: 1024px) {
    /* overflow:visible is still needed here — .sidebar is its own clipping
       context nested inside .du-drawer-side, so the wrapper's own
       du-is-drawer-close:overflow-visible (includes/sidebar.php) only gets
       content past *that* boundary; without this, .sidebar itself still
       clips anything trying to escape it (the nav-item tooltip, and the
       footer avatar's Settings/Log out popover). This does NOT reintroduce
       the earlier vertical-scroll-cutoff bug: .sidebar itself was never the
       thing overflowing there (confirmed via scrollHeight === clientHeight
       even with this set) — that was .sidebar-nav's own hidden scrollbar,
       fixed below independently of this. */
    :root:has(#app-drawer:not(:checked)) .sidebar { width: 68px; overflow: visible; }
    /* When collapsed, the icon rail can hold more nav items than fit in a
       short viewport. .sidebar-nav scrolls vertically to reach the rest
       instead of just cutting them off, with a slim scrollbar as a visible
       hint that's possible.
       This used to also be where the collapsed-state hover tooltip's escape
       path lived — it can't: per spec, whenever one axis's overflow is
       anything other than visible, the browser forces the *computed* value
       of the OTHER axis away from true visible too (confirmed live —
       overflow-x:visible here while overflow-y stayed auto still computed
       to overflow-x:auto, which still clips), so a CSS-only tooltip
       escaping sideways and a scrolling icon rail can never coexist on the
       same element. The tooltip is now rendered by JS into a single shared
       #sidebarTooltip element living outside .sidebar-nav entirely (see
       initSidebarTooltips() in assets/js/app.js, and .sidebar-tooltip-float
       below) — position:fixed, positioned from getBoundingClientRect() on
       hover, so it's never subject to this container's clipping and this
       scroll can stay a normal scroll. */
    :root:has(#app-drawer:not(:checked)) .sidebar .sidebar-nav {
        overflow-y: auto;
        overflow-x: hidden;
        scrollbar-width: thin;
        -ms-overflow-style: auto;
    }
    :root:has(#app-drawer:not(:checked)) .sidebar .sidebar-nav::-webkit-scrollbar {
        display: block;
        width: 4px;
    }
    :root:has(#app-drawer:not(:checked)) .sidebar .sidebar-nav::-webkit-scrollbar-thumb {
        background: color-mix(in srgb, var(--sidebar-foreground) 25%, transparent);
        border-radius: 4px;
    }
}

.sidebar-tooltip-float {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999;
    background: #1f2937;
    color: #fff;
    font-size: 0.78rem;
    line-height: 1.25;
    padding: 0.3rem 0.6rem;
    border-radius: 0.4rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
    transition: opacity .1s ease;
}
.sidebar-tooltip-float.is-visible { opacity: 1; visibility: visible; }

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    flex-shrink: 0;
}

.sidebar-logo { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.sidebar-logo img { width: 34px; height: 34px; border-radius: 0.5rem; object-fit: contain; flex-shrink: 0; }
.sidebar-brand-text { min-width: 0; }
.sidebar-brand { font-size: 0.85rem; font-weight: 700; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-brand-sub { font-size: 0.6rem; font-weight: 500; color: var(--muted-foreground); line-height: 1; margin-top: 0.15rem; white-space: nowrap; }
/* .sidebar-brand-text/.nav-label visibility is handled directly in markup
   via the is-drawer-close:hidden utility (includes/sidebar.php) — no CSS
   needed here, and it naturally only takes effect where the drawer-side is
   actually visible (mobile-closed hides the whole sidebar regardless). */

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    /* Without an explicit overflow-x, it auto-computes to "auto" (per spec,
       whenever overflow-y isn't visible) — the collapsed .nav-active-bar
       used to poke out past this container's left edge (see below) and
       that alone was enough to trigger a horizontal scrollbar. Pinned
       hidden so vertical is the only scroll axis, ever. */
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0.5rem 0.4rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
    align-content: start;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

@media (min-width: 1024px) {
:root:has(#app-drawer:not(:checked)) .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.35rem 0.15rem;
    aspect-ratio: 1;
    min-width: 0;
    border-radius: var(--radius);
    border: 1px solid transparent;
    background: transparent;
    color: var(--sidebar-foreground);
    text-decoration: none;
    text-align: center;
    position: relative;
    transition: background-color .15s ease, border-color .15s ease;
}
.nav-item:hover {
    border-color: color-mix(in srgb, var(--primary) 20%, transparent);
    background: color-mix(in srgb, var(--card) 60%, transparent);
}

.nav-item .nav-icon-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 0.5rem;
    background: color-mix(in srgb, var(--muted) 65%, transparent);
    color: var(--muted-foreground);
    flex-shrink: 0;
    transition: background-color .15s ease, color .15s ease, width .1s ease, height .1s ease;
}
.nav-item .nav-icon-box svg { width: 15px; height: 15px; }

.nav-item .nav-label {
    font-size: 10px;
    line-height: 1.15;
    font-weight: 500;
    color: var(--sidebar-foreground);
    opacity: 0.85;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-item:hover .nav-icon-box { background: var(--sidebar-accent); }

.nav-item.active .nav-icon-box {
    background: color-mix(in srgb, var(--primary) 18%, transparent);
    color: var(--primary);
}
.nav-item.active .nav-label { color: var(--primary); font-weight: 600; opacity: 1; }

/* Collapsed-sidebar hover tooltip: previously the real daisyUI du-tooltip
   component (data-tip + is-drawer-close:du-tooltip in the markup), but that
   requires .sidebar-nav to have visible overflow to escape sideways, which
   is fundamentally incompatible with .sidebar-nav also needing to scroll
   vertically (see the .sidebar-nav comment above). Replaced with a small
   JS-positioned tooltip — see initSidebarTooltips() in assets/js/app.js and
   .sidebar-tooltip-float above; includes/sidebar.php and
   includes/admin_sidebar.php still carry data-tip on each .nav-item as the
   label source, just without the du-tooltip trigger classes. */

@media (min-width: 1024px) {
:root:has(#app-drawer:not(:checked)) .nav-item {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    width: 100%;
    aspect-ratio: auto;
    padding: 0.625rem 0;
    border: none;
    background: transparent;
    border-radius: 0.5rem;
}
:root:has(#app-drawer:not(:checked)) .nav-item:hover { background: color-mix(in srgb, var(--sidebar-accent) 80%, transparent); border-color: transparent; }
:root:has(#app-drawer:not(:checked)) .nav-item .nav-icon-box {
    width: auto;
    height: auto;
    background: transparent;
    color: var(--muted-foreground);
}
:root:has(#app-drawer:not(:checked)) .nav-item:hover .nav-icon-box,
:root:has(#app-drawer:not(:checked)) .nav-item.active .nav-icon-box { background: transparent; color: var(--sidebar-foreground); }
:root:has(#app-drawer:not(:checked)) .nav-item .nav-icon-box svg { width: 18px; height: 18px; }
/* A real element (.nav-active-bar), not ::before — the collapsed nav-item
   also carries daisyUI's du-tooltip component (for the hover label), which
   owns both ::before (bubble) and ::after (tail) on the same element. Using
   ::before here for the active-indicator collided with the tooltip's own
   ::before, producing one broken hybrid box instead of either feature
   working correctly. */
:root:has(#app-drawer:not(:checked)) .nav-item .nav-active-bar {
    display: block;
    position: absolute;
    /* Sits at the item's own left edge rather than escaping outside it
       (this used to be -0.6rem, reaching for the sidebar's outer edge) —
       .sidebar-nav now clips overflow-x, so anything poking past its own
       box would just get cut off. */
    left: 0;
    top: 0.15rem;
    bottom: 0.15rem;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(180deg, var(--primary), color-mix(in srgb, var(--primary) 40%, transparent));
    opacity: 0;
}
:root:has(#app-drawer:not(:checked)) .nav-item.active .nav-active-bar { opacity: 1; }
/* .user-actions sets its own display:flex (below) for the expanded layout;
   that unlayered declaration otherwise beats the layered
   du-is-drawer-close:hidden Tailwind utility applied in markup, so it needs
   an explicit override here to actually hide when collapsed. */
:root:has(#app-drawer:not(:checked)) .user-actions { display: none; }
}

.sidebar-footer {
    flex-shrink: 0;
    border-top: 1px solid color-mix(in srgb, var(--border-color) 60%, transparent);
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.help-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.4rem 0.45rem;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    background: linear-gradient(90deg, rgba(37,99,235,.10), rgba(147,51,234,.10), rgba(219,39,119,.10));
    color: inherit;
}
.help-card .help-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 0.55rem;
    background: linear-gradient(135deg, #3b82f6, #ec4899);
    color: #fff;
    flex-shrink: 0;
}
.help-card .help-icon svg { width: 14px; height: 14px; }
.help-card .help-title { display: block; font-size: 0.72rem; font-weight: 600; line-height: 1.2; }
/* Was a trailing </br> in the markup instead of display:block here — an
   actual <br> inherits the surrounding (larger) font's line-height, not
   this element's own smaller one, so the gap it added between the heading
   and subheading was noticeably bigger than the margin-top below intended. */
.help-card .help-sub { display: block; font-size: 0.62rem; color: var(--muted-foreground); margin-top: 0.05rem; line-height: 1.25; }
/* .help-text/.user-info/.user-actions visibility and the centered layout on
   collapse are handled directly in markup via is-drawer-close: utilities. */

.user-row { display: flex; align-items: center; gap: 0.45rem; padding: 0.25rem 0.3rem; border-radius: 0.6rem; }
.user-row:hover { background: var(--sidebar-accent); }
.user-row .user-info { flex: 1; min-width: 0; }
.user-row .user-name { font-size: 0.7rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; line-height: 1.2; }
.user-row .user-email { font-size: 0.6rem; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0.05rem 0 0; line-height: 1.2; }
.user-row .user-actions { display: flex; gap: 0.1rem; flex-shrink: 0; }

.main-col { display: flex; flex: 1; flex-direction: column; overflow: hidden; }

.topbar {
    z-index: 40;
    display: flex;
    height: 56px;
    flex-shrink: 0;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    padding: 0 1rem;
    background: linear-gradient(90deg, var(--card), color-mix(in srgb, var(--card) 90%, var(--primary)));
}

.topbar .spacer { flex: 1; }

.topbar-search {
    position: relative;
    display: none;
}
@media (min-width: 640px) { .topbar-search { display: block; } }

.topbar-search input {
    width: 16rem;
    height: 2rem;
    padding: 0.25rem 0.75rem 0.25rem 2.25rem;
    border-radius: var(--radius-field);
    border: 1px solid var(--input);
    background: color-mix(in srgb, var(--muted) 40%, transparent);
    color: var(--foreground);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.topbar-search input:focus-visible {
    border-color: color-mix(in srgb, var(--primary) 40%, transparent);
    background: var(--background);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}
.topbar-search svg {
    position: absolute;
    left: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--muted-foreground);
}

.input {
    display: block;
    width: 100%;
    height: 2.25rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--input);
    background: color-mix(in srgb, var(--muted) 40%, transparent);
    color: var(--foreground);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder { color: var(--muted-foreground); }
.input:focus-visible {
    border-color: color-mix(in srgb, var(--primary) 40%, transparent);
    background: var(--background);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}
select.input { cursor: pointer; }
textarea.input { height: auto; min-height: 5rem; resize: vertical; }

/* Global form-field parity fix: most form inputs across the app were built
   with an inline "border:1px solid var(--input); background:var(--background)"
   style (~200 occurrences across 30+ files). This rule overrides all of them
   at once rather than editing every call site, so every field in the app —
   migrated or not — gets the same always-visible thin border and sharp
   square corners as the rest of the app's buttons/cards, with a stronger
   border + solid background on focus. (Earlier this rule made every field
   borderless at rest, matching a different reference design; that's been
   superseded by an explicit always-visible-border request — the resting
   and focus states below both set a real border-color now, just at
   different strengths, instead of resting on transparent.)
   Uses background-color (not the background shorthand) so it doesn't clobber the
   custom chevron background-image some <select> elements set inline. The
   !important on border-radius exists specifically to beat the ~200 inline
   per-field radius values (e.g. "border-radius:.5rem") that would otherwise
   keep those fields rounded regardless of this rule's border-color fix.
   Elements that intentionally embed a borderless input inside a styled wrapper
   (e.g. .trade-price-input input) opt out via the .no-parity class. daisyUI's
   du-input/du-select/du-textarea fields opt out here since they already carry
   their own correct border (this rule's high specificity + !important was
   previously silently forcing their border transparent regardless of any
   daisyUI or override color — not a daisyUI contrast issue). .auth-input
   (the standalone auth/*.php pages, which never go through daisyUI markup at
   all) opts out for the same reason, with its own equivalent border/radius
   already set directly on the class. */
input:not([type="radio"]):not([type="checkbox"]):not([type="range"]):not([type="file"]):not(.no-parity):not(.du-input):not(.auth-input),
select:not(.no-parity):not(.du-select), textarea:not(.no-parity):not(.du-textarea) {
    border-color: var(--input) !important;
    border-radius: var(--radius) !important;
    background-color: color-mix(in srgb, var(--muted) 40%, transparent) !important;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
input:not([type="radio"]):not([type="checkbox"]):not([type="range"]):not([type="file"]):not(.no-parity):not(.du-input):not(.auth-input):focus-visible,
select:not(.no-parity):not(.du-select):focus-visible, textarea:not(.no-parity):not(.du-textarea):focus-visible {
    border-color: color-mix(in srgb, var(--primary) 40%, transparent) !important;
    background-color: var(--background) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
    outline: none;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    border: none;
    background: transparent;
    color: var(--foreground);
    cursor: pointer;
}
.icon-btn:hover { background: var(--accent); }
.icon-btn svg { width: 17px; height: 17px; }

@media (max-width: 639px) {
    .hide-sm { display: none !important; }
}

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    box-shadow: 0 0 0 2px rgba(20,184,166,.2);
}

.social-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: none;
    background: transparent;
    border-radius: 999px;
    padding: 0.35rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.social-action-btn:hover { background: var(--accent); color: var(--foreground); }
.social-action-btn:disabled { cursor: default; }
.social-action-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.social-action-btn.active-like { color: #ef4444; }
.social-action-btn.active-like svg { fill: #ef4444; }
.social-action-btn.active-bookmark { color: var(--primary); }
.social-action-btn.active-bookmark svg { fill: var(--primary); }
.social-action-btn.active-comment { color: var(--primary); }

.watchlist-star-form { display: inline-flex; line-height: 0; }
.watchlist-star {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    border: none;
    background: transparent;
    border-radius: 999px;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.watchlist-star:hover { background: var(--accent); color: var(--foreground); }
.watchlist-star svg { width: 15px; height: 15px; flex-shrink: 0; }
.watchlist-star.active { color: #f59e0b; }
.watchlist-star.active svg { fill: #f59e0b; }

.social-comments {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.social-comment-row { display: flex; gap: 0.5rem; align-items: flex-start; }

.content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0.5rem 0.5rem 4rem;
}
.content::-webkit-scrollbar { display: none; }
@media (min-width: 640px) { .content { padding: 0.75rem 0.75rem 4rem; } }
@media (min-width: 1024px) { .content { padding: 1rem 1rem 4rem; } }

.content-inner {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--muted-foreground);
}
.breadcrumb strong { color: var(--foreground); font-weight: 600; display: inline-flex; align-items: center; gap: .3rem; }
.breadcrumb-link { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted-foreground); text-decoration: none; transition: color .15s; }
.breadcrumb-link:hover { color: var(--foreground); }
.breadcrumb svg, .breadcrumb-link svg { width: 13px; height: 13px; flex-shrink: 0; }
.breadcrumb strong svg { color: var(--primary); }
.breadcrumb-separator { color: var(--muted-foreground); opacity: .6; }

.tab-bar {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0;
    flex-wrap: wrap;
}
.tab-link {
    padding: 0.5rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.tab-link svg { width: 15px; height: 15px; flex-shrink: 0; }
.tab-link:hover { color: var(--foreground); }
.tab-link.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ---------------------------------------------------------------- */
/* Components                                                        */
/* ---------------------------------------------------------------- */

.card {
    background: linear-gradient(145deg, var(--card), var(--card-gradient-end));
    color: var(--card-foreground);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .1), 0 1px 2px -1px rgba(0, 0, 0, .1);
    transition: box-shadow .2s;
}

/* Auth screens (login / forgot / reset / 2FA / register) — a distinct
   "glass card" treatment matching the reference site's sign-in screen
   exactly (softer/larger shadow + inset top highlight vs the standard
   .card, 24px padding on all sides instead of .card's tighter default). */
.auth-shell { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem; background: var(--background); }
/* The back/theme buttons aren't pinned to the viewport corners on live —
   they sit at the left/right edges of the card itself, so on wide desktop
   screens they stay close to the content instead of stranding out at the
   browser edges. Container width matches .auth-card's so left:0/right:0
   actually lines up with the card, not a wider invisible column around it. */
.auth-container { width: 100%; max-width: 400px; margin: 0 auto; position: relative; }
.auth-icon-btn { position: absolute; top: 0; width: 32px; height: 32px; border-radius: var(--radius); background: var(--muted); display: inline-flex; align-items: center; justify-content: center; color: var(--foreground); text-decoration: none; border: none; cursor: pointer; }
.auth-icon-btn svg { width: 16px; height: 16px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: .3rem; margin-bottom: 1.5rem; }
.auth-brand img { width: 40px; height: 40px; }
.auth-brand-name { font-weight: 700; font-size: 1.5rem; color: var(--primary); margin-top: .3rem; line-height: 1.3; }
.auth-slogan { font-size: .875rem; color: var(--muted-foreground); }
.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 1.5rem;
    border-radius: var(--radius);
    background: linear-gradient(145deg, var(--card), var(--card-gradient-end));
    border: 1px solid rgba(255, 255, 255, .35);
    box-shadow: 0 4px 24px rgba(15, 23, 42, .08), inset 0 1px 0 rgba(255, 255, 255, .4);
}
html[data-theme="black"] .auth-card {
    border-color: rgba(255, 255, 255, .12);
    box-shadow: 0 4px 24px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.auth-heading { font-size: 1.25rem; font-weight: 600; line-height: 1.4; color: var(--foreground); }
.auth-subtitle { font-size: .875rem; color: var(--muted-foreground); margin-top: .25rem; margin-bottom: 1.1rem; line-height: 1.43; }
.auth-label { font-size: .875rem; font-weight: 500; display: block; margin-bottom: .5rem; color: var(--foreground); }
.auth-input-wrap { position: relative; }
.auth-input-icon { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); pointer-events: none; display: flex; }
.auth-input { width: 100%; height: 44px; padding: 0 .75rem 0 2.25rem; border-radius: var(--radius); border: 1px solid var(--input); background: transparent; color: var(--foreground); font-size: .875rem; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
html[data-theme="black"] .auth-input { background: color-mix(in srgb, var(--input) 30%, transparent); }
.auth-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
.auth-field { display: flex; flex-direction: column; gap: 0; }
.auth-footer { max-width: 400px; text-align: center; margin-top: 1.25rem; font-size: .72rem; color: var(--muted-foreground); line-height: 1.5; }

.card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -2px rgba(0, 0, 0, .1);
}

/* Colored top-border accent cards, matching the clone's stat-card treatment exactly. */
.card-accent-blue { border-top: 2px solid #3080ff66; }
.card-accent-violet { border-top: 2px solid #8d54ff66; }
.card-accent-teal { border-top: 2px solid #00baa766; }
.card-accent-emerald { border-top: 2px solid #00bb7f66; }
.card-accent-amber { border-top: 2px solid #f99c0066; }
.card-accent-rose { border-top: 2px solid #ff235766; }
.card-accent-cyan { border-top: 2px solid #00b7d766; }

/* Signal direction badges — a real 5-tier color scale matching the clone exactly. */
.signal-badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .5rem; border-radius: var(--radius); font-size: .7rem; font-weight: 600; border: 1px solid; }
.signal-badge svg { width: 13px; height: 13px; flex-shrink: 0; }
.signal-badge-strong-buy { background: #00c75826; border-color: #00c75866; color: #008138; }
.signal-badge-buy { background: #00bb7f26; border-color: #00bb7f66; color: #007956; }
.signal-badge-hold { background: #f99c0026; border-color: #f99c0066; color: #b75000; }
.signal-badge-sell { background: #fe6e0026; border-color: #fe6e0066; color: #c53c00; }
.signal-badge-strong-sell { background: #fb2c3626; border-color: #fb2c3666; color: #bf000f; }
html[data-theme="black"] .signal-badge-strong-buy { color: #4ade80; }
html[data-theme="black"] .signal-badge-buy { color: #34d399; }
html[data-theme="black"] .signal-badge-hold { color: #fbbf24; }
html[data-theme="black"] .signal-badge-sell { color: #fb923c; }
html[data-theme="black"] .signal-badge-strong-sell { color: #f87171; }

.signal-card2 { border-left: 2px solid var(--border-color); }
.signal-card2.dir-buy, .signal-card2.dir-strong-buy { border-left-color: color-mix(in srgb, #10b981 60%, transparent); }
.signal-card2.dir-sell, .signal-card2.dir-strong-sell { border-left-color: color-mix(in srgb, #ef4444 60%, transparent); }
.signal-card2.dir-hold { border-left-color: color-mix(in srgb, #f59e0b 60%, transparent); }
.signal-card2-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.signal-card2-symbol { display: flex; align-items: center; gap: 2.5rem; min-width: 0; }
.signal-card2-symbol-inner { display: flex; align-items: center; gap: .35rem; min-width: 0; }
.signal-card2-symbol-inner strong { font-size: .85rem; }
.signal-card2-symbol-inner span { font-size: .72rem; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.signal-price-badge {
    display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .45rem; border-radius: var(--radius);
    font-size: .68rem; font-weight: 600; background: color-mix(in srgb, #f59e0b 15%, transparent);
    border: 1px solid color-mix(in srgb, #f59e0b 30%, transparent); color: #b45309;
}
.signal-price-badge svg { width: 10px; height: 10px; }
.signal-status-badge {
    display: inline-flex; align-items: center; gap: .2rem; padding: .1rem .4rem; border-radius: var(--radius);
    font-size: .62rem; font-weight: 500; background: color-mix(in srgb, #3b82f6 15%, transparent);
    border: 1px solid color-mix(in srgb, #3b82f6 30%, transparent); color: #2563eb;
}
.signal-status-badge svg { width: 11px; height: 11px; }
.signal-metrics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-bottom: .75rem; }
.signal-metric-label { font-size: .62rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted-foreground); margin-bottom: .1rem; }
.signal-metric-value { font-size: .82rem; font-weight: 600; }
.signal-confidence-row { margin-bottom: .5rem; }
.signal-confidence-head { display: flex; align-items: center; justify-content: space-between; font-size: .62rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted-foreground); margin-bottom: .2rem; }
.signal-confidence-track { display: flex; align-items: center; gap: .4rem; }
.signal-confidence-bar { flex: 1; height: 5px; border-radius: 999px; background: var(--muted); overflow: hidden; }
.signal-confidence-fill { height: 100%; border-radius: 999px; background: var(--gain); }
.signal-confidence-pct { font-size: .72rem; font-weight: 600; min-width: 32px; text-align: right; color: var(--gain); }
.signal-cat-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; flex-wrap: wrap; gap: .3rem; }
.signal-cat-badge {
    display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .4rem; border-radius: var(--radius);
    font-size: .62rem; font-weight: 500; background: color-mix(in srgb, #3b82f6 15%, transparent); color: #2563eb;
}
.signal-cat-badge svg { width: 11px; height: 11px; }
.signal-timeframe-badge { font-size: .62rem; padding: .05rem .4rem; border-radius: var(--radius); border: 1px solid var(--border-color); }
.signal-expiry-badge { display: inline-flex; align-items: center; gap: .2rem; font-size: .68rem; color: var(--muted-foreground); }
.signal-expiry-badge svg { width: 11px; height: 11px; }
.signal-updown-row { display: flex; align-items: center; gap: .4rem; margin-bottom: .6rem; flex-wrap: wrap; }
.signal-upside-badge, .signal-risk-badge {
    display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .45rem; border-radius: var(--radius);
    font-size: .68rem; font-weight: 500; border: 1px solid;
}
.signal-upside-badge svg, .signal-risk-badge svg { width: 11px; height: 11px; }
.signal-upside-badge { border-color: color-mix(in srgb, #f59e0b 40%, transparent); color: #b45309; }
.signal-risk-badge { border-color: var(--border-color); color: var(--foreground); }
.signal-provider-row { display: flex; align-items: center; justify-content: space-between; }
.signal-provider-name { display: inline-flex; align-items: center; gap: .25rem; font-size: .68rem; font-weight: 500; color: var(--muted-foreground); }
.signal-provider-name svg { width: 11px; height: 11px; color: #ec4899; }

/* Course level badges — real colors captured from coursepage.html (Beginner/Intermediate/Advanced). */
.level-badge { display: inline-flex; align-items: center; padding: .1rem .5rem; border-radius: var(--radius); font-size: .68rem; font-weight: 600; border: 1px solid; text-transform: capitalize; }
.level-badge-beginner { background: #00bb7f26; border-color: #00bb7f4d; color: #00bb7f; }
.level-badge-intermediate { background: #f99c0026; border-color: #f99c004d; color: #f99c00; }
.level-badge-advanced { background: #fb2c3626; border-color: #fb2c364d; color: #fb2c36; }

.course-featured-badge { display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .5rem; border-radius: var(--radius); font-size: .68rem; font-weight: 600; background: #f99c00e6; color: #fff; }
.course-featured-badge svg { width: 12px; height: 12px; }

.card-title { font-size: 0.85rem; font-weight: 600; color: var(--muted-foreground); }
.card-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; margin-top: 0.25rem; }

.grid-cards {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(1, minmax(0, 1fr));
}
@media (min-width: 640px) { .grid-cards.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) {
    .grid-cards.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-cards.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .grid-cards.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .grid-cards.cols-main-aside { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}
@media (min-width: 640px) { .grid-cards.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.asset-pill-row { display: flex; align-items: center; gap: 0.4rem; overflow-x: auto; padding-bottom: 0.25rem; }
.asset-pill-row::-webkit-scrollbar { display: none; }
.asset-pill-label { font-size: 0.72rem; color: var(--muted-foreground); font-weight: 500; flex-shrink: 0; margin-right: 0.15rem; }
.asset-pill {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 500;
    border: 1px solid transparent;
    background: color-mix(in srgb, var(--muted) 40%, transparent);
    color: var(--muted-foreground);
    text-decoration: none;
    cursor: pointer;
}
.asset-pill:hover { background: color-mix(in srgb, var(--muted) 60%, transparent); }
.asset-pill.active {
    background: color-mix(in srgb, var(--primary) 15%, transparent);
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 30%, transparent);
}

.trader-tile { display: flex; flex-direction: column; }
.trader-tile-action { margin-top: 0.7rem; }
.trader-card { display: flex; flex-direction: column; gap: 0.6rem; flex: 1; min-width: 0; }
.trader-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.4rem; flex-wrap: wrap; min-width: 0; }
.trader-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.65rem;
    font-weight: 500;
    padding: 0.05rem 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid color-mix(in srgb, var(--gain) 30%, transparent);
    background: color-mix(in srgb, var(--gain) 10%, transparent);
    color: var(--gain);
}
.trader-status-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--gain); }
.trader-badges-stack { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; min-width: 0; }
.trader-risk-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.65rem;
    font-weight: 500;
    padding: 0.05rem 0.45rem;
    border-radius: 0.375rem;
    border: 1px solid;
    white-space: nowrap;
}
.trader-risk-badge svg { width: 10px; height: 10px; }
.trader-star { width: 11px; height: 11px; flex-shrink: 0; color: #fbbf24; opacity: .3; }
.trader-star.filled { opacity: 1; fill: #fbbf24; }

.trader-avatar-wrap { display: flex; flex-direction: column; align-items: center; }
.trader-avatar-frame { position: relative; display: inline-flex; flex-shrink: 0; }
.trader-avatar {
    width: 5rem;
    height: 5rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    color: #fff;
    font-weight: 700;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    object-fit: cover;
}
.trader-online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: var(--gain);
    border-radius: 999px;
    border: 2px solid var(--card);
}
.trader-name-row { display: flex; align-items: center; gap: 0.3rem; margin-top: 0.5rem; justify-content: center; text-align: center; }
.trader-name-row p { font-weight: 600; font-size: 0.85rem; line-height: 1.2; }
.trader-name-row svg { width: 14px; height: 14px; color: #3b82f6; flex-shrink: 0; }

.trader-asset-tags { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.3rem; }
.trader-asset-tag { display: inline-flex; align-items: center; gap: 0.15rem; border-radius: 0.375rem; padding: 0.1rem 0.4rem; font-size: 0.62rem; font-weight: 500; }

.trader-stars { display: flex; align-items: center; justify-content: center; gap: 0.1rem; margin-top: 0.3rem; }
.trader-stars svg { width: 12px; height: 12px; }

.trader-meta-row { display: flex; align-items: center; justify-content: center; gap: 1rem; font-size: 0.68rem; color: var(--muted-foreground); }
.trader-meta-row span { display: inline-flex; align-items: center; gap: 0.25rem; }
.trader-meta-row svg { width: 13px; height: 13px; }

.trader-badges-row { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0.25rem; }
.trader-award-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.6rem;
    font-weight: 500;
    padding: 0.05rem 0.4rem;
    border-radius: 0.375rem;
    border: 1px solid color-mix(in srgb, #f59e0b 30%, transparent);
    background: color-mix(in srgb, #f59e0b 10%, transparent);
    color: #d97706;
}
.trader-award-badge svg { width: 9px; height: 9px; }
.trader-award-more { font-size: 0.6rem; color: var(--muted-foreground); padding: 0.05rem 0.4rem; border-radius: 0.375rem; background: color-mix(in srgb, var(--muted) 30%, transparent); }

.trader-divider { width: 75%; height: 1px; background: var(--border-color); margin: 0 auto; }

.trader-stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.4rem; }
.trader-stat-box { border-radius: var(--radius); padding: 0.4rem; text-align: center; border: 1px solid; }
.trader-stat-box p:first-child { font-size: 0.62rem; color: var(--muted-foreground); }
.trader-stat-box p:last-child { font-size: 0.82rem; font-weight: 700; margin-top: 0.1rem; }

.trader-desc {
    font-size: 0.7rem;
    color: var(--muted-foreground);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.trader-pairs-label { font-size: 0.62rem; color: var(--muted-foreground); font-weight: 500; margin-bottom: 0.2rem; }
.trader-pairs-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem; }
.trader-pair-tag { font-size: 0.6rem; padding: 0.1rem 0.35rem; border-radius: 0.3rem; background: color-mix(in srgb, var(--muted) 40%, transparent); color: var(--muted-foreground); }
.trader-meta-line { display: flex; align-items: center; justify-content: space-between; font-size: 0.7rem; margin-top: 0.5rem; }
.trader-meta-line span { color: var(--muted-foreground); }
.trader-earned-line { display: flex; align-items: center; justify-content: flex-end; gap: 0.25rem; font-size: 0.68rem; color: var(--gain); margin-top: 0.5rem; }
.trader-earned-line svg { width: 12px; height: 12px; }

.kb-search-wrap { position: relative; max-width: 32rem; }
.kb-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--muted-foreground);
    display: inline-flex;
    pointer-events: none;
}
.kb-search-input {
    width: 100%;
    height: 2.75rem;
    padding: 0.5rem 0.75rem 0.5rem 2.5rem;
    border-radius: 0.5rem;
    border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
    background: color-mix(in srgb, var(--background) 80%, transparent);
    backdrop-filter: blur(4px);
    color: var(--foreground);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.kb-search-input::placeholder { color: var(--muted-foreground); }
.kb-search-input:focus-visible {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

.qtip-grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(1, minmax(0, 1fr)); }
@media (min-width: 640px) { .qtip-grid { grid-template-columns: repeat(2, 1fr); } }
.qtip-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--muted) 20%, transparent);
    padding: 0.75rem;
    transition: background 0.15s ease;
}
.qtip-item:hover { background: color-mix(in srgb, var(--muted) 30%, transparent); }
.qtip-icon {
    flex-shrink: 0;
    margin-top: 0.1rem;
    padding: 0.35rem;
    border-radius: 0.375rem;
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    color: var(--primary);
    display: inline-flex;
}
.qtip-icon svg { width: 16px; height: 16px; }
.qtip-title { font-size: 0.85rem; font-weight: 600; }
.qtip-desc { font-size: 0.75rem; color: var(--muted-foreground); margin-top: 0.15rem; line-height: 1.5; }

.kb-card {
    display: block;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: var(--card);
    padding: 1rem;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: box-shadow 0.15s ease;
}
.kb-card:hover { box-shadow: 0 4px 12px color-mix(in srgb, var(--foreground) 8%, transparent); }
.kb-icon-box {
    display: inline-flex;
    padding: 0.5rem;
    border-radius: 0.5rem;
    border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
}
.kb-icon-box svg { width: 20px; height: 20px; }
.kb-title { font-size: 0.85rem; font-weight: 600; margin-top: 0.75rem; }
.kb-card:hover .kb-title { color: var(--primary); }
.kb-desc {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin-top: 0.25rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.kb-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 0.75rem; }
.kb-count { font-size: 0.65rem; color: var(--muted-foreground); }
.kb-browse {
    font-size: 0.72rem;
    color: var(--primary);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.kb-card:hover .kb-browse { opacity: 1; }
.kb-browse svg { width: 12px; height: 12px; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius);
    font-size: 0.72rem;
    font-weight: 600;
}
.badge.gain { background: color-mix(in srgb, var(--gain) 15%, transparent); color: var(--gain); }
.badge.loss { background: color-mix(in srgb, var(--loss) 15%, transparent); color: var(--loss); }
.badge.neutral { background: var(--muted); color: var(--muted-foreground); }

.text-gain { color: var(--gain); }
.text-loss { color: var(--loss); }
.text-primary { color: var(--primary); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    padding: 0.5rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: opacity .15s ease, background-color .15s ease;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; pointer-events: none; }
/* Base alignment for .icon-sm/.icon-lg — previously only the nested svg's
   size was defined globally, not the wrapper's own display/align-items.
   Without this, an <svg> inline next to text uses its default CSS
   vertical-align:baseline, which visually sits noticeably above the text
   (a 15px icon's baseline-aligned bottom edge reads as "too high" next to
   normal text) — every page that didn't locally redeclare
   inline-flex+align-items:center on its own .icon-sm usage had this same
   icon-vs-text misalignment. Setting it once here fixes all of them;
   pages that already redeclared it locally are unaffected (same values). */
.icon-sm, .icon-lg { display: inline-flex; align-items: center; }
.icon-sm svg { width: 15px; height: 15px; flex-shrink: 0; }
.icon-lg svg { width: 48px; height: 48px; flex-shrink: 0; }
.trade-mode-toggle svg, .trade-side-toggle svg { width: 14px; height: 14px; flex-shrink: 0; vertical-align: -2px; }
.order-book-icon svg { width: 16px; height: 16px; flex-shrink: 0; }
.asset-tab-btn svg { width: 14px; height: 14px; flex-shrink: 0; vertical-align: -2px; }
.upload-drop svg { width: 15px; height: 15px; flex-shrink: 0; }
.alert-banner svg { width: 18px; height: 18px; flex-shrink: 0; display: block; margin-top: .1rem; }

.stat-icon-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; border-radius: 0.625rem; flex-shrink: 0;
    background: color-mix(in srgb, var(--si-color) 15%, transparent);
    color: var(--si-color); font-size: 0.85rem; font-weight: 700;
}
.stat-icon-badge svg { width: 16px; height: 16px; flex-shrink: 0; }

.promo-carousel { position: relative; overflow: hidden; border-radius: var(--radius); }
.promo-track { display: flex; transition: transform 0.4s ease; }
.promo-slide {
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
    min-width: 100%; padding: 1rem 1.1rem; border-radius: var(--radius); box-sizing: border-box;
}
.promo-slide-icon {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 3rem; height: 3rem; border-radius: 0.75rem; color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.promo-slide-icon svg { width: 24px; height: 24px; }
.promo-slide-body { flex: 1; min-width: 200px; }
.promo-slide-title { font-weight: 700; font-size: 0.95rem; }
.promo-slide-subtitle { font-size: 0.8rem; font-weight: 500; margin-top: 0.1rem; }
.promo-slide-desc { font-size: 0.78rem; color: var(--muted-foreground); margin-top: 0.3rem; line-height: 1.5; max-width: 480px; }
#traderRow { scrollbar-width: none; -ms-overflow-style: none; }
#traderRow::-webkit-scrollbar { display: none; }

.promo-nav {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
    display: flex; align-items: center; justify-content: center;
    width: 1.75rem; height: 1.75rem; border-radius: 999px; border: none;
    background: color-mix(in srgb, var(--card) 85%, transparent); color: var(--muted-foreground);
    box-shadow: 0 1px 3px rgba(0,0,0,.12); cursor: pointer;
}
.promo-nav svg { width: 15px; height: 15px; }
.promo-nav.prev { left: 0.4rem; }
.promo-nav.next { right: 0.4rem; }
.promo-nav:hover { background: var(--card); color: var(--foreground); }
.promo-dots { display: flex; align-items: center; justify-content: center; gap: 0.4rem; margin-top: 0.65rem; }
.promo-dot {
    width: 0.375rem; height: 0.375rem; border-radius: 999px; border: none; padding: 0;
    background: color-mix(in srgb, var(--muted-foreground) 35%, transparent); cursor: pointer;
    transition: width 0.25s ease, background 0.25s ease;
}
.promo-dot.active { width: 1.4rem; background: var(--primary); }
.badge svg { width: 13px; height: 13px; flex-shrink: 0; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { opacity: 0.9; }
.btn-amber-gradient { background: linear-gradient(90deg, #f59e0b, #f97316); color: #fff; }
.btn-amber-gradient:hover { background: linear-gradient(90deg, #fbbf24, #fb923c); }
.btn-copy-gradient { background: linear-gradient(90deg, #2563eb, #0d9488); color: #fff; }
.btn-copy-gradient:hover { background: linear-gradient(90deg, #3b82f6, #14b8a6); }
.btn-outline { background: transparent; border-color: var(--border-color); color: var(--foreground); }
.btn-outline:hover { background: var(--accent); }
.btn-destructive { background: var(--destructive); color: #fff; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.7rem; height: 2rem; }
.btn-sm svg { width: 14px; height: 14px; }

/* .content already clips overflow-x at the page level (for the scrollbar-less
   app-shell look), which would silently hide the right side of any table
   wider than the viewport instead of letting it scroll — display:block lets
   the table become its own horizontal-scroll region on narrow screens
   while keeping normal table layout for its rows. */
table.data-table { display: block; overflow-x: auto; width: 100%; border-collapse: collapse; font-size: 0.85rem; -webkit-overflow-scrolling: touch; }
table.data-table thead, table.data-table tbody, table.data-table tr { width: 100%; }
table.data-table th {
    text-align: left;
    color: var(--muted-foreground);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
}
table.data-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 60%, transparent);
}
table.data-table tr:last-child td { border-bottom: none; }
table.data-table td.td-summary { display: none; }

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.72rem;
    color: var(--muted-foreground);
}
.table-pagination-controls { display: flex; gap: 0.3rem; }

/* Opt-in accordion mode for wide, information-dense tables on mobile
   (<table class="data-table" data-mobile-collapse>) — each <tr> becomes a
   card showing only its data-summary cells by default; tapping the row
   (initMobileCollapseTables() in app.js) reveals the rest as labeled
   key/value rows via each cell's data-label attribute. Desktop is
   untouched — this block only applies below the mobile breakpoint used
   throughout the rest of the app. */
@media (max-width: 767px) {
    table.data-table[data-mobile-collapse] { display: block; overflow-x: visible; }
    table.data-table[data-mobile-collapse] thead { display: none; }
    table.data-table[data-mobile-collapse] tbody,
    table.data-table[data-mobile-collapse] tr { display: block; width: 100%; }
    table.data-table[data-mobile-collapse] tr {
        margin-bottom: 0.5rem;
        border: 1px solid var(--border-color);
        border-radius: var(--radius);
        overflow: hidden;
        cursor: pointer;
    }
    table.data-table[data-mobile-collapse] tr:last-child { margin-bottom: 0; }
    table.data-table[data-mobile-collapse] td {
        display: none;
        border-bottom: 1px solid color-mix(in srgb, var(--border-color) 60%, transparent);
        padding: 0.45rem 0.75rem;
    }
    table.data-table[data-mobile-collapse] td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 0.65rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--muted-foreground);
        margin-bottom: 0.15rem;
    }
    table.data-table[data-mobile-collapse] tr.expanded td { display: block; }
    table.data-table[data-mobile-collapse] tr.expanded td:last-child { border-bottom: none; }
    table.data-table[data-mobile-collapse] td.td-summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        padding: 0.65rem 0.75rem;
        border-bottom: none;
        background: color-mix(in srgb, var(--muted) 35%, transparent);
    }
    table.data-table[data-mobile-collapse] td.td-summary::before { display: none; }
    table.data-table[data-mobile-collapse] tr.expanded td.td-summary {
        border-bottom: 1px solid color-mix(in srgb, var(--border-color) 60%, transparent);
    }
    table.data-table[data-mobile-collapse] .td-summary-fields {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        min-width: 0;
        overflow: hidden;
    }
    table.data-table[data-mobile-collapse] .td-chevron {
        display: inline-flex;
        flex-shrink: 0;
        color: var(--muted-foreground);
        transition: transform .15s ease;
    }
    table.data-table[data-mobile-collapse] tr.expanded .td-chevron { transform: rotate(180deg); }
}

.alert-banner {
    border-radius: var(--radius);
    border: 1px solid color-mix(in srgb, #f59e0b 30%, transparent);
    background: color-mix(in srgb, #f59e0b 6%, transparent);
    padding: 1rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

/* .popover-panel is now shown/hidden/positioned by the real daisyUI
   du-dropdown/du-dropdown-content component (:focus-within, pure CSS, no
   JS) — this class only supplies the visual polish daisyUI's own
   dropdown-content doesn't opinionate on (background/border/shadow/sizing),
   composed alongside du-dropdown-content in includes/topbar.php and
   includes/admin_topbar.php. margin-top nudges it below the trigger to
   match the old 8px gap since dropdown-content sits flush by default. */
.popover-panel {
    min-width: 260px;
    margin-top: 8px;
    background: var(--popover);
    color: var(--popover-foreground);
    border: 1px solid var(--border-color);
    border-radius: 0.7rem;
    box-shadow: 0 10px 30px rgba(0,0,0,.18);
    overflow: hidden;
}
.popover-title { padding: 0.6rem 0.75rem; font-size: 0.78rem; font-weight: 600; border-bottom: 1px solid var(--border-color); }
.popover-body { max-height: 320px; overflow-y: auto; }
.popover-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    font-size: 0.8rem;
    text-decoration: none;
    color: inherit;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}
.popover-item:hover { background: var(--accent); }
.popover-item svg { width: 15px; height: 15px; flex-shrink: 0; }

/* Notification popover — matches the clone's real bell-icon popup exactly. */
.notif-popover { width: 380px; min-width: 380px; padding: 0; border-radius: 0.75rem; box-shadow: 0 20px 40px rgba(0,0,0,.22); }
@media (max-width: 480px) {
    /* On narrow screens the trigger icon can sit anywhere in the topbar, not
       necessarily near the right edge — anchoring the popover to its small
       .popover-wrap trigger (position:absolute; right:0) let it extend past
       the left edge of the viewport. Pinning it to the viewport itself via
       position:fixed guarantees it always fits, regardless of where the
       trigger icon happens to be. */
    .notif-popover {
        position: fixed;
        top: 62px;
        left: .75rem;
        right: .75rem;
        width: auto;
        min-width: 0;
        max-width: none;
    }
}
.notif-popover-header { display: flex; align-items: center; justify-content: space-between; padding: 0.7rem 1rem; border-bottom: 1px solid var(--border-color); }
.notif-mark-all { display: inline-flex; align-items: center; gap: 0.3rem; background: none; border: none; color: var(--muted-foreground); font-size: 0.72rem; font-weight: 500; padding: 0.3rem 0.5rem; border-radius: 0.4rem; cursor: pointer; }
.notif-mark-all:hover { color: var(--foreground); background: var(--accent); }
.notif-mark-all svg { width: 13px; height: 13px; flex-shrink: 0; }
.notif-separator { height: 1px; background: var(--border-color); margin: 0.15rem 0.75rem; }
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.5rem 0.6rem;
    margin: 0.1rem 0.4rem;
    border-radius: 0.5rem;
    border-left: 3px solid transparent;
    text-decoration: none;
    color: inherit;
    transition: background-color .15s ease;
}
.notif-item:hover { background: color-mix(in srgb, var(--muted) 60%, transparent); }
.notif-item.unread { background: color-mix(in srgb, var(--primary) 4%, transparent); border-left-color: #f97316; }
.notif-item:not(.unread) { border-left-color: color-mix(in srgb, var(--muted-foreground) 30%, transparent); }
.notif-item-icon { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 999px; flex-shrink: 0; }
.notif-item-icon svg { width: 14px; height: 14px; flex-shrink: 0; }
.notif-color-teal .notif-item-icon { background: #14b8a626; color: #14b8a6; box-shadow: inset 0 0 0 1px #14b8a633; }
.notif-color-red .notif-item-icon { background: #ef444426; color: #ef4444; box-shadow: inset 0 0 0 1px #ef444433; }
.notif-color-violet .notif-item-icon { background: #8b5cf626; color: #8b5cf6; box-shadow: inset 0 0 0 1px #8b5cf633; }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title-row { display: flex; align-items: center; gap: 0.4rem; }
.notif-item-title { font-size: 0.75rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-item-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--primary); flex-shrink: 0; }
.notif-item-message { font-size: 0.68rem; color: var(--muted-foreground); margin-top: 0.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-item-meta { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.25rem; }
.notif-priority-tag { font-size: 0.58rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 0.06rem 0.35rem; border-radius: 0.25rem; line-height: 1.4; }
.notif-priority-high { color: #c2410c; background: #f9731626; box-shadow: inset 0 0 0 1px #f9731640; }
.notif-priority-medium { color: #b45309; background: #f59e0b26; box-shadow: inset 0 0 0 1px #f59e0b40; }
.notif-priority-low { color: var(--muted-foreground); background: color-mix(in srgb, var(--muted) 50%, transparent); }
.notif-item-time { font-size: 0.62rem; color: color-mix(in srgb, var(--muted-foreground) 70%, transparent); }
.notif-popover-footer { border-top: 1px solid var(--border-color); padding: 0.5rem; }
.notif-popover-footer a { display: block; text-align: center; padding: 0.5rem; border-radius: 0.5rem; font-size: 0.78rem; font-weight: 500; color: var(--primary); text-decoration: none; }
.notif-popover-footer a:hover { background: color-mix(in srgb, var(--primary) 5%, transparent); }

.notif-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--destructive);
    color: #fff;
    font-size: 0.6rem;
    line-height: 1;
    min-width: 14px;
    height: 14px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

.chart-svg { width: 100%; height: auto; overflow: visible; }
.chart-grid { stroke: var(--border-color); stroke-width: 1; }
.chart-axis-label { font-size: 10px; fill: var(--muted-foreground); font-family: var(--font-sans); }
.chart-ref-line { stroke: var(--muted-foreground); stroke-width: 1; stroke-dasharray: 4 3; opacity: .6; }
.chart-ref-label { font-size: 10px; fill: var(--muted-foreground); font-weight: 600; }
.chart-line { stroke-linecap: round; stroke-linejoin: round; }
.chart-center-value { font-size: 16px; font-weight: 700; fill: var(--foreground); font-family: var(--font-sans); }
.chart-center-label { font-size: 9px; fill: var(--muted-foreground); font-family: var(--font-sans); }

.chart-legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .5rem; }
.chart-legend-item { display: flex; align-items: center; gap: .4rem; font-size: .75rem; color: var(--muted-foreground); }
.chart-legend-dot { width: 9px; height: 9px; border-radius: 999px; flex-shrink: 0; }

.timeframe-pills { display: flex; gap: 0.1rem; background: color-mix(in srgb, var(--muted) 50%, transparent); border-radius: 0.5rem; padding: 0.2rem; flex-wrap: wrap; }
.timeframe-pill { font-size: 0.68rem; font-weight: 500; padding: 0.25rem 0.5rem; border-radius: 0.375rem; color: var(--muted-foreground); cursor: default; }
.timeframe-pill.active { background: var(--card); color: var(--foreground); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.quick-action-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.quick-action-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--qa-color) 12%, transparent);
    color: var(--qa-color);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    transition: background 0.15s ease;
}
.quick-action-tile:hover { background: color-mix(in srgb, var(--qa-color) 20%, transparent); }
.quick-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.625rem;
    background: var(--qa-color);
    color: #fff;
}
.quick-action-icon svg { width: 18px; height: 18px; }

.retirement-score-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 1024px) { .retirement-score-grid { grid-template-columns: 1fr 2fr; align-items: stretch; } }
.readiness-ring-wrap { position: relative; width: 8rem; height: 8rem; }
.readiness-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.readiness-ring-fill { transition: stroke-dashoffset 1s ease-out; }
.readiness-ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.readiness-ring-score { font-size: 1.6rem; font-weight: 700; }
.readiness-ring-max { font-size: .7rem; color: var(--muted-foreground); }

.score-metric-pill {
    display: inline-flex; align-items: center; gap: .35rem; flex-shrink: 0;
    padding: .4rem .7rem; border-radius: .5rem; font-size: .72rem; font-weight: 500;
    border: 1px solid var(--border-color); background: color-mix(in srgb, var(--card) 50%, transparent);
    color: var(--muted-foreground); text-decoration: none; white-space: nowrap;
}
.score-metric-pill svg { width: 13px; height: 13px; flex-shrink: 0; }
.score-metric-pill:hover { border-color: color-mix(in srgb, var(--primary) 25%, transparent); }
.score-metric-pill.active {
    background: color-mix(in srgb, var(--primary) 15%, transparent);
    border-color: color-mix(in srgb, var(--primary) 40%, transparent);
    color: var(--primary);
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 60%, transparent);
}
.setting-row:last-child { border-bottom: none; }
.setting-row-label { font-size: 0.85rem; font-weight: 500; display: block; cursor: pointer; }
.setting-row-desc { font-size: 0.75rem; color: var(--muted-foreground); margin-top: 0.15rem; max-width: 480px; }
.setting-row-control { flex-shrink: 0; }

.toggle {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
    flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
    position: absolute;
    inset: 0;
    background: var(--muted);
    border-radius: 999px;
    cursor: pointer;
    transition: background-color .15s ease;
}
.toggle-track::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .15s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.toggle input:checked + .toggle-track { background: var(--primary); }
.toggle input:checked + .toggle-track::before { transform: translateX(16px); }

.settings-jump { display: flex; gap: .4rem; flex-wrap: wrap; }
.settings-jump a {
    font-size: .74rem;
    padding: .3rem .65rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    color: var(--muted-foreground);
    text-decoration: none;
}
.settings-jump a:hover { background: var(--accent); color: var(--foreground); }

.wizard-steps { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 1rem; }
.wizard-step {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .75rem;
    padding: .4rem .7rem;
    border-radius: 999px;
    background: var(--muted);
    color: var(--muted-foreground);
}
.wizard-step.active { background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary); font-weight: 600; }
.wizard-step.done { background: color-mix(in srgb, var(--gain) 15%, transparent); color: var(--gain); }
.wizard-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: currentColor;
    color: var(--card);
    font-size: .62rem;
    font-weight: 700;
}

.upload-drop {
    border: 1.5px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    color: var(--muted-foreground);
    font-size: .8rem;
}
.upload-drop.filled { border-color: var(--gain); color: var(--gain); border-style: solid; }

.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-backdrop.open { display: flex; }
.modal-panel {
    background: var(--card);
    color: var(--card-foreground);
    border-radius: 0rem;
    border: 1px solid var(--border-color);
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
    min-width: 0;
}
/* Flex/grid children default to a content-based min-width floor that won't
   shrink below their intrinsic size — the classic cause of a modal bleeding
   past the viewport edge on narrow phones (two inputs in a flex row each
   refusing to go below ~150-200px, etc). Stripping that floor on every
   descendant is a safe, permissive change: it never adds a constraint, it
   only removes one, so it can't break layouts that didn't depend on it. */
.modal-panel * { min-width: 0; }
.modal-panel img, .modal-panel svg { max-width: 100%; }
.modal-body { word-break: break-word; overflow-wrap: break-word; }
.modal-panel.modal-lg { max-width: 720px; }
.modal-panel.modal-sm { max-width: 400px; }
.modal-header { padding: 1.25rem 1.25rem 0; }
.modal-body { padding: 1rem 1.25rem; }
.modal-footer { padding: 1rem 1.25rem 1.25rem; display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 480px) {
    .modal-backdrop { padding: .6rem; }
    .modal-header { padding: 1rem 1rem 0; }
    .modal-body { padding: .85rem 1rem; }
    .modal-footer { padding: .85rem 1rem 1rem; }
    .modal-footer .btn { flex: 1 1 auto; }
}
.modal-title { font-size: 1.15rem; font-weight: 700; }
.modal-subtitle { font-size: .82rem; color: var(--muted-foreground); margin-top: .25rem; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-top: .75rem; }
.feature-card { border: 1px solid var(--border-color); border-radius: var(--radius); padding: .85rem; background: var(--card); }
.feature-card-title { font-size: .82rem; font-weight: 600; display: flex; align-items: center; gap: .5rem; }
.feature-card-icon { display: inline-flex; align-items: center; justify-content: center; width: 1.7rem; height: 1.7rem; border-radius: .5rem; flex-shrink: 0; }
.feature-card-icon svg { width: 15px; height: 15px; flex-shrink: 0; }
.feature-card-desc { font-size: .74rem; color: var(--muted-foreground); margin-top: .35rem; }
.feature-card-emerald { border-color: color-mix(in srgb, #10b981 30%, var(--border-color)); background: color-mix(in srgb, #10b981 4%, var(--card)); }
.feature-card-emerald .feature-card-icon { background: color-mix(in srgb, #10b981 18%, transparent); color: #10b981; }
.feature-card-blue { border-color: color-mix(in srgb, #3b82f6 30%, var(--border-color)); background: color-mix(in srgb, #3b82f6 4%, var(--card)); }
.feature-card-blue .feature-card-icon { background: color-mix(in srgb, #3b82f6 18%, transparent); color: #3b82f6; }
.feature-card-violet { border-color: color-mix(in srgb, #8b5cf6 30%, var(--border-color)); background: color-mix(in srgb, #8b5cf6 4%, var(--card)); }
.feature-card-violet .feature-card-icon { background: color-mix(in srgb, #8b5cf6 18%, transparent); color: #8b5cf6; }

.value-pill { border-radius: .75rem; padding: .75rem .5rem; text-align: center; font-size: .75rem; font-weight: 500; border: 1px solid transparent; }
.value-pill-icon { font-size: 1.2rem; }
.value-pill-rose { background: color-mix(in srgb, #f43f5e 8%, transparent); border-color: color-mix(in srgb, #f43f5e 20%, transparent); color: #e11d48; }
.value-pill-blue { background: color-mix(in srgb, #3b82f6 8%, transparent); border-color: color-mix(in srgb, #3b82f6 20%, transparent); color: #2563eb; }
.value-pill-amber { background: color-mix(in srgb, #f59e0b 8%, transparent); border-color: color-mix(in srgb, #f59e0b 20%, transparent); color: #d97706; }
.value-pill-emerald { background: color-mix(in srgb, #10b981 8%, transparent); border-color: color-mix(in srgb, #10b981 20%, transparent); color: #059669; }

.trust-bar { display: flex; gap: 1.25rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-color); }
.trust-stat { text-align: center; }
.trust-stat-value { font-size: .95rem; font-weight: 700; }
.trust-stat-label { font-size: .68rem; color: var(--muted-foreground); }

.modal-panel-colorful { overflow: hidden; }
.modal-header-gradient { height: .35rem; background: linear-gradient(90deg, #f43f5e, #f59e0b, #10b981, #3b82f6, #8b5cf6); }
.onboard-slide { min-width: 100%; box-sizing: border-box; padding: 0 .15rem; min-height: 260px; }
.onboard-slide-title { font-weight: 700; font-size: 1rem; }

/* Step-wizard chrome (dots + Back/Next + progress bar), matching the live
   reference's "Savings Introduction" walkthrough dialog pattern. */
.onboard-wizard-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.onboard-wizard-dots { display: flex; gap: .35rem; }
.onboard-wizard-dot { width: .5rem; height: .5rem; border-radius: 999px; background: var(--muted); transition: width .2s, background-color .2s; }
.onboard-wizard-dot.active { width: 1.5rem; background: var(--primary); }
.onboard-wizard-nav { display: flex; align-items: center; gap: .9rem; }
.onboard-wizard-back { font-size: .78rem; font-weight: 500; color: var(--muted-foreground); background: none; border: none; cursor: pointer; }
.onboard-wizard-back:disabled { visibility: hidden; }
.onboard-wizard-next { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; font-weight: 600; padding: .4rem .8rem; border-radius: var(--radius); border: none; cursor: pointer; background: var(--primary); color: #fff; }
.onboard-wizard-next svg { width: 14px; height: 14px; }
.onboard-wizard-next.finish { background: var(--gain); }
.onboard-wizard-progress-row { display: flex; justify-content: space-between; font-size: .68rem; color: var(--muted-foreground); margin-top: .6rem; }
.onboard-wizard-progress-track { height: 4px; border-radius: 999px; background: var(--muted); overflow: hidden; margin-top: .3rem; margin-bottom: 1rem; }
.onboard-wizard-progress-fill { height: 100%; background: var(--primary); transition: width .2s; }
.onboard-step-badge { display: inline-flex; align-items: center; padding: .2rem .65rem; border-radius: 999px; font-size: .68rem; font-weight: 600; background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.onboard-step-heading { text-align: center; }
.onboard-step-heading .onboard-step-badge { display: flex; margin: 0 auto .5rem; width: fit-content; }
.onboard-step-heading p.modal-title { margin-top: .3rem; }
.onboard-numbered-list { display: flex; flex-direction: column; gap: .55rem; margin-top: .85rem; }
.onboard-numbered-item { display: flex; gap: .65rem; border: 1px solid var(--border-color); border-radius: var(--radius); padding: .65rem .8rem; background: var(--card); align-items: flex-start; }
.onboard-numbered-badge { width: 1.6rem; height: 1.6rem; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.onboard-final-icon { width: 4.25rem; height: 4.25rem; border-radius: 999px; display: flex; align-items: center; justify-content: center; margin: 0 auto .75rem; background: linear-gradient(135deg, #10b981, #059669); color: #fff; }
.onboard-final-icon svg { width: 2rem; height: 2rem; }

/* Investment plan cards + summary tiles, colored per risk tier
   (config/app.php INVESTMENT_TIER_COLORS) to match the live reference. */
.investment-summary-card { display: flex; align-items: center; gap: .75rem; border-radius: var(--radius); padding: 1rem; border: none; }
.investment-summary-icon { width: 2.6rem; height: 2.6rem; border-radius: .65rem; display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }
.investment-summary-icon svg { width: 18px; height: 18px; }
.investment-card { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border-color); background: var(--card); display: flex; flex-direction: column; padding: 0; }
.investment-card-banner { height: 4.5rem; position: relative; display: flex; align-items: flex-start; justify-content: space-between; padding: .6rem; }
.investment-tag-pill { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: #fff; padding: .2rem .55rem; border-radius: .35rem; }
.investment-featured-pill { display: inline-flex; align-items: center; gap: .25rem; font-size: .66rem; font-weight: 600; background: #f59e0b; color: #fff; padding: .2rem .55rem; border-radius: .35rem; }
.investment-featured-pill svg { width: 11px; height: 11px; }
.investment-icon-badge { width: 3rem; height: 3rem; border-radius: .7rem; display: flex; align-items: center; justify-content: center; color: #fff; margin: -1.6rem 0 0 .9rem; box-shadow: 0 2px 6px rgba(0,0,0,.15); position: relative; z-index: 1; }
.investment-icon-badge svg { width: 20px; height: 20px; }
.investment-card-body { padding: .9rem 1.1rem 1.1rem; display: flex; flex-direction: column; flex: 1; }
.investment-tier-pill { font-size: .68rem; font-weight: 500; border: 1px solid; border-radius: 999px; padding: .1rem .55rem; text-transform: lowercase; }
.investment-desc-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.investment-invest-btn { color: #fff; border: none; display: flex; align-items: center; justify-content: center; gap: .4rem; }
.investment-invest-btn svg { width: 15px; height: 15px; }

/* Transactions page: unified 2x2 stats card + list-row transaction history,
   matching the live reference's layout exactly (not a 4-card grid / table). */
.tx-stats-card { display: grid; grid-template-columns: 1fr 1fr; row-gap: 1.25rem; column-gap: 1rem; padding: 1.25rem 1.75rem; }
.tx-search-row { display: flex; gap: .5rem; margin: .75rem 0; flex-wrap: wrap; }
.tx-search-input-wrap { position: relative; flex: 1; }
.tx-search-input-wrap .icon-sm { position: absolute; left: .65rem; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); pointer-events: none; }
.tx-search-input-wrap input { width: 100%; padding: .55rem .65rem .55rem 2.1rem; border-radius: .5rem; border: 1px solid var(--input); background: var(--background); color: var(--foreground); font-size: .82rem; }
.tx-filter-wrap { position: relative; }
.tx-filter-wrap .icon-sm { position: absolute; left: .6rem; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); pointer-events: none; }
.tx-filter-wrap select {
    padding: .55rem 1.9rem .55rem 2.1rem; border-radius: .5rem; border: 1px solid var(--input);
    background-color: var(--background); color: var(--foreground); font-size: .82rem;
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2351606b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right .55rem center; background-size: 14px;
}
.tx-row { display: flex; align-items: center; gap: .85rem; padding: .95rem 0; }
.tx-row + .tx-row { border-top: 1px solid var(--border-color); }
.tx-row-icon { width: 2.5rem; height: 2.5rem; border-radius: 999px; display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }
.tx-row-icon svg { width: 17px; height: 17px; }
.tx-row-main { flex: 1; min-width: 0; }
.tx-row-title { font-weight: 600; font-size: .88rem; }
.tx-row-desc { font-size: .78rem; color: var(--muted-foreground); margin-top: .15rem; }
.tx-row-right { text-align: right; flex-shrink: 0; }
.tx-row-amount { font-weight: 700; font-size: .92rem; }
.tx-row-meta { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; margin-top: .3rem; }
.tx-row-date { font-size: .74rem; color: var(--muted-foreground); }
.tx-row-chevron { display: none; flex-shrink: 0; color: var(--muted-foreground); transition: transform .15s ease; }

/* Accordion mode on mobile — same idea as table[data-mobile-collapse]
   above, adapted to .tx-row's own div-based layout instead of a <table>:
   each row collapses to icon + title + amount, tapping it
   (initTxRowAccordion() in app.js) reveals the description/status/date. */
@media (max-width: 767px) {
    .tx-row { cursor: pointer; }
    .tx-row-desc, .tx-row-meta { display: none; }
    .tx-row.expanded .tx-row-desc { display: block; }
    .tx-row.expanded .tx-row-meta { display: flex; }
    .tx-row-chevron { display: inline-flex; }
    .tx-row.expanded .tx-row-chevron { transform: rotate(180deg); }
}

/* Retirement Milestones vertical timeline, matching the live reference
   (icon + connecting line per milestone, "Next Up" highlight) instead of a
   flat list of bordered boxes. */
.retirement-timeline-item { position: relative; display: flex; gap: .85rem; padding-bottom: 1.4rem; }
.retirement-timeline-item:last-child { padding-bottom: 0; }
.retirement-timeline-item:not(:last-child)::before {
    content: ''; position: absolute; left: 15px; top: 32px; bottom: -1.4rem; width: 1px; background: var(--border-color);
}
.retirement-timeline-icon { width: 32px; height: 32px; border-radius: 999px; background: var(--muted); color: var(--muted-foreground); display: flex; align-items: center; justify-content: center; flex-shrink: 0; z-index: 1; }
.retirement-timeline-icon svg { width: 15px; height: 15px; }
.retirement-timeline-item.next-up .retirement-timeline-icon { background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary); border: 2px solid var(--primary); }
.retirement-timeline-age-row { display: flex; align-items: center; gap: .5rem; }
.retirement-timeline-age { font-weight: 700; font-size: .85rem; }
.retirement-timeline-badge { font-size: .62rem; font-weight: 600; background: var(--primary); color: #fff; padding: .1rem .5rem; border-radius: 999px; }
.retirement-timeline-title { font-size: .85rem; font-weight: 600; margin-top: .15rem; }
.retirement-timeline-desc { font-size: .78rem; color: var(--muted-foreground); margin-top: .15rem; }

/* Wallet page hero/stat/action layout, matching the live reference exactly:
   a full-width Total Portfolio Value hero card, a 3-up stat row underneath
   with small colored icon badges, and icon-left (not icon-top) action
   buttons — replacing the earlier 4-equal-cards + centered-icon-button
   layout that didn't match. */
.wallet-hero-card { border-radius: var(--radius); padding: 1.1rem 1.4rem; margin-bottom: 1rem; border: 1px solid color-mix(in srgb, var(--gain) 18%, var(--border-color)); background: linear-gradient(135deg, color-mix(in srgb, var(--gain) 9%, var(--card)), var(--card)); }
.wallet-hero-label { display: flex; align-items: center; gap: .4rem; font-size: .85rem; font-weight: 600; color: var(--muted-foreground); }
.wallet-hero-label .icon-sm { color: var(--gain); display: inline-flex; }
.wallet-hero-value { font-size: 2.3rem; font-weight: 700; margin-top: .3rem; }
.wallet-stat-title { display: flex; align-items: center; gap: .55rem; font-size: .85rem; font-weight: 600; color: var(--muted-foreground); }
.wallet-stat-icon { width: 1.9rem; height: 1.9rem; border-radius: 999px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; }
.wallet-stat-icon svg { width: 14px; height: 14px; }
.wallet-action-btn { display: flex !important; flex-direction: row !important; align-items: center; gap: .7rem; text-align: left; padding: .85rem !important; height: auto; }
.wallet-action-icon { width: 2.35rem; height: 2.35rem; border-radius: 999px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; }
.wallet-action-icon svg { width: 16px; height: 16px; }
.wallet-action-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.wallet-action-text strong { font-size: .85rem; font-weight: 600; color: var(--foreground); }
.wallet-action-text span { font-size: .72rem; color: var(--muted-foreground); }
.wallet-action-row { display: grid; gap: 1rem; grid-template-columns: repeat(1, minmax(0, 1fr)); margin-bottom: 1rem; }
@media (min-width: 768px) { .wallet-action-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .wallet-action-row { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.toast {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--foreground);
    color: var(--background);
    padding: .6rem 1rem;
    border-radius: var(--radius);
    font-size: .82rem;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.payment-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
}
.payment-overlay.show { opacity: 1; pointer-events: auto; }
.payment-overlay-card {
    background: var(--card);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 2rem 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .9rem;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
    min-width: 220px;
}
.payment-overlay-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    border: 3px solid color-mix(in srgb, var(--primary) 20%, transparent);
    border-top-color: var(--primary);
    animation: payment-spin .7s linear infinite;
}
.payment-overlay-check {
    display: none;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--gain) 15%, transparent);
    color: var(--gain);
    align-items: center;
    justify-content: center;
}
.payment-overlay-check svg { width: 22px; height: 22px; }
.payment-overlay.paid .payment-overlay-spinner { display: none; }
.payment-overlay.paid .payment-overlay-check { display: flex; }
.payment-overlay-text { font-size: .88rem; font-weight: 600; color: var(--foreground); }
@keyframes payment-spin { to { transform: rotate(360deg); } }

/* "Live" badges (Stock Screener, Live Market Heatmap, Market News) —
   blinking to read as an active real-time indicator rather than a static
   label. Pauses for anyone with a reduced-motion preference. */
.live-blink { animation: live-blink 1.4s ease-in-out infinite; }
@keyframes live-blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .live-blink { animation: none; } }

.page-placeholder {
    border: 1px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--muted-foreground);
}

#app-splash {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--background);
}
#app-splash img { width: 56px; height: 56px; border-radius: 0.75rem; }
.splash-brand { font-weight: 700; font-size: 1.1rem; }
.splash-sub { font-size: 0.8rem; color: var(--muted-foreground); }

/* ---------------------------------------------------------------- */
/* Research page                                                     */
/* ---------------------------------------------------------------- */
.research-sentiment-card { text-align: center; }
.research-gauge { width: 100%; max-width: 160px; margin: .3rem auto 0; }
.research-gauge svg { display: block; width: 100%; height: auto; }
.research-gauge-score { font-size: 1.7rem; font-weight: 800; margin-top: -.6rem; line-height: 1; }
.research-sentiment-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .5rem;
    margin-top: 1rem;
    text-align: center;
}
.research-sentiment-stats .rss-pct { font-size: .95rem; font-weight: 700; color: var(--foreground); }
.research-sentiment-stats .rss-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .2rem;
    font-size: .68rem;
    color: var(--muted-foreground);
    margin-top: .1rem;
}
.research-vix-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    font-size: .72rem;
    color: var(--muted-foreground);
    margin-top: .85rem;
    padding-top: .75rem;
    border-top: 1px solid var(--border-color);
}

.research-snapshot-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
}
.research-snapshot-tile {
    padding: .55rem .6rem;
    border-radius: var(--radius);
    background: var(--muted);
}
.research-snapshot-tile.gain { background: color-mix(in srgb, var(--gain) 14%, var(--card)); }
.research-snapshot-tile.loss { background: color-mix(in srgb, var(--loss) 14%, var(--card)); }
.research-snapshot-tile.neutral { background: var(--muted); }
.research-snapshot-tile.amber { background: color-mix(in srgb, #f59e0b 16%, var(--card)); }
.research-snapshot-tile .icon-sm svg { width: 13px; height: 13px; flex-shrink: 0; }
.research-snapshot-tile .rs-label { display: flex; align-items: center; gap: .3rem; font-size: .68rem; color: var(--muted-foreground); }
.research-snapshot-tile.gain .rs-label { color: var(--gain); }
.research-snapshot-tile.loss .rs-label { color: var(--loss); }
.research-snapshot-tile.amber .rs-label { color: #f59e0b; }
.research-snapshot-tile .rs-value { font-size: .95rem; font-weight: 700; color: var(--foreground); margin-top: .3rem; }
.research-snapshot-tile .rs-sub { font-size: .72rem; font-weight: 600; margin-top: .1rem; color: var(--muted-foreground); }
.research-snapshot-tile.gain .rs-sub { color: var(--gain); }
.research-snapshot-tile.loss .rs-sub { color: var(--loss); }

.research-heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 4px;
    margin-top: 1rem;
}
.research-heatmap-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .1rem;
    padding: .5rem .3rem;
    border-radius: .4rem;
    cursor: default;
    text-align: center;
}
.research-heatmap-tile .rht-symbol { font-size: .72rem; font-weight: 700; }
.research-heatmap-tile .rht-name { font-size: .6rem; color: var(--muted-foreground); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.research-heatmap-tile .rht-pct { font-size: .64rem; font-weight: 600; }

.research-movers-title { display: flex; align-items: center; gap: .4rem; margin-bottom: .75rem; font-size: .95rem; color: var(--foreground); }
.research-mover-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .55rem 0; }
.research-mover-row .rm-left { display: flex; align-items: center; gap: .55rem; font-size: .85rem; }
.research-mover-row .rm-left > span { display: flex; flex-direction: column; }
.research-mover-row .rm-name { font-size: .7rem; color: var(--muted-foreground); font-weight: 400; }
.research-mover-row .rm-right { display: flex; flex-direction: column; align-items: flex-end; gap: .1rem; font-size: .85rem; }
.research-mover-row .rm-right span { display: inline-flex; align-items: center; gap: .15rem; font-size: .74rem; font-weight: 600; }
.research-mover-row .rm-right svg { width: 12px; height: 12px; }

.research-sector-head, .research-sector-row {
    display: grid;
    grid-template-columns: minmax(140px, 1.6fr) repeat(4, 1fr);
    align-items: center;
    gap: .5rem;
}
.research-sector-head {
    font-size: .7rem;
    color: var(--muted-foreground);
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--border-color);
}
.research-sector-head span:not(:first-child), .rsec-cell { text-align: right; }
.research-sector-row { padding: .7rem 0; border-bottom: 1px solid var(--border-color); }
.research-sector-row:last-of-type { border-bottom: none; }
.rsec-pills { display: flex; gap: .3rem; margin-top: .3rem; flex-wrap: wrap; }
.rsec-pills .badge { font-size: .62rem; padding: .1rem .4rem; }
.rsec-cell { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; font-size: .78rem; font-weight: 600; }
.rsec-bar { display: block; width: 100%; max-width: 70px; height: 4px; border-radius: 999px; background: var(--muted); overflow: hidden; }
.rsec-bar-fill { display: block; height: 100%; float: right; }
.rsec-bar-fill.gain { background: var(--gain); }
.rsec-bar-fill.loss { background: var(--loss); }

.research-news-row { display: flex; gap: .75rem; padding: .85rem 0; border-bottom: 1px solid var(--border-color); }
.research-news-row:last-child { border-bottom: none; }
.research-news-row .rn-thumb {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: .5rem;
    background: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-foreground);
}
.research-news-row .rn-thumb svg { width: 20px; height: 20px; }
.research-news-row .rn-body { min-width: 0; flex: 1; }
.research-news-row .rn-title { font-weight: 600; font-size: .85rem; }
.research-news-row .rn-summary { font-size: .78rem; color: var(--muted-foreground); margin-top: .25rem; }
.research-news-row .rn-meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; font-size: .68rem; color: var(--muted-foreground); }

/* ---------------------------------------------------------------- */
/* Markets page                                                      */
/* ---------------------------------------------------------------- */
.market-summary-row { display: grid; grid-template-columns: 1fr 2fr; gap: 1rem; margin-bottom: 1rem; }
@media (max-width: 720px) { .market-summary-row { grid-template-columns: 1fr; } }
.market-summary-total { display: flex; gap: 2rem; align-items: center; }
.market-summary-split { display: flex; }
.market-summary-split > div { flex: 1; padding: 0 1.25rem; }
.market-summary-split > div:first-child { border-right: 1px solid var(--border-color); }
.market-asset-row { cursor: pointer; }
.market-asset-row:hover { background: var(--accent); }
.market-assets-table td { vertical-align: middle; }
