:root {
  --brand: #8e0b72;
  --brand-ink: #6d0857;
  --brand-soft: #f6e8f2;
  --green: #3f8200;
  --green-soft: #eef6e4;
  --red: #b42318;
  --red-soft: #fdecea;
  --bg: #f6f5f4;
  --card: #ffffff;
  --ink: #1d1b1a;
  --ink-2: #5d5955;
  --ink-3: #8b8681;
  --line: #e7e3df;
  --focus: #8e0b72;
  --radius: 14px;
  --tabs-h: 62px;
  --top-h: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #d76fbf;
    --brand-ink: #f0a6de;
    --brand-soft: #3a1833;
    --green: #8fd14f;
    --green-soft: #1f2b14;
    --red: #ff8a80;
    --red-soft: #3a1c1a;
    --bg: #141312;
    --card: #1f1d1c;
    --ink: #f2efec;
    --ink-2: #c4beb8;
    --ink-3: #8f8983;
    --line: #34302d;
    --focus: #d76fbf;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---------- okvir ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 6px;
  min-height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0;
  background: var(--brand); color: #fff;
}
@media (prefers-color-scheme: dark) { .top { background: #2a1026; } }
.top-title { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 6px 4px; }
#title { font-weight: 650; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#subtitle { font-size: 12.5px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#subtitle:empty { display: none; }
.icon-btn { background: none; border: 0; color: inherit; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; cursor: pointer; }
.icon-btn:active { background: rgba(255,255,255,.15); }
.net { font-size: 12px; font-weight: 600; background: rgba(255,255,255,.2); padding: 3px 9px; border-radius: 99px; }

main { padding: 14px 14px calc(var(--tabs-h) + 24px + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; outline: none; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line);
}
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--ink-3); font-size: 11.5px; font-weight: 550; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--brand); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabs-h) + 16px + env(safe-area-inset-bottom)); z-index: 20;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14.5px;
  max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.18);
}
.toast button { margin-left: 10px; background: none; border: 0; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }

/* ---------- osnovni elementi ---------- */
h1 { font-size: 22px; line-height: 1.25; margin: 4px 2px 12px; letter-spacing: -.01em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 22px 4px 8px; font-weight: 650; }
.muted { color: var(--ink-2); }
.small { font-size: 13.5px; }
.card { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); }
.pad { padding: 14px 16px; }
.stack > * + * { margin-top: 10px; }
.empty { text-align: center; color: var(--ink-3); padding: 36px 16px; }

.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px 13px 16px; min-height: 52px;
  text-decoration: none; border-top: 1px solid var(--line); cursor: pointer; background: none; width: 100%; text-align: left; border-left: 0; border-right: 0; border-bottom: 0;
}
.row:first-child { border-top: 0; }
.row:active { background: var(--bg); }
.row .main { flex: 1; min-width: 0; }
.row .t { font-weight: 560; overflow-wrap: anywhere; }
.row .s { font-size: 13.5px; color: var(--ink-2); margin-top: 1px; }
.row .chev { color: var(--ink-3); flex: none; }
.row.hi .t { color: var(--brand); font-weight: 650; }
.badge { font-size: 12px; font-weight: 650; color: var(--brand); background: var(--brand-soft); padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.badge.g { color: var(--green); background: var(--green-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; padding: 6px 11px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); font-size: 14px; text-decoration: none; }
.chip.link { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); }

.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; margin: 12px 0 4px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; }
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.kv { display: grid; grid-template-columns: 112px 1fr; gap: 8px 12px; font-size: 15px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.crumbs { font-size: 13px; color: var(--ink-3); margin: 0 2px 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.crumbs a { text-decoration: none; color: var(--ink-2); }
.crumbs span.sep { opacity: .6; }

/* ---------- sadržaj šalabahtera ---------- */
.content { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 16px 12px; margin-top: 12px; }
.content:empty { display: none; }
.content .g, .sec .g { color: var(--green); font-weight: 600; }
.content .r { color: var(--red); font-weight: 600; }
details.sec { border-top: 1px solid var(--line); }
details.sec:first-child { border-top: 0; }
details.sec > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
  padding: 14px 0; font-weight: 650; font-size: 16.5px;
}
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::after {
  content: ""; margin-left: auto; flex: none; width: 9px; height: 9px;
  border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg); transition: transform .15s;
}
details.sec[open] > summary::after { transform: rotate(-135deg); }
details.sec > .body { padding: 0 0 12px; }
details.sec details.sec > summary { font-size: 15.5px; color: var(--brand); }
.it { position: relative; padding: 4px 0 4px 22px; overflow-wrap: anywhere; }
.it::before { position: absolute; left: 2px; top: 4px; color: var(--ink-3); }
.it.b1::before { content: "•"; left: 6px; color: var(--brand); font-weight: 700; }
.it.b1r::before { content: "•"; left: 6px; color: var(--red); font-weight: 700; }
.it.b1r { color: var(--ink-2); }
.it.b2 { margin-left: 18px; }
.it.b2::before { content: "◦"; left: 6px; }
.it.trokut::before { content: "▸"; color: var(--green); left: 4px; }
.it.plus::before { content: "+"; color: var(--green); font-weight: 800; left: 5px; }
.it.l123 { font-weight: 620; padding-left: 26px; margin-top: 8px; }
.it.l123 .num { position: absolute; left: 0; top: 4px; color: var(--brand); font-variant-numeric: tabular-nums; }
.it .kids { margin-top: 2px; font-weight: 400; }
.it.tekst { padding-left: 0; }
.p-sub { font-weight: 600; color: var(--ink-2); margin: 10px 0 4px; }
.opis1 { font-weight: 700; font-size: 17px; margin: 12px 0 0; }
.opis2 { color: var(--ink-2); margin: 0 0 8px; font-size: 14.5px; }
.konk { margin: 14px 0 6px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.konk::before { content: "vs."; font-size: 12px; font-weight: 700; color: #fff; background: var(--red); border-radius: 6px; padding: 1px 6px; }
.usp { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 8px 10px; border-radius: 10px; margin: 6px 0; font-size: 15px; }
.usp::before { font-weight: 800; text-align: center; }
.usp.usp-r { background: var(--red-soft); }
.usp.usp-r::before { content: "✕"; color: var(--red); }
.usp.usp-z { background: var(--green-soft); }
.usp.usp-z::before { content: "✓"; color: var(--green); }
.flash { animation: flash 1.8s ease-out; border-radius: 8px; }
@keyframes flash { 0%, 30% { background: color-mix(in srgb, var(--brand) 22%, transparent); } 100% { background: transparent; } }

/* ---------- pretraga ---------- */
.searchbox { position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top)); z-index: 5; background: var(--bg); padding: 2px 0 10px; }
.input {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); font-size: 16px;
}
.input:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
label.f { display: block; font-size: 14px; font-weight: 600; margin: 14px 2px 6px; color: var(--ink-2); }
mark { background: color-mix(in srgb, var(--brand) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.more-btn { display: block; width: 100%; padding: 12px; background: none; border: 0; border-top: 1px solid var(--line); color: var(--brand); font-weight: 600; cursor: pointer; }

/* ---------- prijava ---------- */
.auth { max-width: 380px; margin: 6vh auto 0; }
.auth .logo { width: 76px; height: 76px; border-radius: 18px; display: block; margin: 0 auto 14px; }
.auth h1 { text-align: center; }
.auth p { text-align: center; }
.err { color: var(--red); font-size: 14.5px; margin: 10px 2px 0; }
.ok { color: var(--green); font-size: 14.5px; margin: 10px 2px 0; }
.loading { display: grid; place-items: center; min-height: 50vh; color: var(--ink-3); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.note { font-size: 13.5px; color: var(--ink-2); background: var(--card); border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; }
ol.steps { padding-left: 20px; margin: 8px 0; }
ol.steps li { margin: 4px 0; }
