/* Dark theme: same roles, stepped for a dark surface. html[data-theme] is set by theme-boot.js. */
:root { --glass: rgba(255,255,255,.94); --row-hover: #f7f6f2; --row-sel: #fff4dc; --chip-on-bg: #fcebeb; --chip-on-border: #eba5a5; --chip-on-text: #9b1c1c; --ctl-bg: #fff; --ctl-text: #333; --grid-line: #e9e7e1; --header-h: 46px; }
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111312;
  --surface: #1a1c1b;
  --surface-2: #222524;
  --border: #323634;
  --text: #f1f1ee;
  --text-2: #b8b9b4;
  --muted: #868883;
  --accent: #bda062;
  --on-accent: #1c1608;
  --accent-2: #d9c48e;
  --accent-soft: rgba(189,160,98,.16);
  --danger: #f07167;
  --warn: #e0a740;
  --heat-zero: #2a2d2c;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.35);
  --glass: rgba(26,28,27,.92);
  --row-hover: #252827;
  --row-sel: #3a3220;
  --chip-on-bg: rgba(240,113,103,.16);
  --chip-on-border: rgba(240,113,103,.5);
  --chip-on-text: #f4a49c;
  --ctl-bg: #1f2221;
  --ctl-text: #e6e6e2;
  --grid-line: #262928;
}

/* surfaces that used fixed light colours */
.hud, .map-toolbar, .legend { background: var(--glass); }
.chip.on { background: var(--chip-on-bg); border-color: var(--chip-on-border); color: var(--chip-on-text); }
.attr-table td { border-bottom-color: var(--surface-2); }
.attr-table tbody tr:hover td { background: var(--row-hover); }
.attr-table tbody tr.sel td, .match.on { background: var(--row-sel); }
.dock-tab:hover { background: var(--surface-2); }
.measure-ctl, .measure-ctl button { background: var(--ctl-bg); color: var(--ctl-text); }
.measure-ctl button:hover { background: var(--surface-2); }
.measure-ctl button.on { background: #d97706; color: #fff; }
.measure-readout, .eb-hint { background: var(--glass); }
.eb-tools { background: var(--surface); }
.eb-btn.on { background: var(--row-sel); }
#map.no-basemap, .bm-thumb.none { background-color: var(--surface-2); background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px); }
html[data-theme="dark"] .attr-table td.calc { background: #1d201f; }
html[data-theme="dark"] .drop-overlay div { background: var(--surface); }
html[data-theme="dark"] .toast { background: #2c3130; }
html[data-theme="dark"] .modal { background: rgba(0,0,0,.6); }
html[data-theme="dark"] input[type="color"] { background: var(--surface); }
html[data-theme="dark"] select, html[data-theme="dark"] input { color-scheme: dark; }

/* Leaflet chrome */
html[data-theme="dark"] .leaflet-container { background: #1b1d1c; }
html[data-theme="dark"] .leaflet-bar a, html[data-theme="dark"] .leaflet-bar a:hover { background: var(--ctl-bg); color: var(--ctl-text); border-bottom-color: var(--border); }
html[data-theme="dark"] .leaflet-bar, html[data-theme="dark"] .measure-ctl { border-color: rgba(255,255,255,.15); }
html[data-theme="dark"] .leaflet-popup-content-wrapper, html[data-theme="dark"] .leaflet-popup-tip { background: var(--surface); color: var(--text); }
html[data-theme="dark"] .leaflet-popup-close-button { color: var(--text-2) !important; }
html[data-theme="dark"] .leaflet-control-attribution { background: rgba(26,28,27,.8) !important; color: var(--muted); }
html[data-theme="dark"] .leaflet-control-attribution a { color: var(--accent-2); }
html[data-theme="dark"] .route-arrow span { text-shadow: 0 0 2px #000, 0 0 2px #000; }

/* ---------------------------------------------------------------- one look for form controls across the platform
   (LardhGIS, simulations, dashboards, ETL, 3D maps, layouts, popups): the same font, text colour, surface, border and corners.
   Sizes and paddings stay with each component. */
html body :is(select, textarea, input[type="text"], input[type="number"], input[type="search"], input[type="email"], input[type="password"], input[type="time"], input[type="date"], input[type="url"], input:not([type])) {
  font-family: inherit; color: var(--text); background-color: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
html body :is(select, textarea, input[type="text"], input[type="number"], input[type="search"], input[type="email"], input[type="password"], input[type="time"], input[type="date"], input[type="url"], input:not([type])):focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none;
}
html body :is(select, textarea, input):disabled { opacity: .55; cursor: not-allowed; }
html body :is(input, textarea)::placeholder { color: var(--muted); opacity: 1; }
html body select option, html body select optgroup { background: var(--surface); color: var(--text); font-family: inherit; }
html body select option:checked { background: var(--accent-soft); color: var(--text); }
html body :is(button, .btn, .mini-btn) { font-family: inherit; }
html body :is(.btn, .mini-btn):not(.primary):not(.danger):not(.danger-solid) { color: var(--text); }
html body .btn.danger-solid, html body .btn.danger-solid:hover { color: #fff; }
/* inputs that sit inside a styled box (search fields, value boxes) keep their transparent look */
html body :is(.list-filter, .symp-search, .cg-search, .etl-rg-search, .g-search, .ifield-box) :is(input, input[type="search"]) { border: 0; background: transparent; box-shadow: none; }
html body .name-input:not(:focus) { border-color: transparent; background: transparent; }
html body .group-head .group-name[readonly] { border-color: transparent; background: transparent; box-shadow: none; }

/* ------------------------------------------------------------ one slider design everywhere */
html body input[type="range"]:not([orient="vertical"]) { -webkit-appearance: none; appearance: none; height: 16px; min-width: 0; margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; cursor: pointer; accent-color: var(--accent); vertical-align: middle; }
html body input[type="range"]:not([orient="vertical"]):focus { outline: none; box-shadow: none; border: 0; }
html body input[type="range"]:not([orient="vertical"])::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--p, 50%), var(--border) var(--p, 50%)); }
html[dir="rtl"] body input[type="range"]:not([orient="vertical"])::-webkit-slider-runnable-track { background: linear-gradient(to left, var(--accent) var(--p, 50%), var(--border) var(--p, 50%)); }
html body input[type="range"]:not([orient="vertical"])::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--accent), 0 1px 3px rgba(0,0,0,.25); transition: transform .12s ease; }
html body input[type="range"]:not([orient="vertical"]):hover::-webkit-slider-thumb { transform: scale(1.12); }
html body input[type="range"]:not([orient="vertical"]):focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 1px var(--accent), 0 0 0 5px var(--accent-soft); }
html body input[type="range"]:not([orient="vertical"])::-moz-range-track { height: 4px; border-radius: 4px; background: var(--border); }
html body input[type="range"]:not([orient="vertical"])::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
html body input[type="range"]:not([orient="vertical"])::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--accent); }
html body input[type="range"]:not([orient="vertical"]):disabled { opacity: .5; cursor: not-allowed; }
/* the two-handle range (dashboards): one shared track drawn by the container, handles only */
html body .db-range-track input[type="range"] { position: absolute; inset: 0; width: 100%; height: 22px; pointer-events: none; }
html body .db-range-track input[type="range"]::-webkit-slider-runnable-track { background: var(--border); }
html body .db-range-track input[type="range"]:last-child::-webkit-slider-runnable-track { background: transparent; }
html body .db-range-track input[type="range"]::-webkit-slider-thumb { pointer-events: auto; }
html body .db-range-track input[type="range"]::-moz-range-thumb { pointer-events: auto; }
html body .db-range-track input[type="range"]::-moz-range-progress { background: transparent; }

/* ------------------------------------------------------------ dropdown lists in the app's style (ui-select.js) */
.ui-list { position: fixed; z-index: 100001; overflow-y: auto; padding: 4px; border-radius: 10px; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  box-shadow: 0 14px 34px -12px rgba(0,0,0,.35); font: 12.5px/1.3 var(--font); scrollbar-width: thin; animation: uiListIn .12s ease-out; }
@keyframes uiListIn { from { opacity: 0; transform: translateY(-3px); } }
.ui-list button { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 28px; padding: 5px 9px; border: 0; border-radius: 6px; background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.ui-list button span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-list button:not(:has(span)) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.ui-list button:hover, .ui-list button:focus-visible { background: var(--surface-2); outline: none; }
.ui-list button.on { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.ui-list button.on::after { content: '✓'; margin-inline-start: auto; padding-inline-start: 8px; color: var(--accent); font-weight: 700; }
.ui-list button:not(:has(span)).on::after { float: inline-end; }
.ui-list button:disabled { opacity: .45; cursor: default; }
.ui-list small { color: var(--muted); font-size: 11px; flex: none; }
.ui-list .ui-grp { padding: 6px 9px 3px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.ui-list .ui-empty { margin: 6px 9px; color: var(--muted); font-size: 12px; }
html body select.ui-open { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ------------------------------------------------------------ scrolling checkbox / item lists: rows keep their full height and the list scrolls
   (in a fixed-height flex column the rows would otherwise shrink and overlap when there are many fields) */
:is(.dp-list, .sym-classes, .gp-layers, .gp-fields, .db-checklist, .dz-checks, .ch-checks, .fc-fields, .lb-fns, .ct-list, .lo-checks, .lo-picklist, .pp-list, .etl-fields-pop) > * { flex-shrink: 0; }
:is(.dp-list, .gp-layers, .gp-fields, .db-checklist, .dz-checks, .ch-checks, .fc-fields, .pp-list) { overscroll-behavior: contain; scrollbar-width: thin; }
.dp-row { min-height: 28px; font-size: 13px; }
.dp-row .ellipsis { font-size: 13px; }
.dp-row input[type="checkbox"] { width: 15px; height: 15px; flex: none; }
.dp-row:hover { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.ex-fields { max-height: 260px; }

/* vertical sliders (3D map tilt) keep the browser's vertical slider, in the accent colour */
html body input[type="range"][orient="vertical"] { writing-mode: vertical-lr; direction: rtl; -webkit-appearance: auto; appearance: auto; accent-color: var(--accent); background: none; border: 0; box-shadow: none; padding: 0; cursor: ns-resize; }

/* the checklist of values ("includes any of" conditions) */
.ui-list.ui-multi { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.ui-multi .um-head { flex: none; padding: 8px 8px 4px; border-bottom: 1px solid var(--border); }
.ui-multi .um-q { width: 100%; box-sizing: border-box; height: 30px; padding: 4px 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; }
.ui-multi .um-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 5px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.ui-multi .um-link { all: unset; cursor: pointer; color: var(--accent-2); font-weight: 600; }
.ui-multi .um-link:hover { text-decoration: underline; }
.ui-multi .um-items { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px; }
.ui-multi .um-row { display: flex; align-items: center; gap: 8px; flex-shrink: 0; min-height: 28px; padding: 4px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.ui-multi .um-row:hover { background: var(--surface-2); }
.ui-multi .um-row input { margin: 0; width: 14px; height: 14px; flex: none; accent-color: var(--accent); }
.ui-multi .um-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-multi .um-row:has(input:checked) { background: var(--accent-soft); }
.ui-multi .um-foot { flex: none; display: flex; justify-content: flex-end; padding: 6px 8px; border-top: 1px solid var(--border); }
.ui-multi .um-done { padding: 4px 14px; border: 0; border-radius: 6px; background: var(--accent); color: var(--on-accent); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
input.fp-multi { cursor: pointer; text-overflow: ellipsis; }

/* every scroll bar, native control and text selection in the brand gold */
:root { accent-color: var(--accent); }
::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--accent) 50%, transparent); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; min-height: 36px; }
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--accent) 80%, transparent); }
::-webkit-scrollbar-thumb:active { background-color: var(--accent); }

/* no map attribution strip (Leaflet / tile credits) */
.leaflet-control-attribution, .maplibregl-ctrl-attrib, .maplibregl-ctrl-attrib-button { display: none !important; }
