:root {
  --bg: #f4f1ec;
  --card: #ffffff;
  --ink: #16202e;
  --muted: #6b7380;
  --line: #e4dfd6;
  --navy: #0f1b2d;
  --accent: #d6453d;
  --gold: #e6b450;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0d131c; --card: #172130; --ink: #eef1f5; --muted: #95a0b0; --line: #263245; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(72px + var(--safe-b));
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }

.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--navy); color: #fff;
  padding: calc(10px + var(--safe-t)) 16px 10px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent); font-weight: 800; letter-spacing: -1px;
}
.brand-title { font-weight: 700; font-size: 17px; }
.brand-sub { font-size: 13px; opacity: .75; }

/* barra dei giorni */
.days {
  display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px 4px;
  scrollbar-width: none; scroll-snap-type: x proximity;
}
.days::-webkit-scrollbar { display: none; }
.day-btn {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--card);
  border-radius: 14px; padding: 8px 12px; text-align: center; min-width: 64px; scroll-snap-align: start;
}
.day-btn small { display: block; font-size: 11px; color: var(--muted); }
.day-btn b { font-size: 15px; }
.day-btn.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.day-btn.on small { color: #c9d2e0; }
.day-btn.today { box-shadow: inset 0 -3px 0 var(--gold); }

.wrap { padding: 8px 16px 16px; }
h1.day-title { font-size: 24px; margin: 8px 0 2px; letter-spacing: -.3px; }
.zone { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.note {
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--gold);
  border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px;
}

/* mappa */
.map-box {
  position: relative; border-radius: 16px; overflow: hidden; background: #dcd6cb;
  border: 1px solid var(--line); height: 240px;
}
.map-box iframe { width: 100%; height: 100%; border: 0; display: block; }
.map-label {
  position: absolute; left: 8px; top: 8px; right: 8px;
  background: rgba(15, 27, 45, .88); color: #fff; font-size: 13px;
  padding: 6px 10px; border-radius: 10px; pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.map-actions { display: flex; gap: 8px; margin: 10px 0 14px; }
.btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 12px; padding: 11px 10px; font-weight: 600; font-size: 14px;
  background: var(--navy); color: #fff; text-decoration: none; cursor: pointer;
}
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }

/* filtri categoria */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 6px 12px; font-size: 14px; white-space: nowrap;
}
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .n { opacity: .6; margin-left: 4px; font-size: 12px; }

/* tappe */
.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: start;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px;
  border-left: 5px solid var(--c, #999); cursor: pointer;
}
.item.sel { outline: 2px solid var(--c); outline-offset: -1px; }
.item.done { opacity: .5; }
.item.done .i-title { text-decoration: line-through; }
.item.now { box-shadow: 0 0 0 3px var(--gold); }
.i-time { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px; }
.i-cat { font-size: 20px; margin-top: 2px; }
.i-title { font-weight: 650; }
.i-where { font-size: 13px; color: var(--muted); }
.i-tip { font-size: 13px; margin-top: 6px; }
.i-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.tag.must { background: var(--accent); color: #fff; border-color: var(--accent); }
.i-side { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.check {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); background: transparent;
  display: grid; place-items: center; font-size: 15px; padding: 0;
}
.item.done .check { background: #2f9e6e; border-color: #2f9e6e; color: #fff; }
.go { font-size: 18px; text-decoration: none; }

details.steps { margin-top: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
details.steps summary { padding: 12px 14px; font-weight: 650; cursor: pointer; }
.step { padding: 10px 14px; border-top: 1px solid var(--line); font-size: 14px; }
.step b { display: block; }
.step .how { color: var(--muted); }
.step .see { margin-top: 2px; }

/* luoghi */
.group h2 { font-size: 18px; margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.place {
  display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 8px;
}
.place .p-main { flex: 1; min-width: 0; }
.place .p-day { font-size: 12px; color: var(--muted); }
.place a { text-decoration: none; font-size: 20px; }

/* info */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.card h2 { font-size: 17px; margin: 0 0 8px; }
.card p { margin: 6px 0; font-size: 14px; }
.row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.row:first-of-type { border-top: 0; }
.row a { color: var(--accent); font-weight: 600; text-decoration: none; white-space: nowrap; }
.fl { display: grid; grid-template-columns: 1fr auto; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.fl:first-of-type { border-top: 0; }
.fl small { color: var(--muted); }
.ul { margin: 0; padding-left: 18px; font-size: 14px; }
.ul li { margin: 6px 0; }
.ck { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.ck:first-of-type { border-top: 0; }
.ck input { width: 20px; height: 20px; accent-color: #2f9e6e; }

/* barra in basso */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.tabs button {
  border: 0; background: none; padding: 8px 0 10px; font-size: 12px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tabs button span { font-size: 20px; }
.tabs button.on { color: var(--accent); font-weight: 700; }

.install {
  position: fixed; left: 12px; right: 12px; bottom: calc(76px + var(--safe-b)); z-index: 40;
  background: var(--navy); color: #fff; border-radius: 14px; padding: 12px 14px;
  display: flex; gap: 10px; align-items: center; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.install button { background: none; border: 0; color: #fff; font-size: 18px; }
.install .share { text-decoration: underline; }
.empty { color: var(--muted); text-align: center; padding: 20px; }
.note.alert { border-left-color: var(--accent); }
.zone a { color: var(--accent); }
.step.alt { cursor: pointer; }
.step a, .step .link { color: var(--accent); text-decoration: none; font-weight: 600; }
