/* VOICE: radni alat dispečera — miran, gust, precizan
   IDEA: tovarni list i dispečerska tabla; red = tura, kolone kao polja formulara
   COLOUR: bela, mastilo #142031, plava autoputa #1b4f9c, crvena samo za probleme
   TYPE: Fira Sans (lokalno, bez Google-a), 4 veličine
   LAYOUT: bočni meni na desktopu, gornji meni na telefonu, sadržaj do 1240px */
@font-face { font-family: 'Fira Sans'; src: url('../assets/fonts/fira-regular.woff') format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Fira Sans'; src: url('../assets/fonts/fira-medium.woff') format('woff'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Fira Sans'; src: url('../assets/fonts/fira-semibold.woff') format('woff'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Fira Sans'; src: url('../assets/fonts/fira-bold.woff') format('woff'); font-weight: 700; font-display: swap; }
:root {
  --paper: #fff; --sheet: #f2f4f7; --ink: #142031; --muted: #556173; --rule: #cdd5df;
  --blue: #1b4f9c; --blue-deep: #123a75; --tint: #e8eef8; --red: #b8292f; --ok: #1d6e46; --warn: #8a5a00; --warn-bg: #fff4dc;
}
* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; }
body { background: var(--sheet); color: var(--ink); font: 400 16px/1.5 'Fira Sans', system-ui, sans-serif; overflow-x: clip; }
a { color: var(--blue); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
h1 { font-size: clamp(26px, 3.2vw, 34px); line-height: 1.1; margin: 0 0 6px; letter-spacing: -0.02em; font-weight: 700; text-wrap: balance; }
h2 { font-size: 20px; margin: 28px 0 10px; font-weight: 600; }
h3 { font-size: 17px; margin: 0 0 8px; font-weight: 600; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.good { color: var(--ok); font-weight: 500; }
.badtxt { color: var(--red); }
.ok { color: var(--ok); }
.sr, .skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: #fff; padding: 8px; z-index: 50; }
.lead { color: var(--muted); font-size: 17px; max-width: 60ch; }

/* top bar */
.top { background: var(--paper); border-bottom: 1.5px solid var(--ink); position: sticky; top: 0; z-index: 20; }
.top .bar { display: flex; align-items: center; gap: 16px; min-height: 58px; padding: 0 clamp(14px, 3vw, 28px); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 19px; }
.brand svg { width: 26px; height: 26px; }
.co { color: var(--muted); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.langsel select { min-height: 36px; border: 1px solid var(--rule); border-radius: 6px; background: #fff; font: 500 14px 'Fira Sans', sans-serif; padding: 0 6px; color: var(--ink); }
.link { background: none; border: 0; color: var(--blue); font: 500 15px 'Fira Sans', sans-serif; cursor: pointer; padding: 6px 4px; text-decoration: underline; text-underline-offset: 3px; }
.link.danger { color: var(--red); }
.menu { display: none; min-height: 40px; min-width: 44px; border: 1px solid var(--rule); background: #fff; border-radius: 6px; font-size: 20px; cursor: pointer; }

/* shell */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 58px); }
.shell.solo { grid-template-columns: minmax(0, 1fr); }
.side { background: var(--paper); border-right: 1px solid var(--rule); padding: 16px 10px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 58px; height: calc(100vh - 58px); }
.side a { display: flex; align-items: center; min-height: 42px; padding: 0 12px; border-radius: 6px; color: var(--ink); text-decoration: none; font-weight: 500; }
.side a:hover { background: var(--sheet); }
.side a[aria-current='page'] { background: var(--ink); color: #fff; }
main { padding: clamp(18px, 3vw, 36px); max-width: 1240px; width: 100%; outline: 0; }
.page.narrow { max-width: 760px; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.notice { background: var(--warn-bg); border: 1px solid #e8c77a; color: #4d3500; padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; }
.notice.bad { background: #fbecec; border-color: #e6a3a6; color: #6b1418; }
.empty { border: 1.5px dashed var(--rule); border-radius: 8px; padding: 32px; text-align: center; color: var(--muted); background: var(--paper); }

/* buttons & fields */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: 6px; border: 1.5px solid var(--blue); background: var(--blue); color: #fff; font: 600 15.5px 'Fira Sans', sans-serif; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--blue-deep); border-color: var(--blue-deep); color: #fff; }
.btn.ghost { background: #fff; color: var(--blue); }
.btn.ghost:hover { background: var(--tint); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14.5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.f { display: flex; flex-direction: column; gap: 4px; }
.f > span { font-size: 13.5px; color: var(--muted); }
input, select, textarea { font: 400 16px 'Fira Sans', sans-serif; color: var(--ink); background: #fff; border: 1px solid var(--rule); border-radius: 6px; min-height: 44px; padding: 8px 10px; width: 100%; }
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: 2px solid var(--tint); }
input:disabled { background: var(--sheet); color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.form-card { background: var(--paper); border: 1.5px solid var(--ink); border-radius: 4px; padding: 20px; display: grid; gap: 14px; margin-top: 16px; }
.form-card.tight { padding: 16px; border-width: 1px; }
.stack { display: grid; gap: 12px; }
.msg { color: var(--red); min-height: 0; margin: 0; }
.msg:empty { display: none; }
.hint { font-size: 13.5px; color: var(--muted); margin: -4px 0 0; }
.ok-msg { color: var(--ok); font-weight: 600; }
.checks { display: flex; gap: 20px; flex-wrap: wrap; }
.checks label { display: flex; gap: 8px; align-items: center; min-height: 40px; }
.checks input { width: 18px; height: 18px; min-height: 0; accent-color: var(--blue); }
.seg { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.seg legend { font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: inline-flex; align-items: center; min-height: 42px; padding: 0 16px; border: 1.5px solid var(--rule); border-radius: 6px; cursor: pointer; font-weight: 500; }
.seg input:checked + span { border-color: var(--blue); background: var(--tint); color: var(--blue-deep); }
.seg input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }

/* auth */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: clamp(24px, 5vw, 72px); align-items: center; max-width: 1040px; margin: clamp(20px, 6vh, 80px) auto; }
.auth h1 { font-size: clamp(32px, 4.2vw, 48px); }
.auth-card { background: var(--paper); border: 1.5px solid var(--ink); padding: 24px; border-radius: 4px; }
.alt { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 15px; margin: 4px 0 0; }

/* filters + list */
.filters { display: grid; grid-template-columns: 2fr repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.list { background: var(--paper); border: 1.5px solid var(--ink); border-radius: 4px; }
.lrow { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.1fr) minmax(0, 1.4fr) 120px; gap: 14px; align-items: center; width: 100%; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--rule); background: transparent; text-align: left; font: inherit; color: inherit; cursor: pointer; text-decoration: none; }
.lrow:last-child { border-bottom: 0; }
.lrow:hover { background: var(--tint); }
.lrow small { display: block; color: var(--muted); font-size: 13.5px; }
.lrow i { font-style: normal; font-size: 11.5px; color: var(--muted); border: 1px solid var(--rule); border-radius: 3px; padding: 0 4px; }
.arr { display: inline-block; width: 18px; height: 1.5px; background: var(--ink); vertical-align: middle; margin: 0 8px; position: relative; }
.arr::after { content: ''; position: absolute; right: -1px; top: -3px; border: 4px solid transparent; border-left: 6px solid var(--ink); border-right: 0; }
.r-price { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.r-price .mine { color: var(--blue); font-weight: 600; }
.urg { font-style: normal; color: #fff; background: var(--red); border-radius: 3px; padding: 0 5px; font-weight: 700; }
.steps { display: flex; gap: 3px; width: 120px; }
.steps i { flex: 1; height: 5px; border: 0; border-radius: 2px; background: var(--rule); padding: 0; }
.steps i.d { background: var(--ink); }
.steps i.c { background: var(--blue); }

/* cards */
.card { background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; padding: 16px 18px; margin-bottom: 14px; }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.acts { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-block; font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 99px; border: 1px solid var(--rule); white-space: nowrap; background: #fff; }
.pill.s-open, .pill.s-in_transit, .pill.s-loaded, .pill.s-at_pickup { border-color: var(--blue); color: var(--blue-deep); background: var(--tint); }
.pill.s-delivered, .pill.s-confirmed, .pill.s-completed { border-color: var(--ok); color: var(--ok); }
.pill.s-problem, .pill.s-cancelled { border-color: var(--red); color: var(--red); }
.offers { list-style: none; margin: 10px 0; padding: 0; border-top: 1px solid var(--rule); }
.offers li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.offers small { display: block; color: var(--muted); }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.timeline { list-style: none; margin: 0 0 12px; padding: 0 0 0 16px; border-left: 2px solid var(--rule); }
.timeline li { position: relative; padding: 4px 0 8px 12px; display: flex; justify-content: space-between; gap: 12px; }
.timeline li::before { content: ''; position: absolute; left: -23px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); border: 2px solid #fff; }
.timeline time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.docs { list-style: none; margin: 8px 0 0; padding: 0; }
.docs li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--rule); }
.docs small { display: block; color: var(--muted); font-size: 13px; }
.linkbox { display: flex; gap: 8px; align-items: center; background: var(--sheet); border-radius: 6px; padding: 8px 10px; margin: 8px 0; }
.linkbox code { font-size: 13px; overflow-wrap: anywhere; flex: 1; }
.share { display: flex; gap: 16px; flex-wrap: wrap; }
#inv { margin-top: 12px; align-items: end; }
.rate { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; }
.rate label input { position: absolute; opacity: 0; }
.rate label span { display: inline-flex; min-height: 36px; align-items: center; padding: 0 10px; border: 1px solid var(--rule); border-radius: 6px; cursor: pointer; }
.rate input:checked + span { border-color: var(--blue); background: var(--tint); }
.chat .msgs { max-height: 380px; overflow: auto; display: flex; flex-direction: column; gap: 6px; padding: 4px 0 10px; }
.m { align-self: flex-start; background: var(--sheet); border-radius: 12px; padding: 8px 12px; max-width: 85%; overflow-wrap: anywhere; margin: 0; }
.m.me { align-self: flex-end; background: var(--ink); color: #fff; }
.m time { display: block; font-size: 12px; opacity: .65; }
.cf { display: flex; gap: 8px; }
.tbl { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--rule); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgb(20 32 49 / .32); z-index: 30; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(500px, 100%); background: var(--paper); border-left: 1.5px solid var(--ink); z-index: 31; overflow: auto; padding: 24px 22px 32px; }
.drawer h2 { margin: 0 0 4px; font-size: 24px; padding-right: 40px; }
.drawer .x { position: absolute; right: 12px; top: 12px; width: 40px; height: 40px; border: 1px solid var(--rule); border-radius: 6px; background: #fff; font-size: 22px; cursor: pointer; }
.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; margin: 18px 0; }
.kv .wide { grid-column: 1 / -1; }
.kv dt { font-size: 13px; color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; max-width: 92vw; }
.toast.on { opacity: 1; }
.toast.bad { background: var(--red); }

@media (max-width: 1000px) {
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .f:first-child { grid-column: 1 / -1; }
  .lrow { grid-template-columns: minmax(0, 1fr) auto; }
  .lrow .r-route { grid-column: 1 / -1; }
  .lrow .r-co { grid-column: 1; }
  .lrow .r-price { grid-column: 2; grid-row: 2; }
  .cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 800px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; position: fixed; top: 58px; left: 0; right: 0; height: auto; z-index: 25; border-bottom: 1.5px solid var(--ink); }
  .side.open { display: flex; }
  .menu { display: inline-flex; align-items: center; justify-content: center; }
  .co { display: none; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
