:root {
    /* Volksbank-/VR-inspirierte Markenwelt */
    --orange:  #ec6608;
    --orange2: #cf580a;
    --orangeS: #fdf1e7;
    --ink:     #1c2733;   /* Anthrazit-Text */
    --bg:      #f3f5f8;
    --surface: #ffffff;
    --surface2:#f7f9fc;
    --line:    #e5e9f0;
    --line2:   #eef1f6;
    --text:    #1c2733;
    --muted:   #6b7787;
    --muted2:  #9aa5b4;
    --primary: #ec6608;
    --primary2:#cf580a;
    --primaryS:#fdf1e7;
    --blue:    #15457a;   /* seriöses Dunkelblau als Zweitfarbe */
    --green:   #1a8a4f;
    --green-bg:#e8f6ee;
    --red:     #cf2e2e;
    --red-bg:  #fbeaea;
    --amber:   #d97706;
    --indigo:  #15457a;

    --r-lg: 16px;
    --r-md: 12px;
    --r-sm: 9px;

    --sh-sm: 0 1px 2px rgba(28,39,51,.06), 0 1px 3px rgba(28,39,51,.05);
    --sh-md: 0 4px 14px rgba(28,39,51,.08);
    --sh-lg: 0 18px 44px rgba(28,39,51,.16);
    --sh-card: 0 10px 24px rgba(21,69,122,.22);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    padding-bottom: 96px;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
/* Markenstreifen ganz oben */
body::before { content: ""; display: block; height: 4px; background: linear-gradient(90deg, var(--orange), #f59331); }
h1,h2,h3,h4 { font-weight: 700; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
code { background: var(--surface2); border:1px solid var(--line); padding: 2px 7px; border-radius: 6px; font-size: .85em; }
hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }

/* ============ LOGIN ============ */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 20px;
    background:
        radial-gradient(900px 420px at 50% -120px, #fbe4d2 0%, transparent 70%),
        linear-gradient(165deg, #ffffff 0%, #eef1f6 100%);
}
.login-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 20px; padding: 42px 34px 34px; width: 100%; max-width: 400px;
    box-shadow: var(--sh-lg); text-align: center; position: relative; overflow: hidden;
}
.login-card::before { content:""; position:absolute; top:0; left:0; right:0; height:5px; background: linear-gradient(90deg, var(--orange), #f59331); }
.login-logo {
    width: 66px; height: 66px; margin: 0 auto 14px; border-radius: 18px;
    display: grid; place-items: center; font-size: 32px;
    background: linear-gradient(135deg, var(--orange), #f59331);
    box-shadow: 0 10px 22px rgba(236,102,8,.35);
}
.login-card h1 { margin: 6px 0 2px; font-size: 1.35rem; }
.login-card .muted { margin-top: 0; }
.login-card label { text-align: left; }
.login-foot { margin-top: 18px; font-size: .78rem; color: var(--muted2); display: flex; align-items: center; justify-content: center; gap: 6px; }
.alert { background: var(--red-bg); border: 1px solid #f0b9b9; color: #9c2020; padding: 11px 14px; border-radius: var(--r-sm); margin: 14px 0; font-size: .9rem; }

/* ============ FORMS ============ */
label { display: block; margin: 14px 0; font-size: .85rem; font-weight: 500; color: var(--muted); }
input, select, button { font: inherit; }
input, select {
    display: block; width: 100%; margin-top: 7px;
    padding: 12px 13px; border-radius: var(--r-sm);
    border: 1px solid var(--line); background: var(--surface); color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--muted2); }
input[type=color] { padding: 4px; height: 46px; cursor: pointer; }
input:focus, select:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(236,102,8,.15); }

button { cursor: pointer; border: none; border-radius: var(--r-sm); transition: background .15s, transform .08s, box-shadow .15s; }
button:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; padding: 12px 18px; font-weight: 600; width: 100%; box-shadow: 0 4px 12px rgba(236,102,8,.28); }
.btn-primary:hover { background: var(--primary2); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line); padding: 9px 13px; font-weight: 500; box-shadow: var(--sh-sm); }
.btn-ghost:hover { background: var(--surface2); border-color: var(--muted2); }
.row { display: flex; gap: 12px; }
.row label { flex: 1; }

/* ============ TOPBAR (weiß, seriös) ============ */
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 13px 22px;
    background: var(--surface); color: var(--text);
    position: sticky; top: 0; z-index: 50;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 10px rgba(28,39,51,.05);
}
.brand { font-size: 1.1rem; font-weight: 800; display: flex; gap: 11px; align-items: center; letter-spacing: -.02em; color: var(--ink); }
.brand::before {
    content: "🏦"; display: grid; place-items: center;
    width: 40px; height: 40px; border-radius: 11px; font-size: 19px;
    background: linear-gradient(135deg, var(--orange), #f59331);
    box-shadow: 0 4px 10px rgba(236,102,8,.3);
}
.brand span { line-height: 1; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.hi { color: var(--muted); font-size: .9rem; }
.hi b { color: var(--ink); }
.topbar .btn-ghost { line-height: 1; padding: 9px 12px; text-decoration: none; color: var(--ink); }

/* ============ LAYOUT (Sidebar + Inhalt) ============ */
.layout { display: flex; align-items: flex-start; max-width: 1180px; margin: 0 auto; }

.tabs {
    display: flex; flex-direction: column; gap: 4px;
    width: 234px; flex-shrink: 0;
    padding: 18px 14px;
    background: var(--surface); border-right: 1px solid var(--line);
    position: sticky; top: 66px; align-self: flex-start;
    height: calc(100vh - 66px); overflow-y: auto; scrollbar-width: thin;
    z-index: 40;
}
.tab {
    display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
    background: transparent; color: var(--muted); padding: 11px 14px;
    border-radius: 11px; white-space: nowrap; font-weight: 600; font-size: .92rem;
    border: 1px solid transparent;
}
.tab .ico { font-size: 1.12rem; width: 22px; text-align: center; flex-shrink: 0; }
.tab:hover { background: var(--surface2); color: var(--ink); }
.tab.active { background: var(--orange); color: #fff; box-shadow: 0 4px 12px rgba(236,102,8,.3); }

.container { flex: 1; min-width: 0; max-width: 920px; margin: 0 auto; padding: 24px 22px; }
.view { display: none; }
.view.active { display: block; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px);} to {opacity:1; transform:none;} }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; margin: 18px 0; box-shadow: var(--sh-sm); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.panel-head h3 { margin: 0; font-size: 1rem; }

/* ============ MONTH BAR ============ */
.month-bar { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 4px 0 10px; }
.month-bar h2 { margin: 0; min-width: 200px; text-align: center; font-size: 1.25rem; text-transform: capitalize; }
.month-bar .btn-ghost { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 1.3rem; padding: 0; }

/* ============ GESAMTVERMÖGEN-HERO ============ */
.hero {
    background: linear-gradient(120deg, #15294a 0%, #1f3c66 100%);
    color: #fff; border-radius: var(--r-lg); padding: 24px 26px; margin: 6px 0 4px;
    box-shadow: var(--sh-md); position: relative; overflow: hidden;
}
.hero::after { content:""; position:absolute; right:-34px; top:-34px; width:170px; height:170px; border-radius:50%; background: rgba(236,102,8,.20); }
.hero::before { content:""; position:absolute; right:60px; bottom:-50px; width:120px; height:120px; border-radius:50%; background: rgba(255,255,255,.05); }
.hero-label { font-size:.76rem; text-transform:uppercase; letter-spacing:.7px; opacity:.82; font-weight:700; }
.hero-amount { font-size:2.3rem; font-weight:800; letter-spacing:-.02em; margin-top:4px; font-variant-numeric:tabular-nums; line-height:1.1; }
.hero-sub { font-size:.82rem; opacity:.85; margin-top:6px; }

/* ============ ACCOUNT CARDS ============ */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px,1fr)); gap: 16px; margin: 16px 0; }
.acct-card {
    border-radius: var(--r-lg); padding: 20px; color: #fff;
    box-shadow: var(--sh-card); position: relative; overflow: hidden; min-height: 128px;
    display: flex; flex-direction: column; justify-content: space-between;
}
.acct-card::after {
    content: ""; position: absolute; top: -40px; right: -40px;
    width: 150px; height: 150px; border-radius: 50%;
    background: rgba(255,255,255,.12);
}
.acct-card::before {
    content: ""; position: absolute; left: 20px; top: 54px;
    width: 36px; height: 26px; border-radius: 5px;
    background: linear-gradient(135deg, rgba(255,255,255,.9), rgba(255,255,255,.5));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.3);
}
.acct-card .tag { font-size: .66rem; font-weight: 700; opacity: .9; text-transform: uppercase; letter-spacing: 1.2px; }
.acct-card .name { font-size: .95rem; opacity: .96; font-weight: 600; margin-top: auto; }
.acct-card .bal { font-size: 1.6rem; font-weight: 800; margin-top: 2px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.acct-card .asof { font-size: .68rem; opacity: .82; margin-top: 3px; font-weight: 500; }

/* ============ KPIs ============ */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 14px; margin: 16px 0; }
.kpi {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
    padding: 16px 16px 16px 18px; box-shadow: var(--sh-sm); position: relative; overflow: hidden;
}
.kpi::before { content:""; position:absolute; left:0; top:0; bottom:0; width:4px; background: var(--muted2); }
.kpi span { color: var(--muted); font-size: .76rem; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; display: block; }
.kpi b { font-size: 1.45rem; font-weight: 800; display: block; margin-top: 5px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi.income::before { background: var(--green); } .kpi.income b { color: var(--green); }
.kpi.expense::before { background: var(--red); }  .kpi.expense b { color: var(--red); }
.kpi.net::before { background: var(--blue); }     .kpi.net b { color: var(--blue); }
.kpi.budget::before { background: var(--amber); } .kpi.budget b { color: var(--amber); }

/* ============ ACTIVITY / TRANSACTIONS ============ */
.activity, .txn-list { display: flex; flex-direction: column; }
.txn {
    display: flex; align-items: center; gap: 13px; padding: 13px 6px;
    border-bottom: 1px solid var(--line2);
}
.txn:last-child { border-bottom: none; }
.txn .icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 1.2rem; flex-shrink: 0; }
.txn .info { flex: 1; min-width: 0; }
.txn .info .desc { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn .info .meta { color: var(--muted); font-size: .8rem; }
.txn .amt { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.txn .amt.income { color: var(--green); }
.txn .amt.expense { color: var(--red); }
.txn .amt.transfer { color: var(--blue); }
.txn .del { opacity: 0; color: var(--muted2); background: none; border: none; font-size: 1.05rem; padding: 4px 7px; border-radius: 8px; transition: .15s; }
.txn:hover { background: var(--surface2); border-radius: 10px; }
.txn:hover .del { opacity: 1; }
.txn .del:hover { color: var(--red); background: var(--red-bg); }
.empty { color: var(--muted); text-align: center; padding: 34px 10px; font-size: .92rem; }

/* Vorgemerkte Buchungen (aus Daueraufträgen) */
.txn.pending { background: repeating-linear-gradient(135deg, var(--orangeS), var(--orangeS) 10px, #fdf6ef 10px, #fdf6ef 20px); border-radius: 10px; border-bottom: 1px solid var(--line2); }
.txn.pending .amt { opacity: .85; }
.badge-pending {
    display: inline-block; font-size: .64rem; font-weight: 700; letter-spacing: .4px;
    text-transform: uppercase; color: var(--orange2); background: #fff;
    border: 1px solid #f3c89f; padding: 1px 7px; border-radius: 999px; margin-left: 6px; vertical-align: middle;
}

/* ============ BUDGETS ============ */
.budget-list { display: flex; flex-direction: column; gap: 12px; }
.budget-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; box-shadow: var(--sh-sm); }
.budget-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
.budget-top .left { display: flex; gap: 9px; align-items: center; font-weight: 600; }
.budget-top .right { font-size: .9rem; color: var(--muted); }
.budget-top .right .left-amt { font-weight: 800; color: var(--green); }
.bar { height: 9px; border-radius: 6px; background: var(--line); overflow: hidden; }
.bar > div { height: 100%; border-radius: 6px; transition: width .4s ease; }
.over { color: var(--red); font-weight: 700; }
.add-cat { margin-top: 16px; }

/* ============ CATEGORY MANAGE ============ */
.cat-manage { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; margin-bottom: 12px; }
.cat-row { display: flex; align-items: center; gap: 10px; padding: 8px 9px; border-radius: var(--r-sm); cursor: pointer; transition: background .12s; }
.cat-row:hover { background: var(--surface2); }
.cat-row .grow { flex: 1; font-weight: 500; }
.cat-row .cat-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.cat-row button { background: none; color: var(--muted2); padding: 4px 6px; font-size: .95rem; }
.cat-row button:hover { color: var(--orange); }
.cat-row [data-delcat]:hover { color: var(--red); }
.chip { font-size: .72rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--line); color: var(--muted); }

/* ============ FAB ============ */
.fab {
    position: fixed; right: 24px; bottom: 24px; width: 62px; height: 62px;
    border-radius: 50%; background: linear-gradient(135deg, var(--orange), #f59331); color: #fff; font-size: 2rem;
    box-shadow: 0 12px 26px rgba(236,102,8,.45); z-index: 60; line-height: 1;
}
.fab:hover { transform: scale(1.06); box-shadow: 0 16px 32px rgba(236,102,8,.5); }

/* ============ MODAL ============ */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(28,39,51,.42); backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-overlay.open { display: flex; animation: fade .18s ease; }
.modal {
    background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
    padding: 24px; width: 100%; max-width: 460px; max-height: 92vh; overflow-y: auto;
    box-shadow: var(--sh-lg);
}
.modal h3 { margin-top: 0; font-size: 1.18rem; }
.modal h4 { margin: 6px 0; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; }
.modal-actions { display: flex; gap: 11px; margin-top: 18px; }
.modal-actions button { flex: 1; }

.type-switch { display: flex; gap: 0; margin: 14px 0; background: var(--surface2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 4px; }
.type-switch button { flex: 1; background: transparent; color: var(--muted); padding: 9px; font-weight: 600; font-size: .85rem; border-radius: 7px; }
.type-switch button.active { background: var(--surface); color: var(--orange); box-shadow: var(--sh-sm); }

.filters { display: flex; gap: 11px; flex-wrap: wrap; margin-bottom: 4px; }
.filters select, .filters input { width: auto; flex: 1; min-width: 130px; margin: 0; box-shadow: var(--sh-sm); }

/* ============ TOAST ============ */
.toast {
    position: fixed; bottom: 104px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: var(--ink); color: #fff; padding: 13px 22px; border-radius: 12px; font-weight: 500;
    box-shadow: var(--sh-lg); opacity: 0; pointer-events: none; transition: .28s cubic-bezier(.2,.8,.2,1); z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }

/* ============ FOOTER (Vertrauen) ============ */
.app-foot {
    max-width: 960px; margin: 10px auto 0; padding: 18px;
    color: var(--muted2); font-size: .78rem; text-align: center;
    display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap;
}
.app-foot .sep { opacity: .5; }

/* Tablet/Handy: Seitenleiste -> obere, scrollbare Tab-Leiste */
@media (max-width: 860px) {
    .layout { display: block; }
    .tabs {
        flex-direction: row; width: auto; height: auto;
        position: sticky; top: 65px; align-self: auto;
        border-right: none; border-bottom: 1px solid var(--line);
        overflow-x: auto; overflow-y: hidden; padding: 10px 12px; gap: 6px;
        scrollbar-width: none;
    }
    .tabs::-webkit-scrollbar { display: none; }
    .tab { width: auto; border-radius: 999px; padding: 9px 14px; font-size: .88rem; }
    .container { max-width: 960px; padding: 20px 16px; }
}

@media (max-width: 560px) {
    body { font-size: 14px; }
    .container { padding: 16px 12px; }
    .hi { display: none; }
    .kpi b { font-size: 1.25rem; }
    .hero-amount { font-size: 1.9rem; }
    .month-bar h2 { min-width: 150px; font-size: 1.1rem; }
}
