/* Auto Mall – zajednički stilovi */
:root {
  --ink: #1A1A1A;
  --ink-2: #2E2E2E;
  --bg: #F5F4F1;
  --card: #FFFFFF;
  --line: #E3E1DC;
  --line-2: #CFCCC4;
  --muted: #5E636B;
  --green: #146C43;
  --green-dk: #0E5133;
  --green-bg: #DDF1E4;
  --red: #A4271B;
  --red-bg: #FDE8E6;
  --amber: #6B4200;
  --amber-bg: #FFF4DB;
  --blue: #1F3A5F;
  --blue-bg: #E3E9F1;
  --chat: #ECE9E3;
  --bubble-out: #D9F3CF;
  --r: 12px;
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--ink); }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Gumbi ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); font: 600 14px/1.2 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #F2F1ED; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid #8FB4E8; outline-offset: 1px; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover { background: var(--ink-2); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.green:hover { background: var(--green-dk); }
.btn.red { color: var(--red); border-color: #E7B7B1; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.05); }
.btn.sm { min-height: 32px; padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.lg { min-height: 50px; padding: 12px 18px; font-size: 16px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { flex: none; }

/* ---- Oznake ---- */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: #F1EFEA; color: #474B52; white-space: nowrap; }
.chip.green { background: var(--green-bg); color: var(--green-dk); }
.chip.red { background: var(--red-bg); color: var(--red); }
.chip.amber { background: var(--amber-bg); color: var(--amber); }
.chip.blue { background: var(--blue-bg); color: var(--blue); }
.chip.dark { background: var(--ink); color: #fff; }
.plate { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .04em; border: 1.5px solid var(--ink); border-radius: 5px; padding: 1px 6px; background: #fff; white-space: nowrap; }
.badge { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; align-items: center; justify-content: center; border-radius: 10px; background: var(--green); color: #fff; font-size: 12px; font-weight: 700; }

/* ---- Kartice i raspored ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.card-pad { padding: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; align-items: start; }
.section-title { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.divider { height: 1px; background: var(--line); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---- Liste ---- */
.list { display: flex; flex-direction: column; }
.list > .item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; font: inherit; }
.list > .item:last-child { border-bottom: 0; }
button.item, a.item { cursor: pointer; }
button.item:hover, a.item:hover { background: #FAF9F7; }
.item.active { background: #F1EFEA; box-shadow: inset 4px 0 0 var(--ink); }

/* ---- Tablice ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #FAF9F7; }

/* ---- Forme ---- */
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: #3B3F45; }
input, select, textarea { font: 400 15px/1.4 var(--font); color: var(--ink); border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 11px; background: #fff; min-height: 42px; width: 100%; }
textarea { resize: vertical; min-height: 80px; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; accent-color: var(--green); flex: none; margin: 0; }
label.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }

/* ---- Modal ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(20,20,20,.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; z-index: 50; overflow-y: auto; }
.modal { width: 100%; max-width: 560px; background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ---- Toast ---- */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 500; z-index: 80; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: calc(100% - 32px); }
#toast.err { background: var(--red); }

/* ---- Chat ---- */
.chat { background: var(--chat); display: flex; flex-direction: column; gap: 8px; padding: 16px; overflow-y: auto; }
.bubble { max-width: 78%; padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.42; white-space: pre-wrap; word-wrap: break-word; box-shadow: 0 1px 0 rgba(0,0,0,.05); }
.bubble.in { align-self: flex-start; background: #fff; border-top-left-radius: 4px; }
.bubble.out { align-self: flex-end; background: var(--bubble-out); border-top-right-radius: 4px; }
.bubble .meta { font-size: 11px; color: #4A5058; text-align: right; margin-top: 3px; white-space: normal; }
.bubble .btns { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.bubble .btns span { display: block; text-align: center; font-size: 13px; font-weight: 600; color: var(--green); background: rgba(255,255,255,.7); border-radius: 8px; padding: 6px; }
.bubble .lnk { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--green); background: rgba(255,255,255,.7); border-radius: 8px; padding: 6px; text-decoration: none; }
.bubble img.media { display: block; max-width: 220px; max-height: 160px; border-radius: 8px; margin-bottom: 6px; object-fit: cover; }
.sys { align-self: center; max-width: 90%; text-align: center; font-size: 12px; font-weight: 600; color: var(--blue); background: var(--blue-bg); border-radius: 8px; padding: 5px 10px; }
.daychip { align-self: center; font-size: 12px; color: var(--muted); background: #fff; border-radius: 8px; padding: 4px 10px; }

/* ---- Traka kapaciteta ---- */
.cap { height: 8px; border-radius: 4px; background: #ECEAE5; overflow: hidden; }
.cap > i { display: block; height: 100%; background: var(--ink); border-radius: 4px; }
.cap.low > i { background: #C77700; }
.cap.full > i { background: var(--red); }

/* ---- Koraci (tijek naloga) ---- */
.steps { display: flex; flex-wrap: wrap; gap: 6px; }
.step { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: #F1EFEA; color: #6A6F76; }
.step.done { background: var(--green-bg); color: var(--green-dk); }
.step.now { background: var(--ink); color: #fff; }

.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { position: relative; width: 110px; height: 82px; border-radius: 10px; overflow: hidden; background: #2B3138; display: flex; align-items: center; justify-content: center; color: #D5D9DE; font-size: 12px; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 14px; line-height: 1; }
