@font-face {
  font-family: "Manrope"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(../fonts/manrope-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(../fonts/manrope-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Lavanda: svetla tema je podrazumevana */
:root {
  --bg: #f5f4fb;
  --surface: #ffffff;
  --surface2: #efedf8;
  --line: #eeebf6;
  --text: #1c1b2e;
  --muted: #7b7a93;
  --accent: #7b5cff;
  --accent-ink: #ffffff;
  --grad: linear-gradient(135deg, #7b5cff 0%, #b35cff 55%, #ff7eb3 100%);
  --grad-soft: linear-gradient(135deg, #f1ecff, #ffeef6);
  --exp: #f0517a;
  --inc: #12a874;
  --inc-bg: #e2f6ee;
  --exp-bg: #fde8ee;
  --warn: #f59e0b;
  --shadow: 0 6px 22px rgba(60, 50, 120, .07);
  --hero-shadow: 0 16px 34px rgba(123, 92, 255, .33);
  --nav: rgba(255, 255, 255, .94);
  --radius: 22px;
  --tabbar: 78px;
  /* "only" zabranjuje telefonu da sam zatamni aplikaciju */
  color-scheme: only light;
}
/* Lavanda noć */
:root[data-theme="dark"] {
  --bg: #100e1a;
  --surface: #1b1829;
  --surface2: #25213a;
  --line: #2a2640;
  --text: #f1eefc;
  --muted: #a29dbd;
  --accent: #9d84ff;
  --grad: linear-gradient(135deg, #6d4dff 0%, #a64dff 55%, #ff6fa8 100%);
  --grad-soft: linear-gradient(135deg, #241d40, #2d1c33);
  --exp: #ff6f93;
  --inc: #34d399;
  --inc-bg: rgba(52, 211, 153, .13);
  --exp-bg: rgba(255, 111, 147, .13);
  --warn: #fbbf24;
  --shadow: none;
  --hero-shadow: 0 14px 30px rgba(109, 77, 255, .35);
  --nav: rgba(27, 24, 41, .94);
  color-scheme: only dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #100e1a; --surface: #1b1829; --surface2: #25213a; --line: #2a2640; --text: #f1eefc; --muted: #a29dbd;
    --accent: #9d84ff; --grad: linear-gradient(135deg, #6d4dff 0%, #a64dff 55%, #ff6fa8 100%);
    --grad-soft: linear-gradient(135deg, #241d40, #2d1c33); --exp: #ff6f93; --inc: #34d399;
    --inc-bg: rgba(52, 211, 153, .13); --exp-bg: rgba(255, 111, 147, .13); --warn: #fbbf24; --shadow: none;
    --hero-shadow: 0 14px 30px rgba(109, 77, 255, .35); --nav: rgba(27, 24, 41, .94); color-scheme: only dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 500 15px/1.4 "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  overscroll-behavior-y: contain;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
b, strong { font-weight: 800; }
.muted { color: var(--muted); }
.exp { color: var(--exp); }
.inc { color: var(--inc); }
.small { font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }

#page {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 8px) 16px calc(var(--tabbar) + env(safe-area-inset-bottom) + 28px);
  min-height: 100%;
}

/* ---------- plutajuća donja traka ---------- */
#tabbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 12px);
  max-width: 536px; margin: 0 auto; height: 64px;
  display: grid; grid-template-columns: 1fr 1fr 76px 1fr 1fr; align-items: center;
  background: var(--nav);
  backdrop-filter: blur(14px);
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(30, 20, 70, .16);
  z-index: 10;
}
#tabbar a { display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 11px; font-weight: 700; color: var(--muted); padding: 6px 0; }
#tabbar a .ti { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#tabbar a.on .ti { stroke-width: 2.4; }
#fab svg { width: 28px; height: 28px; stroke: #fff; stroke-width: 2.8; stroke-linecap: round; fill: none; display: block; margin: auto; }
#tabbar a.on { color: var(--accent); }
#fab {
  justify-self: center; width: 58px; height: 58px; border-radius: 20px; border: 0;
  background: var(--grad); color: #fff; font-size: 34px; font-weight: 500; line-height: 1; margin-top: -30px;
  box-shadow: 0 10px 24px rgba(160, 92, 255, .42);
}
#fab:active { transform: scale(.93); }

/* ---------- osnovno ---------- */
.top { display: flex; align-items: center; justify-content: space-between; min-height: 50px; margin-bottom: 2px; }
.top h1 { font-size: 24px; margin: 0; font-weight: 800; letter-spacing: -.02em; }
.iconbtn { border: 0; background: var(--surface2); width: 40px; height: 40px; border-radius: 14px; font-size: 18px; display: grid; place-items: center; flex: none; }
.sheet .iconbtn { background: transparent; }
.iconbtn:active { filter: brightness(.95); }
.card { background: var(--surface); border-radius: var(--radius); padding: 14px; margin: 14px 0; box-shadow: var(--shadow); }
.card h2 { font-size: 15.5px; margin: 0 0 10px; font-weight: 800; letter-spacing: -.01em; }

/* kartica sa stanjem */
.balance {
  display: block; position: relative; overflow: hidden; margin: 8px 0 4px; padding: 18px 20px 16px;
  border-radius: 26px; background: var(--grad); color: #fff; box-shadow: var(--hero-shadow);
}
.balance::after { content: ""; position: absolute; right: -46px; top: -56px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255, 255, 255, .13); }
.balance::before { content: ""; position: absolute; right: 50px; bottom: -80px; width: 150px; height: 150px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.balance .l { font-size: 13px; font-weight: 700; opacity: .88; position: relative; }
.balance .v { font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin-top: 2px; position: relative; }
.balance .pills { display: flex; gap: 10px; margin-top: 12px; position: relative; }
.balance .pills div { flex: 1; background: rgba(255, 255, 255, .18); border-radius: 14px; padding: 8px 11px; font-size: 11.5px; font-weight: 700; }
.balance .pills em { display: block; font-style: normal; font-size: 15px; font-weight: 800; margin-top: 1px; }

.hero { text-align: center; padding: 6px 0 2px; }
.hero .lbl { color: var(--muted); font-size: 13px; font-weight: 700; }
.hero .big { font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.hero .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.blur { filter: blur(9px); }

.seg { display: flex; background: var(--surface2); border-radius: 15px; padding: 4px; gap: 4px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 6px; border-radius: 11px; color: var(--muted); font-weight: 700; font-size: 14px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 2px 10px rgba(40, 30, 90, .1); }
.seg.e button.on[data-v="e"] { color: var(--exp); }
.seg.i button.on[data-v="i"] { color: var(--inc); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 0; background: var(--surface); box-shadow: var(--shadow); border-radius: 12px; padding: 8px 13px; font-size: 13.5px; font-weight: 700; white-space: nowrap; color: var(--text); }
.card .chip { background: transparent; box-shadow: none; color: var(--muted); }
.chip.on, .card .chip.on { background: var(--accent); color: #fff; box-shadow: 0 6px 14px rgba(123, 92, 255, .28); }
.chips.fit .chip { flex: 1; padding: 7px 2px; text-align: center; }

.pnav { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.pnav .lbl { font-weight: 800; }
.pnav button { border: 0; background: var(--surface2); width: 34px; height: 34px; border-radius: 11px; font-size: 18px; }
.pnav button:disabled { opacity: .3; }

.dn { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.donut { position: relative; width: 136px; height: 136px; flex: none; }
.donut svg { width: 136px; height: 136px; transform: rotate(-90deg); display: block; }
.dn .t { min-width: 0; }
.dn .t b { display: block; font-size: 24px; letter-spacing: -.03em; line-height: 1.15; }
.dn .t span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.pill { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 800; padding: 5px 9px; border-radius: 9px; line-height: 1.3; }
.pill.good { color: var(--inc); background: var(--inc-bg); }
.pill.bad { color: var(--exp); background: var(--exp-bg); }
.pill.neutral { color: var(--muted); background: var(--surface2); }

.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.row:last-child { border-bottom: 0; }
.row:active { background: var(--surface2); }
.row .ic { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-size: 20px; flex: none; }
.row .tx { flex: 1; min-width: 0; }
.row .tx .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .tx .s { color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .amt { text-align: right; font-weight: 800; white-space: nowrap; }
.row .amt .s { color: var(--muted); font-size: 12px; font-weight: 700; }
.bar { height: 6px; border-radius: 4px; background: var(--surface2); margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; }

.daygrp { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); padding: 16px 4px 2px; font-weight: 800; }

.banner { display: flex; gap: 10px; align-items: center; background: var(--surface); box-shadow: var(--shadow); border-left: 4px solid var(--warn); border-radius: 18px; padding: 11px 12px; margin: 12px 0; font-size: 14px; }
.banner.report { border-left: 0; background: var(--grad-soft); }
.banner .grow { flex: 1; }
.banner button { border: 0; background: var(--surface2); border-radius: 11px; padding: 8px 11px; font-weight: 800; font-size: 13px; }
.banner button.pri { background: var(--grad); color: #fff; }

.btn { border: 0; border-radius: 16px; padding: 14px 16px; font-weight: 800; font-size: 15.5px; background: var(--surface2); width: 100%; }
.btn.pri { background: var(--grad); color: #fff; box-shadow: 0 8px 20px rgba(150, 92, 255, .3); }
.btn.danger { background: var(--exp-bg); color: var(--exp); }
.btn:disabled { opacity: .45; }
.btnrow { display: flex; gap: 10px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.actions button { border: 0; background: var(--surface); box-shadow: var(--shadow); border-radius: 18px; padding: 13px; font-weight: 800; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.actions button span { font-size: 22px; color: var(--accent); }

.menu .row .ic { background: var(--grad-soft); }
.menu .row .chev { color: var(--muted); }

.search { width: 100%; border: 0; background: var(--surface); box-shadow: var(--shadow); border-radius: 15px; padding: 13px 15px; outline: none; }
.search:focus { box-shadow: 0 0 0 2px var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; font-weight: 600; }
.empty .e { font-size: 40px; }

/* ---------- prozori (sheet) ---------- */
.sheet { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet .scrim { position: absolute; inset: 0; background: rgba(20, 14, 40, .45); animation: fade .18s; }
.sheet .panel {
  position: relative; background: var(--bg); width: 100%; max-width: 560px; margin: 0 auto;
  max-height: 92dvh; border-radius: 26px 26px 0 0; display: flex; flex-direction: column;
  animation: up .22s cubic-bezier(.2, .8, .2, 1); padding-bottom: env(safe-area-inset-bottom);
}
.sheet.full .panel { max-height: none; height: 100dvh; border-radius: 0; padding-top: env(safe-area-inset-top); }
.sheet .hd { display: flex; align-items: center; gap: 6px; padding: 8px 8px 4px; min-height: 54px; }
.sheet .hd h3 { flex: 1; margin: 0; font-size: 17px; font-weight: 800; }
.sheet .bd { overflow-y: auto; padding: 4px 16px 16px; flex: 1; }
.sheet .ft { padding: 8px 16px 12px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.field { margin: 12px 0; }
.field label, .lbl2 { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 700; }
.input { width: 100%; border: 1.5px solid transparent; background: var(--surface); box-shadow: var(--shadow); border-radius: 14px; padding: 12px 14px; outline: none; }
.input:focus { border-color: var(--accent); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-weight: 700; }
.switch input { width: 48px; height: 28px; appearance: none; background: var(--surface2); border-radius: 14px; position: relative; flex: none; transition: .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); transition: .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { left: 23px; }
.switch .h { font-size: 12.5px; color: var(--muted); font-weight: 600; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatches button { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; }
.swatches button.on { border-color: var(--text); }
.emojis { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emojis button { aspect-ratio: 1; border: 1.5px solid transparent; background: var(--surface); border-radius: 12px; font-size: 21px; padding: 0; }
.emojis button.on { border-color: var(--accent); background: var(--grad-soft); }

/* ---------- unos transakcije ---------- */
.entry .bd { display: flex; flex-direction: column; gap: 10px; padding-top: 0; }
.entry .bd > * { flex: none; }
.entry .hd .seg { flex: 1; }
.amountbox { display: flex; align-items: baseline; justify-content: center; gap: 8px; padding: 6px 0 0; }
.amountbox .v { font-size: 42px; font-weight: 800; letter-spacing: -.03em; min-height: 54px; }
.amountbox.expr { color: var(--muted); font-size: 13px; min-height: 18px; padding: 0; font-weight: 700; }
.amountbox .cur { border: 0; background: var(--surface2); border-radius: 11px; padding: 5px 11px; font-weight: 800; color: var(--muted); }
.entry.e .amountbox .v { color: var(--exp); }
.entry.i .amountbox .v { color: var(--inc); }
.catgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 6px; }
.catgrid button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 4px 0; font-size: 11.5px; font-weight: 700; color: var(--muted); min-width: 0; }
.catgrid button .ic { width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center; font-size: 24px; transition: transform .12s, box-shadow .12s; }
.catgrid button span:last-child { width: 100%; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.catgrid button.on { color: var(--text); }
.catgrid button.on .ic { transform: scale(1.08); box-shadow: 0 0 0 3px var(--bg), 0 0 0 5.5px var(--accent); }
.pickrow { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.pickrow::-webkit-scrollbar { display: none; }
.keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.keypad button { border: 0; background: var(--surface); box-shadow: var(--shadow); border-radius: 14px; height: 46px; font-size: 21px; font-weight: 700; }
.keypad button:active { background: var(--surface2); }
.keypad button.op { color: var(--accent); background: var(--grad-soft); }
.entry .ft { display: flex; flex-direction: column; gap: 8px; }

/* ---------- grafikoni ---------- */
.chart { width: 100%; overflow-x: auto; }
.chart svg { display: block; }
.chart text { fill: var(--muted); font-size: 10px; font-weight: 700; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin-top: 6px; font-weight: 700; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t td, table.t th { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; font-weight: 700; }
table.t th { color: var(--muted); font-size: 12px; }
table.t td:first-child, table.t th:first-child { text-align: left; }

/* ---------- mesečni izveštaj ---------- */
.rep-hero { border-radius: 26px; padding: 20px; background: var(--grad); color: #fff; box-shadow: var(--hero-shadow); position: relative; overflow: hidden; }
.rep-hero::after { content: ""; position: absolute; right: -40px; top: -50px; width: 170px; height: 170px; border-radius: 50%; background: rgba(255, 255, 255, .13); }
.rep-hero .l { font-weight: 700; opacity: .88; font-size: 13px; }
.rep-hero .v { font-size: 34px; font-weight: 800; letter-spacing: -.03em; }
.rep-hero .s { font-weight: 700; font-size: 13.5px; opacity: .92; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.stat { background: var(--surface); box-shadow: var(--shadow); border-radius: 18px; padding: 12px 13px; }
.stat .l { font-size: 12px; color: var(--muted); font-weight: 700; }
.stat .v { font-size: 18px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.stat .s { font-size: 12px; font-weight: 700; margin-top: 2px; }
.insight { display: flex; gap: 12px; align-items: flex-start; padding: 10px 2px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.insight:last-child { border-bottom: 0; }
.insight .e { font-size: 20px; width: 28px; text-align: center; flex: none; }

/* ---------- poruke ---------- */
#toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 18px); transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: #1c1b2e; color: #fff; border-radius: 14px; padding: 11px 15px; font-weight: 700; font-size: 14px; display: flex; gap: 14px; align-items: center; transition: .2s; z-index: 50; max-width: calc(100% - 32px); box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
#toast.show { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
#toast button { border: 0; background: none; color: #c4b5ff; font-weight: 800; padding: 0; }
.dialog .panel { border-radius: 24px; margin-bottom: 30vh; width: calc(100% - 32px); }
.dialog .bd p { margin: 4px 0 8px; }

.welcome { padding-top: 12vh; text-align: center; }
.welcome .logo { width: 88px; height: 88px; border-radius: 26px; margin: 0 auto 16px; display: block; box-shadow: var(--hero-shadow); }
.welcome h1 { margin: 0 0 6px; font-weight: 800; font-size: 28px; }
.welcome p { color: var(--muted); margin: 0 0 26px; }
.welcome .btn { margin-bottom: 10px; }
