/* ===== Colori e misure: cambiali qui e cambiano ovunque ===== */
:root {
  --bg: #FBF7F1;          /* sabbia */
  --surface: #FFFFFF;
  --ink: #1E2A2B;
  --muted: #5F6B6A;
  --line: #E8E0D4;
  --primary: #2F6B4F;     /* verde eucalipto */
  --primary-ink: #FFFFFF;
  --primary-soft: #E3EFE8;
  --accent: #D9633B;      /* terracotta / outback */
  --accent-soft: #FBE7DE;
  --danger: #B3261E;
  --ok: #2F6B4F;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(30, 42, 43, .06), 0 4px 16px rgba(30, 42, 43, .06);
  --font: "DM Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-head: "Bricolage Grotesque", var(--font);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  min-height: 100vh;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
img { max-width: 100%; display: block; }
a { color: var(--primary); }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.8rem, 6vw, 2.6rem); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 1.35rem; font-weight: 800; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0 0 1rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* ===== Barra in alto ===== */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; gap: 12px;
  background: rgba(251, 247, 241, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-family: var(--font-head); font-weight: 800; font-size: 1.2rem; }
.brand img { width: 34px; height: 34px; object-fit: contain; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.lang {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 6px 10px; font: 700 .8rem var(--font); cursor: pointer;
}

/* ===== Contenitore pagine ===== */
main { max-width: 720px; margin: 0 auto; padding: 20px 16px 32px; outline: none; }
.page-head { margin-bottom: 18px; }

/* ===== Bottoni ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border: 1px solid transparent; border-radius: var(--radius);
  font: 700 1rem var(--font); text-decoration: none; cursor: pointer;
  background: var(--primary); color: var(--primary-ink);
  transition: transform .05s ease, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.accent { background: var(--accent); }
.btn.ghost { background: transparent; color: var(--primary); padding: 0 8px; min-height: 40px; }
.btn.danger { background: var(--surface); color: var(--danger); border-color: var(--line); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: .9rem; border-radius: var(--radius-sm); }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== Card ===== */
.card {
  overflow-wrap: anywhere;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.stack > * + * { margin-top: 12px; }

/* ===== Home ===== */
.hero {
  background: var(--primary); color: #fff;
  border-radius: calc(var(--radius) + 6px);
  padding: 28px 20px; margin-bottom: 28px; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -60px; bottom: -60px;
  width: 200px; height: 200px; border-radius: 50%; background: var(--accent); opacity: .9;
}
.hero > * { position: relative; z-index: 1; }
.hero p { opacity: .92; max-width: 46ch; }
.hero .btn.secondary { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.35); }
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 28px; }
@media (min-width: 560px) { .cat-grid { grid-template-columns: repeat(4, 1fr); } }
.cat {
  display: flex; flex-direction: column; gap: 6px; padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink); font-weight: 700;
}
.cat .ico { font-size: 1.6rem; }
.steps { display: grid; gap: 10px; margin-bottom: 28px; counter-reset: s; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step::before {
  counter-increment: s; content: counter(s);
  flex: 0 0 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800;
  background: var(--accent-soft); color: var(--accent);
}
.step p { margin: 0; }
.biz-cta { background: var(--accent-soft); border-color: transparent; box-shadow: none; }

/* ===== Form ===== */
form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 700; font-size: .95rem; }
label .opt { font-weight: 400; color: var(--muted); }
input, select, textarea {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: 1rem var(--font);
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible {
  outline: 3px solid var(--primary-soft); border-color: var(--primary); outline-offset: 1px;
}
.row2 { display: grid; gap: 14px; }
@media (min-width: 560px) { .row2 { grid-template-columns: 1fr 1fr; } }
.form-error { color: var(--danger); font-weight: 500; min-height: 1.2em; margin: 0; }

/* ===== Scelta ruolo ===== */
.choice { display: grid; gap: 12px; }
.choice button {
  text-align: left; display: flex; gap: 14px; align-items: center;
  padding: 18px; border-radius: var(--radius); border: 2px solid var(--line);
  background: var(--surface); cursor: pointer; font: inherit; color: inherit;
}
.choice button:hover { border-color: var(--primary); }
.choice .ico { font-size: 2rem; }
.choice b { display: block; font-size: 1.05rem; }

/* ===== Liste ===== */
.list { display: grid; gap: 12px; }
.item-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 700; white-space: nowrap;
  background: var(--primary-soft); color: var(--primary);
}
.badge.warn { background: var(--accent-soft); color: var(--accent); }
.badge.grey { background: #EFEBE4; color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: .875rem; margin: 6px 0 10px; }
.matches { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 10px; display: grid; gap: 6px; }
.match { display: flex; justify-content: space-between; gap: 10px; font-size: .92rem; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.fav { border: none; background: none; font-size: 1.4rem; cursor: pointer; color: var(--accent); line-height: 1; width: 44px; height: 44px; margin: -8px -8px 0 0; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.notice { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); color: #7A3317; font-size: .92rem; }
.notice.ok { background: var(--primary-soft); color: var(--primary); }
.unread { border-left: 4px solid var(--accent); }
.success { text-align: center; padding: 28px 16px; }
.success .big { font-size: 3rem; }

/* ===== Menu in basso (telefono) ===== */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 700;
  padding: 4px 0; position: relative;
}
.bottom-nav a .ico { font-size: 1.25rem; }
.bottom-nav a.active { color: var(--primary); }
.dot { position: absolute; top: 2px; right: calc(50% - 16px); width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px;
  font-weight: 500; opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100% - 32px); z-index: 20;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
footer.site { text-align: center; color: var(--muted); font-size: .85rem; padding: 24px 0 8px; }
.spinner { text-align: center; color: var(--muted); padding: 40px 0; }
.sel { user-select: all; }
.center { text-align: center; }
.prose h2 { font-size: 1.1rem; margin-top: 1.2rem; }
.prose p { max-width: 65ch; }
