/* Paper Trail Ohio. 8px grid, type scale 12/14/15/18/24/32, square-ish corners. */
:root {
  color-scheme: light dark;
  --paper: #F6F3EA; --ink: #1D1C18; --muted: #5F5B50; --rule: #DAD4C4; --edge: #A9A290; --card: #FFFFFF;
  --accent: #2F5D50; --accent-ink: #FFFFFF; --accent-soft: #E3EEE9;
  --warn: #A8503A; --warn-bg: #FBEDE8; --chip: #EAE5D7; --hit: #FFF1B8; --shadow: 0 8px 30px rgba(20,19,15,.16);
  --t-deed: #2F5D50; --b-deed: #E3EEE9; --t-mtg: #3A5A8C; --b-mtg: #E6ECF6; --t-lien: #A8503A; --b-lien: #FBEDE8;
  --t-lease: #7A5A1E; --b-lease: #F5EDD9; --t-rel: #4F6B3A; --b-rel: #EAF1E1; --t-other: #5F5B50; --b-other: #EEEAE0;
  --tab-h: 64px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); font-size: 15px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171612; --ink: #EEEADF; --muted: #ABA597; --rule: #34312A; --edge: #5A564B; --card: #22201B;
    --accent: #7FB3A2; --accent-ink: #0F1F1A; --accent-soft: #23352F; --warn: #E39A84; --warn-bg: #3A241D; --chip: #2E2B24; --hit: #5B4A12;
    --t-deed: #8FC7B4; --b-deed: #1F3530; --t-mtg: #9DB8E6; --b-mtg: #1F2A3D; --t-lien: #E9A58F; --b-lien: #3A241D;
    --t-lease: #E2C27E; --b-lease: #3A3020; --t-rel: #B5D29A; --b-rel: #26321D; --t-other: #ABA597; --b-other: #2B2923;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--paper); }
body { display: flex; flex-direction: column; overscroll-behavior-y: contain; }
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 13px; }
.muted { color: var(--muted); font-size: 14px; }
.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* header + tabs */
.top { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--rule); background: var(--paper); position: relative; z-index: 6; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; color: var(--ink); text-decoration: none; letter-spacing: -.01em; white-space: nowrap; }
.brand .mark { width: 26px; height: 26px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 14px; }
.brand span { color: var(--accent); }
.tabs { display: flex; gap: 4px; }
.tabs button { display: flex; align-items: center; gap: 6px; border: 0; background: none; min-height: 44px; padding: 0 12px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--chip); color: var(--ink); }
.acct-btn { margin-left: auto; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--edge); background: var(--card); cursor: pointer; font-weight: 600; white-space: nowrap; }
.acct-btn .avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 13px; }

main { flex: 1; position: relative; min-height: 0; overflow: auto; }
.view { max-width: 920px; margin: 0 auto; padding: 16px 16px 32px; }
#view-map { max-width: none; padding: 0; position: absolute; inset: 0; }

/* controls */
input, select { min-height: 44px; border: 1px solid var(--edge); border-radius: 8px; padding: 10px 12px; background: var(--card); }
input::placeholder { color: var(--muted); }
.row1 { display: flex; gap: 8px; flex-wrap: wrap; }
.row1 input { flex: 1 1 220px; min-width: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--edge);
       background: var(--card); color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .08s, background .15s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.pro { font-size: 11px; font-weight: 800; letter-spacing: .04em; padding: 2px 6px; border-radius: 4px; background: var(--b-lease); color: var(--t-lease); }

/* search form */
.search-card { background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: 12px; }
.more { margin-top: 8px; }
.more summary { cursor: pointer; color: var(--accent); font-weight: 600; min-height: 44px; display: flex; align-items: center; gap: 6px; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin: 8px 0 12px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; border: 1px solid var(--edge); background: var(--card); border-radius: 999px; padding: 0 14px; font-size: 14px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* results */
.results-head { position: sticky; top: 0; z-index: 2; background: var(--paper); display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 0 8px; flex-wrap: wrap; }
.results-head .count { font-weight: 700; }
.results-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.list { display: flex; flex-direction: column; gap: 12px; }
.card { text-align: left; background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: 14px 16px; cursor: pointer; width: 100%; display: block; color: inherit; font: inherit; }
.card:hover { border-color: var(--edge); } .card:active { transform: scale(.995); }
.card .r1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .02em; padding: 3px 9px; border-radius: 999px; }
.g-deed { color: var(--t-deed); background: var(--b-deed); } .g-mtg { color: var(--t-mtg); background: var(--b-mtg); }
.g-lien { color: var(--t-lien); background: var(--b-lien); } .g-lease { color: var(--t-lease); background: var(--b-lease); }
.g-rel { color: var(--t-rel); background: var(--b-rel); } .g-other { color: var(--t-other); background: var(--b-other); }
.who { font-weight: 600; font-size: 15px; line-height: 1.35; }
.who .arrow { color: var(--muted); font-weight: 400; margin: 0 4px; }
.who .more-n { color: var(--muted); font-weight: 500; font-size: 13px; }
mark { background: var(--hit); color: inherit; border-radius: 3px; padding: 0 1px; }
.card .r3 { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 13px; }
.skel { height: 96px; border-radius: 12px; background: linear-gradient(90deg, var(--chip) 0%, var(--card) 50%, var(--chip) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* empty state */
.hero { padding: 28px 4px 8px; }
.hero h1 { font-size: clamp(26px, 6vw, 36px); letter-spacing: -.02em; line-height: 1.12; margin: 0 0 10px; }
.hero p { margin: 0 0 16px; max-width: 620px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0; }
.stat { background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.stat span { font-size: 13px; color: var(--muted); }
.try { display: flex; flex-wrap: wrap; gap: 8px; }

/* map */
.map-search { position: absolute; z-index: 3; top: 12px; left: 12px; right: 12px; max-width: 520px; }
.map-search form { display: flex; gap: 8px; }
.map-search input { flex: 1; box-shadow: var(--shadow); }
.map-results { margin-top: 6px; background: var(--card); border: 1px solid var(--rule); border-radius: 10px; box-shadow: var(--shadow); max-height: 50vh; overflow: auto; }
.map-results button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--rule); background: none; padding: 10px 14px; min-height: 48px; cursor: pointer; }
#map { position: absolute; inset: 0; }
.map-tools { position: absolute; z-index: 3; right: 12px; top: 72px; display: flex; flex-direction: column; gap: 8px; }
.map-tools .btn { width: 44px; padding: 0; box-shadow: var(--shadow); }
.layers { position: absolute; z-index: 4; right: 64px; top: 72px; width: 260px; background: var(--card); border: 1px solid var(--rule); border-radius: 12px; box-shadow: var(--shadow); padding: 12px; }
.layers h4 { margin: 4px 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.layers label { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.layers .swatch { width: 14px; height: 14px; border-radius: 3px; flex: none; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--edge); border-radius: 8px; overflow: hidden; margin-bottom: 8px; }
.seg button { min-height: 40px; border: 0; background: var(--card); cursor: pointer; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.legend { position: absolute; z-index: 2; left: 12px; bottom: 28px; background: var(--card); border: 1px solid var(--rule); border-radius: 10px; padding: 8px 10px; font-size: 13px; box-shadow: var(--shadow); }
.legend div { display: flex; align-items: center; gap: 8px; min-height: 22px; }
.maplibregl-ctrl-group button { width: 40px !important; height: 40px !important; }

/* sheet */
.backdrop { position: fixed; inset: 0; z-index: 19; background: rgba(20,19,15,.45); opacity: 0; transition: opacity .2s; }
.backdrop.on { opacity: 1; }
.sheet { position: fixed; z-index: 20; right: 0; top: 0; bottom: 0; width: min(560px, 100%); background: var(--card); overflow: auto; overscroll-behavior: contain;
         padding: 0 20px 32px; box-shadow: var(--shadow); transform: translateX(0); transition: transform .25s cubic-bezier(.2,.8,.2,1); outline: none; }
.sheet.closing { transform: translateX(105%); }
.sheet-bar { position: sticky; top: 0; background: var(--card); display: flex; justify-content: space-between; align-items: center; padding: 8px 0; z-index: 1; touch-action: none; }
.grip { display: none; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--chip); }
.sheet h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.01em; }
.sheet h3 { margin: 24px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0; }
.fact { background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; }
.fact span { display: block; font-size: 13px; color: var(--muted); } .fact b { font-size: 17px; font-variant-numeric: tabular-nums; }
.fact.wide { grid-column: 1 / -1; }
.banner { display: flex; gap: 10px; background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 10px 0; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.timeline { position: relative; margin-left: 6px; padding-left: 18px; border-left: 2px solid var(--rule); }
.tl { position: relative; padding: 4px 0 14px; }
.tl::before { content: ""; position: absolute; left: -25px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--card); }
.tl .t1 { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
.tl.clickable { cursor: pointer; } .tl.clickable:hover .t1 { color: var(--accent); }
.pages img { width: 100%; display: block; border: 1px solid var(--rule); border-radius: 6px; margin: 8px 0; background: #fff; }
.progress { height: 6px; background: var(--chip); border-radius: 3px; overflow: hidden; margin: 10px 0; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .3s; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 18px 4px; }
.spin { width: 18px; height: 18px; border: 2px solid var(--rule); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; flex: none; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.err { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 12px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.minimap { height: 180px; border-radius: 10px; border: 1px solid var(--rule); overflow: hidden; margin: 12px 0; }
.inline-signin { background: var(--accent-soft); border-radius: 10px; padding: 12px; margin: 10px 0; }

/* account */
.saved { display: flex; align-items: center; gap: 8px; border: 1px solid var(--rule); background: var(--card); border-radius: 12px; padding: 6px 6px 6px 14px; }
.saved .what { flex: 1; min-width: 0; cursor: pointer; padding: 6px 0; }
.saved .what b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); white-space: nowrap; min-height: 44px; }
#view-account h3, #view-historic h3 { margin: 24px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }

.toast { position: fixed; bottom: calc(var(--tab-h) + 16px); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 10px; z-index: 40; max-width: 90vw; }
.note { font-size: 13px; color: var(--muted); padding: 16px; max-width: 920px; margin: 0 auto; }
body.on-map .note { display: none; }

@media (min-width: 701px) { .toast { bottom: 24px; } }
@media (max-width: 700px) {
  .top { padding: 8px 12px; }
  .tabs { position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
          background: var(--card); border-top: 1px solid var(--rule); gap: 0; }
  .tabs button { flex: 1; flex-direction: column; justify-content: center; gap: 2px; font-size: 12px; border-radius: 0; min-height: var(--tab-h); }
  .tabs button[aria-selected="true"] { background: none; color: var(--accent); }
  .tabs .ico { width: 22px; height: 22px; }
  main { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); }
  #view-map { bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); }
  .acct-btn .lbl { display: none; } .acct-btn { padding: 0 8px; }
  .sheet { top: auto; left: 0; width: 100%; height: 88%; border-radius: 16px 16px 0 0; transform: translateY(0); padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .sheet.peek { height: 42%; }
  .sheet.closing { transform: translateY(105%); }
  .grip { display: block; width: 44px; height: 5px; background: var(--edge); border-radius: 3px; }
  .sheet-bar { justify-content: space-between; padding-top: 10px; cursor: grab; }
  .stats b { font-size: 20px; }
  .layers { right: 12px; left: 12px; width: auto; top: 128px; }
  .map-tools { top: 128px; }
}
@media (prefers-reduced-motion: reduce) { *, .sheet { transition: none !important; animation-duration: 2.4s !important; } }
@media print {
  .top, .note, .tabs, .view, .btns, .sheet-bar, .toast, .backdrop { display: none !important; }
  main { overflow: visible; } .sheet { position: static; width: 100%; height: auto; box-shadow: none; transform: none; }
}

.layers { max-height: calc(100% - 140px); overflow: auto; }
.hz { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--rule); }
.hz:first-child { border-top: 0; }
.hz .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; }
.hz.high .dot { background: var(--warn); } .hz.warn .dot { background: #D08A2E; } .hz.info .dot { background: var(--t-mtg); }
.hz.ok .dot { background: var(--accent); } .hz.unk .dot { background: var(--edge); }
.hz b { display: block; } .hz .src { font-size: 12px; color: var(--muted); }
.hz-card { background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; padding: 4px 14px; }

.chooser { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 12px; }
.chooser .muted { margin-right: 4px; }
.chooser .chip { min-height: 40px; font-size: 13px; padding: 0 12px; }
.chooser .chip[aria-pressed="true"]::before { content: "✓ "; }
[data-sec][hidden] { display: none !important; }

.here-bar { position: absolute; z-index: 3; left: 12px; right: 12px; bottom: 16px; max-width: 520px; background: var(--card); border: 1px solid var(--rule); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 14px; }
.here-card { display: block; width: 100%; text-align: left; border: 0; background: none; cursor: pointer; padding: 0; }
.here-card b { display: block; font-size: 17px; }
#m-follow[aria-pressed="true"] { background: #1A73E8; color: #fff; border-color: #1A73E8; }
.pin-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.pin-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
body.on-map .legend { bottom: 90px; }
