/* Stena škatlic – mobile-first slog */
:root {
  --bg: #f4f4f5; --card: #fff; --ink: #18181b; --muted: #6b7280; --line: #e5e7eb;
  --brand: #7f1d1d; --accent: #dc2626; --accent-d: #b91c1c; --hl: #facc15; --hl-d: #a16207; --ok: #15803d; --err: #b91c1c;
  --radius: 14px; --tap: 52px; --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; color: var(--ink); background: var(--bg); padding-bottom: calc(76px + var(--safe-b)); }
a { color: #1d4ed8; text-decoration: none; }
h1, h2 { line-height: 1.2; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; display: flex; align-items: center; gap: .4rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.small { font-size: .85rem; } .muted { color: var(--muted); } .center { text-align: center; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 24px; height: 24px; flex: none; } .ic-s { width: 16px; height: 16px; vertical-align: -3px; }
.req { color: var(--accent); }

/* Zgornja vrstica */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .5rem; background: var(--brand); color: #fff; padding: .5rem .75rem; padding-top: calc(.5rem + env(safe-area-inset-top, 0px)); min-height: 56px; }
.topbar-title { font-size: 1.15rem; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-back, .topbar-logo { display: grid; place-items: center; width: 44px; height: 44px; color: #fff; border-radius: 10px; }
.topbar-back:active { background: rgba(255,255,255,.15); }
.desk-nav { display: none; }
.wrap { max-width: 760px; margin: 0 auto; padding: .9rem .9rem 1.5rem; }

/* Spodnja navigacija */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; border-top: 1px solid var(--line); padding-bottom: var(--safe-b); box-shadow: 0 -2px 10px rgba(0,0,0,.05); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 62px; color: var(--muted); font-size: .78rem; font-weight: 600; }
.tabbar a.on { color: var(--accent); }
.tabbar .tab-add .ic { width: 30px; height: 30px; background: var(--accent); color: #fff; border-radius: 50%; padding: 5px; box-sizing: content-box; margin-top: -16px; box-shadow: 0 3px 8px rgba(220,38,38,.45); }

/* Obvestila */
.flash { padding: .8rem 1rem; border-radius: 12px; margin-bottom: .8rem; background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-err { background: #fef2f2; color: var(--err); border-color: #fecaca; }

/* Kartice */
.card { background: var(--card); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.section-title { margin: 1.3rem .2rem .6rem; color: var(--muted); font-size: .95rem; text-transform: uppercase; letter-spacing: .03em; }
.empty { text-align: center; color: var(--muted); padding: 1.5rem 1rem; }
.empty-card { text-align: center; }
.hint { color: var(--muted); font-size: .9rem; margin: .4rem 0; }

/* Gumbi */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 48px; padding: .6rem 1rem; border-radius: 12px; border: 1px solid #d1d5db; background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-align: center; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(.98); background: #f3f4f6; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:active { background: var(--accent-d); }
.btn-danger { color: var(--err); border-color: #fca5a5; }
.btn-block { display: flex; width: 100%; margin-top: .7rem; }
.btn-big { min-height: 60px; font-size: 1.08rem; }
.btn-small { min-height: 44px; padding: .35rem .75rem; font-size: .9rem; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: .4rem 0 1rem; }
.danger-zone { margin: 2rem 0 1rem; }

/* Obrazci */
label { display: block; font-weight: 600; margin: .9rem 0 .35rem; }
.card > label:first-child { margin-top: 0; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; font: inherit; font-size: 17px; padding: .7rem .8rem; min-height: var(--tap); border: 1px solid #d1d5db; border-radius: 12px; background: #fff; color: var(--ink); }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(220,38,38,.3); border-color: var(--accent); }
.check { display: flex; align-items: center; gap: .6rem; font-weight: 500; min-height: 44px; margin: .5rem 0; }
.check input { width: 24px; height: 24px; accent-color: var(--accent); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .7rem; }
.file-btns { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.file-btn { position: relative; margin: 0; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn.has-file { border-color: var(--ok); color: var(--ok); }
.photo { display: block; width: 100%; max-height: 420px; object-fit: contain; border-radius: 12px; background: #f3f4f6; margin-top: .8rem; }
.photo-small { max-height: 200px; width: auto; max-width: 100%; margin: 0 0 .6rem; }

/* Iskanje */
.search { display: flex; background: #fff; border-radius: 16px; border: 2px solid #d4d4d8; overflow: hidden; margin-bottom: .4rem; }
.search:focus-within { border-color: var(--accent); }
.search input[type=search] { border: 0 !important; outline: 0 !important; border-radius: 0 !important; flex: 1; min-height: 60px; font-size: 19px !important; }
.search button { border: 0; background: var(--accent); color: #fff; width: 64px; display: grid; place-items: center; cursor: pointer; }
.search button .ic { width: 28px; height: 28px; }
.result-count { margin: .8rem .2rem; }
.overview-title { font-weight: 700; margin-bottom: .4rem; }
.result { padding: .85rem; }
.result-link { display: block; color: inherit; }
.result-head { display: flex; gap: .7rem; align-items: flex-start; }
.result-main { flex: 1; min-width: 0; }
.result-name { font-weight: 700; font-size: 1.12rem; overflow-wrap: anywhere; }
.result-meta { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
.result-loc { margin: .6rem 0 .5rem; }
.loc { display: inline-flex; align-items: stretch; border-radius: 12px; overflow: hidden; font-size: 1.15rem; border: 2px solid var(--ink); }
.loc > span { padding: .3rem .7rem; }
.loc-row { background: var(--ink); color: #fff; }
.loc-bin { background: var(--hl); color: var(--ink); }
.loc b { font-size: 1.35rem; }
.item-title { font-size: 1.35rem; margin: 0 0 .2rem; }

/* Čipi */
.chip { display: inline-flex; align-items: center; padding: .1rem .55rem; border-radius: 999px; background: #f4f4f5; border: 1px solid var(--line); font-size: .8rem; color: #3f3f46; white-space: nowrap; }
.chip-code { font-family: ui-monospace, monospace; background: #eef2ff; border-color: #c7d2fe; }
.chip-tag { background: #fff; }

/* Seznam predmetov */
.item-list { list-style: none; margin: 0; padding: 0 .8rem; background: #fff; border-radius: var(--radius); }
.item-row { border-bottom: 1px solid var(--line); }
.item-row:last-child { border-bottom: 0; }
.item-link { display: flex; align-items: center; gap: .75rem; color: inherit; min-height: 64px; padding: .4rem 0; }
.item-link > .ic { color: #a1a1aa; }
.thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex: none; background: #f4f4f5; }
.thumb-empty { display: grid; place-items: center; color: #a1a1aa; }
.item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.item-name { font-weight: 650; overflow-wrap: anywhere; }
.item-meta { font-size: .85rem; color: var(--muted); }

/* ---------- Risba stene ---------- */
.wall { display: block; height: auto; user-select: none; -webkit-user-select: none; }
.wall-mini .wall { width: 100%; }
.wall-mini { background: #3f3f46; border-radius: 10px; padding: 4px; }
.wall-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; background: #3f3f46; border-radius: 12px; padding: 6px; }
.wall-card { padding: 6px; }
.wall .bin rect { fill: #ef4444; stroke: #7f1d1d; stroke-width: 1.5; }
.wall .bin .lip { fill: #991b1b; stroke: none; }
.wall .bin text { fill: #fff; text-anchor: middle; font-weight: 700; font-family: system-ui, sans-serif; pointer-events: none; }
.wall .rowno { fill: #e4e4e7; font: 700 17px system-ui, sans-serif; text-anchor: middle; }
.wall .rowno.hl { fill: var(--hl); }
/* mini: vse škatlice zbledijo, poudarjena izstopa */
.wall-mini .bin rect { fill: #a85b5b; stroke: #5b2121; }
.wall-mini .bin .lip { fill: #7c3a3a; }
.wall .bin.hl rect { fill: var(--hl); stroke: #fff; stroke-width: 4; }
.wall .bin.hl .lip { fill: var(--hl-d); }
.wall .bin.hl text { fill: #000; }
.wall-mini .bin.hl rect { animation: blink 1.4s ease-in-out 3; }
@keyframes blink { 50% { fill: #fff59d; } }
/* full: prazne škatlice svetlejše */
.wall--full .bin:not(.has) rect { fill: #f3a5a5; stroke: #b45353; }
.wall--full .bin:not(.has) .lip { fill: #d97777; }
.wall--full .bin:not(.has) text { fill: #7f1d1d; }
.wall--full a.bin:focus rect, .wall--full a.bin:hover rect { stroke: #fff; stroke-width: 3; }
/* pick */
.wall--pick .bin { cursor: pointer; }
.wall--pick .bin rect { fill: #f3a5a5; stroke: #b45353; }
.wall--pick .bin text { fill: #7f1d1d; }
.wall--pick .bin.sel rect { fill: var(--hl); stroke: #fff; stroke-width: 4; }
.wall--pick .bin.sel text { fill: #000; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .88rem; margin: -.4rem .2rem .4rem; align-items: center; }
.lg { display: inline-block; width: 16px; height: 16px; border-radius: 4px; vertical-align: -3px; margin-right: .2rem; }
.lg-has { background: #ef4444; } .lg-empty { background: #f3a5a5; }

/* Škatlica */
.bin-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; margin-bottom: .7rem; }
.bin-nav { display: flex; justify-content: space-between; align-items: center; margin-top: .6rem; }

/* Izbirnik */
.picker-label { display: flex; align-items: center; gap: .4rem; font-size: 1.1rem; margin-bottom: .5rem; padding: .5rem .7rem; background: #fefce8; border: 2px solid var(--hl); border-radius: 12px; }
.picker-selects { display: grid; grid-template-columns: 1.4fr 1fr; gap: .7rem; }
.picker-selects label { margin-top: .4rem; }

/* Urejevalnik razporeditve */
.lrow { background: #fff; border-radius: var(--radius); padding: .7rem .8rem; margin-bottom: .6rem; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.lrow.is-new { border: 2px dashed #a1a1aa; }
.lrow.is-deleted { opacity: .45; }
.lrow.is-deleted .lrow-fields { pointer-events: none; }
.lrow-title { display: flex; gap: .5rem; align-items: center; margin-bottom: .4rem; }
.lrow-fields { display: grid; grid-template-columns: 1.3fr 1fr; gap: .6rem; }
.stepper { display: grid; grid-template-columns: 48px 1fr 48px; gap: .3rem; }
.stepper input { text-align: center; font-weight: 700; padding: .5rem .2rem !important; }
.step { padding: 0; font-size: 1.4rem; }
.lrow-actions { display: flex; gap: .4rem; margin-top: .5rem; }
.lrow-actions [data-remove] { margin-left: auto; }

/* Meni */
.menu { list-style: none; padding: 0 1rem; }
.menu a { display: flex; align-items: center; gap: .75rem; min-height: 58px; color: var(--ink); font-weight: 600; border-bottom: 1px solid var(--line); }
.menu li:last-child a { border-bottom: 0; }
.menu a > .ic:first-child { color: var(--accent); }
.menu a > .ic:last-child { margin-left: auto; color: #a1a1aa; }
.props { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1rem; margin: .8rem 0 0; }
.props dt { color: var(--muted); font-size: .9rem; }
.props dd { margin: 0; overflow-wrap: anywhere; }

/* Prijava */
.page-login { padding-bottom: 0; background: var(--brand); min-height: 100vh; }
.login-box { max-width: 400px; margin: 0 auto; padding: 3rem 1.2rem; text-align: center; color: #fff; }
.login-box h1 { margin: .6rem 0 0; font-size: 2rem; }
.login-box .muted { color: #fecaca; margin-top: .2rem; }
.login-box .card { text-align: left; color: var(--ink); margin-top: 1.5rem; }
.login-logo { border-radius: 20px; }

/* Namizje */
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .tabbar { display: none; }
  .desk-nav { display: flex; gap: .2rem; }
  .desk-nav a { color: #fecaca; padding: .55rem .85rem; border-radius: 10px; font-weight: 600; }
  .desk-nav a.on, .desk-nav a:hover { background: rgba(255,255,255,.14); color: #fff; }
  .wrap { max-width: 1000px; padding: 1.5rem 1rem; }
}

[hidden] { display: none !important; }
/* mini risba: poudarjena vrsta in škatlica */
.wall .rowband { fill: rgba(250, 204, 21, .28); stroke: var(--hl); stroke-width: 2; }
.wall-mini .bin rect { fill: #9f6b6b; stroke: #4a2020; }
.wall-mini .bin.hl rect { fill: var(--hl); stroke: #fff; stroke-width: 4; }
.wall-mini .rowno { font-size: 15px; }
/* urejevalnik: ukazi desno od naslova */
.lrow { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .3rem .5rem; }
.lrow-title { margin: 0; }
.lrow-actions { margin: 0; grid-column: 2; grid-row: 1; }
.lrow-fields { grid-column: 1 / -1; }
.lrow-actions .btn-small { min-width: 44px; padding: .3rem .5rem; }
.lrow-actions [data-remove] span { font-size: .85rem; }
.lrow-title b { white-space: nowrap; }
