/* =========================================================================
   Budget: dizajn sustav
   Crno / bijelo / sivo, jedna plava za naglasak. Bez sjena (osim aktivnog
   segmentiranog taba) i bez gradijenata.
   ========================================================================= */

:root {
  --bg: #F4F4F5;
  --card: #FFFFFF;
  --line: #E4E4E7;
  --text: #0A0A0A;
  --text-2: #3F3F46;
  --muted: #71717A;
  --blue: #2563EB;
  --blue-soft: #EEF3FE;
  --green: #16A34A;
  --orange: #D97706;
  --red: #DC2626;
  --g900: #18181B;
  --g700: #3F3F46;
  --g500: #71717A;
  --g400: #A1A1AA;
  --g300: #D4D4D8;
  --g200: #E4E4E7;
  --g100: #F4F4F5;

  --radius: 16px;
  --radius-btn: 10px;
  --radius-modal: 18px;
  --gap: 16px;
  --sidebar: 232px;
  --tabbar: 64px;

  --font: "Familjen Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

.num, .amount, td.r, .kpi-value, .hero-value { font-variant-numeric: tabular-nums; }

.icon {
  font-family: "Material Symbols Rounded";
  font-weight: 400;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
  font-feature-settings: "liga";
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  user-select: none;
  flex-shrink: 0;
}
.icon.filled { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }

/* ---------- Tipografija ---------- */
.page-title { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.page-subtitle { color: var(--muted); margin-top: 4px; }
.card-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; }
.label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 13px; }

/* =========================================================================
   Raspored
   ========================================================================= */
.shell { min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar);
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 20px 14px;
  overflow-y: auto;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--text); color: #fff;
  display: grid; place-items: center;
}
.brand-mark .icon { font-size: 18px; }
.brand-name { font-size: 20px; font-weight: 900; letter-spacing: -0.04em; }

.nav-group { margin-bottom: 18px; }
.nav-group .label { padding: 0 10px 8px; display: block; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px; margin-bottom: 2px;
  border-radius: 10px;
  color: var(--text-2); font-weight: 500;
}
.nav-item:hover { background: var(--g100); color: var(--text); }
.nav-item.active { background: var(--text); color: #fff; }
.nav-item .icon { font-size: 20px; }

.sidebar-note {
  margin-top: auto;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; font-size: 12.5px; color: var(--muted); line-height: 1.4;
}
.sidebar-note strong { display: block; color: var(--text); font-size: 13px; margin-bottom: 2px; }

.main {
  margin-left: var(--sidebar);
  padding: 28px 32px 48px;
  max-width: calc(1200px + var(--sidebar));
}

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin-bottom: 24px;
}
.page-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.grid { display: grid; gap: var(--gap); }
.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)); }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }

/* Mobilne trake */
.topbar, .tabbar { display: none; }

/* =========================================================================
   Komponente
   ========================================================================= */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card.flush { padding: 0; }
.card.flush .card-head { padding: 20px 20px 0; }

/* Hero */
.hero {
  background: var(--text); color: #fff; border-color: var(--text);
  padding: 24px;
}
.hero .label { color: #A1A1AA; }
.hero-value { font-size: 44px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; margin: 8px 0 18px; }
.hero-meta { display: flex; gap: 0; }
.hero-meta > div { padding-right: 20px; margin-right: 20px; border-right: 1px solid #3F3F46; }
.hero-meta > div:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
.hero-meta .v { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.hero-actions { display: flex; gap: 10px; margin-top: 20px; }

/* KPI */
.kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; margin: 8px 0 4px; }
.kpi-value.lg { font-size: 38px; }
.kpi-desc { font-size: 13px; color: var(--muted); }

/* Pločice unutar kartice, odvojene okomitim linijama */
.tiles { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.tiles > * { padding: 0 20px; border-left: 1px solid var(--line); min-width: 0; }
.tiles > *:first-child { padding-left: 0; border-left: 0; }
.tiles > *:last-child { padding-right: 0; }

/* Gumbi */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 14px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--line);
  background: var(--card); color: var(--text);
  font-weight: 600; font-size: 14px; white-space: nowrap;
}
.btn:hover { border-color: var(--g300); }
.btn .icon { font-size: 18px; }
.btn-primary { background: var(--text); color: #fff; border-color: var(--text); }
.btn-primary:hover { background: #27272A; border-color: #27272A; }
.btn-blue { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-light { background: #fff; color: var(--text); border-color: #fff; }
.btn-dark { background: #27272A; color: #fff; border-color: #27272A; }
.btn-danger { color: var(--red); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-icon {
  width: 30px; height: 30px; padding: 0;
  border-radius: 8px; border: 1px solid var(--line); background: var(--card);
  display: inline-grid; place-items: center; color: var(--text-2);
}
.btn-icon:hover { color: var(--text); border-color: var(--g300); }
.btn-icon .icon { font-size: 18px; }
.btn-ghost { border-color: transparent; background: transparent; }

/* Status spremanja */
.save-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card);
  font-size: 13px; color: var(--text-2); white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--g400); flex-shrink: 0; display: inline-block; }
.dot.green { background: var(--green); }
.dot.orange { background: var(--orange); }
.dot.red { background: var(--red); }
.dot.blue { background: var(--blue); }
.status { display: inline-flex; align-items: center; gap: 7px; }

/* Segmentirani tabovi */
.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--g100); border-radius: 10px;
}
.segmented button {
  border: 0; background: transparent; height: 32px; padding: 0 14px;
  border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--muted);
}
.segmented button.active { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.segmented.block { display: flex; }
.segmented.block button { flex: 1; }

/* Chipovi */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  font-size: 13.5px; font-weight: 500; white-space: nowrap; color: var(--text-2);
}
.chip.active { background: var(--text); border-color: var(--text); color: #fff; }
.chip .icon { font-size: 16px; }

/* Polja */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > .label { color: var(--muted); }
.input, .select, textarea.input {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius-btn);
  background: #fff; font-size: 16px; /* 16px sprječava zoom na iOS-u */
  outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.select {
  appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2371717A' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input-money { position: relative; }
.input-money .input { padding-right: 34px; font-variant-numeric: tabular-nums; }
.input-money::after { content: "€"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.form-error { color: var(--red); font-size: 13.5px; margin-bottom: 12px; }

/* Tablice */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); padding: 0 12px 10px; white-space: nowrap;
}
.table td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table .r { text-align: right; }

/* Popis (redovi s tankim linijama) */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .sub { font-size: 13px; color: var(--muted); }

/* Ikona kategorije (crno-bijela) */
.cat-icon {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  border: 1px solid var(--line); background: var(--card);
  display: grid; place-items: center; color: var(--text);
}
.cat-icon .icon { font-size: 19px; }

/* Pill s postotkom */
.pct-pill {
  display: inline-block; min-width: 44px; text-align: center;
  padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--g100); color: var(--text-2);
}
.pct-pill.blue { background: var(--blue-soft); color: var(--blue); }

/* Oznaka "Transfer" */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-2);
}

/* Traka napretka */
.bar { height: 6px; border-radius: 999px; background: var(--g100); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--g900); border-radius: inherit; }
.bar.blue > span { background: var(--blue); }

/* Prazno stanje */
.empty { padding: 28px 8px; text-align: center; color: var(--muted); }

/* Horizontalni scroll kartica na mobitelu */
.hscroll { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--gap); }

/* =========================================================================
   Odabir mjeseca
   ========================================================================= */
.month-picker { position: relative; }
.month-btn { gap: 8px; }
.month-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  width: 280px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px;
}
.month-pop .year { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-weight: 700; }
.month-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.month-grid button {
  height: 36px; border: 1px solid var(--line); background: #fff; border-radius: 9px;
  font-size: 13.5px; font-weight: 500;
}
.month-grid button.current { color: var(--blue); border-color: var(--blue); }
.month-grid button.active { background: var(--text); color: #fff; border-color: var(--text); }

/* =========================================================================
   Modal, sheet, toast
   ========================================================================= */
.backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 10, 10, .4);
  display: grid; place-items: center; padding: 16px;
  animation: fade .12s ease-out;
}
.modal {
  width: 100%; max-width: 440px; max-height: calc(100dvh - 32px); overflow-y: auto;
  background: #fff; border-radius: var(--radius-modal); padding: 22px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h2 { font-size: 18px; font-weight: 700; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

.toast-wrap {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 16px;
  background: var(--text); color: #fff; border-radius: 12px;
  padding: 11px 14px 11px 16px; font-size: 14px; max-width: calc(100vw - 32px);
  animation: rise .16s ease-out;
}
.toast button { border: 0; background: transparent; color: #fff; font-weight: 700; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* =========================================================================
   Login
   ========================================================================= */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; padding: 28px; }
.login .brand { padding: 0 0 22px; }

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

@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 16px 16px calc(var(--tabbar) + 28px + env(safe-area-inset-bottom)); }

  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: sticky; top: 0; z-index: 30;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: var(--bg);
  }
  .topbar .brand { padding: 0; }
  .topbar .brand-name { font-size: 19px; }

  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tabbar) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--text);
  }
  .tabbar a, .tabbar button {
    border: 0; background: transparent; color: #A1A1AA;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 10.5px; font-weight: 600;
  }
  .tabbar .active { color: #fff; }
  .tabbar .icon { font-size: 23px; }
  .tabbar .tab-add .plus {
    width: 42px; height: 42px; border-radius: 12px; background: #fff; color: var(--text);
    display: grid; place-items: center;
  }
  .tabbar .tab-add .icon { font-size: 26px; }

  .page-header { margin-bottom: 16px; }
  .page-header .page-actions .btn-new, .page-header .save-pill { display: none; }
  .page-title { font-size: 24px; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .hscroll {
    grid-auto-columns: 78%; overflow-x: auto; scroll-snap-type: x mandatory;
    margin: 0 -16px; padding: 0 16px; scroll-padding: 0 16px; scrollbar-width: none;
  }
  .hscroll::-webkit-scrollbar { display: none; }
  .hscroll > * { scroll-snap-align: start; }

  .hero-value { font-size: 38px; }
  .tiles { grid-auto-flow: row; }
  .tiles > * { padding: 12px 0; border-left: 0; border-top: 1px solid var(--line); }
  .tiles > *:first-child { padding-top: 0; border-top: 0; }

  .card { padding: 16px; }
  .card.flush .card-head { padding: 16px 16px 0; }

  /* Modal kao donji sheet */
  .backdrop { place-items: end center; padding: 0; }
  .modal {
    max-width: none; border-radius: var(--radius-modal) var(--radius-modal) 0 0;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    animation: rise .18s ease-out;
  }
  .toast-wrap { bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); }

  /* Izbornik (hamburger) kao sheet */
  .menu-sheet .nav-item { padding: 12px 10px; }
}

/* =========================================================================
   Grafovi
   ========================================================================= */
.chart { --h: 200px; }
.legend { display: flex; gap: 16px; margin-bottom: 12px; font-size: 13px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw.s0 { background: var(--g900); }
.sw.s1 { background: var(--g300); }
.chart-plot { position: relative; height: calc(var(--h) + 24px); padding-left: 52px; }
.chart-grid { position: absolute; inset: 0 0 24px 0; display: flex; flex-direction: column; justify-content: space-between; }
.chart-grid > div { border-top: 1px solid var(--g100); height: 0; position: relative; }
.chart-grid > div:last-child { border-top-color: var(--line); }
.chart-grid span {
  position: absolute; left: 0; top: -8px; width: 46px; text-align: right;
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.chart-bars { position: relative; height: 100%; display: flex; gap: 2px; }
.bar-col { flex: 1; min-width: 0; display: flex; flex-direction: column; outline: none; cursor: default; }
.bar-stack { height: var(--h); display: flex; align-items: flex-end; justify-content: center; gap: 2px; padding: 0 18%; }
.bar-stack.two { padding: 0 12%; }
.bar-stack .b { flex: 1; max-width: 28px; border-radius: 4px 4px 0 0; background: var(--g300); min-height: 0; transition: background .12s; }
.bar-stack:not(.two) .b { background: var(--g400); }
.bar-stack.two .b.s0 { background: var(--g900); }
.bar-stack.two .b.s1 { background: var(--g300); }
.bar-col.hl .b.s0 { background: var(--blue); }
.bar-col:hover .b, .bar-col:focus .b { filter: brightness(.92); }
.bar-label { height: 24px; line-height: 24px; text-align: center; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.bar-col.hl .bar-label { color: var(--blue); font-weight: 600; }
.chart-tip {
  position: absolute; z-index: 300; pointer-events: none;
  background: var(--text); color: #fff; border-radius: 8px; padding: 6px 10px;
  font-size: 12.5px; white-space: pre-line; font-variant-numeric: tabular-nums; max-width: 240px;
}

.donut { position: relative; width: 180px; height: 180px; margin: 0 auto 8px; }
.donut svg { width: 100%; height: 100%; display: block; }
.donut circle[data-tip] { cursor: default; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.donut-center strong { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.swatch { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

@media (max-width: 860px) {
  .chart-plot { padding-left: 44px; }
  .chart-grid span { width: 38px; }
  .bar-label { font-size: 10.5px; }
}

/* Transakcije */
.card.day { padding-top: 14px; padding-bottom: 6px; }
.day-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 6px; }
.list .amount { font-weight: 600; white-space: nowrap; }
.list .btn-icon.btn-ghost { color: var(--g400); margin-right: -6px; }
.list .btn-icon.btn-ghost:hover { color: var(--red); }

/* Kompaktne pločice: ostaju u jednom redu i na mobitelu */
@media (max-width: 860px) {
  .tiles.compact { grid-auto-flow: column; }
  .tiles.compact > * { padding: 0 10px; border-top: 0; border-left: 1px solid var(--line); }
  .tiles.compact > *:first-child { padding-left: 0; border-left: 0; }
  .tiles.compact .kpi-value { font-size: 19px; margin: 6px 0 2px; }
  .tiles.compact .label { font-size: 10px; letter-spacing: 0.06em; }
  .tiles.compact .kpi-desc { font-size: 11.5px; }
}
.label { line-height: 1.3; }
.sm-only { display: none; }
@media (max-width: 860px) {
  .sm-only { display: inline; }
  .lg-only { display: none; }
}
.title { font-weight: 500; }

/* Pregled potrošnje */
.spend-grid { align-items: start; }
.spend-table tbody tr { cursor: pointer; }
.spend-table tbody tr:hover td { background: var(--g100); }
.spend-table td:first-child { width: 64px; }
.spend-table .row { gap: 8px; min-width: 0; }
.cat-mini { font-size: 18px; color: var(--text-2); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.spend-table td:nth-child(2) { max-width: 0; width: 100%; }

/* Ciljevi i novčanik */
.align-start { align-items: start; }
.wallet-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wallet .row:first-child { gap: 10px; }
.wallet .kpi-value { margin: 14px 0 14px; }
.wallet-actions .btn { flex: 1; padding: 0 8px; }
.goals .goal { align-items: flex-start; padding: 14px 0; }
.goal .btn-icon.btn-ghost { color: var(--g400); margin-right: -6px; }
.goal-nums { margin: 10px 0 8px; }
.goal-meta { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
@media (max-width: 1100px) { .wallet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .wallet-grid { gap: 10px; }
  .wallet .cat-icon { width: 30px; height: 30px; }
  .wallet .title { font-size: 14px; }
  .wallet .kpi-value { font-size: 20px; margin: 10px 0; }
  .wallet-actions { gap: 6px; }
  .wallet-actions .btn { height: 34px; font-size: 13px; gap: 2px; }
  .wallet-actions .btn .icon { font-size: 16px; }
}

/* Povijest */
.history-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.month-card { cursor: pointer; display: flex; flex-direction: column; }
.month-card:hover { border-color: var(--g300); }
.month-card:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.tiles.compact.always > * { padding: 0 12px; }
.tiles.compact.always > *:first-child { padding-left: 0; }
.tiles.compact.always .kpi-value { font-size: 19px; margin: 6px 0 0; }
.month-note { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; flex: 1; }
.month-note p { white-space: pre-line; overflow-wrap: anywhere; }
.month-note .btn-icon.btn-ghost { color: var(--g400); margin: -4px -6px 0 0; }
.detail-hero { margin-bottom: 12px; }
.detail-table td { padding-top: 10px; padding-bottom: 10px; }
.detail-label { display: block; margin: 18px 0 2px; }
@media (max-width: 1100px) { .history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .history-grid { grid-template-columns: minmax(0, 1fr); }
  .tiles.compact.always > * { padding: 0 10px; }
}

/* Godišnji pregled */
.year-table td:first-child { max-width: 0; width: 100%; }
.year-table td.r, .year-table th.r { white-space: nowrap; }
.year-table .group-row td { padding-top: 22px; border-top: 0; }
.year-table tbody:first-of-type .group-row td { padding-top: 6px; }
@media (max-width: 860px) {
  .hide-sm { display: none; }
  .tiles.quad { grid-auto-flow: row; grid-template-columns: 1fr 1fr; row-gap: 14px; }
  .tiles.quad > * { padding: 0 0 0 12px; border-top: 0; border-left: 1px solid var(--line); }
  .tiles.quad > *:nth-child(odd) { padding-left: 0; border-left: 0; }
  .tiles.quad > *:nth-child(n+3) { padding-top: 14px; border-top: 1px solid var(--line); }
  .tiles.quad .kpi-value { font-size: 20px; }
}
.nowrap { white-space: nowrap; }

/* Prihodi */
.income-table { margin-top: 12px; }
.income-table tbody tr { cursor: pointer; }
.income-table tbody tr:hover td { background: var(--g100); }
.income-table tr.sel td { font-weight: 600; }
.income-table tr.sel td:first-child { color: var(--blue); }

/* Kategorije */
.cat-list > li { gap: 10px; padding: 10px 0; background: var(--card); }
.cat-list > li.dragging { opacity: .6; }
.drag-handle {
  border: 0; background: transparent; color: var(--g400); padding: 6px 2px; margin-left: -4px;
  cursor: grab; touch-action: none; display: grid; place-items: center; border-radius: 6px;
}
.drag-handle:active { cursor: grabbing; }
.drag-handle:focus-visible { outline: 2px solid var(--blue); }
.cat-icon-btn { cursor: pointer; padding: 0; }
.cat-icon-btn:hover { border-color: var(--g300); }
.fixed-toggle {
  height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.fixed-toggle.on { background: var(--text); border-color: var(--text); color: #fff; }
.btn-icon:disabled { opacity: .35; cursor: not-allowed; }
.check { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 14.5px; }
.check input { width: 18px; height: 18px; accent-color: var(--text); }
.icon-choose { justify-content: flex-start; width: max-content; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 6px; margin-top: 12px; max-height: 50vh; overflow-y: auto; }
.icon-cell { height: 48px; border: 1px solid var(--line); border-radius: 10px; background: #fff; display: grid; place-items: center; color: var(--text); }
.icon-cell:hover { border-color: var(--g300); }
.icon-cell.active { background: var(--text); border-color: var(--text); color: #fff; }
.icon-cell .icon { font-size: 22px; }
@media (max-width: 860px) {
  .cat-list > li { gap: 8px; }
  .cat-list .btn-icon.btn-ghost { width: 28px; }
}

/* Plus / minus */
.pos { color: var(--green); }
.neg { color: var(--red); }
.hero .pos { color: #4ADE80; }
.hero .neg { color: #F87171; }

/* Serije prihod (zeleno) / potrošeno (crveno) */
.chart .sw.inc, .chart .bar-col .b.inc { background: var(--green); }
.chart .sw.exp, .chart .bar-col .b.exp { background: var(--red); }

/* Graf neta */
.net-grid { position: absolute; inset: 0 0 24px 0; }
.net-grid span {
  position: absolute; left: 0; width: 46px; text-align: right; transform: translateY(-50%);
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.net-grid i { position: absolute; left: 52px; right: 0; border-top: 1px solid var(--g300); }
.net-col { position: relative; height: var(--h); margin: 0 22%; }
.net-col .nb { position: absolute; left: 0; right: 0; max-width: 28px; margin: 0 auto; }
.net-col .nb.up { background: var(--green); border-radius: 4px 4px 0 0; }
.net-col .nb.down { background: var(--red); border-radius: 0 0 4px 4px; }
.net-chart .bar-col:hover .nb, .net-chart .bar-col:focus .nb { filter: brightness(.92); }
@media (max-width: 860px) {
  .net-grid span { width: 38px; }
  .net-grid i { left: 44px; }
  .net-col { margin: 0 14%; }
}
