:root {
    --bg: #f4f6fa;
    --panel: #ffffff;
    --ink: #1f2733;
    --muted: #6b7689;
    --line: #e3e8f0;
    --brand: #15396b;
    --brand-2: #1d6fb8;
    --accent: #0e7c5a;
    --danger: #c0392b;
    --warn: #b7791f;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(20, 40, 80, .08), 0 6px 24px rgba(20, 40, 80, .06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Layout ---- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 248px;
    background: linear-gradient(180deg, #102c54, #15396b);
    color: #dce6f4;
    padding: 18px 14px;
    flex-shrink: 0;
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; padding: 4px; }
.brand-mark {
    width: 42px; height: 42px; border-radius: 9px;
    background: #fff; color: var(--brand);
    display: grid; place-items: center; font-weight: 800; letter-spacing: .5px;
}
.brand strong { display: block; font-size: 14px; }
.brand small { color: #9fb6d6; font-size: 12px; }

.sidebar nav a {
    display: block; padding: 9px 12px; border-radius: 8px;
    color: #cdddf2; margin-bottom: 2px; font-size: 14px;
}
.sidebar nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.sidebar nav a.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.nav-sep { margin: 16px 12px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: #7f9bc4; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 28px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 19px; margin: 0; }
.user { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; }

.content { padding: 24px 28px; max-width: 1200px; }

/* ---- Cards / panels ---- */
.card {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 20px 22px; margin-bottom: 20px;
}
.card h2 { margin: 0 0 14px; font-size: 16px; }
.card h3 { font-size: 14px; color: var(--muted); margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .4px; }

.grid { display: grid; gap: 16px; }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 820px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
tbody tr:hover { background: #f8fafd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Forms ---- */
.form-row { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
input, select, textarea {
    width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
    font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(29,111,184,.12); }
textarea { min-height: 80px; resize: vertical; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 18px; }
legend { font-weight: 600; padding: 0 8px; color: var(--brand); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
    padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: 14px; text-decoration: none;
}
.btn:hover { text-decoration: none; opacity: .94; }
.btn-primary { background: var(--brand-2); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; }

/* ---- Badges ---- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-nacrt { background: #eef1f6; color: #5a6678; }
.badge-obracunato { background: #e7f0fb; color: #1d6fb8; }
.badge-dokumenti_generirani { background: #fdf3e2; color: #b7791f; }
.badge-zavrseno { background: #e4f6ee; color: #0e7c5a; }
.badge-pep { background: #fdecec; color: #c0392b; }
.badge-ok { background: #e4f6ee; color: #0e7c5a; }
.badge-miss { background: #f3f4f6; color: #9aa3b2; }

/* ---- Flash ---- */
.flash { padding: 12px 28px; font-size: 14px; }
.flash-success { background: #e4f6ee; color: #0e7c5a; border-bottom: 1px solid #c7ead8; }
.flash-error { background: #fdecec; color: #c0392b; border-bottom: 1px solid #f5cdcd; }
.flash-info { background: #e7f0fb; color: #1d6fb8; border-bottom: 1px solid #cfe0f3; }

/* ---- Toolbar ---- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .search { display: flex; gap: 8px; flex: 1; max-width: 420px; }

/* ---- Izračun preview ---- */
.calc-box { background: #f6f9fd; border: 1px dashed var(--brand-2); border-radius: var(--radius); padding: 18px; }
.calc-line { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed #d6e2f0; font-variant-numeric: tabular-nums; }
.calc-line:last-child { border-bottom: 0; }
.calc-total { font-size: 20px; font-weight: 800; color: var(--brand); }
.calc-formula { text-align: center; color: var(--muted); font-size: 13px; margin-top: 10px; }

.muted { color: var(--muted); }
.right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; font-family: "SFMono-Regular", Consolas, monospace; }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #102c54, #1d6fb8); }
.login-card { background: #fff; padding: 34px; border-radius: 14px; width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-card .brand-mark { width: 54px; height: 54px; font-size: 20px; margin: 0 auto 14px; }
.login-card h1 { text-align: center; font-size: 20px; margin: 0 0 4px; }
.login-card p.sub { text-align: center; color: var(--muted); margin: 0 0 22px; font-size: 14px; }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
