/* Fieldbook 2.0.1 (attached tokens; design/tokens.json on main is still 1.10.0).
   Scoped to the map shell. Sun is the page. Tan is the one primary and the logo tile. */

.MapShell,
.MapShell * {
  box-sizing: border-box;
}

.MapShell {
  --bg-canvas: #F3F0ED;
  --bg-well: #EDE8E1;
  --bg-raised: #FBFAF7;
  --bg-header: #C2A878;
  --text-primary: #1E1B19;
  --text-secondary: #4A4540;
  --fill-accent: #C2A878;
  --fill-accent-pressed: #1E1B19;
  --text-on-accent: #1E1B19;
  --text-on-accent-pressed: #C2A878;
  --border-hairline: #D9D3CB;
  --map-land: #E6E0D2;
  --drill-hit: #8A4B2A;
  --drill-other: #6B6B6B;
  --target: 44px;
  --primary: 64px;
  --radius: 16px;
  position: fixed;
  inset: 0;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: Montserrat, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 24px;
}

html[data-theme="dusk"] .MapShell {
  --bg-canvas: #1A1816;
  --bg-well: #2E2A26;
  --bg-raised: #24211E;
  --text-primary: #F3F0ED;
  --text-secondary: #C9C1B6;
  --fill-accent-pressed: #3A3227;
  --text-on-accent-pressed: #E3CFA5;
  --border-hairline: #3A3632;
  --map-land: #2A2520;
}

.MapShell button,
.MapShell select,
.MapShell input {
  font: inherit;
  color: inherit;
}

.MapShell .MapCanvas {
  position: absolute;
  inset: 0;
  background: var(--map-land);
  z-index: 0;
}

.MapShell[data-surface="desk"] {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: auto 1fr;
}

.MapShell[data-surface="desk"] .DeskTop {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 8px 16px;
  background: var(--bg-canvas);
  z-index: 2;
}

.MapShell[data-surface="desk"] .StatusStrip {
  position: static;
}

.MapShell[data-surface="desk"] .TripHeader {
  position: static;
}

.MapShell[data-surface="desk"] .MapStage {
  position: relative;
  min-height: 0;
}

.MapShell[data-surface="desk"] .MapCanvas {
  position: absolute;
}

.DeskSidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  background: var(--bg-canvas);
  z-index: 2;
  overflow: auto;
}

.DeskSidebar .PrimaryTrip {
  margin-top: auto;
}

.StatusStrip {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: var(--target);
  padding: 4px 8px;
  background: color-mix(in srgb, var(--bg-canvas) 92%, transparent);
}

.GPSStatus,
.SyncStatus,
.BatteryStatus {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  min-height: var(--target);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 20px;
}

.StatusIcon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.TripHeader {
  position: absolute;
  top: 52px;
  left: 12px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
}

.LogoButton {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 24px;
  border: 0;
  border-radius: 0;
  background: var(--rr-logo-plate, var(--fill-accent));
  color: var(--rr-logo-ink, var(--text-on-accent));
}

.LogoMark {
  display: none;
  height: 38px;
  width: 38px;
}

.LogoFull {
  display: block;
  height: 50px;
  width: auto;
}

.LogoWord {
  display: none;
  font-weight: 700;
  white-space: nowrap;
}

.AccountMenu {
  position: absolute;
  top: 64px;
  left: 0;
  display: flex;
  gap: 8px;
  padding: 8px;
  background: var(--bg-raised);
  border-radius: var(--radius);
}

.TripTitle {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.TripName {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.01em;
}

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

.MapModes button,
.ThemeChoice,
.LayersButton,
.LocateButton,
.AddButton,
.AddMenuList button,
.TripsButton,
.ReviewButton,
.LayersClose,
.DetentHandle,
.LayerToggle,
.BasemapChoice,
.LayerInfo,
.OfflineDownloadButton {
  min-height: var(--target);
  min-width: var(--target);
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--bg-raised);
  color: var(--text-primary);
}

.MapModes button[aria-pressed="true"],
.LayerToggle[aria-pressed="true"],
.BasemapChoice[aria-checked="true"] {
  background: #E7D7B8;
  color: var(--text-on-accent);
}

html[data-theme="dusk"] .MapModes button[aria-pressed="true"],
html[data-theme="dusk"] .LayerToggle[aria-pressed="true"],
html[data-theme="dusk"] .BasemapChoice[aria-checked="true"] {
  background: #3A3227;
  color: #E3CFA5;
}

.MapFab {
  position: absolute;
  top: 52px;
  right: 12px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.MapShell[data-surface="desk"] .MapFab {
  top: 12px;
}

.BottomToolbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 8px;
  align-items: end;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg-canvas) 94%, transparent);
}

.PrimaryTripButton {
  min-height: var(--primary);
  min-width: 160px;
  width: 100%;
  border: 0;
  border-radius: 16px;
  background: var(--fill-accent);
  color: var(--text-on-accent);
  font-size: 20px;
  font-weight: 700;
}

.PrimaryTripButton:active {
  background: var(--fill-accent-pressed);
  color: var(--text-on-accent-pressed);
}

.TripStop,
.AddMenuList button,
.ReviewButton,
.TripsButton,
.AddButton {
  min-height: var(--target);
}

.ReviewBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  min-height: 22px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--fill-accent);
  color: var(--text-on-accent);
  font-size: 13px;
}

.AddMenu {
  position: relative;
}

.AddMenuList {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
  z-index: 6;
}

.AddMenuList[hidden],
.AccountMenu[hidden],
.ReviewBadge[hidden],
.TripStop[hidden],
.LayerInfoText[hidden],
.LayersPanel[hidden],
.LayerLegend[hidden],
.DrillLegend[hidden] {
  display: none;
}

.DeskSidebar .AddMenuList {
  position: static;
  margin-top: 8px;
}

.LayersPanel {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 5;
  width: min(420px, calc(100% - 24px));
  overflow: auto;
  padding: 16px;
  background: var(--bg-raised);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgb(30 27 25 / 12%);
}

.MapShell[data-surface="phone"] .LayersPanel {
  top: 108px;
  bottom: 96px;
}

.LayersHead,
.LayerRow,
.TargetCommoditySetting {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.LayersHead {
  justify-content: space-between;
}

.LayerGroup {
  margin-top: 18px;
}

.LayerGroup h2,
.LayersHead h2,
.DetailTitle {
  margin: 0;
  font-size: 20px;
  line-height: 26px;
  font-weight: 700;
}

.GroupEmpty,
.LayerInfoText,
.OfflineNote,
.DetailBody,
.DetailPhase,
.StopConfirm {
  margin: 6px 0;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 22px;
}

.OpacityLabel {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--target);
  color: var(--text-secondary);
  font-size: 15px;
}

.OpacitySlider {
  width: 120px;
  min-height: var(--target);
  accent-color: var(--fill-accent);
}

.TargetCommoditySetting select {
  min-height: var(--target);
  min-width: 140px;
  border: 0;
  border-radius: 12px;
  background: var(--bg-well);
  padding: 8px 12px;
}

.DetailSheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 84px;
  z-index: 4;
  padding: 8px 16px 16px;
  background: var(--bg-raised);
  border-radius: 20px 20px 0 0;
  overflow: auto;
}

.DetailSheet[data-detent="peek"] {
  height: 96px;
}

.DetailSheet[data-detent="half"] {
  height: 46%;
}

.DetailSheet[data-detent="full"] {
  top: 108px;
  height: auto;
}

.DetailPanel {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.DetentHandle {
  align-self: center;
}

.LayerLegend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.LayerLegend li {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: var(--target);
}

.LegendSwatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

body:has(.MapShell) .shell-fallback {
  display: none;
}

.shell-fallback {
  margin: 12px;
}

.shell-fallback a,
.DownloadedAreas button,
.AreaDelete {
  min-height: var(--target);
  min-width: var(--target);
}

.MapShell[data-surface="phone"] {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.MapShell[data-surface="phone"] .StatusStrip,
.MapShell[data-surface="phone"] .TripHeader,
.MapShell[data-surface="phone"] .BottomToolbar {
  position: relative;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  flex: 0 0 auto;
}

.MapShell[data-surface="phone"] .StatusStrip {
  background: #FBFAF7;
  color: #1E1B19;
  gap: 8px;
  padding: 0 8px;
  overflow: hidden;
}

.MapShell[data-surface="phone"] .GPSStatus,
.MapShell[data-surface="phone"] .SyncStatus,
.MapShell[data-surface="phone"] .BatteryStatus {
  color: #1E1B19;
  min-width: 0;
  font-size: 13px;
  line-height: 18px;
  white-space: nowrap;
}

.MapShell[data-surface="phone"] .TripHeader {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 4px 8px;
  background: var(--bg-raised);
  color: var(--text-primary);
  border-radius: 0;
}

.MapShell[data-surface="phone"] .LogoButton {
  flex: 0 1 auto;
  min-width: 0;
  height: auto;
  padding: 4px 10px 4px 6px;
  border-radius: 12px;
  background: var(--rr-logo-plate, var(--fill-accent));
  color: var(--rr-logo-ink, var(--text-on-accent));
}

.MapShell[data-surface="phone"] .LogoFull,
.MapShell[data-surface="phone"] .LogoWord {
  display: none;
}

.MapShell[data-surface="phone"] .LogoMark {
  display: block;
  height: 38px;
  width: 38px;
  max-width: none;
}

.MapShell[data-surface="phone"] .TripTitle {
  flex: 1 1 auto;
  min-width: 0;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.MapShell[data-surface="phone"] .TripName {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  line-height: 18px;
  color: #1E1B19;
}

.MapShell[data-surface="phone"] .MapModes {
  flex: 0 0 auto;
  gap: 4px;
}

.MapShell[data-surface="phone"] .MapModes button {
  min-width: 44px;
  min-height: 44px;
  padding: 4px 8px;
  font-size: 14px;
  font-weight: 700;
}

.MapShell[data-surface="phone"] .MapStage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.MapShell[data-surface="phone"] .MapCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.MapShell[data-surface="phone"] .MapFab {
  top: 8px;
  right: 8px;
  gap: 8px;
}

.MapShell[data-surface="phone"] .LayersButton,
.MapShell[data-surface="phone"] .LocateButton {
  min-height: 44px;
  min-width: 44px;
  padding: 8px 12px;
  font-size: 15px;
  font-weight: 700;
  background: #FBFAF7;
  color: #1E1B19;
}

.MapShell[data-surface="phone"] .BottomToolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 8px;
  background: #FBFAF7;
}

.MapShell[data-surface="phone"] .PrimaryTrip {
  min-width: 0;
}

.MapShell[data-surface="phone"] .PrimaryTripButton {
  min-width: 0;
  width: 100%;
  height: 64px;
  min-height: 64px;
  padding: 8px 10px;
  background: var(--rr-primary-fill, var(--fill-accent));
  color: var(--rr-primary-ink, var(--text-on-accent));
  font-size: 17px;
  white-space: nowrap;
}

.MapShell[data-surface="phone"] .AddButton,
.MapShell[data-surface="phone"] .TripsButton,
.MapShell[data-surface="phone"] .ReviewButton {
  min-height: 44px;
  min-width: 44px;
  padding: 8px 10px;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  background: #FBFAF7;
  color: #1E1B19;
}

.MapShell[data-surface="phone"] .LayersPanel {
  top: auto;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-height: 72vh;
  border-radius: 20px 20px 0 0;
}

.MapShell[data-surface="phone"] .DetailSheet {
  position: absolute;
  top: auto;
  left: 0;
  right: 0;
  bottom: 0;
  height: auto;
  padding: 8px 16px 12px;
  background: #FBFAF7;
  overflow: auto;
}

.MapShell[data-surface="phone"] .DetailSheet[data-detent="peek"] {
  height: 44px;
  padding: 0;
  background: transparent;
  overflow: hidden;
}

.MapShell[data-surface="phone"] .DetailSheet[data-detent="peek"] .DetentHandle {
  display: block;
  width: 100%;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: linear-gradient(#1E1B19, #1E1B19) center 8px / 36px 4px no-repeat;
  color: transparent;
  font-size: 0;
}

.MapShell[data-surface="phone"] .DetailSheet[data-detent="peek"] .DetailTitle,
.MapShell[data-surface="phone"] .DetailSheet[data-detent="peek"] .DetailPhase,
.MapShell[data-surface="phone"] .DetailSheet[data-detent="peek"] .DetailBody,
.MapShell[data-surface="phone"] .DetailSheet[data-detent="peek"] .DetailSlot {
  display: none;
}

.MapShell[data-surface="phone"] .DetailSheet[data-detent="half"],
.MapShell[data-surface="phone"] .DetailSheet[data-detent="full"] {
  height: auto;
  max-height: 70%;
  background: #FBFAF7;
}

.MapShell[data-surface="desk"] .DeskTop {
  background: var(--bg-canvas);
  color: var(--text-primary);
}

.MapShell[data-surface="desk"] .LogoButton {
  padding: 0 24px;
  background: var(--rr-logo-plate, var(--fill-accent));
}

.MapShell[data-surface="desk"] .LogoFull {
  height: 50px;
  max-width: none;
}

.MapShell[data-surface="desk"] .LogoMark {
  display: none;
}

.DrillLegend {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 88px);
  min-height: 44px;
  margin: 0;
  padding: 4px 12px;
  border-radius: 12px;
  background: var(--bg-raised);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  line-height: 20px;
}

.DrillSwatch {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border-radius: 999px;
  box-sizing: border-box;
}

.DrillHit {
  background: var(--drill-hit);
  border: 1.5px solid var(--text-primary);
  box-shadow: 0 0 0 3px var(--bg-canvas);
}

.DrillOther {
  background: var(--drill-other);
  box-shadow: 0 0 0 2px var(--bg-canvas);
}

.DrillLabel {
  background: var(--bg-raised);
  color: var(--text-primary);
  border: 0;
  box-shadow: none;
  font-weight: 600;
}

.DownloadedAreas {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.DownloadedAreas li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: var(--target);
}

.GroupEmpty[hidden] {
  display: none;
}

.MapFailed {
  position: relative;
  z-index: 2;
  margin: 120px 16px;
  color: var(--text-primary);
  background: var(--bg-raised);
  padding: 16px;
  border-radius: var(--radius);
}

