/* Dongvile GIS viewer. Printed-map look: white paper, black rules, plain government type. Single light theme by design. */
:root {
  --paper: #ffffff;
  --ink: #1c1c1c;
  --ink-2: #4d4d4d;
  --ink-3: #7a7a7a;
  --rule: #1c1c1c;
  --rule-soft: #d4d4d0;
  --tint: #f4f4f1;
  --accent: #0a6c93;
  --focus: #0098cc;
  --font-sans: Arimo, Arial, Helvetica, sans-serif;
  --font-narrow: "Archivo Narrow", "Arial Narrow", Arial, sans-serif;
  color-scheme: light;
}
html, body { height: 100%; margin: 0; }
body { background: var(--paper); color: var(--ink); font-family: var(--font-sans); font-size: 13px; overflow: hidden; }
button, input { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
#app { position: relative; height: 100%; width: 100%; overflow: hidden; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; background: var(--paper); }
#map.dragging { cursor: grabbing; }
#neatline { position: absolute; inset: 6px; border: 1.5px solid var(--rule); pointer-events: none; z-index: 2; }

/* ---------- panel ---------- */
#panel { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); left: 14px; width: 344px; max-width: calc(100% - 28px); max-height: calc(100% - 28px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; background: var(--paper); border: 1.5px solid var(--rule); z-index: 6; }
.ph { display: flex; gap: 12px; align-items: center; padding: 12px 12px 12px 14px; border-bottom: 1.5px solid var(--rule); }
.seal { flex: none; width: 52px; height: 52px; }
.ph-text { flex: 1; min-width: 0; }
.eyebrow { font-family: var(--font-narrow); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.ph h1 { margin: 1px 0 0; font-family: var(--font-narrow); font-size: 25px; line-height: 1.05; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.ph .sub { font-size: 11.5px; color: var(--ink-2); margin-top: 2px; }
.ph .home { display: inline-block; margin-top: 3px; font-size: 11.5px; font-weight: 700; color: var(--accent); }
.ph .home:hover { color: var(--ink); }
.collapse { flex: none; width: 30px; height: 30px; border: 1px solid var(--rule); background: var(--paper); cursor: pointer; display: grid; place-items: center; }
.collapse svg { width: 12px; height: 12px; transition: transform .15s; }
#panel.closed .collapse svg { transform: rotate(180deg); }
#panelBody { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; }
#panel.closed #panelBody { display: none; }
#panel.closed .ph { border-bottom: 0; }
.sec { padding: 12px 14px; border-bottom: 1px solid var(--rule-soft); }
.sec:last-child { border-bottom: 0; }
.sec-h, details > summary { font-family: var(--font-narrow); font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); margin: 0 0 8px; }
details > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; margin: 0; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: "+"; font-family: var(--font-sans); font-weight: 400; }
details[open] > summary::after { content: "\2212"; }
details[open] > summary { margin-bottom: 8px; }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--rule); padding: 0 9px; }
.search svg { flex: none; width: 14px; height: 14px; color: var(--ink-3); }
.search input { flex: 1; min-width: 0; border: 0; padding: 8px 0; outline: none; background: transparent; font-size: 13.5px; }
#results { margin-top: 8px; max-height: 300px; overflow-y: auto; border: 1px solid var(--rule-soft); }
.grp { font-family: var(--font-narrow); font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); padding: 7px 8px 3px; background: var(--tint); border-bottom: 1px solid var(--rule-soft); position: sticky; top: 0; }
.grp span { font-family: var(--font-sans); font-weight: 400; letter-spacing: 0; color: var(--ink-3); }
.r { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--rule-soft); background: transparent; padding: 6px 8px; cursor: pointer; min-width: 0; }
.r:hover { background: #eef6fa; }
.r .n { display: block; font-weight: 700; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r .a { display: block; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { margin: 0; padding: 8px; color: var(--ink-2); font-size: 12px; }
.layers { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 5px 10px; }
.layers label { display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: 12.5px; }
.layers input { accent-color: var(--accent); margin: 0; }
#legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
#legend li { display: grid; grid-template-columns: 26px 34px 1fr; align-items: center; gap: 6px; font-size: 12px; }
#legend b { font-size: 11.5px; }
.sw { width: 26px; height: 13px; border: 1px solid var(--rule); display: block; }
.sw.hatch { background: repeating-linear-gradient(135deg, rgba(47,116,181,.8) 0 1px, #fff 1px 6px); border-color: #2f74b5; border-style: dashed; }
.sw.line { border: 0; height: 0; }
.sw.limit { border-top: 2px dashed #6a2d86; box-shadow: 0 0 0 3px rgba(150,90,180,.28); }
.sw.etj { border-top: 1.5px dashed #6f6f6f; }
.sw.rail { height: 6px; background: linear-gradient(#262626, #262626) center / 100% 1.5px no-repeat, repeating-linear-gradient(90deg, #262626 0 1.2px, transparent 1.2px 7px); }
#directory { max-height: 320px; overflow-y: auto; border: 1px solid var(--rule-soft); }
.fine { margin: 0; font-size: 11px; color: var(--ink-2); line-height: 1.5; }

/* ---------- map furniture ---------- */
#tools { position: absolute; top: calc(16px + env(safe-area-inset-top, 0px)); right: 16px; z-index: 5; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.north { width: 46px; height: 62px; }
.zoom { display: flex; flex-direction: column; border: 1.5px solid var(--rule); background: var(--paper); }
.zoom button { width: 34px; height: 34px; border: 0; background: transparent; cursor: pointer; font-size: 18px; line-height: 1; display: grid; place-items: center; }
.zoom button + button { border-top: 1px solid var(--rule); }
.zoom button:hover { background: var(--tint); }
.zoom svg { width: 15px; height: 15px; }
#scale { position: absolute; left: 380px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 4; pointer-events: none; padding: 6px 8px 4px; background: rgba(255,255,255,.9); }
.sb-bar { display: flex; height: 6px; border: 1px solid var(--rule); width: max-content; }
.sb-bar span { display: block; height: 100%; background: var(--ink); }
.sb-bar span.w { background: #fff; }
.sb-lbl { position: relative; height: 13px; font-size: 9.5px; font-variant-numeric: tabular-nums; }
.sb-lbl span { position: absolute; top: 1px; transform: translateX(-50%); }
.sb-unit { font-size: 9.5px; color: var(--ink-2); margin-top: 1px; white-space: nowrap; }
#coords { position: absolute; right: 16px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 4; font-family: var(--font-narrow); font-size: 11.5px; font-variant-numeric: tabular-nums; background: rgba(255,255,255,.92); padding: 2px 6px; pointer-events: none; white-space: nowrap; }
#coords:empty { display: none; }

/* ---------- title block ---------- */
#titleblock { position: absolute; right: 16px; bottom: calc(40px + env(safe-area-inset-bottom, 0px)); width: 300px; z-index: 5; background: var(--paper); border: 2px solid var(--rule); font-size: 11px; }
#titleblock .tb-top { padding: 8px 10px 7px; border-bottom: 1px solid var(--rule); text-align: center; }
#titleblock .tb-k { font-family: var(--font-narrow); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
#titleblock .tb-t { font-family: var(--font-narrow); font-size: 20px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; line-height: 1.1; margin-top: 2px; }
#titleblock .tb-c { font-family: var(--font-narrow); font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-top: 2px; }
#titleblock .tb-grid { display: grid; grid-template-columns: 1fr 1fr; }
#titleblock .tb-grid div { padding: 5px 8px; border-bottom: 1px solid var(--rule-soft); border-right: 1px solid var(--rule-soft); min-width: 0; }
#titleblock .tb-grid div:nth-child(2n) { border-right: 0; }
#titleblock .tb-grid i { display: block; font-style: normal; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
#titleblock .tb-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px 10px 4px; }
#titleblock .tb-sign div { border-top: 1px solid var(--rule); padding-top: 2px; font-size: 9.5px; color: var(--ink-2); }
#titleblock .tb-disc { padding: 4px 10px 8px; font-size: 9px; color: var(--ink-3); line-height: 1.4; }
#titleblock .tb-bar { display: flex; justify-content: space-between; align-items: center; padding: 3px 4px 3px 10px; border-top: 1px solid var(--rule); font-size: 9.5px; color: var(--ink-2); }
#tbToggle { border: 1px solid var(--rule); background: var(--paper); font-size: 10px; padding: 2px 8px; cursor: pointer; }
#titleblock.min { width: auto; }
#titleblock.min > :not(.tb-bar) { display: none; }
#titleblock.min .tb-bar { border-top: 0; gap: 10px; }

/* ---------- record card ---------- */
#card { position: absolute; top: calc(16px + env(safe-area-inset-top, 0px)); right: 66px; width: 330px; max-width: calc(100% - 96px); max-height: calc(100% - 200px); overflow-y: auto; z-index: 7; background: var(--paper); border: 1.5px solid var(--rule); }
.c-head { display: flex; align-items: center; justify-content: space-between; padding: 5px 6px 5px 10px; background: var(--ink); color: #fff; font-family: var(--font-narrow); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.c-x { width: 24px; height: 24px; border: 0; background: transparent; color: #fff; cursor: pointer; display: grid; place-items: center; }
.c-x svg { width: 11px; height: 11px; }
.c-title { padding: 9px 10px 7px; font-family: var(--font-narrow); font-size: 18px; font-weight: 700; line-height: 1.15; letter-spacing: .01em; border-bottom: 1px solid var(--rule); }
.c-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.c-table th { text-align: left; font-weight: 400; color: var(--ink-2); padding: 4px 8px 4px 10px; border-bottom: 1px solid var(--rule-soft); width: 38%; vertical-align: top; white-space: nowrap; font-size: 11.5px; }
.c-table td { padding: 4px 10px 4px 0; border-bottom: 1px solid var(--rule-soft); font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.c-note { margin: 0; padding: 8px 10px 10px; font-size: 12px; line-height: 1.5; color: var(--ink-2); }

@media (max-width: 760px) {
  #scale { left: 16px; bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
  #titleblock { width: auto; left: 16px; }
}
@media (max-width: 640px) {
  #panel { right: 14px; width: auto; }
  #panelBody { max-height: 58vh; }
  #card { left: 14px; right: 14px; width: auto; max-width: none; top: auto; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); max-height: 55vh; }
  #tools { top: auto; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .north { display: none; }
  #coords { display: none; }
}
