/* Mlekara sa Ovčara — CFO Dashboard
   Dark, mobile-first, system fonts, no external deps. */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0a;
  --bg-elev: #141414;
  --bg-card: #181818;
  --border: #252525;
  --text: #f0f0f0;
  --text-dim: #a0a0a0;
  --text-muted: #6b6b6b;
  --accent: #4ade80;     /* green = revenue/profit */
  --accent-warn: #fbbf24;
  --accent-bad:  #f87171;
  --accent-2:   #60a5fa; /* blue = expense */
  --accent-3:   #a78bfa; /* purple = net */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.muted { color: var(--text-muted); font-size: 0.85em; }

/* === TOPBAR === */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}
.brand { display: flex; gap: 12px; align-items: center; }
.logo { font-size: 28px; }
.title { font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.subtitle { font-size: 12px; color: var(--text-dim); }
.meta { display: flex; gap: 10px; align-items: center; font-size: 12px; }

.btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s;
  min-width: 36px;
  min-height: 36px;
}
.btn:hover { background: var(--border); }
.btn:active { transform: scale(0.95); }
.btn:disabled { opacity: 0.5; cursor: wait; }

/* === CONTAINER === */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px;
}

/* === KPI CARDS === */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.kpi-highlight {
  background: linear-gradient(135deg, #0f1a0f 0%, #1a2a1a 100%);
  border-color: #1f3a1f;
}
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); margin-bottom: 6px; }
.kpi-value { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; word-break: break-word; }
.kpi-sub { font-size: 12px; margin-top: 4px; }
.kpi-highlight .kpi-value { color: var(--accent); }

/* === SEMANTIČKE BOJE: pozitivno/negativno === */
/* Koristiti data-attribute="delta" sa vrednošću "up"/"down"/"neutral" */
/* ili klasama .positive, .negative, .neutral */
.positive, [data-delta="up"] { color: var(--accent); }
.negative, [data-delta="down"] { color: var(--accent-bad); }
.neutral, [data-delta="neutral"] { color: var(--text-dim); }

/* Kpi-highlight kad je negativan — crveni gradijent */
.kpi-highlight.kpi-negative {
  background: linear-gradient(135deg, #1f0f0f 0%, #2a1414 100%);
  border-color: #3a1818;
}
.kpi-highlight.kpi-negative .kpi-value { color: var(--accent-bad); }

/* === CARDS === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; flex-wrap: wrap; gap: 8px;
}
.card-header h2 { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }

.legend { display: flex; gap: 12px; font-size: 12px; color: var(--text-dim); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.dot-rev { background: var(--accent); }
.dot-exp { background: var(--accent-2); }
.dot-net { background: var(--accent-3); }

.select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
}
.topbar-select {
  font-weight: 600;
  font-size: 14px;
  padding: 6px 12px;
  min-width: 80px;
}

/* === GRID === */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

/* === CHARTS === */
.chart-wrap { position: relative; width: 100%; height: 280px; }
.chart-wrap-tall { height: 320px; }

/* === TABLES === */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl th { font-size: 11px; text-transform: uppercase; color: var(--text-dim); font-weight: 500; letter-spacing: 0.03em; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .pos { color: var(--accent); }
.tbl .neg { color: var(--accent-bad); }
.tbl-scroll { max-height: 380px; overflow-y: auto; }

/* === TREND TABLES (A vs B pored kolone) === */
.trend-tbl th { vertical-align: middle; }
.trend-tbl th[rowspan] { vertical-align: bottom; }
.trend-tbl .period-a-head {
  background: linear-gradient(180deg, rgba(91,155,213,0.15) 0%, rgba(91,155,213,0.05) 100%);
  text-align: center !important;
  font-weight: 600 !important;
  color: var(--accent) !important;
}
.trend-tbl .period-a-head-sub,
.trend-tbl .period-b-head-sub {
  text-align: right !important;
  font-weight: 500 !important;
  font-size: 11px !important;
}
.trend-tbl .period-a-head-sub { color: #5b9bd5 !important; }
.trend-tbl .period-b-head-sub { color: #e8a55b !important; }
.trend-tbl .period-a-head-sub small,
.trend-tbl .period-b-head-sub small {
  color: var(--text-dim);
  font-weight: normal;
  text-transform: none;
  font-size: 10px;
}

/* === P&L DETAIL === */
.pnl-detail { display: flex; flex-direction: column; gap: 8px; }
.pnl-block { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.pnl-block-title { display: flex; justify-content: space-between; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.pnl-block-total { color: var(--accent); }
.pnl-block-total.exp { color: var(--accent-2); }
.pnl-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; border-top: 1px dashed var(--border); }
.pnl-row:first-of-type { border-top: 0; }
.pnl-row .konto { color: var(--text-dim); font-family: ui-monospace, monospace; font-size: 12px; min-width: 50px; }
.pnl-row .kat { flex: 1; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; }
.pnl-row .amt { font-variant-numeric: tabular-nums; }

/* === FOOTER === */
.footer { text-align: center; padding: 24px 16px 32px; font-size: 11px; }

/* === RESPONSIVE — mobile first === */
@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .kpi-value { font-size: 19px; }
  .container { padding: 12px; }
  .topbar { padding: 10px 14px; }
  .title { font-size: 14px; }
  .chart-wrap { height: 240px; }
  .chart-wrap-tall { height: 200px; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 12px; }
  .kpi-value { font-size: 17px; }
  .kpi-label { font-size: 10px; }
  .card { padding: 12px; }
  .card-header h2 { font-size: 13px; }
  .chart-wrap { height: 200px; }
  .chart-wrap-tall { height: 180px; }
  .tbl th, .tbl td { padding: 6px 8px; font-size: 12px; }
  .pnl-row { font-size: 12px; }
}

/* === POSITIONING FIXES === */
@media (max-width: 360px) {
  .subtitle { display: none; }
}

/* === SUPPLIER DEBT BREAKDOWN === */
.supplier-debt-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.supplier-debt-summary .kpi { padding: 10px 14px; }
.supplier-debt-summary .kpi-label { font-size: 10px; }
.supplier-debt-summary .kpi-value { font-size: 18px; }

.aging-bars { display: flex; flex-direction: column; gap: 6px; }
.aging-bar { display: grid; grid-template-columns: 130px 1fr 110px; align-items: center; gap: 10px; }
.aging-bar .label { font-size: 12px; color: var(--text-dim); }
.aging-bar .bar-track { background: var(--bg); height: 12px; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.aging-bar .bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.aging-bar.preko_365 .bar-fill { background: linear-gradient(90deg, #b91c1c, #ef4444); }
.aging-bar .bar-value { text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; }

.mspeed-row { background: rgba(239, 68, 68, 0.04); border-left: 2px solid #ef4444; }
.mspeed-row td:first-child { padding-left: 14px; }
.mspeed-flag { display: inline-block; background: #ef4444; color: white; font-size: 9px; padding: 2px 6px; border-radius: 8px; font-weight: 600; letter-spacing: 0.04em; margin-left: 4px; vertical-align: middle; }
.konto-tag { display: inline-block; background: var(--bg); color: var(--text-dim); font-size: 10px; padding: 1px 6px; border-radius: 4px; font-family: ui-monospace, monospace; margin-right: 6px; }
.aging-stari { color: #ef4444; font-weight: 600; }

@media (max-width: 700px) {
  .supplier-debt-summary { grid-template-columns: 1fr; }
  .aging-bar { grid-template-columns: 100px 1fr 90px; }
}

/* Supplier-tag — mala tamna pill za prikaz naziva dobavljača
   u tabelama (Marija input 11.07.2026 — DT PREVOZ MLEKA dolazi
   i od M SPEED i od RIMA, pa treba jasno razdvajanje). */
.supplier-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  background: rgba(96, 165, 250, 0.12);
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, 0.25);
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* === ANIMATIONS === */
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.card, .kpi { animation: fadeIn 0.2s ease-out; }

/* === LAYOUT: SIDEBAR + CONTENT === */
body {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
}

.app-shell {
  display: flex;
  flex: 1;
  min-width: 0;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  padding: 12px 8px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-header {
  padding: 12px 12px 16px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.sidebar-header .brand { gap: 10px; }
.sidebar-header .logo { font-size: 24px; }
.sidebar-header .title { font-size: 14px; }
.sidebar-header .subtitle { font-size: 10px; }

/* === USER BADGE === */
.user-badge {
  margin-top: 12px;
  padding: 10px;
  background: #0f0f0f;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
}
.user-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #2d6e4e;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  color: #fff;
  font-weight: 500;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-meta {
  color: #777;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-badge-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #2a2a2a;
}
.user-badge-btn {
  flex: 1;
  background: #1a1a1a;
  border: 1px solid #333;
  color: #aaa;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s;
}
.user-badge-btn:hover {
  background: #252525;
  border-color: #555;
  color: #fff;
}
.user-badge-icon { font-size: 12px; }
.user-badge-login {
  display: block;
  color: #5b9bd5;
  text-decoration: none;
  padding: 8px 10px;
  font-size: 12px;
  text-align: center;
}
.user-badge-login:hover { color: #7eb6e8; }
/* === KRAJ USER BADGE === */

/* === CHANGE PASSWORD MODAL === */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.modal-overlay[hidden] { display: none; }
.modal-card {
  background: #181818;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  animation: modalIn 0.2s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #2a2a2a;
}
.modal-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}
.modal-close {
  background: none;
  border: none;
  color: #888;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s;
}
.modal-close:hover { background: #2a2a2a; color: #fff; }
.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-body label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #aaa;
  font-weight: 500;
}
.modal-body input {
  background: #0f0f0f;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 10px 12px;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
}
.modal-body input:focus {
  outline: none;
  border-color: #2d6e4e;
}
.modal-body input:disabled { opacity: 0.5; cursor: not-allowed; }
.modal-error {
  background: #3a1a1a;
  border: 1px solid #5a2a2a;
  color: #ff8888;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 13px;
}
.modal-success {
  background: #1a3a2a;
  border: 1px solid #2a5a4a;
  color: #88ffaa;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 13px;
}
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid #2a2a2a;
}
.btn-primary, .btn-secondary {
  padding: 9px 16px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid;
}
.btn-primary {
  background: #2d6e4e;
  border-color: #2d6e4e;
  color: #fff;
}
.btn-primary:hover { background: #3a8260; border-color: #3a8260; }
.btn-primary:disabled {
  background: #1a3a2a;
  border-color: #1a3a2a;
  cursor: not-allowed;
  opacity: 0.7;
}
.btn-secondary {
  background: #1a1a1a;
  border-color: #333;
  color: #aaa;
}
.btn-secondary:hover { background: #252525; color: #fff; }
/* === KRAJ CHANGE PASSWORD MODAL === */

.sidebar-group {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 14px 12px 6px 12px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  text-decoration: none;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.nav-item:hover { background: var(--bg-card); color: var(--text); }
.nav-item.active {
  background: var(--bg-card);
  color: var(--text);
  font-weight: 500;
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }
.nav-item .badge {
  margin-left: auto;
  background: var(--accent-bad);
  color: white;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 8px;
  font-weight: 600;
  min-width: 16px;
  text-align: center;
}

.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar { position: sticky; top: 0; flex-shrink: 0; }
.container { max-width: 1400px; margin: 0 auto; padding: 16px; width: 100%; }

/* === VIEW SYSTEM === */
.view { display: none; }
.view.active { display: block; }

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}
.view-title { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.view-subtitle { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* === MOBILE DRAWER (hamburger) === */
.menu-toggle {
  display: none;
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 22px;
  padding: 4px 8px;
  cursor: pointer;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 15;
  opacity: 0;
  transition: opacity 0.2s;
}
.sidebar-overlay.open { opacity: 1; }

@media (max-width: 768px) {
  body { flex-direction: column; }
  .menu-toggle { display: inline-block; }
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform 0.25s ease-out;
    width: 260px;
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; pointer-events: none; }
  .sidebar-overlay.open { pointer-events: auto; }
  .topbar { padding: 10px 14px; }
  .container { padding: 12px; }
}

/* === OVERVIEW MINI-CARDS === */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.overview-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.overview-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.overview-card .oc-head { display: flex; justify-content: space-between; align-items: center; }
.overview-card .oc-icon { font-size: 18px; }
.overview-card .oc-title { font-size: 13px; font-weight: 500; color: var(--text-dim); }
.overview-card .oc-metric { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.overview-card .oc-sub { font-size: 11px; color: var(--text-muted); }
.overview-card .oc-arrow { color: var(--text-muted); font-size: 14px; }
.overview-card.alert { border-color: rgba(248, 113, 113, 0.3); }
.overview-card.alert .oc-metric { color: var(--accent-bad); }
.overview-card.good .oc-metric { color: var(--accent); }
.overview-card.warn .oc-metric { color: var(--accent-warn); }

/* ============================================================
   MULTISELECT (kupci filter)
   ============================================================ */
.multiselect {
  position: relative;
  display: inline-block;
  min-width: 220px;
}
.multiselect-trigger {
  background: var(--bg-input, #1a1a1a);
  color: var(--text, #e5e5e5);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  transition: border-color 0.15s;
}
.multiselect-trigger:hover { border-color: var(--accent, #5b9bd5); }
.multiselect-trigger[aria-expanded="true"] { border-color: var(--accent, #5b9bd5); }
.multiselect-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.multiselect-label strong { color: var(--accent, #5b9bd5); font-weight: 600; }
.multiselect-caret { color: var(--text-dim, #888); font-size: 10px; }
.multiselect-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 280px;
  max-height: 420px;
  background: var(--bg-card, #141414);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 100;
  display: flex;
  flex-direction: column;
}
.multiselect-panel[hidden] { display: none !important; }
.multiselect-search {
  margin: 8px;
  padding: 6px 10px;
  background: var(--bg-input, #1a1a1a);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 4px;
  color: var(--text, #e5e5e5);
  font-size: 13px;
  font-family: inherit;
}
.multiselect-search:focus {
  outline: none;
  border-color: var(--accent, #5b9bd5);
}
.multiselect-actions {
  display: flex;
  gap: 4px;
  padding: 0 8px 6px;
  border-bottom: 1px solid var(--border, #2a2a2a);
}
.multiselect-action {
  flex: 1;
  background: transparent;
  border: 1px solid var(--border, #2a2a2a);
  color: var(--text-dim, #888);
  padding: 4px 6px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.multiselect-action:hover { color: var(--text, #e5e5e5); border-color: var(--accent, #5b9bd5); }
.multiselect-list {
  overflow-y: auto;
  max-height: 320px;
  padding: 4px 0;
}
.multiselect-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  user-select: none;
}
.multiselect-item:hover { background: var(--bg-input, #1a1a1a); }
.multiselect-item input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent, #5b9bd5);
}
.multiselect-item-label { flex: 1; min-width: 0; }
.multiselect-item-sifra {
  color: var(--text-dim, #888);
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 11px;
}
.multiselect-item-naziv {
  color: var(--text, #e5e5e5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.multiselect-item-mark {
  background: rgba(91, 155, 213, 0.35);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}
.multiselect-empty {
  padding: 12px;
  text-align: center;
  color: var(--text-muted, #666);
  font-size: 12px;
}

/* ============================================================
   TENANT (database) selector
   ============================================================ */
.tenant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.tenant-card {
  display: block;
  padding: 12px 14px;
  background: var(--bg-input, #1a1a1a);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.tenant-card:hover { border-color: var(--accent, #5b9bd5); }
.tenant-card.active {
  border-color: var(--accent, #5b9bd5);
  background: rgba(91, 155, 213, 0.08);
  box-shadow: 0 0 0 1px var(--accent, #5b9bd5);
}
.tenant-card input[type="radio"] {
  display: none;  /* Card je label, vizuelno se ceo tretira kao radio */
}
.tenant-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}
.tenant-card-head strong {
  color: var(--text, #e5e5e5);
  font-size: 14px;
}
.tenant-card.active .tenant-card-head strong {
  color: var(--accent, #5b9bd5);
}
.tenant-badge {
  font-size: 10px;
  color: var(--text-dim, #888);
  background: var(--bg-card, #141414);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 3px;
  padding: 1px 6px;
  font-family: ui-monospace, "SF Mono", monospace;
}

/* Topbar tenant badge */
.topbar-tenant-badge {
  display: inline-block;
  font-size: 12px;
  color: var(--text-dim, #888);
  background: var(--bg-input, #1a1a1a);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 4px;
  padding: 4px 8px;
  margin-right: 8px;
  font-weight: 500;
}
.topbar-tenant-badge[data-tenant="MERGE"] {
  color: var(--accent-warn, #f59e0b);
  border-color: var(--accent-warn, #f59e0b);
}
.topbar-tenant-badge[data-tenant="NATURA"] {
  color: var(--accent, #5b9bd5);
  border-color: var(--accent, #5b9bd5);
}

/* ============================================================
   TENANT BANNER (upozorenje kad tenant nije Mlekara)
   ============================================================ */
.tenant-banner {
  margin: 12px 0 16px;
  padding: 12px 16px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-left: 4px solid var(--accent-warn, #f59e0b);
  border-radius: 6px;
  color: var(--text, #e5e5e5);
  font-size: 13px;
  line-height: 1.5;
}
.tenant-banner a {
  color: var(--accent, #5b9bd5);
  text-decoration: underline;
}
.tenant-banner a:hover { color: #87c5e8; }
.tenant-banner strong { color: var(--accent-warn, #f59e0b); }

/* ============================================================
   CASH CONVERSION CYCLE (CCC)
   ============================================================ */
.ccc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 8px 0;
}
.ccc-hero {
  grid-column: 1 / 2;
  padding: 20px 24px;
  border: 1px solid;
  border-radius: 8px;
  text-align: left;
}
.ccc-hero-label {
  font-size: 11px;
  color: var(--text-dim, #888);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.ccc-hero-value {
  font-size: 42px;
  font-weight: 700;
  line-height: 1;
  margin: 8px 0;
  font-variant-numeric: tabular-nums;
}
.ccc-hero-status {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-top: 4px;
}
.ccc-hero-msg {
  color: var(--text, #e5e5e5);
  line-height: 1.5;
}
.ccc-components {
  grid-column: 2 / 3;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.ccc-component {
  background: var(--bg-input, #1a1a1a);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 6px;
  padding: 14px 10px;
  text-align: center;
}
.ccc-component-label {
  font-size: 11px;
  color: var(--text-dim, #888);
  font-weight: 600;
  letter-spacing: 0.5px;
}
.ccc-component-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent, #5b9bd5);
  margin: 6px 0;
  font-variant-numeric: tabular-nums;
}
.ccc-component-unit {
  font-size: 14px;
  color: var(--text-dim, #888);
  margin-left: 2px;
}
.ccc-component-desc {
  font-size: 10px;
  color: var(--text-dim, #888);
  line-height: 1.3;
}
.ccc-formula {
  grid-column: 1 / -1;
  background: var(--bg-input, #1a1a1a);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 6px;
  padding: 14px 18px;
  margin-top: 4px;
}
.ccc-formula-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ccc-formula-piece { color: var(--text, #e5e5e5); }
.ccc-formula-op {
  color: var(--text-dim, #666);
  font-weight: 400;
}
.ccc-formula-labels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-dim, #888);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ccc-formula-labels span:first-child,
.ccc-formula-labels span:nth-child(2) { grid-column: span 1; }
.ccc-benchmark {
  grid-column: 1 / -1;
  background: var(--bg-input, #1a1a1a);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 12px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 16px;
}
.ccc-bench-title { grid-column: 1 / -1; font-weight: 600; margin-bottom: 4px; }
.ccc-bench-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}
.ccc-bench-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.ccc-details {
  grid-column: 1 / -1;
  margin-top: 4px;
}
.ccc-details summary {
  list-style: none;
  padding: 8px 12px;
  background: var(--bg-input, #1a1a1a);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 4px;
}
.ccc-details summary::-webkit-details-marker { display: none; }
.ccc-details summary:hover { color: var(--accent, #5b9bd5); }
.ccc-na {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-input, #1a1a1a);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 6px;
}
.ccc-na-icon { font-size: 32px; }
.ccc-na-text strong { color: var(--text, #e5e5e5); font-size: 14px; }

@media (max-width: 768px) {
  .ccc-grid { grid-template-columns: 1fr; }
  .ccc-hero, .ccc-components, .ccc-formula, .ccc-benchmark, .ccc-details { grid-column: 1 / -1; }
  .ccc-components { grid-template-columns: 1fr; }
  .ccc-benchmark { grid-template-columns: 1fr; }
  .ccc-formula-labels { grid-template-columns: repeat(4, 1fr); }
  .ccc-formula-text { font-size: 18px; gap: 8px; }
}

/* ============================================================
   FILTER BAR (Nabavka, Prodaja, generički)
   shadcn-inspired: tight padding, tanak border, focus ring, wrap
   ============================================================ */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  padding: 14px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 0 16px 0;
}
.filter-bar-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;       /* dozvoljava shrink unutar flexbara */
}
.filter-bar-field--full {
  flex: 1 1 100%;     /* full-width red ispod (za široke multiselect-e) */
}
.filter-bar-field label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.filter-bar-field select,
.filter-bar-field input[type="date"],
.filter-bar-field input[type="text"] {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 28px 7px 10px;
  font-size: 13px;
  font-family: inherit;
  height: 34px;
  min-width: 110px;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
}
/* custom caret za select */
.filter-bar-field select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%23a0a0a0' stroke-width='1.5' d='M1 1l4 4 4-4'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px 6px;
  padding-right: 28px;
}
.filter-bar-field input[type="date"] {
  padding-right: 10px;
  color-scheme: dark;
}
.filter-bar-field select:hover,
.filter-bar-field input:hover {
  border-color: #3a3a3a;
}
.filter-bar-field select:focus,
.filter-bar-field input:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}
.filter-bar-divider {
  display: flex;
  align-items: center;
  height: 34px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  user-select: none;
}
.filter-bar-divider.period-a { color: var(--accent-2); }
.filter-bar-divider.period-b { color: var(--accent-warn); }
.filter-bar-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  align-self: flex-end;
}

/* ============================================================
   FILTER CHIPS (aktivni filteri ispod filter bara)
   ============================================================ */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -8px 0 14px 0;
  min-height: 28px;
}
.filter-chips:empty { display: none; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  background: rgba(96, 165, 250, 0.10);
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text);
  line-height: 1;
}
.filter-chip.period-b {
  background: rgba(251, 191, 36, 0.10);
  border-color: rgba(251, 191, 36, 0.35);
}
.filter-chip.period-b .filter-chip-key { color: var(--accent-warn); }
.filter-chip-key {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.filter-chip-value {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.filter-chip-close {
  background: none;
  border: 0;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0 2px;
  font-size: 14px;
  line-height: 1;
  transition: color 0.15s;
}
.filter-chip-close:hover { color: var(--accent-bad); }

/* ============================================================
   BUTTONS (shadcn-style)
   ============================================================ */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent-2);
  color: #0a0a0a;
  border: 1px solid var(--accent-2);
}
.btn-primary:hover {
  background: #93c5fd;
  border-color: #93c5fd;
}
.btn-primary:active { transform: scale(0.97); }
.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-elev);
  border-color: #3a3a3a;
}
.btn-secondary:active { transform: scale(0.97); }

/* ============================================================
   MULTISELECT (Nabavka odeljenje, custom varijanta)
   Konzistentan sa kupac filterom (.multiselect / .multiselect-trigger)
   ali sa .multiselect-wrap wrapperom za layout integraciju
   ============================================================ */
.multiselect-wrap {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  min-width: 0;
  gap: 4px;
}
.multiselect-wrap > .multiselect-trigger {
  /* Override inline-flex od .multiselect-trigger defaulta — drži height kao select */
  height: 34px;
  padding: 7px 10px;
  background: var(--bg-card);
  font-size: 13px;
}
.multiselect-wrap > .multiselect-trigger:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}
.multiselect-options {
  overflow-y: auto;
  max-height: 320px;
  padding: 4px 0;
}
.multiselect-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
  transition: background 0.1s;
}
.multiselect-option:hover { background: var(--bg-elev); }
.multiselect-option input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent-2);
  width: 14px;
  height: 14px;
}
.multiselect-option-label { flex: 1; min-width: 0; }
.multiselect-option-sifra {
  color: var(--text-muted);
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 11px;
}
.multiselect-all,
.multiselect-reset,
.multiselect-apply {
  flex: 1;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 8px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.multiselect-all:hover,
.multiselect-reset:hover {
  color: var(--text);
  border-color: #3a3a3a;
}
.multiselect-apply {
  background: var(--accent-2);
  color: #0a0a0a;
  border-color: var(--accent-2);
  font-weight: 500;
}
.multiselect-apply:hover {
  background: #93c5fd;
  border-color: #93c5fd;
}

/* ============================================================
   RESPONSIVE — filter bar collapse na manjim ekranima
   ============================================================ */
@media (max-width: 900px) {
  .filter-bar {
    padding: 12px;
    gap: 8px;
  }
  .filter-bar-field { flex: 1 1 calc(50% - 8px); min-width: 120px; }
  .filter-bar-actions { width: 100%; margin-left: 0; }
  .filter-bar-actions .btn-primary,
  .filter-bar-actions .btn-secondary { flex: 1; }
}
@media (max-width: 540px) {
  .filter-bar-field { flex: 1 1 100%; }
  .filter-bar-divider { width: 100%; justify-content: flex-start; padding: 0; }
}
/* YTD red u CFO H1 tabeli — vizualno razdvajanje od UKUPNO */
.ytd-row th {
    background: rgba(91, 155, 213, 0.18) !important;
    color: #5b9bd5 !important;
    font-style: italic;
    border-top: 2px solid rgba(91, 155, 213, 0.4);
}
.ytd-row th strong { color: #b4d4f0; }
/* ================================================================ */
/* BUILD INFO FOOTER (Ivan, 16.08.2026)                              */
/* Verzija app.js bundle-a + git commit, vidljiv u sidebar.          */
/* Pomaže da se odmah vidi da li browser učitava keširanu verziju.    */
/* ================================================================ */
.build-info {
    margin-top: auto;
    padding: 12px 16px 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.2);
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 11px;
    line-height: 1.5;
    color: #9aa3ad;
}
.build-info .bi-line {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.build-info .bi-label {
    color: #6e7681;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 10px;
}
.build-info .bi-version {
    color: #b4d4f0;
    font-weight: 600;
}
.build-info .bi-commit {
    background: rgba(91,155,213,0.15);
    color: #5b9bd5;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    cursor: pointer;
    transition: background .15s;
}
.build-info .bi-commit:hover {
    background: rgba(91,155,213,0.35);
}
.build-info .bi-dirty {
    color: #e8a55b;
    font-weight: bold;
}
.build-info .bi-dirty::before {
    content: "● ";
    color: #e8a55b;
}
.build-info .bi-muted {
    color: #6e7681;
    font-size: 10px;
    margin-top: 2px;
}

/* === PROJEKTNI RAD — FINANSIJE (Ivan, 18.08.2026) === */
.tbl .total-row td { font-weight: 600; border-top: 1px solid var(--border); background: rgba(255,255,255,0.02); }
