/* YouppyConnect. Interfaccia Youppy copiata da YouppyStudy (app.css + office.css). I colori stanno tutti qui sotto, una volta
   per il tema chiaro e una per lo scuro. Accento: ciano collegamento #0891b2. */
[data-tema="chiaro"] {
  --sfondo: #f3f6f8; --carta: #ffffff; --testo: #15202b; --tenue: #66737f; --linea: #e1e8ed;
  --accento: #0891b2; --accento-forte: #0e7490; --su-accento: #ffffff; --accento-tenue: #d8f1f7;
  --rosso: #d8392f; --verde: #1a9d55; --blu: #2f6bd8; --viola: #7a52d6; --arancio: #c96a12;
  --ombra: 0 2px 14px rgba(10, 60, 80, .08); --campo: #edf2f5;
}
[data-tema="scuro"] {
  --sfondo: #121519; --carta: #1c2127; --testo: #eef2f5; --tenue: #94a0ab; --linea: #2b323a;
  --accento: #22c5e6; --accento-forte: #5fd8ef; --su-accento: #062a33; --accento-tenue: #10333c;
  --rosso: #ff6b60; --verde: #45d08f; --blu: #7d9bff; --viola: #b79bff; --arancio: #ffa04d;
  --ombra: 0 2px 14px rgba(0, 0, 0, .4); --campo: #262c33;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body { background: var(--sfondo); color: var(--testo); font: 16px/1.45 system-ui, 'Segoe UI', Roboto, sans-serif; overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; padding: 0; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--blu); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
p { margin: 0; }
[hidden] { display: none !important; }
.cifre { font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

#app { height: 100dvh; max-width: 620px; margin: 0 auto; display: flex; flex-direction: column; background: var(--sfondo); position: relative; overflow: hidden; }
#vista { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
/* sfondo uniforme anche ai lati dello schermo largo (niente bande marroni) */
@media (min-width: 660px) { body { background: var(--sfondo); } }

/* ---- barra in basso ---- */
#barra { display: flex; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--carta); border-top: 1px solid var(--linea); z-index: 2; }
#barra button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 0 3px; color: var(--tenue); font-size: 11px; font-weight: 600; border-radius: 14px; }
#barra button.attiva { color: var(--accento-forte); }
#barra button .ic { width: 44px; height: 27px; padding: 3px 11px; border-radius: 12px; transition: background .2s; }
#barra button.attiva .ic { background: var(--accento-tenue); }
#barra svg { width: 100%; height: 100%; display: block; }

/* ---- pezzi comuni ---- */
.pagina { padding: calc(14px + env(safe-area-inset-top)) 16px 26px; display: flex; flex-direction: column; gap: 14px; }
.testata { display: flex; align-items: center; gap: 10px; min-height: 44px; }
/* i titoli nel carattere del marchio Youppy (Baloo 2), come lo store e la faccia dell'icona */
@font-face { font-family: "Baloo 2"; src: url("/caratteri/Baloo2.ttf") format("truetype"); font-weight: 400 800; font-display: swap; }
.testata h1 { flex: 1; min-width: 0; font-family: "Baloo 2", system-ui, sans-serif; font-size: clamp(24px, 7.5vw, 29px); font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.testata h1 b { color: var(--accento-forte); }
.sotto { color: var(--tenue); font-size: 13.5px; margin-top: -8px; }
.tondo { width: 42px; height: 42px; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--tenue); background: var(--carta); box-shadow: var(--ombra); transition: transform .1s, background .15s; }
.tondo:active { transform: scale(.92); }
.tondo.pieno { background: var(--accento); color: var(--su-accento); box-shadow: 0 6px 16px color-mix(in srgb, var(--accento) 45%, transparent); }
.tondo svg { width: 22px; height: 22px; }
.carta { background: var(--carta); border-radius: 20px; padding: 16px; box-shadow: var(--ombra); }
.nota { color: var(--tenue); font-size: 14px; }
.nota.centro { text-align: center; }
.bottone { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 22px; border-radius: 16px; background: var(--accento); color: var(--su-accento); font-weight: 700; font-size: 17px; transition: transform .1s, background .15s; }
.bottone:active { transform: scale(.97); }
.bottone:disabled { opacity: .4; transform: none; }
.bottone.secondario { background: var(--accento-tenue); color: var(--accento-forte); }
.bottone.chiaro { background: var(--campo); color: var(--testo); }
.bottone.pericolo { background: none; color: var(--rosso); }
.bottone.largo { width: 100%; }
.bottone svg { width: 20px; height: 20px; }
.pillola { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 13px; border-radius: 999px; background: var(--campo); color: var(--tenue); font-weight: 700; font-size: 13px; white-space: nowrap; }
.pillola.forte { background: var(--accento-tenue); color: var(--accento-forte); }
.pillola svg { width: 15px; height: 15px; }
.vuoto { text-align: center; padding: 40px 20px; color: var(--tenue); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.vuoto svg { width: 54px; height: 54px; color: var(--linea); }
.vuoto h3 { color: var(--testo); font-size: 19px; font-weight: 800; }
.vuoto .bottone svg { width: 20px; height: 20px; color: inherit; }   /* l'icona del pulsante resta della misura dei pulsanti */

.campo { width: 100%; background: var(--campo); border: 1px solid transparent; border-radius: 14px; padding: 13px 14px; font-size: 16px; }
.campo:focus { border-color: var(--accento); outline: none; background: var(--carta); }
textarea.campo { resize: vertical; min-height: 90px; line-height: 1.5; }
.etichetta { display: block; font-size: 13px; font-weight: 700; color: var(--tenue); margin: 2px 2px 6px; }



/* ---- strati (fogli e avvisi) ---- */
#strati { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.velo { position: absolute; inset: 0; background: rgba(0,0,0,.45); opacity: 0; transition: opacity .2s; pointer-events: auto; }
.velo.on { opacity: 1; }
.foglio { position: absolute; left: 0; right: 0; bottom: 0; max-width: 620px; margin: 0 auto; background: var(--carta); border-radius: 24px 24px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 40px rgba(0,0,0,.25); transform: translateY(100%); transition: transform .26s cubic-bezier(.2,.8,.2,1); pointer-events: auto; max-height: 90dvh; overflow-y: auto; }
.foglio.on { transform: translateY(0); }
.foglio h2 { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.manico { width: 40px; height: 4px; border-radius: 2px; background: var(--linea); margin: -6px auto 12px; }
.campoRiga { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.coloriScelta { display: flex; gap: 10px; flex-wrap: wrap; }
.coloriScelta button { width: 34px; height: 34px; border-radius: 50%; background: var(--c); position: relative; }
.coloriScelta button[aria-pressed="true"]::after { content: '✓'; color: #fff; position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; }
.toast { position: absolute; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--testo); color: var(--sfondo); padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; max-width: 90%; text-align: center; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

.segmento { display: flex; background: var(--campo); border-radius: 14px; padding: 3px; gap: 3px; }
.segmento button { flex: 1; padding: 9px 0; border-radius: 11px; font-weight: 700; font-size: 14px; color: var(--tenue); }
.segmento button.on { background: var(--carta); color: var(--testo); box-shadow: var(--ombra); }

#barra a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 0 3px; color: var(--tenue); font-size: 11px; font-weight: 600; border-radius: 14px; text-decoration: none; }
#barra a .ic { width: 44px; height: 27px; padding: 3px 11px; border-radius: 12px; }
#barra button.piu { flex: 0 0 58px; width: 58px; height: 58px; margin: -20px 6px 0; padding: 0; border-radius: 50%; display: grid; place-items: center; color: var(--su-accento);
  background: linear-gradient(135deg, var(--accento), var(--accento-forte)); box-shadow: 0 6px 18px color-mix(in srgb, var(--accento) 50%, transparent); transition: transform .1s; }
#barra button.piu:active { transform: scale(.92); }
#barra button.piu svg { width: 28px; height: 28px; }
.sotto-nav { display: flex; flex-direction: column; gap: 10px; }
.sezioni { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.sezioni::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px; background: var(--campo); color: var(--tenue); font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.chip svg { width: 16px; height: 16px; }
.chip.on { background: var(--accento-tenue); color: var(--accento-forte); }
.ricerca { display: flex; gap: 8px; align-items: center; }
.ricerca .campo { flex: 1; min-width: 0; }
.bottone.voce { justify-content: flex-start; text-decoration: none; margin-top: 8px; }
a.carta.corsi { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--testo); }
a.carta.corsi > svg { width: 22px; height: 22px; flex: none; color: var(--accento-forte); }
a.carta.corsi span { flex: 1; display: flex; flex-direction: column; } a.carta.corsi small { color: var(--tenue); font-size: 12.5px; }
.profiloTesta { display: flex; gap: 14px; align-items: center; }
.avatar { width: 56px; height: 56px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accento); color: var(--su-accento); font-weight: 800; font-size: 24px; }
.carta.privato { border: 1px dashed var(--linea); }
.carta.privato h3 { font-size: 16px; margin-bottom: 6px; }
.foglio.intera { top: 0; max-width: none; border-radius: 0; overflow-y: auto; padding-top: calc(22px + env(safe-area-inset-top)); }
.foglio.intera .chiudiX { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 14px; }
.chatPag { gap: 12px; }
.chatCorpo { display: flex; gap: 10px; align-items: flex-start; }
.cmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.cbarra { display: flex; flex-direction: column; gap: 6px; flex: none; position: sticky; top: 8px; }
.cb { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; width: 54px; min-height: 54px; border-radius: 16px; background: var(--carta); box-shadow: var(--ombra); color: var(--tenue); text-decoration: none; }
.cb svg { width: 22px; height: 22px; } .cb small { font-size: 10px; font-weight: 700; }
.chatCorpo[data-barra="sinistra"] .cbarra { order: -1; }
.chatCorpo[data-barra="su"] { flex-direction: column; }
.chatCorpo[data-barra="su"] .cbarra { flex-direction: row; overflow-x: auto; position: static; width: 100%; }
.chatCorpo[data-barra="su"] .cmain { width: 100%; }
.chatCorpo[data-barra="nessuna"] .cbarra { display: none; }
.iaBox, .chatCarta { display: flex; flex-direction: column; gap: 10px; }
.iaBox h3, .chatCarta h3 { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.iaBox h3 svg, .chatCarta h3 svg { width: 20px; height: 20px; color: var(--accento-forte); }
.iaBox .bottone svg { width: 18px; height: 18px; }
.iaRis:empty { display: none; }
.iaTestoRis { white-space: pre-wrap; word-break: break-word; line-height: 1.5; background: var(--campo); border-radius: 14px; padding: 12px 14px; }
.ycBox { height: 440px; min-height: 360px; border-radius: 14px; overflow: hidden; }
.anteprimaMedia { width: 100%; max-height: 50dvh; object-fit: contain; border-radius: 14px; background: var(--campo); display: block; }

/* ================= YouppyConnect ================= */
.statline { display: flex; gap: 10px; }
.statbox { flex: 1; min-width: 0; background: var(--carta); border-radius: 16px; padding: 12px; text-align: center; box-shadow: var(--ombra); }
.statbox .n { font-size: 26px; font-weight: 800; line-height: 1; }
.statbox .e { font-size: 12px; color: var(--tenue); margin-top: 4px; }
.sezione-t { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; color: var(--tenue); text-transform: uppercase; letter-spacing: .06em; margin: 4px 2px -4px; }
.elenco { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.riga { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--carta); border-radius: 18px; padding: 12px 14px; box-shadow: var(--ombra); color: var(--testo); text-decoration: none; }
.riga .bollo { width: 44px; height: 44px; flex: none; border-radius: 14px; display: grid; place-items: center; background: var(--accento-tenue); color: var(--accento-forte); position: relative; }
.riga .bollo svg { width: 24px; height: 24px; }
.riga .cuore { flex: 1; min-width: 0; }
.riga .cuore b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.riga .cuore small { display: block; color: var(--tenue); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.riga > svg { width: 20px; height: 20px; flex: none; color: var(--tenue); }
.riga .azione { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--tenue); }
.riga .azione svg { width: 21px; height: 21px; }
.vivo { position: absolute; right: -2px; bottom: -2px; width: 13px; height: 13px; border-radius: 50%; background: var(--verde); border: 2px solid var(--carta); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--campo); color: var(--tenue); white-space: nowrap; }
.pill.si { background: color-mix(in srgb, var(--verde) 16%, transparent); color: var(--verde); }
.pill.no { background: color-mix(in srgb, var(--rosso) 14%, transparent); color: var(--rosso); }
.pill.lavori { background: color-mix(in srgb, var(--arancio) 16%, transparent); color: var(--arancio); }
.info { width: 26px; height: 26px; flex: none; border-radius: 50%; display: inline-grid; place-items: center; color: var(--tenue); font: 700 15px/1 system-ui; }
.spiega { background: var(--campo); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; line-height: 1.45; }
.carta h3 { font-size: 17px; }
.cartaTesta { display: flex; align-items: center; gap: 10px; }
.cartaTesta > svg { width: 22px; height: 22px; flex: none; color: var(--accento-forte); }
.cartaTesta h3 { flex: 1; min-width: 0; }
.dati { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; margin-top: 10px; font-size: 14px; }
.dati dt { color: var(--tenue); } .dati dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.carta .azioni { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.carta .azioni .bottone { flex: 1 1 140px; min-height: 46px; font-size: 15px; padding: 0 14px; }
.trovati { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.trovati:empty { display: none; }
.trovato { background: var(--campo); border-radius: 12px; padding: 10px 12px; font-size: 14px; overflow-wrap: anywhere; }
.trovato b { display: block; }
.trovato small { color: var(--tenue); }
.avviso { background: var(--accento-tenue); color: var(--testo); border-radius: 16px; padding: 12px 14px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.avviso svg { width: 20px; height: 20px; flex: none; color: var(--accento-forte); margin-top: 1px; }
.barraSpazio { height: 8px; border-radius: 4px; background: var(--campo); overflow: hidden; margin-top: 8px; }
.barraSpazio i { display: block; height: 100%; background: var(--accento); }
.avanzamento { height: 6px; border-radius: 3px; background: var(--campo); overflow: hidden; }
.avanzamento i { display: block; height: 100%; width: 0; background: var(--accento); transition: width .2s; }
.lucchetto { display: flex; flex-direction: column; gap: 10px; }
.lucchetto .campo { font-size: 16px; }
.spunta { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--testo); }
.spunta input { width: 20px; height: 20px; accent-color: var(--accento); }
/* Sinnay e Cerebro: in costruzione e box donazioni */
.progetto { display: flex; flex-direction: column; gap: 10px; }
.progetto .cartaTesta .pill { flex: none; }
a.dona { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--su-accento); background: linear-gradient(135deg, var(--accento), var(--accento-forte)); border-radius: 16px; padding: 12px 14px; }
a.dona svg { width: 22px; height: 22px; flex: none; }
a.dona span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
a.dona b { font-size: 15px; } a.dona small { font-size: 12.5px; opacity: .9; }
a.sito { display: inline-flex; align-items: center; gap: 6px; color: var(--accento-forte); font-weight: 700; font-size: 14px; text-decoration: none; }
a.sito svg { width: 16px; height: 16px; }
/* editor dell'interfaccia (solo proprietario) */
.chipset { display: flex; flex-wrap: wrap; gap: 8px; }
.chipset .chip[aria-pressed="true"] { background: var(--accento-tenue); color: var(--accento-forte); }
.comando { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; background: var(--campo); border-radius: 14px; padding: 10px; }
.comando .campo { background: var(--carta); padding: 10px 12px; font-size: 15px; }
.comando .sx { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.comando .dx { display: flex; flex-direction: column; gap: 4px; }
.comando .dx button { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--tenue); background: var(--carta); }
.comando .dx button svg { width: 18px; height: 18px; }
.comando .tre { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.impgriglia { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.impgriglia label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; color: var(--tenue); min-width: 0; }
.anteprima { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ctrl { background: var(--campo); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ctrl.largo { grid-column: 1 / -1; }
.ctrl .nome { font-size: 13px; font-weight: 700; color: var(--tenue); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctrl .valore { font-size: 24px; font-weight: 800; }
.ctrl input[type="range"] { width: 100%; accent-color: var(--accento); }
.ctrl .bottone { min-height: 44px; font-size: 15px; }
.interr { position: relative; width: 52px; height: 30px; border-radius: 999px; background: var(--linea); transition: background .2s; }
.interr::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); transition: transform .2s; }
.interr[aria-checked="true"] { background: var(--accento); }
.interr[aria-checked="true"]::after { transform: translateX(22px); }
.salvato { font-size: 12.5px; color: var(--tenue); text-align: right; min-height: 18px; }
@media (min-width: 560px) { .anteprima { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 600px) { .sezioni { gap: 5px; } .sezioni .chip { padding: 0 9px; gap: 5px; } }
.avatar svg { width: 28px; height: 28px; }
