/* Destinazioni dei report, modulo di una destinazione, recapiti e «Invia a…» (web/js/views/report/destin*.js,
   deliveries.js, send-dialog.js). Usa i token di app.css (temi chiaro e scuro). Prefissi: .rdest-* per le destinazioni,
   .rdel-* per i recapiti. */

.rdest, .rdest-page, .rdel { min-width: 0; }
.rdest [hidden], .rdest-page [hidden], .rdel [hidden] { display: none !important; }

/* ---- Scheda «Destinazioni» ---- */
.rdest-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; margin-bottom: 8px; }
.rdest-head h2 { margin: 0 0 2px; }
.rdest-head p { margin: 0; max-width: 70ch; }
.rdest-list { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.rdest-newkind { margin: 12px 0; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.rdest-newkind h3 { margin: 0 0 10px; }
.rdest-empty { margin-top: 12px; }

/* Scelta del tipo */
.rdest-kinds { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.rdest-kind-card { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; }
.rdest-kind-card:hover, .rdest-kind-card:focus-visible { border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.rdest-kind-head { display: flex; align-items: center; gap: 8px; }

/* Card di una destinazione */
.rdest-card { margin: 0; }
.rdest-card.off { opacity: 0.85; }
.rdest-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 8px; }
.rdest-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; }
.rdest-title h2 { margin: 0; overflow-wrap: anywhere; }
.rdest-kv { margin: 6px 0; }
.rdest-usage { margin: 6px 0 0; padding-left: 18px; }
.rdest-readonly { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; }
.rdest-readonly li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.rdest-readonly li:last-child { border-bottom: none; }

/* Prove */
.rdest-test { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.rdest-result { min-height: 1.4em; font-size: 13px; overflow-wrap: anywhere; }
.rdest-result .badge { margin-right: 4px; }

/* ---- Modulo ---- */
.rdest-form { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
.rdest-page > .card { margin-bottom: 16px; }
.rdest-form-actions { margin-top: 2px; }
.rdest-form .field input[type="text"], .rdest-form .field input[type="number"], .rdest-form .field textarea, .rdest-form .field select { width: 100%; }
.rdest-form textarea { font-family: inherit; line-height: 1.4; }
.rdest-field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.rdest-label { font-weight: 550; }
.rdest-secret-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rdest-secret-row > input { flex: 1 1 220px; min-width: 0; }
.rdest-secret-row .field-msg { flex-basis: 100%; }
.rdest-tools { display: inline-flex; gap: 6px; }
.rdest-secret-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); }
.rdest-masked { color: var(--text); overflow-wrap: anywhere; }
.rdest-subform { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.rdest-placeholders { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rdest-chip { font-family: var(--mono); font-size: 12px; }
.rdest-caption-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.rdest-counter { font-variant-numeric: tabular-nums; color: var(--muted); }
.rdest-counter.over { color: var(--danger); font-weight: 600; }
.rdest-gstatus { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.rdest-help { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); padding: 8px 14px; }
.rdest-help > summary { cursor: pointer; font-weight: 550; padding: 2px 0; }
.rdest-help ol { margin: 8px 0 4px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.rdest-code { margin: 6px 0 10px; padding: 10px 12px; overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-family: var(--mono); font-size: 12px; line-height: 1.45; white-space: pre; }
.rdest-danger { border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }

/* ---- «Invia a…» ---- */
.rdest-choices { display: flex; flex-direction: column; gap: 6px; }
.rdest-choice { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.rdest-choice:hover { background: var(--surface-2); }
.rdest-choice.off { opacity: 0.65; cursor: not-allowed; }
.rdest-choice input { width: 16px; height: 16px; margin: 0; flex: none; }
.rdest-choice-name { font-weight: 550; overflow-wrap: anywhere; }
.rdest-msg[hidden] { display: none; }
.rdest-msg { display: block; margin-top: 6px; color: var(--danger); font-size: 12.5px; font-weight: 550; line-height: 1.35; }

/* ---- Recapiti ---- */
.rdel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; }
.rdel-head h3 { margin: 0; }
.rdel-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rdel-row { display: grid; grid-template-columns: minmax(160px, 1.2fr) minmax(200px, 1.6fr) minmax(0, 2fr) auto; gap: 4px 14px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); }
.rdel-row:last-child { border-bottom: none; }
.rdel-dest { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; overflow-wrap: anywhere; }
.rdel-state { display: flex; align-items: center; gap: 6px; }
.rdel-detail { min-width: 0; overflow-wrap: anywhere; }
.rdel-error { color: var(--danger); }
.rdel-retry_wait .rdel-error { color: var(--warn); }
.rdel-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
@media (max-width: 860px) {
  .rdel-row { grid-template-columns: minmax(0, 1fr); }
  .rdel-actions { justify-content: flex-start; }
}
