/* Tabero dispatch draft — calm working UI: one typeface, white surfaces with hairline borders,
   brand deep teal for actions, lime only as a small accent. Phone first, sidebar on desktop. */
:root {
  --deep: #062a33; --teal: #14b89b; --lime: #d4f56a;
  --bg: #f6f6f3; --card: #fff; --ink: #14181a; --muted: #6b7376; --faint: #9aa1a3; --line: #e8e8e3; --hover: #f1f1ed;
  --red: #e5533d; --r: 14px;
  --font: "Manrope", system-ui, -apple-system, sans-serif;
  --nav-h: 64px; --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 500 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { margin: 0; font-family: var(--font); font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg:not(.leaflet-zoom-animated) { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); font-weight: 600; }

/* ---------- Layout ---------- */
.main { max-width: 980px; margin: 0 auto; padding: 18px 16px calc(var(--nav-h) + var(--safe-b) + 28px); }
.side { position: fixed; z-index: 50; inset: auto 0 0; padding-bottom: var(--safe-b); background: rgba(255, 255, 255, .94); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.side__brand, .side__reset { display: none; }
.nav { height: var(--nav-h); display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; }
.nav a { position: relative; display: grid; justify-items: center; gap: 2px; color: var(--faint); font-size: 11px; font-weight: 700; }
.nav a svg { width: 22px; height: 22px; }
.nav a.is-on { color: var(--deep); }
.nav a.is-on::after { content: ""; position: absolute; top: -9px; width: 18px; height: 3px; border-radius: 0 0 3px 3px; background: var(--deep); }
.nav__new svg { width: 44px !important; height: 44px !important; padding: 11px; border-radius: 14px; background: var(--deep); color: var(--lime); stroke-width: 2.2; }
.nav__new span { display: none; }
.nav__new.is-on::after { display: none; }
.badge { position: absolute; top: -3px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 99px; background: var(--red); color: #fff; font: 800 10px/17px var(--font); font-style: normal; text-align: center; }

@media (min-width: 900px) {
  .side { inset: 0 auto 0 0; width: 220px; padding: 20px 12px; border-top: 0; border-right: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; gap: 22px; }
  .side__brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-weight: 800; font-size: 16px; letter-spacing: -.01em; }
  .side__brand i { width: 32px; height: 32px; border-radius: 10px; background: var(--deep); color: var(--lime); display: grid; place-items: center; }
  .side__brand i svg { width: 18px; height: 18px; }
  .side__brand small { display: block; font-size: 11px; font-weight: 700; color: var(--faint); letter-spacing: 0; }
  .nav { height: auto; grid-template-columns: 1fr; gap: 2px; }
  .nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; font-size: 14px; color: var(--muted); }
  .nav a:hover { background: var(--hover); }
  .nav a svg { width: 19px; height: 19px; }
  .nav a.is-on { background: var(--hover); color: var(--ink); }
  .nav a.is-on::after { display: none; }
  .nav__new { order: -1; margin-bottom: 12px; justify-content: center; background: var(--deep); color: #fff !important; }
  .nav__new:hover { background: #0b3d48 !important; }
  .nav__new svg { width: 18px !important; height: 18px !important; padding: 0; background: none; color: var(--lime); }
  .nav__new span { display: inline; }
  .nav a.nav__new.is-on { background: var(--deep); color: #fff; }
  .badge { position: static; margin-left: auto; }
  .side__reset { display: block; margin-top: auto; border: 0; background: none; color: var(--faint); font-size: 12px; text-align: left; padding: 0 10px; }
  .main { margin-left: 220px; padding: 32px 40px 48px; }
}

/* ---------- Pieces ---------- */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 20px; }
.head h1 { font-size: 26px; }
.head__kicker { margin: 0 0 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.head__back { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-weight: 700; font-size: 13px; margin-bottom: 10px; }
.head__back svg { width: 16px; height: 16px; }
.sec { margin-top: 26px; }
.sec__head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 8px; }
.sec__head h2 { font-size: 13px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); }
.sec__head a { font-size: 13px; font-weight: 700; color: var(--teal); }
.sec > h2 { font-size: 13px; text-transform: uppercase; color: var(--muted); margin: 0 2px 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.pad { padding: 16px; }
.grid2 { display: grid; gap: 14px; }
.grid2 > * { min-width: 0; }   /* long one-line texts must not widen a column */
@media (min-width: 900px) { .grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } .grid2:has(.save) { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); } }
.tag { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 800; background: var(--hover); color: var(--muted); }
.tag--new { background: rgba(229, 83, 61, .1); color: var(--red); }
.chip { display: inline-flex; padding: 3px 9px; border-radius: 8px; background: var(--hover); font-size: 12.5px; font-weight: 700; }
.chip--warn { background: rgba(242, 169, 59, .16); color: #9a5f08; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border: 1px solid transparent; border-radius: 12px;
  background: var(--deep); color: #fff; font-weight: 700; font-size: 14.5px; transition: background .15s, transform .1s;
}
.btn:hover { background: #0b3d48; }
.btn:active { transform: scale(.98); }
.btn svg { width: 17px; height: 17px; stroke-width: 2.2; }
.btn--line { background: #fff; border-color: var(--line); color: var(--ink); }
.btn--line:hover { background: var(--hover); }
.btn--ghost { background: var(--hover); color: var(--ink); }
.btn--ghost:hover { background: #e9e9e4; }
.btn--danger { background: none; color: var(--red); }
.btn--danger:hover { background: rgba(229, 83, 61, .08); }
.btn--full { width: 100%; }
.btn--sm { min-height: 34px; padding: 0 12px; border-radius: 9px; font-size: 13px; }
.btn:disabled { opacity: .35; pointer-events: none; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); font-weight: 600; }

/* Stats on "Šiandien" */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); }
.stats > * { padding: 14px 14px 12px; }
.stats > * + * { border-left: 1px solid var(--line); }
.stats a:hover { background: var(--hover); }
.stats strong { display: block; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.stats strong em { font-style: normal; color: var(--faint); font-weight: 700; }
.stats strong.is-hot { color: var(--red); }
.stats span { font-size: 12px; color: var(--muted); font-weight: 600; line-height: 1.3; display: block; }

/* Trip rows */
.run { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.run + .run { border-top: 1px solid var(--line); }
.run:hover { background: var(--hover); }
.run__day { flex: 0 0 40px; text-align: center; }
.run__day small { display: block; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }
.run__day strong { display: block; font-size: 20px; font-weight: 800; line-height: 1.1; }
.run__day.is-soon small { color: var(--teal); }
.run__txt { flex: 1; min-width: 0; }
.run__txt strong { display: block; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run__txt span { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.count { min-width: 28px; height: 24px; padding: 0 8px; border-radius: 8px; background: var(--deep); color: #fff; font-size: 12.5px; font-weight: 800; display: grid; place-items: center; }
.count.is-zero { background: var(--hover); color: var(--faint); }
.run > svg { color: #c4c8c9; width: 16px; height: 16px; }

/* Trip detail */
.map { height: 280px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: #ecebe6; }
@media (min-width: 900px) { .map { height: calc(100vh - 150px); position: sticky; top: 32px; } }
.mk { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 1.5px solid var(--deep); color: var(--deep); font: 800 10px var(--font); box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
.mk.has { background: var(--deep); color: var(--lime); }
.mk.is-added { border-color: var(--teal); }
.mk.is-off { opacity: .35; }
.stops { list-style: none; margin: 0; padding: 4px 0; }
.stop { display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 14px; }
.stop + .stop { border-top: 1px solid var(--line); }
.stop__n { flex: 0 0 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line); font-size: 11px; font-weight: 800; color: var(--muted); }
.stop.has .stop__n { background: var(--deep); border-color: var(--deep); color: var(--lime); }
.stop__name { flex: 1; min-width: 0; font-weight: 700; font-size: 14.5px; cursor: pointer; }
.stop__name small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.stop.is-off .stop__name { text-decoration: line-through; color: var(--faint); }
.stop__tools { display: flex; gap: 0; opacity: .7; }
.stop:hover .stop__tools { opacity: 1; }
.ib { width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--muted); display: grid; place-items: center; }
.ib:hover { background: var(--hover); color: var(--ink); }
.ib svg { width: 17px; height: 17px; }
.ib:disabled { opacity: .2; pointer-events: none; }
.stop__orders { list-style: none; margin: 0 10px 8px 46px; display: grid; gap: 6px; }
.note { margin: 10px 2px 0; font-size: 13px; color: var(--muted); font-weight: 600; }

/* Orders */
.ord { display: flex; gap: 12px; padding: 14px; }
.ord + .ord { border-top: 1px solid var(--line); }
.av { flex: 0 0 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--hover); color: var(--deep); font-weight: 800; font-size: 14px; }
.ord__main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ord__line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ord__line strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src { color: var(--faint); display: grid; }
.src svg { width: 14px; height: 14px; }
.ord__sub { font-size: 13px; color: var(--muted); font-weight: 600; }
.ord__sub a { color: var(--teal); }
.ord__items { font-size: 13.5px; color: #3b4447; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ord__note { margin-top: 4px; font-size: 12.5px; color: var(--muted); padding-left: 8px; border-left: 2px solid var(--line); }
.ord__note b { color: var(--ink); }
.ord__btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ord__sum { flex: none; text-align: right; font-weight: 800; font-size: 15px; }
.ord__sum small { display: block; font-size: 12px; color: var(--faint); font-weight: 600; }
.mini { padding: 9px 11px; border-radius: 10px; background: var(--hover); font-size: 13px; }
.mini a { color: var(--teal); font-weight: 700; }
.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: #ebebe6; margin-bottom: 14px; }
.tabs button { border: 0; background: none; padding: 7px 13px; border-radius: 9px; font-weight: 700; font-size: 13.5px; color: var(--muted); }
.tabs button.is-on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

/* Calls */
.progress { height: 6px; border-radius: 99px; background: var(--hover); overflow: hidden; margin: 12px 0 6px; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--teal); transition: width .4s; }
.call { display: flex; align-items: center; gap: 12px; padding: 11px 14px; }
.call + .call { border-top: 1px solid var(--line); }
.call__done { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid #cfd3d2; background: #fff; color: transparent; display: grid; place-items: center; }
.call__done svg { width: 15px; height: 15px; stroke-width: 2.6; }
.call.is-done .call__done { background: var(--teal); border-color: var(--teal); color: #fff; }
.call__txt { flex: 1; min-width: 0; }
.call__txt strong { display: block; font-size: 14.5px; }
.call__txt span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call.is-done .call__txt { opacity: .5; }
.call.is-done .call__txt strong { text-decoration: line-through; }
.call__tel { flex: none; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); color: var(--deep); display: grid; place-items: center; }
.call__tel:hover { background: var(--hover); }
.call-stop { padding: 12px 14px 2px; font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }
.call-stop:not(:first-child) { border-top: 1px solid var(--line); }

/* New phone order */
.form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.form > * { min-width: 0; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea, .pickbtn {
  width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 16px; font-weight: 600; outline: none; transition: border-color .15s, box-shadow .15s;
}
.pickbtn { text-align: left; color: var(--ink); }
.field textarea { min-height: 64px; font-size: 15px; resize: vertical; }
.field input:focus, .field textarea:focus, .pickbtn:focus { border-color: var(--deep); box-shadow: 0 0 0 3px rgba(6, 42, 51, .08); }
.who { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.who__av { width: 34px; height: 34px; border-radius: 50%; background: var(--deep); color: var(--lime); display: grid; place-items: center; font-weight: 800; flex: none; }
.who div { flex: 1; min-width: 0; }
.who .btn { flex: none; }
@media (max-width: 560px) { .who { flex-wrap: wrap; } .who .btn { width: 100%; } }
.who small { display: block; color: var(--muted); font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sugg { margin-top: 4px; border-radius: 12px; overflow: hidden; }
.sugg:not(:empty) { border: 1px solid var(--line); background: #fff; }
.sugg button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 11px 14px; font-weight: 700; font-size: 14.5px; }
.sugg button + button { border-top: 1px solid var(--line); }
.sugg button:hover { background: var(--hover); }
.sugg button small { color: var(--muted); font-weight: 600; margin-left: 6px; }
.runs-pick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.runs-pick button { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 7px 11px; text-align: left; }
.runs-pick button strong { display: block; font-size: 13.5px; }
.runs-pick button span { font-size: 12px; color: var(--muted); font-weight: 600; }
.runs-pick button.is-on { border-color: var(--deep); background: var(--deep); color: #fff; }
.runs-pick button.is-on span { color: var(--lime); }
.runs-pick button:disabled { opacity: .4; }
.lines { display: grid; gap: 0; border-radius: 12px; overflow: hidden; }
.lines:not(:empty) { border: 1px solid var(--line); background: #fff; }
.line { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; }
.line + .line { border-top: 1px solid var(--line); }
.line__name { flex: 1; min-width: 0; font-weight: 700; font-size: 14px; }
.line__name small { display: block; color: var(--muted); font-weight: 600; font-size: 12px; }
.qty { display: flex; align-items: center; border-radius: 10px; border: 1px solid var(--line); }
.qty button { width: 34px; height: 34px; border: 0; background: none; font-size: 18px; font-weight: 700; color: var(--ink); }
.qty output { min-width: 28px; text-align: center; font-weight: 800; font-size: 14px; }
.total { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; color: var(--muted); font-size: 14px; }
.total strong { font-size: 22px; font-weight: 800; color: var(--ink); letter-spacing: -.02em; }
.save { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 10px); z-index: 5; box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .35); }
@media (min-width: 900px) { .save { top: 32px; bottom: auto; } }

/* Sheet + toast */
.sheet { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; background: rgba(10, 14, 16, 0); transition: background .2s; }
.sheet.is-open { background: rgba(10, 14, 16, .35); }
.sheet[hidden] { display: none; }
.sheet__panel { width: 100%; max-width: 520px; max-height: 86vh; overflow-y: auto; padding: 4px 14px calc(16px + var(--safe-b)); background: #fff; border-radius: 20px 20px 0 0; transform: translateY(100%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
@media (min-width: 900px) { .sheet { align-items: center; } .sheet__panel { border-radius: 18px; transform: translateY(20px); opacity: 0; transition: .2s; } .sheet.is-open .sheet__panel { opacity: 1; } }
.sheet.is-open .sheet__panel { transform: none; }
.sheet__grip { height: 20px; display: grid; place-items: center; }
.sheet__grip::before { content: ""; width: 34px; height: 4px; border-radius: 2px; background: #dcdcd6; }
.sheet h2 { font-size: 17px; margin: 4px 4px 12px; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 8px 10px; border: 0; border-radius: 10px; background: none; text-align: left; font-weight: 700; }
.opt:hover, .opt.is-on { background: var(--hover); }
.opt:disabled { opacity: .4; }
.opt span { flex: 1; }
.opt small { display: block; color: var(--muted); font-weight: 600; font-size: 12.5px; }
.toast { position: fixed; z-index: 120; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 14px); transform: translate(-50%, 16px); max-width: calc(100% - 24px); padding: 11px 16px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 900px) { .toast { bottom: 24px; left: calc(50% + 110px); } }

@media print {
  .side, .no-print, .toast { display: none !important; }
  .main { margin: 0; padding: 0; }
  .card { border-color: #bbb; }
}

/* ---------- Colour: every weekly trip has its own (--c, set inline), plus status colours ---------- */
.trip-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--faint)); margin-right: 6px; vertical-align: 1px; }
.run__day { flex-basis: 44px; height: 48px; border-radius: 12px; display: grid; place-content: center; background: color-mix(in srgb, var(--c) 12%, #fff); }
.run__day small, .run__day.is-soon small { color: var(--c); }
.run__day strong { color: var(--c); }
.run__day.is-soon { background: var(--c); }
.run__day.is-soon small, .run__day.is-soon strong { color: #fff; }
.run:hover { background: color-mix(in srgb, var(--c) 5%, #fff); }
.count { background: var(--c); }
.count.is-zero { background: color-mix(in srgb, var(--c) 10%, #fff); color: var(--c); }
.ord .av { background: color-mix(in srgb, var(--c) 14%, #fff); color: var(--c); }
.trip-pill { display: inline-flex; align-items: center; gap: 5px; color: var(--c); font-weight: 700; margin-right: 4px; }
.trip-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.src--web { color: #2f80ed; }
.src--tel { color: #0fa98f; }
.tag--new { background: #e5533d; color: #fff; }
.st i { width: 30px; height: 30px; margin-bottom: 8px; border-radius: 9px; display: grid; place-items: center; }
.st i svg { width: 16px; height: 16px; stroke-width: 2; }
.st--red i { background: rgba(229, 83, 61, .12); color: #e5533d; }
.st--green i { background: rgba(15, 169, 143, .12); color: #0fa98f; }
.st--violet i { background: rgba(124, 92, 255, .12); color: #7c5cff; }
.stop__n { border-color: color-mix(in srgb, var(--c) 35%, #fff); color: var(--c); }
.stop.has .stop__n { background: var(--c); border-color: var(--c); color: #fff; }
.mk { border-color: var(--c); color: var(--c); }
.mk.has { background: var(--c); border-color: #fff; color: #fff; }
.tabs button { display: inline-flex; align-items: center; }
.tabs button.is-on { color: var(--c, var(--ink)); }
#calls .progress i { background: var(--c); }
#calls .call-stop { color: var(--c); }
#calls .call.is-done .call__done { background: var(--c); border-color: var(--c); }
.runs-pick button { border-left: 3px solid var(--c); }
.runs-pick button.is-on { background: var(--c); border-color: var(--c); }
.runs-pick button.is-on span { color: rgba(255, 255, 255, .85); }
.head__kicker .trip-dot { width: 9px; height: 9px; }
.nav__new svg { background: linear-gradient(135deg, var(--deep), #0e5563); }

/* ---------- Server: login, delivered, truck ---------- */
body.is-login .side { display: none; }
body.is-login .main { margin: 0 auto; max-width: 400px; padding-top: 12vh; }
.login { display: grid; gap: 16px; }
.login__brand { display: flex !important; padding: 0 !important; color: var(--ink); margin-bottom: 4px; }
.login__err { margin: 0; color: var(--red); font-weight: 700; font-size: 14px; }
.tag--done { background: rgba(15, 169, 143, .12); color: #0fa98f; }
.truck { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--c, var(--deep)); color: #fff; border: 3px solid #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, .3); }
.truck svg { width: 17px; height: 17px; }
.here { color: var(--c); }
body.is-demo .side__reset::before { content: "Demonstracija · "; }
