/* Vacanza — stile "Riva": salino chiaro, blu maiolica, giallo ombrellone */
:root {
  --bg: #F2F6F7;
  --card: #FFFFFF;
  --ink: #12303E;
  --ink-soft: #5A7482;
  --line: #DCE6EA;
  --blu: #0E5AA7;
  --blu-dark: #0A4076;
  --sole: #E8B004;
  --ok: #2E9E6B;
  --warn: #D4553A;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(18, 48, 62, 0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  padding-bottom: 84px;
}
h1, h2, h3, .display { font-family: 'Bricolage Grotesque', -apple-system, sans-serif; }

/* Header con striscia ombrellone */
header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.stripe {
  height: 6px;
  background: repeating-linear-gradient(90deg,
    var(--blu) 0 28px, #fff 28px 34px, var(--sole) 34px 62px, #fff 62px 68px);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
}
.header-inner h1 { font-size: 19px; font-weight: 700; letter-spacing: -0.2px; }
.header-inner .sub { font-size: 12px; color: var(--ink-soft); }
.avatars { display: flex; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff; margin-left: -8px;
}
.avatar.me { box-shadow: 0 0 0 2px var(--sole); }

main { padding: 16px; max-width: 640px; margin: 0 auto; }

/* Tab bar */
nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: var(--card); border-top: 1px solid var(--line);
  display: flex; justify-content: space-around;
  padding: 6px 0 max(10px, env(safe-area-inset-bottom));
}
nav.tabs button {
  background: none; border: none; font: inherit;
  color: var(--ink-soft); font-size: 11px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 4px 12px; border-radius: 10px; cursor: pointer;
}
nav.tabs button .ico { font-size: 21px; line-height: 1; }
nav.tabs button.active { color: var(--blu); }

/* Card ed elementi */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--line);
  padding: 14px; margin-bottom: 12px;
}
.section-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--ink-soft); margin: 18px 0 8px;
}
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--ink-soft); font-size: 13px; }
.small { font-size: 12px; }

button.primary, button.ghost, button.danger {
  font: inherit; font-weight: 600; border-radius: 12px;
  padding: 12px 18px; cursor: pointer; border: none;
}
button.primary { background: var(--blu); color: #fff; width: 100%; }
button.primary:active { background: var(--blu-dark); }
button.ghost { background: none; border: 1.5px solid var(--line); color: var(--ink); }
button.danger { background: none; color: var(--warn); border: 1.5px solid var(--warn); }
button:disabled { opacity: 0.5; }

.fab {
  position: fixed; right: 18px; bottom: 88px; z-index: 25;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--sole); color: var(--ink); border: none;
  font-size: 28px; font-weight: 400; cursor: pointer;
  box-shadow: 0 4px 14px rgba(18,48,62,0.25);
}

input, select, textarea {
  font: inherit; width: 100%;
  padding: 11px 12px; border: 1.5px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blu); border-color: var(--blu); }
label { font-size: 13px; font-weight: 600; display: block; margin: 12px 0 5px; }
.field-row { display: flex; gap: 10px; }
.field-row > div { flex: 1; }

/* Itinerario */
.day-head {
  display: flex; align-items: baseline; gap: 8px;
  margin: 20px 0 8px; padding-bottom: 4px;
  border-bottom: 2px solid var(--ink);
}
.day-head .dnum { font-family: 'Bricolage Grotesque', sans-serif; font-size: 22px; font-weight: 800; }
.day-head .dlabel { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.event {
  display: flex; gap: 10px; padding: 11px 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; margin-bottom: 8px; cursor: pointer;
}
.event .etime { font-size: 13px; font-weight: 700; min-width: 44px; color: var(--blu); }
.event .etitle { font-weight: 600; font-size: 15px; }
.event .emeta { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  white-space: nowrap;
}
.badge.booked { background: #E2F3EB; color: var(--ok); }
.badge.todo { background: #FBEFD3; color: #8A6A00; }
.cat-ico { font-size: 18px; }

/* Spese */
.balance-hero { text-align: center; padding: 18px 14px; }
.balance-hero .big { font-family: 'Bricolage Grotesque', sans-serif; font-size: 34px; font-weight: 800; }
.budget-bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.budget-bar > div { height: 100%; background: var(--blu); border-radius: 99px; }
.budget-bar > div.over { background: var(--warn); }
.settle {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 12px;
  background: #EDF4FB; margin-bottom: 8px; font-size: 15px;
}
.settle .arrow { color: var(--blu); font-weight: 800; }
.settle .amt { margin-left: auto; font-weight: 800; }
.exp-item { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.exp-item:last-child { border-bottom: none; }
.exp-item .amt { font-weight: 700; white-space: nowrap; }
.net-pos { color: var(--ok); font-weight: 700; }
.net-neg { color: var(--warn); font-weight: 700; }

/* Foto */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.photo-grid img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 8px; display: block; cursor: pointer;
}
.photo-grid .ph-wrap { position: relative; }
.photo-grid .ph-wrap.selected img { outline: 3px solid var(--sole); outline-offset: -3px; }
.photo-grid .ph-check {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px;
  border-radius: 50%; background: var(--sole); color: var(--ink);
  display: none; align-items: center; justify-content: center; font-size: 13px; font-weight: 800;
}
.photo-grid .ph-wrap.selected .ph-check { display: flex; }

/* Checklist */
.chk-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.chk-item:last-child { border-bottom: none; }
.chk-item input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--ok); flex-shrink: 0; }
.chk-item .done { text-decoration: line-through; color: var(--ink-soft); }

/* Modali */
.modal-back {
  position: fixed; inset: 0; background: rgba(18,48,62,0.5);
  z-index: 50; display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--card); border-radius: 20px 20px 0 0;
  width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
}
.modal h2 { font-size: 19px; margin-bottom: 4px; }
.modal .actions { display: flex; gap: 10px; margin-top: 18px; }
.modal .actions button { flex: 1; }
.close-x {
  float: right; background: var(--bg); border: none; width: 32px; height: 32px;
  border-radius: 50%; font-size: 16px; cursor: pointer; color: var(--ink-soft);
}

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; background: rgba(10,20,26,0.94); z-index: 60;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.lightbox img { max-width: 100%; max-height: 78vh; border-radius: 8px; }
.lightbox .lb-bar { display: flex; gap: 12px; margin-top: 14px; }
.lightbox button { background: rgba(255,255,255,0.14); color: #fff; border: none; border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; }
.lightbox .lb-cap { color: #cfe0ea; font-size: 13px; margin-top: 8px; text-align: center; padding: 0 20px; }

/* Collage */
.collage-canvas-wrap { position: relative; width: 100%; }
#collageCanvas { width: 100%; border-radius: 12px; touch-action: none; display: block; border: 1px solid var(--line); }
.sticker-tray { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.sticker-tray button {
  font-size: 24px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; width: 44px; height: 44px; cursor: pointer;
}
.layout-pick { display: flex; gap: 8px; margin: 10px 0; }
.layout-pick button {
  flex: 1; padding: 9px; border-radius: 10px; border: 1.5px solid var(--line);
  background: #fff; font: inherit; font-weight: 600; cursor: pointer; font-size: 13px;
}
.layout-pick button.on { border-color: var(--blu); background: #EDF4FB; color: var(--blu); }

/* Login / setup */
.auth-wrap { max-width: 420px; margin: 8vh auto 0; padding: 0 18px; }
.auth-wrap .logo { text-align: center; margin-bottom: 22px; }
.auth-wrap .logo .sun { font-size: 48px; }
.auth-wrap h1 { font-size: 26px; text-align: center; }
.auth-wrap .tag { text-align: center; color: var(--ink-soft); font-size: 14px; margin-top: 4px; }
.pick-person { display: grid; gap: 8px; margin-top: 14px; }
.pick-person button {
  display: flex; align-items: center; gap: 12px; padding: 13px;
  background: #fff; border: 1.5px solid var(--line); border-radius: 12px;
  font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; text-align: left;
}
.pick-person button.on { border-color: var(--blu); background: #EDF4FB; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 100px; background: var(--ink); color: #fff;
  padding: 11px 18px; border-radius: 12px; font-size: 14px; z-index: 100;
  max-width: 90vw; text-align: center;
}
.empty { text-align: center; color: var(--ink-soft); padding: 34px 20px; font-size: 14px; }
.empty .big-ico { font-size: 40px; display: block; margin-bottom: 8px; }
.hidden { display: none !important; }
@media (prefers-reduced-motion: no-preference) {
  .modal { animation: up 0.22s ease; }
  @keyframes up { from { transform: translateY(30px); opacity: 0.6; } }
}
