/* Lot Walk. Light only, high contrast: used outdoors in daylight (his call, 11-18).
   Layout: the page never scrolls; the lot is the one scroll area (headers pinned inside it); the spot
   card floats over the bottom of the lot on phones and docks at the right on wide screens. */
:root {
  color-scheme: light;
  --bg: #ECEEEB; --surface: #FFFFFF; --surface-2: #F5F6F4; --ink: #111413; --muted: #4A524E;
  --line: #B9BFBB; --accent: #F2B705; --accent-ink: #1B1F1D; --sidewalk: #D3D6D1;
  --clash: #C2410C; --ok: #2F7D4F; --focus: #1F6FEB; --scrim: rgba(20,24,22,.18);
  --c-repark: #2FA84F; --c-issue: #F08C00; --c-dead: #E03131; --c-move: #1C9BD6; --c-paper: #E8C400;
  /* Spot fills: his sheet's cell colors, bright enough to shout "fix this", light enough for dark text. */
  --fill-repark: #7FE08F; --fill-issue: #FFB24D; --fill-dead: #FF8080; --fill-move: #74CDF5; --fill-paper: #FFE55C;
  --f-ui: "Barlow Semi Condensed", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-label: "Barlow Condensed", "Arial Narrow", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box }
html, body { height: 100%; margin: 0 }
body { background: var(--bg); color: var(--ink); font-family: var(--f-ui); font-size: 15px; font-variant-numeric: tabular-nums;
  display: flex; flex-direction: column; overflow: hidden; padding-top: env(safe-area-inset-top, 0px) }
button, input { font: inherit; color: inherit }
button { cursor: pointer }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px }
[hidden] { display: none !important }

.wrap { max-width: 560px; margin: 0 auto; width: 100%;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)) }
header { flex: none; background: var(--surface); border-bottom: 1px solid var(--line) }
header .wrap { display: flex; flex-direction: column; gap: 8px; padding-block: 10px }
.toprow { display: flex; align-items: center; gap: 8px }
.brand { font-family: var(--f-label); font-weight: 700; font-size: 20px; letter-spacing: .02em; flex: 1; min-width: 0 }
.chip { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 4px 10px; font-size: 13px;
  white-space: nowrap; max-width: 46vw; overflow: hidden; text-overflow: ellipsis }
.chip.warn { border-color: var(--clash); color: var(--clash) }
.chip.good { color: var(--ok) }
.iconbtn { border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 6px 10px; text-decoration: none }
.lots { display: flex; gap: 6px; overflow-x: auto }
.lots button { border: 1px solid var(--line); background: transparent; border-radius: 8px; padding: 6px 12px;
  font-family: var(--f-label); font-weight: 600; font-size: 16px; white-space: nowrap }
.lots button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent) }

main { flex: 1; min-height: 0; display: flex; flex-direction: column }
.tray { display: flex; gap: 8px; flex-wrap: wrap; padding-block: 10px }
.tray:empty { padding-block: 4px }
.mapwrap { flex: 1; min-height: 0 }
.map { display: flex; gap: 10px; overflow: auto; height: 100%; padding-bottom: 16px; scroll-snap-type: x proximity }
.line { flex: 0 0 232px; scroll-snap-align: start; display: flex; flex-direction: column }
.lhead { position: sticky; top: 0; z-index: 2; background: var(--bg); padding-top: 4px }
.line h2 { font-family: var(--f-label); font-size: 17px; font-weight: 700; margin: 0; letter-spacing: .02em;
  background: var(--ink); color: var(--bg); padding: 6px 8px; border-radius: 8px 8px 0 0 }
.line .hint { font-size: 12px; color: var(--muted); padding: 4px 8px; background: var(--surface-2);
  border-left: 1px solid var(--line); border-right: 1px solid var(--line) }

.spot { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 6px; text-align: left;
  min-height: 70px; padding: 6px 6px; overflow: visible; background: var(--surface); border: 1px solid var(--line); border-top: 0;
  border-left: 4px solid var(--line); -webkit-touch-callout: none; -webkit-user-select: none; user-select: none }
.spot .code { font-family: var(--f-label); font-weight: 700; font-size: 15px }
.spot .code.unknown { color: var(--muted); font-weight: 500 }
.spot .body { min-width: 0; display: flex; flex-direction: column; gap: 3px }
.spot .emo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; line-height: 20px; min-height: 20px }
.spot .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; line-height: 18px; min-height: 18px;
  display: flex; align-items: center; gap: 5px }
.spot .mdl { min-width: 0; overflow: hidden; text-overflow: ellipsis }
.spot .meta { display: flex; align-items: center; gap: 4px; font-size: 12px; line-height: 16px; min-height: 16px; color: var(--muted) }
.spot.empty .name { color: var(--muted); font-style: italic }
.spot.sel { outline: 3px solid var(--ink); outline-offset: -3px; position: relative; z-index: 1 }
.spot.clash { border-left-color: var(--clash) }
.spot.clash-soft { border-left: 4px dashed var(--clash) }
.spot.pad { background: var(--surface-2) }
.spot.drop { outline: 3px dashed var(--focus); outline-offset: -3px }
.spot.dragging { opacity: .45 }
.spot[draggable="true"] { cursor: grab }
.dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; border: 1px solid var(--muted) }
.sidewalk { height: 18px; background: repeating-linear-gradient(90deg, var(--sidewalk) 0 10px, var(--surface-2) 10px 12px);
  border-left: 1px solid var(--line); border-right: 1px solid var(--line); font-size: 11px; color: var(--muted);
  text-align: center; line-height: 18px; letter-spacing: .08em; text-transform: uppercase }
.padhead { font-size: 12px; color: var(--muted); padding: 4px 8px; background: var(--surface-2);
  border: 1px solid var(--line); border-top: 0; letter-spacing: .06em; text-transform: uppercase }
.fl { width: 10px; height: 10px; border-radius: 2px; display: inline-block }
.ghost { position: fixed; left: 0; top: 0; z-index: 12; pointer-events: none; background: var(--ink); color: var(--bg);
  padding: 8px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; white-space: nowrap; max-width: 240px;
  overflow: hidden; text-overflow: ellipsis; box-shadow: 0 6px 20px var(--scrim) }

.card { position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; background: var(--surface);
  border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: 0 -8px 30px var(--scrim);
  max-height: 68vh; overflow-y: auto; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)) }
.card .wrap { display: flex; flex-direction: column; gap: 10px; padding-top: 12px }
.card-head { display: flex; gap: 10px; align-items: flex-start; position: sticky; top: 0; z-index: 2;
  background: var(--surface); padding-block: 12px 6px; margin-top: -12px; border-bottom: 1px solid var(--line) }
.card-head > div { flex: 1; min-width: 0 }
.card-title { font-family: var(--f-label); font-size: 22px; font-weight: 700; line-height: 1.1 }
.card-sub { font-size: 13px; color: var(--muted) }
.neighbors { display: grid; grid-template-columns: 1fr 1fr; gap: 6px }
.nb { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 10px; display: flex;
  gap: 6px; align-items: center; min-width: 0; text-align: left; font-size: 14px; min-height: 52px }
.nb span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.nb.dir { border: 2px solid var(--ink); background: var(--accent); color: var(--accent-ink); font-weight: 600 }
.nb:disabled { opacity: .5; cursor: default }
.current { font-size: 14px }
.lbl { font-size: 12px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase }
.inrow { display: flex; gap: 8px }
.inrow input, #note-input, #search-input, #pair-pin, #pair-device { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 10px; padding: 10px 12px; font-size: 18px; width: 100% }
#note-input { font-size: 16px }
.matches { display: flex; flex-direction: column; gap: 6px }
.match { text-align: left; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 8px 10px; display: flex; gap: 8px; align-items: center }
.match.only { border-color: var(--ok) }
.msg { font-size: 14px; color: var(--clash) }
.flags { display: flex; flex-wrap: wrap; gap: 6px }
.flag { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 999px; padding: 8px 12px 8px 8px; font-size: 14px }
.flag[aria-pressed="true"] { border-color: var(--ink); background: var(--surface); font-weight: 600 }
.flag[aria-pressed="true"]::after { content: "✓"; margin-left: 2px }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center }
.actions button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 10px 12px }
.actions button:disabled { opacity: .45 }
.actions .primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700 }

.overlay { position: fixed; inset: 0; z-index: 9; background: var(--bg); overflow-y: auto; padding-top: env(safe-area-inset-top, 0px) }
.overlay .wrap { display: flex; flex-direction: column; gap: 10px; padding-block: 14px }
.overlay h3 { font-family: var(--f-label); font-size: 22px; margin: 0; flex: 1 }
.result { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px }
.result b { font-family: var(--f-label); font-size: 17px }
.result span { font-size: 13px; color: var(--muted) }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 }
.facts dt { color: var(--muted) }
.facts dd { margin: 0 }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 13px }
.legend span { display: flex; gap: 5px; align-items: center }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 11; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 999px; font-size: 14px;
  max-width: calc(100% - 32px); text-align: center }
.card:not([hidden]) ~ .toast { bottom: auto; top: calc(110px + env(safe-area-inset-top, 0px)) }

@media (min-width: 900px) {
  .wrap { max-width: 1240px }
  .line { flex-basis: 250px }
  .card { left: auto; right: max(16px, env(safe-area-inset-right, 0px)); bottom: 16px; width: 380px;
    border: 1px solid var(--line); border-radius: 16px; max-height: calc(100vh - 150px) }
  body.card-open main .wrap { padding-right: 410px }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important } }
