:root {
  --honey: #f5b700;
  --honey-soft: #fff3c4;
  --ink: #23201a;
  --muted: #6d675c;
  --line: #e7e0d2;
  --bg: #fffaf0;
  --card: #ffffff;
  --ok: #2e7d32;
  --warn: #b26a00;
  --bad: #c62828;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; padding-bottom: calc(72px + env(safe-area-inset-bottom)); font-size: 17px; }
a { color: inherit; }

.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: var(--honey);
}
.top h1 { flex: 1; margin: 0; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back { text-decoration: none; font-size: 30px; line-height: 1; margin-right: 10px; padding: 0 4px; }
.pill { border: 0; border-radius: 999px; padding: 6px 11px; font-size: 13px; font-weight: 600; background: #fff; white-space: nowrap; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.bad { color: #fff; background: var(--bad); }

main { max-width: 640px; margin: 0 auto; padding: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card h3 { margin: 0 0 6px; }
.trip-on { border: 2px solid var(--honey); }
.hello { font-size: 22px; font-weight: 700; margin: 4px 0 12px; }
.section { margin: 20px 2px 8px; font-size: 16px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.warn-text { color: var(--bad); }
.banner { background: var(--honey-soft); border-radius: 10px; padding: 10px 12px; font-size: 15px; margin: 0 0 12px; }

label { display: block; margin: 0 0 12px; font-weight: 600; font-size: 15px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 5px; font: inherit; font-weight: 400; padding: 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; min-height: 48px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--honey); border-color: transparent; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; }
legend { font-weight: 600; font-size: 15px; padding: 0 4px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; padding: 8px 0; }
label.check input { width: 22px; min-height: 22px; height: 22px; margin: 2px 0 0; flex: none; }
label.toggle { display: flex; gap: 10px; align-items: center; font-weight: 400; margin-top: 12px; }
label.toggle input { width: 22px; min-height: 22px; margin: 0; }
details summary { cursor: pointer; padding: 8px 0; color: var(--muted); }
.row2, .row3 { display: flex; gap: 10px; }
.row2 > *, .row3 > * { flex: 1; min-width: 0; }
.grow { flex: 1; min-width: 0; }
.sub { padding: 10px; background: #faf6ec; border-radius: 10px; margin-bottom: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 10px 16px;
  font: inherit; font-weight: 600; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  text-decoration: none; cursor: pointer; margin: 4px 0; width: auto;
}
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.big { width: 100%; min-height: 56px; font-size: 18px; }
.btn.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.link { border: 0; background: none; color: var(--muted); text-decoration: underline; min-height: 36px; }
.btn.small { min-height: 36px; padding: 6px 10px; font-size: 14px; }
.btn:disabled { opacity: .5; }

.list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; text-decoration: none; min-height: 60px;
}
.list-item b { display: block; }
.list-item .muted { display: block; }
.icon { font-size: 26px; width: 34px; text-align: center; flex: none; }
.chev { font-size: 24px; color: var(--muted); }
.right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex: none; }
.badge { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: #eee; white-space: nowrap; }
.badge.s-done, .badge.ok { background: #e3f2e5; color: var(--ok); }
.badge.s-needs_recheck, .badge.warn { background: #fff0d6; color: var(--warn); }
.badge.s-closed, .badge.bad { background: #fde3e3; color: var(--bad); }
.badge.s-not_visited { background: #eef0f4; color: #4a5160; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip { padding: 8px 12px; border-radius: 999px; background: var(--honey-soft); text-decoration: none; font-weight: 600; }

.town-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 14px; }
.cat {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 8px 4px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 11px; line-height: 1.15; text-decoration: none;
}
.cat span { font-size: 24px; }
.cat b { font-size: 11px; color: var(--muted); }
.cat.active { background: var(--honey); border-color: var(--honey); }
.cat.active b { color: var(--ink); }

.fab {
  position: fixed; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 4;
  background: var(--ink); color: #fff; padding: 16px 20px; border-radius: 999px; font-weight: 700;
  text-decoration: none; box-shadow: 0 4px 14px rgba(0,0,0,.25);
}

.photo-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 120px;
  border: 2px dashed var(--honey); border-radius: var(--radius); background: var(--honey-soft); font-size: 20px; cursor: pointer; text-align: center;
}
.photo-box.big { min-height: 200px; }
.photo-box span { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.photo-box img { max-width: 100%; max-height: 320px; border-radius: 10px; }
.capture h4 { margin: 16px 0 8px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 12px 0; }
.seg > * { flex: 1; border: 0; background: #fff; padding: 12px 6px; font: inherit; font-weight: 600; text-align: center; text-decoration: none; min-height: 48px; text-transform: capitalize; }
.seg > * + * { border-left: 1px solid var(--line); }
.seg .on { background: var(--ink); color: #fff; }
.seg.small > * { font-size: 14px; padding: 8px 4px; min-height: 40px; }
.ticks { display: flex; flex-wrap: wrap; gap: 8px; }
.tick {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 12px; font: inherit; font-size: 15px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer;
}
.tick span { font-size: 20px; }
.tick.on { background: var(--honey); border-color: var(--honey); font-weight: 600; }
.tick.on::after { content: "✓"; }
.sticky-bottom { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); padding-top: 10px; background: linear-gradient(transparent, #fff 30%); }

nav#nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav#nav a { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 8px 2px; font-size: 12px; text-decoration: none; color: var(--muted); min-height: 60px; }
nav#nav a span { font-size: 22px; }
nav#nav a.active { color: var(--ink); font-weight: 700; }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%); top: calc(64px + env(safe-area-inset-top)); z-index: 20;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; max-width: 90vw; text-align: center; font-weight: 600;
}
dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(92vw, 480px); }
dialog::backdrop { background: rgba(0,0,0,.45); }
.dialog-body { padding: 18px 18px 6px; }
.dialog-body h3 { margin-top: 0; }
.dialog-buttons { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px 18px; justify-content: flex-end; }
table.summary { width: 100%; border-collapse: collapse; }
table.summary td { padding: 8px 0; border-bottom: 1px solid var(--line); }
table.summary td:last-child { text-align: right; font-weight: 700; }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; }
.tabs a { padding: 8px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; white-space: nowrap; font-weight: 600; font-size: 14px; }
.tabs a.active { background: var(--ink); color: #fff; }
.review-photo { width: 100%; max-height: 360px; object-fit: cover; border-radius: 10px; margin-bottom: 8px; }
.notes { background: #faf6ec; padding: 10px; border-radius: 8px; white-space: pre-wrap; }
.table-wrap { overflow-x: auto; }
table.grid { border-collapse: collapse; font-size: 13px; background: #fff; }
table.grid th, table.grid td { border: 1px solid var(--line); padding: 6px 8px; white-space: nowrap; }
.login { max-width: 420px; margin: 20px auto; }
.logo { font-size: 56px; text-align: center; }
.footer { margin-top: 30px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
code { background: #f1ede3; padding: 2px 5px; border-radius: 4px; font-size: 12px; }
@media (min-width: 560px) { .cat-grid { grid-template-columns: repeat(5, 1fr); } }

/* ---------------------------------------------------------------- map */
.view-toggle { margin: 0 0 10px; }
.cat-grid.row { display: flex; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
.cat-grid.row .cat { flex: 0 0 76px; }
.map-box { position: relative; height: 58vh; min-height: 300px; border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: 10px; }
.map-box.tall { height: 64vh; }
.fc-map { overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; background: #e9e5dc; }
.fc-tiles { position: absolute; inset: 0; }
.fc-tiles img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; pointer-events: none; }
.fc-svg { position: absolute; inset: 0; pointer-events: none; }
.fc-track { fill: none; stroke: #c62828; stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; opacity: .85; }
.fc-acc { fill: rgba(33,118,255,.15); stroke: rgba(33,118,255,.5); stroke-width: 1; }
.fc-me { fill: #2176ff; stroke: #fff; stroke-width: 3; }
.fc-markers { position: absolute; inset: 0; pointer-events: none; }
.fc-marker {
  position: absolute; left: -19px; top: -19px; width: 38px; height: 38px; padding: 0; border-radius: 50%;
  background: #fff; border: 3px solid #8a93a6; font-size: 19px; line-height: 1; pointer-events: auto; cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.3); display: flex; align-items: center; justify-content: center;
}
.fc-marker.s-done { border-color: var(--ok); }
.fc-marker.s-needs_recheck { border-color: var(--warn); }
.fc-marker.s-closed { border-color: var(--bad); opacity: .75; }
.fc-ctrl { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.fc-ctrl button { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 22px; font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.2); cursor: pointer; }
.fc-attr { position: absolute; left: 0; bottom: 0; z-index: 2; background: rgba(255,255,255,.9); font-size: 11px; padding: 2px 6px; border-top-right-radius: 6px; }
.fc-attr a { color: #1a5fb4; }
.sheet { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; box-shadow: 0 -2px 10px rgba(0,0,0,.08); }
.sheet-row { display: flex; gap: 10px; align-items: flex-start; }
.sheet-row b, .sheet-row .muted { display: block; }
.map-wrap { position: relative; }
.sheet.overlay { position: absolute; left: 8px; right: 62px; top: 8px; z-index: 3; margin: 0; }
