:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #161c24;
  --muted: #6b7584;
  --line: #e6e8ec;
  --line-2: #eef0f3;
  --side: #ffffff;
  --side-2: #f3f4f6;
  --side-ink: #161c24;
  --side-muted: #6b7584;
  --side-line: #e6e8ec;
  --side-input: #ffffff;
  --hero: #121920;
  --acc: #ee8a1e;
  --acc-2: #d97706;
  --acc-ink: #ffffff;
  --acc-soft: #fff4e6;
  --ok: #16a34a;
  --warn: #d48806;
  --bad: #dc2626;
  --input: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --side-w: 256px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0e1318; --card: #161d25; --ink: #e8ecf1; --muted: #8d99a8; --line: #252f3a; --line-2: #1d2630;
    --acc-soft: #2e2213; --input: #11171e; --side: #0a0f14; --side-2: #151d26; color-scheme: dark;
    --side-ink: #e9edf2; --side-muted: #8592a3; --side-line: #1d2630; --side-input: #0d1318; --hero: #0a0f14;
  }
}
:root[data-theme='dark'] {
  --bg: #0e1318; --card: #161d25; --ink: #e8ecf1; --muted: #8d99a8; --line: #252f3a; --line-2: #1d2630;
  --acc-soft: #2e2213; --input: #11171e; --side: #0a0f14; --side-2: #151d26; color-scheme: dark;
  --side-ink: #e9edf2; --side-muted: #8592a3; --side-line: #1d2630; --side-input: #0d1318; --hero: #0a0f14;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14.5px/1.5 Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
h2 { font-size: 17px; font-weight: 700; margin: 0 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 14px; font-weight: 700; margin: 0 0 8px; }
small, .muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.ic { flex: none; display: block; }

/* ---------- Raspored ---------- */
.app { display: flex; min-height: 100vh; }
.side {
  width: var(--side-w); flex: none; background: var(--side); color: var(--side-ink);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 14px; gap: 18px;
  overflow-y: auto; z-index: 40; border-right: 1px solid var(--side-line);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px; }
.brand b { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; display: block; line-height: 1.15; }
.brand small { color: var(--side-muted); font-size: 11.5px; }
.side-proj { display: flex; flex-direction: column; gap: 6px; background: var(--side-2); border-radius: 12px; padding: 12px; }
.side-proj label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--side-muted); font-weight: 600; }
.side-proj select { background: var(--side-input); border: 1px solid var(--side-line); color: var(--side-ink); border-radius: 9px; padding: 8px 10px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav button {
  display: flex; align-items: center; gap: 11px; border: 0; background: transparent; color: var(--side-muted);
  padding: 10px 12px; border-radius: 10px; cursor: pointer; font-weight: 500; text-align: left; transition: 0.15s;
}
.side-nav button:hover { background: var(--side-2); color: var(--side-ink); }
.side-nav button.on { background: var(--side-2); color: var(--side-ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--acc); }
.side-nav button.on .ic { color: var(--acc); }
.side-sum { margin-top: auto; display: grid; gap: 8px; }
.side-sum .s { background: var(--side-2); border-radius: 10px; padding: 9px 12px; }
.side-sum .s small { color: var(--side-muted); font-size: 11px; display: block; }
.side-sum .s b { font-size: 16px; font-variant-numeric: tabular-nums; }
.side-sum .s.acc b { color: var(--acc); }
.side-foot { font-size: 11px; color: var(--side-muted); padding: 0 2px 0 6px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.side-foot .btn { color: var(--side-muted); }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 18px 28px 6px; background: var(--bg);
}
.tb-title small { font-size: 12.5px; }
.tb-title h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.btn.menu-btn { display: none; }

.kpis {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px;
  padding: 12px 28px; position: sticky; top: 0; z-index: 15; background: var(--bg);
}
.kpis .k { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; min-width: 0; box-shadow: var(--shadow); }
.kpis .k small { display: block; font-size: 11.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpis .k b { font-size: 18px; font-weight: 700; white-space: nowrap; letter-spacing: -0.01em; }
.kpis .k.acc { background: var(--hero); border-color: var(--hero); color: #fff; }
.kpis .k.acc small { color: #8592a3; }
.kpis .k.acc b { color: var(--acc); }

main { padding: 8px 28px 40px; width: 100%; }

/* ---------- Kartice i forme ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px;
}
.card-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.card-h h2 { margin: 0; flex: 1; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px 14px; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 500; color: var(--muted); min-width: 0; }
label.f.chk { flex-direction: row; align-items: center; gap: 9px; font-size: 14px; color: var(--ink); padding-top: 22px; }
input, select, textarea {
  background: var(--input); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px;
  width: 100%; min-width: 0; font-size: 14.5px; transition: border-color 0.15s, box-shadow 0.15s;
}
input[type='checkbox'] { width: 18px; height: 18px; accent-color: var(--acc); flex: none; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 22%, transparent); }
input.big { font-size: 17px; font-weight: 700; }
textarea { min-height: 64px; resize: vertical; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 8px 13px;
  border-radius: 9px; cursor: pointer; white-space: nowrap; font-weight: 600; font-size: 13.5px; transition: 0.15s;
}
.btn:hover { border-color: color-mix(in srgb, var(--acc) 60%, var(--line)); }
.btn.acc { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }
.btn.acc:hover { background: var(--acc-2); border-color: var(--acc-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--line-2); color: var(--ink); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 9px; font-size: 12.5px; }
.btn.icon { padding: 7px; }
.btn.block { width: 100%; }

.addbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.addbar .btn {
  flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; text-align: left; white-space: normal;
  border-radius: 12px; box-shadow: var(--shadow);
}
.addbar .btn .ib { width: 34px; height: 34px; border-radius: 9px; background: var(--acc-soft); color: var(--acc-2); display: grid; place-items: center; }
.addbar .btn span.t { font-size: 14px; }
.addbar .btn span.h { font-size: 12px; font-weight: 400; color: var(--muted); margin-top: -6px; }

/* ---------- Pozicije ---------- */
.item { padding: 0; overflow: hidden; }
.item-h { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); }
.item-h .no {
  background: var(--acc-soft); color: var(--acc-2); border-radius: 8px; min-width: 28px; height: 28px;
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
.item-h input { border: 0; background: transparent; font-weight: 700; padding: 5px 6px; font-size: 15.5px; box-shadow: none; }
.item-h input:focus { background: var(--line-2); box-shadow: none; }
.item-h .badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted);
  background: var(--line-2); padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.item-b { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.item-b > div { padding: 16px; min-width: 0; }
.item-b .res { background: color-mix(in srgb, var(--bg) 60%, var(--card)); border-left: 1px solid var(--line); }
.item.collapsed .item-b { display: none; }
.item.collapsed .item-h { border-bottom: 0; }
.src { display: flex; align-items: center; gap: 6px; margin: 12px 0 0; font-size: 12.5px; color: var(--muted); }

.chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.chip { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; min-width: 0; }
.chip small { display: block; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip b { font-size: 18px; font-weight: 700; white-space: nowrap; }
.chip.ok b { color: var(--ok); }
.chip.warn b { color: var(--warn); }
.chip.bad b { color: var(--bad); }

.openings { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.openings table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.openings td { padding: 3px 4px 3px 0; }
.openings td:first-child { min-width: 92px; }
.openings select, .openings input { padding: 7px 9px; }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t td.r, table.t th.r { text-align: right; white-space: nowrap; }
table.t tr.cat td { background: var(--line-2); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
table.t tfoot td { font-weight: 800; border-bottom: 0; border-top: 2px solid var(--line); }
table.t.mini { font-size: 13px; }
table.t.mini td { padding: 5px 6px; }
table.t input { padding: 6px 9px; }
.scroll { overflow-x: auto; }

.layout svg { width: 100%; height: auto; display: block; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: -1px; margin-right: 5px; }
details summary { font-size: 13px; font-weight: 600; }

.empty { text-align: center; padding: 44px 16px; color: var(--muted); }
.empty .ei { width: 52px; height: 52px; border-radius: 14px; background: var(--acc-soft); color: var(--acc-2); display: grid; place-items: center; margin: 0 auto 14px; }
.note { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 13px; margin: 10px 0 0; }

/* ---------- Tlocrt ---------- */
.plan-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; }
.plan-canvas {
  position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  height: calc(100vh - 290px); min-height: 400px; overflow: hidden; touch-action: none; box-shadow: var(--shadow);
}
.plan-canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.plan-canvas.pan canvas { cursor: grab; }
.plan-hint {
  position: absolute; left: 12px; bottom: 12px; right: 12px; background: rgba(18, 25, 32, 0.9); color: #fff;
  padding: 9px 13px; border-radius: 10px; font-size: 13px; pointer-events: none; display: flex; gap: 8px; align-items: center;
}
.plan-zoom { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; }
.plan-zoom .btn { width: 38px; height: 38px; padding: 0; }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tools .btn { justify-content: flex-start; }
.tools .btn.on { background: var(--hero); color: #fff; border-color: var(--hero); }
.tools .btn.on .ic { color: var(--acc); }
.shape { border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; margin-bottom: 8px; background: var(--card); }
.shape.sel { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.shape .row { justify-content: space-between; }
.shape input { padding: 5px 7px; font-weight: 700; }
.used { display: inline-flex; gap: 5px; align-items: center; color: var(--ok); font-size: 12.5px; margin-top: 6px; font-weight: 600; }

/* ---------- Predračun dokument ---------- */
.doc {
  background: #fff; color: #1a1a1a; max-width: 880px; margin: 0 auto; padding: 44px 48px;
  border-radius: 10px; box-shadow: 0 10px 30px rgba(16, 24, 40, 0.08); font-size: 13px; border: 1px solid #e6e8ec;
}
.doc table.t td, .doc table.t th { border-color: #e5e5e5; color: #1a1a1a; }
.doc table.t th { color: #666; }
.doc table.t tr.cat td { background: #f6f6f6; color: #555; }
.doc table.t tfoot td { border-top-color: #ddd; }
.doc .dh { display: flex; justify-content: space-between; gap: 24px; border-bottom: 3px solid #ee8a1e; padding-bottom: 16px; margin-bottom: 20px; }
.doc .dh h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: 0.04em; font-weight: 800; }
.doc .firm b { font-size: 16px; }
.doc .parties { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.doc .parties > div { background: #f8f8f8; border-radius: 8px; padding: 10px 12px; }
.doc .parties small { color: #777; text-transform: uppercase; font-size: 10px; letter-spacing: 0.06em; font-weight: 600; }
.doc .tot { margin-left: auto; width: 330px; margin-top: 14px; }
.doc .tot div { display: flex; justify-content: space-between; padding: 4px 0; }
.doc .tot .grand { border-top: 2px solid #1a1a1a; font-size: 16px; font-weight: 800; padding-top: 8px; margin-top: 4px; }
.doc .sig { display: flex; justify-content: space-between; margin-top: 56px; }
.doc .sig div { width: 40%; border-top: 1px solid #999; padding-top: 4px; text-align: center; color: #666; font-size: 11px; }
.doc h3 { margin-top: 24px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--hero); color: #fff; padding: 11px 18px; border-radius: 11px; transition: 0.2s; z-index: 80;
  pointer-events: none; max-width: 90vw; font-weight: 500; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
.toast.on { opacity: 1; transform: translateX(-50%); }

/* ---------- Otvori (mreža) ---------- */
.op-row { display: grid; grid-template-columns: minmax(92px, 1.3fr) 1fr 1fr 64px 36px; gap: 6px; align-items: center; margin-top: 6px; }
.op-row.op-head { margin-top: 10px; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.op-row input, .op-row select { padding: 7px 9px; }

/* ---------- Kartica projekta ---------- */
.proj-card { padding: 0; }
.proj-card summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; }
.proj-card summary::-webkit-details-marker { display: none; }
.pc-ic { width: 38px; height: 38px; border-radius: 10px; background: var(--acc-soft); color: var(--acc-2); display: grid; place-items: center; flex: none; }
.pc-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pc-t b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-t small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-chev { color: var(--muted); transition: transform 0.2s; }
.proj-card[open] .pc-chev { transform: rotate(180deg); }
.pc-body { padding: 4px 18px 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.pc-act { margin-top: 14px; justify-content: flex-end; }

/* Tabele: pomoćni elementi za telefon */
.sm-no, .sm-u { display: none; }
label.f { justify-content: space-between; }
label.f.chk { justify-content: flex-start; }

/* ---------- Lista pozicija i donji panel (telefon) ---------- */
.irows { display: flex; flex-direction: column; gap: 8px; }
.irow {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 10px 12px 12px; box-shadow: var(--shadow);
}
.irow-ic { width: 42px; height: 42px; border-radius: 12px; background: var(--acc-soft); color: var(--acc-2); display: grid; place-items: center; flex: none; }
.irow-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.irow-t b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.irow-t small, .irow-v small { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.irow-v { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.irow-v b { font-size: 16px; font-weight: 800; }
.irow-ch { color: var(--muted); flex: none; }

.sheet-wrap { position: fixed; inset: 0; z-index: 70; }
.sheet-bg { position: absolute; inset: 0; background: rgba(10, 15, 20, 0.45); animation: fadeIn 0.2s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 94dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: 26px 26px 0 0; padding: 6px 16px 0; animation: slideUp 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet-grab { width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 8px; }
.sheet-h { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.sheet-kind { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; font-size: 15px; }
.btn.round { width: 44px; height: 44px; border-radius: 999px; padding: 0; background: var(--line-2); border-color: transparent; }
input.sheet-name { font-size: 20px !important; font-weight: 800; border-radius: 14px; padding: 12px 14px; background: var(--card); margin-bottom: 14px; }
.hero { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; margin-bottom: 14px; }
.hero-big { font-size: 44px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.hero-big span { font-size: 18px; color: var(--acc-2); font-weight: 700; margin-left: 6px; letter-spacing: 0; }
.hero-big.muted { color: var(--muted); }
.hero-note { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.hero-stats small { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.hero-stats small i { width: 8px; height: 8px; border-radius: 9px; display: inline-block; }
.hero-stats b { font-size: 18px; font-weight: 800; white-space: nowrap; }
.sheet .form { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px; margin-bottom: 14px; }
.sheet .res { margin-bottom: 8px; }
.sheet .res .chip:nth-child(-n+3) { display: none; }
.sheet-cta {
  position: sticky; bottom: 0; margin: 0 -16px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.btn.cta { width: 100%; min-height: 58px; border-radius: 999px; font-size: 17px; box-shadow: 0 8px 22px color-mix(in srgb, var(--acc) 35%, transparent); }
.sheet-q { margin: 4px 2px 10px; font-size: 15px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 11px 16px; font-weight: 700; font-size: 15px; cursor: pointer; box-shadow: var(--shadow);
}
.pill.on { background: var(--hero); color: #fff; border-color: var(--hero); }
.pill.on .ic { color: var(--acc); }
.sheet-hin { margin-bottom: 10px; }
.sheet-del { width: 100%; margin-bottom: 4px; }
body.sheet-open { overflow: hidden; }
.no-anim .sheet, .no-anim .sheet-bg { animation: none; }
.segs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.seg { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 6px 10px 6px 6px; }
.seg span { width: 26px; height: 26px; border-radius: 8px; background: var(--acc-soft); color: var(--acc-2); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.seg input { border: 0; background: transparent; padding: 6px 2px; font-size: 18px !important; font-weight: 800; box-shadow: none !important; min-width: 0; }
.seg em { font-style: normal; color: var(--muted); font-weight: 600; }
.seg:focus-within { border-color: var(--acc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 22%, transparent); }


/* ---------- AI čitanje tlocrta ---------- */
.btn.ai-btn { width: 100%; margin-top: 8px; min-height: 48px; background: var(--hero); color: #fff; border-color: var(--hero); font-size: 15px; border-radius: 12px; }
.btn.ai-btn .ic { color: var(--acc); }
.ai-wait { display: flex; align-items: center; gap: 14px; }
.spin { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--acc); animation: spin 0.9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-note { background: var(--acc-soft); border-radius: 12px; padding: 10px 12px; color: var(--ink); margin: 0 0 14px; }
.ai-note .ic { color: var(--acc-2); margin-top: 2px; }
.ai-h { margin-bottom: 6px; }
.tag { font-style: normal; font-size: 11px; font-weight: 700; color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); padding: 1px 7px; border-radius: 99px; margin-left: 6px; }
.tag.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.ai-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.ai-row { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.ai-row.off { opacity: 0.5; }
.ai-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ai-top b { font-size: 15px; }
input.ai-name { border: 0; background: transparent; font-weight: 800; font-size: 15px; padding: 4px 2px; box-shadow: none !important; }
input.ai-name:focus { background: var(--line-2); }
.ai-no { width: 26px; height: 26px; border-radius: 99px; background: var(--hero); color: var(--acc); display: grid; place-items: center; font-weight: 800; font-size: 12px; flex: none; }
.ai-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.ai-fields label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.ai-fields input { font-weight: 700; padding: 8px 10px; }
.ai-fields small { grid-column: 1 / -1; }
.pills.sm { margin: 10px 0 0; }
.pills.sm .pill { padding: 8px 12px; font-size: 13.5px; box-shadow: none; }
.pill.tgl { width: 30px; height: 30px; padding: 0; justify-content: center; flex: none; box-shadow: none; }
.pill.tgl:not(.on) .ic { opacity: 0; }

/* Panel na računaru: centriran, ne preko cijele širine */
@media screen and (min-width: 861px) {
  .sheet { left: 0; right: 0; margin: 0 auto; width: min(620px, 100%); bottom: 24px; border-radius: 24px; max-height: 88vh; }
  .sheet-cta { margin: 0 -16px; border-radius: 0 0 24px 24px; }
}

/* ---------- Projekti (evidencija) ---------- */
body[data-tab='projekti'] .kpis:not(.pstats) { display: none; }
.kpis.pstats { position: static; padding: 0 0 16px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpis .k em { display: block; font-style: normal; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.kpis .k.acc em { color: #8592a3; }
.ptools { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.ptools .search { flex: 1 1 320px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: var(--input); color: var(--muted); }
.ptools .search input { border: 0; padding: 10px 0; background: transparent; box-shadow: none !important; }
.ptools select { width: auto; min-width: 180px; }
table.ptable th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
table.ptable th.sortable:hover { color: var(--ink); }
table.ptable td { vertical-align: middle; }
table.ptable tr.cur td { background: color-mix(in srgb, var(--acc-soft) 70%, transparent); }
table.ptable tbody tr:hover td { background: var(--line-2); }
table.ptable td small.sub { display: block; color: var(--muted); font-size: 12px; }
table.ptable td.nw { white-space: nowrap; }
table.ptable td.act { white-space: nowrap; }
table.ptable td.act .btn { vertical-align: middle; }
.btn.lnk, button.lnk { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--ink); cursor: pointer; text-align: left; }
button.lnk:hover { color: var(--acc-2); text-decoration: underline; }
select.st-sel {
  width: auto; padding: 5px 28px 5px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  color: var(--c); border-color: color-mix(in srgb, var(--c) 40%, transparent); background-color: color-mix(in srgb, var(--c) 10%, var(--card));
}

/* ---------- Prijava ---------- */
body.auth-open { overflow: hidden; }
.auth {
  position: fixed; inset: 0; z-index: 100; overflow-y: auto; display: flex; align-items: center; justify-content: center; padding: 20px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--acc) 22%, transparent), transparent 60%), var(--bg);
}
.auth-box { width: min(420px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 26px 22px; box-shadow: 0 20px 60px rgba(16, 24, 40, 0.12); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth-brand b { font-size: 22px; font-weight: 800; display: block; }
.auth-brand small { color: var(--muted); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--line-2); border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.auth-tabs button { border: 0; background: transparent; padding: 9px; border-radius: 9px; font-weight: 700; color: var(--muted); cursor: pointer; }
.auth-tabs button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.auth form { display: flex; flex-direction: column; gap: 12px; }
.auth input { font-size: 16px; padding: 12px 13px; }
.auth .cta { margin-top: 4px; }
.auth-err { color: var(--bad); font-weight: 600; margin: 0; font-size: 14px; }
.auth-inv { background: var(--acc-soft); border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; }
.auth-note { color: var(--muted); font-size: 13px; margin: 14px 0 0; text-align: center; }
.auth-note.warn { color: var(--warn); font-weight: 600; margin: 0 0 12px; text-align: left; }

/* ---------- Korisnik i sinhronizacija ---------- */
.side-user { display: grid; gap: 6px; }
.side-user:empty { display: none; }
.su { display: flex; align-items: center; gap: 10px; border: 0; background: var(--side-2); color: var(--side-ink); border-radius: 12px; padding: 9px 10px; cursor: pointer; text-align: left; width: 100%; }
.su .av { width: 32px; height: 32px; border-radius: 99px; background: var(--hero); color: var(--acc); display: grid; place-items: center; font-weight: 800; font-size: 12px; flex: none; }
.su-t { min-width: 0; display: flex; flex-direction: column; }
.su-t b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.su-t small { color: var(--side-muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 0 4px; }
.s-ok { color: var(--ok); }
.s-sync { color: var(--acc-2); }
.s-off { color: var(--warn); }
.s-err { color: var(--bad); }
.sync-dot { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); }
.sync-dot.s-sync .ic { animation: spin 1.4s linear infinite; }
#syncDot { display: none; }
.acct { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-bottom: 12px; }
.acct > div { background: var(--line-2); border-radius: 10px; padding: 9px 12px; min-width: 0; }
.acct small { display: block; color: var(--muted); font-size: 11.5px; }
.acct b { word-break: break-word; }
details.pw summary { cursor: pointer; color: var(--acc-2); }
.inv { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.inv-l { display: flex; flex-direction: column; min-width: 90px; }
.inv-l small { color: var(--muted); font-size: 11.5px; }
.inv input { flex: 1 1 260px; font-size: 13px; }
table.utable td { vertical-align: middle; }
table.utable select { width: auto; }
body.role-radnik .del-proj { display: none !important; }
.ro-note { margin: 0 0 12px; color: var(--warn); }

/* ---------- Navigacija u grupama ---------- */
.nav-g { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; color: var(--side-muted); padding: 12px 12px 4px; opacity: 0.8; }
.nav-g:first-child { padding-top: 0; }
body[data-group='firma'] .kpis:not(.pstats), body[data-group='admin'] .kpis:not(.pstats),
body[data-tab='fakture'] .kpis:not(.pstats), body[data-tab='gradiliste'] .kpis:not(.pstats), body[data-tab='zadaci'] .kpis:not(.pstats) { display: none; }
body.role-radnik .owner-act { display: none !important; }

/* ---------- Početna ---------- */
.dash-hello { margin: 4px 0 14px; }
.dash-hello h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.dash-hello p { margin: 2px 0 0; }
.dash-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.dash-grid > .card { margin: 0; }
.dash-grid.g2 { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.dl {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; border-bottom: 1px solid var(--line-2); background: none;
  padding: 10px 2px; text-align: left; color: var(--ink); cursor: pointer; font: inherit;
}
.dl:last-child { border-bottom: 0; }
.dl:hover .dl-t b { color: var(--acc-2); }
.dl-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dl-t b { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-t small { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-v { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }
.dl-v b { font-variant-numeric: tabular-nums; }
.st-chip {
  display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent);
}
.badge-s { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.badge-s.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.badge-s.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.badge-s.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.badge-s.mut { color: var(--muted); background: var(--line-2); }
.due { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; flex: none; }
.due.late { color: var(--bad); }
.kpis .k.bad b { color: var(--bad); }
.kpis.mini3 { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 14px 0 6px; }

/* ---------- Kalendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 4px 6px; }
.cal-d { min-height: 96px; border: 1px solid var(--line-2); border-radius: 10px; padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; background: var(--card); }
.cal-d.out { background: transparent; border-color: transparent; }
.cal-d.now { border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); }
.cal-n { font-size: 12px; font-weight: 700; color: var(--muted); padding: 0 3px; }
.cal-d.now .cal-n { color: var(--acc-2); }
.cal-p, .cal-t {
  border: 0; border-radius: 6px; font: inherit; font-size: 11.5px; font-weight: 650; text-align: left; padding: 3px 6px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.cal-p { color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--card)); box-shadow: inset 3px 0 0 var(--c); }
.cal-t { color: var(--muted); background: var(--line-2); display: flex; align-items: center; gap: 4px; }

/* ---------- Fakture i situacije ---------- */
.sit { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 14px; }
.sit-r { display: grid; grid-template-columns: minmax(0, 1fr) 92px 110px; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.sit-t { min-width: 0; display: flex; flex-direction: column; }
.sit-t b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sit-t small { font-size: 12px; }
.sit-in { display: flex; align-items: center; gap: 4px; }
.sit-in input { text-align: right; font-weight: 700; }
.sit-in em { font-style: normal; color: var(--muted); font-weight: 700; }
.sit-v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.x-body { padding-bottom: 6px; }
.x-body textarea { min-height: 70px; }
.sheet-del { margin-top: 14px; }
.doc-logo { display: block; max-width: 180px; max-height: 64px; object-fit: contain; margin-bottom: 8px; }
.logo-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px; border: 1px dashed var(--line); border-radius: 12px; }
.logo-prev { width: 120px; height: 52px; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid var(--line); flex: none; }
.logo-prev.empty { display: grid; place-items: center; color: var(--muted); background: var(--line-2); }

/* ---------- Gradilište ---------- */
.diary-new { background: var(--line-2); border-radius: 14px; padding: 12px; margin-bottom: 12px; }
.diary-new textarea { min-height: 76px; }
.diary { display: flex; flex-direction: column; gap: 10px; }
.de { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.de-h { display: flex; align-items: center; gap: 8px; }
.de-h small { font-size: 12px; }
.de p { margin: 6px 0 0; white-space: pre-wrap; }
.de-ph { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin-top: 8px; }
.ph { border: 0; padding: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: var(--line-2); cursor: zoom-in; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph.missing { cursor: default; }
.lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(5, 8, 12, 0.92); display: grid; place-items: center; padding: 16px; cursor: zoom-out; animation: fadeIn 0.2s; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.lightbox .btn { position: absolute; top: 14px; right: 14px; }

/* ---------- Zadaci ---------- */
.task-new { display: grid; grid-template-columns: minmax(0, 1fr) 160px 170px auto; gap: 8px; margin-bottom: 12px; }
.tasks { display: flex; flex-direction: column; }
.task { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line-2); }
.task:last-child { border-bottom: 0; }
.task input[type='checkbox'] { width: 22px; height: 22px; flex: none; accent-color: var(--acc); }
.task-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.task-t small { font-size: 12px; }
.task.done .task-t b { text-decoration: line-through; color: var(--muted); font-weight: 500; }

/* ---------- Plan rezanja ---------- */
.cut-k + .cut-k { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.cut-k h3 { margin: 0 0 2px; }
.cut-k p { margin: 0 0 10px; font-size: 12.5px; }
.cut-grid { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.cb { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.cb svg { display: block; border-radius: 3px; }
.cb figcaption { font-size: 11px; color: var(--muted); font-weight: 600; }

.bottomnav, .backdrop { display: none; }

/* ---------- Tablet ---------- */
@media (max-width: 1180px) {
  .kpis.pstats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .addbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .item-b { grid-template-columns: minmax(0, 1fr); }
  .item-b .res { border-left: 0; border-top: 1px solid var(--line); }
  .plan-wrap { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Mobilni ---------- */
@media screen and (max-width: 860px) {
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform 0.22s; box-shadow: 0 0 40px rgba(0, 0, 0, 0.3); }
  .side.open { transform: none; }
  .backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 35; opacity: 0; pointer-events: none; transition: 0.2s; }
  .backdrop.on { opacity: 1; pointer-events: auto; }
  .btn.menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px 2px; position: sticky; top: 0; z-index: 16; }
  .tb-title h1 { font-size: 19px; }
  .kpis { padding: 8px 16px; gap: 6px; top: 58px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis .k { padding: 7px 10px; border-radius: 10px; }
  .kpis .k b { font-size: 14.5px; }
  .kpis .k small { font-size: 10.5px; }
  main { padding: 8px 16px 24px; }
  .card { padding: 14px; }
  .addbar { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .addbar .btn { padding: 12px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .item-h { padding: 8px 8px 8px 10px; gap: 4px; }
  .item-h .badge { display: none; }
  .chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plan-canvas { height: 60vh; min-height: 320px; }
  .doc { padding: 22px 16px; }
  .doc .parties { grid-template-columns: 1fr; }
  .doc .tot { width: 100%; }
  .bottomnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line);
  }
  .bottomnav button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; border: 0; background: transparent;
    color: var(--muted); font-size: 10.5px; font-weight: 600; padding: 5px 2px; border-radius: 10px; cursor: pointer;
  }
  .bottomnav button.on { color: var(--acc-2); }
  .bottomnav button.on .ic { background: var(--acc-soft); border-radius: 999px; padding: 3px 12px; width: 46px; height: 27px; }
  .bottomnav button span { white-space: nowrap; }
  .toast { bottom: 84px; }

  /* --- Sređivanje za telefon --- */
  input, select, textarea { font-size: 16px; padding: 10px 11px; }
  input.big { font-size: 18px; }
  .btn { min-height: 40px; }
  .btn.sm { min-height: 34px; padding: 6px 10px; }
  .topbar { position: static; padding: 10px 16px 0; }
  .tb-title small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100vw - 90px); }

  .proj-card summary { padding: 12px 14px; }
  .pc-body { padding: 14px; }
  .pc-act { justify-content: stretch; }
  .pc-act .btn { flex: 1; }

  .addbar { display: flex; overflow-x: auto; scroll-snap-type: x proximity; scroll-padding: 0 16px; margin: 0 -16px 14px; padding: 2px 16px 6px; scrollbar-width: none; }
  .addbar::-webkit-scrollbar { display: none; }
  .addbar .btn { flex: 0 0 auto; flex-direction: row; align-items: center; gap: 8px; padding: 9px 14px 9px 9px; border-radius: 999px; scroll-snap-align: start; min-height: 0; }
  .addbar .btn .ib { width: 30px; height: 30px; border-radius: 999px; }
  .addbar .btn span.h { display: none; }
  .addbar .btn span.t { font-size: 13.5px; }

  .item-h { padding: 6px 4px 6px 10px; }
  .item-h input { font-size: 15.5px; padding: 6px 4px; min-width: 0; flex: 1; }
  .item-h .btn.ghost { width: 36px; height: 36px; min-height: 0; padding: 0; }
  .item-b > div { padding: 14px; }
  .grid { gap: 10px; }
  label.f { font-size: 12px; }
  label.f.chk { grid-column: 1 / -1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; background: var(--input); }

  .op-row { grid-template-columns: minmax(80px, 1.2fr) 1fr 1fr 52px 36px; gap: 5px; }
  .op-row input, .op-row select { padding: 9px 7px; }
  .op-row.op-head { font-size: 10.5px; }
  .openings .row .btn.sm { flex: 1; }
  .openings .row h3 { flex-basis: 100%; }

  .chips { gap: 6px; }
  .chip { padding: 8px 10px; }
  .chip b { font-size: 16px; }

  /* Tabele kao kartice */
  table.resp thead { display: none; }
  table.resp, table.resp tbody, table.resp tfoot { display: block; }
  table.resp tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
  table.resp td { border: 0; padding: 0; }
  table.resp td.d { grid-column: 1 / -1; font-weight: 600; margin-bottom: 4px; }
  table.resp td.hm { display: none; }
  table.resp td.r { text-align: left; white-space: normal; }
  table.resp td[data-l]::before { content: attr(data-l); display: block; font-size: 10.5px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.03em; }
  table.resp tr.cat { display: block; padding: 0; border: 0; }
  table.resp tr.cat td { display: block; padding: 6px 8px; border-radius: 6px; margin-top: 8px; }
  table.resp tfoot tr { border-top: 2px solid var(--line); border-bottom: 0; }
  table.resp tfoot td:first-child[colspan] { grid-column: 1 / 3; align-self: end; }
  table.resp .sm-no, table.resp .sm-u { display: inline; }
  .doc table.resp td.d { font-weight: 400; }
  table.price-t td { width: auto !important; align-self: end; }
  table.price-t tr { grid-template-columns: 50px 1fr 1fr; }
  table.price-t td.d input { font-weight: 600; }
  .doc .dh { flex-direction: column; gap: 10px; }
  .doc .dh > div:last-child { text-align: left !important; }
  .doc .dh h1 { font-size: 22px; }

  /* Tlocrt */
  .plan-top .row > .grow { display: none; }
  .plan-wrap { display: flex; flex-direction: column; gap: 12px; }
  .plan-side { display: contents; }
  .plan-tools { order: -1; margin-bottom: 0; padding: 10px; }
  .plan-tools h3 { display: none; }
  .tools { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tools .btn { flex-direction: column; gap: 3px; font-size: 11px; padding: 8px 2px; justify-content: center; }
  .plan-tools .row { margin-top: 8px !important; }
  .plan-tools #plScale { display: none; }
  .plan-hint { font-size: 12px; padding: 7px 10px; left: 8px; right: 8px; bottom: 8px; }


  /* Traka s brojkama: jedna velika brojka + tri male, bez skrolanja */
  .kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: visible; gap: 6px; position: static; box-shadow: none; border: 0; padding: 6px 16px 8px; }
  .kpis .k { min-width: 0; padding: 8px 10px; }
  .kpis .k.acc { order: -1; grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; padding: 12px 14px; border-radius: 16px; }
  .kpis .k.acc b { font-size: 24px; }
  .kpis .k:nth-child(5) { display: none; }
  .kpis .k small { font-size: 10px; }
  .kpis .k b { font-size: 14px; }
  .kpis .k { padding: 7px 8px; }
  body[data-tab='tlocrt'] .kpis, body[data-tab='cjenovnik'] .kpis, body[data-tab='postavke'] .kpis { display: none; }

  /* Tlocrt na telefonu */
  .plan-top { padding: 8px !important; margin-bottom: 10px; }
  .plan-top .row { display: flex; flex-wrap: nowrap; gap: 6px; }
  .plan-top .row > select { flex: 1; min-width: 0; }
  .plan-top .bt { display: none; }
  .plan-top .btn { width: 44px; height: 44px; padding: 0; flex: none; }
  .plan-top .btn.ai-btn { width: 100%; height: auto; min-height: 48px; padding: 0 14px; }
  .plan-wrap { gap: 10px; }
  .plan-list .shape .row:last-of-type .btn { display: none; }
  .plan-list .shape { cursor: pointer; }
  .plan-hint { bottom: 8px; }
  .sheet .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .kpis.pstats { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 0 12px; }
  .kpis.pstats .k.acc { grid-column: 1 / -1; order: -1; }
  .kpis.pstats .k:nth-child(5) { display: block; }
  table.ptable td.act { grid-column: 1 / -1; display: flex; gap: 6px; margin-top: 6px; }
  table.ptable td.act .btn.sm { flex: 1; }
  table.ptable tfoot td.d { grid-column: 1 / -1; }

  #syncDot { display: inline-block; }
  .tb-title { flex: 1; min-width: 0; }
  .tb-title small { max-width: 100%; }
  .topbar .grow { display: none; }
  #syncDot { flex: none; }
  table.ptable select.st-sel { max-width: 100%; }
  table.ptable td.act { white-space: normal; }
  table.ptable td.act .btn { min-width: 0; }
  .topbar { align-items: center; }
  table.utable td.act { grid-column: 1 / -1; }
  .card-h h2 { flex-basis: 100%; }
  .card-h .btn { flex: 1; }
  .plan-top select { max-width: none !important; }
  .side-foot .btn { min-height: 0; }
}

/* ---------- Uvoz cjenovnika ---------- */
.sheet.wide { max-width: none; }
.pi-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 16px; border: 2px dashed var(--line); border-radius: 16px; background: var(--card); color: var(--muted); cursor: pointer; text-align: center; }
.pi-drop b { color: var(--ink); font-size: 16px; }
.pi-drop.on, .pi-drop:hover { border-color: var(--acc); color: var(--acc-2); }
.pi-steps { display: flex; gap: 6px; margin-bottom: 14px; }
.pi-steps span { flex: 1; text-align: center; font-size: 12.5px; font-weight: 700; padding: 7px; border-radius: 999px; background: var(--line-2); color: var(--muted); }
.pi-steps span.on { background: var(--acc-soft); color: var(--acc-2); }
.pi-prev td { white-space: nowrap; font-size: 12px; }
.pi-prev td.on { background: var(--acc-soft); font-weight: 600; }
.pi-prev td.on2 { background: color-mix(in srgb, var(--ok) 12%, transparent); font-weight: 600; }
.pi-t td { vertical-align: middle; }
.pi-t small.sub { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.pi-t select { min-width: 260px; }
.pi-t td.pi-c { width: 28px; }
.pi-t td.pi-c input { width: 20px; height: 20px; accent-color: var(--acc); }
.pi-t tr.pi-none { opacity: 0.55; }
.pi-div { display: inline-flex; align-items: center; gap: 4px; }
.pi-div input { width: 84px; text-align: right; }
.pi-div em { font-style: normal; color: var(--muted); font-size: 12px; min-width: 22px; text-align: left; }
.pi-vat { grid-column: span 2; }
.pi-warn { color: var(--warn) !important; font-weight: 700; }
.pi-src { color: var(--ok) !important; font-size: 11px !important; margin-top: 2px; }
@media screen and (min-width: 861px) {
  .pi-sheet .sheet.wide { width: min(1080px, calc(100% - 48px)); }
}
@media screen and (max-width: 860px) {
  .pi-t select { min-width: 0; width: 100%; }
  .pi-t tr { grid-template-columns: 28px 1fr 1fr; }
  .pi-t td.pi-c { grid-row: 1; align-self: start; }
  .pi-t td.d { grid-column: 2 / -1; }
  .pi-t td[data-l='Artikal dobavljača'] { grid-column: 1 / -1; }
}

/* ---------- Novi moduli na tabletu i telefonu ---------- */
@media (max-width: 1180px) {
  .dash-grid, .dash-grid.g2 { grid-template-columns: minmax(0, 1fr); }
}
@media screen and (max-width: 860px) {
  .dash-hello h2 { font-size: 18px; }
  .dash-actions .btn { flex: 1; }
  .dash-grid { gap: 12px; }
  .cal { gap: 2px; }
  .cal-h { padding: 2px; font-size: 10px; text-align: center; }
  .cal-d { min-height: 58px; padding: 2px; border-radius: 7px; }
  .cal-n { font-size: 11px; }
  .cal-p, .cal-t { font-size: 9.5px; padding: 2px 3px; }
  .cal-t .ic { display: none; }
  .sit-r { grid-template-columns: minmax(0, 1fr) 84px; }
  .sit-v { grid-column: 1 / -1; text-align: left; font-size: 13px; color: var(--muted); }
  .task-new { grid-template-columns: 1fr 1fr; }
  .task-new [data-xt='text'] { grid-column: 1 / -1; }
  .task-new .btn { grid-column: 1 / -1; }
  .kpis.mini3 { grid-template-columns: 1fr 1fr; }
  .kpis.mini3 .k:last-child { grid-column: 1 / -1; }
  .logo-row { flex-wrap: wrap; }
  .logo-row .grow { flex-basis: calc(100% - 140px); }
  .cb svg { width: 70px; height: auto; }
  .bottomnav #bnMenu.on { color: var(--acc-2); }
}

/* ---------- Štampa ---------- */
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; padding: 0; }
  .no-print, .side, .bottomnav, .kpis, .topbar, .toolbar { display: none !important; }
  .app { display: block; }
  main { padding: 0; max-width: none; }
  .doc { box-shadow: none; padding: 0; max-width: none; border: 0; }
  .card { box-shadow: none; }
  tr { break-inside: avoid; }
}
