:root {
  --navy: #0A192F;
  --primary: #005FB0;
  --primary-2: #0284C7;
  --gold: #C9A227;
  --gold-dark: #8a6f12;
  --cyan: #22D3EE;
  --bg: #F7F9FC;
  --surface: #FFFFFF;
  --on-bg: #0F1B2D;
  --on-surface: #0F1B2D;
  --on-surface-var: #5B6677;
  --outline: #E2E8F0;
  --error: #DC2626;
  --ok: #16A34A;
  --pending: #CA8A04;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(10,25,47,.08), 0 2px 8px rgba(10,25,47,.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--on-bg);
  overscroll-behavior-y: none;
}

#app { max-width: 560px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }

.screen { flex: 1; padding: 16px 16px 96px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.tabs {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px;
  display: flex; justify-content: space-around;
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  border-top: 1px solid var(--outline);
  padding: env(safe-area-inset-bottom, 0) 0 6px;
  z-index: 50;
}
.tab {
  flex: 1; border: none; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px 6px; color: var(--on-surface-var); font: inherit;
}
.tab-ico { font-size: 20px; line-height: 1; }
.tab-lbl { font-size: 10px; font-weight: 600; }
.tab.active { color: var(--primary); }
.tab.active .tab-ico { transform: translateY(-1px); }

.card {
  background: var(--surface); border: 1px solid var(--outline);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
h1, h2, h3 { margin: 0 0 6px; }
h2.section { font-size: 18px; margin: 18px 0 10px; font-weight: 700; }
.muted { color: var(--on-surface-var); font-size: 13px; }

/* Hero header (programma) */
.hero {
  background: linear-gradient(135deg, #0A192F 0%, #005FB0 55%, #0284C7 100%);
  border-radius: 20px; padding: 20px; color: #fff; margin-bottom: 16px;
  border: 1px solid rgba(255,255,255,.15); box-shadow: var(--shadow);
}
.hero .badge {
  display: inline-flex; align-items: center; gap: 6px; background: var(--gold);
  color: var(--navy); font-size: 11px; font-weight: 800; padding: 5px 10px; border-radius: 10px;
}
.hero h1 { font-size: 22px; font-weight: 800; margin: 12px 0 4px; }
.hero .sub { color: var(--gold); font-weight: 600; font-size: 15px; }
.hero .graduates { color: rgba(255,255,255,.85); font-size: 12px; margin-top: 8px; line-height: 1.5; }
.hero .meta { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 14px; }
.hero .meta small { opacity: .9; }

/* ticker auguri */
.ticker {
  background: var(--navy); color: #fff; border-radius: 12px; padding: 12px 14px;
  margin-bottom: 16px; display: flex; gap: 10px; align-items: center;
}
.ticker .emoji { font-size: 20px; }
.ticker .txt { flex: 1; font-size: 13px; line-height: 1.4; }
.ticker .heart { background: rgba(255,255,255,.12); border: none; color: #fff; border-radius: 999px; padding: 6px 10px; font-size: 12px; cursor: pointer; }

/* timeline */
.timeline { display: flex; gap: 12px; align-items: stretch; }
.timeline .col-time { width: 52px; text-align: center; flex-shrink: 0; }
.timeline .time { font-size: 11px; font-weight: 700; }
.timeline .dot { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 6px auto; font-size: 14px; }
.timeline .line { width: 2px; min-height: 40px; background: var(--outline); margin: 0 auto; }
.timeline .body { flex: 1; padding-bottom: 16px; }
.timeline .t-title { font-size: 14px; font-weight: 700; }
.timeline .t-loc { font-size: 12px; color: var(--primary); font-weight: 600; margin: 2px 0; }
.timeline .t-det { font-size: 12px; color: var(--on-surface-var); margin-top: 4px; line-height: 1.45; }

/* chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chip { background: var(--outline); color: var(--on-surface); border: none; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; cursor: pointer; }
.chip.active { background: var(--primary); color: #fff; }

/* forms */
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: var(--on-surface-var); }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--outline); border-radius: 10px;
  font: inherit; font-size: 14px; background: #fff; color: var(--on-surface);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); border-color: var(--primary); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; cursor: pointer; padding: 11px 16px; border-radius: 12px;
  font: inherit; font-size: 14px; font-weight: 700; width: 100%;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-ghost { background: var(--outline); color: var(--on-surface); }
.btn:disabled { opacity: .5; }
.btn-row { display: flex; gap: 8px; }

/* status pills */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.pill-conf { background: #DCFCE7; color: #166534; }
.pill-pend { background: #FEF9C3; color: #854D0E; }
.pill-decl { background: #FEE2E2; color: #991B1B; }

/* guest row */
.row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--outline); }
.row:last-child { border-bottom: none; }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-weight: 600; font-size: 14px; }
.row .cat { font-size: 12px; color: var(--on-surface-var); }
.icon-btn { background: none; border: none; cursor: pointer; padding: 6px; font-size: 18px; color: var(--on-surface-var); }

/* seat meter */
.meter { height: 10px; background: var(--outline); border-radius: 999px; overflow: hidden; margin: 8px 0; }
.meter > span { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--primary)); }

/* map */
#map { height: 260px; border-radius: var(--radius); margin-top: 10px; border: 1px solid var(--outline); }
.leaflet-popup-content .mp-title { font-weight: 700; font-size: 13px; }
.leaflet-popup-content .mp-sub { color: var(--on-surface-var); font-size: 12px; }

/* wishes list */
.wish { background: var(--surface); border: 1px solid var(--outline); border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.wish .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.wish .author { font-weight: 700; font-size: 13px; }
.wish .target { font-size: 11px; color: var(--primary); font-weight: 600; }
.wish .msg { font-size: 13px; line-height: 1.45; color: var(--on-surface); }
.wish .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }

/* photos */
.photo { background: var(--surface); border: 1px solid var(--outline); border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.photo .placeholder { background: linear-gradient(135deg, var(--navy), var(--primary)); height: 140px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.7); font-size: 28px; margin-bottom: 8px; }
.photo img.thumb { width: 100%; height: 160px; object-fit: cover; border-radius: 10px; margin-bottom: 8px; }

/* gifts */
.gift { margin-bottom: 14px; }
.gift .gname { font-weight: 700; font-size: 15px; }
.gift .grole { font-size: 12px; color: var(--on-surface-var); }
.gift .gtitle { font-size: 13px; font-weight: 600; margin-top: 6px; }
.gift .gbar { height: 10px; background: var(--outline); border-radius: 999px; overflow: hidden; margin: 8px 0; }
.gift .gbar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-dark)); }
.gift .pay { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.gift .pay a { font-size: 11px; font-weight: 700; padding: 6px 10px; border-radius: 8px; text-decoration: none; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(10,25,47,.5); display: flex; align-items: flex-end; justify-content: center; z-index: 100; }
.modal { background: #fff; width: 100%; max-width: 560px; border-radius: 20px 20px 0 0; padding: 20px 18px calc(env(safe-area-inset-bottom, 0) + 24px); max-height: 90vh; overflow-y: auto; }
.modal h3 { font-size: 18px; margin-bottom: 12px; }
.fab { position: fixed; right: 18px; bottom: 84px; z-index: 40; background: var(--primary); color: #fff; border: none; border-radius: 18px; padding: 14px 18px; font: inherit; font-weight: 700; font-size: 14px; box-shadow: 0 4px 14px rgba(0,95,176,.4); cursor: pointer; }
.close { float: right; background: none; border: none; font-size: 22px; color: var(--on-surface-var); cursor: pointer; }
.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 13px; z-index: 200; opacity: 0; transition: opacity .3s; pointer-events: none; }
.toast.show { opacity: 1; }
.empty { text-align: center; color: var(--on-surface-var); padding: 30px 16px; font-size: 14px; }

/* barra di stato connessione */
.status-bar { font-size: 12px; text-align: center; padding: 6px 12px; font-weight: 600; }
.status-bar.warn { background: #FEF3C7; color: #92400E; border-bottom: 1px solid #FDE68A; }
.status-bar.hidden { display: none; }

/* hero: pulsanti in alto a destra */
.hero .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hero .icon-round { background: rgba(255,255,255,.15); color: #fff; border: none; width: 36px; height: 36px; border-radius: 50%; font-size: 17px; cursor: pointer; position: relative; }
.hero .icon-round .dot { position: absolute; top: -3px; right: -3px; background: #DC2626; color: #fff; font-size: 10px; font-weight: 800; border-radius: 999px; min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

/* riquadro notifiche push */
.push-card { border-color: rgba(0,95,176,.25); background: #EEF5FF; }
.push-card b { display: block; font-size: 14px; }
.push-card .muted { margin-top: 4px; }

/* stato RSVP a tre pulsanti (come l'app Android) */
.status-row { display: flex; gap: 6px; margin-top: 8px; }
.status-btn { flex: 1; border: 1px solid transparent; background: var(--outline); color: var(--on-surface-var); border-radius: 10px; padding: 7px 4px; font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; }
.status-btn.conf { background: #DCFCE7; color: #166534; border-color: #86EFAC; }
.status-btn.pend { background: #FEF9C3; color: #854D0E; border-color: #FDE047; }
.status-btn.decl { background: #FEE2E2; color: #991B1B; border-color: #FCA5A5; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }
.btn-danger { background: #FEE2E2; color: #991B1B; }
