/* Paghetta — identità visiva: il mondo del maneggio (paddock, sella, fieno, coccarde).
   Layout: una colonna centrata (max 1040px), card solo dove servono. */
@import url('/css/fonts.css');

:root {
  --bg: #f3f5ef;
  --surface: #ffffff;
  --surface-2: #e9eee3;
  --ink: #1b2219;
  --muted: #5e6a59;
  --line: #d6ddcf;
  --accent: #2c7a4b;        /* paddock */
  --accent-ink: #ffffff;
  --accent-soft: #dcefe2;
  --saddle: #a65e2e;        /* cuoio */
  --hay: #e9c46a;           /* fieno */
  --hay-ink: #4a3a05;
  --pos: #2a78d6;           /* bonus (grafici) */
  --neg: #e34948;           /* malus (grafici) */
  --pos-soft: #dbe8fa;
  --neg-soft: #fadcdc;
  --good: #1f7a37;
  --warn: #b26a00;
  --crit: #c22f2f;
  --shadow: 0 1px 2px rgba(27, 34, 25, .06), 0 8px 24px rgba(27, 34, 25, .06);
  --radius: 14px;
  --font-display: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* colori dei ragazzi */
  --kid-verde: #2c7a4b; --kid-cielo: #2a78d6; --kid-prugna: #7b3fa0;
  --kid-arancio: #d8662a; --kid-rosa: #d14d8a; --kid-sabbia: #a65e2e;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121712; --surface: #1b231c; --surface-2: #232d24; --ink: #edf1e9; --muted: #a6b1a0;
    --line: #33402f; --accent: #5cc07d; --accent-ink: #0d1a10; --accent-soft: #1f3a28;
    --saddle: #d08a5a; --hay: #e9c46a; --hay-ink: #3b2e03;
    --pos: #3987e5; --neg: #e66767; --pos-soft: #1d2f47; --neg-soft: #46201f;
    --good: #5cc07d; --warn: #e2a33a; --crit: #ef6f6f;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    --kid-verde: #5cc07d; --kid-cielo: #5a9cf0; --kid-prugna: #b584d8;
    --kid-arancio: #f08a4e; --kid-rosa: #ee7bb0; --kid-sabbia: #d08a5a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121712; --surface: #1b231c; --surface-2: #232d24; --ink: #edf1e9; --muted: #a6b1a0;
  --line: #33402f; --accent: #5cc07d; --accent-ink: #0d1a10; --accent-soft: #1f3a28;
  --saddle: #d08a5a; --hay: #e9c46a; --hay-ink: #3b2e03;
  --pos: #3987e5; --neg: #e66767; --pos-soft: #1d2f47; --neg-soft: #46201f;
  --good: #5cc07d; --warn: #e2a33a; --crit: #ef6f6f;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  --kid-verde: #5cc07d; --kid-cielo: #5a9cf0; --kid-prugna: #b584d8;
  --kid-arancio: #f08a4e; --kid-rosa: #ee7bb0; --kid-sabbia: #d08a5a;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%;
  background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--hay); outline-offset: 2px; }

.wrap {
  max-width: 1040px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 16px 48px;
}

/* ---------- barra in alto ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding-block: 8px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand .logo { width: 40px; height: 40px; flex: none; }
.brand .name { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; letter-spacing: .01em; }
.brand .sub { font-size: .85rem; color: var(--muted); display: block; line-height: 1.2; }

/* ---------- componenti ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.stack { display: grid; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 9px 16px; font-weight: 700; cursor: pointer; line-height: 1.2;
  min-height: 40px; text-decoration: none; transition: transform .06s ease, background .15s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--crit); border-color: var(--crit); background: transparent; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 5px 12px; min-height: 32px; font-size: .9rem; }
.btn.icon { width: 36px; height: 36px; padding: 0; min-height: 0; border-radius: 50%; }

.chip {
  display: inline-flex; align-items: center; gap: 8px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); padding: 8px 14px;
  font-weight: 700; cursor: pointer; line-height: 1.2; text-align: left; min-height: 40px;
}
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.chip .pts { font-family: var(--font-display); font-size: .95rem; color: var(--muted); }
.chip.on .pts { color: var(--accent); }
.chip .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; font-size: .8rem; }
.chip.on .tick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  border: none; background: transparent; padding: 8px 14px; border-radius: 999px; cursor: pointer;
  font-weight: 700; color: var(--muted); min-height: 40px;
}
.tab[aria-selected="true"] { background: var(--ink); color: var(--bg); }

.kid-tab { display: inline-flex; align-items: center; gap: 8px; }
.kid-tab .avatar { font-size: 1.2rem; }

.avatar-big {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  font-size: 1.8rem; background: var(--kid, var(--accent-soft)); color: #fff; flex: none;
}

.pill {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px;
  font-size: .8rem; font-weight: 800; background: var(--surface-2); color: var(--muted);
}
.pill.pos { background: var(--pos-soft); color: var(--pos); }
.pill.neg { background: var(--neg-soft); color: var(--neg); }
.pill.hay { background: var(--hay); color: var(--hay-ink); }

/* ---------- form ---------- */
label.field { display: grid; gap: 6px; font-weight: 700; font-size: .92rem; }
label.field span.hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
.input, input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; border: 1.5px solid var(--line); background: var(--surface); border-radius: 10px;
  padding: 10px 12px; min-height: 44px; font-weight: 600;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.error { color: var(--crit); font-weight: 700; }
.ok { color: var(--good); font-weight: 700; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 700;
  box-shadow: var(--shadow); z-index: 50; max-width: calc(100vw - 32px); text-align: center;
  animation: toast-in .2s ease;
}
.toast.err { background: var(--crit); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } * { transition: none !important; } }

/* ---------- dashboard figli ---------- */
.hero {
  display: grid; gap: 16px; grid-template-columns: 1.1fr 1fr; align-items: stretch;
}
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; } }
.balance { display: grid; gap: 6px; }
.balance .amount { font-family: var(--font-display); font-weight: 700; font-size: clamp(2.6rem, 7vw, 3.6rem); line-height: 1; }
.balance .amount .cur { font-size: .5em; color: var(--muted); margin-left: 4px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.stat .v { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; line-height: 1.1; }
.stat .l { font-size: .78rem; color: var(--muted); font-weight: 700; }
@media (max-width: 420px) { .stats { grid-template-columns: 1fr 1fr; } }

/* percorso verso l'obiettivo: un campo gara con gli ostacoli */
.course { position: relative; height: 84px; margin-top: 8px; }
.course .track {
  position: absolute; left: 0; right: 0; bottom: 18px; height: 10px; border-radius: 999px;
  background: var(--surface-2); overflow: hidden;
}
.course .track .fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--hay)); border-radius: 999px; width: 0; transition: width .6s ease; }
.course .jump {
  position: absolute; bottom: 24px; width: 2px; height: 22px; background: var(--saddle); transform: translateX(-50%);
}
.course .jump::before { content: ""; position: absolute; left: -7px; top: 0; width: 16px; height: 4px; background: var(--saddle); border-radius: 2px; }
.course .jump::after { content: ""; position: absolute; left: -7px; top: 9px; width: 16px; height: 4px; background: var(--saddle); border-radius: 2px; opacity: .55; }
.course .jump.done { background: var(--accent); }
.course .jump.done::before, .course .jump.done::after { background: var(--accent); }
.course .rider {
  position: absolute; bottom: 24px; font-size: 2rem; line-height: 1; transform: translateX(-50%) scaleX(-1);
  transition: left .6s ease; filter: drop-shadow(0 2px 2px rgba(0,0,0,.2));
}
.course .flag { position: absolute; right: 0; bottom: 26px; font-size: 1.5rem; line-height: 1; }
.course .pct { position: absolute; left: 0; bottom: 0; font-size: .8rem; color: var(--muted); font-weight: 700; }
.course .target { position: absolute; right: 0; bottom: 0; font-size: .8rem; color: var(--muted); font-weight: 700; }

.week {
  display: grid; grid-template-columns: minmax(130px, 1.6fr) repeat(7, minmax(32px, 1fr)) minmax(44px, .7fr);
  gap: 4px; align-items: center; font-size: .9rem;
}
.week .h { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 800; text-align: center; padding-bottom: 4px; }
.week .h.today { color: var(--accent); }
.week .h .d { display: block; font-size: .95rem; letter-spacing: 0; }
.week .lab { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 6px; }
.week .lab .pts { color: var(--muted); font-weight: 600; font-size: .8rem; }
.week .cell {
  height: 34px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center;
  font-weight: 800; font-size: .85rem; border: none; padding: 0; cursor: default; color: var(--muted);
}
.week .cell.on { background: var(--accent); color: var(--accent-ink); }
.week .cell.neg { background: var(--neg-soft); color: var(--neg); }
.week .cell.mix { background: var(--pos-soft); color: var(--pos); }
.week .cell.future { background: transparent; border: 1.5px dashed var(--line); }
.week .cell.edit { cursor: pointer; }
.week .cell.edit:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.week .tot { text-align: center; font-family: var(--font-display); font-weight: 600; }
.week-scroll { overflow-x: auto; }
.week-scroll .week { min-width: 560px; }

.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); font-weight: 700; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tooltip {
  position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); padding: 6px 10px;
  border-radius: 8px; font-size: .82rem; font-weight: 700; white-space: nowrap; transform: translate(-50%, -110%);
  z-index: 5;
}

.bars { display: grid; gap: 8px; }
.bars .r { display: grid; grid-template-columns: minmax(90px, 1fr) 3fr auto; gap: 10px; align-items: center; font-size: .9rem; }
.bars .r .lab { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .r .bar { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bars .r .bar i { display: block; height: 100%; border-radius: 999px; background: var(--pos); }
.bars .r.neg .bar i { background: var(--neg); }
.bars .r .v { font-family: var(--font-display); font-weight: 600; min-width: 3ch; text-align: right; }

.moves { display: grid; gap: 0; }
.move { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.move:first-child { border-top: none; }
.move .ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: .95rem; background: var(--pos-soft); color: var(--pos); font-family: var(--font-display); }
.move.neg .ico { background: var(--neg-soft); color: var(--neg); }
.move.pay .ico { background: var(--hay); color: var(--hay-ink); }
.move .t { min-width: 0; }
.move .t .lab { font-weight: 700; overflow-wrap: anywhere; }
.move .t .meta { font-size: .8rem; color: var(--muted); }
.move .amt { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; white-space: nowrap; }

.badges { display: flex; gap: 10px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px;
  background: var(--surface-2); font-weight: 700; font-size: .9rem;
}
.badge.won { background: var(--hay); color: var(--hay-ink); }
.badge .ros { font-size: 1.2rem; }

.empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.empty .big { font-size: 2.5rem; line-height: 1; margin-bottom: 8px; }

/* ---------- area genitori ---------- */
.auth { max-width: 460px; margin: 24px auto; }
.segmented { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.segmented button { border: none; background: transparent; padding: 7px 14px; border-radius: 999px; font-weight: 700; cursor: pointer; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.datebar { display: flex; align-items: center; gap: 8px; }
.datebar .cur { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; min-width: 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.rule-list { display: grid; gap: 8px; }
.rule { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.rule .lab { font-weight: 700; }
.rule .cat { font-size: .78rem; color: var(--muted); }
.rule-edit { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
@media (max-width: 760px) { .rule-edit { grid-template-columns: 1fr 1fr; } .rule-edit .wide { grid-column: 1 / -1; } }
.linkbox { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.linkbox code { background: var(--surface-2); padding: 8px 12px; border-radius: 10px; font-size: .95rem; overflow-wrap: anywhere; flex: 1 1 200px; }
.confirm { display: inline-flex; gap: 6px; align-items: center; }
.kid-card { display: grid; gap: 10px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; background: var(--kid); }
.swatch[aria-pressed="true"] { border-color: var(--ink); }
.emojis { display: flex; gap: 6px; flex-wrap: wrap; }
.emojis button { font-size: 1.4rem; width: 44px; height: 44px; border-radius: 10px; border: 2px solid transparent; background: var(--surface-2); cursor: pointer; }
.emojis button[aria-pressed="true"] { border-color: var(--accent); }

/* ---------- landing ---------- */
.landing { display: grid; gap: 20px; max-width: 760px; margin: 0 auto; }
.landing .intro { text-align: center; display: grid; gap: 10px; justify-items: center; padding-block: 24px 8px; }
.landing .intro h1 { font-size: clamp(2.2rem, 7vw, 3.2rem); }
.landing .intro p { max-width: 52ch; color: var(--muted); font-size: 1.05rem; }
footer.foot { margin-top: 32px; text-align: center; color: var(--muted); font-size: .85rem; }

/* ---------- landing ---------- */
.landing { max-width: 1040px; display: grid; gap: 40px; }
.hero-land { display: grid; grid-template-columns: 1.15fr 1fr; gap: 28px; align-items: center; padding-block: 16px 8px; }
@media (max-width: 820px) { .hero-land { grid-template-columns: 1fr; } }
.hero-text { display: grid; gap: 16px; }
.hero-text h1 { font-size: clamp(2.1rem, 5vw, 3.1rem); font-weight: 700; }
.hero-text .lead { font-size: 1.1rem; max-width: 56ch; }
.hero-card { display: grid; gap: 8px; }
.section { display: grid; gap: 14px; }
.section > h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.steps-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.step { display: grid; gap: 8px; align-content: start; }
.step .n { width: 36px; height: 36px; border-radius: 50%; background: var(--hay); color: var(--hay-ink); font-family: var(--font-display); font-weight: 700; display: grid; place-items: center; }
.grid-3 { display: grid; gap: 18px 24px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.why { display: grid; gap: 6px; align-content: start; padding-left: 14px; border-left: 3px solid var(--accent-soft); }
.why p { color: var(--muted); }

/* ---------- percorso guidato ---------- */
.wizard { display: grid; gap: 16px; }
.wiz-steps { display: flex; gap: 6px; flex-wrap: wrap; }
.wiz-steps span { font-size: .8rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.wiz-steps span.cur { background: var(--ink); color: var(--bg); }
.wiz-steps span.done { background: var(--accent-soft); color: var(--accent); }
.options { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.option { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; text-align: left; padding: 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.option:hover { border-color: var(--accent); }
.option[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.option .em { font-size: 1.5rem; line-height: 1; }
.option .t { font-weight: 800; }
.option .d { font-size: .85rem; color: var(--muted); }
.wiz-kid { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.rule-check { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.rule-check input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); }
.rule-check .lab { font-weight: 700; }
.rule-check .cat { font-size: .78rem; color: var(--muted); }
.rule-check input[type="number"] { width: 84px; min-height: 36px; padding: 4px 8px; }
.wiz-nav { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 14px; }
.summary dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.summary dt { font-weight: 800; color: var(--muted); }
.summary dd { margin: 0; }

/* ---------- azioni dei ragazzi: richieste, spese ---------- */
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions .btn { flex: 1 1 auto; }
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.panel-open { border-top: 1px solid var(--line); padding-top: 14px; }
input.pin { font-size: 1.6rem; letter-spacing: .4em; text-align: center; max-width: 220px; }
.reqs { display: grid; gap: 0; }
.req { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.req:first-child { border-top: none; }
.req .ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); font-size: 1.1rem; }
.req .t { min-width: 0; display: grid; gap: 3px; }
.req .lab { font-weight: 800; }
.req .txt { overflow-wrap: anywhere; }
.req .meta { font-size: .8rem; color: var(--muted); }
.req .answer { background: var(--accent-soft); border-radius: 10px; padding: 8px 10px; font-weight: 600; overflow-wrap: anywhere; }
.req .answer::before { content: "↩ "; color: var(--accent); }
.req.open { background: var(--surface-2); border-radius: 12px; padding: 12px; border-top: none; margin-bottom: 8px; }
.req .reply { display: grid; gap: 8px; grid-column: 1 / -1; }
.move.spesa .ico { background: var(--surface-2); color: var(--ink); font-size: 1.1rem; }
.bars.money .v { color: var(--ink); }

/* ---------- condivisione, WhatsApp ---------- */
.btn.wa { background: #25d366; border-color: #25d366; color: #073b1c; }
.btn.wa:hover { filter: brightness(1.05); }
.wa-ico { font-weight: 900; }
.share-menu {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: grid; gap: 8px; z-index: 60; min-width: 260px; max-width: calc(100vw - 32px);
}
.toast.with-action { display: inline-flex; gap: 12px; align-items: center; }
.toast-btn { border: none; background: var(--hay); color: var(--hay-ink); border-radius: 999px; padding: 4px 12px; font-weight: 800; cursor: pointer; }

/* ---------- installazione come app ---------- */
.pwa-banner {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; align-items: center; z-index: 55;
  width: min(560px, calc(100vw - 24px)); padding: 12px 14px; border: 1px solid var(--line);
}
.pwa-banner img { border-radius: 10px; }
.pwa-banner .t { display: grid; min-width: 0; }
.pwa-banner .row { grid-column: 1 / -1; justify-content: flex-end; }
.pwa-help {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: grid; gap: 10px; z-index: 56; width: min(520px, calc(100vw - 24px)); border: 1px solid var(--line);
}
.pwa-help ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

/* ---------- area genitori: barra in basso su telefono ---------- */
.tab .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 999px; background: var(--neg); color: #fff; font-size: .72rem; padding: 0 6px; margin-left: 4px; }
.tab[aria-selected="true"] .count { background: var(--hay); color: var(--hay-ink); }
@media (max-width: 700px) {
  #app { padding-bottom: 76px; }
  #tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(6, 1fr); gap: 0;
    background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px max(6px, env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -6px 20px rgba(27, 34, 25, .08);
  }
  #tabs .tab { display: grid; justify-items: center; gap: 2px; padding: 4px 2px; border-radius: 10px; font-size: .68rem; line-height: 1.1; min-height: 52px; position: relative; }
  #tabs .tab::before { content: attr(data-icon); font-size: 1.25rem; line-height: 1; }
  #tabs .tab .label { display: none; }
  #tabs .tab::after { content: attr(data-short); }
  #tabs .tab[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
  #tabs .tab .count { position: absolute; top: 2px; right: 6px; margin: 0; }
  /* con la barra in basso (solo area genitori, da dentro), avvisi e menu salgono sopra di lei */
  body.has-bottom-nav .pwa-banner, body.has-bottom-nav .share-menu, body.has-bottom-nav .toast { bottom: max(84px, calc(env(safe-area-inset-bottom, 0px) + 84px)); }
}
@media (pointer: coarse) {
  .week .cell { height: 40px; }
  .week .cell.edit { min-width: 40px; }
}
.pin-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pin-row input { max-width: 140px; }
.switch { display: flex; gap: 10px; align-items: center; font-weight: 700; }
.switch input { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); }

/* ---------- vasetti, riflessione, pazienza ---------- */
.jars { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-top: 4px; }
.jar { display: grid; gap: 2px; background: var(--surface-2); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.jar .ico { font-size: 1.1rem; line-height: 1; }
.jar .v { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; }
.jar .l { font-size: .75rem; color: var(--muted); font-weight: 700; }
.opp { color: var(--saddle); font-weight: 700; }
.opp[hidden] { display: none; }
.move.off { opacity: .6; }
.premio { border: 2px solid var(--hay); }
@media (max-width: 480px) {
  /* richieste e spese in riflessione: su telefono i bottoni vanno sotto il testo, non accanto */
  .req { grid-template-columns: auto 1fr; }
  .req > .row, .req > .btn, .req > .pill, .req > .confirm { grid-column: 2; justify-self: start; }
}

/* ---------- membri della famiglia ---------- */
.members { display: grid; gap: 0; }
.member { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.member:first-child { border-top: none; }
.member .lab { font-weight: 800; }
.member .meta { font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.member select { width: auto; min-height: 36px; padding: 4px 8px; }
.consent a { color: var(--accent); }
@media (max-width: 480px) { .member { grid-template-columns: 1fr; } }

/* tendina con «Altro…» */
.pick { display: grid; gap: 6px; }
.pick input[hidden] { display: none; }
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; padding-right: 34px; cursor: pointer; }
