/* Barve 4INFINITY na beli osnovi: modra #0c1e35, turkizna #65aea0, sivo modra #738e9c */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f0f3f7;
  --border: #e3e8ee;
  --border-strong: #cfd7e1;
  --text: #0c1e35;
  --muted: #5d6f80;
  --faint: #93a2b1;
  --primary: #0c1e35;
  --primary-hover: #1b3558;
  --blue-soft: #eaf0f7;
  --teal: #65aea0;
  --teal-soft: #e5f3f0;
  --teal-text: #2c7768;
  --danger: #c0392b;
  --danger-soft: #fbecea;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(12, 30, 53, .04);
  --sidebar-w: 248px;
  --topbar-h: 60px;
  --tabbar-h: 64px;
  --head-font: "Sora", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1 { font-family: var(--head-font); font-size: 1.5rem; line-height: 1.2; margin: 0; letter-spacing: -.02em; font-weight: 700; overflow-wrap: anywhere; }
h2 { font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 28px 0 10px; font-weight: 700; }
.icon, .sidebar svg, .tabbar svg, .menu-toggle svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Ogrodje ---------- */
.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 30;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: transform .2s ease;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 12px;
  height: 76px; padding: 0 20px;
  border-bottom: 1px solid var(--border);
  font-family: var(--head-font); font-weight: 700; font-size: 1.25rem; letter-spacing: -.01em;
}
.sidebar-logo img { width: 52px; }
.sidebar-logo small { display: block; font-size: .7rem; font-weight: 500; color: var(--muted); letter-spacing: .08em; margin-top: -2px; }
.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin-bottom: 2px;
  border-radius: 10px; border-left: 3px solid transparent;
  color: var(--muted); font-weight: 600; font-size: .95rem;
}
.nav-item svg { width: 20px; height: 20px; flex: none; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--blue-soft); color: var(--primary); border-left-color: var(--primary); }
.nav-section { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); font-weight: 700; padding: 18px 12px 6px; }
.sidebar-footer { padding: 14px 16px 18px; border-top: 1px solid var(--border); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 6px; margin: 0 -6px 10px; border-radius: 10px; }
.sidebar-user:hover, .sidebar-user.active { background: var(--surface-2); }
.sidebar-user .who { min-width: 0; }
.sidebar-user b { display: block; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user small { display: block; font-size: .75rem; color: var(--muted); }

.main { margin-left: var(--sidebar-w); min-height: 100vh; transition: margin-left .2s ease; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.menu-toggle {
  flex: none; width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); color: var(--primary); cursor: pointer;
}
.menu-toggle:hover { background: var(--surface-2); }
.menu-toggle svg { width: 20px; height: 20px; }
.topbar-title { flex: 1; font-weight: 700; font-size: 1.05rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-brand { display: none; }
.content { padding: 28px; max-width: 1500px; }

/* Skrit stranski meni (hamburger) */
body.nav-collapsed .sidebar { transform: translateX(-100%); }
body.nav-collapsed .main { margin-left: 0; }

.avatar {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary); color: #fff;
  font-weight: 700; font-size: .82rem;
}
.avatar.lg { width: 56px; height: 56px; font-size: 1.15rem; }

.tabbar { display: none; }

/* Prijava: brez menijev */
body.guest .sidebar, body.guest .topbar, body.guest .tabbar { display: none !important; }
body.guest .main { margin-left: 0; }

/* ---------- Telefon ---------- */
@media (max-width: 880px) {
  .sidebar, .menu-toggle, .topbar-title { display: none; }
  .main { margin-left: 0; }
  .topbar { padding: env(safe-area-inset-top) 16px 0; height: calc(56px + env(safe-area-inset-top)); justify-content: space-between; }
  .topbar-brand { display: flex; align-items: center; gap: 10px; font-family: var(--head-font); font-weight: 700; font-size: 1.15rem; }
  .topbar-brand img { width: 44px; }
  .topbar-brand small { font-weight: 500; color: var(--muted); font-size: .75rem; letter-spacing: .05em; }
  .content { padding: 16px 16px calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom)); }

  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    flex: 1; height: var(--tabbar-h); position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: .72rem; font-weight: 600; color: var(--faint);
  }
  .tabbar svg { width: 24px; height: 24px; }
  .tabbar a.active { color: var(--primary); }
  .tabbar a.active::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary); }
}

/* ---------- Postavitve vsebine ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 0 0 18px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.head-box { display: flex; gap: 14px; align-items: center; min-width: 0; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; font-size: .92rem; margin: 0 0 8px; padding: 4px 0; }
.back:hover { color: var(--text); }

.narrow { max-width: 680px; }
.split { display: grid; gap: 0 24px; }
.split > * { min-width: 0; }
@media (min-width: 1100px) {
  .split:has(> .sticky) { grid-template-columns: minmax(340px, 420px) 1fr; align-items: start; }
  .split > .sticky { position: sticky; top: calc(var(--topbar-h) + 28px); }
  .split:has(> .sticky) > :last-child > h2:first-child { margin-top: 0; }
  .split.photo { grid-template-columns: 1fr minmax(360px, 460px); align-items: start; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card.pad { padding: 18px; }
.card.clip { overflow: hidden; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
@media (min-width: 881px) { .stats { grid-template-columns: repeat(auto-fill, minmax(220px, 280px)); } }
.stat { padding: 18px 20px; border-left: 4px solid var(--primary); }
.stat.teal { border-left-color: var(--teal); }
.stat .num { font-family: var(--head-font); font-size: 2.3rem; font-weight: 700; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .lbl { color: var(--muted); font-size: .9rem; margin-top: 6px; }
a.stat:hover { border-color: var(--border-strong); }

.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--border); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 60px; }
a.row:hover { background: var(--surface-2); }
a.row:active { background: var(--surface-2); }
.row .main-col { flex: 1; min-width: 0; }
.row .title { font-weight: 600; overflow-wrap: anywhere; }
.row .sub { color: var(--muted); font-size: .86rem; margin-top: 1px; overflow-wrap: anywhere; }
.row .chev { color: var(--faint); flex: none; }

/* Škatle kot mreža kartic */
.box-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; list-style: none; margin: 0; padding: 0; }
.box-grid .row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.box-grid a.row:hover { border-color: var(--border-strong); background: var(--surface); }
@media (max-width: 880px) { .box-grid { gap: 8px; } }

/* Stvari po škatlah */
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 880px) { .group-grid { grid-template-columns: 1fr; gap: 14px; } }

.thumb { width: 48px; height: 48px; flex: none; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.thumb.empty { display: grid; place-items: center; color: var(--faint); }
.thumb.empty svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; }

.boxnum {
  flex: none; min-width: 48px; height: 48px; padding: 0 8px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--primary); color: #fff;
  font-family: var(--head-font); font-weight: 700; font-size: 1.2rem; font-variant-numeric: tabular-nums;
}
.pill {
  flex: none; display: inline-flex; align-items: center; gap: 4px;
  background: var(--blue-soft); color: var(--primary);
  font-weight: 700; font-size: .8rem;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.pill.navy { background: var(--primary); color: #fff; }
.pill.teal { background: var(--teal-soft); color: var(--teal-text); }
.pill.grey { background: var(--surface-2); color: var(--muted); }
.count { color: var(--muted); font-size: .9rem; white-space: nowrap; }

.empty-state { text-align: center; color: var(--muted); padding: 32px 16px; }

.detail dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; }
.detail dt { color: var(--muted); font-size: .9rem; }
.detail dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* ---------- Obrazci ---------- */
form { margin: 0; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=number], input[type=password], input[type=search], textarea, select {
  width: 100%;
  font: inherit; font-size: 16px; /* prepreči zoom na iOS */
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 11px 14px;
  outline: none;
  -webkit-appearance: none; appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d6f80' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 40px; }
textarea { resize: vertical; min-height: 48px; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(12, 30, 53, .08); }
.grid-2 { display: grid; grid-template-columns: 110px 1fr; gap: 10px; }

.choices { display: grid; gap: 8px; margin-bottom: 12px; }
@media (min-width: 881px) { .choices { grid-template-columns: repeat(3, 1fr); } }
.choice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: 12px;
  background: var(--surface); cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--primary); background: var(--blue-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.choice input { margin: 3px 0 0; accent-color: var(--primary); width: 18px; height: 18px; flex: none; }
.choice b { display: block; }
.choice small { color: var(--muted); font-size: .86rem; }
.check { display: flex; gap: 10px; align-items: center; padding: 4px 2px 12px; font-weight: 600; cursor: pointer; }
.check input { accent-color: var(--primary); width: 20px; height: 20px; margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700;
  min-height: 46px; padding: 0 18px;
  border-radius: 10px; border: 1px solid transparent;
  background: var(--primary); color: #fff;
  cursor: pointer; white-space: nowrap;
}
.btn:hover, .btn:active { background: var(--primary-hover); }
.btn:disabled { opacity: .6; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.ghost:hover, .btn.ghost:active { background: var(--surface-2); }
.btn.danger { background: var(--surface); color: var(--danger); border-color: var(--border-strong); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.danger.armed { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: .9rem; }
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.actions { display: flex; gap: 10px; }
.actions > * { flex: 1; }

.photo-pick { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.photo-pick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.photo-pick .preview { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex: none; }
.photo-pick .clear { color: var(--danger); font-weight: 600; font-size: .9rem; background: none; border: 0; padding: 8px; cursor: pointer; font-family: inherit; }

.more-toggle { background: none; border: 0; padding: 4px 0 12px; color: var(--primary); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; }

.search { position: sticky; top: var(--topbar-h); z-index: 5; padding: 10px 0; background: var(--bg); margin: -10px 0 8px; }
@media (min-width: 881px) { .search input { max-width: 560px; } }
@media (max-width: 880px) { .search { top: calc(56px + env(safe-area-inset-top)); } }

.group-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-weight: 700; }
.group-head .sub { color: var(--muted); font-weight: 500; font-size: .9rem; overflow-wrap: anywhere; }

.hero-photo { width: 100%; max-height: 75vh; object-fit: contain; background: var(--surface-2); border-radius: var(--radius); margin-bottom: 16px; border: 1px solid var(--border); }

.danger-zone { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border); }
.danger-zone p { color: var(--muted); font-size: .9rem; margin: 0 0 10px; }

.login { min-height: 88vh; display: grid; place-items: center; }
.login .card { width: 100%; max-width: 400px; padding: 32px 28px 28px; }
.login .logo { width: 120px; margin: 0 auto 10px; }
.login h1 { text-align: center; font-size: 1.9rem; }
.login .by { text-align: center; color: var(--muted); margin: 2px 0 24px; font-size: .82rem; letter-spacing: .1em; }

.error { color: var(--danger); font-size: .9rem; margin: -4px 0 12px; }
.loading { color: var(--muted); padding: 32px 0; text-align: center; }

.toast {
  position: fixed; left: 50%; bottom: 24px;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--primary); color: #fff;
  padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: .95rem;
  transition: opacity .2s, transform .2s; z-index: 40; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 880px) { .toast { bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); } }

.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--teal-soft); } to { background: transparent; } }
