/* Site Plan. Phone first: big buttons for gloves, high contrast in sun, dark mode. Survey-ribbon pink. */
:root {
  --bg: #f3efe6; --card: #fffdf8; --ink: #17181b; --mute: #5d5a53; --line: #d9d3c5;
  --y: #ff2e88; --y-ink: #17181b; --y-line: #c4136a; --y-soft: #ffe1ee;
  --good: #1c8a4a; --bad: #c62828; --warn: #a15c00;
  --minor: #ffb35c; --major: #ff7a00; --shot: #19c3ff;
  --r: 14px; --shadow: 0 6px 24px rgba(0,0,0,.18);
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --cond: "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141416; --card: #1f2023; --ink: #f2efe8; --mute: #aaa69c; --line: #3a3b3f; --y-soft: #43142b; --good: #4cc77d; --bad: #ff6b7f; --warn: #ffb443; color-scheme: dark; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 600 16px/1.35 var(--font); overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
#map { position: fixed; inset: 0; background: #2b2d30; }
.leaflet-container { font: 600 14px var(--font); }

/* top bar */
.top { position: fixed; top: 0; left: 0; right: 0; z-index: 900; display: flex; gap: 8px; align-items: center; padding: calc(env(safe-area-inset-top) + 8px) 10px 8px; pointer-events: none; }
.top > * { pointer-events: auto; }
.mark { width: 40px; height: 40px; border-radius: 10px; box-shadow: var(--shadow); flex: none; }
.search { flex: 1; min-width: 0; height: 48px; border: 0; border-radius: 24px; background: var(--card); box-shadow: var(--shadow); text-align: left; padding: 0 18px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.round { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; flex: none; }
.round.getapp { background: var(--y); color: var(--y-ink); }

.mode { position: fixed; z-index: 950; left: 10px; right: 10px; top: calc(env(safe-area-inset-top) + 64px); display: flex; align-items: center; gap: 8px; background: var(--ink); color: var(--bg); border-radius: var(--r); padding: 8px; box-shadow: var(--shadow); }
.mode span { flex: 1; text-align: center; font-size: 15px; }
.mode button { border: 0; border-radius: 10px; min-height: 44px; padding: 0 14px; background: transparent; color: inherit; }
.mode .done { background: var(--y); color: var(--y-ink); }

.floats { position: fixed; z-index: 900; right: 10px; bottom: calc(var(--panel-h, 220px) + 12px); display: flex; flex-direction: column; gap: 10px; }
.round.undo { background: var(--ink); color: var(--bg); }

/* bottom panel */
.panel { position: fixed; z-index: 900; left: 0; right: 0; bottom: 0; background: var(--card); border-radius: 18px 18px 0 0; box-shadow: 0 -4px 24px rgba(0,0,0,.2); padding: 8px 12px calc(env(safe-area-inset-bottom) + 10px); display: flex; flex-direction: column; gap: 8px; max-width: 760px; margin: 0 auto; }
.proj { display: flex; align-items: baseline; gap: 8px; border: 0; background: none; padding: 6px 4px; text-align: left; min-height: 44px; }
.pname { font: 700 19px var(--cond); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.pinfo { flex: 1; color: var(--mute); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { color: var(--mute); font-size: 22px; }
.big { width: 100%; min-height: 56px; border: 0; border-radius: var(--r); background: var(--y); color: var(--y-ink); font: 700 19px var(--cond); }
.big:disabled { opacity: .55; }
.big.ghost { background: transparent; color: var(--ink); border: 2px solid var(--line); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chips:empty { display: none; }
.chip { flex: none; min-height: 40px; border-radius: 20px; border: 2px solid var(--line); background: var(--bg); padding: 0 14px; font-size: 15px; white-space: nowrap; }
.chip b { color: var(--y-line); }
@media (prefers-color-scheme: dark) { .chip b { color: var(--y); } }
.tools { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.tool { border: 0; background: var(--bg); border-radius: 12px; min-height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12.5px; padding: 4px 1px; min-width: 0; }
.tool span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool.on { background: var(--y); color: var(--y-ink); }
.tool:disabled { opacity: .45; }

/* sheets */
#scrim { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.42); }
.sheet { position: fixed; z-index: 1001; left: 0; right: 0; bottom: 0; max-height: 88vh; max-height: 88dvh; overflow: auto; background: var(--card); border-radius: 18px 18px 0 0; padding: 6px 16px calc(env(safe-area-inset-bottom) + 18px); box-shadow: var(--shadow); max-width: 760px; margin: 0 auto; overscroll-behavior: contain; }
.sheet .head { display: flex; align-items: center; gap: 8px; position: sticky; top: -6px; background: var(--card); padding: 8px 0; z-index: 1; }
.sheet .head h2 { flex: 1; margin: 0; font: 700 21px var(--cond); }
.sheet .x { border: 0; background: none; min-height: 44px; padding: 0 8px; color: var(--mute); font-size: 16px; }
.sheet h3 { font: 700 16px var(--cond); margin: 16px 0 6px; color: var(--mute); text-transform: uppercase; letter-spacing: .03em; }
.sheet p { margin: 6px 0; }
.fine { color: var(--mute); font-size: 13.5px; font-weight: 500; }
.row { display: flex; gap: 8px; align-items: center; }
.rows { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 54px; border: 2px solid var(--line); border-radius: 12px; background: var(--bg); padding: 8px 14px; text-align: left; }
.opt.on { border-color: var(--y-line); background: var(--y-soft); }
.opt small { display: block; color: var(--mute); font-weight: 500; font-size: 13px; }
.opt .grow { flex: 1; min-width: 0; }
.btn { min-height: 50px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg); padding: 0 16px; font-weight: 700; }
.btn.y { background: var(--y); border-color: var(--y); color: var(--y-ink); }
.btn.wide { width: 100%; }
.btn.danger { color: var(--bad); }
input.in, textarea.in, select.in { width: 100%; min-height: 52px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); font: 600 17px var(--font); padding: 10px 14px; }
textarea.in { min-height: 120px; font: 500 14px ui-monospace, Menlo, monospace; }
input.in:focus, textarea.in:focus { outline: 3px solid var(--y); border-color: transparent; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.stat .k { color: var(--mute); font-size: 13px; font-weight: 600; }
.stat .v { font: 700 22px var(--cond); }
.stat .v.sm { font-size: 17px; }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
.good { color: var(--good); }
.list { display: flex; flex-direction: column; gap: 6px; }
.svgwrap { background: var(--bg); border-radius: 12px; padding: 6px; overflow-x: auto; }
.svgwrap svg { display: block; width: 100%; height: auto; min-width: 320px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th, table.tbl td { text-align: right; padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.tbl th:first-child, table.tbl td:first-child { text-align: left; }
.toast { position: fixed; z-index: 1100; left: 50%; transform: translateX(-50%); bottom: calc(var(--panel-h, 220px) + 16px); background: var(--ink); color: var(--bg); border-radius: 12px; padding: 12px 16px; max-width: calc(100vw - 32px); box-shadow: var(--shadow); display: flex; gap: 12px; align-items: center; }
.toast button { border: 0; background: var(--y); color: var(--y-ink); border-radius: 8px; min-height: 40px; padding: 0 12px; font-weight: 700; }
.busy { display: inline-block; width: 18px; height: 18px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* on the map */
.clabel { font: 700 12px var(--cond); color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000, 0 0 2px #000; white-space: nowrap; pointer-events: none; transform-origin: center; }
.spot { background: var(--ink); color: var(--bg); border-radius: 8px; padding: 3px 7px; font: 700 13px var(--cond); white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.4); transform: translate(-50%, -130%); display: inline-block; }
.spot::after { content: ""; position: absolute; left: 50%; bottom: -5px; margin-left: -5px; border: 5px solid transparent; border-top-color: var(--ink); border-bottom: 0; }
.shotlbl { color: #fff; font: 700 11px var(--cond); text-shadow: 0 0 3px #000, 0 0 3px #000; white-space: nowrap; transform: translate(8px, -6px); display: inline-block; }
.leaflet-popup-content { font: 600 14px var(--font); margin: 12px 14px; }
.leaflet-popup-content .btn { min-height: 44px; margin-top: 8px; width: 100%; }
.leaflet-control-attribution { font-size: 10px; max-width: 70vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leaflet-control-scale { margin-bottom: 4px !important; }

/* split screen, small and sideways phones */
@media (max-height: 560px) { .tool { min-height: 50px; } .tool span { font-size: 12px; } .big { min-height: 48px; } }
@media (max-width: 360px) { .tool span { font-size: 11px; } .tool svg { width: 22px; height: 22px; } .pinfo { display: none; } }

/* the plan sheet for printing */
#print { display: none; }
@media print {
  @page { size: letter landscape; margin: 0.35in; }
  html, body { overflow: visible; height: auto; background: #fff; color: #000; }
  body > *:not(#print) { display: none !important; }
  #print { display: block; }
  #print .ps { font: 500 10pt var(--font); color: #000; }
  #print svg { width: 100%; height: auto; }
  #print .pg { page-break-after: always; }
  #print .pg:last-child { page-break-after: auto; }
}

/* septic form */
.fld { margin: 10px 0 4px; font-size: 14px; color: var(--mute); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { min-height: 46px; min-width: 52px; border-radius: 10px; border: 2px solid var(--line); background: var(--bg); padding: 0 12px; font-weight: 700; }
.seg button.on { border-color: var(--y-line); background: var(--y-soft); }
.res { display: flex; justify-content: space-between; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.res .rl { color: var(--mute); font-size: 14.5px; }
.res .rv { text-align: right; font-weight: 700; }
.res.hi .rv { font: 700 22px var(--cond); }
.res.hi .rl { color: var(--ink); font-weight: 700; }
.res .ok { color: var(--good); font-size: 13px; display: block; }
.res .no { color: var(--bad); font-size: 13px; display: block; }
