/* Prevent zooming on input focus (iOS requires 16px to not zoom) */
@media screen and (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* Global zoom prevention */
html, body {
    touch-action: manipulation;
}

:root {
    --primary: #1D9E75;
    --primary-dark: #157a5b;
    --primary-light: #E8F7F2;
    --secondary: #0F6E56;
    --accent: #E24B4A;
    --accent-light: #FEF0F0;
    --gold: #F5A623;
    --gold-light: #FFF9EE;
    --bg-light: #F7FAF9;
    --bg-card: #FFFFFF;
    --text-main: #1E2D2A;
    --text-muted: #7B9489;
    --border: #D9EFEA;
    --shadow-sm: 0 2px 6px rgba(29,158,117,0.06);
    --shadow: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
    --radius-xl: 18px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --nav-height: 80px;
    --header-bg: linear-gradient(145deg, #1D9E75 0%, #0D6349 100%);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
}

/* View Transitions Optimization */
::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.2s;
}

[data-theme="dark"] {
    --bg-light: #0D1614;
    --bg-card: #1A2822;
    --text-main: #E8F5F0;
    --text-muted: #7FA697;
    --border: #243D33;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --primary-light: #1A2822;
    --accent-light: #2E1919;
    --gold-light: #2A2010;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-light);
    color: var(--text-main);
    overflow-x: hidden;
    line-height: 1.5;
    /* Removed overscroll-behavior: none to allow natural platform scrolling/bounce */
}

#app {
    max-width: 500px;
    margin: 0 auto;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

#screen-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg-light);
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
    transition: margin-bottom 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body.nav-visible #screen-container {
    margin-bottom: var(--nav-height);
    margin-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
}

.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding-bottom: 24px; /* Standard internal spacing */
}

/* ============ HEADER ============ */
.screen-header {
    background: var(--header-bg);
    padding: calc(16px + env(safe-area-inset-top, 0px)) 22px 18px;
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
    transition: all 0.3s ease;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 8px 25px rgba(29, 158, 117, 0.12);
}

.screen-header h1 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

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

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.badge-free { background: rgba(255,255,255,0.15); color: white; border: 1px solid rgba(255,255,255,0.2); }
.badge-premium { background: linear-gradient(135deg, #F5A623, #D4880A); color: white; box-shadow: 0 4px 12px rgba(245,166,35,0.3); }

.nav-item.active .nav-icon {
    transform: translateY(-4px) scale(1.1);
    color: var(--primary);
}

.nav-item.active .nav-label {
    opacity: 1;
    font-weight: 800;
}

.btn-back-icon {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.btn-back-icon:active { background: rgba(255,255,255,0.35); }

/* ============ CARDS ============ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin: 12px 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

.card-flat {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid var(--border);
}

.card-link {
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.card-link:active {
    transform: scale(0.98);
    box-shadow: var(--shadow);
}

/* ============ STAT CARDS ============ */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 4px 0;
    color: var(--primary);
}

.stat-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ============ INPUTS ============ */
.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.input-field {
    width: 100%;
    padding: 13px 16px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border);
    background: var(--bg-light);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.input-field::placeholder { color: var(--text-muted); opacity: 0.7; }
.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(29,158,117,0.15);
}

/* ============ BUTTONS ============ */
.btn {
    width: 100%;
    padding: 14px;
    border-radius: var(--radius-md);
    border: none;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s, opacity 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.2px;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(29,158,117,0.35);
}
.btn-primary:hover { box-shadow: 0 6px 18px rgba(29,158,117,0.45); }

.btn-danger {
    background: linear-gradient(135deg, #E24B4A, #C0322F);
    color: white;
    box-shadow: 0 4px 12px rgba(226,75,74,0.35);
}

.btn-gold {
    background: linear-gradient(135deg, #F5A623, #D4880A);
    color: white;
    box-shadow: 0 4px 12px rgba(245,166,35,0.35);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover { background: var(--primary-light); }

.btn-ghost {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-main);
}

.btn-sm {
    padding: 9px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    width: auto;
}

.btn-fab {
    position: fixed;
    bottom: 24px; /* Default bottom */
    right: 16px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    font-size: 1.6rem;
    box-shadow: 0 6px 24px rgba(29,158,117,0.45);
    z-index: 40;
    line-height: 1;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s, bottom 0.3s;
}

body.nav-visible .btn-fab {
    bottom: calc(var(--nav-height) + 16px);
    bottom: calc(var(--nav-height) + 16px + env(safe-area-inset-bottom));
}

.keyboard-open .btn-fab {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding: 10px;
    background: white;
    border-radius: 12px;
}

.spinner-sm {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(0,0,0,0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============ BADGES & TAGS ============ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.badge-free { background: var(--border); color: var(--text-muted); }
.badge-premium { background: linear-gradient(135deg, #F5A623, #D4880A); color: white; }
.badge-credit { background: #FEF0F0; color: var(--accent); }
.badge-debit { background: #E8F7F2; color: var(--primary); }
.badge-dot {
    position: absolute;
    top: -4px;
    right: -6px;
    background: var(--accent);
    color: white;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 10px;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-card);
    font-weight: 800;
    box-shadow: 0 2px 4px rgba(226,75,74,0.3);
}

/* ============ BOTTOM NAVIGATION ============ */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 500px; /* Match #app width */
    margin: 0 auto;
    height: var(--nav-height);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s, transform 0.15s;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    min-width: 60px;
}

.nav-item.active { color: var(--primary); }
.nav-item:active { transform: scale(0.92); }

.nav-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 600;
}

.hidden { display: none !important; }

/* ============ SPLASH SCREEN ============ */
.splash-screen {
    background: var(--header-bg);
    color: white;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 0;
    min-height: 100dvh;
}

.logo-circle {
    width: 90px;
    height: 90px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    border: 2px solid rgba(255,255,255,0.25);
    backdrop-filter: blur(4px);
}

.logo-text {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 5px;
    margin-bottom: 4px;
}

.splash-tagline {
    font-size: 0.9rem;
    opacity: 0.75;
    font-weight: 300;
    letter-spacing: 1px;
}

.splash-loader {
    margin-top: 48px;
    display: flex;
    gap: 8px;
    justify-content: center;
}

.splash-dot {
    width: 8px;
    height: 8px;
    background: rgba(255,255,255,0.6);
    border-radius: 50%;
    animation: dotBounce 1.2s ease infinite;
}
.splash-dot:nth-child(2) { animation-delay: 0.2s; }
.splash-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
    40% { transform: translateY(-10px); opacity: 1; }
}

/* ============ TRANSACTION ITEMS ============ */
.txn-item {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: background 0.15s;
}

.txn-item:last-child { border-bottom: none; }
.txn-item:active { background: var(--bg-light); }

.txn-note {
    font-weight: 600;
    color: var(--text-main);
    word-break: break-word; /* Allow long words to break but prefer word breaks */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

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

.txn-amount {
    font-size: 1rem;
    font-weight: 700;
    text-align: right;
    flex-shrink: 0;
}

.txn-credit { color: var(--accent); }
.txn-debit { color: var(--primary); }

/* ============ CUSTOMER LIST ITEM ============ */
.customer-card {
    margin: 6px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
    transition: transform 0.15s, box-shadow 0.15s;
    gap: 12px;
}

.customer-card:active { transform: scale(0.98); }

.customer-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.customer-info { flex: 1; min-width: 0; }

.customer-name {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.customer-phone {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.customer-balance {
    text-align: right;
    flex-shrink: 0;
}

.balance-amount {
    font-size: 1rem;
    font-weight: 700;
}

.balance-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============ SETTINGS LIST ============ */
.settings-item {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.settings-item:last-child { border-bottom: none; }
.settings-item:active { background: var(--bg-light); }

.settings-item-title { font-size: 0.9rem; font-weight: 600; }
.settings-item-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ============ UPGRADE BANNER ============ */
.upgrade-banner {
    margin: 0 16px 12px;
    background: var(--gold-light);
    border: 1.5px solid #F5A623;
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: transform 0.15s;
}
.upgrade-banner:active { transform: scale(0.98); }
.upgrade-banner-text h4 { font-size: 0.88rem; font-weight: 700; color: #8B5900; }
.upgrade-banner-text p { font-size: 0.75rem; color: #A87020; margin-top: 2px; }

/* ============ TOAST (PREMIUM) ============ */
#toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(32px);
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1), bottom 0.3s;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,0.1);
    min-width: 250px;
    backdrop-filter: blur(8px);
}

body.nav-visible #toast {
    bottom: calc(var(--nav-height) + 20px);
}

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

#toast.success { background: rgba(29, 158, 117, 0.9); color: white; }
#toast.error { background: rgba(226, 75, 74, 0.9); color: white; }
#toast.info { background: rgba(30, 45, 42, 0.9); color: white; }

#toast svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2.5;
    flex-shrink: 0;
}

/* ============ MODAL ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease;
    backdrop-filter: blur(2px);
}

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

.modal-sheet {
    background: var(--bg-card);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 24px 20px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh; /* Ensure modal doesn't cover whole screen and is scrollable */
    overflow-y: auto;
    animation: sheetUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(15px) saturate(180%);
}

[data-theme="dark"] .modal-sheet {
    background: rgba(26, 40, 34, 0.85);
    border: 1px solid rgba(255,255,255,0.05);
}

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

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.modal-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ============ LOAD MORE BUTTON ============ */
.btn-load-more {
    margin: 8px auto 20px;
    display: block;
    width: calc(100% - 32px);
    padding: 12px;
    background: var(--bg-light);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.btn-load-more:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

/* ============ EMPTY STATES ============ */
.empty-state {
    text-align: center;
    padding: 40px 24px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3.2rem;
    margin-bottom: 18px;
    opacity: 0.9;
    filter: drop-shadow(0 4px 10px rgba(29, 158, 117, 0.15));
}

.empty-state-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 8px;
}
.empty-state-sub { font-size: 0.85rem; margin-bottom: 24px; }

/* ============ POSTER ============ */
.poster-design {
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 3/4;
    background: var(--header-bg);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px;
    position: relative;
}

.poster-design::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
}

.poster-design::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: -30px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
}

/* ============ SUBSCRIPTION PLAN CARD ============ */
.plan-card {
    border: 2px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: 20px;
    background: var(--primary-light);
    margin: 0 16px 12px;
}

.plan-price {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.plan-period {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 400;
}

.feature-list {
    list-style: none;
    margin-top: 16px;
}

.feature-list li {
    font-size: 0.9rem;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.feature-list li:last-child { border-bottom: none; }

/* ============ SEARCH BAR ============ */
.search-bar {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    position: sticky;
    top: 63px; /* Offset for screen-header */
    z-index: 40;
}

.search-input {
    width: 100%;
    padding: 9px 16px 9px 40px;
    border-radius: 24px;
    border: 1.5px solid var(--border);
    background: var(--bg-light);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.88rem;
    transition: border-color 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237B9489' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 14px center;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ============ CONTENT WRAPPER ============ */
.content {
    flex: 1;
    padding: 16px;
    padding-bottom: 32px;
}

/* ============ DIVIDER ============ */
.divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

/* ============ SWITCH TOGGLE ============ */
.switch {
    width: 44px;
    height: 24px;
    background: var(--border);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
    border: none;
    flex-shrink: 0;
}

.switch.on { background: var(--primary); }

.switch::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.switch.on::after { transform: translateX(20px); }

/* ============ UTILITIES ============ */
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-muted); }
.text-gold { color: var(--gold); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 0.75rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.25rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 0.75rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.25rem; }
.p-4 { padding: 16px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

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

/* PWA install prompt */
#install-banner {
    position: fixed;
    bottom: calc(var(--nav-height) + 16px + env(safe-area-inset-bottom));
    left: 16px;
    right: 16px;
    max-width: 468px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.install-icon {
    width: 42px;
    height: 42px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.install-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.install-text strong {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
}

.install-text span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.install-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 8px;
    margin-right: -4px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.install-close:hover { opacity: 1; }

/* Language selector */
.lang-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 16px;
}

.lang-option {
    padding: 14px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    cursor: pointer;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    background: var(--bg-light);
    color: var(--text-main);
}

.lang-option.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

/* Ledger balance header */
.ledger-balance-header {
    padding: 0 20px 24px;
    color: white;
    text-align: center;
}

.ledger-balance-amount {
    font-size: 1.9rem;
    font-weight: 800;
    margin: 4px 0;
    line-height: 1;
}

.ledger-balance-tag {
    background: rgba(255,255,255,0.2);
    padding: 4px 14px;
    border-radius: 20px;
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.ledger-actions {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    z-index: 45;
}

