:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.4;
  background: #111827;
  color: #e5e7eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #111827;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid #4b5563;
  border-radius: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: #1f2937;
  color: #f9fafb;
  cursor: pointer;
}

button:hover {
  background: #374151;
}

button.primary {
  border-color: #0284c7;
  background: #0369a1;
}

button.primary:hover {
  background: #0284c7;
}

button.confirmed {
  border-color: #15803d;
  background: #15803d;
  color: #ffffff;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.5);
}

button.confirmed:hover {
  background: #166534;
}

input,
select {
  width: 100%;
  border: 1px solid #4b5563;
  border-radius: 0.5rem;
  padding: 0.55rem 0.65rem;
  background: #030712;
  color: #f9fafb;
}

select {
  font: inherit;
}

label {
  display: block;
  margin: 0.75rem 0;
  color: #cbd5e1;
  font-size: 0.92rem;
}

code {
  border-radius: 0.3rem;
  padding: 0.1rem 0.25rem;
  background: #030712;
}

/* Paste "lat, long" row in the Station Review card */
.coords-row {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.coords-row input {
  flex: 1;
  min-width: 0;
}

/* Pipe-review block: nearest-pipe suggestion buttons + disposition */
.pipe-suggestions {
  margin: 0.35rem 0;
}

.pipe-suggestions .button-row {
  margin-top: 0.35rem;
}

.pipe-assign-row {
  display: flex;
  gap: 0.4rem;
  margin: 0.4rem 0;
}

.pipe-assign-row select {
  flex: 1;
  min-width: 0;
}

.qbtn.danger.active {
  background: #7f1d1d;
  border-color: #ef4444;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #374151;
  background: #0f172a;
}

.topbar h1 {
  margin: 0;
  font-size: 1.2rem;
}

.topbar p {
  margin: 0.15rem 0 0;
  color: #94a3b8;
}

.topbar-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 390px) 1fr;
  height: calc(100vh - 74px);
}

.panel {
  overflow: auto;
  padding: 0.75rem;
  border-right: 1px solid #374151;
  background: #111827;
}

.card {
  margin-bottom: 0.75rem;
  padding: 0.85rem;
  border: 1px solid #374151;
  border-radius: 0.8rem;
  background: #1f2937;
}

.card h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.grid {
  display: grid;
  gap: 0.6rem;
}

.two-col {
  grid-template-columns: 1fr 1fr;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.inline-check input {
  width: auto;
}

.hint,
.small {
  color: #9ca3af;
  font-size: 0.82rem;
}

.status-card p,
.selected-card p {
  margin: 0.35rem 0;
}

#status-text[data-level="error"] {
  color: #fecaca;
}

#status-text[data-level="warn"] {
  color: #fde68a;
}

#last-url {
  overflow-wrap: anywhere;
}

.map-wrap {
  position: relative;
  min-height: 500px;
}

#map {
  width: 100%;
  height: 100%;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.3rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.pill-muted {
  background: #374151;
  color: #d1d5db;
}

.pill-ok {
  background: #064e3b;
  color: #a7f3d0;
}

.pill-warn {
  background: #713f12;
  color: #fde68a;
}

.pill-error {
  background: #7f1d1d;
  color: #fecaca;
}

.details-list {
  display: grid;
  grid-template-columns: minmax(100px, 0.7fr) 1fr;
  gap: 0.35rem 0.7rem;
  margin: 0;
  font-size: 0.86rem;
}

.details-list dt {
  color: #9ca3af;
  overflow-wrap: anywhere;
}

.details-list dd {
  margin: 0;
  color: #f9fafb;
  overflow-wrap: anywhere;
}

.qgroup {
  margin: 0.6rem 0;
}

.qlabel {
  color: #cbd5e1;
  font-size: 0.92rem;
  margin-bottom: 0.35rem;
}

.qbtn {
  min-width: 2.6rem;
}

.qbtn.active {
  background: #0369a1;
  border-color: #38bdf8;
}

.importance-block {
  margin: 0.6rem 0 0.2rem;
  padding-top: 0.6rem;
  border-top: 1px solid #334155;
}

.importance-block .qbtn.active {
  background: #b45309;
  border-color: #f59e0b;
}

.coord-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.2rem 0 0.35rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid #4b5563;
  border-radius: 0.5rem;
  background: #030712;
  font-size: 0.82rem;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s;
}

.coord-pill:hover {
  border-color: #0284c7;
}

.coord-pill .coord-label {
  color: #6b7280;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.coord-pill .coord-val {
  color: #e5e7eb;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.coord-pill .coord-copy-icon {
  margin-left: auto;
  color: #6b7280;
}

.coord-pill.copied {
  border-color: #22c55e;
}

.coord-pill.copied .coord-copy-icon {
  color: #22c55e;
}

.neighbor-list {
  margin-top: 0.6rem;
  display: grid;
  gap: 0.4rem;
}

.neighbor-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid #374151;
  border-radius: 0.5rem;
  background: #111827;
  font-size: 0.84rem;
}

.neighbor-item button {
  flex-shrink: 0;
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
}

/* Neighbor review form rendered inside the Google Maps InfoWindow (white
   background), so text colors are overridden from the dark panel theme. */
.review-popup {
  max-width: 320px;
  color: #111827;
}

.review-popup h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.review-popup .qlabel,
.review-popup label {
  color: #374151;
}

.review-popup label {
  margin: 0.6rem 0 0.4rem;
}

.review-popup .details-list dt {
  color: #6b7280;
}

.review-popup .details-list dd {
  color: #111827;
}

.review-popup input {
  border-color: #d1d5db;
  background: #ffffff;
  color: #111827;
}

.popup {
  max-width: 320px;
  color: #111827;
}

.popup h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.popup p {
  margin: 0.25rem 0;
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .panel {
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid #374151;
  }

  .map-wrap {
    height: 70vh;
  }
}

/* Candidate review thumbnails */
.cand-thumbs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0;
  font-size: 12px;
  color: #6b7280;
}

.cand-thumb {
  width: 31%;
  min-width: 72px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
}

.cand-thumb.best {
  border-color: #a855f7;
}

/* On-map legend for RRC pipeline operators */
.map-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  max-width: 260px;
  max-height: 45%;
  overflow-y: auto;
  background: rgba(17, 24, 39, 0.86);
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.35;
  z-index: 5;
  backdrop-filter: blur(3px);
  pointer-events: auto;
}

.map-legend .legend-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #9ca3af;
  margin-bottom: 6px;
}

.map-legend .legend-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 2px 0;
}

.map-legend .legend-swatch {
  width: 14px;
  height: 4px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Master-record edit panel in the chip candidate review card */
.cand-master {
  margin: 0.6rem 0;
  padding: 0.6rem 0.7rem;
  border: 1px solid #334155;
  border-radius: 0.6rem;
  background: #0b1220;
}

.cand-master h3 {
  margin: 0 0 0.4rem;
  font-size: 0.92rem;
}

.cand-master label {
  margin: 0.35rem 0;
  font-size: 0.82rem;
}

.cand-master input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.cand-master-flag {
  margin: 0.5rem 0;
  padding: 0.55rem 0.65rem;
  border: 1px solid #b45309;
  border-radius: 0.5rem;
  background: #2a1c0b;
}

.cand-master-flag p {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: #fcd34d;
}

/* Contractor lists — Sam-side curation card */
.contractor-rows {
  margin: 0.4rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.contractor-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.contractor-rank {
  flex: 0 0 1.6rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #93c5fd;
}

.contractor-rank-blank {
  color: #6b7280;
}

.contractor-station {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
}

.contractor-row button {
  flex: 0 0 auto;
  padding: 0.3rem 0.5rem;
}

.contractor-combo {
  position: relative;
  flex: 1;
  min-width: 0;
}

.contractor-dropdown {
  position: absolute;
  z-index: 30;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid #4b5563;
  border-radius: 0.5rem;
  background: #030712;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.contractor-option {
  padding: 0.4rem 0.55rem;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contractor-option:hover {
  background: #1f2937;
}

#contractor-export code {
  overflow-wrap: anywhere;
}
