:root {
    --saffron: #FF9933;
    --saffron-dark: #E67E17;
    --saffron-soft: #FFF4E6;
    --white: #FFFFFF;
    --green: #138808;
    --green-dark: #0D6B04;
    --green-soft: #EAF7EA;
    --navy: #0A2463;
    --navy-light: #1D3E8A;
    --navy-soft: #EEF2FF;
    --bg: #F1F5F9;
    --text: #0F172A;
    --muted: #64748B;
    --border: #E2E8F0;
    --danger: #DC2626;
    --danger-soft: #FEF2F2;
    --shadow-sm: 0 2px 8px rgba(10, 36, 99, 0.06);
    --shadow-md: 0 8px 24px rgba(10, 36, 99, 0.10);
    --shadow-lg: 0 14px 36px rgba(10, 36, 99, 0.16);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    scrollbar-width: thin;
    scrollbar-color: rgba(10, 36, 99, 0.35) rgba(226, 232, 240, 0.65);
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(160deg, #FFF7ED 0%, #F1F5F9 48%, #ECFDF5 100%);
    color: var(--text);
    min-height: 100vh;
    scroll-behavior: smooth;
}

/* Smooth Side (Vertical) & Under (Horizontal) Scrollbars */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-track {
    background: #E2E8F0;
    border-radius: 999px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--saffron), var(--navy));
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:horizontal {
    background: linear-gradient(90deg, var(--saffron), var(--green));
}

.app-viewport {
    max-width: 460px;
    margin: 0 auto;
    min-height: 100vh;
    background: #F8FAFC;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 50px rgba(10, 36, 99, 0.10);
}

@media (min-width: 520px) {
    body {
        padding: 16px 0;
    }
    .app-viewport {
        height: calc(100vh - 32px);
        min-height: 600px;
        border-radius: 28px;
        overflow: hidden;
        border: 1px solid rgba(10, 36, 99, 0.08);
    }
}

.tricolor-ribbon {
    height: 4px;
    width: 100%;
    background: linear-gradient(90deg, var(--saffron) 0%, var(--saffron) 33.33%, #FFFFFF 33.33%, #FFFFFF 66.66%, var(--green) 66.66%, var(--green) 100%);
    flex-shrink: 0;
}

/* Smooth App Header */
.app-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.app-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    gap: 10px;
}

.brand-cluster {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.chakra-badge {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--saffron) 0%, #FFFFFF 50%, var(--green) 100%);
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(255, 153, 51, 0.25);
}

.chakra-badge-inner {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    background: var(--navy);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-titles {
    min-width: 0;
}

.brand-name {
    font-size: 15px;
    font-weight: 800;
    color: var(--navy);
    letter-spacing: -0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-sub {
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wallet-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--green-soft), #FFFFFF);
    border: 1.5px solid rgba(19, 136, 8, 0.28);
    color: var(--green-dark);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 8px rgba(19, 136, 8, 0.10);
    flex-shrink: 0;
}

.wallet-pill:active {
    transform: scale(0.95);
}

/* Main Scrollable Body */
.app-main {
    flex: 1;
    padding: 16px 16px 96px 16px;
    overflow-y: auto;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.app-screen {
    display: none;
    animation: fadeSlideUp 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.app-screen.active {
    display: block;
}

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

/* Auth Screen */
.auth-hero {
    background: linear-gradient(145deg, var(--navy) 0%, #14368A 65%, #1A47B8 100%);
    color: #fff;
    border-radius: 22px;
    padding: 22px 20px;
    margin-bottom: 18px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.auth-hero::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--saffron) 0%, var(--saffron) 33%, #FFFFFF 33%, #FFFFFF 66%, var(--green) 66%, var(--green) 100%);
}

.auth-hero::after {
    content: "";
    position: absolute;
    right: -30px;
    bottom: -30px;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 153, 51, 0.25) 0%, transparent 70%);
}

.auth-hero h1 {
    margin: 8px 0 4px;
    font-size: 22px;
    font-weight: 800;
}

.auth-hero p {
    margin: 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.45;
}

.segmented-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #E2E8F0;
    padding: 4px;
    border-radius: 14px;
    margin-bottom: 16px;
}

.segmented-btn {
    border: none;
    background: transparent;
    padding: 10px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13.5px;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.segmented-btn.active {
    background: #fff;
    color: var(--navy);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

/* Cards & Forms */
.card {
    background: #fff;
    border-radius: 18px;
    padding: 16px;
    border: 1px solid rgba(226, 232, 240, 0.85);
    box-shadow: var(--shadow-sm);
    margin-bottom: 14px;
}

.card-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--navy);
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.form-group {
    margin-bottom: 13px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 5px;
}

.form-input, .form-select {
    width: 100%;
    padding: 11px 13px;
    border-radius: 12px;
    border: 1.5px solid #CBD5E1;
    background: #F8FAFC;
    font-size: 14px;
    color: var(--text);
    outline: none;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.form-input:focus, .form-select:focus {
    border-color: var(--saffron);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 153, 51, 0.18);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 13px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease;
    text-decoration: none;
}

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--saffron) 0%, var(--saffron-dark) 100%);
    color: #fff;
    box-shadow: 0 6px 18px rgba(255, 153, 51, 0.34);
}

.btn-green {
    background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
    color: #fff;
    box-shadow: 0 6px 18px rgba(19, 136, 8, 0.28);
}

.btn-navy {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    color: #fff;
    box-shadow: 0 6px 16px rgba(10, 36, 99, 0.25);
}

.btn-outline {
    background: #fff;
    color: var(--navy);
    border: 1.5px solid #CBD5E1;
}

.btn-danger-soft {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid #FECACA;
}

/* Wallet Hero Card (Indian Flag Inspired) */
.wallet-hero {
    border-radius: 22px;
    padding: 18px;
    background: linear-gradient(135deg, var(--navy) 0%, #122E7A 60%, #0C4A2B 100%);
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    margin-bottom: 14px;
}

.wallet-hero::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--saffron) 33%, #FFFFFF 33%, #FFFFFF 66%, var(--green) 66%);
}

.wallet-hero-label {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.9px;
    color: rgba(255, 255, 255, 0.78);
    font-weight: 700;
}

.wallet-hero-balance {
    font-size: 32px;
    font-weight: 900;
    margin: 4px 0 14px;
    letter-spacing: -0.5px;
}

.wallet-mini-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.wallet-mini-item span {
    display: block;
    font-size: 10.5px;
    color: rgba(255, 255, 255, 0.72);
}

.wallet-mini-item strong {
    display: block;
    font-size: 13.5px;
    margin-top: 2px;
}

/* Quick Action Tiles */
.quick-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.quick-tile {
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 16px;
    padding: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-align: left;
    transition: transform 0.15s ease, border-color 0.15s ease;
    box-shadow: var(--shadow-sm);
}

.quick-tile:active {
    transform: scale(0.97);
}

.quick-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.quick-tile strong {
    display: block;
    font-size: 13px;
    color: var(--navy);
}

.quick-tile span {
    display: block;
    font-size: 11px;
    color: var(--muted);
}

/* Transaction List */
.tx-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tx-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 14px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
}

.tx-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.tx-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
}

.tx-icon.credit {
    background: var(--green-soft);
    color: var(--green);
}

.tx-icon.debit {
    background: var(--saffron-soft);
    color: var(--saffron-dark);
}

.tx-desc {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tx-time {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

.tx-amount {
    font-size: 14px;
    font-weight: 800;
    flex-shrink: 0;
    text-align: right;
}

.tx-amount.credit { color: var(--green); }
.tx-amount.debit { color: var(--saffron-dark); }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.badge-pending { background: var(--saffron-soft); color: #B45309; }
.badge-approved { background: var(--green-soft); color: var(--green-dark); }
.badge-rejected { background: var(--danger-soft); color: var(--danger); }

/* Scanner Box */
.scanner-frame {
    border-radius: 18px;
    overflow: hidden;
    background: #0F172A;
    border: 2px solid var(--saffron);
    min-height: 250px;
    position: relative;
}

#qr-reader {
    width: 100%;
    border: none !important;
}

#qr-reader video {
    border-radius: 14px;
    object-fit: cover;
}

/* Payout Method Selector */
.method-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.method-card {
    border: 1.5px solid var(--border);
    background: #F8FAFC;
    border-radius: 14px;
    padding: 10px 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
}

.method-card.selected {
    border-color: var(--green);
    background: var(--green-soft);
    color: var(--green-dark);
    box-shadow: 0 3px 10px rgba(19, 136, 8, 0.14);
}

.chip-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.amount-chip {
    border: 1px solid #CBD5E1;
    background: #fff;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: var(--navy);
    cursor: pointer;
}

.amount-chip:active {
    background: var(--saffron-soft);
    border-color: var(--saffron);
}

/* Fixed Smooth Bottom App Footer */
.app-footer-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 460px;
    z-index: 45;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(226, 232, 240, 0.95);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 24px rgba(10, 36, 99, 0.08);
}

@media (min-width: 520px) {
    .app-footer-nav {
        bottom: 16px;
        border-radius: 0 0 28px 28px;
    }
}

.nav-item {
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    color: #64748B;
    font-size: 10.5px;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.16s ease, transform 0.14s ease;
}

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

.nav-item.active svg {
    color: var(--saffron-dark);
}

.nav-scan-btn {
    position: relative;
    top: -18px;
    width: 56px;
    height: 56px;
    margin: 0 auto -16px;
    border-radius: 50%;
    border: 3px solid #fff;
    background: linear-gradient(135deg, var(--saffron) 0%, #FF7700 45%, var(--green) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(255, 153, 51, 0.42);
    transition: transform 0.16s ease;
}

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

/* Filter Pills */
.pill-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    overflow-x: auto;
}

.pill-tab {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--muted);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.pill-tab.active {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}

/* Modal / Result Overlay */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.modal-backdrop.open {
    display: flex;
    animation: fadeIn 0.18s ease;
}

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

.modal-card {
    width: 100%;
    max-width: 390px;
    background: #fff;
    border-radius: 24px;
    padding: 24px 20px;
    text-align: center;
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.25);
    position: relative;
    overflow: hidden;
    animation: popIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes popIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-icon.success { background: var(--green-soft); color: var(--green); }
.modal-icon.warning { background: var(--saffron-soft); color: var(--saffron-dark); }
.modal-icon.error { background: var(--danger-soft); color: var(--danger); }

/* Toast */
.toast-container {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 120;
    width: calc(100% - 32px);
    max-width: 420px;
    pointer-events: none;
}

.toast {
    background: var(--navy);
    color: #fff;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    margin-bottom: 8px;
    border-left: 4px solid var(--saffron);
    animation: fadeSlideUp 0.2s ease;
}

.toast.success { border-left-color: #22C55E; }
.toast.error { border-left-color: #EF4444; background: #7F1D1D; }

.qr-preview-img {
    max-width: 180px;
    max-height: 180px;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    display: block;
    margin: 8px 0;
    object-fit: contain;
}

.empty-state {
    text-align: center;
    padding: 28px 12px;
    color: var(--muted);
    font-size: 13px;
}

/* Mobile Pagination & Page Nav */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding: 10px 12px;
    background: #F8FAFC;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 11.5px;
}

.pagination-info {
    color: var(--muted);
    font-weight: 700;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.pg-btn {
    border: 1px solid #CBD5E1;
    background: #fff;
    color: var(--navy);
    min-width: 29px;
    height: 29px;
    padding: 0 8px;
    border-radius: 8px;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pg-btn.active {
    background: linear-gradient(135deg, var(--saffron), var(--saffron-dark));
    color: #fff;
    border-color: var(--saffron-dark);
}

.pg-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.page-nav-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 9px 12px;
    margin-top: 14px;
    font-size: 12px;
}

.hidden { display: none !important; }
