:root {
    color-scheme: dark;
    --bg: #0b1220;
    --surface: #111c2e;
    --surface-2: #17243a;
    --surface-3: #1d2d46;
    --blue: #3988ff;
    --blue-light: #72adff;
    --text: #f1f5fb;
    --muted: #91a1b8;
    --green: #35d39a;
    --red: #ff7185;
    --border: rgba(151, 177, 211, .12);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.ambient {
    position: fixed;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    filter: blur(100px);
    opacity: .12;
    pointer-events: none;
    z-index: 0;
}
.ambient-one { background: #176cff; top: -170px; right: -130px; }
.ambient-two { background: #1245a0; bottom: -180px; left: -170px; }

.login-screen {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.login-card {
    width: min(100%, 410px);
    padding: 34px 28px 26px;
    background: rgba(17, 28, 46, .94);
    border: 1px solid var(--border);
    border-radius: 25px;
    box-shadow: 0 25px 80px rgba(0,0,0,.28);
}
.brand-mark {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 17px;
    color: white;
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(145deg, #56a0ff, #1762d5);
    box-shadow: 0 8px 25px rgba(42, 119, 239, .3);
}
.brand-title { margin-top: 18px; font-size: 27px; font-weight: 750; letter-spacing: -.8px; }
.brand-title span { color: var(--blue-light); }
.login-subtitle { margin: 8px 0 30px; }
.login-card label {
    display: block;
    margin: 17px 0 8px;
    color: #c6d2e2;
    font-size: 13px;
    font-weight: 600;
}
.login-card input {
    width: 100%;
    height: 51px;
    padding: 0 15px;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    color: var(--text);
    background: #0c1728;
}
.login-card input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(57,136,255,.12); }
.primary-button {
    border: 0;
    border-radius: 12px;
    color: white;
    background: linear-gradient(110deg, #2878ed, #438fff);
    font-weight: 700;
}
.login-button {
    width: 100%;
    height: 52px;
    margin-top: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.login-button span { font-size: 20px; }
.login-button:disabled { opacity: .6; }
.login-footer {
    margin-top: 26px;
    padding-top: 19px;
    border-top: 1px solid var(--border);
    color: #72849d;
    font-size: 11px;
    text-align: center;
}
.error-message { min-height: 16px; color: var(--red); font-size: 12px; }

.app-screen { position: relative; z-index: 1; min-height: 100vh; padding-bottom: 105px; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    min-height: 75px;
    padding: 12px max(20px, calc((100vw - 1050px) / 2));
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(11,18,32,.88);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark.small { width: 40px; height: 40px; border-radius: 13px; font-size: 21px; }
.small-title { margin: 0; font-size: 17px; letter-spacing: -.4px; }
.brand-subtitle { margin-top: 3px; color: var(--muted); font-size: 11px; }
.user-area { display: flex; align-items: center; gap: 9px; }
.user-name { font-size: 13px; font-weight: 650; }
.avatar {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #cfe4ff;
    background: #1d3c68;
    border: 1px solid rgba(104,166,255,.25);
    font-weight: 700;
}
.main-content { width: min(100% - 36px, 850px); margin: 0 auto; padding-top: 30px; }
.view { display: none; animation: appear .2s ease; }
.view.active { display: block; }
@keyframes appear { from { opacity: .5; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.welcome-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 21px; }
.eyebrow { color: var(--blue-light); font-size: 10px; font-weight: 800; letter-spacing: 1.5px; margin: 0 0 7px; }
h1 { margin: 0; font-size: 29px; letter-spacing: -.9px; }
.welcome-row .muted { margin: 7px 0 0; font-size: 12px; }
.live-indicator {
    display: flex; align-items: center; gap: 7px;
    padding: 8px 10px; border-radius: 30px;
    color: #9cacc1; background: var(--surface);
    font-size: 10px; white-space: nowrap;
}
.live-indicator span { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 9px var(--green); }

.balance-card {
    position: relative;
    overflow: hidden;
    padding: 23px;
    border: 1px solid rgba(115,171,255,.23);
    border-radius: 21px;
    background: linear-gradient(120deg, #16396c 0%, #174c91 52%, #1b65bd 100%);
    box-shadow: 0 15px 35px rgba(15, 72, 145, .19);
}
.balance-top, .balance-bottom { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; }
.balance-label { color: #c4dcff; font-size: 12px; }
.balance-icon { color: #a9ceff; font-size: 25px; }
.total-balance { position: relative; z-index: 1; margin: 14px 0 19px; font-size: clamp(31px, 7vw, 42px); font-weight: 780; letter-spacing: -1.4px; }
.balance-bottom { color: #c0d9fa; font-size: 10px; }
.balance-status { padding: 6px 9px; border-radius: 20px; background: rgba(255,255,255,.12); }
.balance-decoration {
    position: absolute; width: 220px; height: 220px; right: -65px; bottom: -150px;
    border: 1px solid rgba(255,255,255,.12); border-radius: 50%;
    box-shadow: 0 0 0 24px rgba(255,255,255,.035), 0 0 0 50px rgba(255,255,255,.025);
}
.section-heading { display: flex; align-items: end; justify-content: space-between; margin: 30px 0 14px; }
.section-heading h2, .panel h2 { margin: 0; font-size: 16px; letter-spacing: -.2px; }
.section-heading .muted { margin: 5px 0 0; font-size: 11px; }
.section-count { color: var(--muted); font-size: 11px; }
.accounts-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 11px; }
.account-card {
    min-width: 0; padding: 16px; border-radius: 16px;
    background: var(--surface); border: 1px solid var(--border);
}
.account-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.account-icon {
    width: 34px; height: 34px; display: grid; place-items: center;
    border-radius: 11px; color: #85baff; background: rgba(57,136,255,.13); font-size: 18px;
}
.account-type { color: #71839d; font-size: 9px; text-transform: uppercase; letter-spacing: .7px; }
.account-name { margin-top: 13px; color: #c3cede; font-size: 11px; }
.account-balance { margin-top: 5px; font-size: 17px; font-weight: 750; letter-spacing: -.4px; overflow-wrap: anywhere; }
.monthly-heading { margin-top: 31px; }
.summary-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; }
.summary-card { min-width: 0; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.summary-icon {
    width: 29px; height: 29px; display: grid; place-items: center;
    margin-bottom: 12px; border-radius: 10px; font-size: 18px;
}
.income-card .summary-icon { color: var(--green); background: rgba(53,211,154,.12); }
.expense-card .summary-icon { color: var(--red); background: rgba(255,113,133,.12); }
.summary-label { display: block; color: var(--muted); font-size: 11px; }
.summary-card strong { display: block; margin-top: 7px; font-size: clamp(17px,4vw,21px); letter-spacing: -.5px; overflow-wrap: anywhere; }
.income-card strong { color: var(--green); }
.expense-card strong { color: var(--red); }
.net-card {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 10px; padding: 16px; border-radius: 14px;
    background: var(--surface-2); color: #b7c6d9; font-size: 12px;
}
.net-card strong { color: var(--blue-light); font-size: 16px; }
.transaction-heading { margin-top: 32px; }
.text-button { border: 0; padding: 7px 0 7px 7px; color: var(--blue-light); background: transparent; font-size: 11px; font-weight: 700; }
.transaction-list { display: grid; gap: 9px; }
.transaction-item {
    display: flex; align-items: center; gap: 12px;
    padding: 13px; border: 1px solid var(--border);
    border-radius: 14px; background: var(--surface);
}
.transaction-symbol {
    width: 39px; height: 39px; flex: 0 0 39px;
    display: grid; place-items: center; border-radius: 12px;
    font-size: 17px; font-weight: 700;
}
.transaction-symbol.income { color: var(--green); background: rgba(53,211,154,.11); }
.transaction-symbol.expense { color: var(--red); background: rgba(255,113,133,.11); }
.transaction-info { min-width: 0; flex: 1; }
.transaction-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 700; }
.transaction-meta { margin-top: 5px; color: var(--muted); font-size: 10px; }
.transaction-amount { text-align: right; white-space: nowrap; font-size: 13px; font-weight: 750; }
.transaction-amount.income { color: var(--green); }
.transaction-amount.expense { color: var(--red); }
.empty-state, .loading-card { padding: 24px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: 14px; font-size: 12px; }

.panel { margin-top: 18px; padding: 18px; border: 1px solid var(--border); border-radius: 17px; background: var(--surface); }
.panel-heading { margin-bottom: 19px; }
.category-list { display: grid; gap: 18px; }
.category-row { display: grid; gap: 8px; }
.category-top { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; }
.category-top span:last-child { color: #d9e4f3; font-weight: 700; }
.category-track { height: 7px; overflow: hidden; border-radius: 10px; background: #26354b; }
.category-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2878ed, #70b0ff); }
.profile-card { display: flex; align-items: center; gap: 15px; padding: 20px; border: 1px solid var(--border); border-radius: 17px; background: var(--surface); }
.avatar.large { width: 53px; height: 53px; font-size: 20px; }
.profile-card h2 { margin: 0; font-size: 17px; }
.profile-card p { margin: 5px 0 0; font-size: 11px; }
.settings-panel { padding: 5px 17px; }
.setting-row { display: flex; justify-content: space-between; gap: 12px; padding: 15px 0; border-bottom: 1px solid var(--border); font-size: 11px; }
.setting-row:last-child { border-bottom: 0; }
.setting-row span { color: var(--muted); }
.setting-row strong { text-align: right; }
.install-help { margin-top: 17px; padding: 17px; border: 1px solid rgba(57,136,255,.2); border-radius: 15px; background: rgba(57,136,255,.08); font-size: 12px; }
.install-help p { margin: 7px 0 0; color: var(--muted); line-height: 1.5; }
.logout-button { width: 100%; margin-top: 18px; padding: 14px; border: 1px solid rgba(255,113,133,.25); border-radius: 13px; color: var(--red); background: rgba(255,113,133,.07); font-weight: 700; }

.bottom-nav {
    position: fixed; z-index: 10; left: 0; right: 0; bottom: 0;
    display: flex; justify-content: center; gap: 0;
    padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: rgba(13,22,37,.94); backdrop-filter: blur(20px);
}
.nav-item {
    width: min(25%, 150px); display: flex; flex-direction: column;
    align-items: center; gap: 5px; padding: 5px 2px;
    border: 0; color: #788ba5; background: transparent; font-size: 9px;
}
.nav-icon { font-size: 21px; line-height: 22px; }
.nav-item.active { color: var(--blue-light); }
.nav-item.active .nav-icon { filter: drop-shadow(0 0 7px rgba(57,136,255,.45)); }
.toast {
    position: fixed; z-index: 20; left: 50%; bottom: 95px;
    transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
    padding: 12px 17px; border: 1px solid var(--border); border-radius: 12px;
    color: white; background: #1d2d46; font-size: 12px; transition: .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 700px) {
    .main-content { padding-top: 42px; }
    .accounts-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
    .balance-card { padding: 29px; }
    .summary-card { padding: 20px; }
    .bottom-nav { bottom: 15px; left: 50%; right: auto; width: min(520px, calc(100% - 30px)); transform: translateX(-50%); border: 1px solid var(--border); border-radius: 18px; }
    .app-screen { padding-bottom: 120px; }
}
