/* ============================================================
   AluSmart — Authenticated app (sidebar + topbar + dashboard)
   Desktop: full-width, fixed sidebar.
   Tablet:  collapsible sidebar.
   Mobile:  off-canvas sidebar + bottom nav (app-like).
   ============================================================ */

:root {
    --as-primary:        #1d4ed8;
    --as-primary-dark:   #1e3a8a;
    --as-primary-light:  #3b82f6;
    --as-accent:         #22d3ee;
    --as-success:        #10b981;
    --as-warn:           #f59e0b;
    --as-danger:         #dc2626;

    --as-hero-from:      #061a3d;
    --as-hero-via:       #0a2a5e;
    --as-hero-to:        #0d3680;

    --as-bg:             #f5f7fa;
    --as-surface:        #ffffff;
    --as-text:           #0f172a;
    --as-text-muted:     #64748b;
    --as-border:         #e2e8f0;

    --as-sidebar-w:      260px;
    --as-topbar-h:       64px;
    --as-bottom-nav-h:   72px;
}

* { box-sizing: border-box; }

/* Global SVG safety net — many of our inline icons have no width/height
   attribute and would otherwise expand to fill their flex parent (giant
   "+" / search icons). Default them to 1em so they scale with surrounding
   text. The existing per-component rules (.as-card-ico svg, .as-icon-btn
   svg, etc.) have higher specificity and continue to override this. */
svg { width: 1em; height: 1em; flex-shrink: 0; }

html, body {
    margin: 0; padding: 0;
    width: 100%;
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body.as-app {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--as-text);
    background: var(--as-bg);
    min-height: 100vh;
}

/* ── Logo mark (shared with auth) ──────────────── */
/* Logo mark — single source of truth: /public/images/logo.svg.
   Same SVG renders in sidebar, auth pages, form headers — guaranteed
   identical across the whole app. Soft blue glow via box-shadow. */
.as-logo-mark {
    position: relative;
    width: 42px; height: 42px;
    background: url('/images/logo.svg?v=5') center/contain no-repeat;
    border-radius: 11px;
    box-shadow: 0 4px 14px rgba(59, 130, 246, .40);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.as-logo-a { display: none; }
.as-brand-text { line-height: 1.15; }
.as-brand-name { font-size: 19px; font-weight: 800; letter-spacing: .2px; }
.as-brand-name .alu   { color: #ffffff; }
.as-brand-name .smart { color: #38bdf8; }
.as-brand-tag  { font-size: 11px; color: rgba(255,255,255,.72); margin-top: 2px; font-weight: 500; }

/* ── Sidebar ──────────────────────────────────── */
.as-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--as-sidebar-w);
    height: 100vh;
    background:
        radial-gradient(120% 60% at 100% 0%, rgba(59,130,246,.15) 0%, transparent 60%),
        linear-gradient(160deg, var(--as-hero-from), var(--as-hero-via) 60%, var(--as-hero-to));
    color: #fff;
    padding: 20px 16px 16px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 18px;
    transition: transform .25s ease;
    overflow: hidden;       /* brand + pro pinned; nav handles its own scroll */
    min-height: 0;
}
.as-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 6px;
    flex-shrink: 0;          /* keep brand fully visible at top */
    position: relative;
}
.as-sidebar-brand .as-brand-text { flex: 1; min-width: 0; transition: opacity .15s; }

/* Collapse / expand toggle (top-right of brand area) */
.as-sidebar-collapse {
    flex-shrink: 0;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.18);
    color: #fff;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s, transform .25s;
}
.as-sidebar-collapse:hover { background: rgba(255,255,255,.20); }
.as-sidebar-collapse svg { width: 14px; height: 14px; }

/* Inner nav scrolls when items + groups exceed available height. The
   thin custom scrollbar keeps the dark theme intact. */
.as-sidenav {
    display: flex; flex-direction: column;
    gap: 4px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    margin-right: -4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.18) transparent;
}
.as-sidenav::-webkit-scrollbar         { width: 6px; }
.as-sidenav::-webkit-scrollbar-track   { background: transparent; }
.as-sidenav::-webkit-scrollbar-thumb   { background: rgba(255,255,255,.18); border-radius: 3px; }
.as-sidenav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.30); }
.as-sidenav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 10px;
    color: rgba(255,255,255,.8);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background .15s, color .15s;
    min-height: 38px;
    flex-shrink: 0;
}
.as-sidenav-link .ico {
    width: 22px; height: 22px;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.as-sidenav-link .ico svg { width: 20px; height: 20px; }
.as-sidenav-link:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}
.as-sidenav-link.is-active {
    background: linear-gradient(135deg, rgba(59,130,246,.35), rgba(29,78,216,.45));
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.1);
}
.as-sidenav-link.is-disabled {
    opacity: .55;
    cursor: not-allowed;
}
.as-sidebar-footer { border-top: 1px solid rgba(255,255,255,.1); padding-top: 12px; }

.as-sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(6, 26, 61, .55);
    z-index: 25;
    opacity: 0; visibility: hidden;
    transition: opacity .25s;
}
body.as-sidebar-open .as-sidebar-backdrop { opacity: 1; visibility: visible; }

/* ── Sidebar collapsed mode ──────────────────────────
   Toggle persists across page loads via localStorage. Width shrinks to
   72px showing icons only; labels, group headers, badges and the upgrade
   card all hide; tooltips on hover come from each link's text. */
:root {
    --as-sidebar-w-collapsed: 72px;
}
.as-sidebar.is-collapsed                              { width: var(--as-sidebar-w-collapsed); }
.as-sidebar.is-collapsed .as-sidebar-brand            { padding: 0; justify-content: center; }
.as-sidebar.is-collapsed .as-brand-text               { display: none; }
.as-sidebar.is-collapsed .as-sidebar-collapse         { transform: rotate(180deg); }
.as-sidebar.is-collapsed .as-sidenav                  { padding-right: 0; margin-right: 0; }
.as-sidebar.is-collapsed .as-sidenav-link             {
    justify-content: center;
    padding: 9px 0;
    gap: 0;
    position: relative;
}
.as-sidebar.is-collapsed .as-sidenav-link > span:not(.ico):not(.as-sidenav-badge) { display: none; }
.as-sidebar.is-collapsed .as-sidenav-link .as-sidenav-badge {
    position: absolute;
    top: 4px; right: 4px;
    min-width: 16px; height: 16px;
    padding: 0 4px;
    font-size: 9px;
    line-height: 16px;
    border-radius: 999px;
    box-shadow: none;
}
.as-sidebar.is-collapsed .as-sidenav-group            { display: none; }
/* When the whole sidebar is collapsed (icon-only), reveal every section's
   items unconditionally — the per-group accordion is irrelevant in that
   mode and the user should still be able to click any icon. */
.as-sidebar.is-collapsed .as-sidenav-section .as-sidenav-section-body {
    max-height: none !important;
    opacity: 1 !important;
    margin: 0 !important;
    pointer-events: auto !important;
}
.as-sidebar.is-collapsed .as-sidebar-pro              { display: none; }

/* Hover tooltip — pulls the link's first text-span as the label */
.as-sidebar.is-collapsed .as-sidenav-link::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(-6px);
    background: #0f172a;
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s, transform .15s;
    z-index: 100;
    box-shadow: 0 6px 18px rgba(0,0,0,.25);
}
.as-sidebar.is-collapsed .as-sidenav-link:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* Shell shifts to match collapsed sidebar width */
body.as-sidebar-collapsed .as-shell { margin-left: var(--as-sidebar-w-collapsed); }

/* Smooth transitions */
.as-sidebar         { transition: width .25s ease, transform .25s ease; }
.as-shell           { transition: margin-left .25s ease; }

/* ── Shell / Topbar ──────────────────────────── */
.as-shell {
    margin-left: var(--as-sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.as-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: var(--as-topbar-h);
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--as-border);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 24px;
}
.as-topbar-title { flex: 1; min-width: 0; }
.as-topbar-title h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: var(--as-text);
    letter-spacing: -.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.as-topbar-actions {
    display: flex; align-items: center; gap: 12px;
    margin-left: auto;
}

.as-icon-btn {
    width: 40px; height: 40px;
    border: 1px solid var(--as-border);
    background: #fff;
    border-radius: 10px;
    color: var(--as-text);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.as-icon-btn:hover { background: #f1f5f9; }
.as-icon-btn svg { width: 20px; height: 20px; }
.as-sidebar-toggle { display: none; }

.as-user-wrap { position: relative; }
.as-user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 10px;
    border: 1px solid var(--as-border);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: background .15s, border-color .15s;
}
.as-user-chip:hover { background: #f8fafc; border-color: #cbd5e1; }
.as-user-chip[aria-expanded="true"] { background: #f1f5f9; border-color: #94a3b8; }
.as-user-chev { width: 14px; height: 14px; color: var(--as-text-muted); transition: transform .15s; }
.as-user-chip[aria-expanded="true"] .as-user-chev { transform: rotate(180deg); }
.as-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1e3a8a);
    color: #fff;
    font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.as-user-meta { line-height: 1.2; max-width: 160px; min-width: 0; text-align: left; }
.as-user-meta .n { font-size: 13px; font-weight: 700; color: var(--as-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-user-meta .e { font-size: 11px; color: var(--as-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.as-user-menu {
    position: absolute;
    top: calc(100% + 8px); right: 0;
    min-width: 240px;
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .12);
    padding: 6px;
    z-index: 60;
    animation: as-user-menu-in .12s ease-out;
}
@keyframes as-user-menu-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.as-user-menu-head {
    padding: 10px 12px 12px;
    border-bottom: 1px solid var(--as-border);
    margin-bottom: 6px;
}
.as-user-menu-head .n { font-size: 13.5px; font-weight: 700; color: var(--as-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-user-menu-head .e { font-size: 12px; color: var(--as-text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-user-menu-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13.5px; font-weight: 500;
    color: var(--as-text);
    text-decoration: none;
    background: none; border: none;
    cursor: pointer;
    text-align: left;
    transition: background .12s;
}
.as-user-menu-item svg { width: 16px; height: 16px; color: var(--as-text-muted); }
.as-user-menu-item:hover { background: #f1f5f9; }
.as-user-menu-item:hover svg { color: var(--as-primary); }
.as-user-menu-sep { height: 1px; background: var(--as-border); margin: 6px 4px; }
.as-user-menu-form { margin: 0; }
.as-user-menu-logout { color: var(--as-danger); }
.as-user-menu-logout svg { color: var(--as-danger); }
.as-user-menu-logout:hover { background: #fee2e2; }
.as-user-menu-logout:hover svg { color: var(--as-danger); }

/* ── Main content ────────────────────────────── */
.as-main {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.as-flash {
    padding: 12px 14px;
    border-radius: 11px;
    font-size: 14px;
    line-height: 1.4;
}
.as-flash-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.as-flash-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* ── Hero card ───────────────────────────────── */
.as-hero-card {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    background:
        radial-gradient(120% 80% at 100% 0%, rgba(59,130,246,.35) 0%, transparent 50%),
        radial-gradient(60% 60% at 0% 100%, rgba(34,211,238,.18) 0%, transparent 50%),
        linear-gradient(135deg, var(--as-hero-from) 0%, var(--as-hero-via) 50%, var(--as-hero-to) 100%);
    color: #fff;
    padding: 26px 28px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    box-shadow: 0 16px 40px -16px rgba(13, 42, 110, .35);
}
.as-hero-card::before {
    content: ""; position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
}
.as-hero-card-text { position: relative; z-index: 1; max-width: 720px; }
.as-eyebrow {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.18);
    font-size: 11.5px; font-weight: 700; letter-spacing: .8px;
    text-transform: uppercase;
    margin-bottom: 10px;
    color: rgba(255,255,255,.92);
}
.as-hero-card-text h2 {
    font-size: 22px; font-weight: 800;
    margin: 0 0 4px 0; letter-spacing: -.2px;
}
.as-hero-card-text p { font-size: 14px; color: rgba(255,255,255,.85); margin: 0; line-height: 1.55; max-width: 620px; }
.as-hero-card-pill {
    position: relative; z-index: 1;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.22);
    color: #fff;
    font-size: 12.5px; font-weight: 700;
    flex-shrink: 0;
}
.as-hero-card-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 4px rgba(74,222,128,.25); }

/* ── Stat grid ───────────────────────────────── */
.as-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}
.as-stat {
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 2px 8px rgba(15, 42, 110, .04);
}
.as-stat-label { font-size: 12px; font-weight: 600; color: var(--as-text-muted); text-transform: uppercase; letter-spacing: .8px; }
.as-stat-value { font-size: 24px; font-weight: 800; color: var(--as-text); margin-top: 6px; letter-spacing: -.3px; }
.as-stat-value .unit { font-size: 12px; color: var(--as-text-muted); font-weight: 600; margin-left: 4px; }
.as-stat-foot { font-size: 12px; color: var(--as-text-muted); margin-top: 6px; }
.as-stat-foot.up { color: var(--as-success); }
.as-stat-foot.down { color: var(--as-danger); }

/* ── Card grid (feature tiles) ───────────────── */
.as-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
.as-card {
    position: relative;
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 14px;
    padding: 18px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px rgba(15, 42, 110, .04);
    transition: transform .12s, box-shadow .15s, border-color .15s;
    display: flex; flex-direction: column; gap: 12px;
    min-height: 132px;
}
.as-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px -12px rgba(15, 42, 110, .18);
    border-color: #cbd5e1;
}
.as-card-ico {
    width: 44px; height: 44px;
    border-radius: 11px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.18);
}
.as-card-ico svg { width: 22px; height: 22px; }
.as-card-ico.ico-blue   { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.as-card-ico.ico-green  { background: linear-gradient(135deg, #22c55e, #15803d); }
.as-card-ico.ico-purple { background: linear-gradient(135deg, #a855f7, #7e22ce); }
.as-card-ico.ico-orange { background: linear-gradient(135deg, #fb923c, #ea580c); }
.as-card-ico.ico-indigo { background: linear-gradient(135deg, #818cf8, #4338ca); }
.as-card-ico.ico-slate  { background: linear-gradient(135deg, #94a3b8, #475569); }
.as-card-title { font-size: 15.5px; font-weight: 800; color: var(--as-text); }
.as-card-body p { font-size: 13.5px; color: var(--as-text-muted); margin: 4px 0 0 0; line-height: 1.5; }
.as-card-tag {
    position: absolute;
    top: 14px; right: 14px;
    font-size: 11px; font-weight: 700;
    letter-spacing: .5px;
    color: var(--as-primary);
    background: rgba(29,78,216,.08);
    padding: 4px 8px;
    border-radius: 999px;
    text-transform: uppercase;
}
.as-card-ghost { background: #f8fafc; }

/* ── Sources card ────────────────────────────── */
.as-sources-card {
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 14px;
    padding: 16px 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(15, 42, 110, .04);
}
.as-sources-card .as-sources-title { color: var(--as-text-muted); margin-bottom: 12px; }
.as-sources-card .as-sources-row .src {
    color: var(--as-text);
    background: #f1f5f9;
    border: 1px solid var(--as-border);
    box-shadow: none;
}

/* ── Bottom nav (mobile only) ────────────────── */
.as-bottom-nav {
    display: none;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 40;
    height: var(--as-bottom-nav-h);
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--as-border);
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    justify-content: space-around;
    align-items: center;
    gap: 4px;
}
.as-bn-link {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px;
    text-decoration: none;
    color: var(--as-text-muted);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.15;
    text-align: center;
    border-radius: 10px;
    padding: 6px 4px;
    min-width: 0;
}
.as-bn-link .ico {
    width: 24px; height: 24px;
    display: inline-flex; align-items: center; justify-content: center;
}
.as-bn-link .ico svg { width: 22px; height: 22px; }
.as-bn-link.is-active {
    color: var(--as-primary);
}
.as-bn-link.is-active .ico {
    color: var(--as-primary);
}

/* ── Tablet (≤ 1024px) — sidebar collapses to drawer ── */
@media (max-width: 1024px) {
    .as-sidebar {
        transform: translateX(-100%);
        box-shadow: 0 24px 60px rgba(6,26,61,.4);
        /* Use dvh so the drawer respects mobile browser chrome (address bar
           collapse / expand) — fixes the Upgrade-to-Pro card getting cut off
           by the URL bar on iOS Safari + Android Chrome. */
        height: 100vh;
        height: 100dvh;
        /* Reserve room for the fixed bottom-nav + iOS home indicator so the
           legal footer row sits above them, not behind. */
        padding-bottom: calc(var(--as-bottom-nav-h) + 12px + env(safe-area-inset-bottom));
    }
    body.as-sidebar-open .as-sidebar { transform: translateX(0); }
    .as-shell { margin-left: 0; }
    .as-sidebar-toggle { display: inline-flex; }
    /* Off-canvas mode: collapse toggle is meaningless on mobile,
       and shell ignores any "is-collapsed" body class. */
    .as-sidebar-collapse { display: none; }
    body.as-sidebar-collapsed .as-shell { margin-left: 0; }
    .as-sidebar.is-collapsed { width: var(--as-sidebar-w); }
    .as-sidebar.is-collapsed .as-brand-text { display: flex; flex-direction: column; }
    .as-sidebar.is-collapsed .as-sidenav-link { justify-content: flex-start; padding: 9px 12px; gap: 12px; }
    .as-sidebar.is-collapsed .as-sidenav-link > span { display: inline-flex; }
    .as-sidebar.is-collapsed .as-sidenav-group { display: block; }
    .as-sidebar.is-collapsed .as-sidebar-pro { display: none; }

    /* Mobile drawer: big Upgrade card eats space, swap for a slim gold pill */
    .as-sidebar .as-sidebar-pro { display: none; }
    .as-sidebar .as-sidebar-pro-mini { display: flex; }
}

/* ── Tablet/Mobile grid ──────────────────────── */
@media (max-width: 1024px) {
    .as-stat-grid { grid-template-columns: repeat(2, 1fr); }
    .as-card-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Mobile (≤ 720px) ────────────────────────── */
@media (max-width: 720px) {
    .as-topbar { padding: 0 14px; }
    .as-user-meta { display: none; }
    .as-user-chip { padding: 4px; border-radius: 999px; }
    .as-main { padding: 16px 14px calc(var(--as-bottom-nav-h) + 16px); gap: 14px; }
    .as-hero-card { padding: 22px 20px; flex-direction: column; align-items: flex-start; border-radius: 16px; }
    .as-hero-card-text h2 { font-size: 19px; }
    .as-hero-card-text p { font-size: 13.5px; }
    .as-stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .as-stat-value { font-size: 20px; }
    .as-card-grid { grid-template-columns: 1fr; gap: 10px; }
    .as-card { padding: 16px; min-height: 0; }

    .as-bottom-nav { display: flex; }
}

/* ── Very small (≤ 380px) ──────────────────── */
@media (max-width: 380px) {
    .as-bn-link { font-size: 10px; }
}

/* ============================================================
   Phase 2 — Marketplace, products, enquiries, dashboard refresh
   ============================================================ */

/* ── Sidebar additions ─────────────────────── */
/* Group header is now a clickable button that toggles its section's
   collapsed state. Uppercase label + chevron that rotates when collapsed. */
.as-sidenav-section { display: flex; flex-direction: column; }
.as-sidenav-group {
    display: flex; align-items: center; justify-content: space-between;
    width: calc(100% - 28px);
    margin: 16px 14px 6px;
    padding: 4px 0 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: rgba(255,255,255,.55);
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,.06);
    transition: color .12s;
    text-align: left;
}
.as-sidenav-group:hover { color: rgba(255,255,255,.85); }
.as-sidenav-group .chev {
    width: 14px; height: 14px;
    flex-shrink: 0;
    transition: transform .2s;
}

.as-sidenav-section-body {
    display: flex; flex-direction: column;
    gap: 4px;
    overflow: hidden;
    max-height: 1200px;       /* large enough for any group */
    transition: max-height .25s ease, opacity .15s ease, margin .15s ease;
}
.as-sidenav-section.is-collapsed .as-sidenav-section-body {
    max-height: 0;
    opacity: 0;
    margin: 0;
    pointer-events: none;
}
.as-sidenav-section.is-collapsed .as-sidenav-group .chev {
    transform: rotate(-90deg);
}
.as-sidenav-badge {
    margin-left: auto;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: .8px;
    background: #ef4444;
    color: #fff;
    padding: 2px 7px;
    border-radius: 999px;
    box-shadow: 0 0 0 3px rgba(239,68,68,.18);
}
.as-sidebar-pro {
    margin-top: 4px;
    flex-shrink: 0;          /* keep Upgrade card pinned at the bottom */
    background:
        radial-gradient(80% 80% at 50% 0%, rgba(250,204,21,.18) 0%, transparent 70%),
        rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 14px;
    padding: 12px 14px 12px;
    color: #fff;
}
.as-sidebar-pro .title { font-size: 14px; font-weight: 800; }
.as-sidebar-pro .sub   { font-size: 12px; color: rgba(255,255,255,.7); margin: 2px 0 10px; line-height: 1.4; }
.as-pro-btn {
    width: 100%;
    min-height: 38px;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: linear-gradient(135deg, #facc15, #f59e0b);
    color: #422006;
    font-weight: 800;
    font-size: 13px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(245,158,11,.35);
}
.as-pro-btn svg { width: 16px; height: 16px; }
.as-pro-btn:disabled { cursor: not-allowed; opacity: .9; }

.as-sidebar-legal {
    margin-top: 10px;
    padding: 8px 4px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 11px;
    color: rgba(255,255,255,.55);
    flex-shrink: 0;
}
.as-sidebar-legal a {
    color: rgba(255,255,255,.7);
    text-decoration: none;
    transition: color .15s;
}
.as-sidebar-legal a:hover { color: #fff; text-decoration: underline; }
.as-sidebar-legal .dot { color: rgba(255,255,255,.35); }
.as-sidebar.is-collapsed .as-sidebar-legal { display: none; }

/* Compact "Upgrade to Pro" pill — replaces the bulky Pro card on mobile.
   Slim full-width gold strip so it's discoverable but doesn't dominate. */
.as-sidebar-pro-mini {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
    padding: 9px 14px;
    background: linear-gradient(135deg, #facc15, #f59e0b);
    color: #422006;
    font-weight: 800;
    font-size: 13px;
    border-radius: 10px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(245,158,11,.4);
    flex-shrink: 0;
    transition: transform .15s, box-shadow .15s;
}
.as-sidebar-pro-mini svg { width: 16px; height: 16px; }
.as-sidebar-pro-mini:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(245,158,11,.55);
}
.as-sidebar.is-collapsed .as-sidebar-pro-mini { display: none; }

/* ── Topbar search + badged buttons ────────── */
.as-search {
    flex: 1;
    max-width: 540px;
    position: relative;
    margin: 0 8px;
}
.as-search .ico {
    position: absolute;
    left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--as-text-muted);
}
.as-search .ico svg { width: 18px; height: 18px; }
.as-search input {
    width: 100%;
    height: 40px;
    padding: 0 16px 0 42px;
    border: 1px solid var(--as-border);
    border-radius: 10px;
    background: #f8fafc;
    font-size: 14px;
    font-family: inherit;
    color: var(--as-text);
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.as-search input:focus {
    outline: none;
    background: #fff;
    border-color: var(--as-primary);
    box-shadow: 0 0 0 4px rgba(29,78,216,.1);
}
.as-icon-btn-badge { position: relative; }
.as-icon-btn-badge .dot {
    position: absolute;
    top: 6px; right: 7px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid #fff;
}

/* ── Bottom nav FAB ────────────────────────── */
.as-bn-fab {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(29,78,216,.4);
    margin-top: -28px;
    transition: transform .12s;
    flex-shrink: 0;
}
.as-bn-fab:active { transform: scale(.94); }
.as-bn-fab svg { width: 26px; height: 26px; }

/* ── Hero card — embedded LIVE MARKET OVERVIEW ─── */
.as-hero-market { align-items: stretch; }
.as-hero-card-text .wave { display: inline-block; transform: rotate(8deg); }
.as-hero-card-text h2 { font-size: 26px; }

.as-hero-market-list {
    position: relative; z-index: 1;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 14px;
    padding: 14px 16px;
    min-width: 320px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.as-hero-market-title {
    font-size: 11px; font-weight: 800; letter-spacing: 1.4px;
    color: rgba(255,255,255,.78);
    margin-bottom: 10px;
}
.as-hero-market-list .row {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.as-hero-market-list .row:last-of-type { border-bottom: none; }
.as-hero-market-list .ic {
    width: 30px; height: 30px;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff;
    flex-shrink: 0;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.as-hero-market-list .ic svg { width: 16px; height: 16px; }
.as-hero-market-list .ic-blue   { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.as-hero-market-list .ic-green  { background: linear-gradient(135deg, #22c55e, #15803d); }
.as-hero-market-list .ic-orange { background: linear-gradient(135deg, #fb923c, #ea580c); }
.as-hero-market-list .info { flex: 1; min-width: 0; }
.as-hero-market-list .info .t { font-size: 12.5px; color: rgba(255,255,255,.78); }
.as-hero-market-list .info .s { font-size: 14px; font-weight: 700; color: #fff; }
.as-hero-market-list .chg { font-size: 12.5px; font-weight: 700; }
.as-hero-market-list .chg.up   { color: #4ade80; }
.as-hero-market-list .chg.down { color: #fca5a5; }
.as-hero-market-cta {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255,255,255,.16);
    color: #fff;
    font-size: 13.5px;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,.18);
    transition: background .15s;
}
.as-hero-market-cta:hover { background: rgba(255,255,255,.24); }
.as-hero-market-cta svg { width: 16px; height: 16px; }

/* ── Stat tiles — colour variants with icon ───── */
.as-stat-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.as-stat-head .ic {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.as-stat-head .ic svg { width: 18px; height: 18px; }
.as-stat-blue   .as-stat-head .ic { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.as-stat-green  .as-stat-head .ic { background: linear-gradient(135deg, #22c55e, #15803d); }
.as-stat-orange .as-stat-head .ic { background: linear-gradient(135deg, #fb923c, #ea580c); }
.as-stat-purple .as-stat-head .ic { background: linear-gradient(135deg, #a855f7, #7e22ce); }
.as-stat-foot a { color: var(--as-primary); text-decoration: none; font-weight: 600; }
.as-stat-foot a:hover { text-decoration: underline; }

/* ── Quick actions ─────────────────────────── */
.as-quick-actions {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}
.as-qa {
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 14px;
    padding: 16px;
    display: flex; flex-direction: column; gap: 10px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px rgba(15, 42, 110, .04);
    transition: transform .12s, box-shadow .15s, border-color .15s;
    min-height: 132px;
}
.as-qa:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -10px rgba(15,42,110,.18); border-color: #cbd5e1; }
.as-qa .as-qa-ico {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,.10), inset 0 1px 0 rgba(255,255,255,.18);
}
.as-qa .as-qa-ico svg { width: 22px; height: 22px; }
.as-qa .as-qa-ico.ico-blue   { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.as-qa .as-qa-ico.ico-green  { background: linear-gradient(135deg, #22c55e, #15803d); }
.as-qa .as-qa-ico.ico-purple { background: linear-gradient(135deg, #a855f7, #7e22ce); }
.as-qa .as-qa-ico.ico-orange { background: linear-gradient(135deg, #fb923c, #ea580c); }
.as-qa .as-qa-ico.ico-indigo { background: linear-gradient(135deg, #818cf8, #4338ca); }
.as-qa .t { font-weight: 800; font-size: 14.5px; color: var(--as-text); }
.as-qa .s { font-size: 12.5px; color: var(--as-text-muted); line-height: 1.45; }
.as-qa.is-disabled { opacity: .65; cursor: not-allowed; }
.as-qa.is-disabled:hover { transform: none; box-shadow: 0 2px 8px rgba(15, 42, 110, .04); border-color: var(--as-border); }

/* ── Sections, panels ─────────────────────── */
.as-section { display: flex; flex-direction: column; gap: 12px; }
.as-section-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 2px;
}
.as-section-head h3 { margin: 0; font-size: 16px; font-weight: 800; color: var(--as-text); letter-spacing: -.2px; }
.as-link { color: var(--as-primary); text-decoration: none; font-weight: 600; font-size: 13.5px; }
.as-link:hover { text-decoration: underline; }
.as-link.strong { font-weight: 700; }

.as-panel {
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 2px 8px rgba(15, 42, 110, .04);
}
.as-panel-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.as-panel-head h3 { margin: 0; font-size: 15px; font-weight: 800; color: var(--as-text); }

.as-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.as-empty {
    background: #fff;
    border: 1px dashed var(--as-border);
    border-radius: 14px;
    padding: 28px 20px;
    text-align: center;
}
.as-empty .t { font-size: 15px; font-weight: 700; color: var(--as-text); }
.as-empty .s { font-size: 13.5px; color: var(--as-text-muted); margin-top: 4px; }

/* ── Product grid + cards ─────────────────── */
.as-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}
.as-product-card {
    display: flex; flex-direction: column;
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px rgba(15, 42, 110, .04);
    transition: transform .12s, box-shadow .15s, border-color .15s;
}
.as-product-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px -14px rgba(15,42,110,.22); border-color: #cbd5e1; }
.as-product-img {
    aspect-ratio: 16 / 11;
    background: #f1f5f9;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.as-product-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.as-product-img-fallback {
    color: #94a3b8;
}
.as-product-img-fallback svg { width: 48px; height: 48px; }
.as-product-img-fallback.large svg { width: 96px; height: 96px; }

.as-product-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.as-product-title { font-size: 14.5px; font-weight: 800; color: var(--as-text); }
.as-product-grade { font-size: 12px; color: var(--as-text-muted); margin-top: -4px; }
.as-product-price {
    font-size: 18px; font-weight: 800; color: var(--as-success);
    margin-top: 4px; letter-spacing: -.3px;
}
.as-product-price .unit { font-size: 12px; font-weight: 600; color: var(--as-text-muted); margin-left: 2px; }
.as-product-meta { font-size: 12.5px; color: var(--as-text-muted); }
.as-product-loc {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12.5px; color: var(--as-text-muted);
}
.as-product-loc svg { width: 14px; height: 14px; color: var(--as-primary); }
.as-product-supplier {
    display: flex; align-items: center; gap: 8px;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--as-border);
    font-size: 12.5px;
    color: var(--as-text);
}
.as-product-supplier .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.as-supplier-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--as-success);
    box-shadow: 0 0 0 3px rgba(16,185,129,.18);
}
.vbadge {
    font-size: 10.5px; font-weight: 700;
    color: var(--as-success);
    background: rgba(16,185,129,.1);
    border-radius: 999px;
    padding: 2px 8px;
}

/* ── Product detail ────────────────────────── */
.as-product-detail {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 1.1fr;
    gap: 24px;
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(15, 42, 110, .04);
}
.as-product-detail-media {
    aspect-ratio: 4 / 3;
    background: #f1f5f9;
    border-radius: 14px;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.as-product-detail-media img { width: 100%; height: 100%; object-fit: cover; }
.as-product-detail-body { display: flex; flex-direction: column; gap: 14px; }
.as-tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.as-chip {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(29,78,216,.08);
    color: var(--as-primary);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .3px;
}
.as-chip.danger { background: rgba(220,38,38,.08); color: var(--as-danger); }
.as-chip.muted  { background: #f1f5f9; color: var(--as-text-muted); }
.as-detail-title { font-size: 24px; font-weight: 800; color: var(--as-text); margin: 0; letter-spacing: -.3px; }
.as-detail-price {
    font-size: 32px; font-weight: 800;
    color: var(--as-success);
    letter-spacing: -.5px;
}
.as-detail-price .unit { font-size: 14px; font-weight: 600; color: var(--as-text-muted); }
.as-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    background: #f8fafc;
    border-radius: 12px;
    padding: 14px;
}
.as-detail-grid .lbl { font-size: 11.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--as-text-muted); }
.as-detail-grid .val { font-size: 14.5px; font-weight: 700; color: var(--as-text); margin-top: 2px; }
.as-detail-section { border-top: 1px solid var(--as-border); padding-top: 12px; }
.as-detail-section .hd { font-size: 12.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--as-text-muted); margin-bottom: 6px; }
.as-detail-section p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--as-text); white-space: pre-wrap; }
.as-detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }

/* ── Page head ─────────────────────────────── */
.as-page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.as-page-title { margin: 0; font-size: 22px; font-weight: 800; color: var(--as-text); letter-spacing: -.3px; }
.as-page-sub   { margin: 4px 0 0; font-size: 13.5px; color: var(--as-text-muted); }

/* ── Filters ───────────────────────────────── */
.as-filters {
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(15, 42, 110, .04);
}
.as-filter-form { display: flex; gap: 10px; flex-wrap: wrap; }
.as-filter-search { flex: 1; min-width: 220px; }
.as-filter-search .as-form-control { padding-left: 44px; min-height: 44px; }
.as-filter-select { min-height: 44px; min-width: 140px; padding: 10px 14px; border: 1.5px solid var(--as-border); border-radius: 10px; font-size: 14px; background: #f8fafc; }
.as-filter-form .as-btn-primary { min-height: 44px; padding: 10px 22px; }

/* ── Pagination ──────────────────────────────────────────
   Desktop: row of numbered page links + Prev/Next.
   Mobile (≤720px): a single full-width "Show next N" CTA.
   The same partial renders both; CSS toggles visibility. */
.as-pagination {
    display: flex; flex-direction: column; align-items: center;
    gap: 8px; margin: 14px 0;
}
.as-pg-desktop {
    display: flex; align-items: center; justify-content: center;
    gap: 6px; flex-wrap: wrap;
}
.as-pg-mobile  { display: none; width: 100%; }
.as-pg-info-line {
    font-size: 12.5px;
    color: var(--as-text-muted);
}
.as-pg-info-line strong { color: var(--as-text); font-weight: 700; }

.as-pg-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 7px 14px;
    border: 1px solid var(--as-border);
    background: #fff;
    color: var(--as-text);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: background .15s, border-color .15s;
}
.as-pg-btn:hover { background: #f1f5f9; border-color: #cbd5e1; }
.as-pg-num {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 34px; height: 34px;
    padding: 0 8px;
    border: 1px solid var(--as-border);
    background: #fff;
    color: var(--as-text);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: background .15s, border-color .15s, color .15s;
}
.as-pg-num:hover:not(.is-active) { background: #f1f5f9; border-color: #cbd5e1; }
.as-pg-num.is-active {
    background: var(--as-primary, #1d4ed8);
    border-color: var(--as-primary, #1d4ed8);
    color: #fff;
    cursor: default;
}
.as-pg-gap {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 24px; height: 34px;
    color: var(--as-text-muted);
    font-weight: 700;
}

/* Legacy `.as-pg-info` (still used inline by a couple of older views) */
.as-pg-info { font-size: 13px; color: var(--as-text-muted); }

/* Mobile: hide the desktop number row, show a wide "Show next N" CTA. */
@media (max-width: 720px) {
    .as-pg-desktop  { display: none; }
    .as-pg-mobile   { display: flex; justify-content: center; padding: 0 12px; }
    .as-pg-loadmore {
        display: inline-flex; align-items: center; justify-content: center;
        gap: 8px;
        width: 100%; max-width: 360px;
        padding: 12px 18px;
        font-size: 14px;
        font-weight: 700;
        border-radius: 12px;
        background: var(--as-primary, #1d4ed8);
        color: #fff;
        text-decoration: none;
        box-shadow: 0 4px 14px rgba(29,78,216,.18);
        transition: filter .15s, transform .12s;
    }
    .as-pg-loadmore:hover  { filter: brightness(1.05); }
    .as-pg-loadmore:active { transform: scale(.98); }
    .as-pg-end {
        font-size: 12.5px;
        color: var(--as-text-muted);
        padding: 10px 0;
    }
}

/* ── Tabs ──────────────────────────────────── */
.as-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--as-border);
    overflow-x: auto;
}
.as-tab {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--as-text-muted);
    font-weight: 600;
    font-size: 14px;
    border-bottom: 2px solid transparent;
    transition: color .15s, border-color .15s;
    white-space: nowrap;
}
.as-tab:hover { color: var(--as-text); }
.as-tab.is-active { color: var(--as-primary); border-bottom-color: var(--as-primary); }
.as-tab-badge {
    background: #f1f5f9;
    color: var(--as-text-muted);
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
}
.as-tab.is-active .as-tab-badge { background: rgba(29,78,216,.1); color: var(--as-primary); }

/* ── Tables ────────────────────────────────── */
.as-table-wrap { padding: 0; overflow-x: auto; }
.as-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.as-table thead th {
    text-align: left;
    padding: 12px 14px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: var(--as-text-muted);
    background: #f8fafc;
    border-bottom: 1px solid var(--as-border);
    white-space: nowrap;
}
.as-table thead th.num     { text-align: right; }
.as-table thead th.actions { text-align: right; }
.as-table tbody td {
    padding: 14px;
    border-bottom: 1px solid var(--as-border);
    vertical-align: middle;
}
.as-table tbody tr:last-child td { border-bottom: none; }
.as-table tbody tr:hover { background: #f8fafc; }
.as-table .num { text-align: right; }
.as-table .num.strong { font-weight: 700; color: var(--as-success); }
.as-table .actions { text-align: right; white-space: nowrap; }
.as-table .actions .as-icon-btn { display: inline-flex; }
.as-table .muted { color: var(--as-text-muted); }
.as-table .msg { color: var(--as-text-muted); max-width: 280px; }
.as-table .s { font-size: 11.5px; color: var(--as-text-muted); margin-top: 2px; }

.as-table-product {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none; color: inherit;
}
.as-table-product .thumb {
    width: 40px; height: 40px;
    border-radius: 8px;
    background: #f1f5f9;
    overflow: hidden;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    color: #94a3b8;
}
.as-table-product .thumb img { width: 100%; height: 100%; object-fit: cover; }
.as-table-product .thumb svg { width: 22px; height: 22px; }
.as-table-product .t { display: block; font-weight: 700; color: var(--as-text); }

.as-status-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.as-status-active   { background: rgba(16,185,129,.12); color: #047857; }
.as-status-inactive { background: #f1f5f9; color: var(--as-text-muted); }
.as-status-sold     { background: rgba(220,38,38,.1); color: var(--as-danger); }

.as-icon-btn.sm { width: 34px; height: 34px; }
.as-icon-btn.sm svg { width: 16px; height: 16px; }
.as-icon-btn.danger { color: var(--as-danger); border-color: rgba(220,38,38,.25); }
.as-icon-btn.danger:hover { background: rgba(220,38,38,.08); }

/* ── List rows (top price comparison) ─────── */
.as-list { display: flex; flex-direction: column; }
.as-list-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--as-border);
    font-size: 14px;
}
.as-list-row:last-child { border-bottom: none; }
.as-list-head { color: var(--as-text-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.as-list-row .num.strong { color: var(--as-success); font-weight: 700; }
.as-supplier { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--as-text); }

/* ── Recent enquiries list ────────────────── */
.as-enq-list { display: flex; flex-direction: column; gap: 4px; }
.as-enq-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 6px;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: background .15s;
}
.as-enq-row:hover { background: #f8fafc; }
.as-enq-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
    font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.as-enq-meta { flex: 1; min-width: 0; }
.as-enq-meta .t { font-size: 14px; font-weight: 700; color: var(--as-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-enq-meta .s { font-size: 12px; color: var(--as-text-muted); }
.as-enq-status {
    font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
    padding: 3px 8px; border-radius: 999px;
    flex-shrink: 0;
}
.as-enq-new           { background: rgba(29,78,216,.1);  color: var(--as-primary); }
.as-enq-replied       { background: rgba(16,185,129,.12); color: #047857; }
.as-enq-in_discussion { background: rgba(245,158,11,.12); color: #92400e; }
.as-enq-closed        { background: #f1f5f9; color: var(--as-text-muted); }

/* ── Market alerts list ───────────────────── */
.as-alerts { display: flex; flex-direction: column; gap: 6px; }
.as-alert-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 6px;
}
.as-alert-row .ic {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.as-alert-row .ic.up   { background: rgba(16,185,129,.12); color: #047857; }
.as-alert-row .ic.down { background: rgba(220,38,38,.1);   color: var(--as-danger); }
.as-alert-row .ic.news { background: rgba(29,78,216,.1);   color: var(--as-primary); }
.as-alert-row .ic svg  { width: 16px; height: 16px; }
.as-alert-row .info { flex: 1; min-width: 0; }
.as-alert-row .info .t { font-size: 14px; font-weight: 700; color: var(--as-text); }
.as-alert-row .info .s { font-size: 12.5px; color: var(--as-text-muted); margin-top: 2px; line-height: 1.45; }
.as-alert-row .time { font-size: 11.5px; color: var(--as-text-muted); white-space: nowrap; }

/* ── Forms (extensions) ───────────────────── */
.as-form-grid { display: flex; flex-direction: column; gap: 14px; }
.as-form-section { padding: 18px 20px; }
.as-form-section-title { margin: 0 0 14px; font-size: 13px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: var(--as-text-muted); }
.as-form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.as-form-group .req { color: var(--as-danger); font-weight: 700; }
.as-form-file { padding: 8px; background: #f8fafc; }
.as-form-control {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    border: 1.5px solid var(--as-border);
    border-radius: 10px;
    background: #f8fafc;
    color: var(--as-text);
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.as-form-control:focus {
    outline: none;
    border-color: var(--as-primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(29, 78, 216, .12);
}
.as-form-control::placeholder { color: #94a3b8; }
.as-form-control.is-invalid {
    border-color: var(--as-danger);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, .1);
}
.as-form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--as-text);
}
textarea.as-form-control { min-height: 96px; resize: vertical; line-height: 1.5; }
.as-current-image { display: flex; align-items: center; gap: 12px; margin-top: 10px; font-size: 13px; color: var(--as-text-muted); }
.as-current-image img { width: 80px; height: 60px; object-fit: cover; border-radius: 6px; border: 1px solid var(--as-border); }
.as-form-footer { display: flex; gap: 10px; margin-top: 16px; }

/* ── Buttons (variants) ───────────────────── */
.as-btn-ghost {
    min-height: 44px;
    padding: 10px 18px;
    background: #fff;
    color: var(--as-text);
    font-weight: 700;
    font-size: 14px;
    border: 1.5px solid var(--as-border);
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
    text-decoration: none;
    transition: background .15s, border-color .15s;
}
.as-btn-ghost:hover { background: #f8fafc; border-color: #cbd5e1; }
.as-btn-ghost svg { width: 16px; height: 16px; }
.as-btn-danger { color: var(--as-danger); border-color: rgba(220,38,38,.25); }
.as-btn-danger:hover { background: rgba(220,38,38,.06); border-color: rgba(220,38,38,.4); }

/* Primary CTA — solid blue gradient, drop shadow, inline by default. The
   .as-btn-block modifier makes it stretch to fill its parent width (used
   by "Compare All Sources" and "View All" links at the bottom of panels). */
.as-btn-primary {
    min-height: 44px;
    padding: 10px 22px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 60%, #1e40af 100%);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
    text-decoration: none;
    letter-spacing: .2px;
    box-shadow: 0 6px 16px rgba(29, 78, 216, .25);
    transition: transform .08s, box-shadow .15s, filter .15s;
}
.as-btn-primary svg { width: 16px; height: 16px; }
.as-btn-primary:hover { box-shadow: 0 10px 24px rgba(29, 78, 216, .35); filter: brightness(1.04); }
.as-btn-primary:active { transform: translateY(1px); }
.as-btn-primary:disabled { opacity: .7; cursor: not-allowed; }

/* Full-width variant — anchor or button stretches to its container */
.as-btn-block { display: flex; width: 100%; }

/* Inline variant — used in panel headers / page heads (smaller padding) */
.as-btn-inline { min-height: 38px; padding: 8px 16px; font-size: 13.5px; border-radius: 9px; }
.as-btn-inline.xs { min-height: 32px; padding: 6px 12px; font-size: 12.5px; }

/* ── Modals ───────────────────────────────── */
.as-modal {
    position: fixed; inset: 0;
    background: rgba(6, 26, 61, .5);
    z-index: 60;
    display: none;
    align-items: center; justify-content: center;
    padding: 20px;
}
.as-modal.is-open { display: flex; }

/* ── Custom confirm dialog (replaces window.confirm) ── */
.as-confirm {
    position: fixed; inset: 0;
    z-index: 80;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.as-confirm[hidden] { display: none; }
.as-confirm-backdrop {
    position: absolute; inset: 0;
    background: rgba(6, 26, 61, .55);
    backdrop-filter: blur(2px);
    animation: as-confirm-fade .12s ease-out;
}
.as-confirm-dialog {
    position: relative;
    width: 100%; max-width: 420px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(6, 26, 61, .35);
    padding: 26px 24px 20px;
    text-align: center;
    animation: as-confirm-pop .14s ease-out;
}
@keyframes as-confirm-fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes as-confirm-pop  { from { opacity: 0; transform: translateY(8px) scale(.97) } to { opacity: 1; transform: none } }
.as-confirm-icon {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1d4ed8;
    margin: 0 auto 14px;
    display: inline-flex; align-items: center; justify-content: center;
}
.as-confirm-icon svg { width: 28px; height: 28px; }
.as-confirm.is-danger .as-confirm-icon {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: var(--as-danger);
}
.as-confirm-title {
    margin: 0 0 6px;
    font-size: 18px; font-weight: 800;
    color: var(--as-text);
}
.as-confirm-message {
    margin: 0 0 20px;
    font-size: 14px; line-height: 1.5;
    color: var(--as-text-muted);
}
.as-confirm-actions {
    display: flex; gap: 10px;
    justify-content: center;
}
.as-confirm-actions .as-btn-ghost,
.as-confirm-actions .as-btn-primary { flex: 1; min-height: 42px; padding: 10px 16px; }
.as-confirm.is-danger .as-confirm-ok {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 60%, #b91c1c 100%);
    box-shadow: 0 6px 16px rgba(220, 38, 38, .28);
}
.as-confirm.is-danger .as-confirm-ok:hover { box-shadow: 0 10px 24px rgba(220, 38, 38, .38); }
body.as-confirm-open { overflow: hidden; }
@media (max-width: 480px) {
    .as-confirm-dialog { padding: 22px 18px 16px; }
    .as-confirm-actions { flex-direction: column-reverse; }
}

/* ── Toast notifications (success / error / warning / info) ── */
.as-toast-stack {
    position: fixed;
    top: 16px; right: 16px;
    z-index: 90;
    display: flex; flex-direction: column;
    gap: 10px;
    max-width: calc(100vw - 32px);
    width: 360px;
    pointer-events: none;        /* let clicks pass through gaps */
}
.as-toast {
    pointer-events: auto;
    display: flex; align-items: flex-start;
    gap: 12px;
    padding: 12px 14px 12px 12px;
    background: #fff;
    border: 1px solid var(--as-border);
    border-left: 4px solid var(--as-primary);
    border-radius: 12px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, .14);
    color: var(--as-text);
    font-size: 13.5px;
    line-height: 1.45;
    cursor: pointer;
    transform: translateX(120%);
    opacity: 0;
    transition: transform .22s cubic-bezier(.2,.8,.25,1), opacity .18s;
}
.as-toast.is-in { transform: none; opacity: 1; }
.as-toast.is-leaving { transform: translateX(120%); opacity: 0; }
.as-toast-icon {
    flex-shrink: 0;
    width: 32px; height: 32px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff;
}
.as-toast-icon svg { width: 18px; height: 18px; }
.as-toast-body { flex: 1; min-width: 0; }
.as-toast-title { font-weight: 800; font-size: 13.5px; margin-bottom: 1px; }
.as-toast-msg   { color: var(--as-text); word-wrap: break-word; }
.as-toast-close {
    flex-shrink: 0;
    width: 26px; height: 26px;
    background: none; border: none;
    color: var(--as-text-muted);
    cursor: pointer;
    border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .12s;
}
.as-toast-close:hover { background: #f1f5f9; color: var(--as-text); }
.as-toast-close svg   { width: 14px; height: 14px; }

.as-toast-success                  { border-left-color: #10b981; }
.as-toast-success .as-toast-icon   { background: linear-gradient(135deg, #10b981, #059669); }
.as-toast-error                    { border-left-color: #dc2626; }
.as-toast-error .as-toast-icon     { background: linear-gradient(135deg, #ef4444, #dc2626); }
.as-toast-warning                  { border-left-color: #f59e0b; }
.as-toast-warning .as-toast-icon   { background: linear-gradient(135deg, #fbbf24, #d97706); }
.as-toast-info                     { border-left-color: #1d4ed8; }
.as-toast-info .as-toast-icon      { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }

@media (max-width: 640px) {
    .as-toast-stack {
        top: 8px; right: 8px; left: 8px;
        width: auto;
        max-width: none;
    }
    .as-toast {
        transform: translateY(-120%);
        font-size: 13px;
    }
    .as-toast.is-leaving { transform: translateY(-120%); }
}

/* Hide the legacy server-flash divs immediately — toast.js converts them to
   toasts on DOMContentLoaded, but we don't want a flash of the old style. */
.as-flash { display: none !important; }
.as-modal-card {
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    background: #fff;
    border-radius: 16px;
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(0,0,0,.25);
    padding: 22px;
}
.as-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.as-modal-head h3 { margin: 0; font-size: 17px; font-weight: 800; color: var(--as-text); }
.as-modal-close {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--as-text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.as-modal-close:hover { background: #f1f5f9; color: var(--as-text); }

.as-enq-context {
    background: #f8fafc;
    border: 1px solid var(--as-border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 14px;
    font-size: 13px;
    line-height: 1.5;
}
.as-enq-context strong { color: var(--as-text); }
.as-reply-body {
    font-size: 14px; line-height: 1.6; color: var(--as-text);
    background: #f8fafc;
    border-radius: 10px;
    padding: 14px;
    white-space: pre-wrap;
}

/* ── Responsive overrides for new bits ────── */
@media (max-width: 1024px) {
    .as-quick-actions     { grid-template-columns: repeat(3, 1fr); }
    .as-grid-2            { grid-template-columns: 1fr; }
    .as-product-detail    { grid-template-columns: 1fr; }
    .as-search            { max-width: none; }
}
@media (max-width: 720px) {
    .as-quick-actions     { grid-template-columns: repeat(2, 1fr); }
    .as-form-row          { grid-template-columns: 1fr; }
    .as-page-head         { flex-direction: column; align-items: flex-start; }
    .as-page-head .as-btn-primary { width: 100%; justify-content: center; }
    .as-product-grid      { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .as-hero-card.as-hero-market { flex-direction: column; align-items: stretch; }
    .as-hero-market-list { min-width: 0; }
    .as-search            { display: none; }
    .as-table             { font-size: 13px; }
    .as-table thead th    { padding: 10px 8px; font-size: 10px; }
    .as-table tbody td    { padding: 10px 8px; }
    .as-table .msg        { display: none; }
    .as-detail-grid       { grid-template-columns: 1fr; }
    .as-detail-price      { font-size: 26px; }
    .as-bottom-nav        { gap: 0; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
}
@media (max-width: 480px) {
    .as-product-grid      { grid-template-columns: 1fr; }
}

/* ============================================================
   Phase 3 — Live prices, AI insight, compare table, best option
   ============================================================ */

/* ── Sidebar — LIVE pill variant ───────────── */
.as-sidenav-badge.live {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .18);
    animation: as-live-pulse 2.4s ease-in-out infinite;
}
@keyframes as-live-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(239, 68, 68, .18); }
    50%      { box-shadow: 0 0 0 6px rgba(239, 68, 68, .05); }
}

/* ── Market Overview header ───────────────── */
.as-mo-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 4px 2px;
}
.as-mo-head-text h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: var(--as-text);
    letter-spacing: -.3px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.as-mo-head-text p {
    margin: 4px 0 0;
    font-size: 13.5px;
    color: var(--as-text-muted);
}
.as-live-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(16, 185, 129, .12);
    color: var(--as-success);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .4px;
    padding: 4px 10px;
    border-radius: 999px;
    text-transform: none;
}
.as-live-badge .dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--as-success);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, .18);
    animation: as-live-pulse-green 2s ease-in-out infinite;
}
@keyframes as-live-pulse-green {
    0%, 100% { box-shadow: 0 0 0 3px rgba(16, 185, 129, .18); }
    50%      { box-shadow: 0 0 0 6px rgba(16, 185, 129, .04); }
}
/* Status variants — Live (green, default), Mixed (amber), Demo (slate) */
.as-live-badge.is-mixed { background: rgba(245, 158, 11, .14); color: #b45309; }
.as-live-badge.is-mixed .dot {
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, .18);
    animation: as-live-pulse-amber 2s ease-in-out infinite;
}
@keyframes as-live-pulse-amber {
    0%, 100% { box-shadow: 0 0 0 3px rgba(245, 158, 11, .18); }
    50%      { box-shadow: 0 0 0 6px rgba(245, 158, 11, .04); }
}
.as-live-badge.is-demo { background: #f1f5f9; color: var(--as-text-muted); }
.as-live-badge.is-demo .dot {
    background: #94a3b8;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, .15);
    animation: none;
}
.as-mo-head-meta { display: inline-flex; align-items: center; gap: 10px; }
.as-last-updated { font-size: 12.5px; color: var(--as-text-muted); }

/* ── Market price tile grid + tile ────────── */
.as-mp-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}
.as-mp-tile {
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(15, 42, 110, .04);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform .12s, box-shadow .15s;
}
.as-mp-tile:hover { transform: translateY(-2px); box-shadow: 0 12px 28px -14px rgba(15,42,110,.16); }
.as-mp-tile.is-link { text-decoration: none; color: inherit; cursor: pointer; }
.as-mp-tile-head {
    display: flex; align-items: center; gap: 10px;
}
.as-mp-ico {
    width: 32px; height: 32px;
    border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff;
    flex-shrink: 0;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.as-mp-ico svg { width: 16px; height: 16px; }
.as-mp-ico.ic-blue  { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.as-mp-ico.ic-red   { background: linear-gradient(135deg, #f87171, #b91c1c); }
.as-mp-tile-title { font-size: 13.5px; font-weight: 700; color: var(--as-text); }

.as-mp-tile-row {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 10px;
}
.as-mp-tile-price {
    font-size: 22px;
    font-weight: 800;
    color: var(--as-text);
    letter-spacing: -.4px;
}
.as-mp-tile-price .unit { font-size: 12px; font-weight: 600; color: var(--as-text-muted); margin-left: 2px; }
.as-mp-tile-chg {
    font-size: 12.5px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 999px;
}
.as-mp-tile-chg.up   { background: rgba(16,185,129,.14); color: #047857; }
.as-mp-tile-chg.down { background: rgba(220,38,38,.10);  color: var(--as-danger); }

.as-spark {
    width: 100%;
    height: 50px;
    position: relative;     /* anchor for hover tooltip when used with .as-hover-chart */
}
.as-spark.lg { height: 60px; }
.as-spark svg { width: 100%; height: 100%; display: block; }
.as-spark.as-hover-chart svg { cursor: crosshair; }

.as-mp-tile-foot {
    font-size: 11.5px;
    color: var(--as-text-muted);
}

/* ── Source colour dots ───────────────────── */
.as-source-cell {
    display: inline-flex; align-items: center; gap: 8px;
    font-weight: 600;
    color: var(--as-text);
}
.as-source-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    flex-shrink: 0;
}
.as-source-dot.dot-lme,
.as-source-dot.dot-lme_cash    { background: #1d4ed8; }
.as-source-dot.dot-mcx         { background: #f59e0b; }
.as-source-dot.dot-nalco       { background: #ef4444; }
.as-source-dot.dot-hindalco    { background: #f97316; }
.as-source-dot.dot-vedanta     { background: #10b981; }
.as-source-dot.dot-imported    { background: #8b5cf6; }
.as-source-dot.dot-usd_inr     { background: #06b6d4; }
.as-source-dot.dot-product     { background: var(--as-primary); box-shadow: 0 0 0 3px rgba(29,78,216,.15); }
/* Precious metals */
.as-source-dot.dot-gold        { background: #d4a017; }
.as-source-dot.dot-silver      { background: #94a3b8; }
.as-source-dot.dot-platinum    { background: #64748b; }
.as-source-dot.dot-palladium   { background: #475569; }
/* Base metals */
.as-source-dot.dot-copper      { background: #b45309; }
.as-source-dot.dot-zinc        { background: #6b7280; }
.as-source-dot.dot-nickel      { background: #84cc16; }
.as-source-dot.dot-lead        { background: #334155; }
.as-source-dot.dot-tin         { background: #a78bfa; }

/* ── Market-prices category groups ──────── */
.as-mp-group {
    display: flex; flex-direction: column;
    gap: 12px;
}
.as-mp-group + .as-mp-group { margin-top: 8px; }
.as-mp-group-head {
    display: flex; flex-direction: column;
    gap: 2px;
    padding: 4px 2px 2px;
    border-bottom: 1px solid var(--as-border);
    margin-bottom: 4px;
}
.as-mp-group-head h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--as-text);
    display: flex; align-items: baseline; gap: 8px;
}
.as-mp-group-head h3 .muted-soft {
    font-size: 12px;
    font-weight: 500;
    color: var(--as-text-muted);
}
.as-mp-group-head .sub {
    font-size: 12.5px;
    color: var(--as-text-muted);
}
.as-mp-detail.cat-precious  { border-top: 3px solid #d4a017; }
.as-mp-detail.cat-base      { border-top: 3px solid #b45309; }
.as-mp-detail.cat-aluminium { border-top: 3px solid #1d4ed8; }
.as-mp-detail.cat-fx        { border-top: 3px solid #06b6d4; }

/* ── Trend chart panel ────────────────────── */
.as-grid-trend {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 16px;
}
.as-chart-panel { padding: 20px; }
.as-chart-toggle {
    display: inline-flex;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}
.as-chart-toggle button {
    border: none;
    background: transparent;
    font-size: 12px;
    font-weight: 700;
    color: var(--as-text-muted);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.as-chart-toggle button.is-active {
    background: var(--as-primary);
    color: #fff;
    box-shadow: 0 4px 10px rgba(29,78,216,.25);
}
.muted-soft { font-size: 12.5px; font-weight: 600; color: var(--as-text-muted); }
.as-chart-meta-y { font-size: 11.5px; font-weight: 600; color: var(--as-text-muted); margin: 6px 0 4px; }
.as-chart {
    position: relative;
    width: 100%;
    height: 240px;
    padding: 4px 8px 24px 40px;
}
.as-chart svg { width: 100%; height: 100%; display: block; cursor: crosshair; }
.as-chart.is-loading { opacity: .55; transition: opacity .2s; }
/* Floating tooltip + cursor line + dot for hover */
.as-chart-tooltip {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    background: rgba(15, 23, 42, .94);
    color: #fff;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    line-height: 1.4;
    box-shadow: 0 4px 14px rgba(15,23,42,.25);
    white-space: nowrap;
    transition: left .05s linear, top .05s linear;
}
.as-chart-tooltip[hidden] { display: none; }
.as-chart-tooltip .t-date  { font-size: 11px; opacity: .8; }
.as-chart-tooltip .t-price { font-weight: 700; font-size: 13.5px; }
.as-chart-tooltip::after {
    content: ''; position: absolute;
    left: 50%; bottom: -4px;
    transform: translateX(-50%) rotate(45deg);
    width: 8px; height: 8px;
    background: rgba(15, 23, 42, .94);
}

.as-chart-y-labels {
    position: absolute;
    left: 0; top: 4px; bottom: 24px;
    width: 36px;
    display: flex; flex-direction: column; justify-content: space-between;
    font-size: 10.5px;
    color: var(--as-text-muted);
    text-align: right;
    padding-right: 4px;
}
.as-chart-x-labels {
    position: absolute;
    left: 40px; right: 8px; bottom: 4px;
    display: flex; justify-content: space-between;
    font-size: 10.5px;
    color: var(--as-text-muted);
}

/* ── AI Market Insight panel ──────────────── */
.as-ai-panel { padding: 20px; }
.as-ai-large { padding: 28px; }
.as-ai-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: linear-gradient(135deg, #ecfeff, #dbeafe);
    border: 1px solid #cffafe;
    color: #0369a1;
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: .4px;
    padding: 4px 10px;
    border-radius: 999px;
}
.as-ai-badge svg { width: 12px; height: 12px; }

.as-ai-body {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}
.as-ai-rec { flex: 1; min-width: 0; }
.as-ai-rec-label { font-size: 12px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--as-text-muted); }
.as-ai-rec-decision {
    font-size: 38px; font-weight: 800; letter-spacing: -.5px;
    line-height: 1.1;
    margin-top: 4px;
}
.as-ai-rec-decision.dec-buy   { color: var(--as-success); }
.as-ai-rec-decision.dec-wait  { color: var(--as-warn); }
.as-ai-rec-decision.dec-hold  { color: var(--as-primary); }
.as-ai-rec-text { font-size: 13.5px; color: var(--as-text-muted); margin: 8px 0 0; line-height: 1.5; }
.as-ai-large .as-ai-rec-decision { font-size: 56px; }

.as-ai-prices {
    display: flex; gap: 14px;
    margin-top: 14px;
    background: #f8fafc;
    border-radius: 10px;
    padding: 12px 14px;
    border: 1px solid var(--as-border);
}
.as-ai-prices .lbl { font-size: 11.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--as-text-muted); }
.as-ai-prices .val { font-size: 16px; font-weight: 800; color: var(--as-text); margin-top: 2px; }

/* ── Donut (CSS-only) ─────────────────────── */
.as-donut {
    --pct: 50;
    --color: #10b981;
    width: 130px; height: 130px;
    border-radius: 50%;
    background: conic-gradient(var(--color) calc(var(--pct) * 1%), #e2e8f0 0);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 6px 20px -6px rgba(15, 42, 110, .15);
}
.as-donut::before {
    content: '';
    position: absolute; inset: 10px;
    border-radius: 50%;
    background: #fff;
}
.as-donut-inner {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center;
    line-height: 1.1;
}
.as-donut-inner .num {
    font-size: 26px;
    font-weight: 800;
    color: var(--as-text);
}
.as-donut-inner .pct { font-size: 13px; font-weight: 700; color: var(--as-text-muted); margin-left: 2px; }
.as-donut-inner .lbl { font-size: 10.5px; font-weight: 700; color: var(--as-text-muted); text-transform: uppercase; letter-spacing: .4px; margin-top: 2px; }
.as-ai-large .as-donut { width: 180px; height: 180px; }
.as-ai-large .as-donut::before { inset: 14px; }
.as-ai-large .as-donut-inner .num { font-size: 36px; }

/* ── AI signals list ──────────────────────── */
.as-ai-signals { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.as-ai-signals li {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--as-border);
    font-size: 13.5px;
}
.as-ai-signals li:last-child { border-bottom: none; }
.as-ai-signals .k { color: var(--as-text-muted); font-weight: 600; }
.as-ai-signals .v {
    display: inline-flex; align-items: center; gap: 6px;
    font-weight: 700;
    color: var(--as-text);
}
.as-ai-signals .v svg { width: 14px; height: 14px; }
.as-ai-signals .v small { font-size: 11px; color: var(--as-text-muted); margin-left: 4px; font-weight: 600; }
.as-ai-signals .tone-positive { color: var(--as-success); }
.as-ai-signals .tone-negative { color: var(--as-danger); }
.as-ai-signals .tone-neutral  { color: var(--as-text); }

.as-ai-signals-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 24px;
    margin-top: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--as-border);
}
.as-ai-signals-grid li:nth-last-child(2) { border-bottom: none; }

/* ── Compare table (Phase 3) ──────────────── */
.as-compare-table .chg-up   { color: var(--as-success); font-weight: 700; }
.as-compare-table .chg-down { color: var(--as-danger);  font-weight: 700; }
.as-compare-table .is-product-row td {
    background: rgba(29, 78, 216, .04);
    font-weight: 600;
}
.as-grid-compare {
    display: grid;
    grid-template-columns: 1.45fr 1fr;
    gap: 16px;
}

/* ── Best Buying Option panel ─────────────── */
.as-best-panel { padding: 20px; }
.as-best-card {
    background: linear-gradient(180deg, rgba(16,185,129,.04), rgba(16,185,129,0));
    border: 1px solid rgba(16,185,129,.18);
    border-radius: 14px;
    padding: 18px;
    display: flex; flex-direction: column; gap: 12px;
}
.as-best-head {
    display: flex; align-items: center; gap: 10px;
}
.as-best-num {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.as-best-name { font-size: 16px; font-weight: 800; color: var(--as-text); flex: 1; min-width: 0; }
.as-best-tag {
    font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
    color: var(--as-success);
    background: rgba(16,185,129,.15);
    padding: 3px 10px;
    border-radius: 999px;
}
.as-best-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.as-best-grid .lbl { font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--as-text-muted); }
.as-best-grid .val {
    font-size: 16px; font-weight: 800; color: var(--as-text); margin-top: 2px;
}
.as-best-grid .val.price { color: var(--as-text); font-size: 18px; }
.as-best-grid .val.save  { color: var(--as-success); font-size: 18px; }
.as-best-grid .val .unit { font-size: 11.5px; font-weight: 600; color: var(--as-text-muted); }
.as-best-foot {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 12.5px;
    color: var(--as-success);
    font-weight: 700;
}
.as-best-foot svg { width: 16px; height: 16px; }

/* ── Price Alert CTA strip ─────────────────── */
.as-alert-cta {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}
.as-alert-cta-text h3 { margin: 0; font-size: 16px; font-weight: 800; }
.as-alert-cta-text p  { margin: 4px 0 0; font-size: 13.5px; color: var(--as-text-muted); }

/* ── Refresh button states ────────────────── */
#asRefreshPrices.is-busy svg { animation: as-spin 1s linear infinite; }
@keyframes as-spin { to { transform: rotate(360deg); } }

/* ── Market prices detail page ─────────────── */
.as-mp-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.as-mp-detail { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.as-mp-detail-head { display: flex; align-items: center; gap: 10px; }
.as-mp-detail-head > div:nth-child(2) { flex: 1; min-width: 0; }
.as-mp-detail-title { font-size: 14.5px; font-weight: 800; color: var(--as-text); }
.as-mp-detail-sub { font-size: 11.5px; color: var(--as-text-muted); margin-top: 2px; }
.as-mp-detail-price {
    font-size: 24px; font-weight: 800;
    color: var(--as-text); letter-spacing: -.3px;
}
.as-mp-detail-price .unit { font-size: 12px; font-weight: 600; color: var(--as-text-muted); margin-left: 2px; }
.as-mp-detail-norm { font-size: 12.5px; color: var(--as-success); font-weight: 600; }
.as-mp-detail-foot { font-size: 11.5px; color: var(--as-text-muted); }

/* ── Compare page extras ──────────────────── */
.as-rank-line { display: flex; align-items: flex-start; gap: 14px; }
.as-rank-line .rank {
    font-size: 38px; font-weight: 800;
    background: linear-gradient(135deg, #2563eb, #1e3a8a);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}
.as-rank-line .rank-text { flex: 1; font-size: 13.5px; color: var(--as-text); }
.as-rank-line .hint { font-size: 12.5px; margin-top: 6px; }
.as-rank-line .hint.up   { color: var(--as-success); }
.as-rank-line .hint.down { color: var(--as-text-muted); }
.as-rank-savings {
    margin-top: 12px;
    padding: 12px 14px;
    background: rgba(16,185,129,.06);
    border: 1px solid rgba(16,185,129,.18);
    border-radius: 10px;
    font-size: 13.5px;
    color: var(--as-text);
}

/* ── Responsive overrides ─────────────────── */
@media (max-width: 1100px) {
    .as-grid-trend     { grid-template-columns: 1fr; }
    .as-grid-compare   { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
    .as-mp-grid        { grid-template-columns: repeat(2, 1fr); }
    .as-ai-large .as-ai-rec-decision { font-size: 44px; }
}
@media (max-width: 720px) {
    .as-mp-grid        { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .as-mp-tile        { padding: 12px; }
    .as-mp-tile-price  { font-size: 18px; }
    .as-best-grid      { grid-template-columns: 1fr; }
    .as-ai-body        { flex-direction: column; align-items: stretch; }
    .as-donut          { align-self: center; }
    .as-ai-signals-grid { grid-template-columns: 1fr; }
    .as-ai-rec-decision { font-size: 28px; }
    .as-mo-head        { flex-direction: column; align-items: flex-start; }
    .as-chart          { height: 200px; padding-left: 32px; }
    .as-chart-y-labels { width: 28px; font-size: 9px; }
}

/* ============================================================
   Phase 4 — Alerts, Notifications, Reports
   ============================================================ */

/* ── Sidebar — red count badge variant ────────── */
.as-sidenav-badge.red {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .12);
    font-size: 10.5px;
}

/* ── Topbar — bell count + user chip chevron ───── */
.as-icon-count {
    position: absolute;
    top: -4px; right: -4px;
    min-width: 18px; height: 18px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 10.5px;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
    padding: 0 5px;
    border: 2px solid #fff;
}
.as-icon-btn-badge { position: relative; overflow: visible; }
.as-user-chev {
    width: 16px; height: 16px;
    margin-left: 6px;
    color: var(--as-text-muted);
}

/* ── Bottom nav — count badge ──────────────────── */
.as-bn-link { position: relative; }
.as-bn-badge {
    position: absolute;
    top: 2px; right: calc(50% - 22px);
    min-width: 16px; height: 16px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 9.5px;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
    padding: 0 4px;
    border: 2px solid #fff;
}

/* ── Alerts list table ─────────────────────────── */
.as-alerts-table .as-alert-name { font-weight: 700; color: var(--as-text); }
.as-alerts-table .as-alert-source { font-size: 11.5px; color: var(--as-text-muted); margin-top: 2px; }

.as-type-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: capitalize;
}
.as-type-pill.as-type-price  { background: rgba(29,78,216,.10);  color: var(--as-primary); }
.as-type-pill.as-type-target { background: rgba(245,158,11,.14); color: #b45309; }
.as-type-pill.as-type-trend  { background: rgba(34,197,94,.14);  color: #047857; }
.as-type-pill.as-type-spike  { background: rgba(168,85,247,.14); color: #7e22ce; }

.as-alert-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: capitalize;
    letter-spacing: .4px;
}
.as-alert-status.as-alert-active     { background: rgba(16,185,129,.12); color: #047857; }
.as-alert-status.as-alert-triggered  { background: rgba(16,185,129,.12); color: #047857; }
.as-alert-status.as-alert-paused     { background: rgba(245,158,11,.12); color: #b45309; }
.as-alert-status.as-alert-inactive   { background: #f1f5f9; color: var(--as-text-muted); }

/* ── Alert form — radio cards & checkbox row ───── */
.as-radio-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.as-radio-card {
    position: relative;
    cursor: pointer;
    display: block;
}
.as-radio-card input[type=radio] {
    position: absolute; inset: 0;
    opacity: 0;
    cursor: pointer;
}
.as-radio-card .card-inner {
    border: 1.5px solid var(--as-border);
    background: #fff;
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    transition: border-color .15s, box-shadow .15s, transform .12s;
    height: 100%;
}
.as-radio-card input:checked + .card-inner {
    border-color: var(--as-primary);
    box-shadow: 0 0 0 4px rgba(29, 78, 216, .12);
    background: linear-gradient(180deg, rgba(29,78,216,.04), #fff);
}
.as-radio-card .card-inner:hover { border-color: #cbd5e1; }
.as-radio-card .ic {
    width: 40px; height: 40px;
    border-radius: 11px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff;
    margin-bottom: 8px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.as-radio-card .ic svg { width: 20px; height: 20px; }
.as-radio-card .ic.ic-price  { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.as-radio-card .ic.ic-target { background: linear-gradient(135deg, #22c55e, #15803d); }
.as-radio-card .ic.ic-trend  { background: linear-gradient(135deg, #fb923c, #ea580c); }
.as-radio-card .ic.ic-spike  { background: linear-gradient(135deg, #f87171, #b91c1c); }
.as-radio-card .card-title { font-size: 13.5px; font-weight: 800; color: var(--as-text); }
.as-radio-card .card-desc  { font-size: 11.5px; color: var(--as-text-muted); margin-top: 4px; line-height: 1.4; }

.as-check-row {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid var(--as-border);
    border-radius: 10px;
}

/* ── Notifications list ─────────────────────────── */
.as-notif-list { padding: 4px; display: flex; flex-direction: column; }
.as-notif-row {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 14px;
    border-bottom: 1px solid var(--as-border);
    transition: background .12s;
}
.as-notif-row:last-child { border-bottom: none; }
.as-notif-row.is-unread  { background: rgba(29,78,216,.03); }
.as-notif-row:hover      { background: #f8fafc; }
/* When the row is wrapped in an <a> for click-through, kill default link styling. */
a.as-notif-row { color: inherit; text-decoration: none; }
a.as-notif-row.is-clickable { cursor: pointer; }
a.as-notif-row:hover .as-notif-body .t { color: var(--as-primary, #1d4ed8); }
.as-notif-ico {
    width: 38px; height: 38px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.as-notif-ico svg { width: 18px; height: 18px; }
.as-notif-ico.ic-price_alert  { background: rgba(16,185,129,.12); color: #047857; }
.as-notif-ico.ic-target_alert { background: rgba(245,158,11,.12); color: #b45309; }
.as-notif-ico.ic-trend_alert,
.as-notif-ico.ic-spike_alert  { background: rgba(34,211,238,.12); color: #0891b2; }
.as-notif-ico.ic-market_news  { background: rgba(29,78,216,.10);  color: var(--as-primary); }
.as-notif-ico.ic-report_ready { background: rgba(168,85,247,.12); color: #7e22ce; }
.as-notif-ico.ic-system       { background: #f1f5f9; color: var(--as-text-muted); }
.as-notif-body { flex: 1; min-width: 0; }
.as-notif-body .t { font-size: 14px; font-weight: 700; color: var(--as-text); }
.as-notif-body .s { font-size: 13px; color: var(--as-text-muted); margin-top: 2px; line-height: 1.5; }
.as-notif-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.as-notif-meta .time { font-size: 11.5px; color: var(--as-text-muted); white-space: nowrap; }
.as-notif-meta .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--as-primary);
    box-shadow: 0 0 0 3px rgba(29,78,216,.18);
}

/* ── Reports — page head, date pill, tile variants ─ */
.as-page-head-actions {
    display: inline-flex; align-items: center; gap: 10px;
    flex-wrap: wrap;
}
.as-date-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--as-text);
}
.as-date-pill.compact { padding: 4px 10px; font-size: 12px; font-weight: 600; color: var(--as-text-muted); }
.as-date-pill svg { width: 14px; height: 14px; color: var(--as-primary); }

.as-stat-grid-4 { grid-template-columns: repeat(4, 1fr); }

.as-report-tile {
    padding: 18px;
    display: flex; flex-direction: column; gap: 6px;
    min-height: 132px;
    position: relative;
    overflow: hidden;
}
.as-report-tile-head {
    display: flex; align-items: center; gap: 10px;
}
.as-report-ico {
    width: 32px; height: 32px;
    border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff;
    flex-shrink: 0;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.as-report-ico svg { width: 16px; height: 16px; }
.as-report-ico.ic-blue   { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.as-report-ico.ic-green  { background: linear-gradient(135deg, #22c55e, #15803d); }
.as-report-ico.ic-purple { background: linear-gradient(135deg, #a855f7, #7e22ce); }
.as-report-ico.ic-orange { background: linear-gradient(135deg, #fb923c, #ea580c); }
.as-report-tile .lbl {
    font-size: 12px; font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--as-text-muted);
}
.as-report-tile .val {
    font-size: 24px;
    font-weight: 800;
    color: var(--as-text);
    letter-spacing: -.4px;
}
.as-report-tile .val.val-sm { font-size: 16px; }
.as-report-tile .val.up     { color: var(--as-success); }
.as-report-tile .val.down   { color: var(--as-danger); }
.as-report-tile .val.val-up { color: var(--as-success); }
.as-report-tile .val .sub   { font-size: 12px; font-weight: 600; color: var(--as-text-muted); margin-left: 2px; }
.as-report-tile .foot {
    font-size: 12px;
    color: var(--as-text-muted);
}
.as-report-tile .foot.up   { color: var(--as-success); font-weight: 600; }
.as-report-tile .foot.down { color: var(--as-danger);  font-weight: 600; }
.as-report-tile .foot.price{ color: var(--as-text); font-weight: 700; font-size: 14px; }
.as-report-tile .foot .sub { font-size: 11.5px; color: var(--as-text-muted); font-weight: 500; }

/* ── Spend & Savings combined chart ──────────── */
.as-trend-chart {
    width: 100%; height: 280px;
    position: relative;
}
.as-trend-chart svg { width: 100%; height: 100%; display: block; }
.as-chart-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--as-text-muted);
    font-weight: 600;
}
.as-chart-legend .dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}
.as-chart-legend .dot-spend   { background: #1d4ed8; }
.as-chart-legend .dot-savings { background: #22c55e; }

/* ── Multi-segment donut + legend ─────────────── */
.as-donut-row {
    display: flex; align-items: center; gap: 24px;
    flex-wrap: wrap;
}
.as-donut-multi {
    width: 180px; height: 180px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 6px 20px -6px rgba(15, 42, 110, .15);
}
.as-donut-multi::before {
    content: '';
    position: absolute; inset: 22px;
    border-radius: 50%;
    background: #fff;
}
.as-donut-multi-inner {
    position: relative; z-index: 1;
    text-align: center;
    line-height: 1.1;
}
.as-donut-multi-inner .num {
    font-size: 26px;
    font-weight: 800;
    color: var(--as-text);
    display: block;
}
.as-donut-multi-inner .num .pct { font-size: 16px; color: var(--as-text-muted); margin-left: 1px; }
.as-donut-multi-inner .lbl {
    font-size: 11px;
    font-weight: 700;
    color: var(--as-text-muted);
    letter-spacing: .4px;
    text-transform: uppercase;
    margin-top: 2px;
    display: block;
}
.as-donut-legend {
    list-style: none;
    margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 10px;
    flex: 1; min-width: 200px;
}
.as-donut-legend li {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
}
.as-donut-legend .dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.as-donut-legend .name { color: var(--as-text); font-weight: 600; }
.as-donut-legend .pct  { color: var(--as-text-muted); font-weight: 700; min-width: 40px; text-align: right; }
.as-donut-legend .amt  { color: var(--as-text); font-weight: 700; min-width: 70px; text-align: right; }

/* ── Recent purchases mini-table arrows ──────── */
.as-recent-purchases td.num.strong { white-space: nowrap; }
.as-recent-purchases td.num.strong svg { vertical-align: -1px; margin-left: 2px; }

/* ── Dashboard alerts widget bottom card ─────── */
.as-alert-cta-card {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px;
    padding: 22px;
    background: linear-gradient(135deg, rgba(29,78,216,.04), rgba(34,211,238,.06));
    border: 1px solid rgba(29,78,216,.10);
}
.as-alert-cta-card h3 { margin: 0; font-size: 16px; font-weight: 800; color: var(--as-text); }
.as-alert-cta-card p  { margin: 4px 0 12px; font-size: 13.5px; color: var(--as-text-muted); }
.as-alert-stat {
    display: inline-flex; align-items: baseline; gap: 8px;
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 10px;
    padding: 8px 12px;
}
.as-alert-stat .num { font-size: 22px; font-weight: 800; color: var(--as-primary); letter-spacing: -.3px; }
.as-alert-stat .lbl { font-size: 12px; font-weight: 600; color: var(--as-text-muted); }

/* ── Responsive ───────────────────────────────── */
@media (max-width: 1024px) {
    .as-radio-cards   { grid-template-columns: repeat(2, 1fr); }
    .as-stat-grid-4   { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
    .as-radio-cards          { grid-template-columns: repeat(2, 1fr); }
    .as-radio-card .card-desc { display: none; }
    .as-donut-row            { justify-content: center; flex-direction: column; align-items: center; }
    .as-donut-legend         { width: 100%; }
    .as-alert-cta-card       { flex-direction: column; align-items: stretch; }
    .as-alert-cta-card .as-btn-primary { width: 100%; justify-content: center; }
    .as-page-head-actions    { width: 100%; justify-content: flex-start; }
    .as-date-pill            { font-size: 12px; padding: 6px 10px; }
    .as-trend-chart          { height: 200px; }
    .as-recent-purchases td.num.strong svg { display: none; }
    .as-alerts-table .as-alert-source { display: none; }
}

/* ============================================================
   Phase 5 — RFQ list, chip picker, quote comparison
   ============================================================ */

/* ── RFQ list table ─────────────────────────── */
.as-rfq-table .as-rfq-title { font-weight: 700; color: var(--as-text); text-decoration: none; }
.as-rfq-table .as-rfq-title:hover { color: var(--as-primary); }
.as-rfq-table .s.muted { font-size: 11.5px; color: var(--as-text-muted); margin-top: 2px; }

/* ── RFQ status pill ─────────────────────────── */
.as-rfq-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: capitalize;
    letter-spacing: .4px;
}
.as-rfq-status.as-rfq-open     { background: rgba(29,78,216,.10);  color: var(--as-primary); }
.as-rfq-status.as-rfq-awarded  { background: rgba(16,185,129,.14); color: #047857; }
.as-rfq-status.as-rfq-closed   { background: #f1f5f9;              color: var(--as-text-muted); }
.as-rfq-status.as-rfq-expired  { background: rgba(245,158,11,.14); color: #b45309; }

.as-quote-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: capitalize;
    letter-spacing: .4px;
}
.as-quote-status.as-quote-submitted { background: rgba(29,78,216,.10);  color: var(--as-primary); }
.as-quote-status.as-quote-awarded   { background: rgba(16,185,129,.14); color: #047857; }
.as-quote-status.as-quote-declined  { background: rgba(220,38,38,.10);  color: var(--as-danger); }
.as-quote-status.as-quote-withdrawn { background: #f1f5f9;              color: var(--as-text-muted); }

/* ── Chip picker (sellers) ──────────────────── */
.as-chip-input {
    border: 1.5px solid var(--as-border);
    border-radius: 11px;
    background: #f8fafc;
    padding: 8px 10px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.as-chip-input:focus-within {
    border-color: var(--as-primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(29, 78, 216, .12);
}
.as-chip-input.is-invalid {
    border-color: var(--as-danger);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, .1);
}
.as-chip-input .chips {
    display: flex; flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}
.as-chip-input .chips:empty { margin-bottom: 0; }
.as-chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 4px 4px 4px 10px;
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--as-text);
    box-shadow: 0 1px 2px rgba(15,42,110,.04);
}
.as-chip .as-chip-avatar {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}
.as-chip .as-chip-x {
    width: 22px; height: 22px;
    border: none;
    background: transparent;
    color: var(--as-text-muted);
    cursor: pointer;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 18px;
    line-height: 1;
}
.as-chip .as-chip-x:hover { background: #f1f5f9; color: var(--as-danger); }

.as-chip-input .search-row { position: relative; }
.as-chip-input input[type=text] {
    width: 100%;
    border: none;
    background: transparent;
    outline: none;
    padding: 8px 4px;
    font-family: inherit;
    font-size: 14px;
    color: var(--as-text);
}
.as-chip-input input[type=text]::placeholder { color: #94a3b8; }
.as-chip-input .dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    list-style: none;
    margin: 0; padding: 6px;
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 12px;
    box-shadow: 0 16px 32px -12px rgba(15, 42, 110, .18);
    z-index: 10;
    max-height: 280px;
    overflow-y: auto;
}
.as-chip-input .dropdown li {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .12s;
}
.as-chip-input .dropdown li:hover,
.as-chip-input .dropdown li.is-focused { background: #f1f5f9; }
.as-chip-input .dropdown .as-chip-avatar { width: 28px; height: 28px; font-size: 12px; }
.as-chip-input .dropdown .name { font-size: 13.5px; font-weight: 700; color: var(--as-text); }
.as-chip-input .dropdown .email { font-size: 11.5px; color: var(--as-text-muted); margin-top: 2px; }
.as-chip-input .dropdown li.is-added { opacity: .55; cursor: not-allowed; }
.as-chip-input .dropdown li.empty {
    color: var(--as-text-muted);
    font-size: 13px;
    cursor: default;
    text-align: center;
    padding: 14px;
}

.as-chip-help { font-size: 12px; color: var(--as-text-muted); margin-top: 8px; }
.as-form-section-sub { font-size: 12.5px; color: var(--as-text-muted); margin: -8px 0 12px; }

/* ── Quote comparison grid ──────────────────── */
.as-quote-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.as-quote-card {
    position: relative;
    background: #fff;
    border: 1.5px solid var(--as-border);
    border-radius: 14px;
    padding: 16px 18px 18px;
    display: flex; flex-direction: column; gap: 12px;
    box-shadow: 0 2px 8px rgba(15, 42, 110, .04);
    transition: transform .12s, box-shadow .15s, border-color .15s;
}
.as-quote-card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px -14px rgba(15, 42, 110, .18); }
.as-quote-card.is-best {
    border-color: rgba(16, 185, 129, .55);
    background: linear-gradient(180deg, rgba(16,185,129,.04), #fff);
}
.as-quote-card.is-awarded {
    border-color: var(--as-success);
    background: linear-gradient(180deg, rgba(16,185,129,.08), #fff);
    box-shadow: 0 12px 30px -10px rgba(16,185,129,.25);
}
.as-quote-banner {
    position: absolute;
    top: -10px; right: 14px;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .8px;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
    color: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,.15);
}
.as-quote-banner.best     { background: linear-gradient(135deg, #22c55e, #16a34a); }
.as-quote-banner.awarded  { background: linear-gradient(135deg, #10b981, #047857); }

.as-quote-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 10px;
}
.as-quote-head .seller {
    display: flex; align-items: center; gap: 10px;
    flex: 1; min-width: 0;
}
.as-quote-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
    font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.as-quote-avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.as-quote-head .name { font-size: 14px; font-weight: 700; color: var(--as-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-quote-head .email { font-size: 11.5px; color: var(--as-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.as-quote-price {
    font-size: 28px;
    font-weight: 800;
    color: var(--as-success);
    letter-spacing: -.4px;
}
.as-quote-price .unit { font-size: 13px; font-weight: 600; color: var(--as-text-muted); margin-left: 2px; }

.as-quote-meta {
    list-style: none;
    margin: 0; padding: 0;
    display: flex; flex-direction: column;
    border-top: 1px solid var(--as-border);
}
.as-quote-meta li {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--as-border);
    font-size: 13px;
}
.as-quote-meta li:last-child { border-bottom: none; }
.as-quote-meta .k { color: var(--as-text-muted); font-weight: 600; }
.as-quote-meta .v { color: var(--as-text); font-weight: 700; text-align: right; }

.as-quote-msg {
    background: #f8fafc;
    border-radius: 10px;
    padding: 12px;
    font-size: 13px;
    color: var(--as-text);
    line-height: 1.5;
    border: 1px solid var(--as-border);
}

.as-quote-awarded-foot {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 12.5px;
    color: var(--as-success);
    font-weight: 700;
    padding-top: 4px;
}
.as-quote-awarded-foot svg { width: 16px; height: 16px; }

.as-quote-awarded-card {
    display: flex; align-items: center; gap: 16px;
    padding: 18px 20px;
    background: linear-gradient(180deg, rgba(16,185,129,.10), rgba(16,185,129,0));
    border: 1px solid rgba(16,185,129,.35);
}
.as-quote-awarded-card .ic {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 6px 14px rgba(16,185,129,.3);
}
.as-quote-awarded-card .ic svg { width: 24px; height: 24px; }
.as-quote-awarded-card h3 { margin: 0; font-size: 16px; font-weight: 800; color: var(--as-text); }
.as-quote-awarded-card p  { margin: 4px 0 0; font-size: 13.5px; color: var(--as-text-muted); }

/* ── RFQ detail grid + recipients table ─────── */
.as-rfq-detail { grid-template-columns: repeat(4, 1fr); }

.as-recipient {
    display: flex; align-items: center; gap: 10px;
}
.as-recipient .name { font-size: 13.5px; font-weight: 700; color: var(--as-text); }
.as-recipient .email { font-size: 11.5px; color: var(--as-text-muted); margin-top: 2px; }

.as-recipient-state {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.as-recipient-state.state-sent      { background: #f1f5f9;              color: var(--as-text-muted); }
.as-recipient-state.state-viewed    { background: rgba(29,78,216,.10);  color: var(--as-primary); }
.as-recipient-state.state-responded { background: rgba(16,185,129,.14); color: #047857; }

/* ── Responsive ────────────────────────────── */
@media (max-width: 1024px) {
    .as-rfq-detail { grid-template-columns: repeat(2, 1fr); }
    .as-quote-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
    .as-rfq-detail        { grid-template-columns: 1fr; }
    .as-quote-grid        { grid-template-columns: 1fr; gap: 12px; }
    .as-quote-card        { padding: 14px; }
    .as-quote-price       { font-size: 24px; }
    .as-rfq-table .actions { display: none; }
    .as-rfq-table th:nth-child(4), .as-rfq-table td:nth-child(4) { display: none; }   /* Delivery */
    .as-recipients-table th:nth-child(2), .as-recipients-table td:nth-child(2) { display: none; }  /* Sent */
    .as-recipients-table th:nth-child(3), .as-recipients-table td:nth-child(3) { display: none; }  /* Viewed */
}

/* RFQ Phase-5 quote-card actions row + seller-actions strip (added now for Phase 6) */
.as-quote-actions {
    display: flex; gap: 8px; align-items: center;
    flex-wrap: wrap;
}
.as-quote-actions .as-btn-primary,
.as-quote-actions .as-btn-ghost { flex: 1; min-height: 38px; padding: 8px 12px; font-size: 13px; justify-content: center; }
.as-quote-actions .as-btn-ghost svg,
.as-quote-actions .as-btn-primary svg { width: 14px; height: 14px; }
.as-quote-actions .as-quote-awarded-foot { flex: 1; }

.as-rfq-seller-actions {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
}
.as-rfq-seller-actions h3 { margin: 0; font-size: 15px; font-weight: 800; color: var(--as-text); }
.as-rfq-seller-actions p  { margin: 4px 0 0; font-size: 13px; }

/* ============================================================
   Phase 6 — Chat (WhatsApp-style: list + pane, bubbles, polling)
   ============================================================ */

/* Make the chat page fill the available height with no main padding */
.as-app-chat .as-main { padding: 0; gap: 0; }

.as-chat {
    display: grid;
    grid-template-columns: 340px 1fr;
    height: calc(100vh - var(--as-topbar-h));
    background: #fff;
    border-top: 1px solid var(--as-border);
}

/* ── Conversation list (left pane) ───────────────── */
.as-chat-list {
    border-right: 1px solid var(--as-border);
    display: flex;
    flex-direction: column;
    background: #fff;
    min-height: 0;
}
.as-chat-list-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--as-border);
}
.as-chat-list-head h2 { margin: 0; font-size: 18px; font-weight: 800; color: var(--as-text); letter-spacing: -.2px; }
.as-chat-list-count {
    background: #f1f5f9;
    color: var(--as-text-muted);
    font-size: 11.5px;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 999px;
}
.as-chat-conversations {
    list-style: none;
    margin: 0; padding: 4px 0;
    overflow-y: auto;
    flex: 1; min-height: 0;
}
.as-conv {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 12px 18px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f1f5f9;
    transition: background .12s;
    position: relative;
}
.as-conv:hover { background: #f8fafc; }
.as-conv.is-active { background: rgba(29, 78, 216, .07); }
.as-conv.is-active::before {
    content: '';
    position: absolute;
    left: 0; top: 8px; bottom: 8px;
    width: 3px;
    background: var(--as-primary);
    border-radius: 0 3px 3px 0;
}
.as-conv-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.as-conv-meta { flex: 1; min-width: 0; }
.as-conv-meta .row1, .as-conv-meta .row2 {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
}
.as-conv-meta .name {
    font-size: 14px; font-weight: 700; color: var(--as-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.as-conv.has-unread .name { color: var(--as-primary); }
.as-conv-meta .time { font-size: 11.5px; color: var(--as-text-muted); white-space: nowrap; flex-shrink: 0; }
.as-conv-meta .preview {
    font-size: 13px;
    color: var(--as-text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.as-conv-meta .preview .you { color: var(--as-text-muted); font-weight: 600; }
.as-conv.has-unread .preview { color: var(--as-text); font-weight: 600; }
.as-conv-meta .unread {
    flex-shrink: 0;
    min-width: 20px; height: 20px;
    border-radius: 999px;
    background: var(--as-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 20px;
    text-align: center;
    padding: 0 6px;
}
.as-conv-meta .row3 {
    margin-top: 4px;
    font-size: 11px;
    color: var(--as-text-muted);
    display: inline-flex; align-items: center; gap: 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.as-conv-meta .row3.ref { color: var(--as-primary); font-weight: 600; }

/* ── Active chat pane (right) ───────────────────── */
.as-chat-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background:
        radial-gradient(60% 40% at 100% 0%, rgba(29,78,216,.04) 0%, transparent 50%),
        radial-gradient(40% 30% at 0% 100%, rgba(34,211,238,.04) 0%, transparent 50%),
        #f8fafc;
}
.as-chat-pane-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 40px;
}
.as-chat-empty-card {
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 16px;
    padding: 40px 32px;
    text-align: center;
    max-width: 380px;
    box-shadow: 0 4px 20px -8px rgba(15, 42, 110, .08);
}
.as-chat-empty-card .ic {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(29,78,216,.1), rgba(34,211,238,.1));
    color: var(--as-primary);
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 16px;
}
.as-chat-empty-card .ic svg { width: 28px; height: 28px; }
.as-chat-empty-card h3 { margin: 0 0 6px; font-size: 18px; font-weight: 800; color: var(--as-text); }
.as-chat-empty-card p  { margin: 0 0 8px; font-size: 13.5px; color: var(--as-text-muted); line-height: 1.5; }
.as-chat-empty-card .hint { font-size: 12px; color: var(--as-text-muted); margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--as-border); }

/* ── Chat header ────────────────────────────────── */
.as-chat-header {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 18px;
    background: #fff;
    border-bottom: 1px solid var(--as-border);
    flex-shrink: 0;
}
.as-chat-back {
    display: none;     /* mobile only */
    width: 36px; height: 36px;
    border-radius: 8px;
    align-items: center; justify-content: center;
    color: var(--as-text);
    text-decoration: none;
    transition: background .12s;
}
.as-chat-back:hover { background: #f1f5f9; }
.as-chat-back svg { width: 20px; height: 20px; }

.as-chat-header .as-conv-avatar { width: 40px; height: 40px; font-size: 14px; }
.as-chat-header-meta { flex: 1; min-width: 0; }
.as-chat-header-meta .name {
    font-size: 15px; font-weight: 800; color: var(--as-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.as-chat-header-meta .sub {
    font-size: 12px; color: var(--as-text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-top: 2px;
}
.as-chat-header-meta .ref { color: var(--as-primary); font-weight: 600; }

/* ── Thread (message bubbles) ────────────────────── */
.as-chat-thread {
    flex: 1; min-height: 0;
    overflow-y: auto;
    padding: 18px 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.as-chat-day {
    display: flex; align-items: center; justify-content: center;
    margin: 14px 0 6px;
}
.as-chat-day span {
    background: #fff;
    border: 1px solid var(--as-border);
    color: var(--as-text-muted);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .4px;
    padding: 4px 12px;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(15,42,110,.04);
}
.as-msg {
    display: flex; align-items: flex-end; gap: 8px;
    margin: 2px 0;
    animation: as-msg-in .25s ease both;
}
.as-msg.is-mine { flex-direction: row-reverse; }
.as-msg-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #94a3b8, #475569);
    color: #fff;
    font-weight: 700;
    font-size: 11.5px;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.as-msg-bubble {
    max-width: 70%;
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 14px 14px 14px 4px;
    padding: 8px 12px 6px;
    box-shadow: 0 1px 2px rgba(15,42,110,.05);
}
.as-msg.is-mine .as-msg-bubble {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    border-color: #1d4ed8;
    border-radius: 14px 14px 4px 14px;
}
.as-msg-bubble .body {
    font-size: 14px;
    line-height: 1.45;
    color: inherit;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.as-msg-bubble .meta {
    display: inline-flex; align-items: center; gap: 4px;
    margin-top: 2px;
    font-size: 10.5px;
    color: var(--as-text-muted);
}
.as-msg.is-mine .as-msg-bubble .meta { color: rgba(255,255,255,.78); }
.as-msg-bubble .meta .time { white-space: nowrap; }
.as-msg-bubble .meta .ticks { display: inline-flex; align-items: center; }
.as-msg-bubble .meta .ticks svg { width: 14px; height: 14px; }
.as-msg.is-mine .as-msg-bubble .meta .ticks { color: rgba(255,255,255,.62); }
.as-msg.is-mine .as-msg-bubble .meta .ticks.read { color: #4ade80; }

@keyframes as-msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Input bar ──────────────────────────────────── */
.as-chat-input {
    display: flex; align-items: flex-end; gap: 10px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--as-border);
    flex-shrink: 0;
}
.as-chat-input textarea {
    flex: 1;
    border: 1px solid var(--as-border);
    border-radius: 22px;
    background: #f8fafc;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.45;
    color: var(--as-text);
    resize: none;
    max-height: 140px;
    transition: border-color .15s, background .15s;
}
.as-chat-input textarea:focus {
    outline: none;
    border-color: var(--as-primary);
    background: #fff;
}
.as-chat-send {
    width: 44px; height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 6px 14px rgba(29,78,216,.3);
    transition: transform .12s, filter .15s;
}
.as-chat-send svg { width: 18px; height: 18px; }
.as-chat-send:hover { filter: brightness(1.05); }
.as-chat-send:active { transform: scale(.94); }
.as-chat-send:disabled { opacity: .55; cursor: not-allowed; }

.as-empty-flush { margin: 16px; }

/* ── Responsive: mobile slide ─────────────────────── */
@media (max-width: 860px) {
    /* Mobile: stack list ↔ pane (one at a time) */
    .as-chat {
        grid-template-columns: 1fr;
        height: calc(100vh - var(--as-topbar-h) - var(--as-bottom-nav-h));
        height: calc(100dvh - var(--as-topbar-h) - var(--as-bottom-nav-h));
    }
    .as-app-chat .as-bottom-nav { display: flex; }
    .as-chat-list { display: flex; }
    .as-chat-pane { display: none; }
    .as-chat.has-active .as-chat-list { display: none; }
    .as-chat.has-active .as-chat-pane { display: flex; }
    .as-chat-back { display: inline-flex; }
    .as-msg-bubble { max-width: 82%; }

    /* ── Active chat = full-screen native-app feel ───────
       Trigger off `.as-chat.has-active` (server-rendered) instead
       of the JS-added `.in-chat` body class so the layout is
       correct on first paint, before any JS runs. */
    .as-chat.has-active {
        position: fixed;
        inset: 0;
        z-index: 50;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        border-top: 0;
        max-width: 100vw;       /* keep in sync with the viewport */
        overflow: hidden;       /* clip anything that would otherwise overflow */
    }
    /* Hide the rest of the app shell once a chat is open */
    body:has(.as-chat.has-active) .as-topbar,
    body:has(.as-chat.has-active) .as-bottom-nav,
    body:has(.as-chat.has-active) .as-sidebar { display: none; }
    body:has(.as-chat.has-active) .as-shell   { margin-left: 0; }
    body:has(.as-chat.has-active) .as-main    { padding: 0; }

    /* Fallback for older browsers without :has() — uses the
       JS-added .in-chat body class as a substitute. */
    .as-app-chat.in-chat .as-topbar     { display: none; }
    .as-app-chat.in-chat .as-bottom-nav { display: none; }
    .as-app-chat.in-chat .as-sidebar    { display: none; }
    .as-app-chat.in-chat .as-shell      { margin-left: 0; }
    .as-app-chat.in-chat .as-main       { padding: 0; }

    /* Pane fills the fixed parent and shrinks correctly */
    .as-chat.has-active .as-chat-pane {
        width: 100%;
        height: 100%;
        min-width: 0;
        min-height: 0;
    }

    /* ── Header: fixed-feel sticky strip with safe-area for notches */
    .as-chat-header {
        position: sticky;
        top: 0;
        z-index: 5;
        padding: 10px 12px calc(10px);
        padding-top: calc(10px + env(safe-area-inset-top));
        gap: 10px;
        box-shadow: 0 1px 0 var(--as-border), 0 4px 12px -8px rgba(15,42,110,.12);
    }
    .as-chat-back {
        width: 40px; height: 40px;
        border-radius: 999px;
    }
    .as-chat-header .as-conv-avatar { width: 36px; height: 36px; font-size: 13px; }
    .as-chat-header-meta .name { font-size: 14.5px; }
    .as-chat-header-meta .sub  { font-size: 11.5px; }

    /* ── Conversation list rows: mobile density */
    .as-chat-list-head { padding: 14px 16px; }
    .as-chat-list-head h2 { font-size: 17px; }
    .as-conv {
        padding: 12px 14px;
        gap: 10px;
        border-bottom: 1px solid #f1f5f9;
        min-height: 64px;
    }
    .as-conv:active { background: #eff6ff; }
    .as-conv-avatar { width: 46px; height: 46px; }

    /* ── Thread: scrolls between header and input */
    .as-chat-thread {
        padding: 12px 12px 10px;
        gap: 2px;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    .as-chat-day   { margin: 10px 0 4px; }
    .as-msg-bubble { padding: 8px 12px 5px; }
    .as-msg-bubble .body { font-size: 14.5px; }

    /* ── Quick-reply strip: edge-to-edge horizontally scrollable */
    .as-chat-quick-replies {
        padding: 6px 12px 8px;
        gap: 6px;
        -webkit-overflow-scrolling: touch;
    }
    .as-qr-chip { padding: 7px 13px; font-size: 12.5px; }

    /* ── Input bar: docks above keyboard with safe-area inset.
       Use `width: 100%; box-sizing: border-box` on the row so
       padding is included; `min-width: 0` on the textarea so it
       shrinks instead of pushing the send button off-screen. */
    .as-chat-input {
        position: sticky;
        bottom: 0;
        width: 100%;
        box-sizing: border-box;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
        gap: 8px;
        box-shadow: 0 -1px 0 var(--as-border);
    }
    .as-chat-input textarea {
        flex: 1 1 0;
        min-width: 0;
        padding: 10px 16px;
        font-size: 16px;       /* >=16px stops iOS auto-zoom on focus */
        border-radius: 22px;
        line-height: 1.4;
    }
    .as-chat-send {
        width: 42px; height: 42px;
        flex-shrink: 0;
    }

    .as-chat-typing { padding: 4px 12px 2px; }

    /* Quick-reply strip uses overflow-x scroll — but the parent
       has to constrain it. Force max-width and scroll. */
    .as-chat-quick-replies {
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
        overflow-x: auto;
        flex-wrap: nowrap;
    }
}

/* ── Phone-portrait extra polish */
@media (max-width: 480px) {
    .as-chat-list-head { padding: 12px 14px; }
    .as-conv-meta .preview { font-size: 12.5px; }
    .as-conv-meta .name    { font-size: 13.5px; }
    .as-conv-meta .row3    { display: none; }   /* hide ref subtitle to save space */
    .as-msg-bubble         { max-width: 86%; }
    .as-chat-empty-card    { padding: 28px 22px; }
    .as-qr-chip            { padding: 6px 11px; font-size: 12px; }
}

/* ============================================================
   Phase 7 — Subscription / Pricing / Billing dashboard
   ============================================================ */

/* ── Plan badge in sidebar ──────────────────────── */
.as-sidenav-badge.plan-pro        { background: linear-gradient(135deg, #3b82f6, #1d4ed8); box-shadow: 0 0 0 3px rgba(29,78,216,.18); }
.as-sidenav-badge.plan-enterprise { background: linear-gradient(135deg, #a855f7, #7e22ce); box-shadow: 0 0 0 3px rgba(168,85,247,.18); }

/* ── Pricing hero ───────────────────────────────── */
.as-pricing-hero {
    text-align: center;
    padding: 24px 16px 8px;
    max-width: 760px;
    margin: 0 auto;
}
.as-pricing-eyebrow {
    display: inline-block;
    background: rgba(29,78,216,.08);
    color: var(--as-primary);
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: .8px;
    text-transform: uppercase;
    padding: 5px 14px;
    border-radius: 999px;
    margin-bottom: 14px;
}
.as-pricing-hero h1 {
    margin: 0 0 12px;
    font-size: 36px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -.5px;
    color: var(--as-text);
}
.as-pricing-hero h1 .hi { color: var(--as-primary); }
.as-pricing-hero p {
    font-size: 15px;
    line-height: 1.6;
    color: var(--as-text-muted);
    margin: 0 0 24px;
}

.as-pricing-toggle {
    display: inline-flex;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 4px;
    gap: 2px;
}
.as-pricing-toggle a {
    display: inline-flex; align-items: center; gap: 6px;
    text-decoration: none;
    color: var(--as-text-muted);
    font-size: 13px;
    font-weight: 700;
    padding: 8px 18px;
    border-radius: 10px;
    transition: background .15s, color .15s;
}
.as-pricing-toggle a.is-active {
    background: var(--as-primary);
    color: #fff;
    box-shadow: 0 4px 10px rgba(29,78,216,.25);
}
.as-pricing-toggle .save {
    background: rgba(16,185,129,.16);
    color: #047857;
    font-size: 10.5px;
    padding: 2px 8px;
    border-radius: 999px;
    letter-spacing: .4px;
}
.as-pricing-toggle a.is-active .save { background: rgba(255,255,255,.2); color: #fff; }

/* ── Pricing grid ───────────────────────────────── */
.as-pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 8px;
}
.as-plan-card {
    position: relative;
    background: #fff;
    border: 1.5px solid var(--as-border);
    border-radius: 18px;
    padding: 28px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    transition: transform .15s, box-shadow .15s, border-color .15s;
    box-shadow: 0 2px 8px rgba(15, 42, 110, .04);
}
.as-plan-card:hover { transform: translateY(-3px); box-shadow: 0 16px 36px -16px rgba(15, 42, 110, .18); }
.as-plan-card.is-popular {
    border-color: rgba(29,78,216,.45);
    box-shadow: 0 16px 36px -14px rgba(29,78,216,.30);
    background: linear-gradient(180deg, rgba(29,78,216,.04), #fff 60%);
}
.as-plan-card.is-current {
    border-color: rgba(16,185,129,.5);
    box-shadow: 0 16px 36px -14px rgba(16,185,129,.25);
}
.as-plan-popular, .as-plan-current {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .8px;
    text-transform: uppercase;
    padding: 5px 14px;
    border-radius: 999px;
    color: #fff;
    box-shadow: 0 6px 14px rgba(0,0,0,.15);
    white-space: nowrap;
}
.as-plan-popular { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.as-plan-current { background: linear-gradient(135deg, #22c55e, #16a34a); }

.as-plan-head { text-align: center; }
.as-plan-name {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--as-primary);
}
.as-plan-card.color-slate      .as-plan-name { color: var(--as-text-muted); }
.as-plan-card.color-blue       .as-plan-name { color: var(--as-primary); }
.as-plan-card.color-purple     .as-plan-name { color: #7e22ce; }
.as-plan-tag {
    margin: 6px 0 0;
    font-size: 13.5px;
    color: var(--as-text-muted);
    line-height: 1.5;
}

.as-plan-price {
    text-align: center;
    padding: 12px 0 4px;
    border-bottom: 1px solid var(--as-border);
}
.as-plan-price .amount {
    font-size: 44px;
    font-weight: 800;
    color: var(--as-text);
    letter-spacing: -1px;
    line-height: 1;
}
.as-plan-price .per {
    font-size: 13px;
    color: var(--as-text-muted);
    margin-left: 4px;
    font-weight: 600;
}
.as-plan-monthly { font-size: 12px; color: var(--as-text-muted); margin-top: 6px; }

.as-plan-features {
    list-style: none;
    margin: 0; padding: 0;
    display: flex; flex-direction: column;
    gap: 12px;
    flex: 1;
}
.as-plan-features li {
    display: flex; align-items: flex-start; gap: 10px;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--as-text);
}
.as-plan-features svg {
    flex-shrink: 0;
    width: 18px; height: 18px;
    margin-top: 1px;
    color: var(--as-success);
    background: rgba(16,185,129,.12);
    border-radius: 50%;
    padding: 2px;
}
.as-plan-card.color-blue   .as-plan-features svg { color: var(--as-primary); background: rgba(29,78,216,.10); }
.as-plan-card.color-purple .as-plan-features svg { color: #7e22ce;            background: rgba(168,85,247,.12); }

.as-plan-cta { display: flex; }
.as-plan-cta .as-btn-primary,
.as-plan-cta .as-btn-ghost { flex: 1; }
.as-plan-card.color-purple .as-plan-cta .as-btn-primary {
    background: linear-gradient(135deg, #a855f7, #7e22ce);
    box-shadow: 0 8px 20px rgba(168, 85, 247, .28);
}

/* ── Pricing FAQ row ────────────────────────────── */
.as-pricing-faq {
    margin-top: 32px;
    padding: 20px;
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 14px;
}
.as-faq-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}
.as-faq-item { font-size: 13.5px; line-height: 1.55; color: var(--as-text); }
.as-faq-item strong { color: var(--as-text); display: block; margin-bottom: 4px; }

/* ── Mock checkout modal ────────────────────────── */
.as-checkout-card { max-width: 440px; }
.as-checkout-banner {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 12px 14px;
    background: rgba(245,158,11,.08);
    border: 1px solid rgba(245,158,11,.30);
    border-radius: 10px;
    margin-bottom: 14px;
}
.as-checkout-banner svg { width: 18px; height: 18px; color: #b45309; flex-shrink: 0; margin-top: 1px; }
.as-checkout-banner .t { font-size: 13px; font-weight: 800; color: #b45309; }
.as-checkout-banner .s { font-size: 12px; color: var(--as-text-muted); margin-top: 2px; line-height: 1.45; }

.as-checkout-summary {
    background: #f8fafc;
    border: 1px solid var(--as-border);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 14px;
}
.as-checkout-summary .row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 0;
    font-size: 13.5px;
}
.as-checkout-summary .row .k { color: var(--as-text-muted); }
.as-checkout-summary .row .v { color: var(--as-text); font-weight: 700; text-transform: capitalize; }
.as-checkout-summary .row.total {
    border-top: 1px solid var(--as-border);
    padding-top: 12px; margin-top: 4px;
    font-size: 16px;
}
.as-checkout-summary .row.total .v { font-size: 20px; color: var(--as-primary); }

/* ── Billing dashboard — current plan card (theme-matched) ─────
   Clean panel with a coloured accent stripe per plan. Text uses the
   normal app palette (no white-on-white edge cases) and meta info
   sits in a subtle inner panel below the headline row. */
.as-bill-card {
    padding: 0;
    overflow: hidden;
    position: relative;
}
.as-bill-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--as-primary, #1d4ed8);
    border-radius: 4px 0 0 4px;
}
.as-bill-card.accent-purple::before { background: linear-gradient(180deg, #a855f7, #7e22ce); }
.as-bill-card.accent-slate::before  { background: linear-gradient(180deg, #64748b, #334155); }
.as-bill-card.accent-green::before  { background: linear-gradient(180deg, #16a34a, #15803d); }
.as-bill-card.accent-orange::before { background: linear-gradient(180deg, #ea580c, #c2410c); }
.as-bill-card.accent-red::before    { background: linear-gradient(180deg, #dc2626, #b91c1c); }
.as-bill-card.accent-blue::before   { background: linear-gradient(180deg, #2563eb, #1e3a8a); }

.as-bill-card-head {
    display: flex; align-items: flex-start; gap: 16px;
    padding: 22px 24px 18px;
    flex-wrap: wrap;
}
.as-bill-card-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    background: rgba(29, 78, 216, .08);
    color: var(--as-primary, #1d4ed8);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.as-bill-card.accent-purple .as-bill-card-icon { background: rgba(168,85,247,.12); color: #7e22ce; }
.as-bill-card.accent-green  .as-bill-card-icon { background: rgba(22,163,74,.12);  color: #15803d; }
.as-bill-card.accent-orange .as-bill-card-icon { background: rgba(234,88,12,.12);  color: #c2410c; }
.as-bill-card.accent-red    .as-bill-card-icon { background: rgba(220,38,38,.10);  color: #b91c1c; }
.as-bill-card.accent-slate  .as-bill-card-icon { background: #f1f5f9;              color: #475569; }
.as-bill-card-icon svg { width: 24px; height: 24px; }

.as-bill-card-text { flex: 1; min-width: 220px; }
.as-bill-card-text .as-eyebrow {
    color: var(--as-text-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.6px;
    text-transform: uppercase;
}
.as-bill-card-name {
    display: inline-flex; align-items: center; gap: 10px;
    margin-top: 4px;
    font-size: 24px;
    font-weight: 800;
    color: var(--as-text);
    letter-spacing: -.3px;
    flex-wrap: wrap;
}
.as-bill-card-tag {
    margin: 4px 0 0;
    font-size: 13.5px;
    color: var(--as-text-muted);
    line-height: 1.5;
}

.as-bill-card-actions {
    display: flex; flex-direction: column; gap: 8px;
    flex-shrink: 0;
    align-self: stretch;
    justify-content: center;
    min-width: 180px;
}
.as-bill-card-actions .as-btn-primary,
.as-bill-card-actions .as-btn-ghost { width: 100%; justify-content: center; }
.as-bill-card-actions .as-btn-danger {
    color: var(--as-danger, #dc2626);
    border-color: rgba(220,38,38,.25);
}
.as-bill-card-actions .as-btn-danger:hover {
    background: rgba(220,38,38,.06);
    border-color: rgba(220,38,38,.45);
    color: var(--as-danger, #dc2626);
}

.as-bill-card-meta {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin: 0 24px 22px;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid var(--as-border);
    border-radius: 10px;
}
.as-bill-card-meta > div { min-width: 0; }
.as-bill-card-meta .lbl {
    font-size: 11px; font-weight: 700; letter-spacing: .6px;
    text-transform: uppercase; color: var(--as-text-muted);
}
.as-bill-card-meta .val {
    font-size: 14px; font-weight: 700;
    color: var(--as-text);
    margin-top: 3px;
    text-transform: capitalize;
    word-wrap: break-word;
}
@media (max-width: 720px) {
    .as-bill-card-head    { padding: 18px 18px 14px; }
    .as-bill-card-meta    { grid-template-columns: repeat(2, 1fr); margin: 0 18px 18px; }
    .as-bill-card-actions { width: 100%; flex-direction: row; min-width: 0; }
    .as-bill-card-actions .as-btn-primary,
    .as-bill-card-actions .as-btn-ghost { flex: 1; }
}

/* ── Billing dashboard — current plan card (legacy gradient hero) ───── */
/* Old high-contrast variant kept for any view that still uses it. */
.as-billing-current {
    display: flex; align-items: center; justify-content: space-between;
    gap: 18px;
    padding: 26px 28px;
    border-radius: 16px;
    color: #fff;
    border: none;
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 50%, #1e3a8a 100%);
    box-shadow: 0 12px 32px -10px rgba(29, 78, 216, .35);
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
}
.as-billing-current::before {
    content: ""; position: absolute; inset: 0;
    background:
        radial-gradient(120% 60% at 100% 0%, rgba(255,255,255,.12) 0%, transparent 60%),
        radial-gradient(80% 60% at 0% 100%, rgba(34,211,238,.18) 0%, transparent 50%);
    pointer-events: none;
}
.as-billing-current.color-purple { background: linear-gradient(135deg, #7e22ce 0%, #a855f7 50%, #581c87 100%); box-shadow: 0 12px 32px -10px rgba(168,85,247,.4); }
.as-billing-current.color-slate  { background: linear-gradient(135deg, #475569 0%, #64748b 50%, #334155 100%); box-shadow: 0 12px 32px -10px rgba(71,85,105,.35); }
.as-billing-current.color-green  { background: linear-gradient(135deg, #15803d 0%, #16a34a 50%, #14532d 100%); box-shadow: 0 12px 32px -10px rgba(22,163,74,.35); }
.as-billing-current.color-orange { background: linear-gradient(135deg, #c2410c 0%, #ea580c 50%, #7c2d12 100%); box-shadow: 0 12px 32px -10px rgba(234,88,12,.35); }
.as-billing-current.color-red    { background: linear-gradient(135deg, #b91c1c 0%, #dc2626 50%, #7f1d1d 100%); box-shadow: 0 12px 32px -10px rgba(220,38,38,.35); }

.as-billing-current-text { flex: 1; min-width: 240px; position: relative; z-index: 1; }
.as-billing-current .as-eyebrow {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255,255,255,.78);
}
.as-billing-current-name {
    display: inline-flex; align-items: center; gap: 12px;
    font-size: 30px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.5px;
    margin-top: 4px;
    flex-wrap: wrap;
}
.as-billing-current-tag {
    margin: 6px 0 16px;
    font-size: 14px;
    color: rgba(255,255,255,.85);
}
.as-billing-current .as-billing-status {
    background: rgba(255,255,255,.18) !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,.28);
    backdrop-filter: blur(4px);
}
.as-billing-current .as-billing-meta .lbl {
    color: rgba(255,255,255,.7) !important;
}
.as-billing-current .as-billing-meta .val {
    color: #fff !important;
}
.as-billing-current .as-billing-actions { position: relative; z-index: 1; }
.as-billing-current .as-btn-primary {
    background: #fff;
    color: var(--as-primary);
    box-shadow: 0 4px 12px rgba(0,0,0,.18);
}
.as-billing-current .as-btn-primary:hover { background: #f1f5f9; }
.as-billing-current .as-btn-ghost {
    background: rgba(255,255,255,.12);
    color: #fff;
    border-color: rgba(255,255,255,.28);
    backdrop-filter: blur(4px);
}
.as-billing-current .as-btn-ghost:hover { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.45); }
.as-billing-current .as-btn-danger {
    background: rgba(220,38,38,.85);
    color: #fff;
    border-color: rgba(255,255,255,.2);
}
.as-billing-current .as-btn-danger:hover { background: rgba(220,38,38,1); }
.as-billing-status {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .5px;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
}
.as-billing-status.as-billing-active     { background: rgba(16,185,129,.12); color: #047857; }
.as-billing-status.as-billing-pending    { background: rgba(245,158,11,.12); color: #b45309; }
.as-billing-status.as-billing-cancelled  { background: rgba(220,38,38,.10);  color: var(--as-danger); }
.as-billing-status.as-billing-expired    { background: #f1f5f9;              color: var(--as-text-muted); }
.as-billing-status.as-billing-past_due   { background: rgba(220,38,38,.12);  color: var(--as-danger); }

.as-billing-meta {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 10px;
    padding: 12px 14px;
}
.as-billing-meta .lbl { font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--as-text-muted); }
.as-billing-meta .val { font-size: 14px; font-weight: 700; color: var(--as-text); margin-top: 2px; text-transform: capitalize; }

.as-billing-actions { display: flex; flex-direction: column; gap: 8px; align-self: stretch; }
.as-billing-actions .as-btn-primary,
.as-billing-actions .as-btn-ghost { width: 100%; justify-content: center; }

/* ── Usage meters ─────────────────────────────── */
.as-usage-grid { display: flex; flex-direction: column; gap: 14px; }
.as-usage-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.as-usage-head .lbl { font-size: 13px; font-weight: 700; color: var(--as-text); }
.as-usage-head .val { font-size: 14px; font-weight: 800; color: var(--as-text); }
.as-usage-bar {
    width: 100%;
    height: 8px;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
}
.as-usage-bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    transition: width .3s, background .2s;
}

/* ── Feature list ─────────────────────────────── */
.as-feature-grid {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 10px;
}
.as-feature-grid li {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    background: rgba(16,185,129,.06);
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--as-text);
}
.as-feature-grid li svg { width: 18px; height: 18px; color: var(--as-success); flex-shrink: 0; }
.as-feature-grid li.is-off {
    background: #f8fafc;
    color: var(--as-text-muted);
}
.as-feature-grid li.is-off svg { color: #cbd5e1; }

/* ── Payment status pill ──────────────────────── */
.as-pay-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.as-pay-status.as-pay-captured { background: rgba(16,185,129,.12); color: #047857; }
.as-pay-status.as-pay-pending  { background: rgba(245,158,11,.12); color: #b45309; }
.as-pay-status.as-pay-failed   { background: rgba(220,38,38,.12);  color: var(--as-danger); }
.as-pay-status.as-pay-refunded { background: #f1f5f9;              color: var(--as-text-muted); }

/* ── Responsive ───────────────────────────────── */
@media (max-width: 1024px) {
    .as-pricing-grid { grid-template-columns: 1fr; }
    .as-plan-card.is-popular { order: -1; }   /* Pro first when stacked */
    .as-faq-row    { grid-template-columns: 1fr; }
    .as-billing-meta { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
    .as-pricing-hero h1 { font-size: 26px; }
    .as-pricing-hero p  { font-size: 13.5px; }
    .as-plan-price .amount { font-size: 36px; }
    .as-billing-current { flex-direction: column; }
    .as-billing-actions { flex-direction: row; flex-wrap: wrap; }
    .as-billing-actions .as-btn-primary,
    .as-billing-actions .as-btn-ghost { flex: 1; }
}

/* ============================================================
   Phase 8 — Live Aluminium Price page
   ============================================================ */

.as-live-hero {
    display: grid;
    grid-template-columns: minmax(280px, 380px) 1fr;
    gap: 18px;
    background:
        radial-gradient(70% 60% at 0% 0%, rgba(29,78,216,.06) 0%, transparent 60%),
        radial-gradient(50% 50% at 100% 100%, rgba(34,211,238,.05) 0%, transparent 60%),
        #fff;
    border: 1px solid var(--as-border);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 4px 18px -10px rgba(15, 42, 110, .12);
}
.as-live-hero-side  { display: flex; flex-direction: column; gap: 8px; }
.as-live-hero-price {
    font-size: 56px;
    font-weight: 800;
    letter-spacing: -1.5px;
    line-height: 1;
    color: var(--as-text);
    margin: 4px 0;
}
.as-live-hero-price.up   { color: var(--as-success); }
.as-live-hero-price.down { color: var(--as-danger); }
.as-live-hero-price .unit { font-size: 18px; font-weight: 700; color: var(--as-text-muted); margin-left: 6px; }
.as-live-hero-chg {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 12px;
}
.as-live-hero-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 12px;
}
.as-live-hero-grid > div {
    background: #f8fafc;
    border: 1px solid var(--as-border);
    border-radius: 10px;
    padding: 10px 12px;
}
.as-live-hero-grid .lbl { font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--as-text-muted); }
.as-live-hero-grid .val { font-size: 18px; font-weight: 800; color: var(--as-text); margin-top: 2px; }
.as-live-hero-grid .val.up   { color: var(--as-success); }
.as-live-hero-grid .val.down { color: var(--as-danger); }

.as-live-hero-chart {
    background: #f8fafc;
    border: 1px solid var(--as-border);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 280px;
}
.as-live-hero-chart svg { width: 100%; height: 240px; display: block; }
.as-live-chart-foot {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12px;
    color: var(--as-text-muted);
}

/* ── How-it-works steps ────────────────────────── */
.as-live-steps {
    list-style: none;
    margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 14px;
}
.as-live-steps li {
    display: flex; gap: 12px; align-items: flex-start;
}
.as-live-steps .step {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.as-live-steps .t { font-size: 14px; font-weight: 700; color: var(--as-text); }
.as-live-steps .s { font-size: 12.5px; color: var(--as-text-muted); margin-top: 2px; }
.as-live-steps code {
    background: #f1f5f9;
    border-radius: 6px;
    padding: 1px 6px;
    font-size: 12px;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    color: var(--as-primary);
}

.as-attribution {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--as-border);
    font-size: 12px;
    color: var(--as-text-muted);
}
.as-attribution a { color: var(--as-primary); text-decoration: none; font-weight: 600; }
.as-attribution a:hover { text-decoration: underline; }

/* Refresh button busy spin (already used by dashboard, repeat here for safety) */
#asLiveRefresh.is-busy svg { animation: as-spin 1s linear infinite; }

@media (max-width: 1024px) {
    .as-live-hero        { grid-template-columns: 1fr; }
    .as-live-hero-price  { font-size: 44px; }
}
@media (max-width: 720px) {
    .as-live-hero          { padding: 16px; }
    .as-live-hero-price    { font-size: 36px; letter-spacing: -1px; }
    .as-live-hero-grid     { grid-template-columns: 1fr 1fr; }
    .as-live-hero-chart    { min-height: 220px; }
    .as-live-hero-chart svg { height: 200px; }
}

/* ============================================================
   Industrial welcome hero (dashboard) — metal-coil background
   ============================================================ */

.as-welcome-hero {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    padding: 28px 32px;
    color: #fff;
    background:
        radial-gradient(120% 80% at 100% 0%, rgba(59,130,246,.32) 0%, transparent 55%),
        radial-gradient(60% 60% at 0% 100%, rgba(34,211,238,.22) 0%, transparent 50%),
        linear-gradient(135deg, var(--as-hero-from) 0%, var(--as-hero-via) 50%, var(--as-hero-to) 100%);
    box-shadow: 0 16px 40px -16px rgba(13, 42, 110, .35);
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    min-height: 196px;
}
.as-welcome-hero::before {
    /* Subtle industrial blueprint grid behind the metal illustration */
    content: '';
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
}
.as-welcome-hero-text {
    position: relative; z-index: 2;
    max-width: 560px;
}
.as-welcome-eyebrow {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    font-size: 11.5px; font-weight: 800; letter-spacing: .8px;
    text-transform: uppercase;
    color: rgba(255,255,255,.92);
    margin-bottom: 10px;
}
.as-welcome-hero-text h1 {
    margin: 0 0 6px;
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -.6px;
    line-height: 1.15;
}
.as-welcome-hero-text h1 .wave { display: inline-block; transform: rotate(8deg); }
.as-welcome-hero-text p {
    margin: 0 0 18px;
    font-size: 15px;
    line-height: 1.55;
    color: rgba(255,255,255,.86);
    max-width: 480px;
}
.as-welcome-hero-text p .hi { color: #4ade80; font-weight: 700; }

.as-welcome-actions {
    display: inline-flex; gap: 10px; flex-wrap: wrap;
}
.as-btn-on-dark {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 11px;
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.22);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    transition: background .15s, border-color .15s;
}
.as-btn-on-dark:hover { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.32); }
.as-btn-on-dark svg   { width: 16px; height: 16px; }

.as-welcome-hero-visual {
    position: relative; z-index: 1;
    flex-shrink: 0;
    align-self: stretch;
    display: flex;
    align-items: flex-end;
    margin: -28px -32px -28px 0;
}
.as-welcome-hero-visual img {
    height: 100%;
    max-height: 252px;
    width: auto;
    display: block;
    pointer-events: none;
    user-select: none;
}

@media (max-width: 1100px) {
    .as-welcome-hero-text h1 { font-size: 28px; }
    .as-welcome-hero-visual img { max-height: 200px; }
}
@media (max-width: 720px) {
    .as-welcome-hero { padding: 22px 18px; min-height: 0; flex-direction: column; align-items: flex-start; gap: 12px; }
    .as-welcome-hero-visual {
        margin: 0 -18px -22px auto;
        opacity: 0.55;     /* photographic backdrop on mobile, not a side panel */
    }
    .as-welcome-hero-visual img { max-height: 130px; }
    .as-welcome-hero-text h1 { font-size: 24px; }
    .as-welcome-hero-text p  { font-size: 13.5px; max-width: 100%; }
    .as-welcome-actions      { width: 100%; }
    .as-welcome-actions .as-btn-primary,
    .as-welcome-actions .as-btn-on-dark { flex: 1; min-width: 140px; justify-content: center; }
}

/* ============================================================
   Dashboard rebuild — status stats + chart sub-stats + TPC table
   (matches the "Welcome back, Rahul!" Phase 3 reference design)
   ============================================================ */

/* ── Greeting block ─────────────────────────────── */
.as-dash-greeting { padding-top: 4px; }
.as-dash-greeting .as-page-title { font-size: 22px; }
.as-dash-greeting .wave { display: inline-block; transform: rotate(8deg); }
.as-dash-greeting .as-page-sub { margin-top: 4px; }

/* ── Status stat tiles (4-up) ───────────────────── */
.as-status-grid { gap: 14px; }
.as-status-tile {
    padding: 18px 20px;
    display: flex; flex-direction: column; gap: 8px;
    min-height: 140px;
    transition: transform .12s, box-shadow .15s, border-color .15s;
}
.as-status-tile:hover { transform: translateY(-2px); box-shadow: 0 12px 28px -14px rgba(15,42,110,.16); border-color: #cbd5e1; }
.as-status-head { display: flex; align-items: center; gap: 10px; }
.as-status-ic {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0,0,0,.10), inset 0 1px 0 rgba(255,255,255,.18);
}
.as-status-ic svg { width: 18px; height: 18px; }
.as-status-ic.ic-blue   { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.as-status-ic.ic-green  { background: linear-gradient(135deg, #22c55e, #15803d); }
.as-status-ic.ic-orange { background: linear-gradient(135deg, #fb923c, #ea580c); }
.as-status-ic.ic-purple { background: linear-gradient(135deg, #a855f7, #7e22ce); }
.as-status-tile .lbl {
    font-size: 13px;
    font-weight: 700;
    color: var(--as-text-muted);
}
.as-status-tile .val {
    display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
    font-weight: 800;
    color: var(--as-text);
    letter-spacing: -.5px;
}
.as-status-tile .val .amt    { font-size: 26px; }
.as-status-tile .val.val-name { font-size: 18px; line-height: 1.2; word-break: break-word; }
.as-status-tile .val.sub-val  { font-size: 22px; color: var(--as-success); margin-top: -2px; }
.as-status-tile .val .unit   { font-size: 13px; font-weight: 600; color: var(--as-text-muted); margin-left: 1px; }
.as-status-tile .val .chg {
    margin-left: auto;
    font-size: 12.5px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 999px;
    letter-spacing: 0;
}
.as-status-tile .val .chg.up   { background: rgba(16,185,129,.14); color: #047857; }
.as-status-tile .val .chg.down { background: rgba(220,38,38,.10);  color: var(--as-danger); }
.as-status-tile .foot { font-size: 12.5px; color: var(--as-text-muted); margin-top: auto; }
.as-status-tile .foot a { color: var(--as-primary); text-decoration: none; font-weight: 600; }
.as-status-tile .foot a:hover { text-decoration: underline; }
.as-status-tile .foot a.warn { color: var(--as-warn); }
.as-status-tile .foot.up { color: var(--as-success); font-weight: 600; }
.as-status-tile .foot.muted { color: var(--as-text-muted); }

/* ── Chart sub-stats row (Current / Change / High / Low) ─ */
.as-chart-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 14px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid var(--as-border);
    border-radius: 10px;
}
.as-chart-stats > div { min-width: 0; }
.as-chart-stats .lbl {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--as-text-muted);
}
.as-chart-stats .val {
    font-size: 16px;
    font-weight: 800;
    color: var(--as-text);
    margin-top: 2px;
    letter-spacing: -.2px;
}
.as-chart-stats .val .unit { font-size: 11px; font-weight: 600; color: var(--as-text-muted); margin-left: 1px; }
.as-chart-stats .val.up   { color: var(--as-success); }
.as-chart-stats .val.down { color: var(--as-danger); }

/* ── Source pill above chart ────────────────────── */
.as-chart-source-pill {
    display: inline-block;
    background: rgba(29, 78, 216, .08);
    color: var(--as-primary);
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    margin: 4px 0 8px;
}

/* ── Top Price Comparison table (lighter than full table) ── */
.as-tpc thead th {
    font-size: 10.5px;
    padding: 10px 12px;
}
.as-tpc tbody td {
    padding: 12px;
    font-size: 13.5px;
}
.as-tpc tbody tr:hover { background: transparent; }    /* the rows are listy not interactive */
.as-tpc .num.strong { color: var(--as-text); font-weight: 700; }
.as-tpc .chg-up   { color: var(--as-success); font-weight: 700; font-size: 12.5px; }
.as-tpc .chg-down { color: var(--as-danger);  font-weight: 700; font-size: 12.5px; }

/* ── Recent Enquiries: right-side meta column ──── */
.as-enq-meta-right {
    display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
    flex-shrink: 0;
}
.as-enq-meta-right .time {
    font-size: 11.5px;
    color: var(--as-text-muted);
    white-space: nowrap;
}
.as-enq-row .as-enq-avatar {
    background: linear-gradient(135deg, #f97316, #ea580c);   /* warm fill matches the design's EM/BM/CM monograms */
    font-size: 12px;
    width: 38px; height: 38px;
}
/* Cycle color so consecutive rows feel distinct, like the reference */
.as-enq-row:nth-child(2) .as-enq-avatar { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.as-enq-row:nth-child(3) .as-enq-avatar { background: linear-gradient(135deg, #22c55e, #15803d); }
.as-enq-row:nth-child(4) .as-enq-avatar { background: linear-gradient(135deg, #a855f7, #7e22ce); }

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 1100px) {
    .as-status-grid     { grid-template-columns: repeat(2, 1fr); }
    .as-chart-stats     { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
    .as-status-grid     { grid-template-columns: 1fr 1fr; gap: 10px; }
    .as-status-tile     { padding: 14px; min-height: 0; }
    .as-status-tile .val .amt    { font-size: 22px; }
    .as-status-tile .val.val-name { font-size: 15px; }
    .as-status-tile .val.sub-val  { font-size: 18px; }
    .as-status-tile .lbl { font-size: 11.5px; }
    .as-status-tile .foot { font-size: 11.5px; }
    .as-chart-stats     { grid-template-columns: 1fr 1fr; padding: 10px 12px; }
    .as-chart-stats .val { font-size: 14px; }
    .as-tpc tbody td   { padding: 10px 8px; font-size: 12.5px; }
    .as-enq-row .as-enq-avatar { width: 32px; height: 32px; font-size: 11px; }
}

/* ============================================================
   Profile + Settings pages
   ============================================================ */

/* ── Profile layout ───────────────────────────────────── */
.as-profile-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 980px) {
    .as-profile-grid { grid-template-columns: 1fr; }
}

.as-profile-id {
    text-align: center;
    padding: 28px 22px 22px;
    position: sticky;
    top: 84px;
}
@media (max-width: 980px) {
    .as-profile-id { position: static; padding: 22px 18px; }
}
.as-profile-avatar {
    width: 84px; height: 84px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8 60%, #1e3a8a);
    color: #fff;
    font-size: 32px;
    font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 10px 24px rgba(29, 78, 216, .35);
    margin-bottom: 14px;
}
.as-profile-name {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 800;
    color: var(--as-text);
    word-wrap: break-word;
}
.as-profile-email {
    margin: 0 0 14px;
    font-size: 13px;
    color: var(--as-text-muted);
    word-break: break-all;
}
.as-profile-verified {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(16, 185, 129, .12);
    color: #047857;
    font-size: 12px;
    font-weight: 700;
}
.as-profile-verified svg { width: 12px; height: 12px; }
.as-profile-meta {
    list-style: none;
    margin: 18px 0 0;
    padding: 18px 0 0;
    border-top: 1px solid var(--as-border);
    text-align: left;
    display: flex; flex-direction: column;
    gap: 12px;
}
.as-profile-meta li {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; color: var(--as-text);
    word-break: break-word;
}
.as-profile-meta .ic {
    flex-shrink: 0;
    width: 28px; height: 28px;
    border-radius: 8px;
    background: #eff6ff;
    color: var(--as-primary);
    display: inline-flex; align-items: center; justify-content: center;
}
.as-profile-meta .ic svg { width: 14px; height: 14px; }

.as-profile-forms { display: flex; flex-direction: column; gap: 16px; }

/* ── Form grid (used by Profile + Settings) ─────────── */
.as-form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px 16px;
    padding: 16px 20px 4px;
}
.as-form-grid-2 .as-span-2 { grid-column: 1 / -1; }
@media (max-width: 720px) {
    .as-form-grid-2          { grid-template-columns: 1fr; padding: 14px 16px 2px; }
    .as-form-grid-2 .as-span-2 { grid-column: auto; }
}

.as-form-footer {
    display: flex; justify-content: flex-end;
    gap: 10px;
    padding: 12px 20px 18px;
}
@media (max-width: 720px) {
    .as-form-footer { padding: 12px 16px 16px; }
    .as-form-footer .as-btn-primary,
    .as-form-footer .as-btn-ghost { width: 100%; justify-content: center; }
}

/* ── Settings: form layout ──────────────────────────── */
/* The form wraps multiple panels, which breaks .as-main's flex gap.
   Make the form itself a flex column so its children (panels +
   form-footer) get the same vertical rhythm as the rest of the page. */
#asSettingsForm {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
#asSettingsForm .as-form-footer { margin-top: 4px; }

/* ── Settings: toggle list ──────────────────────────── */
.as-toggle-list {
    display: flex; flex-direction: column;
    padding: 6px 4px;
}
.as-toggle-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--as-border);
    cursor: pointer;
}
.as-toggle-row:last-child { border-bottom: none; }
.as-toggle-row .t { font-size: 14px; font-weight: 700; color: var(--as-text); }
.as-toggle-row .s { font-size: 12.5px; color: var(--as-text-muted); margin-top: 2px; line-height: 1.4; }
@media (max-width: 480px) {
    .as-toggle-row .s { font-size: 12px; }
}

/* iOS-style switch */
.as-switch {
    appearance: none;
    -webkit-appearance: none;
    width: 44px; height: 24px;
    border-radius: 999px;
    background: #cbd5e1;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .18s;
    margin: 0;
}
.as-switch::before {
    content: "";
    position: absolute; top: 2px; left: 2px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,.2);
    transition: transform .18s;
}
.as-switch:checked          { background: var(--as-primary); }
.as-switch:checked::before  { transform: translateX(20px); }
.as-switch:focus            { outline: 2px solid rgba(29,78,216,.35); outline-offset: 2px; }

/* ============================================================
   Billing page — responsive polish
   ============================================================ */

.as-billing-current {
    display: flex; align-items: center; justify-content: space-between;
    gap: 24px;
    padding: 22px 24px;
    flex-wrap: wrap;
}
.as-billing-current .as-billing-current-text { flex: 1 1 280px; min-width: 0; }
.as-billing-actions {
    display: flex; gap: 10px; align-items: center;
    flex-shrink: 0;
}

@media (max-width: 720px) {
    .as-billing-current      { flex-direction: column; align-items: stretch; padding: 18px 18px; gap: 16px; }
    .as-billing-actions      { flex-direction: column; align-items: stretch; width: 100%; }
    .as-billing-actions .as-btn-primary,
    .as-billing-actions .as-btn-ghost { width: 100%; justify-content: center; }
    .as-billing-meta         { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .as-billing-current-name { font-size: 22px; flex-wrap: wrap; gap: 8px; }
}
@media (max-width: 480px) {
    .as-billing-meta { grid-template-columns: 1fr 1fr; }
}

/* On mobile the payment-history table needs horizontal scroll, not crush */
@media (max-width: 720px) {
    .as-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ============================================================
   Form helper — invalid fields + inline error messages
   ============================================================ */

.as-form-control.is-invalid,
input.is-invalid, textarea.is-invalid, select.is-invalid {
    border-color: var(--as-danger) !important;
    background: rgba(220, 38, 38, .025);
}
.as-form-control.is-invalid:focus,
input.is-invalid:focus, textarea.is-invalid:focus, select.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .14);
    outline: none;
}

/* Inline field error — quiet single-line note that fades in under the input */
.as-field-error {
    display: none;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--as-danger);
    font-weight: 500;
    animation: as-field-error-in .15s ease-out;
}
.as-form-group:has(.is-invalid) .as-field-error,
.as-field-error:not(:empty) { display: flex; }

.as-field-error::before {
    content: "";
    flex-shrink: 0;
    width: 14px; height: 14px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='M12 8v4'/><path d='M12 16h.01'/></svg>") center/contain no-repeat;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='M12 8v4'/><path d='M12 16h.01'/></svg>") center/contain no-repeat;
}
@keyframes as-field-error-in {
    from { opacity: 0; transform: translateY(-2px); }
    to   { opacity: 1; transform: none; }
}

/* Submit button busy/loading state — shows spinner, hides label */
button.is-busy, .as-btn-primary.is-busy, .as-btn-ghost.is-busy {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}
button.is-busy svg, .as-btn-primary.is-busy svg, .as-btn-ghost.is-busy svg { visibility: hidden; }
button.is-busy::after, .as-btn-primary.is-busy::after, .as-btn-ghost.is-busy::after {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    width: 16px; height: 16px;
    margin: -8px 0 0 -8px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-top-color: transparent;
    color: #fff;
    animation: as-spin .7s linear infinite;
}
.as-btn-ghost.is-busy::after { color: var(--as-text); }
@keyframes as-spin { to { transform: rotate(360deg); } }

/* ============================================================
   Buyer / Marketplace — redesign
   - Same component design across desktop / tablet / mobile
   - AJAX-driven filter bar (no form post)
   - Stat tiles, product cards with View / Compare / RFQ actions
   ============================================================ */

/* ── Filter bar ─────────────────────────────────────── */
.as-mp-filters {
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .04);
    overflow: hidden;        /* hard guard against any child overflowing the rounded card */
}
.as-mp-filter-row {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 1fr 1fr auto;
    gap: 10px;
    align-items: center;
    min-width: 0;
}
/* Grid items default to `min-width: auto` (intrinsic content width). With
   long option labels like "Newest first" or "₹200 – ₹220/kg" the selects
   refuse to shrink below their content width and spill out of the cell.
   Forcing `min-width: 0` lets them collapse to whatever the column gives. */
.as-mp-filter-row > * { min-width: 0; }
.as-mp-search {
    position: relative;
    display: flex; align-items: center;
    background: #f8fafc;
    border: 1px solid var(--as-border);
    border-radius: 10px;
    padding: 0 12px 0 38px;
    min-height: 42px;
    transition: border-color .12s, background .12s;
}
.as-mp-search:focus-within {
    background: #fff;
    border-color: var(--as-primary);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, .12);
}
.as-mp-search > svg {
    position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    color: var(--as-text-muted);
}
.as-mp-search input {
    flex: 1;
    border: none; background: transparent;
    font-size: 14px;
    color: var(--as-text);
    outline: none;
    padding: 8px 0;
}
.as-mp-select {
    min-height: 42px;
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--as-border);
    border-radius: 10px;
    background: #fff
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>")
        no-repeat right 10px center / 14px;
    font-size: 14px;
    color: var(--as-text);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}
.as-mp-select:focus { outline: none; border-color: var(--as-primary); box-shadow: 0 0 0 3px rgba(29, 78, 216, .12); }
.as-mp-clear {
    min-height: 42px;
    padding: 8px 14px;
    background: none;
    border: 1px solid var(--as-border);
    color: var(--as-text);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s, color .12s, border-color .12s;
}
.as-mp-clear:hover { background: rgba(220,38,38,.06); border-color: rgba(220,38,38,.25); color: var(--as-danger); }

/* ── Stat tiles ─────────────────────────────────────── */
.as-mp-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}
.as-mp-stat {
    display: flex; align-items: center; gap: 14px;
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 16px;
    padding: 18px 18px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .04);
    min-width: 0;            /* let content shrink in narrow grid cells */
    overflow: hidden;        /* hard guard against any overflowing val/sub */
}
/* The inner wrapper (no class) is a flex item — needs `min-width: 0` so
   long values like "Visible to buyers" or "Total received" can ellipsis
   instead of forcing the whole tile wider than its grid cell. */
.as-mp-stat > div { min-width: 0; flex: 1 1 auto; }
.as-mp-stat .ic {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.as-mp-stat .ic svg { width: 22px; height: 22px; }
.as-mp-stat .ic.ic-blue   { background: linear-gradient(135deg, #dbeafe, #bfdbfe); }
.as-mp-stat .ic.ic-blue   svg { color: var(--as-primary); }
.as-mp-stat .ic.ic-green  { background: linear-gradient(135deg, #d1fae5, #a7f3d0); }
.as-mp-stat .ic.ic-green  svg { color: #047857; }
.as-mp-stat .ic.ic-orange { background: linear-gradient(135deg, #fef3c7, #fde68a); }
.as-mp-stat .ic.ic-orange svg { color: #d97706; }
.as-mp-stat .ic.ic-purple { background: linear-gradient(135deg, #ede9fe, #ddd6fe); }
.as-mp-stat .ic.ic-purple svg { color: #7e22ce; }
.as-mp-stat .ic.ic-yellow { background: linear-gradient(135deg, #fef9c3, #fef08a); }
.as-mp-stat .ic.ic-yellow svg { color: #a16207; }
.as-mp-stat .lbl { font-size: 12.5px; font-weight: 600; color: var(--as-text-muted); }
.as-mp-stat .val { font-size: 22px; font-weight: 800; color: var(--as-text); margin: 2px 0; line-height: 1.1; }
.as-mp-stat .val .unit { font-size: 13px; color: var(--as-text-muted); margin-left: 2px; font-weight: 600; }
.as-mp-stat .sub { font-size: 12px; color: var(--as-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Product grid ───────────────────────────────────── */
.as-mp-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    transition: opacity .15s;
}
.as-mp-grid.is-loading { opacity: .55; pointer-events: none; }

.as-mp-card {
    display: flex; flex-direction: column;
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 16px;
    overflow: hidden;
    transition: box-shadow .15s, transform .15s, border-color .15s;
}
.as-mp-card:hover {
    box-shadow: 0 12px 28px -10px rgba(15, 23, 42, .14);
    transform: translateY(-2px);
    border-color: #cbd5e1;
}

.as-mp-card-img {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #f1f5f9;
    overflow: hidden;
}
.as-mp-card-img img {
    width: 100%; height: 100%; object-fit: cover;
    display: block;
}
.as-mp-card-img-fallback {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: #94a3b8;
}
.as-mp-card-img-fallback svg { width: 48px; height: 48px; }
.as-mp-verified {
    position: absolute; top: 10px; left: 10px; z-index: 2;
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px;
    background: rgba(16, 185, 129, .92);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .2px;
    border-radius: 999px;
    backdrop-filter: blur(4px);
}
.as-mp-verified svg { width: 11px; height: 11px; }
.as-mp-fav {
    position: absolute; top: 10px; right: 10px; z-index: 2;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,.92);
    border: none;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--as-text-muted);
    backdrop-filter: blur(4px);
    transition: color .12s, background .12s;
}
.as-mp-fav:hover { color: var(--as-danger); background: #fff; }
.as-mp-fav svg { width: 16px; height: 16px; transition: transform .15s; }
.as-mp-fav:disabled { opacity: .55; cursor: wait; }
/* "Liked" state — filled red heart with a tiny pop animation. */
.as-mp-fav.is-on { color: var(--as-danger); background: #fff; }
.as-mp-fav.is-on svg {
    fill: currentColor;
    stroke: currentColor;
    animation: as-fav-pop .25s ease-out;
}
@keyframes as-fav-pop {
    0%   { transform: scale(.7); }
    50%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.as-mp-card-body {
    padding: 14px 14px 14px;
    display: flex; flex-direction: column;
    gap: 6px;
    flex: 1;
}
.as-mp-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--as-text);
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}
.as-mp-card-grade {
    font-size: 12px;
    color: var(--as-text-muted);
    font-weight: 500;
}
.as-mp-card-price {
    font-size: 18px;
    font-weight: 800;
    color: #16a34a;
    line-height: 1;
    margin-top: 2px;
}
.as-mp-card-price .unit {
    font-size: 12.5px;
    color: var(--as-text-muted);
    font-weight: 600;
    margin-left: 2px;
}
.as-mp-card-min {
    font-size: 12.5px;
    color: var(--as-text-muted);
}
.as-mp-card-loc {
    display: flex; align-items: center; gap: 4px;
    font-size: 12.5px;
    color: var(--as-text);
    margin-top: 2px;
}
.as-mp-card-loc svg { width: 12px; height: 12px; color: var(--as-primary); flex-shrink: 0; }
.as-mp-card-supplier {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}
.as-mp-card-supplier .dot { width: 6px; height: 6px; border-radius: 50%; background: #10b981; flex-shrink: 0; }
.as-mp-card-supplier .name {
    flex: 1; min-width: 0;
    font-weight: 600;
    color: var(--as-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.as-mp-card-supplier .rating {
    display: inline-flex; align-items: center; gap: 4px;
    color: #d97706;
    font-weight: 700;
    flex-shrink: 0;
    font-size: 11.5px;
}
.as-mp-card-supplier .rating .rating-num   { color: var(--as-text); }
.as-mp-card-supplier .rating .rating-count { color: var(--as-text-muted); font-weight: 600; }
.as-mp-card-supplier .rating.muted-soft    { color: var(--as-text-muted); font-weight: 600; }

/* Small-size star display variant for cards */
.as-stars-display.as-stars-sm {
    font-size: 12px;
    letter-spacing: 1px;
}
.as-mp-card-actions {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 6px;
    margin-top: 10px;
}
.as-mp-card-actions .as-btn-ghost,
.as-mp-card-actions .as-btn-primary {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 8px;
    justify-content: center;
}

.as-mp-empty {
    grid-column: 1 / -1;
    text-align: center;
    background: #fff;
    border: 1px dashed var(--as-border);
    border-radius: 14px;
    padding: 40px 20px;
}

/* ── Pagination row ─────────────────────────────────── */
.as-mp-pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 12px;
    margin: 8px 0 4px;
    flex-wrap: wrap;
}
.as-mp-pagination:empty { display: none; }
.as-mp-pagination .as-pg-btn {
    padding: 8px 16px;
    border: 1px solid var(--as-border);
    background: #fff;
    color: var(--as-text);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}
.as-mp-pagination .as-pg-btn:disabled { opacity: .4; cursor: not-allowed; }
.as-mp-pagination .as-pg-btn:hover:not(:disabled) { background: #f8fafc; border-color: #cbd5e1; }
.as-mp-pagination .as-pg-info { font-size: 13px; color: var(--as-text-muted); }

/* ── Trust strip ────────────────────────────────────── */
.as-mp-trust {
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 16px;
    padding: 14px 18px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .04);
}
.as-mp-trust-item {
    display: flex; align-items: center; gap: 10px;
}
.as-mp-trust-item .ic {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.as-mp-trust-item .ic svg { width: 18px; height: 18px; }
.as-mp-trust-item .ic.ic-blue   { background: #dbeafe; }
.as-mp-trust-item .ic.ic-blue   svg { color: var(--as-primary); }
.as-mp-trust-item .ic.ic-green  { background: #d1fae5; }
.as-mp-trust-item .ic.ic-green  svg { color: #047857; }
.as-mp-trust-item .ic.ic-orange { background: #fed7aa; }
.as-mp-trust-item .ic.ic-orange svg { color: #ea580c; }
.as-mp-trust-item .ic.ic-yellow { background: #fef9c3; }
.as-mp-trust-item .ic.ic-yellow svg { color: #a16207; }
.as-mp-trust-item .ic.ic-purple { background: #ede9fe; }
.as-mp-trust-item .ic.ic-purple svg { color: #7e22ce; }
.as-mp-trust-item .t { font-size: 13px; font-weight: 700; color: var(--as-text); }
.as-mp-trust-item .s { font-size: 12px; color: var(--as-text-muted); margin-top: 1px; line-height: 1.35; }

/* ── Responsive: collapse columns at common breakpoints ─ */
@media (max-width: 1280px) {
    .as-mp-grid { grid-template-columns: repeat(4, 1fr); }
    .as-mp-trust { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1024px) {
    .as-mp-filter-row { grid-template-columns: repeat(3, 1fr) auto; }
    .as-mp-search { grid-column: 1 / -1; }
    .as-mp-stats { grid-template-columns: repeat(2, 1fr); }
    .as-mp-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
    .as-mp-filter-row { grid-template-columns: 1fr 1fr; gap: 8px; }
    .as-mp-search { grid-column: 1 / -1; }
    .as-mp-clear { grid-column: 1 / -1; }
    /* Smaller padding so the chevron + option text still fit in the narrow cell */
    .as-mp-select {
        padding: 8px 28px 8px 10px;
        font-size: 13px;
        background-position: right 8px center;
        text-overflow: ellipsis;
    }
    .as-mp-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .as-mp-stat { padding: 14px 12px; gap: 10px; }
    .as-mp-stat .ic { width: 40px; height: 40px; }
    .as-mp-stat .ic svg { width: 18px; height: 18px; }
    .as-mp-stat .val { font-size: 18px; }
    .as-mp-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .as-mp-card-title { font-size: 13.5px; }
    .as-mp-card-price { font-size: 15px; }
    .as-mp-card-actions { grid-template-columns: 1fr 1fr; gap: 5px; }
    .as-mp-card-actions .as-btn-ghost.xs:nth-child(2) { display: none; }
    .as-mp-card-actions .as-btn-ghost,
    .as-mp-card-actions .as-btn-primary {
        padding: 6px 4px;
        font-size: 11.5px;
        white-space: nowrap;
        min-width: 0;
    }
    /* Supplier rating row gets squeezed on 2-up cards — drop review count
       and shrink number so stars + name fit on one line. */
    .as-mp-card-supplier { font-size: 11px; gap: 4px; }
    .as-mp-card-supplier .rating { font-size: 10.5px; gap: 3px; }
    .as-mp-card-supplier .rating .rating-count { display: none; }
    .as-mp-card-supplier .as-stars-display.as-stars-sm { font-size: 10px; letter-spacing: .5px; }
    .as-mp-trust { grid-template-columns: 1fr; gap: 10px; padding: 14px; }
}
@media (max-width: 480px) {
    /* Stack filters one per row on the smallest phones — 2-up cells were
       tight enough that long select labels truncated awkwardly. */
    .as-mp-filter-row { grid-template-columns: 1fr; }
    .as-mp-search    { grid-column: 1; }
    .as-mp-clear     { grid-column: 1; }
}
@media (max-width: 420px) {
    .as-mp-grid { grid-template-columns: 1fr; }
    .as-mp-card { flex-direction: row; }
    .as-mp-card-img { aspect-ratio: 1; flex: 0 0 130px; }
    .as-mp-card-body { padding: 12px; }
}

/* ============================================================
   Product Detail page — redesigned to match the reference
   Same layout/components on desktop, tablet and mobile.
   ============================================================ */

.as-pd-back {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--as-text);
    font-weight: 600;
    font-size: 13.5px;
    text-decoration: none;
    margin-bottom: 4px;
    transition: color .12s;
}
.as-pd-back:hover { color: var(--as-primary); }
.as-pd-back svg   { width: 14px; height: 14px; }

.as-pd-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 22px;
}

/* ── Media (left) ─────────────────────────────── */
.as-pd-media { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.as-pd-stage {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #f1f5f9;
    border: 1px solid var(--as-border);
    border-radius: 18px;
    overflow: hidden;
}
.as-pd-stage img,
.as-pd-stage-fallback {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.as-pd-stage-fallback {
    display: flex; align-items: center; justify-content: center;
    color: #94a3b8;
}
.as-pd-stage-fallback svg { width: 96px; height: 96px; }

.as-pd-verified {
    position: absolute; top: 14px; left: 14px; z-index: 2;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px;
    background: #16a34a;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(22, 163, 74, .35);
}
.as-pd-verified svg { width: 12px; height: 12px; }

.as-pd-fav {
    position: absolute; top: 14px; right: 14px; z-index: 2;
    width: 38px; height: 38px;
    border-radius: 50%;
    background: #fff;
    border: none;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--as-text-muted);
    box-shadow: 0 4px 12px rgba(15, 23, 42, .15);
    transition: color .12s, transform .12s;
}
.as-pd-fav:hover { color: var(--as-danger); transform: scale(1.05); }
.as-pd-fav svg { width: 18px; height: 18px; }

.as-pd-nav {
    position: absolute; top: 50%;
    transform: translateY(-50%);
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .94);
    border: none;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--as-text);
    z-index: 2;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 14px rgba(15, 23, 42, .18);
    transition: background .12s, transform .12s;
}
.as-pd-nav:hover { background: #fff; transform: translateY(-50%) scale(1.06); }
.as-pd-nav svg   { width: 18px; height: 18px; }
.as-pd-nav.prev  { left: 14px; }
.as-pd-nav.next  { right: 14px; }

.as-pd-dots {
    position: absolute; bottom: 14px; left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 6px;
    z-index: 2;
}
.as-pd-dots .dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .5);
    cursor: pointer;
    transition: background .12s, width .12s;
}
.as-pd-dots .dot.is-active {
    background: #fff;
    width: 22px;
    border-radius: 999px;
}

.as-pd-thumbs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.as-pd-thumb {
    background: #f1f5f9;
    border: 2px solid transparent;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 1;
    cursor: pointer;
    padding: 0;
    transition: border-color .12s, transform .12s;
}
.as-pd-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.as-pd-thumb-fallback {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: #cbd5e1;
}
.as-pd-thumb-fallback svg { width: 28px; height: 28px; }
.as-pd-thumb.is-active {
    border-color: var(--as-primary);
    box-shadow: 0 0 0 2px rgba(29, 78, 216, .12);
}
.as-pd-thumb:hover:not(.is-active) { border-color: #cbd5e1; }

/* ── Info (right) ─────────────────────────────── */
.as-pd-info { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.as-pd-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.as-pd-tags .as-chip {
    padding: 5px 12px;
    border: 1px solid var(--as-border);
    background: #fff;
    color: var(--as-text);
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
}

.as-pd-title {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    line-height: 1.15;
    color: var(--as-text);
    letter-spacing: -.4px;
}

.as-pd-price {
    display: flex; align-items: baseline; gap: 4px;
    margin: 4px 0;
}
.as-pd-price .num {
    font-size: 38px;
    font-weight: 800;
    color: #16a34a;
    line-height: 1;
    letter-spacing: -.5px;
}
.as-pd-price .unit {
    font-size: 16px;
    color: var(--as-text-muted);
    font-weight: 600;
}

.as-pd-price-pills {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-bottom: 4px;
}
.as-pd-price-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
}
.as-pd-price-pill svg { width: 12px; height: 12px; }
.as-pd-price-pill.is-good { background: rgba(22, 163, 74, .10); color: #15803d; }
.as-pd-price-pill.is-warn { background: rgba(220, 38, 38, .10); color: var(--as-danger); }
.as-pd-price-pill.is-info { background: rgba(29, 78, 216, .10); color: var(--as-primary); }

.as-pd-specs {
    border: 1px solid var(--as-border);
    border-radius: 14px;
    padding: 6px 18px;
    background: #fff;
}
.as-pd-specs .row {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    align-items: center;
    font-size: 13.5px;
}
.as-pd-specs .row:last-child { border-bottom: none; }
.as-pd-specs .lbl { color: var(--as-text-muted); font-weight: 500; }
.as-pd-specs .val {
    color: var(--as-text);
    font-weight: 700;
    display: inline-flex; align-items: center; gap: 8px;
    flex-wrap: wrap;
}
.as-pd-specs .val svg { width: 16px; height: 16px; color: var(--as-text-muted); }

.as-pd-verified-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px;
    background: rgba(22, 163, 74, .12);
    color: #15803d;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}
.as-pd-verified-pill svg { width: 11px; height: 11px; }

.as-pd-desc {
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 14px;
    padding: 16px 18px;
}
.as-pd-desc h3 {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 800;
    color: var(--as-text);
}
.as-pd-desc p {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--as-text);
}

/* ── Action buttons grid (Send Enquiry / Chat / Compare / AI) ── */
.as-pd-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.as-pd-actions .as-btn-primary,
.as-pd-actions .as-btn-ghost {
    min-height: 46px;
    padding: 11px 16px;
    font-size: 13.5px;
    border-radius: 11px;
    justify-content: center;
}
.as-pd-actions .as-pd-action-primary { grid-column: 1 / -1; min-height: 50px; font-size: 14.5px; }
/* Owner view = only Edit + Delete. Stack them as two full-width buttons so
   neither is left dangling in a half-row of empty grid space. */
.as-pd-actions.is-owner { grid-template-columns: 1fr 1fr; }
.as-pd-actions.is-owner .as-btn-primary,
.as-pd-actions.is-owner .as-btn-ghost { width: 100%; }
@media (max-width: 480px) {
    .as-pd-actions.is-owner { grid-template-columns: 1fr; }
}

/* ── Supplier card ────────────────────────────── */
.as-pd-supplier { padding: 18px 20px; }
.as-pd-supplier-head h3 {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 800;
    color: var(--as-text);
}
.as-pd-supplier-body {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(0, 1fr)) auto;
    gap: 18px 24px;
    align-items: center;
}
.as-pd-supplier-id {
    display: flex; align-items: center; gap: 12px;
    min-width: 0;
}
.as-pd-supplier-id .avatar {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #b45309;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800;
    font-size: 18px;
    flex-shrink: 0;
}
.as-pd-supplier-id .name {
    font-size: 15px;
    font-weight: 800;
    color: var(--as-text);
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap;
}
.as-pd-supplier-id .rating {
    font-size: 12.5px;
    color: var(--as-text-muted);
    margin-top: 2px;
}
.as-pd-supplier-id .rating .stars { color: #d97706; font-weight: 700; }
.as-pd-supplier-stat { text-align: center; }
.as-pd-supplier-stat .num {
    font-size: 22px;
    font-weight: 800;
    color: var(--as-text);
    line-height: 1;
}
.as-pd-supplier-stat .lbl {
    font-size: 11.5px;
    color: var(--as-text-muted);
    margin-top: 4px;
    font-weight: 600;
}
.as-pd-supplier-cta {
    min-height: 42px;
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 10px;
    white-space: nowrap;
}

/* ── Specs card (full width) ──────────────────── */
.as-pd-specs-card { padding: 18px 20px; }
.as-pd-specs-card h3 {
    margin: 0 0 14px;
    font-size: 16px;
    font-weight: 800;
    color: var(--as-text);
}
.as-pd-specs-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px 30px;
}
.as-pd-specs-grid .cell {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 10px;
    padding: 8px 0;
    align-items: center;
    font-size: 13.5px;
    border-bottom: 1px solid #f1f5f9;
}
.as-pd-specs-grid .cell .lbl { color: var(--as-text-muted); font-weight: 500; }
.as-pd-specs-grid .cell .val { color: var(--as-text); font-weight: 700; }

/* ── Related products row ─────────────────────── */
.as-pd-related-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px;
}
.as-pd-related-head h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: var(--as-text);
}
.as-pd-related-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
}
.as-pd-related-card {
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    display: flex; flex-direction: column;
    transition: box-shadow .15s, transform .15s;
}
.as-pd-related-card:hover { box-shadow: 0 10px 22px -10px rgba(15, 23, 42, .14); transform: translateY(-2px); }
.as-pd-related-img {
    aspect-ratio: 4 / 3;
    background: #f1f5f9;
    overflow: hidden;
}
.as-pd-related-img img { width: 100%; height: 100%; object-fit: cover; }
.as-pd-related-fallback {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: #94a3b8;
}
.as-pd-related-fallback svg { width: 32px; height: 32px; }
.as-pd-related-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.as-pd-related-body .title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--as-text);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}
.as-pd-related-body .price { font-size: 14px; font-weight: 800; color: #16a34a; }
.as-pd-related-body .price .unit { font-size: 11px; color: var(--as-text-muted); margin-left: 2px; }
.as-pd-related-body .loc {
    display: flex; align-items: center; gap: 4px;
    font-size: 11.5px; color: var(--as-text-muted);
    white-space: nowrap; overflow: hidden;
}
.as-pd-related-body .loc svg { width: 11px; height: 11px; flex-shrink: 0; color: var(--as-primary); }

/* ── Responsive: keep the same components, restack at breakpoints ── */
@media (max-width: 1280px) {
    .as-pd-related-row { grid-template-columns: repeat(4, 1fr); }
    .as-pd-supplier-body { gap: 14px 18px; }
}
@media (max-width: 1024px) {
    .as-pd-grid { grid-template-columns: 1fr; gap: 18px; }
    .as-pd-stage { aspect-ratio: 16 / 11; }
    .as-pd-related-row { grid-template-columns: repeat(3, 1fr); }
    .as-pd-supplier-body { grid-template-columns: 1fr 1fr 1fr; }
    .as-pd-supplier-cta { grid-column: 1 / -1; }
    .as-pd-specs-grid { grid-template-columns: repeat(2, 1fr); gap: 6px 24px; }
}
@media (max-width: 720px) {
    .as-pd-back { font-size: 13px; }
    .as-pd-title { font-size: 22px; }
    .as-pd-price .num { font-size: 28px; }
    .as-pd-price .unit { font-size: 14px; }
    .as-pd-stage { aspect-ratio: 1 / 1; border-radius: 14px; touch-action: pan-y; }
    /* Mobile: turn the thumb strip into a horizontal swipeable rail —
       previously hidden, but the user needs a way to see other images. */
    .as-pd-thumbs {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        scrollbar-width: thin;
    }
    .as-pd-thumbs::-webkit-scrollbar { height: 4px; }
    .as-pd-thumbs::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
    .as-pd-thumb {
        flex: 0 0 64px;
        width: 64px;
        scroll-snap-align: start;
    }
    /* Nav arrows: shown again on mobile (smaller) so users can tap to navigate */
    .as-pd-nav { width: 34px; height: 34px; display: inline-flex; }
    .as-pd-nav svg { width: 14px; height: 14px; }
    .as-pd-nav.prev { left: 8px; }
    .as-pd-nav.next { right: 8px; }
    .as-pd-specs { padding: 4px 14px; }
    .as-pd-specs .row { grid-template-columns: 110px 1fr; font-size: 13px; padding: 8px 0; }
    .as-pd-actions { grid-template-columns: 1fr 1fr; }
    .as-pd-supplier-body {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    .as-pd-supplier-id { grid-column: 1 / -1; }
    .as-pd-supplier-cta { grid-column: 1 / -1; justify-content: center; }
    .as-pd-specs-grid { grid-template-columns: 1fr; gap: 4px; }
    .as-pd-specs-grid .cell { grid-template-columns: 120px 1fr; }
    .as-pd-related-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
@media (max-width: 420px) {
    .as-pd-actions { grid-template-columns: 1fr; }
    .as-pd-actions .as-pd-action-primary { grid-column: auto; }
    .as-pd-related-row { grid-template-columns: 1fr; }
}

/* ============================================================
   Seller / My Products extras
   ============================================================ */

.as-mp-status {
    position: absolute; top: 10px; left: 10px; z-index: 2;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: capitalize;
    letter-spacing: .2px;
    backdrop-filter: blur(4px);
}
.as-mp-status.as-mp-status-active   { background: rgba(16, 185, 129, .92); color: #fff; }
.as-mp-status.as-mp-status-inactive { background: rgba(100, 116, 139, .92); color: #fff; }
.as-mp-status.as-mp-status-sold     { background: rgba(220, 38, 38, .92); color: #fff; }

.as-my-meta {
    display: flex; gap: 12px;
    font-size: 11.5px;
    color: var(--as-text-muted);
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}
.as-my-meta .ic { display: inline-flex; align-items: center; gap: 4px; }
.as-my-meta .ic svg { width: 12px; height: 12px; flex-shrink: 0; color: var(--as-primary); }

/* Three-button action row on seller cards (View / Edit / Delete) */
.as-my-card .as-mp-card-actions { grid-template-columns: 1fr 1fr 1fr; }

/* ============================================================
   Product Add/Edit form — redesigned (matches detail page look)
   ============================================================ */

.as-pf-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 18px;
    margin-bottom: 18px;
}
.as-pf-left, .as-pf-right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.as-pf-card { padding: 18px 20px; }
.as-pf-card-head {
    margin-bottom: 14px;
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.as-pf-card-head h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: var(--as-text);
}
.as-pf-card-sub {
    font-size: 12.5px;
    color: var(--as-text-muted);
}

.as-pf-card .as-form-group { margin-bottom: 12px; }
.as-pf-card .as-form-group:last-child { margin-bottom: 0; }
.as-pf-card .as-form-label .req { color: var(--as-danger); margin-left: 2px; }
.as-pf-card .as-form-label .muted-soft { color: var(--as-text-muted); font-weight: 500; }
.as-pf-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}
.as-pf-row .as-form-group { margin: 0; }
.as-pf-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* Sticky save bar */
.as-pf-actions {
    display: flex; gap: 10px; justify-content: flex-end;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 14px;
    position: sticky;
    bottom: 12px;
    z-index: 5;
    box-shadow: 0 6px 18px -8px rgba(15, 23, 42, .14);
}

/* ── Multi-image picker ─────────────────────────── */
.as-img-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}
.as-img-list {
    list-style: none;
    margin: 0; padding: 0;
    display: contents;
}
.as-img-item {
    position: relative;
    aspect-ratio: 1;
    background: #f1f5f9;
    border: 1px solid var(--as-border);
    border-radius: 12px;
    overflow: hidden;
}
.as-img-item img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.as-img-cover {
    position: absolute; top: 6px; left: 6px;
    padding: 2px 8px;
    background: var(--as-primary);
    color: #fff;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .3px;
}
.as-img-remove {
    position: absolute; top: 6px; right: 6px;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: rgba(220, 38, 38, .92);
    color: #fff;
    border: none;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: transform .12s, background .12s;
}
.as-img-remove svg { width: 12px; height: 12px; }
.as-img-remove:hover { background: var(--as-danger); transform: scale(1.05); }

.as-img-drop {
    aspect-ratio: 1;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px;
    text-align: center;
    cursor: pointer;
    color: var(--as-text-muted);
    transition: border-color .12s, background .12s, color .12s;
    padding: 10px;
}
.as-img-drop .ic {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #e0e7ff;
    color: var(--as-primary);
    display: inline-flex; align-items: center; justify-content: center;
}
.as-img-drop .ic svg { width: 18px; height: 18px; }
.as-img-drop .t {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--as-text);
}
.as-img-drop .s {
    font-size: 11.5px;
    color: var(--as-text-muted);
    line-height: 1.35;
}
.as-img-drop:hover, .as-img-drop.is-over {
    border-color: var(--as-primary);
    background: #eff6ff;
    color: var(--as-primary);
}
.as-img-drop.is-error {
    border-color: var(--as-danger);
    background: rgba(220, 38, 38, .04);
    animation: as-shake .35s;
}
.as-img-drop.is-full {
    opacity: .55; cursor: not-allowed; pointer-events: none;
}
@keyframes as-shake {
    0%,100% { transform: translateX(0); }
    25%     { transform: translateX(-4px); }
    50%     { transform: translateX(4px); }
    75%     { transform: translateX(-2px); }
}

/* Responsive */
@media (max-width: 1024px) {
    .as-pf-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .as-pf-row { grid-template-columns: 1fr; }
    .as-pf-row.cols-3 { grid-template-columns: 1fr; }
    .as-pf-actions {
        position: sticky; bottom: 0;
        border-radius: 12px 12px 0 0;
        margin: 0 -8px;
    }
    .as-pf-actions .as-btn-ghost,
    .as-pf-actions .as-btn-primary { flex: 1; justify-content: center; }
}

/* ============================================================
   Admin · Plans table + module catalog grid
   ============================================================ */

/* Plan-row name cell on the plans table */
.as-plan-row-name { display: flex; align-items: center; gap: 10px; }
.as-plan-color-dot {
    flex-shrink: 0;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--as-primary);
}
.as-plan-color-dot.color-blue   { background: #2563eb; }
.as-plan-color-dot.color-purple { background: #a855f7; }
.as-plan-color-dot.color-green  { background: #16a34a; }
.as-plan-color-dot.color-orange { background: #ea580c; }
.as-plan-color-dot.color-red    { background: #dc2626; }
.as-plan-color-dot.color-slate  { background: #64748b; }

/* Module catalog grid in the plan form */
.as-mod-group { padding: 8px 18px 14px; }
.as-mod-group + .as-mod-group { border-top: 1px solid #f1f5f9; }
.as-mod-group-head {
    margin: 6px 0 10px;
    font-size: 12px;
    font-weight: 800;
    color: var(--as-text-muted);
    letter-spacing: 1.2px;
    text-transform: uppercase;
}
.as-mod-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 16px;
}
.as-mod-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid var(--as-border);
    border-radius: 10px;
}
.as-mod-info { flex: 1; min-width: 0; }
.as-mod-label {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--as-text);
}
.as-mod-desc {
    font-size: 11.5px;
    color: var(--as-text-muted);
    margin-top: 2px;
    line-height: 1.4;
}
.as-mod-controls {
    display: flex; align-items: center; gap: 8px;
    flex-shrink: 0;
}
.as-mod-cap {
    width: 88px;
    min-height: 36px;
    padding: 6px 10px;
    font-size: 13px;
    text-align: center;
}
.as-mod-cap:disabled {
    background: #f1f5f9;
    color: #cbd5e1;
    cursor: not-allowed;
}

@media (max-width: 720px) {
    .as-mod-list { grid-template-columns: 1fr; }
    .as-mod-row { padding: 10px; }
    .as-mod-cap { width: 76px; }
}

/* ============================================================
   Responsive table-to-card pattern
   ------------------------------------------------------------
   Add `.as-table-cards` to any <table> to get desktop table /
   mobile card view. Each <td> needs a `data-label="..."` attr
   so the card can show "Label: value" stacked on phones.
   ============================================================ */
@media (max-width: 720px) {
    .as-table-cards { border-collapse: separate; border-spacing: 0; }
    .as-table-cards thead              { display: none; }
    .as-table-cards tbody              { display: flex; flex-direction: column; gap: 10px; }
    .as-table-cards tr {
        display: flex; flex-direction: column;
        gap: 6px;
        padding: 14px;
        background: #fff;
        border: 1px solid var(--as-border);
        border-radius: 12px;
        box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
    }
    .as-table-cards tr:hover { background: #fff; }
    .as-table-cards td {
        display: flex; align-items: flex-start; justify-content: space-between;
        gap: 12px;
        padding: 4px 0 !important;
        border: none !important;
        font-size: 13px;
        text-align: right;
    }
    .as-table-cards td::before {
        content: attr(data-label);
        flex-shrink: 0;
        flex-basis: 38%;
        font-size: 11.5px;
        font-weight: 600;
        color: var(--as-text-muted);
        text-transform: uppercase;
        letter-spacing: .5px;
        text-align: left;
        padding-top: 1px;
    }
    .as-table-cards td:empty,
    .as-table-cards td[data-label=""] { display: none; }
    /* No label = full-width row (used for action buttons) */
    .as-table-cards td.actions {
        text-align: center;
        padding-top: 8px !important;
        margin-top: 4px;
        border-top: 1px solid #f1f5f9 !important;
        gap: 6px;
    }
    .as-table-cards td.actions::before { display: none; }
    .as-table-cards td.actions .as-btn-ghost,
    .as-table-cards td.actions .as-btn-primary,
    .as-table-cards td.actions a,
    .as-table-cards td.actions button {
        flex: 1;
    }
    /* Outer wrapper doesn't scroll on mobile in this mode */
    .as-table-wrap:has(.as-table-cards) { overflow: visible; }
}

/* ============================================================
   Reports — locked export button + responsive trend chart
   ============================================================ */
.as-btn-ghost.is-locked {
    color: var(--as-text-muted);
    background: #f8fafc;
    border-style: dashed;
}
.as-btn-ghost.is-locked:hover {
    background: #eff6ff;
    color: var(--as-primary, #1d4ed8);
    border-color: var(--as-primary, #1d4ed8);
    border-style: solid;
}
.as-pro-pill {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    padding: 2px 7px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(135deg, #f59e0b, #b45309);
    border-radius: 999px;
    line-height: 1.4;
}

/* Trend chart on mobile — let SVG scale; reduce height a bit */
@media (max-width: 720px) {
    .as-trend-chart svg { height: 220px; }
    .as-chart-legend   { flex-wrap: wrap; gap: 8px; font-size: 11.5px; }

    /* Reports stat-grid: 2 columns instead of 4 */
    .as-stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .as-report-tile { padding: 14px; }
    .as-report-tile .val { font-size: 18px; }
    .as-report-tile .val.val-sm { font-size: 14px; }

    /* Donut row stacks under the panel head on phones */
    .as-donut-row { flex-direction: column; align-items: stretch; }
    .as-donut-multi { margin: 0 auto; }
}
@media (max-width: 480px) {
    .as-stat-grid { grid-template-columns: 1fr; }
    .as-report-tile .as-spark { display: none; }   /* free up vertical space */
}

/* ============================================================
   Dashboard plan + usage strip
   ============================================================ */
.as-plan-strip { padding: 18px 22px; }
.as-plan-strip-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.as-plan-strip-head-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
/* Chevron is decorative on desktop (full strip always open); only matters on mobile */
.as-plan-strip-chev {
    display: none;
    width: 18px; height: 18px;
    color: var(--as-text-muted);
    transition: transform .2s;
    flex-shrink: 0;
}
.as-plan-strip.is-collapsed .as-plan-strip-chev { transform: rotate(-90deg); }
.as-plan-strip-eyebrow {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--as-text-muted);
}
.as-plan-strip-name {
    margin: 4px 0 0;
    font-size: 19px;
    font-weight: 800;
    color: var(--as-text);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.as-plan-strip-badge {
    background: #f1f5f9;
    color: var(--as-text-muted);
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .5px;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
}
.as-plan-strip-meters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}
.as-plan-meter-row {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 8px; margin-bottom: 6px;
}
.as-plan-meter-row .lbl { font-size: 12px; color: var(--as-text-muted); font-weight: 600; }
.as-plan-meter-row .val { font-size: 13.5px; font-weight: 700; color: var(--as-text); }
.as-plan-meter-bar {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: #f1f5f9;
    overflow: hidden;
}
.as-plan-meter-bar > span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    transition: width .3s ease;
}
.as-plan-meter.is-warn   .as-plan-meter-bar > span { background: linear-gradient(90deg, #f59e0b, #d97706); }
.as-plan-meter.is-danger .as-plan-meter-bar > span { background: linear-gradient(90deg, #ef4444, #b91c1c); }
.as-plan-meter.is-danger .as-plan-meter-row .val   { color: var(--as-danger, #dc2626); }

/* Mobile: collapse the meters by default. Tap on the head to expand.
   Chevron + cursor only appear on mobile so it's clearly tappable. */
@media (max-width: 720px) {
    .as-plan-strip { padding: 14px 16px; }
    .as-plan-strip-head { margin-bottom: 0; row-gap: 10px; }
    .as-plan-strip.is-collapsed .as-plan-strip-meters { display: none; }
    .as-plan-strip:not(.is-collapsed) .as-plan-strip-head { margin-bottom: 14px; }
    .as-plan-strip-head-main {
        cursor: pointer;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
    .as-plan-strip-chev { display: inline-block; }
}

/* ============================================================
   Chat — presence dot, typing indicator, quick replies
   ============================================================ */
/* Avatar with a small bottom-right status dot */
.as-presence-avatar { position: relative; }
.as-presence-dot {
    position: absolute;
    bottom: -1px; right: -1px;
    width: 11px; height: 11px;
    border-radius: 50%;
    background: #cbd5e1;
    border: 2px solid #fff;
    transition: background .2s;
}
.as-presence-dot.is-online { background: #22c55e; }
.as-chat-presence-status {
    font-size: 11.5px;
    color: var(--as-text-muted);
}
.as-chat-presence-status:not(:empty) ~ .ref::before,
.as-chat-presence-status:not(:empty) + span::before { content: '· '; margin: 0 4px; }

/* Typing indicator row (sits between thread and input) */
.as-chat-typing {
    display: flex; align-items: flex-end; gap: 8px;
    padding: 6px 16px 4px;
}
.as-chat-typing[hidden] { display: none; }
.as-typing-bubble {
    display: inline-flex;
    gap: 4px;
    padding: 10px 14px;
    background: #f1f5f9;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}
.as-typing-bubble .dot {
    width: 6px; height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: as-typing-bounce 1.4s infinite ease-in-out both;
}
.as-typing-bubble .dot:nth-child(2) { animation-delay: .15s; }
.as-typing-bubble .dot:nth-child(3) { animation-delay: .30s; }
@keyframes as-typing-bounce {
    0%, 80%, 100% { transform: scale(.6); opacity: .4; }
    40%           { transform: scale(1);  opacity: 1; }
}

/* Quick reply chips */
.as-chat-quick-replies {
    display: flex;
    gap: 6px;
    padding: 6px 16px 8px;
    overflow-x: auto;
    scrollbar-width: thin;
    border-top: 1px solid #f1f5f9;
}
.as-chat-quick-replies::-webkit-scrollbar { height: 4px; }
.as-chat-quick-replies::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }
.as-qr-chip {
    flex-shrink: 0;
    padding: 6px 12px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--as-primary, #1d4ed8);
    background: #eff6ff;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .12s;
    white-space: nowrap;
    font-family: inherit;
}
.as-qr-chip:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}
.as-qr-chip:active { transform: scale(.96); }

/* ============================================================
   RFQ form — product context card + seller pill
   ============================================================ */
.as-rfq-product-card { display: flex; flex-direction: column; gap: 14px; }
.as-rfq-product {
    display: flex; gap: 14px; align-items: flex-start;
    padding: 4px 0;
}
.as-rfq-product .thumb {
    width: 88px; height: 88px;
    border-radius: 10px;
    object-fit: cover;
    background: #f1f5f9;
    flex-shrink: 0;
}
.as-rfq-product .thumb-fallback {
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--as-text-muted);
}
.as-rfq-product .thumb-fallback svg { width: 32px; height: 32px; }
.as-rfq-product .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.as-rfq-product .title {
    font-size: 15px; font-weight: 700; color: var(--as-text);
    line-height: 1.3;
}
.as-rfq-product .meta { display: flex; gap: 6px; flex-wrap: wrap; }
.as-rfq-product .price {
    font-size: 16px; font-weight: 800; color: #0f172a;
}
.as-rfq-product .price .unit {
    font-size: 12px; font-weight: 500; color: var(--as-text-muted);
}
.as-rfq-seller-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #ecfdf5, #f0f9ff);
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    font-size: 13px;
    color: #065f46;
}
.as-rfq-seller-pill svg { width: 18px; height: 18px; flex-shrink: 0; }
.as-rfq-seller-pill strong { color: #0f172a; font-weight: 700; }

/* ============================================================
   Reports — date range picker
   ============================================================ */
.as-report-date-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 4px 4px 10px;
    border: 1px solid var(--as-border);
    border-radius: 10px;
    background: #fff;
    flex-wrap: wrap;
}
.as-report-date-ico {
    color: var(--as-text-muted);
    display: inline-flex;
}
.as-report-date-ico svg { width: 16px; height: 16px; }
.as-report-date-input {
    border: 0;
    background: transparent;
    padding: 6px 4px;
    font: inherit;
    font-size: 13px;
    color: var(--as-text);
    min-width: 130px;
    cursor: pointer;
}
.as-report-date-input:focus { outline: 0; }
.as-report-date-sep { color: var(--as-text-muted); font-size: 13px; }
.as-report-date-form .as-btn-primary { padding: 6px 14px; font-size: 13px; }
@media (max-width: 720px) {
    .as-report-date-form { width: 100%; justify-content: space-between; }
    .as-report-date-input { flex: 1; min-width: 0; }
}

/* ============================================================
   Clickable table rows
   ============================================================ */
.as-row-link { cursor: pointer; transition: background-color .12s; }
.as-row-link:hover { background-color: #f8fafc; }

/* ============================================================
   Admin payments — top customers strip
   ============================================================ */
.as-top-customers {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}
.as-top-customer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--as-border);
    border-radius: 10px;
    background: #fff;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.as-top-customer:hover {
    border-color: var(--as-primary, #2563eb);
    box-shadow: 0 2px 8px rgba(37, 99, 235, .08);
    transform: translateY(-1px);
}
.as-top-customer .rank {
    flex-shrink: 0;
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: #fff;
    font-weight: 700; font-size: 12px;
}
.as-top-customer:nth-child(1) .rank { background: linear-gradient(135deg, #facc15, #f59e0b); }
.as-top-customer:nth-child(2) .rank { background: linear-gradient(135deg, #94a3b8, #64748b); }
.as-top-customer:nth-child(3) .rank { background: linear-gradient(135deg, #d97706, #b45309); }
.as-top-customer .info { flex: 1; min-width: 0; }
.as-top-customer .info .name {
    font-weight: 600; font-size: 13px; color: var(--as-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.as-top-customer .info .email {
    font-size: 11.5px; color: var(--as-text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.as-top-customer .totals { text-align: right; flex-shrink: 0; }
.as-top-customer .totals .amt { font-weight: 700; font-size: 13px; color: #0f766e; }
.as-top-customer .totals .count { font-size: 11px; color: var(--as-text-muted); }

/* ============================================================
   Payment detail — back link + 2-column grid
   ============================================================ */
.as-pd-back {
    display: inline-flex; align-items: center; gap: 6px;
    margin: -4px 0 12px;
    color: var(--as-text-muted);
    text-decoration: none;
    font-size: 13px; font-weight: 500;
}
.as-pd-back:hover { color: var(--as-primary, #2563eb); }
.as-pd-back svg { width: 16px; height: 16px; }

.as-pf-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 16px;
    align-items: start;
}
.as-pf-left, .as-pf-right { display: flex; flex-direction: column; gap: 16px; }
.as-pf-card-head {
    padding: 14px 18px 6px;
    display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.as-pf-card-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.as-pf-card-sub { font-size: 12px; color: var(--as-text-muted); }

.as-pd-specs { padding: 4px 18px 16px; }
.as-pd-specs .row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 0; gap: 12px;
    border-bottom: 1px solid #f1f5f9;
}
.as-pd-specs .row:last-child { border-bottom: 0; }
.as-pd-specs .lbl { font-size: 12.5px; color: var(--as-text-muted); }
.as-pd-specs .val { font-size: 13px; font-weight: 500; text-align: right; word-break: break-word; }

@media (max-width: 860px) {
    .as-pf-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Product detail — multi-branch availability callout
   ============================================================ */
.as-pd-branches {
    display: flex; align-items: flex-start; gap: 12px;
    margin: 14px 0 4px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #eff6ff, #f0f9ff);
    border: 1px solid rgba(29,78,216,.15);
    border-radius: 12px;
}
.as-pd-branches-icon {
    width: 34px; height: 34px;
    border-radius: 10px;
    background: rgba(29,78,216,.12);
    color: var(--as-primary, #1d4ed8);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.as-pd-branches-icon svg { width: 18px; height: 18px; }
.as-pd-branches-body { flex: 1; min-width: 0; }
.as-pd-branches-label {
    font-size: 12.5px;
    color: var(--as-text-muted);
    margin-bottom: 8px;
}
.as-pd-branches-label strong {
    color: var(--as-primary, #1d4ed8);
    font-weight: 800;
}
.as-pd-branches-list {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.as-pd-branch-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    background: #fff;
    border: 1px solid rgba(29,78,216,.2);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--as-text);
}
.as-pd-branch-pill.is-primary {
    background: var(--as-primary, #1d4ed8);
    color: #fff;
    border-color: var(--as-primary, #1d4ed8);
}
.as-pd-branch-tag {
    background: rgba(255,255,255,.22);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .4px;
    padding: 2px 6px;
    border-radius: 999px;
    margin-left: 2px;
}

/* ============================================================
   Legal pages — Privacy + Terms (standalone, no app shell)
   ============================================================ */
.as-legal-body {
    margin: 0;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    color: var(--as-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
}
.as-legal-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px;
    padding: 18px 32px;
    background: linear-gradient(135deg, #061a3d, #0a2a5e, #0d3680);
    color: #fff;
    flex-wrap: wrap;
}
.as-legal-brand {
    display: flex; align-items: center; gap: 12px;
    text-decoration: none;
    color: #fff;
}
.as-legal-nav {
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap;
}
.as-legal-nav-link {
    color: rgba(255,255,255,.82);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    transition: background .15s, color .15s;
}
.as-legal-nav-link:hover         { background: rgba(255,255,255,.10); color: #fff; }
.as-legal-nav-link.is-active     { background: rgba(255,255,255,.14); color: #fff; }

.as-legal-header .as-btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
}
.as-legal-header .as-btn-ghost {
    background: rgba(255,255,255,.10);
    color: #fff;
    border-color: rgba(255,255,255,.22);
}
.as-legal-header .as-btn-ghost:hover {
    background: rgba(255,255,255,.18);
    border-color: rgba(255,255,255,.32);
    color: #fff;
}

.as-legal {
    max-width: 880px;
    margin: 0 auto;
    padding: 28px 20px 60px;
}
.as-legal-card {
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 18px;
    padding: 36px 40px;
    box-shadow: 0 8px 32px -16px rgba(15, 42, 110, .14);
}
.as-legal-eyebrow {
    display: inline-block;
    background: rgba(29,78,216,.08);
    color: var(--as-primary, #1d4ed8);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 999px;
    margin-bottom: 14px;
}
.as-legal h1 {
    margin: 0 0 12px;
    font-size: 32px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -.4px;
    line-height: 1.2;
}
.as-legal-lead {
    margin: 0 0 12px;
    color: var(--as-text-muted);
    font-size: 15px;
    line-height: 1.6;
}
.as-legal-meta {
    margin: 0 0 28px;
    color: var(--as-text-muted);
    font-size: 13px;
}
.as-legal-meta strong { color: var(--as-text); font-weight: 700; }

.as-legal-toc {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 18px;
    padding: 16px 18px;
    background: #f8fafc;
    border: 1px solid var(--as-border);
    border-radius: 12px;
    margin: 0 0 32px;
}
.as-legal-toc a {
    color: var(--as-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    padding: 4px 0;
    border-bottom: 1px solid transparent;
    transition: color .15s, border-color .15s;
}
.as-legal-toc a:hover {
    color: var(--as-primary, #1d4ed8);
    border-bottom-color: var(--as-primary, #1d4ed8);
}

.as-legal section {
    margin-bottom: 28px;
    scroll-margin-top: 80px;       /* anchor jumps clear the sticky header */
}
.as-legal h2 {
    font-size: 19px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--as-border);
}
.as-legal p, .as-legal ul, .as-legal ol {
    font-size: 14.5px;
    line-height: 1.65;
    color: #334155;
    margin: 0 0 12px;
}
.as-legal ul, .as-legal ol { padding-left: 24px; }
.as-legal li { margin-bottom: 6px; }
.as-legal a.as-link { color: var(--as-primary, #1d4ed8); }
.as-legal code {
    background: #f1f5f9;
    color: #0f172a;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12.5px;
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}
.as-legal strong { color: #0f172a; font-weight: 700; }
.as-legal em     { font-style: italic; color: #475569; }

.as-legal-footer {
    margin: 32px auto 0;
    text-align: center;
    font-size: 12.5px;
    color: var(--as-text-muted);
    display: flex; align-items: center; justify-content: center;
    gap: 10px; flex-wrap: wrap;
}
.as-legal-footer a {
    color: var(--as-text-muted);
    text-decoration: none;
    font-weight: 600;
}
.as-legal-footer a:hover { color: var(--as-primary, #1d4ed8); }

/* Responsive — phones */
@media (max-width: 720px) {
    .as-legal-header   { padding: 14px 16px; gap: 10px; }
    .as-legal-header .as-brand-text { display: none; }   /* brand mark only on small screens */
    .as-legal-nav-link { padding: 6px 10px; font-size: 13px; }
    .as-legal          { padding: 18px 12px 50px; }
    .as-legal-card     { padding: 24px 20px; border-radius: 14px; }
    .as-legal h1       { font-size: 24px; }
    .as-legal h2       { font-size: 17px; }
    .as-legal p, .as-legal ul, .as-legal ol { font-size: 14px; }
    .as-legal-toc      { grid-template-columns: 1fr; gap: 4px; padding: 12px 14px; }
    .as-legal-toc a    { padding: 6px 0; font-size: 13px; }
}
@media (max-width: 480px) {
    .as-legal-header   { flex-direction: column; align-items: stretch; padding: 14px; }
    .as-legal-brand    { justify-content: center; }
    .as-legal-nav      { justify-content: center; }
}

/* ============================================================
   Multi-location chips on the compare table + card "+N" badge
   ============================================================ */
/* Inline chip strip inside a comparison table cell */
.as-row-locs {
    display: inline-flex; flex-wrap: wrap; gap: 4px;
    margin-top: 4px;
}
.as-row-locs .loc-chip {
    display: inline-flex; align-items: center;
    padding: 2px 8px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--as-text);
    background: #f1f5f9;
    border-radius: 999px;
    line-height: 1.3;
}
.as-row-locs .loc-chip.is-main {
    background: rgba(29,78,216,.12);
    color: var(--as-primary, #1d4ed8);
}
.as-row-locs .loc-chip-count {
    display: inline-flex; align-items: center;
    padding: 2px 8px;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--as-text-muted);
    border-radius: 999px;
    border: 1px dashed var(--as-border);
}

/* Marketplace card — "+3" tag next to main location */
.as-card-loc-more {
    margin-left: 4px;
    background: rgba(29,78,216,.12);
    color: var(--as-primary, #1d4ed8);
    font-size: 10.5px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
    line-height: 1.3;
}

/* ============================================================
   Marketplace filter — text-location + min/max price pair
   ============================================================ */
/* Dual-thumb price range slider: two overlapping range inputs with a
   shared track + filled segment. Inputs are transparent (only the thumbs
   are interactive); the JS keeps min ≤ max and updates the fill region. */
.as-mp-price-range {
    display: flex; flex-direction: column;
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 10px;
    padding: 6px 12px 8px;
    min-height: 42px;
    min-width: 0;
    justify-content: center;
    gap: 4px;
}
.as-mp-pr-labels {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    line-height: 1.2;
}
.as-mp-pr-labels .lbl { color: var(--as-text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.as-mp-pr-labels .val { color: var(--as-text); font-weight: 700; font-size: 12px; }
.as-mp-pr-slider {
    position: relative;
    height: 22px;
    margin-top: 22px;       /* room for the value bubbles above the track */
}
/* Live value badge that follows each thumb. JS positions it via `left`. */
.as-mp-pr-bubble {
    position: absolute;
    bottom: calc(100% + 4px);
    transform: translateX(-50%);
    background: #0f172a;
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    white-space: nowrap;
    pointer-events: none;
    line-height: 1.4;
    box-shadow: 0 2px 6px rgba(15,23,42,.18);
    z-index: 4;
}
.as-mp-pr-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #0f172a;
}
.as-mp-pr-slider .track,
.as-mp-pr-slider .fill {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    height: 4px;
    border-radius: 999px;
    pointer-events: none;
}
.as-mp-pr-slider .track {
    left: 0; right: 0;
    background: #e2e8f0;
}
.as-mp-pr-slider .fill {
    left: 0; right: 0;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
}
.as-mp-pr-thumb {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 22px;
    margin: 0;
    background: transparent;
    appearance: none;
    -webkit-appearance: none;
    pointer-events: none;       /* track is non-interactive; thumbs override */
    outline: none;
}
.as-mp-pr-thumb.min { z-index: 2; }
.as-mp-pr-thumb.max { z-index: 3; }
.as-mp-pr-thumb::-webkit-slider-runnable-track { background: transparent; height: 4px; }
.as-mp-pr-thumb::-moz-range-track             { background: transparent; height: 4px; }
.as-mp-pr-thumb::-webkit-slider-thumb {
    -webkit-appearance: none;
    pointer-events: auto;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #1d4ed8;
    box-shadow: 0 2px 6px rgba(15,23,42,.18);
    cursor: pointer;
    margin-top: -7px;
    transition: transform .12s, box-shadow .12s;
}
.as-mp-pr-thumb::-moz-range-thumb {
    pointer-events: auto;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #1d4ed8;
    box-shadow: 0 2px 6px rgba(15,23,42,.18);
    cursor: pointer;
}
.as-mp-pr-thumb:focus::-webkit-slider-thumb,
.as-mp-pr-thumb:active::-webkit-slider-thumb { transform: scale(1.1); box-shadow: 0 0 0 4px rgba(29,78,216,.18); }
.as-mp-pr-thumb:focus::-moz-range-thumb,
.as-mp-pr-thumb:active::-moz-range-thumb     { box-shadow: 0 0 0 4px rgba(29,78,216,.18); }

.as-mp-loc-input {
    position: relative;
    display: flex; align-items: center;
    background: #fff;
    border: 1px solid var(--as-border);
    border-radius: 10px;
    padding: 0 12px 0 36px;
    min-height: 42px;
    min-width: 0;
    transition: border-color .12s, box-shadow .12s;
}
.as-mp-loc-input:focus-within {
    border-color: var(--as-primary);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, .12);
}
.as-mp-loc-input > svg {
    position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%);
    width: 14px; height: 14px;
    color: var(--as-text-muted);
}
.as-mp-loc-input input {
    flex: 1; min-width: 0;
    border: none; background: transparent;
    font-size: 13.5px;
    color: var(--as-text);
    outline: none;
    padding: 8px 0;
}

/* ============================================================
   Product form — available-locations chip input
   ============================================================ */
.as-loc-chips {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 8px 10px;
    border: 1px solid var(--as-border);
    border-radius: 10px;
    background: #fff;
    min-height: 44px;
    transition: border-color .12s, box-shadow .12s;
}
.as-loc-chips:focus-within {
    border-color: var(--as-primary);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, .12);
}
.as-loc-chips .chips { display: contents; }
.as-loc-chips .chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: #eff6ff;
    color: var(--as-primary, #1d4ed8);
    padding: 4px 6px 4px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.2;
}
.as-loc-chips .chip-x {
    background: rgba(29,78,216,.18);
    color: var(--as-primary, #1d4ed8);
    border: 0;
    width: 18px; height: 18px;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
}
.as-loc-chips .chip-x:hover { background: rgba(29,78,216,.32); }
.as-loc-chips input {
    flex: 1; min-width: 120px;
    border: 0;
    outline: none;
    background: transparent;
    font-size: 13.5px;
    color: var(--as-text);
    padding: 4px 6px;
}

/* RFQ form — clickable suggestion chips (seller's branches) */
.as-loc-suggest {
    display: inline-flex;
    align-items: center;
    margin: 0 6px 4px 0;
    padding: 3px 10px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--as-primary, #1d4ed8);
    background: rgba(29,78,216,.08);
    border: 1px solid rgba(29,78,216,.18);
    border-radius: 999px;
    cursor: pointer;
    transition: background .12s, border-color .12s;
}
.as-loc-suggest:hover {
    background: rgba(29,78,216,.16);
    border-color: rgba(29,78,216,.32);
}

/* ============================================================
   Supplier rating — display + input
   ============================================================ */
/* Display: 5 grey stars overlaid by gold stars clipped to width.
   Works for any fractional rating (e.g. 4.3 → 86% fill). */
.as-stars-display {
    position: relative;
    display: inline-block;
    font-size: 16px;
    letter-spacing: 2px;
    line-height: 1;
    vertical-align: middle;
    /* Track + fill share the same character glyphs so they overlap perfectly */
}
.as-stars-display .track {
    color: #e2e8f0;
}
.as-stars-display .fill {
    position: absolute;
    inset: 0;
    overflow: hidden;
    width: 0;
    color: #f59e0b;
    white-space: nowrap;
}
.as-stars-display.is-empty .track { color: #cbd5e1; }
.as-pd-supplier .rating { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.as-pd-supplier .rating .stars-num { font-size: 13.5px; font-weight: 700; color: var(--as-text); }
.as-pd-supplier .rating .reviews   { font-size: 12.5px; color: var(--as-text-muted); }

/* Input: 10 radios (5 stars × {half, full}) styled as one row of stars.
   Reversed in DOM so adjacent-sibling CSS can highlight from the right.
   `.full` is a full star slot, `.half` overlays the left half. */
.as-stars-input {
    display: inline-flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    font-size: 30px;
    line-height: 1;
    user-select: none;
}
.as-stars-input input { display: none; }
.as-stars-input label {
    cursor: pointer;
    color: #e2e8f0;
    transition: color .12s;
}
.as-stars-input label.full { padding: 0 1px; }
.as-stars-input label.half {
    margin-right: -16px;          /* slide left half over preceding full star */
    width: 15px;
    overflow: hidden;
    direction: rtl;               /* show only the left half of the glyph */
}
/* On hover/checked, light up that star AND every star to its right (which
   means LATER in DOM, since the row is row-reverse). */
.as-stars-input label:hover,
.as-stars-input label:hover ~ label,
.as-stars-input input:checked ~ label {
    color: #f59e0b;
}

/* Rate-this-supplier section on the product page */
.as-pd-rate {
    margin: 18px 20px 4px;
    padding: 16px 18px;
    border: 1px dashed var(--as-border);
    border-radius: 12px;
    background: #fafbfc;
}
.as-pd-rate-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
}
.as-pd-rate-head h4 { margin: 0; font-size: 15px; font-weight: 700; color: var(--as-text); }
.as-pd-rate-sub    { font-size: 12.5px; color: var(--as-text-muted); }
.as-pd-rate-body {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
@media (max-width: 480px) {
    .as-pd-rate       { margin: 16px; padding: 14px 14px; }
    .as-pd-rate-body  { gap: 10px; }
    .as-stars-input   { font-size: 28px; }
    .as-pd-rate-body .as-btn-primary { flex: 1; min-width: 0; justify-content: center; }
}

/* ============================================================
   Mobile: hide scrollbars everywhere (scroll still works)
   ------------------------------------------------------------
   On phones the visible scrollbar takes up valuable horizontal
   space and breaks the "native app" look. Hiding it on mobile
   keeps overflow scrolling functional but invisible.
   ============================================================ */
@media (max-width: 860px) {
    /* WebKit (iOS Safari, Chrome, Edge) */
    *::-webkit-scrollbar             { width: 0 !important; height: 0 !important; }
    *::-webkit-scrollbar-thumb,
    *::-webkit-scrollbar-track       { background: transparent !important; }
    /* Firefox */
    * { scrollbar-width: none !important; }
    /* IE / older Edge */
    * { -ms-overflow-style: none !important; }
}

