:root {
  --ink: #142033;
  --muted: #64748b;
  --line: #dce4ed;
  --panel: #ffffff;
  --soft: #f5f8fb;
  --blue: #0969da;
  --blue-dark: #0759b8;
  --green: #137a4a;
  --amber: #9a6700;
  --red: #b42318;
  --shadow: 0 8px 28px rgba(18, 38, 63, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--soft); }
body { overflow: hidden; }
button, input { font: inherit; }
.topbar { height: 58px; padding: 0 20px; display: flex; align-items: center; gap: 28px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.97); position: relative; z-index: 5; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.brandmark { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; background: #eaf3ff; color: var(--blue); }
.brand small { font-size: 10px; font-weight: 800; color: var(--muted); border: 1px solid var(--line); padding: 2px 5px; border-radius: 5px; }
.topbar nav { display: flex; gap: 6px; flex: 1; }
.topbar nav a { text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 650; padding: 8px 10px; border-radius: 8px; }
.topbar nav a.active { color: var(--blue); background: #edf5ff; }
.status { font-size: 12px; color: var(--muted); }
.status.ok { color: var(--green); }
.status.bad { color: var(--red); }
.layout { display: grid; grid-template-columns: 390px minmax(0, 1fr); height: calc(100vh - 58px); }
.sidebar { padding: 18px; overflow-y: auto; border-right: 1px solid var(--line); background: #f8fafc; }
.intro h1 { margin: 0 0 7px; font-size: 20px; line-height: 1.18; letter-spacing: -.025em; }
.muted { color: var(--muted); }
.intro p { font-size: 12px; line-height: 1.5; margin: 0 0 14px; }
.search-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line); background: #edf2f7; border-radius: 11px; margin-bottom: 10px; }
.tab { padding: 8px 10px; background: transparent; color: var(--muted); border: 0; border-radius: 8px; font-size: 12px; font-weight: 750; cursor: pointer; }
.tab.active { background: white; color: var(--blue); box-shadow: 0 1px 4px rgba(17, 38, 66, .1); }
.search-panel { margin-bottom: 12px; }
.searchbox { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.searchbox input, .field { min-width: 0; width: 100%; border: 1px solid #cbd6e2; background: white; border-radius: 9px; padding: 10px 11px; outline: none; font-size: 12px; }
.searchbox input:focus, .field:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(9,105,218,.11); }
.searchbox button { border: 0; background: var(--blue); color: white; border-radius: 9px; padding: 0 14px; font-weight: 750; font-size: 12px; cursor: pointer; }
.searchbox button:hover { background: var(--blue-dark); }
.fieldlabel { display: block; margin: 3px 0 5px; font-size: 11px; color: var(--muted); font-weight: 750; }
.parcel-form { margin-top: 10px; }
.microcopy { font-size: 10px; line-height: 1.4; color: #8492a5; margin: 7px 2px 0; }
.results { display: grid; gap: 5px; margin-top: 6px; }
.compact-results { max-height: 205px; overflow-y: auto; }
.result { width: 100%; text-align: left; background: white; color: var(--ink); border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; font-size: 11px; cursor: pointer; line-height: 1.35; }
.result:hover { border-color: #9ebee5; background: #f8fbff; }
.result-note { padding: 7px 3px; font-size: 11px; }
.ko-result { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.ko-result strong { font-size: 11px; }
.ko-result span { font-size: 10px; color: var(--muted); white-space: nowrap; }
.selected-ko { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 7px; padding: 8px 10px; border-radius: 9px; background: #edf7ff; border: 1px solid #c7def5; font-size: 11px; }
.selected-ko strong { color: var(--blue); font-size: 10px; white-space: nowrap; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 13px; padding: 14px; margin: 11px 0; box-shadow: var(--shadow); }
.card.compact { box-shadow: none; }
.card h2 { font-size: 13px; margin: 0; }
.cardhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pill { font-size: 10px; color: var(--muted); background: #eef2f7; border-radius: 999px; padding: 5px 8px; white-space: nowrap; }
.pill.ok { background: #e9f8f0; color: var(--green); }
.details { margin: 12px 0 0; }
.details div { display: grid; grid-template-columns: 44% 56%; padding: 7px 0; border-top: 1px solid #eef2f6; font-size: 11px; gap: 8px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; text-align: right; font-weight: 680; overflow-wrap: anywhere; }
.source-badge { display: inline-block; border-radius: 999px; padding: 3px 7px; font-size: 9px; font-weight: 800; }
.source-badge.official { background: #eaf3ff; color: var(--blue); }
.toggle { display: flex; gap: 8px; align-items: center; padding-top: 10px; font-size: 11px; }
.toggle input { accent-color: var(--blue); }
.toggle em { font-style: normal; color: #8795a6; font-size: 9px; margin-left: 4px; }
.toggle .source-live, .source-live { color: var(--green); }
.source-error { color: var(--red) !important; }
.disabled { color: #94a3b8; }
.signal { display: flex; justify-content: space-between; gap: 12px; align-items: center; border-top: 1px solid #eef2f6; padding: 9px 0 0; margin-top: 9px; font-size: 10px; }
.signal span { color: var(--muted); }
.signal strong { max-width: 55%; text-align: right; font-size: 10px; }
.signal.pending strong { color: var(--amber); }
.source-card p { color: var(--muted); line-height: 1.45; font-size: 10px; margin-bottom: 0; }
.mapwrap { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; }
.maphint { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 2; background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; font-size: 11px; box-shadow: var(--shadow); white-space: nowrap; }
.maplegend { position: absolute; left: 12px; bottom: 28px; z-index: 2; display: flex; gap: 13px; flex-wrap: wrap; background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; font-size: 9px; box-shadow: var(--shadow); }
.maplegend span { display: flex; gap: 5px; align-items: center; }
.maplegend i { display: inline-block; width: 14px; height: 7px; border-radius: 2px; }
.legend-line { border-top: 2px solid #4a586a; }
.legend-arkod { background: rgba(39,151,92,.34); border: 1px solid rgba(19,122,74,.7); }
.legend-selected { background: rgba(18,135,232,.2); border: 2px solid #006bd6; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 10; max-width: 430px; background: #17283e; color: white; border-radius: 10px; padding: 12px 14px; box-shadow: 0 12px 30px rgba(0,0,0,.2); font-size: 12px; }
@media (max-width: 900px) {
  body { overflow: auto; }
  .topbar nav { display: none; }
  .layout { display: block; height: auto; }
  .sidebar { border-right: 0; }
  .mapwrap { height: 62vh; }
  .maphint { display: none; }
}
.layer-select { width: 100%; margin: 9px 0 2px; border: 1px solid #cbd6e2; background: #fff; color: var(--ink); border-radius: 8px; padding: 8px 9px; font-size: 10px; }
.layer-select:disabled { color: #94a3b8; background: #f3f6f9; }
.analysis-note { margin: 11px 0 0; padding-top: 9px; border-top: 1px solid #eef2f6; color: #7a8899; font-size: 9px; line-height: 1.45; }
.source-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid #eef2f6; font-size: 10px; }
.source-row:first-of-type { margin-top: 8px; }
.source-row span { color: var(--muted); }
.source-row b { max-width: 58%; text-align: right; font-size: 9px; color: var(--green); }
.legend-flood { background: rgba(61, 117, 201, .28); border: 1px solid rgba(31, 82, 160, .75); }

/* 0.3.1 - autorizacija i robusniji prikaz karte */
.auth-pending .topbar,
.auth-pending .layout { visibility: hidden; }
.auth-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #eef5fb 0%, #f8fbfd 48%, #e7f0f7 100%); }
.auth-overlay[hidden] { display: none; }
.login-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 70px rgba(18,38,63,.16); padding: 28px; }
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 24px; }
.login-brand > div { display: grid; gap: 2px; }
.login-brand strong { font-size: 17px; }
.login-brand small { color: var(--muted); font-size: 10px; }
.login-card h1 { margin: 0 0 8px; font-size: 24px; }
.login-card > p { margin: 0 0 20px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.login-form { display: grid; gap: 13px; }
.login-form label { display: grid; gap: 6px; font-size: 11px; font-weight: 750; color: #475569; }
.login-form input { width: 100%; border: 1px solid #cbd6e2; border-radius: 10px; padding: 11px 12px; outline: none; }
.login-form input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(9,105,218,.11); }
.login-form button { margin-top: 4px; border: 0; border-radius: 10px; padding: 11px 14px; background: var(--blue); color: #fff; font-weight: 800; cursor: pointer; }
.login-error { margin-top: 13px; border-radius: 9px; padding: 9px 10px; background: #fff1f0; border: 1px solid #ffd0cc; color: var(--red); font-size: 11px; }
.userarea { display: flex; align-items: center; gap: 8px; }
.userbadge { background: #edf5ff; color: var(--blue); border-radius: 999px; padding: 5px 8px; font-size: 10px; font-weight: 750; }
.logout { border: 1px solid var(--line); background: #fff; color: #475569; border-radius: 8px; padding: 6px 8px; font-size: 10px; font-weight: 700; cursor: pointer; }
.logout:hover { border-color: #aebdce; background: #f8fafc; }
.mapwrap { min-height: 480px; background: #dce8ef; }
#map { width: 100%; height: 100%; min-height: 480px; background: #dce8ef; }
.map-error { position: absolute; inset: 18px; z-index: 4; display: grid; place-content: center; gap: 6px; text-align: center; border: 1px dashed #c7d4e1; border-radius: 14px; background: rgba(248,251,253,.94); color: var(--ink); }
.map-error[hidden] { display: none; }
.map-error strong { font-size: 14px; }
.map-error span { color: var(--muted); font-size: 11px; }
@media (max-width: 900px) {
  #map { min-height: 62vh; }
  .userbadge { display: none; }
}
