/* ────────────── IMPORTS & RESET ────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.35);
    --green: #4ade80;
    --red: #f87171;
    --blue: #60a5fa;
    --amber: #fbbf24;
    --orange: #fb923c;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --radius: 16px;
    --radius-sm: 10px;
    --shadow-elevated: 0 20px 60px rgba(0, 0, 0, 0.4);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] {
    --bg: #07070e;
    --bg2: #0e0e1a;
    --card: #13131f;
    --card2: #1c1c2e;
    --border: rgba(255, 255, 255, 0.06);
    --text: #f0f0fa;
    --sub: #8888b0;
    --muted: #4a4a62;
    --nav-bg: rgba(7, 7, 14, 0.92);
    --hero-g1: #042f2e;
    --hero-g2: #0f766e;
    --hero-g3: #0891b2;
    --logo-bg: #1a1a2e;
    --input-bg: rgba(255, 255, 255, 0.04);
    --glass-bg: rgba(255, 255, 255, 0.03);
}

[data-theme="light"] {
    --bg: #f2f2f7;
    --bg2: #e8e8ef;
    --card: #ffffff;
    --card2: #f0f0f8;
    --border: rgba(0, 0, 0, 0.06);
    --text: #11111e;
    --sub: #666680;
    --muted: #b0b0c4;
    --nav-bg: rgba(255, 255, 255, 0.92);
    --hero-g1: #0f766e;
    --hero-g2: #0891b2;
    --hero-g3: #22d3ee;
    --logo-bg: #f0f0f8;
    --input-bg: rgba(0, 0, 0, 0.03);
    --glass-bg: rgba(255, 255, 255, 0.5);
}

[data-accent="indigo"] {
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.35);
}
[data-accent="emerald"] {
    --accent: #34d399;
    --accent-light: #6ee7b7;
    --accent-glow: rgba(52, 211, 153, 0.35);
}
[data-accent="rose"] {
    --accent: #fb7185;
    --accent-light: #fda4af;
    --accent-glow: rgba(251, 113, 133, 0.35);
}
[data-accent="amber"] {
    --accent: #fbbf24;
    --accent-light: #fde68a;
    --accent-glow: rgba(251, 191, 36, 0.35);
}
[data-accent="sky"] {
    --accent: #38bdf8;
    --accent-light: #7dd3fc;
    --accent-glow: rgba(56, 189, 248, 0.35);
}

html {
    background: var(--bg2);
}
body {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: calc(72px + var(--safe-bottom));
    overflow-x: hidden;
    transition: background var(--transition), color var(--transition);
}

/* ────────────── SCROLLBAR ────────────── */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--muted);
    border-radius: 4px;
}

/* ────────────── SCREENS ────────────── */
.screen {
    display: none;
    flex-direction: column;
    animation: fadeUp 0.35s ease;
}
.screen.active {
    display: flex;
}
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* ────────────── LOGO ────────────── */
.app-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px 10px;
}
.app-logo .logo-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    box-shadow: 0 4px 20px var(--accent-glow);
    transition: transform 0.2s;
    flex-shrink: 0;
}
.app-logo .logo-icon:hover {
    transform: scale(1.04);
}
.app-logo .logo-text {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.6px;
    background: linear-gradient(135deg, var(--text), var(--sub));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.app-logo .logo-text span {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.app-logo .logo-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--accent);
    background: var(--card2);
    padding: 2px 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
    margin-left: auto;
}

/* ────────────── MODE SWITCHER ────────────── */
.mode-switcher {
    display: flex;
    background: var(--card2);
    border-radius: 14px;
    padding: 4px;
    margin: 8px 16px 0;
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
}
.mode-btn {
    flex: 1;
    padding: 10px 8px;
    border-radius: 11px;
    border: none;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    color: var(--sub);
    background: none;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
}
.mode-btn.active {
    background: var(--card);
    color: var(--text);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.mode-btn:active {
    transform: scale(0.96);
}

/* ────────────── BOTTOM NAV ────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 600px;
    margin: 0 auto;
    height: calc(64px + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--nav-bg);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    padding-top: 6px;
    z-index: 100;
    transition: background var(--transition);
}
.bottom-nav.visible {
    display: flex;
}
.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px 0;
    font-family: inherit;
    transition: color var(--transition);
    min-height: 44px;
    position: relative;
}
.nav-btn.active {
    color: var(--accent);
}
.nav-btn.active::after {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    border-radius: 3px;
    background: var(--accent);
}
.nav-btn svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
}
.nav-btn span {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.2px;
}
.nav-fab-wrap {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}
.fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border: none;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    box-shadow: 0 4px 24px var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -24px;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: inherit;
}
.fab:active {
    transform: scale(0.88);
}
.fab.visible {
    display: flex;
}

/* ────────────── SHARED ────────────── */
.page-header {
    padding: 22px 20px 4px;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.6px;
}
.section-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 20px 12px;
}
.section-title {
    font-size: 17px;
    font-weight: 700;
}
.section-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 4px 0;
    transition: opacity 0.15s;
}
.section-link:active {
    opacity: 0.6;
}
.card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    transition: background var(--transition), border-color var(--transition);
}

/* ────────────── TRANSACTION ITEMS ────────────── */
.tx-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px 16px;
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: background var(--transition), transform 0.15s;
    min-height: 68px;
}
.tx-item:active {
    transform: scale(0.98);
}
.tx-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    flex-shrink: 0;
}
.tx-info {
    flex: 1;
    min-width: 0;
}
.tx-name {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tx-cat {
    font-size: 12px;
    color: var(--sub);
    margin-top: 3px;
    font-weight: 500;
}
.tx-right {
    text-align: right;
    flex-shrink: 0;
}
.tx-amount {
    font-size: 16px;
    font-weight: 700;
}
.tx-amount.inc {
    color: var(--green);
}
.tx-amount.exp {
    color: var(--red);
}
.tx-meta {
    font-size: 11px;
    color: var(--muted);
    margin-top: 3px;
    font-weight: 500;
}
.tx-del {
    font-size: 11px;
    color: var(--red);
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    padding: 4px 0;
    font-weight: 600;
    transition: opacity 0.15s;
}
.tx-del:active {
    opacity: 0.5;
}

.empty {
    text-align: center;
    padding: 56px 20px;
    color: var(--muted);
}
.empty .e-ico {
    font-size: 44px;
    margin-bottom: 14px;
    opacity: 0.5;
}
.empty .e-ttl {
    font-size: 17px;
    font-weight: 700;
    color: var(--sub);
    margin-bottom: 6px;
}
.empty .e-sub {
    font-size: 14px;
    font-weight: 500;
}

/* ────────────── TOAST ────────────── */
.toast {
    position: fixed;
    bottom: 82px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: var(--card2);
    color: var(--text);
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--border);
    z-index: 200;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    white-space: nowrap;
    pointer-events: none;
    backdrop-filter: blur(24px);
    box-shadow: var(--shadow-elevated);
    max-width: 92%;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast.undo {
    white-space: normal;
    max-width: 360px;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
}
.toast.undo .undo-btn {
    background: var(--accent);
    border: none;
    color: #fff;
    padding: 4px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s;
    flex-shrink: 0;
}
.toast.undo .undo-btn:active {
    opacity: 0.7;
}

/* ────────────── BADGES ────────────── */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-green {
    background: rgba(74, 222, 128, 0.15);
    color: var(--green);
}
.badge-red {
    background: rgba(248, 113, 113, 0.15);
    color: var(--red);
}
.badge-blue {
    background: rgba(96, 165, 250, 0.15);
    color: var(--blue);
}
.badge-amber {
    background: rgba(251, 191, 36, 0.15);
    color: var(--amber);
}

/* ────────────── BALANCE HERO ────────────── */
.balance-hero {
    margin: 14px 16px 0;
    background: linear-gradient(135deg, var(--hero-g1) 0%, var(--hero-g2) 55%, var(--hero-g3) 100%);
    border-radius: 24px;
    padding: 26px 24px 22px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(8, 145, 178, 0.25);
    transition: background 0.4s;
}
.balance-hero::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
}
.balance-hero::after {
    content: '';
    position: absolute;
    bottom: -40px;
    left: -40px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
}
.bal-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    position: relative;
    z-index: 1;
}
.bal-amount {
    font-size: 44px;
    font-weight: 800;
    letter-spacing: -2px;
    color: #fff;
    margin: 6px 0 4px;
    line-height: 1;
    position: relative;
    z-index: 1;
}
.bal-amount sup {
    font-size: 20px;
    font-weight: 400;
    opacity: 0.55;
    vertical-align: super;
}
.net-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    position: relative;
    z-index: 1;
}
.net-badge.profit {
    background: rgba(74, 222, 128, 0.2);
    color: #86efac;
}
.net-badge.loss {
    background: rgba(248, 113, 113, 0.2);
    color: #fca5a5;
}

.bal-chips {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    position: relative;
    z-index: 1;
}
.bal-chip {
    flex: 1;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    padding: 12px 14px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.bal-chip-label {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}
.bal-chip-val {
    font-size: 17px;
    font-weight: 700;
    margin-top: 4px;
}
.bal-chip-val.g {
    color: #86efac;
}
.bal-chip-val.r {
    color: #fca5a5;
}

.bal-usd-row {
    margin-top: 14px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 12px 16px;
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(4px);
}
.bal-usd-top {
    display: flex;
    align-items: center;
    gap: 6px;
}
.bal-usd-ico {
    font-size: 13px;
}
.bal-usd-lbl {
    font-size: 9px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
    letter-spacing: 1.2px;
}
.bal-usd-val {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    margin-top: 3px;
    letter-spacing: -0.4px;
}

/* ────────────── QUICK ACTIONS ────────────── */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 0 16px;
}
.qa {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: transform 0.15s, background var(--transition), box-shadow 0.15s;
    font-family: inherit;
    min-height: 80px;
    box-shadow: var(--shadow-card);
}
.qa:active {
    transform: scale(0.94);
}
.qa-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.qa-lbl {
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    line-height: 1.2;
}
.qa.q-inc .qa-icon {
    background: rgba(74, 222, 128, 0.15);
}
.qa.q-inc .qa-lbl {
    color: var(--green);
}
.qa.q-exp .qa-icon {
    background: rgba(248, 113, 113, 0.15);
}
.qa.q-exp .qa-lbl {
    color: var(--red);
}
.qa.q-set .qa-icon {
    background: rgba(255, 255, 255, 0.05);
}
.qa.q-set .qa-lbl {
    color: var(--sub);
}

/* ────────────── CHARTS ────────────── */
.chart-card {
    margin: 0 16px;
    padding: 16px 14px 12px;
}
canvas {
    display: block;
    width: 100%;
    border-radius: 4px;
}
.tx-list {
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

/* ────────────── BUSINESS STATS ────────────── */
.biz-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0 16px;
}
.biz-stat {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow-card);
}
.biz-stat-label {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}
.biz-stat-value {
    font-size: 22px;
    font-weight: 800;
    margin-top: 6px;
}
.biz-stat-value.g {
    color: var(--green);
}
.biz-stat-value.r {
    color: var(--red);
}
.biz-stat-value.b {
    color: var(--blue);
}
.biz-stat-value.a {
    color: var(--amber);
}

/* ────────────── INVENTORY ────────────── */
.inventory-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    box-shadow: var(--shadow-card);
}
.inventory-item.low-stock {
    border-color: var(--red);
    background: rgba(248, 113, 113, 0.05);
}
.inventory-info {
    flex: 1;
}
.inventory-name {
    font-weight: 600;
}
.inventory-sku {
    font-size: 11px;
    color: var(--muted);
}
.inventory-stock {
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.inventory-stock.low {
    color: var(--red);
}
.inventory-stock.medium {
    color: var(--amber);
}
.inventory-stock.high {
    color: var(--green);
}
.inv-actions {
    display: flex;
    gap: 6px;
}
.inv-actions button {
    background: var(--card2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 4px 10px;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, transform 0.1s;
    min-width: 32px;
}
.inv-actions button:active {
    transform: scale(0.92);
}
.inv-actions .del-inv {
    color: var(--red);
}
.low-stock-badge {
    font-size: 10px;
    font-weight: 700;
    color: var(--red);
    background: rgba(248, 113, 113, 0.15);
    padding: 2px 10px;
    border-radius: 12px;
    margin-left: 6px;
}

/* ────────────── STATS SUMMARY ────────────── */
.stats-summary {
    margin: 14px 16px 0;
    padding: 22px 20px;
}
.stats-row {
    display: flex;
    gap: 8px;
}
.stats-item {
    flex: 1;
}
.stats-item+.stats-item {
    border-left: 1px solid var(--border);
    padding-left: 16px;
}
.stats-lbl {
    font-size: 11px;
    color: var(--sub);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}
.stats-val {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-top: 6px;
}
.stats-val.g {
    color: var(--green);
}
.stats-val.r {
    color: var(--red);
}

/* ────────────── DONUT ────────────── */
.donut-card {
    margin: 12px 16px 0;
    padding: 20px 16px;
}
.donut-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 16px;
}
.donut-inner {
    display: flex;
    align-items: center;
    gap: 20px;
}
.donut-legend {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.d-row {
    display: flex;
    align-items: center;
    gap: 9px;
}
.d-dot {
    width: 10px;
    height: 10px;
    border-radius: 4px;
    flex-shrink: 0;
}
.d-name {
    font-size: 13px;
    color: var(--sub);
    flex: 1;
    font-weight: 500;
}
.d-pct {
    font-size: 13px;
    font-weight: 700;
}
.d-amount {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}

/* ────────────── MINI TABS ────────────── */
.mini-tabs {
    display: flex;
    background: var(--card2);
    border-radius: 10px;
    padding: 3px;
    border: 1px solid var(--border);
}
.mini-tab {
    padding: 5px 14px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    border: none;
    background: none;
    color: var(--sub);
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
    min-height: 30px;
}
.mini-tab.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.period-row {
    display: flex;
    gap: 8px;
    padding: 14px 16px 0;
    overflow-x: auto;
}
.period-row::-webkit-scrollbar {
    display: none;
}
.period-btn {
    padding: 6px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border);
    background: none;
    color: var(--sub);
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: all var(--transition);
    min-height: 36px;
}
.period-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 16px var(--accent-glow);
}

.sw-hint {
    font-size: 10px;
    color: var(--muted);
    text-align: center;
    padding: 2px 0 4px;
    font-weight: 500;
}

/* ────────────── SWIPE ────────────── */
.swipe-wrap {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
}
.swipe-actions {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 192px;
    display: flex;
}
.swipe-actions button {
    width: 64px;
    border: none;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s;
}
.swipe-actions button:active {
    opacity: 0.7;
}
.swipe-actions button span {
    font-size: 16px;
}
.sw-toggle {
    background: var(--blue);
}
.sw-archive {
    background: #a78bfa;
}
.sw-remove {
    background: var(--red);
}
.swipe-content {
    position: relative;
    z-index: 1;
    touch-action: pan-y;
    will-change: transform;
    cursor: grab;
}
.swipe-content:active {
    cursor: grabbing;
}

/* ────────────── SEARCH & CHIPS ────────────── */
.search-wrap {
    margin: 14px 16px 0;
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    min-height: 48px;
    box-shadow: var(--shadow-card);
}
.search-wrap input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 15px;
    color: var(--text);
    font-family: inherit;
    font-weight: 500;
}
.search-wrap input::placeholder {
    color: var(--muted);
}

.chip-row {
    display: flex;
    gap: 8px;
    padding: 12px 16px 0;
    overflow-x: auto;
}
.chip-row::-webkit-scrollbar {
    display: none;
}
.chip {
    padding: 6px 18px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--border);
    color: var(--sub);
    background: none;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: all var(--transition);
    flex-shrink: 0;
    min-height: 34px;
}
.chip.active {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.date-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 16px 0 7px;
}
.act-list {
    padding: 0 16px;
    display: flex;
    flex-direction: column;
}

.growth-card {
    margin: 14px 16px 0;
    padding: 16px 16px 12px;
}
.growth-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.growth-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--sub);
}
.growth-bal {
    font-size: 16px;
    font-weight: 800;
}

/* ────────────── ADD TRANSACTION ────────────── */
.add-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 20px 0;
}
.add-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.4px;
}
.close-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--sub);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    transition: background var(--transition), transform 0.15s;
}
.close-btn:active {
    transform: scale(0.88);
}

.type-seg {
    display: flex;
    margin: 16px 16px 0;
    background: var(--card);
    border-radius: var(--radius);
    padding: 4px;
    border: 1px solid var(--border);
}
.tseg-btn {
    flex: 1;
    padding: 10px;
    border-radius: 12px;
    border: none;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    color: var(--sub);
    background: none;
    transition: all var(--transition);
    min-height: 42px;
}
.tseg-btn.income.on {
    background: rgba(74, 222, 128, 0.12);
    color: var(--green);
}
.tseg-btn.expense.on {
    background: rgba(248, 113, 113, 0.12);
    color: var(--red);
}

.curr-seg {
    display: flex;
    margin: 10px 16px 0;
    background: var(--card);
    border-radius: var(--radius);
    padding: 4px;
    border: 1px solid var(--border);
    gap: 4px;
}
.curr-btn {
    flex: 1;
    padding: 8px;
    border-radius: 10px;
    border: none;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    color: var(--sub);
    background: none;
    transition: all var(--transition);
    min-height: 36px;
}
.curr-btn.on {
    background: rgba(8, 145, 178, 0.12);
    color: var(--blue);
}

.amt-display {
    text-align: center;
    padding: 24px 20px 16px;
}
.amt-pre {
    font-size: 26px;
    font-weight: 300;
    color: var(--sub);
}
.amt-num {
    font-size: 52px;
    font-weight: 800;
    letter-spacing: -2px;
    line-height: 1;
    color: var(--text);
}
.amt-cursor {
    display: inline-block;
    width: 3px;
    height: 50px;
    background: var(--accent);
    margin-left: 3px;
    vertical-align: bottom;
    animation: blink 1s infinite;
    border-radius: 2px;
}
@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.add-fields {
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.f-row {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 14px 16px;
    min-height: 58px;
    box-shadow: var(--shadow-card);
}
.f-ico {
    font-size: 18px;
    flex-shrink: 0;
}
.f-inner {
    flex: 1;
    min-width: 0;
}
.f-lbl {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 3px;
    font-weight: 600;
}
.f-row input,
.f-row select {
    width: 100%;
    background: none;
    border: none;
    outline: none;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    font-family: inherit;
}
.f-row select option {
    background: var(--card2);
}

.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--border);
    margin: 14px 16px 0;
    border-radius: var(--radius);
    overflow: hidden;
}
.np {
    background: var(--card);
    border: none;
    color: var(--text);
    font-size: 22px;
    font-weight: 500;
    padding: 18px 0;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
}
.np:active {
    background: var(--card2);
}
.np.del {
    font-size: 18px;
    color: var(--sub);
}

.submit-wrap {
    padding: 14px 16px 0;
}
.submit-btn {
    width: 100%;
    padding: 16px;
    border-radius: var(--radius);
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 6px 28px var(--accent-glow);
    transition: opacity 0.15s, transform 0.15s;
    min-height: 50px;
}
.submit-btn:active {
    opacity: 0.8;
    transform: scale(0.97);
}
.err-banner {
    margin: 12px 16px 0;
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.25);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 13px;
    color: var(--red);
    display: none;
    font-weight: 500;
}
.err-banner.show {
    display: block;
}

/* ────────────── SETTINGS ────────────── */
.settings-list {
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.setting-group-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 0 4px 8px;
}
.setting-row {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 58px;
    box-shadow: var(--shadow-card);
}
.setting-row+.setting-row {
    margin-top: 8px;
}
.setting-row.tappable {
    cursor: pointer;
    transition: background 0.15s;
}
.setting-row.tappable:active {
    background: var(--card2);
}
.setting-ico {
    font-size: 20px;
    flex-shrink: 0;
}
.setting-info {
    flex: 1;
}
.setting-label {
    font-size: 15px;
    font-weight: 600;
}
.setting-sub {
    font-size: 12px;
    color: var(--sub);
    margin-top: 2px;
    font-weight: 500;
}
.toggle {
    appearance: none;
    -webkit-appearance: none;
    width: 48px;
    height: 28px;
    border-radius: 14px;
    background: var(--muted);
    cursor: pointer;
    position: relative;
    transition: background 0.3s;
    outline: none;
    flex-shrink: 0;
}
.toggle:checked {
    background: var(--accent);
}
.toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.toggle:checked::after {
    transform: translateX(20px);
}

.accent-picker {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.accent-swatch {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color 0.2s, transform 0.15s;
}
.accent-swatch:active {
    transform: scale(0.88);
}
.accent-swatch.active {
    border-color: var(--text);
}
.accent-swatch[data-a="indigo"] { background: #6366f1; }
.accent-swatch[data-a="emerald"] { background: #34d399; }
.accent-swatch[data-a="rose"] { background: #fb7185; }
.accent-swatch[data-a="amber"] { background: #fbbf24; }
.accent-swatch[data-a="sky"] { background: #38bdf8; }

/* ────────── ICON PICKER ────────── */
.icon-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.icon-opt {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 2px solid var(--border);
    background: var(--card2);
    font-size: 22px;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-opt:active {
    transform: scale(0.88);
}
.icon-opt.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.reset-btn {
    width: 100%;
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid rgba(248, 113, 113, 0.25);
    background: rgba(248, 113, 113, 0.06);
    color: var(--red);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
    min-height: 48px;
}
.reset-btn:active {
    background: rgba(248, 113, 113, 0.12);
}
.app-info {
    text-align: center;
    padding: 28px 20px 12px;
    color: var(--muted);
    font-size: 13px;
}

/* ────────────── POS ────────────── */
.pos-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0 16px;
}
.pos-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
    box-shadow: var(--shadow-card);
}
.pos-item:active {
    transform: scale(0.95);
}
.pos-item .pos-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--green);
    margin-top: 4px;
}
.pos-item .pos-stock {
    font-size: 11px;
    color: var(--muted);
}
.pos-item.out-of-stock {
    opacity: 0.4;
    cursor: not-allowed;
}

.pos-cart {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 12px 16px 0;
    padding: 16px;
    box-shadow: var(--shadow-card);
}
.pos-cart-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}
.pos-total {
    font-size: 20px;
    font-weight: 800;
    text-align: right;
    padding-top: 12px;
}
.pos-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}
.pos-actions button {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius);
    border: none;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s, transform 0.1s;
}
.pos-actions button:active {
    opacity: 0.7;
    transform: scale(0.96);
}
.pos-checkout {
    background: var(--green);
    color: #000;
}
.pos-clear {
    background: var(--red);
    color: #fff;
}

.pos-bill {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 12px 16px 0;
    padding: 16px;
    display: none;
    box-shadow: var(--shadow-elevated);
}
.pos-bill.show {
    display: block;
    animation: fadeUp 0.3s ease;
}
.pos-bill .bill-header {
    text-align: center;
    font-weight: 700;
    font-size: 18px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 8px;
    margin-bottom: 12px;
}
.pos-bill .bill-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 14px;
}
.pos-bill .bill-total {
    border-top: 2px solid var(--border);
    padding-top: 12px;
    margin-top: 8px;
    font-size: 18px;
    font-weight: 800;
    text-align: right;
}
.pos-bill .bill-close {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    margin-top: 12px;
    font-family: inherit;
    transition: opacity 0.15s;
}
.pos-bill .bill-close:active {
    opacity: 0.7;
}

.download-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 6px 18px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s, transform 0.1s;
}
.download-btn:active {
    opacity: 0.7;
    transform: scale(0.95);
}

/* ────────────── AUTH ────────────── */
.auth-screen {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    background: var(--bg);
}
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border-radius: 28px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-elevated);
    padding: 40px 28px 32px;
    backdrop-filter: blur(12px);
}
.auth-logo {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px var(--accent-glow);
}
.auth-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.6px;
}
.auth-title span {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.auth-sub {
    font-size: 14px;
    color: var(--sub);
    font-weight: 500;
    margin-bottom: 24px;
    line-height: 1.6;
}

.auth-tabs {
    display: flex;
    background: var(--card2);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}
.auth-tab {
    flex: 1;
    padding: 10px;
    border-radius: 9px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    color: var(--sub);
    background: none;
    transition: all var(--transition);
}
.auth-tab.active {
    background: var(--card);
    color: var(--text);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.auth-field {
    margin-bottom: 14px;
}
.auth-field label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}
.auth-field input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.auth-btn {
    width: 100%;
    padding: 16px;
    border-radius: var(--radius);
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 6px 28px var(--accent-glow);
    transition: opacity 0.15s, transform 0.15s;
    min-height: 50px;
}
.auth-btn:active {
    opacity: 0.8;
    transform: scale(0.97);
}
.auth-err {
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.25);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 13px;
    color: var(--red);
    margin-bottom: 14px;
    display: none;
    font-weight: 500;
}
.auth-err.show {
    display: block;
}
.auth-footer {
    text-align: center;
    margin-top: 18px;
    font-size: 13px;
    color: var(--muted);
}
.auth-link-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}
.auth-link {
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}
.auth-link:hover { text-decoration: underline; }
.auth-success {
    display: none;
    padding: 11px 13px;
    margin-bottom: 12px;
    border-radius: 10px;
    background: rgba(74, 222, 128, .10);
    border: 1px solid rgba(74, 222, 128, .20);
    color: var(--green);
    font-size: 13px;
    line-height: 1.45;
}
.auth-success.show { display: block; }

.auth-footer .link {
    color: var(--accent);
    cursor: pointer;
    font-weight: 600;
    transition: opacity 0.15s;
}
.auth-footer .link:active {
    opacity: 0.6;
}

.auth-success {
    text-align: center;
    padding: 8px 0 4px;
}
.auth-success-icon {
    font-size: 44px;
    margin-bottom: 12px;
}
.auth-success-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 6px;
}
.auth-success-sub {
    font-size: 14px;
    color: var(--sub);
    line-height: 1.6;
}

/* ────────────── LOADER ────────────── */
.loader-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 999;
    transition: opacity 0.4s;
}
.loader-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.loader-text {
    color: var(--sub);
    font-weight: 500;
}

/* ────────────── RESPONSIVE ────────────── */
@media (min-width: 600px) {
    .bottom-nav {
        left: 50%;
        transform: translateX(-50%);
        width: 600px;
    }
    .toast {
        max-width: 420px;
    }
}

@media (max-width: 420px) {
    .bal-amount {
        font-size: 36px;
    }
    .amt-num {
        font-size: 40px;
    }
    .biz-stat-value {
        font-size: 18px;
    }
}

/* ─── AUTH RATE-LIMIT UX ─── */
.auth-btn:disabled { opacity: .58; cursor: not-allowed; transform: none; }
#auth-status-resend { margin-top: 2px; }
.auth-success { line-height: 1.5; }