/* ============================================================
   XO — tema u stilu Minimax (plavi sidebar, svetla radna površina)
   Brend = plava; zelena/crvena samo za priliv/odliv (računovodstvena semantika).
   ============================================================ */
:root {
    --brand-900: #0b2a4a;
    --brand-800: #103a63;
    --brand-700: #16497c;
    --brand-600: #1d5d9b;   /* primarni akcenat */
    --brand-500: #2671b8;
    --brand-400: #4a90d0;
    --brand-300: #93bfe2;

    --ink: #1f2a37;
    --muted: #6b7785;
    --line: #e4e9ef;
    --canvas: #eef1f5;
    --panel: #ffffff;

    --ok: #1f9d57;          /* priliv / aktivan */
    --ok-700: #157a43;
    --red: #d64545;
    --amber: #d99020;

    --radius: 12px;
    --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 14px rgba(16,24,40,.06);
    --sidebar-w: 232px;
    --sidebar-w-collapsed: 68px;
}

* { box-sizing: border-box; }

html { font-size: 15px; }

body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--ink);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
}

/* ---------- App skelet ---------- */
.app { display: flex; min-height: 100vh; }
.nav-toggle-cb { display: none; }

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 auto;
    background: linear-gradient(180deg, var(--brand-800), var(--brand-900));
    color: #dbe9f6;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    transition: width 180ms ease;
    overflow: visible;
}
.sidebar-brand {
    display: flex; align-items: center; gap: .65rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-mark {
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--brand-400);
    color: #06243f; font-weight: 800; font-size: .95rem;
    display: grid; place-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.brand-text { font-weight: 700; font-size: 1.05rem; line-height: 1; color: #fff; }
.brand-text small { display: block; font-weight: 500; font-size: .72rem; color: var(--brand-300); margin-top: 2px; }

.sidebar-nav { padding: .75rem .6rem; display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; }
.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: .7rem;
    padding: .62rem .7rem;
    border-radius: 9px;
    color: #c5dcf0;
    font-weight: 500; font-size: .94rem;
    text-decoration: none;
    transition: background .12s, color .12s;
}
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav .nav-link.active { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 3px 0 0 var(--brand-400); }
.sidebar-nav .ic { width: 19px; height: 19px; fill: currentColor; opacity: .9; flex: 0 0 auto; }
.sidebar-nav .nav-section {
    padding: .85rem .8rem .3rem;
    font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: var(--brand-300); opacity: .65;
}
.sidebar-nav .nav-section:first-child { padding-top: .35rem; }
.sidebar-foot { padding: .9rem 1.25rem; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-foot .muted { color: var(--brand-300); font-size: .75rem; }

/* ---------- Sidebar edge toggle ---------- */
.sidebar-edge-btn {
    position: absolute;
    right: -13px; top: 68px;
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,.18);
    background: var(--brand-700);
    box-shadow: 0 2px 6px rgba(0,0,0,.3);
    color: #c5dcf0;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    z-index: 50;
    padding: 0;
    transition: background .12s, color .12s, box-shadow .12s;
}
.sidebar-edge-btn:hover {
    background: var(--brand-600);
    color: #fff;
    box-shadow: 0 3px 10px rgba(0,0,0,.35);
}
.sidebar-edge-btn:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 3px; }
.sidebar-edge-btn svg { width: 14px; height: 14px; fill: currentColor; flex: 0 0 auto; }
.sidebar-edge-btn .icon-expand { display: none; }
.sidebar-edge-btn .icon-collapse { display: block; }

/* ---------- Collapsed sidebar (desktop only) ---------- */
@media (min-width: 821px) {
    body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }

    /* Brand: hide text, center mark */
    body.sidebar-collapsed .sidebar-brand { padding: 1.1rem .5rem; justify-content: center; }
    body.sidebar-collapsed .brand-text { display: none; }

    /* Edge button: swap icon */
    body.sidebar-collapsed .sidebar-edge-btn .icon-expand { display: block; }
    body.sidebar-collapsed .sidebar-edge-btn .icon-collapse { display: none; }

    /* Nav section labels → thin dividers */
    body.sidebar-collapsed .sidebar-nav .nav-section {
        height: 1px; background: rgba(255,255,255,.1);
        padding: 0; margin: 5px 10px; overflow: hidden;
        font-size: 0; color: transparent; letter-spacing: 0;
    }
    body.sidebar-collapsed .sidebar-nav .nav-section:first-child { display: none; }

    /* Nav links: icon only, centered */
    body.sidebar-collapsed .sidebar-nav .nav-link { justify-content: center; padding: .6rem 0; gap: 0; }
    body.sidebar-collapsed .sidebar-nav .nav-link span { display: none; }

    /* Footer: hidden */
    body.sidebar-collapsed .sidebar-foot { display: none; }
}

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; gap: 1rem;
    height: 60px; padding: 0 1.5rem;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 1.05rem; font-weight: 600; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: .9rem; }
.user-name { font-size: .9rem; color: var(--muted); font-weight: 500; }
.btn-logout {
    border: 1px solid var(--line); background: #fff; color: var(--ink);
    padding: .35rem .8rem; border-radius: 8px; font-size: .85rem; font-weight: 500; cursor: pointer;
}
.btn-logout:hover { background: #f6f8fa; border-color: #d6dde5; }
.nav-burger { display: none; cursor: pointer; }
.nav-burger svg { width: 24px; height: 24px; fill: var(--ink); }

/* ---------- Zvonce za obaveštenja ---------- */
.notif-bell-btn {
    position: relative;
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border: 1px solid var(--line); background: #fff;
    border-radius: 8px; cursor: pointer; color: var(--muted); padding: 0;
    transition: background .12s, border-color .12s, color .12s;
    flex-shrink: 0;
}
.notif-bell-btn:hover { background: #f6f8fa; border-color: #d6dde5; color: var(--ink); }
.notif-bell-btn:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 2px; }
.notif-badge {
    position: absolute; top: -6px; right: -6px;
    min-width: 18px; height: 18px; border-radius: 9px; padding: 0 4px;
    display: flex; align-items: center; justify-content: center;
    font-size: .65rem; font-weight: 700; line-height: 1;
    border: 2px solid var(--panel); pointer-events: none;
    white-space: nowrap;
}
.notif-badge-info     { background: var(--brand-500); color: #fff; }
.notif-badge-warning  { background: var(--amber); color: #fff; }
.notif-badge-critical { background: var(--red); color: #fff; }

.content { padding: 1.6rem 1.75rem; max-width: 1320px; width: 100%; }

/* ---------- Tipografija ---------- */
h1, .h1, h2, .h2, h3, .h3 { color: var(--ink); font-weight: 700; letter-spacing: -.01em; }
.page-sub { color: var(--muted); margin-top: -.25rem; }

/* ---------- Kartice / paneli ---------- */
.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: var(--panel);
}
.card-header { background: #fff; border-bottom: 1px solid var(--line); font-weight: 600; border-radius: var(--radius) var(--radius) 0 0 !important; }

/* KPI kartice */
.kpi { border-radius: var(--radius); padding: 1.1rem 1.25rem; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.kpi .kpi-label { text-transform: uppercase; letter-spacing: .04em; font-size: .72rem; color: var(--muted); font-weight: 600; }
.kpi .kpi-value { font-size: 1.5rem; font-weight: 700; margin-top: .25rem; font-variant-numeric: tabular-nums; }
.kpi .kpi-sub { font-size: .8rem; color: var(--muted); }
.kpi-primary {
    background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
    border: none; color: #eaf3fb;
}
.kpi-primary .kpi-label { color: #c2dcf2; }
.kpi-primary .kpi-value { color: #fff; font-size: 1.9rem; }
.kpi-primary .kpi-sub { color: #c2dcf2; }

/* ---------- Tabele ---------- */
.table { color: var(--ink); margin: 0; }
.table > thead th {
    background: #f7f9fb; color: var(--muted);
    text-transform: uppercase; font-size: .72rem; letter-spacing: .03em; font-weight: 600;
    border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table > tbody td { border-color: #eef1f4; vertical-align: middle; }
.table-hover > tbody > tr:hover > * { background: #f3f8fc; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.pos { color: var(--ok-700); }
.neg { color: var(--red); }

/* ---------- Bedževi ---------- */
.badge-status { display: inline-flex; align-items: center; gap: .4rem; font-size: .76rem; font-weight: 600; padding: .25rem .6rem; border-radius: 999px; }
.badge-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.badge-active { background: #e6f6ed; color: var(--ok-700); }
.badge-active::before { background: var(--ok); }
.badge-idle { background: #f0f2f5; color: var(--muted); }
.badge-idle::before { background: #b7c0cc; }
.badge-ai { background: #ede4fb; color: #6b35c9; }
.badge-ai::before { background: #8a4fe0; }
.badge-review { background: #fff3e0; color: #b46e00; }
.badge-review::before { background: #e0911f; }

/* ---------- Mini-bar (breakdown) ---------- */
.bar-track { background: #eef1f4; border-radius: 6px; height: 8px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; }
.bar-out { background: var(--red); }
.bar-in  { background: var(--ok); }
.dot { display:inline-block; width:9px; height:9px; border-radius:50%; margin-right:.4rem; }

/* ---------- Dugmad / forme (Bootstrap override) ---------- */
.btn-primary { --bs-btn-bg: var(--brand-600); --bs-btn-border-color: var(--brand-600); --bs-btn-hover-bg: var(--brand-700); --bs-btn-hover-border-color: var(--brand-700); --bs-btn-active-bg: var(--brand-800); --bs-btn-focus-shadow-rgb: 29,93,155; }
.btn-success { --bs-btn-bg: var(--ok); --bs-btn-border-color: var(--ok); --bs-btn-hover-bg: var(--ok-700); --bs-btn-hover-border-color: var(--ok-700); }
.btn-outline-secondary { --bs-btn-color: var(--ink); --bs-btn-border-color: var(--line); --bs-btn-hover-bg: #f6f8fa; --bs-btn-hover-border-color: #d6dde5; --bs-btn-hover-color: var(--ink); }
.btn { border-radius: 9px; font-weight: 500; }
.form-control, .form-select { border-color: #d8dee6; border-radius: 9px; }
.form-control:focus, .form-select:focus { border-color: var(--brand-400); box-shadow: 0 0 0 .2rem rgba(29,93,155,.18); }
.form-label { font-size: .85rem; font-weight: 500; color: #44505e; }
.form-switch .form-check-input:checked { background-color: var(--brand-600); border-color: var(--brand-600); }

/* ---------- iOS-style toggle ---------- */
.xo-ios-toggle {
    position: relative; display: inline-block;
    width: 44px; height: 26px; flex-shrink: 0; cursor: pointer;
}
.xo-ios-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.xo-ios-slider {
    position: absolute; inset: 0;
    background: #cdd5de; border-radius: 26px;
    transition: background .22s ease;
}
.xo-ios-slider::before {
    content: ''; position: absolute;
    width: 20px; height: 20px; left: 3px; top: 3px;
    background: #fff; border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,.22);
    transition: transform .22s ease;
}
.xo-ios-toggle input:checked + .xo-ios-slider { background: var(--brand-500); }
.xo-ios-toggle input:checked + .xo-ios-slider::before { transform: translateX(18px); }
.xo-ios-toggle input:focus-visible + .xo-ios-slider { outline: 2px solid var(--brand-400); outline-offset: 2px; }

/* ---------- Info tooltip icon ---------- */
.xo-info-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px;
    background: var(--brand-500); color: #fff;
    border-radius: 50%; font-size: 10px; font-weight: 700;
    font-style: normal; line-height: 1; cursor: default;
    flex-shrink: 0; user-select: none;
    transition: background .15s;
}
.xo-info-icon:hover { background: var(--brand-600); }
.nav-pills .nav-link.active { background: var(--brand-600); }
.nav-pills .nav-link { color: var(--brand-700); }
a { color: var(--brand-700); }
a:hover { color: var(--brand-800); }

/* ---------- Auth (login) ---------- */
.auth-shell {
    min-height: 100vh; display: grid; place-items: center;
    background: radial-gradient(1200px 600px at 50% -10%, #21557f 0%, var(--brand-900) 55%, #061a2e 100%);
    padding: 1rem;
}
.auth-card {
    width: 100%; max-width: 380px; background: #fff; border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,.3); padding: 2rem 1.9rem;
}
.auth-logo { width: 52px; height: 52px; border-radius: 14px; background: var(--brand-500); color: #fff;
    font-weight: 800; display: grid; place-items: center; margin: 0 auto 1rem; font-size: 1.2rem; }

/* ---------- Dashboard switcher (Pregled · Analiza · AI Analiza) ---------- */
.dash-switcher {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .75rem;
    margin-bottom: 1.5rem;
}

.dash-item {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    padding: 1rem 1.15rem;
    background: var(--panel);
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--ink);
    transition: border-color .14s, box-shadow .14s, background .14s;
}

.dash-item:hover {
    border-color: var(--brand-400);
    background: #f5f9ff;
    box-shadow: 0 2px 10px rgba(29,93,155,.1);
    color: var(--ink);
    text-decoration: none;
}

.dash-item.dash-active {
    border-color: var(--brand-600);
    border-width: 2px;
    background: #edf4fc;
    box-shadow: 0 0 0 1px var(--brand-600), var(--shadow);
    cursor: default;
    color: var(--ink);
    text-decoration: none;
}

.dash-icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #e5edf8;
    color: var(--brand-600);
}

.dash-item.dash-active .dash-icon {
    background: var(--brand-600);
    color: #fff;
}

.dash-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.dash-body {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    min-width: 0;
}

.dash-title {
    font-size: .94rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.2;
}

.dash-item.dash-active .dash-title { color: var(--brand-700); }

.dash-sub {
    font-size: .75rem;
    color: var(--muted);
    line-height: 1.4;
}

@media (max-width: 768px) {
    .dash-switcher {
        grid-template-columns: 1fr;
        gap: .5rem;
    }
}

/* ---------- Responsive ---------- */
.nav-backdrop { display: none; }

@media (max-width: 820px) {
    .sidebar { position: fixed; z-index: 40; transform: translateX(-100%); transition: transform .2s; width: var(--sidebar-w) !important; }
    .nav-toggle-cb:checked ~ .sidebar { transform: translateX(0); }
    .nav-burger { display: inline-flex; }
    .content { padding: 1.1rem; }
    .sidebar-edge-btn { display: none; }
    /* Reset any collapsed styles that would affect mobile sidebar content */
    body.sidebar-collapsed .sidebar-brand { padding: 1.1rem 1.25rem; justify-content: flex-start; }
    body.sidebar-collapsed .brand-text { display: initial; }
    body.sidebar-collapsed .sidebar-nav .nav-section { height: auto; background: none; padding: .85rem .8rem .3rem; margin: 0; font-size: .68rem; color: var(--brand-300); opacity: .65; letter-spacing: .08em; }
    body.sidebar-collapsed .sidebar-nav .nav-section:first-child { display: block; padding-top: .35rem; }
    body.sidebar-collapsed .sidebar-nav .nav-link { justify-content: flex-start; padding: .62rem .7rem; gap: .7rem; }
    body.sidebar-collapsed .sidebar-nav .nav-link span { display: inline; }
    body.sidebar-collapsed .sidebar-foot { display: block; }

    /* Zatamnjena pozadina ispod izvučenog menija — dodir zatvara meni */
    .nav-toggle-cb:checked ~ .nav-backdrop {
        display: block; position: fixed; inset: 0;
        background: rgba(6,26,46,.45); z-index: 35;
    }
}

/* ---------- Telefon ---------- */
@media (max-width: 560px) {
    html { font-size: 14px; }
    .content { padding: .8rem; }
    .topbar { padding: 0 .9rem; gap: .6rem; }
    .topbar-title { font-size: .98rem; }
    .user-name { display: none; }            /* skrati topbar na uskim ekranima */
    .kpi { padding: .85rem .95rem; }
    .kpi .kpi-value { font-size: 1.3rem; }
    .kpi-primary .kpi-value { font-size: 1.6rem; }

    /* Tabela → kartice: svaki red postaje kartica sa labelama */
    .table-cards thead { display: none; }
    .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
    .table-cards tr {
        border: 1px solid var(--line); border-radius: 10px;
        background: var(--panel); box-shadow: var(--shadow);
        padding: .55rem .75rem; margin-bottom: .6rem;
    }
    .table-cards td {
        border: none !important; padding: .22rem 0;
        display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
        text-align: right; white-space: normal;
    }
    .table-cards td::before {
        content: attr(data-label);
        font-weight: 600; color: var(--muted);
        text-align: left; flex: 0 0 auto;
    }
    /* Ćelije bez labele (čekboks, akcije) — bez prefiksa, puna širina */
    .table-cards td[data-label=""] { justify-content: space-between; }
    .table-cards td[data-label=""]::before { content: none; }
    .table-cards td.num { text-align: right; }
}

/* ---------- Paginacija (.pag-bar) ---------- */
.pag-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
    padding: .55rem 1rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 0 0 var(--radius) var(--radius);
    border-top: none;
    font-size: .825rem;
    color: var(--muted);
    margin-top: -1px; /* vizuelno prikači na karticu iznad */
}

.pag-info { white-space: nowrap; }
.pag-info strong { color: var(--ink); font-weight: 600; }

.pag-controls {
    display: flex;
    align-items: center;
    gap: .3rem;
    flex-wrap: wrap;
}

.pag-size {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin-right: .4rem;
    padding-right: .5rem;
    border-right: 1px solid var(--line);
}

.pag-size label {
    font-size: .78rem;
    color: var(--muted);
    white-space: nowrap;
    font-weight: 500;
    margin: 0;
}

.pag-size select {
    padding: .18rem .45rem;
    font-size: .8rem;
    border-radius: 6px;
    border: 1px solid var(--line);
    color: var(--ink);
    background: #fff;
    cursor: pointer;
    line-height: 1.4;
}

.pag-size select:focus {
    outline: none;
    border-color: var(--brand-400);
    box-shadow: 0 0 0 .15rem rgba(29,93,155,.15);
}

.pag-btn {
    min-width: 28px;
    height: 28px;
    padding: 0 .4rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--muted);
    font-size: .8rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .1s, border-color .1s, color .1s;
    line-height: 1;
    user-select: none;
}

.pag-btn:hover:not(:disabled) {
    background: #eef4fb;
    border-color: var(--brand-400);
    color: var(--brand-700);
}

.pag-btn.pag-active {
    background: var(--brand-600);
    border-color: var(--brand-600);
    color: #fff;
    font-weight: 600;
}

.pag-btn.pag-active:hover {
    background: var(--brand-700);
    border-color: var(--brand-700);
}

.pag-btn:disabled {
    opacity: .35;
    cursor: default;
    background: #fafafa;
}

.pag-ellipsis {
    padding: 0 .2rem;
    color: var(--muted);
    font-size: .85rem;
    user-select: none;
    line-height: 28px;
}

@media (max-width: 560px) {
    .pag-bar {
        flex-direction: column;
        align-items: flex-start;
        border-radius: 0 0 var(--radius) var(--radius);
        gap: .5rem;
        padding: .65rem .85rem;
    }
    .pag-controls { width: 100%; }
    .pag-size {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--line);
        padding-right: 0;
        padding-bottom: .4rem;
        margin-right: 0;
        margin-bottom: .1rem;
    }
}


/* Date picker (flatpickr) — dugme za brisanje datuma preko readonly polja */
.xo-date-wrap { position: relative; display: block; }
.xo-date-wrap input.form-control { padding-right: 28px; }
.xo-date-clear {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #8a94a6;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}
.xo-date-clear:hover { background: #eef1f5; color: #333; }

/* PDV kartica — cela kartica je klikabilna */
.vat-card-clickable {
    cursor: pointer;
    transition: box-shadow .15s ease, border-color .15s ease;
}
.vat-card-clickable:hover,
.vat-card-clickable:focus {
    box-shadow: 0 0 0 2px var(--bs-primary);
    outline: none;
}

/* Pregled: kartica „Neplaćene obaveze (fakture)" + sklopiva tabela „Stanje po PR-u" */
.obligations-grid { display: grid; grid-template-columns: auto 1px 1fr; gap: 1.6rem; align-items: center; padding: 1.1rem 1.25rem; }
.obligations-divider { width: 1px; height: 64px; background: var(--line); }
.obl-label { text-transform: uppercase; letter-spacing: .04em; font-size: .72rem; color: var(--muted); font-weight: 600; }
.obl-value { font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.obl-sub { font-size: 12px; color: var(--muted); }
.aging-bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: #eef1f4; gap: 2px; }
.stat-link { display: block; margin: -8px -12px; padding: 8px 12px; border-radius: 9px; color: var(--ink); text-decoration: none; transition: background .15s ease, box-shadow .15s ease; }
.stat-link:hover { background: #edf4fc; box-shadow: 0 0 0 1px #cbd9e8; }
.pr-card-header-toggle { cursor: pointer; }
.pr-card-header-toggle:hover { background: #f8fafc; }
/* Sklopljena kartica: bez donje ivice zaglavlja da se ne duplira sa ivicom kartice */
.pr-collapsed > .card-header { border-bottom: none; border-radius: var(--radius) !important; }
@media (max-width: 768px) {
    .obligations-grid { grid-template-columns: 1fr; }
    .obligations-divider { display: none; }
}

/* ============================================================
   Knjiga — redizajn (dva režima, popover filteri, boje kategorija)
   ============================================================ */
@keyframes xoFadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes xoSlideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* Bedž u boji svoje kategorije (boje dolaze inline iz CategoryColors; tačka preko CSS var) */
.badge-cat::before { background: var(--cat-dot, #b7c0cc); }
button.badge-status { border: 1px dashed transparent; font: inherit; font-size: .76rem; cursor: pointer; }
button.badge-status:hover { border-color: currentColor; }

/* Segmentirana kontrola Tabela / Kategorizacija */
.seg { display: inline-flex; background: var(--canvas); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: none; background: transparent; color: var(--muted); padding: .5rem 1rem; border-radius: 8px; font-weight: 600; font-size: .86rem; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; }
.seg button.active { background: #fff; color: var(--brand-600); box-shadow: 0 1px 2px rgba(16,24,40,.08); }
.seg .seg-count { background: var(--red); color: #fff; border-radius: 999px; font-size: .68rem; font-weight: 700; padding: 0 .4rem; line-height: 1.4; }

/* Banner „čeka pregled / nekategorisano" */
.attention-banner { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; background: #fff3e0; border: 1px solid #f3dcae; color: #8a5c00; border-radius: 10px; padding: .6rem 1rem; margin-bottom: 1rem; font-size: .87rem; }
.attention-banner .btn-open-triage { border: 1px solid #e6c789; background: #fff; color: #8a5c00; padding: .3rem .7rem; border-radius: 7px; font-size: .82rem; font-weight: 600; cursor: pointer; }

/* Popover (kategorije / status u filterima, kategorija u redu tabele) */
.xo-pop-wrap { position: relative; }
.xo-pop-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: .5rem; border: 1px solid #d8dee6; border-radius: 7px; padding: .25rem .6rem; font: inherit; font-size: .9rem; background: #fff; cursor: pointer; text-align: left; }
.xo-pop-btn .placeholder-txt { color: #8b95a1; }
.xo-pop-backdrop { position: fixed; inset: 0; z-index: 40; }
.xo-pop { position: absolute; top: calc(100% + 6px); left: 0; width: 260px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 4px 14px rgba(16,24,40,.14); z-index: 50; padding: .7rem; animation: xoFadeIn .12s ease; }
.xo-pop .pop-list { max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.xo-pop .pop-list label { display: flex; align-items: center; gap: .55rem; padding: .4rem .5rem; border-radius: 7px; font-size: .86rem; cursor: pointer; margin: 0; }
.xo-pop .pop-list label:hover { background: #f4f7fa; }
.xo-pop .pop-foot { display: flex; justify-content: space-between; align-items: center; margin-top: .6rem; padding-top: .5rem; border-top: 1px solid #eef1f4; }

/* Popover za promenu kategorije jednog reda (deljen, pozicionira ga JS) */
.row-cat-pop { position: absolute; width: 230px; max-height: 240px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 4px 14px rgba(16,24,40,.16); z-index: 50; padding: .35rem; animation: xoFadeIn .12s ease; }
.row-cat-pop button { display: block; width: 100%; text-align: left; background: none; border: none; padding: .4rem .55rem; border-radius: 7px; font-size: .83rem; cursor: pointer; color: var(--ink); }
.row-cat-pop button:hover { background: #f4f7fa; }
.row-cat-pop button.current { font-weight: 700; }

/* Brzi filter čipovi */
.chip { border: 1px solid #d8dee6; background: #fff; color: #44505e; padding: .32rem .8rem; border-radius: 999px; font-size: .82rem; font-weight: 600; cursor: pointer; }
.chip.active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

/* KPI trend red */
.kpi-trend { font-size: .76rem; margin-top: .3rem; color: var(--muted); }
.kpi-trend.pos { color: var(--ok-700); }
.kpi-trend.neg { color: var(--red); }

/* Kontekstualno zaglavlje tabele: podrazumevana traka + plava traka izbora */
.tbl-bar { display: flex; align-items: center; gap: .8rem; padding: .7rem 1.1rem; background: #f7f9fb; border-bottom: 1px solid var(--line); font-size: .85rem; color: var(--muted); }
.sel-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; padding: .7rem 1.1rem; background: #eaf2fa; border-bottom: 1px solid #cfe0f0; animation: xoSlideDown .12s ease; font-size: .85rem; color: var(--brand-700); }
.sel-toolbar .btn-linklike { background: none; border: none; color: var(--brand-700); font-size: .85rem; text-decoration: underline; cursor: pointer; padding: 0; }

/* Gustina redova tabele */
.density-compact td, .density-compact th { padding-top: .18rem !important; padding-bottom: .18rem !important; }

/* Režim Kategorizacija */
.triage-progress { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.1rem; }
.triage-progress .bar { flex: 1; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.triage-progress .bar > div { height: 100%; background: var(--brand-600); border-radius: 3px; transition: width .15s ease; }
.triage-progress .lbl { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.triage-progress .btn-undo { border: none; background: none; color: var(--brand-600); font-size: .83rem; font-weight: 600; cursor: pointer; text-decoration: underline; white-space: nowrap; }
.triage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.triage-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.triage-card .t-head { display: flex; justify-content: space-between; align-items: center; color: #8b95a1; font-size: .78rem; margin-bottom: .5rem; }
.triage-card .t-amount { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.triage-card .t-amount.pos { color: var(--ok-700); }
.triage-card .t-amount.neg { color: var(--red); }
.triage-card .t-name { font-size: 1.02rem; font-weight: 700; margin-top: .15rem; }
.triage-card .t-desc { color: #8b95a1; font-size: .78rem; margin-top: .15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.triage-card .t-ai { display: flex; align-items: center; justify-content: space-between; gap: .6rem; background: #ede4fb; border: 1px solid #dcc8f5; border-radius: 9px; padding: .5rem .7rem; margin-top: .7rem; }
.triage-card .t-ai .t-ai-lbl { font-size: .78rem; color: #6b35c9; }
.triage-card .t-ai .btn-accept { border: none; background: var(--ok); color: #fff; padding: .25rem .55rem; border-radius: 6px; font-weight: 600; font-size: .74rem; cursor: pointer; }
.triage-card .t-ai .btn-reject { border: 1px solid #dcc8f5; background: #fff; color: #6b35c9; padding: .25rem .55rem; border-radius: 6px; font-weight: 600; font-size: .74rem; cursor: pointer; }
.triage-card .t-pills { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .8rem; }
.cat-pill { border: none; padding: .32rem .6rem; border-radius: 999px; font-weight: 600; font-size: .76rem; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; }
.cat-pill .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--cat-dot, #b7c0cc); }
.triage-done { max-width: 520px; margin: 3rem auto; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 3rem 2rem; box-shadow: var(--shadow); }
