/* Serve Route Planner — mobile-first, glove-friendly tap targets, no framework. */
* { box-sizing: border-box; }
:root {
  --ink: #1c2430; --paper: #f6f3ec; --card: #ffffff; --line: #d8d2c4;
  --accent: #14532d; --accent2: #b45309; --bad: #b91c1c;
  --ok: #15803d; --warn: #b45309; --pending: #64748b;
}
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--paper); color: var(--ink); padding: 0 10px 40px;
  max-width: 760px; margin-inline: auto;
}
.topbar { padding: 14px 2px 6px; }
.topbar h1 { font-size: 22px; margin: 0 0 8px; }
.dayrow { display: flex; gap: 10px; align-items: center; }
.day-summary { font-size: 14px; color: #55503f; }
input[type="date"], input[type="text"], textarea, select {
  font-size: 17px; padding: 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; width: 100%; color: var(--ink);
}
input[type="date"] { width: auto; }
textarea { resize: vertical; }
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px; margin: 10px 0;
}
.panel h2 { font-size: 17px; margin: 2px 0 8px; }
.fld-label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 4px; color: #55503f; }
.fld-label.inline { display: inline; margin: 0 8px 0 0; }
.row { display: flex; gap: 8px; align-items: center; }
.row.spread { justify-content: space-between; }
.row select { width: auto; flex: 1; }
.hint { font-size: 13px; color: #6b6650; margin-top: 6px; }
.hidden { display: none !important; }

.btn {
  appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 10px; padding: 10px 14px; font-size: 16px; min-height: 48px; cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn-small { min-height: 44px; font-size: 15px; padding: 8px 12px; }
.btn-big { width: 100%; margin-top: 8px; font-size: 18px; font-weight: 600; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-next { background: var(--accent2); border-color: var(--accent2); color: #fff; }
.btn-next:disabled { opacity: .45; }
.btn[disabled] { opacity: .5; }
.actions-panel .totals { font-size: 17px; font-weight: 600; margin-top: 10px; }
.actions-panel .totals .sub { font-weight: 400; font-size: 14px; color: #55503f; }

.stop {
  background: var(--card); border: 1px solid var(--line); border-left: 8px solid var(--pending);
  border-radius: 14px; padding: 12px; margin: 10px 0;
}
.stop.status-attempted { border-left-color: var(--warn); }
.stop.status-served { border-left-color: var(--ok); opacity: .82; }
.stop.is-next { box-shadow: 0 0 0 2px var(--accent2); }
.stop-head { display: flex; gap: 10px; align-items: baseline; }
.stop-num {
  background: var(--ink); color: #fff; border-radius: 999px; min-width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none;
}
.stop-label { font-weight: 700; font-size: 16px; }
.stop-addr { font-size: 17px; margin: 4px 0 2px; }
.stop-subject { font-size: 15px; color: #3c382c; }
.stop-notes { font-size: 14px; color: #55503f; white-space: pre-wrap; margin-top: 4px; }
.leg { font-size: 14px; color: #55503f; margin-top: 6px; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: #e7e2d4; }
.pill.ok { background: #dcfce7; color: var(--ok); }
.pill.warn { background: #fef3c7; color: var(--warn); }
.pill.bad { background: #fee2e2; color: var(--bad); }
.navrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.navrow a {
  text-align: center; text-decoration: none; font-size: 14px; font-weight: 600;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 2px; color: var(--ink); background: #fbf9f4;
}
.statusrow { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.statusrow .btn { flex: 1; }
.meta { font-size: 13px; color: #6b6650; margin-top: 8px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.iconrow { display: flex; gap: 6px; }
.iconrow .btn { min-height: 44px; padding: 6px 12px; }
.editform { border-top: 1px dashed var(--line); margin-top: 10px; padding-top: 6px; }
.toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 15px;
  max-width: 92vw; text-align: center; z-index: 50;
}
.foot { font-size: 12px; color: #8a8471; text-align: center; margin-top: 18px; }
code { background: #eee9db; padding: 0 4px; border-radius: 4px; }

/* ---- v2: connectivity, auth, sheets, ledger UI ---- */
.conn-badge {
  display: inline-block; font-size: 14px; font-weight: 600; border-radius: 999px;
  padding: 6px 12px; margin: 2px 0 8px; border: 1px solid var(--line); background: #fff; cursor: pointer;
}
.conn-on { background: #dcfce7; color: #14532d; border-color: #86efac; }
.conn-off { background: #fee2e2; color: #7f1d1d; border-color: #fca5a5; }
.conn-unknown { color: #55503f; }
.btn-prepare { background: #1e40af; border-color: #1e40af; color: #fff; }
.risk-note {
  background: #fef3c7; border: 1px solid #f59e0b; color: #7c2d12; border-radius: 10px;
  padding: 8px 12px; font-size: 15px; font-weight: 600; margin: 4px 0 8px;
}
.auth-overlay, .sheet {
  position: fixed; inset: 0; background: rgba(20, 24, 32, .55); z-index: 60;
  display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 18px 10px;
}
.auth-card, .sheet-card {
  background: var(--paper); border-radius: 16px; padding: 16px; width: 100%; max-width: 560px;
}
.auth-error { color: var(--bad); font-size: 14px; min-height: 20px; margin-top: 6px; }
.outcome-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.outcome-grid .outcome { min-height: 52px; font-weight: 600; }
.outcome-grid .outcome.picked { background: var(--accent); border-color: var(--accent); color: #fff; }
.outcome-grid .outcome[data-outcome="served"].picked { background: var(--ok); border-color: var(--ok); }
.pin-map { height: 300px; border-radius: 12px; border: 1px solid var(--line); margin: 8px 0; background: #e7e2d4; }
.checkline { display: block; font-size: 16px; margin: 10px 0; }
.checkline input { width: 22px; height: 22px; vertical-align: -4px; }
.fld-grow { flex: 1; }
.fld-grow select, .fld-grow input { width: 100%; }
.places-list .place-row {
  display: flex; gap: 8px; align-items: center; justify-content: space-between;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 6px 0; background: #fbf9f4;
}
.place-row .place-name { font-weight: 700; }
.place-row .place-addr { font-size: 13px; color: #55503f; }
.chip {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  background: #e7e2d4; margin-left: 4px;
}
.chip.risk { background: #fee2e2; color: #b91c1c; }
.chip.due { background: #fef3c7; color: #92400e; }
.chip.win { background: #dbeafe; color: #1e40af; }
.chip.prio { background: #ede9fe; color: #5b21b6; }
.stop.at-risk { box-shadow: 0 0 0 2px #f59e0b; }
.stop .due-line { font-size: 14px; margin-top: 2px; }
.stop details.history { margin-top: 8px; }
.stop details.history summary { font-size: 14px; font-weight: 600; cursor: pointer; padding: 6px 0; }
.hist-row { font-size: 13px; border-top: 1px dashed var(--line); padding: 6px 0; color: #3c382c; }
.hist-row .h-out { font-weight: 700; }
.export-row { display: flex; gap: 6px; margin-top: 8px; }
.export-row a { font-size: 13px; }
.stop-color-red { border-top: 6px solid #dc2626; }
.stop-color-amber { border-top: 6px solid #f59e0b; }
.stop-color-green { border-top: 6px solid #16a34a; }
.stop-color-blue { border-top: 6px solid #2563eb; }
.stop-color-purple { border-top: 6px solid #7c3aed; }
.stop-color-gray { border-top: 6px solid #6b7280; }

/* v2.2 — video-study parity: buckets, outcome lines, ticks, anchored list */
.chip.fee { background: #dcfce7; color: #166534; }
.outcome-line { font-size: 14px; font-weight: 600; margin: 2px 0; }
.outcome-line.ok { color: #166534; }
.outcome-line.bad { color: #b91c1c; }
.stop { scroll-margin-top: 132px; }
.bucket { margin: 0 0 10px; }
.bucket > summary {
  cursor: pointer; font-weight: 700; padding: 10px 12px; border-radius: 10px;
  background: #e7f6ec; color: #166534; list-style: none;
}
.bucket > summary::-webkit-details-marker { display: none; }
.bucket-label { font-weight: 700; padding: 10px 2px 4px; color: #6b7280; }
.status-skipped { opacity: .78; }
.route-ticks { display: flex; gap: 2px; flex-wrap: wrap; margin: 8px 0 2px; }
.tick { width: 10px; height: 10px; border-radius: 3px; background: #e5e7eb; border: 1px solid #cbd5e1; }
.tick-served { background: #22c55e; border-color: #16a34a; }
.tick-attempted { background: #f59e0b; border-color: #d97706; }
.tick-skipped { background: #9ca3af; border-color: #6b7280; }
.route-ops { margin-top: 10px; display: grid; gap: 6px; }
#routeSearch { width: 100%; }

/* v3 — process-server intelligence: window tiles, requirement blocks,
   field-fact row, hold state, outside-hours flag */
.wt-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 2px; }
.wtile {
  font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 999px;
  background: #fff7ed; color: #9a3412; border: 1px dashed #fdba74;
}
.wtile.on { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.chip.hold { background: #e5e7eb; color: #374151; }
.stop.is-held { opacity: .82; border-left: 6px solid #6b7280; }
.req-block {
  font-size: 13px; white-space: pre-wrap; background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 8px; padding: 7px 9px; margin: 6px 0; color: #451a03;
}
.fact-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.oh-flag { color: #b91c1c; font-weight: 700; }
#shotSheet .sheet-card { max-height: 92vh; overflow-y: auto; }
.req-block.warn { background: #fef2f2; border-color: #fca5a5; color: #7f1d1d; }

/* COMPANION MODE gate: the parked standalone layer (photo/GPS proof,
   exports, reporting apparatus) exists in the DOM + data but is not
   surfaced. body.mode-standalone (a future build) reveals it. */
body.mode-companion .parked { display: none !important; }

/* DANGER banner + Run Parameters (Routing Policy Constitution) */
.danger-banner { background: #fef2f2; border: 2px solid #dc2626; color: #7f1d1d;
  border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; font-weight: 600;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.danger-banner.hidden { display: none; }
.run-params { border: 1px dashed #cbd5e1; border-radius: 10px; padding: 8px 10px; margin: 8px 0; }
.run-params summary { font-weight: 700; cursor: pointer; }
.run-params input[type="number"] { padding: 4px 6px; }
