/* =====================================================================
 * records-viewer.css — Precisio records viewer (v1.61.0)
 * Every selector is prefixed rv- so nothing collides with the staff
 * stylesheet or the portal. Colours resolve from the portal tokens.
 * ===================================================================== */
.rv {
  --rv-bg: var(--pp-bg, #0E1116);
  --rv-panel: var(--pp-surface, #151B22);
  --rv-raised: var(--pp-surface-raised, #1B232C);
  --rv-line: var(--pp-line, #2A333E);
  --rv-text: var(--pp-text, #E9EEF3);
  --rv-muted: var(--pp-text-muted, #8B97A4);
  --rv-accent: var(--pp-accent, #FFB627);
  --rv-bad: var(--pp-bad, #E5484D);
  display: flex; flex-direction: column;
  height: 560px; min-height: 420px;
  background: var(--rv-bg); color: var(--rv-text);
  border: 1px solid var(--rv-line); border-radius: var(--pp-r-md, 10px);
  overflow: hidden; font-family: var(--pp-font-body, system-ui, sans-serif); font-size: 13px;
}
.rv--full { position: fixed; inset: 0; z-index: 4000; height: auto; border-radius: 0; border: 0; }
.rv-overlay { position: fixed; inset: 0; z-index: 4000; background: var(--pp-bg, #0E1116); }
.rv-overlay > .rv { height: 100%; border-radius: 0; border: 0; }
body.rv-noscroll { overflow: hidden; }

/* ---- toolbar ---- */
.rv-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 8px 12px; background: var(--rv-panel); border-bottom: 1px solid var(--rv-line); }
.rv-title { display: flex; flex-direction: column; min-width: 0; }
.rv-eyebrow { font-family: var(--pp-font-mono, ui-monospace, monospace); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--rv-muted); }
.rv-site { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.rv-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rv-toolgroup { display: flex; gap: 4px; }
.rv-btn, .rv-seg { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  background: var(--rv-raised); color: var(--rv-text); border: 1px solid var(--rv-line); border-radius: 6px;
  font: inherit; font-size: 12px; cursor: pointer; }
.rv-btn:hover, .rv-seg:hover { border-color: var(--rv-muted); }
.rv-btn[aria-pressed="true"], .rv-btn[aria-expanded="true"], .rv-seg[aria-pressed="true"] { border-color: var(--rv-accent); color: var(--rv-accent); }
.rv-btn:focus-visible, .rv-seg:focus-visible, .rv-link:focus-visible, .rv-icon-btn:focus-visible { outline: 2px solid var(--rv-accent); outline-offset: 1px; }
.rv-segs { display: flex; }
.rv-segs .rv-seg { border-radius: 0; margin-left: -1px; }
.rv-segs .rv-seg:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.rv-segs .rv-seg:last-child { border-radius: 0 6px 6px 0; }

/* ---- body ---- */
.rv-body { flex: 1; display: grid; grid-template-columns: 300px 1fr; min-height: 0; }
.rv-side { overflow-y: auto; background: var(--rv-panel); border-right: 1px solid var(--rv-line); padding: 10px 12px 14px; }
.rv-mapwrap { position: relative; min-height: 0; }
.rv-map { position: absolute; inset: 0; background: #0B0F14; }
.rv-crosshair, .rv-crosshair .leaflet-interactive { cursor: crosshair !important; }
@media (max-width: 760px) {
  .rv { height: 620px; }
  .rv-body { grid-template-columns: 1fr; grid-template-rows: 1fr 220px; }
  .rv-side { order: 2; border-right: 0; border-top: 1px solid var(--rv-line); }
  .rv-site { max-width: 80vw; }
}

.rv-side-head { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--rv-line); margin-bottom: 8px; }
.rv-side-title { font-family: var(--pp-font-mono, ui-monospace, monospace); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--rv-muted); }
.rv-sec { margin: 10px 0 4px; }
.rv-sec-title { margin: 0 0 6px; font-size: 11px; font-weight: 600; color: var(--rv-muted); text-transform: uppercase; letter-spacing: .08em; }
.rv-layer { padding: 8px; border: 1px solid var(--rv-line); border-radius: 8px; margin-bottom: 6px; background: var(--rv-raised); }
.rv-layer--draft { border-style: dashed; border-color: var(--rv-accent); }
.rv-layer-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.rv-layer-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-layer-meta { color: var(--rv-muted); font-size: 11px; margin: 3px 0 0 24px; }
.rv-draft { color: var(--rv-accent); font-size: 11px; margin: 3px 0 0 24px; }
.rv-layer-acts { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 0 24px; }
.rv-link { background: none; border: 0; padding: 0; color: var(--pp-info, #3E8BFF); font: inherit; font-size: 11px; cursor: pointer; text-decoration: none; }
.rv-link:hover { text-decoration: underline; }
.rv-link--bad { color: var(--rv-bad); }
.rv-icon-btn { background: none; border: 1px solid transparent; color: var(--rv-muted); border-radius: 6px; width: 24px; height: 24px; display: inline-grid; place-items: center; cursor: pointer; flex: none; }
.rv-icon-btn:hover { border-color: var(--rv-line); color: var(--rv-text); }
.rv-check { display: flex; align-items: center; gap: 8px; cursor: pointer; min-width: 0; }
.rv-check input { accent-color: var(--rv-accent); margin: 0; flex: none; }
.rv-swatch { width: 14px; height: 4px; border-radius: 2px; flex: none; }
.rv-swatch--sm { width: 10px; }
.rv-swatch--aoi { background: transparent; border-top: 2px dashed var(--rv-accent); height: 0; }
.rv-sublist { margin: 8px 0 0 24px; padding-top: 6px; border-top: 1px solid var(--rv-line); display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.rv-sub-bulk { display: flex; gap: 12px; margin-bottom: 2px; }
.rv-sub { font-size: 12px; }
.rv-sub-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-sub-n { color: var(--rv-muted); font-family: var(--pp-font-mono, ui-monospace, monospace); font-size: 10px; }
.rv-empty { color: var(--rv-muted); font-size: 12px; line-height: 1.5; }
.rv-empty p { margin: 6px 0; }
.rv-caveat { display: flex; gap: 8px; margin-top: 14px; padding: 10px; border-radius: 8px; background: rgba(62, 139, 255, .08); color: var(--rv-muted); font-size: 11px; line-height: 1.45; }
.rv-caveat p { margin: 0 0 4px; }
.rv-caveat svg { flex: none; margin-top: 2px; }
.rv-caveat-small { opacity: .8; }

/* ---- floating readouts + panels ---- */
.rv-readout { position: absolute; left: 10px; bottom: 10px; z-index: 500; pointer-events: none;
  background: rgba(13, 17, 23, .82); color: #C9D1D9; border-radius: 6px; padding: 3px 8px;
  font-family: var(--pp-font-mono, ui-monospace, monospace); font-size: 11px; }
.rv-readout:empty { display: none; }
.rv-measure-out { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 500;
  background: rgba(13, 17, 23, .9); color: var(--rv-accent); border: 1px solid var(--rv-accent); border-radius: 6px; padding: 4px 10px; font-size: 12px; }
.rv-panel { position: absolute; right: 10px; top: 10px; z-index: 600; width: min(340px, calc(100% - 20px)); max-height: calc(100% - 20px); overflow-y: auto;
  background: var(--rv-panel); border: 1px solid var(--rv-line); border-radius: 10px; padding: 12px; box-shadow: var(--pp-shadow-md, 0 10px 28px -12px rgba(0,0,0,.6)); }
.rv-panel > div { display: flex; flex-direction: column; gap: 8px; }
.rv-panel-head { display: flex !important; flex-direction: row !important; align-items: center; justify-content: space-between; }
.rv-dl-fmts { display: flex; flex-direction: column; gap: 6px; }
.rv-dl { display: grid; grid-template-columns: 16px 1fr; column-gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--rv-line); border-radius: 8px; color: var(--rv-text); text-decoration: none; background: var(--rv-raised); }
.rv-dl:hover { border-color: var(--rv-accent); }
.rv-dl--off { opacity: .45; pointer-events: none; }
.rv-dl-name { font-weight: 600; }
.rv-dl-note { grid-column: 2; color: var(--rv-muted); font-size: 11px; }
.rv-dl-list { display: flex; flex-direction: column; gap: 4px; }
.rv-small { color: var(--rv-muted); font-size: 11px; line-height: 1.45; margin: 0; }
.rv-input { width: 100%; box-sizing: border-box; height: 32px; padding: 0 8px; background: var(--rv-bg); color: var(--rv-text); border: 1px solid var(--rv-line); border-radius: 6px; font: inherit; }
.rv-file { color: var(--rv-muted); font-size: 12px; }
.rv-btnrow { display: flex; gap: 8px; }
.rv-status { font-size: 12px; color: var(--rv-text); min-height: 1em; }

/* ---- map content ---- */
/* v1.66.2 — dark basemap = free OSM tiles inverted (no keyed dark tile service) */
.rv-tiles-dark { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.35); }
.rv-lbl { background: none; border: 0; }
.rv-lbl-txt { display: inline-block; white-space: nowrap; transform-origin: 0 50%; font: 600 11px/1 var(--pp-font-body, system-ui, sans-serif);
  text-shadow: 0 0 3px rgba(0, 0, 0, .9), 0 0 2px rgba(0, 0, 0, .9); pointer-events: none; }
.rv[data-basemap="streets"] .rv-lbl-txt { text-shadow: 0 0 3px #fff, 0 0 2px #fff; }
.leaflet-tooltip.rv-bh-label { background: rgba(13, 17, 23, .85); color: #FDE68A; border: 1px solid rgba(245, 158, 11, .6); border-radius: 4px;
  padding: 1px 5px; font: 600 11px/1.3 var(--pp-font-mono, ui-monospace, monospace); box-shadow: none; }
.leaflet-tooltip.rv-bh-label::before { display: none; }
.rv-popup .leaflet-popup-content-wrapper { background: var(--pp-surface, #151B22); color: var(--pp-text, #E9EEF3); border-radius: 8px; }
.rv-popup .leaflet-popup-tip { background: var(--pp-surface, #151B22); }
.rv-pop { font-size: 12px; }
.rv-pop-kind { font-family: var(--pp-font-mono, ui-monospace, monospace); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--pp-text-muted, #8B97A4); margin-bottom: 6px; }
.rv-pop dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; }
.rv-pop dt { color: var(--pp-text-muted, #8B97A4); }
.rv-pop dd { margin: 0; word-break: break-word; }
.rv-pop-caveat { margin: 8px 0 0; font-size: 11px; color: var(--pp-text-muted, #8B97A4); }

/* ---- staff: client portals page ---- */
.rvp-grid { display: grid; gap: 14px; }
.rvp-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rvp-table th { text-align: left; font-weight: 600; color: var(--muted, #8B97A4); padding: 6px 8px; border-bottom: 1px solid var(--line, #2A333E); white-space: nowrap; }
.rvp-table td { padding: 6px 8px; border-bottom: 1px solid var(--line, #2A333E); vertical-align: middle; }
.rvp-table tr.rvp-org td { background: rgba(255, 255, 255, .03); font-weight: 600; }
.rvp-num { font-family: var(--pp-font-mono, ui-monospace, monospace); text-align: right; }
.rvp-tag { display: inline-block; padding: 1px 6px; border-radius: 999px; font-size: 10px; border: 1px solid var(--line, #2A333E); color: var(--muted, #8B97A4); }
.rvp-tag--warn { border-color: var(--warn, #FFB627); color: var(--warn, #FFB627); }

/* v1.62.0 — viewer locked behind a plan */
.rv--locked { height: auto; min-height: 0; }
.rv-locked { padding: 28px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--rv-text); }
.rv-locked h3 { margin: 4px 0 0; font-size: 16px; }
.rv-locked p { margin: 0; max-width: 560px; color: var(--rv-muted); line-height: 1.5; }
.rv-locked svg { color: var(--rv-accent); }
.rvp-table th.rvp-num { text-align: right; }   /* v1.63.0 — numeric headers sit over their figures */

/* v1.70.0 — site constraints (Ireland) */
.rv-sc .rv-sc-tg { margin: 3px 0; font-size: 12px; }
.rv-sc-g { padding: 7px 0; border-top: 1px solid rgba(127,127,127,.18); font-size: 12px; line-height: 1.4; }
.rv-sc-g b { display: block; font-size: 12px; }
.rv-sc-line { color: var(--rv-muted); }
.rv-sc-flag b, .rv-sc-note { color: #f5a524; }
.rv-sc-note { font-size: 11px; font-weight: 600; }
.rv-sc-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.rv-sc-links a, .rv-sc-kml { font-size: 11.5px; color: var(--rv-accent); text-decoration: none; font-weight: 600; }
.rv-sc-links a:hover, .rv-sc-kml:hover { text-decoration: underline; }
.rv-sc-search { font-size: 11.5px; flex-basis: 100%; }
.rv-sc-search code { font-size: 11.5px; padding: 1px 4px; border-radius: 3px; background: var(--rv-chip, rgba(127,127,127,.15)); user-select: all; }
.rv-sc-copy { margin-left: 6px; font: inherit; font-size: 11px; padding: 1px 6px; border-radius: 4px; border: 1px solid currentColor; background: none; color: var(--rv-accent); cursor: pointer; }
.rv-sc-kml { display: inline-block; margin: 8px 0 4px; }

/* v1.71.0 — site constraints colour keys, symbols, documents */
.rv-sc-leg { margin: 2px 0 8px 24px; display: grid; gap: 3px; }
.rv-sc-leg-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; line-height: 1.3; }
.rv-sc-leg-row img { flex: none; border: 1px solid rgba(127,127,127,.35); border-radius: 2px; }
.rv-sc-leg-wait { font-size: 11px; color: var(--rv-muted); }
.rv-sc-more { justify-self: start; background: none; border: 0; padding: 2px 0; color: var(--rv-accent); font: inherit; font-size: 11px; cursor: pointer; }
.rv-sc-sym { flex: none; width: 12px; height: 12px; background: var(--c); border: 1px solid #0B0F14; }
.rv-sc-sym--circle { border-radius: 50%; }
.rv-sc-sym--diamond { transform: rotate(45deg) scale(.82); }
.rv-sc-sym--triangle { border: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.rv-sc-sym--area { background: transparent; border: 1.5px dashed var(--c); }
.rv-sc-sym--parcel { background: transparent; border: 1.5px solid var(--c); }
.rv-sc-doc { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; padding: 5px 0; border-top: 1px dashed rgba(127,127,127,.2); }
.rv-sc-doc-t { font-weight: 600; font-size: 11.5px; grid-column: 1; }
.rv-sc-doc .rv-sc-line { grid-column: 1; font-size: 11px; }
.rv-sc-dl { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 11.5px; font-weight: 600; color: var(--rv-accent); text-decoration: none; white-space: nowrap; }
.rv-sc-dl:hover { text-decoration: underline; }
.rv-sc-small { font-size: 10.5px; line-height: 1.4; color: var(--rv-muted); margin: 6px 0; }

/* v1.74.1 — site summary + zoning key */
.rv-vd{border:1px solid var(--rv-line,#2a3442);border-radius:10px;padding:10px;margin:8px 0 12px;display:flex;flex-direction:column;gap:6px}
.rv-vd-row{display:flex;gap:8px;align-items:flex-start;font-size:12px;line-height:1.35}
.rv-vd-t{display:flex;flex-direction:column}
.rv-vd-t b{font-size:12px}
.rv-zone-sw{display:inline-block;width:18px;height:12px;border:1px solid rgba(0,0,0,.35);border-radius:2px;flex:none}
/* v1.78.6 — one switch per feature type */
.rv-sc-sub { margin: 10px 0 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .7; }
.rv-sc .rv-sc-feat { display: flex; align-items: center; gap: 7px; padding-left: 2px; }
.rv-sc .rv-sc-feat .rv-sc-sym { margin: 0 1px; }
/* v1.85.0 — borehole search distance */
.rv-sc-bh { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: 4px 0; }
.rv-sc-bhsel { font: inherit; font-size: 12px; padding: 2px 4px; border-radius: 4px; border: 1px solid currentColor; background: transparent; color: inherit; }
.rv-sc-bhsel option { color: #111; }

/* ---- v1.89.0 large drawings + sharing ---- */
.rv-progress { height: 5px; background: rgba(127,127,127,.25); border-radius: 3px; margin: 6px 0 2px 24px; overflow: hidden; }
.rv-progress-bar { height: 100%; background: var(--rv-accent); border-radius: 3px; transition: width .4s ease; }
.rv-draft--bad { color: #F0736A; }
.rv-tilecanvas { z-index: 410; }
.rv-add textarea.rv-input { resize: vertical; font: inherit; }
.rv-shared-note { font-size: 12px; opacity: .8; padding: 6px 10px; }
.rv-btn[hidden], .rv-link[hidden] { display: none !important; }

/* v1.95.0 — linetype sample beside a CAD layer name ("___ W D ___") */
.rv-lt-sample { display: inline-flex; align-items: center; margin-left: 6px; flex: 0 0 auto; opacity: .95; }
.rv-lt-sample svg { display: block; }
.rv-glyphcanvas { z-index: 2; }

/* ---- v1.95.2 sets: several files under one name ---- */
.rv-set { border-left: 3px solid var(--rv-accent, #2AD4E6); }
.rv-set-files { margin-top: 8px; padding-left: 10px; border-left: 1px dashed var(--rv-line); }
.rv-set-files .rv-layer { background: transparent; }

/* ---- v1.95.3 sheet sets: the DXFs inside one zip, listed under the layer ---- */
.rv-sheets { margin: 6px 0 2px; padding-left: 10px; border-left: 1px dashed var(--rv-line); font-size: 12px; }
.rv-sheet { display: flex; align-items: baseline; gap: 8px; padding: 2px 0; }
.rv-sheet-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-sheet-what { flex: 0 1 auto; opacity: .75; white-space: nowrap; }
.rv-sheet .rv-link { flex: 0 0 auto; font-size: 12px; }
.rv-sheet--out .rv-sheet-name, .rv-sheet--out .rv-sheet-what { opacity: .5; text-decoration: line-through; }
.rv-sheet--bad .rv-sheet-what { color: var(--rv-bad, #ff7a7a); opacity: 1; }
