@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');
/* Shared design tokens + global foundation — single source of truth for both apps. */
@import url('tokens.css');

/* ==========================================================================
   Maffooz Merchant Portal — Design System
   Mobile-first SaaS admin dashboard.

   Architecture:
   - .app-shell ............... Grid container (sidebar | topbar+main)
   - .sidebar ................. Desktop left navigation (collapsible)
   - .topbar .................. Sticky top app bar
   - .page-content ............ Main content area
   - .mobile-bottom-nav ....... Mobile-only floating bottom navigation

   Breakpoints (mobile-first):
   - base    : 0–639px   (small phones)
   - 640+    : large phones / phablets
   - 768+    : tablet — sidebar visible (collapsed by default)
   - 1024+   : desktop — sidebar expanded by default
   - 1280+   : large desktop
   ========================================================================== */

:root {
    /* App-specific tokens only. All shared design tokens (brand, surfaces, text,
       motion, shape, shadow, spacing, scales) now live in tokens.css, imported
       above, so customer + merchant cannot drift. UI_OPTIMIZATION.md sec 6.1. */

    /* Layout */
    --sidebar-w: 260px;
    --sidebar-w-collapsed: 76px;
    --topbar-h: 64px;

    /* Z-index scale (shared z-* are in tokens.css) */
    --z-sidebar: 30;
    --z-topbar: 40;
}

/* ==========================================================================
   Reset and base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; font-family: 'Inter', sans-serif; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
}

img, video, canvas, svg { max-width: 100%; height: auto; display: block; }
img.inline, .topbar img, .bottom-nav img, .avatar { display: inline-block; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }
table { border-collapse: collapse; width: 100%; }

h1, h2, h3, h4, .outfit { font-family: 'Outfit', sans-serif; line-height: 1.2; color: var(--text-strong); font-weight: 700; }
h1 { font-size: clamp(22px, 3.5vw, 30px); }
h2 { font-size: clamp(18px, 2.5vw, 22px); }
h3 { font-size: clamp(16px, 2vw, 18px); }
h4 { font-size: 14px; font-weight: 600; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001s !important;
        transition-duration: 0.001s !important;
    }
}

/* ==========================================================================
   Glass / surface utilities
   ========================================================================== */

.glass {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-md);
}

.glass-hover { transition: var(--transition); }
.glass-hover:hover {
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.15);
}

/* ==========================================================================
   App shell — sidebar + topbar + content (desktop)
   On mobile: only topbar + content + bottom-nav (sidebar hidden)

   State machine (mobile-first):
     base       : sidebar full-width with labels   (desktop default)
     tablet     : sidebar icon-only                (no labels, narrow)
     mobile     : sidebar hidden                   (replaced by bottom-nav)
     .is-collapsed (desktop only): user opt-in icon-only (no labels)
   ========================================================================== */

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "sidebar topbar"
        "sidebar main";
    transition: grid-template-columns 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile (≤767px) — sidebar removed; bottom-nav handles primary navigation */
@media (max-width: 767px) {
    .app-shell {
        grid-template-columns: 1fr;
        grid-template-areas:
            "topbar"
            "main";
        width: 100%;
        overflow-x: hidden;
    }
}

/* Tablet (768–1023px) — sidebar is icon-only, never expandable */
@media (min-width: 768px) and (max-width: 1023px) {
    .app-shell {
        grid-template-columns: var(--sidebar-w-collapsed) 1fr;
    }
    .app-shell .sidebar-brand .logo-text,
    .app-shell .sidebar-brand .logo-badge,
    .app-shell .sidebar-link .label,
    .app-shell .sidebar-section-label,
    .app-shell .sidebar-user .meta {
        opacity: 0;
        width: 0;
        pointer-events: none;
        overflow: hidden;
    }
    .app-shell .sidebar-link  { justify-content: center; }
    .app-shell .sidebar-user  { justify-content: center; padding: 8px 4px; }
}

/* Desktop (≥1024px) — labels visible by default. User can opt into icon-only via toggle. */
@media (min-width: 1024px) {
    .app-shell.is-collapsed {
        grid-template-columns: var(--sidebar-w-collapsed) 1fr;
    }
    .app-shell.is-collapsed .sidebar-brand .logo-text,
    .app-shell.is-collapsed .sidebar-brand .logo-badge,
    .app-shell.is-collapsed .sidebar-link .label,
    .app-shell.is-collapsed .sidebar-section-label,
    .app-shell.is-collapsed .sidebar-user .meta {
        opacity: 0;
        width: 0;
        pointer-events: none;
        overflow: hidden;
    }
    .app-shell.is-collapsed .sidebar-link { justify-content: center; }
    .app-shell.is-collapsed .sidebar-user { justify-content: center; padding: 8px 4px; }
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.sidebar {
    grid-area: sidebar;
    position: sticky;
    top: 0;
    height: 100vh;
    width: 100%;
    background: rgba(9, 7, 20, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--card-border);
    z-index: var(--z-sidebar);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: var(--transition);
}

@media (max-width: 767px) { .sidebar { display: none; } }

.sidebar-header {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--divider);
    height: var(--topbar-h);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.sidebar-brand .logo-text {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.sidebar-brand .logo-badge {
    background: var(--accent);
    color: #000;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.sidebar-toggle {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: var(--transition);
    flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--surface-3); color: var(--text-strong); }

/* Sidebar collapse toggle is only meaningful on desktop, where the
   sidebar can be wide. On tablet the sidebar is fixed icon-only. */
@media (max-width: 1023px) {
    .sidebar-toggle { display: none; }
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-section-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 12px 10px 6px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: visible;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
    min-height: 44px;
    position: relative;
}

.sidebar-link i {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    stroke-width: 2;
}

.sidebar-link:hover {
    background: var(--surface-3);
    color: var(--text-strong);
}

.sidebar-link.is-active {
    background: var(--primary-soft);
    color: var(--text-strong);
    font-weight: 600;
}

.sidebar-link.is-active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.sidebar-link .label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--divider);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    overflow: hidden;
    min-width: 0;
}
.sidebar-user:hover { background: var(--surface-3); }

.sidebar-user .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--accent);
    object-fit: cover;
    flex-shrink: 0;
}

.sidebar-user .meta {
    overflow: hidden;
    min-width: 0;
}
.sidebar-user .name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-strong);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user .role {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.sidebar-brand .logo-text,
.sidebar-brand .logo-badge,
.sidebar-link .label,
.sidebar-section-label,
.sidebar-user .meta {
    transition: opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1), width 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsed-state hides labels but keeps icons — handled per-breakpoint above */

/* ==========================================================================
   Top App Bar
   ========================================================================== */

.topbar {
    grid-area: topbar;
    position: sticky;
    top: 0;
    height: var(--topbar-h);
    z-index: var(--z-topbar);
    background: rgba(9, 7, 20, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 var(--pad-page-x);
}

.topbar-brand {
    display: none; /* shown on mobile only */
    align-items: center;
    gap: 8px;
}

@media (max-width: 767px) {
    .topbar-brand { display: flex; }
}

.topbar-brand .logo-text {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
@media (max-width: 380px) {
    .topbar-brand .logo-text { display: none; }
}
.topbar-brand .logo-badge {
    background: var(--accent);
    color: #000;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.topbar-title {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-strong);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (max-width: 767px) { .topbar-title { display: none; } }

.topbar-spacer { flex: 1; }

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.topbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--surface-3);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    min-height: 40px;
    white-space: nowrap;
}
.topbar-btn:hover { background: var(--card-border); color: var(--text-strong); }

.topbar-btn.is-icon { padding: 0; width: 40px; }

@media (max-width: 600px) {
    .topbar-btn .label { display: none; }
    .topbar-btn { width: 40px; padding: 0; }
}

/* Store status pill (inline in topbar) */
.store-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 12px;
    background: var(--surface-3);
    border: 1px solid var(--card-border);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
@keyframes greenPulse {
    0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(5, 150, 105, 0); }
    100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}
@keyframes grayPulse {
    0% { box-shadow: 0 0 0 0 rgba(100, 116, 139, 0.5); }
    70% { box-shadow: 0 0 0 6px rgba(100, 116, 139, 0); }
    100% { box-shadow: 0 0 0 0 rgba(100, 116, 139, 0); }
}

.store-status-pill .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}
.store-status-pill.is-online { border-color: rgba(16, 185, 129, 0.35); color: var(--success); }
.store-status-pill.is-online .dot { background: var(--success); animation: greenPulse 2s infinite; }
.store-status-pill.is-offline { border-color: rgba(100, 116, 139, 0.35); color: var(--text-muted); }
.store-status-pill.is-offline .dot { background: var(--text-muted); animation: grayPulse 2s infinite; }

/* Hide some controls on small screens; bottom-nav covers core navigation */
@media (max-width: 480px) {
    .topbar-actions .store-status-pill .label { display: none; }
}

/* Avatar dropdown trigger */
.avatar-trigger {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--accent);
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
    transition: var(--transition);
}
.avatar-trigger:hover { transform: scale(1.05); }
.avatar-trigger img { width: 100%; height: 100%; object-fit: cover; }

.avatar-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: rgba(15, 11, 32, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border-strong);
    border-radius: var(--radius-md);
    padding: 6px;
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    display: none;
}
.avatar-menu.is-open { display: block; }
.avatar-menu .menu-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-xs);
    color: var(--text-main);
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    min-height: 40px;
}
.avatar-menu .menu-link:hover { background: var(--surface-3); color: var(--text-strong); }
.avatar-menu .menu-link i { width: 16px; height: 16px; }
.avatar-menu .menu-divider { height: 1px; background: var(--divider); margin: 4px 0; }
.avatar-menu .menu-link.is-danger { color: #f87171; }
.avatar-menu .menu-link.is-danger:hover { background: var(--error-soft); color: #fca5a5; }

.avatar-wrapper { position: relative; }

/* ==========================================================================
   Page content
   ========================================================================== */

.page-content {
    grid-area: main;
    padding: var(--pad-page-y) var(--pad-page-x);
    padding-bottom: calc(var(--pad-page-y) + 24px);
    min-width: 0;
    width: 100%;
}

@media (max-width: 767px) {
    .page-content {
        padding-bottom: calc(var(--bottom-nav-h) + 28px);
    }
}

.page-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: clamp(20px, 3vw, 32px);
}

.page-header .title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: space-between;
}

.page-header h1 {
    font-size: clamp(22px, 3.2vw, 28px);
    font-weight: 700;
    margin: 0;
}

.page-header .subtitle {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

.page-header .actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==========================================================================
   Mobile bottom nav
   ========================================================================== */

.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-h);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(9, 7, 20, 0.96);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid var(--card-border);
    z-index: var(--z-bottom-nav);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
}

@media (max-width: 767px) {
    .mobile-bottom-nav { display: flex; }
}

.mobile-bottom-nav .inner {
    display: flex;
    flex: 1;
    align-items: stretch;
    justify-content: space-around;
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    transition: var(--transition);
    min-width: 0;
    padding: 6px 4px;
}
.bottom-nav-item i { width: 22px; height: 22px; stroke-width: 2; }
.bottom-nav-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.bottom-nav-item.is-active {
    color: var(--primary);
}
.bottom-nav-item.is-active i {
    transform: translateY(-2px);
    filter: drop-shadow(0 0 6px var(--primary-glow));
}

/* "More" panel for overflow nav items */
.more-sheet {
    display: none;
    position: fixed;
    bottom: var(--bottom-nav-h);
    left: 8px;
    right: 8px;
    background: rgba(15, 11, 32, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--card-border-strong);
    border-radius: var(--radius-md);
    padding: 10px;
    z-index: calc(var(--z-bottom-nav) + 1);
    box-shadow: var(--shadow-lg);
}
.more-sheet.is-open { display: block; }
.more-sheet .grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.more-sheet .grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 6px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 11px;
    font-weight: 500;
    transition: var(--transition);
    text-align: center;
}
.more-sheet .grid-item:hover { background: var(--surface-3); }
.more-sheet .grid-item i { width: 22px; height: 22px; color: var(--primary); }
.more-sheet .grid-item.is-danger i { color: #f87171; }

/* ==========================================================================
   KPI Cards
   ========================================================================== */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: clamp(12px, 1.5vw, 20px);
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}
@media (min-width: 481px) and (max-width: 600px) {
    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
}

.kpi-card {
    padding: 18px;
    border-radius: var(--radius-md);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: var(--transition);
    min-width: 0;
}
a.kpi-card { text-decoration: none; color: inherit; }
a.kpi-card:hover { border-color: var(--primary); transform: translateY(-3px) scale(1.02); box-shadow: var(--shadow-md); }
a.kpi-card:active { transform: translateY(-1px) scale(0.98); }

.kpi-card .icon-tile {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--surface-3);
}
.kpi-card .icon-tile i { width: 20px; height: 20px; }

.kpi-card.is-success .icon-tile { background: var(--success-soft); color: var(--success); }
.kpi-card.is-primary .icon-tile { background: var(--primary-soft); color: var(--primary); }
.kpi-card.is-accent  .icon-tile { background: var(--accent-glow); color: var(--accent); }
.kpi-card.is-info    .icon-tile { background: var(--info-soft); color: var(--info); }
.kpi-card.is-warning .icon-tile { background: var(--warning-soft); color: var(--warning); }
.kpi-card.is-secondary .icon-tile { background: rgba(236, 72, 153, 0.1); color: var(--secondary); }

.kpi-card .label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.kpi-card .value {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(20px, 3vw, 26px);
    font-weight: 800;
    color: var(--text-strong);
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-card .trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    align-self: flex-start;
}
.kpi-card .trend.is-up { background: var(--success-soft); color: var(--success); }
.kpi-card .trend.is-down { background: var(--error-soft); color: #f87171; }
.kpi-card .trend.is-neutral { background: var(--surface-3); color: var(--text-muted); }
.kpi-card .trend i { width: 12px; height: 12px; }

/* ==========================================================================
   Section card (main content panel)
   ========================================================================== */

.section-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: var(--pad-card);
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.section-header h2,
.section-header h3 {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.section-header h2 i,
.section-header h3 i { width: 20px; height: 20px; color: var(--primary); }

.section-header .actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin: -8px 0 16px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    min-height: 44px;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}
.btn:disabled, .btn[disabled] { cursor: not-allowed; opacity: 0.55; }
.btn i { width: 16px; height: 16px; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 100%);
    color: #000;
    box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-primary:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(236, 72, 153, 0.4); }

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}
.btn-success:not(:disabled):hover { transform: translateY(-1px); }

.btn-accent {
    background: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 100%);
    color: #000;
    font-weight: 700;
    box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-accent:not(:disabled):hover { transform: translateY(-1px); }

.btn-secondary {
    background: var(--surface-3);
    color: var(--text-main);
    border: 1px solid var(--card-border);
}
.btn-secondary:hover { background: var(--card-border); color: var(--text-strong); }

.btn-ghost {
    background: transparent;
    color: var(--text-main);
    border: 1px solid transparent;
}
.btn-ghost:hover { background: var(--surface-3); }

.btn-danger {
    background: var(--error-soft);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); color: var(--text-strong); }

.btn-sm { padding: 6px 12px; font-size: 12px; min-height: 36px; }
.btn-block { width: 100%; }

/* legacy btn-submit alias used by old forms */
.btn-submit {
    width: 100%;
    background: var(--accent);
    color: #000;
    border-radius: var(--radius-sm);
    padding: 14px;
    font-weight: 600;
    transition: var(--transition);
    min-height: 48px;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-submit:hover { background: #d97706; }
.btn-submit:disabled { cursor: not-allowed; opacity: 0.6; }

/* ==========================================================================
   Submit-button loading state (B1)
   --------------------------------------------------------------------------
   Any submit button carrying [data-loading] is locked + shows a spinner the
   moment its form submits, so a second tap on a slow connection can't fire a
   duplicate POST (add bank / payout / save profile / save store). The browser
   replaces the whole page on the server-rendered response, so we never need to
   "restore" the button — it just needs to stay disabled during the round-trip.
   ========================================================================== */
.btn[aria-busy="true"],
.btn-submit[aria-busy="true"] {
    cursor: progress;
    opacity: 0.75;
    pointer-events: none;          /* blocks the second tap at the pointer level */
}
.btn__spinner {
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: btnSpin 0.6s linear infinite;
    display: inline-block;
    flex: 0 0 auto;
}
@keyframes btnSpin { to { transform: rotate(360deg); } }

/* legacy nav-btn alias */
.nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 100%);
    color: #000;
    font-weight: 600;
    font-size: 13px;
    transition: var(--transition);
    min-height: 40px;
    text-decoration: none;
    box-shadow: 0 4px 14px var(--accent-glow);
    line-height: 1;
}
.nav-btn:hover { transform: translateY(-1px); }

/* ==========================================================================
   Forms
   ========================================================================== */

.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    background: rgba(9, 7, 20, 0.5);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text-strong);
    font-size: 16px; /* >=16px prevents iOS zoom */
    transition: var(--transition);
    min-height: 44px;
    font-family: inherit;
}
.form-textarea { resize: vertical; min-height: 96px; }

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-input:disabled,
.form-input[readonly] {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

.input-with-prefix {
    position: relative;
}
.input-with-prefix .prefix {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    pointer-events: none;
}
.input-with-prefix .form-input { padding-left: 48px; }

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}
.input-with-icon :is(i, svg) {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 16px;
    height: 16px;
    pointer-events: none;
}
.input-with-icon .form-input { padding-left: 42px; display: block; }

.field-help {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}
.field-error {
    font-size: 11px;
    color: #f87171;
    margin-top: 6px;
    display: block;
}

/* Range / discount slider */
input[type="range"].form-input {
    padding: 0;
    height: 8px;
    cursor: pointer;
    background: transparent;
    appearance: none;
    -webkit-appearance: none;
    border: none;
}
input[type="range"].form-input::-webkit-slider-runnable-track {
    height: 6px;
    background: linear-gradient(to right, var(--accent), var(--secondary));
    border-radius: 3px;
}
input[type="range"].form-input::-moz-range-track {
    height: 6px;
    background: linear-gradient(to right, var(--accent), var(--secondary));
    border-radius: 3px;
}
input[type="range"].form-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px; border-radius: 50%;
    background: #fff;
    border: 2px solid var(--accent);
    margin-top: -6px;
    cursor: pointer;
}
input[type="range"].form-input::-moz-range-thumb {
    width: 18px; height: 18px; border-radius: 50%;
    background: #fff; border: 2px solid var(--accent); cursor: pointer;
}

/* ==========================================================================
   Alerts & toasts
   ========================================================================== */

.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.4;
}
.alert i { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

.alert-success { background: var(--success-soft); border: 1px solid rgba(16, 185, 129, 0.3); color: #34d399; }
.alert-error   { background: var(--error-soft);   border: 1px solid rgba(239, 68, 68, 0.3);  color: #f87171; }
.alert-info    { background: var(--info-soft);    border: 1px solid rgba(59, 130, 246, 0.3); color: #60a5fa; }
.alert-warning { background: var(--warning-soft); border: 1px solid rgba(245, 158, 11, 0.3); color: var(--accent); }

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.badge-online,
.badge.is-success { background: var(--success-soft); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-offline,
.badge.is-error { background: var(--error-soft); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge.is-warning { background: var(--warning-soft); color: var(--accent); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge.is-info { background: var(--info-soft); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge.is-primary { background: var(--primary-soft); color: #c4b5fd; border: 1px solid rgba(139, 92, 246, 0.3); }
.badge.is-muted { background: var(--surface-3); color: var(--text-muted); border: 1px solid var(--card-border); }

/* ==========================================================================
   Quick action tiles
   ========================================================================== */

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}
@media (max-width: 480px) {
    .action-grid { grid-template-columns: 1fr; }
}
@media (min-width: 481px) and (max-width: 600px) {
    .action-grid { grid-template-columns: 1fr 1fr; }
}

.action-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius-md);
    background: var(--surface-3);
    border: 1px solid var(--card-border);
    transition: var(--transition);
    text-align: left;
    color: var(--text-strong);
    width: 100%;
    cursor: pointer;
    font-family: inherit;
    min-height: 64px;
    min-width: 0;
}
.action-tile:hover {
    background: rgba(139, 92, 246, 0.08);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateY(-1px);
}
.action-tile .icon-tile {
    width: 36px; height: 36px;
    border-radius: var(--radius-xs);
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.action-tile .icon-tile i { width: 18px; height: 18px; }
.action-tile .meta { display: flex; flex-direction: column; min-width: 0; }
.action-tile .meta .title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-strong);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.action-tile .meta .desc {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   Activity list (recent activity feed)
   ========================================================================== */

.activity-list {
    display: flex;
    flex-direction: column;
}
.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--divider);
    min-width: 0;
}
.activity-item:last-child { border-bottom: 0; }
.activity-item .icon-tile {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--surface-3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.activity-item .icon-tile i { width: 16px; height: 16px; color: var(--text-muted); }
.activity-item.is-success .icon-tile { background: var(--success-soft); }
.activity-item.is-success .icon-tile i { color: var(--success); }
.activity-item.is-warning .icon-tile { background: var(--warning-soft); }
.activity-item.is-warning .icon-tile i { color: var(--accent); }
.activity-item.is-info .icon-tile { background: var(--info-soft); }
.activity-item.is-info .icon-tile i { color: var(--info); }
.activity-item .body { flex: 1; min-width: 0; }
.activity-item .title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-strong);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.activity-item .meta {
    font-size: 11px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.activity-item .amount {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 13px;
    color: var(--text-strong);
    flex-shrink: 0;
}

/* ==========================================================================
   Segmented control (filters)
   ========================================================================== */

.segmented {
    display: inline-flex;
    background: var(--surface-3);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 4px;
    gap: 2px;
    flex-wrap: wrap;
}
.segmented-item {
    padding: 8px 14px;
    border-radius: var(--radius-xs);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition);
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.segmented-item:hover { color: var(--text-strong); }
.segmented-item.is-active {
    background: var(--primary-soft);
    color: var(--text-strong);
}
.segmented-item i { width: 14px; height: 14px; }

/* ==========================================================================
   Search bar
   ========================================================================== */

.search-bar {
    position: relative;
    width: 100%;
    max-width: 480px;
    display: flex;
    align-items: center;
}
.search-bar :is(i, svg) {
    position: absolute;
    left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); width: 16px; height: 16px;
    pointer-events: none;
}
.search-bar input {
    width: 100%;
    background: var(--surface-3);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 10px 12px 10px 42px;
    color: var(--text-strong);
    font-size: 14px;
    min-height: 42px;
    display: block;
}
.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ==========================================================================
   Data table -> mobile cards
   ========================================================================== */

.data-table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-sm);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
    min-width: 600px;
}
.data-table thead tr {
    background: rgba(9, 7, 20, 0.6);
    border-bottom: 1px solid var(--card-border);
    color: var(--text-muted);
}
.data-table th {
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--divider);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: var(--surface-3); }
.data-table .empty-row td { text-align: center; padding: 40px 16px; color: var(--text-muted); }

/* Mobile: hide thead, render rows as labeled cards */
@media (max-width: 767px) {
    .data-table-wrapper { overflow: visible; }
    .data-table { min-width: 0; display: block; }
    .data-table thead {
        position: absolute !important;
        left: -9999px !important;
        width: 1px; height: 1px; overflow: hidden;
    }
    .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
    .data-table tr {
        border: 1px solid var(--card-border);
        border-radius: var(--radius-md);
        background: rgba(9, 7, 20, 0.4);
        padding: 12px 14px;
        margin-bottom: 12px;
    }
    .data-table td {
        border-bottom: 1px solid var(--divider);
        padding: 8px 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        text-align: right;
        font-size: 13px;
    }
    .data-table td:last-child { border-bottom: 0; }
    .data-table td::before {
        content: attr(data-label);
        font-size: 10px;
        font-weight: 700;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.4px;
        flex: 0 0 auto;
        text-align: left;
    }
    .data-table .empty-row td { justify-content: center; text-align: center; padding: 32px 0; }
    .data-table .empty-row td::before { content: ''; }
    .data-table tr:hover { background: rgba(9, 7, 20, 0.4); }
}

/* ==========================================================================
   Empty state
   ========================================================================== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 16px;
    background: var(--surface-3);
    border: 1px dashed var(--card-border);
    border-radius: var(--radius-md);
    gap: 8px;
}
.empty-state .icon-tile {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}
.empty-state .icon-tile i { width: 24px; height: 24px; }
.empty-state h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-strong);
    margin: 0;
}
.empty-state p {
    color: var(--text-muted);
    font-size: 13px;
    max-width: 360px;
    margin: 0 0 12px;
}

/* ==========================================================================
   Stepper (multi-step add bank flow)
   ========================================================================== */

.stepper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.stepper-step {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.stepper-step .circle {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--surface-3);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}
.stepper-step .circle i { width: 14px; height: 14px; }
.stepper-step .label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stepper-step.is-active .circle {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
}
.stepper-step.is-active .label { color: var(--text-strong); }
.stepper-step.is-done .circle { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.stepper-step.is-done .label { color: var(--text-main); }
.stepper-divider {
    flex: 1;
    height: 2px;
    background: var(--divider);
    border-radius: 2px;
}
.stepper-divider.is-done { background: var(--success); }
@media (max-width: 600px) {
    .stepper-step .label { display: none; }
    .stepper-step { flex: 0 0 auto; }
}

/* ==========================================================================
   Bank account card
   ========================================================================== */

.bank-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.06) 0%, rgba(236, 72, 153, 0.04) 100%);
    border: 1px solid var(--card-border);
    transition: var(--transition);
    position: relative;
}
.bank-card.is-primary {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.18) 0%, rgba(236, 72, 153, 0.10) 100%);
    border-color: rgba(139, 92, 246, 0.4);
}
.bank-card .head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.bank-card .bank-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 15px;
    color: var(--text-strong);
}
.bank-card .acc-num {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-strong);
}
.bank-card .meta-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.bank-card .meta-row strong { color: var(--text-main); font-weight: 600; }
.bank-card .actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==========================================================================
   Eligibility checklist
   ========================================================================== */

.checklist { display: flex; flex-direction: column; gap: 10px; }
.checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    border: 1px solid var(--card-border);
    font-size: 13px;
    color: var(--text-main);
}
.checklist-item .icon-tile {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.checklist-item .icon-tile i { width: 14px; height: 14px; }
.checklist-item.is-done {
    background: var(--success-soft);
    border-color: rgba(16, 185, 129, 0.3);
}
.checklist-item.is-done .icon-tile { background: var(--success); color: #fff; }
.checklist-item.is-pending .icon-tile {
    background: var(--surface-3);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
}
.checklist-item .body { flex: 1; min-width: 0; }
.checklist-item .title { font-weight: 600; color: var(--text-strong); font-size: 13px; }
.checklist-item .desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ==========================================================================
   Toggle switch (legacy support)
   ========================================================================== */

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    transition: 0.3s;
    border-radius: 999px;
}
.slider::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    transition: 0.3s;
    border-radius: 50%;
}
input:checked + .slider {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.4);
}
input:checked + .slider::before { transform: translateX(20px); }

/* ==========================================================================
   Skeleton loader
   ========================================================================== */

.skeleton {
    /* sec 6.3b — brand-tinted shimmer (was neutral surface-3 / card-border) */
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.08) 25%, rgba(236, 72, 153, 0.16) 50%, rgba(139, 92, 246, 0.08) 75%);
    background-size: 200% 100%;
    animation: skel 1.6s infinite;
    border-radius: var(--radius-xs);
}
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-up { animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1.4s linear infinite; }

/* ==========================================================================
   Location autocomplete (used by store-profile)
   ========================================================================== */

.location-autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    background: rgba(15, 11, 32, 0.96);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--card-border-strong);
    border-radius: var(--radius-sm);
    z-index: var(--z-dropdown);
    max-height: 280px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    display: none;
}
.autocomplete-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--divider);
    transition: var(--transition);
}
.autocomplete-item:last-child { border-bottom: 0; }
.autocomplete-item:hover { background: var(--surface-3); }
.autocomplete-item.select-none { cursor: default; padding: 16px; text-align: center; }

/* ==========================================================================
   Avatar grid (store profile owner avatar selection)
   ========================================================================== */

.avatar-picker {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}
@media (max-width: 480px) { .avatar-picker { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 360px) { .avatar-picker { grid-template-columns: repeat(3, 1fr); } }

.avatar-picker img {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
    object-fit: cover;
}
.avatar-picker img.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ==========================================================================
   Chart container (Chart.js wrapper)
   ========================================================================== */

.chart-wrap {
    position: relative;
    width: 100%;
    height: clamp(220px, 32vw, 320px);
}

/* ==========================================================================
   Utility classes
   ========================================================================== */

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.flex-wrap { flex-wrap: wrap; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-error { color: #f87171; }
.text-accent { color: var(--accent); }
.text-strong { color: var(--text-strong); }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-xs { font-size: 11px; }
.text-sm { font-size: 13px; }

.hidden { display: none !important; }
@media (min-width: 768px) { .show-mobile-only { display: none !important; } }
@media (max-width: 767px) { .show-desktop-only { display: none !important; } }

.divider {
    height: 1px;
    background: var(--divider);
    margin: 16px 0;
}

/* ==========================================================================
   Print styles
   ========================================================================== */

@media print {
    .sidebar, .topbar, .mobile-bottom-nav, .more-sheet { display: none !important; }
    .app-shell { grid-template-columns: 1fr; grid-template-areas: "main"; }
    body { background: #fff !important; color: #000 !important; }
    .glass, .section-card, .kpi-card { background: #fff !important; color: #000 !important; border: 1px solid #ccc !important; box-shadow: none !important; }
}

/* === OTP inputs (match customer login) === */
.otp-boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 16px; }
@media (max-width: 480px) { .otp-boxes { gap: 6px; } }
@media (max-width: 360px) { .otp-boxes { gap: 4px; } }
.otp-box { aspect-ratio: 1; width: 100%; min-width: 0; padding: 0; box-sizing: border-box; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1.5px solid var(--card-border); color: var(--text-strong); font-family: 'Outfit'; font-size: clamp(18px,4.5vw,26px); font-weight: 700; text-align: center; transition: var(--transition); }
.otp-box:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); background: rgba(139,92,246,0.08); }
.otp-box.is-filled { border-color: rgba(139,92,246,0.4); background: rgba(139,92,246,0.06); }
.otp-box.is-error { border-color: rgba(239,68,68,0.6); box-shadow: 0 0 0 3px rgba(239,68,68,0.2); animation: otpShake 0.4s; }
@keyframes otpShake { 10%,90% { transform: translateX(-2px); } 20%,80% { transform: translateX(3px); } 30%,50%,70% { transform: translateX(-4px); } 40%,60% { transform: translateX(4px); } }


/* ==========================================================================
   LIGHT THEME — html[data-theme="light"]
   Dark is the default. Additive overrides only: palette tokens plus the few
   hardcoded dark panels and inputs. Hardcoded white text now uses
   --text-strong so text flips automatically. Brand gradients are unchanged.
   ========================================================================== */
html[data-theme="light"] {
    color-scheme: light;

    --bg-gradient: linear-gradient(135deg, #f5f5fb 0%, #eceef6 50%, #f6f5fb 100%);
    --bg-app: #f3f3f9;
    --surface-1: #ffffff;
    --surface-2: #ffffff;
    --surface-3: rgba(17, 17, 40, 0.03);
    --card-bg: #ffffff;
    --card-border: rgba(17, 17, 40, 0.10);
    --card-border-strong: rgba(17, 17, 40, 0.16);
    --divider: rgba(17, 17, 40, 0.08);

    --text-main: #2c2c3f;
    --text-strong: #14142b;
    --text-muted: #56566b;
    --text-faint: #9595aa;

    --shadow-sm: 0 2px 8px rgba(17, 17, 40, 0.06);
    --shadow-md: 0 8px 24px rgba(17, 17, 40, 0.10);
    --shadow-lg: 0 16px 40px rgba(17, 17, 40, 0.14);
}

/* Chrome: dark glass -> light glass */
html[data-theme="light"] .sidebar { background: rgba(255, 255, 255, 0.88); }
html[data-theme="light"] .topbar { background: rgba(255, 255, 255, 0.85); }
html[data-theme="light"] .mobile-bottom-nav { background: rgba(255, 255, 255, 0.92); }

/* Popovers: avatar menu + mobile "More" sheet */
html[data-theme="light"] .avatar-menu,
html[data-theme="light"] .more-sheet { background: rgba(255, 255, 255, 0.98); box-shadow: 0 16px 40px rgba(17, 17, 40, 0.18); }

/* Inputs: dark/translucent fills -> solid light */
html[data-theme="light"] .form-input,
html[data-theme="light"] .form-select,
html[data-theme="light"] .form-textarea,
html[data-theme="light"] .otp-box { background: #ffffff; }
html[data-theme="light"] .otp-box.is-filled { background: rgba(139, 92, 246, 0.06); }

/* === Theme toggle button (topbar) ========================================= */
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--card-border); color: var(--text-muted); cursor: pointer; transition: var(--transition); flex-shrink: 0; }
.theme-toggle:hover { color: var(--text-strong); border-color: var(--primary); }
.theme-toggle :is(i, svg) { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: inline-block; }
html[data-theme="light"] .theme-toggle .icon-sun { display: inline-block; }
html[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* Login sandbox OTP toast: darken the amber text for contrast on light. */
html[data-theme="light"] .otp-toast { color: #92400e; }
html[data-theme="light"] .otp-toast .label { color: #b45309; }
html[data-theme="light"] .otp-toast .code { color: var(--text-strong); }

/* Data table (orders/settlements): dark header/rows -> light */
html[data-theme="light"] .data-table thead tr { background: rgba(17, 17, 40, 0.04); }
html[data-theme="light"] .location-autocomplete-dropdown { background: rgba(255, 255, 255, 0.98); box-shadow: 0 16px 40px rgba(17, 17, 40, 0.18); }
@media (max-width: 767px) {
    html[data-theme="light"] .data-table tr { background: #ffffff; }
    html[data-theme="light"] .data-table tr:hover { background: rgba(17, 17, 40, 0.04); }
}

/* ==========================================================================
   sec 6.3c — Tactile press feedback
   Interactive controls dip slightly on press. End-of-file so :active wins over
   earlier :hover transforms; animates via existing `transition: var(--transition)`.
   Skipped for users who prefer reduced motion.
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
    .btn:active,
    .sidebar-link:active {
        transform: scale(0.98);
    }
}


/* ============================================================
   Accessibility utilities — UI Optimization Plan, Phase 2
   Additive only: skip link, screen-reader-only text, and a
   consistent keyboard focus ring. Plain CSS (no Tailwind).
   ============================================================ */

/* Visually hidden, but still exposed to assistive technology. */
.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip-to-content link: off-screen until keyboard-focused, then pinned
   top-left so keyboard / screen-reader users can jump past the chrome. */
.skip-link {
    position: absolute;
    left: 8px;
    top: -56px;
    z-index: 1000;
    padding: 10px 16px;
    background: var(--accent, #f59e0b);
    color: #000;
    font-weight: 700;
    font-size: 14px;
    line-height: 1;
    border-radius: 8px;
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    transition: top 0.15s ease;
}
.skip-link:focus {
    top: 8px;
    outline: 2px solid #000;
    outline-offset: 2px;
}

/* Consistent, visible keyboard focus ring (WCAG 2.4.7). Shows only for
   keyboard / AT focus via :focus-visible, never on a plain mouse click. */
:focus-visible {
    outline: 2px solid var(--accent, #f59e0b);
    outline-offset: 2px;
}
:focus:not(:focus-visible) {
    outline: none;
}


/* =====================================================================
   Live "payment received" toast notifications (merchant dashboard).
   Injected/managed by the polling script in layout.html. Namespaced
   with .mz-toast* to avoid collisions; all design tokens have fallbacks
   so the toast renders even if a token is absent.
   ===================================================================== */
.mz-toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
    pointer-events: none;
}

.mz-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--surface, #ffffff);
    border: 1px solid var(--divider, rgba(17, 17, 40, 0.08));
    border-left: 4px solid var(--success, #16a34a);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 10px 30px rgba(17, 17, 40, 0.16);
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.32s ease;
}

.mz-toast.is-visible { transform: translateX(0); opacity: 1; }
.mz-toast.is-leaving { transform: translateX(120%); opacity: 0; }

.mz-toast-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 50%;
    background: var(--success-soft, rgba(22, 163, 74, 0.12));
    color: var(--success, #16a34a);
}

.mz-toast-icon i,
.mz-toast-icon svg { width: 20px; height: 20px; }

.mz-toast-body { flex: 1 1 auto; min-width: 0; }
.mz-toast-title { font-weight: 600; font-size: 0.92rem; color: var(--text-strong, #111128); }
.mz-toast-desc { font-size: 0.85rem; color: var(--text-muted, #56566b); margin-top: 2px; word-break: break-word; }

.mz-toast-close {
    flex: 0 0 auto;
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
    color: var(--text-muted, #56566b);
    padding: 2px 4px;
    border-radius: 6px;
}
.mz-toast-close:hover { color: var(--text-strong, #111128); }

@media (max-width: 640px) {
    .mz-toast-container { top: 12px; right: 12px; left: 12px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    .mz-toast { transition: opacity 0.2s ease; transform: none; }
    .mz-toast.is-leaving { transform: none; }
}
