/* ==========================================================================
   Servis Generatora - dizajn sistem (svijetli, poslovni admin panel)
   Učitava se NAKON Bootstrap 5.3 i redefiniše njegove komponente.
   Stare .vm-* klase su zadržane kao kompatibilni sloj, pa se sve stranice usklađuju.
   ========================================================================== */

:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e3e8f0;
    --border-strong: #cfd7e3;
    --text: #1a2233;
    --muted: #5d6b82;
    --faint: #8a96aa;

    --primary: #2358d8;
    --primary-700: #1b46b0;
    --primary-50: #eaf0ff;
    --primary-100: #d7e3ff;

    --success: #0f7b5a;  --success-50: #e4f6ef;
    --warning: #a65b05;  --warning-50: #fff2dc;
    --danger:  #c0392b;  --danger-50:  #fdebe8;
    --info:    #0b6f8c;  --info-50:    #e1f3f9;
    --neutral: #566277;  --neutral-50: #eceff4;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(20, 34, 66, .06);
    --shadow: 0 2px 8px rgba(20, 34, 66, .07), 0 1px 2px rgba(20, 34, 66, .05);
    --shadow-lg: 0 12px 32px rgba(20, 34, 66, .16);

    --nav-w: 250px;
    --topbar-h: 60px;

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

* { -webkit-tap-highlight-color: transparent; }
html { font-size: 15px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    margin: 0;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-700); }
h1, h2, h3, h4, h5, h6 { color: var(--text); font-weight: 650; letter-spacing: -.01em; }
:focus-visible { outline: 3px solid rgba(35, 88, 216, .35); outline-offset: 2px; border-radius: 6px; }
.text-muted, .text-secondary { color: var(--muted) !important; }
::selection { background: var(--primary-100); }

/* ---------------------------------------------------------------- layout */
.app-shell { display: block; min-height: 100vh; }

.app-nav {
    position: fixed; inset: 0 auto 0 0;
    width: var(--nav-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    z-index: 1040;
    transition: transform .22s ease;
}
.app-brand {
    height: var(--topbar-h);
    display: flex; align-items: center; gap: .7rem;
    padding: 0 1.1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text); font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em;
}
.app-brand:hover { color: var(--text); }
.brand-mark {
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, #2f6bff, #1a46bd);
    color: #fff; display: grid; place-items: center; font-size: 1.1rem;
    box-shadow: 0 2px 6px rgba(35, 88, 216, .35);
}
.app-nav-scroll { flex: 1; overflow-y: auto; padding: .6rem .7rem 1rem; }
.nav-group-title {
    font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: var(--faint); padding: 1rem .65rem .35rem;
}
.nav-item-link {
    display: flex; align-items: center; gap: .7rem;
    padding: .55rem .7rem; margin: 1px 0;
    border-radius: 9px; color: var(--muted); font-weight: 520; font-size: .93rem;
    min-height: 40px;
}
.nav-item-link i { font-size: 1.1rem; width: 1.3rem; text-align: center; color: var(--faint); transition: color .15s; }
.nav-item-link:hover { background: var(--surface-2); color: var(--text); }
.nav-item-link:hover i { color: var(--muted); }
.nav-item-link.active { background: var(--primary-50); color: var(--primary-700); font-weight: 620; }
.nav-item-link.active i { color: var(--primary); }

.app-nav-user {
    border-top: 1px solid var(--border);
    padding: .8rem 1rem;
    display: flex; align-items: center; gap: .7rem;
}
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--primary-50); color: var(--primary-700);
    display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none;
}
.app-nav-user .who { min-width: 0; flex: 1; line-height: 1.25; }
.app-nav-user .who strong { display: block; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-nav-user .who span { font-size: .75rem; color: var(--muted); }
.app-nav-user .logout {
    color: var(--muted); font-size: 1.15rem; padding: .4rem; border-radius: 8px; line-height: 1;
}
.app-nav-user .logout:hover { background: var(--danger-50); color: var(--danger); }

.app-main { margin-left: var(--nav-w); min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.app-topbar {
    position: sticky; top: 0; z-index: 1030;
    height: var(--topbar-h);
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(1.4) blur(8px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: .8rem;
    padding: 0 1.5rem;
}
.topbar-title { font-weight: 650; font-size: 1.02rem; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-toggle {
    display: none; border: 1px solid var(--border); background: var(--surface);
    width: 42px; height: 42px; border-radius: 10px; font-size: 1.35rem; line-height: 1; color: var(--text);
    align-items: center; justify-content: center;
}
.topbar-date { color: var(--muted); font-size: .85rem; }

.page { padding: 1.6rem 1.5rem 3rem; width: 100%; max-width: 1360px; margin: 0 auto; flex: 1; }
.app-footer { padding: 1rem 1.5rem; color: var(--faint); font-size: .8rem; text-align: center; }

.drawer-backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 1035; }

@media (max-width: 991.98px) {
    .app-nav { transform: translateX(-102%); box-shadow: var(--shadow-lg); width: min(84vw, 300px); }
    body.nav-open .app-nav { transform: none; }
    body.nav-open .drawer-backdrop { display: block; }
    body.nav-open { overflow: hidden; }
    .app-main { margin-left: 0; }
    .nav-toggle { display: inline-flex; }
    .app-topbar { padding: 0 1rem; }
    .topbar-date { display: none; }
    .page { padding: 1.1rem 1rem 2.5rem; }
}

/* ---------------------------------------------------------------- zaglavlje stranice */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-header h1, .page-header .h1 { font-size: 1.55rem; margin: 0; line-height: 1.25; }
.page-header .sub { color: var(--muted); margin: .15rem 0 0; font-size: .92rem; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.crumb { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .88rem; font-weight: 520; margin-bottom: .35rem; }
.crumb:hover { color: var(--primary); }

/* ---------------------------------------------------------------- kartice */
.card, .vm-card, .panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.vm-card { padding: 1.15rem 1.25rem; margin-bottom: 1rem; }
.card-body { padding: 1.15rem 1.25rem; }
.panel { padding: 0; margin-bottom: 1rem; overflow: hidden; }
.panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    padding: .95rem 1.25rem; border-bottom: 1px solid var(--border);
}
.panel-head h2, .panel-head h3 { font-size: 1rem; margin: 0; }
.panel-body { padding: 1.1rem 1.25rem; }
.panel-body.flush { padding: 0; }

.vm-section-title {
    font-size: .74rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
    color: var(--muted); margin: 0 0 .85rem; padding: 0; border: 0;
}
.vm-content-header { margin-bottom: 1.1rem; }
.vm-content-header h2 { font-size: 1.55rem; margin: 0; }
.vm-content-header small { color: var(--muted); font-size: .92rem; display: block; margin-top: .15rem; }

/* ---------------------------------------------------------------- dugmad */
.btn {
    font-weight: 560; border-radius: 9px; padding: .5rem .95rem; font-size: .92rem;
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    min-height: 40px; line-height: 1.2; transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn-sm { min-height: 34px; padding: .3rem .7rem; font-size: .85rem; border-radius: 8px; }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-700); --bs-btn-hover-border-color: var(--primary-700); --bs-btn-active-bg: var(--primary-700); --bs-btn-active-border-color: var(--primary-700); box-shadow: 0 1px 2px rgba(35, 88, 216, .3); }
.btn-outline-secondary, .btn-light, .btn-secondary {
    --bs-btn-color: var(--text); --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--border-strong);
    --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-color: var(--text); --bs-btn-hover-border-color: var(--border-strong);
    --bs-btn-active-bg: var(--neutral-50); --bs-btn-active-color: var(--text);
}
.btn-danger { --bs-btn-bg: var(--danger); --bs-btn-border-color: var(--danger); --bs-btn-hover-bg: #a52f23; --bs-btn-hover-border-color: #a52f23; }
.btn-outline-danger { --bs-btn-color: var(--danger); --bs-btn-border-color: #efc2bc; --bs-btn-hover-bg: var(--danger-50); --bs-btn-hover-color: var(--danger); --bs-btn-hover-border-color: #e5a69e; }
.btn-success { --bs-btn-bg: var(--success); --bs-btn-border-color: var(--success); --bs-btn-hover-bg: #0b6248; --bs-btn-hover-border-color: #0b6248; }
.btn-warning { --bs-btn-bg: #f2a417; --bs-btn-border-color: #f2a417; --bs-btn-color: #2b1d00; }
.btn-icon { width: 38px; padding: 0; }
.btn-sm.btn-icon { width: 34px; }

/* kompatibilnost: stari .vm-btn */
.vm-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .5rem .95rem; min-height: 40px; font-size: .92rem; font-weight: 560; line-height: 1.2;
    background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 9px;
    cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s;
}
.vm-btn:hover { background: var(--surface-2); color: var(--text); }
button.vm-btn[type="submit"]:not(.vm-btn-danger):not(.vm-btn-secondary):not(.vm-btn-outline-secondary) { background: var(--primary); border-color: var(--primary); color: #fff; }
button.vm-btn[type="submit"]:not(.vm-btn-danger):not(.vm-btn-secondary):not(.vm-btn-outline-secondary):hover { background: var(--primary-700); }
.vm-btn-sm { min-height: 32px; padding: .25rem .65rem; font-size: .82rem; border-radius: 8px; }
.vm-btn-danger { color: var(--danger); border-color: #efc2bc; background: var(--surface); }
.vm-btn-danger:hover { background: var(--danger-50); color: var(--danger); }
.vm-btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.vm-btn-secondary { background: var(--neutral-50); color: var(--neutral); }
.vm-btn-outline-success { color: var(--success); border-color: #b7e0d1; }
.vm-btn-outline-secondary { color: var(--muted); }
.vm-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.vm-form-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }

/* ---------------------------------------------------------------- forme */
label, .form-label { font-size: .84rem; font-weight: 600; color: var(--text); margin-bottom: .3rem; }
.form-control, .form-select,
.vm-form-group input:not([type="checkbox"]):not([type="radio"]), .vm-form-group select, .vm-form-group textarea {
    width: 100%; font-size: .94rem; color: var(--text);
    background-color: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px;
    padding: .55rem .75rem; min-height: 42px; box-shadow: none;
    transition: border-color .15s, box-shadow .15s;
}
textarea.form-control, .vm-form-group textarea { min-height: 90px; resize: vertical; }
.form-control:focus, .form-select:focus,
.vm-form-group input:focus, .vm-form-group select:focus, .vm-form-group textarea:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(35, 88, 216, .15); outline: 0;
}
.form-control::placeholder { color: var(--faint); }
input[readonly], textarea[readonly] { background: var(--surface-2) !important; color: var(--text); }
.vm-form-group { margin-bottom: .9rem; }
.vm-form-group label { display: block; }
.vm-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .25rem 1rem; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon > .form-control { padding-left: 2.4rem; }

/* ---------------------------------------------------------------- tabele */
.table-wrap { overflow-x: auto; }
.vm-table, .table {
    width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; margin: 0;
    --bs-table-bg: transparent;
}
.vm-table th, .table th {
    background: var(--surface-2); color: var(--muted);
    font-size: .74rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
    padding: .7rem 1rem; text-align: left; border: 0; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.vm-table td, .table td { padding: .8rem 1rem; border: 0; border-bottom: 1px solid var(--border); vertical-align: middle; }
.vm-table tbody tr:last-child td, .table tbody tr:last-child td { border-bottom: 0; }
.vm-table tbody tr:hover, .table-hover tbody tr:hover { background: var(--surface-2); }
.vm-card .vm-table, .vm-card .table { margin: 0 -1.25rem; width: calc(100% + 2.5rem); }
.cell-main { font-weight: 620; color: var(--text); }
.cell-sub { font-size: .82rem; color: var(--muted); }
.row-actions { display: flex; gap: .35rem; justify-content: flex-end; flex-wrap: wrap; }
.row-actions form { margin: 0; display: inline-flex; }
.clickable-row { cursor: pointer; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

.vm-empty, .empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state i, .vm-empty i { font-size: 2.6rem; color: var(--border-strong); display: block; margin-bottom: .5rem; }
.empty-state h3 { font-size: 1.05rem; margin: 0 0 .25rem; color: var(--text); }
td.vm-empty { padding: 2rem 1rem; }

/* ---------------------------------------------------------------- bedževi */
.badge { font-weight: 620; font-size: .76rem; border-radius: 999px; padding: .32em .7em; letter-spacing: .01em; }
.badge.bg-success   { background: var(--success-50) !important; color: var(--success); }
.badge.bg-warning   { background: var(--warning-50) !important; color: var(--warning); }
.badge.bg-danger    { background: var(--danger-50)  !important; color: var(--danger); }
.badge.bg-info      { background: var(--info-50)    !important; color: var(--info); }
.badge.bg-secondary { background: var(--neutral-50) !important; color: var(--neutral); }
.badge.bg-primary   { background: var(--primary-50) !important; color: var(--primary-700); }
.pill {
    display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem; font-weight: 620;
    padding: .25rem .7rem; border-radius: 999px; white-space: nowrap; line-height: 1.3;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }
.pill-success { background: var(--success-50); color: var(--success); }
.pill-warning { background: var(--warning-50); color: var(--warning); }
.pill-danger  { background: var(--danger-50);  color: var(--danger); }
.pill-info    { background: var(--info-50);    color: var(--info); }
.pill-neutral { background: var(--neutral-50); color: var(--neutral); }
.pill-primary { background: var(--primary-50); color: var(--primary-700); }
.pill.no-dot::before { display: none; }
.tag { display: inline-block; font-size: .78rem; font-weight: 600; color: var(--muted); background: var(--neutral-50); padding: .15rem .55rem; border-radius: 6px; }

/* ---------------------------------------------------------------- alerti */
.alert { border-radius: 10px; border: 1px solid; font-size: .92rem; padding: .8rem 1rem; display: flex; gap: .6rem; align-items: flex-start; }
.alert-success { background: var(--success-50); border-color: #bfe6d8; color: #0a5a42; }
.alert-danger  { background: var(--danger-50);  border-color: #f2c4bd; color: #8f2a20; }
.alert-warning { background: var(--warning-50); border-color: #f4d9a6; color: #7c4503; }
.alert-info    { background: var(--info-50);    border-color: #b9e0ec; color: #0a5870; }

/* ---------------------------------------------------------------- modali */
.modal-content { border: 0; border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-header { border-bottom: 1px solid var(--border); padding: 1rem 1.35rem; }
.modal-title { font-size: 1.08rem; font-weight: 650; }
.modal-body { padding: 1.25rem 1.35rem; }
.modal-footer { border-top: 1px solid var(--border); padding: .85rem 1.35rem; background: var(--surface-2); gap: .5rem; }
.modal-backdrop.show { opacity: .45; }
@media (max-width: 575.98px) {
    .modal-dialog { margin: 0; min-height: 100%; display: flex; align-items: flex-end; max-width: none; }
    .modal-content { border-radius: 16px 16px 0 0; max-height: 92vh; display: flex; flex-direction: column; width: 100%; }
    .modal-content > form { display: flex; flex-direction: column; min-height: 0; }
    .modal-body { overflow-y: auto; }
}

/* ---------------------------------------------------------------- tabovi */
.nav-tabs, .vm-tabs {
    display: flex; gap: .25rem; border-bottom: 1px solid var(--border);
    overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; margin-bottom: 1rem;
}
.nav-tabs::-webkit-scrollbar, .vm-tabs::-webkit-scrollbar { display: none; }
.nav-tabs .nav-link, .vm-tab {
    border: 0; border-bottom: 2px solid transparent; background: none; border-radius: 0;
    color: var(--muted); font-weight: 600; font-size: .92rem; padding: .7rem 1rem; white-space: nowrap; cursor: pointer; margin-bottom: -1px;
}
.nav-tabs .nav-link:hover, .vm-tab:hover { color: var(--text); border-color: var(--border-strong); }
.nav-tabs .nav-link.active, .vm-tab.active { color: var(--primary-700); border-bottom-color: var(--primary); background: none; }
.nav-tabs .nav-link .count { background: var(--neutral-50); color: var(--muted); border-radius: 999px; font-size: .72rem; padding: .1rem .5rem; margin-left: .35rem; }
.nav-tabs .nav-link.active .count { background: var(--primary-50); color: var(--primary-700); }

/* ---------------------------------------------------------------- alatna traka / filteri */
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; padding: .85rem 1.25rem; border-bottom: 1px solid var(--border); }
.toolbar .search { flex: 1 1 240px; min-width: 0; }
.toolbar .form-select { width: auto; min-width: 150px; }
.seg { display: inline-flex; background: var(--neutral-50); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button {
    border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: .85rem;
    padding: .4rem .8rem; border-radius: 8px; min-height: 34px; display: inline-flex; align-items: center; gap: .4rem;
}
.seg button .n { font-size: .74rem; background: rgba(255,255,255,.7); border-radius: 999px; padding: 0 .45rem; color: var(--muted); }
.seg a { border: 0; background: transparent; padding: .3rem .7rem; border-radius: 8px; color: var(--muted); font-weight: 500; text-decoration: none; font-size: .86rem; }
.seg a:hover { color: var(--text); }
.seg a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg button.active .n { background: var(--primary-50); color: var(--primary-700); }

/* ---------------------------------------------------------------- KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1rem 1.1rem; display: flex; gap: .9rem; align-items: center; box-shadow: var(--shadow-sm);
    color: var(--text); transition: border-color .15s, box-shadow .15s, transform .15s;
}
a.kpi:hover { border-color: var(--primary-100); box-shadow: var(--shadow); color: var(--text); transform: translateY(-1px); }
.kpi-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; flex: none; }
.kpi-icon.primary { background: var(--primary-50); color: var(--primary); }
.kpi-icon.success { background: var(--success-50); color: var(--success); }
.kpi-icon.warning { background: var(--warning-50); color: var(--warning); }
.kpi-icon.danger  { background: var(--danger-50);  color: var(--danger); }
.kpi-icon.info    { background: var(--info-50);    color: var(--info); }
.kpi-label { line-height: 1.25; font-size: .8rem; color: var(--muted); font-weight: 560; }
.kpi-value { white-space: nowrap; font-size: 1.5rem; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: .8rem; font-weight: 600; color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.grid-2.even { grid-template-columns: 1fr 1fr; }
@media (max-width: 1099.98px) { .grid-2, .grid-2.even { grid-template-columns: 1fr; } }

/* lista sa stavkama (dashboard) */
.item-list { list-style: none; margin: 0; padding: 0; }
.item-list li { display: flex; align-items: center; gap: .8rem; padding: .8rem 1.25rem; border-bottom: 1px solid var(--border); }
.item-list li:last-child { border-bottom: 0; }
.item-list .grow { flex: 1; min-width: 0; }
.item-list .t { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-list .s { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; font-size: 1rem; }
.timeline li { align-items: flex-start; }

/* mini grafikon (SVG) */
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--primary); }
.chart .bar:hover { fill: var(--primary-700); }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }

/* ---------------------------------------------------------------- detalji mašine */
.spec { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1.1rem 1.5rem; margin: 0; }
.spec div { min-width: 0; }
.spec dt { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin-bottom: .15rem; }
.spec dd { margin: 0; font-weight: 580; overflow-wrap: anywhere; }
.spec dd.empty { color: var(--faint); font-weight: 400; }
.hero-img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 10px; background: var(--neutral-50); display: block; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-top: .5rem; }
.thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.thumbs img:hover, .thumbs img.on { border-color: var(--primary); }
.photo-card { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.photo-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.photo-card .cap { padding: .5rem .7rem; font-size: .82rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.placeholder-img { display: grid; place-items: center; aspect-ratio: 16/10; background: linear-gradient(135deg, var(--neutral-50), var(--primary-50)); border-radius: 10px; color: var(--primary); font-size: 3rem; }
.thumb-sm { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--neutral-50); flex: none; }
.thumb-ph { width: 44px; height: 44px; border-radius: 10px; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; font-size: 1.2rem; flex: none; }
.media-cell { display: flex; align-items: center; gap: .75rem; min-width: 0; }

/* ---------------------------------------------------------------- tabela -> kartice na telefonu */
@media (max-width: 767.98px) {
    .table-cards thead { display: none; }
    .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
    .table-cards tr { padding: .9rem 1rem; border-bottom: 1px solid var(--border); position: relative; }
    .table-cards tbody tr:last-child { border-bottom: 0; }
    .table-cards td { border: 0 !important; padding: .15rem 0 !important; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
    .table-cards td::before { content: attr(data-label); color: var(--faint); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; text-align: left; flex: none; padding-top: .15rem; }
    .table-cards td.primary-cell { display: block; text-align: left; padding-bottom: .4rem !important; }
    .table-cards td.primary-cell::before, .table-cards td.actions-cell::before { display: none; }
    .table-cards td.actions-cell { display: block; padding-top: .6rem !important; }
    .table-cards td.actions-cell .row-actions { justify-content: flex-start; }
    .table-cards td.num { text-align: right; }
    .toolbar { padding: .75rem 1rem; }
    .toolbar .form-select { flex: 1 1 140px; }
    .page-header h1 { font-size: 1.35rem; }
    .btn, .vm-btn, .form-control, .form-select, .vm-form-group input, .vm-form-group select { min-height: 44px; }
    .form-control, .form-select, .vm-form-group input, .vm-form-group select, .vm-form-group textarea { font-size: 16px; }   /* sprječava iOS zoom */
    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
    .kpi { padding: .85rem; flex-direction: column; align-items: flex-start; gap: .6rem; }
    .kpi-value { font-size: 1.3rem; }
    .vm-card .vm-table, .vm-card .table { margin: 0 -1.25rem; }
    .vm-table th, .vm-table td { padding: .65rem .75rem; }
}

/* ---------------------------------------------------------------- kontekstni panel mašina (stranice koje rade nad jednom mašinom) */
.ctx-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 1rem; align-items: start; }
.ctx-panel { position: sticky; top: calc(var(--topbar-h) + 1rem); max-height: calc(100vh - var(--topbar-h) - 2rem); display: flex; flex-direction: column; }
.ctx-panel summary { list-style: none; cursor: pointer; }
.ctx-panel summary::-webkit-details-marker { display: none; }
.ctx-list { overflow-y: auto; }
.ctx-item { display: flex; align-items: center; gap: .6rem; padding: .6rem 1rem; border-bottom: 1px solid var(--border); color: var(--text); font-size: .9rem; cursor: pointer; }
.ctx-item:hover { background: var(--surface-2); }
.ctx-item.active { background: var(--primary-50); color: var(--primary-700); font-weight: 620; }
.ctx-item .id { color: var(--faint); font-size: .78rem; min-width: 1.8rem; }
@media (max-width: 991.98px) {
    .ctx-layout { grid-template-columns: 1fr; }
    .ctx-panel { position: static; max-height: none; }
    .ctx-list { max-height: 260px; }
}

/* ---------------------------------------------------------------- prijava */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.auth-hero {
    background: radial-gradient(1200px 600px at 0% 0%, #3b74ff 0%, transparent 60%), linear-gradient(160deg, #173b9a 0%, #0f2766 100%);
    color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.auth-hero::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; border: 60px solid rgba(255, 255, 255, .06); }
.auth-hero .brand { display: flex; align-items: center; gap: .75rem; font-weight: 700; font-size: 1.15rem; }
.auth-hero .brand .brand-mark { background: rgba(255, 255, 255, .16); box-shadow: none; width: 40px; height: 40px; }
.auth-hero h2 { color: #fff; font-size: 2rem; line-height: 1.2; max-width: 20ch; margin-bottom: 1rem; }
.auth-hero p { color: rgba(255, 255, 255, .78); max-width: 42ch; }
.auth-points { list-style: none; padding: 0; margin: 1.75rem 0 0; display: grid; gap: .8rem; position: relative; z-index: 1; }
.auth-points li { display: flex; gap: .7rem; align-items: center; color: rgba(255, 255, 255, .9); font-weight: 520; }
.auth-points i { width: 30px; height: 30px; border-radius: 9px; background: rgba(255, 255, 255, .14); display: grid; place-items: center; flex: none; }
.auth-panel { display: grid; place-items: center; padding: 2rem 1.5rem; background: var(--bg); }
.auth-card { width: 100%; max-width: 410px; }
.auth-card h1 { font-size: 1.6rem; margin-bottom: .3rem; }
.auth-card .lead { color: var(--muted); font-size: .95rem; font-weight: 400; margin-bottom: 1.6rem; }
.auth-mobile-brand { display: none; align-items: center; gap: .7rem; font-weight: 700; margin-bottom: 1.6rem; }
.auth-card .btn-primary { width: 100%; min-height: 46px; font-size: 1rem; }
.pw-toggle { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); width: 38px; height: 38px; border-radius: 8px; font-size: 1.1rem; }
.pw-toggle:hover { background: var(--neutral-50); color: var(--text); }
.auth-foot { text-align: center; color: var(--faint); font-size: .8rem; margin-top: 1.5rem; }
@media (max-width: 899.98px) {
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-hero { display: none; }
    .auth-panel { background: var(--bg); align-items: start; padding-top: 12vh; }
    .auth-mobile-brand { display: flex; }
    .auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1.6rem 1.35rem; box-shadow: var(--shadow); }
}

/* ---------------------------------------------------------------- razno */
.vm-status-bar { display: none; }
hr { border-color: var(--border); opacity: 1; }
.pagination .page-link { border-radius: 8px; margin: 0 2px; color: var(--muted); border-color: var(--border); }
.pagination .active .page-link { background: var(--primary); border-color: var(--primary); }
.list-group-item { border-color: var(--border); }
.dropdown-menu { border-radius: 10px; border-color: var(--border); box-shadow: var(--shadow); }
.d-inline > .btn, form.d-inline { vertical-align: middle; }
.divider { height: 1px; background: var(--border); margin: 1rem 0; }
.hide-mobile { }
@media (max-width: 767.98px) { .hide-mobile { display: none !important; } }
@media (min-width: 768px) { .show-mobile { display: none !important; } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print { .app-nav, .app-topbar, .page-actions, .vm-actions, .app-footer, .toolbar, .row-actions .btn, .notif-dd { display: none !important; } .panel { break-inside: avoid; box-shadow: none; } .app-main { margin: 0; } .page { padding: 0; } }

/* ---------------------------------------------------------------- zvonce / obavještenja */
.notif-bell { position: relative; border: 1px solid var(--border); background: var(--surface); width: 42px; height: 42px; border-radius: 10px; font-size: 1.2rem; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.notif-bell:hover { color: var(--text); background: var(--surface-2); }
.notif-badge { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.notif-menu { width: min(380px, calc(100vw - 24px)); padding: 0; border-radius: 14px; overflow: hidden; }
.notif-menu-head { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--border); }
.notif-item { display: flex; gap: .75rem; width: 100%; text-align: left; border: 0; background: var(--surface); padding: .75rem 1rem; border-bottom: 1px solid var(--border); align-items: center; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--primary-50); }
.notif-item.unread:hover { background: #e0e9ff; }
.notif-text { min-width: 0; display: flex; flex-direction: column; }
.notif-text .t { font-weight: 600; font-size: .88rem; line-height: 1.3; }
.notif-text .s { font-size: .78rem; color: var(--muted); }
.notif-empty { padding: 1.4rem 1rem; text-align: center; color: var(--muted); }
.notif-menu-foot { display: block; text-align: center; padding: .7rem; font-weight: 600; font-size: .88rem; background: var(--surface-2); }
.notif-card { display: flex; gap: .9rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); align-items: flex-start; }
.notif-card:last-child { border-bottom: 0; }
.notif-card.unread { background: var(--primary-50); box-shadow: inset 3px 0 0 var(--primary); }
.notif-card .body { flex: 1; min-width: 0; }
.notif-card .title { font-weight: 650; }
.notif-card .msg { color: var(--muted); font-size: .9rem; margin: .1rem 0 .35rem; }
.notif-card .meta { font-size: .78rem; color: var(--faint); }
.notif-card .acts { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .6rem; }
.notif-card .acts form { margin: 0; }
@media (max-width: 575.98px) { .notif-menu { position: fixed !important; inset: 64px 12px auto 12px !important; width: auto; transform: none !important; } }

/* ---------------------------------------------------------------- radni nalog agregata (lista provjera) */
.nalog-head { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .9rem 1.25rem; }
.checklist { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.checklist .grp { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .7rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--border); font-weight: 700; letter-spacing: .03em; font-size: .84rem; text-transform: uppercase; color: var(--muted); }
.checklist .grp button { text-transform: none; letter-spacing: 0; font-weight: 600; }
.chk-row { display: grid; grid-template-columns: 2.2rem minmax(0, 1fr) 54px minmax(0, 36%); align-items: center; gap: .5rem; padding: .35rem 1rem; border-bottom: 1px solid var(--border); min-height: 52px; }
.chk-row:last-child { border-bottom: 0; }
.chk-row .rb { color: var(--faint); font-variant-numeric: tabular-nums; font-weight: 600; }
.chk-row .nm { font-weight: 520; }
.chk-row .box { display: grid; place-items: center; }
.chk-row .box input { width: 28px; height: 28px; accent-color: var(--primary); cursor: pointer; }
.chk-row:has(input:checked) { background: #f3f8f5; }
.chk-row .nap { min-height: 38px; }
.chk-view .ok { color: var(--success); font-size: 1.3rem; }
.chk-view .no { color: var(--border-strong); font-size: 1.3rem; }
@media (max-width: 767.98px) {
    .chk-row { grid-template-columns: 1.8rem minmax(0, 1fr) 44px; padding: .55rem .9rem; row-gap: .35rem; }
    .chk-row .nap { grid-column: 2 / 4; }
    .chk-row .box input { width: 32px; height: 32px; }
}
.sticky-actions { position: sticky; bottom: 0; background: rgba(255,255,255,.94); backdrop-filter: blur(6px); border-top: 1px solid var(--border); padding: .75rem 1rem; margin: 1rem -1rem -1rem; display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; z-index: 5; }
.sched-group { border: 1px dashed var(--border-strong); border-radius: 10px; padding: .75rem 1rem; }
.paper-field { display: flex; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--border); }
.paper-field .l { width: 190px; flex: none; color: var(--muted); }
.paper-field .v { font-weight: 620; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 575.98px) { .paper-field { flex-direction: column; gap: 0; } .paper-field .l { width: auto; font-size: .78rem; } }
.bulkbar { display: flex; align-items: center; gap: 1rem; padding: .6rem 1.25rem; background: var(--primary-50); border-bottom: 1px solid var(--primary-100); }
.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: .9rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; }
.step { display: flex; gap: .75rem; align-items: flex-start; }
.step .n { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-50); color: var(--primary-700); display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }

/* v8: tabovi se na telefonu pomjeraju vodoravno (ne sijeku se) */
.nav-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tabs .nav-link { white-space: nowrap; }
.chart { max-height: 280px; }

/* v10: svaki prozor (modal) staje u ekran – zaglavlje i dugmad ostaju vidljivi, sadržaj se skroluje */
@media (min-width: 768px) {
    .modal-dialog { max-height: calc(100vh - 2rem); margin-top: 1rem; margin-bottom: 1rem; }
    .modal-dialog .modal-content { max-height: calc(100vh - 2rem); display: flex; flex-direction: column; }
    .modal-dialog .modal-content > form { display: flex; flex-direction: column; min-height: 0; max-height: 100%; overflow: hidden; }
    .modal-dialog .modal-body { overflow-y: auto; min-height: 0; }
    .modal-header, .modal-footer { flex-shrink: 0; }
}

/* katalog: kratko istakni polja koja je popunio katalog */
.kat-popunjeno { background-color: #e8f5e9 !important; transition: background-color .3s; }

/* ---- indikator učitavanja / otpremanja (assets/js/app.js: vmLoader) */
.vm-loader{position:fixed;inset:0;z-index:2000;pointer-events:none;opacity:0;visibility:hidden;transition:opacity .15s}
.vm-loader.on{opacity:1;visibility:visible}
.vm-loader.blok{pointer-events:auto;background:rgba(255,255,255,.35);cursor:progress}
.vm-loader-bar{position:absolute;top:0;left:0;right:0;height:4px;background:rgba(35,88,216,.15);overflow:hidden}
.vm-loader-bar span{display:block;height:100%;width:2%;background:var(--primary,#2358d8);transition:width .2s ease}
.vm-loader-bar.ind span{width:35%;animation:vm-ind 1.1s ease-in-out infinite}
@keyframes vm-ind{0%{transform:translateX(-100%)}100%{transform:translateX(300%)}}
.vm-loader-pill{position:absolute;left:50%;bottom:24px;transform:translateX(-50%);display:flex;align-items:center;gap:.6rem;max-width:calc(100% - 32px);
  background:#1f2937;color:#fff;padding:.6rem 1rem;border-radius:999px;box-shadow:0 6px 24px rgba(0,0,0,.25);font-size:.92rem;font-variant-numeric:tabular-nums}
@media (prefers-reduced-motion:reduce){.vm-loader-bar.ind span{animation:none;width:100%;opacity:.6}}

/* ---- magacin: fotografije artikala */
.mag-thumb{width:44px;height:44px;border-radius:8px;object-fit:cover;flex:0 0 44px;border:1px solid var(--bs-border-color,#e3e6ee);background:#fff}
.mag-thumb-prazno{display:inline-flex;align-items:center;justify-content:center;color:#b6bdcc;background:#f4f6fa}
.mag-galerija{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:12px}
.mag-slika{margin:0;border:1px solid var(--bs-border-color,#e3e6ee);border-radius:10px;overflow:hidden;background:#fff}
.mag-slika img{display:block;width:100%;aspect-ratio:4/3;object-fit:cover}
.mag-slika figcaption{display:flex;justify-content:space-between;align-items:center;gap:6px;padding:6px 8px;font-size:.8rem;color:#555}

/* ---- zavodna knjiga */
.zk-tabs{gap:4px;flex-wrap:wrap}
.zk-tabs .nav-link{padding:.35rem .8rem;font-size:.9rem}
.zk-broj{display:inline-block;padding:.6rem 1rem;border-radius:10px;background:rgba(35,88,216,.07);border:1px dashed rgba(35,88,216,.35)}
.zk-broj-v{font-size:1.6rem;font-weight:700;letter-spacing:.02em;color:var(--primary,#2358d8)}
