:root {
  --ink: #1b1b2a;
  --ink-soft: #4b4d63;
  --ink-mute: #7a7d93;
  --line: #e6e7f0;
  --line-soft: #f0f1f7;
  --paper: #ffffff;
  --wash: #f7f7fb;
  --accent: #5a4fcf;
  --accent-soft: #eeecfb;
  --accent-ink: #3f35a8;
  --green: #1f8a4c;
  --green-soft: #e6f5ec;
  --amber: #a8650a;
  --amber-soft: #fdf2dc;
  --red: #b3372f;
  --red-soft: #fbe9e7;
  --blue: #2456b8;
  --blue-soft: #e8effc;
  --sidebar: 288px;
  --onpage: 232px;
  --radius: 12px;
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 24px; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--wash);
  -webkit-font-smoothing: antialiased;
}

body.locked { overflow: hidden; }

a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

/* Bočni meni */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  padding: 20px 14px 40px;
  overflow-y: auto;
  background: var(--paper);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
  color: var(--ink);
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
}

.brand small { display: block; font-size: 11.5px; font-weight: 500; color: var(--ink-mute); letter-spacing: 0.01em; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.search { position: relative; padding: 0 4px 12px; }

.search input {
  width: 100%;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
}

.search input:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }

#results:empty { display: none; }

#results {
  margin-top: 6px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(27, 27, 42, 0.1);
}

#results a { display: block; padding: 7px 9px; border-radius: 7px; text-decoration: none; color: var(--ink); line-height: 1.3; }
#results a:hover { background: var(--accent-soft); }
#results b { display: block; font-size: 13.5px; font-weight: 600; }
#results small { font-size: 11.5px; color: var(--ink-mute); }
#results .empty { padding: 8px 9px; font-size: 13px; color: var(--ink-mute); }

.nav-group { margin-top: 10px; }

.nav-label {
  padding: 10px 10px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.nav-group a {
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.35;
  color: var(--ink-soft);
  text-decoration: none;
}

.nav-group a i { display: inline-block; min-width: 28px; font-style: normal; font-variant-numeric: tabular-nums; color: var(--ink-mute); }
.nav-group a.active i { color: var(--accent-ink); }

.nav-group a:hover { background: var(--wash); color: var(--ink); }
.nav-group a.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }

/* Sadržaj */
main {
  margin-left: var(--sidebar);
  display: flex;
  justify-content: center;
  gap: 40px;
  padding: 36px 40px 80px;
}

.page { width: 100%; max-width: 980px; min-width: 0; }

.crumb { font-size: 12.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }

article { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 40px 48px 48px; }

article > :first-child { margin-top: 0; }

h1 { font-size: 34px; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 18px; text-wrap: balance; }
h2 { font-size: 24px; line-height: 1.3; letter-spacing: -0.01em; margin: 52px 0 14px; padding-top: 28px; border-top: 1px solid var(--line); text-wrap: balance; }
h3 { font-size: 18.5px; line-height: 1.35; margin: 34px 0 10px; }
h4 { font-size: 16px; margin: 26px 0 8px; }

h1 + h2 { border-top: 0; padding-top: 0; margin-top: 28px; }

.headerlink { margin-left: 8px; font-weight: 400; color: var(--line); text-decoration: none; }
h1 .headerlink { display: none; }
h2:hover .headerlink, h3:hover .headerlink, h4:hover .headerlink { color: var(--accent); }

p { margin: 0 0 14px; }
h1 + p { font-size: 18px; color: var(--ink-soft); }

ul, ol { margin: 0 0 16px; padding-left: 24px; }
li { margin-bottom: 6px; }
li > ul, li > ol { margin-top: 6px; margin-bottom: 6px; }

strong { font-weight: 650; }

hr { border: 0; border-top: 1px solid var(--line); margin: 36px 0; }

code {
  font-family: var(--mono);
  font-size: 0.86em;
  padding: 2px 6px;
  background: var(--wash);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  overflow-wrap: anywhere;
}

pre {
  margin: 0 0 18px;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.55;
  background: #20202f;
  color: #ecebf7;
  border-radius: var(--radius);
}

pre code { padding: 0; background: none; border: 0; color: inherit; font-size: inherit; overflow-wrap: normal; }

pre.mermaid { background: var(--wash); color: var(--ink-soft); border: 1px solid var(--line); text-align: center; }
pre.mermaid[data-processed] { background: #fff; }

blockquote { margin: 0 0 16px; padding: 4px 18px; border-left: 3px solid var(--accent); color: var(--ink-soft); background: var(--accent-soft); border-radius: 0 10px 10px 0; }
blockquote p:last-child { margin-bottom: 4px; }

/* Tabele */
.table-wrap { margin: 0 0 20px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }

table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.5; }

table.cols-5 { min-width: 900px; }
table.cols-6 { min-width: 1080px; }
table.cols-7 { min-width: 1240px; }

th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-mute); background: var(--wash); white-space: nowrap; }

th, td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }

tr:last-child td { border-bottom: 0; }

td:first-child { font-weight: 600; }

/* Slike ekrana */
figure.shot { margin: 22px 0 26px; }

figure.shot a { display: block; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--wash); box-shadow: 0 6px 24px rgba(27, 27, 42, 0.07); cursor: zoom-in; }

figure.shot img { display: block; width: 100%; height: auto; max-height: 720px; object-fit: cover; object-position: top left; }

figure.shot figcaption { margin-top: 9px; font-size: 13.5px; color: var(--ink-mute); text-align: center; }

.lightbox { position: fixed; inset: 0; z-index: 50; overflow: auto; padding: 28px; background: rgba(20, 20, 32, 0.86); cursor: zoom-out; text-align: center; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: min(1440px, 100%); height: auto; border-radius: 10px; background: #fff; }

/* Istaknuti okviri: !!! note | tip | warning | danger | qa | example */
.admonition { margin: 0 0 20px; padding: 14px 18px 4px; border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius); background: var(--wash); }
.admonition-title { margin-bottom: 6px; font-weight: 700; font-size: 14.5px; }
.admonition.note { border-left-color: var(--blue); background: var(--blue-soft); border-color: #d2def7; }
.admonition.note .admonition-title { color: var(--blue); }
.admonition.tip { border-left-color: var(--green); background: var(--green-soft); border-color: #cbe9d6; }
.admonition.tip .admonition-title { color: var(--green); }
.admonition.warning { border-left-color: #d98a10; background: var(--amber-soft); border-color: #f4dfb2; }
.admonition.warning .admonition-title { color: var(--amber); }
.admonition.danger { border-left-color: var(--red); background: var(--red-soft); border-color: #f2cdc9; }
.admonition.danger .admonition-title { color: var(--red); }
.admonition.qa { border-left-color: var(--accent); background: var(--accent-soft); border-color: #d9d5f6; }
.admonition.qa .admonition-title { color: var(--accent-ink); }
.admonition.example { border-left-color: var(--ink-mute); background: #fff; }

/* Oznake statusa u tekstu: <span class="st st-green">Vraćena</span> */
.st { display: inline-block; padding: 1px 9px; font-size: 12.5px; font-weight: 650; line-height: 1.6; border-radius: 999px; background: var(--wash); border: 1px solid var(--line); color: var(--ink-soft); white-space: nowrap; }
.st-green { background: var(--green-soft); border-color: #cbe9d6; color: var(--green); }
.st-amber { background: var(--amber-soft); border-color: #f4dfb2; color: var(--amber); }
.st-red { background: var(--red-soft); border-color: #f2cdc9; color: var(--red); }
.st-blue { background: var(--blue-soft); border-color: #d2def7; color: var(--blue); }
.st-violet { background: var(--accent-soft); border-color: #d9d5f6; color: var(--accent-ink); }

/* Tok u koracima: <div class="flow"><div>…</div><div>…</div></div> */
.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; margin: 18px 0 24px; counter-reset: flow; }
.flow > div { position: relative; flex: 1 1 150px; padding: 12px 14px; font-size: 14px; line-height: 1.45; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); counter-increment: flow; }
.flow > div::before { content: counter(flow); display: grid; place-items: center; width: 22px; height: 22px; margin-bottom: 6px; font-size: 12px; font-weight: 700; color: #fff; background: var(--accent); border-radius: 50%; }
.flow b { display: block; margin-bottom: 2px; }
.flow small { color: var(--ink-mute); }

/* Kartice na početnoj */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin: 18px 0 26px; }
.cards a { display: block; padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.cards a:hover { border-color: var(--accent); box-shadow: 0 6px 20px rgba(90, 79, 207, 0.12); }
.cards b { display: block; margin-bottom: 4px; font-size: 15.5px; }
.cards span { font-size: 13.5px; color: var(--ink-soft); line-height: 1.45; display: block; }

/* Dno stranice */
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 22px; }
.pager a { flex: 1; max-width: 48%; padding: 14px 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); font-weight: 600; text-decoration: none; }
.pager a:hover { border-color: var(--accent); }
.pager a.next { text-align: right; margin-left: auto; }
.pager small { display: block; font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-mute); }

footer { margin-top: 26px; font-size: 12.5px; color: var(--ink-mute); text-align: center; }

/* Sadržaj stranice desno */
.onpage { position: sticky; top: 28px; flex: 0 0 var(--onpage); align-self: flex-start; max-height: calc(100vh - 56px); overflow-y: auto; padding-left: 4px; }
.onpage .nav-label { padding-left: 12px; }
.onpage a { display: block; padding: 4px 12px; font-size: 13px; line-height: 1.4; color: var(--ink-mute); text-decoration: none; border-left: 2px solid var(--line); }
.onpage a.l3 { padding-left: 24px; font-size: 12.5px; }
.onpage a:hover { color: var(--ink); }
.onpage a.here { color: var(--accent-ink); border-left-color: var(--accent); font-weight: 600; }

.menu-toggle { display: none; }

@media (max-width: 1320px) {
  .onpage { display: none; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; z-index: 30; box-shadow: 0 0 40px rgba(27, 27, 42, 0.2); }
  body.menu-open .sidebar { transform: none; }
  main { margin-left: 0; padding: 64px 14px 60px; }
  article { padding: 24px 20px 30px; border-radius: 12px; }
  h1 { font-size: 27px; }
  h2 { font-size: 21px; }
  .menu-toggle { display: block; position: fixed; top: 12px; left: 12px; z-index: 40; padding: 8px 14px; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sidebar { transition: none; }
}

@media print {
  .sidebar, .onpage, .pager, .menu-toggle, .search, footer { display: none !important; }
  body { background: #fff; font-size: 11.5pt; }
  main { margin: 0; padding: 0; display: block; }
  .page { max-width: none; }
  article { border: 0; padding: 0; }
  h2 { break-after: avoid; }
  figure.shot, .admonition, tr { break-inside: avoid; }
  figure.shot img { max-height: none; }
  a { color: inherit; text-decoration: none; }
}
