/* Viaggi — tema "bianco ghiaccio": arioso, luminoso, tasti grigio chiaro, testo nero */
:root {
  --bg: #f3f6f9;          /* bianco ghiaccio */
  --surface: #ffffff;
  --surface-2: #eef2f6;   /* grigio chiarissimo per riquadri secondari */
  --btn: #e6ebf0;         /* tasti grigio chiaro */
  --btn-hover: #d9e0e7;
  --text: #0f1419;
  --muted: #5b6672;
  --line: #e1e7ed;
  --accent: #0f1419;      /* il nero fa da colore principale */
  --good: #17803d;
  --bad: #c0362c;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(15, 20, 25, .04), 0 8px 24px rgba(15, 20, 25, .05);
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3, .brand em, .module-title, .section {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  letter-spacing: .005em;
}
h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); line-height: 1.1; margin: 0 0 6px; }
h2 { font-size: 1.5rem; margin: 0 0 8px; }
h3 { font-size: 1.2rem; margin: 0 0 6px; line-height: 1.25; }
h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 14px 0 4px; font-weight: 600; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.lead { font-size: 1.05rem; }
.neg { color: var(--bad); }
.pos { color: var(--good); }

/* ---------- Barra in alto ---------- */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px max(16px, env(safe-area-inset-left));
  background: rgba(243, 246, 249, .86);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { text-decoration: none; font-size: 1.35rem; display: flex; align-items: center; gap: 8px; }
.brand-mark {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  background: var(--text); color: #fff; font-size: 1rem; font-style: normal;
}
.topnav { display: flex; gap: 4px; }
.topnav a {
  text-decoration: none; padding: 7px 14px; border-radius: 999px; font-size: .92rem; font-weight: 500; color: var(--muted);
}
.topnav a.active, .topnav a:hover { background: var(--btn); color: var(--text); }

main { max-width: 1080px; margin: 0 auto; padding: 20px 16px 48px; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 0 16px 32px; }

/* ---------- Stato sincronizzazione ---------- */
.sync-dot {
  margin-left: auto; margin-right: 8px; display: flex; align-items: center; gap: 6px;
  text-decoration: none; font-size: .78rem; color: var(--muted);
}
.sync-dot i { width: 9px; height: 9px; border-radius: 50%; background: #c3cad2; display: block; }
.sync-dot.ok i { background: var(--good); }
.sync-dot.saving i { background: #d8a019; }
.sync-dot.code i, .sync-dot.setup i { background: var(--bad); }
.sync-dot.off span, .sync-dot.unavailable span { display: none; }
.sync-state { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.sync-state.ok { color: var(--good); }
.sync-state.code, .sync-state.setup { color: var(--bad); }

/* ---------- Campi del profilo ---------- */
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.field { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); }
.field input { border: 1px solid var(--line); background: var(--bg); border-radius: var(--radius-sm); padding: 9px 12px; color: var(--text); }

/* ---------- Tasti ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 999px; padding: 10px 18px;
  background: var(--btn); color: var(--text); font-weight: 500; font-size: .95rem;
  text-decoration: none; cursor: pointer; transition: background .15s, transform .1s;
}
.btn:hover { background: var(--btn-hover); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--text); color: #fff; }
.btn.primary:hover { background: #2a323b; }
.btn.small { padding: 6px 14px; font-size: .85rem; }
.btn.wide { width: 100%; margin: 12px 0; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.x { border: none; background: none; color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.x:hover { background: var(--surface-2); color: var(--bad); }

/* ---------- Etichette ---------- */
.tag, .chip {
  display: inline-block; font-size: .76rem; font-weight: 500; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); font-family: var(--sans); font-style: normal;
}
.tag.strong { background: var(--text); color: #fff; }
.tag.light { background: rgba(255, 255, 255, .9); color: var(--text); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: .85rem; padding: 5px 12px; background: var(--btn); color: var(--text); }

/* ---------- Home ---------- */
.page-title { margin: 12px 0 24px; }
.trip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; align-items: start; }
.trip-card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  text-decoration: none; display: flex; flex-direction: column; transition: transform .15s;
}
a.trip-card:hover { transform: translateY(-3px); }
.trip-card .photo.cover { aspect-ratio: 16 / 9; }
.trip-card-body { padding: 18px 20px 20px; }
.trip-card-body h2 { margin-top: 10px; }
.trip-card.new { border: 2px dashed var(--line); box-shadow: none; background: transparent; }
.template {
  background: var(--surface); border-radius: var(--radius-sm); padding: 12px; font-size: .8rem; white-space: pre-wrap;
  border: 1px solid var(--line); margin: 10px 0;
}

/* ---------- Foto ---------- */
.photo { margin: 0; position: relative; overflow: hidden; background: var(--surface-2); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo figcaption {
  position: absolute; right: 8px; bottom: 6px; font-size: .62rem; color: rgba(255, 255, 255, .85);
  background: rgba(0, 0, 0, .35); padding: 1px 6px; border-radius: 6px; max-width: 70%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.photo figcaption a { text-decoration: none; }
.photo.thumb { aspect-ratio: 16 / 9; border-radius: var(--radius-sm); margin: -4px -4px 12px; }

/* ---------- Testata del viaggio / giorno ---------- */
.hero { position: relative; border-radius: calc(var(--radius) + 6px); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 16px; }
.hero .hero-img { height: clamp(240px, 46vw, 440px); }
.hero .hero-img figcaption { top: 8px; bottom: auto; }
.hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, .62) 100%);
}
.hero-text { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 24px; color: #fff; z-index: 1; }
.hero-text h1 { color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, .3); margin-top: 8px; }
.hero-text p { margin: 0; opacity: .92; }

/* ---------- Navigazione a pillole (giorni e strumenti) ---------- */
.pills { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: thin; }
.pill {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px; text-decoration: none;
  background: var(--btn); padding: 8px 14px 8px 8px; border-radius: 16px; font-size: .85rem; line-height: 1.2;
  transition: background .15s;
}
.pill small { color: var(--muted); }
.pill:hover { background: var(--btn-hover); }
.pill-n {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px;
  background: var(--surface); font-weight: 700;
}
.pill.active { background: var(--text); color: #fff; }
.pill.active small { color: rgba(255, 255, 255, .7); }
.pill.active .pill-n { background: rgba(255, 255, 255, .16); }
.pills.tools .pill { padding: 9px 16px; border-radius: 999px; }
.pills.tools { margin-bottom: 12px; }

/* ---------- Tasti dei moduli del giorno ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 18px 0; scroll-margin-top: 70px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-decoration: none;
  background: var(--btn); border-radius: var(--radius); padding: 16px; font-weight: 500; font-size: .92rem;
  transition: background .15s, transform .1s;
}
.tile:hover { background: var(--btn-hover); transform: translateY(-1px); }
.tile-icon { font-size: 1.5rem; line-height: 1; }
.tile.active { background: var(--text); color: #fff; }

/* ---------- Contenuti ---------- */
.module { margin-top: 8px; }
.module-title { font-size: 1.7rem; margin: 10px 0 14px; }
.module-title .muted { font-size: 1.2rem; }
.section { font-size: 1.45rem; margin: 30px 0 12px; }
h3.sub { margin: 18px 0 10px; }

.card {
  background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  margin-bottom: 14px; display: block; text-decoration: none;
}
.card.soft { background: var(--surface-2); box-shadow: none; }
.card.intro { font-size: 1.02rem; }
.card.verdict { border-left: 4px solid var(--text); }
.card.is-chosen { outline: 2px solid var(--text); }
.card.is-done { opacity: .62; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.cards .card { margin-bottom: 0; display: flex; flex-direction: column; }
.cards.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-bottom: 14px; }
.card-top { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.card-foot { margin-top: auto; padding-top: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.links { display: flex; gap: 12px; flex-wrap: wrap; }
.ext { font-size: .86rem; font-weight: 500; text-decoration: none; border-bottom: 1px solid var(--line); }
.ext:hover { border-color: var(--text); }
.price { font-weight: 600; font-size: 1.05rem; }
.advice { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; font-size: .9rem; margin-top: 8px; }
.card.soft .advice { background: var(--surface); }
.rating { font-size: .7rem; letter-spacing: 2px; color: var(--muted); font-style: normal; vertical-align: middle; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 10px 0 0; font-size: .9rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .9rem; }
.check input { width: 18px; height: 18px; accent-color: var(--text); }

.dishes { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 18px; }
.dishes div { display: flex; flex-direction: column; font-size: .9rem; }
.dishes span { color: var(--muted); }

.transfer { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 14px; }
.transfer a { margin-left: 6px; font-size: .88rem; }

.leg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 8px; }
.leg-opt { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px; }
.leg-opt.preferred { outline: 2px solid var(--text); }
.leg-head { font-weight: 600; }

/* ---------- Percorso a piedi ---------- */
.route-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.route-stats { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; }
.map { height: 300px; border-radius: var(--radius-sm); margin-top: 12px; background: var(--surface-2); z-index: 0; }
.map.tall { height: 360px; }
.pin span {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--text); color: #fff; font: 600 12px/1 var(--sans); border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}
.timeline { list-style: none; padding: 0; margin: 8px 0 0; }
.timeline li { display: grid; grid-template-columns: 50px 30px 1fr; gap: 10px; position: relative; padding-bottom: 16px; }
.timeline li:not(:last-child)::before {
  content: ''; position: absolute; left: 74px; top: 30px; bottom: 0; width: 2px; background: var(--line);
}
.tl-time { font-weight: 600; font-variant-numeric: tabular-nums; padding-top: 4px; font-size: .9rem; }
.tl-dot {
  width: 30px; height: 30px; border-radius: 50%; background: var(--btn); display: grid; place-items: center;
  font-weight: 700; font-size: .85rem;
}
.tl-body p { margin: 4px 0 0; font-size: .93rem; }
.walk { font-size: .8rem; color: var(--muted); margin-bottom: 2px; }
.tl-body .small.muted { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Panoramica ---------- */
.route-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0 0; }
.route-line span { background: var(--btn); padding: 6px 14px; border-radius: 999px; font-weight: 500; }
.route-line i { color: var(--muted); font-style: normal; }
.day-list { display: grid; gap: 10px; }
.day-row {
  display: grid; grid-template-columns: 96px 1fr 20px; gap: 14px; align-items: center; text-decoration: none;
  background: var(--surface); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow);
}
.day-row img { width: 96px; height: 72px; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-2); }
.day-row strong { font-family: var(--serif); font-style: italic; font-size: 1.15rem; font-weight: 600; }
.day-row .go { font-size: 1.6rem; color: var(--muted); }
.day-row:hover { background: #fafbfc; }
.tips li { margin-bottom: 6px; }

/* ---------- Numeri e budget ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 6px 0 12px; }
.stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; flex-direction: column; }
.stat span { font-size: .8rem; color: var(--muted); }
.stat strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.stats.big .stat { background: var(--surface); box-shadow: var(--shadow); }
.stats.big .stat strong { font-size: 1.6rem; }
.bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 8px 0; }
.bar > div { height: 100%; background: var(--text); border-radius: 999px; }
.bar.over > div { background: var(--bad); }
.budget-teaser { color: inherit; }
.table { width: 100%; border-collapse: collapse; }
.table td { padding: 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; padding-left: 12px; }
.table tr.total td { font-weight: 700; font-size: 1.1rem; border-bottom: 2px solid var(--text); }
.cmp ul { padding-left: 18px; margin: 0; font-size: .92rem; }
.cmp .btn { margin-top: 14px; }

/* ---------- Liste e form ---------- */
.rows { list-style: none; padding: 0; margin: 0 0 12px; }
.rows li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.rows li:last-child { border-bottom: none; }
.rows li.is-done label { text-decoration: line-through; color: var(--muted); }
.grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.inline { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.inline input, .inline select, textarea {
  border: 1px solid var(--line); background: var(--bg); border-radius: var(--radius-sm); padding: 9px 12px; min-width: 0;
}
.inline input.grow { flex: 1 1 200px; }
.inline .num-in { width: 100px; }
textarea { width: 100%; min-height: 180px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--text); outline-offset: 1px; }

.forecast { display: flex; align-items: center; gap: 14px; }
.forecast .big { font-size: 2.6rem; }

.prevnext { display: flex; justify-content: space-between; margin-top: 24px; }

@media (max-width: 600px) {
  main { padding: 14px 12px 40px; }
  .hero-text { padding: 16px; }
  .hero .hero-img { height: 340px; }
  .sync-dot span { display: none; }
  .hero .hero-img figcaption { max-width: 55%; }
  .cards { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .tile { padding: 12px; font-size: .86rem; }
  .card { padding: 16px; }
  .timeline li { grid-template-columns: 44px 26px 1fr; gap: 8px; }
  .timeline li:not(:last-child)::before { left: 64px; }
  .tl-dot { width: 26px; height: 26px; }
  .day-row { grid-template-columns: 72px 1fr 16px; }
  .day-row img { width: 72px; height: 60px; }
}
