:root {
  --bg: #f6f7f9; --card: #fff; --text: #1d2330; --muted: #6b7280; --line: #e3e6eb;
  --accent: #2456c8; --accent-text: #fff; --warn-bg: #fff6e0; --warn: #8a5a00;
  --err: #b42318; --err-bg: #fdecea; --ok-bg: #e8f6ee; --ok: #1b6e3c; --hover: #f0f4ff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c; --card: #1d2128; --text: #e6e8ec; --muted: #9aa3b0; --line: #2e343e;
    --accent: #6b93ff; --accent-text: #0d1220; --warn-bg: #3a2f14; --warn: #f2c66b;
    --err: #ff8a80; --err-bg: #3b1d1b; --ok-bg: #16301f; --ok: #7fd6a0; --hover: #232a38;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
       background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.4rem; margin: 0 0 .25rem; }
h2 { font-size: 1rem; margin: 1.5rem 0 .5rem; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, Consolas, monospace; }
.muted { color: var(--muted); }

.top { display: flex; align-items: center; justify-content: space-between;
       padding: .75rem 1.25rem; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 600; color: var(--text); font-size: 1.05rem; }
.logout { display: flex; gap: .75rem; align-items: center; margin: 0; }
main { max-width: 1400px; margin: 0 auto; padding: 1.25rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px;
        padding: 1rem 1.25rem; margin-bottom: 1rem; }
.login-card { max-width: 340px; margin: 4rem auto; display: grid; gap: .75rem; }

label { display: flex; flex-direction: column; gap: .25rem; font-size: .8rem; color: var(--muted); }
input, select { font: inherit; color: var(--text); background: var(--card);
                border: 1px solid var(--line); border-radius: 6px; padding: .45rem .6rem; min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button, .button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--card);
                  color: var(--text); border-radius: 6px; padding: .45rem .9rem; display: inline-block; }
.button:hover { text-decoration: none; background: var(--hover); }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }

.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.filters .grow { flex: 1 1 280px; }
.actions { display: flex; gap: .5rem; align-items: center; }
.edit .actions { margin-top: 1.25rem; }

.resultbar { display: flex; justify-content: space-between; align-items: center; margin: .5rem 0; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.card .table-wrap { border: 0; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .5rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
th a { color: inherit; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--hover); }
.history tbody tr { cursor: default; }

main.wide { max-width: none; }
.toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.toolbar .grow { flex: 1 1 320px; }
.hint { font-size: .8rem; }
code { font-size: .85em; background: var(--hover); padding: 0 .25em; border-radius: 3px; }
.nowrap { white-space: nowrap; }
.empty { text-align: center; padding: 2rem; }

.data { font-size: .85rem; }
.data th, .data td { padding: .35rem .5rem; }
.data td { max-width: 22rem; overflow-wrap: anywhere; }
.data .col-ime_zavezanca { min-width: 16rem; }
.data .col-naslov_zavezanca { min-width: 13rem; }
.data .col-email { min-width: 11rem; }
.filter-row th { padding: .25rem .3rem .4rem; background: var(--card); }
.filter-row input, .filter-row select { width: 100%; min-width: 4.5rem; padding: .25rem .35rem; font-size: .8rem; }
.filter-row .on { border-color: var(--accent); background: var(--hover); }
.data thead tr:first-child th { position: sticky; top: 0; background: var(--card); z-index: 1; }

.map-link { all: unset; cursor: pointer; color: var(--accent); }
.map-link:hover { text-decoration: underline; }
.map-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.map-link.inline { font-size: inherit; }
#map-dialog { width: min(900px, 94vw); height: min(640px, 86vh); padding: 0; border: 1px solid var(--line);
              border-radius: 10px; background: var(--card); color: var(--text); overflow: hidden; }
#map-dialog[open] { display: flex; flex-direction: column; }
#map-dialog::backdrop { background: rgb(0 0 0 / .45); }
.map-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem;
            padding: .6rem .9rem; border-bottom: 1px solid var(--line); }
.map-actions { display: flex; gap: 1rem; align-items: center; white-space: nowrap; }
#map-close { border: 0; background: none; font-size: 1.1rem; padding: .1rem .4rem; }
#map-frame { flex: 1; width: 100%; border: 0; }

.card.spaced { margin-top: 1.5rem; }
h2.first { margin-top: 0; }
.topnav { display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap; }
.narrow-card { max-width: 420px; display: grid; gap: .75rem; }
tr.inactive td { color: var(--muted); }
fieldset.readonly { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.readonly input { background: var(--bg); }

.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .75rem 1rem; }
.grid .wide { grid-column: span 2; }
@media (max-width: 560px) { .grid .wide { grid-column: auto; } }
label.error input { border-color: var(--err); }
label.error small { color: var(--err); }

.flash { padding: .6rem .9rem; border-radius: 6px; margin-bottom: 1rem; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.napaka { background: var(--err-bg); color: var(--err); }
.flash.info { background: var(--hover); }
.warn { background: var(--warn-bg); color: var(--warn); padding: .5rem .75rem; border-radius: 6px; font-size: .85rem; }
