/* Layout: a sinistra il modulo di iscrizione in quattro passi (dati, marcatura, mantello, categoria), a destra gli animali iscritti; sotto, per gli organizzatori, il riepilogo di tutte le iscrizioni. */
  :root {
    --bg: #f3f5f8;
    --surface: #ffffff;
    --ink: #1c2330;
    --muted: #5a6577;
    --line: #d6dce5;
    --accent: #3d5675;
    --accent-soft: #e3e9f1;
    --red: #a23b28;
    --ok: #2f6b4c;
    --warn: #9a6200;
    --h1: #3d5675;   /* allevatore: bigio */
    --h2: #2f6b6b;   /* dati: verde acqua */
    --h3: #6b5a2e;   /* marcatura: bruno */
    --h4: #a23b28;   /* mantello: rosso verga */
    --h5: #5b4b86;   /* categoria: viola */
    --font-display: "Spectral", Georgia, "Times New Roman", serif;
    --font-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
    --r: 6px;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg: #11151b; --surface: #19202a; --ink: #e5e9ef; --muted: #98a3b3; --line: #2b3542;
      --accent: #9db4d1; --accent-soft: #233041; --red: #e2806b; --ok: #7cc19d; --warn: #e3b25a;
      --h1: #9db4d1; --h2: #7cc2c2; --h3: #cdb27a; --h4: #e2806b; --h5: #b3a4e0;
      color-scheme: dark;
    }
  }
  :root[data-theme="dark"] {
    --bg: #11151b; --surface: #19202a; --ink: #e5e9ef; --muted: #98a3b3; --line: #2b3542;
    --accent: #9db4d1; --accent-soft: #233041; --red: #e2806b; --ok: #7cc19d; --warn: #e3b25a;
    --h1: #9db4d1; --h2: #7cc2c2; --h3: #cdb27a; --h4: #e2806b; --h5: #b3a4e0;
    color-scheme: dark;
  }
  body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.5; }
  .wrap { max-width: 76rem; margin: 0 auto; padding-block: 28px 56px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 24px; }
  header { display: grid; gap: 8px; }
  .eyebrow { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 0; }
  h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.7rem, 3.6vw, 2.4rem); line-height: 1.15; margin: 0; text-wrap: balance; }
  h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; margin: 0; text-wrap: balance; }
  h3 { font-size: 1rem; margin: 0; font-weight: 600; }
  .lede { margin: 0; color: var(--muted); max-width: 66ch; }
  .links { display: flex; flex-wrap: wrap; gap: 8px; }
  .navlink { font-size: .85rem; font-weight: 600; color: var(--accent); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; text-decoration: none; background: var(--surface); }
  .navlink:hover { border-color: var(--accent); }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  .status { margin: 0; padding: 10px 14px; border-radius: var(--r); background: var(--accent-soft); font-size: .92rem; }
  .status.warn { color: var(--warn); }

  .layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; align-items: start; }
  @media (max-width: 58rem) { .layout { grid-template-columns: minmax(0, 1fr); } }
  .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: grid; gap: 18px; min-width: 0; }

  fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; min-width: 0; }
  legend { display: flex; align-items: baseline; gap: 10px; padding: 0; margin-bottom: 4px; font-weight: 600; font-size: 1.05rem; }
  /* Ogni passo del modulo ha la sua tinta. */
  .step { --hue: var(--accent); background: color-mix(in srgb, var(--hue) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--hue) 28%, var(--surface)); border-radius: var(--r); padding: 14px 16px 16px; }
  .step legend { float: left; width: 100%; margin-bottom: 6px; }
  .step legend + * { clear: both; }
  .step .stepn { background: var(--hue); }
  .s1 { --hue: var(--h1); } .s2 { --hue: var(--h2); } .s3 { --hue: var(--h3); } .s4 { --hue: var(--h4); } .s5 { --hue: var(--h5); }
  .flabel { font-size: .82rem; color: var(--muted); font-weight: 600; }
  .ticks { display: flex; flex-wrap: wrap; gap: 8px; }
  .ing-rules { margin: 0; padding-left: 1.2rem; display: grid; gap: 2px; font-size: .9rem; color: var(--muted); max-width: 80ch; }
  .ing-select { width: auto; }
  .ing-table td.cage { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; width: 4.5rem; }
  .ing-table tr.cls td { background: var(--accent); color: var(--surface); font-weight: 600; font-size: 1rem; letter-spacing: .02em; }
  .ing-table tr.grp td { background: var(--accent-soft); color: var(--ink); font-weight: 600; font-size: .9rem; }
  .ing-table tr.sub td { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; padding-top: 12px; }
  .ing-table .n { font-family: var(--font-mono); font-size: .76rem; color: var(--muted); margin-right: 6px; }
  .filtri { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
  .filtri .frow { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); gap: 8px; }
  .filtri select, .filtri input { padding: 5px 8px; font-size: .88rem; }
  .filtri .fbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
  .filtri .f-count { font-size: .88rem; color: var(--muted); font-variant-numeric: tabular-nums; }
  .filtri .f-count b { color: var(--ink); }
  .cta-ing { display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: var(--r); background: var(--h3); color: var(--surface); font-size: 1.05rem; font-weight: 600; text-decoration: none; box-shadow: 0 2px 6px color-mix(in srgb, var(--h3) 35%, transparent); }
  .cta-ing:hover { background: color-mix(in srgb, var(--h3) 85%, var(--ink)); }
  .cta-ing:focus-visible { outline: 3px solid var(--h3); outline-offset: 3px; }
  .btn.wa { border-color: color-mix(in srgb, var(--ok) 55%, var(--surface)); color: var(--ok); font-weight: 600; }
  .tick { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; font-size: .95rem; }
  .tick:has(input:checked) { border-color: var(--hue, var(--accent)); box-shadow: inset 0 0 0 1px var(--hue, var(--accent)); font-weight: 600; }
  .tick input { margin: 0; accent-color: var(--hue, var(--accent)); }
  .chips { display: flex; flex-wrap: wrap; gap: 6px; }
  .chip { font: inherit; font-size: .82rem; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
  .chip:hover { border-color: var(--h4); }
  .chip[aria-pressed="true"] { background: var(--h4); border-color: var(--h4); color: var(--surface); font-weight: 600; }
  .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .editing-other { margin: 0; padding: 8px 12px; border-radius: var(--r); background: color-mix(in srgb, var(--warn) 14%, var(--surface)); color: var(--ink); font-size: .9rem; }
  .stepn { font-family: var(--font-mono); font-size: .8rem; color: var(--surface); background: var(--accent); border-radius: 999px; width: 1.6rem; height: 1.6rem; display: inline-grid; place-items: center; flex: none; }
  .hint { margin: 0; color: var(--muted); font-size: .88rem; max-width: 70ch; }
  .grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: 10px; }
  .field { display: grid; gap: 4px; min-width: 0; }
  .field label { font-size: .82rem; color: var(--muted); font-weight: 600; }
  input[type="text"], input[type="search"], input[type="number"], select, textarea { font: inherit; font-size: .95rem; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 7px 10px; width: 100%; min-width: 0; box-sizing: border-box; }
  textarea { min-height: 3.2rem; resize: vertical; }

  .choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 10px; }
  .choice { position: relative; display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); cursor: pointer; text-align: left; font: inherit; color: var(--ink); }
  .choice:hover { border-color: var(--accent); }
  .choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
  .choice b { font-size: .98rem; }
  .choice span { font-size: .84rem; color: var(--muted); line-height: 1.4; }
  .choice .ex { font-size: .78rem; color: var(--muted); font-style: italic; }
  .choice .count { position: absolute; top: 10px; right: 12px; font-family: var(--font-mono); font-size: .72rem; color: var(--muted); font-style: normal; }

  .helper { border: 1px dashed var(--accent); border-radius: var(--r); padding: 14px; display: grid; gap: 10px; background: var(--surface); }
  .helper .q { font-size: .98rem; margin: 0; }
  .helper .qn { font-size: .78rem; color: var(--muted); margin: 0; }
  .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .btn { font: inherit; font-size: .9rem; padding: 7px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
  .btn:hover { border-color: var(--accent); }
  .btn.primary { background: var(--accent); color: var(--surface); border-color: var(--accent); font-weight: 600; }
  .btn.small { font-size: .8rem; padding: 4px 10px; }
  .btn.link { border: 0; background: none; color: var(--accent); padding: 4px 0; font-weight: 600; }
  .btn:disabled { opacity: .5; cursor: not-allowed; }
  .wiz-figs { display: grid; gap: 12px; }
  .wiz-figs figure { margin: 0; display: grid; gap: 4px; }
  .wiz-figs img { width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
  .wiz-figs figcaption { font-size: .8rem; color: var(--muted); }
  .choice:disabled { opacity: .45; cursor: default; }
  .choice:disabled:hover { border-color: var(--line); }
  .verdict { margin: 0; padding: 10px 12px; border-radius: var(--r); background: var(--accent-soft); font-size: .92rem; }

  .mlist { max-height: 18rem; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
  .mgroup { font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 8px 12px 4px; position: sticky; top: 0; background: var(--bg); }
  .mitem { display: flex; gap: 10px; width: 100%; text-align: left; font: inherit; font-size: .9rem; color: var(--ink); background: none; border: 0; border-top: 1px solid var(--line); padding: 7px 12px; cursor: pointer; }
  .mitem:hover { background: var(--accent-soft); }
  .mitem[aria-pressed="true"] { background: var(--accent-soft); font-weight: 600; }
  .mitem .n { font-family: var(--font-mono); font-size: .76rem; color: var(--muted); min-width: 2.6rem; padding-top: 2px; }
  .check { display: inline-flex; gap: 8px; align-items: center; font-size: .9rem; }
  .summary-line { margin: 0; font-size: .9rem; }
  .summary-line b { font-weight: 600; }
  .formmsg { margin: 0; font-size: .88rem; }
  .formmsg.err { color: var(--red); }
  .formmsg.ok { color: var(--ok); }

  .mine { display: grid; gap: 10px; }
  .animal { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 6px; background: var(--bg); }
  .animal-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
  .ring { font-family: var(--font-mono); font-size: .9rem; font-weight: 500; }
  .meta { font-size: .84rem; color: var(--muted); }
  .tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: 1px 7px; border-radius: 3px; margin-right: 4px; }
  .tag.cat { background: var(--accent-soft); color: var(--accent); }
  .tag.todo { border: 1px solid var(--warn); color: var(--warn); }
  .tag.done { border: 1px solid var(--ok); color: var(--ok); }
  .empty { color: var(--muted); font-size: .92rem; margin: 0; }

  .admin { display: grid; gap: 14px; }
  .stats { display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: .9rem; }
  .stats b { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; display: block; line-height: 1.1; font-variant-numeric: tabular-nums; }
  .tablebox { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
  table { width: 100%; border-collapse: collapse; font-size: .86rem; }
  th { text-align: left; font-size: .76rem; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--bg); white-space: nowrap; }
  td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
  td.mono { font-family: var(--font-mono); font-size: .8rem; white-space: nowrap; }
  .showinfo { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: 10px; align-items: end; }
