:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-2: #eef3f8;
  --ink: #0B1F44;
  --muted: #5A6D84;
  --line: #d3ddea;
  --accent: #C8102E;
  --accent-2: #0B1F44;
  --danger: #9F1239;
  --glass: rgba(255, 255, 255, 0.94);
  --glass-border: rgba(11, 31, 68, 0.16);
  --shadow: 0 10px 28px rgba(11, 31, 68, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { height: 100dvh; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.net-banner {
  position: fixed;
  z-index: 70;
  top: 0;
  left: 0;
  right: 0;
  background: #0B1F44;
  color: #ffffff;
  border-bottom: 3px solid #C8102E;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  text-align: center;
}
body.is-offline .net-banner { display: block; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  z-index: 60;
  top: 0;
  left: 0;
  right: 0;
  padding: calc(0.4rem + var(--safe-top)) 0.85rem 0.85rem;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0));
  border: 0;
  pointer-events: none;
}
.topbar .brand,
.topbar .topbar-meta { pointer-events: auto; }
.brand { display: flex; gap: 0.5rem; align-items: center; }
.mark { width: 1.75rem; height: 1.75rem; border-radius: 0.4rem; display: block; object-fit: cover; }
.topbar h1 { margin: 0; font-size: 0.98rem; font-weight: 600; letter-spacing: 0.01em; }
.topbar p, .topbar-meta, .muted, .hint, .note { color: var(--muted); margin: 0.08rem 0 0; }
.topbar p { font-size: 0.72rem; }
.topbar-meta { font-size: 0.78rem; display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }
.account-nav { position: relative; display: flex; align-items: center; }

.workspace {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  z-index: 1;
}
.workspace-tabs { display: none; }
.workspace-tab {
  flex: 1;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 0;
  padding: 0.42rem 0.5rem 0.36rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  min-height: 0;
}
.workspace-tab[aria-selected="true"] {
  background: transparent;
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.tab-count {
  display: inline-block;
  margin-left: 0.2rem;
  font-weight: 700;
}
.tab-count[hidden] { display: none; }
.layout {
  display: grid;
  grid-template-columns: minmax(340px, 1fr) minmax(380px, 1.15fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0.7rem;
  padding: 0.7rem 1.1rem 0.7rem;
  min-height: 0;
  overflow: hidden;
}
.workspace-panes.layout {
  flex: 1 1 auto;
  min-height: 0;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: none;
  min-height: 0;
  height: 100%;
  max-height: 100%;
}
.search-panel { padding: 0.8rem 0.85rem 0.95rem; overflow: auto; }
.map-panel { padding: 0; overflow: hidden; display: flex; flex-direction: column; }

.search-form { display: grid; gap: 0.32rem; }
.control-row {
  display: grid;
  grid-template-columns: minmax(6.2rem, 0.72fr) minmax(6.2rem, 0.78fr) minmax(0, 1.7fr);
  gap: 0.4rem;
  align-items: stretch;
}
.picker { display: block; min-width: 0; }
.picker select {
  width: 100%;
  height: 100%;
  min-height: 1.65rem;
  appearance: none;
  -webkit-appearance: none;
  background-color: #ffffff;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 0.72rem) 55%, calc(100% - 0.48rem) 55%;
  background-size: 0.26rem 0.26rem, 0.26rem 0.26rem;
  background-repeat: no-repeat;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.1rem 1.15rem 0.1rem 0.4rem;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 550;
}
.modes {
  display: flex;
  gap: 2px;
  min-width: 0;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  min-height: 1.65rem;
}
.mode { cursor: pointer; flex: 1 1 0; min-width: 0; position: relative; }
.mode input { position: absolute; opacity: 0; pointer-events: none; }
.mode span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0.1rem 0.2rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  font-size: 0.68rem;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
}
.mode input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.mode input:checked + span {
  background: rgba(200, 16, 46, 0.12);
  color: var(--accent);
  font-weight: 650;
}
.query-row { display: flex; gap: 0.35rem; align-items: stretch; }
.query-field { position: relative; flex: 1; min-width: 0; }
.query-row input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  border-radius: 5px;
  padding: 0.18rem 1.85rem 0.18rem 0.5rem;
  font-size: 0.78rem;
  min-height: 1.65rem;
}
.query-row input[type="search"]::-webkit-search-cancel-button,
.query-row input[type="search"]::-webkit-search-decoration,
.query-row input[type="search"]::-webkit-search-results-button,
.query-row input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}
.query-clear {
  position: absolute;
  z-index: 2;
  right: 0.22rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.45rem;
  height: 1.45rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1.05rem;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.query-field:has(input:not(:placeholder-shown)) .query-clear { display: flex; }
.query-clear:hover,
.query-clear:focus-visible {
  color: var(--ink);
  background: rgba(11, 31, 68, 0.12);
}
.query-row input[type="search"]::placeholder { color: transparent; }
.query-field .ph {
  position: absolute;
  left: 0.55rem;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: none;
}
.search-form:has([name=mode][value="name"]:checked) .ph-name { display: block; }
.search-form:has([name=mode][value="api"]:checked) .ph-api { display: block; }
.search-form:has([name=mode][value="operator"]:checked) .ph-operator { display: block; }
.search-form:has(select[name=scope] option[value="pipelines"]:checked) .ph-name,
.search-form:has(select[name=scope] option[value="pipelines"]:checked) .ph-api,
.search-form:has(select[name=scope] option[value="pipelines"]:checked) .ph-operator,
.search-form:has(select[name=scope] option[value="disposal"]:checked) .ph-name,
.search-form:has(select[name=scope] option[value="disposal"]:checked) .ph-api,
.search-form:has(select[name=scope] option[value="disposal"]:checked) .ph-operator { display: none !important; }
.search-form:has(select[name=scope] option[value="pipelines"]:checked):has([name=pipe_mode][value="operator"]:checked) .ph-pipe-op { display: block; }
.search-form:has(select[name=scope] option[value="pipelines"]:checked):has([name=pipe_mode][value="name"]:checked) .ph-pipe-name { display: block; }
.search-form:has(select[name=scope] option[value="disposal"]:checked):has([name=disp_mode][value="name"]:checked) .ph-disp-name { display: block; }
.search-form:has(select[name=scope] option[value="disposal"]:checked):has([name=disp_mode][value="operator"]:checked) .ph-disp-op { display: block; }
.search-form:has(select[name=scope] option[value="disposal"]:checked):has([name=disp_mode][value="permit"]:checked) .ph-disp-permit { display: block; }
.search-form:has(select[name=scope] option[value="wells"]:checked) .modes-pipelines,
.search-form:has(select[name=scope] option[value="wells"]:checked) .modes-disposal { display: none !important; }
.search-form:has(select[name=scope] option[value="pipelines"]:checked) .modes-wells,
.search-form:has(select[name=scope] option[value="pipelines"]:checked) .modes-disposal { display: none !important; }
.search-form:has(select[name=scope] option[value="disposal"]:checked) .modes-wells,
.search-form:has(select[name=scope] option[value="disposal"]:checked) .modes-pipelines { display: none !important; }
.search-form:has(select[name=scope] option[value="pipelines"]:checked) #active-filters,
.search-form:has(select[name=scope] option[value="disposal"]:checked) #active-filters { display: none; }
.query-field:has(input:not(:placeholder-shown)) .ph { display: none !important; }
.hint-api, .hint-operator, .hint-pipe-op, .hint-pipe-name,
.hint-disp-name, .hint-disp-op, .hint-disp-permit { display: none; }
.search-form:has([name=mode][value="api"]:checked) .hint-name,
.search-form:has([name=mode][value="operator"]:checked) .hint-name,
.search-form:has(select[name=scope] option[value="pipelines"]:checked) .hint-name,
.search-form:has(select[name=scope] option[value="disposal"]:checked) .hint-name,
.search-form:has([name=mode][value="api"]:checked) ~ .hint-name,
.search-form:has([name=mode][value="operator"]:checked) ~ .hint-name,
.search-form:has(select[name=scope] option[value="pipelines"]:checked) ~ .hint-name,
.search-form:has(select[name=scope] option[value="disposal"]:checked) ~ .hint-name { display: none; }
.search-form:has([name=mode][value="api"]:checked) .hint-api,
.search-form:has([name=mode][value="api"]:checked) ~ .hint-api { display: block; }
.search-form:has([name=mode][value="operator"]:checked) .hint-operator,
.search-form:has([name=mode][value="operator"]:checked) ~ .hint-operator { display: block; }
.search-form:has(select[name=scope] option[value="pipelines"]:checked) .hint-api,
.search-form:has(select[name=scope] option[value="pipelines"]:checked) ~ .hint-api,
.search-form:has(select[name=scope] option[value="pipelines"]:checked) .hint-operator,
.search-form:has(select[name=scope] option[value="pipelines"]:checked) ~ .hint-operator,
.search-form:has(select[name=scope] option[value="disposal"]:checked) .hint-api,
.search-form:has(select[name=scope] option[value="disposal"]:checked) ~ .hint-api,
.search-form:has(select[name=scope] option[value="disposal"]:checked) .hint-operator,
.search-form:has(select[name=scope] option[value="disposal"]:checked) ~ .hint-operator { display: none !important; }
.search-form:has(select[name=scope] option[value="pipelines"]:checked):has([name=pipe_mode][value="operator"]:checked) ~ .hint-pipe-op { display: block; }
.search-form:has(select[name=scope] option[value="pipelines"]:checked):has([name=pipe_mode][value="name"]:checked) ~ .hint-pipe-name { display: block; }
.search-form:has(select[name=scope] option[value="disposal"]:checked):has([name=disp_mode][value="name"]:checked) ~ .hint-disp-name { display: block; }
.search-form:has(select[name=scope] option[value="disposal"]:checked):has([name=disp_mode][value="operator"]:checked) ~ .hint-disp-op { display: block; }
.search-form:has(select[name=scope] option[value="disposal"]:checked):has([name=disp_mode][value="permit"]:checked) ~ .hint-disp-permit { display: block; }
.search-form:has(select[name=scope] option[value="wells"]:checked):has([name=mode][value="api"]:checked) + #operator-suggest { display: none; }
#active-filters { display: contents; }
#operator-suggest { margin-top: 0.15rem; }
.primary, .pager a, .suggest-item, .lease-item, .ghost, .save-btn, .map-toggle, .text-link, .recent-chip, .clear-all {
  border: 0;
  cursor: pointer;
  font: inherit;
}
.ghost, .text-link, a.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.18rem 0.48rem;
  font-size: 0.78rem;
  font-weight: 550;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.text-link { border: 0; color: var(--accent); padding: 0; display: inline; }
.ghost:hover, .save-btn:hover, .map-toggle:hover, .recent-chip:hover, .pager a:hover, .clear-all:hover { border-color: var(--accent); }
a.recent-chip { text-decoration: none; display: inline-flex; align-items: center; }
.danger-text { color: var(--danger); }
.primary {
  background: var(--accent-2);
  color: #ffffff;
  border-radius: 6px;
  padding: 0 0.85rem;
  font-weight: 650;
  font-size: 0.88rem;
}
.query-row .primary {
  border-radius: 5px;
  padding: 0 0.6rem;
  font-size: 0.74rem;
  font-weight: 650;
}
.hint { font-size: 0.86rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.suggest, .lease-list { list-style: none; margin: 0.4rem 0 0; padding: 0; display: grid; gap: 0.35rem; }
.suggest-item, .lease-item {
  width: 100%;
  text-align: left;
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}
.suggest-item:hover, .lease-item:hover, .well-row:hover { border-color: var(--accent); }

.spinner { margin: 0.8rem 0; color: var(--accent); }
.htmx-indicator { display: none; }
.htmx-request.htmx-indicator, .htmx-request .htmx-indicator { display: block; }

.empty, .banner { padding: 0.85rem 0.9rem; border-radius: 6px; background: var(--panel-2); }
.banner.error { border: 1px solid var(--danger); color: #9F1239; }
.result-head { display: flex; justify-content: space-between; align-items: end; gap: 0.75rem; margin: 0.8rem 0; }
.result-head h2, .map-head h2 { margin: 0; font-size: 1.05rem; }
.save-hint { font-size: 0.78rem; margin: 0.2rem 0 0.35rem; }
.result-tools { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.filters, .filter-bar { display: grid; gap: 0.45rem; margin-top: 0.15rem; }
.filter-label { margin: 0; font-size: 0.8rem; color: var(--muted); }
.filters .filter-chips, .filter-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.35rem 0.2rem 0.55rem;
  font-size: 0.8rem;
}
.filter-chip label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
}
.filter-chip.off,
.filter-chip.inactive,
.filter-chip:has(input[type="checkbox"]:not(:checked)) { opacity: 0.55; }
.filter-chip input[type="checkbox"] { accent-color: var(--accent); margin: 0; }
.chip-x, .filter-remove {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  padding: 0 0.25rem;
}
.chip-x:hover, .filter-remove:hover { color: var(--danger); }
.clear-filters, .clear-all {
  justify-self: start;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
}
.clear-all:hover { color: var(--danger); border-color: var(--danger); }
.results-toolbar { display: flex; flex-wrap: wrap; gap: 0.4rem; }
table.wells th.col-operator,
table.wells td.col-operator {
  width: 32%;
  white-space: normal;
  overflow-wrap: break-word;
}
.well-api-sub {
  display: block;
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 450;
  letter-spacing: 0.01em;
}
table.wells th.col-status,
table.wells td.col-status {
  max-width: 11rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

.map-toggle {
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  cursor: pointer;
}
.map-toggle.on { background: #fdecef; color: var(--accent); border-color: var(--accent); }

.table-wrap { overflow: auto; width: 100%; }
table.wells { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 0.92rem; }
.sheet-view table.wells,
#results table.wells { font-size: 0.75rem; }
.sheet-view table.wells th, .sheet-view table.wells td,
#results table.wells th, #results table.wells td { padding: 0.32rem 0.35rem; }
table.wells th, table.wells td {
  text-align: left;
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid var(--line);
  overflow-wrap: break-word;
  word-break: normal;
  vertical-align: top;
}
table.wells th { color: var(--muted); font-weight: 600; }
table.wells tr[hidden] { display: none !important; }
table.wells th.map-col, table.wells td.map-col { width: 2.6rem; text-align: center; }
table.wells th.save-col, table.wells td.save-cell {
  width: 2.4rem;
  text-align: right;
  padding-left: 0.1rem;
  padding-right: 0.15rem;
  overflow: visible;
  white-space: nowrap;
}
.save-status { margin: 0.35rem 0 0; font-size: 0.86rem; color: var(--ink); }
.save-status:empty { display: none; }
.save-status .text-link { margin-left: 0.35rem; }
.sort-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0.85rem;
  gap: 0.28rem;
  cursor: pointer;
}
.sort-link:hover, .sort-link.is-active { color: var(--accent); }
.sort-ind { font-size: 0.7rem; }
.sort-idle { opacity: 0; }
.col-head-wrap { position: relative; }
.col-head { display: flex; align-items: center; gap: 0.15rem; }
.col-filter-toggle {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 0.14em;
  cursor: pointer;
}
.col-filter-toggle:hover,
.col-filter-toggle:focus-visible,
th[aria-sort="ascending"] .col-filter-toggle,
th[aria-sort="descending"] .col-filter-toggle,
.col-filter-toggle:has(.col-filter-dot) { color: var(--accent); }
.col-filter-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.col-head-wrap:hover .sort-idle,
.col-head-wrap:focus-within .sort-idle { opacity: 0.55; }
.col-filter-dot {
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
}
.col-filter {
  position: absolute;
  z-index: 8;
  top: calc(100% + 0.15rem);
  left: 0;
  width: 11rem;
  max-width: 70vw;
  padding: 0.28rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}
.col-filter[hidden] { display: none !important; }
.col-filter input {
  width: 100%;
  margin: 0;
  padding: 0.28rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
}
.col-filter input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.col-filter input::placeholder { color: var(--muted); }
table.wells th.col-sortable:nth-last-child(-n+2) .col-filter { left: auto; right: 0; }
.pager:empty, .pager[hidden] { display: none; }
.well-row { cursor: pointer; }
.well-row.is-mapped { background: rgba(124, 179, 106, 0.08); }
.well-row.is-selected { background: rgba(200, 16, 46, 0.10); box-shadow: inset 3px 0 0 var(--accent); }
.well-name-link {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}
button.well-name-link {
  display: inline;
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.well-name-link:hover { color: var(--accent); }
.mono { font-family: "Cascadia Mono", Consolas, monospace; font-size: 0.88rem; }
.pill {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: #fdecef;
  color: var(--accent);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin-top: 0.8rem; }
.pager a, .pager-current {
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  text-decoration: none;
  min-width: 2.25rem;
  text-align: center;
}
.pager-current {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 650;
}
.pager-gap { color: var(--muted); padding: 0 0.15rem; }

.map-placeholder, .map-chrome {
  padding: 0.75rem 0.9rem 0.9rem;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  overflow: hidden;
  overscroll-behavior: contain;
}
.map-toolbar { flex: 0 0 auto; }
.map-details {
  flex: 0 1 auto;
  min-height: 0;
  max-height: 42%;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  overscroll-behavior: contain;
}
.map-head,
.pipeline-legend,
.pipeline-status,
.disposal-legend,
.mapped-list,
.map-footer,
.coord-bar,
.coord-grid,
.route-row { flex: 0 0 auto; }
.map-head { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }
.basemap-picker { display: flex; align-items: center; gap: 0.18rem; font-size: 0.66rem; line-height: 1.1; color: var(--muted); }
.basemap-picker select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath fill='%239aa386' d='M0 0l4 5 4-5z'/%3E%3C/svg%3E") no-repeat right center;
  background-size: 0.4rem;
  color: var(--ink);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0 0.62rem 0 0;
  margin: 0;
  min-height: 1.2rem;
  height: 1.2rem;
  max-width: 7.2rem;
  font: 600 0.72rem/1.1 "Segoe UI", "IBM Plex Sans", sans-serif;
  cursor: pointer;
}
.basemap-picker select option {
  font-size: 0.78rem;
  font-weight: 600;
}
.overlay-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
}
.overlay-toggle input { accent-color: var(--accent); }
.overlay-with-tip { display: inline-flex; align-items: center; gap: 0.2rem; }
.info-tip { display: inline-flex; align-items: center; }
.info-tip-btn {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  border: 1px solid var(--muted);
  background: transparent;
  color: var(--muted);
  font: italic 700 0.68rem/1 "Segoe UI", sans-serif;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.info-tip-btn[aria-expanded="true"] {
  color: var(--ink);
  border-color: var(--accent);
  background: #fdecef;
}
.info-tip-pop {
  position: fixed;
  inset: auto;
  z-index: 10000;
  margin: 0;
  padding: 0.5rem 0.65rem;
  width: min(15rem, calc(100vw - 1rem));
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  font-size: 0.8rem;
  line-height: 1.4;
}
.info-tip-pop[hidden] { display: none !important; }
.legend-key { display: flex; flex-wrap: wrap; gap: 0.3rem 0.65rem; align-items: center; }
.offline-pack {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.1rem 0.55rem;
  max-width: none;
}
.offline-pack .ghost {
  min-height: 1.2rem;
  padding: 0 0.02rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.1;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}
.offline-pack .ghost:hover,
.offline-pack .ghost:focus-visible,
.offline-pack .ghost.is-on {
  color: var(--accent);
  border-color: transparent;
}
.offline-routes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.28rem;
  max-height: 8.6rem;
  overflow: auto;
}
.offline-routes[hidden] { display: none; }
.route-swatch {
  flex: none;
  width: 1.15rem;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}
.route-pin-icon,
.user-location-icon {
  background: transparent;
  border: 0;
}
.route-pin-dot {
  display: block;
  width: 14px;
  height: 14px;
  margin: 2px;
  border-radius: 50%;
  background: #C8102E;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 2px rgba(200, 16, 46, 0.35);
}
.user-location-dot {
  display: block;
  width: 14px;
  height: 14px;
  margin: 2px;
  border-radius: 50%;
  background: #C8102E;
  border: 2px solid #fff;
  box-shadow: 0 0 0 6px rgba(200, 16, 46, 0.22);
}
.user-location-icon.is-nav .user-location-dot {
  width: 0;
  height: 0;
  margin: 2px 0 0 7px;
  border-radius: 0;
  background: transparent;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 18px solid #C8102E;
  border-top: 0;
  box-shadow: none;
  transform-origin: 7px 14px;
}
.route-nav {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: #fff5f6;
}
.route-nav[hidden] { display: none; }
.route-nav-arrow {
  flex: none;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: #C8102E;
  position: relative;
}
.route-nav-arrow::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0.32rem;
  margin-left: -0.34rem;
  border-left: 0.34rem solid transparent;
  border-right: 0.34rem solid transparent;
  border-bottom: 0.85rem solid #fff;
}
.route-nav-copy { flex: 1; min-width: 0; }
.route-nav-title { margin: 0; font-size: 0.95rem; font-weight: 700; }
.route-nav-detail { margin: 0.1rem 0 0; font-size: 0.78rem; color: var(--muted); }
.route-nav.is-off .route-nav-detail { color: #e0893a; }
.route-nav.is-arrived .route-nav-title { color: #7cb36a; }
.route-nav-actions { display: flex; gap: 0.45rem; align-items: center; }
.route-nav-actions .ghost { color: var(--muted); }
.route-nav-go {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  padding: 0.15rem 0.2rem;
}
.mapped-item.is-navigating { border-color: var(--accent); }
.leaflet-container.well-map.is-pinning,
.leaflet-container.well-map.is-pinning.leaflet-grab,
.leaflet-container.well-map.is-pinning .leaflet-interactive {
  cursor: crosshair;
}
.well-map .leaflet-control-attribution {
  background: transparent;
  color: rgba(236, 232, 216, 0.55);
  font-size: 0.56rem;
  line-height: 1.1;
  padding: 0;
  margin: 0.55rem 0.85rem 0 0;
  border-radius: 0;
  box-shadow: none;
  max-width: min(12rem, 58vw);
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}
.well-map .leaflet-control-attribution a {
  color: inherit;
}
.disposal-waste-classes {
  margin: 0.15rem 0 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.disposal-wait {
  margin: 0.45rem 0;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}
.disposal-wait[hidden] { display: none; }
.disposal-wait-head h3 { margin: 0; font-size: 1rem; }
.disposal-wait-head .muted { margin: 0.2rem 0 0; font-size: 0.78rem; }
.disposal-wait-summary { margin-top: 0.45rem; font-size: 0.9rem; }
.disposal-wait-summary p { margin: 0.2rem 0; }
.wait-report-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
}
.wait-report-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
}
.disposal-wait-form,
.disposal-wait-prefs-form {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.45rem;
}
.disposal-wait details > summary {
  cursor: pointer;
  font-weight: 600;
  margin-top: 0.45rem;
}
.wait-kind {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.wait-kind legend { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.25rem; width: 100%; }
.wait-datetime-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: end;
}
.wait-datetime-row label { flex: 1 1 12rem; display: grid; gap: 0.2rem; }
.wait-datetime-row input[type="datetime-local"],
.disposal-wait select,
.disposal-wait input[type="number"] {
  min-height: 2.2rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel, #ffffff);
  color: inherit;
  padding: 0.25rem 0.45rem;
}
.offline-pack #offline-status {
  margin: 0;
  font-size: 0.75rem;
  text-align: left;
  line-height: 1.35;
  flex-basis: 100%;
}
#offline-status:empty { display: none; }
.pipeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  align-items: center;
  font-size: 0.78rem;
  color: var(--ink);
}
.swatch,
.pipeline-legend .swatch {
  display: inline-block;
  width: 0.85rem;
  height: 3px;
  margin-right: 0.28rem;
  vertical-align: middle;
  background: var(--accent);
}
.swatch.gas { background: #e4c04a; }
.swatch.crude { background: #6fbf73; }
.swatch.hvl { background: #e0893a; }
.swatch.product { background: #7aa2e3; }
.swatch.other { background: #b7b7a8; }
.swatch.disposal { height: 10px; width: 10px; border-radius: 2px; background: #c45c3a; }
.swatch.swd-commercial,
.swatch.swd-operator {
  height: 0.62rem;
  width: 0.62rem;
  border-radius: 50%;
}
.swatch.swd-commercial { background: #c45c3a; }
.swatch.swd-operator { background: #3d7cc9; }
.pipeline-status { margin: 0; font-size: 0.8rem; }
.pipeline-status:empty,
.coord-bar:empty,
.coord-grid:empty,
.route-row:empty { display: none; }
.pipeline-owners {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.7rem 0.8rem 0.55rem;
  display: grid;
  align-content: start;
  gap: 0.45rem;
  flex: 0 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
.pipeline-owners[hidden] { display: none; }
.pipeline-owners-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
}
.pipeline-owners-head h3 { margin: 0; font-size: 1.05rem; }
.pipeline-owners-head .muted { font-size: 0.78rem; margin: 0.2rem 0 0; }
.pipeline-owners dl {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 0.2rem 0.7rem;
  margin: 0;
  font-size: 0.86rem;
}
.pipeline-owners dt,
.pipeline-owners dd { min-width: 0; }
.pipeline-owners dt { color: var(--muted); }
.pipeline-owners dd { margin: 0; overflow-wrap: anywhere; }
.pipeline-owners-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.pipeline-map-btn.well-name-link {
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.well-map {
  flex: 1 1 auto;
  min-height: 12rem;
  width: 100%;
  border-radius: 6px;
  border: 1px solid var(--line);
}
/* Pipeline drawing is hit-tested from the map click. The canvas must not
   swallow taps meant for disposal markers in the phone WebViews. */
.leaflet-pipelines-pane,
.leaflet-pipelines-pane canvas {
  pointer-events: none;
}
.map-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 0.75rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
  background: var(--panel);
}
.coord-bar,
.coord-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.45rem;
  min-width: 0;
}
.coord-chip {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.3rem 0.45rem;
  padding: 0;
  line-height: 1.25;
}
.coord-chip-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.66rem;
  font-weight: 700;
}
.coord-chip .mono { font-size: 0.78rem; }
.coord-chip .muted { margin: 0; font-size: 0.7rem; }
.map-footer .route {
  padding: 0.1rem 0;
  font-size: 0.75rem;
  border-radius: 0;
}

.mapped-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.28rem;
  max-height: 8.6rem;
  overflow: auto;
}
.mapped-list:empty { display: none; }
.mapped-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.22rem 0.4rem;
  font-size: 0.82rem;
}
.mapped-item.selected {
  border-color: var(--accent);
}
.mapped-item-select {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mapped-item-remove {
  flex: none;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  padding: 0.1rem 0.28rem;
}
.mapped-item-remove:hover { color: var(--danger); }

.well-marker {
  background: #0B1F44;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  opacity: 0.88;
}
.well-marker.is-selected {
  background: var(--accent);
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.28);
  opacity: 1;
}

.pipeline-pin-wrap {
  background: transparent !important;
  border: none !important;
}
.pipeline-pin {
  display: block;
  width: 16px;
  height: 16px;
  margin: 4px 0 0 2px;
  background: #C8102E;
  border: 2px solid #ffffff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}
.route-row .pipeline-pin-remove {
  align-self: center;
}

.route-row .muted { margin: 0; font-weight: 400; }
.note { font-size: 0.86rem; line-height: 1.4; }
.route-row { display: flex; gap: 0.85rem; flex-wrap: wrap; align-items: center; }
.route {
  text-decoration: underline;
  text-underline-offset: 0.16em;
  border-radius: 0;
  padding: 0.1rem 0;
  font-weight: 600;
  font-size: 0.75rem;
  background: transparent;
  min-height: 1.65rem;
  display: inline-flex;
  align-items: center;
}
.route.apple { background: transparent; color: var(--ink); }
.route.google { background: transparent; color: #9ec1f5; }
.route.apple:hover, .route.google:hover { color: var(--accent); }
.leaflet-popup.loc-popup .leaflet-popup-content-wrapper,
.leaflet-popup.loc-popup .leaflet-popup-tip {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.leaflet-popup.loc-popup .leaflet-popup-content-wrapper { border-radius: 12px; }
.leaflet-popup.loc-popup .leaflet-popup-content {
  margin: 12px 22px 12px 14px;
  min-width: 12.5rem;
  font-size: 0.84rem;
  line-height: 1.35;
}
.leaflet-popup.loc-popup-compact .leaflet-popup-content-wrapper { border-radius: 8px; }
.leaflet-popup.loc-popup-compact .leaflet-popup-content {
  margin: 8px 18px 8px 10px;
  min-width: 12.75rem;
  width: max-content;
  max-width: 16rem;
  font-size: 0.75rem;
  line-height: 1.2;
}
.leaflet-popup.loc-popup-compact .leaflet-popup-content strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
}
.leaflet-popup.loc-popup-compact .loc-operator {
  display: block;
  margin: 0.16rem 0 0;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 550;
  line-height: 1.25;
}
.leaflet-container .loc-popup a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-container .loc-popup a.leaflet-popup-close-button:hover,
.leaflet-container .loc-popup a.leaflet-popup-close-button:focus { color: var(--ink); }
.loc-popup button.route {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
}
.loc-popup .route.is-selected { color: var(--accent); }
.loc-share {
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--line);
}
.loc-share-platforms,
.loc-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  align-items: center;
}
.loc-popup .route,
.loc-share-actions .ghost {
  min-height: 2.25rem;
}
.loc-share-via { margin-top: 0.35rem; }
.loc-share-via[hidden] { display: none; }
.loc-share-prompt {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
}
.loc-popup-compact .loc-share,
.loc-share-compact {
  margin-top: 0.45rem;
  padding-top: 0;
  border-top: 0;
}
.loc-popup-compact .loc-share-platforms,
.loc-share-compact .loc-share-platforms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  align-items: stretch;
}
.loc-popup-compact .loc-share-actions,
.loc-share-compact .loc-share-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.3rem;
  align-items: stretch;
}
.leaflet-popup.loc-popup-compact button.route,
.loc-share-compact button.route,
.leaflet-popup.loc-popup-compact .loc-share-actions a.ghost,
.loc-share-compact .loc-share-actions a.ghost {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  min-height: 2rem;
  margin: 0;
  padding: 0.35rem 0.45rem;
  border: 1px solid #d3ddea;
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
}
.leaflet-popup.loc-popup-compact button.route.google,
.loc-share-compact button.route.google {
  color: #0B1F44;
  background: #ffffff;
  border-color: #0B1F44;
}
.leaflet-popup.loc-popup-compact button.route.is-selected,
.loc-share-compact button.route.is-selected {
  color: #ffffff;
  background: var(--accent);
  border-color: #ffffff;
  box-shadow: 0 0 0 1px rgba(200, 16, 46, 0.35);
}
.leaflet-popup.loc-popup-compact button.route:hover,
.loc-share-compact button.route:hover,
.leaflet-popup.loc-popup-compact .loc-share-actions a.ghost:hover,
.loc-share-compact .loc-share-actions a.ghost:hover,
.leaflet-popup.loc-popup-compact button.route:focus-visible,
.loc-share-compact button.route:focus-visible,
.leaflet-popup.loc-popup-compact .loc-share-actions a.ghost:focus-visible,
.loc-share-compact .loc-share-actions a.ghost:focus-visible {
  border-color: var(--accent);
}
.leaflet-popup.loc-popup-compact button.route.is-selected:hover,
.loc-share-compact button.route.is-selected:hover,
.leaflet-popup.loc-popup-compact button.route.is-selected:focus-visible,
.loc-share-compact button.route.is-selected:focus-visible {
  border-color: #ffffff;
  color: #ffffff;
}
.leaflet-popup.loc-popup-compact .loc-share-actions a.ghost,
.loc-share-compact .loc-share-actions a.ghost {
  flex-direction: column;
  gap: 0.08rem;
  min-height: 2.4rem;
  background: #ffffff;
  border-color: #d3ddea;
}
.loc-popup-compact .loc-share-kind,
.loc-share-compact .loc-share-kind {
  font-weight: 700;
  line-height: 1.1;
}
.loc-popup-compact .loc-share-source,
.loc-share-compact .loc-share-source {
  color: var(--accent);
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.loc-share-source:empty { display: none; }
.loc-popup-compact .loc-share-via,
.loc-share-compact .loc-share-via { margin-top: 0.35rem; }
.map-chrome[data-focus="well"] #map-title,
.map-chrome[data-focus="well"] #map-sub { display: none; }
.map-chrome[data-focus="well"] .map-details:not(:has(#mapped-list li, #nav-links > *, #pipeline-owners:not([hidden]), #pipeline-status:not(:empty), #disposal-status:not(:empty))) {
  display: none;
}
.map-chrome[data-focus="well"] .map-details {
  gap: 0.12rem;
  max-height: none;
}
.map-chrome[data-focus="well"] .map-footer { background: transparent; gap: 0.2rem; }
.map-chrome[data-focus="well"] #nav-links .ghost {
  border: 0;
  padding: 0;
  min-height: 0;
  font-size: 0.72rem;
  text-decoration: underline;
  text-underline-offset: 0.14em;
}
.route.compact { padding: 0.1rem 0; font-size: 0.72rem; font-weight: 600; }
.nav-col { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.leaflet-container { background: #e7eef5; font: inherit; }

body.gate { overflow: auto; max-height: none; }
body.gate .gate-tagline {
  display: block;
  max-width: 22rem;
  line-height: 1.35;
  font-size: 0.82rem;
  color: var(--muted);
}
.gate-main {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2.4rem 1.5rem 3rem;
}
.gate-main .auth-card {
  width: min(26rem, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.15rem 1.2rem 1.25rem;
  box-shadow: none;
}
.auth-card, .account-card { display: grid; gap: 0.75rem; padding: 0.4rem 0 0; }
.auth-card h2, .account-card h2 { margin: 0; font-size: 1.35rem; }
.auth-purpose {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
  font-size: 0.95rem;
}
.auth-form { display: grid; gap: 0.7rem; max-width: 22rem; }
.auth-form label { display: grid; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
.auth-form input {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  border-radius: 6px;
  padding: 0.65rem 0.8rem;
  font: inherit;
  min-height: 2.75rem;
}
.auth-form label.remember-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  font-size: 0.92rem;
}
.auth-form label.remember-row input {
  width: 1.15rem;
  height: 1.15rem;
  min-height: 1.15rem;
  padding: 0;
  margin: 0;
  accent-color: var(--accent);
  flex: 0 0 auto;
}
.remember-hint { margin: 0; line-height: 1.4; }
.auth-form .otp-input {
  letter-spacing: 0.4em;
  font-size: 1.25rem;
  text-align: center;
}
.auth-form .primary { padding: 0.65rem 1rem; justify-self: start; }
.auth-form .ghost { justify-self: start; }
.auth-form .primary, .auth-form .ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.75rem;
}
.auth-form .btn-busy { display: none; align-items: center; gap: 0.45rem; }
.auth-form.is-busy .btn-idle,
.auth-form.htmx-request .btn-idle,
.auth-form :disabled .btn-idle { display: none; }
.auth-form.is-busy .btn-busy,
.auth-form.htmx-request .btn-busy,
.auth-form :disabled .btn-busy { display: inline-flex; }
.auth-form.is-busy .primary,
.auth-form.htmx-request .primary,
.auth-form .primary:disabled {
  cursor: wait;
  background: #16325C;
  box-shadow: inset 0 0 0 1px #0B1F44;
}
.auth-form.is-busy .ghost,
.auth-form.htmx-request .ghost,
.auth-form .ghost:disabled {
  cursor: wait;
  opacity: 0.8;
}
.btn-spinner {
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }
.danger-btn {
  background: var(--danger);
  color: #ffffff;
}
.account-identity { display: grid; gap: 0.35rem; }
.account-identity .muted { margin: 0; line-height: 1.4; }
.account-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.account-tools .ghost {
  min-height: 2.75rem;
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
}
.account-signout { margin: 0.15rem 0 0; }
.account-signout .ghost {
  min-height: 2.75rem;
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
}
.account-danger {
  margin-top: 0.85rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}
.danger-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--danger);
  border-radius: 8px;
  color: var(--danger);
  background: transparent;
  text-decoration: none;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
}
.danger-action:hover { background: rgba(211, 107, 79, 0.12); }
.delete-explain { margin: 0; line-height: 1.45; }
.delete-cancel { margin-top: 0.35rem; }
.delete-cancel .ghost {
  min-height: 2.75rem;
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
}
.account-legal {
  margin: 0.35rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.app-footer {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 2.4rem 1fr 2.4rem;
  align-items: center;
  gap: 0.5rem;
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: 0.35rem 0.85rem calc(0.4rem + var(--safe-bottom));
}
.home-btn {
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.home-btn svg {
  width: 1.35rem;
  height: 1.35rem;
  fill: currentColor;
}
.home-btn:hover,
.home-btn:focus-visible {
  color: var(--accent);
  background: var(--panel-2);
}
.app-copy {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
}
.site-footer {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: 0.5rem 1.5rem calc(0.55rem + var(--safe-bottom));
}
.legal-footer {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.55rem;
}
.legal-footer a { color: var(--accent); }
.legal-note { color: var(--muted); }
.legal-main { padding-bottom: calc(2rem + var(--safe-bottom)); }
.legal-card {
  width: min(44rem, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.15rem 1.2rem 1.25rem;
  box-shadow: none;
  display: grid;
  gap: 0.7rem;
}
.legal-card h3 { margin: 0.55rem 0 0; font-size: 1.05rem; }
.legal-card h4 { margin: 0.35rem 0 0; font-size: 0.95rem; }
.legal-card ul { margin: 0; padding-left: 1.2rem; }
.legal-card p, .legal-card li { line-height: 1.45; }
.legal-cross { margin-top: 0.4rem; }
.legal-top-nav {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding-right: 0.25rem;
}
.legal-top-nav a { color: var(--accent); text-decoration: none; font-size: 0.9rem; }
.legal-top-nav a[aria-current="page"] { color: var(--ink); font-weight: 650; }
.account-actions, .cache-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.account-actions form { margin: 0; }
.member-table { width: 100%; max-width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 0.78rem; }
.member-table th, .member-table td {
  text-align: left;
  padding: 0.4rem 0.3rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  overflow-wrap: break-word;
  word-break: normal;
}
.member-table th:nth-child(2),
.member-table td:nth-child(2) { width: 4.2rem; }
.member-table th:last-child,
.member-table td:last-child { width: 5.6rem; }
.member-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 0.3rem; }
.member-actions .ghost { padding: 0.2rem 0.4rem; font-size: 0.72rem; min-height: 0; }
.member-actions form { margin: 0; }
.seat-summary { margin: 0; }
.seat-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.65rem;
}
.seat-form label { display: grid; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
.seat-form input[type="number"] {
  width: 6.5rem;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  font: inherit;
}
.member-create { margin: 0.15rem 0 0.35rem; }
.member-create input[type="email"],
.member-create input[type="password"],
.member-create select {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  font: inherit;
  min-width: 0;
}
.member-create input[type="email"] { width: min(16rem, 100%); }
.member-create input[type="password"] { width: 9.5rem; }
.member-create select { min-height: 2.2rem; }
.member-create .primary { min-height: 2.2rem; }
.billing-card .seat-form { margin-top: 0.25rem; }

.save-form { margin: 0; display: inline-flex; }
.save-btn {
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.save-btn.on { background: #fdecef; color: var(--accent); border-color: var(--accent); }
.save-btn.save-star {
  background: transparent;
  border: 0;
  padding: 0.05rem 0.15rem;
  color: var(--muted);
  opacity: 0.4;
  font-size: 1.05rem;
  line-height: 1;
}
.well-row:hover .save-btn.save-star,
.save-btn.save-star:hover,
.save-btn.save-star:focus-visible { opacity: 0.9; color: var(--ink); border-color: transparent; }
.save-btn.save-star.on,
.save-btn.save-star.on:hover {
  opacity: 1;
  background: transparent;
  border: 0;
  color: var(--accent);
}
.map-actions { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.7rem; }
.map-chrome[data-focus="idle"] #map-title { display: none; }
.map-chrome[data-focus="pipeline"] #map-title,
.map-chrome[data-focus="well"] #map-title,
.map-chrome[data-focus="disposal"] #map-title { font-size: 1.2rem; }
.map-chrome[data-focus="pipeline"] .coord-chip .mono,
.map-chrome[data-focus="well"] .coord-chip .mono,
.map-chrome[data-focus="disposal"] .coord-chip .mono {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.recent { margin: 0.85rem 0 1.1rem; }
.recent-row { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.recent-chip {
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
}
.history-head { margin-bottom: 0.35rem; }
.history-head p { margin: 0.2rem 0 0; }
.history-list {
  list-style: none;
  margin: 0.7rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}
.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem 0.65rem;
  align-items: start;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}
.history-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
}
.history-kicker .pill { margin: 0; }
.history-title {
  margin: 0.18rem 0 0;
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.history-meta {
  margin: 0.18rem 0 0;
  font-size: 0.75rem;
  line-height: 1.35;
}
.history-item form { margin: 0; }
.history-item .ghost {
  min-height: 1.7rem;
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
}
.phone-only { display: none; }

@media (max-width: 960px) {
  .hide-phone { display: none !important; }
  .phone-only { display: inline-flex; align-items: center; }
  .topbar {
    padding: 0.4rem 0.65rem;
    align-items: center;
    gap: 0.4rem;
  }
  .brand { gap: 0.4rem; flex: 0 0 auto; }
  .mark { font-size: 1rem; }
  .topbar h1 { font-size: 0.95rem; white-space: nowrap; }
  .topbar p { display: none; }
  body.gate .topbar p.gate-tagline {
    display: block;
    font-size: 0.72rem;
    max-width: 14rem;
  }
  body.gate .gate-main { padding: 1.25rem 0.85rem 2rem; }
  .auth-purpose { font-size: 0.9rem; }
  .auth-form .primary,
  .auth-form .ghost {
    width: 100%;
    justify-self: stretch;
  }
  .account-tools, .account-signout, .account-danger, .delete-cancel {
    display: grid;
    gap: 0.45rem;
  }
  .account-tools .ghost,
  .account-signout .ghost,
  .danger-action,
  .delete-cancel .ghost {
    width: 100%;
    justify-content: center;
  }
  .topbar-meta { font-size: 0.78rem; justify-content: flex-end; min-width: 0; flex-wrap: nowrap; }
  .auth-form { max-width: none; }
  .auth-form input { font-size: 16px; min-height: 2.75rem; }
  .control-row { grid-template-columns: 1fr 1fr; gap: 0.35rem; }
  .control-row .modes { grid-column: 1 / -1; }
  .picker select { font-size: 0.78rem; min-height: 1.75rem; }
  .search-form { gap: 0.28rem; }
  .search-panel { padding: 0.6rem 0.65rem 0.75rem; }
  .hint { font-size: 0.75rem; }
  .filter-chip, .filter-chip label { min-height: 2.15rem; }
  .result-head { flex-direction: column; align-items: stretch; gap: 0.35rem; margin: 0.45rem 0; }
  .result-tools, .results-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
  }
  .workspace {
    padding: 0;
    gap: 0;
  }
  .site-footer { padding: 0.45rem 0.8rem calc(0.5rem + var(--safe-bottom)); }
  .workspace-tab { min-height: 0; padding: 0.4rem 0.45rem 0.32rem; font-size: 0.8rem; }
  .workspace-tabs {
    display: flex;
    gap: 0;
    flex: none;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
  }
  .workspace-panes.layout {
    display: block;
    position: relative;
    padding: 0;
    gap: 0;
    flex: 1 1 auto;
    min-height: 0;
  }
  .workspace .search-panel,
  .workspace .map-panel {
    position: absolute;
    inset: 0;
    height: 100%;
    width: 100%;
    max-height: none;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .workspace[data-pane="search"] .map-panel,
  .workspace[data-pane="map"] .search-panel {
    visibility: hidden;
    pointer-events: none;
  }
  .search-panel { overflow: auto; -webkit-overflow-scrolling: touch; }
  .map-chrome {
    min-height: 0;
    overflow: hidden;
    padding: 0.28rem 0.4rem calc(0.28rem + var(--safe-bottom));
    gap: 0.18rem;
  }
  .map-actions { gap: 0.12rem 0.38rem; }
  .basemap-picker { font-size: 0.62rem; gap: 0.14rem; }
  .basemap-picker select {
    min-height: 1.12rem;
    height: 1.12rem;
    max-width: 6.5rem;
    padding-right: 0.55rem;
    font-size: 0.68rem;
  }
  .basemap-picker select option { font-size: 0.75rem; }
  .overlay-toggle { min-height: 1.35rem; }
  .offline-pack { gap: 0.05rem 0.32rem; }
  .offline-pack .ghost { min-height: 1.12rem; padding: 0; font-size: 0.62rem; }
  .well-map .leaflet-control-attribution {
    margin: 0.45rem 0.7rem 0 0;
    max-width: min(11rem, 62vw);
    font-size: 0.52rem;
  }
  .well-map {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
  }
  .map-chrome { position: relative; }
  .well-map { border-radius: 0; }
  .map-details {
    position: absolute;
    z-index: 500;
    left: 0.35rem;
    right: 0.35rem;
    bottom: 0.35rem;
    max-height: 32%;
    margin: 0;
    padding: 0.45rem 0.55rem;
    background: var(--glass);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
  }
  .map-chrome[data-focus="idle"] .map-details { display: none; }
  .map-chrome[data-focus="well"] .map-details {
    padding: 0.15rem 0.4rem;
    max-height: none;
  }
  .pipeline-owners { padding: 0.55rem 0.65rem; }
  .pipeline-owners-head h3 { font-size: 1.12rem; }
  .pipeline-owners dl { font-size: 0.92rem; grid-template-columns: 6.4rem minmax(0, 1fr); }
  .map-footer { display: grid; gap: 0.2rem; }
  .route-row { display: flex; gap: 0.9rem; }
  .route-row .pipeline-pin-remove { min-height: 1.65rem; }
  .map-footer .route { display: inline-flex; align-items: center; min-height: 1.65rem; justify-content: flex-start; font-size: 0.75rem; width: auto; }
  .query-row { flex-wrap: wrap; }
  .query-row input[type="search"],
  .query-row .primary { min-height: 1.75rem; font-size: 0.78rem; }
  .mode span { min-height: 1.55rem; font-size: 0.7rem; }
  .results-toolbar .ghost { min-height: 2.2rem; padding: 0.35rem 0.45rem; font-size: 0.78rem; justify-content: center; }
  table.wells th, table.wells td { padding: 0.7rem 0.4rem; }
  #results table.wells th, #results table.wells td { padding: 0.28rem 0.3rem; }
  table.wells.pins-table th,
  table.wells.pins-table td { padding: 0.42rem 0.28rem; }
  table.wells.pins-table th.save-col,
  table.wells.pins-table td.save-cell {
    width: 4.9rem;
    min-width: 4.9rem;
    padding-right: 0;
  }
  .results { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .route-row a { min-height: 1.65rem; display: inline-flex; align-items: center; }
  .pager a, .pager-current { min-height: 2.5rem; display: inline-flex; align-items: center; justify-content: center; }
}

@media (max-width: 720px) {
  body.gate .topbar-meta { display: none; }
}

@media (min-width: 721px) and (max-width: 960px) {
  .workspace-tab { font-size: 0.84rem; }
}

.account-card h3 {
  margin: 1.1rem 0 0.35rem;
  font-size: 1.05rem;
}

.feedback-form {
  display: grid;
  gap: 0.55rem;
  max-width: 36rem;
}
.feedback-form label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.feedback-form input,
.feedback-form select,
.feedback-form textarea {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  font: inherit;
  min-height: 2.75rem;
}
.feedback-form textarea {
  min-height: 6.5rem;
  resize: vertical;
  line-height: 1.4;
}
.feedback-form .primary { justify-self: start; }
.feedback-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}
.feedback-note {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 6px;
  padding: 0.75rem 0.85rem;
  display: grid;
  gap: 0.35rem;
}
.feedback-note header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  align-items: baseline;
  justify-content: space-between;
}
.feedback-kind {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.feedback-meta, .feedback-body { margin: 0; }
.feedback-body { white-space: pre-wrap; line-height: 1.45; }
.feedback-note form { margin: 0; }

@media (max-width: 720px) {
  .feedback-form { max-width: none; }
  .feedback-form .primary,
  .feedback-note .ghost { width: 100%; justify-content: center; }
}

.workspace-tabs { display: none !important; }
.workspace-panes.layout {
  display: block;
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  gap: 0;
  overflow: hidden;
}
.workspace,
.workspace-panes.layout {
  position: fixed;
  inset: 0;
  z-index: 2;
  background: transparent;
  pointer-events: none;
}
.workspace .map-panel {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  border: 0;
  border-radius: 0;
  visibility: visible !important;
  pointer-events: auto !important;
}
.workspace .map-chrome {
  position: relative;
  height: 100%;
  padding: 0;
}
.workspace .leaflet-top { top: calc(3.4rem + var(--safe-top)); }
.workspace .leaflet-bottom { bottom: calc(5.2rem + var(--safe-bottom)); }
.workspace .leaflet-top.leaflet-right {
  margin-right: 0.45rem;
}
.well-map .leaflet-control-zoom,
.well-map .leaflet-control-basemap,
.well-map .leaflet-control-overlays,
.well-map .leaflet-control-locate {
  border: 1px solid var(--glass-border);
  overflow: visible;
  background: #ffffff;
  box-shadow: 0 1px 8px rgba(11, 31, 68, 0.28);
  border-radius: 10px;
}
.well-map .leaflet-control-zoom a,
.well-map .map-tool-tile {
  width: 2.2rem;
  height: 2.2rem;
  line-height: 2.2rem;
  background: #ffffff;
  color: var(--ink);
  border: 0;
  font: 700 1.15rem/2.2rem "Segoe UI", "IBM Plex Sans", sans-serif;
}
.well-map .leaflet-control-zoom a:hover,
.well-map .leaflet-control-zoom a:focus,
.well-map .map-tool-tile:hover,
.well-map .map-tool-tile:focus {
  background: rgba(11, 31, 68, 0.06);
  color: var(--accent);
}
.well-map .leaflet-control-zoom a.leaflet-control-zoom-in {
  border-bottom: 1px solid var(--glass-border);
  border-radius: 10px 10px 0 0;
}
.well-map .leaflet-control-zoom a.leaflet-control-zoom-out {
  border-radius: 0 0 10px 10px;
}
.well-map .leaflet-touch .leaflet-control-zoom a,
.well-map .leaflet-touch .map-tool-tile {
  width: 2.4rem;
  height: 2.4rem;
  line-height: 2.4rem;
  font-size: 1.2rem;
}
.leaflet-control-maptool,
.leaflet-control-basemap,
.leaflet-control-overlays {
  position: relative;
}
.map-tool-tile {
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  border-radius: 10px;
}
.map-tool-icon {
  width: 1.2rem;
  height: 1.2rem;
  display: block;
}
.map-tool-icon path,
.map-tool-icon circle { fill: currentColor; }
.leaflet-control-maptool.is-open .map-tool-tile,
.overlay-tile.is-active,
.locate-tile.is-busy { color: var(--accent); }
.map-tool-menu,
.map-tool-menu[hidden],
.basemap-menu,
.basemap-menu[hidden] {
  display: none !important;
}
.leaflet-control-maptool.is-open .map-tool-menu,
.leaflet-control-basemap.is-open .basemap-menu {
  position: absolute;
  top: 0;
  right: calc(100% + 0.4rem);
  display: flex !important;
  flex-direction: column;
  min-width: 7.4rem;
  padding: 0.28rem;
  border-radius: 10px;
  background: var(--glass);
  box-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}
.map-tool-choice,
.basemap-choice {
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font: 650 0.78rem/1.2 "Segoe UI", "IBM Plex Sans", sans-serif;
  padding: 0.42rem 0.55rem;
  cursor: pointer;
}
.map-tool-choice:hover,
.map-tool-choice.is-on,
.basemap-choice:hover,
.basemap-choice.is-on {
  color: var(--accent);
  background: rgba(200, 16, 46, 0.10);
}
.workspace .well-map { flex: 1 1 auto; min-height: 0; border-radius: 0; }
.search-form {
  position: absolute;
  inset: 0;
  z-index: 470;
  display: block;
  margin: 0;
  pointer-events: none;
}
.stage-search,
.search-form .bottom-sheet,
.stage-search #operator-suggest { pointer-events: auto; }
.stage-search {
  position: absolute;
  z-index: 30;
  top: calc(0.55rem + var(--safe-top));
  left: 0.5rem;
  right: 0.5rem;
  display: block;
}
.stage-search .query-field { flex: 1 1 auto; width: 100%; }
.stage-search .query-clear {
  right: 0.4rem;
  width: 1.75rem;
  height: 1.75rem;
  font-size: 1.25rem;
}
.stage-search input[type="search"] {
  min-height: 2.4rem;
  font-size: 1rem;
  padding: 0.4rem 2.35rem 0.4rem 0.75rem;
  border-radius: 10px;
  border-color: var(--glass-border);
  background: var(--glass);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
}
#operator-suggest:empty { display: none; }
.scope-native {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.float-sheet {
  position: absolute;
  z-index: 5;
  top: calc(6.1rem + var(--safe-top));
  left: 0.5rem;
  width: min(24rem, calc(100% - 1rem));
  max-height: calc(100% - 8.2rem);
  overflow: auto;
  background: var(--glass);
  border: 1px solid rgba(11, 31, 68, 0.12);
  border-radius: 12px;
  padding: 0.8rem 0.85rem 0.95rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(10px);
}
.float-sheet .modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6.2rem, 1fr));
  gap: 0.4rem;
  margin: 0 0 0.7rem;
  padding: 0;
  border: 0;
  background: transparent;
  min-height: 0;
}
.float-sheet .mode span {
  min-height: 2.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  font-size: 0.82rem;
  font-weight: 650;
  white-space: normal;
}
.float-sheet .mode input:checked + span {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(200, 16, 46, 0.10);
}
.edge-panel {
  position: fixed;
  z-index: 35;
  top: calc(0.45rem + var(--safe-top));
  bottom: calc(4.7rem + var(--safe-bottom));
  left: 0;
  width: min(24rem, calc(100vw - 0.6rem));
  display: flex;
  flex-direction: row;
  align-items: stretch;
  transform: translateX(-120%);
  transition: transform 0.2s ease;
  pointer-events: none;
}
.edge-panel.is-active {
  transform: translateX(calc(-100% + 1.15rem));
  pointer-events: auto;
}
.edge-panel.is-open { transform: translateX(0); }
.edge-panel.edge-wide { width: min(44rem, calc(100vw - 0.6rem)); }
.edge-handle {
  flex: 0 0 1.15rem;
  width: 1.15rem;
  margin: 0;
  padding: 0.4rem 0;
  border: 1px solid var(--glass-border);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  font: inherit;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  cursor: pointer;
}
.edge-panel.is-open .edge-handle { color: var(--accent); }
.edge-body {
  flex: 1 1 auto;
  min-width: 0;
  overflow: auto;
  background: var(--glass);
  border: 1px solid rgba(11, 31, 68, 0.12);
  border-left: 0;
  border-radius: 0 12px 12px 0;
  padding: 0.8rem 0.85rem 0.95rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
}
.edge-body h2 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.float-sheet h2,
.team-page h2 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.choice-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6.4rem, 1fr));
  gap: 0.4rem;
  margin: 0.55rem 0 0.7rem;
}
.choice-tile {
  min-height: 2.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.choice-tile.is-on {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(200, 16, 46, 0.10);
}
#settings-sheet .choice-tiles {
  grid-template-columns: repeat(auto-fit, minmax(4.4rem, 1fr));
  gap: 0.28rem;
  margin: 0.25rem 0 0.4rem;
}
#settings-sheet .choice-tile {
  min-height: 0;
  padding: 0.18rem 0.35rem;
  border-radius: 5px;
  font-size: 0.72rem;
  line-height: 1.15;
}
#settings-sheet .modes {
  min-height: 0;
  margin: 0 0 0.4rem;
  gap: 0.28rem;
  padding: 0;
  border: 0;
  background: transparent;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(4.4rem, 1fr));
}
#settings-sheet .mode span {
  min-height: 0;
  padding: 0.18rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-2);
  font-size: 0.72rem;
  font-weight: 650;
  white-space: normal;
}
#settings-sheet .mode input:checked + span {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(200, 16, 46, 0.10);
}
#settings-sheet > p.muted { font-size: 0.75rem; margin: 0.35rem 0 0.1rem; }
.settings-basemap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: fit-content;
  margin: 0.2rem 0 0.45rem;
  padding: 0.28rem 0.5rem;
  border: 1px solid rgba(11, 31, 68, 0.2);
  border-radius: 6px;
}
.settings-offline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.55rem;
}
.settings-offline .primary {
  min-height: 2rem;
  padding: 0.28rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
}
.settings-offline .primary.is-on {
  box-shadow: inset 0 0 0 2px #ffffff;
}
.settings-offline #offline-status { flex-basis: 100%; }
.nav-tile[aria-pressed="true"] {
  color: var(--accent);
  background: #fdecef;
}
.sheet-tabs {
  display: flex;
  gap: 0.3rem;
  margin: 0.2rem 0 0.75rem;
}
.sheet-tabs button {
  flex: 1;
  min-height: 2.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.settings-page[data-settings-tab="account"] [data-settings-panel="location"],
.settings-page[data-settings-tab="location"] [data-settings-panel="account"],
.team-page[data-team-tab="people"] [data-team-panel="use"],
.team-page[data-team-tab="people"] [data-team-panel="feedback"],
.team-page[data-team-tab="use"] [data-team-panel="people"],
.team-page[data-team-tab="use"] [data-team-panel="feedback"],
.team-page[data-team-tab="feedback"] [data-team-panel="people"],
.team-page[data-team-tab="feedback"] [data-team-panel="use"] { display: none; }
.team-page[data-team-tab="people"] .sheet-tabs [data-team-tab="people"],
.team-page[data-team-tab="use"] .sheet-tabs [data-team-tab="use"],
.team-page[data-team-tab="feedback"] .sheet-tabs [data-team-tab="feedback"],
.settings-page[data-settings-tab="account"] .sheet-tabs [data-settings-tab="account"],
.settings-page[data-settings-tab="location"] .sheet-tabs [data-settings-tab="location"],
#account-sheet[data-account-tab="account"] .sheet-tabs [data-account-tab="account"],
#account-sheet[data-account-tab="team"] .sheet-tabs [data-account-tab="team"] {
  color: var(--accent);
  border-color: var(--accent);
}
#account-sheet[data-account-tab="account"] [data-account-panel="team"],
#account-sheet[data-account-tab="team"] [data-account-panel="account"] { display: none; }
.team-layer {
  position: absolute;
  inset: 0;
  z-index: 40;
  overflow: auto;
  pointer-events: auto;
  background: var(--glass);
  padding: calc(3.2rem + var(--safe-top)) 0.9rem calc(5.4rem + var(--safe-bottom));
}
.results-dock {
  position: absolute;
  z-index: 20;
  pointer-events: auto;
  left: 0.4rem;
  right: 0.4rem;
  bottom: calc(4.5rem + var(--safe-bottom));
  height: 1.55rem;
  max-height: calc(100% - 3.8rem);
  display: flex;
  flex-direction: column;
  background: var(--glass);
  border: 1px solid rgba(11, 31, 68, 0.12);
  border-radius: 12px 12px 10px 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.36);
  overflow: hidden;
  transition: height 0.18s ease;
}
.results-dock.is-open { height: min(42vh, 28rem); }
.results-dock.is-dragging { transition: none; }
.results-dock .dock-body { display: none; min-height: 0; overflow: auto; flex: 1; padding: 0 0.7rem 0.75rem; }
.results-dock.is-open .dock-body { display: block; }
.pull-tab {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  min-height: 1.55rem;
  cursor: grab;
  touch-action: none;
}
#results-tab::before {
  content: "";
  display: block;
  width: 2rem;
  height: 3px;
  margin: 0.22rem auto 0;
  border-radius: 99px;
  background: rgba(11, 31, 68, 0.28);
}
.pull-tab.has-focus { color: var(--accent); }
.detail-sheet {
  position: absolute;
  z-index: 18;
  top: calc(6.1rem + var(--safe-top));
  right: 0.4rem;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  max-width: calc(100% - 0.8rem);
  transform: translateX(calc(100% - 1.65rem));
  transition: transform 0.2s ease;
  pointer-events: none;
}
.detail-sheet.is-open { transform: translateX(0); }
.detail-sheet .detail-pull,
.detail-sheet .map-details { pointer-events: auto; }
.detail-pull {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  min-width: 1.65rem;
  min-height: 5.5rem;
  border: 1px solid var(--line);
  border-radius: 8px 0 0 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.detail-sheet .map-details {
  display: flex !important;
  position: relative;
  width: max-content;
  max-width: min(26rem, calc(100vw - 2.6rem));
  max-height: min(62vh, calc(100dvh - 10.5rem));
  height: auto;
  margin: 0;
  overflow: auto;
  background: var(--glass);
  border: 1px solid rgba(11, 31, 68, 0.12);
  border-radius: 0 12px 12px 12px;
  padding: 0.7rem 0.8rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
}
.detail-sheet .map-details .map-head,
.detail-sheet .map-details .mapped-list { max-width: 24rem; }
.bottom-sheet {
  position: fixed;
  z-index: 40;
  left: 0;
  right: 0;
  bottom: calc(3.45rem + var(--safe-bottom));
  height: 0.85rem;
  max-height: min(70vh, calc(100dvh - 5.5rem));
  display: flex;
  flex-direction: column;
  background: var(--glass);
  border-top: 1px solid var(--glass-border);
  border-radius: 0;
  overflow: hidden;
  transition: height 0.18s ease;
}
.bottom-sheet.is-open { height: min(58vh, 34rem); }
.bottom-sheet.is-open[data-view="details"],
.bottom-sheet.is-open[data-view="pins"],
.bottom-sheet.is-open[data-view="saved"],
.bottom-sheet.is-open[data-view="search"] {
  height: auto;
  max-height: min(58vh, 34rem);
}
.bottom-sheet.is-open[data-view="details"] .sheet-views,
.bottom-sheet.is-open[data-view="pins"] .sheet-views,
.bottom-sheet.is-open[data-view="saved"] .sheet-views,
.bottom-sheet.is-open[data-view="search"] .sheet-views {
  overflow: auto;
  max-height: calc(min(58vh, 34rem) - 0.9rem);
}
.bottom-sheet.is-dragging { transition: none; }
.bottom-sheet .sheet-views {
  display: none;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  overflow: auto;
  flex: 1;
}
.bottom-sheet.is-open .sheet-views { display: block; }
.sheet-view {
  min-width: 0;
  max-width: 100%;
  padding: 0.15rem 0.85rem 0.9rem;
  overflow-wrap: break-word;
}
.sheet-view .account-card { min-width: 0; max-width: 100%; }
.sheet-view[hidden] { display: none !important; }
#bottom-sheet[data-view="search"] #account-sheet,
#bottom-sheet[data-view="saved"] #account-sheet,
#bottom-sheet[data-view="settings"] #account-sheet,
#bottom-sheet[data-view="details"] #account-sheet,
#bottom-sheet[data-view="pins"] #account-sheet { display: none !important; }
.pin-row { cursor: pointer; }
table.wells.pins-table {
  width: 100%;
  table-layout: fixed;
}
table.wells.pins-table th,
table.wells.pins-table td {
  padding: 0.42rem 0.32rem;
  vertical-align: middle;
}
table.wells.pins-table .pin-name {
  min-width: 0;
  overflow-wrap: anywhere;
}
table.wells.pins-table th.pin-kind-col,
table.wells.pins-table td.pin-kind {
  width: 4.1rem;
  white-space: nowrap;
}
table.wells.pins-table th.pin-pick-col,
table.wells.pins-table td.pin-pick-col {
  width: 1.85rem;
  min-width: 1.85rem;
  padding-left: 0;
  padding-right: 0.1rem;
  text-align: center;
}
#pins-sheet:not(.is-batch) .pin-pick-col { display: none; }
.pin-batch-check {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.pin-batch {
  margin: 0 0 0.7rem;
}
.pin-batch[hidden] { display: none !important; }
.pin-batch-prompt {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
}
.pin-batch .loc-share {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.pin-batch [aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}
table.wells.pins-table th.save-col .col-filter-toggle {
  justify-content: flex-end;
  text-align: right;
}
table.wells.pins-table th.save-col,
table.wells.pins-table td.save-cell {
  width: 4.75rem;
  min-width: 4.75rem;
  padding-left: 0.2rem;
  padding-right: 0;
  white-space: nowrap;
  overflow: visible;
  overflow-wrap: normal;
  text-align: right;
}
table.wells.pins-table .ghost {
  min-height: 1.7rem;
  padding: 0.18rem 0.42rem;
  font-size: 0.72rem;
  white-space: nowrap;
}
#pins-sheet .table-wrap {
  overflow-x: hidden;
}
.bottom-sheet .map-details {
  display: block !important;
  width: auto;
  max-width: none;
  max-height: none;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}
#sheet-tab { color: transparent; font-size: 0; min-height: 0.85rem; }
#sheet-tab::before {
  content: "";
  display: block;
  width: 2.25rem;
  height: 3px;
  margin: 0.28rem auto 0;
  border-radius: 99px;
  background: rgba(11, 31, 68, 0.28);
}
.nav-footer {
  position: fixed;
  z-index: 60;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  padding: 0;
  padding-bottom: var(--safe-bottom);
  background: #ffffff;
  border: 0;
  border-top: 3px solid #C8102E;
  pointer-events: auto;
}
.nav-tile {
  position: relative;
  min-height: 3.45rem;
  border: 0;
  border-radius: 0;
  border-right: 1px solid rgba(11, 31, 68, 0.12);
  background: #ffffff;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.nav-tile:last-child { border-right: 0; }
.nav-tile svg { width: 1.25rem; height: 1.25rem; }
.tile-badge {
  position: absolute;
  top: 0.15rem;
  right: 0.35rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent);
}
.tile-badge[hidden] { display: none; }
#team-layer.is-open { z-index: 45; }
@media (max-width: 960px) {
  .workspace-tabs { display: none !important; }
  .workspace[data-pane="search"] .map-panel,
  .workspace[data-pane="map"] .search-panel,
  .workspace[data-pane="map"] .map-panel {
    visibility: visible !important;
    pointer-events: auto !important;
  }
}

/* Fuzzy search suggestions: bounded, scrollable dropdown above the map. */
.stage-search #operator-suggest {
  position: relative;
  z-index: 40;
  max-height: min(360px, calc(100dvh - 7rem - var(--safe-top, 0px)));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

/* Header filters: iOS zooms the page when a focused input is under 16px,
   and quick taps on headers can trigger double-tap zoom. */
table th.col-sortable,
table th .col-filter-toggle { touch-action: manipulation; }
@media (pointer: coarse), (max-width: 960px) {
  .col-filter input { font-size: 16px; }
}

/* Active search filter chips under the search box */
.active-chips { margin: 0.3rem 0 0; }
.active-chips[hidden] { display: none; }
#wells-count .clear-all { margin-left: 0.25rem; }
