/* Circlegram Web - stile. Tema chiaro/scuro (03/11): quello scelto nell'app sul telefono (data-theme
   su <html>, da applyTheme); prima del collegamento, o con un'app vecchia, quello del browser. */
:root {
  color-scheme: light;
  --brand: #ed883b;
  --brand-dark: #a65619;
  /* Sfondo delle chat della palette (dal telefono); nel tema scuro resta --bg. */
  --chat-bg-light: #fff7ef;
  --chat-bg: var(--chat-bg-light);
  --bg: #f4f5f7;
  --panel: #ffffff;
  --text: #212121;
  --muted: #757575;
  --line: #e3e5e8;
  /* Fumetti inviati azzurro chiaro (23/10): non più il colore della palette; l'urgenza li colora. */
  --mine: #d4e9ff;
  --mine-text: #212121;
  /* 20/11: ricevuti come nell'app: lo sfondo della chat scurito del 7% (prima bianchi, quasi invisibili sullo sfondo) */
  --theirs: color-mix(in srgb, var(--chat-bg-light) 93%, #000000);
  --theirs-text: #212121;
  /* Date al centro della chat e reazioni sotto i fumetti. */
  --day-bg: rgba(255,255,255,.9);
  --day-text: #5f6368;
  --react-bg: #ffffff;
  --react-text: #424242;
  --react-line: #e0e0e0;
  --err-soft: #c62828;
  --cal-sat: #607d8b;
  --cal-sun: #e53935;
  --cal-day: rgba(0,0,0,.06);
  --cal-sat-bg: rgba(96,125,139,.16);
  --cal-sun-bg: rgba(229,57,53,.18);
  --cal-hol-bg: rgba(129,199,132,.4);
  --cal-hol: #2e7d32;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #17181a;
  --panel: #212224;
  --text: #ececec;
  --muted: #9a9a9a;
  --line: #333538;
  --theirs: #4d4d52;
  --theirs-text: #ececec;
  --chat-bg: var(--bg);
  --day-bg: #2c2d30;
  --day-text: #e0e0e0;
  --react-bg: #2c2d30;
  --react-text: #ececec;
  --react-line: #45474b;
  --err-soft: #ef9a9a;
  --cal-sat: #90a4ae;
  --cal-sun: #ef5350;
  --cal-day: rgba(255,255,255,.08);
  --cal-sat-bg: rgba(96,125,139,.16);
  --cal-sun-bg: rgba(239,83,80,.25);
  --cal-hol-bg: rgba(129,199,132,.35);
  --cal-hol: #a5d6a7;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #17181a;
    --panel: #212224;
    --text: #ececec;
    --muted: #9a9a9a;
    --line: #333538;
    --theirs: #4d4d52;
    --theirs-text: #ececec;
    --chat-bg: var(--bg);
    --day-bg: #2c2d30;
    --day-text: #e0e0e0;
    --react-bg: #2c2d30;
    --react-text: #ececec;
    --react-line: #45474b;
    --err-soft: #ef9a9a;
    --cal-sat: #90a4ae;
    --cal-sun: #ef5350;
    --cal-day: rgba(255,255,255,.08);
    --cal-sat-bg: rgba(96,125,139,.16);
    --cal-sun-bg: rgba(239,83,80,.25);
    --cal-hol-bg: rgba(129,199,132,.35);
    --cal-hol: #a5d6a7;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; margin-top: 40vh; }
button { font: inherit; border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer;
  background: var(--brand); color: #fff; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.link { background: none; color: var(--brand); padding: 0; }
input, textarea, select { font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
a { color: inherit; }

.screen { height: 100%; }
#pairing, #closed { display: flex; align-items: center; justify-content: center; padding: 16px; }
.pair-card { background: var(--panel); border-radius: 16px; padding: 28px; max-width: 460px; width: 100%;
  box-shadow: 0 4px 24px rgba(0,0,0,.08); }
.pair-card h1 { margin: 0 0 12px; color: var(--brand); font-size: 26px; }
.qr { display: flex; justify-content: center; margin: 18px 0; min-height: 260px; }
.qr img { width: 260px; height: 260px; image-rendering: pixelated; background: #fff; padding: 8px; border-radius: 8px; }

#main { display: flex; flex-direction: column; }
#tabs { display: flex; gap: 6px; padding: 10px 12px; background: linear-gradient(var(--brand), var(--brand-dark)); flex-wrap: wrap; }
#tabs button { background: rgba(255,255,255,.18); }
#tabs button.active { background: #fff; color: var(--brand); }
#tabs .spacer { flex: 1; }
#tabs #logout { color: #fff; border-color: rgba(255,255,255,.5); }
#content { flex: 1; display: flex; min-height: 0; }
#list { width: 320px; max-width: 40%; border-right: 1px solid var(--line); overflow-y: auto; background: var(--panel); }
#detail { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.item { padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.item:hover, .item.active { background: color-mix(in srgb, var(--brand) 12%, transparent); }
.item .title { font-weight: 600; }
.item .sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toolbar { padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel); display: flex; gap: 8px; align-items: center; }
.toolbar h2 { margin: 0; font-size: 17px; flex: 1; }
.toolbar-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.toolbar-title h2 { flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toolbar-title .presence { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.presence.typing, .item .sub.typing { color: var(--brand); font-style: italic; }
.bubble .quote { cursor: pointer; }
.bubble.flash { animation: quoteflash 1.2s ease; }
@keyframes quoteflash { 0%, 50% { opacity: .35; } 25%, 100% { opacity: 1; } }

#messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 6px; background: var(--chat-bg); }
.day { align-self: center; font-size: 12px; color: var(--day-text); background: var(--day-bg); padding: 3px 12px;
  border-radius: 10px; margin: 8px 0; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.bubble { max-width: 72%; padding: 8px 12px; border-radius: 14px; word-wrap: break-word; white-space: pre-wrap; }
.bubble.mine { align-self: flex-end; background: var(--mine); color: var(--mine-text); border-bottom-right-radius: 4px; }
/* 20/11: gruppi, iconcina di chi scrive a sinistra del fumetto */
.bubble.with-ava { position: relative; margin-left: 40px; }
.bubble .bubble-ava { position: absolute; left: -40px; bottom: 0; width: 32px; height: 32px; font-size: 12px; }
.bubble.theirs { align-self: flex-start; background: var(--theirs); color: var(--theirs-text); border-bottom-left-radius: 4px; }
.bubble .who { font-size: 12px; font-weight: 600; opacity: .8; }
.bubble .meta { font-size: 11px; opacity: .75; text-align: right; margin-top: 2px; }
/* Fase 7: citazione, reazioni, striscia della risposta, reazioni rapide */
.bubble .quote, #replybar .texts { border-left: 3px solid var(--brand); padding: 2px 8px; margin-bottom: 4px; font-size: 13px; }
.bubble .quote { background: rgba(0,0,0,.05); border-radius: 6px; }
.bubble .quote .qa, #replybar .qa { font-weight: 700; }
.bubble .quote .qt, #replybar .qt { opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }
.bubble .reactions { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 999px; background: var(--react-bg); color: var(--react-text); border: 1px solid var(--react-line); font-size: 14px; }
#replybar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-top: 1px solid var(--line); background: var(--panel); }
#replybar.hidden { display: none; }
#replybar .texts { flex: 1; min-width: 0; margin: 0; }
.react-menu { display: flex; gap: 2px; padding: 6px; }
.react-menu .emoji.selected { background: var(--line); border-radius: 8px; }
.bubble a { color: inherit; text-decoration: underline; }
.bubble img.thumb { display: block; max-width: 260px; max-height: 300px; border-radius: 8px; cursor: pointer; margin: 2px 0; }
.bubble .thumb-checking { width: 220px; height: 160px; border-radius: 8px; margin: 2px 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 12px; box-sizing: border-box; background: rgba(128,128,128,.2); font-size: 13px; opacity: .85; cursor: pointer; }
.att { display: flex; gap: 10px; align-items: center; min-width: 0; }
/* 12/11: nomi lunghi degli allegati a capo dentro la scheda, mai fuori dalla finestra. */
.att-texts { min-width: 0; flex: 1; }
.att-name { overflow-wrap: anywhere; word-break: break-word; }
.att > :first-child { flex-shrink: 0; }
button.link.busy { opacity: 1; cursor: progress; }
button.link.busy::before { content: ''; display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: att-spin .8s linear infinite; }
@keyframes att-spin { to { transform: rotate(360deg); } }
.att .icon { font-size: 26px; }
.bubble audio { max-width: 260px; display: block; }
/* Vocali (05/11): il pulsante "▶ Messaggio vocale" e il lettore del browser seguono il colore del fumetto,
   non il tema della pagina; nel tema scuro i fumetti inviati restano azzurro chiaro e il testo bianco
   del tema non si leggeva. */
.bubble button.ghost { color: inherit; border-color: color-mix(in srgb, currentColor 35%, transparent); }
.bubble.mine:not(.urgent) { color-scheme: light; }
.bubble.urgent { color-scheme: dark; }
.vocal-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.vocal-text-btn { padding: 6px 10px; font-size: 13px; }
.vocal-text { margin-top: 6px; font-size: 14px; white-space: pre-wrap; max-width: 320px; }
.bubble .vocal-text.muted { color: inherit; opacity: .75; font-style: italic; }
#composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: var(--panel); align-items: flex-end; }
#composer textarea { resize: none; height: 42px; max-height: 140px; }
#composer label { cursor: pointer; font-size: 22px; padding: 6px; }
#composer input[type=file] { display: none; }
#composer .urgency-btn { width: 42px; height: 42px; border-radius: 50%; padding: 0; font-size: 18px; color: #fff; flex: none; }
#composer .send-btn { color: #fff; }
.bubble.urgent { color: #fff; }
.urgency-menu { min-width: 260px; }
.urgency-menu .urgency-title { font-weight: 600; padding: 8px 12px 4px; }
.urgency-menu .ctxitem.selected { background: color-mix(in srgb, var(--brand) 14%, transparent); }
.urgency-name { font-weight: 700; display: inline-block; padding: 1px 10px; border-radius: 10px; }
.urgency-sub { font-size: 12px; opacity: .75; }
#composer .emoji-btn { font-size: 22px; padding: 6px; flex: none; border: 0; }
.emoji-menu { width: 340px; max-width: calc(100vw - 16px); padding: 6px; }
.emoji-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding-bottom: 4px; margin-bottom: 4px; }
.emoji-tab { flex: 1; font-size: 20px; padding: 4px; background: transparent; border-radius: 8px; }
.emoji-tab.selected { background: color-mix(in srgb, var(--brand) 18%, transparent); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 240px; overflow-y: auto; }
.emoji-grid .emoji { font-size: 22px; padding: 4px 0; background: transparent; border-radius: 6px; line-height: 1.2; }
.emoji-grid .emoji:hover, .emoji-tab:hover { background: color-mix(in srgb, var(--text) 10%, transparent); }

.form { padding: 14px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.form .row { display: flex; gap: 8px; }
/* Pulsanti larghi quanto il testo, non tutta la pagina (09/11, contatti del dispositivo). */
.form .btn-fit { align-self: flex-start; width: auto; padding-left: 22px; padding-right: 22px; }
.notebody { flex: 1; min-height: 220px; resize: vertical; }
.pill { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 10px; background: color-mix(in srgb, var(--brand) 20%, transparent); margin-left: 6px; }

#lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; z-index: 10; }
#lightbox img, #lightbox video { max-width: 94vw; max-height: 94vh; }

@media (max-width: 720px) {
  #list { width: 100%; max-width: none; border-right: 0; }
  #content.open #list { display: none; }
  #content:not(.open) #detail { display: none; }
}

/* Intestazione dell'elenco chat: logo + Circlegram + "+" */
.list-header { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--panel); z-index: 1; }
.list-header img { width: 40px; height: 40px; }
.list-header .brand { flex: 1; font-size: 24px; font-weight: 700; letter-spacing: .2px; }
.list-header .plus { width: 40px; height: 40px; border-radius: 50%; font-size: 24px; line-height: 1; padding: 0; }
/* 03/12: tasto "B" delle novità delle Bacheche, "B" e sotto il numero; a sinistra del "+", nel colore del tema come il "+" */
.list-header .hub-b { width: 40px; height: 40px; border-radius: 50%; padding: 0; border: none; background: var(--brand); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; box-shadow: 0 2px 5px rgba(0,0,0,.25); }
.list-header .hub-b.hidden { display: none; }
.hub-b-icon { width: 16px; height: 16px; display: block; }
.hub-b-count { font-size: 10px; font-weight: 700; margin-top: 1px; }
.hub-upd-list { max-height: 60vh; overflow-y: auto; overflow-x: hidden; }
.hub-upd-list .item { box-sizing: border-box; width: 100%; }
.hub-upd-row { gap: 10px; align-items: center; }

/* Avatar con iniziali, sfumato come nell'app */
.avatar { flex: none; width: 42px; height: 42px; border-radius: 50%; color: #fff; display: flex; align-items: center;
  justify-content: center; font-weight: 600; font-size: 16px; }
.avatar.small { width: 34px; height: 34px; font-size: 14px; }
.item.row { display: flex; align-items: center; gap: 12px; }
.item.row .texts { flex: 1; min-width: 0; }
.toolbar .avatar { margin-right: 2px; }
.toolbar .toolbar-icon { font-size: 20px; padding: 4px 10px; }

/* Nuova chat / rubrica */
.list-section { padding: 10px 14px; font-weight: 700; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--brand) 16%, var(--panel)); }
.list-day { text-align: center; font-size: 13px; font-weight: 600; color: var(--list-day); padding: 10px 14px 4px; }
.section-title { padding: 12px 14px 6px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.contact-action { flex: none; }
.contact-action.done { color: var(--muted); font-size: 13px; }
.item.none { opacity: .55; cursor: default; }
.member-pick { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.member-pick input { width: auto; }

/* "←" solo su schermi stretti (su schermo largo l'elenco resta visibile a sinistra). */
@media (min-width: 721px) { .toolbar .back { display: none; } }

.keep { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; cursor: pointer; }
.keep input { width: auto; }
.row-buttons { display: flex; gap: 10px; margin-top: 14px; }

/* Menu del tasto destro, scelta del destinatario per l'inoltro, avvisi brevi */
.ctxmenu { position: fixed; z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.18); padding: 4px 0; min-width: 170px; }
.ctxitem { padding: 9px 16px; cursor: pointer; }
.ctxitem:hover { background: color-mix(in srgb, var(--brand) 14%, transparent); }
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: var(--panel); border-radius: 16px; padding: 20px; width: 100%; max-width: 420px; max-height: 80vh;
  display: flex; flex-direction: column; gap: 10px; }
.modal-card h2 { margin: 0; font-size: 18px; }
.modal-list { overflow-y: auto; min-height: 0; flex: 1; border: 1px solid var(--line); border-radius: 10px; }
.modal-card .row-buttons { margin-top: 4px; justify-content: flex-end; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 40; background: #323232; color: #fff;
  padding: 10px 18px; border-radius: 20px; font-size: 14px; }

/* Menu del 📍 nella chat */
.popmenu { position: fixed; z-index: 50; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.18); padding: 6px; min-width: 280px; }
.popitem { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: transparent;
  color: var(--text); padding: 12px 14px; border-radius: 8px; min-height: 48px; }
.popitem:hover { background: var(--bg); }
.popicon { width: 22px; text-align: center; font-size: 18px; }

/* Controllo dell'arrivo a destinazione */
.dest-wrap { position: relative; flex: 1; min-height: 280px; }
/* Più specifico di .maplibregl-map (position: relative nel CSS di MapLibre), che la lasciava alta 0. */
.dest-wrap > .dest-map, .dest-wrap > .dest-map.maplibregl-map { position: absolute; inset: 0; }
.dest-refresh { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; border-radius: 50%;
  font-size: 22px; padding: 0; box-shadow: 0 2px 8px rgba(0,0,0,.25); z-index: 2; }
.dest-panel { background: var(--panel); border-top-left-radius: 18px; border-top-right-radius: 18px; padding: 14px 16px 16px;
  box-shadow: 0 -4px 16px rgba(0,0,0,.12); margin-top: -18px; position: relative; z-index: 3; }
.dest-label { margin: 2px 0 4px; }
.dest-label.off { opacity: .5; }
.dest-panel input[type=range] { width: 100%; padding: 0; border: 0; accent-color: var(--brand); background: transparent; }
.dest-panel input[type=range]:disabled { opacity: .4; }
.dest-times { display: flex; gap: 6px; margin: 4px 0 10px; }
.dest-times .chip { flex: 1; border-radius: 20px; background: color-mix(in srgb, var(--brand) 18%, var(--panel)); color: var(--text); font-weight: 600; }
.dest-times .chip.selected { background: var(--brand); color: #fff; }
.dest-time { flex: 1; border-radius: 20px; text-align: center; }
.dest-time.selected { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.dest-actions { display: flex; gap: 10px; }
.dest-actions button { flex: 1; border-radius: 20px; font-weight: 600; padding: 10px; }
.dest-actions button:disabled { opacity: .4; cursor: default; }
.dest-times .chip:disabled, .dest-times input:disabled { opacity: .4; cursor: default; }
.dest-cancel { background: #C62828; }
.dest-status { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; }
.dest-blink { animation: dest-blink 1.4s ease-in-out infinite; font-size: 18px; }
@keyframes dest-blink { 50% { opacity: .15; } }
.dest-hint { font-weight: 700; }
.dest-bubble { background: #fff; border: 2px solid #EE5F22; border-radius: 14px; padding: 4px; position: relative; }
.dest-bubble::after { content: ''; position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%);
  border: 8px solid transparent; border-top-color: #EE5F22; border-bottom: 0; }
.zone-label { display: block; overflow: visible; }
.center-small { text-align: center; margin-top: 30%; }

/* Finestra del controllo d'arrivo */
.dest-alert-card { gap: 12px; }
.dest-alert-head { font-weight: 700; font-size: 17px; color: #5E35B1; }
.dest-alert-head.late { color: #C62828; }
.dest-alert-img { width: 100%; height: 200px; object-fit: cover; border-radius: 12px; }
.dest-alert-text { font-size: 16px; }
.dest-alert-text.late { color: #C62828; font-weight: 600; }
.dest-label { background: #fff; color: #43A047; border: 2px solid #43A047; border-radius: 12px; padding: 4px 12px;
  font-weight: 700; font-size: 14px; position: relative; white-space: nowrap; }
.dest-label::after { content: ''; position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%);
  border: 7px solid transparent; border-top-color: #43A047; border-bottom: 0; }
.dest-search { position: absolute; top: 14px; left: 14px; right: 72px; z-index: 2; display: flex; gap: 6px;
  background: var(--panel); border-radius: 24px; padding: 4px 4px 4px 14px; box-shadow: 0 2px 8px rgba(0,0,0,.25); flex-wrap: wrap; }
.dest-search input { flex: 1; border: 0; padding: 6px 0; background: transparent; min-width: 0; }
.dest-search input:focus { outline: none; }
.dest-search > button { border-radius: 20px; padding: 6px 12px; }
.dest-search-results { flex-basis: 100%; margin: 4px 0 4px -10px; max-height: 260px; overflow-y: auto; }
.dest-search.locked { opacity: .5; }

/* Agenda: elenco o calendario (02/11), come nell'app. */
.seg { display: inline-flex; border: 1px solid var(--brand); border-radius: 20px; padding: 2px; gap: 2px; }
.seg button { border-radius: 18px; padding: 5px 14px; }
.seg button.ghost { border: 0; color: var(--brand); }
#list > .seg { margin: 10px 12px; }
.narrow-only { display: none; }
@media (max-width: 720px) { .narrow-only { display: block; } }
.cal-toolbar { flex-wrap: wrap; }
.cal-toolbar .spacer { flex: 1; }
.cal-head { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 14px 0; }
.cal-nav { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 520px; }
.cal-nav .ghost { font-size: 22px; line-height: 1; padding: 4px 14px; color: var(--brand); border: 0; }
.cal-nav .cal-title { flex: 1; font-size: 17px; font-weight: 700; color: var(--text); }
.cal-body { flex: 1; overflow-y: auto; padding: 8px 14px 14px; touch-action: pan-y; user-select: none; }
.cal-body.from-right { animation: calin-r .2s ease; }
.cal-body.from-left { animation: calin-l .2s ease; }
@keyframes calin-r { from { opacity: 0; transform: translateX(40px); } }
@keyframes calin-l { from { opacity: 0; transform: translateX(-40px); } }
.cal-month { max-width: 560px; margin: 0 auto; }
.cal-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; }
.cal-wd div { text-align: center; font-size: 13px; color: var(--muted); padding: 4px 0; }
.cal-wd.mini div { font-size: 11px; padding: 1px 0; }
.cal-wd .sat { color: var(--cal-sat); }
.cal-wd .sun { color: var(--cal-sun); }
.cal-day { position: relative; aspect-ratio: 1; border-radius: 8px; cursor: pointer; overflow: hidden;
  background: var(--cal-day); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.cal-day:hover { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--brand) 45%, transparent); }
.cal-day .num { font-size: 15px; }
.cal-day.sat { background: var(--cal-sat-bg); color: var(--cal-sat); }
.cal-day.sun { background: var(--cal-sun-bg); color: var(--cal-sun); }
.cal-day.hol { background: var(--cal-hol-bg); color: var(--cal-hol); }
.cal-day.sunhol::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 12%; min-height: 3px; background: #81c784; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-day.today .num { font-weight: 700; }
.cal-day .mark { width: 34%; height: 34%; fill: var(--brand); }
.cal-day .mark.done, .modal-list .mark.done { fill: var(--muted); }
.cal-blank { aspect-ratio: 1; }
.cal-month.six .cal-day, .cal-month.six .cal-blank { aspect-ratio: 1.25; }
.cal-month.six .cal-row { margin-bottom: 3px; }
.cal-year { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 22px; }
.cal-month.mini { max-width: none; margin: 0; }
.cal-month.mini .cal-row { gap: 2px; margin-bottom: 2px; }
.cal-mname { font-weight: 700; font-size: 15px; margin: 8px 0 2px; }
.cal-day.mini { border-radius: 4px; }
.cal-day.mini .num { font-size: 11px; }
.cal-day .dot { position: absolute; top: 12%; right: 12%; width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }
.cal-day .dot.done { background: var(--muted); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: center; margin: 16px 0 4px; font-size: 13px; color: var(--muted); }
.cal-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend .sw { width: 16px; height: 16px; border-radius: 4px; position: relative; overflow: hidden; background: var(--cal-day); }
.cal-legend .sw.today { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-legend .sw.hol { background: rgba(129,199,132,.4); }
.cal-legend .sw.sunhol { background: rgba(229,57,53,.18); }
.cal-legend .sw.sunhol::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: #81c784; }
.cal-legend .mark { width: 16px; height: 16px; fill: var(--brand); }
.cal-empty { padding: 10px 14px; }
.modal-list .mark { width: 22px; height: 22px; fill: var(--brand); flex: none; }
.modal-list .title.struck { text-decoration: line-through; color: var(--muted); }
.modal.top { z-index: 30; }
.confirm-modal { z-index: 40; animation: cf-fade .14s ease-out; backdrop-filter: blur(2px); }
.confirm-modal.closing { opacity: 0; transition: opacity .12s; }
.confirm-card { max-width: 380px; align-items: center; text-align: center; gap: 8px; padding: 24px 24px 20px;
  box-shadow: 0 18px 48px rgba(0,0,0,.28); animation: cf-pop .16s ease-out; }
.confirm-icon { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); margin-bottom: 4px; }
.confirm-icon.danger { background: color-mix(in srgb, #d32f2f 13%, transparent); color: #d32f2f; }
.confirm-icon svg { width: 26px; height: 26px; }
.confirm-card h2 { font-size: 18px; }
.confirm-text { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.confirm-buttons { display: flex; gap: 10px; width: 100%; margin-top: 12px; }
.confirm-buttons button { flex: 1; padding: 10px 14px; font-weight: 600; border-radius: 10px; }
button.danger { background: #d32f2f; color: #fff; }
button.danger:hover { background: #b71c1c; }
@keyframes cf-fade { from { opacity: 0; } }
@keyframes cf-pop { from { transform: scale(.94); opacity: 0; } }
.item.row.check { cursor: pointer; }
.item.row.check input { width: auto; }
.rem-form { display: flex; flex-direction: column; gap: 10px; }
.rem-form .link { text-align: left; }
.rem-form .err { color: #d32f2f; min-height: 1em; }
.row-buttons button:disabled, .form .row button:disabled { opacity: .45; cursor: default; }
@media (max-width: 720px) {
  #content.agenda-cal #list { display: none; }
  #content.agenda-cal #detail { display: flex; }
}

/* Sicurezza e condivisione (Parental Control dal browser, 02/11), come nell'app. */
.saf-page { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 14px;
  align-content: start; align-items: start; }
.saf-box { border: 1.5px solid var(--line); border-radius: 12px; padding: 4px 12px 8px; }
.req-note { display: flex; align-items: center; gap: 8px; }
.saf-box .req-note { padding: 6px 0 2px; }
.saf-box.stale .saf-value, .saf-box.stale .saf-icon, .saf-box.stale .saf-link { opacity: .45; }
.saf-spinner { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--line);
  border-top-color: var(--brand); animation: saf-spin .8s linear infinite; }
@keyframes saf-spin { to { transform: rotate(360deg); } }
.saf-offline { flex: none; display: flex; color: #d32f2f; }
.saf-offline svg { width: 18px; height: 18px; }
.saf-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; align-content: start; }
.saf-actions .saf-item { border: 1.5px solid var(--line); border-radius: 12px; min-height: 64px; }
.saf-row { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 4px 0; }
.saf-icon { width: 24px; text-align: center; font-size: 18px; }
.saf-label { flex: 1; }
.saf-right { display: flex; flex-direction: column; align-items: flex-end; max-width: 50%; text-align: right; }
.saf-value { font-weight: 700; }
.saf-link { font-size: 13px; color: var(--muted); }
.saf-link.clickable { color: var(--brand); cursor: pointer; }
.saf-item { font-size: 16px; padding: 12px 6px; border-radius: 10px; }
.usage-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.usage-row .grow, .grow { flex: 1; min-width: 0; }
.app-icon { width: 28px; height: 28px; border-radius: 6px; flex: none; object-fit: contain; }
.app-icon.blank { display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }
.pill.red { background: #d32f2f; color: #fff; }
.lim-state { margin: 0; color: var(--muted); }
.lim-state.err, .err { color: #d32f2f; }
.lim-state.warn { color: #fb8c00; font-weight: 600; }
.pad { padding: 10px 14px; }
.dur-pick { display: flex; gap: 16px; }
.dur-pick label { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.zone-panel { max-height: 45vh; overflow-y: auto; }
.zone-days { display: flex; gap: 6px; flex-wrap: wrap; }
.zone-days .chip { min-width: 38px; border-radius: 20px; background: color-mix(in srgb, var(--brand) 12%, var(--panel)); color: var(--text); }
.zone-days .chip.selected { background: var(--brand); color: #fff; }
.time-range { display: flex; align-items: stretch; gap: 10px; padding: 12px; border: 1.5px solid var(--line);
  border-radius: 14px; background: color-mix(in srgb, var(--brand) 5%, var(--panel)); max-width: 460px; }
.tr-mid { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 70px; }
.tr-arrow { font-size: 20px; color: var(--muted); }
.tr-span { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; }
.tr-span.bad { color: var(--err-soft); }
.tf { display: flex; flex-direction: column; gap: 4px; }
.tf-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.tf-btn { display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 12px; border-radius: 12px;
  background: var(--panel); color: var(--text); border: 1.5px solid var(--line); cursor: pointer;
  transition: border-color .15s, box-shadow .15s; }
.tf-btn:hover { border-color: color-mix(in srgb, var(--brand) 60%, var(--line)); }
.tf-btn.open { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.tf-icon { display: flex; color: var(--brand); }
.tf-icon svg { width: 22px; height: 22px; }
.tf-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.tf-pop { position: fixed; z-index: 1000; background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 10px 32px rgba(0,0,0,.22); padding: 10px; }
.tf-cols { display: flex; gap: 8px; }
.tf-colwrap { display: flex; flex-direction: column; gap: 4px; }
.tf-coltitle { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; text-align: center; letter-spacing: .4px; }
.tf-col { display: flex; flex-direction: column; gap: 2px; height: 220px; overflow-y: auto; overflow-x: hidden; padding: 0 2px;
  scrollbar-width: none; scroll-behavior: smooth; mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent); }
.tf-col::-webkit-scrollbar { display: none; }
.tf-col::before, .tf-col::after { content: ''; flex: none; height: 24px; }
.tf-opt { min-width: 64px; padding: 7px 0; border-radius: 9px; background: transparent; color: var(--text);
  font-size: 16px; font-variant-numeric: tabular-nums; border: 0; cursor: pointer; }
.tf-opt:hover { background: color-mix(in srgb, var(--brand) 12%, transparent); }
.tf-opt.sel { background: var(--brand); color: #fff; font-weight: 700; }
.zone-item .texts { flex: 1; }
.dot-state { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.mon-page { align-items: center; text-align: center; }
.mon-video { width: 100%; max-width: 720px; max-height: 60vh; background: #000; border-radius: 12px; }
.mon-mic { font-size: 72px; margin: 24px 0; }
.mon-status { font-size: 16px; }
.mon-status.mon-warn { color: var(--err-soft); font-weight: 600; }
.live-status { font-weight: 600; margin-bottom: 6px; }
.undelivered-tag { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; color: #c62828;
  font-size: 12px; font-weight: 700; cursor: pointer; }
.undelivered-tag svg { width: 15px; height: 15px; flex: none; }
.undelivered-tag:hover span { text-decoration: underline; }
.bubble.theirs .undelivered-tag { color: var(--err-soft); }
.undelivered-tag.on-color { color: #fff; }
.bubble.undelivered .meta { opacity: 1; }   /* la scritta a colore pieno; l'ora resta attenuata */
.bubble.undelivered .meta-time { opacity: .75; }
.alert-box { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 60; background: var(--panel);
  border: 2px solid var(--brand); border-radius: 14px; padding: 14px 18px; max-width: min(460px, 92vw); box-shadow: 0 8px 30px rgba(0,0,0,.25);
  display: flex; flex-direction: column; gap: 6px; }
.alert-title { font-weight: 700; color: var(--brand); }
.alert-box button { align-self: flex-end; }

/* Selettore di data e ora dei promemoria (03/11): al posto di quello del browser. */
.dt-field { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.dt-field:hover { border-color: var(--brand); }
.dt-field .dt-text { flex: 1; font-weight: 600; }
.dt-field .dt-edit { color: var(--brand); }
.dtp-overlay { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dtp-card { background: var(--panel); color: var(--text); border-radius: 18px; width: 100%; max-width: 360px; max-height: 96vh; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.3); display: flex; flex-direction: column; }
.dtp-card .dtp-body { overflow-y: auto; min-height: 0; }
.dtp-head { flex: none; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; padding: 14px 20px; border-radius: 18px 18px 0 0; }
.dtp-hdate { font-size: 22px; font-weight: 700; }
.dtp-htime { font-size: 15px; opacity: .9; margin-top: 2px; }
.dtp-body { padding: 10px 16px 0; display: flex; flex-direction: column; gap: 6px; }
.dtp-nav-row { display: flex; align-items: center; }
.dtp-month { flex: 1; text-align: center; font-weight: 700; font-size: 16px; }
.dtp-nav { background: transparent; color: var(--text); font-size: 22px; width: 36px; height: 36px; padding: 0; border-radius: 50%; }
.dtp-nav:hover:not(:disabled) { background: color-mix(in srgb, var(--brand) 14%, transparent); }
.dtp-nav:disabled { opacity: .3; cursor: default; }
.dtp-card .cal-wd { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); }
.dtp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dtp-day { background: transparent; color: var(--text); width: 36px; height: 36px; justify-self: center; padding: 0; border-radius: 50%; font-size: 14px; }
.dtp-day:hover:not(:disabled):not(.sel) { background: color-mix(in srgb, var(--brand) 14%, transparent); }
.dtp-day.other { color: var(--muted); opacity: .6; }
.dtp-day.sun { color: var(--cal-sun); }
.dtp-day.today { box-shadow: inset 0 0 0 1.5px var(--brand); font-weight: 700; }
.dtp-day.sel { background: var(--brand); color: #fff; font-weight: 700; }
.dtp-day:disabled { opacity: .25; cursor: default; }
.dtp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dtp-chips.times { display: grid; grid-template-columns: repeat(6, 1fr); }
.dtp-chips.times .dtp-chip { padding: 5px 0; }
.dtp-chip { background: color-mix(in srgb, var(--brand) 12%, var(--panel)); color: var(--text); border-radius: 16px; padding: 5px 12px; font-size: 13px; }
.dtp-chip.on { background: var(--brand); color: #fff; }
.dtp-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-top: 4px; }
.dtp-time { display: flex; align-items: center; justify-content: center; gap: 8px; }
.dtp-stepper { display: flex; flex-direction: column; align-items: center; }
.dtp-step { background: transparent; color: var(--brand); padding: 0 16px; font-size: 12px; line-height: 1.3; }
.dtp-step:hover { background: color-mix(in srgb, var(--brand) 12%, transparent); }
.dtp-num { width: 60px; text-align: center; font-size: 24px; font-weight: 700; padding: 2px; border-radius: 10px; }
.dtp-num:focus { outline: 2px solid var(--brand); outline-offset: 0; }
.dtp-colon { font-size: 24px; font-weight: 700; }
.dtp-err { text-align: center; min-height: 1.2em; }
.dtp-buttons { flex: none; display: flex; justify-content: flex-end; gap: 10px; padding: 6px 16px 14px; }
.dtp-buttons button:disabled { opacity: .45; cursor: default; }
/* Controllo contenuti (05/11): scudo nella lista (rosso = avvisi nuovi, grigio = visti), elenco, fumetto bloccato. */
/* Colori dell'app (LinkedContactAdapter.bindGuardIcon): rosso = nuovi, grigio = visti. */
:root { --guard-seen: #9e9e9e; }
:root[data-theme="dark"] { --guard-seen: #bdbdbd; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) { --guard-seen: #bdbdbd; } }
.watch-flag { flex: none; cursor: pointer; padding: 4px; color: var(--guard-seen); display: flex; }
.watch-flag.on, .watch-icon.on, .watch-toggle.on { color: #43a047; }
.watch-flag.out { color: #d32f2f; }
.sub.zone-out { color: #d32f2f; font-weight: 600; }
/* 27/11: bandierina rossa che sventola (contatto fuori zona in fascia); ferma se il sistema chiede meno animazioni */
.watch-flag.out svg { transform-origin: 20% 90%; animation: flag-wave 1.6s ease-in-out infinite; }
@keyframes flag-wave { 0%, 100% { transform: rotate(0deg); } 25% { transform: rotate(-10deg); } 75% { transform: rotate(6deg); } }
@media (prefers-reduced-motion: reduce) { .watch-flag.out svg { animation: none; } }
.watch-flag svg { width: 22px; height: 22px; }
.watch-icon { flex: none; display: flex; color: #9e9e9e; }
.watch-icon svg, .watch-toggle svg { width: 24px; height: 24px; }
.watch-toggle { flex: none; display: flex; padding: 8px; color: #43a047; }
.watch-row.off .texts { opacity: .55; }
.modal-list button.watch-toggle { color: #43a047; }   /* play e pausa verdi (06/11) */
.modal-list button.watch-toggle.on { color: #43a047; }
.zone-btn { flex: none; display: flex; padding: 8px; border-radius: 50%; }
.zone-btn svg { width: 22px; height: 22px; }
.zone-btn.zone-del { color: var(--muted); }
.zone-btn.watch-toggle { color: #43a047; }
.zone-btn.watch-toggle.on { color: #43a047; }
.guard-shield { flex: none; cursor: pointer; padding: 4px; color: var(--guard-seen); display: flex; }
.guard-shield.new { color: #d32f2f; }
.guard-shield svg { width: 22px; height: 22px; }
.guard-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.guard-row .guard-icon { color: #d32f2f; display: flex; }
.guard-row .guard-icon svg { width: 22px; height: 22px; }
.guard-row .guard-text { flex: 1; }
.bubble.blocked { font-style: italic; opacity: .85; }

/* Suggerimenti al passaggio del mouse (06/11): fumetto scuro con freccia al posto del riquadro del browser. */
.tip {
  position: fixed; z-index: 10000; max-width: 260px; padding: 6px 10px; border-radius: 8px;
  background: rgba(33, 34, 38, .96); color: #fff; font-size: 12.5px; line-height: 1.35; font-weight: 500;
  white-space: pre-line; pointer-events: none; box-shadow: 0 4px 14px rgba(0, 0, 0, .22);
  opacity: 0; transform: translateY(3px); transition: opacity .12s ease, transform .12s ease; visibility: hidden;
}
.tip.show { opacity: 1; transform: none; visibility: visible; }
.tip::after {
  content: ''; position: absolute; left: var(--ax, 50%); top: 100%; margin-left: -5px;
  border: 5px solid transparent; border-top-color: rgba(33, 34, 38, .96);
}
.tip.below { transform: translateY(-3px); }
.tip.below.show { transform: none; }
.tip.below::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: rgba(33, 34, 38, .96); }
:root[data-theme="dark"] .tip { background: rgba(236, 236, 236, .97); color: #1b1b1d; }
:root[data-theme="dark"] .tip::after { border-top-color: rgba(236, 236, 236, .97); }
:root[data-theme="dark"] .tip.below::after { border-top-color: transparent; border-bottom-color: rgba(236, 236, 236, .97); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .tip { background: rgba(236, 236, 236, .97); color: #1b1b1d; }
  :root:not([data-theme]) .tip::after { border-top-color: rgba(236, 236, 236, .97); }
  :root:not([data-theme]) .tip.below::after { border-top-color: transparent; border-bottom-color: rgba(236, 236, 236, .97); }
}

/* Esito del controllo d'arrivo in chat (06/11): testo del tema, icona colorata accanto. */
.dest-result { display: inline-flex; align-items: flex-start; gap: 6px; font-weight: 600; }
.dest-result-icon { flex: none; display: flex; margin-top: 1px; }
.dest-result-icon svg { width: 18px; height: 18px; }
.dest-result.missed .dest-result-icon { color: #e53935; }
.dest-result.ok .dest-result-icon { color: #43a047; }
.bubble.dest-card { max-width: 280px; }
.bubble .dest-thumb { display: block; width: 100%; max-width: 260px; aspect-ratio: 220 / 140; object-fit: cover; border-radius: 8px; margin: 2px 0 6px; cursor: pointer; background: var(--line); }
.dest-result.clickable { cursor: pointer; }

/* Note (07/11): tre puntini a destra del nome, azioni in una barra orizzontale sopra la riga. */
.note-row { align-items: center; }
.note-row .texts { flex: 1; min-width: 0; cursor: pointer; }
.note-more, button.note-more { flex: none; display: flex; padding: 6px; border-radius: 50%; color: var(--muted); border: none; background: transparent; box-shadow: none; min-width: 0; }
.note-more:hover { background: var(--line); }
.note-more svg { width: 22px; height: 22px; }
.note-bar { position: fixed; z-index: 60; display: flex; gap: 2px; padding: 6px; border-radius: 16px; background: var(--panel);
  border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0, 0, 0, .18); animation: note-bar-in .12s ease-out; }
@keyframes note-bar-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.note-act { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 58px; padding: 4px 2px; border: none;
  background: transparent; border-radius: 10px; color: var(--muted); cursor: pointer; font: inherit; }
.note-act:hover, .note-act:focus-visible { background: color-mix(in srgb, var(--line) 70%, transparent); outline: none; }
.note-act-icon { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%;
  background: color-mix(in srgb, currentColor 13%, transparent); }
.note-act-icon svg { width: 22px; height: 22px; }
.note-act-label { font-size: 11px; color: var(--muted); white-space: nowrap; }
.pick-row { cursor: pointer; }
.pick-row input { margin-right: 8px; }
.note-transcript { white-space: pre-wrap; line-height: 1.5; margin: 0; }
.note-bar button.note-act { width: 58px; min-width: 0; padding: 4px 2px; margin: 0; flex: none; box-sizing: border-box; box-shadow: none; }
.note-bar .note-act-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.note-bar { max-width: calc(100vw - 16px); }

/* Date negli elenchi (07/11): nel tono delle intestazioni di sezione, scuro sul chiaro e chiaro sullo scuro. */
:root { --list-day: #a65619; }
:root[data-theme="dark"] { --list-day: #f2a062; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) { --list-day: #f2a062; } }

/* Note: due riquadri di altezza fissa, ognuno con il suo scorrimento (07/11). */
#list.notes-split { display: flex; flex-direction: column; overflow: hidden; }
#list.notes-split > .item { flex: none; }
.notes-pane { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.notes-pane > .list-section { flex: none; }
.notes-scroll { flex: 1; min-height: 0; overflow-y: auto; }

/* Nota archiviata (07/11), come archive_note_card dell'app: "carta" chiara o scura (NotePaper). */
:root { --paper: #fff6d6; --paper-line: #f0e2b0; --paper-text: #2b2a26; --paper-sub: rgba(0,0,0,.6); }
:root[data-theme="dark"] { --paper: #5a5444; --paper-line: #6e6754; --paper-text: #f5f1e6; --paper-sub: rgba(245,241,230,.7); }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) { --paper: #5a5444; --paper-line: #6e6754; --paper-text: #f5f1e6; --paper-sub: rgba(245,241,230,.7); } }
.note-card { align-self: stretch; margin: 6px 4px; padding: 14px; border-radius: 14px; background: var(--paper);
  border: 1px solid var(--paper-line); color: var(--paper-text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.note-card-title { font-weight: 700; font-size: 16px; }
.note-card-body { margin-top: 6px; line-height: 1.45; white-space: pre-wrap; font-size: 15px; }
.note-card .vocal { margin-top: 6px; }
.note-card-foot { margin-top: 8px; text-align: right; font-size: 12px; color: var(--paper-sub); }
.note-card.editable { cursor: pointer; }
.note-card.editable:hover { box-shadow: 0 2px 8px rgba(0,0,0,.14); }
.note-edit .notebody { min-height: 220px; }
.modal-card .note-edit { min-width: min(520px, 80vw); }
.note-card-head { display: flex; align-items: flex-start; gap: 8px; }
.note-card-head .note-card-title { flex: 1; min-width: 0; }
button.note-card-del { flex: none; display: flex; padding: 4px; margin: -4px -4px 0 0; border: none; border-radius: 50%; background: transparent; color: #e53935; opacity: .75; }
button.note-card-del:hover { opacity: 1; background: color-mix(in srgb, #e53935 12%, transparent); }
button.note-card-del svg { width: 20px; height: 20px; }
.note-page { padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--chat-bg); flex: 1; }
.note-page .note-card { margin: 0; }

/* Iconcina del gruppo accanto al nome nell'elenco delle chat (10/11). */
.grp-mark { margin-left: 6px; font-size: .85em; opacity: .7; }
/* Ricerca e filtri dell'elenco delle chat (10/11), come nella home dell'app. */
.chat-bar { padding: 6px 10px 4px; border-bottom: 1px solid var(--line); }
.chat-search { width: 100%; box-sizing: border-box; margin-bottom: 6px; }
.chat-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 4px 12px; font-size: 13px; cursor: pointer; }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.unread-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-left: 6px; }
.empty-note { padding: 14px; }

/* Messaggio urgente al centro (10/11/2026) e sua impostazione per chat */
.urgent-card { max-width: 460px; }
.urgent-row { display: flex; width: fit-content; align-items: center; justify-content: flex-start; gap: 12px; padding: 6px 8px 6px 4px; margin: 2px 0; cursor: pointer; border-radius: 8px; }
.urgent-row:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.urgent-row input[type=checkbox] { width: 20px; height: 20px; flex: none; margin: 0; padding: 0; accent-color: var(--brand); cursor: pointer; }
.urgent-row .urgency-name { white-space: nowrap; }
.urgent-card .urgency-name { display: inline-block; margin-top: 4px; }
.urgent-sender { font-weight: 700; color: var(--muted); margin-top: 10px; }
.urgent-text { font-size: 18px; margin: 10px 0 16px; white-space: pre-wrap; max-height: 40vh; overflow-y: auto; overflow-wrap: anywhere; }
.urgent-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; }
.urgent-row .urgency-name { min-width: 64px; text-align: center; }
.bubble.clickable { cursor: pointer; }

/* Luoghi salvati (10/11/2026) */
.place-panel { max-height: 40vh; overflow-y: auto; }
.place-head { font-weight: 700; font-size: 17px; margin-bottom: 8px; }
.place-pin { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.place-dot { width: 14px; height: 14px; border-radius: 50%; background: #5E35B1; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.place-name { font-weight: 700; color: #5E35B1; background: #fff; border-radius: 8px; padding: 1px 6px; box-shadow: 0 1px 3px rgba(0,0,0,.25); white-space: nowrap; }
a.button { display: inline-block; text-decoration: none; border-radius: 8px; padding: 8px 14px; background: var(--brand); color: #fff; }
.modal .error { color: #c62828; }

/* Bacheca del gruppo (11/11) */
.hub-tabs { display: flex; gap: 6px; padding: 6px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.hub-tabs button { flex: 1; max-width: 220px; border-radius: 18px; padding: 6px 14px; background: transparent; color: var(--text); border: 1px solid var(--line); }
.hub-tabs button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.hub-page, .hub-feed { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.hub-card { position: relative; border: 1px solid var(--line); border-radius: 16px; padding: 12px; min-height: 110px; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; }
.hub-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.hub-emoji { font-size: 30px; }
.hub-card-title { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.hub-card-edit { position: absolute; top: 6px; right: 6px; padding: 0 10px; font-size: 20px; line-height: 30px; border: 0; background: color-mix(in srgb, var(--panel) 70%, transparent); border-radius: 15px; }
.hub-add { align-items: center; justify-content: center; color: var(--brand); border: 2px dashed var(--brand); font-weight: 600; }
.hub-page p, .hub-feed p { margin: 0; }
.hub-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.hub-post { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 6px;
  max-width: 760px; width: 100%; align-self: center; box-sizing: border-box; }
.hub-post-head { display: flex; align-items: center; gap: 8px; }
.hub-post-head > span { flex: 1; }
.hub-more { padding: 0 10px; font-size: 18px; border: 0; }
.hub-post-title { font-weight: 700; font-size: 17px; }
.hub-post-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.hub-pill-pending { background: #f9a825; color: #000; align-self: flex-start; margin-left: 0; }
.hub-post .pill { align-self: flex-start; margin-left: 0; }
.hub-event-when { color: var(--brand); font-weight: 600; }
.hub-link { color: var(--brand); text-decoration: none; overflow-wrap: anywhere; }
.hub-link:hover { text-decoration: underline; }
.hub-inline { align-self: flex-start; font-weight: 600; }
.hub-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.hub-check input { width: auto; margin: 0; accent-color: var(--brand); }
.hub-check.done > span:first-of-type { text-decoration: line-through; color: var(--muted); }
.hub-option { padding: 4px 0; }
.hub-option.clickable { cursor: pointer; }
.hub-option.mine .hub-option-row span:first-child { font-weight: 700; }
.hub-option-row { display: flex; justify-content: space-between; gap: 8px; }
.hub-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 3px; }
.hub-bar-fill { height: 100%; background: var(--brand); }
.hub-read.done { color: #43a047; font-weight: 600; }
/* Una sola foto (11/11): quadrata con angoli arrotondati, come una casella del mosaico; il clic la ingrandisce. */
.hub-single { width: min(278px, 45vw); aspect-ratio: 1; object-fit: cover; border-radius: 8px; cursor: pointer; align-self: flex-start; }
.hub-mosaic { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; max-width: 560px; }
.hub-tile { position: relative; aspect-ratio: 1; cursor: pointer; overflow: hidden; border-radius: 8px; }
.hub-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hub-more-n { position: absolute; inset: 0; background: rgba(0,0,0,.5); color: #fff; font-size: 28px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; }
.hub-comment { font-size: 14px; overflow-wrap: anywhere; }
.hub-comment-row { display: flex; gap: 6px; margin-top: 4px; }
.hub-comment-row input { flex: 1; min-width: 0; }
.hub-form textarea { resize: vertical; }
.hub-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.hub-picker button { flex: none; border-radius: 18px; padding: 5px 10px; }
.hub-picker button.selected { background: var(--brand); color: #fff; border-color: var(--brand); }
.hub-picker .hub-swatch { width: 32px; height: 32px; padding: 0; border-radius: 50%; border: 3px solid transparent; }
.hub-picker .hub-swatch.selected { border-color: var(--text); }
.hub-kinds { display: flex; flex-direction: column; gap: 8px; }
/* Tipi di sezione (12/11): emoji, nome e una riga che dice cosa si pubblica. */
.hub-stypes { display: flex; flex-direction: column; gap: 6px; }
.hub-stype { display: flex; align-items: center; gap: 10px; text-align: left; background: transparent; color: inherit;
  border: 1px solid rgba(136,136,136,.25); border-radius: 12px; padding: 8px 10px; font-weight: normal; width: 100%; }
.hub-stype.selected { border: 2px solid var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); }
.hub-stype-e { font-size: 22px; }
.hub-stype-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hub-file-btn { display: inline-block; align-self: flex-start; cursor: pointer; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); }
.hub-file-btn input[type=file] { display: none; }
.hub-day { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.hub-day-title { font-weight: 700; }
.hub-places { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.hub-album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px; }
.hub-album-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; cursor: pointer; display: block; }
.hub-viewer { position: relative; display: flex; align-items: center; justify-content: center; }
.hub-viewer-img { max-width: 88vw; max-height: 86vh; object-fit: contain; }
#lightbox img.hub-viewer-img { max-width: none; max-height: none; }
.hub-nav { position: fixed; top: 50%; transform: translateY(-50%); font-size: 34px; background: rgba(0,0,0,.45); color: #fff; padding: 6px 16px; border-radius: 30px; }
.hub-nav.prev { left: 12px; }
.hub-nav.next { right: 12px; }
.hub-viewer-cap { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 14px;
  background: rgba(0,0,0,.45); padding: 4px 12px; border-radius: 14px; white-space: nowrap; max-width: 90vw; overflow: hidden; text-overflow: ellipsis; }
.hub-viewer-save { position: fixed; top: 14px; right: 14px; background: rgba(0,0,0,.45); color: #fff; font-size: 20px; border-radius: 20px; }
@media (max-width: 720px) {
  .hub-grid { grid-template-columns: 1fr 1fr; }
  .hub-tabs button { max-width: none; }
}

.hub-map { height: 360px; border-radius: 12px; overflow: hidden; }
.modal-card:has(.hub-map) { max-width: 640px; }
button.link.hub-link { font-weight: 500; text-align: left; }
.hub-cap-place { background: none; color: #ffcc80; padding: 0; font-size: 14px; text-decoration: underline; }
.hub-viewer-cap { cursor: default; }
input.invalid, textarea.invalid { border-color: #d32f2f !important; box-shadow: 0 0 0 1px #d32f2f; }
input.invalid::placeholder, textarea.invalid::placeholder { color: #d32f2f; opacity: 1; }

/* Amici (11/11) */
.hub-rsvp { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.hub-rsvp button { flex: 1; min-width: 90px; border-radius: 18px; padding: 6px 10px; }
.hub-sub-title { font-weight: 700; font-size: 14px; margin-top: 8px; }
.hub-bring-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 0; }
.hub-mine { color: #43a047; font-weight: 600; }
.hub-date-opt { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.hub-date-opt.clickable { cursor: pointer; }
.hub-date-opt.best .hub-date-label { font-weight: 700; }
.hub-date-label { flex: 1; }
.hub-dates-edit { display: flex; flex-direction: column; gap: 4px; }
.hub-date-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hub-date-row button { padding: 2px 10px; }
.hub-add-date { align-self: flex-start; }
.hub-cash-total { font-weight: 700; color: var(--brand); font-size: 16px; }
.hub-cash-line { font-size: 14px; }
.hub-emoji-picker { display: flex; flex-direction: column; gap: 4px; }
.hub-emoji-cat { font-size: 12px; color: var(--muted); margin-top: 4px; }
.hub-emoji-picker .hub-picker button { font-size: 18px; padding: 3px 8px; }
/* Scuola (11/11) */
.hub-brand { color: var(--brand); }
.hub-feedback { font-size: 14px; padding: 4px 8px; border-left: 3px solid var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); border-radius: 4px; }

/* Iconcina del tipo di file nella Bacheca (11/11): foglio colorato con la sigla e l'angolo piegato. */
.hub-fname { display: inline-flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.hub-ficon { flex: none; display: inline-flex; align-items: flex-end; justify-content: center; width: 20px; height: 25px;
  padding-bottom: 4px; box-sizing: border-box; border-radius: 3px; color: #fff; font: 700 7px/1 system-ui, sans-serif;
  letter-spacing: .2px; clip-path: polygon(0 0, 70% 0, 100% 24%, 100% 100%, 0 100%); }
.hub-ficon.big { width: 28px; height: 35px; font-size: 9.5px; padding-bottom: 6px; }

/* Chi ha votato (sondaggi, solo amministratori, 11/11): iconcine dei contatti, sovrapposte se non ci stanno. */
.hub-option-row .hub-option-text { flex: 1; min-width: 0; }
.hub-voters { display: inline-flex; align-items: center; margin: 0 10px; flex: none; }
.avatar.hub-voter { width: 26px; height: 26px; font-size: 10px; position: relative; box-shadow: 0 0 0 1.5px var(--panel); }
.avatar.hub-voter.more { background: #757575; }
.hub-poll-q { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.hub-voters { cursor: pointer; }
.hub-voter-one { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px 0; }
.avatar.hub-voter-big { width: 88px; height: 88px; font-size: 32px; }
.hub-voter-name { font-size: 18px; font-weight: 700; }
.hub-voter-list { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; min-width: 260px; }

/* Evento (11/11): scheda appena diversa dallo sfondo della pagina, con le finestre Contenuto, Allegati, Commenti. */
.hub-post.hub-event-card { background: color-mix(in srgb, var(--bg) 88%, var(--brand) 12%); }
/* Tema scuro (11/11): la scheda un po' più chiara della pagina, così si distingue. */
:root[data-theme="dark"] .hub-post.hub-event-card { background: color-mix(in srgb, color-mix(in srgb, var(--bg) 84%, #ffffff 16%) 82%, var(--brand) 18%); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hub-post.hub-event-card { background: color-mix(in srgb, color-mix(in srgb, var(--bg) 84%, #ffffff 16%) 82%, var(--brand) 18%); }
}
.hub-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px 10px;
  display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.hub-panel-title { font-size: 13px; font-weight: 700; color: var(--muted); }

/* Avvisi in anticipo del promemoria (11/11). */
.early-box { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.early-opt { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.early-opt input { width: 18px; height: 18px; accent-color: var(--brand); }
/* 21/11: «Ripeti» */
.rep-panel { display: flex; flex-direction: column; gap: 4px; margin: 2px 0 4px 26px; }
.rep-panel[hidden] { display: none; }
.early-opt input.rep-count { width: 64px; height: auto; padding: 4px 6px; text-align: center; accent-color: auto; }
.rep-until { padding: 2px 4px; }
.confirm-buttons.wrap { flex-wrap: wrap; }

/* G4 scuola (11/11): verifica, quiz, prossimi impegni, riepilogo. */
.hub-exam-chip { align-self: flex-start; margin-left: 0; background: #e53935; color: #fff; }
.hub-exam-chip.oral { background: #3949ab; }
.hub-right { color: #2e7d32; font-weight: 700; }
.hub-wrong { color: #d32f2f; font-weight: 700; }
.hub-bar.right .hub-bar-fill { background: #43a047; }
.hub-quiz-picks { display: flex; flex-direction: column; gap: 6px; }
.hub-quiz-picks button { text-align: left; border-radius: 18px; }
.hub-upcoming { background: color-mix(in srgb, var(--panel) 85%, #7e57c2 15%); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.hub-week { display: flex; flex-direction: column; gap: 4px; min-width: 280px; max-height: 60vh; overflow-y: auto; }
.hub-week-row { padding: 6px 4px; border-radius: 8px; cursor: pointer; }
.hub-week-row:hover { background: color-mix(in srgb, var(--brand) 12%, transparent); }
.hub-flash { animation: hubflash 1.6s ease-out 1; }
@keyframes hubflash { 0% { box-shadow: 0 0 0 3px var(--brand); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* Consegne dei compiti (12/11) */
.hub-subs-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hub-subs-open { border-radius: 16px; padding: 6px 12px; font-size: 14px; }
.hub-sub-todo .avatar { opacity: .6; }
.hub-sub-go { color: var(--brand); font-size: 22px; font-weight: bold; }
.item.row.clickable { cursor: pointer; }
/* 12/11: anche negli allegati della chat e nei file scelti del modulo i nomi lunghi vanno a capo. */
.att > div { min-width: 0; overflow-wrap: anywhere; }
.hub-fname { min-width: 0; overflow-wrap: anywhere; }

/* Colloqui (12/11): chi ha prenotato con la videocamera, e il turno in corso in evidenza. */
.hub-slot-who { display: flex; align-items: center; gap: 10px; padding: 0 0 6px 8px; }
.hub-slot-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.hub-slot-x { color: var(--muted); font-size: 16px; }
.hub-video { width: 36px; height: 36px; border-radius: 50%; padding: 0; font-size: 17px; background: rgba(136,136,136,.2); opacity: .45; border: none; }
.hub-video.on { background: #43A047; opacity: 1; }
.hub-video.big { width: 44px; height: 44px; font-size: 20px; }
.hub-slot-now { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0 4px;
  padding: 8px 8px 8px 12px; border-radius: 12px; border: 1px solid #43A047; background: rgba(67,160,71,.13); }

/* Chiamate nel browser (12/11) */
.call-win { position: fixed; inset: 0; z-index: 3000; background: #111; color: #fff; display: flex; flex-direction: column;
  align-items: center; justify-content: center; }
.call-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; display: none; }
.call-win.video .call-remote { display: block; }
/* 01/12: schermo condiviso del contatto: clic = "tocca qui" */
.call-screen-hint { display: none; margin-top: 8px; padding: 6px 12px; border-radius: 14px; background: rgba(0,0,0,.6); font-size: 13px; }
.call-win.screen .call-screen-hint { display: inline-block; }
.call-win.screen .call-remote { cursor: crosshair; }
.call-point { position: absolute; width: 36px; height: 36px; margin: -18px 0 0 -18px; border: 4px solid #ffc107; border-radius: 50%;
  background: rgba(255,193,7,.3); pointer-events: none; animation: cg-point 1.5s ease-out forwards; z-index: 2; }
@keyframes cg-point { from { transform: scale(.6); opacity: 1; } to { transform: scale(2); opacity: 0; } }
.call-face { display: flex; flex-direction: column; align-items: center; gap: 12px; z-index: 1; }
.call-face .avatar { width: 112px; height: 112px; font-size: 40px; }
.call-win.video .call-face { display: none; }
.call-name { font-size: 22px; font-weight: 600; }
.call-top { position: absolute; top: 24px; left: 0; right: 0; text-align: center; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.call-status { font-size: 16px; background: rgba(0,0,0,.35); padding: 4px 12px; border-radius: 14px; }
.call-note { font-size: 13px; background: rgba(0,0,0,.35); padding: 3px 10px; border-radius: 12px; opacity: .9; }
.call-local { position: absolute; right: 16px; bottom: 110px; width: min(28vw, 220px); aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: 12px; border: 2px solid rgba(255,255,255,.6); background: #222; z-index: 2; transform: scaleX(-1); }
.call-bar { position: absolute; bottom: 28px; left: 0; right: 0; display: flex; justify-content: center; gap: 22px; z-index: 2; }
.call-btn { width: 58px; height: 58px; border-radius: 50%; border: none; font-size: 24px; padding: 0; background: rgba(255,255,255,.18); color: #fff; cursor: pointer; }
.call-btn.off { background: rgba(255,255,255,.55); filter: grayscale(1); }
.call-btn.decline { background: #E53935; }
.call-btn.answer { background: #43A047; }
.call-in { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 3100; display: flex; align-items: center; gap: 12px;
  background: var(--panel, #fff); color: var(--text); padding: 10px 12px 10px 16px; border-radius: 16px; box-shadow: 0 6px 24px rgba(0,0,0,.3);
  max-width: calc(100vw - 32px); }
.call-in .call-btn { width: 46px; height: 46px; font-size: 20px; color: #fff; }
.call-in-text { display: flex; flex-direction: column; min-width: 0; margin-right: 6px; }
.call-in-text b { overflow-wrap: anywhere; }

/* Pulsanti Chiama e Videochiamata nella barra della chat (12/11): cerchio colorato, icona bianca. */
.toolbar .call-tool { width: 38px; height: 38px; border-radius: 50%; border: none; padding: 0; display: inline-flex;
  align-items: center; justify-content: center; color: #fff; cursor: pointer; flex-shrink: 0; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toolbar .call-tool svg { width: 20px; height: 20px; }
.toolbar .call-tool.voice { background: #43A047; }
.toolbar .call-tool.video { background: #1E88E5; }
.toolbar .call-tool:hover { filter: brightness(1.1); }
.call-btn svg { width: 22px; height: 22px; vertical-align: middle; }
.call-btn.answer.video { background: #1E88E5; }

/* Navigazione protetta (12/11) */
.modal.safe-modal .modal-card { width: min(960px, calc(100vw - 32px)); max-width: none; }
.safe-video { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; overflow: hidden; }
.safe-frame { width: 100%; height: 100%; border: 0; display: block; }
.safe-frame.reader { height: min(70vh, 720px); border-radius: 10px; background: #fff; }
.safe-cover { position: absolute; inset: 0; background: #000; color: #fff; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 16px; font-size: 18px; }
.safe-cover.hidden { display: none; }
.safe-cover button { font-size: 16px; padding: 10px 24px; border-radius: 22px; }

.hub-ok { color: #2E7D32; }

/* Lettura nel browser (12/11): solo testo, immagini e riquadri dei video dell'articolo. */
.safe-reader { max-height: min(70vh, 760px); overflow: auto; padding: 18px 22px 30px; border-radius: 10px; background: #fbfaf7; color: #222;
  font: 18px/1.6 Georgia, serif; }
.safe-reader h1 { font: 700 24px/1.3 sans-serif; margin: 0 0 6px; }
.safe-reader .s { color: #888; font: 13px sans-serif; margin-bottom: 18px; }
.safe-reader img, .safe-reader video, .safe-reader figure { max-width: 100%; height: auto; }
.safe-reader figure { margin: 16px 0; }
.safe-reader figcaption { font: 13px sans-serif; color: #777; }
.safe-reader .cg-video { display: block; position: relative; width: 100%; margin: 16px 0; padding: 0; min-height: 140px; border: 0;
  border-radius: 10px; overflow: hidden; background: #000; cursor: pointer; }
.safe-reader .cg-video img { display: block; width: 100%; opacity: .75; }
.safe-reader .cg-video span { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,.65);
  color: #fff; font: 600 17px sans-serif; padding: 10px 20px; border-radius: 24px; }
@media (prefers-color-scheme: dark) { .safe-reader { background: #121212; color: #e8e8e8; } }
video.safe-frame { background: #000; }

.safe-reader .cg-missing { font: 14px sans-serif; background: #fff4d6; color: #5d4500; border-radius: 8px; padding: 8px 12px; }
@media (prefers-color-scheme: dark) { .safe-reader .cg-missing { background: #3a2f12; color: #f3d98b; } }

/* Tipo del gruppo nel modulo Nuovo gruppo (12/11) */
.group-types { display: flex; flex-wrap: wrap; gap: 8px; }
.group-type { background: transparent; color: inherit; border: 1px solid var(--line); border-radius: 18px; padding: 7px 14px; font-weight: normal; }
.group-type.selected { background: var(--brand); border-color: var(--brand); color: #fff; }
.group-type-hint { margin-bottom: 6px; }

/* Attività e giochi (13/11) */
.hub-edu-row { justify-content: flex-start; margin-top: 6px; }
.edu-frame { width: 100%; height: min(78vh, 760px); border: 0; border-radius: 10px; background: var(--bg); display: block; }

/* 13/11: galleria dei giochi e editor dei contenuti */
.edu-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.edu-tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; padding: 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; min-height: 150px; }
/* 18/11: modi di gioco in alto a destra (👤 da soli, 👥 in gruppo) */
.edu-tile .game-modes { position: absolute; top: 10px; right: 12px; display: flex; gap: 4px; }
.game-cat-row .game-modes-row { margin: 0 8px; display: flex; gap: 4px; white-space: nowrap; }
.mode-ic { width: 20px; height: 20px; flex: 0 0 20px; }
.game-legend { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.game-legend span { margin-right: 10px; }
.edu-tile:hover { border-color: var(--brand); }
.edu-tile.faded { opacity: .55; }
.edu-tile .edu-emo { font-size: 30px; }
.edu-tile .edu-count { color: var(--brand); font-weight: 600; font-size: 12px; margin-top: auto; }
.edu-tile .edu-best { color: #2e7d32; font-size: 12px; }
.modal-card:has(.edu-editor), .modal-card:has(.edu-contents) { max-width: 600px; }
.edu-contents { display: flex; flex-direction: column; gap: 4px; max-height: 60vh; overflow: auto; }
.edu-content { padding: 8px 4px; border-bottom: 1px solid var(--line); }
.edu-content.clickable { cursor: pointer; }
.edu-content.clickable:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.edu-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.edu-acts button { padding: 4px 10px; font-size: 13px; }
.edu-editor { max-height: 60vh; overflow: auto; padding-right: 4px; }
.edu-meta { display: flex; gap: 8px; }
.edu-meta input:first-child { flex: 1.4; }
.edu-meta input:last-child { flex: 1; }
.edu-modes, .edu-games { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-start; }
.edu-rows { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.edu-row { display: flex; gap: 6px; align-items: center; }
.edu-row input { flex: 1; min-width: 0; }
.edu-row button { padding: 6px 8px; flex: none; }
.edu-tools { display: flex; gap: 8px; margin-top: 8px; }
.edu-paste textarea { width: 100%; box-sizing: border-box; }
.edu-err { color: #d32f2f; min-height: 1em; }

/* 13/11: Giochi v2 */
.game-challenge { margin-bottom: 10px; }
.game-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.game-list { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 10px; }
.game-rank { min-width: 32px; font-weight: 700; font-size: 18px; }
.modal-card:has(.game-catalog) { max-width: 600px; }
.game-catalog { display: flex; flex-direction: column; gap: 4px; max-height: 60vh; overflow: auto; }
.game-cat-row { display: flex; align-items: center; gap: 10px; text-align: left; background: transparent; color: var(--text); border: 1px solid transparent; border-radius: 12px; padding: 8px; cursor: pointer; }
.game-cat-row.on { background: color-mix(in srgb, var(--brand) 14%, transparent); border-color: var(--brand); }
.game-cat-row .texts { display: flex; flex-direction: column; flex: 1; }
.game-cat-row .edu-emo { font-size: 26px; }

/* 13/11: finestra del gioco a tutta altezza (niente scorrimento dentro i giochi) */
.modal.game-modal .modal-card { width: min(960px, calc(100vw - 24px)); max-width: none; height: calc(100vh - 24px); max-height: none; padding: 8px; display: flex; flex-direction: column; }
.modal.game-modal .modal-card > h2, .modal.game-modal .modal-card > .row-buttons { display: none; }
.modal.game-modal .edu-frame { flex: 1; height: auto; min-height: 0; }

.modal.game-modal .game-bar { display: flex; justify-content: flex-end; margin: -2px 0 4px; }
.modal.game-modal .game-close { font-size: 18px; padding: 2px 12px; line-height: 1.4; }
.modal.game-modal .modal-card { position: relative; }
.modal.game-modal .game-bar { gap: 4px; }
.modal.game-modal .game-resize { position: absolute; right: 0; bottom: 0; width: 22px; height: 22px; cursor: nwse-resize; touch-action: none; z-index: 2;
  background: linear-gradient(135deg, transparent 50%, var(--muted, #888) 50%, var(--muted, #888) 58%, transparent 58%, transparent 70%, var(--muted, #888) 70%, var(--muted, #888) 78%, transparent 78%);
  border-bottom-right-radius: 12px; opacity: .7; }
.modal.game-modal .game-resize:hover { opacity: 1; }
.modal.game-modal .modal-card.game-fs { width: 100vw !important; height: 100vh !important; border-radius: 0; padding: 6px; transform: none !important; }
.modal.game-modal .game-bar { touch-action: none; user-select: none; min-height: 34px; align-items: center; }
.modal.game-modal .modal-card.game-fs .game-resize { display: none; }

.game-live { border: 2px solid #e53935 !important; }
.game-result { padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }

/* 21/11: risposte e voci una per casella (sondaggi, quiz, liste) */
.line-list { display: flex; flex-direction: column; gap: 4px; }
.line-rows { display: flex; flex-direction: column; gap: 6px; }
.line-row { display: flex; align-items: center; gap: 6px; }
.line-row .line-n { min-width: 22px; font-weight: 700; opacity: .7; text-align: right; }
.line-row input { flex: 1; min-width: 0; }
.line-row .line-del { padding: 4px 10px; }
.line-add { align-self: flex-start; font-weight: 600; padding: 6px 2px; }

/* 21/11 (richiesta dell'utente): Elimina accanto a Salva nelle note di testo e vocali, pieno grigio-blu (non rosso) */
button.del-soft { background: #607D8B; color: #fff; }
button.del-soft:hover { background: #546E7A; }

/* ---- Sicurezza e condivisione, pagina unica e gruppo (24/11) ---- */
.toolbar-pair { display: contents; }
/* Due colonne indipendenti (niente vuoti sotto le schede basse); sotto 800 px una colonna, in ordine naturale. */
.sg-page { padding: 14px; overflow-y: auto; container-type: inline-size; }
.sg-flow { display: flex; gap: 14px; align-items: flex-start; }
.sg-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
@container (max-width: 800px) {
  .sg-flow { flex-direction: column; align-items: stretch; }
  .sg-col { display: contents; }
}
.sg-sub { font-weight: 700; font-size: 14px; margin: 14px 0 2px; }
.sg-consent-note { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.sg-card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); min-width: 0; }
.sg-title { font-weight: 700; font-size: 16px; margin-bottom: 10px; }
.sg-head { display: flex; align-items: center; gap: 14px; }
.sg-avatar { position: relative; flex: none; }
.sg-avatar .avatar { width: 58px; height: 58px; font-size: 22px; }
.sg-avatar.sm .avatar { width: 44px; height: 44px; font-size: 16px; }
.sg-pres { position: absolute; right: -2px; bottom: -2px; width: 20px; height: 20px; border-radius: 50%; background: var(--panel); display: flex; align-items: center; justify-content: center; }
.sg-pres .cg-ic { width: 17px; height: 17px; }
.sg-avatar.sm .sg-pres { width: 16px; height: 16px; } .sg-avatar.sm .sg-pres .cg-ic { width: 13px; height: 13px; }
.sg-name { font-weight: 700; font-size: 20px; }
.sg-head-place { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.sg-place { font-weight: 700; }
.sg-ic-slot { flex: none; display: inline-flex; width: 30px; height: 30px; }
.sg-ic-slot.sm { width: 20px; height: 20px; }
.cg-ic { display: inline-flex; width: 100%; height: 100%; flex: none; }
.sg-btn .cg-ic, .sg-empty-in .cg-ic, .sg-zone .cg-ic, .sg-usage-top .cg-ic { width: 26px; height: 26px; }
.sg-btn .cg-ic { width: 18px; height: 18px; margin-right: 6px; vertical-align: -3px; }
.cg { width: 100%; height: 100%; overflow: visible; }
.sg-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.sg-tile { background: color-mix(in srgb, var(--text) 5%, var(--panel)); border-radius: 14px; padding: 10px 12px; min-height: 64px; }
.sg-tile-top { display: flex; align-items: center; gap: 10px; }
.sg-label { font-size: 12px; color: var(--muted); }
.sg-value { font-weight: 700; }
.sg-note { margin-top: 4px; color: var(--muted); }
.sg-tiles.stale .sg-tile { opacity: .45; }
.sg-card .req-note { margin-top: 8px; }
.sg-map { height: 220px; border-radius: 14px; overflow: hidden; margin-bottom: 6px; }
.sg-empty, .sg-empty-in { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.sg-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.sg-btn { flex: 1 1 120px; padding: 9px 12px; border-radius: 20px; font-weight: 600; background: color-mix(in srgb, var(--brand) 15%, var(--panel)); }
.sg-zones { margin-top: 6px; }
.sg-zone { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.sg-usage-top { display: flex; align-items: center; gap: 10px; }
.sg-big { font-size: 22px; font-weight: 700; }
.sg-bar { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--text) 10%, var(--panel)); overflow: hidden; margin: 8px 0; }
.sg-bar.thin { height: 5px; margin: 4px 0 0; }
.sg-bar > div { height: 100%; border-radius: inherit; }
.sg-app { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.sg-app-top { display: flex; gap: 8px; }
.sg-consent { display: flex; align-items: center; gap: 12px; font-weight: 600; cursor: pointer; }
.sg-switch { width: 42px; height: 24px; accent-color: var(--brand); flex: none; }
.sg-member { border-top: 1px solid var(--line); }
.sg-member:first-child { border-top: 0; }
.sg-member.dim .sg-mrow > .grow { opacity: .6; }
.sg-mrow { display: flex; align-items: center; gap: 12px; padding: 8px 0; cursor: pointer; }
.sg-mname { font-weight: 600; }
.sg-mline { display: flex; align-items: center; gap: 4px; font-weight: 600; }
.sg-mright { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.sg-mright .sg-ic-slot { width: 22px; height: 22px; }
.sg-mdetail { padding: 0 0 12px 56px; }

/* icone animate: una tantum all'ingresso, continue solo dove servono */
.cg * { transform-box: view-box; }
.cg-grow { transform-origin: 4px 12px; animation: cg-grow .6s ease-out both; }
.cg-blink { animation: cg-grow .6s ease-out both, cg-blink 1.6s ease-in-out .6s infinite; }
.cg-pulse { animation: cg-blink 1.4s ease-in-out infinite; }
.cg-pop { transform-origin: 12px 12px; animation: cg-pop .45s cubic-bezier(.3,1.6,.6,1) both; }
.cg-ping { transform-origin: 12px 12px; animation: cg-ping .7s ease-out .15s both; }
.cg-ping2 { transform-origin: 12px 12px; animation: cg-ping2 1.3s ease-out both; }
.cg-spin { transform-origin: 12px 12px; animation: cg-spin 1.5s linear infinite; }
.cg-draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: cg-draw .55s ease-out .1s forwards; }
.cg-swing { transform-origin: 12px 3px; animation: cg-swing .9s ease-out both; }
.cg-jit { animation: cg-jit .6s ease-out both; }
.cg-seq1, .cg-seq2, .cg-seq3 { animation: cg-fade .3s ease-out both; }
.cg-seq1 { animation-delay: .12s; } .cg-seq2 { animation-delay: .32s; } .cg-seq3 { animation-delay: .52s; }
.cg-bar1, .cg-bar2, .cg-bar3, .cg-bar4 { animation: cg-bar .35s ease-out both; }
.cg-bar2 { animation-delay: .1s; } .cg-bar3 { animation-delay: .2s; } .cg-bar4 { animation-delay: .3s; }
rect.cg-bar1.cg-blink { animation: cg-bar .35s ease-out both, cg-blink 1.2s ease-in-out .4s infinite; }
.cg-slide { animation: cg-slide .55s ease-out both; }
.cg-fly { animation: cg-fly .65s ease-out both; }
.cg-drop { animation: cg-drop .7s cubic-bezier(.3,1.5,.6,1) both; }
.cg-shrink { transform-origin: 12px 13.5px; animation: cg-shrink .7s ease-out both; }
.cg-exit { animation: cg-exit .8s ease-out both; }
.cg-shake { transform-origin: 12px 13px; animation: cg-shake .8s ease-out both; }
@keyframes cg-grow { from { transform: scaleX(0); } }
@keyframes cg-blink { 50% { opacity: .4; } }
@keyframes cg-pop { from { transform: scale(0); } }
@keyframes cg-ping { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(1.7); } }
@keyframes cg-ping2 { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0; transform: scale(2); } 51% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(2); } }
@keyframes cg-spin { to { transform: rotate(360deg); } }
@keyframes cg-draw { to { stroke-dashoffset: 0; } }
@keyframes cg-swing { 15% { transform: rotate(18deg); } 35% { transform: rotate(-14deg); } 55% { transform: rotate(9deg); } 75% { transform: rotate(-4deg); } }
@keyframes cg-jit { 20% { transform: translateX(1.3px); } 40% { transform: translateX(-1.1px); } 60% { transform: translateX(.8px); } 80% { transform: translateX(-.4px); } }
@keyframes cg-fade { from { opacity: 0; } }
@keyframes cg-bar { from { transform: scaleY(.15); } }
@keyframes cg-slide { from { transform: translateX(-5px); opacity: .3; } }
@keyframes cg-fly { from { transform: translate(-6px, 6px); opacity: .25; } }
@keyframes cg-drop { from { transform: translateY(-4px); } }
@keyframes cg-shrink { from { transform: scale(1.3); opacity: .4; } }
@keyframes cg-exit { from { transform: translateX(-9.5px); } }
@keyframes cg-shake { 15% { transform: translateX(1.6px); } 30% { transform: translateX(-1.4px); } 45% { transform: translateX(1px); } 60% { transform: translateX(-.6px); } }
@media (prefers-reduced-motion: reduce) { .cg * { animation: none !important; stroke-dashoffset: 0 !important; } }
.sg-ic-slot.sm:empty { display: none; }

.lim-info { align-self: flex-start; }
.lim-info-body { overflow-y: auto; min-height: 0; flex: 1; padding-right: 4px; }   /* scorre dentro la finestra (24/11) */
.lim-info-body p { margin: 0 0 10px; line-height: 1.45; }

/* Navigazione protetta (25/11/2026). Colori con classi: la CSP della pagina non ammette stili in linea. */
.wg-red { color: #D32F2F; }
.wg-green { color: #43A047; }
.wg-orange { color: #FB8C00; }
.wg-muted { color: var(--muted); }
.wg-gap { margin-top: 6px; }
.wg-site { font-weight: 600; overflow-wrap: anywhere; }
.wg-check { display: flex; align-items: center; gap: 12px; padding: 6px 0; cursor: pointer; }
.wg-check > .grow { flex: 1; min-width: 0; }
.wg-check input[type=checkbox] { width: 22px; height: 22px; flex: none; margin: 0; padding: 0; accent-color: var(--brand); }
.wg-visit { align-items: flex-start; }
.form .usage-row input[type=time] { width: auto; }
button.ghost.wg-red, .ghost.wg-red { color: #D32F2F; border-color: color-mix(in srgb, #D32F2F 40%, transparent); }
.chip.sg-btn.wg-off { color: #D32F2F; border-color: #D32F2F; }
/* Rapporto della settimana (26/11) */
.wk-total { font-size: 1.6em; font-weight: 700; }
.wk-chart { position: relative; display: flex; gap: 6px; align-items: flex-end; height: 120px; margin: 12px 0 4px; }
.wk-labels { display: flex; gap: 6px; }
.wk-col { flex: 1; text-align: center; min-width: 0; }
.wk-chart .wk-col { height: 100%; display: flex; align-items: flex-end; }
.wk-bar { width: 100%; background: #5b8def; border-radius: 6px 6px 0 0; }
.wk-bar.over { background: #d32f2f; }
.wk-limit { position: absolute; left: 0; right: 0; height: 2px; background: #fb8c00; margin-bottom: 0; pointer-events: none; }
.wk-hbar { height: 5px; border-radius: 5px; background: var(--line, #e5e5e5); margin-top: 4px; }
.wk-fill { height: 100%; border-radius: 5px; background: var(--accent, #ef8a3c); }
.sg-pause { margin-top: 10px; }
.wg-save { align-self: flex-start; min-width: 160px; padding-left: 28px; padding-right: 28px; }
.wg-red-bg { background: #d32f2f; color: #fff; }
.wg-save:disabled { opacity: .4; cursor: default; }
.item .sub.wg-red { color: #d32f2f; } .item .sub.wg-green { color: #43A047; }

/* 26/11: rotella della chat — Cerca e Consensi Parental Control */
.chat-search { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-bottom: 1px solid var(--line, rgba(0,0,0,.1)); background: var(--bg, #fff); }
.chat-search input { flex: 1; min-width: 0; }
.chat-search .search-count { font-size: 13px; color: var(--muted, #777); white-space: nowrap; }
.chat-search button:disabled { opacity: .35; cursor: default; }
mark.hl { background: #ffeb3b; color: #000; border-radius: 2px; padding: 0 1px; }
/* 26/11: la finestra è alta al massimo 80vh, i consensi scorrono dentro (prima uscivano dal riquadro, tagliati). */
.consents { display: flex; flex-direction: column; gap: 12px; flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 4px; }
.consents > * { flex: none; }
.urg-card { border: 1px solid var(--line, rgba(0,0,0,.08)); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.urg-title { font-weight: 600; }
.urg-details { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 6px; }
.urg-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; }
.urg-field select, .urg-num { max-width: 55%; }
.urg-num { width: 7ch; }
.consent-saved { color: #2e7d32; font-size: 14px; font-weight: 600; }
.consent-wait { font-style: italic; }
.modal-card:has(.consents) { max-width: 520px; max-height: 88vh; }
.consent-row { display: flex; flex-direction: column; gap: 4px; padding-bottom: 10px; border-bottom: 1px solid var(--line, rgba(0,0,0,.08)); }
.consent-head { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.consent-head input[type=checkbox] { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--brand); }
.consent-title { flex: 1; font-weight: 600; }
.consent-state { font-size: 12px; }
.consent-state.on { color: #2e7d32; }
.consent-state.off { color: var(--muted, #777); }
.consent-missing { font-size: 13px; color: #fb8c00; }
.form-error { color: #c62828; font-size: 14px; }
.pin-input { font-size: 22px; letter-spacing: 8px; text-align: center; width: 9ch; margin: 8px auto; display: block; }

/* 26/11: scudo "Sicurezza e condivisione" come nell'app */
/* 27/11: scudo, rotella e gruppo nei cerchi come Chiama/Video; colori dal tema (chiaro/scuro) */
.toolbar .circle-tool { width: 38px; height: 38px; border-radius: 50%; border: none; padding: 0; display: inline-flex;
  align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; box-shadow: 0 1px 3px rgba(0,0,0,.2);
  background: #546E7A; color: #fff; }
:root[data-theme="dark"] .toolbar .circle-tool { background: #78909C; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .toolbar .circle-tool { background: #78909C; } }
.toolbar .circle-tool svg { width: 21px; height: 21px; display: block; }
.toolbar .circle-tool.safety-shield svg { width: 24px; height: 24px; }
.toolbar .circle-tool:hover { filter: brightness(1.12); }

/* 26/11: tasto SOS a distanza, sotto lo stato del telefono */
.sos-row { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line, rgba(0,0,0,.08)); }

/* 27/11: chat ancora vuota (come nell'app) */
.chat-empty { margin: auto; max-width: 360px; padding: 24px; border-radius: 18px; background: var(--panel); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px; box-shadow: 0 2px 12px rgba(0,0,0,.08); }
.chat-empty-icon { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand); }
.chat-empty-icon svg { width: 28px; height: 28px; fill: currentColor; }
.chat-empty-title { font-weight: 700; font-size: 17px; }
.chat-empty-text { color: var(--muted, #777); font-size: 14px; }
#messages:has(.bubble) .chat-empty { display: none; }

/* 27/11: immagine del profilo dal browser */
#tabs .me-avatar { width: 36px; height: 36px; border-radius: 50%; padding: 0; overflow: hidden; display: inline-flex; align-items: center;
  justify-content: center; background: rgba(255,255,255,.25); color: #fff; border: 2px solid rgba(255,255,255,.7); cursor: pointer; }
#tabs .me-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
#tabs .me-avatar svg { width: 22px; height: 22px; fill: currentColor; }
.modal-card.wide { max-width: 680px; max-height: 90vh; }
.av-picker { display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; }
.av-picker .av-upload { align-self: center; }
.av-preview { width: 120px; height: 120px; border-radius: 50%; overflow: hidden; align-self: center; display: flex; align-items: center;
  justify-content: center; background: color-mix(in srgb, var(--text) 8%, var(--panel)); text-align: center; font-size: 13px; }
.av-preview img { width: 100%; height: 100%; object-fit: cover; }
.av-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.av-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); grid-auto-rows: max-content; align-content: start;
  gap: 8px; flex: 1; min-height: 120px; overflow-y: auto; padding: 4px; }
.av-preview, .av-chips, .av-picker .av-upload { flex: none; }
.av-cell { padding: 0; border: 3px solid transparent; border-radius: 50%; overflow: hidden; width: 100%; height: auto; aspect-ratio: 1 / 1;
  min-height: 0; background: none; cursor: pointer; display: block; }
.av-cell img { width: 100%; height: 100%; display: block; object-fit: cover; }
.av-cell.selected { border-color: var(--brand); }
.av-cell:hover { filter: brightness(1.06); }

/* 30/11: Bacheca personale */
.board-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
.board-card { border-radius: 16px; padding: 12px; min-height: 104px; cursor: pointer; border: 1px solid var(--bc);
  background: color-mix(in srgb, var(--bc) 14%, var(--panel)); display: flex; flex-direction: column; gap: 2px; }
.board-card:hover { filter: brightness(1.04); }
.board-card { position: relative; }
.board-add { align-items: center; justify-content: center; color: var(--brand); border: 2px dashed var(--brand); background: transparent; font-weight: 600; }
.board-emoji { font-size: 30px; line-height: 1.2; }
.board-emoji.sm { font-size: 26px; width: 38px; text-align: center; flex: none; }
.board-name { font-weight: 700; font-size: 16px; }
.board-sub { font-size: 12px; color: var(--muted); }
.board-note { padding: 0 14px; }
.board-list { padding: 6px 12px; }
.board-cat { color: var(--brand); font-size: 15px; margin: 14px 6px 4px; }
.board-row { gap: 10px; align-items: center; }
.board-rec { color: #7E57C2; }
.board-album { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 4px; padding: 8px 12px; }
.board-thumb { aspect-ratio: 1; background: color-mix(in srgb, var(--text) 10%, var(--panel)) center / cover no-repeat; border-radius: 6px; cursor: pointer; position: relative; }
.board-thumb.video::after { content: '▶'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 30px; text-shadow: 0 0 8px #000; }
.board-back .title { color: var(--brand); }
/* 30/11: colori delle sezioni (niente stili in linea: li blocca la protezione della pagina) */
.board-card.sec-archives { --bc: #FB8C00; }
.board-card.sec-games { --bc: #7E57C2; }
.board-card.sec-album { --bc: #26A69A; }
.board-card.sec-materials { --bc: #42A5F5; }
.board-card.sec-coco-routines { --bc: #FFB300; }
.board-card.sec-coco-me { --bc: #26A69A; }
.board-card.sec-coco-chat { --bc: #EF6C00; }
/* 02/12: Parla con Coco */
.cc-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.cc-intro { padding: 8px 14px 0; margin: 0; }
.cc-box { flex: 1; }
.cc-hints { padding: 6px 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.cc-composer textarea { flex: 1; }
.bubble.cc-ask { border-left: 3px solid var(--brand); }
.cc-note { white-space: normal; text-align: center; }
.cc-media { max-width: min(560px, 90%); padding: 6px; }
.cc-video { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 10px; display: block; }
/* 03/12: video in una finestra a parte (server aperto da un indirizzo numerico) */
.yt-card { display: flex; gap: 10px; align-items: center; }
/* 04/12: la radio come sul telefono: nome, Coco che canta, Interrompi e volume */
.cc-radio-card { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 260px; }
.cc-radio-name { font-weight: 700; font-size: 17px; color: var(--brand); text-align: center; }
.cc-radio-coco { height: 92px; display: flex; justify-content: center; overflow: hidden; }
.cc-radio-ctl { display: flex; align-items: center; gap: 8px; width: 100%; justify-content: center; flex-wrap: wrap; }
.cc-radio-vol { flex: 1; min-width: 100px; max-width: 200px; accent-color: var(--brand); }
.cc-radio-volicon { font-size: 16px; }
.yt-card .mv-thumb { width: 120px; border-radius: 8px; flex: none; }
.yt-card-body { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; }
.cc-radio { width: 100%; margin-top: 4px; }
.coco-mascot { display: block; }
.coco-hello { display: flex; justify-content: center; padding: 0; height: 126px; overflow: hidden; }
.cc-wrap.started .cc-intro { display: none; }
img.cc-ava { border-radius: 50%; object-fit: cover; }
.cc-mic { font-size: 20px; width: 44px; height: 42px; padding: 0; flex: none; border-radius: 50%; }
.cc-mic.rec { background: #e53935; color: #fff; border-color: #e53935; animation: ccrec 1.4s ease-in-out infinite; }
@keyframes ccrec { 0%, 100% { box-shadow: 0 0 0 0 rgba(229,57,53,.45); } 50% { box-shadow: 0 0 0 8px rgba(229,57,53,0); } }
@media (prefers-reduced-motion: reduce) { .cc-mic.rec { animation: none; } }
.cc-voice { font-size: 18px; padding: 4px 10px; }
.bubble.cc-pending { opacity: .6; }
.cc-dots { display: flex; gap: 4px; padding: 12px 14px; }
.cc-dots.hidden { display: none; }
.cc-dots span { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .35; animation: ccdot 1.2s infinite; }
.cc-dots span:nth-child(2) { animation-delay: .2s; }
.cc-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes ccdot { 0%, 60%, 100% { opacity: .25; transform: none; } 30% { opacity: .9; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .cc-dots span { animation: none; opacity: .6; } }
.board-card.sec-coco-videos { --bc: #E53935; }
/* 04/12 (utente): casella del link più lunga */
.mv-add { max-width: 900px; margin: 8px 0; }
.mv-add input { max-width: none; flex: 1 1 520px; min-width: 0; }
.mv-new { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin: 8px 0 12px; max-width: 900px; }
.mv-new input { width: 100%; }
.mv-row { gap: 10px; align-items: center; }
.mv-thumb { width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; flex: none; background: var(--line); }
.mv-list { max-width: 760px; }
.mv-player { width: min(720px, 86vw); }
.board-card.sel { box-shadow: 0 0 0 2px var(--bc); }
/* 02/12: "Cosa sa Coco di te" */
.coco-me { padding: 4px 16px 24px; max-width: 760px; }
.coco-row { display: grid; grid-template-columns: 190px 1fr; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line, rgba(127,127,127,.18)); }
.coco-label { font-weight: 600; padding-top: 7px; }
.coco-ctl { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; }
.coco-ctl > input, .coco-ctl > select { width: 100%; max-width: 340px; }
.coco-ctl input.bad { border-color: #e53935; }
.coco-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.coco-chip { display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 10px; border-radius: 14px;
  background: color-mix(in srgb, #26A69A 16%, var(--panel)); border: 1px solid color-mix(in srgb, #26A69A 45%, transparent); }
.coco-chip button { padding: 0 6px; font-size: 16px; line-height: 1; border: none; }
.coco-add { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.coco-add input { flex: 1 1 140px; min-width: 0; max-width: 220px; }
.coco-past { display: flex; flex-direction: column; gap: 2px; }
.coco-told { margin-top: 14px; }
.coco-msg { margin-left: 8px; }
@media (max-width: 720px) { .coco-row { grid-template-columns: 1fr; gap: 4px; } .coco-label { padding-top: 0; } }
button.board-del { display: flex; padding: 6px; border: none; border-radius: 50%; background: transparent; color: #e53935; opacity: .75; }
button.board-del:hover { opacity: 1; background: color-mix(in srgb, #e53935 12%, transparent); }

.board-game-acts { margin-top: 14px; }
.board-game-img { width: 34px; height: 34px; vertical-align: middle; }
button.board-del svg { width: 20px; height: 20px; fill: currentColor; }

/* 01/12: Routine di Coco */
.rt-row { gap: 10px; align-items: center; }
.rt-switch input { width: 20px; height: 20px; }
.rt-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.rt-act { display: flex; align-items: center; gap: 6px; }
.rt-intro { padding: 0 14px; }
.rt-log { padding: 2px 14px; }

/* 01/12: schermo del PC condiviso: la chiamata diventa un riquadro spostabile in basso a destra */
.call-grip { display: none; }
.call-win.sharing { inset: auto 16px 16px auto; width: 320px; height: 300px; border-radius: 16px; box-shadow: 0 8px 30px rgba(0,0,0,.5); overflow: hidden; }
.call-win.sharing .call-grip { display: block; position: absolute; top: 0; left: 0; right: 0; height: 22px; z-index: 3; cursor: move; text-align: center;
  font-size: 12px; line-height: 22px; color: rgba(255,255,255,.7); background: rgba(0,0,0,.35); letter-spacing: 2px; }
.call-win.sharing .call-face { display: none; }
.call-win.sharing .call-top { font-size: 12px; padding-top: 24px; }
.call-win.sharing .call-local { width: 45%; height: auto; max-height: 40%; right: 8px; top: 28px; }
.call-win.sharing .call-btn { width: 40px; height: 40px; font-size: 16px; }
.call-win.in-pip { position: static; width: 100vw; height: 100vh; border-radius: 0; box-shadow: none; }
.call-win.in-pip .call-grip { display: none; }
body.call-pip-body { margin: 0; background: #111; overflow: hidden; }

/* 01/12: copia di sicurezza dell'archivio sul PC */
#tabs #backup { color: #fff; border-color: rgba(255,255,255,.5); }
.bk-card { max-width: 520px; overflow-y: auto; }   /* 04/12: alta più dello schermo: scorre */
.bk-card > * { flex-shrink: 0; }
.bk-card section { border-top: 1px solid var(--line, rgba(128,128,128,.25)); padding-top: 12px; margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.bk-card h3 { margin: 0; font-size: 16px; }
.bk-card input[type=password], .bk-card input[type=file] { width: 100%; box-sizing: border-box; }
.bk-progress { height: 8px; border-radius: 4px; background: rgba(128,128,128,.25); overflow: hidden; }
.bk-progress > div { height: 100%; width: 0; background: var(--brand); transition: width .3s; }
.bk-msg { min-height: 1.2em; }
.bk-msg.err { color: #c62828; }
.bk-msg.ok { color: #2e7d32; }

/* 02/12: agenda, elenco completo a sinistra con le voci del giorno/periodo scelto colorate */
#list .item.ag-sel { background: color-mix(in srgb, var(--brand) 16%, transparent); border-left: 4px solid var(--brand); }
#list .item.ag-sel .title { font-weight: 600; }

/* 02/12: modulo delle routine allineato (spunte a sinistra, giorni a capo, niente scorrimento interno) */
.rt-detail { display: flex; flex-direction: column; gap: 10px; }
.rt-detail input[type=time] { width: auto; align-self: flex-start; }
.rt-days { display: flex; flex-wrap: wrap; gap: 6px; }
.rt-act { justify-content: flex-start; text-align: left; cursor: pointer; line-height: 1.3; }
.rt-act input[type=checkbox], .rt-switch input[type=checkbox] { width: auto; flex: 0 0 auto; margin: 0; }

/* 03/12: tasto attenuato (azione senza effetto, es. classifiche già vuote) */
button.dim { opacity: .5; }

/* 04/12: album con titolo nella bacheca personale */
.board-albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.board-album-card { padding: 10px; border-radius: 16px; background: color-mix(in srgb, #26A69A 14%, var(--panel)); }
.board-album-card .title { font-weight: 600; margin-top: 8px; }
.board-mosaic { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.board-mosaic .board-thumb { position: relative; }
.board-more { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff;
  font-size: 22px; font-weight: 700; background: rgba(0,0,0,.4); border-radius: inherit; }
.board-thumb.pending { display: flex; align-items: center; justify-content: center; }
.board-thumb.pending .spinner { width: 28px; height: 28px; border: 3px solid var(--brand); border-right-color: transparent;
  border-radius: 50%; animation: att-spin .8s linear infinite; }

/* 04/12: copia di sicurezza: occhio della password, file scelto, stato sotto il tasto */
.pw-wrap { position: relative; display: flex; align-items: center; }
.pw-wrap input { flex: 1; padding-right: 44px; }
.pw-eye { position: absolute; right: 4px; min-width: 0; padding: 4px 8px; margin: 0; box-shadow: none; opacity: .55; }
.pw-eye.on { opacity: 1; }
.bk-file { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0; }
.bk-status:empty { display: none; }
.bk-status { margin-top: 8px; }
.confirm-icon.ok { color: #2E7D32; }
