/* Nadzorna ploča Medikor Huba. Izgled prati webshop (shop-medikor.hr): bijela podloga,
   oštri rubovi, naslovi u tankom serifu velikim slovima, Medikor plava #003399 za radnje.
   Fontovi su lokalni (SIL OFL, licence u fonts/), bez učitavanja s Googlea. */

@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/manrope-latin-ext-400.b0f47ce93b74.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/manrope-latin-400.84c90a24de75.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/manrope-latin-ext-500.7a8057cec05f.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/manrope-latin-500.6bb1d1cc9a9c.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/manrope-latin-ext-600.f386cb233a56.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/manrope-latin-600.d291d41d2872.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/manrope-latin-ext-700.deb3a4785b17.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/manrope-latin-700.5d0c39c84f7b.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/cormorant-garamond-latin-ext-400.cf54620e3006.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/cormorant-garamond-latin-400.ad42ff0a48cd.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/cormorant-garamond-latin-ext-500.7ba973c61ce4.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/cormorant-garamond-latin-500.edfa21ab8b94.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --ink: #111111;
  --text: #252525;
  --muted: #5c5c5c;
  --line: #e5e5e5;
  --soft: #f2f2f2;
  --panel: #fafafa;
  --page: #ffffff;
  --blue: #003399;
  --blue-dark: #00246b;
  --bar-failed: #c55a11;
  --good: #1f7a3a;
  --good-bg: #e6f2ea;
  --bad: #b4410b;
  --bad-bg: #fbeadf;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--text); font: 14px/1.5 var(--sans); }
a { color: var(--blue); }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
h1, h2, h3 { color: var(--ink); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Raspored: bočni izbornik i sadržaj. Izbornik stoji na mjestu dok se sadržaj pomiče (sticky, a ako
   je prozor niži od izbornika, izbornik se pomiče sam). Na mobitelu izbornik ide iznad sadržaja. */
.layout { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); align-items: start; }
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; overscroll-behavior: contain; padding: 28px 24px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 32px; }
.brand img { display: block; width: 152px; height: auto; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; color: #404041; text-decoration: none; font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.nav a:hover { background: var(--soft); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--soft); color: var(--ink); font-weight: 700; }
.nav svg { width: 18px; height: 18px; flex: none; }
.account { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.account-name { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.account a, .link-button { font-size: 13px; }
.link-button { padding: 0; border: 0; background: none; color: var(--blue); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; text-align: left; }
.main { min-width: 0; padding: 40px 48px 56px; display: flex; flex-direction: column; gap: 32px; }
@media (max-width: 720px) {
  .layout { display: block; }
  .sidebar { position: static; height: auto; overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); gap: 16px; padding: 20px 16px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav a { padding: 0 10px; gap: 8px; }
  .account { margin-top: 0; flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 16px; }
  .account-name { flex-basis: 100%; }
  .main { padding: 24px 16px 40px; }
}

/* Zaglavlje stranice */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; }
.page-head > div:not(.actions) { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.title { margin: 0; font: 400 44px/1 var(--serif); letter-spacing: .04em; text-transform: uppercase; overflow-wrap: anywhere; }
.subtitle { margin: 0; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.breadcrumb { font-size: 13px; }

/* Gumbi */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border: 1px solid var(--blue); background: var(--blue); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; }
.btn-outline { background: #fff; color: var(--ink); border-color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-danger { background: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: #8a3209; border-color: #8a3209; }

/* Odabir razdoblja */
.periods { display: flex; border: 1px solid var(--ink); }
.periods a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; color: var(--ink); font-weight: 600; text-decoration: none; }
.periods a[aria-current="true"] { background: var(--ink); color: #fff; }

/* Ključni brojevi */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border: 1px solid var(--line); }
.kpi { padding: 20px 22px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.kpi:last-child { border-right: 0; }
.kpi-label, .label { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.kpi-value { font-size: 34px; font-weight: 600; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi-note { font-size: 13px; color: #404041; }
.kpi-bad .kpi-value { color: var(--bad); }

/* Paneli */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 24px; }
.panel { margin: 0; min-width: 0; border: 1px solid var(--line); padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.panel-soft { background: var(--panel); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
@media (min-width: 1280px) { .span-2 { grid-column: span 2; } }
@media (max-width: 1100px) { .span-2 { grid-column: auto; } }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; }
.panel-title { margin: 0; font: 500 24px/1.1 var(--serif); letter-spacing: .04em; text-transform: uppercase; }
.empty { margin: 0; color: var(--muted); }

/* Stupčasti grafikon */
.legend { display: flex; gap: 16px; font-size: 13px; color: #404041; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; display: inline-block; }
.swatch-ok { background: var(--blue); }
.swatch-failed { background: var(--bar-failed); }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 220px; border-bottom: 1px solid var(--ink); }
.chart-small { height: 140px; gap: 3px; }
.bar { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bar-failed { background: var(--bar-failed); }
.bar-ok { flex: 1; background: var(--blue); }
.axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* Vodoravne trake (alati) */
.meters { display: flex; flex-direction: column; gap: 18px; }
.meter-head { display: flex; justify-content: space-between; gap: 12px; color: var(--ink); }
.meter-head span:first-child { font-weight: 500; }
.meter-head span:last-child { font-weight: 600; }
.meter { height: 6px; background: var(--soft); margin-top: 6px; }
.meter > span { display: block; height: 6px; background: var(--ink); }

/* Tablice */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 8px 12px 8px 0; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--ink); white-space: nowrap; }
.table td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th.num, .table td.num { text-align: right; padding-right: 0; padding-left: 12px; }
.table a.strong, .strong { color: var(--ink); font-weight: 600; text-decoration: none; }
.table a.strong:hover { text-decoration: underline; }
.table .sub { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.table-wide { min-width: 720px; }
.row-inactive td { color: var(--muted); }
.table tr.group th { padding-top: 20px; color: var(--ink); border-bottom: 1px solid var(--line); }
.table-matrix th:first-child, .table-matrix td:first-child { min-width: 260px; }

/* Objašnjenje pojmova */
.terms dl { margin: 12px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; max-width: 900px; font-size: 13px; }
.terms dt { font-weight: 600; }
.terms dd { margin: 0; color: var(--muted); }
@media (max-width: 640px) { .terms dl { grid-template-columns: 1fr; } .terms dd { margin-bottom: 6px; } }

/* Oznake stanja */
.badge { display: inline-block; padding: 2px 8px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--good-bg); color: var(--good); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-neutral { background: var(--soft); color: #404041; }
.status-ok { color: var(--good); font-weight: 600; }
.status-bad { color: var(--bad); font-weight: 600; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }

/* Popisi ključ-vrijednost */
.facts { margin: 0; display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 10px 20px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.plain-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.plain-list li { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; padding-bottom: 0; }

/* Poruke */
.messages { display: flex; flex-direction: column; gap: 8px; }
.message { margin: 0; padding: 12px 16px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.message-success { border-color: #b9dcc4; background: var(--good-bg); }
.message-error, .message-warning { border-color: #f1c4a8; background: var(--bad-bg); }
.message > p { margin: 0 0 12px; }
.message > :last-child { margin-bottom: 0; }

/* Napredak mjerenja (vidljivost u AI alatima) */
.run-progress > p { margin: 0; }
.progress-engines { display: flex; flex-direction: column; gap: 10px; }
.progress-row { display: grid; grid-template-columns: minmax(120px, 220px) minmax(80px, 1fr) 200px; align-items: center; gap: 8px 16px; }
.progress-name { overflow-wrap: anywhere; }
.progress-count { font-size: 13px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.progress-count strong { color: var(--ink); }
.progress-total .progress-name { font-weight: 700; }
.run-progress progress { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 8px; border: 0; background: var(--soft); color: var(--blue); }
.run-progress progress::-webkit-progress-bar { background: var(--soft); }
.run-progress progress::-webkit-progress-value { background: var(--blue); transition: width .6s ease; }
.run-progress progress::-moz-progress-bar { background: var(--blue); }
.progress-total progress { height: 12px; }
@media (max-width: 640px) {
  .progress-row { grid-template-columns: 1fr max-content; }
  .progress-row progress { grid-column: 1 / -1; grid-row: 2; }
}

/* Obrasci */
.form { max-width: 720px; display: flex; flex-direction: column; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field legend { font-weight: 600; color: var(--ink); padding: 0; }
.field fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.field input[type="text"], .field input[type="email"], .field input[type="password"], .field input[type="date"], .field input[type="time"], .field input[type="number"],
.field input[type="search"], .field input[type="url"], .field select { min-height: 44px; padding: 0 12px; border: 1px solid #b8b8b8; background: #fff; color: var(--ink); font: inherit; border-radius: 0; width: 100%; max-width: 480px; }
.field input:focus, .field select:focus { border-color: var(--blue); outline: 1px solid var(--blue); }
.field .help, .helptext { font-size: 13px; color: var(--muted); }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: 28px; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--blue); flex: none; }
.checks { display: flex; flex-direction: column; gap: 10px; }
.errorlist { margin: 0; padding: 0; list-style: none; color: var(--bad); font-weight: 600; }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* Filteri dnevnika */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; align-items: end; }
.filters .field select, .filters .field input { max-width: none; }
.search { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }

/* Detalji zapisa */
details summary { cursor: pointer; color: var(--blue); font-size: 13px; }
details pre { margin: 8px 0 0; padding: 12px; background: var(--panel); border: 1px solid var(--line); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 560px; }
.danger { border-color: #f1c4a8; }
.invite-panel { border-color: #b8c6ea; }
.invite-panel p { margin: 0; }
.danger summary { color: var(--bad); font-weight: 600; min-height: 32px; }

/* Straničenje */
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.pagination a, .pagination span.current { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.pagination span.current { border-color: var(--ink); font-weight: 700; }

/* Animacije: sadržaj ulazi odozdo, stupci rastu, trake se pune. Isključene uz „smanji pokrete”. */
.btn, .btn-outline, .nav a, .periods a, .field input, .field select { transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease; }
.page-head, .kpis, .grid > *, .messages, .form, .filters, .table-wrap { animation: rise .5s cubic-bezier(.2, .7, .2, 1) both; }
.kpis { animation-delay: .05s; }
.grid > :nth-child(1) { animation-delay: .1s; }
.grid > :nth-child(2) { animation-delay: .15s; }
.grid > :nth-child(3) { animation-delay: .2s; }
.grid > :nth-child(4) { animation-delay: .25s; }
.grid > :nth-child(n+5) { animation-delay: .3s; }
.bar { transform-origin: bottom; animation: grow .7s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(.2s + var(--i, 0) * 18ms); }
.meter > span { transform-origin: left; animation: fill .8s cubic-bezier(.2, .7, .2, 1) .25s both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleY(0); } to { transform: none; } }
@keyframes fill { from { transform: scaleX(0); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
