:root { --blue: #1f5fbf; --line: #ddd; --muted: #666; --bg: #fff; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: Arial, sans-serif; background: var(--bg); color: #111; }
[hidden] { display: none !important; }
button { font: inherit; padding: 6px 10px; border: 1px solid #aaa; background: #f4f4f4; border-radius: 6px; cursor: pointer; }
button.big { width: 100%; padding: 12px; font-size: 17px; background: var(--blue); color: #fff; border: 0; margin: 4px 0; }
.muted { color: var(--muted); font-size: 13px; }
.screen { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; padding: 16px; text-align: center; }
.screen .big { max-width: 320px; }

#app { display: flex; flex-direction: column; height: 100%; }
header { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
header #count { flex: 1; }
#map { flex: 1; }
/* Leaflet places its labels by LTR math; inside the map use LTR (the page itself stays RTL) */
.leaflet-container { direction: ltr; }
/* "$18" label next to each dot */
.leaflet-tooltip.amt { display: none; direction: ltr; padding: 0 4px; font: bold 12px/16px Arial; color: #111; background: #fffd; border: 1px solid #999;
  border-radius: 4px; box-shadow: none; cursor: pointer; }
.leaflet-tooltip.amt::before { display: none; }
#map.show-amt .leaflet-tooltip.amt { display: block; }
#locate { position: fixed; bottom: 24px; left: 16px; z-index: 900; width: 48px; height: 48px; border-radius: 50%; font-size: 22px; background: #fff; box-shadow: 0 1px 6px #0004; }
#fullscreen { position: fixed; bottom: 80px; left: 16px; z-index: 900; width: 48px; height: 48px; border-radius: 50%; font-size: 22px; background: #fff; box-shadow: 0 1px 6px #0004; }
/* full map: hide the header so the map and the route fill the whole screen */
body.full header { display: none; }
body.full #fullscreen { background: #1f5fbf; color: #fff; }

.panel { position: absolute; top: 48px; right: 0; left: 0; z-index: 1000; background: #fff; border-bottom: 1px solid var(--line);
  padding: 12px 16px; max-height: calc(100% - 48px); overflow-y: auto; box-shadow: 0 4px 10px #0002; }
.panel fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 0 0 8px; }
.panel label { display: inline-flex; align-items: center; gap: 4px; margin: 4px 10px 4px 0; font-size: 16px; }
.panel input[type=checkbox] { width: 20px; height: 20px; }
#minAmount, #recentDays { width: 70px; font-size: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 10px; }
.tile { display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 4px; aspect-ratio: 1;
  margin: 0 !important; padding: 10px; border: 0; border-radius: 16px; background: #eef4ff; color: #123; font-size: 15px;
  font-weight: bold; text-align: center; cursor: pointer; box-shadow: 0 2px 6px #0002; }
.tile span { font-size: 34px; line-height: 1; }
.tile small { font-weight: normal; color: #567; font-size: 12px; }
.tile.on { background: #1a9a3a; color: #fff; }
.tile.on small { color: #e0ffe0; }
#status { position: fixed; top: 52px; right: 8px; left: 8px; z-index: 950; background: #fff4d6; padding: 6px 10px; border-radius: 8px;
  font-size: 14px; box-shadow: 0 1px 4px #0003; }
.stopbanner { background: #1a9a3a; color: #fff; padding: 6px 10px; border-radius: 8px; margin-bottom: 6px; font-weight: bold; }
#adminBox { margin: 8px 0; padding: 8px; background: #eef4ff; border-radius: 6px; }
.panel select, .panel input[type=search], .panel input[type=text] { width: 100%; font-size: 16px; padding: 8px; margin: 4px 0; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.filebtn { display: block !important; padding: 10px; border: 1px dashed #aaa; border-radius: 6px; margin: 8px 0 !important; cursor: pointer; }
#routeFromMe { position: fixed; bottom: 24px; left: 72px; z-index: 900; height: 48px; padding: 0 16px; border-radius: 24px;
  background: #1a9a3a; color: #fff; border: 0; font-size: 16px; box-shadow: 0 1px 6px #0004; }
header #find { flex: 1; min-width: 0; font-size: 16px; padding: 6px 8px; }
#findResults .res { padding: 8px 0; border-bottom: 1px solid #eee; cursor: pointer; unicode-bidi: plaintext; }
.routebar { position: fixed; bottom: 0; right: 0; left: 0; z-index: 1050; background: #fff; border-top: 3px solid #e0245e;
  padding: 8px 12px; box-shadow: 0 -4px 12px #0003; max-height: 60%; overflow-y: auto; }
.routebar .big { background: #e0245e; }
#routeFold { float: left; width: 44px; height: 32px; padding: 0; font-size: 18px; border-radius: 16px; margin: -2px 0 4px 8px; }
/* folded: only a thin strip with the arrow, the map gets the whole screen */
.routebar.folded > :not(#routeFold) { display: none; }
.routebar.folded { padding: 4px 12px; background: #fff0; border: 0; box-shadow: none; pointer-events: none; }
.routebar.folded #routeFold { float: right; margin: 0; pointer-events: auto; box-shadow: 0 1px 6px #0004; background: #e0245e; color: #fff; border: 0; }
.routebar .row button { margin: 2px 0; }
#routeHead { font-size: 15px; margin-bottom: 4px; unicode-bidi: plaintext; }
.startpin { background: #1a9a3a; color: #fff; border-radius: 6px; font: bold 12px/22px Arial; text-align: center; white-space: nowrap; box-shadow: 0 1px 4px #0006; }
.arrow span { display: block; color: #fff; font-size: 13px; line-height: 18px; text-align: center; text-shadow: 0 0 2px #a0123c, 0 0 2px #a0123c; }
.moves { margin-top: 4px; padding: 6px 8px; background: #fff4d6; border-radius: 6px; font-size: 15px; font-weight: bold; unicode-bidi: plaintext; }
#routeList { padding-right: 20px; font-size: 14px; }
.stopnum { background: #e0245e; color: #fff; border-radius: 50%; font: bold 12px/22px Arial; text-align: center; border: 2px solid #fff; box-shadow: 0 1px 4px #0006; }
.stopnum.first { background: #1a9a3a; font-size: 15px; line-height: 26px; }
#routeList li { padding: 4px 0; border-bottom: 1px solid #eee; cursor: pointer; }
#routeList li.done { color: #999; text-decoration: line-through; }

#sheet { position: fixed; bottom: 0; right: 0; left: 0; z-index: 1100; background: #fff; border-top: 2px solid var(--blue);
  max-height: 75%; overflow-y: auto; padding: 12px 16px 20px; box-shadow: 0 -4px 12px #0003; }
#sheet h2 { margin: 0 0 4px; font-size: 18px; unicode-bidi: plaintext; }
#sheet .addr { unicode-bidi: plaintext; color: var(--muted); font-size: 14px; }
#sheet h2.street { direction: ltr; text-align: right; font-size: 22px; }
#sheet .who { font-size: 17px; font-weight: bold; }
#sheet.stop h2.street { font-size: 32px; }
#sheet.stop .who { font-size: 24px; }
/* the tapped house: a ring around its dot with the house number above */
.picked span { position: absolute; transform: translate(-50%, 0); margin-top: 18px; white-space: nowrap; background: #111; color: #fff;
  font: bold 15px/22px Arial; padding: 0 8px; border-radius: 6px; box-shadow: 0 1px 4px #0006; }
.picked::after { content: ''; position: absolute; width: 30px; height: 30px; left: -15px; top: -15px; border: 4px solid #111; border-radius: 50%; }
#sheet .close { float: left; }
#sheet .amount { font-size: 22px; font-weight: bold; color: #1a7f1a; margin: 6px 0; }
#sheet textarea, #sheet input[type=text], #sheet input[type=number] { width: 100%; font-size: 16px; padding: 8px; margin: 4px 0; }
#sheet .acts { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
#sheet .acts button { flex: 1; padding: 10px; font-size: 16px; }
#sheet .gave { background: #1a7f1a; color: #fff; border: 0; }
#sheet .nothome { background: #b35c00; color: #fff; border: 0; }
#sheet .homeno { background: #6b6f80; color: #fff; border: 0; }
#sheet ul { padding-right: 18px; font-size: 14px; }
/* window that pops up by itself at a stop: whole screen, big enough to read while standing at the door */
#sheet.stop { top: 0; max-height: none; height: 100%; border-top: 0; padding: 16px 18px 28px; font-size: 19px; }
#sheet.stop .close { width: 52px; height: 52px; font-size: 24px; border-radius: 50%; }
#sheet.stop .stopbanner { font-size: 20px; padding: 12px 14px; margin: 8px 0 12px; clear: both; }
#sheet.stop h2 { font-size: 28px; }
#sheet.stop .addr, #sheet.stop .muted { font-size: 17px; }
#sheet.stop .amount { font-size: 40px; margin: 10px 0; }
#sheet.stop input[type=number], #sheet.stop textarea { font-size: 22px; padding: 12px; }
#sheet.stop .acts { flex-direction: column; gap: 10px; }
#sheet.stop .acts button { padding: 18px; font-size: 22px; border-radius: 12px; }
#sheet.stop ul { font-size: 17px; }
/* what the dot colours mean */
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 6px 0; font-size: 14px; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #999; margin-left: 4px; vertical-align: -2px; }
/* "houses around me" button, above the full-screen button */
#nearMe { position: fixed; bottom: 136px; left: 16px; z-index: 900; height: 44px; padding: 0 12px; border-radius: 22px; font-size: 15px;
  background: #fff; border: 0; box-shadow: 0 1px 6px #0004; }
/* you are here: blue dot with a soft halo */
.mepin b { position: absolute; width: 18px; height: 18px; left: -9px; top: -9px; border-radius: 50%; background: #1f6fff;
  border: 3px solid #fff; box-shadow: 0 0 0 8px #1f6fff33, 0 1px 4px #0006; }
#findResults .res b[dir=ltr] { unicode-bidi: isolate; }
/* nearby list: top part only, the map with the yellow spot stays visible below */
#findResults.near { max-height: 42vh; }
#findResults .nearClose { float: left; width: 36px; height: 32px; padding: 0; }
/* amounts on the route stops show at every zoom */
.leaflet-tooltip.amt.route { display: block; background: #fff; border-color: #e0245e; }
/* route of the 10 houses in the area you moved the map to */
#routeHere { position: fixed; bottom: 80px; left: 72px; z-index: 900; height: 44px; padding: 0 14px; border-radius: 22px;
  background: #1f5fbf; color: #fff; border: 0; font-size: 15px; box-shadow: 0 1px 6px #0004; }
/* brings back a route that was closed */
#routeBack { position: fixed; bottom: 136px; left: 140px; z-index: 900; height: 44px; padding: 0 14px; border-radius: 22px;
  background: #e0245e; color: #fff; border: 0; font-size: 15px; box-shadow: 0 1px 6px #0004; }
/* a field the house is still missing (name / amount): fill it in at the door */
#sheet input.missing { background: #fff6c2; border: 2px solid #e0a800; }
/* close the nearby list: a big ✕ on top and an arrow bar stuck to the bottom of the list */
#findResults .nearClose { width: 44px; height: 40px; font-size: 20px; }
#findResults .nearFold { position: sticky; bottom: -12px; float: none; display: block; width: 100%; height: 44px; margin-top: 8px;
  background: #1f5fbf; color: #fff; border: 0; border-radius: 10px; font-size: 17px; }
