:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #18212f;
  --muted: #697386;
  --line: #d8dde6;
  --blue: #2f6df6;
  --green: #2fa66a;
  --amber: #df8b23;
  --red: #d92d20;
  --shadow: 0 14px 35px rgba(20, 30, 46, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea,
.navButton {
  font: inherit;
}

button,
select,
.navButton {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

.navButton {
  display: grid;
  place-items: center;
  text-decoration: none;
}

button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.authScreen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  background: var(--bg);
  padding: 24px;
}

body.authLocked .authScreen {
  display: grid;
}

body.authChecking .authScreen {
  display: none;
}

body.passwordLocked #passwordScreen {
  display: grid;
}

body.passwordLocked #passwordScreen[hidden] {
  display: grid !important;
}

body.authLocked #repShell {
  visibility: hidden;
}

body.passwordLocked #repShell {
  visibility: hidden;
}

.authCard {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 24px;
}

.brandMark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.authCard h1,
.authCard p {
  margin: 0;
}

.authCard p,
.helperText,
.repTop span,
.meta {
  color: var(--muted);
}

.authCard label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-weight: 700;
}

.authCard input,
.noteCard textarea,
.settingsCard input,
.settingsCard textarea,
.territoryRequestPanel input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
}

#repShell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.repTop {
  position: sticky;
  top: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto minmax(180px, 300px) auto auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
  padding: 12px;
}

.repTop > div:first-child {
  display: grid;
  gap: 2px;
}

.tabs {
  display: flex;
  gap: 6px;
}

.appTabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.repTopActions {
  justify-content: flex-end;
}

.menuIconBtn {
  display: grid;
  place-items: center;
  gap: 4px;
  width: 42px;
  padding: 0;
}

.menuIconBtn span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.repMenuBackdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  border: 0;
  border-radius: 0;
  background: rgba(18, 27, 41, 0.2);
  padding: 0;
}

.repSideMenu {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 11;
  display: grid;
  align-content: start;
  gap: 10px;
  width: min(330px, calc(100vw - 36px));
  height: 100vh;
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 16px;
}

.repSideMenu header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
}

.repSideMenu header button {
  min-width: 40px;
  padding: 0;
}

.repSideMenu > button:not(.repMenuBackdrop) {
  display: flex;
  align-items: center;
  justify-content: start;
  min-height: 46px;
  text-align: left;
}

.appTabs button.active,
.tabs button.active,
#routeBtn.active,
#streetViewBtn.active,
#hiddenLeadsBtn.active,
#comebacksBtn.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.repPage {
  min-height: 0;
}

.repPage[hidden] {
  display: none;
}

.leadControls {
  position: sticky;
  top: var(--rep-top-height, 0px);
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 170px;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 246, 248, 0.94);
  padding: 12px 14px;
}

.backToTopBtn {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9;
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  box-shadow: var(--shadow);
}

.leadControls input {
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

.viewPanel {
  min-height: 0;
}

.leadList {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.leadCard {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.leadCard.notInterested {
  border-color: rgba(217, 45, 32, 0.42);
  background: #fff1f0;
}

.leadCard.declinedMst {
  border-color: rgba(249, 115, 22, 0.45);
  background: #fff7ed;
}

.leadCard.declinedSara {
  border-color: rgba(234, 179, 8, 0.5);
  background: #fefce8;
}

.leadCard.sale {
  border-color: rgba(47, 166, 106, 0.42);
  background: #ecfdf3;
}

.leadCard.hiddenLead {
  border-style: dashed;
  background: #f8fafc;
  opacity: 0.82;
}

.leadHeader {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.address {
  font-size: 16px;
  font-weight: 800;
}

.leadTimestamp {
  margin-top: 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.noteBtn {
  min-width: 42px;
  padding: 0;
}

.dispositionSelectRow {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.dispositionSelectRow select {
  min-height: 44px;
  border-color: #cfd6e2;
  font-size: 16px;
  font-weight: 850;
}

.emptyState {
  display: grid;
  place-items: center;
  min-height: 60vh;
  color: var(--muted);
}

.mapPanel {
  position: relative;
  min-height: calc(100vh - 118px);
}

#map {
  position: absolute;
  inset: 0;
}

.mapTools {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.locationStatus {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border: 1px solid rgba(47, 109, 246, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 900;
  padding: 0 10px;
}

.mapTools button {
  box-shadow: var(--shadow);
}

.mapTools button.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.territoryRequestPanel {
  position: absolute;
  top: auto;
  bottom: 14px;
  left: 14px;
  z-index: 3;
  display: grid;
  gap: 12px;
  width: min(360px, calc(100vw - 32px));
  max-height: min(52vh, 430px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: 14px;
}

.territoryRequestPanel[hidden] {
  display: none;
}

.territoryRequestPanel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.territoryRequestPanel header strong {
  font-size: 14px;
  text-transform: uppercase;
}

.territoryRequestPanel header button {
  width: 34px;
  min-height: 34px;
  padding: 0;
}

.territoryRequestPanel label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.territoryRequestZipGrid {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
}

.territoryRequestPanel select,
.territoryRequestPanel input,
.territoryRequestPanel textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px 10px;
}

.territoryRequestActions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.territoryRequestActions button {
  min-width: 0;
  padding-inline: 8px;
}

.territoryRequestSearch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  gap: 8px;
  align-items: end;
}

.territoryRequestSearch[hidden] {
  display: none;
}

.leadMapPopup {
  display: grid;
  gap: 8px;
  min-width: 230px;
  color: var(--ink);
  font-family: inherit;
}

.leadMapPopup strong {
  font-size: 14px;
  line-height: 1.25;
}

.leadMapPopup > span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.leadMapPopup label {
  display: grid;
  gap: 5px;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
}

.leadMapPopup select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px 9px;
}

.searchPinMarker {
  position: relative;
  width: 24px;
  height: 24px;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  background: var(--blue);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.28);
  transform: rotate(-45deg);
}

.searchPinMarker::after {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: #fff;
  content: "";
}

@media (max-width: 720px) {
  .territoryRequestPanel {
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    max-height: 42vh;
    gap: 9px;
    padding: 12px;
  }

  .territoryRequestPanel header strong {
    font-size: 13px;
  }

  .territoryRequestZipGrid,
  .territoryRequestSearch,
  .territoryRequestActions {
    grid-template-columns: 1fr;
  }
}

.routeCursor canvas,
.startPointCursor canvas,
.requestCursor canvas {
  cursor: crosshair;
}

.routeCursor .leadBubble,
.startPointCursor .leadBubble,
.requestCursor .leadBubble {
  pointer-events: none;
}

.leadBubble {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-height: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  padding: 0;
}

.leadBubble.worked {
  background: #6b7280;
}

.leadBubble.secondNoAnswer {
  background: #475467;
  box-shadow: 0 0 0 5px rgba(71, 84, 103, 0.28);
}

.leadBubble.thirdNoAnswer {
  background: #111827;
  box-shadow: 0 0 0 5px rgba(17, 24, 39, 0.24);
}

.leadBubble.notInterested {
  background: var(--red);
  font-size: 17px;
}

.leadBubble.declinedMst {
  background: #f97316;
  font-size: 17px;
}

.leadBubble.declinedSara {
  background: #eab308;
  font-size: 17px;
}

.leadBubble.sale {
  background: var(--green);
  font-size: 16px;
}

.leadBubble.comeback {
  background: var(--amber);
  font-size: 17px;
}

.leadBubble.hiddenLead {
  background: #64748b;
  opacity: 0.8;
}

.userDot {
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #2f6df6;
  box-shadow: 0 0 0 8px rgba(47, 109, 246, 0.18);
}

dialog {
  width: min(520px, calc(100vw - 36px));
  border: 0;
  border-radius: 10px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(18, 27, 41, 0.46);
}

.noteCard {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.noteCard header,
.noteCard footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.noteCard h2 {
  margin: 0;
}

.noteAddress {
  color: #344054;
  font-weight: 800;
}

.profileSettings {
  display: grid;
  place-items: start center;
  padding: 24px;
}

.settingsCard {
  display: grid;
  gap: 14px;
  width: min(680px, 100%);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 22px;
}

.settingsCard header h2,
.settingsCard header p {
  margin: 0;
}

.settingsCard header p {
  margin-top: 5px;
  color: var(--muted);
}

.settingsCard label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-weight: 800;
}

.avatarRow {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 14px;
  align-items: center;
}

.avatarPreview {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.avatarPreview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.routeArrow {
  position: relative;
  width: 38px;
  height: 22px;
  opacity: 0.56;
  filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.24));
  transform-origin: 19px 11px;
  pointer-events: none;
}

.routeArrow::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 0;
  width: 28px;
  height: 8px;
  border-radius: 999px;
  background: #ef4444;
}

.routeArrow::after {
  content: "";
  position: absolute;
  top: 1px;
  right: 0;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 14px solid #ef4444;
}

.startMarker {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #1d4ed8;
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
  opacity: 0.62;
  text-shadow:
    0 1px 0 #fff,
    1px 0 0 #fff,
    0 -1px 0 #fff,
    -1px 0 0 #fff,
    0 3px 7px rgba(15, 23, 42, 0.28);
  pointer-events: none;
}

.dayStats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.dayStatTile {
  display: block;
  min-height: 84px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 12px;
  text-align: left;
}

.dayStatTile.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 109, 246, 0.12);
}

.dayStats span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dayStats strong {
  display: block;
  margin-top: 4px;
  font-size: 28px;
}

.dayTimeline {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}

.dayTimeline h3 {
  margin: 0;
}

.dayEvent {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  gap: 8px;
  align-items: center;
  border-top: 1px solid #edf0f5;
  padding-top: 8px;
}

.dayEvent time {
  color: var(--muted);
  font-weight: 800;
}

.dayEvent .badge {
  border-radius: 999px;
  background: #eef2f7;
  color: #526071;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
  white-space: nowrap;
}

.activityNotes {
  margin-top: 4px;
  color: #344054;
  font-size: 12px;
  font-style: italic;
}

.noteRevealBtn {
  min-height: 28px;
  margin-top: 6px;
  border-color: #c9d4e5;
  background: #f8fafc;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
  padding: 0 9px;
}

.teamActivity {
  padding: 14px;
}

.repTrainingPage {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
}

.repTrainingSidebar,
.repTrainingDetail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.repTrainingSidebar {
  align-self: start;
}

.repTrainingSidebar header,
.repTrainingDetail header {
  margin-bottom: 12px;
}

.repTrainingSidebar h2,
.repTrainingDetail h2,
.repTrainingSidebar p,
.repTrainingDetail p {
  margin: 0;
}

.repTrainingSidebar p,
.repTrainingDetail header p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.repTrainingCourseList,
.repTrainingItems,
.repTrainingChildren {
  display: grid;
  gap: 10px;
}

.repTrainingCourseCard {
  display: grid;
  gap: 4px;
  width: 100%;
  height: auto;
  min-height: 60px;
  text-align: left;
}

.repTrainingCourseCard.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 109, 246, 0.12);
}

.repTrainingCourseCard span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.repTrainingNotice {
  margin-bottom: 12px;
  border: 1px solid #f6d58b;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
  padding: 12px;
  font-weight: 800;
}

.repTrainingItem {
  display: grid;
  gap: 8px;
  margin-left: calc(var(--depth) * 18px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 12px;
}

.repTrainingItem.folder {
  background: #fff7ed;
}

.repTrainingItem.book {
  background: #ecfdf3;
}

.repTrainingItemHeader {
  display: grid;
  gap: 4px;
}

.repTrainingItemHeader span {
  width: fit-content;
  border-radius: 999px;
  background: #eef2f7;
  color: #526071;
  font-size: 11px;
  font-weight: 900;
  padding: 4px 8px;
  text-transform: uppercase;
}

.repTrainingItem p,
.repTrainingNotes {
  margin: 0;
  color: #344054;
  font-size: 14px;
  line-height: 1.45;
}

.repTrainingItem a {
  width: fit-content;
  border: 1px solid var(--blue);
  border-radius: 8px;
  color: var(--blue);
  font-weight: 800;
  padding: 8px 10px;
  text-decoration: none;
}

.teamActivityControls {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(150px, 220px) auto;
  gap: 8px;
  margin-bottom: 12px;
}

.teamActivityControls input {
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

.teamActivityGrid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.4fr);
  gap: 12px;
  align-items: start;
}

.teamActivityRepList,
.teamActivityDetail,
.teamTimeline {
  display: grid;
  gap: 10px;
}

.teamActivityRepList {
  align-content: start;
}

.teamRepCard,
.teamTimeline {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.teamRepCard {
  display: grid;
  gap: 8px;
  align-self: start;
  text-align: left;
}

.teamRepCard.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 109, 246, 0.12);
}

.teamRepMain {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.plusBtn {
  display: grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  border-color: var(--blue);
  color: var(--blue);
  font-size: 18px;
  font-weight: 900;
  padding: 0;
}

.teamEvent {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  gap: 8px;
  align-items: center;
  border-top: 1px solid #edf0f5;
  padding-top: 8px;
}

.teamEvent:first-child {
  border-top: 0;
}

.teamEvent time {
  color: var(--muted);
  font-weight: 800;
}

.emptyState.compact {
  min-height: 240px;
}

@media (max-width: 780px) {
  .repTop {
    grid-template-columns: 1fr;
  }

  .repTopActions,
  .viewTabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .repTopActions button,
  .viewTabs button {
    min-width: 0;
    padding-inline: 8px;
  }

  .menuIconBtn {
    justify-self: end;
  }

  .leadControls {
    grid-template-columns: 1fr 1fr;
  }

  .dayStats,
  .dayEvent,
  .teamActivityGrid,
  .teamEvent {
    grid-template-columns: 1fr;
  }

  .teamActivityControls {
    grid-template-columns: 1fr;
  }

  .repTrainingPage {
    grid-template-columns: 1fr;
  }

  .repTrainingItem {
    margin-left: 0;
  }
}
