/* Plancia · un'unica plancia per lavoro e vita. Guscio: barra laterale · barra superiore · vista. Carta fredda, colore solo dove significa qualcosa. */
:root {
  --bg: #F2F3F0; --surface: #FFFFFF; --surface-2: #EEF0EB; --surface-3: #E2E5DF;
  --text: #171A18; --muted: #5B615D; --faint: #8E9590; --border: #DFE2DC; --border-strong: #C6CBC4;
  --work: #2D5BE3; --work-soft: #E8EDFC; --teams: #5B5FC7; --teams-soft: #ECECFA; --life: #0B7A5E; --life-soft: #DEF1E9;
  --danger: #C8322A; --danger-soft: #FCE8E6; --on-danger: #FFFFFF;
  --warn: #935700; --warn-fill: #E39A1B; --warn-soft: #FFF1D6;
  --ok: #2E7D4F; --ok-soft: #E2F2E8;
  --hatch: #C6CBC4; --overlay: rgba(23, 26, 24, .36);
  --shadow-pop: 0 24px 64px rgba(23, 26, 24, .16), 0 2px 8px rgba(23, 26, 24, .08);
  --on-accent: #FFFFFF; --ink-accent: #171A18;
  --f-ui: 'Geist', Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --f-display: 'Bodoni Moda', Didot, 'Bodoni 72', Georgia, serif;
  --gl: max(16px, env(safe-area-inset-left, 0px)); --gr: max(16px, env(safe-area-inset-right, 0px));
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101211; --surface: #171A19; --surface-2: #1F2321; --surface-3: #2A2F2C;
    --text: #E8ECE9; --muted: #A0A7A2; --faint: #6F7672; --border: #2A2F2C; --border-strong: #3B413D;
    --work: #7D9DFF; --work-soft: #1B2546; --teams: #9195F3; --teams-soft: #24254A; --life: #43C9A1; --life-soft: #0F2E26;
    --danger: #FF6E61; --danger-soft: #3B1714; --on-danger: #1A0806;
    --warn: #F2B144; --warn-fill: #E39A1B; --warn-soft: #3A2A0D;
    --ok: #56C483; --ok-soft: #12301E;
    --hatch: #3B413D; --overlay: rgba(0, 0, 0, .56);
    --shadow-pop: 0 24px 64px rgba(0, 0, 0, .5), 0 0 0 1px #2A2F2C;
    --on-accent: #101211; --ink-accent: #E8ECE9;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101211; --surface: #171A19; --surface-2: #1F2321; --surface-3: #2A2F2C;
  --text: #E8ECE9; --muted: #A0A7A2; --faint: #6F7672; --border: #2A2F2C; --border-strong: #3B413D;
  --work: #7D9DFF; --work-soft: #1B2546; --teams: #9195F3; --teams-soft: #24254A; --life: #43C9A1; --life-soft: #0F2E26;
  --danger: #FF6E61; --danger-soft: #3B1714; --on-danger: #1A0806;
  --warn: #F2B144; --warn-fill: #E39A1B; --warn-soft: #3A2A0D;
  --ok: #56C483; --ok-soft: #12301E;
  --hatch: #3B413D; --overlay: rgba(0, 0, 0, .56);
  --shadow-pop: 0 24px 64px rgba(0, 0, 0, .5), 0 0 0 1px #2A2F2C;
  --on-accent: #101211; --ink-accent: #E8ECE9;
  color-scheme: dark;
}

/* ---------- Pagina: l'app riempie la finestra, senza scroll della pagina ---------- */
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; background: var(--bg); color: var(--text); }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { font: 400 13px/1.45 var(--f-ui); -webkit-font-smoothing: antialiased; }
#root { height: 100vh; height: 100dvh; }
noscript { display: block; padding: 24px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---------- Primitivi ---------- */
.app, .app * { box-sizing: border-box; }
.app { --accent: var(--ink-accent); position: relative; width: 100%; height: 100%; overflow: hidden; container: app / inline-size;
  background: var(--bg); color: var(--text); font: 400 13px/1.45 var(--f-ui); -webkit-font-smoothing: antialiased; text-align: left; }
.app[data-ctx="lavoro"] { --accent: var(--work); }
.app[data-ctx="vita"] { --accent: var(--life); }
:where(.app) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
:where(.app) a { color: inherit; text-decoration: none; }
:where(.app) h1, :where(.app) h2, :where(.app) h3, :where(.app) p { margin: 0; }
:where(.app) input, :where(.app) textarea { font: inherit; color: var(--text); }
.app :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Campi dentro una cornice: il fuoco colora la cornice, non il campo */
.app :is(.filter, .ta-add, .pal-in, .composer, .pop-field) :is(input, textarea):focus-visible { outline: none; }
.app :is(.filter, .ta-add, .composer):focus-within { border-color: var(--accent); }
.app .i { flex: none; display: block; }
.app .i.xs { width: 12px; height: 12px; display: inline-block; vertical-align: -2px; margin-right: 4px; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp { flex: 1; }
.lbl { font: 500 11px/1.2 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.app kbd { font: 500 10.5px/1 var(--f-mono); display: inline-block; min-width: 18px; padding: 3px 4px 2px; text-align: center; border: 1px solid var(--border-strong);
  border-bottom-width: 2px; border-radius: 4px; background: var(--surface); color: var(--muted); }
.app kbd + kbd { margin-left: 3px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.more { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.card > .more { margin-top: 12px; }
.more:hover { color: var(--text); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 6px; white-space: nowrap;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 500; }
.app .btn { border: 1px solid var(--border-strong); background: var(--surface); }
.app .btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.app .btn.primary kbd { background: transparent; color: inherit; border-color: currentColor; opacity: .7; }
.app .btn.ghost { background: transparent; }
.app .btn.danger-outline { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn.small { height: 26px; padding: 0 9px; font-size: 12px; }
.btn.block { width: 100%; height: 44px; }
.ib { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 6px; color: var(--muted); flex: none; }
.ib:hover { background: var(--surface-2); color: var(--text); }
.ib.sm { width: 26px; height: 26px; }
.ib.bordered { border: 1px solid var(--border-strong); width: 28px; height: 28px; }

.chip { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 6px; font: 500 11px/1 var(--f-ui); white-space: nowrap;
  background: var(--surface-2); color: var(--muted); flex: none; }
.chip.mono { font-family: var(--f-mono); }
.chip .i { width: 12px; height: 12px; }
.chip.icon { padding: 0 5px; }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.teams { background: var(--teams-soft); color: var(--teams); }
.chip.work { background: var(--work-soft); color: var(--work); }
.chip.life { background: var(--life-soft); color: var(--life); }
.chip.origin { gap: 6px; padding-left: 3px; }
.chip.origin .tile { width: 14px; height: 14px; font-size: 9px; border-radius: 4px; }

.tile { width: 20px; height: 20px; border-radius: 5px; display: inline-grid; place-items: center; font: 600 11px/1 var(--f-ui); flex: none; position: relative; }
.tile.o { background: var(--work-soft); color: var(--work); }
.tile.t { background: var(--teams-soft); color: var(--teams); }
.tile.g { background: var(--life-soft); color: var(--life); }

.seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); flex: none; }
.app .seg button { height: 26px; padding: 0 11px; border-radius: 999px; color: var(--muted); font-weight: 500; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.app .seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border-strong); }
.seg .mono { font-size: 11px; color: var(--muted); }
.cdot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.cdot.tutto { background: linear-gradient(90deg, var(--work) 50%, var(--life) 50%); }
.cdot.lavoro { background: var(--work); }
.cdot.vita { background: var(--life); }

.filter { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 9px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); min-width: 0; }
.filter input { border: 0; outline: 0; background: transparent; min-width: 0; width: 100%; height: 100%; }
.filter input::placeholder { color: var(--faint); }

.cb { width: 18px; height: 18px; border: 1.5px solid var(--border-strong); display: inline-grid; place-items: center; flex: none; color: var(--on-accent); background: var(--surface); }
.cb.sq { border-radius: 5px; }
.cb.rd { border-radius: 50%; }
.cb.sq.on { background: var(--work); border-color: var(--work); }
.cb.rd.on { background: var(--life); border-color: var(--life); }
.cb.wait { border-style: dashed; color: var(--muted); border-radius: 5px; }
.cb.wait .i { width: 11px; height: 11px; }
.sqdot, .rddot { width: 9px; height: 9px; flex: none; }
.sqdot { border-radius: 2px; } .rddot { border-radius: 50%; }
.sqdot.work { background: var(--work); } .rddot.life { background: var(--life); }


.plink { color: var(--text); font-weight: 500; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.app .plink { display: inline; }
.plink.sm { font-weight: 400; text-decoration: none; color: var(--muted); }

/* eventi (condivisi da Oggi e Agenda) */
.ev { position: absolute; border-radius: 6px; background: var(--work-soft); border-left: 3px solid var(--work); padding: 3px 7px; font-size: 12px; line-height: 1.3;
  overflow: hidden; color: var(--text); display: flex; flex-direction: column; gap: 1px; min-width: 0; cursor: pointer; }
.ev-t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-h { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.teams { background: var(--teams-soft); border-left-color: var(--teams); }
.ev.life { background: var(--life-soft); border-left-color: var(--life); }
.ev.tentative { background: transparent; border: 1px dashed var(--work); border-left: 3px solid var(--work); }
.ev.past { opacity: .55; }
.ev.private { background: repeating-linear-gradient(135deg, var(--hatch) 0 1.5px, var(--surface-2) 1.5px 6px); border-left-color: var(--border-strong); color: var(--muted); }
.ev.private .ev-h { display: none; }
.ev.faint { background: var(--surface-3); border-left-color: var(--border-strong); }
.ev.faint .ev-t, .ev.faint .ev-h, .ev.faint .ev-join { visibility: hidden; }
.ev-join { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--teams); color: var(--on-accent); font-size: 11px; font-weight: 500; align-self: flex-start; }
.ev-join .i { width: 12px; height: 12px; }

/* tooltip */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); font: 500 11px/1.3 var(--f-ui); padding: 5px 8px; border-radius: 6px; white-space: nowrap; z-index: 20; pointer-events: none; }
.tip-r[data-tip]:hover::after, .tip-r[data-tip]:focus-visible::after { left: auto; right: 0; transform: none; }
.tip-l[data-tip]:hover::after, .tip-l[data-tip]:focus-visible::after { left: 0; transform: none; }

/* ---------- Guscio ---------- */
.ctxline { position: absolute; inset: 0 0 auto 0; height: 2px; z-index: 30; background: linear-gradient(90deg, var(--work) 50%, var(--life) 50%); }
.app[data-ctx="lavoro"] .ctxline { background: var(--work); }
.app[data-ctx="vita"] .ctxline { background: var(--life); }
.shell { display: flex; height: 100%; min-height: 0; }
.sidebar { width: 232px; flex: none; display: flex; flex-direction: column; gap: 20px; padding: calc(14px + var(--sat)) 12px 12px var(--gl); border-right: 1px solid var(--border); background: var(--bg);
  overflow: hidden auto; overscroll-behavior: contain; scrollbar-width: none; }   /* se la finestra è bassa scorre; niente barra che stringerebbe le icone */
.brand { display: flex; align-items: center; gap: 10px; height: 32px; padding-left: 4px; }
.mark rect { fill: var(--accent); } .mark path { stroke: var(--on-accent); stroke-width: 1.7; stroke-linecap: round; } .mark circle { fill: var(--on-accent); }
.wordmark { font: 600 16px/1 var(--f-ui); letter-spacing: -.01em; }
.brand .collapse { margin-left: auto; width: 26px; height: 26px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-i { position: relative; display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 6px; color: var(--muted); font-weight: 500; }
.nav-i:hover { background: var(--surface-2); color: var(--text); }
.nav-i.active { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.nav-i.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--accent); }
.nav-i.dim { opacity: .5; }
.nav-i .count { margin-left: auto; font-size: 11px; color: var(--muted); }
.nav-i .count.red { background: var(--danger); color: var(--on-danger); padding: 3px 6px; border-radius: 999px; line-height: 1; }
.sources { display: flex; flex-direction: column; gap: 2px; }
.sources .lbl { padding: 0 10px 6px; }
.src-row { display: flex; align-items: center; gap: 9px; height: 26px; padding: 0 10px; border-radius: 6px; color: var(--text); font-size: 12.5px; }
.sdot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; margin: 0 4px 0 5px; }
.src-row .ago { margin-left: auto; font-size: 11px; color: var(--faint); }
.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
/* pillola generica in fondo alla barra (la usa turnoPill() di turni.js) */
.side-pill { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 30px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); font-size: 12px; font-weight: 500; text-align: left; }
.side-pill .i { color: var(--muted); }
.whoami { display: flex; align-items: center; gap: 9px; height: 32px; padding: 0 10px; border-radius: 6px; font-size: 12.5px; }
.whoami { height: 40px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-weight: 600; flex: none; }
.me-t { display: flex; flex-direction: column; line-height: 1.2; }
.me-t small { color: var(--muted); font-size: 11px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.topbar { height: calc(52px + var(--sat)); flex: none; display: flex; align-items: center; gap: 16px; padding: var(--sat) var(--gr) 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); min-width: 0; }
.brand-mini { display: none; }
.tb-title { flex: 1 1 auto; min-width: 0; }
.tb-h { font: 600 15px/1.2 var(--f-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-title .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search { flex: 0 1 220px; min-width: 150px; height: 32px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); display: flex; align-items: center; gap: 8px; padding: 0 6px 0 10px; color: var(--muted); }
.s-txt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-k { display: flex; }
.tb-right { display: flex; align-items: center; gap: 10px; flex: none; }
.meet { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 4px 0 10px; border-radius: 999px; background: var(--teams-soft); color: var(--teams); font-weight: 500; white-space: nowrap; }
.meet .mono { font-weight: 600; }
.meet-w { color: var(--muted); font-weight: 400; }
.meet-go { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 4px 0 9px; border-radius: 999px; background: var(--teams); color: var(--on-accent); }
.meet-go kbd { background: transparent; color: inherit; border-color: currentColor; opacity: .75; padding: 2px 3px 1px; min-width: 15px; }
.clock { font-size: 13px; font-weight: 500; }
.view { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
.app .view:focus { outline: none; }
.tabbar { display: none; }
.fab { display: none; }
.page { padding: 24px 24px 32px; max-width: 1320px; margin: 0 auto; }

/* ---------- Oggi ---------- */
.og-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 18px; }
.og-date { min-width: 0; }
.serif-date { font: italic 400 34px/1.05 var(--f-display); letter-spacing: -.01em; text-wrap: balance; }
.og-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.punto { font-size: 15px; color: var(--muted); max-width: 72ch; margin-top: 10px; line-height: 1.55; text-wrap: pretty; }
.og-day { display: flex; align-items: center; gap: 16px; flex: none; }
.og-meter { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.meter { width: 180px; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; display: block; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.og-meter-l { font-size: 11.5px; color: var(--muted); }

.oriz { padding: 12px 16px 12px; margin-bottom: 16px; }
.oz-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.oz-legend { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.oz-legend .dia { position: static; display: inline-block; width: 8px; height: 8px; transform: rotate(45deg); margin: 0 2px 0 8px; }
.oz-grid { position: relative; display: grid; grid-template-columns: 52px 1fr; row-gap: 6px; align-items: center; }
.oz-ticks { position: relative; height: 16px; }
.oz-ticks span { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--muted); }
.oz-ticks span:first-child { transform: none; }
.oz-ticks span:last-child { transform: translateX(-100%); }
.oz-lbl { font: 500 10.5px/1 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.oz-track { position: relative; height: 28px; border-radius: 6px; background: var(--surface-2); }
.oz-track.dl { height: 18px; background: transparent; border-top: 1px dashed var(--border); border-radius: 0; }
.dimmed { opacity: .35; }
.oz-block { position: absolute; top: 3px; bottom: 3px; border-radius: 5px; background: var(--work-soft); border-left: 3px solid var(--work); font-size: 10.5px; padding: 0 5px;
  white-space: nowrap; display: flex; align-items: center; min-width: 6px; }
.oz-block span { overflow: hidden; text-overflow: ellipsis; }
.oz-block.lab-r > span, .oz-block.lab-l > span { position: absolute; top: 50%; transform: translateY(-50%); overflow: visible; color: var(--text); font-weight: 500; pointer-events: none; }
.oz-block.lab-r > span { left: calc(100% + 5px); }
.oz-block.lab-l > span { right: calc(100% + 7px); }
.oz-block.lab-0 > span { display: none; }
.oz-block.teams { background: var(--teams-soft); border-left-color: var(--teams); }
.oz-block.life { background: var(--life-soft); border-left-color: var(--life); }
.oz-block.past { opacity: .5; }
.oz-block.invite { background: transparent; border: 1px dashed var(--warn-fill); border-left: 3px solid var(--warn-fill); color: var(--warn); }
.oz-block.private { background: repeating-linear-gradient(135deg, var(--hatch) 0 1.5px, var(--surface) 1.5px 6px); border-left-color: var(--border-strong); }
.oz-block.private span, .oz-block.faint span { visibility: hidden; }
.oz-mark { position: absolute; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; display: grid; place-items: center; z-index: 2; }
.dia { width: 10px; height: 10px; border-radius: 2px; transform: rotate(45deg); background: var(--faint); box-shadow: 0 0 0 2px var(--surface); display: block; }
.dia.risk { background: var(--warn-fill); } .dia.late { background: var(--danger); } .dia.task { background: var(--work); } .dia.life { background: var(--life); } .dia.ok { background: var(--faint); }
.oz-over { position: absolute; left: 52px; right: 0; top: 16px; bottom: 0; pointer-events: none; }
.oz-line { position: absolute; top: 0; bottom: -2px; width: 0; border-left: 1.5px dashed var(--border-strong); }
.oz-line span { position: absolute; bottom: -16px; left: 4px; font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.oz-line.now { border-left: 2px solid var(--accent); top: -2px; }
.oz-line.now span { bottom: -17px; left: -19px; background: var(--accent); color: var(--on-accent); padding: 1px 4px; border-radius: 4px; font-weight: 600; }
.oz-line.now em { position: absolute; bottom: -17px; left: 24px; font-style: normal; font-size: 10.5px; padding: 1px 5px; border-radius: 999px; background: var(--danger); color: var(--on-danger); white-space: nowrap; font-weight: 600; }
.oriz { padding-bottom: 26px; }

.og-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.og-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.og-agenda { padding-bottom: 12px; }
.tl-before { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; margin-bottom: 14px; border-radius: 6px; background: var(--surface-2); font-size: 12px; color: var(--muted); }
.tl-before .i { margin-top: 1px; }
.tl { position: relative; }
.tl-hour { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); }
.tl-hour span { position: absolute; left: 0; top: -7px; font-size: 11px; color: var(--muted); background: var(--surface); padding-right: 6px; line-height: 14px; }
.tl-ev { z-index: 1; }
.tl-ev.tiny { flex-direction: row; align-items: center; gap: 8px; padding-top: 0; padding-bottom: 0; }
.tl-ev.tiny .ev-h { flex: none; }
.tl-ev.has-join { padding-right: 70px; }
.tl-ev .ev-join { position: absolute; right: 6px; top: 3px; height: 18px; }
.tl-now { position: absolute; left: 44px; right: 0; border-top: 2px solid var(--accent); z-index: 3; }
.tl-now span { position: absolute; left: -44px; top: -9px; font-size: 10.5px; font-weight: 600; background: var(--accent); color: var(--on-accent); padding: 1px 4px; border-radius: 4px; }
.adesso .ad-when { margin-top: 10px; font-size: 12px; color: var(--teams); font-weight: 600; }
.adesso.life .ad-when { color: var(--life); }
.ad-title { font: 600 18px/1.25 var(--f-ui); margin-top: 4px; letter-spacing: -.01em; text-wrap: balance; }
.ad-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.ad-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.ad-prep { display: flex; align-items: flex-start; gap: 8px; width: 100%; margin-top: 14px; padding: 10px; border-radius: 8px; background: var(--surface-2); font-size: 12.5px; text-align: left; }
.ad-prep .i { margin-top: 1px; color: var(--muted); }
.ad-prep { overflow-wrap: anywhere; }
.og-prio .more { margin-top: 6px; }
.task-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.task-row:first-of-type { border-top: 0; }
.task-row .t-title { flex: 1; min-width: 0; text-align: left; font-size: 13px; }
.task-row.done .t-title { text-decoration: line-through; color: var(--muted); }
.fc-big { display: flex; align-items: baseline; gap: 8px; color: var(--muted); }
.fc-big .mono { font-size: 30px; font-weight: 500; color: var(--text); letter-spacing: -.02em; }
.fc-bars { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 10px; }
.fc-bar { display: grid; grid-template-columns: 20px 62px 1fr 24px; align-items: center; gap: 8px; font-size: 12px; }
.fc-bar .mono { text-align: right; color: var(--muted); }
.fc-track { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.fc-track i { display: block; height: 100%; border-radius: 3px; }
.fc-track i.o { background: var(--work); } .fc-track i.t { background: var(--teams); } .fc-track i.g { background: var(--life); }
.fc-list { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.fc-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; width: 100%; }
.fc-row .ell { flex: 1; }
.fc-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; line-height: 1.35; text-align: left; }
.fc-txt b, .fc-txt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-txt b { font-weight: 600; }
.fc-txt span { color: var(--muted); }
.sp-lbl { fill: var(--muted); font: 500 10px var(--f-mono); }
.vt-row, .nx-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 0; border-top: 1px solid var(--border); font-size: 12.5px; text-align: left; }
.vt-row:first-of-type, .nx-row:first-of-type { border-top: 0; }
.vt-row > .mono:first-child, .nx-row > .mono:first-child { width: 44px; flex: none; color: var(--muted); font-size: 12px; }
.vt-row .ell, .nx-row .ell { flex: 1; }
.og-vita .vt-row .i { width: 13px; color: var(--life); }

/* ---------- Flusso ---------- */
.view[data-route="flusso"], .view[data-route="agenda"] { overflow: hidden; }
.fl { display: flex; flex-direction: column; height: 100%; }
.fl-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px var(--gr) 8px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.chips-row { display: flex; gap: 6px; flex-wrap: wrap; }
.fchip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px 0 6px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); font-weight: 500; white-space: nowrap; }
.fchip:not(:has(.tile)):not(:has(.i)) { padding-left: 10px; }
.fchip .tile { width: 18px; height: 18px; font-size: 10px; border-radius: 50%; }
.fchip .i { width: 14px; }
.fchip[aria-pressed="true"] { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.fchip .mono { font-size: 11px; }
.fl-bar .filter { width: 160px; margin-left: auto; }
.fl-zero { display: flex; align-items: center; gap: 10px; padding: 12px 16px 2px; font-size: 11.5px; color: var(--muted); }
.fl-zero .meter { width: 90px; }
.fl-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 420px minmax(0, 1fr); }
.fl-list { overflow: auto; border-right: 1px solid var(--border); background: var(--surface); }
.fl-sec { position: sticky; top: 0; z-index: 2; display: flex; gap: 8px; padding: 12px 16px 6px; background: var(--surface); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.fl-sec span { color: var(--faint); }
.fl-row { position: relative; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--border); cursor: pointer; min-width: 0; }
.fl-row:hover { background: var(--surface-2); }
.fl-row .stripe { position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 2px 2px 0; }
.fl-row.src-o .stripe { background: var(--work); } .fl-row.src-t .stripe { background: var(--teams); } .fl-row.src-g .stripe { background: var(--life); }
.fl-row.cur, .fl-row.sel { background: var(--surface-2); }
.fl-row.cur .stripe, .fl-row.sel .stripe { top: 0; bottom: 0; background: var(--accent); width: 2px; }
.fr-from { width: 108px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.fl-row.unread .fr-from, .fl-row.unread .fr-subj { font-weight: 600; }
.fl-row.unread .fr-from::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 5px; vertical-align: 1px; }
.fr-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.fr-subj { color: var(--text); margin-right: 6px; }
.fr-chips { display: flex; gap: 4px; flex: none; }
.fr-time { flex: none; width: 38px; text-align: right; font-size: 11px; color: var(--muted); }
.fr-acts { display: none; }
.fl-hint { padding: 14px 16px 20px; font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.held { display: flex; align-items: center; gap: 10px; margin: 10px 12px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-size: 12.5px; }
.held span { flex: 1; min-width: 0; }
.fl-scrim { display: none; }
.fl-read { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.rd-head { padding: 16px 28px 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
.rd-top { display: flex; align-items: center; gap: 10px; font-size: 11.5px; }
.rd-back { display: none; }
.crumb { color: var(--muted); }
.rd-time { margin-left: auto; }
.rd-title { font: 600 19px/1.3 var(--f-ui); margin-top: 8px; letter-spacing: -.01em; text-wrap: balance; }
.rd-from { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--muted); }
.rd-from b { color: var(--text); font-weight: 500; }
.rd-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.rd-chips .chip { height: 24px; padding: 0 8px; }
.rd-body { flex: 1; min-height: 0; overflow: auto; padding: 18px 28px 24px; display: flex; flex-direction: column; gap: 14px; }
.mail { font-size: 15px; line-height: 1.6; max-width: 68ch; display: flex; flex-direction: column; gap: 12px; }
.thread { display: flex; flex-direction: column; gap: 12px; }
.day-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; }
.day-sep::before, .day-sep::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.bub { display: flex; gap: 10px; max-width: 86%; align-items: flex-start; }
.bub .av { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font: 600 10.5px var(--f-ui); flex: none; }
.bub .bx { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font-size: 14px; line-height: 1.5; min-width: 0; }
.bub .bh { display: flex; gap: 8px; align-items: baseline; font-size: 12px; margin-bottom: 2px; }
.bub .bh .mono { color: var(--muted); font-size: 11px; }
.bub.me { margin-left: auto; flex-direction: row-reverse; }
.bub.me .bx { background: var(--teams-soft); border-color: transparent; }
.bub.me .av { background: var(--teams-soft); color: var(--teams); }
.mention { background: var(--teams-soft); color: var(--teams); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.att { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; }
.atts { display: flex; flex-wrap: wrap; gap: 8px; }
.atts .att { margin: 0; }
.tip { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.tip span { flex: 1; min-width: 0; }
.tip .i { color: var(--warn-fill); }
.guard { display: flex; gap: 10px; padding: 12px 14px; border-radius: 8px; background: var(--warn-soft); color: var(--text); font-size: 13.5px; line-height: 1.5; }
.guard .i { color: var(--warn); margin-top: 3px; }
.guard-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.invite-card { padding: 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.rd-status { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); color: var(--muted); }
.rd-status span { flex: 1; }
.composer { border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.composer textarea { border: 0; outline: 0; resize: vertical; background: transparent; min-height: 64px; font-size: 14px; }
.cq { display: flex; gap: 6px; flex-wrap: wrap; }
.c-acts { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.rd-bar { flex: none; display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 28px; border-top: 1px solid var(--border); background: var(--surface); }
.rd-reply { flex: 1 0 100%; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 12px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); font-size: 13.5px; text-align: left; cursor: text; }
.rd-reply span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-reply .i { width: 15px; }
.rb { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px 0 10px; border-radius: 6px; border: 1px solid var(--border); font-weight: 500; white-space: nowrap; }
.rb .i { width: 15px; color: var(--muted); }
.rb kbd { margin-left: 2px; }
.rd-empty { margin: auto; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 8px; }
.empty { padding: 40px 24px; text-align: center; color: var(--muted); }
.serif-empty { font: italic 400 32px/1.1 var(--f-display); color: var(--text); margin-bottom: 8px; }

/* ---------- Agenda ---------- */
.ag { display: flex; height: 100%; min-height: 0; }
.ag-rail { width: 216px; flex: none; padding: 16px; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 18px; overflow: auto; background: var(--bg); }
.mc-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 13px; }
.mc-nav { display: flex; gap: 6px; color: var(--muted); }
.mc-row { display: grid; grid-template-columns: 22px repeat(7, 1fr); align-items: center; font-size: 11px; border-radius: 6px; }
.mc-row.cur { background: var(--surface); box-shadow: 0 0 0 1px var(--border); }
.mc-dow { color: var(--muted); font-size: 10.5px; }
.mc-wk { color: var(--faint); font-size: 10px; text-align: center; }
.mc-d { position: relative; height: 24px; display: grid; place-items: center; }
.mc-d.out { color: var(--faint); }
.mc-d.today { color: var(--on-accent); }
.mc-d.today::before { content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); z-index: -1; }
.mc-d { z-index: 0; }
.mc-d i { position: absolute; bottom: 1px; width: 3px; height: 3px; border-radius: 50%; background: var(--muted); }
.mc-d.today i { background: var(--on-accent); }
.ag-cals { display: flex; flex-direction: column; gap: 8px; }
.ag-cals .lbl { margin-bottom: 2px; }
.cal-t { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.cal-box { width: 15px; height: 15px; border-radius: 4px; border: 1.5px solid var(--border-strong); display: grid; place-items: center; color: var(--on-accent); flex: none; }
.cal-box.on.work { background: var(--work); border-color: var(--work); }
.cal-box.on.teams { background: var(--teams); border-color: var(--teams); }
.cal-box.on.life { background: var(--life); border-color: var(--life); }
.mini-card { padding: 12px; }
.mini-card .lbl { margin-bottom: 8px; }
.conflict-card { border-color: var(--danger); }
.conflict-card .lbl { color: var(--danger); }
.cf-row { display: flex; gap: 8px; font-size: 12px; line-height: 1.4; }
.cf-row .mono { color: var(--muted); flex: none; }
.free-big { font-size: 20px; font-weight: 500; }
.free-sl { font-size: 11px; margin-top: 4px; line-height: 1.5; }
.ag-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.ag-bar { display: flex; align-items: center; gap: 14px; padding: 10px var(--gr) 10px 16px; border-bottom: 1px solid var(--border); }
.ag-nav { display: flex; gap: 6px; align-items: center; }
.ag-title { font: 600 15px/1.2 var(--f-ui); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-title .mono { font-weight: 400; font-size: 12px; }
.wk { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.wk-head, .wk-allday { display: grid; grid-template-columns: 56px repeat(var(--n, 7), minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.wk-gut { font-size: 10px; color: var(--muted); display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; }
.wk-dh { display: flex; align-items: baseline; gap: 6px; padding: 8px 8px 6px; font-size: 12px; color: var(--muted); border-left: 1px solid var(--border); }
.wk-dh b { font-size: 15px; font-weight: 500; color: var(--text); }
.wk-dh.today b { background: var(--accent); color: var(--on-accent); padding: 1px 7px; border-radius: 999px; }
.wk-dh.we { background: var(--surface-2); }
.wk-ad { grid-column: 2 / -1; display: grid; grid-template-columns: repeat(var(--n, 7), minmax(0, 1fr)); gap: 3px; padding: 4px 3px; }
.ad-bar { height: 22px; border-radius: 5px; display: flex; align-items: center; gap: 6px; padding: 0 8px; font-size: 11.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ad-bar .i { width: 13px; flex: none; }
.ad-bar span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ad-bar.life { background: var(--life-soft); color: var(--life); }
.wk-scroll { flex: 1; min-height: 0; overflow: auto; }
.wk-body { position: relative; display: grid; grid-template-columns: 56px repeat(var(--n, 7), minmax(0, 1fr)); }
.wk-hours { position: relative; }
.wk-hours span { position: absolute; right: 8px; font-size: 10.5px; color: var(--muted); transform: translateY(-50%); }
.wk-hours span:first-child { transform: none; }
.wk-cols { grid-column: 2 / -1; display: grid; grid-template-columns: repeat(var(--n, 7), minmax(0, 1fr));
  background: repeating-linear-gradient(180deg, var(--border) 0 1px, transparent 1px 44px); }
.wk-col { position: relative; border-left: 1px solid var(--border); }
.wk-col.we { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.wk-work { position: absolute; left: 0; right: 0; background: color-mix(in srgb, var(--work-soft) 22%, transparent); pointer-events: none; }
.wk-ev { font-size: 11.5px; padding: 3px 6px; }
.wk-ev.tiny { flex-direction: row; align-items: center; padding: 0 6px; }
.wk-ev .ev-t { font-size: 11.5px; }
.cf-flag { position: absolute; left: 4px; z-index: 4; display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 7px; border-radius: 999px; background: var(--danger); color: var(--on-danger); font-size: 10.5px; font-weight: 600; white-space: nowrap; }
.cf-flag .i { width: 11px; height: 11px; }
.wk-now { position: absolute; left: -1px; right: 0; border-top: 2px solid var(--accent); z-index: 3; }
.wk-now::before { content: ""; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.wk-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.agp { padding: 12px var(--gr) 24px var(--gl); }
.agp-head { display: flex; justify-content: space-between; align-items: center; font-size: 15px; margin-bottom: 10px; }
.agp-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.ds { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 5px; border-radius: 10px; font-size: 11px; color: var(--muted); }
.ds b { font-size: 15px; color: var(--text); font-weight: 500; }
.ds.sel { background: var(--accent); color: var(--on-accent); }
.ds.sel b { color: var(--on-accent); }
.ds-dots { display: flex; gap: 2px; height: 5px; }
.ds-dots i { width: 4px; height: 4px; border-radius: 50%; }
.ds-dots i.work { background: var(--work); } .ds-dots i.teams { background: var(--teams); } .ds-dots i.life { background: var(--life); }
.ds.sel .ds-dots i { background: var(--on-accent); }
.agp-list { display: flex; flex-direction: column; gap: 8px; }
.dl-row { display: grid; grid-template-columns: 48px 1fr; gap: 8px; align-items: stretch; }
.dl-t { font-size: 12px; color: var(--muted); padding-top: 6px; }
.dl-ev { position: relative; padding: 8px 10px; font-size: 14px; }
.dl-ev .ev-h { font-size: 12px; }
.dl-ev .ev-join { position: absolute; right: 8px; top: 8px; height: 24px; padding: 0 10px; font-size: 12px; }
.dl-now { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--accent); font-weight: 600; }
.dl-now::after { content: ""; flex: 1; border-top: 2px solid var(--accent); }
.dl-free { display: grid; grid-template-columns: 48px 1fr; gap: 8px; font-size: 12.5px; color: var(--muted); }
.dl-free span:last-child { padding: 8px 10px; border-radius: 6px; border: 1px dashed var(--border-strong); background: repeating-linear-gradient(135deg, var(--surface-2) 0 1px, transparent 1px 7px); }

/* ---------- Attività ---------- */
.ta { display: flex; min-height: 100%; }
.ta-rail { width: 232px; flex: none; padding: 20px 14px; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; }
.ta-rail .lbl { padding: 14px 10px 6px; }
.ta-rail .lbl:first-child { padding-top: 0; }
.rl-i { display: flex; align-items: center; gap: 9px; min-height: 30px; padding: 5px 10px; line-height: 1.3; border-radius: 6px; font-size: 13px; color: var(--text); }
.rl-i .mono { margin-left: auto; font-size: 11px; color: var(--muted); }
.rl-i.active { background: var(--surface); box-shadow: 0 0 0 1px var(--border); font-weight: 500; }
.ta-main { flex: 1; min-width: 0; padding: 24px 32px 40px; max-width: 820px; }
.ta-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ta-head h2 { font: 600 20px/1.2 var(--f-ui); letter-spacing: -.01em; }
.ta-head h2 .muted { font-weight: 400; }
.ta-prog { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.ring-bg { fill: none; stroke: var(--surface-3); stroke-width: 3.5; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 3.5; stroke-linecap: round; }
.ta-add { display: flex; align-items: center; gap: 10px; height: 42px; margin: 18px 0 8px; padding: 0 10px 0 12px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); }
.ta-add input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 14px; min-width: 0; }
.ta-add input::placeholder { color: var(--faint); }
.t-sec { margin-top: 18px; }
.t-sec > .lbl { display: flex; align-items: center; gap: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.t-sec > .lbl .mono { color: var(--faint); }
.t-sec > .lbl .i { width: 13px; }
.t-row { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 4px; border-bottom: 1px solid var(--border); }
.t-row.cur { background: var(--surface-2); }
.t-star { width: 14px; flex: none; color: var(--warn-fill); }
.t-star .i { width: 14px; height: 14px; }
.t-star .starred path { fill: var(--warn-fill); stroke: var(--warn-fill); }
.t-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.t-title { flex: 1; min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-chips { display: flex; gap: 5px; flex: none; align-items: center; }
.t-row.done .t-title { text-decoration: line-through; color: var(--muted); }
.ta-phone-pick { margin-bottom: 12px; }
/* Da tablet in su: se i chip non ci stanno, vanno sotto il titolo invece di schiacciarlo */
@container app (min-width: 760px) {
  .t-main { flex-wrap: wrap; row-gap: 4px; }
  .t-title { flex: 1 1 200px; }
  .t-chips { flex: 0 1 auto; flex-wrap: wrap; min-width: 0; }
}

/* ---------- Vita ---------- */
.vi-head { margin-bottom: 18px; }
.vi-head p { margin-top: 8px; font-size: 14px; }
.vi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.vi-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.vita .card { border-top: 2px solid var(--life); }
.gm-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.gm-row:first-of-type { border-top: 0; }
.gm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 12.5px; line-height: 1.35; }
.gm-main b { font-weight: 500; }
.gm-main .ell { color: var(--muted); }
.gm-r { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 11px; flex: none; }
.gm-acts { font-size: 11.5px; padding-top: 10px; border-top: 1px solid var(--border); }
.bill { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--border); font-size: 13px; }
.bill .b-t { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bill .b-d { font-size: 11.5px; }
.bill:first-of-type { border-top: 0; }
.bill .mono { font-size: 12px; }
.bill .chip { height: 20px; }
.bill .amt { font-size: 13px; text-align: right; }
.bill .chip { justify-self: end; }
.bill-f { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border-strong); font-size: 13px; font-weight: 500; }
.wk-li { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.wk-li:first-of-type { border-top: 0; }
.wk-li > .mono { color: var(--muted); font-size: 12px; white-space: nowrap; }
.wk-li.later { color: var(--muted); }
.vi-lists .seg { margin-bottom: 8px; }
.li-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.li-row.done { color: var(--muted); text-decoration: line-through; }
.li-add { margin-top: 10px; width: 100%; }
.notes-box { display: block; width: 100%; margin-top: 8px; min-height: 76px; padding: 10px 12px; border: 0; border-radius: 8px; background: var(--surface-2); font-size: 13px; line-height: 1.55; resize: vertical; }
.st-line { stroke: var(--border-strong); stroke-dasharray: 3 3; }
.st-dot { fill: var(--life); }
.st-dot.over { fill: var(--warn-fill); }
.vi-stacc svg { margin-top: 8px; overflow: visible; }
.vi-stacc p { font-size: 12.5px; margin-top: 4px; }

/* ---------- Righe che sono pulsanti, cursori, animazioni piccole ---------- */
.li-row, .gm-row, .cf-row, .rl-i, .cal-t { width: 100%; text-align: left; }
.cf-row:hover, .cal-t:hover { color: var(--text); }
.src-row { width: 100%; text-align: left; }
.src-row:hover, .rl-i:hover { background: var(--surface-2); }
.rl-i.active:hover { background: var(--surface); }
.brand-btn { display: grid; place-items: center; border-radius: 6px; }
.demo-pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; border: 1px dashed var(--border-strong); color: var(--muted);
  font: 500 11px/1 var(--f-mono); white-space: nowrap; cursor: help; }
.tb-demo { display: none; }
.cb.pop { animation: cb-pop .3s ease-out; }
.t-row { cursor: pointer; scroll-margin: 8px 0; }
.t-sec-t { display: inline-flex; align-items: center; gap: 6px; }
.sent { max-width: 68ch; padding: 10px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--border-strong); }
.sent p { margin-top: 4px; font-size: 14px; line-height: 1.55; }
.fl-row { scroll-margin-top: 34px; }
.fl-row.out { animation: row-out .16s ease-in forwards; }   /* flList rimette .out se la riga viene ridisegnata */
.fr-acts { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); gap: 2px; padding-left: 6px; background: var(--surface-2); }
.fr-acts .ib:hover { background: var(--surface-3); }
@media (hover: hover) {
  .fl-row:hover .fr-acts { display: flex; }
  .fl-row:hover .fr-chips, .fl-row:hover .fr-time { visibility: hidden; }
}
.pal-empty, .wk-empty { pointer-events: none; }

/* Agenda, vista Giorno: la colonna del giorno e l'elenco dei dettagli */
.ag-day { flex: 1; min-height: 0; display: flex; }
.ag-day > .wk { flex: 1; min-width: 0; }
.ag-details { width: 280px; flex: none; border-left: 1px solid var(--border); padding: 14px 12px; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.ag-details > .lbl { padding: 0 8px 8px; }
.ag-details > .muted { padding: 0 8px; }
.dt-row { display: flex; flex-direction: column; gap: 3px; padding: 8px; border-radius: 6px; font-size: 13px; }
.dt-row[role="button"] { cursor: pointer; }
.dt-row[role="button"]:hover { background: var(--surface-2); }
.dt-row > .mono { font-size: 11.5px; }
.dt-t { display: flex; align-items: center; gap: 8px; font-weight: 500; min-width: 0; }
.dt-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--work); flex: none; }
.dt-dot.teams { background: var(--teams); }
.dt-dot.life { background: var(--life); }
.dt-dot.tentative { background: transparent; box-shadow: inset 0 0 0 1.5px var(--work); }
.dt-dot.past { opacity: .55; }
.mc-d:hover { color: var(--text); }
.mc-d.sel::after { content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--accent); }

/* ---------- Livelli: pannelli, popover, fogli, palette, scorciatoie, HUD, toast ---------- */
.layer { position: absolute; inset: 0; z-index: 50; }
.scrim { position: absolute; inset: 0; background: var(--overlay); }
.scrim.clear { background: transparent; }
.scrim.blur { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.layer.enter .scrim:not(.clear) { animation: fade-in .2s ease-out; }
.grip { display: none; }
.app [role="dialog"]:focus { outline: none; }

/* Pannello laterale (attività, eventi; anche turni.js con drawerHTML) */
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(400px, 100%); display: flex; flex-direction: column; background: var(--surface);
  border-left: 1px solid var(--border); box-shadow: var(--shadow-pop); }
.layer.enter .drawer { animation: from-right .2s ease-out; }
.dr-head { display: flex; align-items: flex-start; gap: 12px; padding: calc(16px + var(--sat)) 12px 14px 20px; border-bottom: 1px solid var(--border); }
.dr-ttl { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 12px; }
.dr-ttl > .cb { margin-top: 19px; }
.dr-ttl > .dt-dot { margin-top: 23px; }
.dr-tx { min-width: 0; }
.dr-tx h2 { font: 600 17px/1.3 var(--f-ui); letter-spacing: -.01em; margin-top: 4px; text-wrap: balance; overflow-wrap: anywhere; }
.dr-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 18px; font-size: 13px; }
.dr-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dr-sec > .lbl { display: flex; gap: 6px; margin-bottom: 8px; }
.dr-sec > .lbl .mono { color: var(--faint); }
.dr-sec > p { margin-bottom: 8px; }
.dr-sec .more { margin-top: 8px; }
.dr-quote { margin: 0; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); line-height: 1.45; }
.dr-quote small { display: block; color: var(--muted); margin-top: 2px; font-size: 12px; }
.dr-meta { display: flex; flex-direction: column; gap: 8px; }
.dr-meta > div { display: flex; align-items: center; gap: 10px; }
.dr-meta .i { color: var(--muted); }
.people { display: flex; flex-direction: column; gap: 8px; }
.person { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.person .av { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font: 600 10px var(--f-ui); flex: none; }
.dr-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 20px calc(12px + var(--sab)); border-top: 1px solid var(--border); }
.pills { display: flex; flex-wrap: wrap; gap: 4px; }
.pill { height: 24px; padding: 0 9px; display: inline-flex; align-items: center; border-radius: 999px; border: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.pill:hover { color: var(--text); border-color: var(--border-strong); }
.pill.on { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Popover: vicino a chi l'ha aperto (app.js lo posiziona), altrimenti in alto al centro */
.popover { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); width: 288px; max-width: calc(100% - 32px); padding: 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-pop); }
.popover.anchored { transform: none; }
.layer.enter .popover { animation: pop-in .14s ease-out; }
.layer[data-layer="pop-convert"] .popover { width: 400px; }
.pop-h { padding: 8px 10px 6px; font: 500 11px/1.2 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pop-opt { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 10px; border-radius: 6px; font-size: 13px; text-align: left; }
.pop-opt:hover, .pop-opt:focus-visible { background: var(--surface-2); }
.pop-opt > span:not([class]) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-opt .i { color: var(--muted); }
.pop-field { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; min-width: 0; }
.pop-field input { height: 34px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); outline: 0; min-width: 0; }
.pop-field input:focus { border-color: var(--accent); }
.pop-orig { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); }
.pop-acts { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 8px 10px 6px; }

/* Palette (Ctrl/⌘ K) */
.palette { position: absolute; left: 50%; top: 13%; transform: translateX(-50%); width: min(640px, calc(100% - 32px)); display: flex; flex-direction: column; background: var(--surface);
  border-radius: 12px; box-shadow: var(--shadow-pop); overflow: hidden; border: 1px solid var(--border); }
.layer.enter .palette { animation: pop-in .14s ease-out; }
.pal-in { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 14px; border-bottom: 1px solid var(--border); font-size: 15px; flex: none; }
.pal-in .i { color: var(--muted); }
.pal-in input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: 15px; }
.pal-in input::placeholder { color: var(--faint); }
.pal-x { display: none; }
.pal-res { padding: 6px 6px 8px; max-height: min(420px, 60vh); overflow: auto; overscroll-behavior: contain; }
.pal-g { padding: 10px 10px 6px; }
.pal-r { display: flex; align-items: center; gap: 10px; width: calc(100% - 8px); height: 40px; padding: 0 10px; margin: 0 4px; border-radius: 8px; font-size: 13px; text-align: left; }
.pal-r:hover { background: var(--surface-2); }
.pal-r.on { background: var(--surface-2); box-shadow: inset 2px 0 0 var(--accent); }
.pal-r .i { color: var(--muted); }
.pal-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-t small { color: var(--muted); font-size: 12px; }
.pal-r mark { background: none; color: var(--accent); font-weight: 600; }
.pal-k { display: flex; flex: none; }
.pal-h { flex: none; font-size: 11.5px; color: var(--muted); }
.pal-empty { padding: 18px 14px; color: var(--muted); }
.pal-foot { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted);
  background: var(--surface-2); flex-wrap: wrap; flex: none; }

/* Finestre: scorciatoie (?) e fogli («Altro», «Nuova attività») */
.modal { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(760px, calc(100% - 32px)); max-height: calc(100% - 48px); overflow: auto;
  overscroll-behavior: contain; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-pop); }
.layer.enter .modal { animation: pop-in .16s ease-out; }
.help-h { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 14px 10px 22px; background: var(--surface); }
.help-h h2 { font: 600 16px/1.2 var(--f-ui); }
.help-b { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 32px; padding: 6px 22px 8px; }
.help-b section > .lbl { margin-bottom: 6px; }
.help-r { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--border); font-size: 13px; }
.help-k { display: flex; flex-wrap: wrap; gap: 3px; }
.app .help-k kbd + kbd { margin-left: 0; }
.help-f { padding: 8px 22px 18px; font-size: 12px; }
.sheet { top: 13%; transform: translateX(-50%); width: min(480px, calc(100% - 32px)); padding: 18px 20px 16px; }
.sh-h { font: 600 16px/1.2 var(--f-ui); margin-bottom: 10px; }
.sh-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 2px; border-top: 1px solid var(--border); font-size: 15px; }
.sh-h + .sh-row { border-top: 0; }
.sh-row > span:not([class]) { flex: 1; min-width: 0; }
.sh-row .i { color: var(--muted); }
.sh-row .sh-go { color: var(--faint); }
.sh-row .count { font-size: 11px; color: var(--muted); }
.sh-row .count.red { background: var(--danger); color: var(--on-danger); padding: 3px 6px; border-radius: 999px; line-height: 1; }
.sh-note { margin-top: 12px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.nt-add { margin: 4px 0 0; }
.sheet .pop-acts { padding: 12px 0 0; }

/* HUD di «G» in basso a sinistra, accanto alla barra */
.hud { position: absolute; left: 248px; bottom: calc(20px + var(--sab)); z-index: 90; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; max-width: calc(100% - 264px);
  padding: 10px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-pop); font-size: 12.5px; }
.hud.enter { animation: pop-in .12s ease-out; }
.hud-i { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

/* Toast in basso al centro (su telefono sopra la barra delle schede) */
.toasts { position: absolute; left: 0; right: 0; bottom: calc(24px + var(--sab)); z-index: 95; display: flex; justify-content: center; padding: 0 var(--gr) 0 var(--gl); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; min-height: 40px; max-width: 560px; padding: 8px 8px 8px 14px; border-radius: 10px;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-pop); font-size: 13px; font-weight: 500; line-height: 1.35; }
.toast:not(:has(.toast-undo)) { padding-right: 14px; }
.toast.enter { animation: toast-in .2s ease-out; }
.toast.out { opacity: 0; translate: 0 6px; transition: opacity .18s, translate .18s; }
.toast-undo { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border-radius: 6px; font-weight: 600; }
.toast-undo:hover { background: color-mix(in srgb, var(--bg) 16%, transparent); }
.app .toast kbd { background: transparent; color: inherit; border-color: currentColor; opacity: .7; }
.app .toast :focus-visible { outline-color: var(--bg); }
/* Nel Flusso il toast resta sopra la barra del lettore, così non copre «Fatto» */
.app:has(.fl-read .rd-bar) .toasts { bottom: calc(108px + var(--sab)); }
/* Con un pannello aperto il toast si centra nello spazio che resta a sinistra */
.app:has(.layer-drawer) .toasts { right: min(400px, 100%); }

@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; translate: 0 -6px; } }
@keyframes toast-in { from { opacity: 0; translate: 0 8px; } }
@keyframes from-right { from { translate: 100% 0; } }
@keyframes from-below { from { translate: 0 100%; } }
@keyframes cb-pop { 0% { scale: .8; } 60% { scale: 1.15; } 100% { scale: 1; } }
@keyframes row-out { to { opacity: 0; translate: 40px 0; } }

/* ---------- Classi di supporto per dimensione ---------- */
.app .phone-only { display: none !important; }

/* ---------- Barra a icone: tablet, oppure compressa con [ ---------- */
@container app (max-width: 1099px) {
  .sidebar { width: calc(60px + var(--sal)); padding: calc(14px + var(--sat)) 8px 12px calc(8px + var(--sal)); align-items: center; }
  .sidebar .nl, .sources .lbl { display: none; }
  .brand { padding: 0; justify-content: center; }
  .nav-i { width: 40px; justify-content: center; padding: 0; }
  .nav-i .count { position: absolute; right: -2px; top: -2px; font-size: 9.5px; padding: 2px 4px; border-radius: 999px; background: var(--surface-3); color: var(--text); line-height: 1; }
  .src-row { width: 40px; justify-content: center; padding: 0; }
  .src-row .sdot { margin: 0; }
  .side-pill, .whoami { width: 40px; justify-content: center; padding: 0; }
  .search { flex: 0 0 32px; min-width: 0; width: 32px; padding: 0; justify-content: center; background: none; border: 0; }
  .s-txt, .s-k { display: none; }
  .meet { display: none; }
  .og-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .og-agenda { grid-row: span 2; }
  .vi-grid { grid-template-columns: 1fr 1fr; }
  .hud { left: 76px; max-width: calc(100% - 92px); }
  /* Flusso: la lettura si apre come pannello sopra l'elenco */
  .fl-body { position: relative; grid-template-columns: minmax(0, 1fr); }
  .fl-list { border-right: 0; }
  .fl-scrim.open { display: block; position: absolute; inset: 0; z-index: 44; background: var(--overlay); }
  .fl-read { position: absolute; top: 0; right: 0; bottom: 0; z-index: 45; width: min(640px, calc(100% - 48px)); border-left: 1px solid var(--border); box-shadow: var(--shadow-pop);
    visibility: hidden; translate: 100% 0; }
  .fl-read.open { visibility: visible; translate: 0 0; }
  .fl-read.open.enter { animation: from-right .2s ease-out; }
  .rd-back { display: inline-flex; align-items: center; gap: 2px; height: 28px; margin-left: -4px; font-weight: 500; color: var(--accent); }
}
.app.collapsed .sidebar { width: 60px; padding: calc(14px + var(--sat)) 8px 12px; align-items: center; }
.app.collapsed .sidebar .nl, .app.collapsed .sources .lbl { display: none; }
.app.collapsed .brand { padding: 0; justify-content: center; }
.app.collapsed .nav-i { width: 40px; justify-content: center; padding: 0; }
.app.collapsed .nav-i .count { position: absolute; right: -2px; top: -2px; font-size: 9.5px; padding: 2px 4px; border-radius: 999px; background: var(--surface-3); color: var(--text); line-height: 1; }
.app.collapsed .nav-i .count.red { background: var(--danger); color: var(--on-danger); }
.app.collapsed .src-row { width: 40px; justify-content: center; padding: 0; }
.app.collapsed .src-row .sdot { margin: 0; }
.app.collapsed .side-pill, .app.collapsed .whoami { width: 40px; justify-content: center; padding: 0; }
.app.collapsed .hud { left: 76px; max-width: calc(100% - 92px); }
@container app (max-width: 1599px) { .meet-w { display: none; } }
@container app (max-width: 1199px) { .meet-t { display: none; } }

/* ---------- Telefono ---------- */
@container app (max-width: 759px) {
  .app .phone-only { display: revert !important; }
  .app .desk-only { display: none !important; }
  .shell { flex-direction: column; font-size: 14px; }
  .sidebar { display: none; }
  .topbar { padding: var(--sat) var(--gr) 0 var(--gl); gap: 10px; }
  .brand-mini { display: block; }
  .tb-h { font-size: 17px; }
  .tb-title .sub, .clock, .theme-btn, .meet, .demo-pill { display: none; }
  .tb-demo { display: block; margin-top: 1px; font: 500 10.5px/1.2 var(--f-mono); letter-spacing: .02em; color: var(--muted); white-space: nowrap; }
  .search { order: 3; flex: 0 0 40px; width: 40px; height: 40px; }
  .app .seg.ctx button { padding: 0 8px; font-size: 12px; gap: 4px; }
  .seg.ctx .cdot { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); height: calc(64px + var(--sab)); flex: none; background: var(--surface); border-top: 1px solid var(--border);
    padding: 0 var(--gr) var(--sab) var(--gl); }
  .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--muted); font-weight: 500; }
  .tab.active { color: var(--text); }
  .tab-i { position: relative; width: 24px; height: 24px; display: grid; place-items: center; }
  .tab.active .tab-i { color: var(--accent); }
  .tab-i .i { width: 20px; height: 20px; }
  .tbadge { position: absolute; top: -4px; left: 15px; font-size: 9.5px; line-height: 1; padding: 2px 4px; border-radius: 999px; background: var(--surface-3); color: var(--text); }
  .tbadge.red { background: var(--danger); color: var(--on-danger); }
  .fab { display: grid; place-items: center; position: absolute; right: var(--gr); bottom: calc(80px + var(--sab)); width: 56px; height: 56px; border-radius: 50%;
    background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-pop); z-index: 20; }
  .fab .i { width: 22px; height: 22px; stroke-width: 2; }
  .app:has(.toast) .fab { translate: 0 -64px; }     /* il + sale sopra al toast */
  .page { padding: 16px var(--gr) 96px var(--gl); }
  .card { padding: 14px; }
  /* bersagli al tocco di almeno 40px; la casella resta piccola, ma si tocca un quadrato di 40px */
  .app .seg button, .fchip { min-height: 40px; }
  .ib, .rd-back { min-width: 40px; min-height: 40px; }
  .li-row { min-height: 44px; }
  .t-row .btn.small, .t-sec-t, .dr-sec .more { min-height: 40px; }
  .cb { position: relative; }
  .cb::after { content: ""; position: absolute; inset: -11px; }
  .app input, .app textarea { font-size: 16px; }   /* 16px: iOS non ingrandisce la pagina quando tocchi un campo */
  /* Oggi */
  .og-head { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 14px; }
  .serif-date { font-size: 28px; }
  .punto { font-size: 14.5px; }
  .og-day { display: none; }
  .oriz { display: none; }
  .og-grid { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
  .og-col { display: contents; }
  .adesso { order: 1; } .og-turni { order: 2; } .og-next { order: 3; } .og-prio { order: 4; } .og-agenda { order: 5; } .og-vita { order: 6; } .og-flusso { order: 7; }
  .og-next.phone-only { display: block !important; }
  .task-row, .vt-row, .nx-row, .fc-row { min-height: 44px; }
  /* Flusso: la lettura è una pagina intera con «‹ Flusso» */
  .fl-bar { padding: 8px var(--gr) 8px var(--gl); gap: 8px; }
  .fl-bar .seg { width: 100%; }
  .fl-bar .seg button { flex: 1; justify-content: center; padding: 0 6px; }
  .fl-bar .filter, .fl-zero { display: none; }
  .fl-row { height: auto; min-height: 60px; flex-wrap: wrap; align-content: center; row-gap: 2px; padding: 8px var(--gr) 8px 16px; }
  .fr-from { flex: 1; width: auto; order: 1; }
  .fr-time { order: 2; }
  .fl-row .tile { order: 0; }
  .fr-main { order: 3; flex-basis: calc(100% - 28px); margin-left: 28px; }
  .fr-prev { display: none; }
  .fr-main .fr-subj:empty + .fr-prev, .fr-main > .fr-prev:only-child { display: inline; }
  .fr-chips { order: 4; margin-left: 28px; }
  .fl-hint { display: none; }
  .fl-list { padding-bottom: 96px; }   /* spazio per il + */
  .fl-body { position: static; }
  .fl-scrim.open { display: none; }
  .fl-read { inset: 0; width: auto; border-left: 0; box-shadow: none; }
  .rd-head { padding: calc(10px + var(--sat)) var(--gr) 12px var(--gl); }
  .rd-back { height: 32px; font-size: 14px; }
  .rd-back .i { width: 18px; height: 18px; }
  .rd-title { font-size: 18px; }
  .rd-body { padding: 14px var(--gr) 16px var(--gl); }
  .mail { font-size: 15px; }
  .bub { max-width: 94%; }
  .rd-bar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; padding: 6px var(--gr) calc(8px + var(--sab)) var(--gl); }
  .rb { flex-direction: column; height: 52px; gap: 3px; border: 0; padding: 0; font-size: 11px; justify-content: center; }
  .rb .i { width: 20px; height: 20px; color: var(--text); }
  .rb kbd { display: none; }
  .rb.phone-only { display: flex !important; }
  /* Agenda */
  .view[data-route="agenda"] { overflow-y: auto; }
  .ag { display: block; height: auto; }
  .ag-rail, .ag-bar { display: none; }
  .ag-main { background: var(--bg); display: block; }
  .agp { padding-bottom: 96px; }
  .agp.phone-only { display: block !important; }
  /* Attività */
  .ta { display: block; }
  .ta-rail { display: none; }
  .ta-main { padding: 14px var(--gr) 96px var(--gl); }
  .ta-phone-pick.phone-only { display: block !important; }
  .ta-head { align-items: flex-start; }
  .ta-head h2 { font-size: 18px; }
  .ta-head h2 .muted { display: block; font-size: 13px; margin-top: 2px; }
  .ta-head h2 .sep, .ta-add kbd { display: none; }
  .t-row { align-items: flex-start; padding: 10px 0; }
  .t-row .cb { margin-top: 1px; }
  .t-main { flex-direction: column; align-items: stretch; gap: 6px; }
  .t-title { white-space: normal; }
  .t-chips { flex-wrap: wrap; }
  .t-chips .chip.origin { display: none; }
  /* Vita */
  .vi-grid { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
  .vi-col { display: contents; }
  .vi-tonight { order: 1; } .vi-bills { order: 2; } .vi-gmail { order: 3; } .vi-week { order: 4; } .vi-lists { order: 5; } .vi-notes { order: 6; } .vi-stacc { order: 7; }
  .vi-tonight.phone-only { display: block !important; }
  /* Livelli come fogli dal basso, con la maniglia */
  .grip { display: block; flex: none; width: 36px; height: 4px; margin: 0 auto; padding: 8px 40px 10px; box-sizing: content-box; border-radius: 2px;
    background: var(--border-strong); background-clip: content-box; touch-action: none; cursor: grab; }
  .drawer { top: auto; left: 0; width: 100%; height: 90%; border-left: 0; border-radius: 16px 16px 0 0; }
  .layer.enter .drawer { animation-name: from-below; }
  .dr-head { padding: 0 var(--gr) 12px var(--gl); }
  .dr-body { padding: 14px var(--gr) 16px var(--gl); }
  .dr-foot { padding: 10px var(--gr) calc(12px + var(--sab)) var(--gl); }
  .dr-foot .btn { height: 44px; }
  .pill { height: 36px; padding: 0 14px; font-size: 14px; }
  .scrim.clear { background: var(--overlay); }
  .popover { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100% !important; max-width: none; transform: none; border: 0; border-radius: 16px 16px 0 0;
    padding: 0 var(--gr) calc(12px + var(--sab)) var(--gl); }
  .layer.enter .popover { animation: from-below .2s ease-out; }
  .pop-opt { min-height: 48px; font-size: 15px; }
  .modal { left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-height: 90%; transform: none; border: 0; border-radius: 16px 16px 0 0;
    padding: 0 var(--gr) calc(20px + var(--sab)) var(--gl); }
  .layer.enter .modal { animation: from-below .2s ease-out; }
  .help-h { padding: 4px 0 10px; }
  .help-b { grid-template-columns: 1fr; padding: 0 0 8px; }
  .help-f { padding: 8px 0 0; }
  .sheet .btn { height: 44px; }
  .palette { left: 0; right: 0; top: 0; bottom: 0; width: 100%; transform: none; border: 0; border-radius: 0; padding-top: var(--sat); }
  .layer.enter .palette { animation: fade-in .14s ease-out; }
  .pal-in { padding: 0 var(--gr) 0 var(--gl); }
  .pal-res { max-height: none; flex: 1; }
  .pal-r { height: 48px; font-size: 15px; }
  .app .pal-x.phone-only { display: inline-flex !important; align-items: center; height: 40px; color: var(--accent); font-weight: 500; font-size: 15px; }
  .pal-foot { display: none; }
  .hud { left: var(--gl); max-width: calc(100% - 32px); bottom: calc(80px + var(--sab)); }
  .toasts, .app:has(.fl-read .rd-bar) .toasts { bottom: calc(76px + var(--sab)); }
  /* con un foglio aperto il toast va in alto, così non copre le opzioni */
  .app:has(.layer:not(.layer-pal)) .toasts { top: calc(12px + var(--sat)); bottom: auto; right: 0; }
}
@media (prefers-reduced-motion: reduce) { .app *, .app *::before, .app *::after { transition: none !important; animation: none !important; } }
