/* PPTG Routes mini-view — styles.
   Deliberately self-contained: same design tokens and visual language as
   app/index.html (navy topbar, panel background, 14px cards) but zero
   dependencies on any file under app/. Nothing here is imported by the
   main dashboard. */

:root{
  --navy:#0d3b66;
  --blue:#1d6fb8;
  --panel:#f4f7fb;
  --ink:#1c2a36;
  --ink-soft:#4a5c6b;
  --border:#dbe4ee;
  --white:#ffffff;
  --ok:#1f7a5c;
  --warn:#b8562f;
  --amber-bg:#fff6e6;
  --amber-border:#e8b95b;
  --amber-ink:#7a4e0a;
  --danger:#c0392b;
  --danger-bg:#fdecea;
}

*,*::before,*::after{ box-sizing:border-box; }

html,body{
  margin:0;
  padding:0;
  background:var(--panel);
  color:var(--ink);
  font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing:antialiased;
}

button, input, select, textarea{ font-family:inherit; }

a{ color:var(--blue); }

.page{
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

/* ---------- Top bar (matches the dashboard) ---------- */
.topbar{
  position:sticky;
  top:0;
  z-index:50;
  background:var(--navy);
  color:var(--white);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 16px;
  box-shadow:0 2px 8px rgba(13,59,102,0.25);
}
.wordmark{
  font-weight:700;
  font-size:1.05rem;
  letter-spacing:0.2px;
  white-space:nowrap;
  display:flex;
  align-items:center;
  gap:8px;
}
.wordmark .page-name{
  font-weight:400;
  color:rgba(255,255,255,0.75);
}
.back-link{
  color:rgba(255,255,255,0.85);
  font-size:0.82rem;
  text-decoration:none;
  border:1px solid rgba(255,255,255,0.35);
  border-radius:999px;
  padding:6px 14px;
  white-space:nowrap;
  display:inline-flex;
  align-items:center;
  gap:6px;
}
.back-link:hover{ background:rgba(255,255,255,0.12); color:#fff; }
.back-link:focus-visible{ outline:2px solid #fff; outline-offset:2px; }

/* ---------- Demo banner ---------- */
.demo-banner{
  background:var(--amber-bg);
  border-bottom:1px solid var(--amber-border);
  color:var(--amber-ink);
  padding:10px 16px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  flex-wrap:wrap;
  font-size:0.85rem;
  text-align:center;
}
.demo-banner strong{
  background:var(--amber-border);
  color:#fff;
  padding:2px 10px;
  border-radius:999px;
  font-size:0.7rem;
  letter-spacing:0.05em;
  text-transform:uppercase;
}

/* ---------- Main column ---------- */
.main{
  flex:1;
  max-width:900px;
  width:100%;
  margin:0 auto;
  padding:20px;
}

.screen-title{
  font-size:1.3rem;
  font-weight:700;
  color:var(--navy);
  margin:0;
}
.page-sub{
  font-size:0.88rem;
  color:var(--ink-soft);
  margin:4px 0 0;
}

/* ---------- Tabs ---------- */
.tabbar{
  display:flex;
  gap:6px;
  background:var(--white);
  border:1px solid var(--border);
  border-radius:12px;
  padding:5px;
  margin:18px 0 16px;
}
.tab{
  flex:1;
  border:none;
  background:transparent;
  color:var(--ink-soft);
  font-size:0.92rem;
  font-weight:600;
  padding:10px 12px;
  border-radius:9px;
  cursor:pointer;
  transition:background 0.15s ease, color 0.15s ease;
}
.tab:hover{ color:var(--navy); }
.tab.active{
  background:var(--navy);
  color:var(--white);
}
.tab:focus-visible{ outline:2px solid var(--blue); outline-offset:1px; }

.view{ display:none; }
.view.active{ display:block; }

/* ---------- Buttons / inputs (dashboard style) ---------- */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border-radius:10px;
  border:1px solid transparent;
  padding:10px 18px;
  font-size:0.88rem;
  font-weight:600;
  cursor:pointer;
  text-decoration:none;
  white-space:nowrap;
}
.btn-primary{ background:var(--blue); color:var(--white); }
.btn-primary:hover{ background:#1a63a4; }
.btn-secondary{ background:var(--white); color:var(--navy); border-color:var(--border); }
.btn-secondary:hover{ background:var(--panel); }
.btn:focus-visible{ outline:2px solid var(--navy); outline-offset:2px; }
.btn[disabled]{ opacity:0.55; cursor:default; }

input[type="text"],
input[type="date"]{
  padding:11px 13px;
  border:1px solid var(--border);
  border-radius:10px;
  font-size:0.92rem;
  color:var(--ink);
  background:var(--white);
}
input:focus{ outline:2px solid var(--blue); outline-offset:1px; border-color:var(--blue); }

.inline-error{
  font-size:0.84rem;
  color:var(--danger);
  background:var(--danger-bg);
  border:1px solid rgba(192,57,43,0.25);
  border-radius:8px;
  padding:10px 13px;
  margin:12px 0;
  font-weight:600;
  display:none;
}
.inline-error.show{ display:block; }

/* ---------- Day view toolbar ---------- */
.day-toolbar{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:12px;
}
.day-toolbar input[type="date"]{ flex:1; min-width:170px; }

.stat-strip{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:14px;
}
.stat-chip{
  background:var(--white);
  border:1px solid var(--border);
  border-radius:10px;
  padding:6px 12px;
  font-size:0.8rem;
  color:var(--ink-soft);
}
.stat-chip strong{ color:var(--ink); font-weight:700; }

.driver-row{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:16px;
}
.driver-chip{
  border:1px solid var(--border);
  background:var(--white);
  color:var(--ink);
  padding:7px 14px;
  border-radius:999px;
  font-size:0.8rem;
  font-weight:600;
  cursor:pointer;
}
.driver-chip:hover{ border-color:var(--blue); }
.driver-chip.selected{
  background:var(--navy);
  border-color:var(--navy);
  color:var(--white);
}
.driver-chip:focus-visible{ outline:2px solid var(--blue); outline-offset:2px; }

/* ---------- Stop cards ---------- */
.stop-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.stop-card{
  background:var(--white);
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px 16px;
  box-shadow:0 1px 3px rgba(13,59,102,0.08);
  display:flex;
  gap:14px;
}
.stop-num{
  width:38px;
  height:38px;
  border-radius:50%;
  background:var(--navy);
  color:var(--white);
  font-weight:700;
  font-size:0.95rem;
  display:flex;
  align-items:center;
  justify-content:center;
  flex:none;
}
.stop-card.status-done .stop-num{ background:var(--ok); }
.stop-card.status-issue .stop-num{ background:var(--danger); }
.stop-card.status-onsite .stop-num,
.stop-card.status-enroute .stop-num{ background:var(--blue); }
.stop-card.status-unassigned .stop-num{ background:var(--ink-soft); }

.stop-body{ flex:1; min-width:0; }
.stop-top-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:3px;
}
.stop-title{
  font-size:0.98rem;
  font-weight:700;
  color:var(--ink);
  overflow-wrap:anywhere;
}
.stop-chips{
  display:flex;
  gap:6px;
  align-items:center;
  flex-wrap:wrap;
}

.type-chip{
  font-size:0.66rem;
  font-weight:700;
  letter-spacing:0.04em;
  text-transform:uppercase;
  padding:3px 9px;
  border-radius:999px;
  background:var(--panel);
  border:1px solid var(--border);
  color:var(--ink-soft);
  white-space:nowrap;
}
.type-chip.t-work{ color:#5a4a8a; background:#efedfa; border-color:#d5d0ef; }
.type-chip.t-pickup{ color:#8a5a2a; background:#fdf1e4; border-color:#ecd5b8; }
.type-chip.t-dropoff{ color:#2a6a8a; background:#e6f2f9; border-color:#c3dcec; }

.status-chip{
  font-size:0.66rem;
  font-weight:700;
  letter-spacing:0.04em;
  text-transform:uppercase;
  padding:3px 9px;
  border-radius:999px;
  white-space:nowrap;
  background:var(--border);
  color:var(--ink-soft);
}
.status-chip.s-done{ background:#e3f5e8; color:#1c7c3c; }
.status-chip.s-issue{ background:#fde5e5; color:#b02a2a; }
.status-chip.s-onsite{ background:#e8ecfd; color:#3550c8; }
.status-chip.s-enroute{ background:#e8ecfd; color:#3550c8; }
.status-chip.s-scheduled{ background:var(--border); color:var(--ink-soft); }
.status-chip.s-assigned{ background:#fdf3dd; color:#9a6b00; }

.stop-address{
  font-size:0.86rem;
  color:var(--ink);
  margin:2px 0 0;
  overflow-wrap:anywhere;
}
.stop-address a{ color:inherit; text-decoration:none; }
.stop-address a:hover{ color:var(--blue); text-decoration:underline; }

.stop-meta{
  display:flex;
  gap:6px 14px;
  flex-wrap:wrap;
  margin-top:7px;
  font-size:0.78rem;
  color:var(--ink-soft);
}
.stop-meta .meta-item{ display:inline-flex; align-items:center; gap:5px; }
.stop-meta svg{ flex:none; color:var(--blue); }

.stop-note{
  font-size:0.78rem;
  color:var(--amber-ink);
  background:var(--amber-bg);
  border:1px solid var(--amber-border);
  border-radius:8px;
  padding:7px 10px;
  margin-top:9px;
  overflow-wrap:anywhere;
}

.stop-actions{
  display:flex;
  gap:8px;
  margin-top:10px;
  flex-wrap:wrap;
}
.stop-actions .link-btn{ margin-top:0; }

.link-btn{
  background:none;
  border:none;
  color:var(--blue);
  text-decoration:underline;
  font-size:0.8rem;
  font-weight:600;
  cursor:pointer;
  padding:0;
}
.link-btn:hover{ color:#1a63a4; }
.link-btn:focus-visible{ outline:2px solid var(--blue); outline-offset:2px; }

.map-link{
  font-size:0.8rem;
  font-weight:600;
  color:var(--blue);
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  gap:5px;
}
.map-link:hover{ text-decoration:underline; }

/* ---------- Empty / loading ---------- */
.empty-card{
  text-align:center;
  color:var(--ink-soft);
  padding:40px 16px;
  background:var(--white);
  border:1px solid var(--border);
  border-radius:14px;
  font-size:0.9rem;
}
.empty-card .empty-title{
  font-weight:700;
  color:var(--ink);
  margin-bottom:4px;
}

/* ---------- Address search ---------- */
.search-bar{
  display:flex;
  gap:10px;
  align-items:stretch;
  margin-bottom:12px;
}
.search-bar input[type="text"]{ flex:1; min-width:0; }
@media (max-width:560px){
  .search-bar{ flex-direction:column; }
  .search-bar .btn{ width:100%; }
}

.example-row{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom:18px;
}
.example-chip{
  border:1px solid var(--border);
  background:var(--white);
  color:var(--navy);
  padding:7px 13px;
  border-radius:999px;
  font-size:0.78rem;
  font-weight:600;
  cursor:pointer;
}
.example-chip:hover{ border-color:var(--blue); background:var(--panel); }
.example-chip:focus-visible{ outline:2px solid var(--blue); outline-offset:2px; }
.example-label{
  width:100%;
  font-size:0.72rem;
  color:var(--ink-soft);
  margin-bottom:0;
}

.addr-group{
  background:var(--white);
  border:1px solid var(--border);
  border-radius:14px;
  padding:16px;
  margin-bottom:14px;
  box-shadow:0 1px 3px rgba(13,59,102,0.08);
}
.addr-group-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  padding-bottom:12px;
  border-bottom:1px solid var(--border);
  margin-bottom:6px;
}
.addr-group-client{
  font-size:1.15rem;
  font-weight:800;
  color:var(--navy);
  overflow-wrap:anywhere;
}
.addr-group-title{
  font-size:1.1rem;
  font-weight:700;
  color:var(--ink);
  overflow-wrap:anywhere;
}
.hist-title{
  font-size:0.92rem;
  font-weight:650;
  color:var(--ink);
  margin-top:2px;
  overflow-wrap:anywhere;
}
.addr-last{
  font-size:0.8rem;
  color:var(--ink-soft);
  margin-top:2px;
}
.addr-last strong{ color:var(--ok); }

.hist-list{
  list-style:none;
  margin:0;
  padding:0;
}
.hist-row{
  display:flex;
  gap:12px;
  align-items:flex-start;
  padding:10px 0;
  border-bottom:1px solid var(--border);
}
.hist-row:last-child{ border-bottom:none; }

.popup-last{
  font-size:0.76rem;
  color:var(--ink-soft);
  margin:0 0 8px;
}
.popup-last strong{ color:var(--navy); }
.hist-date{
  flex:none;
  width:104px;
  font-size:0.8rem;
  font-weight:700;
  color:var(--navy);
  padding-top:2px;
}
.hist-body{ flex:1; min-width:0; }
.hist-line1{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  font-size:0.85rem;
  color:var(--ink);
  font-weight:600;
}
.hist-sub{
  font-size:0.77rem;
  color:var(--ink-soft);
  margin-top:3px;
  overflow-wrap:anywhere;
}
@media (max-width:560px){
  .hist-row{ flex-direction:column; gap:4px; }
  .hist-date{ width:auto; }
}

/* ---------- Map view ---------- */
.map-shell{
  background:var(--white);
  border:1px solid var(--border);
  border-radius:14px;
  overflow:hidden;
  box-shadow:0 1px 3px rgba(13,59,102,0.08);
  height:62vh;
  min-height:400px;
  position:relative;
}
.map-el{ height:100%; }
.map-note{
  font-size:0.74rem;
  color:var(--ink-soft);
  margin:10px 2px 0;
}

/* numbered, driver-colored pins (Leaflet divIcon) */
.map-pin{
  width:30px;
  height:30px;
  border-radius:50% 50% 50% 0;
  transform:rotate(-45deg);
  border:2px solid #ffffff;
  box-shadow:0 2px 6px rgba(0,0,0,0.35);
  display:flex;
  align-items:center;
  justify-content:center;
}
.map-pin span{
  transform:rotate(45deg);
  color:#ffffff;
  font-weight:700;
  font-size:0.72rem;
}
.map-pin.pin-done{ opacity:0.62; }
.map-pin.pin-issue{ outline:2px solid var(--danger); }

/* live driver position (demo = fake dot; live = locate endpoint) */
.map-truck{
  width:18px;
  height:18px;
  border-radius:50%;
  border:3px solid #ffffff;
  box-shadow:0 0 0 3px rgba(13,59,102,0.25), 0 2px 6px rgba(0,0,0,0.35);
}

/* map legend / driver toggle chips */
.legend-chip{
  display:inline-flex;
  align-items:center;
  gap:7px;
  border:1px solid var(--border);
  background:var(--white);
  color:var(--ink);
  padding:7px 14px;
  border-radius:999px;
  font-size:0.8rem;
  font-weight:600;
  cursor:pointer;
}
.legend-chip:hover{ border-color:var(--blue); }
.legend-chip.selected{ background:var(--navy); border-color:var(--navy); color:var(--white); }
.legend-chip.off{ opacity:0.45; }
.legend-chip:focus-visible{ outline:2px solid var(--blue); outline-offset:2px; }
.legend-dot{
  width:11px;
  height:11px;
  border-radius:50%;
  flex:none;
}
.legend-chip .legend-count{
  font-weight:400;
  font-size:0.74rem;
  opacity:0.85;
}

/* ---------- Address autocomplete (our addresses only, never Google) ---------- */
.search-input-wrap{
  position:relative;
  flex:1;
  min-width:0;
}
.search-input-wrap input[type="text"]{ width:100%; }
.ac-drop{
  position:absolute;
  top:calc(100% + 4px);
  left:0;
  right:0;
  background:var(--white);
  border:1px solid var(--border);
  border-radius:10px;
  box-shadow:0 10px 28px rgba(13,59,102,0.18);
  max-height:320px;
  overflow-y:auto;
  z-index:400;
}
.ac-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 13px;
  cursor:pointer;
  border-bottom:1px solid var(--border);
}
.ac-item:last-child{ border-bottom:none; }
.ac-item:hover, .ac-item.active{ background:var(--panel); }
.ac-left{ min-width:0; }
.ac-addr{
  font-size:0.95rem;
  color:var(--ink);
  font-weight:600;
  overflow-wrap:anywhere;
}
.ac-name{
  font-size:0.78rem;
  color:var(--ink-soft);
  overflow-wrap:anywhere;
}
.ac-meta{
  font-size:0.72rem;
  color:var(--ink-soft);
  white-space:nowrap;
  flex:none;
  text-align:right;
}
.ac-empty{
  padding:12px 13px;
  font-size:0.82rem;
  color:var(--ink-soft);
  font-style:italic;
}

/* ---------- Map hover tooltip (Leaflet) ---------- */
.leaflet-tooltip.pptg-tip{
  background:var(--white);
  border:1px solid var(--border);
  border-radius:8px;
  box-shadow:0 4px 14px rgba(13,59,102,0.18);
  color:var(--ink);
  font-family:inherit;
  padding:8px 11px;
  white-space:normal;
  min-width:170px;
}
.leaflet-tooltip.pptg-tip::before{ display:none; }
.map-tip-1{
  font-size:0.8rem;
  font-weight:700;
  color:var(--navy);
  margin-bottom:2px;
}
.map-tip-2{
  font-size:0.74rem;
  color:var(--ink-soft);
}

/* Leaflet popup typography — match the app */
.leaflet-popup-content-wrapper{
  border-radius:12px;
  font-family:inherit;
}
.leaflet-popup-content{
  margin:12px 14px;
  font-family:inherit;
  min-width:200px;
}
.popup-title{
  font-size:0.9rem;
  font-weight:700;
  color:var(--ink);
  margin:0 0 2px;
  overflow-wrap:anywhere;
}
.popup-addr{
  font-size:0.78rem;
  color:var(--ink-soft);
  margin:0 0 8px;
  overflow-wrap:anywhere;
}
.popup-chips{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin-bottom:8px;
}
.popup-meta{
  font-size:0.76rem;
  color:var(--ink);
  margin:0 0 8px;
  line-height:1.5;
}
.popup-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

/* ---------- "On today's route" banner (address search) ---------- */
.today-banner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  background:rgba(31,122,92,0.08);
  border:1px solid rgba(31,122,92,0.35);
  border-radius:10px;
  padding:10px 13px;
  margin-bottom:10px;
}
.today-banner .tb-main{
  font-size:0.85rem;
  font-weight:700;
  color:var(--ok);
}
.today-banner .tb-sub{
  font-size:0.8rem;
  color:var(--ink);
  margin-top:2px;
}

/* ---------- Footer ---------- */
.footer{
  text-align:center;
  padding:18px 12px 26px;
  font-size:0.74rem;
  color:var(--ink-soft);
}

.visually-hidden{
  position:absolute;
  width:1px;height:1px;
  overflow:hidden;
  clip:rect(0 0 0 0);
  white-space:nowrap;
}
