:root {
  --bg: #fbf8f2;
  --panel: #ffffff;
  --ink: #1f1d1a;
  --muted: #6d675e;
  --line: #e6e0d4;
  --accent: #c8781c;
  --accent-ink: #ffffff;
  --sun: #ffc53d;
  --tree: #8fb573;
  --shade: #3a4763;
  --danger: #b3261e;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { display: flex; background: var(--bg); }
#sidebar {
  width: 360px; flex: none; height: 100%; overflow-y: auto;
  padding: 14px 16px 10px; border-right: 1px solid var(--line); background: var(--bg);
  display: flex; flex-direction: column; gap: 10px;
}
#map { flex: 1; height: 100%; }
header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
h1 { font-size: 20px; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 18px; margin: 4px 0 0; }
h3 { font-size: 14px; margin: 0 0 6px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
h4 { font-size: 13px; margin: 12px 0 4px; }
.hint { color: var(--muted); font-size: 12px; margin: 2px 0; }
footer { margin-top: auto; padding-top: 8px; }
button, select, input[type=search], input[type=date], textarea {
  font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 8px; padding: 6px 10px;
}
button { cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.subtle { background: transparent; }
button.danger { color: var(--danger); }
button.link { border: 0; background: none; padding: 0; color: var(--accent); text-align: left; }
button.active { outline: 2px solid var(--accent); }
textarea { width: 100%; resize: vertical; }
input[type=search] { width: 100%; }
.row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 6px 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.chips button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.check { display: flex; gap: 6px; align-items: center; margin: 6px 0; font-size: 13px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
#pub-list { list-style: none; margin: 0; padding: 0; }
#pub-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 8px; cursor: pointer;
}
#pub-list li:hover { background: #f1ebdf; }
#pub-list .name { font-weight: 500; }
#pub-list .sub { color: var(--muted); font-size: 12px; }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: #eee7da; color: var(--muted); white-space: nowrap; }
.badge.done { background: #fdecc8; color: #7a4a00; }
.badge.none { background: #e8e8e8; color: #777; }
.badge.osm { background: #fff5d6; color: #7a5a00; border: 1px dashed #d9a400; }

/* drink prices */
#price-list, #correction-list { list-style: none; margin: 6px 0; padding: 0; }
#price-list > li { border-top: 1px solid var(--line); padding: 7px 0; }
#price-list > li:first-child { border-top: 0; }
#price-list > li.old { opacity: .6; }
.pr-main { display: flex; justify-content: space-between; gap: 8px; }
.pr-amt { text-align: right; white-space: nowrap; }
.pr-amt b { font-size: 16px; display: block; }
.pr-confirm { font-size: 11px; }
.pr-history summary { cursor: pointer; margin-top: 2px; }
.pr-history ul { list-style: none; margin: 4px 0 0; padding: 0 0 0 8px; font-size: 12px; color: var(--muted); }
#price-add summary { cursor: pointer; color: var(--accent); font-weight: 600; margin: 6px 0; }
#price-form { display: flex; flex-direction: column; gap: 6px; }
#price-form input, #price-form select { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--panel); }
#price-form .row { margin: 0; flex-wrap: nowrap; }
#price-form .row > * { flex: 1; min-width: 0; }
.money { display: flex; align-items: center; gap: 4px; font-weight: 600; }
.money input { width: 100%; }

/* surroundings corrections */
#correction-tools button { font-size: 12px; padding: 4px 8px; }
#correction-form { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; padding: 8px; background: #f7f3ea; border-radius: 8px; }
#correction-form p { margin: 0; font-size: 12px; }
#correction-form input { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; }
#correction-list li { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 0; }
#correction-list .lbl { flex: 1; }
button.link.danger { color: var(--danger); }
.status { font-size: 12px; margin: 6px 0 0; min-height: 1em; }
.status.error { color: var(--danger); }
#time { width: 100%; accent-color: var(--accent); }
#readout { font-size: 13px; margin: 4px 0 6px; }
#readout b { font-size: 18px; }
canvas { width: 100%; display: block; }
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); margin: 4px 0; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.sw.sun { background: var(--sun); }
.sw.tree { background: var(--tree); }
.sw.shade { background: var(--shade); }
.leaflet-tooltip.pub-label { font-weight: 600; }
.leaflet-tooltip.pub-label.selected { background: #1f1d1a; color: #fff; border-color: #1f1d1a; font-size: 13px; }
.leaflet-tooltip.pub-label.selected::before { border-top-color: #1f1d1a; }
.pub-highlight { animation: pulse 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { 50% { stroke-width: 6px; stroke-opacity: .55; } }
.height-info {
  background: rgba(255, 255, 255, .92); border-radius: 8px; padding: 6px 8px; width: 190px;
  font-size: 11px; color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.height-info .ramp {
  height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, rgb(255,230,90), rgb(255,170,40), rgb(240,90,50), rgb(200,40,120), rgb(110,40,170));
}
.height-info .ticks { display: flex; justify-content: space-between; color: var(--muted); margin-top: 2px; }
.height-info .here { margin-top: 4px; font-weight: 600; }

/* drawing controls, shown over the map while outlining (easier than tapping the first point on a phone) */
.draw-bar { position: fixed; z-index: 1000; left: calc(360px + (100vw - 360px) / 2); transform: translateX(-50%); top: 12px;
  display: flex; gap: 8px; background: var(--panel); padding: 8px; border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .25); }
.draw-bar button { min-height: 40px; padding: 8px 14px; }
.sheet-handle { display: none; }

/* phones: full-screen map, panel as a bottom sheet */
@media (max-width: 760px) {
  body { display: block; }
  #map { position: fixed; inset: 0; height: auto; }
  #sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; width: 100%;
    height: var(--sheet, 42vh); max-height: calc(100vh - 60px);
    border-right: 0; border-radius: 16px 16px 0 0; box-shadow: 0 -6px 24px rgba(0, 0, 0, .18);
    padding: 0 14px calc(10px + env(safe-area-inset-bottom));
    transition: height .2s ease;
  }
  #sidebar.full { --sheet: 88vh; }
  .sheet-handle { display: flex; justify-content: center; align-items: center; position: sticky; top: 0; z-index: 2;
    width: calc(100% + 28px); margin: 0 -14px; height: 26px; border: 0; border-radius: 16px 16px 0 0; background: var(--bg); }
  .sheet-handle span { width: 42px; height: 5px; border-radius: 3px; background: #cfc6b6; }
  button, select, input[type=search], input[type=date] { min-height: 40px; }
  .chips button { min-height: 32px; }
  button.link { min-height: 32px; }
  h1 { font-size: 18px; }
  .leaflet-control-layers, .leaflet-control-zoom { margin-top: 10px !important; }
  .height-info { display: none; }
  .draw-bar { left: 50%; top: max(12px, env(safe-area-inset-top)); }
  .leaflet-bottom { bottom: calc(var(--sheet, 42vh) + 4px); }
}
@media (prefers-reduced-motion: reduce) { #sidebar { transition: none; } }

/* accounts */
.account { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
#auth-form { display: flex; flex-direction: column; gap: 6px; }
#auth-form input { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
#moderation ul { list-style: none; margin: 6px 0; padding: 0; font-size: 12px; }
#moderation li { display: flex; gap: 6px; align-items: center; padding: 3px 0; }
#moderation li span { flex: 1; }

/* sun reports */
#reports-card #report-note { width: 100%; font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; margin-top: 6px; }
#report-list { list-style: none; margin: 6px 0 0; padding: 0; }
#report-list li { display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding: 6px 0; font-size: 13px; }
#report-list .ok { color: #2a7d4f; font-size: 11px; }
#report-list .bad { color: var(--danger); font-size: 11px; }
.sw.cloud { background: repeating-linear-gradient(90deg, #5f7d9a 0 4px, transparent 4px 7px); }

/* cheapest-pint labels on the map */
.price-tag {
  background: #1f1d1a; color: #ffd24d; font: 600 11px -apple-system, sans-serif; text-align: center;
  border-radius: 9px; padding: 1px 0; box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}

.maptiler-logo { display: block; line-height: 0; margin-bottom: 4px; }

#moderation .queue-heading { font-weight: 600; margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
#moderation li button { white-space: nowrap; }

/* near me + favourites */
.search-row { flex-wrap: nowrap; margin: 0 0 6px; }
.search-row input { flex: 1; min-width: 0; }
.search-row button { white-space: nowrap; }
.near-bar { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 13px;
  background: #fdf0d5; border-radius: 8px; padding: 6px 10px; margin-bottom: 6px; }
.near-bar span { flex: 1 1 100%; font-weight: 600; }
.sun-badge { background: linear-gradient(90deg, #ffd66b var(--sun), #eee7da var(--sun)); color: #5a3d00; font-weight: 600; }
.pub-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.fav { flex: none; border-radius: 999px; padding: 4px 10px; font-size: 13px; margin-top: 4px; }
.fav.on { background: #fdf0d5; border-color: #e3a52b; color: #7a4a00; }

.directions { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.dir-link { display: inline-flex; align-items: center; min-height: 34px; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 500; }
.dir-link:hover { border-color: var(--accent); }

/* map display options */
.display-opts { display: flex; flex-wrap: wrap; gap: 8px 12px; margin: 10px 0 4px; }
.display-opts label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.display-opts select { font-size: 13px; }
.hours-legend { margin: 4px 0; }
.hours-ramp { height: 10px; border-radius: 5px;
  background: linear-gradient(90deg, rgb(35,45,95), rgb(95,80,150) 25%, rgb(190,95,120) 50%, rgb(240,150,60) 75%, rgb(255,215,90)); }
.hours-ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 2px; }
.leaflet-shadows-pane.multiply { mix-blend-mode: multiply; }

.offline-bar { position: fixed; z-index: 1100; top: 0; left: 0; right: 0; text-align: center; font-size: 13px; font-weight: 600;
  padding: 6px 10px calc(6px) ; padding-top: max(6px, env(safe-area-inset-top)); background: #1f1d1a; color: #fbf8f2; }

.drawing-note { background: #fdf0d5; border-radius: 8px; padding: 8px 10px; color: #5a3d00; margin: 6px 0; }

.osm-draw { margin: 8px 0; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.osm-draw summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); }
.osm-draw ol { margin: 6px 0; padding-left: 18px; }
.osm-draw ol li { margin: 2px 0; }
.osm-link { margin: 4px 0 2px; }
