:root {
  --green: #1f3d2b;
  --green-2: #2f5d40;
  --wheat: #e9b949;
  --bg: #f4f2ec;
  --card: #ffffff;
  --ink: #1d1d1b;
  --muted: #6b6a64;
  --line: #d9d5ca;
  --red: #b3261e;
  --ok: #2e7d32;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { padding-bottom: env(safe-area-inset-bottom); font-size: 17px; }
[hidden] { display: none !important; }

.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--green); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand img { width: 30px; height: 30px; border-radius: 7px; }
.bar-right { display: flex; gap: 8px; }
.chip { background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 999px; padding: 7px 12px; font-size: 14px; font-weight: 600; }

.banner { background: var(--wheat); color: #3a2c00; padding: 8px 16px; font-size: 15px; font-weight: 600; text-align: center; }

.view { padding: 16px; max-width: 640px; margin: 0 auto; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.card.narrow { max-width: 400px; margin: 24px auto; }
h1 { font-size: 22px; margin: 0 0 14px; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 26px 2px 10px; }
.hello { margin: 4px 2px 14px; font-size: 18px; }

label { display: block; margin: 0 0 14px; }
label > span, legend { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
input, textarea {
  width: 100%; font: inherit; font-size: 17px; color: var(--ink);
  padding: 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
  -webkit-appearance: none; appearance: none;
}
input:focus, textarea:focus { outline: none; border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(47,93,64,.15); }
input.bad, .seg.bad { border-color: var(--red) !important; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { font: inherit; font-size: 16px; padding: 12px 4px; border: 0; background: #fff; color: var(--ink); }
.seg button + button { border-left: 1.5px solid var(--line); }
.seg button.on { background: var(--green); color: #fff; font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 700; padding: 13px 18px; border-radius: 12px;
  border: 1.5px solid var(--green); background: #fff; color: var(--green); cursor: pointer;
}
.btn.primary { background: var(--green); color: #fff; }
.btn.big { width: 100%; padding: 17px; font-size: 19px; margin-bottom: 10px; }
.btn:disabled { opacity: .55; }
.link { background: none; border: 0; color: var(--red); font: inherit; font-size: 15px; text-decoration: underline; }
.actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 6px; }

.net { margin: -4px 0 14px; padding: 10px 12px; background: #eef4ef; border-radius: 10px; font-weight: 700; color: var(--green); }
.net.bad { background: #fbeaea; color: var(--red); }
.photo { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.photo img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }

.error { color: var(--red); font-weight: 600; margin: 4px 0 12px; }
.hint { color: var(--muted); font-size: 15px; text-align: center; }

.sync { background: #fff7df; border: 1px solid #ecd48a; border-radius: 12px; padding: 12px 14px; font-size: 15px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sync .btn { padding: 8px 12px; font-size: 15px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.item { background: var(--card); border-radius: 12px; padding: 12px 14px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.item .top { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; }
.item .sub { color: var(--muted); font-size: 15px; margin-top: 3px; }
.tag { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.tag.sent { background: #e3f1e5; color: var(--ok); }
.tag.wait { background: #fff1c7; color: #7a5a00; }
.tag.err { background: #fbeaea; color: var(--red); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 20;
  max-width: 90vw; text-align: center;
}

/* Tasks (driver app) */
a.chip { text-decoration: none; display: inline-flex; align-items: center; }
.item.task-item { border-left: 5px solid var(--wheat); border-radius: 0 12px 12px 0; cursor: pointer; }
.item.task-item.done { border-left-color: var(--ok); opacity: .75; }
.progress { height: 10px; background: #ece9df; border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.progress > div { height: 100%; background: var(--green-2); }
.back { color: var(--green); text-decoration: none; font-weight: 700; font-size: 17px; padding: 4px 2px 12px; }
.tv-details { margin: 0 0 8px; white-space: pre-wrap; }
.tv-sub { margin: 0 0 6px; color: var(--muted); font-size: 15px; }
.tv-count { font-weight: 700; margin: 4px 0 14px; }
.form-task { margin: -6px 0 14px; padding: 8px 12px; background: #fff7df; border-radius: 10px; font-weight: 600; font-size: 15px; }
.item .top { align-items: flex-start; }
.item .top .tag { flex-shrink: 0; margin-top: 2px; }
.form-task { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.form-task .unlink { color: #7a5a00; font-size: 14px; }

/* Task map */
.tv-mapbox { margin: 10px 0 6px; }
.tv-map { height: 230px; border-radius: 12px; overflow: hidden; background: #dfe3d8; }
.tv-drive { font-weight: 700; margin: 8px 0 4px; color: var(--green); }
.tv-stops { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.tv-stop { background: #f7f5ef; border-radius: 10px; padding: 10px 12px; }
.tv-stop-head { display: flex; align-items: center; gap: 8px; }
.tv-note { color: var(--muted); font-size: 15px; margin: 4px 0 0 32px; white-space: pre-wrap; }
.tv-nav { display: flex; gap: 14px; align-items: center; margin: 8px 0 0 32px; flex-wrap: wrap; }
.tv-nav .btn { padding: 9px 14px; font-size: 15px; text-decoration: none; }
.tv-nav .link { color: var(--green-2); font-weight: 600; text-decoration: underline; font-size: 15px; }
.tv-dot { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 13px; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); flex-shrink: 0; }
.tv-dot.a { background: var(--green-2); }
.tv-dot.b { background: #b3261e; }
.leaflet-marker-icon .tv-dot { transform: translate(-50%, -50%); }
.weight-hint { margin: -4px 0 12px; font-size: 14px; color: var(--muted); }
.weight-hint.std { padding: 10px 12px; background: #eef4ef; border-radius: 10px; font-weight: 700; color: var(--green); font-size: 15px; }
label.btn.bad { border-color: var(--red); color: var(--red); }
