/* Full-screen master map and tappable schedule sheet. */
#screen-home.active {
  position: fixed;
  z-index: 10;
  top: 74px;
  right: 0;
  bottom: 0;
  left: 242px;
  width: auto;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #e7ebea;
  --home-bottom-clearance: 12px;
  --home-sheet-peek: 136px;
}

#screen-home .home-heading {
  position: absolute;
  z-index: 5;
  top: 12px;
  right: 12px;
  left: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 11px 14px;
  border: 1px solid #ffffffd9;
  border-radius: 12px;
  background: #fffffff0;
  box-shadow: 0 8px 28px #17252a1c;
  backdrop-filter: blur(14px);
}

#screen-home .home-heading > div:first-child { min-width: 0; }
#screen-home .home-heading .eyebrow { margin-bottom: 2px; font-size: 10px; }
#screen-home .home-heading h1 { margin: 0; font-size: clamp(19px, 2vw, 25px); line-height: 1.15; }
#screen-home .home-heading .page-subtitle { display: none; }
#screen-home .home-controls { display: flex; align-items: stretch; gap: 8px; }
#screen-home .work-mode-switch,
#screen-home .availability-switch {
  min-width: 146px;
  gap: 5px;
  padding: 7px 9px;
  border-radius: 8px;
}
#screen-home .work-mode-switch > span,
#screen-home .availability-caption { color: #77828a; font-size: 10px; font-weight: 800; }
#screen-home .segmented-control button { min-height: 27px; font-size: 12px; }
#screen-home .availability-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
#screen-home .availability-switch-row strong { color: var(--green); font-size: 12px; font-weight: 850; white-space: nowrap; }
#screen-home .availability-switch.not-working .availability-switch-row strong { color: #68747b; }
#screen-home .availability-toggle {
  position: relative;
  display: block;
  width: 46px;
  height: 27px;
  min-height: 27px;
  flex: none;
  padding: 2px;
  border: 0;
  border-radius: 999px;
  background: #28a567;
  transition: background .18s ease;
}
#screen-home .availability-toggle:hover { filter: brightness(.96); }
#screen-home .availability-toggle:focus-visible { outline: 3px solid #22855644; outline-offset: 2px; }
#screen-home .availability-knob {
  display: block;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px #10201842;
  transform: translateX(19px);
  transition: transform .18s ease;
}
#screen-home .availability-toggle.not-working { background: #808b91; }
#screen-home .availability-toggle.not-working .availability-knob { transform: translateX(0); }

#screen-home .home-grid { position: absolute; inset: 0; display: block; margin: 0; }
#screen-home .map-panel {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
#screen-home .map-header { display: none; }
#screen-home .map-frame-wrap { position: absolute; inset: 0; height: auto; min-height: 0; background: #e7ebea; }
#screen-home .map-frame-wrap iframe { position: absolute; inset: 0; }
#screen-home .map-frame-wrap::after {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  height: calc(var(--home-bottom-clearance) + 14px);
  background: #fff;
  content: "";
  pointer-events: none;
}
#screen-home .map-placeholder { bottom: calc(var(--home-bottom-clearance) + var(--home-sheet-peek) + 100px); }
#screen-home .map-footer,
#screen-home .map-link-row {
  position: absolute;
  z-index: 3;
  right: 12px;
  left: 12px;
  border: 1px solid #ffffffd9;
  background: #fffffff0;
  box-shadow: 0 5px 20px #17252a18;
  backdrop-filter: blur(12px);
}
#screen-home .map-footer {
  bottom: calc(var(--home-bottom-clearance) + var(--home-sheet-peek) + 40px);
  min-height: 43px;
  padding: 6px 10px;
  border-radius: 9px 9px 0 0;
}
#screen-home .location-state { min-width: 0; font-size: 11px; }
#screen-home #location-label {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
#screen-home .map-footer .button { min-height: 32px; flex: none; padding-inline: 10px; font-size: 11px; }
#screen-home .map-link-row {
  bottom: calc(var(--home-bottom-clearance) + var(--home-sheet-peek));
  gap: 12px;
  min-height: 39px;
  padding: 6px 10px;
  border-top-color: #edf0f1;
  border-radius: 0 0 9px 9px;
  font-size: 10px;
}
#screen-home .map-link-row a { font-size: 11px; white-space: nowrap; }

#screen-home .home-bottom-sheet {
  position: absolute;
  z-index: 8;
  right: 12px;
  bottom: var(--home-bottom-clearance);
  left: 12px;
  height: var(--home-sheet-peek);
  max-height: calc(100% - 145px);
  overflow: hidden;
  border: 1px solid #d9dfe2;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 14px 40px #17252a30;
  backdrop-filter: blur(15px);
  transition: height .32s cubic-bezier(.22, 1, .36, 1);
}

#screen-home .map-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #e4e9e6;
  user-select: none;
}
#screen-home .map-placeholder {
  z-index: 3;
  top: 50%;
  right: 16px;
  bottom: auto;
  left: 16px;
  width: auto;
  max-width: 390px;
  margin: 0 auto;
  transform: translateY(-50%);
  padding: 9px 12px;
  border-radius: 9px;
}
#screen-home .map-placeholder strong { font-size: 12px; }
#screen-home .map-placeholder span:last-child { font-size: 10px; }
#screen-home .map-error-message {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  width: min(360px, calc(100% - 36px));
  padding: 10px 13px;
  transform: translate(-50%,-50%);
  border: 1px solid #fff;
  border-radius: 9px;
  background: #fffffff2;
  box-shadow: 0 5px 18px #17252a24;
  color: #344149;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  pointer-events: none;
}
#screen-home .map-error-message[hidden] { display: none; }
#screen-home .map-request-marker {
  display: grid;
  min-width: 34px;
  height: 34px;
  place-items: center;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #e85e3d;
  box-shadow: 0 2px 8px #17252a55;
  color: #fff;
  font: 850 9px/1 system-ui, sans-serif;
  white-space: nowrap;
  cursor: pointer;
}
#screen-home .map-request-marker.multiple { min-width: 35px; background: #2b7bb8; font-size: 12px; }
#screen-home .map-user-marker { width: 18px; height: 18px; border: 3px solid #fff; border-radius: 50%; background: #287ec0; box-shadow: 0 1px 8px #17252a77; }
#screen-home .map-popup-request + .map-popup-request { margin-top: 10px; padding-top: 9px; border-top: 1px solid #e8ecee; }
#screen-home .map-popup-request strong, #screen-home .map-popup-request span, #screen-home .map-popup-request small { display: block; }
#screen-home .map-popup-request span { margin-top: 3px; color: #4f5d64; }
#screen-home .map-popup-request small { margin-top: 3px; color: #77838a; font-size: 10px; }
#screen-home .map-popup-open { margin-top: 7px; padding: 0; border: 0; background: transparent; color: #bd5716; font: inherit; font-weight: 850; text-align: left; }
#screen-home .map-popup-open:hover { text-decoration: underline; }
#screen-home .map-address-label {
  position: absolute;
  z-index: 4;
  top: 72px;
  left: 12px;
  width: min(380px, calc(100% - 80px));
  padding: 9px 11px;
  border: 1px solid #ffffffde;
  border-radius: 8px;
  background: #fffffff2;
  box-shadow: 0 4px 15px #17252a20;
  color: #344149;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
  overflow-wrap: anywhere;
  pointer-events: none;
}
#screen-home .map-address-label[hidden] { display: none; }
#screen-home .home-bottom-sheet.is-expanded {
  height: min(54vh, 620px);
  height: min(54dvh, 620px);
  max-height: calc(100% - 145px);
}
#screen-home .sheet-header {
  display: grid;
  gap: 7px;
  padding: 10px 15px 9px;
}
#screen-home .sheet-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#screen-home .sheet-header-actions { display: flex; align-items: center; gap: 8px; }
#screen-home .sheet-title-row .eyebrow { margin-bottom: 1px; font-size: 9px; }
#screen-home .sheet-title-row h2 { font-size: 17px; }
#screen-home .sheet-title-row .count-pill { min-width: 28px; height: 28px; }
#screen-home .sheet-toggle {
  display: grid;
  width: 38px;
  height: 38px;
  flex: none;
  place-items: center;
  border: 1px solid #d9dfe2;
  border-radius: 50%;
  background: #fff;
  color: #34424a;
  transition: border-color .18s ease, background .18s ease, color .18s ease;
}
#screen-home .sheet-toggle:hover { border-color: #f07818; background: #fff7f0; color: #a8490e; }
#screen-home .sheet-toggle:focus-visible { outline: 3px solid #f0781844; outline-offset: 2px; }
#screen-home .sheet-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .32s cubic-bezier(.22, 1, .36, 1); }
#screen-home .home-bottom-sheet.is-expanded .sheet-toggle svg { transform: rotate(180deg); }
#screen-home .sheet-preview { display: grid; gap: 1px; min-width: 0; }
#screen-home .sheet-preview strong,
#screen-home .sheet-preview span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#screen-home .sheet-preview strong { color: #34424a; font-size: 12px; }
#screen-home .sheet-preview span { color: #6d7980; font-size: 11px; }
#screen-home .sheet-preview.empty strong { color: #59666e; }
#screen-home .sheet-request-list { display: none; }
#screen-home .home-bottom-sheet.is-expanded .sheet-request-list {
  display: grid;
  height: calc(100% - 104px);
  max-height: none;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 9px;
  overflow-y: auto;
  padding: 0 12px 14px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
#screen-home .home-bottom-sheet.is-expanded .request-card { padding: 13px 13px 12px; }
#screen-home .home-bottom-sheet.is-expanded .request-time { margin-top: 8px; }

.notification-button { overflow: visible; flex: none; }
.notification-badge {
  top: -5px;
  right: -5px;
  display: grid;
  min-width: 19px;
  width: auto;
  height: 19px;
  place-items: center;
  padding: 0 4px;
  border: 2px solid var(--dark);
  border-radius: 999px;
  background: #ff963e;
  color: #192127;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 1px 3px #0006;
}

@media (max-width: 860px) {
  #screen-home.active {
    top: 74px;
    left: 0;
    --home-bottom-clearance: calc(60px + env(safe-area-inset-bottom, 0px));
    --home-sheet-peek: 136px;
  }
  #screen-home .home-heading {
    top: 10px;
    right: 10px;
    left: 10px;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 9px 11px;
  }
  #screen-home .home-heading h1 { font-size: 20px; }
  #screen-home .home-controls { width: 100%; }
  #screen-home .work-mode-switch,
  #screen-home .availability-switch { min-width: 0; flex: 1; }
  #screen-home .home-bottom-sheet { right: 0; left: 0; border-right: 0; border-bottom: 0; border-left: 0; border-radius: 17px 17px 0 0; }
  #screen-home .map-address-label { top: 69px; left: 9px; width: min(270px, calc(100% - 72px)); font-size: 11px; }
  #screen-home .map-footer,
  #screen-home .map-link-row { right: 8px; left: 8px; }
  #screen-home .map-footer { bottom: calc(var(--home-bottom-clearance) + var(--home-sheet-peek) + 40px); }
  #screen-home .map-link-row { bottom: calc(var(--home-bottom-clearance) + var(--home-sheet-peek)); }
}

@media (max-width: 680px) {
  #screen-home.active { top: 64px; }
  #screen-home .home-heading { top: 8px; right: 8px; left: 8px; padding: 8px 10px; }
  #screen-home .home-heading .eyebrow { font-size: 9px; }
  #screen-home .home-heading h1 { font-size: 19px; }
  #screen-home .home-controls { gap: 6px; }
  #screen-home .work-mode-switch,
  #screen-home .availability-switch { gap: 4px; padding: 6px 8px; }
  #screen-home .work-mode-switch > span,
  #screen-home .availability-caption { font-size: 9px; }
  #screen-home .segmented-control { padding: 2px; }
  #screen-home .segmented-control button { min-height: 25px; font-size: 11px; }
  #screen-home .availability-switch-row { gap: 5px; }
  #screen-home .availability-switch-row strong { font-size: 11px; }
  #screen-home .availability-toggle { width: 42px; height: 25px; min-height: 25px; }
  #screen-home .availability-knob { width: 21px; height: 21px; }
  #screen-home .availability-toggle:not(.not-working) .availability-knob { transform: translateX(17px); }
  #screen-home .map-footer { gap: 7px; padding: 5px 8px; }
  #screen-home .map-footer .button { min-height: 30px; padding-inline: 8px; font-size: 10px; }
  #screen-home .location-state { gap: 6px; font-size: 10px; }
  #screen-home .map-link-row { gap: 9px; padding: 5px 8px; }
  #screen-home .map-link-row a { font-size: 10px; }
  #screen-home .sheet-header { padding-right: 13px; padding-left: 13px; }
  #screen-home .home-bottom-sheet.is-expanded .sheet-request-list { height: calc(100% - 100px); padding-right: 9px; padding-left: 9px; }
  .notification-badge { top: -4px; right: -4px; min-width: 18px; height: 18px; }
}

/* Keep the home controls compact: date and availability only. */
#screen-home .home-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 11px;
}
#screen-home .home-heading > .home-date {
  min-width: 0;
  flex: 1;
  margin: 0;
  color: #b85b1c;
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: .09em;
}
#screen-home .home-controls { width: auto; flex: none; }
#screen-home .availability-switch {
  display: grid;
  grid-template-rows: auto auto;
  gap: 1px;
  min-width: 0;
  padding: 0 2px;
  border: 0;
  background: transparent;
  box-shadow: none;
}
#screen-home .availability-caption { color: #7b868d; font-size: 9px; line-height: 1.1; }
#screen-home .availability-switch-row { gap: 7px; }
#screen-home .availability-switch-row strong { font-size: 11px; }
.status-pill.in_progress { background: #e6f5ed; color: #26744d; }

@media (max-width: 680px) {
  #screen-home .home-heading { top: 8px; right: 8px; left: 8px; grid-template-columns: none; padding: 7px 10px; }
  #screen-home .home-heading > .home-date { font-size: 9px; letter-spacing: .07em; }
  #screen-home .home-controls { width: auto; }
  #screen-home .availability-switch { min-width: 0; flex: none; padding: 0; }
  #screen-home .availability-switch-row { gap: 5px; }
}
