/* CAMA additions on top of soft-ui.css. Only the tokens from soft-ui are used
   for color, radius and shadow, so light and dark both follow. */

:root {
  --brand-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 42 38'%3E%3Cpath d='M3 3h16v14H3zM23 3h16v14H23zM3 21h16v14H3zM23 21h9l7 7v7H23z'/%3E%3C/svg%3E");
}
.icon { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-sprite { position: absolute; }

/* Sign-in */
.login-brand { display: inline-flex; align-items: center; gap: 12px; }
.login-brand .brand-name { font-size: 1.5rem; }
.login-notice { margin-bottom: 18px; }

/* Records list */
.record-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main main" "type value"; padding: 12px 16px; gap: 8px 12px; }
.record-type { grid-area: type; justify-self: start; }
.record-value { grid-area: value; justify-self: end; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; font-variant-numeric: tabular-nums; }
.record-value span { color: var(--text-3); font-size: .8125rem; font-weight: 700; }
@media (min-width: 900px) {
  .record-row { grid-template-columns: minmax(0, 1fr) 190px 150px; grid-template-areas: "main type value"; gap: 16px; }
}
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stat-value { white-space: nowrap; }

/* Property record */
.table-wrap { overflow-x: auto; }
.value-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.value-table th, .value-table td { padding: 10px 12px; text-align: right; white-space: nowrap; }
.value-table th[scope="row"], .value-table thead th:first-child { text-align: left; }
.value-table thead th { color: var(--text-3); font-size: .875rem; font-weight: 700; }
.value-table tbody th { color: var(--text-2); font-weight: 700; }
.value-table tbody td { color: var(--text); font-weight: 700; }
.value-table tbody tr { border-top: 1px solid var(--border); }
.value-table tfoot tr { border-top: 2px solid var(--border-strong); }
.value-table tfoot th, .value-table tfoot td { color: var(--text); font-weight: 900; font-size: 1.0625rem; }
.details-after { margin-top: 18px; }
.details-one { grid-template-columns: 1fr; }

/* ---------------------------------------------------------------- the map */
body.is-map { height: 100dvh; overflow: hidden; }
.map-shell { position: fixed; inset: var(--topbar-h) 0 0 0; --map-top: 12px; }
#map { position: absolute; inset: 0; background: var(--surface-3); }
@media (min-width: 900px) {
  /* The map runs under the floating nav pill; panels start below it. */
  .map-shell { inset: 0; --map-top: calc(var(--topbar-h) + 30px); }
}

.map-left { position: absolute; z-index: 5; top: var(--map-top); left: 12px; width: min(380px, calc(100% - 24px)); display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.map-left > * { pointer-events: auto; }
@media (min-width: 900px) { .map-left { left: var(--gutter); } }

.map-search { display: flex; align-items: center; gap: 10px; padding: 0 8px 0 18px; background: var(--surface); border-radius: var(--pill); box-shadow: var(--shadow-md); color: var(--text-3); }
.map-search:focus-within { box-shadow: var(--shadow-md), var(--ring); }
.map-search input:not([type="checkbox"]):not([type="radio"]) { flex: 1; min-width: 0; min-height: 50px; padding: 0 8px 0 0; border: 0; background: transparent; box-shadow: none; }
.map-search input:focus-visible { box-shadow: none; }

.map-results { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 8px; max-height: min(60dvh, 460px); overflow-y: auto; }
.map-result { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-radius: var(--radius-md); background: transparent; text-align: left; cursor: pointer; }
.map-result:hover, .map-result.is-active { background: var(--surface-3); }
.map-result-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.map-result-title { color: var(--text); font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-result-sub { color: var(--text-2); font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-result-empty { padding: 12px; color: var(--text-2); }

.map-layers { align-self: flex-start; max-width: 100%; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-md); }
.map-layers summary { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--pill); color: var(--text); font-weight: 800; font-size: .9375rem; cursor: pointer; list-style: none; }
.map-layers summary::-webkit-details-marker { display: none; }
.map-layers summary:focus-visible { border-radius: var(--pill); }
.map-layers-body { padding: 0 16px 14px; }
.map-layers-body .subhead { margin: 8px 0 8px; }
.map-layers .seg-control { box-shadow: none; background: var(--surface-3); }
.map-layers .seg-btn { padding: 0 12px; }
.map-layers .seg-btn.is-active { background: var(--primary); color: var(--on-primary); }
.map-layers .check { display: flex; }
.layer-note { color: var(--text-3); font-size: .8125rem; font-weight: 600; margin-left: auto; }

.map-hint { position: absolute; z-index: 4; left: 50%; bottom: 28px; transform: translateX(-50%); padding: 8px 16px; border-radius: var(--pill); background: var(--surface); color: var(--text); box-shadow: var(--shadow-md); font-weight: 800; font-size: .875rem; white-space: nowrap; }

/* The record panel: a sheet from the bottom on phones, a side panel from 900px. */
.map-record { position: absolute; z-index: 6; left: 0; right: 0; bottom: 0; max-height: 62dvh; overflow-y: auto; padding: 18px 18px calc(env(safe-area-inset-bottom) + 18px); background: var(--surface); border-radius: 28px 28px 0 0; box-shadow: var(--shadow-lg); }
@media (min-width: 900px) {
  .map-record { left: auto; right: var(--gutter); top: var(--map-top); bottom: 28px; width: 420px; max-height: none; padding: 22px; border-radius: var(--radius); }
}
.rec-head { display: flex; align-items: flex-start; gap: 10px; }
.rec-head-main { flex: 1; min-width: 0; }
.rec-head h2 { font-size: 1.375rem; line-height: 1.2; overflow-wrap: anywhere; margin-top: 8px; }
.rec-head p { margin-top: 2px; }
.rec-values { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.rec-value { padding: 12px 14px; border-radius: 16px; background: var(--surface-2); }
.rec-value b { display: block; font-size: 1.25rem; font-weight: 900; line-height: 1.2; font-variant-numeric: tabular-nums; }
.rec-value span { color: var(--text-3); font-size: .8125rem; font-weight: 700; }
.rec-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.rec-section h3 { margin-bottom: 12px; }
.rec-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.rec-others { display: flex; flex-direction: column; gap: 6px; }
.rec-other { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border: 0; border-radius: var(--radius-md); background: var(--surface-2); text-align: left; cursor: pointer; }
.rec-other:hover { background: var(--surface-3); }
.rec-other-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rec-other-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-other-text span { color: var(--text-2); font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-loading { padding: 28px 0; text-align: center; color: var(--text-2); font-weight: 700; }

/* MapLibre's own controls, in the house style */
.maplibregl-map { font: inherit; }
.maplibregl-ctrl-group { border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-md) !important; overflow: hidden; }
.maplibregl-ctrl-group button { width: 40px; height: 40px; background-color: var(--surface); }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--border); }
[data-theme="dark"] .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) hue-rotate(180deg); }
.maplibregl-ctrl-attrib { border-radius: 12px !important; background: color-mix(in srgb, var(--surface) 85%, transparent) !important; color: var(--text-2); font-size: .6875rem; }
.maplibregl-ctrl-attrib a { color: var(--text-2); }
.maplibregl-ctrl-scale { border-color: var(--text-2); background: color-mix(in srgb, var(--surface) 80%, transparent); color: var(--text); font-weight: 700; }
@media (min-width: 900px) {
  .maplibregl-ctrl-bottom-right { right: calc(var(--gutter) - 10px); bottom: 18px; }
  .maplibregl-ctrl-bottom-left { left: calc(var(--gutter) - 10px); bottom: 18px; }
  .has-record .maplibregl-ctrl-bottom-right { right: calc(var(--gutter) + 430px); }
}
