:root {
    --w-primary: #1a2b5f;
    --w-primary-light: #243a7a;
    --w-accent: #2563eb;
    --w-green: #16a34a;
    --w-red: #dc2626;
    --w-bg: #f4f6fb;
    --w-card: #ffffff;
    --w-text: #1e293b;
    --w-muted: #64748b;
    --w-border: #e2e8f0;
    --w-radius: 16px;
    --w-shadow: 0 4px 24px rgba(26, 43, 95, 0.08);
}

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

body.wallet-app {
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
    background: #e8ecf4;
    color: var(--w-text);
    min-height: 100vh;
}

.wallet-shell {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--w-bg);
    position: relative;
    box-shadow: 0 0 40px rgba(0,0,0,0.06);
}

/* Header */
.wallet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--w-card);
}
.wallet-header-left { display: flex; align-items: center; gap: 10px; }
.wallet-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--w-primary), var(--w-accent));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem;
    text-decoration: none;
}
.wallet-logo { height: 28px; }
.wallet-header-right { display: flex; align-items: center; gap: 14px; }
.wallet-flag { font-size: 1.3rem; }
.wallet-notif {
    color: var(--w-text);
    font-size: 1.2rem;
    text-decoration: none;
}

/* Main */
.wallet-main {
    padding: 0 16px 90px;
    min-height: calc(100vh - 120px);
}

/* Balance card */
.balance-card {
    background: linear-gradient(145deg, var(--w-primary) 0%, #0f1d42 100%);
    border-radius: var(--w-radius);
    padding: 22px 20px;
    color: #fff;
    margin: 8px 0 20px;
    box-shadow: var(--w-shadow);
}
.balance-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.balance-label { font-size: 0.82rem; opacity: 0.85; }
.balance-toggle {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 32px; height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
}
.balance-amount {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.balance-amount.hidden { filter: blur(8px); user-select: none; }

/* Quick actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--w-text);
}
.quick-action-icon {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--w-card);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    color: var(--w-primary);
    box-shadow: 0 2px 12px rgba(26,43,95,0.08);
    transition: transform 0.15s;
}
.quick-action:hover .quick-action-icon { transform: scale(1.05); }
.quick-action span { font-size: 0.72rem; font-weight: 600; text-align: center; line-height: 1.2; }

/* Section */
.section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--w-text);
}

/* Transactions */
.tx-list { list-style: none; }
.tx-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--w-border);
}
.tx-item:last-child { border-bottom: none; }
.tx-icon {
    width: 42px; height: 42px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.tx-icon.deposit { background: #dcfce7; color: var(--w-green); }
.tx-icon.withdraw { background: #fee2e2; color: var(--w-red); }
.tx-icon.send { background: #dbeafe; color: var(--w-accent); }
.tx-icon.receive { background: #dcfce7; color: var(--w-green); }
.tx-icon.qr { background: #f3e8ff; color: #9333ea; }
.tx-info { flex: 1; min-width: 0; }
.tx-title { font-size: 0.88rem; font-weight: 600; }
.tx-date { font-size: 0.75rem; color: var(--w-muted); margin-top: 2px; }
.tx-amount { font-size: 0.92rem; font-weight: 700; white-space: nowrap; }
.tx-amount.positive { color: var(--w-green); }
.tx-amount.negative { color: var(--w-red); }
.tx-empty { text-align: center; padding: 32px 0; color: var(--w-muted); font-size: 0.88rem; }

/* Bottom nav */
.wallet-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    height: 64px;
    background: var(--w-card);
    border-top: 1px solid var(--w-border);
    display: flex;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.wallet-bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--w-muted);
    font-size: 0.65rem;
    font-weight: 600;
}
.wallet-bottom-nav a i { font-size: 1.15rem; }
.wallet-bottom-nav a.active { color: var(--w-primary); }

/* Auth pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    background: var(--w-bg);
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--w-card);
    border-radius: var(--w-radius);
    padding: 32px 24px;
    box-shadow: var(--w-shadow);
}
.auth-logo { display: block; height: 40px; margin: 0 auto 20px; }
.auth-title { text-align: center; font-size: 1.3rem; font-weight: 800; margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--w-muted); font-size: 0.85rem; margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 6px; color: var(--w-text); }
.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--w-border);
    border-radius: 10px;
    font-size: 0.92rem;
    font-family: inherit;
    transition: border-color 0.15s;
}
.form-group input:focus { outline: none; border-color: var(--w-accent); }
.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--w-primary), var(--w-primary-light));
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    margin-top: 8px;
}
.btn-primary:hover { opacity: 0.92; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-link { text-align: center; margin-top: 18px; font-size: 0.85rem; color: var(--w-muted); }
.auth-link a { color: var(--w-accent); font-weight: 600; text-decoration: none; }
.auth-msg { padding: 10px 14px; border-radius: 8px; font-size: 0.85rem; margin-bottom: 14px; display: none; }
.auth-msg.error { display: block; background: #fee2e2; color: var(--w-red); }
.auth-msg.success { display: block; background: #dcfce7; color: var(--w-green); }

/* Page content */
.page-title { font-size: 1.2rem; font-weight: 800; margin: 12px 0 16px; }
.page-card {
    background: var(--w-card);
    border-radius: var(--w-radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.iban-box {
    background: #f8fafc;
    border: 1.5px dashed var(--w-border);
    border-radius: 12px;
    padding: 16px;
    margin: 12px 0;
    text-align: center;
}
.iban-box .iban-value {
    font-family: monospace;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 1px;
    word-break: break-all;
    color: var(--w-primary);
}
.iban-box .bank-name { font-size: 0.82rem; color: var(--w-muted); margin-top: 6px; }
.wallet-code-box {
    background: #f8fafc;
    border: 1.5px dashed var(--w-border);
    border-radius: 12px;
    padding: 14px 16px;
    margin: -8px 0 20px;
    text-align: center;
}
.balance-card + .wallet-code-box {
    margin-top: -12px;
}
.balance-card .wallet-code-box {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.35);
    margin: 14px 0 0;
}
.wallet-code-box .wallet-code-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--w-muted);
    margin-bottom: 6px;
}
.balance-card .wallet-code-box .wallet-code-label {
    font-size: 0.78rem;
    font-weight: 400;
    color: #fff;
    opacity: 0.85;
}
.wallet-code-box .wallet-code-value {
    font-family: monospace;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--w-primary);
}
.balance-card .wallet-code-box .wallet-code-value {
    color: #fff;
}
.copy-btn-light {
    background: rgba(255,255,255,0.2);
    margin-top: 10px;
}
.copy-btn-light:hover { background: rgba(255,255,255,0.3); }
.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--w-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    font-family: inherit;
}
.stub-page {
    text-align: center;
    padding: 60px 20px;
    color: var(--w-muted);
}
.stub-page i { font-size: 3rem; color: var(--w-border); margin-bottom: 16px; }
.stub-page h2 { font-size: 1.1rem; color: var(--w-text); margin-bottom: 8px; }
.card-list { display: flex; flex-direction: column; gap: 10px; }
.wallet-card-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid var(--w-border);
}
.wallet-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(32, 34, 91, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--w-primary);
    font-size: 1.1rem;
}
.wallet-card-info { flex: 1; min-width: 0; }
.wallet-card-label { font-weight: 700; font-size: 0.92rem; color: var(--w-text); }
.wallet-card-meta { font-size: 0.8rem; color: var(--w-muted); margin-top: 2px; }
.wallet-card-status {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(0, 177, 114, 0.12);
    color: #00B172;
    white-space: nowrap;
}
.wallet-card-status.inactive { background: rgba(148, 163, 184, 0.15); color: var(--w-muted); }

/* Credit card form */
.cc-form-card { overflow: hidden; }
.label-optional { font-weight: 400; color: var(--w-muted); }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cc-mono { font-family: 'SF Mono', 'Consolas', monospace; letter-spacing: 0.5px; }
.cc-uppercase { text-transform: uppercase; }
.cc-preview {
    background: linear-gradient(135deg, #1a2b5f 0%, #2563eb 50%, #1e40af 100%);
    border-radius: 16px;
    padding: 24px 20px;
    color: #fff;
    margin-bottom: 20px;
    min-height: 170px;
    position: relative;
    box-shadow: 0 8px 32px rgba(26, 43, 95, 0.25);
}
.cc-preview-chip {
    width: 42px;
    height: 32px;
    background: linear-gradient(135deg, #fbbf24, #d97706);
    border-radius: 6px;
    margin-bottom: 24px;
}
.cc-preview-number {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 2px;
    margin-bottom: 20px;
    word-spacing: 4px;
}
.cc-preview-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
}
.cc-preview-label {
    font-size: 0.65rem;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}
.cc-preview-name {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cc-preview-expiry {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.95rem;
    font-weight: 600;
}

@media (max-width: 360px) {
    .form-row-2 { grid-template-columns: 1fr; }
    .cc-preview-number { font-size: 1rem; letter-spacing: 1px; }
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--w-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 12px;
}

@media (min-width: 431px) {
    body.wallet-app { background: #d1d9e6; }
}

/* Mobile polish: safe area, touch targets, readability */
body.wallet-app {
    font-size: 14px;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

.wallet-shell {
    padding-top: env(safe-area-inset-top, 0);
}

.wallet-header {
    padding-top: calc(14px + env(safe-area-inset-top, 0));
}

.wallet-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom, 0);
    height: calc(64px + env(safe-area-inset-bottom, 0));
}

.wallet-bottom-nav a {
    min-height: 44px;
    min-width: 44px;
}

.quick-action-btn,
.wallet-btn,
.wallet-submit,
.form-input,
.wallet-notif,
.wallet-avatar {
    min-height: 44px;
}

.form-input {
    width: 100%;
    font-size: 16px;
    box-sizing: border-box;
}

.wallet-main {
    padding-bottom: calc(90px + env(safe-area-inset-bottom, 0));
}

@media (min-width: 768px) {
    .wallet-shell {
        max-width: 430px;
        border-radius: 0;
    }
}

/* Breakpoints: 480 / 768 / 1024 — touch 44px, safe-area verified */
@media (max-width: 1024px) {
    .wallet-shell {
        max-width: 100%;
        box-shadow: none;
    }
}

@media (max-width: 768px) {
    .auth-page {
        padding: calc(24px + env(safe-area-inset-top, 0)) 16px calc(24px + env(safe-area-inset-bottom, 0));
        align-items: stretch;
    }

    .auth-card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .form-group input,
    .btn-primary,
    .copy-btn {
        min-height: 44px;
        font-size: 16px;
    }

    .page-card {
        padding: 16px;
    }

    .quick-action-icon {
        width: 52px;
        height: 52px;
    }
}

@media (max-width: 480px) {
    .balance-amount { font-size: 1.75rem; }
    .quick-actions { grid-template-columns: repeat(4, 1fr); gap: 8px; }
    .quick-action span { font-size: 0.65rem; }
    .form-row-2 { grid-template-columns: 1fr; }
    .auth-card { padding: 24px 16px; }
    .wallet-header { padding-left: 12px; padding-right: 12px; }
    .wallet-main { padding-left: 12px; padding-right: 12px; }
}
