:root {
  --bg: #EEF2F8;
  --map: #E2E8F1;
  --ink: #0B0D12;
  --ink-2: #1F2430;
  --muted: #3E4553;
  --muted-2: #4F5563;
  --accent: #0A6CFF;
  --accent-dark: #06419A;
  --accent-soft: rgba(10, 108, 255, 0.12);
  --accent-line: rgba(10, 108, 255, 0.5);
  --accent-glass: rgba(10, 108, 255, 0.86);
  --accent-shadow: rgba(10, 108, 255, 0.3);
  --minus: #B4430B;
  --glass: rgba(255, 255, 255, 0.66);
  --glass-strong: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(255, 255, 255, 0.95);
  --line: rgba(11, 13, 18, 0.08);
  --display: Manrope, Inter, system-ui, sans-serif;
  --body: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='300' viewBox='0 0 420 300' fill='none'%3E%3Crect width='420' height='300' fill='%23E2E8F1'/%3E%3Cpath d='M-10 60H430M-10 150H430M-10 240H430M70 -10V310M180 -10V310M290 -10V310M400 -10V310' stroke='%23fff' stroke-width='10'/%3E%3Cpath d='M-20 260 L 220 -10' stroke='%23fff' stroke-width='18'/%3E%3Cpath d='M40 270 C 100 250, 150 190, 210 175 S 330 120, 380 40' stroke='%230A6CFF' stroke-width='6' stroke-linecap='round'/%3E%3C/svg%3E"),
    radial-gradient(420px 360px at 110% 55%, rgba(10,108,255,0.18), transparent 70%),
    radial-gradient(380px 320px at -15% 92%, rgba(10,108,255,0.13), transparent 70%);
  background-repeat: no-repeat;
  background-size: 100% 300px, auto, auto;
  background-attachment: scroll, fixed, fixed;
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap {
  max-width: 540px;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(120px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.wrap.no-tabs { padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

/* superfici */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  backdrop-filter: blur(10px) saturate(160%);
  box-shadow: 0 12px 30px rgba(11, 13, 18, 0.07);
}
.pad { padding: 16px; }
.blue {
  background: var(--accent-glass);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 26px;
  box-shadow: 0 18px 36px var(--accent-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.dashed { background: var(--accent-soft); border: 1px dashed var(--accent-line); border-radius: 22px; }
.note { font-size: 13px; color: var(--muted); }
.small { font-size: 12px; color: var(--muted-2); }
.label { font-size: 12px; color: var(--muted-2); }
.strong { font-weight: 600; }
.center { text-align: center; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 6px 4px 0; }
.section-title h2 { font-size: 18px; }
.empty { padding: 20px; text-align: center; color: var(--muted); border: 1px dashed rgba(11,13,18,0.15); border-radius: 20px; background: rgba(255,255,255,0.45); }

/* intestazione */
.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 10px; }
.logo { width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; }
.brand { font-family: var(--display); font-weight: 800; font-size: 19px; line-height: 1.1; }
.avatar { width: 42px; height: 42px; flex: none; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font: 800 14px var(--display); display: flex; align-items: center; justify-content: center; text-decoration: none; }
.back { width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.page-title { font-size: 21px; }

/* pulsanti */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 16px; border: 1px solid rgba(11,13,18,0.12);
  background: rgba(255,255,255,0.8); color: var(--ink); font-weight: 600; font-size: 15px;
  cursor: pointer; text-decoration: none; text-align: center;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.blue-btn { background: var(--accent); color: #fff; border-color: transparent; }
.btn.danger { color: var(--minus); border-color: var(--minus); background: #fff; }
.btn.big { min-height: 58px; border-radius: 20px; font: 700 17px var(--display); box-shadow: 0 14px 30px rgba(11,13,18,0.2); }
.btn.block { width: 100%; }
.btn.pill { min-height: 40px; border-radius: 999px; padding: 0 16px; font-size: 14px; white-space: nowrap; flex: none; }
.btn.link { background: transparent; border: 0; min-height: 40px; padding: 0 6px; text-decoration: underline; }

.hero { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hero-btn {
  display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
  min-height: 140px; padding: 16px; border-radius: 26px; text-decoration: none; color: inherit;
}
.hero-btn .ico { width: 46px; height: 46px; border-radius: 15px; display: flex; align-items: center; justify-content: center; }
.hero-btn.blue .ico { background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.35); }
.hero-btn.glass .ico { background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent); }
.hero-btn b { display: block; font: 800 19px/1.12 var(--display); }
.hero-btn small { display: block; margin-top: 4px; font-size: 13px; opacity: 0.9; }

.strip { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; border-radius: 20px; background: var(--ink); color: #fff; text-decoration: none; box-shadow: 0 12px 26px rgba(11,13,18,0.22); }
.strip .ico { width: 40px; height: 40px; flex: none; border-radius: 13px; background: var(--accent); display: flex; align-items: center; justify-content: center; }
.strip small { display: block; font-size: 12px; color: rgba(255,255,255,0.72); }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; font-size: 14px; color: var(--ink-2); }

/* schede */
.card { display: flex; flex-direction: column; gap: 12px; padding: 16px; cursor: pointer; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; background: rgba(11,13,18,0.06); font-size: 14px; font-weight: 600; }
.price { font: 800 24px var(--display); white-space: nowrap; }
.route { display: flex; align-items: center; gap: 10px; }
.route .end { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.route .end.right { align-items: flex-end; text-align: right; }
.route .end span:first-child { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-2); }
.route .end span:last-child { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.route .line { flex: 1; min-width: 40px; position: relative; height: 30px; display: flex; align-items: center; justify-content: center; }
.route .line::before { content: ""; position: absolute; left: 0; right: 0; top: 14px; border-top: 2px dashed var(--accent-line); }
.route .dot { position: relative; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 14px var(--accent-shadow); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13px; color: var(--muted); }
.meta span { display: inline-flex; align-items: center; gap: 5px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid currentColor; }
.pill.ok { color: var(--accent-dark); }
.pill.warn { color: var(--minus); }
.pill.off { color: var(--muted-2); }
.disp { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.disp .ico { width: 40px; height: 40px; flex: none; border-radius: 13px; background: #fff; color: var(--accent); display: flex; align-items: center; justify-content: center; }

/* moduli */
form { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.field { display: flex; flex-direction: column; gap: 4px; padding: 10px 14px; border-radius: 18px; background: var(--glass-strong); border: 1px solid var(--glass-border); }
.field > span { font-size: 12px; color: var(--muted-2); }
.field input, .field select, .field textarea { border: 0; background: transparent; padding: 0; outline: none; font-weight: 600; font-size: 16px; width: 100%; min-height: 26px; }
.field textarea { min-height: 60px; resize: vertical; font-weight: 500; }
.field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field.money { flex-direction: row; align-items: center; justify-content: space-between; min-height: 72px; padding: 0 18px; border-radius: 22px; }
.field.money.blue { background: var(--accent-glass); border-color: rgba(255,255,255,0.45); color: #fff; }
.field.money input { font: 800 30px var(--display); text-align: right; width: 140px; color: #fff; }
.ico-tile { width: 40px; height: 40px; flex: none; border-radius: 13px; background: #fff; color: var(--accent); display: flex; align-items: center; justify-content: center; }
.card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.field.money input::placeholder { color: rgba(255,255,255,0.6); }
.route-box { position: relative; padding: 4px 16px; }
.route-box .r { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.route-box .r + .r { border-top: 1px solid var(--line); }
.route-box .r .pin { width: 28px; height: 28px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; }
.route-box label { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.route-box input { border: 0; background: transparent; padding: 0; outline: none; font-weight: 600; font-size: 17px; width: 100%; }
.route-box .swap { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(11,13,18,0.08); background: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 4px 12px rgba(11,13,18,0.08); }
details.more { border-radius: 18px; border: 1px dashed rgba(11,13,18,0.18); background: rgba(255,255,255,0.45); padding: 0 14px; }
details.more > summary { list-style: none; cursor: pointer; min-height: 52px; display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] { padding-bottom: 14px; }
details.more[open] > summary { margin-bottom: 4px; }
details.more .stack { gap: 10px; }

.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.options.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opt { position: relative; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 12px; border-radius: 18px; background: var(--glass); border: 1px solid var(--glass-border); cursor: pointer; font-size: 14px; font-weight: 500; }
.options.three .opt { justify-content: center; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt svg { flex: none; color: var(--accent); }
.opt:has(input:checked) { background: var(--accent-glass); color: #fff; border-color: rgba(255,255,255,0.45); font-weight: 600; box-shadow: 0 10px 24px var(--accent-shadow); }
.opt:has(input:checked) svg { color: #fff; }
.opt:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.opt.black:has(input:checked) { background: var(--ink); box-shadow: 0 10px 24px rgba(11,13,18,0.25); }
.only-scegli { display: none; }
form:has(input[name="partenza"][value="scegli"]:checked) .only-scegli { display: flex; }
.only-altro { display: none; }
form:has(input[name="luogo"][value="altro"]:checked) .only-altro { display: flex; }
.step { font: 800 18px var(--display); margin: 0 0 8px 4px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }

.sugg { display: flex; align-items: center; gap: 12px; padding: 12px; }
.sugg .ico { width: 36px; height: 36px; flex: none; border-radius: 12px; background: #fff; color: var(--accent); display: flex; align-items: center; justify-content: center; }

/* dettaglio corsa */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 15px; margin: 0; }
.kv dt { color: var(--muted-2); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.confirm { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 18px; border: 1px solid var(--minus); background: #fff; }

/* conti */
.total { display: flex; flex-direction: column; gap: 4px; padding: 22px 20px; }
.total .n { font: 800 52px/1.05 var(--display); letter-spacing: -0.02em; }
.person { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; }
.initials { width: 44px; height: 44px; flex: none; border-radius: 14px; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; font: 700 14px var(--display); }
.amt { font: 800 20px var(--display); white-space: nowrap; }
.amt.plus { color: var(--accent-dark); }
.amt.minus { color: var(--minus); }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 4px; border-radius: 16px; background: rgba(11,13,18,0.05); }
.seg a { min-height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none; }
.seg a[aria-current="page"] { background: var(--ink); color: #fff; font-weight: 600; }
.lines { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.lines div { display: flex; justify-content: space-between; gap: 10px; }
.lines div span:last-child { white-space: nowrap; }

/* barra in basso */
.tabbar {
  position: fixed; left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  max-width: 508px; margin: 0 auto; height: 66px; padding: 0 8px; z-index: 20;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: center;
  border-radius: 24px; background: rgba(255,255,255,0.78); border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(14px) saturate(160%); backdrop-filter: blur(14px) saturate(160%);
  box-shadow: 0 12px 32px rgba(11,13,18,0.14);
}
.tabbar a { height: 46px; border-radius: 16px; display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600; }
.tabbar a span { display: none; }
.tabbar a[aria-current="page"] { background: var(--ink); color: #fff; }
.tabbar a[aria-current="page"] span { display: inline; }

/* accesso */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: flex-end; }
.login-card { display: flex; flex-direction: column; gap: 14px; padding: 22px 18px 18px; border-radius: 30px; background: rgba(255,255,255,0.78); }
.otp { letter-spacing: 0.4em; font: 800 28px var(--display) !important; text-align: center; }
.phone { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 0 16px; border-radius: 18px; background: #fff; border: 2px solid var(--accent); }
.phone input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font: 600 18px var(--body); }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  width: min(480px, calc(100% - 32px)); z-index: 50; padding: 13px 16px; border-radius: 16px;
  background: var(--ink); color: #fff; font-weight: 600; font-size: 15px; box-shadow: 0 12px 30px rgba(11,13,18,0.3);
}
.toast.err { background: var(--minus); }
.loading { min-height: 70vh; display: flex; align-items: center; justify-content: center; color: var(--muted); }
pre.copy { white-space: pre-wrap; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; margin: 0; padding: 12px; border-radius: 14px; background: #fff; border: 1px solid var(--line); overflow-wrap: anywhere; }
