/* =====================================================================
   FLUXI Super Admin Dashboard — shared design tokens & component styles.

   A byte-for-byte copy of src/frontend/dashboard/shared/dashboard.css
   (same fx- tokens, same component classes), not a bespoke admin theme —
   admin.fluxisystems.app is a genuinely separate origin from
   app.fluxisystems.app (docs/design/super-admin-dashboard-design.md §5.2,
   a storage-isolation property), but that isolation was never a reason to
   look like a different product. Copied rather than linked cross-origin so
   this surface stays self-contained (no runtime dependency on the tenant
   dashboard's deployment). If the source file's design system changes,
   re-sync this copy by hand — there is no build step to automate it.

   Original header, unchanged below:
   Tokens extracted from src/frontend/landing/index.html (light mode)
   and src/frontend/portal/index.html (dark mode, real toggle mechanism).
   See docs/design/tenant-dashboard-visual-system.md for the extraction
   discipline this file follows. Loaded via plain <link> — no build step.

   v2 (Dashboard Polish Phase 0): component execution upgraded per the
   frontend-design skill — same locked palette, same class names. New
   opt-in pieces: .fx-selectw/.fx-datew (JS-enhanced custom select &
   date-picker, auto-mounted by dashboard.js), .fx-switch, .fx-modal,
   .fx-cta-dock (mobile thumb-zone CTA), .fx-reveal, .fx-eyebrow.
   See docs/design/tenant-dashboard-component-upgrade-spec.md.
   ===================================================================== */

:root {
    --fx-bg: #F8FAFC;              /* slate-50  — landing body bg + portal light canvas */
    --fx-surface: #FFFFFF;          /* landing .fx-card */
    --fx-surface-inner: #F1F5F9;    /* slate-100 — nested tiles inside a card */
    --fx-border: #E2E8F0;           /* slate-200 — landing .fx-card border */
    --fx-text: #0F172A;             /* slate-900 — landing body color */
    --fx-muted: #64748B;            /* slate-500 — landing .fx-muted */
    --fx-accent: #10B981;           /* emerald-500 — landing --accent / portal emerald-500 */
    --fx-accent-strong: #059669;    /* emerald-600 */
    --fx-accent-soft: color-mix(in srgb, var(--fx-accent) 14%, white);
    --fx-danger: #DC2626;
    --fx-danger-soft: color-mix(in srgb, var(--fx-danger) 12%, white);
    --fx-radius-outer: 24px;
    --fx-radius-inner: 16px;
    --fx-shadow-card: 0 8px 24px -14px rgba(15, 23, 42, 0.15);
    /* v2 additions — all derived from the locked palette above */
    --fx-ring: color-mix(in srgb, var(--fx-accent) 28%, transparent);
    --fx-border-strong: #CBD5E1;    /* slate-300 — hover border */
    --fx-shadow-pop: 0 12px 32px -8px rgba(15, 23, 42, 0.22), 0 2px 8px -2px rgba(15, 23, 42, 0.08);
    --fx-shadow-btn: 0 2px 8px -2px color-mix(in srgb, var(--fx-accent-strong) 45%, transparent);
    --fx-scrim: rgba(2, 6, 23, 0.55);
}

html.dark {
    --fx-bg: #020617;               /* slate-950 — portal dark canvas + chrome bars */
    --fx-surface: #0F172A;          /* slate-900 / fluxiNavy — one step lighter than bg */
    --fx-surface-inner: #1E293B;    /* slate-800 */
    --fx-border: #1E293B;           /* slate-800 — portal border-slate-800 */
    --fx-text: #F1F5F9;             /* slate-100 — portal dark body color */
    --fx-muted: #94A3B8;            /* slate-400 — portal carrier-status-bar / toast text */
    --fx-accent: #10B981;
    --fx-accent-strong: #34D399;    /* emerald-400 — portal's lighter dark-mode accent */
    --fx-accent-soft: color-mix(in srgb, var(--fx-accent) 18%, #0F172A);
    --fx-danger: #F87171;
    --fx-danger-soft: color-mix(in srgb, var(--fx-danger) 14%, #0F172A);
    --fx-shadow-card: 0 10px 30px -12px rgba(0, 0, 0, 0.5);
    --fx-ring: color-mix(in srgb, var(--fx-accent) 35%, transparent);
    --fx-border-strong: #334155;    /* slate-700 */
    --fx-shadow-pop: 0 16px 40px -8px rgba(0, 0, 0, 0.65), 0 2px 8px -2px rgba(0, 0, 0, 0.4);
    --fx-shadow-btn: 0 2px 10px -2px color-mix(in srgb, var(--fx-accent) 40%, transparent);
    --fx-scrim: rgba(2, 6, 23, 0.72);
}

* { box-sizing: border-box; }

body.fx-shell {
    background: var(--fx-bg);
    color: var(--fx-text);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: background-color 200ms ease, color 200ms ease;
    /* Atmosphere: one faint emerald wash top-left, one deeper wash far right —
       depth without leaving the palette. Fixed so it doesn't scroll-band. */
    background-image:
        radial-gradient(1100px 520px at 8% -10%, color-mix(in srgb, var(--fx-accent) 6%, transparent), transparent 60%),
        radial-gradient(900px 600px at 105% 30%, color-mix(in srgb, var(--fx-accent) 4%, transparent), transparent 55%);
    background-attachment: fixed;
}

.fx-font-display { font-family: 'Lexend', 'Inter', sans-serif; }

/* Focus discipline: one consistent ring everywhere, keyboard-only. */
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid var(--fx-accent);
    outline-offset: 2px;
    border-radius: 8px;
}

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

/* ---------- layout shell ---------- */

.fx-app {
    display: flex;
    min-height: 100vh;
}

.fx-sidebar {
    width: 264px;
    flex-shrink: 0;
    background: var(--fx-surface);
    border-right: 1px solid var(--fx-border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: background-color 200ms ease, border-color 200ms ease, transform 260ms cubic-bezier(0.32, 0.72, 0, 1);
}

.fx-main {
    flex: 1;
    min-width: 0;
    padding: 24px 24px 96px;
}

@media (max-width: 900px) {
    .fx-sidebar {
        position: fixed;
        z-index: 40;
        transform: translateX(-100%);
        box-shadow: var(--fx-shadow-card);
    }
    .fx-sidebar.is-open { transform: translateX(0); }
    .fx-main { padding: 16px 16px 96px; }
}

.fx-sidebar-brand {
    padding: 20px 20px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--fx-border);
}

.fx-site-switcher {
    margin: 16px 16px 8px;
    padding: 10px 12px;
    border-radius: var(--fx-radius-inner);
    background: var(--fx-surface-inner);
    border: 1px solid var(--fx-border);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.fx-site-switcher:hover {
    border-color: var(--fx-accent);
    box-shadow: 0 0 0 3px var(--fx-ring);
}

.fx-nav-group-label {
    padding: 16px 20px 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--fx-muted);
}

.fx-sidebar-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    margin: 2px 10px;
    border-radius: var(--fx-radius-inner);
    font-size: 14px;
    font-weight: 500;
    color: var(--fx-muted);
    text-decoration: none;
    transition: background-color 150ms ease, color 150ms ease, padding-left 150ms ease;
}

/* Active-state indicator: emerald bar that grows in from the left edge. */
.fx-sidebar-link::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 50%;
    height: 18px;
    width: 3px;
    border-radius: 9999px;
    background: var(--fx-accent);
    transform: translateY(-50%) scaleY(0);
    transition: transform 200ms cubic-bezier(0.34, 1.4, 0.64, 1);
}

.fx-sidebar-link:hover:not(.is-disabled) {
    background: var(--fx-surface-inner);
    color: var(--fx-text);
}

.fx-sidebar-link.is-active {
    background: var(--fx-accent-soft);
    color: var(--fx-accent-strong);
    font-weight: 600;
}
.fx-sidebar-link.is-active::before { transform: translateY(-50%) scaleY(1); }

.fx-sidebar-link.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.fx-sidebar-link .fx-soon-pill {
    margin-left: auto;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 9999px;
    background: var(--fx-surface-inner);
    color: var(--fx-muted);
}

.fx-sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid var(--fx-border);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ---------- topbar ---------- */

.fx-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.fx-page-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.fx-page-subtitle {
    font-size: 13px;
    color: var(--fx-muted);
    margin-top: 4px;
}

/* Eyebrow pill — the locked "pill/badge eyebrow label" landing pattern
   (visual-system §2): uppercase, letter-spaced, above a heading. */
.fx-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: var(--fx-accent-soft);
    color: var(--fx-accent-strong);
    border: 1px solid color-mix(in srgb, var(--fx-accent) 25%, transparent);
}

/* ---------- cards ---------- */

.fx-card {
    background: var(--fx-surface);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-radius-outer);
    box-shadow: var(--fx-shadow-card);
    transition: background-color 200ms ease, border-color 200ms ease;
}

.fx-card-inner {
    background: var(--fx-surface-inner);
    border-radius: var(--fx-radius-inner);
}

.fx-stat-card {
    background: var(--fx-surface);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-radius-outer);
    padding: 20px;
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease, background-color 200ms ease;
}
.fx-stat-card:hover {
    border-color: color-mix(in srgb, var(--fx-accent) 35%, var(--fx-border));
    box-shadow: var(--fx-shadow-card), 0 0 0 3px color-mix(in srgb, var(--fx-accent) 8%, transparent);
    transform: translateY(-1px);
}

.fx-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--fx-radius-inner);
    background: var(--fx-accent-soft);
    color: var(--fx-accent-strong);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fx-stat-value {
    font-size: 24px;
    font-weight: 700;
    font-family: 'Lexend', 'Inter', sans-serif;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

.fx-stat-label {
    font-size: 12px;
    color: var(--fx-muted);
    font-weight: 600;
}

.fx-stat-sub {
    font-size: 11px;
    color: var(--fx-muted);
    margin-top: 6px;
}

/* ---------- status dot / badges ---------- */

.fx-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 9999px;
    background: var(--fx-accent);
    display: inline-block;
    position: relative;
}

.fx-status-dot.is-pulsing::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 9999px;
    background: var(--fx-accent);
    opacity: 0.35;
    animation: fx-pulse-ring 1.8s ease-out infinite;
}

.fx-status-dot.is-offline { background: var(--fx-danger); }
.fx-status-dot.is-offline.is-pulsing::after { background: var(--fx-danger); }

@keyframes fx-pulse-ring {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(2.4); opacity: 0; }
}

.fx-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: var(--fx-accent-soft);
    color: var(--fx-accent-strong);
    transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.fx-pill.is-muted {
    background: var(--fx-surface-inner);
    color: var(--fx-muted);
}

.fx-pill.is-danger {
    background: var(--fx-danger-soft);
    color: var(--fx-danger);
}

/* Interactive pills (the History/Vouchers tab strips set cursor:pointer inline) */
button.fx-pill:hover { box-shadow: 0 0 0 3px var(--fx-ring); }

/* ---------- coming soon / disabled ---------- */

.fx-coming-soon {
    position: relative;
    opacity: 0.6;
}

.fx-coming-soon::before {
    content: '';
    position: absolute;
    inset: 0;
    cursor: not-allowed;
    z-index: 5;
}

.fx-coming-soon-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 9999px;
    background: var(--fx-surface-inner);
    color: var(--fx-muted);
    border: 1px dashed var(--fx-border);
}

/* ---------- buttons ---------- */

.fx-btn-primary {
    background: linear-gradient(180deg, var(--fx-accent), color-mix(in srgb, var(--fx-accent) 78%, #047857));
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    border-radius: var(--fx-radius-inner);
    padding: 10px 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid color-mix(in srgb, var(--fx-accent-strong) 55%, transparent);
    box-shadow: var(--fx-shadow-btn), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    transition: filter 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
.fx-btn-primary:hover:not(:disabled) {
    filter: brightness(1.06);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px -3px color-mix(in srgb, var(--fx-accent-strong) 55%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.fx-btn-primary:active:not(:disabled) {
    transform: translateY(0) scale(0.985);
    filter: brightness(0.97);
}
.fx-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.fx-btn-secondary {
    background: var(--fx-surface);
    color: var(--fx-text);
    border: 1px solid var(--fx-border);
    font-weight: 600;
    font-size: 14px;
    border-radius: var(--fx-radius-inner);
    padding: 10px 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
.fx-btn-secondary:hover {
    border-color: var(--fx-accent);
    background: var(--fx-accent-soft);
    color: var(--fx-accent-strong);
    transform: translateY(-1px);
}
.fx-btn-secondary:active { transform: translateY(0) scale(0.985); }

/* Loading affordance: add .is-loading to either button style. */
.fx-btn-primary.is-loading, .fx-btn-secondary.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}
.fx-btn-primary.is-loading::after, .fx-btn-secondary.is-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: fx-spin 0.7s linear infinite;
}
.fx-btn-secondary.is-loading::after {
    border-color: var(--fx-ring);
    border-top-color: var(--fx-accent);
}

.fx-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--fx-radius-inner);
    border: 1px solid var(--fx-border);
    background: var(--fx-surface);
    color: var(--fx-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
}
.fx-icon-btn:hover {
    color: var(--fx-accent-strong);
    border-color: var(--fx-accent);
    background: var(--fx-accent-soft);
}
.fx-icon-btn:active { transform: scale(0.94); }

/* ---------- form fields — label above input, 12px gap, 24px between groups ---------- */

.fx-field-group { margin-bottom: 24px; }
.fx-field-group:last-child { margin-bottom: 0; }

.fx-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--fx-text);
    margin-bottom: 12px;
}

.fx-input, .fx-select {
    width: 100%;
    background: var(--fx-surface-inner);
    border: 1px solid var(--fx-border);
    color: var(--fx-text);
    border-radius: var(--fx-radius-inner);
    padding: 10px 14px;
    font-size: 14px;
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 200ms ease;
}
.fx-input::placeholder { color: color-mix(in srgb, var(--fx-muted) 75%, transparent); }
.fx-input:hover:not(:disabled):not(:focus), .fx-select:hover:not(:disabled):not(:focus) {
    border-color: var(--fx-border-strong);
}
.fx-input:focus, .fx-select:focus {
    outline: none;
    border-color: var(--fx-accent);
    box-shadow: 0 0 0 3px var(--fx-ring);
}
.fx-input:disabled { opacity: 0.6; cursor: not-allowed; }

/* Kill the native number spinners (vouchers quantity etc.) */
.fx-input::-webkit-outer-spin-button, .fx-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.fx-input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* ---------- OTP digit boxes (sign-in Step 2) — six individual boxes, not
   one field, per Marc's own explicit convention: "matches how users read
   codes, easier to spot mistakes". Boxed with a background, same radius
   token as every other input (radius-inner), not an underline style. ---------- */

.fx-otp-row {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.fx-otp-box {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 52px;
    background: var(--fx-surface-inner);
    border: 1px solid var(--fx-border);
    color: var(--fx-text);
    border-radius: var(--fx-radius-inner);
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-family: 'Lexend', 'Inter', sans-serif;
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 200ms ease;
}
.fx-otp-box:focus {
    outline: none;
    border-color: var(--fx-accent);
    box-shadow: 0 0 0 3px var(--fx-ring);
}
.fx-otp-box.is-invalid {
    border-color: var(--fx-danger);
    box-shadow: 0 0 0 3px var(--fx-danger-soft);
}
.fx-otp-box::-webkit-outer-spin-button, .fx-otp-box::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* When dashboard.js has mounted a custom widget over a native control,
   the native element stays in the DOM as the value store, visually gone. */
.fx-native-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    clip-path: inset(50%);
}

/* ---------- custom select (mounted by dashboard.js over select.fx-select) ---------- */

.fx-selectw { position: relative; width: 100%; }
.fx-selectw.is-auto { width: auto; min-width: 160px; }

.fx-select-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--fx-surface-inner);
    border: 1px solid var(--fx-border);
    color: var(--fx-text);
    border-radius: var(--fx-radius-inner);
    padding: 10px 14px;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 200ms ease;
}
.fx-select-btn:hover { border-color: var(--fx-border-strong); }
.fx-selectw.is-open .fx-select-btn {
    border-color: var(--fx-accent);
    box-shadow: 0 0 0 3px var(--fx-ring);
}
.fx-select-btn .fx-caret {
    flex-shrink: 0;
    color: var(--fx-muted);
    transition: transform 200ms cubic-bezier(0.34, 1.4, 0.64, 1);
}
.fx-selectw.is-open .fx-caret { transform: rotate(180deg); color: var(--fx-accent-strong); }

.fx-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 100%;
    z-index: 55;
    background: var(--fx-surface);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-radius-inner);
    box-shadow: var(--fx-shadow-pop);
    padding: 6px;
    max-height: 280px;
    overflow-y: auto;
    display: none;
}
.fx-selectw.is-open .fx-menu, .fx-datew.is-open .fx-menu { display: block; animation: fx-pop-in 160ms cubic-bezier(0.34, 1.3, 0.64, 1); }
.fx-menu.drop-up { top: auto; bottom: calc(100% + 6px); transform-origin: bottom center; }

@keyframes fx-pop-in {
    from { opacity: 0; transform: translateY(-4px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.fx-menu.drop-up.fx-menu, .fx-selectw.is-open .fx-menu.drop-up { animation: fx-pop-in-up 160ms cubic-bezier(0.34, 1.3, 0.64, 1); }
@keyframes fx-pop-in-up {
    from { opacity: 0; transform: translateY(4px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.fx-menu::-webkit-scrollbar { width: 8px; }
.fx-menu::-webkit-scrollbar-thumb { background: var(--fx-border-strong); border-radius: 8px; }
.fx-menu::-webkit-scrollbar-track { background: transparent; }

.fx-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    text-align: left;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--fx-text);
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 100ms ease, color 100ms ease;
}
.fx-option:hover, .fx-option.is-hilite { background: var(--fx-surface-inner); }
.fx-option.is-selected {
    background: var(--fx-accent-soft);
    color: var(--fx-accent-strong);
    font-weight: 600;
}
.fx-option .fx-option-check { flex-shrink: 0; opacity: 0; transform: scale(0.5); transition: opacity 120ms ease, transform 160ms cubic-bezier(0.34, 1.5, 0.64, 1); }
.fx-option.is-selected .fx-option-check { opacity: 1; transform: scale(1); }

/* ---------- custom date-picker (mounted by dashboard.js over input[type=date]) ---------- */

.fx-datew { position: relative; width: 100%; }
.fx-datew.is-auto { width: auto; min-width: 148px; }

.fx-date-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 9px;
    background: var(--fx-surface-inner);
    border: 1px solid var(--fx-border);
    color: var(--fx-text);
    border-radius: var(--fx-radius-inner);
    padding: 10px 14px;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 200ms ease;
}
.fx-date-btn:hover { border-color: var(--fx-border-strong); }
.fx-datew.is-open .fx-date-btn {
    border-color: var(--fx-accent);
    box-shadow: 0 0 0 3px var(--fx-ring);
}
.fx-date-btn .fx-date-ic { color: var(--fx-muted); flex-shrink: 0; }
.fx-datew.is-open .fx-date-ic { color: var(--fx-accent-strong); }
.fx-date-btn .fx-date-placeholder { color: color-mix(in srgb, var(--fx-muted) 75%, transparent); }

.fx-cal { width: 268px; padding: 12px; max-height: none; overflow: visible; }

.fx-cal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 10px;
}
.fx-cal-title {
    font-family: 'Lexend', 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 700;
}
.fx-cal-nav {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fx-muted);
    cursor: pointer;
    transition: background-color 120ms ease, color 120ms ease;
}
.fx-cal-nav:hover { background: var(--fx-surface-inner); color: var(--fx-accent-strong); }

.fx-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.fx-cal-dow {
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--fx-muted);
    padding: 4px 0 6px;
}
.fx-cal-day {
    height: 32px;
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--fx-text);
    cursor: pointer;
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 100ms ease, color 100ms ease, transform 100ms ease;
}
.fx-cal-day:hover { background: var(--fx-surface-inner); }
.fx-cal-day:active { transform: scale(0.9); }
.fx-cal-day.is-outside { color: color-mix(in srgb, var(--fx-muted) 45%, transparent); }
.fx-cal-day.is-today { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--fx-accent) 55%, transparent); font-weight: 700; }
.fx-cal-day.is-selected {
    background: var(--fx-accent);
    color: #fff;
    font-weight: 700;
    box-shadow: var(--fx-shadow-btn);
}

.fx-cal-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--fx-border);
}
.fx-cal-foot button {
    font-size: 11px;
    font-weight: 700;
    color: var(--fx-accent-strong);
    padding: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 120ms ease;
}
.fx-cal-foot button:hover { background: var(--fx-accent-soft); }

/* ---------- radio / checkbox — custom-drawn, zero-markup-change ---------- */

.fx-radio-row { display: flex; flex-direction: column; gap: 10px; }
.fx-radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--fx-radius-inner);
    border: 1px solid var(--fx-border);
    background: var(--fx-surface-inner);
    font-size: 13px;
    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}
.fx-radio-option:hover { border-color: var(--fx-border-strong); }
.fx-radio-option:has(input:checked) {
    border-color: var(--fx-accent);
    background: var(--fx-accent-soft);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--fx-accent) 10%, transparent);
}

.fx-radio-option input[type="radio"],
.fx-package-option input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin: 0;
    border-radius: 9999px;
    border: 1.5px solid var(--fx-border-strong);
    background: var(--fx-surface);
    display: inline-grid;
    place-content: center;
    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease;
}
.fx-radio-option input[type="radio"]::before,
.fx-package-option input[type="radio"]::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 9999px;
    background: #fff;
    transform: scale(0);
    transition: transform 180ms cubic-bezier(0.34, 1.6, 0.64, 1);
}
.fx-radio-option input[type="radio"]:checked,
.fx-package-option input[type="radio"]:checked {
    border-color: var(--fx-accent);
    background: var(--fx-accent);
}
.fx-radio-option input[type="radio"]:checked::before,
.fx-package-option input[type="radio"]:checked::before { transform: scale(1); }

/* ---------- table ---------- */

.fx-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fx-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--fx-muted);
    padding: 10px 14px;
    border-bottom: 1px solid var(--fx-border);
}
.fx-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--fx-border);
    color: var(--fx-text);
    transition: background-color 100ms ease;
}
.fx-table tr:last-child td { border-bottom: none; }
.fx-table tbody tr:hover td { background: color-mix(in srgb, var(--fx-surface-inner) 55%, transparent); }
.fx-table tbody tr:hover td:first-child { border-radius: 10px 0 0 10px; }
.fx-table tbody tr:hover td:last-child { border-radius: 0 10px 10px 0; }

/* ---------- banner ---------- */

.fx-banner {
    border-radius: var(--fx-radius-outer);
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border: 1px solid;
}
.fx-banner.is-warning {
    background: var(--fx-danger-soft);
    border-color: color-mix(in srgb, var(--fx-danger) 35%, transparent);
    color: var(--fx-text);
}

/* ---------- theme toggle — same floating position/behavior as portal ---------- */

.fx-theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 50;
    width: 44px;
    height: 44px;
    border-radius: 9999px;
    background: #0F172A;
    border: 1px solid #1E293B;
    box-shadow: var(--fx-shadow-card);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #34D399;
    transition: transform 150ms ease, background-color 150ms ease, bottom 200ms ease;
}
.fx-theme-toggle:hover { background: #1E293B; transform: scale(1.06); }
.fx-theme-toggle:active { transform: scale(0.94); }

/* ---------- recent activity row ---------- */

.fx-activity-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--fx-border);
}
.fx-activity-row:last-child { border-bottom: none; }

/* ---------- toast (mirrors portal's system-toast) ---------- */

#fx-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 340px;
    background: var(--fx-surface);
    border: 1px solid var(--fx-border);
    border-left: 3px solid var(--fx-accent);
    border-radius: var(--fx-radius-inner);
    box-shadow: var(--fx-shadow-pop);
    padding: 14px;
    z-index: 60;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    transform: translateY(-16px) scale(0.98);
    opacity: 0;
    pointer-events: none;
    transition: transform 260ms cubic-bezier(0.34, 1.3, 0.64, 1), opacity 200ms ease;
    overflow: hidden;
}
#fx-toast.is-shown { transform: translateY(0) scale(1); opacity: 1; pointer-events: auto; }
#fx-toast.is-error { border-left-color: var(--fx-danger); }

/* Countdown bar injected by dashboard.js — shows time until auto-dismiss. */
.fx-toast-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    background: var(--fx-accent);
    width: 100%;
    transform-origin: left;
}
#fx-toast.is-error .fx-toast-progress { background: var(--fx-danger); }
#fx-toast.is-shown .fx-toast-progress { animation: fx-toast-drain 4s linear forwards; }
@keyframes fx-toast-drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.fx-hamburger {
    display: none;
}
@media (max-width: 900px) {
    .fx-hamburger {
        display: flex;
        width: 36px;
        height: 36px;
        border-radius: var(--fx-radius-inner);
        border: 1px solid var(--fx-border);
        align-items: center;
        justify-content: center;
        color: var(--fx-text);
    }
}

.fx-sidebar-scrim {
    display: none;
}
@media (max-width: 900px) {
    .fx-sidebar-scrim.is-open {
        display: block;
        position: fixed;
        inset: 0;
        background: var(--fx-scrim);
        z-index: 30;
        animation: fx-fade-in 200ms ease;
    }
}
@keyframes fx-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- spinner (mirrors portal's real spinner) ---------- */

.fx-spinner {
    border: 3px solid color-mix(in srgb, var(--fx-accent) 20%, transparent);
    border-top-color: var(--fx-accent);
    border-radius: 50%;
    animation: fx-spin 0.9s linear infinite;
}
@keyframes fx-spin { to { transform: rotate(360deg); } }

/* ---------- voucher code display (Agent PoS success state) ---------- */

.fx-voucher-code-box {
    background: var(--fx-surface-inner);
    border: 1.5px dashed var(--fx-accent);
    border-radius: var(--fx-radius-inner);
    padding: 16px;
    text-align: center;
    font-family: 'Lexend', 'Inter', sans-serif;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--fx-accent-strong);
}

/* ---------- checkbox row (e.g. Free Trial toggle) ---------- */

.fx-checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--fx-radius-inner);
    border: 1px solid var(--fx-border);
    background: var(--fx-surface-inner);
    font-size: 13px;
    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}
.fx-checkbox-row:hover { border-color: var(--fx-border-strong); }
.fx-checkbox-row:has(input:checked) {
    border-color: var(--fx-accent);
    background: var(--fx-accent-soft);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--fx-accent) 10%, transparent);
}

.fx-checkbox-row input[type="checkbox"]:not(.fx-switch) {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin: 0;
    border-radius: 6px;
    border: 1.5px solid var(--fx-border-strong);
    background: var(--fx-surface);
    display: inline-grid;
    place-content: center;
    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease;
}
.fx-checkbox-row input[type="checkbox"]:not(.fx-switch)::before {
    content: '';
    width: 10px;
    height: 10px;
    background: #fff;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
    transform: scale(0);
    transition: transform 180ms cubic-bezier(0.34, 1.6, 0.64, 1);
}
.fx-checkbox-row input[type="checkbox"]:not(.fx-switch):checked {
    border-color: var(--fx-accent);
    background: var(--fx-accent);
}
.fx-checkbox-row input[type="checkbox"]:not(.fx-switch):checked::before { transform: scale(1); }

/* Switch variant — add class="fx-switch" to a checkbox input for a pill
   toggle (used for boolean on/off, e.g. the Free Trial toggle). Still a
   real checkbox underneath: same events, same .checked contract. */
input[type="checkbox"].fx-switch {
    appearance: none;
    -webkit-appearance: none;
    width: 38px;
    height: 22px;
    flex-shrink: 0;
    margin: 0;
    border-radius: 9999px;
    border: 1.5px solid var(--fx-border-strong);
    background: var(--fx-surface-inner);
    position: relative;
    cursor: pointer;
    transition: background-color 200ms ease, border-color 200ms ease;
}
input[type="checkbox"].fx-switch::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 15px;
    height: 15px;
    border-radius: 9999px;
    background: var(--fx-muted);
    transition: transform 200ms cubic-bezier(0.34, 1.3, 0.64, 1), background-color 200ms ease;
}
input[type="checkbox"].fx-switch:checked {
    background: var(--fx-accent);
    border-color: var(--fx-accent);
}
input[type="checkbox"].fx-switch:checked::before {
    background: #fff;
    transform: translateX(16px);
}

/* ---------- collapsible (e.g. Advanced Options) ---------- */

.fx-collapsible-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--fx-radius-inner);
    border: 1px solid var(--fx-border);
    background: var(--fx-surface-inner);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease;
}
.fx-collapsible-trigger:hover { border-color: var(--fx-border-strong); }
.fx-collapsible-trigger .fx-caret, .fx-collapsible-trigger [data-lucide="chevron-down"] {
    transition: transform 200ms cubic-bezier(0.34, 1.4, 0.64, 1);
}
.fx-collapsible-trigger[aria-expanded="true"] .fx-caret,
.fx-collapsible-trigger[aria-expanded="true"] [data-lucide="chevron-down"] { transform: rotate(180deg); }

.fx-collapsible-body {
    padding: 16px 2px 2px;
}

/* Animated variant — wrap .fx-collapsible-body in .fx-collapsible-wrap and
   toggle .is-open on the wrap (see packages-create.html reference). */
.fx-collapsible-wrap {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 260ms cubic-bezier(0.32, 0.72, 0, 1);
}
.fx-collapsible-wrap > .fx-collapsible-body { overflow: hidden; min-height: 0; }
.fx-collapsible-wrap.is-open { grid-template-rows: 1fr; }

/* ---------- modal (opt-in shared classes — see upgrade spec migration note) ---------- */

.fx-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--fx-scrim);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: fx-fade-in 180ms ease;
}
.fx-modal.hidden { display: none; }
.fx-modal-panel {
    width: 100%;
    animation: fx-modal-rise 240ms cubic-bezier(0.34, 1.2, 0.64, 1);
}
@keyframes fx-modal-rise {
    from { opacity: 0; transform: translateY(14px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.fx-modal.is-closing { animation: fx-fade-out 160ms ease forwards; }
.fx-modal.is-closing .fx-modal-panel { animation: fx-modal-sink 160ms ease forwards; }
@keyframes fx-fade-out { to { opacity: 0; } }
@keyframes fx-modal-sink { to { opacity: 0; transform: translateY(8px) scale(0.98); } }

@media (max-width: 640px) {
    /* Thumb-zone: on phones, modals bottom-sheet instead of center-float. */
    .fx-modal { align-items: flex-end; padding: 0; }
    .fx-modal .fx-modal-panel { max-width: none !important; }
    .fx-modal .fx-card {
        border-radius: var(--fx-radius-outer) var(--fx-radius-outer) 0 0;
        border-bottom: none;
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }
}

/* ---------- settings sub-nav tab strip (Settings sector) ---------- */

.fx-settings-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--fx-border);
    margin-bottom: 24px;
}
.fx-settings-tab {
    position: relative;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--fx-muted);
    text-decoration: none;
    margin-bottom: -1px;
    border-radius: var(--fx-radius-inner) var(--fx-radius-inner) 0 0;
    transition: color 150ms ease, background-color 150ms ease;
}
.fx-settings-tab::after {
    content: '';
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 0;
    height: 2px;
    border-radius: 2px;
    background: var(--fx-accent);
    transform: scaleX(0);
    transition: transform 200ms cubic-bezier(0.34, 1.2, 0.64, 1);
}
.fx-settings-tab:hover { color: var(--fx-text); background: var(--fx-surface-inner); }
.fx-settings-tab:hover::after { transform: scaleX(0.6); }
.fx-settings-tab.is-active { color: var(--fx-accent-strong); }
.fx-settings-tab.is-active::after { transform: scaleX(1); }

/* ---------- package-select cards (Agent PoS) ---------- */

.fx-package-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--fx-radius-inner);
    border: 1.5px solid var(--fx-border);
    background: var(--fx-surface-inner);
    cursor: pointer;
    transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.fx-package-option:hover { border-color: var(--fx-accent); transform: translateY(-1px); }
.fx-package-option.is-selected,
.fx-package-option:has(input:checked) {
    border-color: var(--fx-accent);
    background: var(--fx-accent-soft);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--fx-accent) 10%, transparent);
}

/* ---------- mobile thumb-zone CTA dock (Marc's bottom-third convention) ----------
   Markup: place at end of <body>:
     <div class="fx-cta-dock"> ...primary (and optional secondary) button... </div>
   and add class "has-cta-dock" to <body>. Desktop: hidden (the inline CTA
   row stays). Mobile: fixed bottom bar in the thumb zone; the theme toggle
   lifts above it so the two never collide. */

.fx-cta-dock { display: none; }

@media (max-width: 640px) {
    body.has-cta-dock .fx-cta-dock {
        display: flex;
        gap: 10px;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 45;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
        background: color-mix(in srgb, var(--fx-surface) 88%, transparent);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-top: 1px solid var(--fx-border);
        box-shadow: 0 -8px 24px -16px rgba(15, 23, 42, 0.3);
    }
    body.has-cta-dock .fx-cta-dock .fx-btn-primary { flex: 1; }
    body.has-cta-dock .fx-theme-toggle { bottom: calc(76px + env(safe-area-inset-bottom)); }
    body.has-cta-dock .fx-main { padding-bottom: 132px; }
    /* The inline CTA row duplicates the dock on phones — hide it there. */
    body.has-cta-dock .fx-cta-inline { display: none; }
}

/* ---------- dark hero panel (locked landing pattern: navy floating card
   with emerald accents, deliberately dark even on the light page) ---------- */

.fx-hero-panel {
    background: #0F172A;            /* fluxiNavy — same in both modes by design */
    border: 1px solid #1E293B;
    border-radius: var(--fx-radius-inner);
    color: #F1F5F9;
    box-shadow: 0 12px 32px -14px rgba(2, 6, 23, 0.55);
}
html.dark .fx-hero-panel {
    background: #1E293B;            /* one step lighter than the dark page surface */
    border-color: #334155;
}
.fx-hero-panel .fx-hero-muted { color: #94A3B8; }
.fx-hero-panel .fx-hero-accent { color: #34D399; }

/* Navy rounded-square icon badge with emerald glyph (locked feature-grid pattern) */
.fx-hero-badge {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #0F172A;
    border: 1px solid #1E293B;
    color: #34D399;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
html.dark .fx-hero-badge { background: #334155; border-color: #475569; }

/* ---------- page-load reveal (opt-in: add .fx-reveal to <main>) ---------- */

@keyframes fx-rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.fx-reveal > * { animation: fx-rise 480ms cubic-bezier(0.22, 0.9, 0.36, 1) backwards; }
.fx-reveal > *:nth-child(1) { animation-delay: 0ms; }
.fx-reveal > *:nth-child(2) { animation-delay: 60ms; }
.fx-reveal > *:nth-child(3) { animation-delay: 120ms; }
.fx-reveal > *:nth-child(4) { animation-delay: 180ms; }
.fx-reveal > *:nth-child(5) { animation-delay: 240ms; }
.fx-reveal > *:nth-child(6) { animation-delay: 300ms; }
.fx-reveal > *:nth-child(n+7) { animation-delay: 360ms; }

/* ---------- fluid daily bar chart (Dashboard "Revenue Over Time") ----------
   One column per day of the viewed month, columns share the row equally
   (flex:1) so the count is fluid — 4 columns on the 4th, 23 on the 23rd.
   Each bar stacks 3 segments (voucher / mobile money / commission). No
   value axis is drawn; per-bar detail lives in the hover/tap tooltip. */

.fx-daybar-chart {
    position: relative; /* anchors the moving-average line overlay */
    height: 220px;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    padding-top: 34px; /* headroom for a tall bar's tooltip */
}

.fx-daybar-col {
    flex: 1 1 0;
    min-width: 3px;
    display: flex;
    flex-direction: column;
    height: 100%;
    cursor: pointer;
}

.fx-daybar-barwrap {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: flex-end;
}

.fx-daybar { position: relative; width: 100%; }

/* Segments are true flex items (flex-grow set per-segment in JS, not a
   height percentage) so `gap` correctly reserves real space between them
   instead of the segments' percentages overflowing the bar. */
.fx-daybar-fill {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column-reverse;
    gap: 3px;
    transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}

.fx-daybar-seg { width: 100%; min-height: 0; border-radius: 2px; }
.fx-daybar-seg.is-voucher { background: var(--fx-accent); }
.fx-daybar-seg.is-mm { background: #FDBA74; }
.fx-daybar-seg.is-commission { background: #38BDF8; }

/* No resizing on hover/tap — the bar just lifts off the baseline and
   glows. Nothing about its own or its neighbors' width ever changes. */
.fx-daybar-col:hover .fx-daybar-fill,
.fx-daybar-col.is-active .fx-daybar-fill {
    transform: translateY(-6px);
    filter: brightness(1.08) saturate(1.1);
    box-shadow: 0 8px 16px -6px color-mix(in srgb, var(--fx-accent) 65%, transparent);
    z-index: 3;
}

.fx-daybar-label {
    height: 14px;
    margin-top: 6px;
    font-size: 9px;
    text-align: center;
    color: var(--fx-muted);
    font-variant-numeric: tabular-nums;
}

.fx-daybar-tip {
    position: absolute;
    bottom: calc(100% + 8px);
    width: max-content;
    min-width: 148px;
    max-width: min(200px, 78vw);
    background: var(--fx-surface);
    border: 1px solid var(--fx-border);
    border-radius: 12px;
    box-shadow: var(--fx-shadow-pop);
    padding: 9px 10px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px) scale(0.96);
    transition: opacity 140ms ease, transform 140ms ease;
    z-index: 10;
}
.fx-daybar-col:hover .fx-daybar-tip,
.fx-daybar-col.is-active .fx-daybar-tip {
    opacity: 1;
    transform: translateY(0) scale(1);
}

@media (max-width: 480px) {
    .fx-daybar-tip { min-width: 132px; max-width: 84vw; padding: 8px 9px; }
    .fx-daybar-chart { height: 190px; padding-top: 30px; }
}

/* Cumulative moving-average line — drawn in front of the bars (last in DOM,
   pointer-events:none so it never blocks bar hover/tap). White-on-dark-halo
   by design, not theme tokens: it sits on top of the bars' own fixed
   (non-theme) colors, not the page background, so this reads identically —
   and correctly — in both light and dark mode without any re-tinting. */
.fx-daybar-avgline {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* ---------- date range picker (dual calendar + presets) ---------- */

.fx-rangepicker { position: relative; }

.fx-rangepicker-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    background: var(--fx-surface-inner);
    border: 1px solid var(--fx-border);
    color: var(--fx-text);
    border-radius: var(--fx-radius-inner);
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 200ms ease;
}
.fx-rangepicker-btn:hover { border-color: var(--fx-border-strong); }
.fx-rangepicker.is-open .fx-rangepicker-btn {
    border-color: var(--fx-accent);
    box-shadow: 0 0 0 3px var(--fx-ring);
}
.fx-rangepicker-btn .fx-date-ic { color: var(--fx-muted); flex-shrink: 0; }
.fx-rangepicker.is-open .fx-date-ic { color: var(--fx-accent-strong); }

.fx-rangepanel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 55;
    display: none;
    background: var(--fx-surface);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-radius-outer);
    box-shadow: var(--fx-shadow-pop);
    overflow: hidden;
}
.fx-rangepicker.is-open .fx-rangepanel { display: flex; animation: fx-pop-in 160ms cubic-bezier(0.34, 1.3, 0.64, 1); }

.fx-rangepanel-main { padding: 16px 18px; width: 560px; max-width: 88vw; }

.fx-rangepanel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.fx-rangepanel-inputs { display: flex; align-items: center; gap: 3px; font-size: 13px; }
.fx-rp-num {
    width: 30px;
    text-align: center;
    background: var(--fx-surface-inner);
    border: 1px solid var(--fx-border);
    border-radius: 8px;
    padding: 6px 2px;
    font-size: 12.5px;
    color: var(--fx-text);
    font-variant-numeric: tabular-nums;
}
.fx-rp-num.is-year { width: 48px; }
.fx-rp-num:focus { outline: none; border-color: var(--fx-accent); box-shadow: 0 0 0 2px var(--fx-ring); }
.fx-rp-dash { color: var(--fx-muted); margin: 0 6px; }

.fx-rangepanel-actions { display: flex; gap: 8px; }

.fx-rp-months { display: flex; gap: 22px; }
.fx-rp-month { width: 240px; }
.fx-rp-month-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.fx-rp-month-title { font-family: 'Lexend', 'Inter', sans-serif; font-size: 13px; font-weight: 700; }
.fx-rp-nav {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fx-muted);
    cursor: pointer;
    transition: background-color 120ms ease, color 120ms ease;
}
.fx-rp-nav:hover { background: var(--fx-surface-inner); color: var(--fx-accent-strong); }

.fx-rp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.fx-rp-dow { text-align: center; font-size: 10px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: var(--fx-muted); padding: 2px 0 6px; }
.fx-rp-day {
    height: 30px;
    font-size: 12px;
    font-weight: 500;
    color: var(--fx-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fx-rp-day.is-outside { color: color-mix(in srgb, var(--fx-muted) 40%, transparent); pointer-events: none; }
.fx-rp-day-dot {
    width: 26px;
    height: 26px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
    transition: background-color 100ms ease, color 100ms ease;
}
.fx-rp-day:not(.is-outside):hover .fx-rp-day-dot { background: var(--fx-surface-inner); }
.fx-rp-day.is-today .fx-rp-day-dot { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--fx-accent) 55%, transparent); }
.fx-rp-day.is-in-range { background: var(--fx-accent-soft); }
.fx-rp-day.is-range-start { border-radius: 9999px 0 0 9999px; }
.fx-rp-day.is-range-end { border-radius: 0 9999px 9999px 0; }
.fx-rp-day.is-range-start.is-range-end { border-radius: 9999px; }
.fx-rp-day.is-endpoint .fx-rp-day-dot { background: var(--fx-accent); color: #fff; font-weight: 700; }

.fx-rangepanel-side {
    width: 150px;
    flex-shrink: 0;
    border-left: 1px solid var(--fx-border);
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--fx-surface-inner);
}
.fx-rp-preset {
    text-align: left;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--fx-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    cursor: pointer;
    transition: background-color 100ms ease, color 100ms ease;
}
.fx-rp-preset:hover { background: var(--fx-surface); }
.fx-rp-preset.is-active { background: var(--fx-accent-soft); color: var(--fx-accent-strong); }
.fx-rp-preset .fx-option-check { flex-shrink: 0; opacity: 0; transform: scale(0.5); transition: opacity 120ms ease, transform 160ms cubic-bezier(0.34, 1.5, 0.64, 1); }
.fx-rp-preset.is-active .fx-option-check { opacity: 1; transform: scale(1); }

@media (max-width: 640px) {
    /* `left:50%` on the base rule centers against the trigger BUTTON's own
       box (its containing block) — fine on desktop where that button sits
       roughly mid-row, but on a narrow phone topbar the trigger can sit far
       off-center, dragging most of the panel off-screen with it. Switching
       to `position:fixed` re-centers against the viewport itself instead,
       the same floating-overlay treatment `.fx-modal` already uses. */
    .fx-rangepanel {
        position: fixed;
        top: 50%;
        left: 50%;
        right: auto;
        transform: translate(-50%, -50%);
        flex-direction: column;
        max-height: 86vh;
        overflow-y: auto;
    }
    .fx-rangepanel-main { width: 92vw; }
    .fx-rp-months { flex-direction: column; gap: 14px; }
    .fx-rp-month { width: 100%; }
    .fx-rangepanel-side { width: 100%; border-left: none; border-top: 1px solid var(--fx-border); flex-direction: row; flex-wrap: wrap; }
}
