/* =====================================================================
   HE5 Mobile — Design System (wondr-clone for ISP)
   ===================================================================== */

/* ---------- CSS Variables (light defaults) ---------- */
:root {
    /* Brand palette */
    --c-orange:        #FF6B00;
    --c-orange-soft:   #FF8A33;
    --c-orange-deep:   #E55A00;
    --c-teal:          #14CFC0;
    --c-teal-soft:     #5FE3D7;
    --c-lime:          #D4FF3F;
    --c-lime-soft:     #E8FF85;
    --c-purple:        #B5A7FF;
    --c-pink:          #FFB6E0;
    --c-dark:          #0A0A0A;
    --c-cream:         #FFFAF0;

    /* Semantic */
    --c-success:       #14CFC0;
    --c-danger:        #FF4D6D;
    --c-warning:       #FFB020;
    --c-info:          #B5A7FF;

    /* Surface */
    --bg-app:          var(--c-cream);
    --bg-card:         #FFFFFF;
    --bg-elevated:     #FFFFFF;
    --bg-muted:        #F5F1E8;
    --bg-overlay:      rgba(10, 10, 10, 0.5);

    /* Text */
    --text-primary:    #0A0A0A;
    --text-secondary:  #5A5A5A;
    --text-muted:      #999999;
    --text-on-brand:   #FFFFFF;

    /* Border */
    --border-soft:     rgba(10, 10, 10, 0.06);
    --border-strong:   rgba(10, 10, 10, 0.12);

    /* Spacing */
    --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
    --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 40px; --s-9: 56px;

    /* Radius */
    --r-sm: 12px; --r-md: 16px; --r-lg: 20px; --r-xl: 28px; --r-2xl: 36px; --r-pill: 999px;

    /* Shadow */
    --sh-1: 0 2px 8px rgba(10, 10, 10, 0.04);
    --sh-2: 0 8px 24px rgba(10, 10, 10, 0.06);
    --sh-3: 0 16px 40px rgba(255, 107, 0, 0.18);
    --sh-glow-teal: 0 16px 40px rgba(20, 207, 192, 0.25);

    /* Typography */
    --ff-sans: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --ff-mono: 'Space Mono', 'Courier New', ui-monospace, monospace;
    --fs-xs: 11px; --fs-sm: 13px; --fs-base: 15px; --fs-md: 16px; --fs-lg: 18px;
    --fs-xl: 22px; --fs-2xl: 28px; --fs-3xl: 36px; --fs-4xl: 48px;
    --fw-regular: 400; --fw-medium: 500; --fw-semibold: 600; --fw-bold: 700;

    /* Layout */
    --h-app-bar: 64px;
    --h-bottom-nav: 72px;
    --max-width: 480px;

    /* Motion */
    --ease-out: cubic-bezier(0.2, 0.9, 0.3, 1);
    --ease-in:  cubic-bezier(0.4, 0, 1, 1);
}

/* Dark theme overrides */
[data-theme="dark"] {
    --bg-app:        #121013;
    --bg-card:       #1C1A1F;
    --bg-elevated:   #26232B;
    --bg-muted:      #1F1D22;
    --text-primary:  #F5F1E8;
    --text-secondary:#B5B1AC;
    --text-muted:    #807C7A;
    --border-soft:   rgba(255, 250, 240, 0.06);
    --border-strong: rgba(255, 250, 240, 0.12);
    --sh-1: 0 2px 8px rgba(0, 0, 0, 0.3);
    --sh-2: 0 8px 24px rgba(0, 0, 0, 0.35);
    --sh-3: 0 16px 40px rgba(255, 107, 0, 0.25);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}
body {
    font-family: var(--ff-sans);
    font-size: var(--fs-base);
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-app);
    min-height: 100vh;
    min-height: 100dvh;
    touch-action: manipulation;
    overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: var(--fw-semibold); letter-spacing: -0.01em; }
p { margin: 0; }
input, textarea, select { font-family: inherit; }

/* ---------- Layout shell ---------- */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: var(--max-width);
    margin: 0 auto;
    background: var(--bg-app);
    position: relative;
}
.app-main {
    flex: 1;
    padding: var(--s-4);
    padding-bottom: calc(64px + var(--s-7) + env(safe-area-inset-bottom));
}
.app-main--no-nav { padding-bottom: var(--s-4); }

/* ---------- App Bar ---------- */
.app-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: var(--h-app-bar);
    padding: env(safe-area-inset-top) var(--s-4) 0;
    display: flex;
    align-items: center;
    gap: var(--s-3);
    background: var(--bg-app);
    backdrop-filter: blur(12px);
}
.app-bar > * { margin-top: 0; align-self: center; }
.app-bar__greeting {
    flex: 1;
    overflow: hidden;
}
.app-bar__greeting small {
    display: block;
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.app-bar__greeting strong {
    display: block;
    color: var(--text-primary);
    font-size: var(--fs-lg);
    font-weight: var(--fw-semibold);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-bar__action {
    width: 44px; height: 44px;
    border-radius: var(--r-pill);
    background: var(--bg-card);
    color: var(--text-primary);
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: var(--sh-1);
    transition: transform 0.2s var(--ease-out);
}
.app-bar__action:active { transform: scale(0.95); }
.app-bar__notif {
    position: relative;
    text-decoration: none;
}
/* ---------- Notification list (read/unread state) ---------- */
.notif-item--unread .list-item__title {
    font-weight: var(--fw-bold);
}
.notif-item--read {
    opacity: 0.62;
}
.notif-item--read .list-item__avatar {
    filter: grayscale(0.5);
}
.notif-item--read .list-item__title {
    font-weight: var(--fw-medium);
    color: var(--text-secondary);
}
.notif-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--c-orange);
    margin-right: 6px;
    box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.18);
    vertical-align: middle;
    margin-bottom: 2px;
}

.app-bar__notif-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--c-orange);
    color: #fff;
    font-size: 10px;
    font-weight: var(--fw-bold);
    line-height: 18px;
    text-align: center;
    border: 2px solid var(--bg-app);
    box-sizing: content-box;
}
.app-bar__avatar {
    width: 44px; height: 44px;
    border-radius: var(--r-pill);
    background: linear-gradient(135deg, var(--c-orange), var(--c-orange-soft));
    color: white;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: var(--fw-bold);
    font-size: var(--fs-md);
}

/* ---------- Hero card (solid orange + scattered bubbles, wondr-style) ---------- */
.hero-card {
    position: relative;
    border-radius: var(--r-xl);
    padding: var(--s-6);
    color: var(--text-on-brand);
    background: var(--c-orange-soft);
    box-shadow: var(--sh-3);
    overflow: hidden;
    margin-bottom: var(--s-5);
    isolation: isolate;
}
/* Scatter of small bubbles only — no large halo, base stays uniform */
.hero-card::before { content: none; }
.hero-card::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background-image:
        radial-gradient(circle at 88% 28%, rgba(255,255,255,0.16) 7px, transparent 8px),
        radial-gradient(circle at 76% 75%, rgba(255,255,255,0.13) 9px, transparent 10px),
        radial-gradient(circle at 14% 30%, rgba(255,255,255,0.12) 5px, transparent 6px),
        radial-gradient(circle at 32% 85%, rgba(255,255,255,0.14) 7px, transparent 8px),
        radial-gradient(circle at 62% 14%, rgba(255,255,255,0.10) 4px, transparent 5px),
        radial-gradient(circle at 95% 58%, rgba(255,255,255,0.11) 6px, transparent 7px),
        radial-gradient(circle at 48% 50%, rgba(255,255,255,0.08) 3px, transparent 4px);
}
.hero-card__label {
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    opacity: 0.85;
}
.hero-card__amount {
    font-family: var(--ff-mono);
    font-size: var(--fs-3xl);
    font-weight: var(--fw-bold);
    line-height: 1.1;
    margin: var(--s-2) 0 var(--s-4);
    letter-spacing: -0.02em;
}
.hero-card__amount-currency {
    font-size: var(--fs-md);
    font-weight: var(--fw-medium);
    opacity: 0.85;
    margin-right: var(--s-1);
}
.hero-card__meta {
    display: flex; align-items: center; gap: var(--s-2);
    font-size: var(--fs-sm);
    opacity: 0.9;
    margin-bottom: var(--s-5);
}
.hero-card__cta {
    width: 100%;
}

/* ---------- Generic card ---------- */
.card {
    position: relative;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.78) 0%, rgba(255, 250, 240, 0.55) 100%);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--r-lg);
    padding: var(--s-5);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.7),
        0 1px 2px rgba(10, 10, 10, 0.04),
        0 8px 24px rgba(10, 10, 10, 0.06),
        0 20px 48px rgba(255, 107, 0, 0.08);
    margin-bottom: var(--s-4);
    overflow: hidden;
    isolation: isolate;
    transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}
/* Soft tinted glow behind card — gives the glass something to blur over */
.card::before {
    content: "";
    position: absolute;
    inset: -40% -20% auto auto;
    width: 60%;
    aspect-ratio: 1;
    background: radial-gradient(circle, rgba(255, 138, 51, 0.18) 0%, transparent 70%);
    z-index: -2;
    pointer-events: none;
}
.card::after {
    content: "";
    position: absolute;
    inset: auto auto -40% -30%;
    width: 70%;
    aspect-ratio: 1;
    background: radial-gradient(circle, rgba(20, 207, 192, 0.16) 0%, transparent 70%);
    z-index: -2;
    pointer-events: none;
}
.card:hover {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        0 2px 4px rgba(10, 10, 10, 0.05),
        0 12px 28px rgba(10, 10, 10, 0.08),
        0 28px 56px rgba(255, 107, 0, 0.12);
    transform: translateY(-2px);
}
[data-theme="dark"] .card {
    background:
        linear-gradient(135deg, rgba(255, 250, 240, 0.07) 0%, rgba(255, 250, 240, 0.03) 100%);
    border: 1px solid rgba(255, 250, 240, 0.08);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 1px 2px rgba(0, 0, 0, 0.35),
        0 8px 24px rgba(0, 0, 0, 0.4),
        0 20px 48px rgba(255, 107, 0, 0.10);
}
[data-theme="dark"] .card::before { background: radial-gradient(circle, rgba(255, 138, 51, 0.22) 0%, transparent 70%); }
[data-theme="dark"] .card::after  { background: radial-gradient(circle, rgba(20, 207, 192, 0.18) 0%, transparent 70%); }
.card-flat {
    background: var(--bg-muted);
    border-radius: var(--r-lg);
    padding: var(--s-4);
}
.card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-3);
    margin-bottom: var(--s-5);
}
.card-stat {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--r-lg);
    padding: var(--s-4);
    box-shadow: var(--sh-1);
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    overflow: hidden;
    isolation: isolate;
    text-decoration: none;
}
/* Bubble decoration layer (used by all colored variants) */
.card-stat--orange::after,
.card-stat--teal::after,
.card-stat--lime::after,
.card-stat--purple::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background-image:
        radial-gradient(circle at 88% 22%, rgba(255,255,255,0.20) 7px, transparent 8px),
        radial-gradient(circle at 78% 82%, rgba(255,255,255,0.14) 9px, transparent 10px),
        radial-gradient(circle at 18% 70%, rgba(255,255,255,0.12) 6px, transparent 7px),
        radial-gradient(circle at 60% 12%, rgba(255,255,255,0.10) 4px, transparent 5px);
}
/* Opt-out: keep gradient, remove bubbles */
.card-stat--plain::after { content: none; }
/* Gradient color variants */
.card-stat--orange {
    background: linear-gradient(135deg, var(--c-orange) 0%, var(--c-orange-soft) 60%, #FFB347 100%);
    color: #FFFFFF;
}
.card-stat--teal {
    background: linear-gradient(135deg, #0FB8AB 0%, var(--c-teal) 55%, var(--c-teal-soft) 100%);
    color: #FFFFFF;
}
.card-stat--lime {
    background: linear-gradient(135deg, #B8E635 0%, var(--c-lime) 60%, var(--c-lime-soft) 100%);
    color: var(--c-dark);
}
.card-stat--purple {
    background: linear-gradient(135deg, #9C8AFF 0%, var(--c-purple) 60%, #D6CCFF 100%);
    color: #FFFFFF;
}

/* Override label/value/sub colors when card is colored */
.card-stat--orange .card-stat__label,
.card-stat--teal   .card-stat__label,
.card-stat--purple .card-stat__label { color: rgba(255, 255, 255, 0.85); }
.card-stat--lime   .card-stat__label { color: rgba(10, 10, 10, 0.7); }

.card-stat--orange .card-stat__value,
.card-stat--teal   .card-stat__value,
.card-stat--purple .card-stat__value { color: #FFFFFF; }
.card-stat--lime   .card-stat__value { color: var(--c-dark); }

.card-stat--orange .card-stat__sub,
.card-stat--teal   .card-stat__sub,
.card-stat--purple .card-stat__sub { color: rgba(255, 255, 255, 0.75); }
.card-stat--lime   .card-stat__sub { color: rgba(10, 10, 10, 0.6); }

.card-stat__icon {
    width: 40px; height: 40px;
    border-radius: var(--r-md);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 18px;
}
/* Icon bg becomes translucent white when card itself is colored */
.card-stat--orange .card-stat__icon,
.card-stat--teal   .card-stat__icon,
.card-stat--purple .card-stat__icon { background: rgba(255, 255, 255, 0.22); color: #FFFFFF; }
.card-stat--lime   .card-stat__icon { background: rgba(10, 10, 10, 0.12); color: var(--c-dark); }

/* Standalone icon variants (used inside white cards) */
.card-stat__icon--orange { background: rgba(255, 107, 0, 0.12); color: var(--c-orange); }
.card-stat__icon--teal   { background: rgba(20, 207, 192, 0.14); color: var(--c-teal); }
.card-stat__icon--lime   { background: rgba(212, 255, 63, 0.25); color: #6E8E0A; }
.card-stat__icon--purple { background: rgba(181, 167, 255, 0.18); color: #5A4ECC; }
[data-theme="dark"] .card-stat__icon--lime { color: var(--c-lime); }
[data-theme="dark"] .card-stat__icon--purple { color: var(--c-purple); }
.card-stat__label {
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.card-stat__value {
    font-size: var(--fs-xl);
    font-weight: var(--fw-bold);
    color: var(--text-primary);
    line-height: 1.1;
    font-family: var(--ff-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-stat__sub {
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

/* ---------- Section header ---------- */
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin: var(--s-5) 0 var(--s-3);
}
.section-header h3 {
    font-size: var(--fs-lg);
    font-weight: var(--fw-semibold);
}
.section-header a {
    font-size: var(--fs-sm);
    color: var(--c-orange);
    font-weight: var(--fw-medium);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: var(--s-2);
    height: 56px; padding: 0 var(--s-6);
    border-radius: var(--r-pill);
    font-weight: var(--fw-semibold);
    font-size: var(--fs-md);
    transition: transform 0.15s var(--ease-out), box-shadow 0.2s var(--ease-out), background 0.2s var(--ease-out);
    cursor: pointer; user-select: none;
    text-align: center;
}
.btn:active { transform: scale(0.97); }
.btn--block { width: 100%; }
.btn--sm { height: 40px; padding: 0 var(--s-4); font-size: var(--fs-sm); }
.btn--lg { height: 64px; font-size: var(--fs-lg); }

.btn-primary {
    background: var(--c-dark);
    color: var(--c-cream);
}
.btn-primary:hover { background: #1A1A1A; }

.btn-orange {
    background: var(--c-orange);
    color: white;
    box-shadow: 0 8px 20px rgba(255, 107, 0, 0.35);
}
.btn-teal {
    background: var(--c-teal);
    color: #FFFFFF;
}
.btn-lime {
    background: var(--c-lime);
    color: var(--c-dark);
}
.btn-ghost {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1.5px solid var(--border-strong);
}
.btn-danger {
    background: var(--c-danger);
    color: white;
}
.btn-icon {
    width: 44px; height: 44px;
    border-radius: var(--r-md);
    background: var(--bg-card);
    color: var(--text-primary);
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: var(--sh-1);
}

/* ---------- FAB ---------- */
.fab {
    position: fixed;
    right: var(--s-5);
    bottom: calc(var(--h-bottom-nav) + var(--s-4) + env(safe-area-inset-bottom));
    width: 56px; height: 56px;
    border-radius: var(--r-pill);
    background: linear-gradient(135deg, var(--c-orange), var(--c-orange-soft));
    color: white;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 22px;
    box-shadow: 0 12px 28px rgba(255, 107, 0, 0.4);
    z-index: 40;
}

/* ---------- List items ---------- */
.list {
    background: var(--bg-card);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    overflow: hidden;
    margin-bottom: var(--s-4);
}
.list-item {
    display: flex; align-items: center; gap: var(--s-3);
    padding: var(--s-4);
    color: inherit;
    transition: background 0.15s var(--ease-out);
}
.list-item + .list-item {
    border-top: 1px solid var(--border-soft);
}
.list-item:active {
    background: var(--bg-muted);
}
.list-item__avatar {
    width: 48px; height: 48px;
    border-radius: var(--r-pill);
    background: linear-gradient(135deg, var(--c-orange-soft), var(--c-pink));
    color: white;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: var(--fw-bold);
    font-size: var(--fs-md);
    flex-shrink: 0;
}
.list-item__avatar--teal { background: linear-gradient(135deg, var(--c-teal), var(--c-teal-soft)); color: var(--c-dark); }
.list-item__avatar--purple { background: linear-gradient(135deg, var(--c-purple), var(--c-pink)); color: white; }
.list-item__avatar--lime { background: linear-gradient(135deg, var(--c-lime), var(--c-lime-soft)); color: var(--c-dark); }
.list-item__body {
    flex: 1;
    min-width: 0;
}
.list-item__title {
    font-weight: var(--fw-semibold);
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.list-item__sub {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.list-item__trail {
    flex-shrink: 0;
    text-align: right;
}
.list-item__trail-amount {
    font-family: var(--ff-mono);
    font-weight: var(--fw-bold);
    color: var(--text-primary);
    font-size: var(--fs-sm);
}

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: var(--s-1);
    padding: 4px 10px;
    border-radius: var(--r-pill);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    letter-spacing: 0.02em;
}
.badge-active  { background: rgba(20, 207, 192, 0.16); color: #0A8B82; }
.badge-isolir  { background: rgba(255, 107, 0, 0.14); color: var(--c-orange-deep); }
.badge-off     { background: rgba(10, 10, 10, 0.08); color: var(--text-secondary); }
.badge-warning { background: rgba(255, 176, 32, 0.18); color: #B57400; }
.badge-muted   { background: var(--bg-muted); color: var(--text-muted); }
.badge-lime    { background: var(--c-lime); color: var(--c-dark); }
[data-theme="dark"] .badge-active { color: var(--c-teal-soft); }
[data-theme="dark"] .badge-isolir { color: var(--c-orange-soft); }

/* ---------- Inputs ---------- */
.input-group { margin-bottom: var(--s-4); }
.input-label {
    display: block;
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--text-secondary);
    margin-bottom: var(--s-2);
}
.input,
.select,
.textarea {
    width: 100%;
    height: 56px;
    padding: 0 var(--s-4);
    border-radius: var(--r-md);
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1.5px solid var(--border-strong);
    font-size: var(--fs-md);
    transition: border 0.15s var(--ease-out), box-shadow 0.2s var(--ease-out);
    -webkit-appearance: none;
    appearance: none;
}
.textarea {
    height: auto;
    min-height: 100px;
    padding: var(--s-3) var(--s-4);
    line-height: 1.5;
    resize: vertical;
}
.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--c-orange);
    box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.12);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }

.input-search {
    position: relative;
}
.input-search input {
    padding-left: 48px;
}
.input-search__icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* ---------- Chips (filter) ---------- */
.chip-row {
    display: flex; gap: var(--s-2);
    overflow-x: auto;
    padding-bottom: var(--s-2);
    margin: 0 calc(var(--s-4) * -1) var(--s-3);
    padding-left: var(--s-4);
    padding-right: var(--s-4);
    scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
    display: inline-flex; align-items: center; gap: var(--s-1);
    height: 36px;
    padding: 0 var(--s-4);
    border-radius: var(--r-pill);
    background: var(--bg-card);
    color: var(--text-primary);
    font-weight: var(--fw-medium);
    font-size: var(--fs-sm);
    box-shadow: var(--sh-1);
    flex-shrink: 0;
    border: 1.5px solid transparent;
    transition: background 0.15s var(--ease-out);
    cursor: pointer;
}
.chip.is-active {
    background: var(--c-dark);
    color: var(--c-cream);
}

/* ---------- Date chip (mini calendar tile) ---------- */
.date-chip-row {
    display: flex; gap: var(--s-2);
    overflow-x: auto;
    padding-bottom: var(--s-2);
    margin: 0 calc(var(--s-4) * -1) var(--s-3);
    padding-left: var(--s-4);
    padding-right: var(--s-4);
    scrollbar-width: none;
}
.date-chip-row::-webkit-scrollbar { display: none; }
.date-chip {
    flex-shrink: 0;
    width: 56px;
    height: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border-radius: var(--r-md);
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--sh-1);
    border: 1.5px solid transparent;
    text-decoration: none;
    transition: transform 0.15s var(--ease-out), background 0.2s var(--ease-out);
    cursor: pointer;
}
.date-chip:active { transform: scale(0.94); }
.date-chip__num {
    font-family: var(--ff-mono);
    font-size: 22px;
    font-weight: var(--fw-bold);
    line-height: 1;
}
.date-chip__label {
    font-size: 9px;
    font-weight: var(--fw-medium);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.date-chip.is-active {
    background: linear-gradient(135deg, var(--c-orange), var(--c-orange-soft));
    color: #FFFFFF;
    box-shadow: 0 8px 18px rgba(255, 107, 0, 0.35);
}
.date-chip.is-active .date-chip__label {
    color: rgba(255, 255, 255, 0.85);
}
.date-chip--all {
    width: 64px;
}
.date-chip--all i {
    font-size: 18px;
}
.date-chip--all.is-active {
    background: var(--c-dark);
}

/* ---------- Bottom nav ---------- */
.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: calc(var(--s-3) + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: calc(100% - var(--s-6));
    max-width: calc(var(--max-width) - var(--s-6));
    height: 64px;
    padding: 6px;
    background: var(--c-dark);
    border-radius: var(--r-pill);
    display: flex;
    align-items: stretch;
    gap: 4px;
    z-index: 60;
    box-shadow: 0 12px 36px rgba(10, 10, 10, 0.28), 0 4px 12px rgba(10, 10, 10, 0.18);
}
.bottom-nav__item {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.55);
    border-radius: var(--r-pill);
    transition: flex 0.32s var(--ease-out), background 0.2s var(--ease-out), color 0.2s var(--ease-out);
    position: relative;
    text-decoration: none;
    overflow: hidden;
    min-width: 44px;
    padding: 0 6px;
}
.bottom-nav__item i {
    font-size: 18px;
    flex-shrink: 0;
}
.bottom-nav__item span {
    font-size: 13px;
    font-weight: var(--fw-semibold);
    letter-spacing: 0.01em;
    white-space: nowrap;
    max-width: 0;
    opacity: 0;
    transition: max-width 0.32s var(--ease-out), opacity 0.2s var(--ease-out) 0.05s;
}
.bottom-nav__item.is-active {
    flex: 2.2;
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.1);
}
.bottom-nav__item.is-active span {
    max-width: 120px;
    opacity: 1;
}
.bottom-nav__item:not(.is-active):active {
    background: rgba(255, 255, 255, 0.05);
}
.bottom-nav__item.is-disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* Light theme — white pill nav with teal active capsule */
[data-theme="light"] .bottom-nav {
    background: #FFFFFF;
    box-shadow: 0 12px 36px rgba(20, 207, 192, 0.18), 0 4px 14px rgba(10, 10, 10, 0.08);
    border: 1px solid var(--border-soft);
}
[data-theme="light"] .bottom-nav__item {
    color: var(--text-muted);
}
[data-theme="light"] .bottom-nav__item.is-active {
    color: #FFFFFF;
    background: var(--c-teal);
    box-shadow: 0 6px 16px rgba(20, 207, 192, 0.4);
}
[data-theme="light"] .bottom-nav__item:not(.is-active):active {
    background: rgba(20, 207, 192, 0.08);
    color: var(--c-teal);
}

/* ---------- Modal / bottom sheet ---------- */
.sheet-backdrop {
    position: fixed; inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(2px);
    z-index: 100;
    opacity: 0;
    transition: opacity 0.2s var(--ease-out);
    pointer-events: none;
}
.sheet-backdrop.is-open { opacity: 1; pointer-events: auto; }
.sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--bg-card);
    border-top-left-radius: var(--r-2xl);
    border-top-right-radius: var(--r-2xl);
    padding: var(--s-3) var(--s-5) calc(var(--s-6) + env(safe-area-inset-bottom));
    z-index: 101;
    transform: translateY(100%);
    transition: transform 0.3s var(--ease-out);
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
}
.sheet.is-open { transform: translateY(0); }
.sheet__handle {
    width: 40px; height: 4px;
    background: var(--border-strong);
    border-radius: 999px;
    margin: 0 auto var(--s-4);
}
.sheet__title {
    font-size: var(--fs-lg);
    font-weight: var(--fw-semibold);
    margin-bottom: var(--s-4);
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    top: calc(var(--s-4) + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%) translateY(-150%);
    background: var(--c-dark);
    color: var(--c-cream);
    padding: var(--s-3) var(--s-5);
    border-radius: var(--r-pill);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    box-shadow: var(--sh-2);
    z-index: 200;
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    transition: transform 0.3s var(--ease-out);
    max-width: calc(100% - var(--s-6));
    white-space: nowrap;
}
.toast.is-visible { transform: translateX(-50%) translateY(0); }
.toast-success { background: var(--c-teal); color: var(--c-dark); }
.toast-error   { background: var(--c-danger); color: white; }
.toast-warning { background: var(--c-warning); color: var(--c-dark); }

/* ---------- Empty state ---------- */
.empty-state {
    text-align: center;
    padding: var(--s-8) var(--s-5);
    color: var(--text-secondary);
}
.empty-state .empty-art {
    width: 120px; height: 120px;
    margin: 0 auto var(--s-5);
    background: linear-gradient(135deg, var(--c-orange-soft), var(--c-pink));
    border-radius: var(--r-2xl);
    display: inline-flex; align-items: center; justify-content: center;
    color: white;
    font-size: 48px;
}
.empty-state h2 {
    font-size: var(--fs-xl);
    color: var(--text-primary);
    margin-bottom: var(--s-2);
}
.empty-state p { margin-bottom: var(--s-5); }

/* ---------- Skeleton ---------- */
.skeleton {
    background: linear-gradient(90deg, var(--bg-muted) 0%, var(--border-soft) 50%, var(--bg-muted) 100%);
    background-size: 200% 100%;
    animation: skeleton 1.4s infinite linear;
    border-radius: var(--r-sm);
}
@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---------- Splash / login layout ---------- */
.splash {
    position: fixed; inset: 0;
    background: var(--c-orange);
    z-index: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: max(8vh, calc(env(safe-area-inset-top) + var(--s-7)));
}
.splash__blob {
    position: absolute;
    pointer-events: none;
}
.splash__blob--teal {
    top: -80px; left: -80px;
    width: 280px; height: 280px;
    opacity: 0.6;
}
.splash__blob--purple {
    bottom: 220px; right: -120px;
    width: 320px; height: 320px;
    opacity: 0.45;
}
.splash__brand {
    text-align: center;
    color: white;
    z-index: 2;
}
.splash__brand h1 {
    font-size: 56px;
    font-weight: var(--fw-bold);
    letter-spacing: -0.04em;
    margin-bottom: var(--s-1);
}
.splash__brand p {
    font-size: var(--fs-sm);
    opacity: 0.85;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.splash__sheet {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: var(--bg-card);
    border-top-left-radius: var(--r-2xl);
    border-top-right-radius: var(--r-2xl);
    padding: var(--s-7) var(--s-5) calc(var(--s-6) + env(safe-area-inset-bottom));
    z-index: 5;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
    max-height: 75vh;
    overflow-y: auto;
    animation: slide-up 0.6s var(--ease-out);
}
@keyframes slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

/* ---------- Utilities ---------- */
.text-muted   { color: var(--text-muted); }
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-orange  { color: var(--c-orange); }
.text-teal    { color: var(--c-teal); }
.text-success { color: var(--c-success); }
.text-danger  { color: var(--c-danger); }
.text-mono    { font-family: var(--ff-mono); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-bold    { font-weight: var(--fw-bold); }
.text-semibold { font-weight: var(--fw-semibold); }
.text-xs { font-size: var(--fs-xs); }
.text-sm { font-size: var(--fs-sm); }
.text-lg { font-size: var(--fs-lg); }
.text-xl { font-size: var(--fs-xl); }
.text-2xl { font-size: var(--fs-2xl); }
.text-3xl { font-size: var(--fs-3xl); }

.row { display: flex; gap: var(--s-3); align-items: center; }
.row-between { display: flex; gap: var(--s-3); align-items: center; justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: var(--s-2); }
.flex-1 { flex: 1; }
.flex-grow { flex: 1 1 auto; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--s-1); } .mt-2 { margin-top: var(--s-2); }
.mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); }
.mt-5 { margin-top: var(--s-5); } .mt-6 { margin-top: var(--s-6); }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--s-1); } .mb-2 { margin-bottom: var(--s-2); }
.mb-3 { margin-bottom: var(--s-3); } .mb-4 { margin-bottom: var(--s-4); }
.mb-5 { margin-bottom: var(--s-5); } .mb-6 { margin-bottom: var(--s-6); }

.gap-1 { gap: var(--s-1); } .gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); } .gap-4 { gap: var(--s-4); }

.hidden { display: none !important; }

/* Bigger touch targets */
button, a.btn, .chip, .bottom-nav__item, .list-item {
    min-height: 44px;
}

/* Avoid 100vh on iOS */
@supports (height: 100dvh) {
    .splash, .app-shell { min-height: 100dvh; }
}

/* ---------- Progress row (animated bar list) ---------- */
.progress-row {
    margin-bottom: var(--s-4);
}
.progress-row__head {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--s-3);
    margin-bottom: var(--s-2);
}
.progress-row__label {
    display: inline-flex; align-items: center; gap: var(--s-2);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    color: var(--text-primary);
}
.progress-row__label i {
    width: 28px; height: 28px;
    border-radius: var(--r-md);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px;
}
.progress-row__count {
    font-family: var(--ff-mono);
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
    color: var(--text-primary);
    white-space: nowrap;
}
.progress-bar {
    position: relative;
    height: 10px;
    background: var(--bg-muted);
    border-radius: var(--r-pill);
    overflow: hidden;
}
.progress-fill {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 100%;
    border-radius: var(--r-pill);
    transform-origin: left center;
    transform: scaleX(0);
    animation: progress-fill 1.2s var(--ease-out) forwards;
    animation-delay: 0.1s;
}
@keyframes progress-fill {
    to { transform: scaleX(var(--w, 0)); }
}
.progress-fill--teal   { background: linear-gradient(90deg, #0FB8AB 0%, var(--c-teal) 100%); }
.progress-fill--orange { background: linear-gradient(90deg, var(--c-orange) 0%, var(--c-orange-soft) 100%); }
.progress-fill--purple { background: linear-gradient(90deg, #9C8AFF 0%, var(--c-purple) 100%); }
.progress-fill--lime   { background: linear-gradient(90deg, #B8E635 0%, var(--c-lime) 100%); }
.progress-fill--muted  { background: var(--text-muted); }
.progress-row__pct {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-top: 6px;
    font-family: var(--ff-mono);
}

/* ---------- Quick menu (wondr "top picks" style) ---------- */
.quick-menu {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--s-3);
    margin-bottom: var(--s-5);
}
.quick-menu--5 {
    grid-template-columns: repeat(5, 1fr);
    gap: var(--s-2);
}
.quick-menu__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    padding: 4px 0;
    transition: transform 0.15s var(--ease-out);
}
.quick-menu--5 .quick-menu__item {
    gap: 6px;
}
.quick-menu__item:active {
    transform: scale(0.95);
}
.quick-menu__icon {
    width: 56px; height: 56px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 8px 18px rgba(10, 10, 10, 0.08);
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
/* Smaller icon for 5-column layout */
.quick-menu--5 .quick-menu__icon {
    width: 46px; height: 46px;
    border-radius: 14px;
    font-size: 18px;
}
.quick-menu__icon::after {
    /* subtle inner highlight */
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.35) 0%, transparent 60%);
    pointer-events: none;
    z-index: -1;
}
.quick-menu__icon--teal   { background: linear-gradient(135deg, #0FB8AB 0%, var(--c-teal) 100%); color: #fff; }
.quick-menu__icon--orange { background: linear-gradient(135deg, var(--c-orange) 0%, var(--c-orange-soft) 100%); color: #fff; }
.quick-menu__icon--lime   { background: linear-gradient(135deg, #B8E635 0%, var(--c-lime) 100%); color: var(--c-dark); }
.quick-menu__icon--purple { background: linear-gradient(135deg, #9C8AFF 0%, var(--c-purple) 100%); color: #fff; }
.quick-menu__icon--pink   { background: linear-gradient(135deg, #FF9CD4 0%, var(--c-pink) 100%); color: var(--c-dark); }
.quick-menu__icon--blue   { background: linear-gradient(135deg, #3B9EFF 0%, #1A7FD4 100%); color: #fff; }
.quick-menu__label {
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--text-primary);
    text-align: center;
    line-height: 1.25;
    max-width: 80px;
}
.quick-menu--5 .quick-menu__label {
    font-size: 10px;
    max-width: 60px;
}
.quick-menu__item.is-disabled {
    opacity: 0.45;
    pointer-events: none;
}

/* ---------- Stacked progress (multi-segment bar) ---------- */
.stacked-bar {
    display: flex;
    height: 14px;
    background: var(--bg-muted);
    border-radius: var(--r-pill);
    overflow: hidden;
    gap: 2px;
}
.stacked-bar__seg {
    height: 100%;
    /* flex-grow injected inline based on count */
    flex-grow: 0;
    flex-shrink: 0;
    flex-basis: 0;
    min-width: 0;
    transform-origin: left center;
    transform: scaleX(0);
    animation: stacked-fill 1s var(--ease-out) forwards;
}
@keyframes stacked-fill {
    to { transform: scaleX(1); }
}
.stacked-bar__seg:nth-child(1) { animation-delay: 0.10s; }
.stacked-bar__seg:nth-child(2) { animation-delay: 0.25s; }
.stacked-bar__seg:nth-child(3) { animation-delay: 0.40s; }
.stacked-bar__seg--teal   { background: linear-gradient(90deg, #0FB8AB, var(--c-teal)); }
.stacked-bar__seg--orange { background: linear-gradient(90deg, var(--c-orange), var(--c-orange-soft)); }
.stacked-bar__seg--purple { background: linear-gradient(90deg, #9C8AFF, var(--c-purple)); }

.stacked-legend {
    display: flex;
    gap: var(--s-3);
    margin-top: var(--s-4);
    flex-wrap: wrap;
}
.stacked-legend__item {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: var(--s-2);
    color: inherit;
    text-decoration: none;
}
.stacked-legend__dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.stacked-legend__dot--teal   { background: var(--c-teal); }
.stacked-legend__dot--orange { background: var(--c-orange); }
.stacked-legend__dot--purple { background: var(--c-purple); }
.stacked-legend__body { min-width: 0; }
.stacked-legend__label {
    font-size: var(--fs-xs);
    color: var(--text-secondary);
    white-space: nowrap;
}
.stacked-legend__value {
    font-family: var(--ff-mono);
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
    color: var(--text-primary);
}

/* ---------- Detail: invoice / client header ---------- */
.detail-header {
    display: flex; align-items: center; gap: var(--s-3);
    padding: var(--s-2) 0 var(--s-4);
}
.detail-header__back {
    width: 44px; height: 44px;
    border-radius: var(--r-md);
    background: var(--bg-card);
    box-shadow: var(--sh-1);
    display: inline-flex; align-items: center; justify-content: center;
}
.detail-header h1 {
    font-size: var(--fs-xl);
    font-weight: var(--fw-bold);
    flex: 1;
}

.kv-list {
    display: flex; flex-direction: column;
}
.kv-item {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: var(--s-3) 0;
    border-bottom: 1px solid var(--border-soft);
    gap: var(--s-3);
}
.kv-item:last-child { border-bottom: none; }
.kv-item__key {
    color: var(--text-secondary);
    font-size: var(--fs-sm);
    flex-shrink: 0;
}
.kv-item__val {
    font-weight: var(--fw-medium);
    color: var(--text-primary);
    text-align: right;
    word-break: break-word;
}

/* ---------- Trend / chart container ---------- */
.chart-card {
    background: var(--bg-card);
    border-radius: var(--r-lg);
    padding: var(--s-5);
    box-shadow: var(--sh-1);
    margin-bottom: var(--s-4);
}
.chart-card__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s-4); }

/* ---------- Image preview (proof) ---------- */
.proof-preview {
    position: relative;
    border-radius: var(--r-md);
    overflow: hidden;
    background: var(--bg-muted);
    aspect-ratio: 4 / 3;
    margin-bottom: var(--s-3);
}
.proof-preview img,
.proof-preview video {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.proof-preview__placeholder {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: var(--text-muted);
    text-align: center;
    padding: var(--s-4);
}
.proof-preview__placeholder i { font-size: 32px; margin-bottom: var(--s-2); }
.proof-actions { display: flex; gap: var(--s-2); }
.proof-actions .btn { flex: 1; }

/* ---------- Form helpers ---------- */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.form-error {
    color: var(--c-danger);
    font-size: var(--fs-sm);
    margin-top: var(--s-1);
}

/* ---------- Misc helpers ---------- */
.divider { height: 1px; background: var(--border-soft); margin: var(--s-4) 0; }
.spinner {
    width: 22px; height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.checkbox {
    display: inline-flex; align-items: center; gap: var(--s-3);
    cursor: pointer;
}
.checkbox input { width: 20px; height: 20px; accent-color: var(--c-orange); }
