/* Field chrome matches the homepage deck: forest, olive, Unbounded, 5px. */
:root,
html[data-theme="dark"] {
  --bg: #080d09;
  --ink: #f1f4ee;
  --muted: rgba(241, 244, 238, 0.62);
  --line: rgba(241, 244, 238, 0.14);
  --accent: #9cad4e;
  --accent-ink: #151b11;
  --card: #101811;
  --input: #101811;
  --danger: #c56a4e;
  --live: #9cad4e;
  --font-ui: "Unbounded", system-ui, sans-serif;
  --font-display: "Unbounded", system-ui, sans-serif;
  --deck-ink: #f1f4ee;
  --deck-muted: rgba(241, 244, 238, 0.62);
  --deck-line: rgba(241, 244, 238, 0.14);
  --deck-panel: #101811;
  --deck-accent: #9cad4e;
  --deck-warm: #db9e49;
  --deck-font: "Unbounded", system-ui, sans-serif;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #080d09;
  font-family: var(--deck-font);
  color: var(--deck-ink);
  /* Map draws edge-to-edge; chrome floats above via safe-area padding */
  padding: 0 !important;
  /* Long-press on the map must not select UI / OSM attribution text */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* Only typed fields stay selectable — and only after the user selects */
input,
textarea,
select,
[contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

input::selection,
textarea::selection,
[contenteditable="true"]::selection,
input::-moz-selection,
textarea::-moz-selection,
[contenteditable="true"]::-moz-selection {
  background: rgba(156, 173, 78, 0.42);
  color: #f1f4ee;
}

#map {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  z-index: 0;
  background: #080d09;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.field-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 800;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  padding: calc(0.55rem + env(safe-area-inset-top, 0px)) 0.65rem 0.55rem;
  pointer-events: none;
}

.field-top > * {
  pointer-events: auto;
}

.field-top-left {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.field-top-left .field-menu-wrap {
  display: flex;
  align-items: center;
}

.field-top .nav-account-btn {
  color: #fff;
  height: 2.85rem;
  min-height: 2.85rem;
  padding: 0 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  box-sizing: border-box;
  border-radius: 5px;
  border: 1px solid var(--deck-line);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
  line-height: 1;
  font-weight: 700;
}

.field-top .nav-account-btn .ico,
.field-top .nav-account-btn #btnMenuIcon {
  color: #fff;
  display: inline-flex;
  align-items: center;
}

.field-top .nav-account-label {
  line-height: 1;
  font-size: 0.9rem;
}

body .btn,
body button.btn {
  border-radius: 5px;
  border-color: var(--deck-line);
  font-family: var(--deck-font);
  font-weight: 700;
}

/* Solid buttons like site chrome — no see-through map */
.field-top .btn,
.field-tool-btn,
.field-sheet .btn,
.radial-btn {
  background: #101811;
  color: var(--deck-ink);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  opacity: 1;
  font-family: var(--deck-font);
}

.field-top .btn.btn-primary,
.field-sheet .btn.btn-primary,
.field-tool-btn.is-active,
body .btn-primary,
body button.btn-primary {
  background: var(--deck-accent);
  color: var(--accent-ink);
  border-color: var(--deck-accent);
}

.field-menu-wrap .nav-account-menu {
  left: 0;
  right: auto;
  min-width: 12.5rem;
  padding: 0.35rem;
  border: 0;
  border-radius: 5px;
  color: #152015;
  background: #f1f4ee;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

.field-menu-panel button {
  font-family: var(--deck-font);
  font-weight: 700;
  color: #152015;
  border-radius: 4px;
}

.field-menu-panel button:hover {
  background: rgba(156, 173, 78, 0.22);
  color: #152015;
}

.field-menu-panel button.is-danger {
  color: #c56a4e;
}

.field-menu-panel button.is-active {
  color: #3d4a1f;
  background: rgba(156, 173, 78, 0.28);
}

.field-anon-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 2.85rem;
  padding: 0 0.75rem;
  border: 1px solid var(--deck-line);
  border-radius: 5px;
  background: #101811;
  color: var(--deck-ink);
  font: 700 0.78rem/1 var(--deck-font);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
  pointer-events: auto;
}

.field-anon-badge[hidden] {
  display: none !important;
}

.field-anon-badge .ico {
  display: inline-flex;
  color: #d7e0b8;
}

.field-tool-btn {
  width: 2.85rem;
  height: 2.85rem;
  min-width: 2.85rem;
  padding: 0;
  border: 1px solid var(--deck-line);
  background: #101811;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

.field-tool-btn.is-active {
  background: var(--deck-accent);
  color: var(--accent-ink);
  border-color: var(--deck-accent);
}

.field-tool-btn.is-active .field-tool-ico {
  filter: brightness(0);
}

.field-tool-btn .field-tool-ico {
  width: 20px;
  height: 20px;
  display: block;
  filter: brightness(0) invert(1);
}

/* Tips sit to the right of the coords block — never centered under the action bar */
.field-measure-badge {
  position: absolute;
  left: calc(0.45rem + min(48vw, 10.5rem) + 0.4rem);
  right: 0.45rem;
  bottom: calc(0.45rem + env(safe-area-inset-bottom, 0px));
  transform: none;
  z-index: 760;
  background: #101811;
  border: 1px solid var(--deck-line);
  color: var(--deck-ink);
  padding: 0.35rem 0.55rem;
  border-radius: 5px;
  font-size: 0.72rem;
  font-family: var(--deck-font);
  white-space: normal;
  max-width: none;
  text-align: left;
  line-height: 1.25;
  box-sizing: border-box;
  pointer-events: none;
}

/* Confirm strip above the coords block */
.field-draw-bar {
  position: absolute;
  left: 50%;
  bottom: calc(3.7rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 770;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.45rem;
  max-width: min(96vw, 26rem);
  background: #101811;
  border: 1px solid var(--deck-line);
  border-radius: 5px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
  pointer-events: auto;
}

.field-draw-bar[hidden] {
  display: none !important;
}

.field-draw-bar .btn {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0.55rem 0.55rem;
  font-size: 0.78rem;
  font-family: var(--deck-font);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  color: var(--deck-ink);
  border: 0;
  border-radius: 4px;
  white-space: nowrap;
}

.field-draw-bar .btn.btn-primary {
  background: var(--deck-accent);
  color: var(--accent-ink);
  border-color: transparent;
}

.field-draw-bar .field-draw-bar-cancel {
  flex: 0 0 auto;
  color: #1a100c;
  background: #c56a4e;
  border-color: transparent;
}

/* Keep tips beside coords; confirm bar is already higher — no overlap */
body:has(#lineConfirmBar:not([hidden])) .field-measure-badge {
  display: none !important;
}

.field-status {
  position: absolute;
  left: 0.45rem;
  bottom: calc(0.45rem + env(safe-area-inset-bottom, 0px));
  z-index: 750;
  max-width: min(48vw, 10.5rem);
  padding: 0.28rem 0.4rem;
  border-radius: 5px;
  border: 1px solid var(--deck-line);
  background: #101811;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
  font-family: var(--deck-font);
  color: var(--deck-ink);
  pointer-events: auto;
  cursor: pointer;
  display: grid;
  gap: 0.05rem;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  font: inherit;
}

.field-status-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.field-status-v {
  font-size: 0.62rem;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-status-dot {
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  margin-right: 0.25rem;
  vertical-align: 0.05em;
  background: #666;
}

.field-status-dot[data-state="ok"] {
  background: #9cad4e;
  box-shadow: 0 0 0 2px rgba(156, 173, 78, 0.22);
}

.field-status-dot[data-state="err"] {
  background: #e07070;
  box-shadow: 0 0 0 2px rgba(224, 112, 112, 0.22);
}

.field-status-dot[data-state="unknown"] {
  background: #888;
}

.field-status-dot[data-state="anon"] {
  background: #9cad4e;
}

.field-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  max-height: min(78vh, 620px);
  overflow: auto;
  color: var(--deck-ink);
  background:
    radial-gradient(circle at 6% 0%, rgba(255, 255, 255, 0.13), transparent 40%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.008) 45%, rgba(8, 16, 10, 0.42)),
    #101811;
  border-top: 0;
  border-radius: 5px 5px 0 0;
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  padding: 0.85rem 0.9rem calc(1rem + env(safe-area-inset-bottom, 0px));
  transform: translateY(110%);
  transition: transform 0.22s ease;
  font-family: var(--deck-font);
}

.field-sheet.is-open {
  transform: translateY(0);
}

.field-sheet h2 {
  margin: 0 0 0.75rem;
  font-family: var(--deck-font);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.field-sheet-close {
  float: right;
  border: 0;
  background: transparent;
  color: var(--deck-muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
}

.field-list {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--deck-line);
}

.map-feature-row {
  gap: 0.45rem;
}

.map-feature-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 0;
  cursor: pointer;
}

.map-feature-del {
  flex-shrink: 0;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 8px;
  border: 1px solid rgba(224, 112, 112, 0.55);
  background: #161c18;
  color: #e07070;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.map-feature-del.is-locked {
  opacity: 0.4;
  color: #888;
  border-color: rgba(136, 136, 136, 0.45);
  cursor: not-allowed;
}

/* Shared feature: grey × = hide for me (author keeps it). */
.map-feature-del.is-shared-del {
  color: #9aa3ad;
  border-color: rgba(154, 163, 173, 0.55);
}

button.field-user-row {
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: default;
}

button.field-user-row.is-fly {
  cursor: pointer;
}

button.field-user-row.is-fly:hover {
  border-color: rgba(156, 173, 78, 0.45);
  background: rgba(156, 173, 78, 0.1);
}

button.field-user-row:disabled {
  opacity: 0.85;
  cursor: default;
}

.field-row .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #666;
  flex-shrink: 0;
}

.field-row .dot.on {
  background: #9cad4e;
  box-shadow: 0 0 0 3px rgba(156, 173, 78, 0.2);
}

.field-row strong,
.field-user-row strong {
  color: var(--ink, #e8efe9);
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-display, "Unbounded", "Syne", sans-serif);
  letter-spacing: 0.02em;
  opacity: 1;
}

.field-row .muted {
  font-size: 0.75rem;
  color: var(--muted, #7a8f82);
  opacity: 1;
}

.field-team-title {
  margin: 0.85rem 0 0.35rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.65;
  font-family: var(--font-display, "Unbounded", "Syne", sans-serif);
}

.field-team-block {
  margin: 0.35rem 0 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(12, 20, 16, 0.45);
  overflow: hidden;
}

.field-team-toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.7rem 0.75rem;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.field-team-toggle:hover {
  background: rgba(255, 255, 255, 0.04);
}

.field-team-chevron {
  flex: 0 0 auto;
  width: 1rem;
  opacity: 0.7;
  font-size: 0.85rem;
}

.field-team-name {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 650;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-team-counts {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  color: var(--muted, #7a8f82);
  white-space: nowrap;
}

.field-team-counts .is-on {
  color: #6dce8a;
}

.field-team-counts .is-off {
  color: #9aa3a8;
}

.field-team-counts .is-sep {
  opacity: 0.45;
}

.field-team-members {
  display: grid;
  gap: 0.2rem;
  padding: 0 0.4rem 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.field-team-members[hidden] {
  display: none;
}

.field-user-ago {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 600;
  color: #9aa3a8;
  white-space: nowrap;
}

.geo-providers {
  display: grid;
  gap: 0.65rem;
}

#btnAuth.is-danger {
  color: #c56a4e;
}

.geo-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.8rem;
  border-radius: 5px;
  border: 1px solid var(--deck-line);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.geo-card.is-on {
  border-color: rgba(156, 173, 78, 0.4);
  background: rgba(156, 173, 78, 0.08);
}

.geo-card-main {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.25rem;
}

.geo-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #f2f5f3;
  font-family: var(--font-display, "Unbounded", "Syne", sans-serif);
}

.geo-card-desc {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted, #7a8f82);
}

.geo-card-live {
  margin: 0.15rem 0 0;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.geo-card input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.15rem;
  flex-shrink: 0;
  accent-color: var(--accent, #9cad4e);
  cursor: pointer;
}

.field-actions {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.field-actions .btn {
  width: 100%;
}

.layer-card {
  display: grid;
  gap: 0.45rem;
  padding: 0.5rem 0.55rem 0.6rem;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--deck-line);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.layer-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.layer-row button.eye,
.layer-row button.layer-share,
.layer-row button.layer-del {
  border: 0;
  background: #161c18;
  color: #9cad4e;
  border-radius: 5px;
  width: 2.2rem;
  height: 2.2rem;
  cursor: pointer;
  font-size: 1rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(156, 173, 78, 0.35);
  padding: 0;
}

.layer-row button.eye img,
.layer-row button.layer-share img {
  width: 16px;
  height: 16px;
  display: block;
  filter: invert(78%) sepia(18%) saturate(700%) hue-rotate(28deg) brightness(95%);
}

.layer-row button.eye.off {
  opacity: 0.45;
  color: #888;
}

.layer-row button.eye.off img {
  filter: invert(55%) grayscale(1);
}

.layer-row button.layer-del {
  color: #e07070;
  border-color: rgba(224, 112, 112, 0.45);
}

.layer-row .name {
  flex: 1 1 0;
  width: 0;
  font-size: 0.9rem;
  min-width: 0;
  max-width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.offline-row {
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
}

.offline-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.offline-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.offline-row-actions .btn {
  flex: 1;
  min-width: 5.5rem;
  font-size: 0.8rem;
  padding: 0.45rem 0.55rem;
}

.offline-progress {
  font-size: 0.78rem;
  color: #d7e0b8;
  font-variant-numeric: tabular-nums;
}

.share-panel.form label {
  display: block;
  margin: 0.55rem 0 0.3rem;
  font-size: 0.82rem;
  opacity: 0.8;
}

.share-panel.form select,
.share-panel.form input {
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  border-radius: 4px;
  border: 0;
  color: var(--deck-ink);
  background: rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 0 0 1px var(--deck-line);
  padding: 0.55rem 0.7rem;
}

.icon-picker {
  display: grid;
  gap: 0.85rem;
}

.icon-cat-title {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.65;
  font-family: var(--font-display, "Unbounded", "Syne", sans-serif);
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
}

.icon-pick {
  aspect-ratio: 1;
  border: 1px solid var(--deck-line);
  border-radius: 5px;
  background: #101811;
  color: #e8e6e1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
}

.icon-pick img {
  width: 22px;
  height: 22px;
  filter: invert(0.92) sepia(0.35) saturate(2.2) hue-rotate(5deg);
}

.icon-pick:hover,
.icon-pick.is-on {
  border-color: rgba(156, 173, 78, 0.65);
  background: rgba(156, 173, 78, 0.14);
}

.radial {
  /* fixed: left/top from getBoundingClientRect + containerPoint are viewport coords */
  position: fixed;
  z-index: 950;
  width: 220px;
  height: 220px;
  margin: -110px 0 0 -110px;
  /* Only option circles capture taps — empty area closes the menu via map click */
  pointer-events: none;
}

.radial.is-open .radial-btn:not([hidden]) {
  pointer-events: auto;
}

.radial-btn {
  --radial-r: 58px;
  --step: 72deg;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  border-radius: 50%;
  border: 1px solid rgba(156, 173, 78, 0.5);
  background: #101811;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transform: rotate(calc(var(--i, 0) * var(--step) - 90deg)) translate(var(--radial-r))
    rotate(calc(-1 * (var(--i, 0) * var(--step) - 90deg)));
}

.radial-btn[hidden] {
  display: none !important;
}

.radial-btn .field-tool-ico {
  width: 20px;
  height: 20px;
  display: block;
  filter: brightness(0) invert(1);
}

.measure-label-wrap {
  background: transparent !important;
  border: none !important;
  overflow: visible !important;
}

.measure-dist-label {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  background: #101811;
  border: 1px solid var(--deck-line);
  color: var(--deck-ink);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--deck-font);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  user-select: none;
}

.measure-segment-line {
  cursor: pointer;
}

.measure-follow-svg {
  position: absolute;
  inset: 0;
  z-index: 620;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.measure-follow-hit {
  pointer-events: stroke;
  cursor: pointer;
}

.measure-follow-label {
  position: absolute;
  z-index: 621;
  pointer-events: none;
  transform: translate(-50%, -110%);
}

.field-toast {
  position: absolute;
  left: 50%;
  bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 1000;
  background: #101811;
  border: 0;
  color: var(--deck-ink);
  padding: 0.55rem 0.9rem;
  border-radius: 5px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--deck-font);
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  max-width: 90vw;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.field-toast.is-on {
  opacity: 1;
}

/* Sequential permission rationale (one dialog at a time, above all chrome). */
.perm-gate {
  position: fixed;
  inset: 0;
  z-index: 2400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(1rem + env(safe-area-inset-top, 0px)) 1.1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  background:
    linear-gradient(180deg, rgba(3, 6, 4, 0.55), rgba(3, 6, 4, 0.78)),
    rgba(4, 8, 5, 0.62);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  box-sizing: border-box;
}

.perm-gate[hidden] {
  display: none !important;
}

.perm-gate-card {
  width: min(22.5rem, 100%);
  border: 0;
  border-radius: 5px;
  color: var(--deck-ink);
  background:
    radial-gradient(circle at 6% 0%, rgba(255, 255, 255, 0.13), transparent 40%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.015) 45%, rgba(8, 16, 10, 0.42)),
    rgba(10, 16, 12, 0.86);
  box-shadow:
    0 22px 56px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  padding: 1.15rem 1rem 1rem;
  display: grid;
  gap: 0.65rem;
  animation: perm-gate-in 0.28s ease-out;
}

@keyframes perm-gate-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.perm-gate-icon-wrap {
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 5px;
  display: grid;
  place-items: center;
  background: rgba(156, 173, 78, 0.16);
  border: 0;
  margin-bottom: 0.15rem;
}

.perm-gate-icon {
  width: 1.7rem;
  height: 1.7rem;
  filter: invert(78%) sepia(18%) saturate(700%) hue-rotate(28deg) brightness(95%);
}

.perm-gate-step {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--deck-muted);
  font-family: var(--deck-font);
  font-weight: 700;
}

.perm-gate h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.25;
  font-weight: 800;
  color: #fff;
  font-family: var(--deck-font);
}

.perm-gate-body {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--deck-muted);
}

.perm-gate-actions {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.perm-gate-actions .btn {
  width: 100%;
  min-height: 2.15rem;
  font-family: var(--deck-font);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  border: 0;
  border-radius: 4px;
  color: var(--deck-ink);
}

.perm-gate-actions .btn.btn-primary {
  background: var(--deck-accent);
  color: var(--accent-ink);
  border-color: transparent;
}

/* Markers: label centered under point, no frame */
.leaflet-marker-icon.gp-marker-wrap,
.gp-marker-wrap {
  background: transparent !important;
  border: none !important;
  overflow: visible !important;
}

/* Only the dot receives clicks — not the wide label area */
.leaflet-marker-icon.gp-marker-wrap.is-fighter {
  pointer-events: none !important;
}

.leaflet-marker-icon.gp-marker-wrap.is-fighter .ally-dot,
.leaflet-marker-icon.gp-marker-wrap.is-fighter .self-dot,
.leaflet-marker-icon.gp-marker-wrap.is-fighter .field-dot-wrap {
  pointer-events: auto !important;
  cursor: pointer;
}

.leaflet-marker-icon.field-cluster-wrap {
  pointer-events: auto !important;
  cursor: pointer;
}

.field-marker-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  overflow: visible;
}

.field-marker-label {
  position: absolute;
  top: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  background: none;
  border: none;
  color: #fff;
  text-shadow:
    0 0 3px #000,
    0 1px 2px #000,
    0 -1px 2px #000;
  padding: 2px 0 0;
  font-size: 11px;
  font-weight: 600;
  /* Same as site UI: Unbounded → Outfit */
  font-family: var(--font-ui, "Unbounded", "Outfit", system-ui, sans-serif);
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  line-height: 1.15;
  pointer-events: none !important;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.field-marker-label.is-offline {
  color: #c5cbd0;
}

.field-marker-sub {
  display: block;
  margin-top: 1px;
  font-size: 9px;
  font-weight: 500;
  color: #9aa3a8;
  text-shadow:
    0 0 3px #000,
    0 1px 2px #000;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ally-dot.is-offline {
  background: #8b949e !important;
  border-color: #2a3036 !important;
  box-shadow: none !important;
  opacity: 0.9;
}

/* Single horizontal line name near the view center along the path. */
.field-line-label-wrap {
  background: transparent !important;
  border: none !important;
  overflow: visible !important;
}

.field-line-label {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  color: #fff;
  text-shadow:
    0 0 3px #000,
    0 1px 2px #000,
    0 -1px 2px #000,
    1px 0 2px #000,
    -1px 0 2px #000;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-ui, "Unbounded", "Outfit", system-ui, sans-serif);
  white-space: nowrap;
  max-width: none;
  letter-spacing: 0.02em;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.role-badge {
  color: #111;
  font-size: 7px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  /* Same as callsign label under the marker */
  font-family: var(--font-ui, "Unbounded", "Outfit", system-ui, sans-serif);
  pointer-events: none;
  user-select: none;
}

.self-dot.has-role.is-long .role-badge,
.ally-dot.has-role.is-long .role-badge {
  font-size: 6px;
}

.leaflet-marker-icon {
  overflow: visible !important;
}

.field-cluster-wrap {
  background: transparent !important;
  border: none !important;
  overflow: visible !important;
}

.field-cluster {
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: #9cad4e;
  color: #151b11;
  font-weight: 700;
  font-size: 11px;
  font-family: var(--font-ui, "Unbounded", "Outfit", system-ui, sans-serif);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--dot-outline, #fff);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
  cursor: pointer;
}

.field-dot-wrap {
  position: relative;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transform: rotate(var(--heading, 0deg));
  transform-origin: 50% 50%;
}

.field-heading-nub {
  position: absolute;
  left: 50%;
  top: -5px;
  width: 0;
  height: 0;
  margin-left: -3.5px;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-bottom: 6px solid #3dd68c;
  pointer-events: none;
  z-index: 2;
}

.field-dot-wrap.is-ally .field-heading-nub {
  border-bottom-color: #9cad4e;
}

/* Accuracy ring as DivIcon — scales with markerPane during pinch zoom (unlike L.circle SVG). */
.self-accuracy-icon {
  background: transparent !important;
  border: none !important;
}
.self-accuracy-disk {
  border-radius: 50%;
  box-sizing: border-box;
  border: 1.5px solid rgba(61, 214, 140, 0.55);
  background: rgba(61, 214, 140, 0.12);
  pointer-events: none;
}

.self-dot,
.ally-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--dot-outline, #fff);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow: visible;
  position: relative;
  z-index: 1;
}

.self-dot {
  background: #3dd68c;
  box-shadow: 0 0 0 3px rgba(61, 214, 140, 0.25);
}

.ally-dot {
  background: #9cad4e;
}

.color-picker,
.line-style-picker {
  display: grid;
  gap: 0.55rem;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
}

.color-pick {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  padding: 0;
}

.color-pick:hover,
.line-style-pick:hover {
  outline: 2px solid #9cad4e;
  outline-offset: 1px;
}

.line-style-pick {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.line-style-swatch {
  flex: 1;
  height: 0;
  border-top: 3px solid #6ea8ff;
}

.line-style-swatch.is-dashed {
  border-top-style: dashed;
}

.line-style-swatch.is-dotted {
  border-top-style: dotted;
}

.field-line-arrow {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 12px solid #6ea8ff;
  transform-origin: 50% 70%;
}

.point-dot.has-color {
  border-color: var(--pt-color, #6ea8ff);
}


.layer-row button.name:hover {
  color: #9cad4e;
}

.layer-row .layer-tag {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.68rem;
  color: #9cad4e;
  opacity: 0.85;
  vertical-align: middle;
}

.layer-row .layer-del.is-disabled {
  opacity: 0.35;
  color: #888;
  border-color: rgba(136, 136, 136, 0.4);
  cursor: not-allowed;
}

.layer-opacity-row,
.layer-frame-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  color: var(--deck-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.layer-opacity-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.28rem;
}

.layer-opacity-row span,
.layer-frame-row span {
  flex: 0 0 auto;
  white-space: nowrap;
}

.layer-opacity-row input[type="range"] {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  height: 1.15rem;
  border: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  accent-color: var(--deck-accent);
}

.layer-opacity-row input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  border: 0;
  border-radius: 999px;
  background: rgba(241, 244, 238, 0.22);
}

.layer-opacity-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border: 0;
  border-radius: 50%;
  background: var(--deck-accent, #9cad4e);
}

.layer-opacity-row input[type="range"]::-moz-range-track {
  width: 100%;
  height: 4px;
  border: 0;
  border-radius: 999px;
  background: rgba(241, 244, 238, 0.22);
}

.layer-opacity-row input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: var(--deck-accent, #9cad4e);
}

.layer-frame-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  min-width: 0;
}

.layer-frame-swatch {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 3px;
  border: 1px solid rgba(241, 244, 238, 0.18);
  padding: 0;
  cursor: pointer;
  background: #888;
}

.layer-frame-swatch.is-on {
  outline: 2px solid #f1f4ee;
  outline-offset: 1px;
}

.layer-card[data-reorder],
.layer-row[data-reorder] {
  touch-action: none;
  cursor: grab;
}

.layer-row.is-dragging {
  opacity: 0.85;
  outline: 1px solid rgba(156, 173, 78, 0.55);
  background: rgba(156, 173, 78, 0.08);
}

.field-user-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  text-align: left;
}

.field-user-row .field-user-cs {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.field-user-roles {
  display: inline-flex;
  gap: 0.3rem;
  flex-shrink: 0;
  margin-left: auto;
}

.field-role-chip {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  background: rgba(156, 173, 78, 0.18);
  color: #d7e0b8;
  border: 1px solid rgba(156, 173, 78, 0.35);
}

.field-role-chip.is-force {
  background: rgba(110, 168, 255, 0.16);
  color: #b7d4ff;
  border-color: rgba(110, 168, 255, 0.4);
}

.field-user-row.is-offline {
  opacity: 0.55;
}

.field-row .dot.off {
  background: #666;
  box-shadow: none;
}

.point-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #101811;
  border: 2px solid #6ea8ff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.point-dot img {
  width: 14px;
  height: 14px;
  filter: invert(0.92) sepia(0.2) saturate(1.5);
}

/* KMZ extent frame — stroke color is set by Leaflet / the swatch picker */
.kmz-bounds-frame {
  stroke-width: 5 !important;
  stroke-opacity: 1 !important;
  fill: none !important;
  fill-opacity: 0 !important;
  filter: drop-shadow(0 0 2px #000);
}

.leaflet-image-layer.kmz-image-overlay,
.kmz-image-overlay {
  background: transparent !important;
  image-rendering: auto;
}

/* Cluster dissolve + fighter burst (labels ride along) */
.field-cluster.is-splitting {
  animation: field-cluster-split-fade 0.32s cubic-bezier(0.4, 0, 1, 1) forwards;
  pointer-events: none !important;
  transform-origin: center center;
}

@keyframes field-cluster-split-fade {
  0% {
    transform: scale(1);
    opacity: 1;
    filter: blur(0);
  }
  40% {
    transform: scale(1.08);
    opacity: 0.9;
  }
  100% {
    transform: scale(0.2);
    opacity: 0;
    filter: blur(1.5px);
  }
}

.field-marker-stack.is-split-burst {
  --split-dx: 0px;
  --split-dy: 0px;
  --split-delay: 0ms;
  animation: field-split-burst 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--split-delay);
  transform-origin: 50% 8px;
  will-change: transform, opacity;
}

@keyframes field-split-burst {
  0% {
    transform: translate(var(--split-dx), var(--split-dy)) scale(0.4);
    opacity: 0.5;
  }
  55% {
    transform: translate(calc(var(--split-dx) * 0.12), calc(var(--split-dy) * 0.12)) scale(1.08);
    opacity: 1;
  }
  100% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
}

.field-cluster.is-merge-arrive {
  animation: field-merge-arrive 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes field-merge-arrive {
  0% {
    transform: scale(0.35);
    opacity: 0.35;
  }
  60% {
    transform: scale(1.1);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
.leaflet-bottom.leaflet-right {
  margin: 0 !important;
  bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px)) !important;
  right: 0.35rem !important;
}

.leaflet-attribution-flag {
  display: none !important;
}

.leaflet-control-attribution {
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  color: rgba(20, 24, 22, 0.72) !important;
  text-shadow: 0 0 3px #fff, 0 1px 2px #fff;
  font-size: 10px !important;
  font-family: var(--deck-font, "Unbounded", system-ui, sans-serif) !important;
  max-width: 70vw;
  margin: 0 !important;
  border-radius: 0;
  padding: 0 2px !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
  pointer-events: none;
}

.leaflet-control-attribution a {
  color: inherit !important;
  pointer-events: none;
  text-decoration: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}

.field-freq-list {
  display: grid;
  gap: 0.75rem;
}

.field-freq-empty {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--deck-muted);
}

.field-freq-side {
  margin: 0 0 0.15rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.field-freq-grid {
  display: grid;
  gap: 0.4rem;
  padding: 0.65rem 0.7rem;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--deck-line);
}

.field-freq-grid-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}

.field-freq-grid-head b {
  font-size: 0.9rem;
  font-weight: 800;
}

.field-freq-grid-head small {
  color: var(--deck-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.field-freq-notes {
  margin: 0;
  color: var(--deck-muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.field-freq-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto;
  gap: 0.35rem 0.65rem;
  align-items: baseline;
  margin-left: calc(var(--d, 0) * 0.7rem);
  padding: 0.38rem 0 0.28rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.field-freq-row--group {
  grid-template-columns: 1fr;
  color: var(--deck-muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.field-freq-row i {
  display: block;
  color: var(--deck-muted);
  font-size: 0.68rem;
  font-style: normal;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field-freq-row b {
  font-size: 0.86rem;
  font-weight: 700;
}

.field-freq-vals {
  display: grid;
  justify-items: end;
  gap: 0.08rem;
  font-variant-numeric: tabular-nums;
}

.field-freq-vals strong {
  font-size: 0.92rem;
  font-weight: 800;
}

.field-freq-vals em {
  color: var(--deck-muted);
  font-size: 0.74rem;
  font-style: normal;
}

.field-freq-vals span {
  color: var(--deck-muted);
  font-size: 0.7rem;
}
