/* ============================================================
   Finance Tracker v2 — Mobile-first redesign
   Blue gradient theme, fintech app style
   ============================================================ */

/* ---- Reset ---- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Brand */
    --blue-900: #1e3a8a;
    --blue-800: #1e40af;
    --blue-700: #1d4ed8;
    --blue-600: #2563eb;
    --blue-500: #3b82f6;
    --blue-400: #60a5fa;
    --blue-100: #dbeafe;
    --blue-50: #eff6ff;

    --income: #10b981;
    --income-bg: #d1fae5;
    --income-bg-soft: #ecfdf5;

    --expense: #ef4444;
    --expense-bg: #fee2e2;
    --expense-bg-soft: #fef2f2;

    /* Neutrals */
    --bg: #f3f4f6;
    --surface: #ffffff;
    --surface-alt: #f9fafb;
    --border: #e5e7eb;
    --text: #111827;
    --text-soft: #4b5563;
    --text-muted: #9ca3af;

    --danger: #ef4444;

    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
    --shadow-fab: 0 6px 20px rgba(37, 99, 235, 0.4);

    --header-h: 200px;
    --nav-h: 72px;
    --max-w: 480px;
}

html,
body {
    height: 100%;
    overscroll-behavior: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, "PingFang HK", "Microsoft JhengHei", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   App container — mobile-first phone-frame
   ============================================================ */
.app {
    max-width: var(--max-w);
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
    position: relative;
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
}

@media (min-width: 640px) {
    .app {
        box-shadow: var(--shadow-lg);
        margin-top: 16px;
        margin-bottom: 16px;
        border-radius: var(--radius-lg);
        overflow: hidden;
    }
    body {
        background: #e5e7eb;
        padding: 0 16px;
    }
}

/* ============================================================
   Header — gradient blue
   ============================================================ */
.header {
    background: linear-gradient(135deg, var(--blue-800) 0%, var(--blue-500) 100%);
    color: #fff;
    padding: 24px 20px 80px;
    padding-top: calc(24px + env(safe-area-inset-top, 0px));
    position: relative;
    overflow: hidden;
}

.header::before {
    content: "";
    position: absolute;
    top: -100px;
    right: -100px;
    width: 240px;
    height: 240px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    position: relative;
    z-index: 1;
}

.greeting-text {
    font-size: 0.85rem;
    opacity: 0.9;
}

.greeting-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 2px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    border: none;
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.15s;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, #ec4899);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
}

.balance {
    position: relative;
    z-index: 1;
}

.balance-label {
    font-size: 0.85rem;
    opacity: 0.85;
    margin-bottom: 6px;
}

.balance-amount {
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: -1px;
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   Main content
   ============================================================ */
.main {
    margin-top: -64px;
    position: relative;
    z-index: 2;
    padding: 0 16px;
}

.view {
    display: none;
    animation: fadeIn 0.25s ease;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Quick Actions
   ============================================================ */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 16px;
}

.qa-tile {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: background 0.15s, transform 0.1s;
    font-family: inherit;
}

.qa-tile:active {
    transform: scale(0.96);
    background: var(--surface-alt);
}

.qa-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
}

.qa-icon-income {
    background: linear-gradient(135deg, #10b981, #34d399);
}
.qa-icon-expense {
    background: linear-gradient(135deg, #ef4444, #f87171);
}
.qa-icon-stats {
    background: linear-gradient(135deg, var(--blue-600), var(--blue-400));
}
.qa-icon-cats {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
}

.qa-label {
    font-size: 0.78rem;
    color: var(--text-soft);
    font-weight: 600;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-md);
    margin-bottom: 16px;
}

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

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.link-btn {
    background: transparent;
    border: none;
    color: var(--blue-600);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    padding: 4px 0;
}

.link-btn:hover {
    color: var(--blue-700);
}

/* ============================================================
   Filter pills
   ============================================================ */
.filter-pills {
    display: inline-flex;
    background: var(--surface-alt);
    border-radius: 999px;
    padding: 4px;
    gap: 2px;
    margin-bottom: 14px;
}

.pill {
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 7px 14px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pill:hover {
    color: var(--text);
}

.pill.active {
    background: #fff;
    color: var(--blue-700);
    box-shadow: var(--shadow-sm);
}

.pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.pill-dot-income { background: var(--income); }
.pill-dot-expense { background: var(--expense); }

/* ============================================================
   Transaction list
   ============================================================ */
.txn-groups {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.txn-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.txn-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.txn-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 4px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    cursor: default;
}

.txn-item:hover {
    background: var(--surface-alt);
}

.txn-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.txn-item.income .txn-icon {
    background: var(--income-bg);
}

.txn-item.expense .txn-icon {
    background: var(--expense-bg);
}

.txn-body {
    flex: 1;
    min-width: 0;
}

.txn-desc {
    font-weight: 600;
    color: var(--text);
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.txn-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.txn-amount {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.txn-amount-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
    text-align: right;
}

.txn-item.income .txn-amount { color: var(--income); }
.txn-item.expense .txn-amount { color: var(--expense); }

/* ============================================================
   Empty state
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-soft);
}

.empty-icon {
    font-size: 2.4rem;
    margin-bottom: 8px;
    opacity: 0.6;
}

.empty-state p {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.empty-state span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.hidden {
    display: none !important;
}

/* ============================================================
   Page headers (History, Stats, Categories, Profile)
   ============================================================ */
.page-header {
    padding: 24px 4px 16px;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
}

.page-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.section-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 18px 4px 10px;
}

/* ============================================================
   Search box
   ============================================================ */
.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 11px 14px;
    margin-bottom: 16px;
    color: var(--text-muted);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.search-box:focus-within {
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.92rem;
    color: var(--text);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

/* ============================================================
   Stats view
   ============================================================ */
.stats-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--border);
}

.stat-card-income { border-left-color: var(--income); }
.stat-card-expense { border-left-color: var(--expense); }

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
}

.stat-card-income .stat-value { color: var(--income); }
.stat-card-expense .stat-value { color: var(--expense); }

.legend {
    display: flex;
    gap: 12px;
    font-size: 0.78rem;
    color: var(--text-soft);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.legend-dot-income { background: var(--income); }
.legend-dot-expense { background: var(--expense); }

.chart-wrap {
    width: 100%;
    height: 200px;
}

.chart-wrap svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.cat-breakdown {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cat-bar-row {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    gap: 10px;
    align-items: center;
}

.cat-bar-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 1rem;
    background: var(--expense-bg);
}

.cat-bar-info {
    min-width: 0;
}

.cat-bar-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.cat-bar-name .cat-bar-pct {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8rem;
}

.cat-bar-track {
    height: 6px;
    background: var(--surface-alt);
    border-radius: 999px;
    overflow: hidden;
}

.cat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue-500), var(--blue-400));
    border-radius: 999px;
    transition: width 0.4s ease;
}

.cat-bar-amount {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ============================================================
   Categories view
   ============================================================ */
.cat-list {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 8px;
}

.cat-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.cat-list-item:last-child {
    border-bottom: none;
}

.cat-list-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.cat-list-icon.income { background: var(--income-bg); }
.cat-list-icon.expense { background: var(--expense-bg); }

.cat-list-body {
    flex: 1;
    min-width: 0;
}

.cat-list-name {
    font-weight: 600;
    color: var(--text);
    font-size: 0.92rem;
}

.cat-list-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.cat-list-amount {
    font-weight: 700;
    font-size: 0.92rem;
    font-variant-numeric: tabular-nums;
}

.cat-list-item.income .cat-list-amount { color: var(--income); }
.cat-list-item.expense .cat-list-amount { color: var(--expense); }

/* ============================================================
   Profile view
   ============================================================ */
.profile-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, #ec4899);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.profile-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.profile-email {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.settings-group {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 14px 16px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s;
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-row:hover {
    background: var(--surface-alt);
}

.settings-label {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.settings-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--blue-50);
    color: var(--blue-700);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.settings-icon-danger {
    background: var(--expense-bg);
    color: var(--expense);
}

.settings-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.text-danger {
    color: var(--danger);
}

.settings-select {
    font-family: inherit;
    font-size: 0.9rem;
    padding: 7px 10px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--surface-alt);
    color: var(--text);
    cursor: pointer;
    outline: none;
}

.settings-select:focus {
    border-color: var(--blue-500);
}

.app-info {
    text-align: center;
    padding: 20px 16px 8px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.app-info p {
    margin: 2px 0;
}

/* ============================================================
   Bottom nav
   ============================================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--max-w);
    height: var(--nav-h);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(4, 1fr) 0;
    align-items: center;
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav-item {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 8px 0;
    transition: color 0.15s, transform 0.1s;
}

.nav-item:active {
    transform: scale(0.95);
}

.nav-item.active {
    color: var(--blue-600);
}

.nav-item.active svg {
    stroke: var(--blue-600);
}

.nav-fab {
    grid-column: 3 / 4;
    grid-row: 1 / 3;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
    color: #fff;
    border: none;
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-fab);
    margin: 0 auto;
    transition: transform 0.1s, box-shadow 0.15s;
    align-self: start;
    margin-top: -16px;
}

.nav-fab:active {
    transform: scale(0.92);
}

.nav-fab:hover {
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.5);
}

/* Reposition nav items to make room for FAB */
.bottom-nav {
    grid-template-columns: repeat(2, 1fr) 80px repeat(2, 1fr);
}

/* ============================================================
   Modal (bottom sheet)
   ============================================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal.open {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeBackdrop 0.2s ease;
}

@keyframes fadeBackdrop {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-sheet {
    position: relative;
    width: 100%;
    max-width: var(--max-w);
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    padding: 12px 20px calc(24px + env(safe-area-inset-bottom, 0px));
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.modal-handle {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 999px;
    margin: 0 auto 14px;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 18px;
    text-align: center;
}

/* Form */
#transactionForm {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.type-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--surface-alt);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
    margin-bottom: 4px;
}

.type-btn {
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    padding: 10px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.type-btn.active {
    background: #fff;
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.type-btn[data-type="expense"].active {
    color: var(--expense);
}

.type-btn[data-type="income"].active {
    color: var(--income);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.78rem;
    color: var(--text-soft);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-group input,
.form-group select {
    font-family: inherit;
    font-size: 1rem;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: var(--surface-alt);
    color: var(--text);
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

.form-group select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--blue-500);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] { -moz-appearance: textfield; }

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 10px;
    margin-top: 6px;
}

.btn {
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    padding: 13px 20px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s, box-shadow 0.15s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
    background: var(--surface-alt);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--border);
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
    position: fixed;
    bottom: calc(var(--nav-h) + 16px);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: #fff;
    padding: 12px 20px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.3s;
    z-index: 200;
    pointer-events: none;
    max-width: 90%;
    text-align: center;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ============================================================
   Responsive tweaks
   ============================================================ */
@media (min-width: 640px) {
    .app {
        min-height: calc(100vh - 32px);
    }

    .header {
        padding: 32px 24px 80px;
    }

    .main {
        padding: 0 20px;
    }

    .balance-amount {
        font-size: 2.8rem;
    }
}

@media (max-width: 360px) {
    .quick-actions {
        padding: 12px 8px;
        gap: 6px;
    }
    .qa-label { font-size: 0.72rem; }
    .qa-icon { width: 40px; height: 40px; }
    .balance-amount { font-size: 2.1rem; }
}
