* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #111827; }
#map { position: absolute; inset: 0; }

#topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
  background: rgba(31, 41, 55, .92); color: #fff;
}
.brand { font-weight: 700; }
.layers { display: flex; gap: 12px; font-size: 14px; }
.layers input { vertical-align: -2px; }

#legend { position: absolute; z-index: 2; left: 10px; top: calc(env(safe-area-inset-top) + 118px); max-height: 60vh; overflow-y: auto;
  background: #fff; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.2); font-size: 13px; max-width: 240px; }
#legend-btn { border: 0; background: none; font-weight: 700; font-size: 16px; width: 34px; height: 34px; cursor: pointer; }
#legend.collapsed .legend-body { display: none; }
.legend-body { padding: 0 12px 10px; }
.legend-body b { display: block; margin-top: 6px; }
.legend-body i { display: inline-block; width: 18px; height: 4px; margin-right: 6px; vertical-align: middle; border-radius: 2px; }
.legend-body i.dot { width: 10px; height: 10px; border-radius: 50%; }
.small { color: #6b7280; font-size: 12px; margin-top: 6px; }

.fab { position: absolute; z-index: 2; border: 0; border-radius: 999px; box-shadow: 0 2px 10px rgba(0,0,0,.25);
  background: #fff; font-size: 16px; cursor: pointer; }
#locate-btn { right: 12px; bottom: calc(env(safe-area-inset-bottom) + 84px); width: 48px; height: 48px; font-size: 22px; }
#park-btn { left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 20px);
  padding: 14px 22px; font-weight: 600; }
.primary { background: #2563eb !important; color: #fff; }

#sheet { position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; max-height: 72vh; overflow-y: auto;
  background: #fff; border-radius: 16px 16px 0 0; box-shadow: 0 -4px 20px rgba(0,0,0,.2);
  padding: 16px 16px calc(env(safe-area-inset-bottom) + 16px); }
@media (min-width: 700px) { #sheet { left: auto; right: 12px; bottom: 12px; width: 400px; border-radius: 16px; max-height: 80vh; } }
#sheet-close { position: sticky; float: right; top: 0; border: 0; background: #f3f4f6; border-radius: 50%;
  width: 32px; height: 32px; font-size: 20px; cursor: pointer; }
.hidden { display: none !important; }

#sheet h2 { font-size: 18px; margin: 0 40px 2px 0; }
#sheet h3 { font-size: 14px; margin: 14px 0 6px; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; }
.sub { color: #6b7280; font-size: 13px; }
.card { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.big { font-size: 17px; font-weight: 600; }
.warn { color: #b91c1c; }
.ok { color: #047857; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: #e5e7eb; margin-left: 4px; }
.seg { display: flex; gap: 6px; margin: 6px 0; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 0; padding: 8px; border: 1px solid #d1d5db; background: #fff; border-radius: 8px; cursor: pointer; font-size: 14px; }
.seg button.on { background: #1f2937; color: #fff; border-color: #1f2937; }
.btn { display: inline-block; padding: 10px 14px; border-radius: 10px; border: 1px solid #d1d5db; background: #fff;
  font-size: 14px; cursor: pointer; margin: 4px 4px 0 0; text-decoration: none; color: inherit; }
.btn.primary { border-color: #2563eb; background: #2563eb; color: #fff; }
.btn.danger { color: #b91c1c; }
table.sched { width: 100%; border-collapse: collapse; font-size: 13px; }
table.sched td { padding: 3px 4px; border-bottom: 1px solid #f3f4f6; vertical-align: top; }
table.sched td:first-child { font-weight: 600; width: 42px; }
table.sched tr.today td { background: #eff6ff; }
ul.rules { margin: 4px 0; padding-left: 18px; }
select, input[type=text] { font-size: 15px; padding: 6px 8px; border-radius: 8px; border: 1px solid #d1d5db; }
.checks label { display: block; margin: 4px 0; }

#toast { position: absolute; z-index: 5; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 84px); pointer-events: none; text-align: center;
  background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: 90vw; }

.car-marker { font-size: 28px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); cursor: grab; }
.me-marker { width: 16px; height: 16px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(37,99,235,.25); }
.seg button.on .pill { background: #4b5563; color: #fff; }
.seg button.on .sub { color: #d1d5db; }
#home-btn { right: 12px; bottom: calc(env(safe-area-inset-bottom) + 142px); width: 48px; height: 48px; font-size: 20px; }
.home-marker { font-size: 24px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }
.searchbar { flex-basis: 100%; position: relative; }
#search { width: 100%; padding: 9px 36px 9px 12px; border-radius: 10px; border: 0; font-size: 16px; -webkit-appearance: none; }
#search::-webkit-search-cancel-button { display: none; }
#search-clear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; font-size: 22px; color: #6b7280; cursor: pointer; }
#search-results { flex-basis: 100%; background: #fff; color: #111827; border-radius: 10px; max-height: 50vh; overflow-y: auto; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.sr { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid #f3f4f6; background: #fff; padding: 10px 12px; font-size: 15px; cursor: pointer; color: inherit; }
.sr:hover { background: #f9fafb; }
.sr-empty { padding: 10px 12px; color: #6b7280; }
.maplibregl-ctrl-top-right { top: calc(env(safe-area-inset-top) + 118px); }
.holidays > div { margin: 4px 0; }
.indent { padding-left: 24px; }
.search-marker { font-size: 30px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
.checks input[type=text] { width: 100%; margin-top: 4px; }
.brand { font-size: 15px; line-height: 1.2; }
