/* Gestore social di Missione mIAo: stile del pannello (prima il telefono, poi il computer). */

:root {
  --sfondo: #f2f4ff;
  --superficie: #ffffff;
  --inchiostro: #1d1a2e;
  --grigio: #5b5774;
  --linea: #e1e3f3;
  --bordo-campo: #cfd2e6;
  --corallo: #ff7a6b;
  --corallo-chiaro: #fff1ef;
  --arancio: #ffb45c;
  --latte: #fff2d0;
  --latte-forte: #ffe194;
  --allarme: #c2362b;
  --verde: #2e7d4f;
  --raggio: 14px;
  --ombra: 0 1px 2px rgba(29, 26, 46, 0.05), 0 6px 18px rgba(29, 26, 46, 0.06);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--sfondo);
  color: var(--inchiostro);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

h1 { font-size: 1.55rem; line-height: 1.2; margin: 8px 0 16px; }
h1 small { font-size: 0.9rem; font-weight: 500; color: var(--grigio); }
h2 { font-size: 1.15rem; margin: 0 0 8px; }
a { color: inherit; }
img, video { max-width: 100%; }
:focus-visible { outline: 3px solid var(--arancio); outline-offset: 2px; }

.contenitore { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 16px; }
.principale { padding-top: 16px; padding-bottom: 16px; min-height: 60vh; }

/* --- testata e menu --------------------------------------------------------- */
.testata { background: var(--superficie); border-bottom: 1px solid var(--linea); }
.testata-riga { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding-top: 10px; padding-bottom: 6px; }
.marchio { font-weight: 800; font-size: 1.1rem; text-decoration: none; white-space: nowrap; padding: 4px 0; }
.marchio i { font-style: normal; color: var(--corallo); }
.marchio span { font-weight: 500; font-size: 0.85rem; color: var(--grigio); margin-left: 4px; }
.menu {
  display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  margin: 0 -16px; padding: 2px 16px 6px; flex: 1 1 100%;
}
.menu a {
  flex: 0 0 auto; text-decoration: none; padding: 8px 12px; border-radius: 999px;
  font-weight: 600; font-size: 0.95rem; color: var(--grigio); white-space: nowrap;
}
.menu a:hover { background: var(--sfondo); color: var(--inchiostro); }
.menu a[aria-current="page"] { background: var(--corallo-chiaro); color: var(--inchiostro); }
.pallino {
  display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 2px; border-radius: 999px;
  background: var(--corallo); color: var(--inchiostro); font-size: 0.75rem; line-height: 20px; text-align: center;
}
.pallino-mano { background: var(--latte-forte); }

@media (min-width: 760px) {
  .menu { flex: 0 1 auto; margin: 0 0 0 auto; padding: 0; }
}

.fascia-stop { background: var(--allarme); color: #fff; padding: 10px 0; }
.fascia-stop .contenitore { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.fascia-stop .bottone { background: #fff; color: var(--allarme); }

/* --- elementi comuni -------------------------------------------------------- */
.scheda {
  background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--raggio);
  padding: 16px; margin: 0 0 16px; box-shadow: var(--ombra);
}
.stretta { max-width: 440px; margin: 32px auto; }
.titolo-riga { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 4px 0 12px; }
.titolo-riga h1 { margin: 0; }
.sezione { margin: 26px 0; }
.sezione > h2 { display: flex; align-items: center; gap: 8px; }
.conta { background: var(--corallo); color: var(--inchiostro); border-radius: 999px; font-size: 0.8rem; padding: 0 9px; line-height: 22px; }
.spiega { color: var(--grigio); font-size: 0.9rem; margin: 4px 0 10px; }
.giorno { font-size: 0.95rem; color: var(--grigio); margin: 18px 0 8px; }
.giorno::first-letter { text-transform: uppercase; }
.vuoto { color: var(--grigio); font-style: italic; }
.nota { background: var(--latte); padding: 8px 12px; border-radius: 10px; }
.ok { color: var(--verde); margin: 2px 0; }
.in-linea { display: inline; margin: 0; }
code { background: #eef0fb; padding: 1px 6px; border-radius: 6px; font-size: 0.85rem; overflow-wrap: anywhere; }
.segreto { display: block; margin: 8px 0; padding: 8px 10px; }
details summary { cursor: pointer; font-weight: 600; margin: 14px 0 4px; }

.avviso { border: 1px solid; border-radius: 12px; padding: 10px 14px; margin: 0 0 16px; }
.avviso p { margin: 4px 0; }
.avviso ul { margin: 6px 0; padding-left: 20px; }
.avviso-ok { background: #e8f6ee; border-color: #bfe5cf; color: #1d5e3a; }
.avviso-errore { background: #fdecea; border-color: #f5c2bd; color: #8a231b; }
.avviso-mano { background: var(--latte); border-color: var(--latte-forte); color: #6b4300; }

/* --- bottoni ---------------------------------------------------------------- */
.bottone {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px; border: 1px solid transparent; border-radius: 10px;
  background: var(--corallo); color: var(--inchiostro); font: inherit; font-weight: 700;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.bottone:hover { filter: brightness(0.96); }
.bottone.secondario { background: var(--superficie); border-color: var(--bordo-campo); }
.bottone.pericolo, .bottone.armato { background: var(--allarme); border-color: var(--allarme); color: #fff; }
.bottone.piccolo { min-height: 36px; padding: 6px 12px; font-size: 0.875rem; }
.bottone:disabled { opacity: 0.6; cursor: progress; }
.link { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }

/* --- moduli ----------------------------------------------------------------- */
.modulo label { display: block; font-weight: 600; margin: 14px 0 6px; }
.modulo label.scelta, .modulo label.spunta { margin: 0; }
input[type="text"], input:not([type]), input[type="password"], input[type="url"], input[type="number"],
input[type="datetime-local"], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--bordo-campo); border-radius: 10px;
  background: #fff; color: var(--inchiostro); font: inherit; font-size: 16px;
}
textarea { resize: vertical; min-height: 140px; }
input[type="file"] { width: 100%; padding: 10px; border: 1px dashed var(--bordo-campo); border-radius: 10px; background: #fafbff; font-size: 0.95rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--corallo); outline-offset: 1px; border-color: var(--corallo); }
fieldset { border: 1px solid var(--linea); border-radius: 12px; padding: 4px 14px 14px; margin: 18px 0; min-width: 0; }
legend { font-weight: 700; padding: 0 6px; }
.spunta { display: flex; align-items: center; gap: 10px; font-weight: 500; padding: 8px 0; cursor: pointer; }
.spunta input { width: 20px; height: 20px; flex: 0 0 auto; accent-color: var(--corallo); }
.spunta.grande { font-size: 1.05rem; border-bottom: 1px solid var(--linea); padding: 12px 0; }
.due-colonne { display: grid; gap: 0 12px; }
@media (min-width: 600px) { .due-colonne { grid-template-columns: 1fr 1fr; } }
.valore-fisso { margin: 0; padding: 10px 12px; background: #eef0fb; border-radius: 10px; font-weight: 600; }
.azioni-modulo { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

.griglia-scelta { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.scelta {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 6px;
  border: 2px solid var(--linea); border-radius: 12px; font-weight: 400; cursor: pointer; background: var(--superficie);
}
.scelta:has(input[type="checkbox"]:checked) { border-color: var(--corallo); background: var(--corallo-chiaro); }
.scelta input[type="checkbox"] { position: absolute; top: 10px; left: 10px; width: 22px; height: 22px; z-index: 1; accent-color: var(--corallo); }
.scelta .anteprima { width: 100%; height: auto; aspect-ratio: 1; }
.scelta-nome { font-size: 0.75rem; color: var(--grigio); overflow-wrap: anywhere; }
.scelta .posizione { width: 72px; padding: 6px 8px; font-size: 0.9rem; }

.caricamento { margin-top: 14px; }
.caricamento progress { width: 100%; height: 14px; accent-color: var(--corallo); }
.caricamento p { margin: 6px 0 0; font-size: 0.9rem; color: var(--grigio); }
.caricamento.errore p { color: var(--allarme); font-weight: 600; }

/* --- post ------------------------------------------------------------------- */
.post {
  display: flex; gap: 12px; background: var(--superficie); border: 1px solid var(--linea);
  border-radius: var(--raggio); padding: 12px; margin: 0 0 10px;
}
.post-media { flex: 0 0 auto; display: block; }
.anteprima {
  display: block; width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: #e9eaf5;
}
.anteprima.vuota { display: flex; align-items: center; justify-content: center; color: var(--grigio); font-weight: 700; }
.anteprima-cornice { position: relative; display: block; }
.anteprima-cornice.e-video::after {
  content: "▶"; position: absolute; right: 5px; bottom: 5px; padding: 3px 5px; border-radius: 6px;
  background: rgba(29, 26, 46, 0.72); color: #fff; font-size: 10px; line-height: 1;
}
@media (min-width: 600px) { .post .anteprima { width: 96px; height: 96px; } }
.post-corpo { flex: 1; min-width: 0; }
.post-riga { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }
.rete, .formato, .stato { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; line-height: 1.5; }
.rete-instagram { background: #c13584; color: #fff; }
.rete-facebook { background: #1565d8; color: #fff; }
.rete-youtube { background: #d40000; color: #fff; }
.rete-tiktok { background: #111; color: #fff; }
.formato { background: #eef0fb; color: var(--grigio); }
.stato-bozza { background: #eceef6; color: #4a4766; }
.stato-da_approvare { background: var(--latte-forte); color: #5c3d00; }
.stato-approvato { background: #dff3e7; color: #1d5e3a; }
.stato-in_pubblicazione { background: #e1ecff; color: #1d4ea8; }
.stato-a_mano { background: var(--latte); color: #7a4b00; box-shadow: inset 0 0 0 1px var(--latte-forte); }
.stato-pubblicato { background: var(--verde); color: #fff; }
.stato-errore { background: var(--allarme); color: #fff; }
.stato-fermato { background: #e3e3ea; color: #4a4766; }
.stato-delicato { background: #efe3ff; color: #5b2a86; }
.post-testo { display: block; text-decoration: none; white-space: pre-line; overflow-wrap: anywhere; }
.post-testo:hover { text-decoration: underline; }
.post-piede { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 6px; font-size: 0.82rem; color: var(--grigio); }
.errore-breve { flex-basis: 100%; color: var(--allarme); }
.post-azioni { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.post-azioni form { margin: 0; }

.galleria { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 12px 0; }
figure { margin: 0; }
figcaption { font-size: 0.82rem; color: var(--grigio); margin-top: 4px; overflow-wrap: anywhere; }
.anteprima-grande { display: block; width: 100%; max-height: 70vh; object-fit: contain; background: #16141f; border-radius: 12px; }
.sottotitolo { font-size: 1.05rem; margin: 14px 0 0; }
.testo-post {
  white-space: pre-wrap; overflow-wrap: anywhere; background: #fafbff; border: 1px solid var(--linea);
  border-radius: 12px; padding: 12px; margin: 12px 0 8px;
}
.azioni-post { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.azioni-post form { margin: 0; }
.modulo-in-linea { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1 1 100%; }
.modulo-in-linea input { flex: 1 1 220px; width: auto; }
.condividi { margin: 10px 0 0; }
.condividi .spiega { color: inherit; margin-top: 6px; }
.scarica { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 2px; }
.eventi { list-style: none; margin: 0; padding: 0; }
.eventi li { padding: 8px 0; border-bottom: 1px solid var(--linea); font-size: 0.9rem; overflow-wrap: anywhere; }
.eventi li:last-child { border-bottom: 0; }
.eventi .ora { color: var(--grigio); }
.eventi .chi { font-weight: 700; }

/* --- foto e video ----------------------------------------------------------- */
.griglia-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.media-scheda { background: var(--superficie); border: 1px solid var(--linea); border-radius: 12px; padding: 8px; }
.media-scheda .anteprima { width: 100%; height: auto; aspect-ratio: 1; }
.media-nome { font-weight: 600; font-size: 0.875rem; margin: 6px 0 0; overflow-wrap: anywhere; }
.media-scheda .spiega { font-size: 0.75rem; }
.media-scheda .post-azioni { margin-top: 6px; }
.pagine { display: flex; justify-content: space-between; margin: 16px 0; }

/* --- numeri ----------------------------------------------------------------- */
.griglia-numeri { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 8px; }
.numero { background: var(--superficie); border: 1px solid var(--linea); border-top: 5px solid var(--linea); border-radius: 12px; padding: 12px 14px; }
.rete-bordo-instagram { border-top-color: #c13584; }
.rete-bordo-facebook { border-top-color: #1565d8; }
.rete-bordo-youtube { border-top-color: #d40000; }
.numero-rete { margin: 0; font-weight: 700; }
.numero-valore { margin: 2px 0 0; font-size: 2rem; font-weight: 800; line-height: 1.2; }
.tabella-scorrevole { overflow-x: auto; border: 1px solid var(--linea); border-radius: 12px; background: var(--superficie); }
.tabella { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.tabella th, .tabella td { padding: 8px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--linea); }
.tabella th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--grigio); white-space: nowrap; }
.tabella tr:last-child td { border-bottom: 0; }
.tabella td:nth-child(2) { min-width: 200px; }

/* --- impostazioni ----------------------------------------------------------- */
.collegamento { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 0; border-bottom: 1px solid var(--linea); }
.collegamento:last-child { border-bottom: 0; }
.collegamento > div:first-child { flex: 1 1 240px; }
.collegamento form { margin: 0; }
.collegamento-nome { margin: 0; font-weight: 700; }

/* --- piede ------------------------------------------------------------------ */
.piede { color: var(--grigio); font-size: 0.82rem; padding: 24px 0 36px; }
.piede .contenitore { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
