
.custom-tooltip { 
  --bs-tooltip-bg: #4c0bce;
  --bs-tooltip-color: white;
}

/* ---------- Tema aplikacije: Primat ljubičasta umjesto Bootstrap plave, mirnije kartice i tablice ---------- */
:root {
  --app-ink: #1d1638;
  --app-brand: #4c0bce;
  --app-brand-dark: #3a0ca3;
  --app-line: #e3def3;
  --app-muted: #5b5477;
  --app-canvas: #f4f2fb;

  --bs-body-color: #1d1638;
  --bs-body-color-rgb: 29, 22, 56;
  --bs-primary: #4c0bce;
  --bs-primary-rgb: 76, 11, 206;
  --bs-primary-bg-subtle: #ece6fb;
  --bs-primary-border-subtle: #cdbff4;
  --bs-primary-text-emphasis: #2e0a82;
  --bs-link-color: #4c0bce;
  --bs-link-color-rgb: 76, 11, 206;
  --bs-link-hover-color: #3a0ca3;
  --bs-link-hover-color-rgb: 58, 12, 163;
  --bs-secondary-color: #6b6485;
  --bs-border-color: #e3def3;
  --bs-focus-ring-color: rgba(76, 11, 206, .25);
}

body { background-color: #fbfaff; }

main h3, main .h3 { font-weight: 650; letter-spacing: -.015em; }

/* navigacija i podnožje */
.navbar.bg-dark, .footer.bg-dark { background-color: var(--app-ink) !important; }
.navbar .nav-link { position: relative; }
.navbar .nav-link.active { color: #fff; font-weight: 500; }
@media (min-width: 992px) {
  .navbar .nav-link.active::after {
    content: "";
    position: absolute;
    left: .5rem;
    right: .5rem;
    bottom: -.15rem;
    height: 2px;
    border-radius: 2px;
    background: #a98eda;
  }
}
.navbar .dropdown-menu { --bs-dropdown-link-active-bg: var(--app-brand); }
.footer { height: 36px !important; font-size: .8rem; display: flex; align-items: center; }
.footer .text-light { opacity: .75; }

/* kartice */
.card { border-color: var(--app-line); border-radius: .75rem; }
.card.shadow-sm { box-shadow: 0 1px 0 var(--app-line), 0 14px 30px -24px rgba(58, 12, 163, .55) !important; }
.card-header {
  padding: .8rem 1rem;
  background: #fff;
  border-bottom-color: var(--app-line);
  font-weight: 600;
}
.card-header:first-child { border-radius: .75rem .75rem 0 0; }
.card-header sup .badge.bg-secondary { background-color: #ece8f6 !important; color: var(--app-muted); }

/* tablice */
.table {
  --bs-table-bg: transparent;
  --bs-table-border-color: #ece8f6;
  --bs-table-hover-bg: #f6f3fd;
  font-variant-numeric: tabular-nums;
}
.table > thead th {
  font-size: .8rem;
  font-weight: 600;
  color: var(--app-muted);
  border-bottom-color: #d9d3ee;
  white-space: nowrap;
}
.table > tbody > tr:last-child > * { border-bottom-color: transparent; }

/* gumbi i forme */
.btn { --bs-btn-border-radius: .5rem; }
.btn-sm { --bs-btn-border-radius: .45rem; }
.btn-primary {
  --bs-btn-bg: #4c0bce;
  --bs-btn-border-color: #4c0bce;
  --bs-btn-hover-bg: #3a0ca3;
  --bs-btn-hover-border-color: #3a0ca3;
  --bs-btn-active-bg: #2e0a82;
  --bs-btn-active-border-color: #2e0a82;
  --bs-btn-disabled-bg: #4c0bce;
  --bs-btn-disabled-border-color: #4c0bce;
  --bs-btn-focus-shadow-rgb: 76, 11, 206;
}
.btn-outline-primary {
  --bs-btn-color: #4c0bce;
  --bs-btn-border-color: #cdbff4;
  --bs-btn-hover-bg: #4c0bce;
  --bs-btn-hover-border-color: #4c0bce;
  --bs-btn-active-bg: #3a0ca3;
  --bs-btn-active-border-color: #3a0ca3;
  --bs-btn-disabled-color: #4c0bce;
  --bs-btn-disabled-border-color: #cdbff4;
  --bs-btn-focus-shadow-rgb: 76, 11, 206;
}
.btn-outline-secondary {
  --bs-btn-color: var(--app-muted);
  --bs-btn-border-color: #d6d0ec;
  --bs-btn-hover-color: var(--app-ink);
  --bs-btn-hover-bg: var(--app-canvas);
  --bs-btn-hover-border-color: #bdb4de;
  --bs-btn-active-color: var(--app-ink);
  --bs-btn-active-bg: #e7e3f3;
  --bs-btn-active-border-color: #bdb4de;
}
.form-control:focus, .form-select:focus { border-color: #a98eda; box-shadow: 0 0 0 .2rem rgba(76, 11, 206, .18); }
.form-check-input:checked { background-color: #4c0bce; border-color: #4c0bce; }
.form-check-input:focus { border-color: #a98eda; box-shadow: 0 0 0 .2rem rgba(76, 11, 206, .18); }
.progress { --bs-progress-bar-bg: #4c0bce; --bs-progress-bg: #e7e3f3; }
.alert { border-radius: .6rem; }
.badge { font-weight: 600; }
.bg-body-tertiary { background-color: #f8f6fd !important; }


/* ---------- Downloads ---------- */
.install-steps { margin: 0; padding-left: 1.2rem; }
.install-steps li { padding: .3rem 0 .3rem .25rem; }
.install-steps li::marker { font-weight: 650; color: var(--app-brand); }

.download-link {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .3rem .6rem;
  margin: -.1rem -.6rem;
  border-radius: .45rem;
  font-weight: 600;
  text-decoration: none;
}
.download-link:hover, .download-link:focus-visible { background: var(--bs-primary-bg-subtle); }

/* popis izmjena ispod reda verzije (changes_hr.md / changes_en.md) */
#downloadsTable tr:has(+ .release-notes-row) > td { border-bottom-width: 0; }
#downloadsTable .release-notes-row > td { padding-top: 0; }
#downloadsTable .release-notes-row:hover > td { --bs-table-bg-state: transparent; }
.release-notes { font-size: .875rem; color: var(--app-muted); overflow-wrap: anywhere; }
.release-notes > :first-child { margin-top: 0; }
.release-notes > :last-child { margin-bottom: 0; }
.release-notes h1, .release-notes h2, .release-notes h3, .release-notes h4 {
  font-size: .9rem;
  font-weight: 650;
  color: var(--app-ink);
  margin: .6rem 0 .25rem;
}
.release-notes p { margin: 0 0 .35rem; }
.release-notes ul, .release-notes ol { margin: 0 0 .35rem; padding-left: 1.2rem; }
.release-notes li { padding: .05rem 0; }
.release-notes code { font-size: .8rem; }


/* ---------- System Info ---------- */
.fact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));   /* 6 podataka: 2x3 na uskom, 3x2 na širokom ekranu - bez siročeta u zadnjem redu */
  gap: 1px;
  border: 1px solid var(--app-line);
  border-radius: .75rem;
  background: var(--app-line);
  overflow: hidden;
}
@media (min-width: 768px) { .fact-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.fact { padding: .9rem 1rem; background: #fff; }
.fact-label { font-size: .8rem; color: var(--app-muted); }
.fact-value { font-size: 1.35rem; font-weight: 650; letter-spacing: -.015em; line-height: 1.3; overflow-wrap: anywhere; }
.fact-value-note { font-weight: 400; color: var(--app-muted); }
.fact-note { font-size: .8rem; color: var(--app-muted); }
.fact-warn .fact-value { color: #b45309; }

.usage-bar { display: flex; align-items: center; gap: .6rem; }
.usage-bar-pct { flex: none; width: 3.6rem; text-align: right; font-size: .85rem; font-weight: 600; }
.usage-bar .progress { flex: 1; height: .45rem; }

/* redak resursa koji se klikom proširuje u detalje (open cursors) */
.usage-row-toggle { color: inherit; text-decoration: none; text-align: left; }
.usage-row-toggle .toggle-chevron { display: inline-block; transition: transform .15s; font-size: .8rem; }
.usage-row-toggle[aria-expanded="true"] .toggle-chevron { transform: rotate(180deg); }
.cursor-details > td { background: var(--app-canvas); }
.cursor-sql-text { font-family: var(--bs-font-monospace); font-size: .78rem; max-width: 38rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* rezultat skupne akcije po retku - greške kompilacije dolaze svaka u svom retku */
.batch-result { white-space: pre-line; overflow-wrap: anywhere; }

.health-checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: .25rem 1.5rem; }
.health-check {
  display: grid;
  grid-template-columns: 1.4rem 1fr;
  column-gap: .5rem;
  padding: .45rem .5rem;
  margin: 0 -.5rem;
  border-radius: .5rem;
  color: inherit;
  text-decoration: none;
}
.health-check:hover, .health-check:focus-visible { background: var(--app-canvas); }
.health-check .bi { grid-row: span 2; font-size: 1.05rem; line-height: 1.5; }
.health-check-title { font-weight: 600; }
.health-check-detail { font-size: .85rem; color: var(--app-muted); }
.health-check-ok .bi { color: #15803d; }
.health-check-warn .bi { color: #d97706; }
.health-check-danger .bi { color: #dc2626; }
.health-check-warn .health-check-detail, .health-check-danger .health-check-detail { color: var(--app-ink); }

  

/* ---------- Globalni indikator učitavanja (pageProgress.js) ---------- */
#pageProgress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 2000;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease;
}

#pageProgress.active {
  opacity: 1;
  transition-delay: .12s;   /* kratki pozivi ne bljeskaju trakom */
}

#pageProgress::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 35%;
  background: linear-gradient(90deg, transparent, #a98eda 20%, #ffffff 50%, #a98eda 80%, transparent);
  transform: translateX(-100%);
}

#pageProgress.active::before {
  animation: pageProgressSlide 1.1s ease-in-out infinite;
}

@keyframes pageProgressSlide {
  from { transform: translateX(-100%); }
  to   { transform: translateX(300%); }
}

/* Placeholder dok se sekcija učitava ajaxom */
.loading-placeholder .progress { height: .5rem; }

/* Sekcija koja se ponovno učitava, a već ima sadržaj */
.is-reloading { opacity: .55; transition: opacity .15s ease; }

@media (prefers-reduced-motion: reduce) {
  #pageProgress.active::before { animation-duration: 3s; }
}


/* ---------- Devices: skok na sekciju (linkovi s početne stranice) ---------- */
#mobile-computers, #printers, #libras { scroll-margin-top: 1rem; }


/* Devices: IP adresa uređaja s licencom -> link na licencu (običan tekst + ikona, bez plavog podcrtanog linka) */
.licence-link {
  display: inline-flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
  border-radius: .25rem;
  padding: .1rem .35rem;
  margin: -.1rem -.35rem;
  transition: background-color .15s ease, color .15s ease;
}
.licence-link .bi { font-size: .8em; color: var(--bs-primary); }
.licence-link:hover,
.licence-link:focus-visible { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); }


/* ---------- Home: topologija sustava ---------- */
/* Platno s točkastom mrežom (shema), App server kao tamno čvorište, veze kao dvosmjerni vodovi po kojima teku crtice. */
.topo-canvas {
  --topo-ink: #1d1638;
  --topo-hub: #3a0ca3;
  --topo-wire: #8478b8;
  --topo-db: #b45309;
  --topo-dev: #0f766e;
  --topo-gap: 1rem;
  background-color: #f4f2fb;
  background-image: radial-gradient(circle, #d6d0ec 1px, transparent 1.5px);
  background-size: 18px 18px;
  border: 1px solid #e3def3;
  border-radius: 1rem;
  padding: 1.5rem 1.25rem;
}

.topo {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "db" "ldb" "app" "scan" "fork";
  row-gap: var(--topo-gap);
  max-width: 23rem;
  margin: 0 auto;
}

.topo-area-db    { grid-area: db; }
.topo-area-ldb   { grid-area: ldb; }
.topo-area-app   { grid-area: app; }
.topo-area-lscan { grid-area: lscan; }
.topo-area-scan  { grid-area: scan; }
.topo-area-fork  { grid-area: fork; }

/* --- čvorovi --- */
.topo-node {
  --topo-accent: var(--topo-wire);
  display: block;
  position: relative;
  min-width: 0;
  padding: 1rem 1.1rem 1.1rem;
  border: 1px solid #ddd7f0;
  border-radius: .75rem;
  background: #fff;
  color: var(--topo-ink);
  text-decoration: none;
  box-shadow: 0 1px 0 #e3def3, 0 10px 24px -18px rgba(58, 12, 163, .55);
}

.topo-node-db     { --topo-accent: var(--topo-db); }
.topo-node-device { --topo-accent: var(--topo-dev); }

/* App server -> čvorište: jedini tamni element na platnu */
.topo-node-app {
  --topo-accent: #fff;
  background: linear-gradient(160deg, #4c0bce, var(--topo-hub) 70%);
  border-color: var(--topo-hub);
  color: #fff;
  box-shadow: 0 0 0 5px rgba(76, 11, 206, .12), 0 18px 34px -18px rgba(58, 12, 163, .9);
}

.topo-node-head {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .6rem;
}

.topo-node-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: .55rem;
  font-size: 1.1rem;
  color: var(--topo-accent);
  background: color-mix(in srgb, var(--topo-accent) 12%, transparent);
}
.topo-node-app .topo-node-icon { background: rgba(255, 255, 255, .16); }
.topo-icon-db  { --topo-accent: #b45309; }
.topo-icon-app { --topo-accent: #4c0bce; }

.topo-node-role { font-size: .9rem; font-weight: 600; }
.topo-node:not(.topo-node-app) .topo-node-role { color: #5b5477; }

.topo-node-tag {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-left: auto;
  padding: .15rem .55rem;
  border-radius: 1rem;
  font-size: .75rem;
  font-weight: 500;
  background: rgba(255, 255, 255, .16);
  white-space: nowrap;
}
.topo-node-dot { width: .45rem; height: .45rem; border-radius: 50%; background: #4ade80; }

.topo-node-main {
  font-size: 1.5rem;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -.015em;
  margin-bottom: .35rem;
  overflow-wrap: anywhere;
}

.topo-node-line {
  font-size: .875rem;
  line-height: 1.55;
  color: #5b5477;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.topo-node-app .topo-node-line { color: rgba(255, 255, 255, .82); }

/* --- grupe uređaja: broj aktivnih + mjerač udjela --- */
.topo-count { display: flex; align-items: baseline; gap: .45rem; }
.topo-count-active { font-size: 2.1rem; font-weight: 650; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.topo-count-total { font-size: .875rem; color: #5b5477; }

.topo-meter {
  height: .3rem;
  margin: .6rem 0 .45rem;
  border-radius: 1rem;
  background: #e7e3f3;
  overflow: hidden;
}
.topo-meter > span { display: block; height: 100%; border-radius: inherit; background: var(--topo-accent); }

.topo-node-go {
  margin-left: auto;
  font-size: .8rem;
  color: #a39cc4;
  transition: transform .15s ease, color .15s ease;
}

a.topo-node-device { transition: border-color .15s ease, box-shadow .15s ease; }
a.topo-node-device:hover,
a.topo-node-device:focus-visible {
  border-color: var(--topo-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--topo-accent) 18%, transparent), 0 10px 24px -18px rgba(15, 118, 110, .8);
}
a.topo-node-device:focus-visible { outline: none; }
a.topo-node-device:hover .topo-node-go,
a.topo-node-device:focus-visible .topo-node-go { color: var(--topo-accent); transform: translateX(3px); }

/* --- vodovi: dvije trake, crtice teku u suprotnim smjerovima (dvosmjerna komunikacija) --- */
.topo-wire {
  --dash: linear-gradient(90deg, var(--topo-wire) 55%, transparent 0);
  display: block;
  position: relative;
  flex: none;
  width: 9px;
  height: 2.25rem;
}
.topo-wire::before,
.topo-wire::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--topo-wire) 55%, transparent 0) 0 0 / 2px 10px repeat-y;
  animation: topoFlowV 1.1s linear infinite;
}
.topo-wire::before { left: 0; }
.topo-wire::after  { right: 0; animation-direction: reverse; }

@keyframes topoFlowV { to { background-position: 0 10px; } }
@keyframes topoFlowH { to { background-position: 10px 0; } }

.topo-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.topo-link-label {
  position: absolute;
  left: calc(50% + 1rem);
  top: 50%;
  transform: translateY(-50%);
  padding: .1rem .55rem;
  border: 1px solid #ddd7f0;
  border-radius: 1rem;
  background: #fff;
  font-size: .75rem;
  font-weight: 500;
  color: #5b5477;
  white-space: nowrap;
}

/* Uski ekran: uređaji su stablo ispod App servera (lijeva vodilica), da se ne čita kao lanac skener -> printer */
.topo-area-lscan, .topo-fanout { display: none; }
.topo-fork, .topo-branch { display: contents; }

.topo-node-device { margin-left: 2rem; }

.topo-node-device::before {            /* od vodilice do čvora */
  content: "";
  position: absolute;
  left: calc(-1.25rem - 1px);
  top: calc(-1 * var(--topo-gap) - 1px);
  height: calc(50% + var(--topo-gap) + 1px);
  width: 1.25rem;
  border-left: 2px solid var(--topo-wire);
  border-bottom: 2px solid var(--topo-wire);
  border-bottom-left-radius: .5rem;
}

.topo-node-device::after {             /* nastavak vodilice do sljedećeg uređaja */
  content: "";
  position: absolute;
  left: calc(-1.25rem - 1px);
  top: 50%;
  bottom: -1px;
  border-left: 2px solid var(--topo-wire);
}

.topo > .topo-node-device:last-child::after,
.topo-branch:last-child > .topo-node-device::after { display: none; }

/* --- detalji ispod platna --- */
.topo-spec-title {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .75rem;
  font-weight: 600;
}

.topo-details th {
  width: 9.5rem;
  padding-left: 0;
  font-weight: 400;
  color: var(--bs-secondary-color);
  white-space: nowrap;
}
.topo-details td { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.topo-details tr:last-child > * { border-bottom: 0; }

/* Široki ekran: BAZA <-> APP SERVER <-> skeneri u jednom redu, printeri, vage i line scanneri ispod App servera */
@media (min-width: 992px) {
  .topo-canvas { padding: 2.5rem 2rem; }

  .topo {
    grid-template-columns: minmax(0, 1fr) 12rem minmax(0, 1.15fr) 12rem minmax(0, 1fr);
    grid-template-areas:
      "db   ldb  app   lscan scan"
      "fork fork fork  fork  fork";
    row-gap: 0;
    max-width: none;
    align-items: center;
    position: relative;
  }

  .topo-no-peripherals { grid-template-areas: "db ldb app lscan scan"; }

  .topo-area-lscan { display: flex; }

  /* vodoravni vod */
  .topo-link { flex-direction: row; }
  .topo-link .topo-wire { flex: 1; width: auto; height: 9px; }
  .topo-link .topo-wire::before,
  .topo-link .topo-wire::after {
    left: 0;
    right: 0;
    top: auto;
    bottom: auto;
    width: auto;
    height: 2px;
    background: var(--dash) 0 0 / 10px 2px repeat-x;
    animation-name: topoFlowH;
  }
  .topo-link .topo-wire::before { top: 0; }
  .topo-link .topo-wire::after  { bottom: 0; }

  .topo-link-label { left: 50%; top: 50%; transform: translate(-50%, -50%); }

  .topo-node-device { margin-left: 0; }
  .topo-node-device::before, .topo-node-device::after { display: none; }

  /* grupe ispod App servera; prostor iznad njih je za vodove (svaki vod zaseban, crta ih js/topology.js) */
  .topo-fork { display: flex; justify-content: center; gap: 2rem; padding-top: 5rem; }
  .topo-branch { display: block; position: relative; flex: 0 1 17rem; min-width: 0; }

  .topo-fanout {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
  }
}

/* vod App server -> grupa ispod njega: crtice teku od App servera prema uređajima */
.topo-lane {
  fill: none;
  stroke: var(--topo-wire);
  stroke-width: 2;
  stroke-dasharray: 5.5 4.5;
  stroke-linejoin: round;
  animation: topoLane 1.1s linear infinite;
}

@keyframes topoLane { to { stroke-dashoffset: -10; } }

.topo-fanout-label { z-index: 1; }

@media (prefers-reduced-motion: reduce) {
  .topo-wire::before, .topo-wire::after, .topo-lane { animation: none; }
}
