/* =======================
   Base / Theme
======================= */
:root{
  --bg:#000;
  --text:#fff;
  --muted:#ccc;
  --panel:#1c1d1d;
  --panel-border:#333;
  --btn-border:#444;
  --accent:#85ff4c;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:'Segoe UI', sans-serif;
  display:flex;
  flex-direction:column;
  min-height:100vh;
  overflow-x:hidden;
}

/* A11y utility */
.visually-hidden{
  position:absolute!important;
  height:1px;width:1px;overflow:hidden;
  clip:rect(1px,1px,1px,1px);white-space:nowrap;
}

/* =======================
   Site Header (generic <header>)
======================= */
header{
  position:relative;
  text-align:center;
  padding:15px 10px 10px;
}
header img{ width:220px; height:auto; }
header .tagline{
  font-size:14px; color:var(--muted);
  margin-top:5px; letter-spacing:.4px;
}

/* Top-right social icons (img-based) */
.social-links.top-right{
  position:absolute; top:10px; right:10px;
  display:flex; gap:8px;
}
.social-links.top-right a{
  display:inline-flex; align-items:center; justify-content:center;
  width:28px; height:28px;
}
.social-links.top-right a img{
  width:28px; height:28px; display:block;
  filter:brightness(0) invert(1);
  transition:transform .2s, opacity .2s, filter .2s;
}
.social-links.top-right a:hover img{
  transform:scale(1.15); opacity:.95;
  filter:brightness(0) invert(1) drop-shadow(0 0 4px var(--accent));
}
.social-links.top-right a:focus-visible{
  outline:2px solid var(--accent); outline-offset:2px;
}

/* =======================
   Map
======================= */
#map{
  width:95vw; max-width:1200px; height:60vh;
  margin:0 auto; border-radius:8px;
  box-shadow:0 0 10px rgba(0,0,0,.6);
  position: relative; /* allow absolute-positioned panels inside the map */
}


/* Map toolbar (search row above the map) */
.map-toolbar{
  width:95vw;
  max-width:1200px;
  margin:14px auto 10px;
  /* Remove the faint container box behind the search controls.
     The input/buttons already have their own styling, so the wrapper
     just looked like an extra ghost panel. */
  padding:0;
  border-radius:0;
  background: transparent;
  border:0;
  box-shadow:none;
}
.map-toolbar .control-top{
  width:100%;
  /* Keep the search + buttons as a compact group (like it was under the map)
     instead of stretching the input across the full map width. */
  justify-content:center;
  flex-wrap: nowrap;
}
.map-toolbar .search-input-wrap{
  flex: 0 0 auto;
}
.map-toolbar .search-input-wrap input{
  width:100%;
}

/* The global #searchInput rule sets a fixed-ish width; override it in the toolbar
   so the input can grow to fill the row. */
.map-toolbar #searchInput{
  /* Slightly shorter than the map width, but still responsive */
  width: min(56vw, 560px) !important;
  max-width: 560px !important;
  min-width: 240px !important;
}

/* Mobile: let the search row wrap naturally.
   The search input gets its own full-width row, and buttons flow beneath it. */
@media (max-width: 700px){
  .map-toolbar{ margin: 10px auto 8px; }

  .map-toolbar .control-top{
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .map-toolbar .search-input-wrap{
    flex: 1 1 100%;
    width: 100%;
  }

  .map-toolbar #searchInput{
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
  }

  /* Make action buttons fit nicely on a second line */
  .map-toolbar .control-top > button{
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
  }
  .map-toolbar .control-top > button.icon-btn{
    flex: 0 0 auto;
    min-width: 44px;
  }
}

/* Keep the action buttons snug to the search box (avoid huge visual gaps) */
.map-toolbar .control-top > button{
  flex: 0 0 auto;
}

/* "Fullscreen" fallback for mobile browsers (CSS-based).
   When enabled, we show the map only and pin it to the viewport. */
.tg-map-only body{ overflow:hidden; }
.tg-map-only header,
.tg-map-only .map-toolbar,
.tg-map-only .control-panel,
.tg-map-only footer,
.tg-map-only .scaled-print-output{ display:none !important; }
.tg-map-only #map{
  position:fixed !important;
  inset:0 !important;
  width:100vw !important;
  height:100vh !important;
  max-width:none !important;
  margin:0 !important;
  border-radius:0 !important;
  z-index:9999 !important;
}

/* Custom fullscreen control button */
.truegis-fs-control{
  /* Place fullscreen under the zoom controls (top-left) */
  /* OpenLayers zoom control occupies ~2 buttons tall; keep a small gap below it */
  top: 4.6em;
  left: .5em;
  right: auto;
}

/* Accessible visually-hidden labels (for grid/inline controls) */
.sr-only{
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  padding:0 !important;
  margin:-1px !important;
  overflow:hidden !important;
  clip:rect(0,0,0,0) !important;
  white-space:nowrap !important;
  border:0 !important;
}

/* Text/Label style controls: modern "form" layout */
.style-panel[data-stylepanel="text"]{
  padding-top: 6px;
}

.text-style-grid{
  display:grid;
  grid-template-columns: 92px 1fr;
  gap: 10px 12px;
  align-items:center;
  margin-top: 10px;
  max-width: 980px;
}

.text-style-grid label{
  font-size: 12px;
  opacity: 0.88;
}

.text-style-grid input[type="text"],
.text-style-grid input[type="number"],
.text-style-grid select{
  width:100%;
  border-radius: 10px;
}

.text-style-grid input[type="color"]{
  width: 52px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.25);
}

.text-style-inline{
  display:flex;
  gap: 14px;
  align-items:center;
}

/* Make the inline row span the full grid width */
.text-style-grid .text-style-inline{
  grid-column: 1 / -1;
}

@media (min-width: 900px){
  .text-style-grid{
    grid-template-columns: 92px 1fr 92px 1fr;
  }
  /* Keep the checkbox + align rows spanning across */
  .text-style-grid .text-style-inline{
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px){
  /* Make Text feel less "spreadsheet" on small screens */
  .text-style-grid{ grid-template-columns: 1fr; }
  .text-style-grid label{ margin-top: 6px; }
  .text-style-grid .text-style-inline{ justify-content: flex-start; }
}


.style-row .opacity-range{
  width: 140px;
  max-width: 38vw;
}

.symbol-palette{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
}

.symbol-chip{
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.10);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background .15s ease, border-color .15s ease;
}

.symbol-chip:hover:not(.chip-active){
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.28);
}

.symbol-chip.chip-active,
.symbol-chip.chip-active:hover{
  background: rgba(133,255,76,0.14);
  border-color: rgba(133,255,76,0.70);
}

.symbol-chip svg{
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.hint{
  font-size: 0.85rem;
  opacity: 0.85;
  margin: 6px 0 10px;
}
.truegis-fs-btn{
  width: 2.1em;
  height: 2.1em;
  border-radius: 0.3em;
  background: rgba(30,30,30,0.85);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  font-size: 1.1em;
  line-height: 1;
}
.truegis-fs-btn:hover{
  background: rgba(255,255,255,0.08);
}

/* On-map basemap (layers) control button */
.truegis-layers-control{
  /* Positioned dynamically in JS under fullscreen/zoom; keep a sane fallback */
  top: 6.8em;
  left: .5em;
  right: auto;
}
.truegis-layers-btn{
  width: 2.25em;
  height: 2.25em;
  border-radius: 0.35em;
  background: rgba(30,30,30,0.85);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  line-height: 1;
  display:flex;
  align-items:center;
  justify-content:center;
}
.truegis-layers-btn:hover{ background: rgba(255,255,255,0.08); }
.truegis-layers-btn svg{ display:block; }

/* Hide old toolbar layers button (basemaps now live on the map) */
.map-toolbar #layersBtn{ display:none; }

/* =======================
   Controls
======================= */
.control-panel{
  position: relative;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:14px;
  max-width:1200px;
  margin:0 auto;
  padding:18px 16px 10px;
}
.control-group{
  display:flex; flex-wrap:wrap; align-items:center; justify-content:center;
  gap:14px;
}
.control-group.center{ justify-content:center; }

/* Preset colour chips (Style tab) */
.preset-row{
  display:flex;
  gap:14px;
  align-items:flex-start;
  flex-wrap:wrap;
}
.preset-group{
  display:flex;
  flex-direction:column;
  gap:8px;
  min-width: 150px;
}
.preset-group-label{
  font-size: 12px;
  opacity: 0.85;
}
.preset-chips{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}
.color-chip{
  width:32px;
  height:32px;
  border-radius:4px;
  border:1px solid rgba(255,255,255,0.22);
  box-shadow:0 0 0 1px rgba(0,0,0,0.28) inset;
  cursor:pointer;
  padding:0;
  background: var(--chip, #6b7280);
}
.color-chip.chip-active{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.symbol-chip.chip-active{
  /* Avoid "double selection" (border + outline). Border/background already indicate active. */
  outline: none;
}
.color-chip:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:2px;
}

/* Top row (search + primary actions) */
.control-top{
  width:min(96vw, 1200px);
  justify-content:center;
}

/* Section tabs (centered) */
.section-tabs{
  width:min(96vw, 1200px);
  display:flex;
  justify-content:center;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}
.tab-btn{ min-width: 120px; }
/* NOTE: active styling for tab buttons is defined later with higher specificity,
   so it isn't overridden by the baseline .btn styling. */


/* Baseline button styling (used across the app, including the attribute table dock) */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 14px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.92);
  font-weight:700;
  cursor:pointer;
  user-select:none;
}
.btn:hover{
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.18);
}
.btn:active{ transform: translateY(1px); }
.btn:disabled{
  opacity:0.55;
  cursor:not-allowed;
}

/* Grouped sections (no accordions).
   Layout: give the UI a clear hierarchy.
   Draw + Print are the primary sections (top row).
   Style/Measure sit underneath, and Drawings is compact at the bottom. */
.control-grid{
  width:min(96vw, 1200px);
  display:block;
}

@media (max-width: 700px){
  /* Avoid tiny horizontal drift on first mobile load */
  .control-grid{ width:100%; }
}

/* Section switching (tab buttons). Only one panel is shown at a time. */
.section[hidden]{ display:none !important; }

.section{
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 0 10px rgba(0,0,0,.25);
  /* Visual separation between Draw / Style / Measure / Print blocks */
  margin-bottom: 14px;
}

.section-title{
  font-weight: 800;
  letter-spacing: .2px;
  margin: 0 0 10px 0;
  padding: 2px 2px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
}

.subsection-title{
  /* Sub-accordion: pill "blob" toggle */
  margin: 14px auto 10px;
  width: fit-content;
  max-width: 100%;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: none;
  color: rgba(255,255,255,0.92);
  padding: 10px 40px 10px 22px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
  border-radius: 999px;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  position: relative;
  cursor: pointer;
  user-select: none;
}

/* Mobile subsection tabs (pills in a row) */
.subsection-nav{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap: 12px;
  margin: 8px 0 12px;
}
.subsection-panels{
  /* Keep form controls left-aligned even though titles are centered */
  text-align:left;
}
.subsection-nav .subsection-title{
  margin: 0;
  padding: 10px 18px;
}
.subsection-nav .subsection-title::after{
  display:none;
}
.subsection-title.is-active{
  /* Match TrueGIS green selection (no teal) */
  border-color: rgba(133,255,76,0.70);
  background: rgba(133,255,76,0.18);
  box-shadow: none;
}

.subsection-title::after{
  content:"▾";
  font-size: 12px;
  opacity: 0.75;
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
}

.subsection-title.is-collapsed::after{ content:"▸"; }

.subsection-title:hover:not(.is-active){
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.18);
}

.subsection-title.is-active:hover{
  background: rgba(133,255,76,0.18);
  border-color: rgba(133,255,76,0.70);
}

.subsection-title:focus{
  outline: none;
  box-shadow: none;
}


.subsection-title:focus-visible{
  outline: none;
  box-shadow: none;
}
/* Remove mobile tap highlight (prevents teal flash on iOS/Android) */
.subsection-title{
  -webkit-tap-highlight-color: transparent;
}

.subsection-body[hidden]{ display:none !important; }

.section .control-group{ justify-content:flex-start; }

/* Keep groups from visually sticking together */
.section .control-group + .control-group{ margin-top: 12px; }

.checkbox-inline{
  display:inline-flex;
  align-items:center;
  gap:8px;
}

/* Style panel: split controls into two readable rows */
.style-row{
  justify-content:flex-start;
  gap:10px;
  flex-wrap: nowrap;
}
.style-row label{
  font-size: 13px;
  opacity: .9;
  margin-right: 2px;
}

/* Percentage inputs for opacity */
.pct-input{
  display:inline-flex;
  align-items:center;
  gap:6px;
}
.pct-input input[type="number"]{
  width:72px;
  padding:8px 10px;
  font-size:14px;
  background:var(--panel);
  color:var(--text);
  border:1px solid var(--panel-border);
  border-radius:4px;
}
.pct-input span{
  font-size:13px;
  opacity:0.85;
}
.style-row input[type="range"]{
  width: min(220px, 34vw);
}

@media (max-width: 700px){
  .style-row{ flex-wrap: wrap; }
}

/* Search helper text (shows supported formats) */
.search-hint{
  width:100%;
  font-size:12px;
  color:rgba(255,255,255,0.75);
  margin:0 0 2px 0;
}

.control-group input[type="text"],
.control-group select{
  padding:8px 12px; font-size:14px;
  background:var(--panel); color:var(--text);
  border:1px solid var(--panel-border); border-radius:4px;
}

/* Make the main search field feel like the primary control */
#searchInput{
  width: min(52vw, 520px);
  min-width: 240px;
}

/* Section buttons should be compact; the top row can stay more prominent */
.section .btn{ min-width: 76px; }
.control-top .btn{ min-width: 110px; }

/* Icon buttons (e.g. layers) should be compact but match the system styling */
.control-top .btn.icon-btn{
  min-width: 44px;
  padding: 10px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.control-top .btn.icon-btn svg{ display:block; }
.control-top .btn.icon-btn.is-active{
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.24);
}

/* Layers / basemap panel */
.layers-panel{
  position: absolute;
  right: 18px;
  top: 124px; /* legacy position (overridden for basemap dropdown) */
  z-index: 2000;
  width: 220px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
}

/* Basemap dropdown anchored to the top toolbar */
.basemap-control{ position: relative; display: inline-flex; align-items: center; }
.layers-panel.layers-panel--basemap{
  /* Anchor neatly under the Basemap button */
  left: auto;
  right: 0;
  top: calc(100% + 6px);
  width: max-content;
  min-width: 240px;
  padding: 6px;
  border-radius: 12px;
}
.layers-panel.layers-panel--basemap .layers-panel__row{
  width: 100%;
  text-align: left;
  background: rgba(0,0,0,0.20);
}

/* When the basemap panel is anchored to the on-map icon */
.layers-panel.layers-panel--map{
  right: auto;
  top: auto;
  left: 0;
  /* JS sets precise left/top relative to the map container */
}

/* Attribute dock (under map) */
.attr-dock{
  width:95vw;
  max-width:1200px;
  margin: 10px auto 0;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.28);
  /* Make sure nothing forces a horizontal scrollbar */
  overflow-x: hidden;
}
.attr-dock__header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  flex-wrap:wrap;
}
.attr-dock__tabs{ display:flex; gap: 8px; flex-wrap:wrap; }
.attr-dock__right{ display:flex; gap: 10px; align-items:center; flex-wrap:wrap; }
.attr-inline{ display:flex; gap: 8px; align-items:center; font-size: 12px; color: rgba(255,255,255,0.78); }

/* --- Point popups (OL overlays) --- */
.tg-popup{ z-index: 9999; color: #111; font-size: 13px;  min-width: 260px; max-width: 340px; background:#fff; border:1px solid rgba(0,0,0,0.18); border-radius: 12px; box-shadow: 0 10px 26px rgba(0,0,0,0.18); padding: 12px 12px 10px; position: relative; }
.tg-popup__close{ position:absolute; top:6px; right:8px; width:30px; height:30px; border:none; background:transparent; font-size:22px; line-height:30px; cursor:pointer; color: rgba(0,0,0,0.6); }
.tg-popup__title{ font-weight: 800; font-size: 18px; margin-bottom: 8px; padding-right: 28px; }
.tg-popup__kv{ display:grid; grid-template-columns: 90px 1fr; gap: 10px; font-size: 14px; padding: 4px 0; }
.tg-popup__kv span:first-child{ color: rgba(0,0,0,0.65); font-weight: 600; }
.tg-popup__divider{ height:1px; background: rgba(0,0,0,0.10); margin: 8px 0; }
.tg-popup__hint{ margin-top: 8px; font-size: 12px; color: rgba(0,0,0,0.55); }
.tg-mini-popup{ z-index: 9998; color:#111; background: rgba(255,255,255,0.88); border: 1px solid rgba(0,0,0,0.18); border-radius: 10px; padding: 2px 7px; font-size: 12px; font-weight: 700; white-space: nowrap; box-shadow: 0 8px 18px rgba(0,0,0,0.12); pointer-events: none; }
.attr-dock__controls{
  margin-top: 10px;
  display:flex;
  gap: 10px;
  align-items:center;
  flex-wrap:wrap;
}
.attr-dock__controls .feature-search{ flex: 1; min-width: 220px; }

.btn.attr-tab{
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.14);
}
.btn.attr-tab.is-active{
  /* Keep active state consistent with TrueGIS green used elsewhere */
  background: rgba(133,255,76,0.22);
  border-color: rgba(133,255,76,0.85);
  box-shadow: 0 0 0 2px rgba(133,255,76,0.14);
}

/* Basemap styling: greyscale OpenStreetMap option.
   Applied to the OL layer container via `className: "basemap-greyscale"`.
   This avoids CORS/canvas pixel access issues and keeps vectors coloured. */
.basemap-greyscale{
  filter: grayscale(100%) contrast(115%) brightness(105%);
}
.layers-panel__title{
  font-weight: 700;
  font-size: 14px;
  margin: 2px 0 10px;
}
.layers-panel__row{
  display:flex;
  gap: 10px;
  align-items:center;
  padding: 8px 8px;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  border: 0;
  color: inherit;
  font: inherit;
}
.layers-panel__row:hover{ background: rgba(255,255,255,0.06); }
.layers-panel__row input{ transform: translateY(0.5px); }


.layers-panel__hr{
  border: 0;
  border-top: 1px solid rgba(255,255,255,0.12);
  margin: 10px 0;
}
.layers-features__meta{
  display:flex;
  gap: 10px;
  align-items:center;
  margin: 6px 0 8px;
}
.feature-search{
  flex:1;
  min-width: 0;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.92);
  padding: 8px 10px;
  border-radius: 10px;
}
.feature-count{
  font-size: 12px;
  color: rgba(255,255,255,0.70);
}

/* --- Attribute table (Layers → Table) --- */
.attrtable-controls{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: wrap;
}
.attrtable-label{
  display:flex;
  align-items:center;
  gap: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.78);
}
.attrtable-select{
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.92);
  padding: 8px 10px;
  border-radius: 10px;
}
.attrtable{
  margin-top: 8px;
}
.attrtable-grid{
  display:flex;
  flex-direction:column;
  gap: 6px;
  /* Rows should visually align and fill the available width */
  align-items:stretch;
  max-height: 420px;
  /* Allow horizontal scrolling (mobile + narrow screens) */
  overflow-y:auto;
  overflow-x:auto;
  padding: 8px;
  background: rgba(255,255,255,0.02);
  border-radius: 14px;
}
.attrrow{
  display:grid;
  grid-template-columns: 28px minmax(150px, 1.2fr) minmax(120px, 1fr);
  gap: 8px;
  align-items:center;
  padding: 6px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);

  /* Fill the table viewport, but also allow the row background to extend
     across the full scrollable width when there are many columns (mobile). */
  min-width: 100%;
  width: max-content;
  box-sizing: border-box;
}

/* Geometry-specific table layouts */
.attrrow--points{
  /*
    Fixed column widths on purpose.
    Each row is its own grid container, so "auto" tracks won't line up
    across rows. Fixed tracks keep the header + rows aligned.
  */
  grid-template-columns:
    28px   /* vis */
    160px  /* layer */
    200px  /* name */
    96px   /* lat */
    96px   /* lon */
    110px  /* easting */
    110px  /* northing */
    120px  /* postcode */
    420px  /* address */
    320px; /* actions */
}
.attrrow--lines{
  grid-template-columns:
    28px
    160px                  /* layer */
    260px                  /* name */
    160px                  /* length */
    260px;                 /* actions */
}
.attrrow--polygons{
  grid-template-columns:
    28px
    160px                  /* layer */
    260px                  /* name */
    160px                  /* area */
    160px                  /* perimeter */
    260px;                 /* actions */
}
.attrrow:hover{ background: rgba(255,255,255,0.06); }
.attrrow.is-selected{
  /* Green selection to match TrueGIS accent */
  background: rgba(133,255,76,0.10);
  box-shadow: inset 0 0 0 2px rgba(133,255,76,0.55);
}

.attrrow-header{
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(18,18,18,0.94);
  border-color: rgba(255,255,255,0.14);

  /* Match row sizing so headers align when horizontally scrolling */
  min-width: 100%;
  width: max-content;
  box-sizing: border-box;
}
.attrcell{
  font-size: 12px;
  color: rgba(255,255,255,0.88);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  min-width: 0;
}
.attrcell-wrap{
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
.attrcell-header{
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.65);
  text-align: left;
}
.attrcell-name{
  cursor: text;
}
.attrtable-actions{
  display:flex;
  gap: 6px;
  justify-content:flex-start;
  flex-wrap:nowrap;
  align-items:center;
}

.attrcell-actions{
  overflow: visible;
  white-space: normal;
}

/* Compact action buttons inside the attribute table so rows don't become tall */
.attrtable-actions .btn{
  padding: 5px 9px;
  font-size: 12px;
  border-radius: 10px;
  font-weight: 800;
}

/* Dark dropdown menus (fix white-on-white option text) */
select,
select option{
  background-color: #111;
  color: rgba(255,255,255,0.92);
}
.attrtable-vis{
  transform: translateY(0.5px);
}
.attrtable-name-input{
  width: 100%;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.92);
  padding: 6px 8px;
  border-radius: 10px;
}
.feature-list{
  display:flex;
  flex-direction:column;
  gap: 8px;
  max-height: 240px;
  overflow:auto;
  padding-right: 2px;
}
.feature-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 10px;
  padding: 8px 8px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
}
.feature-name{
  font-size: 13px;
  color: rgba(255,255,255,0.92);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  max-width: 140px;
}
.feature-actions{
  display:flex;
  gap: 8px;
}
.btn.btn-secondary{
  background: rgba(0,0,0,0.25);
  border-color: rgba(255,255,255,0.14);
}
.btn.btn-secondary:hover{
  background: rgba(0,0,0,0.18);
  border-color: rgba(255,255,255,0.22);
}

/* Search input wrap (used to position the suggestions dropdown against the input) */
.search-input-wrap{
  position:relative;
  display:inline-flex;
  align-items:center;
}

/* Clear search button sits next to Search (should not look like a primary action) */
.btn.btn-secondary.clear-search{
  min-width: 88px;
  background: var(--panel);
  color: rgba(255,255,255,0.86);
}
.btn.btn-secondary.clear-search:hover{
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.95);
  border-color: rgba(255,255,255,0.25);
  box-shadow: none;
}
.control-group input[type="color"],
.control-group input[type="range"]{ cursor:pointer; }

.control-group label{ font-size:14px; }

/* Buttons: consistent base.
   Use .btn-primary for the few actions that should pop. */
.control-panel .btn{
  background:var(--panel);
  color:var(--text);
  border:1px solid var(--btn-border);
  padding:10px 16px;
  font-size:14px;
  border-radius:10px;
  cursor:pointer;
  transition:background .2s ease, color .2s ease, border-color .2s ease, transform .05s ease, box-shadow .2s ease;
  min-width:100px;
}


.layers-panel .btn{
  background:var(--panel);
  color:var(--text);
  border:1px solid var(--btn-border);
  padding:10px 16px;
  font-size:14px;
  border-radius:10px;
  cursor:pointer;
  transition:background .2s ease, color .2s ease, border-color .2s ease, transform .05s ease, box-shadow .2s ease;
  min-width:100px;
}

.control-panel .btn:hover{
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.22);
  box-shadow: none;
}

.control-panel .btn.btn-primary:hover{
  background:var(--accent);
  color:#000;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(133,255,76,0.18);
}

.control-panel .btn.btn-primary{
  font-weight: 700;
}

.control-panel .btn:active{
  transform: translateY(1px);
}

/* Buttons: disabled states */
.control-panel .btn:disabled{
  opacity: .55;
  cursor: not-allowed;
}
.control-panel .btn:disabled:hover{
  background: var(--panel);
  color: var(--text);
  border-color: var(--btn-border);
  box-shadow: none;
}

/* Tab buttons: visible active state (needs higher specificity than .control-panel .btn). */
.control-panel .tab-btn.is-active{
  background: rgba(133,255,76,0.22);
  border-color: rgba(133,255,76,0.85);
  box-shadow: 0 0 0 2px rgba(133,255,76,0.14);
}
.control-panel .tab-btn.is-active:hover{
  background: rgba(133,255,76,0.28);
  border-color: rgba(133,255,76,0.95);
}

/* Make draw tool buttons a touch smaller to reduce visual noise */
.section-draw .btn{ min-width: 72px; }

/* Optional: match other tool buttons and make "active mode" pop */
.mode-active{
  background: rgba(133,255,76,0.18) !important;
  color: var(--text) !important;
  border-color: rgba(133,255,76,0.70) !important;
  box-shadow: none !important;
}

/* Destructive actions */
.btn.btn-danger{
  background: var(--panel);
  color: var(--text);
  border-color: rgba(255,77,77,0.70);
}
.btn.btn-danger:hover{
  background: #ff4d4d;
  color: #fff;
  border-color: #ff4d4d;
  box-shadow: 0 0 0 2px rgba(255,77,77,0.25);
}
.btn.btn-danger.btn-subtle{
  background: var(--panel);
  color: var(--text);
  border-color: rgba(255,77,77,0.50);
}
.btn.btn-danger.btn-subtle:hover{
  background: #ff4d4d;
  color: #fff;
}

/* --- Measure tooltip (used by measureTools.js) --- */
.truegis-measure-tooltip{
  z-index: 5;
  user-select: none;
}

/* Import/Export should look like normal tool buttons */
#importGeoJSON,
#exportGeoJSON{
  min-width: 72px;
}

/* =======================
   Footer
======================= */
footer{
  text-align:center; padding:20px 10px 30px;
  font-size:15px; color:#aaa;
}
footer a{ color:var(--accent); text-decoration:underline; }
footer strong{ color:var(--text); font-weight:700; }

/* Generic social block (e.g., footer) */
.social-links{
  margin-top:10px; display:flex; justify-content:center; gap:10px;
}
.social-links a img{
  width:28px; height:28px;
  filter:brightness(0) invert(1);
  transition:transform .2s, opacity .2s, filter .2s;
}
.social-links a:hover img{
  transform:scale(1.15); opacity:.95;
  filter:brightness(0) invert(1) drop-shadow(0 0 4px var(--accent));
}

/* =======================
   Scaled Print inline output
======================= */
.scaled-print-output{
  margin: 18px auto 0;
  max-width: 980px;
}

.scaled-print-status,
.scaled-print-error{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  flex-wrap: wrap;
  padding:12px 14px;
  border-radius:14px;
  background: rgba(255,255,255,0.04);
  border:1px solid rgba(255,255,255,0.10);
  color: var(--text);
}

.scaled-print-error{
  color:#ffb4b4;
  border-color: rgba(255, 120, 120, 0.25);
}

.scaled-print-result{
  padding: 12px;
  border-radius: 18px;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.10);
}

.scaled-print-attrib{
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.78);
  font-size: 13px;
  text-align: center;
}

.scaled-print-actions{
  display:flex;
  justify-content:center;
  gap:10px;
  margin: 0 0 10px;
}

.scaled-print-actions .btn{
  display:inline-block;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  text-decoration:none;
}

.scaled-print-actions .btn:hover{
  background: var(--accent);
  color:#000;
  border-color: var(--accent);
}

.scaled-print-preview{
  display:flex;
  justify-content:center;
  /* Legends can be very tall (SVG viewBox with whitespace). Keep preview compact. */
  max-height: 360px;
  overflow: auto;
}

.scaled-print-preview img,
.scaled-print-preview embed{
  width: 100%;
  max-width: 920px;
  height: auto;
  max-height: 340px;
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
}

.scaled-print-preview embed{
  height: 520px;
  background: rgba(0,0,0,0.35);
}

.spinner{
  width: 14px;
  height: 14px;
  min-width: 14px;
  min-height: 14px;
  flex: 0 0 14px;
  box-sizing: border-box;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

/* PDF generation progress bar (Scaled print) */
.pdf-progress{
  margin: 10px auto 0;
  width: min(520px, 92%);
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  padding: 10px 12px;
}
.pdf-progress__row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.pdf-progress__label{ font-size: 13px; color: rgba(255,255,255,0.86); }
.pdf-progress__pct{ font-size: 12px; color: rgba(255,255,255,0.74); }
.pdf-progress progress{
  width: 100%;
  height: 10px;
}

.scaled-print-progress-wrap{
  display:flex;
  align-items:center;
  gap:8px;
}

.scaled-print-progress-wrap progress{
  width: 160px;
  height: 10px;
}

@keyframes spin{
  to{ transform: rotate(360deg); }
}

/* --- Search dropdown (Nominatim suggestions) --- */
#searchDropdown.tg-search-dropdown {
  position: absolute;
  z-index: 99999;
  display: none;
  max-height: 260px;
  overflow-y: auto;

  background: #111827; /* slate-900 */
  color: #f9fafb; /* slate-50 */
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
  font-size: 14px;
  line-height: 1.2;
  backdrop-filter: blur(2px);
}

#searchDropdown.tg-search-dropdown .tg-search-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#searchDropdown.tg-search-dropdown .tg-search-item:last-child {
  border-bottom: none;
}

#searchDropdown.tg-search-dropdown .tg-search-item:hover,
#searchDropdown.tg-search-dropdown .tg-search-item.is-active {
  background: rgba(255, 255, 255, 0.08);
}

#searchDropdown.tg-search-dropdown .tg-search-item .title {
  font-weight: 600;
  margin-bottom: 4px;
}

#searchDropdown.tg-search-dropdown .tg-search-item .subtitle {
  opacity: 0.85;
  font-size: 12px;
}



/* Print subtabs */
.subtabs{ display:flex; gap:.5rem; justify-content:center; margin:.5rem 0 .75rem; }
.subtab-btn{ padding:.4rem .75rem; border-radius:10px; border:1px solid rgba(255,255,255,0.15); background:rgba(255,255,255,0.06); color:inherit; cursor:pointer; }
.subtab-btn.subtab-active{ background:rgba(255,255,255,0.16); border-color:rgba(255,255,255,0.25); }
.print-panel .hint{ margin-top:.5rem; opacity:.75; font-size:.9rem; }


/* Text creation helpers */
.text-warning{
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  background: rgba(255, 165, 0, 0.12);
  color: rgba(255,255,255,0.92);
  margin-top: 8px;
}




/* Print panel note */
.print-note{
  font-size: 11px;
  color: #8a8a8a;
  margin-top: 6px;
  line-height: 1.3;
}


/* Cursor coordinate readout */


/* Right-click coordinates popup */
.context-coords{
  position:absolute;
  z-index: 1200;
  min-width: 180px;
  background:#1f1f1f;
  color:#fff;
  border:1px solid rgba(255,255,255,0.15);
  border-radius:12px;
  padding:10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.context-coords__title{font-size:12px;opacity:0.85;margin-bottom:6px;}
.context-coords__text{font-size:12px;}
.context-coords__actions{display:flex;gap:8px;margin-top:8px;}
.context-coords__text{display:flex;flex-direction:column;gap:6px;}
.context-coords__row{display:grid;grid-template-columns:64px 1fr;gap:10px;align-items:center;}
.context-coords__k{font-size:11px;letter-spacing:0.6px;opacity:0.75;text-transform:uppercase;}
.context-coords__v{font-size:13px;font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;}
.context-coords__hint{font-size:11px;opacity:0.7;margin-top:2px;}

.btn.btn-small{padding:6px 10px;font-size:12px;}


/* Layers panel tabs */
.layers-panel__tabs{display:flex;gap:8px;margin-bottom:10px;}
.layers-tab{
  flex:1;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color:#fff;
  cursor:pointer;
  font-size:13px;
}
.layers-tab--active{
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.22);
}
.layers-features__meta{display:flex;align-items:center;gap:10px;margin:8px 0 10px;}
.feature-search{
  flex:1;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.2);
  color:#fff;
  font-size:13px;
}
.feature-count{font-size:12px;opacity:0.8;white-space:nowrap;}
.feature-list{max-height:260px;overflow:auto;display:flex;flex-direction:column;gap:8px;}
.feature-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
}
.feature-row__name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;}
.feature-row__meta{font-size:11px;opacity:0.75;margin-top:2px;}
.feature-row__left{display:flex;flex-direction:column;min-width:0;flex:1;}
.feature-row__actions{display:flex;gap:6px;}
.feature-action{
  width:28px;height:28px;
  border-radius:8px;
  border:1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color:#fff;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}


/* Layers panel: per-feature visibility checkbox */
.feature-vis {
  width: 16px;
  height: 16px;
  margin-right: 10px;
  accent-color: #00a86b;
}


/* Layers panel tabs */
.layers-tabs{
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.layers-tab{
  flex: 1;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
  color: inherit;
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  font: inherit;
}
.layers-tab.is-active{
  border-color: rgba(0,168,107,0.75);
  box-shadow: 0 0 0 2px rgba(0,168,107,0.15) inset;
}
.layers-tabpanel[hidden]{ display:none; }

/* Layers panel: feature name + inline rename */
.feature-name{
  flex: 1;
  padding: 4px 6px;
  min-width: 0;
  cursor: text;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feature-name-input{
  flex: 1;
  width: 100%;
  font: inherit;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.25);
  color: inherit;
  outline: none;
}
.feature-name-input:focus{
  border-color: rgba(0,168,107,0.9);
}


/* --- Layers panel sizing tweaks (bigger, easier browsing) --- */
.layers-panel{
  width: 420px;
  max-height: 72vh;
}
.feature-list{
  max-height: 46vh;
}

/* Tabs should match existing TrueGIS button styling */
.layers-tabs{
  margin-bottom: 10px;
}
.layers-tabs .btn.layers-tab{
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
}
.layers-tabs .btn.layers-tab.is-active{
  border-color: rgba(0,168,107,0.75);
  box-shadow: 0 0 0 2px rgba(0,168,107,0.15) inset;
}


/* --- Fix: layers tabs active colour consistent --- */
.layers-tab.is-active{
  background: rgba(0,168,107,0.18) !important;
  border-color: rgba(0,168,107,0.75) !important;
  box-shadow: inset 0 0 0 2px rgba(0,168,107,0.15) !important;
}



.layers-tabs .layers-tab.is-active,
.layers-tabs .layers-tab[aria-selected="true"]{
  background: rgba(0,168,107,0.18) !important;
  border-color: rgba(0,168,107,0.75) !important;
  color: #fff !important;
  box-shadow: inset 0 0 0 1px rgba(0,168,107,0.35) !important;
}


/* --- Layers tabs: ACTIVE = TrueGIS green (no teal) --- */
.layers-tabs .layers-tab.is-active,
.layers-tabs .layers-tab[aria-selected="true"]{
  background: rgba(76, 175, 80, 0.22) !important;
  border-color: rgba(76, 175, 80, 0.9) !important;
  color: #ffffff !important;
  box-shadow: inset 0 0 0 1px rgba(76, 175, 80, 0.45) !important;
}


/* --- Attribute dock: keep buttons readable and avoid horizontal scrolling --- */
.attr-dock__controls {
  gap: 10px;
  flex-wrap: wrap;
}
.attrtable-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.attrtable-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
}
.attrcell-wrap {
  white-space: normal;
  overflow: hidden;
  text-overflow: clip;
}

/* --- Modal (paste coordinates) --- */
.tg-modal { position: fixed; inset: 0; z-index: 9999; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.tg-modal[hidden] { display: none; }
.tg-modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.56); }
.tg-modal__panel {
  position: relative;
  width: min(960px, calc(100vw - 32px));
  margin: 24px auto;
  background: #0f1220;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
  overflow: hidden;
  max-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
}
.tg-modal__panel--pastecoords {
  width: min(900px, calc(100vw - 32px));
  background:
    radial-gradient(circle at top right, rgba(73, 123, 255, 0.12), transparent 34%),
    linear-gradient(180deg, #101524 0%, #0b1020 100%);
}
.tg-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.tg-modal__title { font-weight: 700; font-size: 16px; }
.tg-modal__body { padding: 18px; overflow: auto; min-height: 0; }
.tg-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tg-field span { font-size: 11px; font-weight: 600; letter-spacing: 0.01em; opacity: 0.82; }
.tg-field input,
.tg-field select {
  width: 100%;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: inherit;
  padding: 0 12px;
}
.tg-input { width: 100%; }
.tg-field input:focus,
.tg-field select:focus,
.tg-textarea:focus {
  outline: none;
  border-color: rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.05);
}
.tg-field--checkbox {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
}
.tg-field--checkbox input {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 auto;
}
.tg-field--checkbox span {
  font-size: 12px;
  line-height: 1.2;
  font-weight: 600;
  opacity: 0.94;
}
.tg-textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: inherit;
  padding: 12px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.tg-modal__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.tg-modal__status { margin-top: 6px; font-size: 12px; opacity: 0.9; }
.tg-pastecoords-body {
  display: grid;
  gap: 12px;
}
.tg-pastecoords-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.tg-pastecoords-topbar__text {
  max-width: 680px;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(255,255,255,0.66);
}
.tg-pastecoords-card {
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  background: rgba(255,255,255,0.025);
  backdrop-filter: blur(6px);
}
.tg-pastecoords-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(170px, 0.7fr) minmax(170px, auto);
  gap: 12px;
  align-items: end;
}
.tg-pastecoords-type { grid-column: 1; }
.tg-pastecoords-separator { grid-column: 2; }
.tg-pastecoords-header {
  grid-column: 3;
  align-self: stretch;
  white-space: nowrap;
}
.tg-pastecoords-columns {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}
.tg-pastecoords-zone { grid-column: span 1; }
.tg-pastecoords-hint {
  grid-column: 1 / -1;
  margin: -2px 0 0;
  padding-top: 2px;
  font-size: 11px;
  line-height: 1.4;
  color: rgba(255,255,255,0.60);
}
.tg-pastecoords-grid [hidden],
.tg-pastecoords-columns [hidden] { display: none !important; }
.tg-pastecoords-textfield {
  gap: 8px;
}
.tg-pastecoords-textfield > span {
  font-size: 13px;
  font-weight: 700;
  opacity: 0.98;
}
.tg-pastecoords-textarea {
  min-height: 240px;
  max-height: min(38dvh, 340px);
  line-height: 1.45;
}
.tg-modal__actions--pastecoords {
  align-items: center;
  padding-top: 2px;
}
.tg-modal__actions--pastecoords .btn {
  min-height: 40px;
  padding: 0 14px;
}
@media (max-width: 980px) {
  .tg-modal__panel--pastecoords {
    width: min(100vw - 20px, 900px);
    margin: 10px auto;
    max-height: calc(100dvh - 20px);
  }
  .tg-pastecoords-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .tg-pastecoords-type,
  .tg-pastecoords-separator,
  .tg-pastecoords-header {
    grid-column: auto;
  }
  .tg-pastecoords-header {
    grid-column: 1 / -1;
    white-space: normal;
  }
  .tg-pastecoords-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .tg-modal {
    padding: 8px;
  }
  .tg-modal__panel--pastecoords {
    width: 100%;
    margin: 0;
    max-height: calc(100dvh - 16px);
    border-radius: 16px;
  }
  .tg-modal__header {
    padding: 14px;
    align-items: flex-start;
  }
  .tg-modal__header .btn {
    flex: 0 0 auto;
  }
  .tg-modal__body {
    padding: 14px;
  }
  .tg-pastecoords-body {
    gap: 10px;
  }
  .tg-pastecoords-card {
    padding: 12px;
    border-radius: 12px;
  }
  .tg-pastecoords-grid,
  .tg-pastecoords-columns {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .tg-pastecoords-type,
  .tg-pastecoords-separator,
  .tg-pastecoords-header {
    grid-column: 1;
  }
  .tg-pastecoords-header {
    align-self: auto;
  }
  .tg-pastecoords-topbar__text {
    font-size: 11px;
  }
  .tg-pastecoords-textfield > span {
    font-size: 12px;
  }
  .tg-pastecoords-textarea {
    min-height: 180px;
    max-height: none;
    padding: 11px;
  }
  .tg-modal__actions--pastecoords {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 2px;
    padding: 0;
    background: transparent;
  }
  .tg-modal__actions--pastecoords .btn {
    width: 100%;
    margin: 0;
    min-height: 40px;
  }
  .tg-modal__actions--pastecoords .btn:nth-child(3) {
    grid-column: 1 / -1;
  }
}
@media (max-width: 420px) {
  .tg-modal__header {
    gap: 10px;
  }
  .tg-modal__title {
    font-size: 15px;
  }
  .tg-field input,
  .tg-field select,
  .tg-field--checkbox {
    min-height: 40px;
  }
}

/* Layer manager */


/* Layer manager modal: slimmer, cleaner */
.tg-modal__panel--layers{
  width: min(760px, calc(100vw - 32px));
  background:
    radial-gradient(circle at top right, rgba(0,168,107,0.10), transparent 32%),
    linear-gradient(180deg, #10141d 0%, #0c1018 100%);
}
.tg-modal__header--layers{
  padding: 14px 16px;
}
.tg-modal__body--layers{
  padding: 14px 16px 16px;
}
.tg-modal__row--layers{
  gap: 10px;
  margin-bottom: 10px;
}
.tg-modal__panel--layers .hint{
  color: rgba(255,255,255,0.68);
  font-size: 12px;
  line-height: 1.35;
}
.layer-manager__list{
  display:flex;
  flex-direction:column;
  gap:8px;
  max-height: 50vh;
  overflow:auto;
  padding-right:2px;
}
.layer-manager__item{
  display:grid;
  grid-template-columns: 18px minmax(0,1fr) auto auto;
  align-items:center;
  gap:10px;
  padding:8px 10px;
  border:1px solid rgba(255,255,255,0.10);
  border-radius:12px;
  background: rgba(255,255,255,0.03);
}
.layer-manager__item:hover{
  background: rgba(255,255,255,0.045);
  border-color: rgba(255,255,255,0.14);
}
.layer-manager__item input[type="radio"]{
  margin:0;
  width:14px;
  height:14px;
  accent-color:#00a86b;
}
.layer-manager__item input[type="text"]{
  flex:1;
  min-width:0;
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: inherit;
}
.layer-manager__item input[type="text"]:focus{
  outline:none;
  border-color: rgba(0,168,107,0.55);
  box-shadow: 0 0 0 3px rgba(0,168,107,0.10);
  background: rgba(255,255,255,0.06);
}
.layer-manager__count,
.layer-manager__active{
  font-size:12px;
  line-height:1;
  white-space:nowrap;
}
.layer-manager__count{
  color: rgba(255,255,255,0.66);
}
.layer-manager__active{
  justify-self:start;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(0,168,107,0.14);
  border: 1px solid rgba(0,168,107,0.26);
  color: rgba(255,255,255,0.94);
  text-transform: lowercase;
}
.layer-manager__active:empty{
  display:none;
}
.layer-manager__delete{
  white-space:nowrap;
  min-height: 34px;
  padding: 0 10px;
}
#layerManagerAddBtn{
  min-height: 36px;
  padding: 0 12px;
}
#manageLayersBtn{
  min-height: 36px;
  padding-inline: 12px;
}
@media (max-width: 760px){
  .tg-modal__panel--layers{
    width: calc(100vw - 16px);
    margin: 8px auto;
    max-height: calc(100dvh - 16px);
    border-radius: 16px;
  }
  .tg-modal__row--layers{
    flex-direction: column;
    align-items: stretch !important;
  }
  .tg-modal__row--layers > *{
    width: 100%;
  }
  .layer-manager__item{
    grid-template-columns: 18px minmax(0,1fr) auto;
  }
  .layer-manager__count{
    grid-column: 2 / 4;
    justify-self: start;
  }
  .layer-manager__delete{
    grid-column: 3;
    grid-row: 2;
    justify-self: end;
  }
  .layer-manager__active{
    grid-column: 2;
    grid-row: 2;
    width: fit-content;
  }
}
@media (max-width: 520px){
  .tg-modal__body--layers{
    padding: 12px;
  }
  .layer-manager__item{
    grid-template-columns: 16px minmax(0,1fr);
    gap: 8px;
    padding: 8px;
  }
  .layer-manager__count,
  .layer-manager__active,
  .layer-manager__delete{
    grid-column: 2;
    justify-self: start;
  }
  .layer-manager__delete{
    width: 100%;
    justify-self: stretch;
  }
}

/* --- Consistent tab hover: hover should not override selected --- */
.btn.attr-tab:hover:not(.is-active){
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.18);
}


/* Keep actions stable */
.attr-actions{ white-space: nowrap; }


/* Prevent a flash of unconverted subsection accordions (JS converts to tab pills) */
html.tg-js .control-grid{ visibility: hidden; }
html.tg-js.tg-ready .control-grid{ visibility: visible; }


/* Segmented buttons (Style target) */
.segmented{ display:flex; gap:8px; background: rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.12); border-radius: 14px; padding:6px; }
.segmented__btn{ flex:1; border:none; background: transparent; color: rgba(255,255,255,0.82); padding:8px 10px; border-radius: 12px; cursor:pointer; font-weight:700; }
.segmented__btn.is-active{ background: rgba(255,255,255,0.14); color:#fff; }


.symbol-chip:focus{ outline: none; box-shadow: none; }
.symbol-chip:focus-visible{ outline: none; box-shadow: none; }


/* Basemap dropdown (toolbar) */
.layers-panel{
  position: absolute;
  top: 54px;
  right: 16px;
  z-index: 1005;
  min-width: 260px;
  background: rgba(18,18,18,0.96);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.45);
}


/* --- Crawlable content block (AdSense / SEO friendly, minimal impact on app UI) --- */
.tg-content{
  background: #0b0f12;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 24px 16px 10px;
}
.tg-content__inner{
  max-width: 980px;
  margin: 0 auto;
  color: rgba(255,255,255,0.86);
}
.tg-content__inner h2,
.tg-content__inner h3{
  color: rgba(255,255,255,0.95);
  margin: 0 0 10px;
}
.tg-content__inner h3{ margin-top: 18px; }
.tg-content__inner p{
  margin: 10px 0;
  line-height: 1.55;
}
.tg-content__inner ul{
  margin: 10px 0 0 18px;
}
.tg-content__inner li{
  margin: 6px 0;
  line-height: 1.45;
}


.back-link a{color:#32cd32;text-decoration:underline;}
.back-link a:hover{opacity:.9}
