/* ============================================================
   FILE: premium-ui.css
   PURPOSE: App shell UI (_Layout.cshtml pages only)
   USED ON: Dashboard, Portfolio, Explore, Profile, KYC, Login
   NOT ON: Client onboarding (Create), Pending, Submitted
            — those use client-onboarding*.css / submitted.css

   Dashboard & Explore page styles live in this file under:
   .dashboard-kpi-grid, .dashboard-grid, .explore-fund-grid
   BRAND COLORS: theme.css → ★ QUICK EDIT
   ============================================================ */

/* ============================================================
   XClient Premium UI — v5
   Secondary: var(--ds-edit-mint) · Slim · Modern SaaS
   CSS-only refresh — no markup or logic changes
   ============================================================ */

:root {
    /* Brand secondary — bridged to theme.css ★ QUICK EDIT (same hex) */
    --secondary: var(--ds-edit-mint);
    --secondary-dark: var(--ds-edit-mint-dark);
    --secondary-darker: var(--ds-edit-mint-darker);
    --secondary-light: var(--ds-mint-soft);
    --secondary-muted: var(--ds-mint-muted);
    --secondary-glow: var(--ds-mint-glow);

    /* Refined primary (deep navy — Stripe / Linear inspired) */
    --primary: var(--ds-edit-shell);
    --primary-mid: var(--ds-edit-shell-mid);
    --primary-accent: var(--ds-edit-shell-action);
    --primary-soft: var(--ds-shell-navy-soft);

    /* Velzon-style button tokens (brand blue) */
    --btn-primary: var(--ds-edit-shell-action);
    --btn-primary-hover: var(--ds-edit-shell-action-hover);
    --btn-primary-active: var(--ds-edit-shell-action-active);
    --btn-primary-light: var(--ds-brand-blue-400);
    --btn-primary-soft: var(--ds-color-action-soft);
    --btn-outline-border: var(--ds-edit-shell-action);

    /* Slim layout */
    --sidebar-expanded: 240px;
    --sidebar-collapsed: 64px;
    --sidebar-w: 240px;
    --topbar-h: 56px;
    --bottom-nav-h: 64px;

    /* Radii — bridged to theme.css ★ QUICK EDIT */
    --r-xs: var(--ds-radius-xs);
    --r-sm: var(--ds-radius-sm);
    --r-md: var(--ds-radius-lg);   /* slightly roomier UI chrome */
    --r-lg: var(--ds-radius-xl);
    --r-xl: var(--ds-radius-2xl);

    /* Softer shadows */
    --sh-xs: 0 1px 2px rgba(15, 39, 68, 0.04);
    --sh-sm: 0 1px 3px rgba(15, 39, 68, 0.06), 0 1px 2px rgba(15, 39, 68, 0.04);
    --sh-md: 0 4px 12px rgba(15, 39, 68, 0.07);
    --sh-lg: 0 8px 24px rgba(15, 39, 68, 0.09);
    --sh-xl: 0 16px 40px rgba(15, 39, 68, 0.11);
    --sh-glow: 0 0 20px var(--secondary-glow);

    /* Map legacy tokens to theme.css ★ QUICK EDIT */
    --g-900: var(--primary);
    --g-800: var(--ds-edit-shell-mid);
    --g-700: var(--primary-mid);
    --g-600: var(--primary-accent);
    --g-500: var(--ds-edit-accent);
    --g-400: var(--secondary);
    --g-300: var(--ds-edit-mint);
    --g-200: rgba(var(--ds-edit-mint-rgb), 0.35);
    --g-100: var(--secondary-light);
    --g-50: var(--ds-edit-page-bg);

    --success: var(--secondary-darker);
    --success-light: var(--secondary-light);
    --info: var(--primary-accent);
    --info-light: var(--primary-soft);

    --dur: 180ms;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Base typography & canvas ─────────────────────────────── */
html {
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--ds-edit-page-bg);
    color: var(--ds-edit-heading);
    line-height: 1.55;
    letter-spacing: -0.01em;
}

a {
    color: var(--primary-accent);
    transition: color var(--dur) var(--ease);
}

a:hover {
    color: var(--secondary-darker);
}

a:focus-visible,
button:focus-visible,
input:not([type="checkbox"]):not([type="radio"]):focus-visible,
select:focus-visible,
textarea:focus-visible,
.nav-item:focus-visible,
.mobile-nav-item:focus-visible {
    outline: 2px solid var(--secondary);
    outline-offset: 2px;
}

/* ── Sidebar — slim, premium dark ─────────────────────────── */
.sidebar {
    background: linear-gradient(175deg, var(--ds-edit-shell-deep) 0%, var(--ds-edit-shell) 48%, var(--ds-edit-shell-mid) 100%);
    border-right: 1px solid rgba(var(--ds-edit-mint-rgb), 0.12);
    box-shadow: 2px 0 20px rgba(8, 20, 38, 0.28);
}

.sidebar::before {
    background: radial-gradient(circle, rgba(var(--ds-edit-mint-rgb), 0.14) 0%, transparent 70%);
}

.sidebar::after {
    background: radial-gradient(circle, rgba(var(--ds-edit-primary-rgb), 0.1) 0%, transparent 70%);
}

.sidebar-brand {
    padding: 12px 14px;
    min-height: var(--topbar-h);
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

/* Shared frosted brand mark (mockup logo) */
.brand-mark {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    overflow: hidden;
    flex-shrink: 0;
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 5px 12px rgba(23, 17, 92, 0.18);
}

.brand-mark::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 58%;
    background: rgba(255, 255, 255, 0.1);
    pointer-events: none;
}

.brand-mark svg {
    position: relative;
    z-index: 1;
    display: block;
    width: 22px;
    height: 22px;
}

.sidebar-brand .brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6755cb, #9a91e3);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(103, 85, 203, 0.35);
}

.sidebar-brand .brand-mark::after {
    background: rgba(255, 255, 255, 0.12);
}

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

/* Dashboard / app shell — purple brand mark (all themes) */
body:has(.main-wrap) .sidebar-brand .brand-mark,
body:has(.main-wrap) .topbar .brand-mark,
body:has(.main-wrap) .mobile-brand-logo.brand-mark {
    background: linear-gradient(135deg, #6755cb, #9a91e3) !important;
    border-color: rgba(255, 255, 255, 0.22) !important;
    color: #FFFFFF !important;
    box-shadow: 0 4px 14px rgba(103, 85, 203, 0.35) !important;
}

.brand-name {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 1px;
}

.brand-name-accent,
.logo-text-accent {
    color: var(--secondary-darker, var(--ds-edit-mint-darker));
    -webkit-text-fill-color: var(--secondary-darker, var(--ds-edit-mint-darker));
}

.brand-tagline {
    font-size: 8.5px;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 1.4px;
}

.sidebar-toggle-btn {
    display: none !important;
}

/* Sidebar collapse toggle — simple arrow with light surface */
.icon-btn.collapse-icon,
.collapse-icon {
    display: none;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(15, 39, 68, 0.08);
    border-radius: 10px;
    background: #f1f5f9;
    color: #475569;
    cursor: pointer;
    box-shadow: none;
    transition:
        background var(--dur) var(--ease),
        border-color var(--dur) var(--ease),
        color var(--dur) var(--ease);
}

.collapse-icon > svg {
    display: block;
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
    transition: transform 0.2s var(--ease);
}

.icon-btn.collapse-icon:hover,
.collapse-icon:hover {
    background: #e8edf4;
    border-color: rgba(103, 85, 203, 0.18);
    color: #6755cb;
}

.icon-btn.collapse-icon:active,
.collapse-icon:active {
    transform: scale(0.96);
}

body.sidebar-collapsed .icon-btn.collapse-icon > svg,
body.sidebar-collapsed .collapse-icon > svg {
    transform: rotate(180deg);
}

html[data-theme="arth"] .icon-btn.collapse-icon,
html[data-theme="arth"] .collapse-icon {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    color: #d8d4f5;
    box-shadow: none;
}

html[data-theme="arth"] .icon-btn.collapse-icon:hover,
html[data-theme="arth"] .collapse-icon:hover {
    background: rgba(154, 145, 227, 0.16);
    border-color: rgba(154, 145, 227, 0.28);
    color: #f0eeff;
}

@media (min-width: 1025px) {
    .icon-btn.collapse-icon,
    .collapse-icon {
        display: inline-flex;
    }
}

.sidebar-nav {
    padding: 8px;
}

.nav-section-label {
    font-size: 8.5px;
    padding: 10px 10px 4px;
    color: rgba(255, 255, 255, 0.38);
}

.nav-item {
    padding: 8px 10px;
    gap: 10px;
    font-size: 12.5px;
    font-weight: 500;
    border-radius: var(--ds-edit-nav-active-radius, var(--r-md));
    border-left: none;
    color: var(--ds-edit-nav-color);
}

.nav-item:hover {
    background: var(--ds-edit-nav-hover-bg);
    color: var(--ds-edit-nav-hover-color);
}

.nav-item:hover svg {
    stroke: var(--ds-edit-nav-hover-icon);
}

.nav-item.active {
    background: var(--ds-edit-nav-active-bg);
    color: var(--ds-edit-nav-active-color);
    border-left: none;
    border-radius: var(--ds-edit-nav-active-radius);
    box-shadow: var(--ds-edit-nav-active-shadow);
    font-weight: 600;
}

.nav-item.active svg {
    stroke: var(--ds-edit-nav-active-icon);
}

.nav-badge.verified {
    background: linear-gradient(135deg, var(--secondary-dark), var(--secondary));
    color: #fff;
    box-shadow: 0 2px 8px var(--secondary-glow);
}

.sidebar-footer {
    padding: 8px;
}

.user-pill {
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(var(--ds-edit-mint-rgb), 0.14);
    border-radius: var(--r-md);
}

.user-pill:hover {
    background: rgba(var(--ds-edit-mint-rgb), 0.08);
}

.user-avatar {
    width: 32px;
    height: 32px;
    font-size: 11px;
    background: linear-gradient(135deg, var(--ds-edit-shell-mid), var(--ds-edit-shell-action));
    color: #e0fff5;
    border: 2px solid rgba(var(--ds-edit-mint-rgb), 0.8);
    box-shadow: 0 2px 8px var(--secondary-glow);
}

.user-status-dot {
    background: #06f13b !important;
    border-color: #fff !important;
    box-shadow: 0 0 6px var(--secondary-glow) !important;
}

.user-name {
    font-size: 11.5px;
}

.logout-btn {
    width: 28px;
    height: 28px;
    background: rgba(var(--ds-edit-mint-rgb), 0.12);
    border: 1px solid rgba(var(--ds-edit-mint-rgb), 0.25);
    border-radius: var(--r-sm);
    color: var(--secondary);
}

.logout-btn:hover {
    background: var(--secondary);
    color: #fff;
}

/* ── Topbar — clean glass ───────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    padding: 0 20px;
    background: linear-gradient(72deg, #FFFFFF 21%, var(--ds-edit-shell-action) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--ds-edit-border);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.35) inset,
        0 3px 14px rgba(15, 39, 68, 0.14);
}

.topbar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--r-md);
    background: #F1F5F9;
    border-color: transparent;
}

.icon-btn:hover {
    background: var(--secondary-light);
    border-color: rgba(var(--ds-edit-mint-rgb), 0.35);
    color: var(--secondary-darker);
}

/* Topbar market ticker — readable on dark header */
.topbar-main {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    gap: 12px;
}

.market-ticker-strip {
    flex-shrink: 0;
}

.market-ticker-track {
    display: flex;
    align-items: center;
}

.topbar .market-ticker,
.market-ticker-strip .market-ticker {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.topbar .ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.topbar .ticker-name {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72) !important;
}

.topbar .ticker-val {
    font-size: 11px;
    font-weight: 800;
    color: #FFFFFF !important;
    letter-spacing: -0.02em;
}

.topbar .ticker-chg {
    font-size: 10px;
    font-weight: 600;
}

.topbar .ticker-item.positive .ticker-chg {
    color: #86EFAC !important;
}

.topbar .ticker-item.negative .ticker-chg {
    color: #FCA5A5 !important;
}

/* Mobile marquee — continuous scroll below blue header */
@media (max-width: 1024px) {
    .market-ticker-strip {
        overflow: hidden !important;
        background: #F8FAFC !important;
        border-top: 1px solid rgba(var(--ds-edit-mint-rgb), 0.28);
        border-bottom: 1px solid #EEF2F6;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
        -webkit-mask-image: none !important;
        mask-image: none !important;
    }

    .market-ticker-strip .ticker-item {
        background: #FFFFFF !important;
        border: 1px solid #E2E8F0 !important;
        box-shadow: 0 1px 4px rgba(15, 39, 68, 0.06) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        padding: 5px 11px !important;
    }

    .market-ticker-strip .ticker-name {
        color: #64748B !important;
    }

    .market-ticker-strip .ticker-val {
        color: var(--ds-edit-shell) !important;
    }

    .market-ticker-strip .ticker-item.positive .ticker-chg {
        color: #059669 !important;
    }

    .market-ticker-strip .ticker-item.negative .ticker-chg {
        color: #DC2626 !important;
    }

    .market-ticker-track {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center;
        width: max-content !important;
        min-width: 100%;
        animation: marketTickerMarquee 20s linear infinite !important;
        will-change: transform;
    }

    .market-ticker-strip:hover .market-ticker-track,
    .market-ticker-strip:active .market-ticker-track {
        animation-play-state: paused !important;
    }

    .market-ticker-strip .market-ticker {
        display: inline-flex !important;
        flex: 0 0 auto !important;
        flex-wrap: nowrap !important;
        padding-right: 10px;
    }
}

@keyframes marketTickerMarquee {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(-50%, 0, 0);
    }
}

/* ── Buttons — Velzon-style (clean brand blue) ───────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0.5rem 0.95rem;
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.5;
    border-radius: var(--ds-radius-xs);
    border: 1px solid transparent;
    letter-spacing: normal;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,
        border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, transform 0.15s ease;
}

.btn-primary {
    color: #FFFFFF !important;
    background: var(--ds-gradient-action) !important;
    background-image: var(--ds-gradient-action) !important;
    border-color: var(--ds-edit-accent-deep) !important;
    box-shadow: 0 4px 12px rgba(var(--ds-edit-primary-rgb), 0.28) !important;
}

.btn-primary:hover {
    color: #FFFFFF !important;
    background: var(--ds-gradient-action-hover) !important;
    background-image: var(--ds-gradient-action-hover) !important;
    background-color: var(--btn-primary-hover) !important;
    border-color: var(--btn-primary-hover) !important;
    box-shadow: 0 2px 6px rgba(var(--ds-edit-primary-rgb), 0.28) !important;
}

.btn-primary:active,
.btn-primary:focus-visible {
    color: #FFFFFF !important;
    background-color: var(--btn-primary-active) !important;
    border-color: var(--btn-primary-active) !important;
    box-shadow: none !important;
}

/* Velzon gradient primary — subtle left-to-right shine */
.btn-primary.bg-gradient,
.welcome-actions .btn-primary {
    background: var(--ds-gradient-action) !important;
    background-image: var(--ds-gradient-action) !important;
    border-color: var(--ds-edit-accent-deep) !important;
}

.btn-primary.bg-gradient:hover,
.welcome-actions .btn-primary:hover {
    background: var(--ds-gradient-action-hover) !important;
    background-image: var(--ds-gradient-action-hover) !important;
    border-color: var(--btn-primary-hover) !important;
}

.btn-outline {
    color: var(--btn-outline-border) !important;
    background-color: transparent !important;
    border: 1px solid var(--btn-outline-border) !important;
    box-shadow: none !important;
}

.btn-outline:hover {
    color: #FFFFFF !important;
    background: var(--ds-gradient-action-hover) !important;
    background-image: var(--ds-gradient-action-hover) !important;
    background-color: var(--btn-primary-hover) !important;
    border-color: var(--btn-primary-hover) !important;
    box-shadow: none !important;
}

.btn-danger-outline {
    color: #DC2626 !important;
    background-color: transparent !important;
    border: 1px solid #FCA5A5 !important;
    box-shadow: none !important;
}

.btn-danger-outline:hover {
    color: #FFFFFF !important;
    background-color: #DC2626 !important;
    border-color: #DC2626 !important;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    border-radius: var(--ds-radius-xs);
}

.btn-xs {
    padding: 0.28rem 0.65rem;
    font-size: 0.6875rem;
    font-weight: 500;
    border-radius: var(--ds-radius-xs);
}

.card-header .btn-primary.btn-sm {
    padding: 8px 18px !important;
}

.ticker-item.positive .ticker-chg,
.positive,
.text-green,
.kpi-delta.positive,
.nav-change.positive,
.return-val.positive {
    color: var(--secondary-darker) !important;
}

/* ── Page content — slim spacing ──────────────────────────── */
.page-content {
    padding: 18px 22px;
}

.page-content:has(.explore-page),
.page-content:has(.mf-landing) {
    padding: 12px 18px 14px;
}

.page-content:has(.pf-page) {
    padding: 14px 18px 18px;
}

.main-wrap {
    background: var(--ds-edit-page-bg);
}

/* ── Welcome bar ────────────────────────────────────────────── */
.welcome-bar {
    margin-bottom: 12px;
    gap: 10px;
}

.welcome-greeting {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.welcome-sub {
    font-size: 12px;
    color: #64748B;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
    padding: 16px 18px;
    border-radius: var(--r-lg);
    border: 1px solid rgba(15, 39, 68, 0.07);
    box-shadow: var(--sh-sm);
    transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

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

.card-header {
    margin-bottom: 12px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.card-link {
    font-size: 11.5px;
    color: var(--secondary-darker);
    font-weight: 600;
}

/* ── App shell: dashboard KPI / grid / explore (scoped) ─────── */
body:has(.main-wrap) .kpi-grid {
    gap: 12px;
    margin-bottom: 12px;
}

body:has(.main-wrap) .kpi-card {
    padding: 14px 16px;
    gap: 12px;
    border-radius: var(--r-lg);
    border-color: rgba(15, 39, 68, 0.06);
}

body:has(.main-wrap) .kpi-card::after {
    background: linear-gradient(90deg, var(--secondary), var(--primary-accent));
}

body:has(.main-wrap) .kpi-card:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--ds-edit-mint-rgb), 0.35);
}

body:has(.main-wrap) .kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--r-md);
}

body:has(.main-wrap) .kpi-icon.green {
    background: linear-gradient(135deg, var(--secondary-light), #fff);
    color: var(--secondary-darker);
}

body:has(.main-wrap) .kpi-icon.blue,
body:has(.main-wrap) .kpi-icon.purple {
    background: linear-gradient(135deg, var(--primary-soft), #fff);
    color: var(--primary-accent);
}

body:has(.main-wrap) .kpi-label {
    font-size: 10px;
    letter-spacing: 0.5px;
    color: #64748B;
}

body:has(.main-wrap) .kpi-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.02em;
}

body:has(.main-wrap) .kpi-sub {
    font-size: 10px;
}

/* ── Dashboard KPI — distinct color per card, compact ─────── */
.dashboard-kpi-grid .kpi-card {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 14px 16px;
    border: none;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(17, 27, 61, 0.06), 0 4px 14px rgba(17, 27, 61, 0.04);
}

.dashboard-kpi-grid .kpi-card::after {
    display: none;
}

.dashboard-kpi-grid .kpi-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.dashboard-kpi-grid .kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 9px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(17, 27, 61, 0.1);
    font-size: 16px;
}

.dashboard-kpi-grid .kpi-icon svg {
    width: 18px;
    height: 18px;
}

/* 1 — Total Invested: purple */
.dashboard-kpi-grid .kpi-card--purple {
    background: linear-gradient(145deg, rgba(103, 85, 203, 0.12) 0%, #fff 55%);
}

.dashboard-kpi-grid .kpi-card--purple .kpi-icon {
    background: linear-gradient(135deg, #6755cb, #9a91e3);
    color: #fff;
}

/* 2 — Current Value: blue */
.dashboard-kpi-grid .kpi-card--blue {
    background: linear-gradient(145deg, rgba(37, 99, 235, 0.1) 0%, #fff 55%);
}

.dashboard-kpi-grid .kpi-card--blue .kpi-icon {
    background: linear-gradient(135deg, #2563eb, #60a5fa);
    color: #fff;
}

/* 3 — Today's Gain: amber (positive) / red (negative) */
.dashboard-kpi-grid .kpi-card--gain.positive {
    background: linear-gradient(145deg, rgba(245, 158, 11, 0.11) 0%, #fff 55%);
}

.dashboard-kpi-grid .kpi-card--gain.positive .kpi-icon {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: #fff;
}

.dashboard-kpi-grid .kpi-card--gain.negative {
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.1) 0%, #fff 55%);
}

.dashboard-kpi-grid .kpi-card--gain.negative .kpi-icon {
    background: linear-gradient(135deg, #ef4444, #f87171);
    color: #fff;
}

/* 4 — Active SIPs: violet */
.dashboard-kpi-grid .kpi-card--violet {
    background: linear-gradient(145deg, rgba(124, 58, 237, 0.1) 0%, #fff 55%);
}

.dashboard-kpi-grid .kpi-card--violet .kpi-icon {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    color: #fff;
}

.dashboard-kpi-grid .kpi-label {
    font-size: 11px;
    font-weight: 500;
    color: #8792ad;
    text-transform: none;
    letter-spacing: 0;
    margin: 0;
    padding-top: 2px;
}

.dashboard-kpi-grid .kpi-value {
    font-size: 20px;
    font-weight: 600;
    color: #111b3d;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.dashboard-kpi-grid .kpi-delta,
.dashboard-kpi-grid .kpi-sub {
    font-size: 10.5px;
    font-weight: 500;
    margin-top: 0;
    line-height: 1.2;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .dashboard-kpi-grid .kpi-card {
    border: none !important;
    transform: none !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .dashboard-kpi-grid .kpi-card--purple {
    background: linear-gradient(145deg, rgba(103, 85, 203, 0.12) 0%, #fff 55%) !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .dashboard-kpi-grid .kpi-card--blue {
    background: linear-gradient(145deg, rgba(37, 99, 235, 0.1) 0%, #fff 55%) !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .dashboard-kpi-grid .kpi-card--gain.positive {
    background: linear-gradient(145deg, rgba(245, 158, 11, 0.11) 0%, #fff 55%) !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .dashboard-kpi-grid .kpi-card--gain.negative {
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.1) 0%, #fff 55%) !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .dashboard-kpi-grid .kpi-card--violet {
    background: linear-gradient(145deg, rgba(124, 58, 237, 0.1) 0%, #fff 55%) !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .dashboard-kpi-grid .kpi-card:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 18px rgba(103, 85, 203, 0.1) !important;
}

/* ── Dashboard grid — symmetric rows, tight spacing ───────── */
.dashboard-grid {
    gap: 12px;
    align-items: stretch;
}

.dashboard-grid > .card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding: 14px 16px;
}

.dashboard-grid .card-header {
    margin-bottom: 8px;
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: nowrap;
}

.dashboard-grid .card-title {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
}

.dashboard-grid .chart-period-tabs {
    flex-shrink: 0;
}

/* Performance chart — fixed height */
.chart-card .chart-wrap {
    flex: 0 0 auto;
    position: relative;
    height: 180px;
    max-height: 180px;
    width: 100%;
}

/* Allocation — grid rows so donut centers when card stretches */
.dashboard-grid > .allocation-card {
    display: grid;
    grid-template-rows: auto 1fr auto;
    height: 100%;
}

.allocation-card .card-header {
    grid-row: 1;
}

.allocation-card .chart-wrap--donut {
    grid-row: 2;
    align-self: center;
    justify-self: center;
    position: relative;
    height: 155px;
    max-height: 155px;
    width: 100%;
    max-width: 200px;
    margin: 0;
}

.allocation-card .allocation-legend {
    grid-row: 3;
    margin-top: 0;
    padding-top: 4px;
    gap: 4px;
}

.chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
    max-height: 100%;
}

.dashboard-grid .alloc-leg-item {
    padding: 2px 0;
}

.dashboard-grid .alloc-label,
.dashboard-grid .alloc-pct {
    font-size: 11px;
}

/* Holdings & transactions — equal-height paired cards */
.holdings-card .holdings-list,
.txn-card .txn-list {
    flex: 1 1 auto;
    min-height: 0;
}

.dashboard-grid .holding-row,
.dashboard-grid .txn-row {
    padding: 9px 8px;
    font-weight: 500;
}

.dashboard-grid .holding-name,
.dashboard-grid .holding-meta,
.dashboard-grid .holding-current,
.dashboard-grid .holding-return,
.dashboard-grid .txn-name,
.dashboard-grid .txn-meta,
.dashboard-grid .txn-val {
    font-weight: 500;
}

body:has(.main-wrap) .period-btn.active,
body:has(.main-wrap) .period-btn:hover,
body:has(.main-wrap) .cat-tab.active {
    background: linear-gradient(90deg, #6755cb, #9a91e3);
    box-shadow: 0 2px 8px rgba(103, 85, 203, 0.28);
    color: #fff;
    border-color: transparent;
}

body:has(.main-wrap) .cat-tab:hover {
    border-color: var(--secondary);
    color: var(--secondary-darker);
}

body:has(.main-wrap) .holding-row:hover,
body:has(.main-wrap) .txn-row:hover {
    background: var(--secondary-light);
}

body:has(.main-wrap) .fund-logo-mini,
body:has(.main-wrap) .fund-logo,
body:has(.main-wrap) .fund-logo-lg {
    background: linear-gradient(135deg, #6755cb, #9a91e3);
    color: #fff;
    box-shadow: 0 4px 12px rgba(103, 85, 203, 0.28);
}

body:has(.main-wrap) .recommend-row:hover {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px var(--secondary-muted);
}

/* ── Mutual fund landing page ─────────────────────────────── */
.mf-landing {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.mf-landing-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 20px;
    border: 1px solid #e8ebf3;
    border-radius: 14px;
    background:
        radial-gradient(ellipse 80% 120% at 100% 0%, rgba(103, 85, 203, 0.08), transparent 55%),
        linear-gradient(180deg, #fff 0%, #fafbff 100%);
    box-shadow: 0 1px 3px rgba(17, 27, 61, 0.04);
}

.mf-landing-title {
    margin: 0 0 6px;
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.mf-landing-sub {
    margin: 0 0 14px;
    font-size: 13px;
    line-height: 1.45;
    color: #64748b;
}

.mf-landing-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mf-landing-hero-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
    text-align: right;
    padding: 4px 0;
}

.mf-landing-stat-val {
    font-size: 32px;
    font-weight: 700;
    color: #6755cb;
    line-height: 1;
    letter-spacing: -0.03em;
}

.mf-landing-stat-label {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
}

.mf-landing-stat-meta {
    margin-top: 2px;
    font-size: 11px;
    color: #94a3b8;
}

.mf-landing-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mf-landing-section-hdr {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.mf-landing-section-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.mf-landing-section-sub {
    margin: 2px 0 0;
    font-size: 12px;
    color: #64748b;
}

.mf-landing-link {
    font-size: 12px;
    font-weight: 600;
    color: #6755cb;
    text-decoration: none;
    white-space: nowrap;
}

.mf-landing-link:hover {
    text-decoration: underline;
}

.mf-category-chips {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}

.mf-category-chip {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid #e8ebf3;
    border-radius: 10px;
    background: #fff;
    text-decoration: none;
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), background var(--dur) var(--ease);
}

.mf-category-chip--all {
    background: linear-gradient(180deg, #f5f3ff 0%, #faf9ff 100%);
    border-color: #e9e4ff;
}

.mf-category-chip--equity {
    background: linear-gradient(180deg, #eff6ff 0%, #f8fbff 100%);
    border-color: #dbeafe;
}

.mf-category-chip--debt {
    background: linear-gradient(180deg, #ecfdf5 0%, #f6fef9 100%);
    border-color: #bbf7d0;
}

.mf-category-chip--hybrid {
    background: linear-gradient(180deg, #eef2ff 0%, #f7f8ff 100%);
    border-color: #c7d2fe;
}

.mf-category-chip--elss {
    background: linear-gradient(180deg, #fff7ed 0%, #fffbf5 100%);
    border-color: #fed7aa;
}

.mf-category-chip--index {
    background: linear-gradient(180deg, #f8fafc 0%, #fcfdfe 100%);
    border-color: #e2e8f0;
}

.mf-category-chip:hover {
    border-color: rgba(103, 85, 203, 0.35);
    box-shadow: 0 4px 14px rgba(103, 85, 203, 0.08);
    transform: translateY(-1px);
}

.mf-category-chip--all:hover {
    background: linear-gradient(180deg, #ede9fe 0%, #f5f3ff 100%);
}

.mf-category-chip--equity:hover {
    background: linear-gradient(180deg, #dbeafe 0%, #eff6ff 100%);
}

.mf-category-chip--debt:hover {
    background: linear-gradient(180deg, #d1fae5 0%, #ecfdf5 100%);
}

.mf-category-chip--hybrid:hover {
    background: linear-gradient(180deg, #e0e7ff 0%, #eef2ff 100%);
}

.mf-category-chip--elss:hover {
    background: linear-gradient(180deg, #ffedd5 0%, #fff7ed 100%);
}

.mf-category-chip--index:hover {
    background: linear-gradient(180deg, #f1f5f9 0%, #f8fafc 100%);
}

.mf-category-chip-label {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
}

.mf-category-chip-count {
    font-size: 11px;
    font-weight: 600;
    color: #6755cb;
}

.mf-category-chip-desc {
    font-size: 10.5px;
    color: #94a3b8;
    line-height: 1.3;
}

.mf-spotlight-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.mf-spotlight-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border: 1px solid #e8ebf3;
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(17, 27, 61, 0.04);
}

.mf-spotlight-top {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.mf-spotlight-head {
    min-width: 0;
}

.mf-spotlight-name {
    margin: 4px 0 2px;
    font-size: 13px;
    font-weight: 700;
    color: #111b3d;
    line-height: 1.25;
}

.mf-spotlight-house {
    margin: 0;
    font-size: 10.5px;
    color: #8792ad;
}

.mf-spotlight-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
    border-radius: 8px;
    background: #f7f8fb;
    border: 1px solid #eef1f6;
}

.mf-spotlight-stat-label {
    display: block;
    font-size: 9px;
    font-weight: 500;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mf-spotlight-stat-val {
    font-size: 13px;
    font-weight: 600;
    color: #111b3d;
}

.mf-spotlight-stat-val.positive {
    color: #12a150;
}

.mf-spotlight-actions {
    display: flex;
    gap: 6px;
    margin-top: auto;
}

.mf-spotlight-actions .btn {
    flex: 1;
    justify-content: center;
}

.mf-goal-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.mf-goal-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px;
    border: 1px solid #e8ebf3;
    border-radius: 11px;
    background: #fff;
    text-decoration: none;
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.mf-goal-card:hover {
    border-color: rgba(103, 85, 203, 0.3);
    box-shadow: 0 4px 16px rgba(103, 85, 203, 0.08);
}

.mf-goal-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: #f0eefc;
    color: #6755cb;
    font-size: 14px;
}

.mf-goal-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}

.mf-goal-desc {
    font-size: 11.5px;
    line-height: 1.4;
    color: #64748b;
    flex: 1;
}

.mf-goal-link {
    font-size: 11px;
    font-weight: 600;
    color: #6755cb;
}

.mf-curated-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.mf-curated-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 11px 12px;
    border: 1px solid #e8ebf3;
    border-radius: 10px;
    background: #fff;
    text-decoration: none;
    transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.mf-curated-card:hover {
    border-color: rgba(103, 85, 203, 0.28);
    background: #faf9ff;
}

.mf-curated-name {
    font-size: 12.5px;
    font-weight: 600;
    color: #111b3d;
    line-height: 1.3;
}

.mf-curated-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 11px;
    color: #64748b;
}

.mf-curated-sep {
    color: #cbd5e1;
}

.mf-landing-cta {
    margin-top: 4px;
}

.mf-landing-cta-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6755cb 0%, #9a91e3 100%);
    color: #fff;
    box-shadow: 0 6px 20px rgba(103, 85, 203, 0.25);
}

.mf-landing-cta-title {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.mf-landing-cta-sub {
    margin: 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.88);
    max-width: 480px;
}

.mf-landing-cta .btn-primary {
    background: #fff !important;
    color: #6755cb !important;
    border-color: #fff !important;
    box-shadow: none !important;
    flex-shrink: 0;
}

.mf-landing-cta .btn-primary:hover {
    background: #f8f7ff !important;
}

.explore-breadcrumb a {
    color: inherit;
    text-decoration: none;
}

.explore-breadcrumb a:hover {
    color: #6755cb;
    text-decoration: underline;
}

@media (max-width: 1100px) {
    .mf-category-chips {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .mf-spotlight-grid,
    .mf-goal-grid,
    .mf-curated-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .page-content:has(.mf-landing) {
        padding: 10px 12px 12px;
    }

    .mf-landing-hero {
        flex-direction: column;
        padding: 14px;
    }

    .mf-landing-hero-stat {
        align-items: flex-start;
        text-align: left;
    }

    .mf-landing-title {
        font-size: 20px;
    }

    .mf-category-chips {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mf-landing-cta-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .mf-landing-cta .btn-primary {
        width: 100%;
        justify-content: center;
    }
}

/* ── Explore page toolbar (search · filters · sort · tabs) ─── */
.explore-page {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.explore-page-hdr {
    margin-bottom: 10px;
}

.explore-breadcrumb {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 4px;
}

.explore-page-title {
    margin: 0 0 2px;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.explore-page-sub {
    margin: 0;
    max-width: 560px;
    font-size: 12.5px;
    line-height: 1.35;
    color: #64748b;
}

.explore-toolbar {
    margin-bottom: 0;
}

.explore-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.explore-search-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.explore-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

.explore-search-input {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px 8px 38px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    font-size: 13px;
    color: #1e293b;
    outline: none;
    font-family: var(--font);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.explore-search-input::placeholder {
    color: #94a3b8;
}

.explore-search-input:focus {
    border-color: #6755cb;
    box-shadow: 0 0 0 3px rgba(103, 85, 203, 0.12);
}

.explore-filters-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.explore-filters-btn:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.explore-sort-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    flex-shrink: 0;
}

.explore-sort-icon {
    position: absolute;
    left: 12px;
    color: #64748b;
    font-size: 11px;
    pointer-events: none;
    z-index: 2;
}

.explore-sort-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 40px;
    min-width: 168px;
    padding: 0 12px 0 32px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    outline: none;
    cursor: pointer;
    font-family: var(--font);
    white-space: nowrap;
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.explore-sort-trigger:hover,
.explore-sort-wrap.is-open .explore-sort-trigger {
    border-color: #cbd5e1;
}

.explore-sort-trigger:focus-visible {
    border-color: #6755cb;
    box-shadow: 0 0 0 3px rgba(103, 85, 203, 0.12);
}

.explore-sort-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.explore-sort-chevron {
    flex-shrink: 0;
    color: #94a3b8;
    font-size: 10px;
    transition: transform var(--dur) var(--ease);
}

.explore-sort-wrap.is-open .explore-sort-chevron {
    transform: rotate(180deg);
}

.explore-sort-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 120;
    min-width: 100%;
    width: max-content;
    margin: 0;
    padding: 6px;
    list-style: none;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

.explore-sort-option {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.explore-sort-option:hover {
    background: #f8fafc;
    color: #1e293b;
}

.explore-sort-option.is-active {
    background: rgba(103, 85, 203, 0.1);
    color: #6755cb;
}

.explore-results-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.explore-view-toggle {
    display: inline-flex;
    align-items: center;
    padding: 2px;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    background: #f8fafc;
    gap: 2px;
}

.explore-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 13px;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.explore-view-btn:hover {
    color: #334155;
    background: rgba(103, 85, 203, 0.08);
}

.explore-view-btn.is-active {
    background: #fff;
    color: #6755cb;
    box-shadow: 0 1px 3px rgba(15, 39, 68, 0.08);
}

.explore-filter-badge,
.explore-filter-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #6755cb;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.explore-filter-count-badge:empty,
.explore-filter-count-badge[data-filter-count="0"] {
    display: none;
}

.explore-cat-tabs {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin: 8px 0 0;
    padding: 0;
    border-bottom: 1px solid #e8ebf3;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.explore-cat-tabs::-webkit-scrollbar {
    display: none;
}

.explore-cat-tab {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px 7px;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: none;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.explore-cat-tab:hover {
    color: #334155;
}

.explore-cat-tab.active {
    color: #6755cb;
    border-bottom-color: #6755cb;
}

.explore-cat-count {
    font-weight: 700;
    color: inherit;
}

.explore-results-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 10px 0 8px;
}

.explore-results-hdr-text {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 10px;
    min-width: 0;
}

.explore-results-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.explore-results-meta {
    margin: 0;
    font-size: 12px;
    color: #64748b;
}

.explore-meta-sep {
    margin: 0 4px;
}

.explore-watchlist-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 600;
    color: #6755cb;
    text-decoration: none;
    white-space: nowrap;
}

.explore-watchlist-link:hover {
    color: #5645b8;
    text-decoration: underline;
}

.explore-empty {
    grid-column: 1 / -1;
    padding: 40px 24px;
    text-align: center;
    border: 1px dashed #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    color: #64748b;
}

.explore-empty p {
    margin: 0 0 14px;
}

/* ── Explore filter drawer ─────────────────────────────────── */
.explore-filter-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 220ms var(--ease);
}

body.explore-filters-open {
    overflow: hidden;
}

html.explore-filters-open {
    overflow: hidden;
    height: 100%;
}

body.explore-filters-open .main-wrap,
body.explore-filters-open .page-content {
    overflow: hidden;
    overscroll-behavior: none;
}

body.explore-filters-open .explore-filter-backdrop {
    opacity: 1;
}

.explore-filter-panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 201;
    width: min(360px, 100vw);
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    background: #fff;
    border-left: 1px solid #e8ebf3;
    box-shadow: -8px 0 32px rgba(15, 23, 42, 0.12);
    transform: translateX(100%);
    transition: transform 240ms var(--ease);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overscroll-behavior: contain;
}

body.explore-filters-open .explore-filter-panel {
    transform: translateX(0);
}

.explore-filter-form {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: 100%;
    height: 100%;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

.explore-filter-hdr {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid #eef1f6;
    flex-shrink: 0;
    overflow: hidden;
}

.explore-filter-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 2px;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.explore-filter-sub {
    margin: 0;
    font-size: 11.5px;
    color: #64748b;
}

.explore-filter-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: #f1f5f9;
    color: #475569;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--dur) var(--ease);
}

.explore-filter-close:hover {
    background: #e2e8f0;
}

.explore-filter-body {
    grid-row: 2;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}

.explore-filter-section {
    border-bottom: 1px solid #eef1f6;
}

.explore-filter-section-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    cursor: pointer;
    list-style: none;
}

.explore-filter-section-hdr::-webkit-details-marker {
    display: none;
}

.explore-filter-chevron {
    font-size: 10px;
    color: #94a3b8;
    transition: transform var(--dur) var(--ease);
}

.explore-filter-section[open] .explore-filter-chevron {
    transform: rotate(180deg);
}

.explore-filter-options {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 10px 8px;
}

.explore-filter-options--compact {
    padding-bottom: 6px;
}

.explore-filter-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 7px 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: background var(--dur) var(--ease);
}

.explore-filter-option--compact {
    padding: 5px 6px;
}

.explore-filter-option:hover {
    background: #f8fafc;
}

.explore-filter-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.explore-filter-check {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    border: 1.5px solid #cbd5e1;
    border-radius: 5px;
    background: #fff;
    position: relative;
    transition: all var(--dur) var(--ease);
}

.explore-filter-check--radio {
    border-radius: 999px;
}

.explore-filter-option input:checked + .explore-filter-check {
    background: #6755cb;
    border-color: #6755cb;
}

.explore-filter-option input:checked + .explore-filter-check::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.explore-filter-option:not(.explore-filter-option--radio) input:checked + .explore-filter-check::after {
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -58%) rotate(45deg);
}

.explore-filter-option--radio input:checked + .explore-filter-check::after {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #fff;
}

.explore-filter-option-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.explore-filter-option-label {
    font-size: 12.5px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.25;
}

.explore-filter-option-desc {
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.3;
}

.explore-filter-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #eef1f6;
    background: #fff;
    flex-shrink: 0;
    z-index: 2;
    box-shadow: 0 -6px 16px rgba(15, 23, 42, 0.06);
}

.explore-filter-clear {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 4px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
}

.explore-filter-clear:hover {
    color: #334155;
    text-decoration: underline;
}

.explore-filter-apply {
    min-height: 38px;
    padding: 0 18px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .page-content:has(.explore-page) {
        padding: 10px 12px 12px;
    }

    .explore-results-hdr-text {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .explore-search-row {
        flex-direction: column;
        align-items: stretch;
    }

    .explore-filters-btn,
    .explore-sort-wrap {
        width: 100%;
    }

    .explore-sort-trigger {
        width: 100%;
    }

    .explore-results-hdr {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .explore-results-actions {
        width: 100%;
        justify-content: space-between;
    }

    .explore-filter-panel {
        width: 100vw;
    }
}

/* ── Filter bar removed from Explore (legacy) ─────────────── */
.filter-bar {
    display: none !important;
}

.search-input:focus,
.form-input:focus,
.form-select:focus,
.cf-input:focus,
.cf-select:focus,
.f-input:focus,
.f-select:focus {
    border-color: var(--secondary-dark);
    box-shadow: 0 0 0 3px var(--secondary-muted);
}

.search-input:focus {
    border-color: var(--secondary-dark);
    box-shadow: 0 0 0 3px var(--secondary-muted);
}

/* ── Explore fund cards (screenshot layout) ─────────────────── */
.explore-fund-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

@media (min-width: 1280px) {
    .explore-fund-grid:not(.is-list-view) {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.explore-fund-grid.is-list-view {
    grid-template-columns: 1fr;
    gap: 8px;
}

.explore-fund-grid.is-list-view .fund-card {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.9fr) minmax(0, 1.4fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 12px;
    row-gap: 4px;
    padding: 10px 12px;
}

.explore-fund-grid.is-list-view .fund-card-header {
    grid-column: 1;
    grid-row: 1 / 3;
}

.explore-fund-grid.is-list-view .fund-card-tags {
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: center;
    flex-direction: column;
    align-items: flex-start;
}

.explore-fund-grid.is-list-view .fund-curated {
    margin-left: 0;
}

.explore-fund-grid.is-list-view .fund-metrics {
    grid-column: 3;
    grid-row: 1 / 3;
    align-self: center;
    padding: 6px 8px;
}

.explore-fund-grid.is-list-view .fund-card-footer {
    grid-column: 4;
    grid-row: 1 / 3;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    padding-top: 0;
    border-top: 0;
}

.explore-fund-grid.is-list-view .fund-card-actions {
    flex-direction: column;
}

.explore-fund-grid.is-list-view .fund-wishlist-btn {
    display: none;
}

@media (max-width: 900px) {
    .explore-fund-grid.is-list-view .fund-card {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .explore-fund-grid.is-list-view .fund-card-header,
    .explore-fund-grid.is-list-view .fund-card-tags,
    .explore-fund-grid.is-list-view .fund-metrics,
    .explore-fund-grid.is-list-view .fund-card-footer {
        grid-column: 1;
        grid-row: auto;
    }

    .explore-fund-grid.is-list-view .fund-card-tags {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .explore-fund-grid.is-list-view .fund-card-footer {
        flex-direction: row;
        align-items: center;
        border-top: 1px solid #eef1f6;
        padding-top: 8px;
    }

    .explore-fund-grid.is-list-view .fund-card-actions {
        flex-direction: row;
    }

    .explore-fund-grid.is-list-view .fund-wishlist-btn {
        display: inline-flex;
    }
}

.explore-fund-grid .fund-card {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 11px 12px;
    border: 1px solid #e8ebf3;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(17, 27, 61, 0.04);
    min-width: 0;
}

.explore-fund-grid .fund-card::before {
    display: none;
}

.explore-fund-grid .fund-card:hover {
    transform: translateY(-1px);
    border-color: rgba(103, 85, 203, 0.2);
    box-shadow: 0 4px 16px rgba(103, 85, 203, 0.08);
}

.explore-fund-grid .fund-card-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.explore-fund-grid .fund-logo {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    flex-shrink: 0;
    background: linear-gradient(145deg, #6755cb, #9a91e3);
    color: #fff;
    box-shadow: 0 2px 8px rgba(103, 85, 203, 0.2);
}

.explore-fund-grid .fund-head-text {
    flex: 1;
    min-width: 0;
    padding-top: 0;
}

.explore-fund-grid .fund-name {
    font-size: 13px;
    font-weight: 600;
    color: #111b3d;
    line-height: 1.25;
    margin: 0 0 1px;
}

.explore-fund-grid .fund-house {
    font-size: 10.5px;
    font-weight: 500;
    color: #8792ad;
    margin: 0;
    line-height: 1.2;
}

.explore-fund-grid .fund-wishlist-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #f4f3fb;
    color: #6755cb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 12px;
    transition: background 0.15s ease, color 0.15s ease;
}

.explore-fund-grid .fund-wishlist-btn:hover {
    background: #ebe8fa;
}

.explore-fund-grid .fund-wishlist-btn.is-active {
    background: #ebe8fa;
    color: #6755cb;
}

.explore-fund-grid .fund-card-tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.explore-fund-grid .fund-curated {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 500;
    color: #6755cb;
}

    .explore-fund-grid .fund-curated i {
        font-size: 9px;
        color:  #F59E0B;
    }

/* Light metrics strip — screenshot match */
.explore-fund-grid .fund-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    padding: 6px 4px;
    background: #f7f8fb;
    border: 1px solid #eef1f6;
    border-radius: 7px;
}

.explore-fund-grid .fund-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 0 6px;
    text-align: center;
    min-height: 36px;
}

.explore-fund-grid .fund-metric:not(:last-child) {
    border-right: 1px solid #e3e7ef;
}

.explore-fund-grid .fund-metric-label {
    font-size: 9px;
    font-weight: 500;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.1;
}

.explore-fund-grid .fund-metric-val {
    font-size: 13.5px;
    font-weight: 600;
    color: #111b3d;
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.explore-fund-grid .fund-metric-val.positive {
    color: #12a150;
}

.explore-fund-grid .fund-metric-val.negative {
    color: #dc2626;
}

.explore-fund-grid .fund-metric-val--nav {
    color: #111b3d;
    font-weight: 600;
}

.explore-fund-grid .fund-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 6px;
    margin-top: 0;
    border-top: 1px solid #eef1f6;
}

.explore-fund-grid .fund-min-sip {
    font-size: 11px;
    font-weight: 500;
    color: #8792ad;
    white-space: nowrap;
}

.explore-fund-grid .fund-min-sip strong {
    color: #111b3d;
    font-weight: 600;
}

.explore-fund-grid .fund-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.explore-fund-grid .fund-card-tags .fund-category-chip,
.explore-fund-grid .fund-card-tags .risk-chip {
    font-size: 10px;
    padding: 2px 7px;
}

.explore-fund-grid .btn-compare {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #5c6378 !important;
    background: #f1f3f9 !important;
    border: 1px solid #e0e3ec !important;
    border-radius: var(--ds-radius-xs) !important;
    padding: 4px 10px !important;
    font-size: 10.5px !important;
    font-weight: 500 !important;
    box-shadow: none !important;
    min-height: 30px;
}

.explore-fund-grid .btn-compare-icon {
    font-size: 10px;
}

.explore-fund-grid .btn-compare:hover {
    border-color: #d4d8e8 !important;
    background: #e8ebf3 !important;
}

.explore-fund-grid .btn-compare.is-comparing {
    color: #6755cb !important;
    background: #f0eefc !important;
    border-color: rgba(103, 85, 203, 0.28) !important;
}

.explore-fund-grid .fund-card-actions .btn-primary {
    border-radius: var(--ds-radius-xs) !important;
    padding: 4px 14px !important;
    font-size: 10.5px !important;
    font-weight: 600 !important;
    min-height: 30px;
    background: linear-gradient(90deg, #6755cb, #9a91e3) !important;
    border-color: #6755cb !important;
    box-shadow: 0 2px 6px rgba(103, 85, 203, 0.2) !important;
}

@media (max-width: 1100px) {
    .explore-fund-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .explore-fund-grid .fund-card {
        border: 1px solid #e8ebf3 !important;
        border-radius: 12px !important;
        box-shadow: 0 1px 3px rgba(17, 27, 61, 0.05), 0 4px 14px rgba(17, 27, 61, 0.04) !important;
    }
}

@media (max-width: 640px) {
    .explore-fund-grid .fund-card {
        padding: 16px;
    }

    .explore-fund-grid .fund-card-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .explore-fund-grid .fund-card-actions {
        width: 100%;
    }

    .explore-fund-grid .fund-card-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .explore-fund-grid .fund-metric-val {
        font-size: 14px;
    }
}

/* ── Fund cards (legacy base) ───────────────────────────────── */
.fund-grid {
    gap: 14px;
}

.fund-card {
    padding: 16px;
    border-radius: var(--r-xs);
}

.fund-card::before {
    background: linear-gradient(90deg, var(--secondary), var(--primary-accent));
}

.fund-card:hover {
    border-color: rgba(var(--ds-edit-mint-rgb), 0.45);
}

/* ── Portfolio overview page ───────────────────────────────── */
.pf-page {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.pf-page-hdr {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.pf-eyebrow {
    display: block;
    margin-bottom: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6755cb;
}

.pf-title {
    margin: 0;
    font-size: clamp(24px, 2.4vw, 30px);
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.03em;
}

.pf-title-spark {
    color: #f59e0b;
    font-size: 0.9em;
}

.pf-subtitle {
    margin: 6px 0 0;
    font-size: 13px;
    color: #64748b;
    max-width: 520px;
}

.pf-as-on {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #e8ebf3;
    color: #64748b;
    font-size: 11.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.pf-overview {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
    gap: 14px;
}

.pf-hero-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    min-height: 220px;
    padding: 22px 24px;
    border-radius: 20px;
    background: linear-gradient(135deg, #6755cb 0%, #7c6fe0 48%, #9a91e3 100%);
    color: #fff;
    box-shadow: 0 16px 36px rgba(103, 85, 203, 0.22);
}

.pf-hero-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.82);
}

.pf-hero-value {
    display: block;
    margin-top: 6px;
    font-size: clamp(30px, 3vw, 38px);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.05;
}

.pf-hero-change {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.pf-hero-change.is-up {
    color: #dcfce7;
}

.pf-hero-change.is-down {
    color: #fee2e2;
}

.pf-hero-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pf-hero-pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.pf-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.pf-kpi-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 104px;
    padding: 16px 16px 14px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid #e8ebf3;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.pf-kpi-label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
}

.pf-kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.pf-kpi-value.is-positive {
    color: #16a34a;
}

.pf-kpi-value.is-negative {
    color: #dc2626;
}

.pf-kpi-meta {
    margin-top: auto;
    font-size: 11px;
    color: #94a3b8;
}

.pf-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pf-section-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pf-section-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.pf-section-link {
    font-size: 12px;
    font-weight: 600;
    color: #6755cb;
    text-decoration: none;
    white-space: nowrap;
}

.pf-section-link:hover {
    text-decoration: underline;
}

.pf-pulse-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.pf-pulse-card {
    position: relative;
    min-height: 132px;
    padding: 18px 18px 16px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid #e8ebf3;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.pf-pulse-icon {
    position: absolute;
    top: 16px;
    right: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 14px;
}

.pf-pulse-icon--chart {
    background: rgba(103, 85, 203, 0.1);
    color: #6755cb;
}

.pf-pulse-icon--flame {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}

.pf-pulse-icon--bolt {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

.pf-pulse-title {
    margin: 0 0 8px;
    padding-right: 42px;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}

.pf-pulse-copy {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.55;
    color: #64748b;
}

.pf-details-card {
    border-radius: 18px;
    background: #fff;
    border: 1px solid #e8ebf3;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

.pf-details-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #eef1f6;
}

.pf-search-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    max-width: 420px;
}

.pf-search-input {
    width: 100%;
    min-height: 42px;
    padding: 0 42px 0 14px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    font-size: 13px;
    color: #334155;
    outline: none;
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.pf-search-input:focus {
    border-color: #6755cb;
    box-shadow: 0 0 0 3px rgba(103, 85, 203, 0.12);
    background: #fff;
}

.pf-search-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 14px;
    pointer-events: none;
}

.pf-add-btn {
    flex-shrink: 0;
}

.pf-holdings-list {
    display: flex;
    flex-direction: column;
}

.pf-holding-row {
    display: grid;
    grid-template-columns: minmax(220px, 1.2fr) minmax(280px, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    border-bottom: 1px solid #eef1f6;
}

.pf-holding-row:last-child {
    border-bottom: 0;
}

.pf-holding-fund {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}

.pf-holding-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: #4338ca;
    font-size: 15px;
    font-weight: 700;
    flex-shrink: 0;
}

.pf-holding-info {
    min-width: 0;
}

.pf-holding-name {
    margin: 0 0 6px;
    font-size: 13.5px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pf-holding-tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.pf-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 10px;
    font-weight: 600;
}

.pf-tag--muted {
    background: #eef2ff;
    color: #4338ca;
}

.pf-tag--sip {
    background: rgba(103, 85, 203, 0.1);
    color: #6755cb;
}

.pf-rating {
    font-size: 10px;
    color: #f59e0b;
    letter-spacing: 0.04em;
}

.pf-holding-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.pf-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.pf-metric-label {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
}

.pf-metric-value {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
}

.pf-returns-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pf-returns-value {
    font-size: 13px;
    font-weight: 700;
}

.pf-returns-bar {
    display: block;
    width: 100%;
    max-width: 110px;
    height: 5px;
    border-radius: 999px;
    background: #e8ebf3;
    overflow: hidden;
}

.pf-returns-bar-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
}

.pf-returns-bar-fill.is-up {
    background: linear-gradient(90deg, #6755cb, #9a91e3);
}

.pf-returns-bar-fill.is-down {
    background: linear-gradient(90deg, #f87171, #ef4444);
}

.pf-holding-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pf-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: rgba(103, 85, 203, 0.1);
    color: #6755cb;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.pf-action-btn:hover {
    background: rgba(103, 85, 203, 0.16);
    color: #5644b8;
}

.pf-action-btn--muted {
    background: #f1f5f9;
    color: #64748b;
}

.pf-action-btn--muted:hover {
    background: #e2e8f0;
    color: #334155;
}

.pf-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 36px 20px;
    color: #64748b;
    text-align: center;
}

.pf-disclaimer {
    margin: 0;
    font-size: 11px;
    line-height: 1.5;
    color: #94a3b8;
    text-align: center;
}

@media (max-width: 1100px) {
    .pf-overview {
        grid-template-columns: 1fr;
    }

    .pf-pulse-grid {
        grid-template-columns: 1fr;
    }

    .pf-holding-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .pf-holding-name {
        white-space: normal;
    }
}

@media (max-width: 768px) {
    .pf-page-hdr {
        flex-direction: column;
    }

    .pf-as-on {
        align-self: flex-start;
    }

    .pf-kpi-grid {
        grid-template-columns: 1fr;
    }

    .pf-details-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .pf-search-wrap {
        max-width: none;
    }

    .pf-holding-metrics {
        grid-template-columns: 1fr;
    }

    .pf-holding-actions {
        justify-content: flex-end;
    }
}

/* ── Portfolio strip (legacy) ───────────────────────────────── */
.portfolio-summary-strip {
    padding: 18px 24px;
    margin-bottom: 14px;
    border: 1px solid rgba(var(--ds-edit-mint-rgb), 0.2);
    box-shadow: var(--sh-md);
    background: linear-gradient(135deg, #fff 0%, var(--secondary-light) 100%);
}

.ps-label {
    font-size: 9.5px;
    color: var(--primary-mid);
}

.ps-val {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: -0.02em;
}

/* ── Tables — modern, sticky header ─────────────────────────── */
.table-wrap {
    border-radius: var(--r-md);
    border: 1px solid rgba(15, 39, 68, 0.06);
}

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #F8FAFC;
}

.data-table th {
    padding: 8px 12px;
    font-size: 9.5px;
    letter-spacing: 0.55px;
    color: #64748B;
    border-bottom: 1px solid #E2E8F0;
    background: #F8FAFC;
}

.data-table td {
    padding: 10px 12px;
    font-size: 12.5px;
}

.data-table tbody tr:hover {
    background: var(--secondary-light);
}

.badge-blue {
    background: var(--secondary-light);
    color: var(--secondary-darker);
    white-space:nowrap;
}

.status-pill.processed {
    background: var(--secondary-light);
    color: var(--secondary-darker);
}

/* ── Forms ───────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 12px;
}

.form-label {
    font-size: 10px;
    margin-bottom: 5px;
    color: #64748B;
}

.form-input,
.form-select {
    padding: 9px 12px;
    font-size: 14px;
    border-radius: var(--r-md);
    border-color: #E2E8F0;
}

.toggle-btn.active {
    color: var(--secondary-darker);
}

.quick-amounts button:hover {
    background: var(--secondary-light);
    border-color: var(--secondary);
    color: var(--secondary-darker);
}

.invest-summary {
    margin-top: 20px;
    padding: 16px 18px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(103, 85, 203, 0.08) 0%, rgba(154, 145, 227, 0.14) 100%);
    border: 1px solid rgba(103, 85, 203, 0.16);
}

.invest-summary .is-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(103, 85, 203, 0.12);
}

.invest-summary .is-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.invest-summary .is-row:first-child {
    padding-top: 0;
}

.invest-summary .is-row span {
    color: #64748b;
    font-weight: 500;
}

.invest-summary .is-row strong {
    color: #0f172a;
    font-weight: 700;
}

/* ── Alerts & toasts ────────────────────────────────────────── */
.alert-success {
    background: var(--secondary-light);
    color: var(--secondary-darker);
    border-left-color: var(--secondary);
}

.toast.success {
    border-left-color: var(--secondary);
}

.toast {
    border-radius: var(--r-md);
    font-size: 12.5px;
    padding: 10px 16px;
}

/* ── Modals ──────────────────────────────────────────────────── */
.modal {
    border-radius: var(--r-xl);
    border: 1px solid rgba(15, 39, 68, 0.08);
}

.modal-backdrop {
    background: rgba(15, 39, 68, 0.55);
}

/* ── Profile ─────────────────────────────────────────────────── */
.profile-avatar {
    background: linear-gradient(135deg, var(--primary-mid), var(--primary-accent));
    box-shadow: 0 6px 20px rgba(26, 73, 118, 0.3);
}

.profile-verified-badge {
    background: linear-gradient(135deg, var(--secondary-dark), var(--secondary));
    color: #d9fff3;
}

.profile-bank-card {
    background: #FFFFFF !important;
    border: 1px solid rgba(var(--ds-edit-primary-rgb), 0.22) !important;
    box-shadow: 0 10px 28px rgba(15, 39, 68, 0.1) !important;
}

.pqs-item {
    padding: 10px 8px;
    border-radius: var(--r-md);
}

/* ── Pagination ──────────────────────────────────────────────── */
.pag-btn.active {
    background: linear-gradient(135deg, var(--primary-mid), var(--primary-accent));
}

.pag-btn:hover {
    border-color: var(--secondary);
    color: var(--secondary-darker);
}

/* ── KYC steps ───────────────────────────────────────────────── */
.kyc-step.done {
    background: var(--secondary-light);
    border-color: rgba(var(--ds-edit-mint-rgb), 0.4);
}

.done .kyc-step-icon {
    background: var(--secondary);
    color: var(--primary);
}

/* ── Mobile bottom nav ───────────────────────────────────────── */
.mobile-bottom-nav {
    height: var(--bottom-nav-h);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(15, 39, 68, 0.1);
}

.mobile-bottom-nav::before {
    background: linear-gradient(90deg, var(--secondary), var(--primary-accent), var(--secondary));
}

.mobile-nav-item {
    font-size: 9px;
    padding: 6px 2px;
    gap: 3px;
}

.mobile-nav-item.active {
    color: var(--secondary-darker);
    background: var(--secondary-light);
}

.mobile-nav-item.active::before {
    background: linear-gradient(90deg, var(--secondary), var(--secondary-dark));
}

.mobile-nav-item.active svg {
    filter: drop-shadow(0 2px 4px var(--secondary-glow));
}

/* ── Create page (in site.css) ───────────────────────────────── */
.create-header,
.create-wrap .create-header {
    background: linear-gradient(140deg, var(--primary) 0%, var(--primary-mid) 55%, var(--primary-accent) 100%);
}

.create-card-stripe,
.create-progress-bar .create-step-item.done::before {
    background: linear-gradient(90deg, var(--secondary), var(--primary-accent));
}

.create-step-item.is-active,
.create-step-item.active {
    background: var(--secondary-light);
    border-color: rgba(var(--ds-edit-mint-rgb), 0.35);
}

.create-panel-icon,
.create-card-icon {
    background: linear-gradient(135deg, var(--primary-mid), var(--primary-accent));
}

.cf-section-label,
.f-divider-label {
    background: var(--secondary-light);
    border-color: rgba(var(--ds-edit-mint-rgb), 0.35);
    color: var(--secondary-darker);
}

.add-item-btn,
.array-add-btn {
    border-color: var(--secondary);
    background: var(--secondary-light);
    color: var(--secondary-darker);
}

.add-item-btn:hover,
.array-add-btn:hover {
    background: rgba(var(--ds-edit-mint-rgb), 0.25);
    border-color: var(--secondary-dark);
}

/* ── Responsive topbar (mobile) ──────────────────────────────── */
@media (max-width: 1024px) {
    /* Beat legacy site.css mobile topbar height/padding */
    .app-header-stack .topbar {
        position: relative !important;
        height: var(--app-header-h) !important;
        min-height: var(--app-header-h) !important;
        max-height: var(--app-header-h) !important;
        padding: 0 !important;
        margin-left: 0 !important;
    }

    .market-ticker-strip .market-ticker {
        display: inline-flex !important;
    }

    .topbar-main .icon-btn {
        background: rgba(255, 255, 255, 0.12);
        border-color: rgba(var(--ds-edit-mint-rgb), 0.25);
        color: #fff;
    }
}

/* Desktop — title left | PMS actions right (solid header) */
@media (min-width: 1025px) {
    .app-header-stack {
        position: sticky;
        top: 0;
        z-index: 200;
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 10px;
        padding: 0 20px 0 5px;
        min-height: var(--topbar-h);
        box-sizing: border-box;
        pointer-events: auto;
        width: 100%;
    }

    .app-header-stack .topbar,
    .app-header-stack .topbar-main {
        display: contents;
    }

    .app-header-stack .mobile-menu-btn,
    .app-header-stack .topbar-brand-mobile,
    .app-header-stack .market-ticker-strip {
        display: none !important;
    }

    .app-header-stack .icon-btn.collapse-icon,
    .app-header-stack .collapse-icon {
        display: inline-flex !important;
        order: 0;
        margin: 0 2px 0 0 !important;
        align-self: center;
        width: 40px !important;
        height: 40px !important;
        background: #f1f5f9 !important;
        border: 1px solid rgba(15, 39, 68, 0.08) !important;
        color: #475569 !important;
        border-radius: 10px !important;
        box-shadow: none !important;
    }

    .app-header-stack .icon-btn.collapse-icon:hover,
    .app-header-stack .collapse-icon:hover {
        background: #e8edf4 !important;
        border-color: rgba(103, 85, 203, 0.18) !important;
        color: #6755cb !important;
    }

    html[data-theme="arth"] .app-header-stack .icon-btn.collapse-icon,
    html[data-theme="arth"] .app-header-stack .collapse-icon {
        background: rgba(255, 255, 255, 0.08) !important;
        border-color: rgba(255, 255, 255, 0.12) !important;
        color: #d8d4f5 !important;
    }

    html[data-theme="arth"] .app-header-stack .icon-btn.collapse-icon:hover,
    html[data-theme="arth"] .app-header-stack .collapse-icon:hover {
        background: rgba(154, 145, 227, 0.16) !important;
        border-color: rgba(154, 145, 227, 0.28) !important;
        color: #f0eeff !important;
    }

    .app-header-stack .topbar-title {
        order: 1;
        flex: 0 1 auto;
        margin-right: auto;
        color: var(--ds-edit-heading) !important;
        font-size: 15px !important;
        font-weight: 600 !important;
        letter-spacing: -0.02em;
        white-space: nowrap;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: min(320px, 40vw);
    }

    .app-header-stack .topbar-right {
        order: 3;
        display: flex !important;
        align-items: center;
        gap: 6px !important;
        flex: 0 0 auto;
        margin-left: 0 !important;
    }

    .app-header-stack .icon-btn {
        background: transparent !important;
        border: none !important;
        color: var(--ds-edit-header-icon) !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .app-header-stack .icon-btn:hover {
        background: var(--ds-edit-header-icon-bg-hover) !important;
        color: var(--ds-edit-header-icon-hover) !important;
    }
}
@media (max-width: 768px) {
    .page-content {
        padding: 14px 12px calc(var(--bottom-nav-h) + 10px);
    }

    .kpi-grid {
        gap: 8px;
    }

    .kpi-card {
        padding: 12px;
    }

    .kpi-value {
        font-size: 16px;
    }

    .welcome-greeting {
        font-size: 16px;
    }

    .card {
        padding: 14px;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 13.5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Standalone pages: Login ─────────────────────────────────── */
body:has(.login-hero) {
    font-family: var(--ds-edit-font-sans);
}

@media (min-width: 901px) {
    .login-panel .login-box {
        border: 1px solid rgba(15, 39, 68, 0.06);
        border-radius: 16px;
        padding: 32px 28px;
        background: #fff;
        box-shadow: var(--sh-xs);
    }

    html[data-theme="arth"] .login-panel .login-box {
        background: transparent;
        border-color: transparent;
        box-shadow: none;
        padding: 0;
        border-radius: 0;
    }
}

/* ── Standalone pages: Client onboarding (dark theme only) ──── */
html[data-theme="arth"] .client-create-page .topbar,
html[data-theme="arth"] body:has(.page-body) .topbar {
    background: linear-gradient(135deg, var(--ds-edit-dark-ink) 0%, var(--ds-edit-dark-deep) 55%, var(--ds-edit-dark-mid) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

html[data-theme="arth"] .client-create-page .page-header,
html[data-theme="arth"] body:has(.page-body) .page-header {
    background: linear-gradient(140deg, var(--ds-edit-dark-ink) 0%, var(--ds-edit-dark-deep) 55%, var(--ds-edit-dark-mid) 100%);
}

html:not([data-theme="arth"]) .client-create-page .page-header {
    background: #FFFFFF !important;
}

html:not([data-theme="arth"]) .client-create-page .step-rail-progress-fill {
    background: linear-gradient(90deg, var(--ds-edit-shell-action), var(--ds-edit-mint)) !important;
}

html[data-theme="arth"] .client-create-page .step-rail-progress-fill,
html[data-theme="arth"] body:has(.page-body) .step-rail-progress-fill {
    background: linear-gradient(90deg, var(--secondary), var(--secondary-dark));
}

html[data-theme="arth"] .client-create-page .section-divider-label,
html[data-theme="arth"] .client-create-page .form-section-title {
    background: rgba(var(--ds-edit-mint-rgb), 0.12);
    border-color: rgba(var(--ds-edit-mint-rgb), 0.35);
    color: var(--ds-edit-mint);
}

.client-create-page .mobile-pill.is-active,
.client-create-page .mobile-progress-percent {
    color: var(--secondary-darker);
}

.client-create-page .mobile-progress-fill {
    background: linear-gradient(90deg, var(--secondary-dark), var(--secondary));
}

.client-create-page .mobile-progress-dot {
    background: var(--secondary);
    box-shadow: 0 0 0 4px var(--secondary-muted);
}

/* ── Standalone pages: Submitted ─────────────────────────────── */
.submitted-page .page-glow {
    background: radial-gradient(circle, rgba(var(--ds-edit-mint-rgb), 0.16) 0%, transparent 65%);
}

.submitted-page .ref-box {
    border-color: rgba(var(--ds-edit-mint-rgb), 0.25);
    background: #F8FAFC;
}

/* ── Kill legacy heavy topbar stripe ─────────────────────────── */
html:not([data-theme="arth"]) .topbar {
    border-bottom: 1px solid var(--ds-edit-border) !important;
}

.topbar-title {
    color: var(--primary) !important;
}

@media (min-width: 1025px) {
    html[data-theme="arth"] .app-header-stack .topbar-title {
        color: #FFFFFF !important;
    }

    .topbar-title {
        display: block !important;
    }

    .mobile-nav-home-ring {
        display: none;
    }
}

/* ══════════════════════════════════════════════════════════════
   NIFTY BRIGHT LIGHT THEME — default (html:not([data-theme="arth"]))
   Inspired by https://preview.themeon.net/nifty/forms/general/
   ══════════════════════════════════════════════════════════════ */
html:not([data-theme="arth"]) {
    --nifty-bg: var(--ds-gradient-page);
    --nifty-surface: var(--ds-edit-surface);
    --nifty-border: var(--ds-edit-border);
    --nifty-border-soft: var(--ds-edit-border-soft);
    --nifty-text: var(--ds-edit-text-strong);
    --nifty-heading: var(--ds-edit-heading);
    --nifty-muted: var(--ds-edit-muted);
    --nifty-primary: var(--ds-edit-shell-action);
    --nifty-primary-soft: rgba(var(--ds-edit-primary-rgb), 0.08);
    --nifty-radius: var(--ds-radius-md);
    --nifty-radius-lg: var(--ds-radius-sm);
    --nifty-shadow: 0 1px 2px rgba(17, 27, 61, 0.04);
    --nifty-shadow-md: 0 2px 8px rgba(17, 27, 61, 0.06);
    --nifty-header-bg: var(--ds-edit-header-bg);
    --nifty-header-border: var(--ds-edit-header-border);
    --nifty-header-shadow: 0 1px 2px rgba(17, 27, 61, 0.04);
    --nifty-header-accent: transparent;
    --nifty-sidebar-bg: var(--ds-edit-sidebar-bg);
    --nifty-client-topbar-bg: var(--ds-gradient-topbar);
    --x-field-border: var(--ds-edit-border);
    --x-field-bg: var(--ds-edit-surface);
    --x-field-muted: var(--ds-edit-muted);
    --x-field-radius: var(--ds-radius-md);
    --x-field-shadow: none;
    --x-menu-shadow: 0 4px 16px rgba(15, 39, 68, 0.08);
}

html:not([data-theme="arth"]) body {
    background: var(--nifty-bg) !important;
    color: var(--nifty-text);
}

html:not([data-theme="arth"]) .main-wrap .page-content,
html:not([data-theme="arth"]) body:has(.main-wrap) .page-content {
    background: var(--nifty-bg) !important;
    border-top: none !important;
}

/* Header stack — solid surface (no gradient) */
html:not([data-theme="arth"]) .main-wrap .app-header-stack,
html:not([data-theme="arth"]) body:has(.main-wrap) .app-header-stack {
    position: relative;
    background: var(--nifty-header-bg) !important;
    border-bottom: 1px solid var(--nifty-header-border) !important;
    box-shadow: var(--nifty-header-shadow) !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .app-header-stack::after {
    display: none !important;
}

html:not([data-theme="arth"]) .main-wrap .app-header-stack .topbar,
html:not([data-theme="arth"]) body:has(.main-wrap) .app-header-stack .topbar {
    background: transparent !important;
    border-bottom: none !important;
    box-shadow: none !important;
}

html:not([data-theme="arth"]) .main-wrap .app-header-stack .topbar-title,
html:not([data-theme="arth"]) body:has(.main-wrap) .app-header-stack .topbar-title {
    color: var(--nifty-heading) !important;
    font-weight: 600 !important;
}

html:not([data-theme="arth"]) .main-wrap .app-header-stack .icon-btn,
html:not([data-theme="arth"]) body:has(.main-wrap) .app-header-stack .icon-btn {
    background: transparent !important;
    border: none !important;
    color: var(--ds-edit-header-icon) !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

html:not([data-theme="arth"]) .main-wrap .app-header-stack .icon-btn:hover,
html:not([data-theme="arth"]) body:has(.main-wrap) .app-header-stack .icon-btn:hover {
    background: var(--ds-edit-header-icon-bg-hover) !important;
    border-color: transparent !important;
    color: var(--ds-edit-header-icon-hover) !important;
}

/* Sidebar — soft white-to-grey gradient */
html:not([data-theme="arth"]) body:has(.main-wrap) .sidebar {
    background: var(--nifty-sidebar-bg) !important;
    border-right: 1px solid var(--nifty-border) !important;
    box-shadow: none !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .sidebar::before,
html:not([data-theme="arth"]) body:has(.main-wrap) .sidebar::after {
    opacity: 0.35;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .sidebar-brand {
    background: var(--nifty-surface) !important;
    border-bottom: 1px solid var(--nifty-border-soft) !important;
    border-left: none !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .sidebar-brand .brand-mark,
html[data-theme="arth"] body:has(.main-wrap) .sidebar-brand .brand-mark {
    background: linear-gradient(135deg, #6755cb, #9a91e3) !important;
    border-color: rgba(255, 255, 255, 0.22) !important;
    color: #FFFFFF !important;
    box-shadow: 0 4px 14px rgba(103, 85, 203, 0.35) !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .brand-name {
    background: none !important;
    -webkit-background-clip: unset !important;
    background-clip: unset !important;
    color: var(--nifty-heading) !important;
    -webkit-text-fill-color: var(--nifty-heading) !important;
    font-weight: 800 !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .brand-name-accent {
    color: var(--ds-edit-mint-darker) !important;
    -webkit-text-fill-color: var(--ds-edit-mint-darker) !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .brand-tagline {
    color: var(--nifty-muted) !important;
    letter-spacing: 1.2px !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .nav-section-label {
    color: var(--nifty-muted) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    letter-spacing: 0.04em !important;
    text-transform: uppercase !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .nav-badge.verified {
    background: var(--ds-edit-nav-active-bg) !important;
    color: var(--ds-edit-nav-active-color) !important;
    box-shadow: var(--ds-edit-nav-active-shadow) !important;
}

html:not([data-theme="arth"]) body.sidebar-collapsed .nav-item {
    gap: 0 !important;
}

html:not([data-theme="arth"]) body.sidebar-collapsed .nav-item .nav-label {
    width: 0 !important;
    flex: 0 0 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

html:not([data-theme="arth"]) body.sidebar-collapsed .nav-item .nav-badge {
    opacity: 1 !important;
    max-width: none !important;
    margin-left: 0 !important;
    position: absolute !important;
    top: 5px !important;
    right: 5px !important;
    min-width: 14px !important;
    height: 14px !important;
    padding: 0 3px !important;
    font-size: 8px !important;
    line-height: 14px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .sidebar-footer {
    border-top: 1px solid var(--nifty-border-soft) !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .user-pill {
    background: var(--nifty-bg) !important;
    border: 1px solid var(--nifty-border) !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .user-pill:hover {
    background: var(--nifty-primary-soft) !important;
    border-color: rgba(var(--ds-edit-primary-rgb), 0.2) !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .user-name {
    color: var(--nifty-heading) !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .user-code {
    color: var(--ds-edit-mint-dark) !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .logout-btn {
    background: var(--nifty-surface) !important;
    border: 1px solid var(--nifty-border) !important;
    color: var(--nifty-heading) !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .logout-btn:hover {
    background: var(--nifty-heading) !important;
    border-color: var(--nifty-heading) !important;
    color: #FFFFFF !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .sidebar-toggle-btn {
    display: none !important;
}

/* Cards */
html:not([data-theme="arth"]) .main-wrap .card,
html:not([data-theme="arth"]) body:has(.main-wrap) .card {
    background: var(--nifty-surface) !important;
    border: 1px solid var(--nifty-border) !important;
    border-radius: var(--nifty-radius-lg) !important;
    box-shadow: var(--nifty-shadow) !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .card:hover {
    border-color: rgba(var(--ds-edit-primary-rgb), 0.22) !important;
    box-shadow: var(--nifty-shadow-md) !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .kpi-card {
    background: var(--nifty-surface) !important;
    border: 1px solid var(--nifty-border) !important;
    border-radius: var(--nifty-radius-lg) !important;
    box-shadow: var(--nifty-shadow) !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .kpi-card:hover {
    border-color: rgba(var(--ds-edit-primary-rgb), 0.22) !important;
    box-shadow: var(--nifty-shadow-md) !important;
    transform: none !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .card-header {
    padding-bottom: 10px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--nifty-border-soft) !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .card-title {
    color: var(--nifty-heading) !important;
    font-weight: 600 !important;
    padding-left: 0 !important;
}

html:not([data-theme="arth"]) body:has(.main-wrap) .card-title::before {
    display: none !important;
}

html:not([data-theme="arth"]) .btn-primary {
    border-radius: var(--ds-radius-xs) !important;
    box-shadow: none !important;
}

html:not([data-theme="arth"]) .btn-outline {
    border-radius: var(--ds-radius-xs) !important;
    background: var(--nifty-surface) !important;
}

html:not([data-theme="arth"]) .field-control,
html:not([data-theme="arth"]) .x-select-enhanced {
    background: var(--nifty-surface) !important;
    border-color: var(--nifty-border) !important;
    box-shadow: none !important;
}

html:not([data-theme="arth"]) .page-content .form-group > .form-input,
html:not([data-theme="arth"]) .page-content .form-group > textarea,
html:not([data-theme="arth"]) .page-content .form-group > select.form-select {
    background: var(--nifty-surface) !important;
    border-color: var(--nifty-border) !important;
    box-shadow: none !important;
}

/* Client onboarding — same bright shell */
html:not([data-theme="arth"]) body.client-create-page {
    --cc-bg: #F5F7FA;
    --cc-surface: #FFFFFF;
    --cc-border: #DFE5EF;
    --cc-border-soft: #EEF2F7;
    --cc-shadow: var(--nifty-shadow);
    --cc-shadow-lg: var(--nifty-shadow-md);
    --cc-radius: var(--ds-radius-md);
    background: var(--cc-bg) !important;
}

html:not([data-theme="arth"]) body.client-create-page::before {
    opacity: 0.5;
}

html:not([data-theme="arth"]) .client-create-page .topbar,
html:not([data-theme="arth"]) .submitted-page .topbar,
html:not([data-theme="arth"]) .onboarding-pending-page .topbar {
    position: relative;
    overflow: hidden;
    background: linear-gradient(108deg, #302b91 0%, #4a3cc0 52%, #7258dc 100%) !important;
    border-bottom: 1px solid rgba(53, 45, 144, 0.3) !important;
    box-shadow: 0 2px 18px rgba(48, 43, 145, 0.16) !important;
}

/* Mockup-style circular texture rings on purple topbars */
html:not([data-theme="arth"]) .client-create-page .topbar::before,
html:not([data-theme="arth"]) .submitted-page .topbar::before,
html:not([data-theme="arth"]) .onboarding-pending-page .topbar::before,
html:not([data-theme="arth"]) .client-create-page .topbar::after,
html:not([data-theme="arth"]) .submitted-page .topbar::after,
html:not([data-theme="arth"]) .onboarding-pending-page .topbar::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

html:not([data-theme="arth"]) .client-create-page .topbar::before,
html:not([data-theme="arth"]) .submitted-page .topbar::before,
html:not([data-theme="arth"]) .onboarding-pending-page .topbar::before {
    top: -144px;
    right: -80px;
    width: 256px;
    height: 256px;
}

html:not([data-theme="arth"]) .client-create-page .topbar::after,
html:not([data-theme="arth"]) .submitted-page .topbar::after,
html:not([data-theme="arth"]) .onboarding-pending-page .topbar::after {
    top: -112px;
    right: 56px;
    bottom: auto;
    width: 224px;
    height: 224px;
}

html:not([data-theme="arth"]) .client-create-page .topbar > *,
html:not([data-theme="arth"]) .submitted-page .topbar > *,
html:not([data-theme="arth"]) .onboarding-pending-page .topbar > * {
    position: relative;
    z-index: 1;
}

/* Same circular texture on dark (arth) purple/teal topbars */
html[data-theme="arth"] .client-create-page .topbar,
html[data-theme="arth"] .submitted-page .topbar,
html[data-theme="arth"] .onboarding-pending-page .topbar {
    position: relative;
    overflow: hidden;
}

html[data-theme="arth"] .client-create-page .topbar::before,
html[data-theme="arth"] .submitted-page .topbar::before,
html[data-theme="arth"] .onboarding-pending-page .topbar::before,
html[data-theme="arth"] .client-create-page .topbar::after,
html[data-theme="arth"] .submitted-page .topbar::after,
html[data-theme="arth"] .onboarding-pending-page .topbar::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

html[data-theme="arth"] .client-create-page .topbar::before,
html[data-theme="arth"] .submitted-page .topbar::before,
html[data-theme="arth"] .onboarding-pending-page .topbar::before {
    top: -144px;
    right: -80px;
    width: 256px;
    height: 256px;
}

html[data-theme="arth"] .client-create-page .topbar::after,
html[data-theme="arth"] .submitted-page .topbar::after,
html[data-theme="arth"] .onboarding-pending-page .topbar::after {
    top: -112px;
    right: 56px;
    bottom: auto;
    width: 224px;
    height: 224px;
}

html[data-theme="arth"] .client-create-page .topbar > *,
html[data-theme="arth"] .submitted-page .topbar > *,
html[data-theme="arth"] .onboarding-pending-page .topbar > * {
    position: relative;
    z-index: 1;
}

html:not([data-theme="arth"]) .client-create-page .logo-text {
    color: #FFFFFF !important;
    font-weight: 600;
    letter-spacing: 0.02em;
}

html:not([data-theme="arth"]) .client-create-page .logo-text-accent {
    color: inherit !important;
    -webkit-text-fill-color: currentColor !important;
}

html:not([data-theme="arth"]) .client-create-page .page-header {
    background: var(--nifty-surface) !important;
    border-bottom: 1px solid var(--nifty-border-soft) !important;
}

html:not([data-theme="arth"]) .client-create-page .panel,
html:not([data-theme="arth"]) .client-create-page .main-card,
html:not([data-theme="arth"]) .client-create-page .card,
html:not([data-theme="arth"]) .client-create-page .form-section-card,
html:not([data-theme="arth"]) .client-create-page .array-entry {
    background: var(--nifty-surface) !important;
    border: 1px solid var(--nifty-border) !important;
    border-radius: var(--nifty-radius-lg) !important;
    box-shadow: var(--nifty-shadow) !important;
}

html:not([data-theme="arth"]) .client-create-page .step-rail {
    background: var(--nifty-surface) !important;
    border: 1px solid var(--nifty-border) !important;
    box-shadow: var(--nifty-shadow) !important;
}

html:not([data-theme="arth"]) .client-create-page .step-rail-item.is-active .step-rail-dot {
    background: var(--nifty-primary) !important;
    border-color: var(--nifty-primary) !important;
}

html:not([data-theme="arth"]) .client-create-page .step-rail-item.is-active .step-rail-label {
    color: var(--nifty-primary) !important;
}

html:not([data-theme="arth"]) .client-create-page input,
html:not([data-theme="arth"]) .client-create-page select,
html:not([data-theme="arth"]) .client-create-page textarea {
    background: var(--nifty-surface) !important;
    border-color: var(--nifty-border) !important;
    border-radius: var(--nifty-radius) !important;
    box-shadow: none !important;
}

html:not([data-theme="arth"]) .client-create-page input:not([type="checkbox"]):not([type="radio"]):focus,
html:not([data-theme="arth"]) .client-create-page select:focus,
html:not([data-theme="arth"]) .client-create-page textarea:focus {
    border-color: var(--nifty-primary) !important;
    box-shadow: 0 0 0 3px rgba(var(--ds-edit-primary-rgb), 0.12) !important;
}

html:not([data-theme="arth"]) .client-create-page .btn-primary {
    border-radius: var(--nifty-radius) !important;
    box-shadow: none !important;
}

@media (max-width: 1024px) {
    html:not([data-theme="arth"]) .main-wrap .topbar-main {
        background: transparent !important;
        border-bottom: none !important;
        box-shadow: none !important;
    }

    html:not([data-theme="arth"]) .main-wrap .topbar-main::after {
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent) !important;
    }

    html:not([data-theme="arth"]) body:has(.main-wrap) .app-header-stack .market-ticker-strip {
        background: rgba(255, 255, 255, 0.28) !important;
        border-top: 1px solid rgba(149, 168, 186, 0.55) !important;
        border-bottom: none !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
    }

    html:not([data-theme="arth"]) .main-wrap .topbar-brand-mobile,
    html:not([data-theme="arth"]) .main-wrap .topbar-app-name,
    html:not([data-theme="arth"]) .main-wrap .topbar-page-name {
        color: var(--nifty-heading) !important;
    }

    html:not([data-theme="arth"]) .main-wrap .mobile-menu-btn,
    html:not([data-theme="arth"]) .main-wrap .topbar-main .icon-btn {
        background: rgba(255, 255, 255, 0.92) !important;
        border: 1px solid rgba(149, 168, 186, 0.65) !important;
        color: var(--nifty-heading) !important;
        box-shadow: 0 1px 3px rgba(15, 39, 68, 0.08) !important;
    }
}

@media (min-width: 1025px) {
    html:not([data-theme="arth"]) body:has(.main-wrap) .market-ticker-strip .ticker-item {
        background: rgba(255, 255, 255, 0.95) !important;
        border: 1px solid var(--ds-edit-border) !important;
        box-shadow: 0 1px 4px rgba(15, 39, 68, 0.1) !important;
        flex-shrink: 0 !important;
        min-width: max-content !important;
    }

    html:not([data-theme="arth"]) body:has(.main-wrap) .market-ticker-strip .ticker-name,
    html:not([data-theme="arth"]) body:has(.main-wrap) .market-ticker-strip .ticker-val,
    html:not([data-theme="arth"]) body:has(.main-wrap) .market-ticker-strip .ticker-chg {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        overflow: visible !important;
    }

    html:not([data-theme="arth"]) body:has(.main-wrap) .market-ticker-strip .ticker-name {
        color: var(--nifty-muted) !important;
    }

    html:not([data-theme="arth"]) body:has(.main-wrap) .market-ticker-strip .ticker-val {
        color: var(--nifty-heading) !important;
    }

    html:not([data-theme="arth"]) body:has(.main-wrap) .market-ticker-strip .ticker-item.positive .ticker-chg {
        color: #16A34A !important;
    }

    html:not([data-theme="arth"]) body:has(.main-wrap) .market-ticker-strip .ticker-item.negative .ticker-chg {
        color: #DC2626 !important;
    }
}

@media (max-width: 900px) {
    html:not([data-theme="arth"]) .client-create-page .topbar {
        box-shadow: var(--nifty-header-shadow) !important;
    }

    html:not([data-theme="arth"]) .client-create-page .main-card,
    html:not([data-theme="arth"]) .client-create-page .card,
    html:not([data-theme="arth"]) .client-create-page .form-section-card {
        border: 1px solid var(--nifty-border) !important;
        box-shadow: var(--nifty-shadow) !important;
    }
}

/* ══════════════════════════════════════════════════════════════
   PMS-style app header actions (search / profile / fullscreen)
   Tokens: theme.css → --ds-edit-header-*
   ══════════════════════════════════════════════════════════════ */
body:has(.main-wrap) .app-header-stack {
    background: var(--ds-edit-header-bg) !important;
    border-bottom: 1px solid var(--ds-edit-header-border) !important;
    box-shadow: 0 1px 2px rgba(17, 27, 61, 0.04) !important;
}

body:has(.main-wrap) .app-header-stack .market-ticker-strip {
    display: none !important;
}

body:has(.main-wrap) .app-header-stack .topbar-brand-mobile {
    display: none !important;
}

body:has(.main-wrap) .app-header-stack .topbar-title {
    color: var(--ds-edit-heading) !important;
}

body:has(.main-wrap) .app-header-stack .theme-switch {
    margin-left: 0 !important;
    flex-shrink: 0;
}

.header-search {
    position: relative;
    display: flex;
    align-items: center;
}

.header-search-panel {
    display: none;
    align-items: center;
    gap: 8px;
    min-width: 280px;
    height: 44px;
    padding: 0 8px 0 12px;
    border-radius: 8px;
    background: var(--ds-edit-header-search-bg);
    border: 1px solid var(--ds-edit-header-border);
}

.header-search.is-open .header-search-panel {
    display: flex;
}

.header-search.is-open .header-search-toggle {
    display: none;
}

.header-search-glyph {
    flex-shrink: 0;
    color: var(--ds-edit-header-icon);
}

.header-search-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--ds-edit-heading);
    font: inherit;
    font-size: 14px;
}

.header-search-input::placeholder {
    color: var(--ds-edit-muted);
}

.header-profile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    padding: 2px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    color: inherit;
    transition: background 0.15s ease;
}

.header-profile:hover {
    background: var(--ds-edit-header-icon-bg-hover);
}

.header-profile-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: var(--ds-edit-shell-action);
    flex-shrink: 0;
}

.header-profile-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--ds-edit-heading);
}

.header-profile-role {
    font-size: 11px;
    color: var(--ds-edit-muted);
    text-align: left;
}

/* Mobile / tablet header */
@media (max-width: 1024px) {
    body:has(.main-wrap) .app-header-stack {
        padding: 0 !important;
    }

    body:has(.main-wrap) .app-header-stack .topbar {
        background: var(--ds-edit-header-bg) !important;
        border-bottom: none !important;
        box-shadow: none !important;
    }

    body:has(.main-wrap) .app-header-stack .topbar-main {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        justify-content: space-between !important;
        padding: 0 12px 0 10px !important;
        min-height: var(--topbar-h);
        width: 100%;
        box-sizing: border-box;
        position: relative;
    }

    body:has(.main-wrap) .app-header-stack .collapse-icon {
        display: none !important;
    }

    body:has(.main-wrap) .app-header-stack .mobile-menu-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--ds-edit-header-icon);
        flex-shrink: 0;
        position: relative;
        z-index: 6;
        pointer-events: auto;
        cursor: pointer;
    }

    body:has(.main-wrap) .app-header-stack .topbar-title {
        flex: 1 1 auto;
        min-width: 0;
        margin: 0 !important;
        font-size: 15px !important;
        font-weight: 600 !important;
        color: var(--ds-edit-heading) !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body:has(.main-wrap) .app-header-stack .topbar-right {
        display: flex !important;
        align-items: center;
        gap: 2px !important;
        margin-left: 0 !important;
        flex: 0 0 auto;
        position: relative;
        z-index: 6;
        pointer-events: auto;
    }

    body:has(.main-wrap) .app-header-stack .icon-btn,
    body:has(.main-wrap) .app-header-stack .header-action-btn {
        width: 38px;
        height: 44px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        color: var(--ds-edit-header-icon) !important;
        background: transparent !important;
        border: none !important;
    }

    /* Allow profile dropdown to escape the fixed header */
    body:has(.main-wrap) .app-header-stack,
    body:has(.main-wrap) .app-header-stack .topbar,
    body:has(.main-wrap) .app-header-stack .topbar-main {
        overflow: visible !important;
    }

    body:has(.main-wrap) .header-profile-wrap {
        position: relative;
        z-index: 6;
        pointer-events: auto;
    }

    body:has(.main-wrap) .header-profile {
        padding: 2px;
        margin-left: 0;
        pointer-events: auto;
        cursor: pointer;
        position: relative;
        z-index: 6;
    }

    body:has(.main-wrap) .header-profile-avatar {
        width: 30px;
        height: 30px;
        font-size: 11px;
    }

    body:has(.main-wrap) .header-profile-dropdown {
        /* Position comes from JS (flush under avatar) — don't force top with !important */
        z-index: 5000 !important;
        max-height: calc(100dvh - 72px);
        overflow: auto;
    }

    /* Mobile left drawer (hamburger) */
    body:has(.main-wrap) .sidebar {
        display: flex !important;
        position: fixed !important;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(82vw, 280px) !important;
        max-width: 280px;
        height: 100dvh !important;
        transform: translateX(-105%) !important;
        transition: transform 0.25s ease !important;
        z-index: 1500 !important;
        margin: 0 !important;
    }

    body:has(.main-wrap) .sidebar.mobile-open {
        transform: translateX(0) !important;
    }

    body:has(.main-wrap) .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(17, 27, 61, 0.45);
        backdrop-filter: blur(2px);
        z-index: 1450 !important;
        pointer-events: auto;
    }

    body:has(.main-wrap) .sidebar-overlay.active {
        display: block !important;
    }

    /* Expand search as overlay across header on mobile */
    body:has(.main-wrap) .header-search.is-open {
        position: absolute;
        inset: 0;
        z-index: 5;
        padding: 0 10px;
        background: var(--ds-edit-header-bg);
        display: flex;
        align-items: center;
    }

    body:has(.main-wrap) .header-search.is-open .header-search-panel {
        width: 100%;
        min-width: 0;
        flex: 1;
    }

    /* Keep header actions tappable; hide settings label density on very small */
    @media (max-width: 420px) {
        body:has(.main-wrap) .app-header-stack [data-fullscreen-toggle] {
            display: none !important;
        }
    }
}

html[data-theme="arth"] body:has(.main-wrap) .app-header-stack .topbar-title,
html[data-theme="arth"] body:has(.main-wrap) .header-profile-name {
    color: rgba(255, 255, 255, 0.92) !important;
}

html[data-theme="arth"] body:has(.main-wrap) .header-profile-role {
    color: rgba(255, 255, 255, 0.5) !important;
}

/* Profile dropdown + settings panel (PMS) */
.header-profile-wrap { position: relative; margin-left: 2px; }
.header-profile {
  display: inline-flex; align-items: center; justify-content: center; margin-left: 0;
  padding: 2px; border: 0; border-radius: 999px; background: transparent;
  cursor: pointer; color: inherit;
  transition: background 0.15s ease;
}
.header-profile:hover,
.header-profile-wrap.is-open .header-profile { background: var(--ds-edit-header-icon-bg-hover); }
.header-action-btn, .header-theme-btn { position: relative; }
.header-dot {
  position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%;
  border: 1.5px solid var(--ds-edit-header-bg);
}
.header-dot--warning { background: #ff9f43; }
.header-theme-btn .theme-icon-sun { display: none; }
html[data-theme="arth"] .header-theme-btn .theme-icon-moon { display: none; }
html[data-theme="arth"] .header-theme-btn .theme-icon-sun { display: block; }
body:has(.main-wrap) .app-header-stack .theme-switch { display: none !important; }

.header-search-panel {
  min-width: 0 !important;
  width: 100% !important;
  height: 44px !important;
  gap: 10px !important;
  padding: 0 10px 0 14px !important;
  border-radius: 10px !important;
}
.header-search-input { font-size: 14px !important; }

.header-profile-dropdown {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 1200; width: 260px;
  border-radius: 12px; background: var(--ds-edit-surface);
  border: 1px solid var(--ds-edit-header-border);
  box-shadow: 0 10px 32px rgba(17, 27, 61, 0.14); overflow: hidden;
}
.header-profile-dropdown[hidden] { display: none !important; }
.header-profile-dropdown.is-open { display: block !important; }
.header-profile-dropdown-head {
  display: flex; align-items: center; gap: 10px; padding: 14px;
  border-bottom: 1px solid var(--ds-edit-header-border);
}
.header-profile-dropdown-list { padding: 8px; display: grid; gap: 2px; }
.header-profile-link {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 8px;
  color: var(--ds-edit-heading); text-decoration: none; font-size: 13px; font-weight: 600;
  width: 100%; border: 0; background: transparent; cursor: pointer; font: inherit; text-align: left;
}
.header-profile-link .theme-icon { width: 16px; text-align: center; font-size: 14px; }
.header-profile-link .theme-icon-sun { display: none; }
html[data-theme="arth"] .header-profile-link .theme-icon-moon { display: none; }
html[data-theme="arth"] .header-profile-link .theme-icon-sun { display: inline-block; }
.header-profile-link:hover { background: var(--ds-edit-header-icon-bg-hover); color: var(--ds-edit-shell-action); }
.header-profile-dropdown-foot {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: rgba(var(--ds-edit-primary-rgb), 0.06); color: var(--ds-edit-muted);
  font-size: 11px; font-weight: 600;
}

.settings-overlay {
  position: fixed; inset: 0; z-index: 1400; background: rgba(17, 27, 61, 0.35);
}
.settings-overlay[hidden] { display: none !important; }
.settings-panel {
  position: fixed; top: 0; right: 0; z-index: 1410; width: min(360px, 100vw); height: 100vh;
  background: var(--ds-edit-surface); border-left: 1px solid var(--ds-edit-header-border);
  box-shadow: -8px 0 32px rgba(17, 27, 61, 0.12); transform: translateX(100%);
  transition: transform 0.22s ease; display: flex; flex-direction: column;
}
.settings-panel[hidden] { display: none !important; }
.settings-panel.is-open { display: flex !important; transform: translateX(0); }
.settings-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 18px 14px; border-bottom: 1px solid var(--ds-edit-header-border);
}
.settings-panel-title { margin: 0; font-size: 18px; font-weight: 800; color: var(--ds-edit-heading); }
.settings-panel-close {
  width: 34px; height: 34px; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--ds-edit-header-search-bg); color: var(--ds-edit-header-icon);
  display: inline-flex; align-items: center; justify-content: center;
}
.settings-panel-body { padding: 8px 18px 24px; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 0; border-bottom: 1px solid var(--ds-edit-header-border);
}
.settings-row-label { color: var(--ds-edit-muted); font-size: 14px; font-weight: 600; }
.settings-row-value { color: var(--ds-edit-heading); font-size: 14px; }
.settings-toggle {
  width: 42px; height: 24px; border: 0; border-radius: 999px; background: #d8dde8;
  position: relative; cursor: pointer; flex-shrink: 0;
}
.settings-toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(17,27,61,.2);
  transition: transform .18s ease;
}
.settings-toggle[aria-pressed="true"] { background: var(--ds-edit-shell-action); }
.settings-toggle[aria-pressed="true"]::after { transform: translateX(18px); }
.settings-theme-btn {
  border: 0; border-radius: 8px; padding: 8px 14px; background: var(--ds-edit-shell-action);
  color: #fff; font-size: 13px; font-weight: 600; cursor: pointer;
}
.settings-theme-btn:hover { background: var(--ds-edit-shell-action-hover); }
.settings-panel-note { margin: 16px 0 0; color: var(--ds-edit-muted); font-size: 12px; line-height: 1.45; }

html[data-theme="arth"] .header-profile-dropdown,
html[data-theme="arth"] .settings-panel {
  background: var(--ds-edit-dark-deep); border-color: rgba(255,255,255,.08);
}
html[data-theme="arth"] .header-profile-dropdown-foot { background: rgba(var(--ds-edit-primary-rgb), .14); }
html[data-theme="arth"] .settings-panel-close { background: var(--ds-edit-dark-mid); color: rgba(255,255,255,.75); }
html[data-theme="arth"] .settings-row-label,
html[data-theme="arth"] .settings-panel-note,
html[data-theme="arth"] .header-profile-dropdown-foot { color: rgba(255,255,255,.55); }
html[data-theme="arth"] .settings-panel-title,
html[data-theme="arth"] .settings-row-value,
html[data-theme="arth"] .header-profile-link { color: rgba(255,255,255,.9); }

@media (max-width: 1024px) {
  .header-search-panel {
    width: 100% !important; min-width: 0 !important;
  }
  .settings-panel { width: min(320px, 100vw); }
}

/* Search grows toward Dashboard title; FA moon theme icon */
.header-theme-btn .theme-icon {
    font-size: 16px;
    line-height: 1;
}

@media (min-width: 1025px) {
    body:has(.main-wrap) .app-header-stack .topbar-title {
        flex: 0 0 auto !important;
        margin-right: 16px !important;
        max-width: none !important;
    }

    body:has(.main-wrap) .app-header-stack .topbar-right {
        flex: 1 1 auto !important;
        min-width: 0;
        justify-content: flex-end;
        gap: 4px !important;
    }

    body:has(.main-wrap) .app-header-stack .header-search {
        flex: 0 0 auto;
        min-width: 0;
        margin-right: 4px;
    }

    body:has(.main-wrap) .app-header-stack .header-search.is-open {
        flex: 1 1 auto;
        justify-content: stretch;
        margin-right: 10px;
    }

    body:has(.main-wrap) .app-header-stack .header-search.is-open .header-search-panel {
        display: flex !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        height: 46px !important;
        flex: 1 1 auto;
    }
}
