:root {
  --bg: #f6f5f2; --panel: #ffffff; --panel2: #efeee9; --ink: #1c1c1e; --mut: #8a8a8e;
  --line: rgba(60, 60, 67, .14); --accent: #1f6f68; --accent-ink: #ffffff; --accent-soft: rgba(31, 111, 104, .12);
  --mine: #e3906a; --other: #81d8d0; --other-soft: rgba(129, 216, 208, .18); --danger: #c0392b; --note: #6a4fc4;
  --bubble-me: #1f6f68; --bubble-me-ink: #fff; --bubble-other: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 8px 24px rgba(0, 0, 0, .06);
  --vh: 100dvh;
  --sat: env(safe-area-inset-top); --sab: env(safe-area-inset-bottom);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111214; --panel: #1c1d20; --panel2: #26272b; --ink: #f2f2f4; --mut: #8e8e93;
    --line: rgba(255, 255, 255, .1); --accent: #4fb3a9; --accent-ink: #0b1514; --accent-soft: rgba(79, 179, 169, .16);
    --mine: #e3906a; --other: #81d8d0; --other-soft: rgba(129, 216, 208, .16); --danger: #ff6b5e; --note: #a28ff0;
    --bubble-me: #2b7f77; --bubble-me-ink: #fff; --bubble-other: #26272b;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font: 22px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
body { overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; font-size: 22px; color: var(--ink); }
svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
h1, h2, h3 { margin: 0; }

/* ------------------------------------------------ schermate di accesso */
.screen { position: fixed; inset: 0; overflow-y: auto; padding: calc(var(--sat) + 24px) 20px calc(var(--sab) + 28px);
  display: flex; flex-direction: column; gap: 16px; }
.hero { text-align: center; margin: 0 0 8px; }
/* Schermate di accesso: contenuto centrato in verticale, azioni subito sotto */
#scr-install, #scr-lock { justify-content: center; gap: 22px; }
#scr-install .steps { padding: 18px 18px 18px 16px; }
#scr-install .note { text-align: center; font-size: 16px; padding: 0 12px; }
#scr-lock .stack { margin-top: 18px; }
#scr-lock .msg { min-height: 0; }
.hero-icon { width: 96px; height: 96px; border-radius: 22px; box-shadow: var(--shadow); }
.hero h1 { font-size: 39px; letter-spacing: -.02em; margin-top: 14px; }
.lead { color: var(--mut); margin: 6px 0 0; font-size: 21px; }
.title { font-size: 42px; letter-spacing: -.02em; margin-top: 8px; }
.screen-head { min-height: 28px; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
.card { background: var(--panel); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.card p { margin: 0 0 8px; } .card p:last-child { margin-bottom: 0; }
.steps .step { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 12px; }
.steps .step:last-child { margin-bottom: 0; }
.steps .n { flex: 0 0 34px; height: 34px; border-radius: 17px; margin-top: -1px; background: var(--accent-soft); color: var(--accent);
  font-weight: 600; font-size: 18px; display: grid; place-items: center; }
.note { color: var(--mut); font-size: 18px; margin: 0; }
.label { font-size: 17px; color: var(--mut); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.recovery { font: 600 22px/1.7 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .04em; word-spacing: 4px;
  user-select: all; -webkit-user-select: all; }
.code-box { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.code { font: 700 52px/1.1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .08em; color: var(--accent); margin: 4px 0 8px !important; }
.status { color: var(--mut); font-size: 20px; margin-top: 12px !important; }
.check { display: flex; gap: 12px; align-items: center; font-size: 21px; }
.check input { width: 28px; height: 28px; accent-color: var(--accent); }
.msg { min-height: 20px; margin: 0; font-size: 20px; text-align: center; }
.msg.err { color: var(--danger); }

.btn { border-radius: 14px; padding: 15px 18px; font-weight: 600; text-align: center; width: 100%; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:disabled { opacity: .4; }
.btn.secondary { background: var(--panel); color: var(--accent); box-shadow: var(--shadow); }
.btn.plain { color: var(--accent); font-weight: 500; padding: 10px; }
.btn.danger { background: var(--panel); color: var(--danger); box-shadow: var(--shadow); }
.btn.big { font-size: 23px; }
.btn:active, .row.action:active { opacity: .6; }
.link.back { font-size: 40px; line-height: 1; padding: 0 12px 4px 0; font-weight: 300; }
.link { white-space: nowrap; color: var(--accent); font-size: 22px; padding: 8px 0; }
.link.light { color: #fff; } .link.danger { color: #ff8a80; }

.form { display: flex; flex-direction: column; gap: 0; padding: 0 16px; }
.field { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; }
.field > span { font-size: 17px; color: var(--mut); }
.field input, .field textarea { border: 0; outline: 0; background: transparent; padding: 2px 0; width: 100%; resize: none; }
.field textarea { font-family: inherit; }
#act-code, #rec-code { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .06em; }
.field.inline { flex-direction: row; justify-content: space-between; align-items: center; gap: 12px; }
.field.inline > span { white-space: nowrap; font-size: 22px; color: var(--ink); }
.field.inline input[type="date"], .field.inline input[type="time"] { width: auto; text-align: right; color: var(--accent); }
.switch { appearance: none; -webkit-appearance: none; width: 51px; height: 31px; border-radius: 16px; background: rgba(120, 120, 128, .32);
  position: relative; transition: background .2s; flex: 0 0 auto; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .2s; }
.field .switch, .field input.switch { width: 51px; padding: 0; }
.switch:checked { background: var(--accent); } .switch:checked::after { transform: translateX(20px); }

/* ------------------------------------------------ struttura dell'app */
#app { position: fixed; left: 0; right: 0; top: var(--vt, 0px); height: var(--vh); display: flex; flex-direction: column; }
.nav { padding: calc(var(--sat) + 6px) 16px 8px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.6) blur(20px);
  -webkit-backdrop-filter: saturate(1.6) blur(20px); border-bottom: 1px solid var(--line); z-index: 5; }
.nav h2 { font-size: 22px; font-weight: 600; max-width: 62vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-side.right { display: flex; justify-content: flex-end; }
.icon-btn { width: 46px; height: 46px; display: grid; place-items: center; color: var(--accent); border-radius: 20px; }
.icon-btn:active { background: var(--accent-soft); }
#view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.tab { padding: 8px clamp(8px, 4vw, 16px) 24px; }
.tabbar { display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px 8px calc(var(--sab) + 4px);
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.6) blur(20px);
  -webkit-backdrop-filter: saturate(1.6) blur(20px); border-top: 1px solid var(--line); }
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 14px; color: var(--mut);
  padding: 4px 0; position: relative; font-weight: 500; }
.tabbar button.active { color: var(--accent); }
.badge { position: absolute; top: 0; left: calc(50% + 6px); min-width: 22px; height: 22px; border-radius: 11px; padding: 0 6px;
  background: var(--danger); color: #fff; font: 600 15px/22px -apple-system, system-ui; font-style: normal; }
body.typing .tabbar, body.in-thread .tabbar { display: none; }
body.in-thread:not(.typing) .composer { padding-bottom: calc(var(--sab) + 8px); }

/* ------------------------------------------------ agenda */
.month-head { display: flex; align-items: center; justify-content: space-between; margin: 4px -8px 6px; }
.month-head h3 { font-size: clamp(22px, 7.4vw, 29px); font-weight: 700; letter-spacing: -.01em; text-transform: capitalize; }
.dow, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); text-align: center; }
.dow span { font-size: clamp(13px, 4vw, 16px); color: var(--mut); font-weight: 600; padding: 4px 0; }
.grid { row-gap: 2px; }
.day { min-width: 0; aspect-ratio: 1 / 1.02; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.day .num { width: min(44px, 100%); height: auto; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  font-size: clamp(16px, 5.6vw, 22px); }
.day.out .num { color: var(--mut); opacity: .45; }
.day.today .num { color: var(--accent); font-weight: 700; }
.day.sel .num { background: var(--ink); color: var(--bg); font-weight: 600; }
.day.sel.today .num { background: var(--accent); color: var(--accent-ink); }
.dots { display: flex; gap: 3px; height: 7px; }
.dots i { width: 7px; height: 7px; border-radius: 4px; background: var(--pc, var(--mine)); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); }
.day-head { margin: 16px 2px 8px; }
.day-head h3 { font-size: 20px; color: var(--mut); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.list { display: flex; flex-direction: column; gap: 8px; }
.ev { background: var(--panel); border-radius: 14px; padding: 12px 14px 12px 16px; display: grid; grid-template-columns: clamp(70px, 24vw, 96px) minmax(0, 1fr);
  gap: 10px; box-shadow: var(--shadow); position: relative; text-align: left; width: 100%; box-sizing: border-box; min-width: 0; }
.ev::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 0 4px 4px 0; background: var(--pc, var(--mine)); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.ev .t { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ev .t.all { font-size: 17px; line-height: 1.25; color: var(--mut); }
.ev .t small { display: block; font-weight: 400; color: var(--mut); }
.ev .b b { display: block; font-weight: 600; }
.ev .b span { display: block; color: var(--mut); font-size: 18px; }
.empty { text-align: center; color: var(--mut); padding: 28px 0; font-size: 20px; }

/* ------------------------------------------------ messaggi */
#tab-chat { padding: 8px 12px 12px; min-height: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
.thread { display: flex; flex-direction: column; gap: 3px; }
.sep { text-align: center; font-size: 16px; color: var(--mut); margin: 14px 0 6px; font-weight: 600; }
.bubble { max-width: 78%; padding: 8px 12px; border-radius: 18px; font-size: 22px; line-height: 1.32; word-wrap: break-word;
  white-space: pre-wrap; background: var(--bubble-other); align-self: flex-start; box-shadow: var(--shadow); position: relative; }
.bubble.me { align-self: flex-end; box-shadow: none; }
/* sfondo e testo dal colore di chi scrive (impostati dall'app per ogni messaggio) */
.bubble { background: var(--bub, var(--bubble-other)); color: var(--bub-ink, var(--ink)); }
.bubble .time { display: block; font-size: 14px; opacity: .6; margin-top: 2px; text-align: right; }
.bubble.media { padding: 4px; overflow: hidden; }
.bubble.media img { display: block; max-width: 100%; border-radius: 14px; min-width: 120px; min-height: 80px; background: var(--panel2); }
.bubble.media .time { padding: 0 8px 2px; }
.bubble .file { display: flex; gap: 10px; align-items: center; padding: 4px 2px; }
.bubble .file .ic { width: 38px; height: 38px; border-radius: 10px; background: rgba(127, 127, 127, .18); display: grid; place-items: center; flex: 0 0 auto; }
.bubble .file b { display: block; font-weight: 600; font-size: 20px; }
.bubble .file small { opacity: .7; font-size: 17px; }
.bubble .evcard { display: block; text-align: left; }
.bubble .evcard small { display: block; opacity: .7; font-size: 16px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.bubble .evcard b { display: block; }
.bubble.pending { opacity: .55; }
.composer { display: flex; align-items: flex-end; gap: 6px; padding: 8px 10px; background: var(--bg); border-top: 1px solid var(--line); }
.input-wrap { flex: 1; position: relative; display: flex; min-width: 0; }
.composer textarea { flex: 1; border: 1px solid var(--line); border-radius: 22px; padding: 9px 44px 9px 16px; background: var(--panel);
  outline: 0; resize: none; max-height: 180px; line-height: 1.3; min-width: 0; }
.expand { position: absolute; right: 4px; bottom: 4px; width: 38px; height: 38px; border-radius: 19px; display: grid; place-items: center; color: var(--mut); }
.expand svg { width: 20px; height: 20px; }
.composer.expanded { align-items: stretch; }
.composer.expanded textarea { height: calc(var(--vh) * .55) !important; max-height: none; border-radius: 16px; padding-right: 16px; padding-top: 44px; }
.composer.expanded .expand { top: 4px; bottom: auto; color: var(--accent); }
.composer.expanded .send, .composer.expanded #btn-attach { align-self: flex-end; }
.send { width: 44px; height: 44px; border-radius: 22px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: 0 0 auto; margin-bottom: 1px; }
.send svg { width: 20px; height: 20px; stroke-width: 2.4; }
.send:disabled { opacity: .35; }

/* ------------------------------------------------ elenco conversazioni */
#tab-chat.mode-list { justify-content: flex-start; }
.conv { background: var(--panel); width: 100%; text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px; }
.group .conv:first-of-type { border-radius: 12px 12px 0 0; }
.group .conv:last-child { border-radius: 0 0 12px 12px; border-bottom: 0; }
.group .conv:first-of-type:last-child { border-radius: 12px; }
.conv:active { background: var(--panel2); }
.conv-top, .conv-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.conv-top b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-time { color: var(--mut); font-size: 18px; flex: 0 0 auto; }
.conv-prev { color: var(--mut); font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-badge { min-width: 26px; height: 26px; border-radius: 13px; padding: 0 6px; background: var(--accent); color: var(--accent-ink);
  font: 600 16px/26px -apple-system, system-ui; font-style: normal; text-align: center; flex: 0 0 auto; }

/* ------------------------------------------------ impostazioni */
.group { margin: 12px 0 22px; }
.group-title { font-size: 17px; color: var(--mut); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; margin: 0 4px 6px; }
.row { background: var(--panel); display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 16px;
  width: 100%; text-align: left; border-bottom: 1px solid var(--line); }
.group .row:first-of-type { border-radius: 12px 12px 0 0; }
.group .row:last-child { border-radius: 0 0 12px 12px; border-bottom: 0; }
.group .row:first-of-type:last-child { border-radius: 12px; }
.row.action { color: var(--accent); }
.row.danger { color: var(--danger); }
.mut { color: var(--mut); text-align: right; flex: 0 1 auto; max-width: 60%; }
.row > span:first-child { flex: 1 0 auto; max-width: 55%; }
.foot { color: var(--mut); font-size: 17px; margin: 0 4px; }

/* ------------------------------------------------ pannello modale */
#sheet-wrap { position: fixed; left: 0; right: 0; top: var(--vt, 0px); height: var(--vh); z-index: 20; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .35); animation: fade .2s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: calc(var(--vh) - var(--sat) - 12px); overflow-y: auto;
  background: var(--bg); border-radius: 14px 14px 0 0; padding: 8px 16px calc(var(--sab) + 20px); animation: up .25s ease-out;
  display: flex; flex-direction: column; gap: 14px; }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; position: sticky; top: -8px;
  background: var(--bg); padding: 8px 0 4px; z-index: 1; }
.sheet-head h3 { font-size: 22px; font-weight: 600; text-align: center; }
.sheet-head .right { text-align: right; }
.sheet-head .link.strong { font-weight: 600; }
.sheet .stack { margin-top: 0; }
.ev-view h2 { font-size: 34px; letter-spacing: -.01em; }
.ev-view .when { color: var(--mut); margin-top: 4px; }
.ev-view .meta { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.ev-view .who { font-size: 17px; color: var(--mut); margin-top: 10px; }
.pend { display: flex; justify-content: space-between; align-items: center; width: 100%; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

/* ------------------------------------------------ visualizzatore */
#viewer { position: fixed; inset: 0; background: #000; z-index: 30; display: flex; flex-direction: column; }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; padding: calc(var(--sat) + 6px) 16px 8px; color: #fff; gap: 10px; }
.viewer-bar span { font-size: 20px; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-body { flex: 1; display: grid; place-items: center; overflow: auto; color: #fff; }
.viewer-body img, .viewer-body video { max-width: 100%; max-height: 100%; }
.viewer-foot { padding: 8px 16px calc(var(--sab) + 8px); text-align: center; min-height: 40px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#toast { position: fixed; left: 50%; transform: translateX(-50%); top: calc(var(--sat) + 10px); z-index: 40;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 22px; font-size: 20px; max-width: 90vw;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .2); animation: fade .2s; }

/* evento: data e ora di inizio e di fine */
.field.inline.when { flex-direction: column; align-items: stretch; gap: 6px; }
.when-inputs { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.field .when-inputs input { width: auto; min-width: 0; flex: 0 1 auto; color: var(--accent); background: var(--panel2);
  border-radius: 8px; padding: 6px 10px; }
.field .when-inputs input[type=date] { flex: 1 1 auto; }
.ev .t.lab small { display: block; font-weight: 400; color: var(--mut); font-size: 15px; }

/* impegno con note */
.ev .b .has-notes { color: var(--note); font-size: 15px; font-weight: 600; margin-top: 2px; }

/* v5: conversazione dell'evento */
.ev .b .ev-info { display: flex; align-items: center; gap: 8px; color: var(--note); font-size: 15px; font-weight: 600; margin-top: 2px; }
.ev-unread { min-width: 22px; height: 22px; border-radius: 11px; padding: 0 6px; background: var(--note); color: var(--panel);
  font: 600 14px/22px -apple-system, system-ui; font-style: normal; text-align: center; }
.ev-head { background: var(--panel); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); margin: 4px 0 10px;
  border-left: 4px solid var(--note); }
.ev-head p { margin: 0; }
.ev-head .when { font-weight: 600; }
.ev-head .place { color: var(--mut); font-size: 20px; margin-top: 2px; }
.ev-head .desc { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.ev-head .desc small { display: block; color: var(--note); font-size: 15px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.ev-head .desc p { white-space: pre-wrap; font-size: 20px; }
.ev-head .who { font-size: 16px; color: var(--mut); margin-top: 8px; }
/* Conversazione di un evento: contenuto dall'alto, altezza data solo dal contenuto. Nessuna altezza percentuale
   sul thread: su iPhone (WebKit) rendeva il contenuto piu' alto del contenitore e bloccava lo scorrimento. */
#tab-chat.mode-event { justify-content: flex-start; }

/* v5: allegati effimeri */
.bubble .file.eph .ic { background: rgba(127, 127, 127, .18); }
.bubble .file.eph .ic svg { width: 22px; height: 22px; }
.bubble.gone { font-style: italic; opacity: .6; }
.eph-btn { display: flex; align-items: center; justify-content: center; gap: 8px; }
.eph-btn svg { width: 22px; height: 22px; }
#eph-viewer { position: fixed; inset: 0; background: #000; z-index: 31; display: flex; flex-direction: column;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.eph-bar-left { font-size: 16px !important; white-space: nowrap; }
.eph-stage { flex: 1; position: relative; display: grid; place-items: center; overflow: hidden; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.eph-media { position: absolute; inset: 0; display: grid; place-items: center; visibility: hidden; pointer-events: none; }
.eph-media canvas, .eph-media video { max-width: 100%; max-height: 100%; pointer-events: none; -webkit-touch-callout: none; }
.eph-stage.show .eph-media { visibility: visible; }
.eph-hint { color: rgba(255, 255, 255, .75); font-size: 20px; margin: 0; text-align: center; padding: 0 24px; }
.eph-stage.show .eph-hint { visibility: hidden; }

/* v6: messaggi da leggere negli eventi, in cima all'Agenda */
.unread-box { margin: 4px 0 14px; }
.unread-box .group-title { color: var(--note); }
.unread-box .conv { border-left: 4px solid var(--note); }
.unread-box .conv-badge { background: var(--note); color: var(--panel); }
.conv-when { color: var(--note); font-size: 17px; font-weight: 600; }
.day.unr .num { outline: 2px solid var(--note); outline-offset: 2px; }
.bubble.hl { box-shadow: 0 0 0 3px var(--note); }

/* v6: album */
.dots i.ph { background: none; border: 1.5px solid var(--note); }
.al-month { font-size: 29px; font-weight: 700; letter-spacing: -.01em; margin: 6px 2px 2px; text-transform: capitalize; }
.al-day { font-size: 20px; color: var(--mut); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; margin: 16px 2px 8px; }
.al-ev { display: flex; align-items: baseline; gap: 8px; margin: 10px 2px 6px; color: var(--note); font-weight: 600; font-size: 19px;
  width: calc(100% - 4px); text-align: left; }
.al-ev::before { content: ""; width: 4px; height: 18px; border-radius: 2px; background: var(--note); align-self: center; flex: 0 0 auto; }
.al-ev .ttl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.al-ev small { color: var(--mut); font-weight: 500; font-size: 17px; white-space: nowrap; }
.al-ev .more { margin-left: auto; font-size: 17px; white-space: nowrap; }
.al-free { margin: 12px 2px 6px; color: var(--mut); font-weight: 600; font-size: 17px; }
.al-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.ph { aspect-ratio: 1; border-radius: 4px; position: relative; overflow: hidden; background: var(--panel2); display: block; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph i { position: absolute; right: 5px; bottom: 5px; width: 11px; height: 11px; border-radius: 6px;
  background: var(--pc, var(--mine)); box-shadow: 0 0 0 2px rgba(255, 255, 255, .85); }
.ph.lib::after { content: "data indicata"; position: absolute; left: 5px; top: 5px; font: 600 11px/1 -apple-system, system-ui;
  color: #fff; background: rgba(0, 0, 0, .45); padding: 3px 5px; border-radius: 5px; }
.ph .more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .45); color: #fff;
  font-weight: 600; font-size: 20px; }
.day-photos { display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 14px; padding: 10px 12px;
  box-shadow: var(--shadow); margin-top: 8px; width: 100%; text-align: left; }
.day-photos .strip { display: flex; flex: 0 0 auto; }
.day-photos .strip img { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; border: 2px solid var(--panel);
  margin-left: -12px; background: var(--panel2); }
.day-photos .strip img:first-child { margin-left: 0; }
.day-photos b { display: block; font-weight: 600; font-size: 20px; }
.day-photos small { display: block; color: var(--mut); font-size: 17px; }
.day-photos .chev { margin-left: auto; color: var(--mut); font-size: 26px; }
.ev-photos { margin: 0 0 10px; }
.ev-photos .hd { display: flex; justify-content: space-between; align-items: baseline; margin: 0 2px 6px; }
.ev-photos .hd small { color: var(--note); font-size: 15px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.ev-photos .hd button { color: var(--note); font-size: 17px; font-weight: 600; }
.ev-photos .row4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; }
.viewer-info { color: #fff; padding: 10px 18px 0; display: flex; flex-direction: column; gap: 6px; font-size: 19px; }
.viewer-info .who { display: flex; align-items: center; gap: 8px; opacity: .9; }
.viewer-info .who i { width: 12px; height: 12px; border-radius: 6px; background: var(--pc, var(--mine)); }
.viewer-info .evl { color: #b9a9f5; font-weight: 600; text-align: left; }
.lib-row { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.lib-row:last-child { border-bottom: 0; }
.lib-row img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: var(--panel2); }
.lib-row .when-inputs { display: flex; flex-wrap: wrap; gap: 8px; }
.lib-row .when-inputs input { color: var(--accent); background: var(--panel2); border: 0; border-radius: 8px; padding: 6px 8px; min-width: 0; max-width: 100%; }
.lib-row .when-inputs input[type=date] { flex: 1 1 150px; } .lib-row .when-inputs input[type=time] { flex: 0 1 auto; }
.lib-row small { display: block; color: var(--mut); font-size: 16px; margin-top: 4px; }

/* ------------------------------------------------ persone: mittente e autore */
.sender { display: flex; align-items: center; gap: 7px; font-size: 16px; font-weight: 600; color: var(--mut);
  margin: 8px 0 -2px 6px; align-self: flex-start; }
.sender i, .ev-head .who i, .ev-view .who i { width: 10px; height: 10px; border-radius: 5px; background: var(--pc, var(--mine));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); flex: none; }
.ev-head .who, .ev-view .who { display: flex; align-items: center; gap: 7px; }

/* nessun elemento puo' allargare la pagina oltre lo schermo */
#view { overflow-x: hidden; }
