/* =========================================================
   My Budget — Design System (Ashraf Systems)
   Modern purple theme · RTL ready · Mobile first
   ========================================================= */

:root {
    --primary: #6d4aff;
    --primary-2: #a855f7;
    --primary-dark: #5532e6;
    --primary-soft: #f1ecff;
    --primary-softer: #f8f6ff;
    --primary-soft-hover: #e7dfff;
    --primary-border: #c9bbff;
    --primary-rgb: 109,74,255;
    --shadow-rgb: 76,52,170;
    --accent: #c084fc;
    --track: #eee9fb;
    --line: #f2eff9;
    --input-bg: #fcfbff;
    --side-text: #d6cff0;
    --side-muted: #a99fd0;
    --grad: linear-gradient(135deg, #6d4aff 0%, #8b5cf6 50%, var(--accent) 100%);
    --grad-dark: linear-gradient(160deg, #1e1638 0%, #2a1d57 60%, #3b2780 100%);

    --bg: #f5f3fb;
    --surface: #ffffff;
    --text: #1d1933;
    --muted: #8a84a3;
    --border: #ece8f6;

    --green: #12b981;
    --green-soft: #e7f8f1;
    --red: #f0436b;
    --red-soft: #fff0f3;
    --amber: #f59e0b;
    --amber-soft: #fff7e6;
    --blue: #3b82f6;
    --blue-soft: #eaf2ff;

    --radius: 20px;
    --radius-sm: 13px;
    --shadow: 0 1px 2px rgba(29,25,51,.04), 0 8px 28px rgba(var(--shadow-rgb),.07);
    --shadow-lg: 0 20px 50px rgba(var(--shadow-rgb),.18);

    --sidebar: 264px;
    --font: 'Inter', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
}

[dir="rtl"] {
    --font: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.ic { flex-shrink: 0; vertical-align: middle; }
[dir="rtl"] .flip { transform: scaleX(-1); }

/* ---------- App shell ---------- */

.app { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: var(--sidebar);
    background: var(--grad-dark);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 26px 18px;
    z-index: 40;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 26px;
}

.brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: var(--grad);
    display: grid;
    place-items: center;
    box-shadow: 0 8px 20px rgba(var(--primary-rgb),.45);
}

.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -.2px; }
.brand-tag { font-size: 11.5px; color: var(--side-muted); }

.nav { display: flex; flex-direction: column; gap: 4px; }

.nav-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--side-muted);
    padding: 16px 12px 6px;
}
[dir="rtl"] .nav-label { letter-spacing: 0; }

.nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 12px;
    color: var(--side-text);
    font-weight: 600;
    font-size: 14px;
    transition: background .2s, color .2s;
}

.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }

.nav a.active {
    background: rgba(255,255,255,.12);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--accent);
}
[dir="rtl"] .nav a.active { box-shadow: inset -3px 0 0 var(--accent); }

.sidebar-footer {
    margin-top: auto;
    padding: 14px;
    border-radius: 16px;
    background: rgba(255,255,255,.06);
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--grad);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    flex-shrink: 0;
}

.sidebar-user { min-width: 0; flex: 1; }
.sidebar-user strong { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user span { font-size: 11.5px; color: var(--side-muted); }

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    border: 0;
    background: rgba(255,255,255,.08);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
}
.icon-btn:hover { background: rgba(255,255,255,.16); }

.main {
    margin-inline-start: var(--sidebar);
    min-height: 100vh;
    padding: 26px 34px 40px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 26px;
}

.page-title h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.4px; }
.page-title p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.mobile-brand { display: none; }

/* Language switcher */
.lang-switch {
    display: inline-flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px;
    gap: 2px;
    box-shadow: var(--shadow);
}

.lang-switch a {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--muted);
}

.lang-switch a.active { background: var(--grad); color: #fff; }

/* ---------- Cards & grid ---------- */

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.mb { margin-bottom: 18px; }
.mb-lg { margin-bottom: 26px; }

.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(236,232,246,.7);
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 800;
    margin: 0;
}

.card-title .ic { color: var(--primary); }

.link-more {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--primary);
    font-weight: 700;
    font-size: 13px;
}

/* Stat cards */
.stat { position: relative; overflow: hidden; }

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    margin-bottom: 14px;
}

.stat-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -.5px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value small { font-size: 13px; font-weight: 700; color: var(--muted); margin-inline-start: 4px; }
.stat-sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.tone-purple { background: var(--primary-soft); color: var(--primary); }
.tone-green { background: var(--green-soft); color: var(--green); }
.tone-red { background: var(--red-soft); color: var(--red); }
.tone-amber { background: var(--amber-soft); color: var(--amber); }
.tone-blue { background: var(--blue-soft); color: var(--blue); }

.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-purple { color: var(--primary); }
.text-amber { color: var(--amber); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.bold { font-weight: 800; }

/* Hero wallet */
.hero {
    background: var(--grad);
    color: #fff;
    border-radius: 24px;
    padding: 26px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 18px 40px rgba(var(--primary-rgb),.28);
}

.hero::before, .hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,.12);
}
.hero::before { width: 260px; height: 260px; inset-inline-end: -80px; top: -110px; }
.hero::after { width: 160px; height: 160px; inset-inline-end: 90px; bottom: -90px; }

.hero > * { position: relative; z-index: 1; }

.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.hero-label { font-size: 13px; opacity: .85; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.hero-name { font-size: 22px; font-weight: 800; margin: 8px 0 2px; overflow-wrap: anywhere; }
.hero-meta { font-size: 12.5px; opacity: .8; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.hero .chip { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.28); }

.hero-bottom {
    display: flex;
    flex-wrap: wrap;
    gap: 26px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(255,255,255,.22);
}

.hero-stat span { display: block; font-size: 12px; opacity: .8; }
.hero-stat strong { font-size: 19px; font-weight: 800; }

/* Progress */
.progress {
    height: 10px;
    border-radius: 999px;
    background: var(--track);
    overflow: hidden;
    margin: 14px 0 8px;
}

.progress > div {
    height: 100%;
    border-radius: 999px;
    background: var(--grad);
    transition: width .4s ease;
}

.progress > div.over { background: linear-gradient(90deg, #f0436b, #fb7185); }
.progress > div.warn { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.progress-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--muted); }

/* Alerts */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 15px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 16px;
}
.alert div { flex: 1; }
.alert-danger { background: var(--red-soft); color: #b4234a; }
.alert-warning { background: var(--amber-soft); color: #9a5b00; }
.alert-info { background: var(--blue-soft); color: #1e55b3; }
.alert-success { background: var(--green-soft); color: #0b7a55; }

/* Action tiles */
.action {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border-radius: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s, border-color .2s;
}

.action:hover { transform: translateY(-3px); border-color: var(--primary-border); box-shadow: var(--shadow-lg); }

.action-icon {
    width: 48px;
    height: 48px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.action-title { font-weight: 800; font-size: 14.5px; }
.action-desc { font-size: 12.5px; color: var(--muted); }
.action .chev { margin-inline-start: auto; color: var(--primary-border); }

/* Rows / lists */
.row-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}
.row-item:last-child { border-bottom: 0; }

.row-icon {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.row-main { flex: 1; min-width: 0; }
.row-main strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-main span { font-size: 12.5px; color: var(--muted); }
.row-end { text-align: end; white-space: nowrap; }
.row-end strong { display: block; font-weight: 800; }

a.row-item:hover { background: var(--primary-softer); border-radius: 12px; }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed #ece8f6; font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv strong { font-weight: 800; }

.bar-row { margin-bottom: 14px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-row .top { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; margin-bottom: 6px; }
.bar-row .top span { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.bar-row .track { height: 7px; border-radius: 999px; background: var(--track); overflow: hidden; }
.bar-row .track div { height: 100%; border-radius: 999px; background: var(--grad); }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 800;
    white-space: nowrap;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: #c27803; }
.badge-purple { background: var(--primary-soft); color: var(--primary); }
.badge-gray { background: #f1f0f5; color: #6f6a85; }

/* Empty state */
.empty { text-align: center; padding: 34px 14px; color: var(--muted); }
.empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    border-radius: 20px;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid;
    place-items: center;
}
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ---------- Forms ---------- */

.form-card { max-width: 760px; }

.form-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.form-head .stat-icon { margin: 0; }
.form-head h2 { margin: 0; font-size: 20px; font-weight: 800; }
.form-head p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }

.field { margin-bottom: 18px; }

.field label {
    display: block;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 7px;
}
.field label .req { color: var(--red); }

.control {
    width: 100%;
    padding: 13px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    font-family: inherit;
    font-size: 14.5px;
    color: var(--text);
    outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.control:focus { border-color: var(--primary-border); background: #fff; box-shadow: 0 0 0 4px rgba(var(--primary-rgb),.12); }
.control[readonly] { background: var(--track); color: var(--muted); }
textarea.control { min-height: 96px; resize: vertical; }
.control-lg { font-size: 22px; font-weight: 800; }
select.control { appearance: auto; }

.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.field-error { display: block; color: var(--red); font-size: 12.5px; margin-top: 6px; font-weight: 600; }

/* Segmented choice (radio pills) */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 13px 8px;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    background: var(--input-bg);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: .2s;
}
.choice span .ic { color: var(--primary); }
.choice input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); box-shadow: 0 0 0 3px rgba(var(--primary-rgb),.1); }
.choice input:focus-visible + span { outline: 2px solid var(--primary); }

.choice-lg span { flex-direction: row; justify-content: center; padding: 16px; font-size: 14px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    border: 0;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .15s, box-shadow .2s, background .2s;
    white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 22px rgba(var(--primary-rgb),.28); }
.btn-primary:hover { box-shadow: 0 14px 28px rgba(var(--primary-rgb),.38); }
.btn-light { background: var(--primary-soft); color: var(--primary); }
.btn-light:hover { background: var(--primary-soft-hover); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 8px 12px; font-size: 12.5px; border-radius: 10px; }
.btn-block { width: 100%; padding: 15px; font-size: 15px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.toolbar .field { margin: 0; }

/* Tabs */
.tabs { display: inline-flex; background: var(--track); border-radius: 14px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.tabs a { padding: 9px 16px; border-radius: 11px; font-weight: 700; font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.tabs a.active { background: #fff; color: var(--primary); box-shadow: 0 2px 8px rgba(var(--shadow-rgb),.12); }

/* Table */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: start; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
[dir="rtl"] .table th { letter-spacing: 0; }
.table td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }

/* ---------- Mobile bottom nav ---------- */

.bottom-nav { display: none; }

/* ---------- Modal (custom confirm / alert) ---------- */

.mb-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20,14,40,.45);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}
.mb-modal-backdrop.show { display: flex; animation: mbFade .18s ease; }

.mb-modal {
    background: #fff;
    border-radius: 22px;
    width: 100%;
    max-width: 400px;
    padding: 26px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: mbPop .22s ease;
}
.mb-modal .stat-icon { margin: 0 auto 14px; width: 56px; height: 56px; border-radius: 18px; }
.mb-modal h3 { margin: 0 0 6px; font-size: 18px; }
.mb-modal p { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.mb-modal-actions { display: flex; gap: 10px; }
.mb-modal-actions .btn { flex: 1; }

/* Toast */
.toast-wrap { position: fixed; top: 20px; inset-inline-end: 20px; z-index: 110; display: flex; flex-direction: column; gap: 10px; }
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #1d1933;
    color: #fff;
    padding: 13px 16px;
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    font-weight: 600;
    font-size: 13.5px;
    animation: mbSlide .3s ease;
}
.toast .ic { color: #34d399; }

@keyframes mbFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mbPop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes mbSlide { from { transform: translateY(-12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.footer { text-align: center; color: #aaa4bf; font-size: 12px; margin-top: 34px; }

/* ---------- Responsive ---------- */

.mobile-logout { display: none !important; background: var(--surface) !important; color: var(--primary) !important; border: 1px solid var(--border) !important; }


@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 900px) {
    .sidebar { display: none; }
    .main { margin: 0; padding: 18px 16px 100px; }
    .mobile-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; }
    .mobile-brand .brand-logo { width: 36px; height: 36px; border-radius: 11px; color: #fff; }
    .topbar { flex-wrap: wrap; }
    .page-title { order: 3; width: 100%; }
    .page-title h1 { font-size: 22px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }

    .bottom-nav {
        display: flex;
        position: fixed;
        inset-inline: 12px;
        bottom: 12px;
        background: rgba(255,255,255,.96);
        backdrop-filter: blur(10px);
        border-radius: 22px;
        box-shadow: 0 10px 34px rgba(var(--shadow-rgb),.18);
        padding: 8px 6px;
        z-index: 50;
        justify-content: space-around;
        align-items: center;
    }
    .bottom-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        font-size: 10.5px;
        font-weight: 700;
        color: var(--muted);
        padding: 6px 8px;
        border-radius: 12px;
        min-width: 56px;
    }
    .bottom-nav a.active { color: var(--primary); }
    .bottom-nav a.fab {
        width: 54px;
        height: 54px;
        min-width: 54px;
        border-radius: 18px;
        background: var(--grad);
        color: #fff;
        justify-content: center;
        margin-top: -28px;
        box-shadow: 0 12px 24px rgba(var(--primary-rgb),.4);
    }
    .mobile-logout { display: inline-grid !important; }
}

@media (max-width: 560px) {
    .grid-4 { grid-template-columns: 1fr 1fr; gap: 12px; }
    .card { padding: 18px; border-radius: 18px; }
    .stat-value { font-size: 20px; }
    .stat-icon { width: 40px; height: 40px; border-radius: 12px; margin-bottom: 10px; }
    .hero { padding: 22px; }
    .lang-switch a { padding: 5px 9px; }
    .form-head h2 { font-size: 18px; }
}


/* =========================================================
   THEMES — saved per user (dbo.Users.Gender)
   Male = Dark Blue · Female = Pink
   ========================================================= */

.theme-male {
    --primary: #1e40af;
    --primary-2: #2563eb;
    --primary-dark: #172f80;
    --primary-soft: #e6edfc;
    --primary-softer: #f3f6fd;
    --primary-soft-hover: #d6e2fa;
    --primary-border: #a9c1f5;
    --primary-rgb: 30,64,175;
    --shadow-rgb: 15,37,87;
    --accent: #60a5fa;
    --grad: linear-gradient(135deg, #0b1f4d 0%, #1e3a8a 45%, #2563eb 100%);
    --grad-dark: linear-gradient(160deg, #050d22 0%, #0a1a3f 55%, #10275c 100%);
    --bg: #eef2f9;
    --text: #0f1b33;
    --muted: #6b7a96;
    --border: #e0e7f3;
    --track: #e3e9f6;
    --line: #edf1f8;
    --input-bg: #f8faff;
    --side-text: #c8d5ef;
    --side-muted: #8fa3cc;
}

.theme-female {
    --primary: #db2777;
    --primary-2: #ec4899;
    --primary-dark: #be185d;
    --primary-soft: #fde7f1;
    --primary-softer: #fff5fa;
    --primary-soft-hover: #fbd3e6;
    --primary-border: #f6a9cb;
    --primary-rgb: 219,39,119;
    --shadow-rgb: 157,23,77;
    --accent: #f9a8d4;
    --grad: linear-gradient(135deg, #db2777 0%, #ec4899 50%, #f472b6 100%);
    --grad-dark: linear-gradient(160deg, #3b0a24 0%, #5e1038 55%, #831843 100%);
    --bg: #fdf3f8;
    --text: #331326;
    --muted: #9a7189;
    --border: #f6e1ec;
    --track: #fbe4ef;
    --line: #fbeef5;
    --input-bg: #fffafc;
    --side-text: #f6d3e4;
    --side-muted: #d29bb8;
}

/* Theme picker in the sidebar */
.theme-picker { display: flex; gap: 6px; margin: 14px 0 0; }
.theme-picker form { flex: 1; margin: 0; }
.theme-picker button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    border-radius: 11px;
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(255,255,255,.06);
    color: var(--side-text);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.theme-picker button.on { background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.35); }
.swatch { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.swatch-blue { background: linear-gradient(135deg, #0b1f4d, #2563eb); }
.swatch-pink { background: linear-gradient(135deg, #db2777, #f472b6); }

/* =========================================================
   AUTH PAGES (Login / Register)
   ========================================================= */

.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
}

.auth-side {
    background: var(--grad-dark);
    color: #fff;
    padding: 48px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}
.auth-side::before, .auth-side::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: var(--grad);
    opacity: .35;
    filter: blur(10px);
}
.auth-side::before { width: 380px; height: 380px; inset-inline-end: -140px; top: -120px; }
.auth-side::after { width: 260px; height: 260px; inset-inline-start: -90px; bottom: -80px; }
.auth-side > * { position: relative; z-index: 1; }

.auth-side .brand { padding: 0; }
.auth-hero { margin: auto 0; max-width: 440px; }
.auth-hero h2 { font-size: 36px; line-height: 1.2; margin: 0 0 14px; font-weight: 800; letter-spacing: -.6px; }
.auth-hero p { color: var(--side-text); font-size: 15.5px; margin: 0 0 28px; }

.feature { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-weight: 600; color: var(--side-text); }
.feature .fi { width: 38px; height: 38px; border-radius: 12px; background: rgba(255,255,255,.1); display: grid; place-items: center; color: #fff; }

.auth-main {
    display: flex;
    flex-direction: column;
    padding: 28px 32px;
}
.auth-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth-top .mobile-brand { display: none; }

.auth-card {
    width: 100%;
    max-width: 520px;
    margin: auto;
    background: var(--surface);
    border-radius: 26px;
    padding: 34px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}
.auth-card h1 { margin: 0 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -.4px; }
.auth-card .lead { margin: 0 0 24px; color: var(--muted); }
.auth-switch { text-align: center; margin-top: 20px; color: var(--muted); font-size: 14px; }
.auth-switch a { color: var(--primary); font-weight: 800; }

/* Gender cards on Register */
.gender-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gender input { position: absolute; opacity: 0; pointer-events: none; }
.gender span {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 10px;
    border-radius: 18px;
    border: 2px solid var(--border);
    background: var(--input-bg);
    cursor: pointer;
    text-align: center;
    font-weight: 800;
    transition: .2s;
}
.gender .g-circle { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; color: #fff; }
.gender .g-male .g-circle { background: linear-gradient(135deg, #0b1f4d, #2563eb); }
.gender .g-female .g-circle { background: linear-gradient(135deg, #db2777, #f472b6); }
.gender small { font-weight: 600; color: var(--muted); font-size: 11.5px; }
.gender input:checked + .g-male { border-color: #1e40af; background: #e6edfc; box-shadow: 0 0 0 4px rgba(30,64,175,.12); }
.gender input:checked + .g-female { border-color: #db2777; background: #fde7f1; box-shadow: 0 0 0 4px rgba(219,39,119,.12); }

/* Phone row */
.phone-row { display: flex; gap: 8px; direction: ltr; }
.dial {
    flex-shrink: 0;
    min-width: 78px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    background: var(--primary-softer);
    font-weight: 800;
    color: var(--primary);
}
.dial img { width: 22px; height: 15px; border-radius: 3px; object-fit: cover; }

.pin-wrap { position: relative; }
.pin-wrap .control { padding-inline-end: 64px; letter-spacing: 3px; }
.pin-toggle {
    position: absolute;
    inset-inline-end: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 9px;
    padding: 6px 10px;
    font-family: inherit;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
}

.check { display: flex; align-items: center; gap: 9px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

/* =========================================================
   COUNTRY PICKER (flag dropdown with search)
   ========================================================= */

.cp { position: relative; }
.cp select.cp-native { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.cp-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    font-family: inherit;
    font-size: 14.5px;
    color: var(--text);
    cursor: pointer;
    text-align: start;
}
.cp-btn:focus, .cp.open .cp-btn { border-color: var(--primary-border); box-shadow: 0 0 0 4px rgba(var(--primary-rgb),.12); outline: none; }
.cp-btn .cp-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.cp-btn .cp-dial { color: var(--muted); font-weight: 700; direction: ltr; }
.cp-flag { width: 26px; height: 18px; border-radius: 4px; object-fit: cover; box-shadow: 0 0 0 1px rgba(0,0,0,.08); flex-shrink: 0; background: var(--track); }

.cp-pop {
    position: absolute;
    inset-inline: 0;
    top: calc(100% + 6px);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    z-index: 60;
    display: none;
    overflow: hidden;
}
.cp.open .cp-pop { display: block; animation: mbPop .15s ease; }
.cp-search { padding: 10px; border-bottom: 1px solid var(--line); }
.cp-search input { width: 100%; padding: 10px 12px; border-radius: 11px; border: 1.5px solid var(--border); font-family: inherit; font-size: 14px; outline: none; background: var(--input-bg); }
.cp-search input:focus { border-color: var(--primary-border); }
.cp-list { max-height: 270px; overflow-y: auto; padding: 6px; margin: 0; list-style: none; }
.cp-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
}
.cp-list li span:first-of-type { flex: 1; }
.cp-list li .cp-dial { color: var(--muted); font-weight: 700; font-size: 12.5px; direction: ltr; }
.cp-list li:hover, .cp-list li.active { background: var(--primary-soft); }
.cp-list li.selected { font-weight: 800; color: var(--primary); }
.cp-empty { padding: 16px; text-align: center; color: var(--muted); font-size: 13px; }

@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; }
    .auth-side { display: none; }
    .auth-main { padding: 16px; }
    .auth-top .mobile-brand { display: flex; }
    .auth-card { padding: 24px 18px; border-radius: 22px; margin-top: 6px; }
    .auth-card h1 { font-size: 22px; }
}

.theme-dot { border: 0; background: transparent; padding: 6px 8px; border-radius: 999px; cursor: pointer; display: grid; place-items: center; }
.theme-dot .swatch { width: 16px; height: 16px; }
.theme-dot.active { background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary); }

/* =========================================================
   BEAUTIFUL THEMED BACKGROUNDS (no plain white)
   ========================================================= */

:root {
    --surface: rgba(255,255,255,.78);
    --page-bg:
        radial-gradient(900px 520px at 100% -5%, rgba(168,85,247,.30), transparent 60%),
        radial-gradient(800px 520px at -10% 105%, rgba(109,74,255,.26), transparent 60%),
        linear-gradient(160deg, #ece6ff 0%, #e2d9ff 55%, #f1e9ff 100%);
}

.theme-male {
    --surface: rgba(255,255,255,.74);
    --page-bg:
        radial-gradient(900px 560px at 105% -10%, rgba(37,99,235,.42), transparent 60%),
        radial-gradient(760px 520px at -12% 108%, rgba(30,58,138,.40), transparent 62%),
        radial-gradient(520px 360px at 55% 45%, rgba(96,165,250,.18), transparent 70%),
        linear-gradient(160deg, #d7e3ff 0%, #c4d4f9 50%, #dbe6ff 100%);
}

.theme-female {
    --surface: rgba(255,255,255,.74);
    --page-bg:
        radial-gradient(900px 560px at 105% -10%, rgba(236,72,153,.38), transparent 60%),
        radial-gradient(760px 520px at -12% 108%, rgba(219,39,119,.30), transparent 62%),
        radial-gradient(520px 360px at 55% 45%, rgba(249,168,212,.30), transparent 70%),
        linear-gradient(160deg, #ffe3ef 0%, #fcd0e4 50%, #ffe8f2 100%);
}

body {
    background: var(--page-bg);
    background-attachment: fixed;
    min-height: 100vh;
}

/* soft sparkle dots pattern */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(rgba(255,255,255,.55) 1.2px, transparent 1.3px);
    background-size: 26px 26px;
    opacity: .45;
    z-index: 0;
}
.main, .auth, .bottom-nav, .sidebar { position: relative; z-index: 1; }
.sidebar { position: fixed; z-index: 40; }
.bottom-nav { position: fixed; }

/* glass cards tinted by the theme */
.card, .action, .lang-switch, .auth-card {
    background: var(--surface);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
    border-color: rgba(255,255,255,.65);
}
.mb-modal, .cp-pop { background: #fff; }

.control, .cp-btn, .choice span { background: rgba(255,255,255,.85); }
.control:focus { background: #fff; }

.auth-main { background: transparent; }

/* =========================================================
   One-time color chooser (old accounts)
   ========================================================= */
.gender-btn {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 10px;
    border-radius: 18px;
    border: 2px solid var(--border);
    background: rgba(255,255,255,.85);
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
}
.gender-btn small { font-weight: 600; color: var(--muted); font-size: 11.5px; }
.gender-btn .g-circle { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; color: #fff; }
.gender-btn.g-male .g-circle { background: linear-gradient(135deg, #0b1f4d, #2563eb); }
.gender-btn.g-female .g-circle { background: linear-gradient(135deg, #db2777, #f472b6); }
.gender-btn.g-male:hover { border-color: #1e40af; }
.gender-btn.g-female:hover { border-color: #db2777; }

/* =========================================================
   FAMILY WALLET + CHAT
   ========================================================= */
.nav-badge {
    margin-inline-start: auto;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: #f43f5e;
    color: #fff;
    font-size: 11.5px;
    font-weight: 800;
    display: inline-grid;
    place-items: center;
}
.dot-badge {
    position: absolute;
    top: 2px;
    inset-inline-end: 8px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #f43f5e;
    color: #fff;
    font-size: 10px;
    font-style: normal;
    font-weight: 800;
    display: grid;
    place-items: center;
}

.family-card {
    display: block;
    padding: 22px;
    border-radius: var(--radius);
    background: var(--grad);
    color: #fff;
    box-shadow: 0 18px 40px rgba(var(--primary-rgb),.28);
    position: relative;
    overflow: hidden;
    transition: transform .2s;
}
.family-card:hover { transform: translateY(-4px); }
.family-card::after { content: ""; position: absolute; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.12); inset-inline-end: -60px; top: -60px; }
.family-card .muted, .family-card .link-more { color: rgba(255,255,255,.85); }
.family-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; position: relative; z-index: 1; }
.family-avatar { width: 52px; height: 52px; border-radius: 16px; background: rgba(255,255,255,.2); display: grid; place-items: center; }
.family-name { font-size: 19px; font-weight: 800; position: relative; z-index: 1; }

.av {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
    font-size: 13px;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255,255,255,.9);
}
.av-lg { width: 42px; height: 42px; font-size: 15px; }
.av-male { background: linear-gradient(135deg, #0b1f4d, #2563eb); }
.av-female { background: linear-gradient(135deg, #db2777, #f472b6); }
.av-default { background: linear-gradient(135deg, #6d4aff, #a855f7); }
.avatar-stack { display: flex; margin-top: 12px; }
.avatar-stack .av { margin-inline-end: -8px; }

.family-layout { align-items: start; }

.chat-card { display: flex; flex-direction: column; height: 640px; position: sticky; top: 16px; }
.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 6px 4px 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
.msg { display: flex; align-items: flex-end; gap: 8px; max-width: 86%; animation: mbSlide .25s ease; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg.theirs { align-self: flex-start; }
.bubble {
    padding: 9px 13px 7px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(var(--shadow-rgb),.08);
    border-end-start-radius: 6px;
    min-width: 70px;
}
.msg.mine .bubble { background: var(--grad); color: #fff; border-end-start-radius: 18px; border-end-end-radius: 6px; }
.bubble .who { font-size: 11.5px; font-weight: 800; color: var(--primary); margin-bottom: 2px; }
.bubble .text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.bubble .time { font-size: 10.5px; opacity: .65; margin-top: 3px; text-align: end; }

.chat-form { border-top: 1px solid var(--line); padding-top: 10px; }
.quick-replies { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.quick-replies button {
    border: 1px solid var(--border);
    background: rgba(255,255,255,.85);
    border-radius: 999px;
    padding: 5px 11px;
    font-family: inherit;
    font-size: 12.5px;
    cursor: pointer;
    color: var(--text);
}
.quick-replies button:hover { border-color: var(--primary-border); color: var(--primary); }
.chat-input { display: flex; gap: 8px; align-items: flex-end; }
.chat-input textarea {
    flex: 1;
    resize: none;
    border: 1.5px solid var(--border);
    border-radius: 16px;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 14.5px;
    outline: none;
    background: rgba(255,255,255,.9);
    max-height: 120px;
}
.chat-input textarea:focus { border-color: var(--primary-border); box-shadow: 0 0 0 4px rgba(var(--primary-rgb),.12); }
.chat-input .btn { width: 48px; height: 48px; padding: 0; border-radius: 16px; }

.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; animation: livePulse 1.6s infinite; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(18,185,129,.6); } 70% { box-shadow: 0 0 0 8px rgba(18,185,129,0); } 100% { box-shadow: 0 0 0 0 rgba(18,185,129,0); } }

@media (max-width: 900px) {
    .chat-card { height: 70vh; position: static; }
}

/* =========================================================
   Step 148 — Goals, Shopping, Bills, Occasions, Allowance,
   Summary, Achievements, Discover
   ========================================================= */

.sidebar .nav { flex: 1; min-height: 0; overflow-y: auto; padding-inline-end: 4px; margin-bottom: 12px; }
.sidebar .nav::-webkit-scrollbar { width: 5px; }
.sidebar .nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 9px; }
.nav a { padding: 9px 12px; }

.wallet-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.wallet-pills a {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 14px; border-radius: 999px;
    background: var(--surface); border: 1px solid rgba(255,255,255,.7);
    font-weight: 700; font-size: 13px; color: var(--muted);
    backdrop-filter: blur(10px);
}
.wallet-pills a.active { background: var(--grad); color: #fff; box-shadow: 0 8px 18px rgba(var(--primary-rgb),.28); }

.mini-form { display: flex; gap: 8px; align-items: center; margin: 0; }
.mini-form .control { padding: 9px 11px; font-size: 13.5px; min-width: 0; flex: 1; }

/* Goals */
.goal-card { text-align: start; }
.goal-done { box-shadow: 0 0 0 3px rgba(18,185,129,.25), var(--shadow); }
.jar-wrap { position: relative; width: 150px; margin: 4px auto 14px; }
.jar { width: 150px; height: 162px; display: block; filter: drop-shadow(0 10px 18px rgba(var(--shadow-rgb),.18)); }
.jar-fill { transition: y .8s ease; }
.jar-pct { position: absolute; inset: 52% 0 auto; text-align: center; font-weight: 800; font-size: 22px; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.25); }
.icon-pick { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.icon-pick .choice span { padding: 9px 0; }

/* Shopping */
.shop-item { display: flex; align-items: center; gap: 8px; padding: 11px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.shop-item:last-child { border-bottom: 0; }
.shop-item .row-main { min-width: 140px; }

/* Occasions */
.occasion-top { display: flex; justify-content: space-between; align-items: center; }
.countdown { text-align: center; background: var(--grad); color: #fff; border-radius: 16px; padding: 8px 14px; min-width: 78px; box-shadow: 0 8px 18px rgba(var(--primary-rgb),.25); }
.countdown strong { display: block; font-size: 24px; line-height: 1.1; }
.countdown span { font-size: 11px; opacity: .9; }

/* Allowance */
.stars { color: #e5e1ef; font-size: 17px; letter-spacing: 2px; }
.stars .on { color: #f5b301; text-shadow: 0 0 8px rgba(245,179,1,.45); }
.kid-left { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.kid-left strong { font-size: 24px; }

/* Monthly summary card */
.summary-card {
    background: var(--grad);
    color: #fff;
    border-radius: 26px;
    padding: 28px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 22px 50px rgba(var(--primary-rgb),.32);
}
.summary-card::before { content: ""; position: absolute; width: 300px; height: 300px; border-radius: 50%; background: rgba(255,255,255,.12); inset-inline-end: -90px; top: -120px; }
.summary-card > * { position: relative; }
.summary-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.summary-month { font-size: 30px; font-weight: 800; margin: 6px 0 2px; }
.summary-emoji { font-size: 54px; line-height: 1; filter: drop-shadow(0 6px 12px rgba(0,0,0,.2)); }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-top: 22px; }
.summary-grid > div { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); border-radius: 16px; padding: 14px; }
.summary-grid span { display: block; font-size: 12px; opacity: .85; }
.summary-grid strong { display: block; font-size: 19px; font-weight: 800; }
.summary-budget { margin-top: 18px; font-size: 14px; }
.summary-track { height: 10px; border-radius: 999px; background: rgba(255,255,255,.25); overflow: hidden; margin-top: 8px; }
.summary-track div { height: 100%; border-radius: 999px; background: #fff; }
.share-preview { white-space: pre-wrap; font-family: inherit; font-size: 13px; background: var(--primary-softer); border: 1px dashed var(--primary-border); border-radius: 14px; padding: 12px; margin: 0 0 12px; }

/* Achievements */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.badge-card {
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
    padding: 22px 14px; border-radius: 20px;
    background: var(--surface); border: 1px solid rgba(255,255,255,.7);
    backdrop-filter: blur(12px); box-shadow: var(--shadow);
}
.badge-medal { width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 6px; box-shadow: inset 0 0 0 4px rgba(255,255,255,.7), 0 8px 18px rgba(var(--shadow-rgb),.15); }
.badge-card.unlocked .badge-medal { animation: medalPop .5s ease; }
.badge-card.locked { opacity: .55; filter: grayscale(.8); }
@keyframes medalPop { 0% { transform: scale(.6); } 70% { transform: scale(1.08); } 100% { transform: scale(1); } }

/* Discover grid on the dashboard */
.discover-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.discover {
    display: flex; flex-direction: column; align-items: center; gap: 9px; text-align: center;
    padding: 16px 8px; border-radius: 18px;
    background: var(--surface); border: 1px solid rgba(255,255,255,.7);
    backdrop-filter: blur(12px); box-shadow: var(--shadow);
    font-weight: 700; font-size: 12.5px;
    transition: transform .2s;
}
.discover:hover { transform: translateY(-3px); }
.d-ic { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; color: #fff; }
.d1 { background: linear-gradient(135deg, #6366f1, #a855f7); }
.d2 { background: linear-gradient(135deg, #10b981, #34d399); }
.d3 { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.d4 { background: linear-gradient(135deg, #ef4444, #f97316); }
.d5 { background: linear-gradient(135deg, #ec4899, #f472b6); }
.d6 { background: linear-gradient(135deg, #0ea5e9, #38bdf8); }
.d7 { background: linear-gradient(135deg, #1e40af, #3b82f6); }
.d8 { background: linear-gradient(135deg, #eab308, #f59e0b); }

@media (max-width: 900px) {
    .summary-grid { grid-template-columns: 1fr 1fr; }
    .summary-month { font-size: 24px; }
    .icon-pick { grid-template-columns: repeat(4, 1fr); }
}

/* =========================================================
   Step 149 — Notifications
   ========================================================= */
[hidden] { display: none !important; }

.bell {
    position: relative;
    width: 44px; height: 44px;
    border-radius: 14px;
    display: grid; place-items: center;
    background: var(--surface);
    border: 1px solid rgba(255,255,255,.7);
    color: var(--primary);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}
.bell-count {
    position: absolute; top: -5px; inset-inline-end: -5px;
    min-width: 20px; height: 20px; padding: 0 5px;
    border-radius: 999px; background: #f43f5e; color: #fff;
    font-size: 11px; font-weight: 800;
    display: grid; place-items: center;
    box-shadow: 0 0 0 2px #fff;
    animation: bellPop .4s ease;
}
@keyframes bellPop { from { transform: scale(.4); } to { transform: scale(1); } }
.push-banner { border: 1.5px dashed var(--primary-border); }
.notif.unread { background: var(--primary-softer); border-radius: 12px; padding-inline: 10px; }
.notif.unread strong::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #f43f5e; margin-inline-start: 8px; vertical-align: middle; }
.assignee { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 3px 9px; border-radius: 999px; }

/* =========================================================
   Step 150 — Quick add, Welcome, Pro, Guide, Language menu
   ========================================================= */

/* ⚡ Floating + button (desktop) */
.quick-fab {
    position: fixed;
    bottom: 28px;
    inset-inline-end: 28px;
    width: 64px; height: 64px;
    border-radius: 22px;
    border: 0;
    background: var(--grad);
    color: #fff;
    display: grid; place-items: center;
    box-shadow: 0 16px 34px rgba(var(--primary-rgb),.45);
    cursor: pointer;
    z-index: 45;
    transition: transform .2s;
}
.quick-fab:hover { transform: scale(1.07) rotate(90deg); }

/* Bottom sheet */
.sheet-backdrop {
    position: fixed; inset: 0;
    background: rgba(20,14,40,.45);
    backdrop-filter: blur(4px);
    z-index: 95;
    display: none;
    align-items: flex-end;
    justify-content: center;
}
.sheet-backdrop.show { display: flex; animation: mbFade .2s ease; }
.sheet {
    width: 100%;
    max-width: 520px;
    background: #fff;
    border-radius: 28px 28px 0 0;
    padding: 12px 20px 24px;
    box-shadow: var(--shadow-lg);
    animation: sheetUp .28s cubic-bezier(.2,.9,.3,1.2);
    max-height: 92vh;
    overflow-y: auto;
}
@media (min-width: 901px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 28px; } }
@keyframes sheetUp { from { transform: translateY(60px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.sheet-grip { width: 46px; height: 5px; border-radius: 9px; background: var(--track); margin: 0 auto 10px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.sheet-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 18px; }
.sheet-head h3 .ic { color: var(--primary); }
.sheet-close { background: var(--primary-soft) !important; color: var(--primary) !important; }

.quick-amount {
    display: flex; align-items: center; gap: 8px;
    background: var(--primary-softer);
    border: 2px solid var(--primary-border);
    border-radius: 20px;
    padding: 6px 10px 6px 16px;
    margin-bottom: 14px;
    direction: ltr;
}
.quick-amount input {
    flex: 1; min-width: 0;
    border: 0; background: transparent; outline: none;
    font-family: inherit; font-size: 40px; font-weight: 800;
    color: var(--text);
}
.quick-amount select {
    border: 0; background: var(--primary-soft); color: var(--primary);
    font-weight: 800; border-radius: 12px; padding: 10px 8px; font-family: inherit; max-width: 110px;
}

.quick-cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.quick-cat input { position: absolute; opacity: 0; pointer-events: none; }
.quick-cat span {
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    padding: 12px 4px; border-radius: 16px;
    border: 2px solid var(--border); background: var(--input-bg);
    cursor: pointer; color: var(--primary); transition: .15s;
}
.quick-cat small { color: var(--text); font-weight: 700; font-size: 11.5px; }
.quick-cat input:checked + span { border-color: var(--primary); background: var(--primary-soft); transform: scale(1.04); }

/* 👋 Welcome */
.welcome { max-width: 420px; }
.welcome-emoji { font-size: 64px; line-height: 1; margin: 6px 0 12px; animation: medalPop .5s ease; }
.welcome h3 { font-size: 21px; }
.welcome p { font-size: 15px; }
.welcome-dots { display: flex; justify-content: center; gap: 6px; margin: 0 0 18px; }
.welcome-dots i { width: 8px; height: 8px; border-radius: 9px; background: var(--track); transition: .2s; }
.welcome-dots i.on { width: 24px; background: var(--primary); }

/* Language menu */
.lang-menu { position: relative; }
.lang-menu summary {
    list-style: none; cursor: pointer;
    display: flex; align-items: center; gap: 7px;
    padding: 9px 12px; border-radius: 14px;
    background: var(--surface); border: 1px solid rgba(255,255,255,.7);
    box-shadow: var(--shadow); font-weight: 800; font-size: 13px;
    backdrop-filter: blur(10px);
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu img { width: 22px; height: 15px; border-radius: 3px; object-fit: cover; }
.lang-pop {
    position: absolute; top: calc(100% + 6px); inset-inline-end: 0;
    background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg);
    padding: 6px; min-width: 170px; z-index: 70; border: 1px solid var(--border);
}
.lang-pop a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px; font-weight: 700; font-size: 14px; }
.lang-pop a:hover, .lang-pop a.active { background: var(--primary-soft); color: var(--primary); }

/* Pro */
.pro-tag {
    margin-inline-start: auto;
    font-style: normal; font-size: 9.5px; font-weight: 800; letter-spacing: .05em;
    padding: 2px 6px; border-radius: 6px;
    background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #3b2500;
}
.plan-table { display: grid; gap: 2px; }
.plan-row { display: grid; grid-template-columns: 1fr 64px 64px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }
.plan-row span { display: flex; align-items: center; gap: 8px; }
.plan-row b { text-align: center; }
.plan-head { font-size: 12px; text-transform: uppercase; color: var(--muted); }
.pro-price { font-size: 32px; font-weight: 800; color: var(--primary); margin-bottom: 6px; }

/* Guide */
.guide-step .action-title { font-size: 15.5px; }
.guide-step .action-desc { font-size: 13.5px; }
.faq { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 800; }
.faq p { margin: 8px 0 0; color: var(--muted); }

@media (max-width: 900px) {
    .quick-fab { display: none; }
    .quick-amount input { font-size: 34px; }
}

/* Fix: PIN / password fields in Arabic (RTL).
   The numbers are written left-to-right, so the field and its Show button
   always use LTR layout: text on the left, button on the right, never on top of each other. */
.pin-wrap { direction: ltr; }
.pin-wrap .control { padding-right: 78px; padding-left: 14px; text-align: left; }
.pin-toggle { left: auto; right: 8px; }

/* 💬 Chat page */
.chat-shortcut { display: flex; align-items: center; gap: 14px; transition: transform .2s; }
.chat-shortcut:hover { transform: translateY(-3px); }
.chat-shortcut .stat-icon { margin: 0; }
.chat-shortcut .chev { margin-inline-start: auto; color: var(--primary-border); }
.chat-room .chat-card { height: calc(100vh - 230px); min-height: 460px; position: static; }
.chat-room-row .row-main span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.chat-unread { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; margin-top: 4px; border-radius: 999px; background: #f43f5e; color: #fff; font-size: 12px; font-weight: 800; }
@media (max-width: 900px) { .chat-room .chat-card { height: calc(100vh - 260px); } }

/* =========================================================
   Step 152 — Mobile polish, validation, read receipts, language first
   ========================================================= */

/* Validation */
.has-error .control,
.has-error .cp-btn,
.has-error textarea { border-color: var(--red) !important; box-shadow: 0 0 0 4px rgba(240,67,107,.12) !important; background: #fff7f9; }
.has-error .gender span { border-color: var(--red) !important; }
.js-error { animation: errShake .35s ease; }
@keyframes errShake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* Language chooser on first visit */
.lang-first {
    position: fixed; inset: 0; z-index: 200;
    background: var(--grad-dark);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    animation: mbFade .25s ease;
}
.lang-first-card { width: 100%; max-width: 440px; text-align: center; color: #fff; }
.lang-first-card h2 { margin: 0 0 6px; font-size: 24px; }
.lang-first-card p { margin: 0 0 22px; color: var(--side-text); font-size: 13.5px; }
.lang-first-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lang-first-grid a {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    padding: 20px 10px; border-radius: 20px;
    background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18);
    font-weight: 800; font-size: 17px; color: #fff;
    transition: transform .15s, background .15s;
}
.lang-first-grid a:hover, .lang-first-grid a:active { transform: scale(1.03); background: rgba(255,255,255,.16); }
.lang-first-grid img { width: 54px; height: 38px; border-radius: 8px; object-fit: cover; box-shadow: 0 6px 14px rgba(0,0,0,.3); }

/* Read receipts */
.bubble .time { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.ticks { font-weight: 800; letter-spacing: -3px; padding-inline-end: 3px; opacity: .8; }
.ticks.partial { opacity: 1; }
.ticks.read { color: #7dd3fc; opacity: 1; }
.msg.theirs .ticks { display: none; }
.chat-seen { font-size: 11.5px; color: var(--muted); text-align: end; padding: 0 6px 6px; }

/* Chat room header */
.chat-room-head { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.chat-room-title { display: none; font-weight: 800; font-size: 17px; }

/* ---------- Phones ---------- */
@media (max-width: 900px) {
    /* stop iPhone zoom when typing */
    .control, select.control, textarea.control, .cp-search input, .chat-input textarea, .quick-amount input { font-size: 16px; }

    /* Auth pages */
    .auth-main { padding: 12px 12px 24px; }
    .auth-top { margin-bottom: 8px; }
    .auth-card { padding: 22px 16px; border-radius: 22px; box-shadow: var(--shadow); }
    .auth-card h1 { font-size: 21px; }
    .auth-card .lead { margin-bottom: 16px; font-size: 13.5px; }
    .gender span { padding: 12px 6px; border-radius: 16px; font-size: 14px; }
    .gender .g-circle { width: 40px; height: 40px; border-radius: 13px; }
    .phone-row .dial { min-width: 70px; padding: 0 8px; font-size: 14px; }
    .field { margin-bottom: 14px; }
    .btn-block { padding: 15px; font-size: 16px; }
    .footer { margin-top: 18px; }

    /* Chat page: full height, input always visible above the bottom bar */
    .page-chat .page-title,
    .page-chat .footer,
    .page-chat .quick-fab { display: none !important; }
    .page-chat .main { padding-bottom: 88px; }
    .page-chat .topbar { margin-bottom: 8px; }
    .chat-room-title { display: block; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .chat-room-head .avatar-stack { display: none; }
    .hide-sm { display: none; }
    .chat-room .chat-card {
        height: calc(100vh - 205px);
        height: calc(100dvh - 205px);
        min-height: 320px;
        padding: 12px;
        border-radius: 20px;
    }
    .chat-room .chat-card .card-head { margin-bottom: 8px; }
    .msg { max-width: 90%; }
    .bubble { padding: 8px 12px 6px; }
    .quick-replies { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
    .quick-replies::-webkit-scrollbar { display: none; }
    .quick-replies button { white-space: nowrap; flex-shrink: 0; }
    .chat-input .btn { width: 46px; height: 46px; }
}

/* Footer: Ashraf Systems contact */
.brand-contact { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin-top: 4px; }
.brand-contact a { color: var(--primary); font-weight: 700; text-decoration: none; }
.brand-contact a:hover { text-decoration: underline; }
.side-footer { color: var(--side-muted); }
.side-footer .brand-contact { justify-content: flex-start; }
.side-footer .brand-contact a { color: #fff; }

/* Chat: sender line + ticks legend */
.bubble .who { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.role-chip { font-size: 10px; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); }
.chat-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--muted); padding: 0 4px 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.chat-legend .tk { font-weight: 800; letter-spacing: -3px; margin-inline-end: 5px; color: var(--muted); }
.chat-legend .tk-grey { color: #94a3b8; }
.chat-legend .tk-blue { color: #0ea5e9; }

/* Chat attachments: photo, document, location */
.chat-tool {
    width: 44px; height: 44px; flex-shrink: 0;
    border-radius: 14px; border: 1.5px solid var(--border);
    background: rgba(255,255,255,.9); color: var(--primary);
    display: grid; place-items: center; cursor: pointer;
}
.chat-tool:hover { border-color: var(--primary-border); background: var(--primary-soft); }
.chat-photo { display: block; margin: 2px 0 4px; }
.chat-photo img { display: block; max-width: 240px; max-height: 260px; width: 100%; object-fit: cover; border-radius: 14px; background: var(--track); }
.chat-doc {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; margin: 2px 0 4px; border-radius: 12px;
    background: rgba(0,0,0,.06); color: inherit; text-decoration: none; min-width: 190px;
}
.msg.mine .chat-doc { background: rgba(255,255,255,.18); }
.chat-doc-ic { width: 40px; height: 44px; border-radius: 8px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 10.5px; font-weight: 800; flex-shrink: 0; }
.msg.mine .chat-doc-ic { background: rgba(255,255,255,.3); }
.chat-doc-info { display: flex; flex-direction: column; min-width: 0; }
.chat-doc-info b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.chat-doc-info small { font-size: 11px; opacity: .75; }
.chat-map { width: 240px; max-width: 100%; margin: 2px 0 4px; border-radius: 14px; overflow: hidden; background: var(--track); }
.chat-map iframe { display: block; width: 100%; height: 150px; border: 0; }
.chat-map-link { display: block; padding: 8px 10px; font-weight: 800; font-size: 12.5px; color: var(--primary); background: #fff; text-decoration: none; }
@media (max-width: 900px) {
    .chat-tool { width: 40px; height: 40px; border-radius: 12px; }
    .chat-input { gap: 6px; }
    .chat-photo img, .chat-map { max-width: 210px; }
}

/* Quick add (+) on mobile: full screen, fits above the keyboard, Save always visible */
.sheet-foot { margin-top: 4px; }
.sheet-more { display: block; text-align: center; margin-top: 10px; }
html.sheet-open, html.sheet-open body { overflow: hidden; }
@media (max-width: 900px) {
    .sheet-backdrop { align-items: stretch; bottom: auto; height: var(--vvh, 100dvh); padding: 0; }
    .sheet {
        max-width: none; max-height: none; height: 100%;
        border-radius: 0; display: flex; flex-direction: column;
        padding: calc(10px + env(safe-area-inset-top)) 16px 0;
        overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
        animation: sheetUpM .22s ease;
    }
    .sheet-grip { display: none; }
    .sheet-head { position: sticky; top: calc(-10px - env(safe-area-inset-top)); z-index: 2; background: #fff; margin: 0 -16px 10px; padding: 6px 16px 8px; }
    .sheet-head h3 { font-size: 17px; }
    .sheet-close { width: 42px; height: 42px; }
    .quick-amount { padding: 4px 8px 4px 14px; border-radius: 16px; margin-bottom: 12px; }
    .quick-amount input { font-size: 30px; height: 52px; }
    .quick-amount select { padding: 9px 6px; max-width: 96px; font-size: 14px; }
    .quick-cats { gap: 6px; margin-bottom: 10px; }
    .quick-cat span { padding: 9px 2px; border-radius: 14px; gap: 3px; }
    .quick-cat small { font-size: 11px; line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
    .quick-cat input:checked + span { transform: none; }
    .sheet .control { font-size: 16px; }
    .sheet-foot {
        position: sticky; bottom: 0; z-index: 2; margin: auto -16px 0;
        background: #fff; border-top: 1px solid var(--line);
        padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    }
    .sheet-foot .btn { min-height: 50px; font-size: 16px; }
    .sheet-more { margin-top: 8px; font-size: 13px; }
}
@media (max-width: 360px) {
    .quick-cats { grid-template-columns: repeat(4, 1fr); }
    .quick-cat span .ic { width: 20px; height: 20px; }
    .quick-amount input { font-size: 26px; }
}
@keyframes sheetUpM { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Chat on phones: fills the screen, nothing cut, full screen while typing */
.chat-box > * { flex-shrink: 0; }
.chat-seen:empty { display: none; }
@media (max-width: 900px) {
    .chat-box { scroll-behavior: auto; overscroll-behavior: contain; }
    .page-chat .main { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
    .chat-room .chat-card { min-height: 300px; }
    html.chat-typing .bottom-nav,
    html.chat-typing .topbar,
    html.chat-typing .chat-room-head { visibility: hidden; }
    html.chat-typing .chat-room .chat-card {
        position: fixed; inset-inline: 6px; z-index: 80;
        min-height: 0; margin: 0;
        box-shadow: 0 10px 40px rgba(0,0,0,.18);
    }
    html.chat-typing .chat-legend { display: none; }
    html.chat-typing, html.chat-typing body { overflow: hidden; }
}

/* Chat on phones: the page itself never scrolls, only the messages */
@media (max-width: 900px) {
    html.chat-phone, html.chat-phone body { overflow: hidden; overscroll-behavior: none; }
    html.chat-phone .chat-room .chat-card { margin: 0; z-index: 30; }
    html.chat-typing .chat-room .chat-card { z-index: 80; }
}

/* Profile photos (Step 154): the photo covers the letter circle */
.av, .avatar { position: relative; overflow: hidden; text-decoration: none; }
.av-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; background: #fff; }
.av-xl { width: 72px; height: 72px; font-size: 28px; }
.photo-edit { position: relative; flex-shrink: 0; }
.photo-edit .av { box-shadow: 0 0 0 3px rgba(255,255,255,.95), 0 8px 20px rgba(0,0,0,.15); }
.photo-cam {
    position: absolute; bottom: -2px; inset-inline-end: -4px;
    width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff;
    background: var(--primary); color: #fff; display: grid; place-items: center; cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,.2);
}
.top-avatar { width: 38px; height: 38px; font-size: 14px; box-shadow: 0 0 0 2px #fff, var(--shadow); }
.avatar-stack .av-img, .msg .av-img { border-radius: 50%; }

/* Dashboard: clear Personal / Family wallet cards */
.wallets-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 800; font-size: 16px; margin: 0 2px 10px; }
.wallets-title small { font-weight: 600; font-size: 12.5px; color: var(--muted); width: 100%; }
.wallet-kind { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; position: relative; z-index: 1; }
.kind-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 900; letter-spacing: .4px; }
.kind-personal { background: #fff; color: var(--primary); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.kind-family { background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff; box-shadow: 0 4px 12px rgba(249,115,22,.35); }
.kind-note { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; opacity: .9; }
.wallet-hero .hero-meta { opacity: .85; }
.family-card {
    position: relative; border-radius: 24px; padding: 20px;
    background: linear-gradient(135deg, #fff7ed, #ffffff 60%);
    border: 2px solid #fdba74; box-shadow: 0 12px 30px rgba(249,115,22,.14);
}
.family-card .kind-note { color: #9a3412; }
.family-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.family-card-name { font-size: 20px; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.family-card-role { font-size: 13px; color: var(--muted); margin-top: 2px; }
.family-card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.family-card-stats div { background: #fff; border: 1px solid #fed7aa; border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.family-card-stats span { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.family-card-stats strong { font-size: 14.5px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.family-card .progress > div { background: linear-gradient(90deg, #f59e0b, #f97316); }
.family-card .progress > div.over { background: linear-gradient(90deg, #f0436b, #fb7185); }
.family-card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.family-invite { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; border: 2px dashed var(--primary-border); }
.family-invite span:nth-child(2) { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.family-invite small { color: var(--muted); font-size: 12.5px; }
@media (max-width: 560px) {
    .family-card { padding: 16px; }
    .family-card-name { font-size: 17px; }
    .family-card-stats strong { font-size: 13px; }
}

/* No zoom on phones: no double-tap zoom, and inputs at 16px so iPhone does not zoom into them */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (max-width: 900px) {
    input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea { font-size: 16px !important; }
    .quick-amount input { font-size: 30px !important; }
}

/* Quick add step 1: choose Personal or Family */
.wallet-choose { display: flex; flex-direction: column; gap: 12px; padding-bottom: 14px; }
.wallet-choose-q { margin: 0 0 2px; font-weight: 800; color: var(--muted); }
.wallet-choice {
    display: flex; align-items: center; gap: 14px; width: 100%; text-align: start;
    padding: 16px; border-radius: 20px; cursor: pointer; font: inherit; color: inherit;
    border: 2px solid var(--primary-border); background: var(--primary-soft);
    transition: transform .12s ease, box-shadow .12s ease;
}
.wallet-choice:active { transform: scale(.98); }
.wallet-choice:hover { box-shadow: var(--shadow); }
.wallet-choice.is-family { border-color: #fdba74; background: #fff7ed; }
.wc-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; flex-shrink: 0; background: var(--grad); color: #fff; }
.wallet-choice.is-family .wc-icon { background: linear-gradient(135deg, #f59e0b, #f97316); }
.wc-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.wc-text b { font-size: 16.5px; }
.wc-name { font-weight: 700; font-size: 13.5px; color: var(--primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wallet-choice.is-family .wc-name { color: #c2410c; }
.wc-text small { font-size: 12px; color: var(--muted); line-height: 1.4; }
.wallet-chosen {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
    margin-bottom: 12px; padding: 10px 14px; border-radius: 14px; font: inherit; font-weight: 800; cursor: pointer;
    border: 1.5px solid var(--primary-border); background: var(--primary-soft); color: var(--primary);
}
.wallet-chosen.is-family { border-color: #fdba74; background: #fff7ed; color: #c2410c; }
.wallet-change-link { font-size: 12.5px; text-decoration: underline; opacity: .85; }

/* Shopping list: simple and clear */
.shop-steps { display: flex; gap: 10px; flex-wrap: wrap; }
.shop-steps > div {
    flex: 1 1 180px; display: flex; align-items: center; gap: 10px;
    background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow);
    font-size: 13px; font-weight: 700; line-height: 1.45;
}
.shop-steps b { width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff; font-size: 14px; }
.shop-add { display: flex; flex-direction: column; gap: 8px; padding: 14px; margin-bottom: 14px; border-radius: 18px; background: var(--primary-softer); border: 1.5px dashed var(--primary-border); }
.shop-add .label { margin: 0; }
.shop-name { font-size: 17px; font-weight: 700; }
.shop-suggest { display: flex; gap: 6px; flex-wrap: wrap; }
.shop-suggest button { border: 1px solid var(--primary-border); background: #fff; color: var(--primary); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.shop-suggest button:active { transform: scale(.96); }
.shop-add-row { display: flex; gap: 8px; flex-wrap: wrap; }
.shop-add-row > div { display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
.shop-list { display: flex; flex-direction: column; gap: 10px; }
.shop-card { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; padding: 12px; border-radius: 16px; background: #fff; border: 1.5px solid var(--line); box-shadow: var(--shadow); }
.shop-card.is-mine { border-color: #fbbf24; background: #fffbeb; }
.shop-card-main { flex: 1; min-width: 150px; }
.shop-card-name { font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.shop-card-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 4px; font-size: 12px; align-items: center; }
.assignee-any { background: var(--track) !important; color: var(--muted) !important; }
.shop-card details > summary { list-style: none; cursor: pointer; }
.shop-card details > summary::-webkit-details-marker { display: none; }
.shop-buy[open], .shop-more[open] { flex-basis: 100%; order: 3; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.shop-buy[open] > .shop-buy-box, .shop-more[open] > .shop-more-box { align-self: stretch; }
.shop-buy-box, .shop-more-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px; background: var(--primary-softer); border: 1px solid var(--primary-border); }
.shop-buy-row { display: flex; gap: 8px; }
.shop-buy-row input { flex: 1; min-width: 0; }
.shop-buy-row select { width: 96px; }
.shop-more > summary { font-size: 20px; line-height: 1; width: 38px; height: 38px; display: grid; place-items: center; }

/* Bills: edit / change date */
.row-item:has(.bill-edit) { flex-wrap: wrap; }
.bill-edit { flex-basis: 100%; }
.bill-edit > summary { list-style: none; cursor: pointer; display: inline-flex; }
.bill-edit > summary::-webkit-details-marker { display: none; }
.bill-edit-box { margin-top: 10px; padding: 12px; border-radius: 14px; background: var(--primary-softer); border: 1px solid var(--primary-border); }

/* Info banner + "how to" steps */
.info-banner { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 20px; background: #fff; border: 1.5px solid var(--primary-border); box-shadow: var(--shadow); }
.info-banner > div { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; line-height: 1.55; }
.info-banner b { font-size: 15px; }
.info-banner span { color: var(--muted); }
.how-steps { margin-top: 16px; padding: 14px; border-radius: 18px; background: var(--primary-softer); border: 1px solid var(--primary-border); display: flex; flex-direction: column; gap: 10px; }
.how-steps h4 { margin: 0 0 2px; font-size: 15px; }
.how-steps > div { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.5; font-weight: 600; }
.how-steps b { width: 26px; height: 26px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff; font-size: 13px; }

/* Notifications request dialog */
.push-ask { text-align: start; max-width: 420px; }
.push-ask h3 { text-align: center; }
.push-ask-bell { width: 70px; height: 70px; margin: 0 auto 10px; border-radius: 22px; display: grid; place-items: center; color: #fff; background: var(--grad); box-shadow: 0 12px 28px rgba(var(--primary-rgb),.35); animation: bellRing 1.6s ease 1s 2; }
.push-ask-lead { font-weight: 700; margin: 6px 0 8px; }
.push-ask-list { margin: 0 0 10px; padding: 0; list-style: none; display: grid; gap: 7px; font-size: 13.5px; line-height: 1.45; }
.push-ask-list li { background: var(--primary-softer); border-radius: 12px; padding: 8px 10px; }
.push-ask-ios { font-size: 13px; font-weight: 700; background: #fff7ed; border: 1px solid #fdba74; border-radius: 12px; padding: 10px; color: #9a3412; }
@keyframes bellRing { 0%,100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(8deg); } 60% { transform: rotate(-6deg); } 75% { transform: rotate(3deg); } }
.family-card, .shop-card, .shop-steps > div, .info-banner, .how-steps, .wallets-title { color: var(--text); }
.wallet-choice { color: var(--text); }
.family-card-stats strong { white-space: normal; overflow-wrap: anywhere; }
.shop-more-btn { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; line-height: 1; font-weight: 900; color: var(--primary); background: var(--primary-soft); border: 1px solid var(--primary-border); }

/* ===== Step 155: app mode (installed), share, install page ===== */
/* Locked like an app: no pull-to-refresh, no rubber-band bounce, no sideways sliding */
html, body { overscroll-behavior: none; }
html, body { max-width: 100%; overflow-x: clip; }
html.app-mode body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
html.app-mode input, html.app-mode textarea, html.app-mode [contenteditable] { -webkit-user-select: text; user-select: text; }
html.app-mode img { -webkit-user-drag: none; }
html.app-mode .main { padding-top: max(14px, env(safe-area-inset-top)); }

/* Share button in the top bar */
.share-btn { border: 0; cursor: pointer; font: inherit; }

/* Share dialog */
.share-dlg { max-width: 420px; }
.share-dlg h3 { display: flex; align-items: center; justify-content: center; gap: 8px; }
.share-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.share-grid a {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px;
    border-radius: 16px; background: var(--primary-softer); border: 1px solid var(--line);
    color: var(--text); text-decoration: none; font-weight: 700; font-size: 12.5px;
}
.share-grid a span { font-size: 24px; }
.share-grid .sh-wa { background: #ecfdf3; border-color: #a7f3d0; }
.share-copy { display: flex; gap: 8px; }
.share-copy input { flex: 1; min-width: 0; font-size: 13px !important; }

/* Install page */
.install-page { text-align: center; }
.install-logo { width: 86px; height: 86px; margin: 0 auto 12px; border-radius: 26px; display: grid; place-items: center; color: #fff; background: var(--grad); box-shadow: 0 16px 36px rgba(var(--primary-rgb),.35); }
.install-title { margin: 0; font-size: 24px; }
.install-sub { color: var(--muted); margin: 6px 0 14px; }
.install-points { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; text-align: start; }
.install-points li { background: var(--primary-softer); border-radius: 14px; padding: 10px 12px; font-weight: 700; font-size: 13.5px; }
.btn-lg { min-height: 56px; font-size: 17px; }
.install-steps { text-align: start; margin: 6px 0 16px; padding: 14px; border-radius: 18px; background: var(--primary-softer); border: 1px solid var(--primary-border); display: flex; flex-direction: column; gap: 10px; }
.install-steps h4 { margin: 0; font-size: 15px; }
.install-steps > div { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.55; font-weight: 600; }
.install-steps b { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff; }
.ios-share-ic, .ios-plus-ic { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: #fff; border: 1px solid var(--border); color: #0a84ff; vertical-align: middle; font-weight: 900; }
.install-warn { display: flex; gap: 8px; align-items: flex-start; text-align: start; padding: 12px; margin-bottom: 12px; border-radius: 14px; background: #fff7ed; border: 1px solid #fdba74; color: #9a3412; font-weight: 700; font-size: 13.5px; }
.install-done { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px; margin-bottom: 14px; border-radius: 18px; background: #ecfdf3; border: 1px solid #a7f3d0; }
.install-done-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: #10b981; color: #fff; font-size: 26px; font-weight: 900; }
.install-links { display: grid; gap: 8px; margin-top: 8px; }
.install-cta { margin-top: 12px; }

/* iPhone "Add to Home Screen" guide with pictures */
.ios-step { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.55; font-weight: 700; text-align: start; }
.ios-step b { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff; }
.ios-red { color: #ef233c; font-weight: 900; }
.ios-shot { display: block; width: 100%; border-radius: 14px; border: 3px solid #ef233c; box-shadow: 0 8px 20px rgba(239,35,60,.25); }
.ios-menu-mock { background: #f2f2f7; border-radius: 14px; overflow: hidden; border: 1px solid #d1d1d6; }
.ios-menu-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 14px; font-size: 15px; font-weight: 600; color: #111; background: #fff; border-bottom: 1px solid #e5e5ea; }
.ios-menu-row:last-child { border-bottom: 0; }
.ios-menu-row span { font-size: 18px; color: #555; }
.ios-menu-hit { outline: 3px solid #ef233c; outline-offset: -3px; background: #fff1f2; color: #ef233c; font-weight: 900; }
.ios-home-mock { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px; border-radius: 16px; background: linear-gradient(160deg, #3b2c85, #b04b8f); }
.ios-app-ic { width: 60px; height: 60px; border-radius: 15px; overflow: hidden; box-shadow: 0 6px 14px rgba(0,0,0,.3); }
.ios-app-ic img { width: 100%; height: 100%; display: block; }
.ios-home-mock small { color: #fff; font-weight: 700; }
.ios-login-guide { margin-top: 14px; }
.install-steps > .ios-menu-mock { display: flex; flex-direction: column; gap: 0; align-items: stretch; font-weight: 600; }
.install-steps > .ios-home-mock { display: flex; flex-direction: column; align-items: center; gap: 4px; }

/* "Watch the video guide" banner */
.video-banner { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 20px; text-decoration: none; color: #fff; background: linear-gradient(135deg, #1e1638, #3b2c85); box-shadow: 0 12px 28px rgba(30,22,56,.3); text-align: start; }
.video-banner > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.video-banner b { font-size: 16px; }
.video-banner small { opacity: .8; font-size: 12.5px; }
.video-play { width: 52px; height: 52px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; font-size: 22px; background: var(--grad); box-shadow: 0 0 0 6px rgba(255,255,255,.12); }

/* Step 157: shopping "needed on" + savings payments */
.need-by { border-radius: 999px; padding: 3px 9px; font-weight: 800; font-size: 11.5px; }
.need-today { background: #fef3c7; color: #92400e; }
.need-late { background: #fee2e2; color: #b91c1c; }
.need-later { background: var(--track); color: var(--muted); }
.goal-payments { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.goal-payments-title { font-size: 12px; font-weight: 800; color: var(--muted); }
.goal-pay { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.goal-pay-del { width: 30px; height: 30px; border-radius: 10px; border: 1px solid #fecaca; background: #fff1f2; color: #e11d48; display: grid; place-items: center; cursor: pointer; }

/* Debts & Loans on phones: cards instead of long rows */
@media (max-width: 700px) {
    .debt-list .row-item { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; padding: 14px; margin-bottom: 10px; border: 1.5px solid var(--line); border-radius: 18px; background: #fff; box-shadow: var(--shadow); }
    .debt-list .row-item .row-main span { white-space: normal; line-height: 1.5; }
    .debt-list .row-item .row-end { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding-top: 8px; border-top: 1px dashed var(--line); text-align: start; }
    .debt-list .row-item .row-end strong { font-size: 18px; }
    .debts-toolbar { flex-direction: column; align-items: stretch; }
    .debts-toolbar .tabs { width: 100%; }
    .debts-toolbar .tabs a { flex: 1; justify-content: center; }
    .debts-toolbar .btn { margin-inline-start: 0 !important; width: 100%; justify-content: center; }
}

/* ===== Step 160: real video guide (/guide), intro video on /install, dashboard card ===== */
.vg-body { margin: 0; min-height: 100vh; background: radial-gradient(900px 600px at 80% -10%, #2f5bea 0%, rgba(47,91,234,0) 60%), linear-gradient(160deg, #0c1847, #070b24); color: #fff; }
.vg-wrap { max-width: 520px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 14px 30px; }
.vg-top { display: flex; align-items: center; gap: 12px; }
.vg-back { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.1); color: #fff; }
.vg-title { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; }
.vg-langs, .vg-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.vg-langs a, .vg-tabs a { padding: 7px 14px; border-radius: 999px; background: rgba(255,255,255,.1); color: #dbe4ff; text-decoration: none; font-weight: 700; font-size: 14px; }
.vg-langs a.on, .vg-tabs a.on { background: #fff; color: #1e3a8a; }
.vg-tabs a { flex: 1; text-align: center; }
.vg-player { margin-top: 14px; border-radius: 22px; overflow: hidden; background: #000; box-shadow: 0 20px 50px rgba(0,0,0,.45); }
.vg-player video { display: block; width: 100%; max-height: 78vh; aspect-ratio: 9 / 16; background: #000; }
.vg-h { margin: 20px 4px 10px; font-size: 17px; }
.vg-chapters { display: flex; flex-direction: column; gap: 8px; }
.vg-ch { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 1px solid rgba(255,255,255,.12); border-radius: 16px; background: rgba(255,255,255,.06); color: #fff; font: inherit; text-align: start; cursor: pointer; }
.vg-ch.on { background: rgba(59,108,246,.35); border-color: #6d8cff; }
.vg-ch-n { width: 28px; height: 28px; flex: none; border-radius: 9px; display: grid; place-items: center; background: #3b6cf6; font-weight: 800; font-size: 14px; }
.vg-ch-t { flex: 1; font-weight: 700; }
.vg-ch-time { color: #9fb0ea; font-size: 13px; direction: ltr; }
.vg-cta { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }

.intro-video { position: fixed; inset: 0; z-index: 2000; background: #000; display: flex; align-items: center; justify-content: center; }
.intro-video[hidden] { display: none; }
.intro-video video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.intro-skip { position: absolute; top: max(14px, env(safe-area-inset-top)); inset-inline-end: 14px; padding: 9px 16px; border: 0; border-radius: 999px; background: rgba(255,255,255,.92); color: #111827; font: inherit; font-weight: 800; cursor: pointer; }
.intro-continue { position: absolute; bottom: max(24px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); padding: 14px 34px; border: 0; border-radius: 999px; background: #3b6cf6; color: #fff; font: inherit; font-weight: 800; font-size: 17px; box-shadow: 0 12px 30px rgba(59,108,246,.5); cursor: pointer; }
body.intro-on { overflow: hidden; }
.intro-later { position: fixed; inset: 0; z-index: 2100; background: rgba(10,18,54,.55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.intro-later[hidden] { display: none; }
.intro-later .modal-card { width: 100%; max-width: 360px; background: #fff; color: #111827; border-radius: 24px; padding: 24px 20px; text-align: center; box-shadow: 0 30px 60px rgba(0,0,0,.35); }
.intro-later h3 { margin: 10px 0 6px; font-size: 18px; }
.intro-later p { margin: 0 0 16px; color: #4b5563; line-height: 1.6; }
.intro-later-ic { width: 58px; height: 58px; margin: 0 auto; border-radius: 18px; display: grid; place-items: center; background: linear-gradient(135deg,#1e3a8a,#3b6cf6); color: #fff; font-size: 22px; }

.tut-card { display: flex; gap: 14px; align-items: center; padding: 12px; margin-bottom: 16px; border-radius: 22px; background: linear-gradient(135deg, #1e1638, #3b2c85); color: #fff; box-shadow: 0 12px 28px rgba(30,22,56,.28); }
.tut-thumb { position: relative; flex: none; width: 74px; height: 120px; border-radius: 14px; overflow: hidden; background: #0c1847; }
.tut-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tut-play { position: absolute; inset: 0; margin: auto; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.92); color: #3b2c85; font-size: 15px; }
.tut-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tut-text b { font-size: 16px; }
.tut-text small { color: #d7d2ff; line-height: 1.5; }
.tut-actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.tut-actions .btn-ghost { color: #fff; border-color: rgba(255,255,255,.35); }
