/* =====================================================================
   SmartyPlus — UI redesign
   Brand: Smarty green (#0FB489) on ink-navy (dark) / mint (light)
   Principles: tonal surfaces instead of borders, one hero (balance card),
   modern selects, animated theme icon, fully responsive.
   Only presentation lives here — no behaviour was changed.
   ===================================================================== */

/* ---------- Tokens ---------- */
:root {
    --brand: #0FB489;               /* Smarty green (from the app icon) */
    --brand-deep: #066B52;
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --ease: cubic-bezier(.2, .7, .2, 1);
}

body.theme-dark {
    --page-bg: #0a1220;
    --surface: #101b2d;
    --surface-strong: #0d1626;
    --surface-2: #16243a;
    --surface-3: #1c2d49;
    --overlay-bg: rgba(10, 18, 32, .92);
    --text: #eaf2f8;
    --text-main: #eaf2f8;
    --text-2: #b9c8d9;
    --muted: #8da1b8;
    --primary: #22C9A0;
    --primary-strong: #0A8466;
    --primary-dark: #0A8466;
    --primary-light: #5eead4;
    --primary-bg: rgba(34, 201, 160, .13);
    --primary-bg-hover: rgba(34, 201, 160, .22);
    --shadow: 0 1px 2px rgba(0, 0, 0, .28), 0 18px 40px -18px rgba(0, 0, 0, .65);
    --shadow-soft: 0 10px 28px -14px rgba(0, 0, 0, .6);
    --danger: #f87171;
    --danger-bg: rgba(248, 113, 113, .12);
    --scroll-thumb: rgba(141, 161, 184, .35);
    color-scheme: dark;
    background: var(--page-bg);
    color: var(--text);
}

body.theme-light {
    --page-bg: #eef6f2;
    --surface: #ffffff;
    --surface-strong: #ffffff;
    --surface-2: #f0f7f4;
    --surface-3: #e3efe9;
    --overlay-bg: rgba(238, 246, 242, .92);
    --text: #0d2a22;
    --text-main: #0d2a22;
    --text-2: #34554a;
    --muted: #5a766b;
    --primary: #0A8466;
    --primary-strong: #0A8466;
    --primary-dark: #066B52;
    --primary-light: #0FB489;
    --primary-bg: rgba(10, 132, 102, .10);
    --primary-bg-hover: rgba(10, 132, 102, .18);
    --shadow: 0 1px 2px rgba(8, 70, 54, .06), 0 18px 38px -20px rgba(8, 90, 68, .30);
    --shadow-soft: 0 10px 26px -16px rgba(8, 90, 68, .35);
    --danger: #dc2626;
    --danger-bg: rgba(220, 38, 38, .08);
    --scroll-thumb: rgba(10, 132, 102, .35);
    color-scheme: light;
    background: var(--page-bg);
    color: var(--text);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-feature-settings: "tnum" 1, "cv11" 1;
    -webkit-font-smoothing: antialiased;
    min-height: 100dvh;
}
button, input, select, textarea { font-family: inherit; }

/* Targeted transitions (instead of animating everything) */
button, a, .card, .input-field, .sidebar-btn, .mobile-nav-btn,
.wallet-icon-box, .home-round-btn, .toggle-switch, .toggle-knob {
    transition: background-color .22s var(--ease), color .22s var(--ease),
                box-shadow .22s var(--ease), transform .22s var(--ease), opacity .22s var(--ease);
}

:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent);
    outline-offset: 2px;
    border-radius: 10px;
}

/* ---------- Text colour helpers used by the app's Tailwind classes ---------- */
body.theme-dark .text-slate-300 { color: var(--text-2) !important; }
body.theme-dark .text-slate-400 { color: var(--muted) !important; }
body.theme-dark .text-slate-500 { color: #6f849c !important; }
body.theme-light .text-slate-300 { color: var(--text-2) !important; }
body.theme-light .text-slate-400 { color: var(--muted) !important; }
body.theme-light .text-slate-500 { color: #6d8a7e !important; }
body.theme-light .table-container td.text-white,
body.theme-light .table-container td .text-white { color: var(--text) !important; }
body.theme-light .table-container .text-emerald-400 { color: #0A8466 !important; }
body.theme-light .table-container .text-yellow-400 { color: #a16207 !important; }
body.theme-light .table-container .text-red-400 { color: #dc2626 !important; }
body.theme-light .table-container .text-purple-400 { color: #7c3aed !important; }
body.theme-light .table-container .text-slate-300 { color: var(--text-2) !important; }

/* Remove leftover Tailwind divider borders — spacing separates things instead */
.border-t, .border-b, .border-b-2 { border-width: 0 !important; }
.border-slate-700\/50, .border-slate-700\/40 { border-color: transparent !important; }

/* ---------- Buttons ---------- */
.btn-primary, .btn-outline, .btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    padding: 12px 22px;
    border: 0;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: .95rem;
    letter-spacing: .1px;
    cursor: pointer;
}
.btn-primary {
    background: linear-gradient(135deg, #0FB489 -20%, var(--primary-strong) 70%);
    color: #fff;
    box-shadow: 0 10px 22px -10px rgba(10, 132, 102, .75);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 26px -10px rgba(10, 132, 102, .85); }
.btn-primary:active { transform: translateY(0) scale(.99); }
.btn-primary:disabled, .btn-outline:disabled, .btn-danger:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* "outline" buttons are now tonal — no border */
.btn-outline {
    background: var(--primary-bg);
    color: var(--primary);
}
.btn-outline:hover { background: var(--primary-bg-hover); transform: translateY(-1px); }
.btn-outline:active { transform: scale(.99); }

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

/* Language buttons are re-classed by script.js; style by state */
#lang-btn-en, #lang-btn-so {
    border: 0 !important;
    border-radius: var(--radius-md) !important;
    min-height: 48px;
    padding: 12px 16px !important;
    font-size: .9rem !important;
    font-weight: 700;
    background: var(--surface-2) !important;
    color: var(--muted) !important;
    box-shadow: none;
}
#lang-btn-en:is(.btn-primary, .bg-emerald-600),
#lang-btn-so:is(.btn-primary, .bg-emerald-600) {
    background: linear-gradient(135deg, #0FB489 -20%, var(--primary-strong) 70%) !important;
    color: #fff !important;
    box-shadow: 0 10px 22px -12px rgba(10, 132, 102, .8);
}

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 0;
    border-radius: var(--radius-xl);
    padding: 26px;
    min-height: 0;
    height: auto;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
}
.card:hover { transform: none; box-shadow: var(--shadow); border-color: transparent; }

/* Page titles (replaces the old underlined headings) */
section > h2 {
    display: flex !important;
    align-items: center;
    gap: 14px;
    padding: 0 !important;
    margin: 4px 0 6px;
    color: var(--text) !important;
    font-weight: 800;
    letter-spacing: -.2px;
}
section > h2 > i {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    margin: 0 !important;
    border-radius: 14px;
    background: var(--primary-bg);
    color: var(--primary) !important;
    font-size: 1.05rem;
}
.card h3 { color: var(--text) !important; font-weight: 800; letter-spacing: -.1px; }
.card h3 > i {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: var(--primary-bg);
    color: var(--primary) !important;
    font-size: .9rem;
}
.card h3[style*="#ef4444"] { color: var(--danger) !important; }
.card h3[style*="#ef4444"] > i { background: var(--danger-bg); color: var(--danger) !important; }

/* Form labels: sentence case, no shouting */
label.uppercase, label.block {
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-size: .82rem !important;
    font-weight: 700 !important;
    margin-bottom: 8px !important;
}
label.block > i, label.flex > i { color: var(--primary) !important; opacity: .9; }

/* ---------- Inputs ---------- */
.input-field {
    width: 100%;
    min-height: 50px;
    padding: 13px 16px;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    background: var(--surface-2);
    color: var(--text);
    font-size: .95rem;
    font-weight: 500;
    outline: none;
    box-shadow: none;
}
.input-field::placeholder { color: var(--muted); opacity: .75; font-weight: 400; }
.input-field:hover { background: var(--surface-3); }
.input-field:focus {
    background: var(--surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 5px var(--primary-bg);
}
.input-field[readonly] { opacity: .7; cursor: not-allowed; }
body.theme-dark .input-field,
body.theme-light .input-field { color: var(--text) !important; }
body.theme-dark .input-field { background: var(--surface-2) !important; border-color: transparent !important; }
body.theme-light .input-field { background: var(--surface-2) !important; }
body.theme-dark .input-field:focus, body.theme-light .input-field:focus {
    background: var(--surface) !important;
    border-color: var(--primary) !important;
}
input[type="date"].input-field { appearance: none; -webkit-appearance: none; min-width: 0; }
body.theme-dark input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(.85); }

/* ---------- Modern select ("option") inputs ---------- */
select.input-field,
.bt-currency-text select {
    cursor: pointer;
    text-overflow: ellipsis;
}

/* Fallback (Safari / Firefox): custom chevron, native list */
@supports not (appearance: base-select) {
    .bt-currency-text select { appearance: none; -webkit-appearance: none; }
    select.input-field {
        appearance: none;
        -webkit-appearance: none;
        padding-right: 46px;
        background-repeat: no-repeat;
        background-position: right 16px center;
        background-size: 16px;
    }
    body.theme-dark select.input-field {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2322C9A0' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    }
    body.theme-light select.input-field {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230A8466' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    }
    select.input-field option { background: var(--surface); color: var(--text); }
}

/* Chromium 135+: fully styled dropdown list */
@supports (appearance: base-select) {
    select.input-field,
    select.input-field::picker(select),
    .bt-currency-text select,
    .bt-currency-text select::picker(select) {
        appearance: base-select;
    }
    select.input-field {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }
    select.input-field::picker-icon,
    .bt-currency-text select::picker-icon {
        content: "";
        width: 16px;
        height: 16px;
        flex: 0 0 auto;
        background: var(--primary);
        -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
                mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
        transition: rotate .22s var(--ease);
    }
    .bt-currency-text select { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
    select.input-field:open::picker-icon,
    .bt-currency-text select:open::picker-icon { rotate: 180deg; }

    select.input-field::picker(select),
    .bt-currency-text select::picker(select) {
        border: 0;
        padding: 8px;
        margin-top: 8px;
        border-radius: 20px;
        background: var(--surface);
        color: var(--text);
        box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .45), 0 0 0 1px color-mix(in srgb, var(--primary) 14%, transparent);
        max-height: min(320px, 60vh);
        overflow-y: auto;
    }
    select.input-field option,
    .bt-currency-text select option {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 14px;
        border-radius: 14px;
        font-size: .95rem;
        font-weight: 600;
        color: var(--text);
        background: transparent;
        cursor: pointer;
    }
    select.input-field option:hover,
    select.input-field option:focus-visible,
    .bt-currency-text select option:hover,
    .bt-currency-text select option:focus-visible {
        background: var(--primary-bg);
        color: var(--primary);
        outline: none;
    }
    select.input-field option:checked,
    .bt-currency-text select option:checked {
        background: var(--primary-bg);
        color: var(--primary);
    }
    select.input-field option::checkmark,
    .bt-currency-text select option::checkmark {
        order: 2;
        margin-left: auto;
        color: var(--primary);
        font-weight: 800;
    }
    select.input-field::picker(select) {
        opacity: 0;
        transform: translateY(-6px) scale(.98);
        transition: opacity .18s var(--ease), transform .18s var(--ease), overlay .18s allow-discrete, display .18s allow-discrete;
    }
    select.input-field::picker(select):popover-open { opacity: 1; transform: none; }
    @starting-style {
        select.input-field::picker(select):popover-open { opacity: 0; transform: translateY(-6px) scale(.98); }
    }
}

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ---------- Loader / session banner ---------- */
.loader {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 4px solid var(--primary-bg);
    border-top-color: var(--primary);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#sessionWarning {
    background: var(--primary-strong) !important;
    border-radius: var(--radius-md);
    max-width: calc(100vw - 24px);
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .45) !important;
}

/* ---------- Tables ---------- */
.table-container {
    overflow: auto !important;
    max-height: 420px !important;
    min-height: 0;
    border: 0;
    border-radius: var(--radius-lg);
    background: var(--surface-2);
    scrollbar-gutter: stable;
    position: relative;
}
.table-container table {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .875rem;
}
.table-container thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 14px 16px;
    text-align: left;
    font-size: .78rem;
    font-weight: 800;
    text-transform: none;
    letter-spacing: .2px;
    color: var(--muted);
    background: var(--surface-3);
    border: 0;
    white-space: nowrap;
}
.table-container tbody tr { border: 0 !important; }
.table-container tbody td {
    padding: 14px 16px !important;
    font-size: .85rem;
    border: 0;
    vertical-align: middle;
}
.table-container tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.table-container tbody tr:hover td { background: var(--primary-bg); }
.table-container tbody tr td:first-child { border-radius: 12px 0 0 12px; }
.table-container tbody tr td:last-child { border-radius: 0 12px 12px 0; }
.table-container button[onclick^="deleteLoan"] {
    width: 34px; height: 34px;
    border-radius: 10px;
    background: var(--danger-bg);
}
.table-container button[onclick^="deleteLoan"]:hover { background: var(--danger); }
#transactionCount {
    background: var(--primary-bg) !important;
    color: var(--primary) !important;
    font-weight: 700;
}

/* =====================================================================
   LAYOUT SHELL
   ===================================================================== */
#appContainer { background: var(--page-bg) !important; min-height: 100dvh; }
main { padding-bottom: 32px; }
main > .profile-header-card,
main > section { max-width: 1120px; margin-left: auto; margin-right: auto; }
section.space-y-4 > .card,
section.space-y-6 > .card { width: 100%; }

/* Sidebar */
aside {
    background: var(--surface) !important;
    border: 0 !important;
    box-shadow: 1px 0 0 transparent, var(--shadow-soft);
    z-index: 5;
}
@media (min-width: 768px) {
    aside { position: sticky; top: 0; height: 100dvh; overflow-y: auto; flex-shrink: 0; }
}
.brand-mark {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    display: block;
    border-radius: 13px;
    box-shadow: 0 12px 24px -10px rgba(15, 180, 137, .7);
}
.auth-brand .brand-mark { width: 52px; height: 52px; border-radius: 16px; box-shadow: 0 14px 28px -12px rgba(0, 0, 0, .45); }
aside .tracking-wider { color: var(--text) !important; letter-spacing: -.2px; font-weight: 800; }

.sidebar-btn {
    border: 0 !important;
    border-radius: 16px !important;
    color: var(--muted) !important;
    background: transparent !important;
    font-weight: 600;
    position: relative;
}
.sidebar-btn i { color: var(--muted) !important; width: 20px; text-align: center; }
.sidebar-btn:hover:not(.active) { background: var(--surface-2) !important; color: var(--text) !important; }
.sidebar-btn:hover:not(.active) i { color: var(--primary) !important; }
.sidebar-btn.active {
    background: var(--primary-bg) !important;
    color: var(--primary) !important;
    font-weight: 800;
}
.sidebar-btn.active i { color: var(--primary) !important; }
.sidebar-btn.active::before {
    content: "";
    position: absolute;
    left: -24px;
    top: 50%;
    width: 5px;
    height: 24px;
    transform: translateY(-50%);
    border-radius: 0 6px 6px 0;
    background: var(--brand);
}
aside button[onclick="confirmLogout()"] {
    border: 0 !important;
    background: var(--danger-bg);
    color: var(--danger) !important;
    min-height: 42px;
    font-weight: 700;
    font-size: .8rem;
}
aside button[onclick="confirmLogout()"]:hover { background: var(--danger); color: #fff !important; }
#liveClock { color: var(--primary) !important; }

/* ---------- Header / profile card ---------- */
.profile-header-card.home-header {
    position: relative;
    overflow: visible;
    min-height: 0;
    background: var(--surface);
    border: 0;
    border-radius: var(--radius-xl);
    padding: 16px 20px !important;
    box-shadow: var(--shadow);
}
.home-avatar {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: #fff;
    font-size: 1.4rem;
    background: linear-gradient(135deg, #0FB489, #066B52);
    box-shadow: 0 10px 22px -10px rgba(15, 180, 137, .8);
}
.home-name {
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -.2px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.home-greeting { font-size: .85rem; color: var(--muted); margin-top: 2px; }
.profile-avatar-slot img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }

.home-round-btn {
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--surface-2);
    color: var(--primary);
    font-size: 1rem;
    cursor: pointer;
    box-shadow: none;
}
.home-round-btn:hover,
#searchToggleBtn:hover,
#headerThemeBtn:hover {
    background: var(--primary-bg-hover) !important;
    color: var(--primary) !important;
    transform: translateY(-1px);
}
.home-round-btn:active { transform: scale(.94); }

/* ---- Modern dark-mode icon (replaces the Font Awesome glyph) ---- */
#headerThemeIcon { font-size: 0; width: 22px; height: 22px; display: block; }
#headerThemeIcon::before {
    content: "" !important;
    display: block;
    width: 22px;
    height: 22px;
    background: currentColor;
    -webkit-mask: var(--theme-icon) center / contain no-repeat;
            mask: var(--theme-icon) center / contain no-repeat;
}
#headerThemeIcon.fa-sun {
    --theme-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41'/%3E%3C/svg%3E");
}
#headerThemeIcon.fa-moon {
    --theme-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z'/%3E%3C/svg%3E");
}
#headerThemeIcon.fa-sun::before { animation: themeSun .5s var(--ease); }
#headerThemeIcon.fa-moon::before { animation: themeMoon .5s var(--ease); }
@keyframes themeSun  { from { transform: rotate(-90deg) scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes themeMoon { from { transform: rotate(90deg) scale(.4);  opacity: 0; } to { transform: none; opacity: 1; } }

/* Settings theme switch — knob carries a moon / sun */
.toggle-switch {
    width: 64px;
    height: 34px;
    border: 0;
    border-radius: 34px;
    background: var(--surface-3);
    position: relative;
    cursor: pointer;
    flex: 0 0 auto;
}
.toggle-switch.active { background: linear-gradient(135deg, #12263f, #0b3a33); border: 0; }
.toggle-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    display: grid;
    place-items: center;
    color: #f59e0b;
    box-shadow: 0 4px 10px -2px rgba(0, 0, 0, .35);
}
.toggle-switch.active .toggle-knob { left: 33px; background: #0d1a2c; color: var(--primary); }
.toggle-knob::before {
    content: "";
    width: 16px;
    height: 16px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41'/%3E%3C/svg%3E") center / contain no-repeat;
}
.toggle-switch.active .toggle-knob::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z'/%3E%3C/svg%3E");
            mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z'/%3E%3C/svg%3E");
}
/* theme row inside settings: tonal, no border */
#view-settings .rounded-2xl.border {
    border: 0 !important;
    background: var(--surface-2) !important;
    border-radius: var(--radius-lg) !important;
}

/* Search field inside header */
.profile-search { margin-top: 14px; }

/* ---------- Balance card — the one hero ---------- */
.balance-total-card {
    position: relative;
    overflow: hidden;
    border: 0;
    border-radius: 32px;
    padding: 24px 26px 26px;
    color: #fff;
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(94, 234, 212, .38) 0%, transparent 52%),
        radial-gradient(90% 120% at 0% 100%, rgba(3, 60, 46, .55) 0%, transparent 60%),
        linear-gradient(135deg, #0DA37D 0%, #087A5D 55%, #066B52 100%);
    box-shadow: 0 28px 50px -24px rgba(8, 122, 93, .85);
}
.balance-total-card::before,
.balance-total-card::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    background: rgba(255, 255, 255, .08);
}
.balance-total-card::before { width: 220px; height: 220px; right: -60px; top: -90px; }
.balance-total-card::after  { width: 150px; height: 150px; right: 70px; bottom: -80px; background: rgba(255, 255, 255, .06); }
.balance-total-card > * { position: relative; z-index: 1; }
.bt-top, .bt-bottom { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.bt-title-wrap { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bt-wallet-icon, .balance-total-eye {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 0;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    cursor: pointer;
}
.bt-wallet-icon { width: 46px; height: 46px; border-radius: 16px; font-size: 1.15rem; cursor: default; }
.balance-total-eye { width: 44px; height: 44px; border-radius: 16px; font-size: 1rem; }
.balance-total-eye:hover { background: rgba(255, 255, 255, .3); }
.bt-title { font-size: 1rem; font-weight: 700; color: rgba(255, 255, 255, .92); }
.bt-bottom { margin-top: 22px; align-items: flex-end; flex-wrap: wrap; }
.bt-amount {
    flex: 1 1 auto;
    min-width: 0;
    font-size: clamp(2.1rem, 6vw, 3.1rem);
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.05;
    color: #fff;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.bt-amount.is-long  { font-size: clamp(1.7rem, 5vw, 2.4rem); }
.bt-amount.is-xlong { font-size: clamp(1.3rem, 4vw, 1.9rem); }
.bt-currency {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    min-width: 142px;
    padding: 9px 14px 9px 12px;
    border: 0;
    border-radius: 18px;
    background: rgba(255, 255, 255, .16);
    backdrop-filter: blur(6px);
    cursor: pointer;
    box-shadow: none;
}
.bt-currency:hover { background: rgba(255, 255, 255, .24); }
.bt-currency-icon { font-size: 1.2rem; color: #fff; flex: 0 0 auto; }
.bt-currency-text { display: flex; flex-direction: column; line-height: 1.15; flex: 1; min-width: 0; }
.bt-currency-text small { font-size: .7rem; color: rgba(255, 255, 255, .75); font-weight: 600; }
.bt-currency-text select {
    background: transparent;
    border: 0;
    outline: none;
    padding: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: #fff;
    width: 100%;
}
.bt-currency-text select option { color: var(--text); background: var(--surface); }
.bt-currency-text select::picker-icon { background: #fff; }
.bt-currency-chevron { font-size: .8rem; color: #fff; pointer-events: none; }
@supports (appearance: base-select) { .bt-currency-chevron { display: none; } }

/* ---------- Wallet tiles ---------- */
.wallet-panel {
    background: var(--surface);
    border: 0;
    border-radius: var(--radius-xl);
    padding: 26px 18px 22px;
    box-shadow: var(--shadow);
}
.wallet-icon-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px 10px;
}
@media (min-width: 640px)  { .wallet-icon-grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 900px)  { .wallet-icon-grid { grid-template-columns: repeat(6, 1fr); } }
.wallet-icon-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}
.wallet-icon-box {
    width: 100%;
    max-width: 72px;
    aspect-ratio: 1 / 1;
    border: 0;
    border-radius: 22px;
    background: var(--surface-2);
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 11px;
    box-shadow: none;
}
body.theme-light .wallet-icon-box { background: #f1f7f4; }
.wallet-icon-tile:hover .wallet-icon-box { transform: translateY(-3px); background: var(--primary-bg); box-shadow: var(--shadow-soft); }
.wallet-icon-tile:active .wallet-icon-box { transform: scale(.95); }
.wallet-icon-box img { width: 100%; height: 100%; object-fit: contain; }
.wallet-icon-box.is-soon { border: 0; background: var(--primary-bg); box-shadow: none; cursor: default; }
.wallet-icon-box.is-soon i { color: var(--primary) !important; }
.wallet-icon-tile.is-soon { cursor: default; }
.wallet-icon-tile.is-soon:hover .wallet-icon-box { transform: none; box-shadow: none; background: var(--primary-bg); }
.wallet-icon-box.is-demo { border: 0; background: rgba(245, 158, 11, .12); }
.wallet-icon-tile.is-demo .wallet-icon-label { color: #d97706; }
.wallet-icon-label {
    font-size: .78rem;
    font-weight: 700;
    color: var(--text-2);
    text-align: center;
    line-height: 1.2;
}

/* ---------- Mobile bottom navigation ---------- */
.mobile-nav-bar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 40;
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 2px;
    padding: 8px;
    border: 0;
    border-radius: 28px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    box-shadow: 0 22px 44px -14px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .08);
}
@media (min-width: 768px) { .mobile-nav-bar { display: none; } }
.mobile-nav-bar .mobile-nav-btn {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    padding: 9px 4px 8px;
    border: 0;
    border-radius: 20px;
    color: var(--muted) !important;
    background: transparent;
    font-weight: 600;
}
.mobile-nav-bar .mobile-nav-btn span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-nav-bar .mobile-nav-btn.active {
    color: var(--primary) !important;
    background: var(--primary-bg);
    font-weight: 800;
}
.mobile-nav-bar .mobile-nav-btn.active::after { display: none; }
@media (max-width: 767px) {
    main { padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- Modals ---------- */
.wallet-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(5, 10, 20, .62);
    backdrop-filter: blur(8px);
}
.wallet-modal-overlay.hidden { display: none; }
.wallet-modal {
    position: relative;
    width: 100%;
    max-width: 360px;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    border: 0;
    border-radius: 32px;
    background: var(--surface);
    padding: 30px 24px 24px;
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6);
    animation: walletModalPop .26s var(--ease);
}
@keyframes walletModalPop { from { transform: translateY(14px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.wallet-modal-close {
    position: absolute;
    top: 14px; right: 14px;
    width: 36px; height: 36px;
    border: 0;
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--muted);
    display: grid;
    place-items: center;
    cursor: pointer;
}
.wallet-modal-close:hover { background: var(--danger-bg); color: var(--danger); }

.pin-modal { text-align: center; }
.pin-modal-icon, .wallet-detail-icon {
    border: 0;
    background: var(--surface-2);
    display: grid;
    place-items: center;
    overflow: hidden;
}
.pin-modal-icon { width: 68px; height: 68px; border-radius: 22px; margin: 0 auto 14px; }
.pin-modal-icon img, .wallet-detail-icon img { width: 100%; height: 100%; object-fit: contain; padding: 9px; }
.pin-modal-title { font-size: 1.1rem; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.pin-modal-subtitle { font-size: .82rem; color: var(--muted); margin-bottom: 20px; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin-bottom: 12px; }
.pin-dots span {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 0;
    background: var(--surface-3);
    transition: background-color .15s, transform .15s var(--ease);
}
.pin-dots span.filled { background: var(--primary); transform: scale(1.15); }
.pin-error { color: var(--danger); font-size: .8rem; font-weight: 700; margin-bottom: 8px; min-height: 16px; }
.pin-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.pin-keypad button {
    aspect-ratio: 1 / 1;
    border: 0;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    display: grid;
    place-items: center;
}
.pin-keypad button:hover { background: var(--primary-bg); color: var(--primary); }
.pin-keypad button:active { transform: scale(.93); background: var(--primary-bg-hover); }
.pin-key-ghost { visibility: hidden; cursor: default !important; background: none !important; border: 0 !important; }

.wallet-detail-modal { max-width: 390px; }
.wallet-detail-header { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; padding-right: 34px; }
.wallet-detail-icon { width: 54px; height: 54px; border-radius: 18px; flex: 0 0 auto; }
.wallet-detail-title { font-size: 1.1rem; font-weight: 800; color: var(--text); }
.wallet-detail-subtitle { font-size: .78rem; color: var(--muted); }
.wallet-detail-eye {
    margin-left: auto;
    width: 40px; height: 40px;
    border: 0;
    border-radius: 14px;
    background: var(--primary-bg);
    color: var(--primary);
    display: grid;
    place-items: center;
    cursor: pointer;
    flex: 0 0 auto;
}
.wallet-detail-eye:hover { background: var(--primary); color: #fff; }
.wallet-detail-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.wallet-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: var(--surface-2);
    border-radius: 18px;
    padding: 14px 16px;
}
.wallet-detail-row .wdr-label { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: none; letter-spacing: 0; }
.wallet-detail-row .wdr-value {
    font-family: inherit;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.wallet-detail-demo-note {
    font-size: .74rem;
    color: #b45309;
    background: rgba(245, 158, 11, .12);
    border: 0;
    border-radius: 14px;
    padding: 10px 12px;
    margin-bottom: 16px;
}
.wallet-detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* =====================================================================
   LOGIN — redesigned
   ===================================================================== */
.auth {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr;
    background: var(--page-bg);
}
.auth.hidden { display: none; }

.auth-brand {
    position: relative;
    overflow: hidden;
    color: #fff;
    padding: calc(34px + env(safe-area-inset-top, 0px)) 24px 86px;
    border-radius: 0 0 40px 40px;
    background:
        radial-gradient(90% 90% at 100% 0%, rgba(94, 234, 212, .40), transparent 55%),
        radial-gradient(80% 80% at 0% 100%, rgba(3, 50, 39, .6), transparent 60%),
        linear-gradient(145deg, #0DA37D 0%, #087A5D 55%, #055140 100%);
}
.auth-brand::before, .auth-brand::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .07);
    pointer-events: none;
}
.auth-brand::before { width: 320px; height: 320px; right: -110px; top: -120px; }
.auth-brand::after  { width: 220px; height: 220px; left: -80px; bottom: -110px; }
.auth-brand > * { position: relative; z-index: 1; }
.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -.3px;
}
.auth-logo-mark {
    width: 48px; height: 48px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: rgba(255, 255, 255, .18);
    font-size: 1.3rem;
    backdrop-filter: blur(4px);
}
.auth-tagline { margin: 16px 0 0; font-size: 1.05rem; font-weight: 600; max-width: 30ch; line-height: 1.4; color: rgba(255, 255, 255, .92); }
.auth-points { display: none; list-style: none; margin: 34px 0 0; padding: 0; gap: 18px; }
.auth-points li { display: flex; align-items: center; gap: 14px; font-weight: 600; font-size: .98rem; color: rgba(255, 255, 255, .94); }
.auth-points li i {
    width: 42px; height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 14px;
    background: rgba(255, 255, 255, .16);
    font-size: 1rem;
}

.auth-panel { display: grid; place-items: start center; padding: 0 16px 32px; }
.auth-card {
    width: 100%;
    max-width: 440px;
    margin-top: -56px;
    position: relative;
    z-index: 2;
    background: var(--surface);
    border-radius: 32px;
    padding: 28px 22px 24px;
    box-shadow: var(--shadow);
}
.auth-title { margin: 0; font-size: 1.6rem; font-weight: 800; letter-spacing: -.5px; color: var(--text); line-height: 1.15; }
.auth-sub { margin: 8px 0 0; font-size: .92rem; color: var(--muted); line-height: 1.45; }
.auth-form { margin-top: 26px; display: grid; gap: 18px; }
.auth-field label { display: block; margin-bottom: 8px; font-size: .82rem; font-weight: 700; color: var(--text-2); }
.auth-field .field-wrap { position: relative; }
.auth-field .field-wrap > i.lead {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: .95rem;
    pointer-events: none;
}
.auth-field .field-wrap:focus-within > i.lead { color: var(--primary); }
.auth-field .input-field { padding-left: 46px; min-height: 54px; }
.auth-field .input-field.has-trail { padding-right: 52px; }
.auth-field .trail {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px; height: 40px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    z-index: 2;
}
.auth-field .trail:hover { background: var(--primary-bg); color: var(--primary); }
.auth-submit { width: 100%; min-height: 54px; font-size: 1rem; margin-top: 4px; }
.auth-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--danger-bg);
    color: var(--danger);
    font-size: .88rem;
    font-weight: 700;
    text-align: center;
}
.auth-error.hidden { display: none; }
.auth-foot { margin-top: 24px; text-align: center; display: grid; gap: 6px; }
.auth-foot p { margin: 0; }
.auth-foot p:first-child { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: .88rem; font-weight: 800; color: var(--primary); }
.auth-foot p:last-child { font-size: .78rem; color: var(--muted); }

@media (min-width: 900px) {
    .auth { grid-template-columns: minmax(380px, 46%) 1fr; }
    .auth-brand {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: 48px 56px;
        border-radius: 0 44px 44px 0;
    }
    .auth-tagline { font-size: 2rem; font-weight: 800; letter-spacing: -.8px; line-height: 1.15; max-width: 14ch; margin-top: 0; }
    .auth-points { display: grid; margin-top: 0; }
    .auth-panel { place-items: center; padding: 40px; }
    .auth-card { margin-top: 0; padding: 40px 38px 32px; box-shadow: none; background: transparent; }
    .auth-title { font-size: 2rem; }
}
@media (min-width: 900px) and (max-height: 640px) {
    .auth-brand { padding: 32px 48px; }
    .auth-points { gap: 12px; }
}

/* =====================================================================
   RESPONSIVE REFINEMENTS
   ===================================================================== */
@media (max-width: 767px) {
    main { padding: 14px 14px calc(110px + env(safe-area-inset-bottom, 0px)) !important; }
    .card { padding: 20px; border-radius: 26px; }
    .profile-header-card.home-header { padding: 14px 14px !important; border-radius: 26px; }
    .home-avatar { width: 50px; height: 50px; border-radius: 16px; }
    .home-name { font-size: 1.08rem; }
    .balance-total-card { padding: 20px 20px 22px; border-radius: 28px; }
    .bt-bottom { margin-top: 18px; }
    .bt-currency { min-width: 0; width: 100%; }
    .wallet-panel { padding: 22px 10px 18px; border-radius: 26px; }
    section > h2 { font-size: 1.25rem; }
    section > h2 > i { width: 40px; height: 40px; border-radius: 13px; }
    /* 16px inputs stop iOS from zooming on focus */
    .input-field, .auth-field .input-field { font-size: 16px; }
    .table-container { max-height: 360px !important; border-radius: 18px; }
    #sessionWarning { left: 12px !important; right: 12px; transform: none !important; font-size: .78rem; padding: 12px 14px; }
    .wallet-modal { border-radius: 28px; }
}
@media (max-width: 380px) {
    .wallet-icon-grid { gap: 18px 6px; }
    .wallet-icon-label { font-size: .7rem; }
    .btn-primary, .btn-outline, .btn-danger { padding: 12px 16px; font-size: .9rem; }
    .auth-card { padding: 24px 18px 20px; }
}
@media (min-width: 768px) and (max-width: 1023px) {
    main { padding: 24px !important; }
    aside { width: 224px; }
}
@media (min-width: 1024px) {
    main { padding: 32px 40px !important; }
}
@media (min-width: 1440px) {
    main > .profile-header-card, main > section { max-width: 1240px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
