/* =========================
   PALETTE GLOBALE + VARIABILI (da scheda.css)
   ========================= */
:root {
  /* Palette derivata dal footer */
  --color-bg: #fff;
  --color-text: #264159;
  --color-link: #295084;
  --color-border: #e1e6ec;
  --color-border-muted: #b5c1d1;
  --color-soft-bg: #f8fbfd;
  --color-hover-bg: #edf2f6;
  --color-hover-bg-strong: #d9e2ef;
  --color-muted: #3b5678;
  --accent: #6697c1;

  /* Ombre e overlay coerenti con footer/modal */
  --shadow-1: 0 4px 16px rgba(20,30,60,0.08);
  --shadow-2: 0 8px 32px rgba(20,30,60,0.15);
  --overlay: rgba(20, 30, 60, 0.4);

  /* Bottoni/azioni */
  --btn-bg: var(--color-link);
  --btn-bg-hover: #1f3c63;
}

/* =========================
   RESET + BASE (correzione selettore universale)
   ========================= */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html, body { height: 100%; }
body {
  font-family: Arial, sans-serif;
  line-height: 1.5;
  color: var(--color-text);
  background: #f9fafc;
}

/* Link generici */
a { color: var(--color-link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* =========================
   HERO (da scheda.css)
   ========================= */
#hero {
  position: relative;
  height: 50vh;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #fff;
  text-align: center;
  border-bottom: 4px solid var(--accent);
  border-radius: 0 0 18px 18px;
  overflow: hidden;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1;
  border-radius: inherit;
  pointer-events: none;
}
/* Sopra overlay */
#hero > *:not(.hero-overlay) { position: relative; z-index: 2; }
#hero h1 {
  font-size: 2.7rem;
  margin-bottom: .3em;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 8px rgba(0,0,0,0.85), 0 0px 2px #000;
}
#hero p {
  font-size: 1.3rem;
  margin-bottom: 0;
  font-style: italic;
  text-shadow: 0 2px 8px rgba(0,0,0,0.7), 0 0px 2px #000;
}
/* Correzione typo nelle classi dedicate */
.sciname { font-weight: bold; }
.author { font-size: 1rem; margin-left: 8px; font-style: normal; }

/* =========================
   GALLERIA / SEZIONI (da scheda.css)
   ========================= */
#gallery {
  padding: 3em 1em;
  background: #f5f5f5;
  max-width: 1200px;
  margin: 0 auto 2em auto;
  border-radius: 15px;
  box-shadow: var(--shadow-1);
}
#gallery h2 {
  color: var(--color-link);
  text-align: center;
  font-size: 2rem;
  margin-bottom: 1.2em;
}
.carousel {
  position: relative;
  overflow: hidden;
  border-radius: 13px;
  box-shadow: 0 4px 14px rgba(0,0,0,.13);
  margin-bottom: 1em;
}
#mainPhoto {
  width: 100%;
  max-height: 65vh;
  object-fit: cover;
  transition: opacity .6s;
  border-radius: 8px;
}
.thumbs {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px,1fr));
  gap: 10px;
}
.thumbs img {
  width: 100%;
  height: 70px;
  object-fit: cover;
  border-radius: 5px;
  cursor: pointer;
  opacity: .8;
  border: 2px solid var(--color-border);
  transition: .3s;
}
.thumbs img:hover,
.thumbs img.active {
  opacity: 1;
  border-color: var(--accent);
  box-shadow: 0 0 5px rgba(102,151,193,0.33);
}

/* Boxed sections */
.boxed {
  background: var(--color-bg);
  border-radius: 12px;
  border: 1.5px solid var(--color-border);
  box-shadow: 0 2px 10px rgba(20,30,60,0.05);
  padding: 1.5em;
  margin-bottom: 1.5em;
}
section {
  padding: 2.3em 1.2em 1em 1.2em;
  max-width: 820px;
  margin: 0 auto;
}
h2 {
  margin-bottom: .6em;
  color: var(--color-link);
  font-size: 1.5rem;
  letter-spacing: 0.02em;
}

/* Liste */
ul { list-style: disc inside; margin-bottom: 1em; }
li { margin-bottom: .5em; }

/* Accenti “scientifici” in palette */
.sci-name { color: var(--accent); }

/* Scroll to top */
#scrollToTopBtn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  background-color: var(--btn-bg);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  z-index: 999;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  transition: opacity 0.3s ease, background-color .2s ease;
}
#scrollToTopBtn:hover { background-color: var(--btn-bg-hover); }

/* =========================
   COOKIE BANNER (da scheda.css)
   ========================= */
/* Versione unica e centrata */
.cookie-banner {
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(92vw, 640px);
  background: var(--color-bg);
  color: var(--color-text);
  padding: 1.4rem 1.2rem;
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(0,0,0,.25);
  z-index: 9999;
  font-size: .95rem;
  line-height: 1.5;
  display: none; /* nascosto di default */
  border: 2px solid var(--color-border);
}
.cookie-banner p { margin: 0 0 1rem 0; text-align: justify; }
.cookie-options {
  display: flex; flex-wrap: wrap;
  gap: 1rem 2rem;
  margin-bottom: 1.2rem;
}
.cookie-options label {
  display: flex; align-items: center; gap: .5rem;
  cursor: pointer; user-select: none;
}
.cookie-banner input[type="checkbox"] {
  accent-color: var(--color-link);
  transform: scale(1.2);
}
#cookie-save {
  display: inline-block;
  background: var(--btn-bg);
  border: none;
  color: #fff;
  padding: .75rem 1.8rem;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: background .25s ease;
}
#cookie-save:hover, #cookie-save:focus {
  background: var(--btn-bg-hover);
  outline: none;
}
@media (max-width: 480px) {
  .cookie-banner { font-size: .85rem; padding: 1rem; }
  .cookie-options { flex-direction: column; gap: .6rem; }
  #cookie-save { width: 100%; text-align: center; }
}

/* =========================
   MODALI GENERICHE (da scheda.css)
   ========================= */
/* Overlay generico */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  width: 100%; height: 100%;
  background: var(--overlay);
  z-index: 1000;
  backdrop-filter: blur(3px);
}
/* Contenuto modale */
.modal-content {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--color-bg);
  border-radius: 18px;
  box-shadow: var(--shadow-2);
  border: 2px solid var(--color-border);
  padding: 2.5rem;
  width: 100%; max-width: 700px;
  max-height: 80vh; overflow-y: auto;
}
.modal-header { text-align: center; margin-bottom: 2rem; }
.modal-title {
  color: var(--color-text);
  font-size: 2rem;
  margin-bottom: 0.5rem;
  letter-spacing: 1px;
}
.modal-body { color: #234; line-height: 1.6; font-size: 1.05rem; }
.modal-body h3 {
  color: var(--color-link);
  font-size: 1.4rem;
  margin: 1.5rem 0 1rem 0;
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 0.5rem;
}
.modal-body p { margin-bottom: 1.2rem; }
.modal-body a {
  color: var(--color-link);
  text-decoration: none;
  font-weight: 600;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  background: var(--color-hover-bg);
  transition: all 0.16s ease;
}
.modal-body a:hover {
  background: var(--color-hover-bg-strong);
  transform: translateY(-1px);
}
.email-protected {
  color: var(--color-link);
  text-decoration: none;
  font-weight: 600;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  background: var(--color-hover-bg);
  cursor: pointer;
  transition: all 0.16s ease;
}
.email-protected:hover {
  background: var(--color-hover-bg-strong);
  transform: translateY(-1px);
}
.close-button {
  position: absolute; top: 1rem; right: 1.5rem;
  background: none; border: none;
  font-size: 2rem; color: var(--color-muted);
  cursor: pointer; line-height: 1;
  padding: 0.5rem; border-radius: 50%;
  transition: all 0.16s ease;
}
.close-button:hover {
  background: var(--color-hover-bg);
  color: var(--color-text);
  transform: scale(1.1);
}

/* =========================
   FOOTER (da scheda.css)
   ========================= */
footer {
  text-align: center;
  padding: 1rem;
  background: var(--color-bg);
  border-radius: 12px;
  border: 2px solid var(--color-border);
  box-shadow: var(--shadow-1);
  margin: 2rem auto;
  max-width: 900px;
  color: var(--color-text);
  font-size: 1rem;
}
.info-link {
  color: var(--color-link);
  text-decoration: none;
  font-weight: 600;
  margin-left: 1rem;
  padding: 0.3rem 0.8rem;
  border: 1.5px solid var(--color-border-muted);
  border-radius: 8px;
  background: var(--color-soft-bg);
  transition: all 0.16s ease;
  cursor: pointer;
}
.info-link:hover {
  background: var(--color-hover-bg);
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* =========================
   MODALE DI RICERCA (da scheda.css)
   ========================= */
body.search-popup-open {
  overflow: hidden !important;
  touch-action: none !important;
}
.search-popup {
  position: fixed; left: 0; top: 0;
  width: 100vw; height: 100vh;
  background: rgba(36, 65, 89, 0.16);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  overscroll-behavior: contain;
}
.search-popup-content {
  background: var(--color-bg);
  border-radius: 18px;
  border: 2px solid var(--color-border);
  box-shadow: 0 4px 18px rgba(40,60,120,0.13), 0 2px 10px rgba(20,30,60,0.06);
  padding: 2.3em 2.3em 1.2em 2.3em;
  max-width: 420px;
  width: 97%;
  max-height: 60vh;
  overflow-y: auto;
  font-family: 'Georgia', serif;
  color: var(--color-text);
  text-align: left;
  animation: popup-fade-in 0.24s;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}
@keyframes popup-fade-in {
  from { transform: scale(.97) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.search-popup-content a {
  display: block;
  margin-bottom: 1.18em;
  padding: 0.65em 0.85em;
  border-radius: 12px;
  color: var(--color-link);
  background: var(--color-soft-bg);
  border: 1.5px solid var(--color-border-muted);
  text-decoration: none !important;
  font-size: 1.09em;
  transition: background 0.13s, border 0.13s, color 0.13s;
  font-family: 'Georgia', serif;
}
.search-popup-content a:hover {
  background: var(--color-hover-bg);
  border-color: var(--accent);
  color: var(--color-link);
  box-shadow: 0 2px 10px rgba(102,151,193,0.17);
}
.search-popup-content .desc {
  color: var(--color-muted);
  font-size: .96em;
  margin-top: 0.23em;
  display: block;
  line-height: 1.3;
}

/* =========================
   OVERLAY FOTO (da scheda.css)
   ========================= */
.photo-overlay {
  position: fixed; top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.8);
  display: flex; justify-content: center; align-items: center;
  z-index: 9999;
}
.photo-overlay img {
  max-width: 90vw; max-height: 90vh;
  box-shadow: 0 4px 30px rgba(0,0,0,0.7);
}

/* =========================
   RESPONSIVE (da scheda.css)
   ========================= */
@media (max-width: 768px) {
  /* Hero */
  #hero { height: 35vh; font-size: 1.1rem; }
  #hero h1 { font-size: 2rem; }

  /* Spaziature contenuti */
  #gallery, section { max-width: 98vw; padding: 1em 0.6em; }
  .carousel { max-height: 36vh; }
  #mainPhoto { max-height: 38vh; }

  /* Modali */
  .modal-content { padding: 1.5rem; margin: 1rem; max-width: calc(100% - 2rem); }
  .modal-title { font-size: 1.6rem; }
  .modal-body { font-size: 1rem; }

  /* Footer link incolonnato su mobile medio */
  .info-link { display: block; margin: 1rem auto 0; width: fit-content; }
}
@media (max-width: 600px) {
  .search-popup-content {
    max-width: 97vw !important;
    padding: 1em 0.6em 0.8em 0.6em;
  }
  .search-popup-content a { font-size: .98em; padding: 0.5em; }
}
@media (max-width: 480px) {
  /* Hero più compatto */
  #hero { height: 28vh; font-size: 1rem; }

  /* Contenuti */
  #gallery, section { max-width: 99vw; padding: 0.7em 0.3em; }
  .boxed { padding: 0.7em; }
  #gallery h2, h2 { font-size: 1.15rem; }
  #mainPhoto { max-height: 55vw; }

  /* Modale */
  .modal-content { padding: 1rem; }
  .close-button { top: 0.5rem; right: 1rem; font-size: 1.8rem; }
}

/* =========================
   TABELLE (da scheda.css)
   ========================= */
/* Contenitore scrollabile */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0;
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: 12px;
  box-shadow: var(--shadow-1);
}
/* Tabella base */
table {
  width: 100%;
  border-collapse: separate; /* permette i bordi arrotondati sulla thead */
  border-spacing: 0;
  font-size: 0.98rem;
  color: var(--color-text);
  background: var(--color-bg);
}
/* Intestazioni */
thead th {
  position: relative;
  text-align: left;
  font-weight: 700;
  color: var(--color-link);
  background: var(--color-soft-bg);
  border-bottom: 2px solid var(--color-border);
  padding: 0.75rem 0.9rem;
  white-space: nowrap;
}
thead th:first-child { border-top-left-radius: 10px; }
thead th:last-child  { border-top-right-radius: 10px; }
/* Celle */
tbody td, tfoot td, tfoot th {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}
/* Ultima riga senza bordo inferiore (se non c'è tfoot) */
tbody tr:last-child > * { border-bottom: 0; }
/* Zebra + hover */
tbody tr:nth-child(even) { background: var(--color-hover-bg); }
tbody tr:hover { background: var(--color-hover-bg-strong); transition: background .18s ease; }
/* Focus accessibile */
tbody tr:focus-within { outline: 2px solid var(--accent); outline-offset: -2px; }
/* Link e pulsanti in tabella */
table a { color: var(--color-link); text-decoration: none; font-weight: 600; }
table a:hover { text-decoration: underline; }
/* Header “ordinabile” */
thead th a {
  display: inline-flex; align-items: center; gap: .35rem;
  color: inherit; text-decoration: none;
}
thead th a:hover { color: var(--color-link); text-decoration: underline; }
.sort-icon { font-size: .85em; color: var(--color-muted); }
/* Header sticky */
.table--sticky thead th {
  position: sticky; top: 0; z-index: 2;
  background: linear-gradient(#f8fbfd, #f6f9fc);
  box-shadow: 0 2px 0 var(--color-border);
}
/* Caption */
caption {
  caption-side: top; text-align: left;
  padding: 0.6rem 0.2rem 0.6rem 0;
  color: var(--color-muted); font-size: .95rem;
}
/* Colonne e allineamenti tipici */
th.num, td.num,
th[data-type="number"], td[data-type="number"] { text-align: right; font-variant-numeric: tabular-nums; }
th.center, td.center { text-align: center; }
th.nowrap, td.nowrap { white-space: nowrap; }
.col-narrow { width: 1%; white-space: nowrap; }
/* Badge */
.badge {
  display: inline-block; padding: .15rem .55rem; border-radius: 999px;
  background: var(--color-soft-bg); color: var(--color-link);
  border: 1px solid var(--color-border-muted);
  font-size: .85em; line-height: 1.2;
}
/* Densità */
.table--compact tbody td, .table--compact thead th { padding: .5rem .6rem; }
.table--comfortable tbody td, .table--comfortable thead th { padding: 1rem 1.1rem; }
/* Bordi arrotondati fondo */
tfoot td:first-child, tfoot th:first-child { border-bottom-left-radius: 10px; }
tfoot td:last-child,  tfoot th:last-child  { border-bottom-right-radius: 10px; }
/* Stato “vuoto” */
.table-empty { text-align: center; padding: 2rem 1rem; color: var(--color-muted); font-style: italic; }
/* Responsive fine-tuning */
@media (max-width: 768px) {
  table { font-size: .95rem; }
  thead th, tbody td { padding: .6rem .65rem; }
}
@media (max-width: 480px) {
  table { font-size: .92rem; }
  thead th, tbody td { padding: .5rem .55rem; }
  .hide-sm { display: none; }
}

/* =======================================================================
   CALCOLATORE (da calcolatore.css – corretto e unificato; precedenza finale)
   ======================================================================= */

/* Contenitori principali */
.calculator-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}
.calculator-card {
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: 15px;
  padding: 2rem;
  box-shadow: var(--shadow-1);
  margin-bottom: 2rem;
}

/* Header / titoli */
.calculator-title {
  color: var(--color-link);
  font-size: 1.6rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  justify-content: center;
}
.calculator-emoji { font-size: 1.8rem; }

.calc-header { text-align: center; margin-bottom: 2rem; }
.calc-title  { color: var(--color-link); font-size: 2.2rem; margin-bottom: 0.5rem; letter-spacing: 0.5px; }
.calc-subtitle{ color: var(--color-muted); font-size: 1.1rem; font-style: italic; }

/* Gruppi form (unificazione: .form-group / .formgroup) */
.form-group, .formgroup { margin-bottom: 1rem; }
.form-group label, .formgroup label {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--color-text);
  font-weight: 600;
}
.form-group input, .formgroup input,
.form-group select, .formgroup select {
  width: 100%;
  padding: 0.6rem;
  border: 1.5px solid var(--color-border-muted);
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
  background: var(--color-soft-bg);
  color: var(--color-text);
}
.form-group input:focus, .formgroup input:focus,
.form-group select:focus, .formgroup select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(102, 151, 193, 0.2);
}

/* Righe griglia del form */
.form-row, .formrow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-row-3, .formrow3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

/* Pulsanti Calcola (unificazione: .calculatebtn / .calculate-btn) */
.calculatebtn, .calculate-btn {
  width: 100%;
  background: var(--btn-bg);
  color: #fff;
  border: none;
  padding: 1rem 2rem; /* versione “comoda” */
  border-radius: 12px;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 1rem;
  margin-bottom: 2rem;
}
.calculatebtn:hover, .calculate-btn:hover {
  background: var(--btn-bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(41, 80, 132, 0.3);
}
.calculatebtn:disabled, .calculate-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Risultati */
.result {
  margin-top: 1.5rem;
  padding: 1.2rem;
  background: var(--color-hover-bg);
  border: 2px solid var(--accent);
  border-radius: 8px;
  display: none;
}
.result.show { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.result-section, .resultsection { margin-bottom: 1rem; }
.result-section:last-child, .resultsection:last-child { margin-bottom: 0; }
.result-value, .resultvalue {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--color-link);
  margin-bottom: 0.3rem;
}
.result-info, .resultinfo {
  font-size: 0.9rem;
  color: var(--color-muted);
}

/* Avvisi */
.warning {
  background: #fff3cd;
  border: 2px solid #ffc107;
  color: #856404;
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1rem;
  font-size: 0.9rem;
}
.warning strong { color: #b45309; }

/* Toggle unità */
.unit-toggle, .unittoggle {
  display: flex;
  background: var(--color-hover-bg);
  border-radius: 6px;
  padding: 0.2rem;
  margin-bottom: 1rem;
}
.unit-toggle button, .unittoggle button {
  flex: 1;
  background: none;
  border: none;
  padding: 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.unit-toggle button.active, .unittoggle button.active {
  background: var(--color-link);
  color: #fff;
}

/* Stato disabilitato */
.disabled-section, .disabledsection { opacity: 0.5; pointer-events: none; }

/* Step indicator */
.step-indicator, .stepindicator {
  text-align: center;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--color-muted);
}
.step-number, .stepnumber {
  display: inline-block;
  width: 25px; height: 25px;
  background: var(--color-link);
  color: #fff;
  border-radius: 50%;
  line-height: 25px;
  font-weight: bold;
  margin-right: 0.5rem;
}

/* Input group (unificazione: .input-group / .inputgroup) */
.input-group, .inputgroup {
  background: var(--color-soft-bg);
  padding: 1.2rem;
  border-radius: 12px;
  border: 1px solid var(--color-border);
}
.inputgroup label {
  display: block;
  font-weight: 600;
  color: var(--color-link);
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}
.inputgroup input[type="number"],
.inputgroup input {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 2px solid var(--color-border);
  border-radius: 8px;
  font-size: 1.1rem;
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color 0.2s ease;
}
.input-group input[type="number"]:focus,
.input-group input:focus,
.inputgroup input[type="number"]:focus,
.inputgroup input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(102, 151, 193, 0.1);
}
/* Select personalizzate */
.input-group select, .inputgroup select {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 2px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-bg);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.7rem center;
  background-repeat: no-repeat;
  background-size: 1.2em 1.2em;
  padding-right: 2.5rem;
  appearance: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.input-group select:focus, .inputgroup select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(102, 151, 193, 0.1);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236697c1' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
}
.inputgroup select:hover { border-color: var(--color-border-muted); }

/* Placeholder numerici */
input[type="number"]::placeholder { color: rgba(36, 65, 89, 0.25) !important; font-style: italic; opacity: 1; }
input[type="number"]::-webkit-input-placeholder { color: rgba(36, 65, 89, 0.25) !important; font-style: italic; }
input[type="number"]::-moz-placeholder { color: rgba(36, 65, 89, 0.25) !important; font-style: italic; opacity: 1; }
input[type="number"]:-ms-input-placeholder { color: rgba(36, 65, 89, 0.25) !important; font-style: italic; }
input[type="number"]:-moz-placeholder { color: rgba(36, 65, 89, 0.25) !important; font-style: italic; opacity: 1; }
/* Quando l'utente digita, il testo diventa normale */
input[type="number"]:not(:placeholder-shown) { color: var(--color-text) !important; }

/* Contenitore principale calc */
.calculator-container {
  background: var(--color-bg);
  border-radius: 18px;
  border: 2px solid var(--color-border);
  box-shadow: var(--shadow-2);
  padding: 2.5rem;
  margin: 2rem auto;
  max-width: 800px;
}

/* Grid di input */
.input-grid, .inputgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.unit { color: var(--color-muted); font-size: 0.9rem; margin-top: 0.3rem; }

/* Contenitore risultati principali */
.result-container, .resultcontainer {
  background: var(--color-soft-bg);
  border-radius: 15px;
  padding: 2rem;
  border: 2px solid var(--color-border);
  text-align: center;
  margin-bottom: 2rem;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.co2-value { font-size: 3rem; font-weight: bold; margin-bottom: 0.5rem; text-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.co2-unit, .co2unit { font-size: 1.2rem; color: var(--color-muted); margin-bottom: 1rem; }

.status-indicator, .statusindicator {
  padding: 0.8rem 1.5rem;
  border-radius: 25px;
  font-weight: 600;
  font-size: 1.1rem;
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status-low, .statuslow   { background: #fef3c7; color: #92400e; border: 2px solid #fde68a; }
.status-optimal, .statusoptimal { background: #d1fae5; color: #065f46; border: 2px solid #a7f3d0; }
.status-high, .statushigh { background: #fee2e2; color: #991b1b; border: 2px solid #fecaca; }

/* Info pannelli */
.info-panel, .infopanel {
  background: var(--color-bg);
  border-radius: 12px;
  border: 1.5px solid var(--color-border);
  padding: 1.5rem;
  margin-top: 2rem;
}
.infopanel h3 { color: var(--color-link); margin-bottom: 1rem; font-size: 1.3rem; }

/* Range / griglie */
.ranges-grid, .rangesgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.range-item, .rangeitem {
  background: var(--color-soft-bg);
  padding: 1rem;
  border-radius: 8px;
  border-left: 4px solid var(--accent);
  text-align: center;
}
.range-value, .rangevalue { font-size: 1.2rem; font-weight: bold; color: var(--color-link); margin-bottom: 0.3rem; }
.range-label, .rangelabel { color: var(--color-muted); font-size: 0.9rem; }

/* Formula info */
.formula-info, .formulainfo {
  background: var(--color-hover-bg);
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem;
  font-family: monospace;
  font-size: 0.95rem;
  color: var(--color-text);
  border-left: 3px solid var(--accent);
}

/* Nutrienti */
.nutrient-grid, .nutrientgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.nutrient-card, .nutrientcard {
  background: var(--color-soft-bg);
  border: 2px solid var(--color-border);
  border-radius: 15px;
  padding: 1.5rem;
  transition: all 0.3s ease;
}
.nutrient-card:hover, .nutrientcard:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(102, 151, 193, 0.2);
}
.nutrient-header, .nutrientheader {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
}
.nutrient-icon, .nutrienticon {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: bold; color: #fff;
}
.no3-icon { background: #10b981; }
.po4-icon { background: #f59e0b; }
.k-icon   { background: #8b5cf6; }
.fe-icon  { background: #ef4444; }
.mg-icon  { background: #06b6d4; }
.ca-icon  { background: #84cc16; }
.nutrient-title, .nutrienttitle {
  color: var(--color-link);
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
}
.nutrient-subtitle, .nutrientsubtitle {
  color: var(--color-muted);
  font-size: 0.9rem;
}

/* Target + preset */
.target-input, .targetinput {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.target-input input, .targetinput input {
  flex: 1;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color 0.2s;
}
.target-input input:focus, .targetinput input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(102, 151, 193, 0.1);
}
.preset-buttons, .presetbuttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.preset-btn, .presetbtn {
  padding: 0.4rem 0.8rem;
  background: var(--color-hover-bg);
  border: 1px solid var(--color-border-muted);
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--color-text);
  transition: all 0.2s;
}
.preset-btn:hover, .presetbtn:hover,
.preset-btn.active, .presetbtn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Risultati dosaggio */
.dosing-result, .dosingresult {
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem;
}
.dosing-method, .dosingmethod { margin-bottom: 1rem; }
.method-title, .methodtitle {
  font-weight: 600;
  color: var(--color-link);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.dose-value, .dosevalue { font-size: 1.1rem; font-weight: bold; color: var(--color-text); }
.dose-unit, .doseunit { color: var(--color-muted); font-size: 0.9rem; margin-left: 0.3rem; }
.stock-solution, .stocksolution {
  background: var(--color-hover-bg);
  padding: 0.8rem;
  border-radius: 6px;
  margin-top: 0.5rem;
  border-left: 3px solid var(--accent);
}

/* Pianificazione (schedule) */
.schedule-panel, .schedulepanel {
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: 15px;
  padding: 2rem;
  margin-top: 2rem;
}
.schedule-grid, .schedulegrid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
  margin-top: 1rem;
}
.day-cell, .daycell {
  text-align: center;
  padding: 0.8rem 0.3rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}
.day-header, .dayheader { background: var(--color-link); color: #fff; }
.dose-day, .doseday {
  background: var(--color-soft-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}
.rest-day, .restday {
  background: var(--color-hover-bg);
  color: var(--color-muted);
  border: 1px solid var(--color-border-muted);
}
.water-change, .waterchange {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

/* Opzioni avanzate */
.advanced-options, .advancedoptions {
  background: var(--color-soft-bg);
  border: 1.5px solid var(--color-border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  transition: all 0.3s ease;
}
.advanced-options:hover, .advancedoptions:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(102, 151, 193, 0.1);
}
.toggle-advanced, .toggleadvanced {
  background: none;
  border: none;
  color: var(--color-link);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.5rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}
.toggle-advanced:hover, .toggleadvanced:hover {
  background: var(--color-hover-bg);
  transform: translateX(2px);
}
#advancedPanel { transition: all 0.3s ease; overflow: hidden; }

.advanced-grid, .advancedgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

/* Warning panel visibile a richiesta */
.warning-panel, .warningpanel {
  background: #fef3c7;
  border: 2px solid #fde68a;
  border-radius: 10px;
  padding: 1rem;
  margin-top: 1rem;
  display: none;
}
.warning-panel.show, .warningpanel.show { display: block; }
.warning-icon, .warningicon { color: #d97706; margin-right: 0.5rem; }

/* =========================
   RESPONSIVE (da calcolatore.css, corretto)
   ========================= */
@media (max-width: 768px) {
  .form-row, .formrow,
  .form-row-3, .formrow3 { grid-template-columns: 1fr; }

  .calculator-container { margin: 1rem; padding: 1.5rem; }
  .calc-title { font-size: 1.8rem; }
  .input-grid, .inputgrid { grid-template-columns: 1fr; gap: 1rem; }
  .co2-value { font-size: 2.5rem; }

  .advanced-grid, .advancedgrid { grid-template-columns: 1fr; }
  .inputgroup select { font-size: 0.95rem; padding: 0.7rem 0.9rem; padding-right: 2.3rem; }

  .nutrient-grid, .nutrientgrid { grid-template-columns: 1fr; }
  .schedule-grid, .schedulegrid { font-size: 0.75rem; }
  .day-cell, .daycell { padding: 0.6rem 0.2rem; }
}

/* Label dentro input-group (allinea look anche per la variante con trattino) */
.input-group label, .inputgroup label {
  display: block;
  font-weight: 600;
  color: var(--color-link);
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}

/* Spaziatura verticale standard del blocco */
.form-group { margin-bottom: 2rem; }
/* In alternativa, se non vuoi il wrapper .form-group: */
/* .input-group { margin-bottom: 2rem; } */