/* Scout Tracker - themed after the Scouts brand guidelines (Aug 2026):
   core purple #7413dc, core teal #088486, Nunito Sans typography,
   high-contrast accessible combinations. */

:root {
  --purple: #7413dc;
  --purple-dark: #5a0fb0;
  --teal: #088486;
  --teal-dark: #056a6c;
  --navy: #003982;
  --green: #25b755;
  --green-dark: #1c9a45;
  --red: #ed3f23;
  --red-dark: #c22a16;
  --orange: #ff912a;
  --yellow: #ffe627;

  --bg: #f4f5f9;
  --surface: #ffffff;
  --ink: #1d2330;
  --muted: #5a6270;
  --line: #e3e6ee;
  --soft: #f7f4fc; /* purple-tinted surface */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; padding-bottom: 24px; }

/* ---- top bar (Scouts Purple, white text per brand convention) ---- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--purple);
  color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 {
  font-size: 18px;
  font-weight: 900; /* Nunito Sans Black */
  letter-spacing: 0.2px;
  color: #ffffff;
}
.sub { font-size: 11.5px; color: rgba(255, 255, 255, 0.85); font-weight: 600; }
.badges { display: flex; gap: 6px; align-items: center; }
.badge {
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  white-space: nowrap;
}
.badge.live { background: #ffffff; color: var(--green-dark); border-color: #ffffff; }
.badge.demo { background: #ffffff; color: #b35c00; border-color: #ffffff; }
.badge.offline { background: #ffffff; color: var(--red-dark); border-color: #ffffff; }
.badge-clock { font-variant-numeric: tabular-nums; }
.badge.beta { background: #ffe627; color: #1d2330; border-color: #ffe627; }
.badge.dev { background: #ffffff; color: var(--purple); border-color: #ffffff; }

/* full-width beta / dev banner */
.env-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #ffe627;
  color: #1d2330;
  font-size: 12.5px;
  font-weight: 800;
  padding: 7px 14px;
  text-align: center;
}
.env-banner.hidden { display: none; }
.env-banner-dismiss {
  background: transparent;
  border: none;
  color: #1d2330;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 3px;
}

/* ---- last location update strip ---- */
.last-update {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.last-update.hidden { display: none; }
.last-update .fix-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.last-update.fresh .fix-dot { background: var(--green); animation: fixPulse 2.2s infinite; }
.last-update.ageing .fix-dot { background: var(--orange); }
.last-update.stale { background: #fdece9; color: var(--red-dark); border-bottom-color: #f6c2b9; }
.last-update.stale .fix-dot { background: var(--red); animation: fixPulseRed 1.4s infinite; }
.last-update-label { color: var(--muted); font-weight: 800; }
.last-update.stale .last-update-label { color: var(--red-dark); }
.last-update-time { font-weight: 900; color: var(--navy); }
.last-update.stale .last-update-time { color: var(--red-dark); }
.last-update-ago { font-weight: 800; color: var(--muted); }
.last-update.stale .last-update-ago { color: var(--red-dark); }
@keyframes fixPulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 183, 85, 0.55); }
  70% { box-shadow: 0 0 0 6px rgba(37, 183, 85, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 183, 85, 0); }
}
@keyframes fixPulseRed {
  0% { box-shadow: 0 0 0 0 rgba(237, 63, 35, 0.55); }
  70% { box-shadow: 0 0 0 6px rgba(237, 63, 35, 0); }
  100% { box-shadow: 0 0 0 0 rgba(237, 63, 35, 0); }
}

/* ---- alert banner (Scouts Red, white text) ---- */
.alert-banner {
  background: var(--red);
  color: #ffffff;
  padding: 10px 14px;
  animation: pulse 1.6s ease-in-out infinite;
  box-shadow: 0 2px 8px rgba(237, 63, 35, 0.35);
}
.alert-banner.hidden { display: none; }
.alert-inner { display: flex; gap: 10px; align-items: flex-start; }
.alert-banner strong { font-size: 14px; font-weight: 900; }
.alert-banner .alert-copy { font-size: 13px; font-weight: 700; opacity: 0.95; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.78; } }

/* ---- swipeable map / route-card carousel ---- */
.view-carousel { overflow: hidden; }
.view-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.view-track::-webkit-scrollbar { display: none; }
.view-page {
  flex: 0 0 100%;
  scroll-snap-align: start;
  min-width: 100%;
}
.card-panel { padding-top: 14px; }
.view-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 14px 0;
  max-width: 640px;
  margin: 0 auto;
  background: var(--bg);
}
.view-tab {
  flex: 1;
  border: 1.5px solid var(--teal);
  background: var(--surface);
  color: var(--teal-dark);
  padding: 8px 0;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
}
.view-tab.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
}

/* ---- ghost (estimated position) banner ---- */
.ghost-banner {
  background: #fff4e0;
  color: #7a4a00;
  border-bottom: 1px solid rgba(179, 92, 0, 0.5);
  padding: 10px 14px;
}
.ghost-banner.hidden { display: none; }
.ghost-inner { display: flex; gap: 10px; align-items: flex-start; }
.ghost-banner strong { font-size: 13.5px; font-weight: 900; }
.ghost-banner .ghost-copy { font-size: 12.5px; font-weight: 700; opacity: 0.9; }

/* ---- map ---- */
.map-wrap { position: relative; }
#map {
  height: 44vh;
  min-height: 260px;
  z-index: 1;
}
.leaflet-container { background: #dce7ee; font-family: "Nunito Sans", sans-serif; }

/* tracker legend (overlaid on the map) */
.tracker-legend {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1001;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 10px;
  box-shadow: 0 2px 8px rgba(29, 35, 48, 0.18);
  pointer-events: none;
}
.tracker-legend.hidden { display: none; }
.legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--ink);
  padding: 1px 0;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(29, 35, 48, 0.25);
  flex: 0 0 auto;
}

/* ---- timings ---- */
.timings h2 {
  font-size: 13px;
  font-weight: 900;
  color: var(--muted);
  margin: 4px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.timings { margin-bottom: 12px; }
.est-tag {
  font-size: 10px;
  font-weight: 900;
  color: #7a4a00;
  background: #fff4e0;
  border: 1px solid #ffd37a;
  border-radius: 999px;
  padding: 1px 8px;
  letter-spacing: 0.2px;
}
.timing-note {
  margin-top: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #7a4a00;
  background: #fff4e0;
  border: 1px solid #ffd37a;
  border-radius: 8px;
  padding: 7px 10px;
}
.timing-note.hidden, .est-tag.hidden { display: none; }

/* ---- waypoint markers on the map (green = passed, red = not yet reached) ---- */
.leaflet-div-icon.icon-wp {
  background: transparent;
  border: none;
  position: relative;
}
.icon-wp span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  color: #ffffff;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 3px rgba(29, 35, 48, 0.4);
}
.icon-wp.icon-passed span { background: var(--green); }
.icon-wp.icon-upcoming span { background: var(--red); }
.icon-wp.icon-next span {
  background: var(--red-dark);
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px rgba(237, 63, 35, 0.45), 0 1px 3px rgba(29, 35, 48, 0.4);
}
.icon-wp .pulse-ring {
  position: absolute;
  inset: -7px;
  border-radius: 999px;
  border: 2px solid var(--red);
  animation: wpPulse 1.5s ease-out infinite;
  pointer-events: none;
}
@keyframes wpPulse {
  0% { transform: scale(0.75); opacity: 1; }
  100% { transform: scale(1.45); opacity: 0; }
}

/* ---- ghost marker (estimated position on the route) ---- */
.leaflet-div-icon.icon-ghost {
  background: transparent;
  border: none;
  position: relative;
}
.icon-ghost .ghost-dot {
  position: absolute;
  inset: 4px;
  border-radius: 999px;
  background: rgba(116, 19, 220, 0.55);
  border: 2px dashed #ffffff;
}
.icon-ghost .pulse-ring {
  position: absolute;
  inset: -6px;
  border-radius: 999px;
  border: 2px dashed rgba(116, 19, 220, 0.75);
  animation: ghostPulse 1.6s ease-out infinite;
  pointer-events: none;
}
@keyframes ghostPulse {
  0% { transform: scale(0.7); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ---- panel ---- */
.panel { padding: 14px; max-width: 640px; margin: 0 auto; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  border: 1.5px solid var(--purple);
  background: var(--surface);
  color: var(--purple);
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
}
.chip.active { background: var(--purple); border-color: var(--purple); color: #ffffff; }

/* ---- tracker selector + per-tracker summary (multi-tracker) ---- */
.tracker-selector { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.tracker-selector.hidden, .tracker-summary.hidden { display: none; }
.tchip { display: inline-flex; align-items: center; gap: 6px; }
.tchip-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.tchip.active { background: var(--tc, var(--purple)); border-color: var(--tc, var(--purple)); color: #ffffff; }

.tracker-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.tracker-card {
  text-align: left;
  font-family: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--tc, var(--purple));
  border-radius: 12px;
  padding: 9px 11px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(29, 35, 48, 0.05);
}
.tracker-card.active { border-color: var(--tc, var(--purple)); box-shadow: 0 0 0 1px var(--tc, var(--purple)); }
.tracker-card-head { display: flex; align-items: center; gap: 7px; }
.tracker-card-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(29,35,48,.25); }
.tracker-card-name { font-weight: 900; font-size: 13px; color: var(--navy); flex: 1; }
.tracker-card-dev { font-size: 10.5px; font-weight: 800; white-space: nowrap; }
.tracker-card-dev.ok { color: var(--green-dark); }
.tracker-card-dev.bad { color: var(--red-dark); }
.tracker-card-meta { font-size: 11.5px; font-weight: 700; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }

.route-head { margin-bottom: 12px; }
.route-title { font-size: 17px; font-weight: 900; color: var(--navy); }
.route-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; font-weight: 600; }

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 1px 2px rgba(29, 35, 48, 0.05);
}
.stat-value { font-size: 21px; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--navy); }
.stat-value.warn { color: #b35c00; }
.stat-value.bad { color: var(--red-dark); }
.stat-value.good { color: var(--green-dark); }
.stat-label { font-size: 10.5px; color: var(--muted); font-weight: 700; margin-top: 2px; }

.next-wp {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(29, 35, 48, 0.05);
}
.next-label { font-size: 11px; color: var(--teal-dark); font-weight: 900; }
.next-name { font-size: 17px; font-weight: 900; margin: 3px 0; color: var(--navy); }
.next-desc { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.progress { height: 8px; background: #eceef5; border-radius: 999px; margin: 10px 0 6px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--teal), var(--purple)); width: 0%; transition: width 0.6s ease; }
.progress-meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); font-weight: 700; }

.info-rows {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(29, 35, 48, 0.05);
}
.info-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; font-size: 12.5px; }
.info-row + .info-row { border-top: 1px solid var(--line); }
.info-row span:first-child { color: var(--muted); font-weight: 700; }
.info-row span:last-child { text-align: right; font-weight: 800; color: var(--navy); }

.wps h2 { font-size: 13px; font-weight: 900; color: var(--muted); margin: 4px 0 8px; }
#wpList { list-style: none; }
#wpList li {
  display: flex;
  gap: 10px;
  padding: 9px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 6px;
  align-items: flex-start;
}
#wpList li.passed { opacity: 0.6; }
#wpList li.current { border-color: var(--purple); background: var(--soft); box-shadow: 0 0 0 1px var(--purple); }
.wp-label {
  min-width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: #f0f0f6;
  font-weight: 900; font-size: 12px;
  border: 1.5px solid #d8d9e4;
  color: var(--muted);
}
.wp-label.passed { background: #e9f8ee; border-color: var(--green); color: var(--green-dark); }
.wp-label.current { background: var(--purple); border-color: var(--purple); color: #ffffff; }
.wp-body { flex: 1; }
.wp-name { font-weight: 800; font-size: 13px; }
.wp-desc { font-size: 12px; color: var(--muted); margin-top: 1px; font-weight: 600; }
.wp-meta { font-size: 11px; color: var(--muted); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; font-weight: 700; }

.foot { text-align: center; font-size: 11px; color: var(--muted); margin-top: 14px; font-weight: 600; }
.foot a { color: var(--muted); }

/* ---- header setup button ---- */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.16);
  cursor: pointer;
  padding: 0;
}
.icon-btn svg { display: block; }
.icon-btn:active { transform: scale(0.95); }
.icon-btn.hidden { display: none; }
.icon-btn { position: relative; }
.icon-btn.subscribed svg path { stroke: #ffe627; }
.icon-btn.subscribed::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #25b755;
  border: 1.5px solid #ffffff;
}
.icon-btn.close {
  width: 30px;
  height: 30px;
  border: none;
  background: #f0f0f6;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

/* ---- auth (sign in / account) ---- */
.icon-btn.logged-in::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #25b755;
  border: 1.5px solid #ffffff;
}
.auth-user { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 12px; }
.auth-role { font-size: 11.5px; font-weight: 800; color: var(--purple); margin-bottom: 12px; }
.auth-user strong { display: block; font-size: 15px; font-weight: 900; color: var(--navy); margin-bottom: 2px; }
.auth-user .auth-meta { font-size: 11px; font-weight: 700; color: var(--muted); margin-top: 6px; }
.auth-actions { display: flex; gap: 8px; margin-top: 4px; }
.auth-actions .btn { flex: 1; padding: 10px 12px; }
.auth-hint { font-weight: 700; }
.auth-link { background: none; border: none; padding: 0; margin: 12px 0 0; font: inherit; font-size: 12.5px; font-weight: 800; color: var(--purple); cursor: pointer; text-decoration: underline; }
.auth-remember { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 800; color: var(--ink); margin: 2px 0 4px; cursor: pointer; }
.auth-remember input { accent-color: var(--purple); width: 15px; height: 15px; }
.auth-note { font-size: 11.5px; font-weight: 700; color: var(--muted); margin-top: 8px; }
.auth-note strong { color: var(--navy); }

/* ---- admin dashboard ---- */
.admin-summary { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 12px; }
.admin-users { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.admin-user {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface);
}
.admin-user-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.admin-user-name { font-weight: 900; font-size: 13.5px; color: var(--navy); }
.admin-user-name .admin-tag {
  font-size: 9.5px;
  font-weight: 900;
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 5px;
  vertical-align: 1px;
  text-transform: uppercase;
}
.admin-tag.leader { background: var(--soft); border: 1px solid var(--purple); color: var(--purple); }
.admin-tag.viewer { background: var(--soft); border: 1px solid var(--navy); color: var(--navy); }
.admin-tag.active { background: #e9f8ee; border: 1px solid var(--green); color: var(--green-dark); }
.admin-tag.pending { background: #fff6d6; border: 1px solid #e0b400; color: #8a6d00; }
.admin-tag.revoked { background: #fdeaea; border: 1px solid var(--red, #c22a16); color: var(--red, #c22a16); }
.admin-user-sub { font-size: 11px; font-weight: 700; color: var(--muted); margin-top: 3px; }
.admin-user-sub .exp-warn { color: #b8860b; font-weight: 900; }
.admin-user-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.admin-user-actions .btn { flex: initial; padding: 6px 10px; font-size: 12px; }
.admin-invite {
  border: 1.5px dashed var(--purple);
  border-radius: 12px;
  padding: 12px;
  background: var(--soft);
}
.admin-invite-head { font-size: 13px; font-weight: 900; color: var(--navy); margin-bottom: 8px; }
.admin-invite-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.admin-invite-row .field { flex: 1; min-width: 150px; margin-bottom: 0; }
.admin-invite-row .btn { padding: 9px 12px; }
.admin-invite-out {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
  word-break: break-all;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
}
.admin-invite-out button {
  background: none;
  border: none;
  padding: 0;
  margin-top: 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  color: var(--purple);
  cursor: pointer;
  text-decoration: underline;
}
.admin-err { font-size: 12px; font-weight: 700; color: var(--red, #c22a16); margin-top: 8px; }

/* ---- my position ---- */
.icon-mypos { background: none; border: none; }
.mypos-dot {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #0a7dff;
  border: 2.5px solid #ffffff;
  box-shadow: 0 0 0 2px #0a7dff;
}
.icon-mypos .pulse-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(10, 125, 255, 0.55);
  animation: pulse 2s ease-out infinite;
}
.icon-btn.locating svg { filter: drop-shadow(0 0 4px #0a7dff); }
.mypos-toast {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: #1d2330;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 800;
  padding: 9px 14px;
  border-radius: 999px;
  z-index: 1500;
  box-shadow: 0 6px 20px rgba(29, 35, 48, 0.35);
  max-width: 90vw;
  text-align: center;
}
.mypos-toast.ok { background: #1c7a3c; }
.mypos-toast.hidden { display: none; }
.field input[type="password"] {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface);
}
.field input[type="password"]:focus { outline: 2px solid var(--purple); outline-offset: 1px; }

/* ---- sign-in gate (full-screen until authenticated) ---- */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--purple);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  text-align: center;
}
.auth-gate.hidden { display: none; }
.auth-gate-inner { width: 100%; max-width: 400px; }
.gate-logo { display: block; margin: 0 auto 6px; }
.gate-title { color: #ffffff; font-size: 30px; font-weight: 900; margin: 0 0 2px; }
.gate-sub { color: rgba(255, 255, 255, 0.85); font-size: 13.5px; font-weight: 600; margin: 0 0 18px; }
.gate-card { background: var(--surface); border-radius: 16px; padding: 18px 16px; text-align: left; }
.auth-gate-foot { color: rgba(255, 255, 255, 0.7); font-size: 11px; font-weight: 600; margin-top: 16px; }
.gate-env {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  padding: 3px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.gate-env.beta { background: #ffe627; color: #1d2330; }
.gate-env.dev { background: #ffffff; color: var(--purple); }
.gate-env.hidden { display: none; }

/* ---- setup modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(29, 35, 48, 0.55);
  z-index: 1200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 12px;
  overflow-y: auto;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface);
  border-radius: 16px;
  max-width: 560px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(29, 35, 48, 0.3);
  padding: 18px 16px 16px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.modal-head h2 { font-size: 19px; font-weight: 900; color: var(--navy); }
.setup-section { margin-bottom: 16px; }
.setup-subhead { font-size: 13px; font-weight: 900; color: var(--navy); margin-bottom: 6px; }
.setup-subhead span { color: var(--muted); font-weight: 800; }
.setup-hint { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 10px; }

.field { display: block; margin-bottom: 10px; }
.field-label { display: block; font-size: 11.5px; font-weight: 800; color: var(--muted); margin-bottom: 4px; }
.field input[type="text"], .field input[type="number"] {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface);
}
.field input:focus { outline: 2px solid var(--purple); outline-offset: 1px; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 140px; }
.permit-boxes { display: flex; gap: 12px; padding-top: 4px; }
.permit-box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
}
.permit-box input { accent-color: var(--purple); width: 16px; height: 16px; }

.setup-days { display: flex; flex-direction: column; gap: 10px; }
.day-card {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface);
}
.day-card.done { border-color: var(--green); background: #f4fcf7; }
.day-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; }
.day-card-title { font-weight: 900; font-size: 14px; color: var(--navy); }
.day-card-title .src-tag {
  font-size: 10px;
  font-weight: 800;
  background: var(--soft);
  border: 1px solid var(--purple);
  color: var(--purple);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: 1px;
}
.day-card-badge {
  font-size: 10.5px;
  font-weight: 900;
  color: var(--green-dark);
  background: #e9f8ee;
  border: 1px solid var(--green);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}
.upload-zone {
  border: 1.5px dashed var(--purple);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  color: var(--purple);
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  background: var(--soft);
}
.upload-zone input[type="file"] { display: none; }
.upload-zone.dragover { background: #efe6fd; border-color: var(--purple-dark); }
.day-summary { margin-top: 10px; }
.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}
.summary-grid .k { color: var(--muted); font-weight: 800; }
.zone-warn {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: #fff4e0;
  border: 1px solid #ffd37a;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
  color: #7a4a00;
  margin-top: 8px;
}
.zone-warn.red {
  background: #fdece9;
  border-color: var(--red);
  color: var(--red-dark);
}
.zone-warn.ok {
  background: #e9f8ee;
  border-color: var(--green);
  color: var(--green-dark);
}
.day-card-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 900;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--purple);
  background: var(--surface);
  color: var(--purple);
  cursor: pointer;
}
.btn.primary {
  background: var(--purple);
  border-color: var(--purple);
  color: #ffffff;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.small { padding: 5px 10px; font-size: 11.5px; }

/* tracker setup rows */
.tracker-setup-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.tracker-setup-row {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: var(--surface);
}
.tracker-setup-top { display: flex; align-items: center; gap: 8px; }
.t-input {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  width: 100%;
  min-width: 0;
}
.t-input:focus { outline: 2px solid var(--purple); outline-offset: 1px; }
.t-name { flex: 1.2; }
.t-asset { flex: 1.8; }
.t-adv { margin-top: 8px; }
.t-adv summary {
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--purple);
}
.t-adv-body { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.t-field { display: block; }
.t-cap { display: block; font-size: 10.5px; font-weight: 800; color: var(--muted); margin-bottom: 2px; }
.t-hint { font-size: 11px; color: var(--muted); font-weight: 600; }

.setup-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; margin-top: 6px; }
.setup-actions .btn { padding: 11px 14px; font-size: 14px; }
.setup-warn {
  background: #fdece9;
  border: 1px solid var(--red);
  color: var(--red-dark);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 12.5px;
  font-weight: 800;
}

/* ---- daily timings log ---- */
.log-list { display: flex; flex-direction: column; gap: 10px; }
.log-entry {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: var(--surface);
}
.log-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.log-title { font-weight: 900; font-size: 13.5px; color: var(--navy); }
.log-badge {
  font-size: 10.5px;
  font-weight: 900;
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}
.log-badge.not-started { background: #f0f0f6; color: var(--muted); border: 1px solid #d8d9e4; }
.log-badge.started { background: #fff4e0; color: #7a4a00; border: 1px solid #ffd37a; }
.log-badge.arrived { background: var(--soft); color: var(--purple); border: 1px solid var(--purple); }
.log-badge.complete { background: #e9f8ee; color: var(--green-dark); border: 1px solid var(--green); }
.log-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 12px; }
.log-cell { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.log-k { color: var(--muted); font-weight: 800; }
.log-v { font-weight: 900; color: var(--ink); font-variant-numeric: tabular-nums; }
.log-est {
  margin-top: 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: #7a4a00;
  background: #fff4e0;
  border: 1px solid #ffd37a;
  border-radius: 8px;
  padding: 6px 9px;
}
.log-empty { color: var(--muted); font-size: 12.5px; font-weight: 700; padding: 8px 2px; }

/* side-by-side tracker comparison in the daily log */
.log-compare {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.log-compare > * {
  background: var(--surface);
  padding: 7px 9px;
  font-size: 12px;
  min-width: 0;
}
.log-compare-head {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--soft);
  font-weight: 900;
  color: var(--navy);
}
.log-compare-name { white-space: normal; line-height: 1.25; overflow-wrap: anywhere; }
.log-compare-label {
  background: #fafbfe;
  color: var(--muted);
  font-weight: 800;
}
.log-compare-label.corner { background: var(--soft); }
.log-compare-cell {
  font-weight: 900;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.log-compare-cell.complete { color: var(--green-dark); }
.log-compare-cell.arrived { color: var(--purple); }
.log-compare-cell.started { color: #7a4a00; }

.setup-imported { display: flex; flex-direction: column; gap: 8px; }
.imported-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  background: var(--surface);
}
.imported-row .imp-name { font-weight: 900; font-size: 13px; color: var(--navy); }
.imported-row .imp-meta { font-size: 11px; color: var(--muted); font-weight: 700; }
.imported-row .imp-warn { font-size: 11px; font-weight: 900; color: var(--red-dark); }

/* zone strip on the route card page */
.zone-strip {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
  margin: 0 0 10px;
}
.zone-strip.red { background: #fdece9; border: 1px solid var(--red); color: var(--red-dark); }
.zone-strip.amber { background: #fff4e0; border: 1px solid #ffd37a; color: #7a4a00; }
.zone-strip.green { background: #e9f8ee; border: 1px solid var(--green); color: var(--green-dark); }

@media (min-width: 700px) {
  .stats { grid-template-columns: repeat(5, 1fr); }
}
