/* =========================================================
   Roster Fiscal — dokumentacija
   ========================================================= */
:root {
  --navy: #1E2A36;
  --navy-2: #263545;
  --teal: #0F766E;
  --teal-dark: #0B5A54;
  --teal-soft: #E3F2F0;
  --red: #A01C3C;
  --red-soft: #F6E6EA;
  --amber: #92400E;
  --amber-soft: #FEF3C7;
  --blue: #1D4E89;
  --blue-soft: #E6EEF8;
  --bg: #FFFFFF;
  --bg-soft: #F4F7F9;
  --line: #E1E8EC;
  --text: #1E2A36;
  --muted: #4A5864;
  --font-head: 'Montserrat', system-ui, sans-serif;
  --font-body: 'Source Sans 3', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --header-h: 64px;
  --sidebar-w: 280px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 20px); }
body { margin: 0; font-family: var(--font-body); font-size: 17px; line-height: 1.7; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--teal); }
a:hover { color: var(--teal-dark); }
.sr { position: absolute; left: -9999px; }

/* ---------- Zaglavlje ---------- */
.dh { position: sticky; top: 0; z-index: 40; height: var(--header-h); background: rgba(255,255,255,.97); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.dh__inner { height: 100%; display: flex; align-items: center; gap: 24px; padding: 0 24px; max-width: 1560px; margin: 0 auto; }
.dh__brand { display: flex; align-items: center; gap: 12px; text-decoration: none; flex-shrink: 0; }
.dh__brand img { height: 32px; width: auto; display: block; }
.dh__label { font-family: var(--font-head); font-weight: 700; font-size: 14px; color: var(--muted); padding-left: 12px; border-left: 1px solid var(--line); }
.dh__links { display: flex; gap: 24px; margin-left: auto; }
.dh__links a { font-family: var(--font-head); font-weight: 600; font-size: 14px; color: var(--navy); text-decoration: none; white-space: nowrap; }
.dh__links a:hover { color: var(--teal); }
.dh__menu { display: none; width: 44px; height: 44px; border: 0; background: transparent; border-radius: 10px; cursor: pointer; padding: 10px; color: var(--navy); }
.dh__menu svg, .search__icon { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.dh__menu:hover { background: var(--bg-soft); }

/* ---------- Pretraga ---------- */
.search { position: relative; flex: 0 1 420px; margin-left: 24px; }
.search input {
  width: 100%; height: 42px; padding: 0 40px 0 40px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-soft);
  font: 15px var(--font-body); color: var(--text);
}
.search input:focus { outline: none; border-color: var(--teal); background: #fff; box-shadow: 0 0 0 3px rgba(15,118,110,.15); }
.search__icon { position: absolute; left: 12px; top: 11px; width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.search__kbd { position: absolute; right: 10px; top: 10px; font: 12px var(--font-mono); color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; background: #fff; }
.search input:focus ~ .search__kbd { display: none; }
.search__results {
  position: absolute; top: 48px; left: 0; right: 0; max-height: min(70vh, 520px); overflow: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 20px 50px rgba(30,42,54,.16); padding: 6px;
}
.sr-item { display: block; padding: 10px 12px; border-radius: 8px; text-decoration: none; color: var(--text); }
.sr-item:hover, .sr-item.is-active { background: var(--teal-soft); }
.sr-item__sec { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.sr-item__title { font-family: var(--font-head); font-weight: 700; font-size: 15px; }
.sr-item__snip { font-size: 14px; color: var(--muted); line-height: 1.45; }
.sr-item mark { background: #FDE68A; color: inherit; border-radius: 2px; padding: 0 1px; }
.sr-empty { padding: 14px; color: var(--muted); font-size: 15px; }

/* ---------- Raspored ---------- */
.layout { display: flex; max-width: 1560px; margin: 0 auto; }
.sidebar {
  position: sticky; top: var(--header-h); align-self: flex-start;
  width: var(--sidebar-w); flex-shrink: 0; height: calc(100vh - var(--header-h)); overflow-y: auto;
  padding: 28px 16px 40px 24px; border-right: 1px solid var(--line);
}
.nav-sec { margin-bottom: 24px; }
.nav-sec__title { font-family: var(--font-head); font-weight: 700; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--red); margin: 0 0 6px 12px; }
.nav-sec ul { list-style: none; margin: 0; padding: 0; }
.nav-sec a {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 8px;
  font-size: 15px; color: var(--muted); text-decoration: none; line-height: 1.4;
}
.nav-sec a:hover { background: var(--bg-soft); color: var(--navy); }
.nav-sec a.is-active { background: var(--teal-soft); color: var(--teal-dark); font-weight: 700; }
.badge { margin-left: auto; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--red-soft); color: var(--red); }
.ext { margin-left: auto; font-size: 13px; }
.scrim { display: none; }

.main { flex: 1; min-width: 0; display: flex; gap: 48px; padding: 40px 48px 80px; }
.doc { flex: 1; min-width: 0; max-width: 820px; }
.toc { width: 220px; flex-shrink: 0; position: sticky; top: calc(var(--header-h) + 40px); align-self: flex-start; max-height: calc(100vh - var(--header-h) - 60px); overflow-y: auto; }
.toc__title { font-family: var(--font-head); font-weight: 700; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc a { display: block; padding: 4px 0 4px 14px; margin-left: -2px; border-left: 2px solid transparent; font-size: 14px; color: var(--muted); text-decoration: none; line-height: 1.4; }
.toc__l3 a { padding-left: 26px; font-size: 13px; }
.toc a:hover { color: var(--navy); }
.toc a.is-active { color: var(--teal); border-left-color: var(--teal); font-weight: 600; }

/* ---------- Sadržaj ---------- */
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.crumbs a { text-decoration: none; }
.crumbs span { margin: 0 8px; color: #A9B6BF; }
.doc h1 { font-family: var(--font-head); font-weight: 800; font-size: 40px; line-height: 1.15; letter-spacing: -0.015em; margin: 0 0 14px; }
.doc__lead { font-size: 20px; color: var(--muted); margin: 0 0 32px; line-height: 1.55; }

.prose > *:first-child { margin-top: 0; }
.prose h2, .prose h3, .prose h4 { font-family: var(--font-head); line-height: 1.3; position: relative; }
.prose h2 { font-size: 26px; font-weight: 800; margin: 52px 0 14px; padding-top: 8px; }
.prose h3 { font-size: 20px; font-weight: 700; margin: 36px 0 10px; }
.prose h4 { font-size: 17px; font-weight: 700; margin: 28px 0 8px; }
.anchor { margin-left: 8px; color: #B8C7D0; text-decoration: none; font-weight: 600; opacity: 0; transition: opacity .15s; }
.prose h2:hover .anchor, .prose h3:hover .anchor, .anchor:focus { opacity: 1; }
.prose p, .prose ul, .prose ol { margin: 0 0 18px; }
.prose ul, .prose ol { padding-left: 24px; }
.prose li { margin-bottom: 6px; }
.prose li > ul, .prose li > ol { margin: 6px 0 0; }
.prose strong { font-weight: 700; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
.prose img { max-width: 100%; height: auto; }

/* Numerisane liste kao koraci */
.prose ol { list-style: none; padding-left: 0; counter-reset: step; }
.prose ol > li { counter-increment: step; position: relative; padding-left: 44px; min-height: 30px; margin-bottom: 14px; }
.prose ol > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 50%; background: var(--teal); color: #fff;
  font: 700 14px/30px var(--font-head); text-align: center;
}

/* Kod */
.prose code { font-family: var(--font-mono); font-size: .86em; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }
.prose pre { position: relative; margin: 0 0 22px; background: #F7F9FA; border: 1px solid var(--line); border-radius: 12px; overflow: auto; }
.prose pre code { display: block; padding: 18px 20px; background: none; border: 0; font-size: 14px; line-height: 1.6; }
.prose pre code.hljs { background: none; padding: 18px 20px; }
.code-lang { position: absolute; top: 8px; right: 70px; font: 600 11px var(--font-mono); text-transform: uppercase; color: #8A99A5; letter-spacing: .05em; }
.copy-btn {
  position: absolute; top: 6px; right: 8px; height: 28px; padding: 0 10px; border-radius: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--muted); font: 600 12px var(--font-body); cursor: pointer;
}
.copy-btn:hover { color: var(--teal); border-color: var(--teal); }

/* Tabele */
.table-wrap { overflow-x: auto; margin: 0 0 22px; border: 1px solid var(--line); border-radius: 12px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; }
.prose th { text-align: left; background: var(--bg-soft); font-family: var(--font-head); font-weight: 700; font-size: 13px; color: var(--navy); }
.prose th, .prose td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose tr:last-child td { border-bottom: 0; }

/* Screenshotovi */
.shot { margin: 28px 0; }
.shot__zoom { display: block; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(30,42,54,.08); cursor: zoom-in; background: var(--bg-soft); }
.shot__zoom img { display: block; width: 100%; height: auto; transition: transform .3s; }
.shot__zoom:hover img { transform: scale(1.01); }
.shot figcaption { font-size: 14px; color: var(--muted); text-align: center; margin-top: 10px; }

/* Napomene */
.callout { border-radius: 12px; padding: 16px 20px; margin: 0 0 22px; border: 1px solid; }
.callout p { margin: 0 0 8px; }
.callout p:last-child { margin-bottom: 0; }
.callout__title { font-family: var(--font-head); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; display: flex; align-items: center; gap: 8px; }
.callout__title::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: currentColor; }
.callout--note { background: var(--blue-soft); border-color: #C5D6EC; }
.callout--note .callout__title { color: var(--blue); }
.callout--tip { background: var(--teal-soft); border-color: #B5DDD7; }
.callout--tip .callout__title { color: var(--teal-dark); }
.callout--warn { background: var(--amber-soft); border-color: #F3D27A; }
.callout--warn .callout__title { color: var(--amber); }
.callout--important { background: var(--red-soft); border-color: #E7B9C5; }
.callout--important .callout__title { color: var(--red); }
.prose blockquote { margin: 0 0 22px; padding: 4px 20px; border-left: 3px solid var(--line); color: var(--muted); }

/* Kartice (HTML u Markdown-u: <div class="cards">…) */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 0 0 24px; }
.cards a { display: block; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--text); transition: border-color .2s, box-shadow .2s, transform .2s; }
.cards a:hover { border-color: var(--teal); box-shadow: 0 10px 24px rgba(30,42,54,.08); transform: translateY(-2px); color: var(--text); }
.cards strong { display: block; font-family: var(--font-head); font-size: 16px; margin-bottom: 4px; color: var(--navy); }
.cards span { font-size: 15px; color: var(--muted); line-height: 1.5; display: block; }

/* HTTP metode u tekstu: <span class="m m-get">GET</span> */
.m { display: inline-block; font: 700 12px var(--font-mono); padding: 2px 8px; border-radius: 5px; color: #fff; vertical-align: 1px; }
.m-get { background: #1D4E89; } .m-post { background: var(--teal); } .m-put { background: #92400E; } .m-delete { background: var(--red); }

/* Prethodno / sledeće */
.pn { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 56px 0 0; }
.pn__item { display: flex; flex-direction: column; padding: 16px 20px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--navy); transition: border-color .2s; }
.pn__item:hover { border-color: var(--teal); color: var(--navy); }
.pn__item small { color: var(--muted); font-size: 13px; }
.pn__item span { font-family: var(--font-head); font-weight: 700; font-size: 16px; }
.pn__item--next { text-align: right; grid-column: 2; }

.doc__foot { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 15px; color: var(--muted); }
.help strong { color: var(--navy); margin-right: 4px; }
.updated { font-size: 14px; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(15, 22, 30, .92); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 120px); border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.lightbox__cap { color: #D3DCE2; margin: 14px 0 0; font-size: 15px; text-align: center; }
.lightbox__close { position: absolute; top: 14px; right: 18px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .toc { display: none; }
  .main { padding: 36px 40px 72px; }
}
@media (max-width: 960px) {
  .dh__menu { display: inline-flex; }
  .dh__links { display: none; }
  .dh__inner { gap: 12px; padding: 0 12px; }
  .search { margin-left: auto; }
  .sidebar {
    position: fixed; top: var(--header-h); left: 0; bottom: 0; z-index: 35; height: auto;
    background: #fff; transform: translateX(-100%); transition: transform .25s ease; box-shadow: 0 0 40px rgba(30,42,54,.15);
  }
  body.nav-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: var(--header-h) 0 0 0; z-index: 30; background: rgba(30,42,54,.35); }
  .scrim[hidden] { display: none; }
  .main { padding: 28px 20px 64px; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .dh__label { display: none; }
  .dh__brand img { height: 28px; }
  .search { flex: 1; }
  .search__kbd { display: none; }
  .search__results { position: fixed; top: calc(var(--header-h) + 4px); left: 8px; right: 8px; }
  .doc h1 { font-size: 30px; }
  .doc__lead { font-size: 18px; }
  .prose h2 { font-size: 22px; margin-top: 40px; }
  .main { padding: 24px 16px 56px; }
  .pn { grid-template-columns: 1fr; }
  .pn__item--next { grid-column: 1; }
  .shot { margin: 22px -4px; }
}

/* ---------- Štampa / PDF ---------- */
@media print {
  .dh, .sidebar, .toc, .pn, .copy-btn, .anchor, .scrim, .lightbox { display: none !important; }
  .main { padding: 0; }
  .doc { max-width: none; }
  body { font-size: 11pt; }
  .shot__zoom { box-shadow: none; }
  .prose h2 { break-after: avoid; }
  .shot, pre, .callout, table { break-inside: avoid; }
  a { color: inherit; }
}
