:root {
    --bg-main: #f4f5f7;
    --bg-card: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --primary-green: #22c55e;
    --border-color: #f3f4f6;
    --red-color: #ef4444;
    --blue-color: #3b82f6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed; /* Prevent body scrolling on iOS */
    overscroll-behavior: none;
}

body {
    background-color: #e5e7eb;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-container {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    height: 100dvh;
    background: var(--bg-main);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 0 auto;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

/* Multi-page system */
.page {
    display: none;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.page.active {
    display: flex;
}

@media (max-width: 414px) {
    .app-container {
        height: 100vh;
        max-height: 100vh;
        box-shadow: none;
    }
}

/* Header */
.header {
    padding: 40px 20px 15px 20px;
    background: var(--bg-main);
    flex-shrink: 0;
}

.header-modal-style {
    background: var(--bg-card);
    padding: 20px 20px 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.page-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 15px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    padding: 0;
}

.btn-link:last-child {
    color: var(--text-secondary);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.balance-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.currency {
    font-weight: 600;
}

.fa-eye, .fa-eye-slash {
    font-size: 20px;
    cursor: pointer;
}

.balance-label {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.header-actions {
    display: flex;
    gap: 15px;
    font-size: 20px;
    color: var(--text-primary);
    padding-top: 5px;
}

/* Main Content */
.content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 15px calc(80px + env(safe-area-inset-bottom, 0px)) 15px;
    background: var(--bg-main);
}

/* Card General */
.card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 15px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-green);
    text-decoration: none;
}

/* Wallet List */
.wallet-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.wallet-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.wallet-info-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.wallet-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: #e5e7eb;
}

.wallet-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.wallet-balance {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Report Section */
.report-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 0 5px;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.report-card {
    padding: 0;
    overflow: hidden;
}

.report-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.tab {
    flex: 1;
    text-align: center;
    padding: 15px 0;
    cursor: pointer;
    position: relative;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--red-color);
}

.tab:nth-child(2).active::after {
    background: var(--blue-color);
}

.tab-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.tab-value {
    font-size: 16px;
    font-weight: 600;
}

.tab-value.expense { color: var(--red-color); }
.tab-value.income { color: var(--blue-color); }
.tab:not(.active) .tab-value { color: var(--text-secondary); font-weight: 500; }

.chart-info {
    text-align: center;
    padding: 15px;
    background: #f9fafb;
    margin: 15px;
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.chart-info strong {
    color: var(--text-primary);
}

.chart-info .expense-text {
    color: var(--red-color);
}

.chart-container {
    height: 180px;
    padding: 0 15px;
    position: relative;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 15px;
    font-size: 12px;
    color: var(--text-secondary);
}

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

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.dot.red { background: var(--red-color); }
.dot.gray { background: #d1d5db; }

/* Bottom Navigation */
.bottom-nav {
    height: calc(65px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-card);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
    flex-shrink: 0;
    width: 100%;
    z-index: 1000;
    box-sizing: border-box;
    border-top: 1px solid #f3f4f6;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-light);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    width: 20%;
}

.nav-item i {
    font-size: 20px;
}

.nav-item.active {
    color: var(--text-primary);
}

.nav-fab-wrapper {
    width: 20%;
    display: flex;
    justify-content: center;
    position: relative;
}

.fab-btn {
    position: absolute;
    top: -45px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-green);
    color: white;
    border: none;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(34, 197, 94, 0.4);
    cursor: pointer;
}

/* Custom Icons background colors for specific wallets */
.icon-travel { background: #0ea5e9; color: white; }
.icon-piggy { background: #334155; color: #fca5a5; }
.icon-cash { background: #475569; color: white; }

/* Scrollbar hidden for mobile feel */
::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

/* === ADD WALLET PAGE === */
.page-light { background: var(--bg-main); }

.btn-link-primary { color: var(--primary-green) !important; font-weight: 600; }

.aw-card { margin-bottom: 12px; padding: 0; overflow: hidden; }

.aw-name-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
}

.aw-icon-btn {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: #f8650020;
    border: none;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex-shrink: 0;
    transition: 0.2s;
}
.aw-icon-btn:hover { opacity: 0.8; }

.aw-name-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 17px;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: transparent;
}
.aw-name-input::placeholder { color: #d1d5db; }

.aw-field-row {
    display: flex;
    align-items: center;
    padding: 15px 16px;
    gap: 12px;
}

.aw-field-icon { font-size: 18px; flex-shrink: 0; }

.aw-field-text { flex: 1; font-size: 15px; color: var(--text-primary); }
.aw-field-text.text-muted { color: var(--text-secondary); }

.aw-field-arrow { color: #d1d5db; font-size: 13px; }

.aw-field-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }

.aw-balance-input {
    border: none;
    outline: none;
    font-size: 22px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: transparent;
    width: 100%;
}

.aw-link-card { text-align: center; padding: 16px !important; }

.aw-link-btn {
    background: none;
    border: none;
    color: var(--primary-green);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
}

.aw-hint {
    font-size: 12px;
    color: var(--text-light);
    padding: 0 5px;
    margin-bottom: 16px;
    margin-top: -6px;
}

.aw-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
}

.aw-toggle-label { font-size: 15px; font-weight: 500; color: var(--text-primary); }

/* Toggle Switch */
.aw-switch { position: relative; display: inline-block; width: 44px; height: 26px; }
.aw-switch input { opacity: 0; width: 0; height: 0; }
.aw-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: #d1d5db; border-radius: 26px; transition: 0.3s;
}
.aw-slider:before {
    content: ''; position: absolute;
    height: 20px; width: 20px; left: 3px; bottom: 3px;
    background: white; border-radius: 50%; transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.aw-switch input:checked + .aw-slider { background: var(--primary-green); }
.aw-switch input:checked + .aw-slider:before { transform: translateX(18px); }

.aw-delete-btn {
    width: 100%;
    padding: 14px;
    border: none;
    background: #fee2e2;
    color: #ef4444;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
}

/* Icon grid item */
.icon-grid-item {
    font-size: 28px;
    padding: 10px 5px;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-grid-item:hover { background: #f3f4f6; }
.icon-grid-item.selected { background: #dcfce7; }


/* === ACCOUNTS PAGE STYLES === */
.section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    letter-spacing: 0.5px;
    padding: 0 5px;
    margin-bottom: 8px;
    margin-top: 5px;
}

.wallet-total-card {
    margin-bottom: 8px;
    padding: 16px;
}

.wallet-item-full {
    display: flex;
    align-items: center;
    gap: 14px;
}

.wallet-name-big {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}

.wallet-balance-sub {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.icon-globe {
    background: linear-gradient(135deg, #0ea5e9, #3b82f6);
    color: white;
    font-size: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.wallet-list-card {
    padding: 0;
    margin-bottom: 8px;
    overflow: hidden;
}

.wallet-list-card .wallet-item {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.15s;
}
.wallet-list-card .wallet-item:last-child {
    border-bottom: none;
}
.wallet-list-card .wallet-item:hover {
    background: #f9fafb;
}

.wallet-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wallet-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.wallet-check {
    color: var(--blue-color);
    font-size: 16px;
}

.wallet-edit-btn {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 15px;
    cursor: pointer;
    padding: 4px 8px;
}

.wallet-actions-card {
    padding: 0;
    overflow: hidden;
    margin-bottom: 30px;
}

.wallet-action-row {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.wallet-action-row:hover {
    background: #f9fafb;
}

.action-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.action-icon.green {
    background: #dcfce7;
    color: #16a34a;
}

.action-text {
    font-size: 15px;
    font-weight: 500;
}
.action-text.green { color: var(--primary-green); }

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

/* === SETTINGS PAGE === */
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 16px;
    cursor: pointer;
    transition: background 0.15s;
    min-height: 54px;
}
.settings-row:hover { background: #f9fafb; }

.settings-label {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 500;
}

.settings-value {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: right;
}

.settings-val-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--primary-green);
}

.settings-arrow {
    font-size: 13px;
    color: #cbd5e1;
}

/* Settings picker list items */
.setting-option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
}
.setting-option-row:last-child { border-bottom: none; }
.setting-option-row:hover { background: #f9fafb; }
.setting-option-row.active {
    color: var(--primary-green);
    font-weight: 600;
}
.setting-option-row .check-icon {
    color: var(--primary-green);
    font-size: 15px;
}

.version-tag {
    text-align: center;
    font-size: 11px;
    color: #cbd5e1;
    margin: 20px 0 10px 0;
    font-weight: 500;
}

/* === RECEIVING INFO CAROUSEL === */
.recv-carousel-container {
    position: relative;
    width: 100%;
}

.recv-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    gap: 0;
    padding-bottom: 20px;
}

.recv-carousel::-webkit-scrollbar { display: none; }

.recv-slide {
    flex: 0 0 100%;
    scroll-snap-align: center;
    padding: 0 16px;
    box-sizing: border-box;
}

.recv-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: -10px;
    padding-bottom: 20px;
}

.recv-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
    transition: all 0.3s ease;
}

.recv-dot.active {
    background: #10b981;
    width: 20px;
}

/* Hide arrows only on touch-only devices (phones), show on PC even if window is small */
@media (hover: none) {
    .recv-nav-controls button {
        display: none !important;
    }
    .recv-nav-controls {
        gap: 0 !important;
    }
}

/* Ensure arrows are visible and clickable on PC */
@media (hover: hover) {
    .recv-nav-controls button {
        display: block !important;
        cursor: pointer;
    }
}

/* Toggle Switch */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: .4s; border-radius: 24px; }
.toggle-switch .slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
.toggle-switch input:checked + .slider { background-color: #10b981; }
.toggle-switch input:checked + .slider:before { transform: translateX(20px); }
/* === TOAST NOTIFICATION === */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 90%;
    max-width: 350px;
    pointer-events: none;
}
.toast {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    color: #1f2937;
    padding: 12px 16px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid rgba(0,0,0,0.05);
    animation: toastIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    pointer-events: auto;
}
.toast.success { border-left: 4px solid #10b981; }
.toast.warning { border-left: 4px solid #f59e0b; }
.toast.error { border-left: 4px solid #ef4444; }
.toast.info { border-left: 4px solid #3b82f6; }
.toast-icon { font-size: 18px; }
.toast.success .toast-icon { color: #10b981; }
.toast.warning .toast-icon { color: #f59e0b; }
.toast.error .toast-icon { color: #ef4444; }
.toast.info .toast-icon { color: #3b82f6; }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}
