/* Palette presa dai materiali reali di AskWarpi: verde scuro #0b3d2a,
   verde acceso #20b65f, nero #101512. Il tema e' uno solo, scuro, scelto
   di proposito: un tema che cambia col sistema avrebbe fatto convivere due
   identita' diverse, e qui il verde su nero E' il marchio. */

@font-face {
  font-family: 'Outfit';
  src: url('/fonts/outfit-var.woff2') format('woff2-variations');
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Nero verdastro, non #000: il nero puro schiaccia le ombre e fa
     sembrare tutto una finestra di terminale. */
  --bg:        #080c0a;
  --surface:   #101713;
  --surface-2: #16211b;
  --line:      #223029;
  --line-soft: #1a241e;

  --ink:       #e8f0ea;
  --muted:     #8a9990;
  --faint:     #5d6b63;

  --green:      #20b65f;
  --green-dim:  #189a4e;
  --green-deep: #0b3d2a;
  --green-wash: rgba(32, 182, 95, .10);

  --danger:      #e2564b;
  --danger-wash: rgba(226, 86, 75, .12);
  --warn:        #d9a441;
  --warn-wash:   rgba(217, 164, 65, .12);

  --radius:    14px;
  --radius-sm: 9px;
  /* Ombre tinte di verde scuro invece che nero puro: seguono il fondo
     invece di sporcarlo di grigio. */
  --shadow:    0 1px 2px rgba(3, 12, 7, .5), 0 14px 40px rgba(3, 12, 7, .45);

  --font: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

* { box-sizing: border-box; }

/* Qualsiasi display esplicito batte [hidden]{display:none} dello user-agent,
   che ha specificita' minima: senza questa riga modale e gate comparirebbero. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Alone verde molto largo dietro al contenuto: rompe il nero piatto senza
   diventare un gradiente da presentazione. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(60rem 40rem at 15% -10%, rgba(32, 182, 95, .10), transparent 60%),
    radial-gradient(45rem 35rem at 100% 0%, rgba(11, 61, 42, .45), transparent 65%);
  z-index: 0;
}

/* Grana finissima: toglie l'aspetto vettoriale sterile alle superfici scure. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .035;
  z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

main, .gate, .modal { position: relative; z-index: 2; }

h1 {
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -.025em;
  margin: 0;
  text-wrap: balance;
}
h2 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -.02em;
  margin: 0 0 1.35rem;
}
.muted { color: var(--muted); font-size: .84rem; margin: .2rem 0 0; }
.error { color: var(--danger); font-size: .84rem; margin: .7rem 0 0; }
.spacer { flex: 1; }

a { color: var(--green); }

/* Accessibilita': un anello di focus visibile serve a chi naviga da tastiera. */
:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ================= Login ================= */
.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.gate-card {
  width: min(370px, 100%);
  display: flex;
  flex-direction: column;
  padding: 2.6rem 2.1rem 2.1rem;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(32, 182, 95, .07), transparent 45%),
    var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-align: center;
  animation: rise .5s var(--ease) both;
}

/* La mascotte sborda dal bordo alto della card: senza questo sfalsamento
   sarebbe solo un'immagine appoggiata sopra al modulo. */
.mascotte {
  width: 104px;
  height: auto;
  margin: -5.4rem auto .6rem;
  filter: drop-shadow(0 10px 22px rgba(3, 12, 7, .55));
  animation: bob 4.5s ease-in-out infinite;
}

.wordmark {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -.035em;
  margin: 0;
  line-height: 1;
}
.wordmark span { color: var(--green); }

.gate-card h1 {
  font-size: .95rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: -.01em;
  margin-top: .45rem;
}
.gate-card .muted { margin-top: .9rem; font-size: .8rem; color: var(--faint); }

.gate-card label {
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
  text-align: left;
  margin: 1.6rem 0 .4rem;
}
.gate-card .btn { margin-top: .9rem; }
.gate-card .error { text-align: left; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50%      { transform: translateY(-7px) rotate(1.5deg); }
}
/* Chi ha chiesto meno animazioni al sistema non deve vedere niente muoversi. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ================= Controlli ================= */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.7rem;
}

input, select, textarea {
  font: inherit;
  font-size: .9rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .55rem .7rem;
  width: 100%;
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: #2c3d34; }
input:focus, select:focus, textarea:focus {
  border-color: var(--green);
  background: var(--surface-2);
  outline: none;
  box-shadow: 0 0 0 3px var(--green-wash);
}
textarea { resize: vertical; min-height: 4.5rem; }

.btn {
  font: inherit;
  font-size: .88rem;
  font-weight: 500;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: .55rem 1rem;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s var(--ease), background .18s var(--ease),
              border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.btn:hover { border-color: #33473c; background: #1b2721; }
/* Ritorno tattile alla pressione: senza, il clic non "risponde". */
.btn:active { transform: translateY(1px) scale(.985); }

.btn.primary {
  background: var(--green);
  border-color: var(--green);
  color: #05130b;
  font-weight: 600;
}
.btn.primary:hover {
  background: #27c96b;
  border-color: #27c96b;
  box-shadow: 0 6px 18px rgba(32, 182, 95, .28);
}
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn.danger:hover { background: var(--danger-wash); border-color: transparent; }
.btn[disabled] { opacity: .5; cursor: default; transform: none; }

/* ================= Struttura ================= */
main { max-width: 1320px; margin: 0 auto; padding: 2rem 1.5rem 5rem; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.topbar-id { display: flex; align-items: center; gap: .85rem; }
.topbar-mascotte { width: 40px; height: auto; }
.topbar-actions { display: flex; gap: .5rem; }

.stats {
  display: grid;
  gap: .8rem;
  margin-bottom: 1.9rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  transition: border-color .2s var(--ease);
}
.stat:hover { border-color: var(--line); }
.stat .n {
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -.04em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat .l {
  font-size: .7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 500;
  margin-top: .15rem;
}
/* La sola scheda che deve saltare all'occhio e' quella che chiede un'azione. */
.stat.alert { border-color: rgba(226, 86, 75, .45); background: var(--danger-wash); }
.stat.alert .n { color: var(--danger); }
.stat.alert .l { color: #eda49d; }

.toolbar {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.1rem;
}
.toolbar #search { flex: 1 1 260px; }
.toolbar select { width: auto; min-width: 155px; }
.check {
  display: flex; align-items: center; gap: .45rem;
  font-size: .84rem; color: var(--muted); white-space: nowrap; cursor: pointer;
}
.check input { width: auto; accent-color: var(--green); }
.count { font-size: .8rem; color: var(--faint); margin-left: auto; font-variant-numeric: tabular-nums; }

/* ================= Tabella ================= */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { text-align: left; padding: .8rem .9rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
thead th {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--faint);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  position: sticky;
  top: 0;
  background: var(--surface-2);
  transition: color .15s var(--ease);
  user-select: none;
}
thead th:hover { color: var(--green); }
thead th.col-actions { cursor: default; }
thead th.col-actions:hover { color: var(--faint); }
tbody tr { transition: background .15s var(--ease); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--green-wash); }
td.role { max-width: 330px; }
td.next { max-width: 230px; color: var(--muted); }
.company { font-weight: 600; letter-spacing: -.01em; }
.nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }
.empty { padding: 2.5rem 1.5rem; text-align: center; color: var(--muted); }
#first-run p { margin: 0 0 .5rem; }
#first-run .hint { max-width: 46ch; margin: 0 auto 1.3rem; }

.ext { text-decoration: none; color: var(--faint); font-weight: 400; transition: color .15s var(--ease); }
.ext:hover { color: var(--green); }

/* La riga intera e' cliccabile: il cursore e il chevron lo devono dire
   prima del clic, altrimenti la scheda resta una funzione nascosta. */
tbody tr[data-id] { cursor: pointer; }
tbody tr[data-id]:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.chevron { color: var(--faint); font-size: 1.15rem; line-height: 1; transition: color .15s var(--ease), transform .15s var(--ease); display: inline-block; }
tbody tr:hover .chevron { color: var(--green); transform: translateX(2px); }

.row-actions { text-align: right; white-space: nowrap; }
.icon-btn {
  border: 0; background: transparent; color: var(--faint);
  cursor: pointer; font: inherit; font-size: .8rem; padding: .25rem .45rem;
  border-radius: 6px;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.icon-btn:hover { color: var(--green); background: var(--green-wash); }

/* Tendina di stato che si legge come una pillola. Un <select> normale
   costringerebbe ad aprire la scheda per cambiare lo stato. */
select.status-select {
  -webkit-appearance: none; appearance: none;
  padding: .2rem 1.5rem .2rem .65rem;
  width: auto; min-width: 140px;
  cursor: pointer;
  font-size: .74rem; font-weight: 600; line-height: 1.6;
  letter-spacing: .01em;
  border-radius: 999px;
  background-color: transparent;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 13px) 53%, calc(100% - 9px) 53%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  transition: filter .15s var(--ease);
}
select.status-select:hover { filter: brightness(1.18); }
select.status-select option { background: var(--surface); color: var(--ink); }

.pill.azione   { background: var(--danger-wash); color: #f08379; border: 1px solid rgba(226, 86, 75, .38); }
.pill.colloqui { background: var(--warn-wash);   color: #e5bd72; border: 1px solid rgba(217, 164, 65, .35); }
.pill.offerta  { background: rgba(32, 182, 95, .18); color: #55d68c; border: 1px solid rgba(32, 182, 95, .45); }
.pill.corso    { background: rgba(32, 182, 95, .10); color: #3fc47a; border: 1px solid rgba(32, 182, 95, .28); }
.pill.inviata  { background: var(--surface-2);   color: var(--muted); border: 1px solid var(--line); }
.pill.chiusa   { background: transparent;        color: var(--faint); border: 1px solid var(--line-soft); }

/* ================= Modale ================= */
.modal {
  position: fixed; inset: 0;
  background: rgba(4, 9, 6, .72);
  backdrop-filter: blur(5px);
  display: grid; place-items: center;
  padding: 1.25rem;
  z-index: 50;
  overflow-y: auto;
  animation: fade .18s var(--ease) both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  width: min(760px, 100%);
  max-height: 90dvh;
  overflow-y: auto;
  animation: rise .28s var(--ease) both;
}

/* ---------- Scheda di dettaglio ---------- */
.detail-card { width: min(620px, 100%); }
.detail-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; padding-bottom: 1.1rem; margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
}
.detail-head h2 { margin: 0; font-size: 1.3rem; letter-spacing: -.025em; }
.detail-role { margin: .2rem 0 0; color: var(--muted); font-size: .92rem; text-wrap: pretty; }
.detail-head .pill { flex: none; padding: .2rem .7rem; font-size: .75rem; font-weight: 600; border-radius: 999px; }

.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.4rem; margin: 0; }
.detail-grid dt {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--faint); font-weight: 600; margin-bottom: .18rem;
}
.detail-grid dd { margin: 0; font-size: .92rem; color: var(--ink); text-wrap: pretty; }

.detail-notes { margin-top: 1.5rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.detail-notes h3 {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--faint); font-weight: 600; margin: 0 0 .5rem;
}
/* Le note sono il testo piu' lungo della scheda: larghezza limitata e
   interlinea piu' ampia, altrimenti l'occhio perde la riga. */
.detail-notes p {
  margin: 0; font-size: .93rem; line-height: 1.65; color: var(--ink);
  max-width: 68ch; white-space: pre-wrap;
}

.url-block {
  background: linear-gradient(135deg, rgba(32, 182, 95, .09), rgba(11, 61, 42, .35));
  border: 1px solid rgba(32, 182, 95, .22);
  border-radius: var(--radius-sm);
  padding: .95rem 1.05rem 1.1rem;
  margin-bottom: 1.35rem;
}
.url-block label {
  display: block;
  font-size: .72rem; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase;
  color: #58c98a;
  margin-bottom: .45rem;
}
.url-row { display: flex; gap: .5rem; }
.url-row input { flex: 1; }
.hint { font-size: .78rem; color: var(--muted); margin: .6rem 0 0; line-height: 1.5; max-width: 62ch; }

.grid { display: grid; gap: .9rem; grid-template-columns: 1fr 1fr; }
.grid label {
  display: flex; flex-direction: column; gap: .32rem;
  font-size: .74rem; font-weight: 500;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--faint);
}
.grid label.wide { grid-column: 1 / -1; }
.modal-actions { display: flex; gap: .5rem; align-items: center; margin-top: 1.5rem; }

/* ================= Grafici ================= */
.charts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: .8rem;
  margin-bottom: 1.9rem;
}
.chart-card {
  margin: 0;
  padding: 1.15rem 1.3rem 1.3rem;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
.chart-card figcaption { margin-bottom: 1.1rem; }
.chart-card h2 { font-size: .95rem; margin: 0; letter-spacing: -.015em; }
.chart-sub { font-size: .76rem; color: var(--faint); margin: .12rem 0 0; }
.chart-empty { color: var(--faint); font-size: .84rem; margin: 0; }

/* Barre orizzontali: le etichette di stato sono lunghe, in verticale
   verrebbero ruotate o troncate. */
.bars { display: flex; flex-direction: column; gap: .5rem; }
.bar-row {
  display: grid;
  grid-template-columns: 8.6rem minmax(0, 1fr) 1.6rem;
  align-items: center;
  gap: .65rem;
  border-radius: 6px;
  transition: background .15s var(--ease);
}
.bar-row:hover, .bar-row:focus-visible { background: var(--green-wash); outline: none; }
.bar-label { font-size: .76rem; color: var(--muted); text-align: right; line-height: 1.3; }
.bar-track { height: 10px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.bar-fill {
  display: block;
  height: 100%;
  background: var(--green);
  /* Estremita' arrotondata solo dal lato del dato, la base resta ancorata. */
  border-radius: 0 4px 4px 0;
  transition: width .5s var(--ease);
}
.bar-val {
  font-size: .8rem; font-weight: 600; color: var(--ink);
  font-variant-numeric: tabular-nums; text-align: right;
}
/* Verde e rosso sono quasi identici per un deficit deutan: la barra che
   chiede un'azione porta anche righe e un simbolo, cosi' resta
   riconoscibile senza percepire affatto il colore. */
.bar-row.urgente .bar-fill {
  background: var(--danger);
  background-image: repeating-linear-gradient(
    135deg, transparent 0 5px, rgba(255, 255, 255, .3) 5px 8px);
}
.bar-row.urgente .bar-label { color: #f08379; font-weight: 600; }
.bar-row.urgente .warn { color: var(--danger); font-size: .7rem; }

/* Colonne per mese */
.cols { display: flex; align-items: flex-end; gap: 3px; }
.col-item {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 5px;
  transition: background .15s var(--ease);
}
.col-item:hover, .col-item:focus-visible { background: var(--green-wash); outline: none; }
.col-n {
  font-size: .68rem; font-weight: 600; color: var(--muted);
  font-variant-numeric: tabular-nums; margin-bottom: .2rem; min-height: .95rem;
}
/* Altezza FISSA: le percentuali delle colonne si risolvono contro questa e
   non contro lo spazio che avanza dopo le etichette, che cambierebbe da
   colonna a colonna e falserebbe le proporzioni. */
.col-track {
  height: 108px;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.col-bar {
  width: 100%;
  max-width: 26px;
  flex: none;
  background: var(--green);
  border-radius: 4px 4px 0 0;
  transition: height .5s var(--ease);
}
.col-item.vuoto .col-bar { background: var(--line); border-radius: 2px; }
.col-lab {
  font-size: .62rem; color: var(--faint); margin-top: .35rem;
  text-transform: uppercase; letter-spacing: .04em; min-height: .85rem;
}

/* ================= Telefono ================= */
@media (max-width: 900px) {
  .charts { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  main { padding: 1.25rem 0 6rem; }
  .topbar, .stats, .charts, .toolbar { padding-inline: 1rem; }
  .topbar { margin-bottom: 1.5rem; }
  h1 { font-size: 1.25rem; }

  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: .8rem .9rem; }
  .stat .n { font-size: 1.5rem; }

  .toolbar #search { flex: 1 1 100%; }
  .toolbar select { flex: 1; min-width: 0; }
  .count { margin-left: 0; width: 100%; }

  /* La tabella diventa un elenco di schede: nove colonne su un telefono
     obbligherebbero a scorrere in orizzontale per leggere una riga. */
  .table-wrap { border: 0; border-radius: 0; background: transparent; overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tbody tr {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: .9rem 1rem;
    margin: 0 1rem .7rem;
    width: auto;
  }
  tbody tr:hover { background: var(--surface); }
  td { border: 0; padding: 0; }
  /* Ogni valore si porta dietro la sua intestazione, che nel thead nascosto
     non c'e' piu'. */
  td[data-label]:not(.company)::before {
    content: attr(data-label);
    display: block;
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--faint);
    margin-top: .6rem;
    margin-bottom: .1rem;
  }
  /* Righe vuote nascoste: su una scheda un'etichetta senza valore e' rumore. */
  td[data-label]:empty { display: none; }
  td.company { font-size: 1.02rem; padding-right: 5.5rem; }
  td.role { color: var(--muted); }
  td.role, td.next { max-width: none; }
  tbody tr { position: relative; }
  .row-actions { position: absolute; top: .9rem; right: .9rem; }
  .chevron { font-size: 1.5rem; }
  /* Bersagli da dito: sotto i 44px si sbaglia il tocco. */
  .icon-btn { min-height: 40px; min-width: 44px; padding: .5rem .7rem; background: var(--surface-2); }
  select.status-select { min-height: 38px; font-size: .8rem; }
  .detail-grid { grid-template-columns: 1fr; gap: .85rem; }
  .detail-head h2 { font-size: 1.15rem; }

  .grid { grid-template-columns: 1fr; }
  .url-row { flex-direction: column; }
  .url-row .btn { min-height: 44px; }

  .topbar-actions { width: 100%; }
  .topbar-actions .btn { flex: 1; min-height: 44px; }
  .topbar-mascotte { width: 34px; }

  /* La scheda di modifica diventa un pannello a tutto schermo con le azioni
     sempre visibili in fondo: dentro una modale centrata, su un telefono, il
     pulsante Salva finisce sotto la tastiera. */
  .modal { padding: 0; place-items: stretch; }
  .modal-card {
    width: 100%;
    max-height: 100dvh;
    min-height: 100dvh;
    border-radius: 0;
    border: 0;
    padding: 1.25rem 1.1rem 0;
    display: flex;
    flex-direction: column;
  }
  .modal-card .grid { flex: 1; align-content: start; }
  .modal-card input, .modal-card select, .modal-card textarea { min-height: 44px; font-size: 16px; }
  .modal-actions {
    position: sticky;
    bottom: 0;
    margin: 1.25rem -1.1rem 0;
    padding: .85rem 1.1rem;
    padding-bottom: calc(.85rem + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--line);
  }
  .modal-actions .btn { min-height: 44px; }
  .modal-actions .btn.primary { flex: 1; }
}
