:root {
  --bg: #f4f6f4;
  --card: #fff;
  --ink: #1b2a1f;
  --muted: #5d6b61;
  --line: #dde4de;
  --accent: #1f5d3a;
  --good: #2e7d32;
  --meh: #f9a825;
  --bad: #c62828;
  --unknown: #9e9e9e;
  --shadow: 0 2px 12px rgba(0, 0, 0, .18);
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink); overflow: hidden;
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; }
.muted { color: var(--muted); }

.app { position: fixed; inset: 0; }
.map { position: absolute; inset: 0; z-index: 0; }

/* overlays sit above Leaflet's panes and controls */
.panel { position: absolute; inset: 0; z-index: 1100; pointer-events: none; }
.panel > * { pointer-events: auto; }

/* --- top bar --- */
.topbar {
  position: absolute; top: max(8px, env(safe-area-inset-top)); left: 8px; right: 8px;
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 10px;
  display: grid; gap: 8px;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.date { display: grid; gap: 2px; font-size: .75rem; color: var(--muted); min-width: 0; }
.date input {
  font: inherit; font-size: .95rem; color: var(--ink); min-height: 44px; width: 100%; min-width: 0;
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.near {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px 0 10px;
  border: 0; border-radius: 18px; background: var(--accent); color: #fff; font-weight: 600; font-size: .85rem; cursor: pointer;
}
.near:disabled { opacity: .6; cursor: wait; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 36px; padding: 0 12px; border-radius: 18px; cursor: pointer; font-size: .85rem;
  border: 1px solid var(--line); background: #fff;
}
.chip.on { background: #e3f1e7; border-color: var(--accent); color: var(--accent); font-weight: 600; }
.sep { flex: none; width: 1px; background: var(--line); margin: 4px 2px; }
.legend { display: flex; align-items: center; gap: 12px; font-size: .75rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.status { margin-left: auto; }
.note { font-size: .85rem; padding: 8px 10px; border-radius: 8px; }
.note.error { background: #fdecea; color: #7a1c1c; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- bottom sheet (mobile) / side panel (desktop) --- */
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 56vh; overflow-y: auto;
  background: var(--card); border-radius: 18px 18px 0 0; box-shadow: 0 -2px 16px rgba(0, 0, 0, .2);
  padding: 6px 16px max(16px, env(safe-area-inset-bottom)); display: grid; gap: 14px; align-content: start;
}
.grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 2px auto 0; }
.head { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; }
.icon-btn { width: 44px; height: 44px; margin: -6px 0 0 -10px; display: grid; place-items: center; border: 0; background: none; border-radius: 22px; cursor: pointer; }
.icon-btn:hover { background: #eef2ee; }
.title h2 { margin: 0; font-size: 1.2rem; line-height: 1.25; }
.meta { margin: 2px 0 0; font-size: .85rem; color: var(--muted); }
h3 { margin: 0 0 6px; font-size: .85rem; color: var(--muted); font-weight: 600; }

.verdict {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 10px 14px; border-radius: 12px;
  color: #fff; font-size: 1.1rem;
}
.verdict .cov { font-size: .75rem; opacity: .9; }
.verdict.lvl-good { background: var(--good); }
.verdict.lvl-meh { background: var(--meh); color: #3b2a00; }
.verdict.lvl-bad { background: var(--bad); }
.verdict.lvl-unknown { background: var(--unknown); }

/* the graphic: one bar per day, coloured by rating */
.bars { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.bar-col { flex: 1 0 58px; display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border-radius: 10px; background: #f6f8f6; }
.bar-word { font-size: .7rem; color: var(--muted); }
.wx { display: block; }
.bar-track { height: 64px; display: flex; align-items: flex-end; width: 100%; justify-content: center; }
.bar { width: 60%; max-width: 30px; border-radius: 6px 6px 2px 2px; transition: height .25s; }
.bar-mm { font-size: .8rem; font-weight: 600; }
.bar-day { font-size: .75rem; color: var(--muted); }

.nights { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.nights li { display: grid; justify-items: center; min-width: 64px; padding: 6px 8px; border-radius: 10px; background: #e8f3ea; font-size: .75rem; }
.nights li.full { background: #f1f1f1; color: var(--muted); }
.nights li.unk { background: #f1f1f1; }
.nights strong { font-size: 1rem; }
.hint { margin: 6px 0 0; font-size: .75rem; color: var(--muted); }
.links { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.links a { color: var(--accent); min-height: 44px; display: inline-flex; align-items: center; }
.links a.primary { background: var(--accent); color: #fff; padding: 0 16px; border-radius: 10px; font-weight: 600; text-decoration: none; }

/* near me list */
.nearby { list-style: none; margin: 0; padding: 0; display: grid; }
.near-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; width: 100%;
  min-height: 52px; padding: 6px 0; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); cursor: pointer;
}
.nearby li:first-child .near-item { border-top: 0; }
.dot { width: 14px; height: 14px; border-radius: 50%; }
.n { display: grid; min-width: 0; }
.n strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini { display: flex; gap: 3px; }
.mini i { width: 10px; height: 22px; border-radius: 3px; }

.leaflet-control-zoom { display: none; }

/* --- desktop: left panel, map fills the rest --- */
@media (min-width: 900px) {
  .panel { inset: 12px auto 12px 12px; width: 380px; display: flex; flex-direction: column; gap: 8px; }
  .topbar { position: static; }
  .sheet { position: static; max-height: none; flex: 1; min-height: 0; border-radius: 14px; box-shadow: var(--shadow); }
  .grab { display: none; }
  .leaflet-control-zoom { display: block; }
}
