/* ============================================================
   Personal Finance — animated design system
   ============================================================ */
:root {
    --bg-1:      #0b1020;
    --bg-2:      #141a35;
    --surface:   #ffffff;
    --surface-2: #f5f7fc;
    --line:      #e7eaf3;
    --text:      #161c2d;
    --muted:     #6b7280;
    --primary:   #6366f1;
    --primary-2: #8b5cf6;
    --primary-d: #4f46e5;
    --green:     #10b981;
    --green-bg:  #e7f8f0;
    --red:       #ef4444;
    --red-bg:    #fdecec;
    --amber:     #f59e0b;
    --font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    --radius:    14px;
    --shadow-sm: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
    --shadow-lg: 0 12px 30px -10px rgba(38,43,99,.25);
    --ease:      cubic-bezier(.4, 0, .2, 1);
    --spring:    cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font-family);
    color: var(--text);
    background: radial-gradient(1200px 600px at 100% -10%, #eef1fb 0%, transparent 60%),
                radial-gradient(1000px 500px at -10% 110%, #f0ecfb 0%, transparent 55%),
                var(--surface-2);
    background-attachment: fixed;
    font-size: 14.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-d); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--primary-2); }

/* ---- Keyframes -------------------------------------------- */
@keyframes fadeInUp   { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn     { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideInL   { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
@keyframes popIn      { 0% { opacity: 0; transform: translateY(14px) scale(.96); } 60% { opacity: 1; } 100% { opacity: 1; transform: none; } }
@keyframes floatPulse { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-3px) rotate(-3deg); } }
@keyframes gradientShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes shimmer    { 100% { transform: translateX(100%); } }
@keyframes flashIn    { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes ripple     { to { transform: scale(3.2); opacity: 0; } }
@keyframes spin       { to { transform: rotate(360deg); } }

/* ---- App layout ------------------------------------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 252px; flex-shrink: 0;
    background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
    color: #c2c8de; display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
    box-shadow: 4px 0 24px rgba(11,16,32,.18);
    z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 16px; animation: fadeIn .6s var(--ease) both; }
.brand-mark {
    width: 38px; height: 38px; border-radius: 11px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
    color: #fff; font-weight: 700; font-size: 20px;
    display: grid; place-items: center;
    box-shadow: 0 6px 18px -4px rgba(99,102,241,.6);
    animation: floatPulse 5s ease-in-out infinite;
}
.brand-text { display: flex; flex-direction: column; font-weight: 700; color: #fff; line-height: 1.15; }
.brand-text small { font-weight: 400; font-size: 11px; color: #7d85a3; letter-spacing: .04em; }

.nav { padding: 8px; flex: 1; overflow-y: auto; }
.nav-link {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 13px; margin: 3px 0; border-radius: 11px;
    color: #c2c8de; font-weight: 500; position: relative;
    transition: transform .18s var(--ease), background .2s var(--ease), color .2s var(--ease);
    animation: slideInL .4s var(--ease) both;
}
.nav .nav-link:nth-child(1) { animation-delay: .03s; }
.nav .nav-link:nth-child(2) { animation-delay: .06s; }
.nav .nav-link:nth-child(3) { animation-delay: .09s; }
.nav .nav-link:nth-child(4) { animation-delay: .12s; }
.nav .nav-link:nth-child(5) { animation-delay: .15s; }
.nav .nav-link:nth-child(n+7) { animation-delay: .2s; }
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; transform: translateX(4px); text-decoration: none; }
.nav-link.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
    color: #fff; box-shadow: 0 8px 20px -8px rgba(99,102,241,.8);
}
.nav-link.active::before {
    content: ""; position: absolute; left: -8px; top: 18%; height: 64%; width: 4px;
    border-radius: 4px; background: #fff;
}
.nav-link .ico { width: 18px; text-align: center; opacity: .92; transition: transform .2s var(--spring); }
.nav-link:hover .ico { transform: scale(1.2); }
.nav-section { padding: 18px 13px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: #636b88; }

.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.07); animation: fadeIn .8s var(--ease) both; }
.user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; display: grid; place-items: center; font-weight: 700; box-shadow: 0 4px 12px -3px rgba(99,102,241,.6); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-meta strong { color: #fff; font-size: 13.5px; }
.user-meta small { color: #7d85a3; font-size: 11.5px; }
.user-link { text-decoration: none; }
.user-link:hover .user-meta strong { text-decoration: underline; }

.main { flex: 1; padding: 30px 34px; max-width: 1220px; animation: fadeIn .4s var(--ease) both; }

/* ---- Page header ------------------------------------------ */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; animation: fadeInUp .45s var(--ease) both; }
.page-head h1 { margin: 0; font-size: 23px; letter-spacing: -.02em; }
.page-head p { margin: 5px 0 0; color: var(--muted); max-width: 680px; }
.page-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* ---- Cards ------------------------------------------------- */
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); overflow: hidden;
    transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
    animation: fadeInUp .5s var(--ease) both;
}
.main > .card { animation-delay: .08s; }
.main > .card:nth-of-type(2) { animation-delay: .16s; }
.main > .card:nth-of-type(3) { animation-delay: .22s; }
.main > .card:nth-of-type(4) { animation-delay: .28s; }
.card:hover { box-shadow: var(--shadow-lg); border-color: #d9deef; transform: translateY(-2px); }
.card + .card { margin-top: 20px; }
.card-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.card-head h2 { margin: 0; font-size: 15px; }
.card-body { padding: 18px; }
.card-pad { padding: 18px; }

/* ---- Stat tiles ------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kind-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kind-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px; display: flex; flex-direction: column; text-align: left;
}
.kind-card .label { margin-bottom: 6px; }
.kind-card p { margin: 0 0 14px; font-size: 13px; flex: 1; }
.kind-card .filters { margin-top: auto; }
@media (max-width: 880px) { .kind-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .kind-grid { grid-template-columns: 1fr; } }

.holding-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 20px; }
.holding-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px; display: flex; flex-direction: column; gap: 12px;
    text-decoration: none; color: inherit; box-shadow: var(--shadow-sm);
    transition: transform .25s var(--spring), box-shadow .25s var(--ease);
    animation: popIn .45s var(--ease) both;
}
.holding-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.holding-card-hd { display: flex; align-items: center; gap: 12px; }
.holding-card-hd .name { font-weight: 700; font-size: 15.5px; line-height: 1.25; }
.holding-card-meta { font-size: 12px; color: var(--muted); margin-top: -6px; }
.holding-card-stats { display: flex; justify-content: space-between; gap: 10px; }
.holding-card-stats .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.holding-card-stats .value { font-size: 17px; font-weight: 700; margin-top: 3px; }
.holding-card-ft { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; }
.tile {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
    transition: transform .25s var(--spring), box-shadow .25s var(--ease);
    animation: popIn .55s var(--ease) both;
}
.tile::before {
    content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 0;
    background: linear-gradient(90deg, var(--primary), var(--primary-2));
    transition: width .4s var(--ease);
}
.tile:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.tile:hover::before { width: 100%; }
.tiles .tile:nth-child(1) { animation-delay: .05s; }
.tiles .tile:nth-child(2) { animation-delay: .11s; }
.tiles .tile:nth-child(3) { animation-delay: .17s; }
.tiles .tile:nth-child(4) { animation-delay: .23s; }
.tiles .tile:nth-child(5) { animation-delay: .29s; }
.tiles .tile:nth-child(6) { animation-delay: .35s; }
.tile .label { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; }
.tile .value { font-size: 25px; font-weight: 750; margin-top: 6px; letter-spacing: -.02em; }

/* ---- Tables ----------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); }
table.data tbody tr { transition: background .18s var(--ease), transform .18s var(--ease); animation: fadeInUp .4s var(--ease) both; }
table.data tbody tr:nth-child(1) { animation-delay: .04s; } table.data tbody tr:nth-child(2) { animation-delay: .08s; }
table.data tbody tr:nth-child(3) { animation-delay: .12s; } table.data tbody tr:nth-child(4) { animation-delay: .16s; }
table.data tbody tr:nth-child(5) { animation-delay: .2s; }  table.data tbody tr:nth-child(6) { animation-delay: .24s; }
table.data tbody tr:nth-child(7) { animation-delay: .28s; } table.data tbody tr:nth-child(8) { animation-delay: .32s; }
table.data tbody tr:nth-child(n+9) { animation-delay: .36s; }
table.data tbody tr:hover { background: linear-gradient(90deg, #f6f7ff, #fbf9ff); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* ---- Buttons ---------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 10px;
    border: 1px solid transparent; font-weight: 600; font-size: 13.5px; cursor: pointer;
    background: var(--surface-2); color: var(--text); position: relative; overflow: hidden;
    transition: transform .14s var(--ease), box-shadow .2s var(--ease), filter .2s var(--ease), background .2s var(--ease);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%); color: #fff; box-shadow: 0 6px 16px -6px rgba(99,102,241,.7); }
.btn-primary:hover { color: #fff; box-shadow: 0 10px 22px -6px rgba(99,102,241,.85); }
/* shine sweep on primary hover */
.btn-primary::after {
    content: ""; position: absolute; inset: 0; transform: translateX(-120%);
    background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
}
.btn-primary:hover::after { animation: shimmer .7s var(--ease); }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.18); color: #c2c8de; }
.btn-ghost:hover { background: rgba(255,255,255,.09); color: #fff; }
.btn-outline { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary-d); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger:hover { background: #fbdcdc; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }
.btn-link { background: none; border: none; color: var(--primary-d); padding: 4px 6px; cursor: pointer; font-weight: 600; }

/* ripple */
.ripple { position: absolute; border-radius: 50%; background: rgba(255,255,255,.5); width: 12px; height: 12px; margin: -6px 0 0 -6px; pointer-events: none; animation: ripple .6s var(--ease) forwards; }
.btn-outline .ripple, .btn-danger .ripple, .btn-sm .ripple { background: rgba(99,102,241,.25); }

/* ---- Forms ------------------------------------------------ */
.field { display: block; margin-bottom: 15px; }
.field-label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.field-hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
    font: inherit; color: var(--text); background: #fff;
    transition: border-color .18s var(--ease), box-shadow .2s var(--ease), transform .15s var(--ease);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,102,241,.14); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 18px; }
.form-grid .col-span { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.checkbox { display: flex; align-items: center; gap: 8px; }
.checkbox input { width: auto; }

/* ---- Alerts ----------------------------------------------- */
.alert { padding: 13px 16px; border-radius: 12px; margin-bottom: 18px; font-size: 13.5px; animation: flashIn .4s var(--spring) both; }
.alert-success { background: var(--green-bg); color: #0f5132; border: 1px solid #b6e6cf; }
.alert-error { background: var(--red-bg); color: #7f1d1d; border: 1px solid #f3c2c2; }
.alert-list { margin: 8px 0 0; padding-left: 18px; }

/* ---- Badges & amounts ------------------------------------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; transition: transform .15s var(--spring); }
tr:hover .badge { transform: scale(1.06); }
.badge-income { background: var(--green-bg); color: #0f5132; }
.badge-expense { background: var(--red-bg); color: #7f1d1d; }
.badge-transfer { background: #eef0ff; color: #3730a3; }
.badge-muted { background: #eef0f4; color: var(--muted); }
.amt-pos { color: var(--green); font-weight: 650; }
.amt-neg { color: var(--red); font-weight: 650; }
.muted { color: var(--muted); }
.tree-indent { color: #c2c6d2; }

/* ---- Filter bar ------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.filters .field { margin-bottom: 0; }
.filters .field-label { font-size: 11.5px; }
.filters select, .filters input { min-width: 140px; }

/* ---- Auth -------------------------------------------------- */
.auth-body { display: grid; place-items: center; min-height: 100vh;
    background: linear-gradient(135deg, #1e1b4b, #0b1020 55%, #2a1b4b);
    background-size: 200% 200%; animation: gradientShift 14s ease infinite; }
.auth-card { width: 366px; background: rgba(255,255,255,.97); border-radius: 18px; padding: 30px; box-shadow: 0 30px 70px rgba(0,0,0,.4); animation: popIn .5s var(--ease) both; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand h1 { font-size: 19px; margin: 0; display: flex; flex-direction: column; }
.auth-brand small { font-weight: 400; font-size: 11.5px; color: var(--muted); }
.error-code { font-size: 60px; font-weight: 800; background: linear-gradient(135deg, var(--primary), var(--primary-2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.error-message { color: var(--muted); margin: 8px 0 20px; }

/* ---- Split rows ------------------------------------------- */
.splits-table { width: 100%; border-collapse: collapse; }
.splits-table th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); text-align: left; padding: 0 8px 6px; }
.splits-table td { padding: 4px 8px 8px; vertical-align: top; }
.split-row { animation: fadeInUp .3s var(--ease) both; }
.split-sum { display: flex; gap: 18px; align-items: center; margin-top: 10px; font-weight: 600; }
.split-sum .ok { color: var(--green); }
.split-sum .bad { color: var(--red); }

[data-types] { transition: opacity .2s var(--ease); }

@media (max-width: 820px) {
    .sidebar { display: none; }
    .main { padding: 18px; }
    .form-grid { grid-template-columns: 1fr; }
}

/* ---- Payment cards (bank-app style) ----------------------- */
.paycard {
    position: relative; color: #fff; border-radius: 18px; padding: 22px;
    aspect-ratio: 1.586 / 1; max-width: 380px; width: 100%;
    display: flex; flex-direction: column; justify-content: space-between;
    box-shadow: 0 18px 40px -16px rgba(20,24,60,.55), inset 0 1px 0 rgba(255,255,255,.2);
    overflow: hidden; text-decoration: none; color: #fff;
    transition: transform .3s var(--spring), box-shadow .3s var(--ease);
    animation: popIn .5s var(--ease) both;
}
a.paycard:hover { transform: translateY(-6px) rotate(-.5deg) scale(1.015); box-shadow: 0 30px 60px -18px rgba(20,24,60,.6); color: #fff; text-decoration: none; }
.paycard-sheen { position: absolute; inset: 0; background:
    radial-gradient(130% 90% at 0% 0%, rgba(255,255,255,.28), transparent 48%),
    linear-gradient(125deg, rgba(255,255,255,.14), transparent 42%); pointer-events: none; }
.paycard > * { position: relative; z-index: 1; }
.paycard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.paycard-brand { display: flex; flex-direction: column; gap: 3px; }
.paycard-bank { font-weight: 700; font-size: 16px; text-shadow: 0 1px 2px rgba(0,0,0,.2); }
.paycard-logo { max-height: 30px; max-width: 130px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }
.paycard-kind { font-size: 10px; text-transform: uppercase; letter-spacing: .14em; opacity: .85; }
.paycard-bal { text-align: right; display: flex; flex-direction: column; }
.paycard-bal small { font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em; opacity: .8; }
.paycard-bal strong { font-size: 17px; }
.paycard-bal strong.neg { color: #ffd5d5; }
.paycard-chip { width: 44px; height: 33px; border-radius: 7px; background: linear-gradient(135deg, #f7d774, #cda23a); position: relative; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.paycard-chip::after { content: ""; position: absolute; inset: 6px 9px; border: 1px solid rgba(0,0,0,.2); border-radius: 3px; }
.paycard-number { font-size: 19px; letter-spacing: .14em; font-family: "Consolas","SF Mono",monospace; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.paycard-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.paycard-fields { display: flex; gap: 18px; }
.paycard-field small { display: block; font-size: 9px; text-transform: uppercase; letter-spacing: .1em; opacity: .75; }
.paycard-field span { font-size: 13px; font-weight: 600; text-transform: uppercase; }
.paycard-net { font-weight: 800; font-style: italic; font-size: 16px; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.paycard-inactive { position: absolute; top: 14px; right: 14px; background: rgba(0,0,0,.4); padding: 2px 9px; border-radius: 999px; font-size: 10px; z-index: 2; }

.paycard-photo { background-size: cover; background-position: center; background-repeat: no-repeat; }
.paycard-photo-overlay { position: absolute; left: 16px; bottom: 16px; z-index: 2; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.paycard-photo-number { font-size: 15px; letter-spacing: .12em; font-family: "Consolas","SF Mono",monospace; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.7); background: rgba(0,0,0,.4); backdrop-filter: blur(3px); border-radius: 8px; padding: 5px 11px; }
.paycard-bal-chip { background: rgba(0,0,0,.5); backdrop-filter: blur(3px); border-radius: 10px; padding: 6px 12px; }
.paycard-bal-chip small { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em; opacity: .85; color: #fff; }
.paycard-bal-chip strong { font-size: 16px; color: #fff; }
.paycard-bal-chip strong.neg { color: #ffd5d5; }

.paycard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 22px; align-items: start; }

.bank-fam { margin-bottom: 26px; padding: 16px 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(99,102,241,.035); }
.bank-fam-hd { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; padding-left: 2px; }
.bank-fam-name { font-size: 15px; font-weight: 750; color: var(--text); }
.bank-fam-name::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); margin-right: 9px; vertical-align: middle; }
.bank-fam-count { font-size: 12px; color: var(--muted); }
.paycard-grid-nested { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; padding-left: 18px; }
.paycard-grid-nested .paycard { max-width: 320px; }
.paycard-add {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    aspect-ratio: 1.586 / 1; max-width: 380px; width: 100%; border-radius: 18px;
    border: 2px dashed var(--line); color: var(--muted); background: rgba(255,255,255,.5);
    font-weight: 600; transition: all .25s var(--ease);
}
.paycard-add:hover { border-color: var(--primary); color: var(--primary-d); background: #fff; transform: translateY(-4px); text-decoration: none; }
.paycard-add .plus { font-size: 36px; line-height: 1; }

.ps-layout { display: flex; gap: 26px; align-items: flex-start; margin-bottom: 20px; flex-wrap: wrap; }
.ps-preview { width: 380px; flex-shrink: 0; position: sticky; top: 24px; }
@media (max-width: 880px) { .ps-preview { width: 100%; position: static; } }

.reveal { font-family: "Consolas", monospace; letter-spacing: .06em; }
.reveal-btn { margin-left: 8px; }

/* ---- Avatars & vendor cards ------------------------------- */
.avatar-badge { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 700; overflow: hidden; flex-shrink: 0; box-shadow: 0 4px 12px -4px rgba(0,0,0,.28); }
.avatar-badge img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 84px; height: 84px; font-size: 34px; margin: 0 auto; }

.vendor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.vendor-card { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s var(--ease); animation: fadeInUp .45s var(--ease) both; }
.vendor-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #d9deef; text-decoration: none; }
.vendor-card-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vendor-card-body strong { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vendor-card-spend { text-align: right; display: flex; flex-direction: column; }
.vendor-card-add { justify-content: center; color: var(--muted); border-style: dashed; gap: 8px; font-weight: 600; }
.vendor-card-add:hover { color: var(--primary-d); border-color: var(--primary); }
.vendor-card-add .plus { font-size: 24px; }

/* ---- New-transaction hub ---------------------------------- */
.hub-group-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 0 10px; font-weight: 700; }
.hub-group-label:first-of-type { margin-top: 8px; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.hub-tile { display: flex; align-items: center; gap: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease); animation: fadeInUp .4s var(--ease) both; }
.hub-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary); text-decoration: none; }
.hub-ico { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-size: 19px; flex-shrink: 0; color: #fff; }
.hub-in { background: linear-gradient(135deg, #10b981, #34d399); }
.hub-out { background: linear-gradient(135deg, #ef4444, #f87171); }
.hub-move { background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.hub-tile-body { display: flex; flex-direction: column; min-width: 0; }
.hub-tile-body strong { color: var(--text); }
.hub-tile-body small { color: var(--muted); font-size: 12px; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: middle; }
.tree-row { display: inline-flex; align-items: center; gap: 6px; }
.tree-toggle { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 11px; width: 20px; height: 20px; border-radius: 5px; transition: background .15s var(--ease), color .15s var(--ease); }
.tree-toggle:hover { background: var(--surface-2); color: var(--primary-d); }
.tree-spacer { display: inline-block; width: 20px; }
.child-count { font-size: 11px; background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 1px 8px; }
.vendor-head { display: flex; align-items: center; gap: 16px; }
.vendor-preview .avatar-lg { box-shadow: 0 10px 26px -8px rgba(0,0,0,.35); }

.mbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.mbar-label { width: 64px; font-size: 12.5px; color: var(--muted); flex-shrink: 0; }
.mbar-track { flex: 1; height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.mbar-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); animation: growBar .8s var(--ease) both; }
.mbar-val { width: 92px; text-align: right; font-size: 13px; font-weight: 600; color: var(--red); flex-shrink: 0; font-variant-numeric: tabular-nums; }
@keyframes growBar { from { width: 0; } }
.mbar-fill.mbar-red   { background: linear-gradient(90deg, var(--red), #fb7185); }
.mbar-fill.mbar-green { background: linear-gradient(90deg, var(--green), #34d399); }
.mbar-val.mbar-val-pos { color: var(--green); }

/* ---- Dashboard analytics --------------------------------- */
.tile-sub  { margin-top: 5px; font-size: 12px; color: var(--muted); }
.tile-unit { font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 2px; }

.chart { width: 100%; height: auto; display: block; margin: 6px 0 2px; overflow: visible; }
.chart-axis { fill: var(--muted); font-size: 11px; }
.chart-axis .yr { fill: var(--muted); opacity: .65; }
.chart-tag  { fill: var(--primary-d); font-size: 12px; font-weight: 700; }

.comp-row { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.comp-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.comp-chip strong { color: var(--text); }
.comp-chip .dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.dot-banks { background: var(--primary); }
.dot-investments { background: var(--green); }
.dot-cash { background: var(--amber); }
.dot-wallets { background: var(--primary-2); }
.dot-creditcards { background: var(--red); }

.legend { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.legend .lg { width: 11px; height: 11px; border-radius: 3px; display: inline-block; margin-left: 8px; }
.legend .lg-in  { background: var(--green); }
.legend .lg-out { background: var(--red); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
/* grid siblings must not inherit the stacked-card top margin (it offsets the 2nd card) */
.grid2 .card + .card { margin-top: 0; }
.grid2 .mbar-label { width: 124px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 880px) { .grid2 { grid-template-columns: 1fr; } }

.dash-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 20px;
    padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.df-group { display: inline-flex; align-items: center; gap: 8px; }
.df-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.df-select, .df-date {
    font: inherit; font-size: 13.5px; color: var(--text); background: var(--surface-2);
    border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; cursor: pointer;
}
.df-select:focus, .df-date:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.df-custom { gap: 6px; flex-wrap: wrap; }
.df-custom[hidden] { display: none; }
.df-date { max-width: 150px; }
.df-showing { margin-left: auto; font-size: 13px; color: var(--muted); }
.df-showing strong { color: var(--text); }
@media (max-width: 720px) { .df-showing { margin-left: 0; width: 100%; } }

.obligs { display: flex; flex-direction: column; gap: 10px; }
.oblig { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface-2); transition: transform .15s var(--ease), box-shadow .15s var(--ease); }
.oblig:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.oblig-k { font-size: 12.5px; color: var(--muted); }
.oblig-v { font-size: 21px; font-weight: 750; margin-top: 3px; letter-spacing: -.01em; }
.oblig-s { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---- Searchable select (type-to-search combobox) ---------- */
.ss-wrap { position: relative; }
select.ss-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ss-input { width: 100%; cursor: text; background-image: none; }
.ss-wrap::after {
    content: '▾'; position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    color: var(--muted); font-size: 11px; pointer-events: none;
}
.ss-panel {
    display: none; position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: 0;
    max-height: 260px; overflow-y: auto; background: var(--surface);
    border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 5px;
}
.ss-wrap.open .ss-panel { display: block; }
/* let an open dropdown escape the card's rounded-corner clip */
.card:has(.ss-wrap.open) { overflow: visible; }
.ss-option { padding: 8px 11px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--text); }
.ss-option:hover, .ss-option.active { background: var(--surface-2); }
.ss-option.selected { font-weight: 600; color: var(--primary-d); }
.ss-empty { padding: 9px 11px; color: var(--muted); font-size: 13px; }

/* ---- Recurring schedules (renewals / instalments): upcoming as cards, paid
   history as a table, editing a paid one as a native-dialog card. Shared by
   Subscriptions and Loans & EMI. -------------------------------------------- */
.ren-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.ren-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface-2); }
.ren-card-hd { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px dashed var(--line); }
.ren-card-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.ren-card-form .field { margin-bottom: 0; }
.ren-card-form .field-label { font-size: 11px; }

.ren-dialog { border: none; border-radius: var(--radius); padding: 0; width: 460px; max-width: 92vw;
    box-shadow: var(--shadow-lg); }
.ren-dialog::backdrop { background: rgba(15,23,42,.55); }
.ren-dialog-hd { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.ren-dialog-hd h3 { margin: 0; font-size: 15px; }
.ren-dialog-x { background: none; border: none; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 6px; }
.ren-dialog-x:hover { color: var(--text); }
.ren-dialog-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 18px; }
.ren-dialog-form .field { margin-bottom: 0; }
.ren-dialog-actions { grid-column: 1 / -1; display: flex; gap: 10px; margin-top: 4px; }

/* ---- Respect reduced-motion ------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
