:root {
  --bg: #F3F4F6;
  --card: #FFFFFF;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6B7280;
  --line: #E5E7EB;
  --line-2: #EEF0F3;
  --soft: #F5F6F8;
  --violet: #4B3FD1;
  --violet-dark: #3A2FB8;
  --violet-soft: #ECEBFC;
  --violet-ink: #2E2790;
  --green: #15803D;
  --green-btn: #1F9D55;
  --green-soft: #E7F5EC;
  --green-ink: #166534;
  --warm-soft: #F8ECE6;
  --warm-ink: #9A3412;
  --orange: #D97706;
  --orange-ink: #9A5B07;
  --orange-soft: #FDF4E3;
  --amber-line: #F3D9A4;
  --dark: #17181C;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 1px 1px rgba(17, 24, 39, .02);
  --shadow-hover: 0 10px 28px rgba(17, 24, 39, .08), 0 2px 6px rgba(17, 24, 39, .04);
  --ease: cubic-bezier(.22, .8, .24, 1);
  --top: 76px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top) + 12px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ── Barra in alto: niente sfondo bianco, sempre visibile ── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: 1480px; margin: 0 auto;
  height: var(--top);
  padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-line { width: 1px; height: 30px; background: #D1D5DB; flex: none; }
.brand h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.notif-btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 13.5px;
  transition: transform .15s var(--ease), box-shadow .2s, background .2s;
}
.notif-btn:hover { box-shadow: var(--shadow-hover); }
.notif-btn:active { transform: scale(.96); }
.notif-btn.on { color: var(--green-ink); background: var(--green-soft); border-color: transparent; }
.notif-btn svg { flex: none; }

/* ── Griglia a tre colonne ── */
.layout {
  max-width: 1480px; margin: 0 auto;
  padding: 8px 32px 48px;
  display: grid;
  grid-template-columns: 340px minmax(330px, 1fr) minmax(440px, 1.4fr);
  gap: 28px;
  align-items: start;
}
.col-left, .col-center {
  position: sticky;
  top: calc(var(--top) + env(safe-area-inset-top) + 8px);
  max-height: calc(100vh - var(--top) - 24px);
  overflow-y: auto;
  scrollbar-width: none;
  padding-bottom: 8px;
}
.col-left::-webkit-scrollbar, .col-center::-webkit-scrollbar { display: none; }
.col-left { display: flex; flex-direction: column; gap: 22px; }
.col-left > * { flex: none; }
.col-right { min-width: 0; scroll-margin-top: calc(var(--top) + 12px); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ── Calendario ── */
.calendar { padding: 22px 22px 18px; overflow: hidden; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cal-head h2 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card);
  display: grid; place-items: center;
  transition: transform .15s var(--ease), background .2s, box-shadow .2s;
}
.icon-btn:hover { background: var(--soft); }
.icon-btn:active { transform: scale(.92); }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.cal-week span { font-size: 12.5px; font-weight: 600; color: var(--muted); padding-bottom: 8px; }
.cal-grid-wrap { position: relative; }
.cal-grid { row-gap: 4px; }
.cal-grid.slide-next { animation: slideNext .38s var(--ease); }
.cal-grid.slide-prev { animation: slidePrev .38s var(--ease); }
@keyframes slideNext { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slidePrev { from { transform: translateX(-40px); opacity: 0; } to { transform: none; opacity: 1; } }
.day {
  position: relative;
  height: 44px; margin: 0 auto; width: 40px;
  border: 0; background: transparent; border-radius: 12px;
  font-size: 14.5px; font-weight: 500; color: var(--ink-2);
  transition: background .18s, color .18s, transform .15s var(--ease);
}
.day:hover { background: var(--soft); }
.day:active { transform: scale(.9); }
.day.today { font-weight: 800; color: var(--ink); }
.day.sel { background: var(--violet); color: #fff; font-weight: 800; box-shadow: 0 6px 16px rgba(75, 63, 209, .28); }
.day .dots { position: absolute; left: 0; right: 0; bottom: 5px; display: flex; justify-content: center; gap: 3px; }
.day .dot { width: 5px; height: 5px; border-radius: 50%; }
.dot.ev { background: var(--violet); }
.dot.dl { background: var(--orange); }
.day.sel .dot.ev { background: #fff; }
.day.sel .dot.dl { background: #FFD08A; }
.cal-legend { display: flex; gap: 18px; border-top: 1px solid var(--line-2); margin-top: 12px; padding-top: 12px; font-size: 13px; color: var(--ink-2); }
.cal-legend span { display: inline-flex; align-items: center; gap: 7px; }

/* ── Scadenze ── */
.deadlines { padding: 22px 20px 20px; }
.dl-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin: 0 2px 14px; }
.dl-head h2 { margin: 0; font-size: 17px; font-weight: 800; line-height: 1.25; }
.dl-head small { color: var(--muted); font-size: 12.5px; text-align: right; line-height: 1.3; padding-top: 2px; }
.last-card {
  background: var(--dark); color: #fff; border-radius: 16px;
  padding: 14px 16px; margin-bottom: 8px; cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s;
}
.last-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, .18); }
.last-top { display: flex; justify-content: space-between; font-size: 12px; color: #A1A1AA; margin-bottom: 4px; }
.last-card strong { display: block; font-size: 14.5px; line-height: 1.3; }
.last-card span.sub { font-size: 13px; color: #D4D4D8; }
.dl-item {
  display: grid; grid-template-columns: 12px 1fr; gap: 10px;
  width: 100%; text-align: left; border: 0; background: transparent;
  padding: 12px 6px; border-radius: 12px;
  transition: background .18s, transform .15s var(--ease);
}
.dl-item:hover { background: var(--soft); }
.dl-item:active { transform: scale(.98); }
.dl-item .dot { width: 9px; height: 9px; margin-top: 6px; background: var(--orange); border-radius: 50%; }
.dl-item b { display: block; font-size: 14.5px; font-weight: 700; }
.dl-item .c { display: block; font-size: 13px; color: var(--muted); }
.dl-item .n { display: block; font-size: 13px; color: var(--orange-ink); font-weight: 700; }
.dl-empty { padding: 10px 6px; font-size: 13.5px; color: var(--muted); }

/* ── Colonna centrale ── */
.day-title { margin: 6px 0 2px; font-size: 32px; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; }
.day-sub { margin: 0 0 18px; color: var(--muted); font-size: 15px; }
.ev-list { display: flex; flex-direction: column; gap: 14px; }
.ev-card {
  display: block; width: 100%; text-align: left;
  padding: 18px 20px 16px;
  border: 1px solid var(--line); border-radius: 20px; background: var(--card);
  box-shadow: var(--shadow);
  transition: transform .22s var(--ease), box-shadow .22s, border-color .2s;
  animation: fadeUp .4s var(--ease) both;
}
.ev-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.ev-card:active { transform: translateY(-1px) scale(.99); }
.ev-card.sel { border: 2px solid var(--violet); padding: 17px 19px 15px; }
.ev-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ev-top h3 { margin: 0; font-size: 17.5px; font-weight: 800; letter-spacing: -.01em; line-height: 1.3; }
.chip { flex: none; background: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.ev-meta { margin: 6px 0 10px; color: var(--ink-2); font-size: 14px; display: flex; flex-wrap: wrap; column-gap: 18px; row-gap: 2px; }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.pill.green { background: var(--green-soft); color: var(--green-ink); }
.pill.orange { background: var(--orange-soft); color: var(--orange-ink); }
.pill.grey { background: var(--soft); color: var(--muted); }
.pill.warm { background: #F1F2F4; color: var(--ink-2); }
.progress { height: 6px; background: var(--line-2); border-radius: 999px; margin: 14px 0 8px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--green-btn); border-radius: 999px; transition: width .6s var(--ease); }
.ev-foot { font-size: 13.5px; color: var(--muted); }
.day-empty { padding: 26px 22px; text-align: center; color: var(--muted); border: 1px dashed #D5D8DE; border-radius: 20px; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── Pannello di destra ── */
.panel { overflow: hidden; }
.panel.enter { animation: panelIn .45s var(--ease); }
@keyframes panelIn { from { opacity: 0; transform: translateX(36px); } to { opacity: 1; transform: none; } }
.panel-empty { padding: 48px 32px; text-align: center; }
.empty-illu { width: 76px; height: 76px; border-radius: 22px; background: var(--violet-soft); color: var(--violet); display: grid; place-items: center; margin: 0 auto 14px; }
.empty-title { margin: 0 0 4px; font-size: 18px; font-weight: 800; }
.p-head { padding: 26px 30px 22px; border-bottom: 1px solid var(--line-2); }
.p-kicker { font-size: 13px; color: var(--muted); }
.p-head h2 { margin: 2px 0 14px; font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; margin-bottom: 16px; }
.info-grid div span { display: block; font-size: 13px; color: var(--muted); }
.info-grid div b { font-weight: 600; font-size: 15px; }
.info-grid .wide { grid-column: 1 / -1; }
.status-box { border-radius: 16px; padding: 12px 16px; font-size: 14px; line-height: 1.45; }
.status-box b { display: block; font-weight: 800; }
.status-box.closed { background: var(--green-soft); color: var(--green-ink); }
.status-box.open { background: var(--orange-soft); color: var(--orange-ink); }
.status-box.none { background: var(--soft); color: var(--muted); }
.p-links { display: flex; gap: 16px; margin-top: 12px; font-size: 13px; }
.p-links a { color: var(--muted); text-decoration: none; font-weight: 600; }
.p-links a:hover { color: var(--violet); }

.tabs-wrap { padding: 18px 30px; border-bottom: 1px solid var(--line-2); }
.tabs { position: relative; display: grid; grid-template-columns: 1fr 1fr; background: #EEF0F3; border-radius: 16px; padding: 5px; }
.tab-ind { position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc(50% - 5px); background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(17, 24, 39, .1); transition: transform .35s var(--ease); }
.tabs[data-tab="mail"] .tab-ind { transform: translateX(100%); }
.tab { position: relative; z-index: 1; border: 0; background: transparent; padding: 11px 10px; border-radius: 12px; font-weight: 700; font-size: 15px; color: var(--muted); transition: color .25s; }
.tab.on { color: var(--ink); }
.tab:active { transform: scale(.97); }

.tab-body { animation: fadeIn .35s var(--ease); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 20px 30px; border-bottom: 1px solid var(--line-2); }
.stat { border-radius: 16px; padding: 12px 16px; }
.stat span { display: block; font-size: 13.5px; }
.stat b { display: block; font-size: 28px; font-weight: 800; line-height: 1.15; }
.stat.g { background: var(--green-soft); color: var(--green-ink); }
.stat.w { background: var(--warm-soft); color: var(--warm-ink); }
.stat.n { background: #F1F2F4; color: var(--ink); }
.stat.n span { color: var(--muted); }

.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 20px 30px 6px; }
.sec-head h3 { margin: 0; font-size: 17px; font-weight: 800; }
.sec-head small { color: var(--muted); font-size: 13px; }

.people { padding: 0 30px 8px; }
.person { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line-2); animation: fadeUp .35s var(--ease) both; }
.person:last-child { border-bottom: 0; }
.check { position: relative; width: 22px; height: 22px; }
.check input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.check span { position: absolute; inset: 0; border: 1.5px solid #9CA3AF; border-radius: 6px; background: #fff; transition: background .18s, border-color .18s, transform .15s var(--ease); pointer-events: none; }
.check input:checked + span { background: var(--violet); border-color: var(--violet); }
.check input:checked + span::after { content: ''; position: absolute; left: 6.5px; top: 2.5px; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.4px 2.4px 0; transform: rotate(45deg); }
.check input:active + span { transform: scale(.88); }
.check input:focus-visible + span { box-shadow: 0 0 0 3px rgba(75, 63, 209, .3); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--violet-soft); color: var(--violet); font-weight: 800; font-size: 14px; display: grid; place-items: center; }
.p-name { min-width: 0; }
.p-name b { display: block; font-size: 15px; font-weight: 700; }
.p-name small { display: block; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-name small.miss { color: var(--orange-ink); }
.plus { display: inline-block; background: var(--violet-soft); color: var(--violet); border-radius: 8px; font-size: 12px; font-weight: 800; padding: 1px 7px; margin-left: 6px; vertical-align: 1px; }
.p-right { display: flex; align-items: center; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }
.rub { font-size: 13px; font-weight: 600; }
.rub.ok { color: var(--green); }
.rub.ko { color: var(--orange-ink); }

.prep { padding: 14px 30px 22px; border-bottom: 1px solid var(--line-2); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 13px; padding: 12px 18px;
  font-weight: 700; font-size: 15px; text-decoration: none;
  transition: transform .15s var(--ease), box-shadow .2s, background .2s, filter .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.96); }
.btn-block { width: 100%; }
.btn-primary { background: var(--violet); color: #fff; box-shadow: 0 6px 16px rgba(75, 63, 209, .25); padding: 14px 18px; font-size: 16px; }
.btn-primary:hover { background: var(--violet-dark); }
.btn-dark { background: #17181C; color: #fff; }
.btn-dark:hover { filter: brightness(1.2); }
.btn-wa { background: var(--green-btn); color: #fff; }
.btn-wa:hover { filter: brightness(1.06); }
.btn-wa-out { background: #fff; color: var(--green-ink); border: 1.5px solid var(--green-btn); padding: 10.5px 16.5px; }
.btn-wa-out:hover { background: var(--green-soft); }
.btn-sm { padding: 9px 14px; font-size: 14px; border-radius: 11px; }
.btn[disabled] { opacity: .55; pointer-events: none; }

.msgs { background: #F8F9FA; padding: 8px 30px 28px; }
.grp { margin: 20px 0 10px; font-size: 17px; font-weight: 800; }
.grp.g { color: var(--green-ink); }
.grp.w { color: var(--warm-ink); }
.msg { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px 18px; margin-bottom: 12px; animation: fadeUp .45s var(--ease) both; transition: box-shadow .2s, transform .2s var(--ease); }
.msg:hover { box-shadow: var(--shadow-hover); }
.msg-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.msg-top b { font-size: 15.5px; }
.msg-top small { font-size: 13px; color: var(--muted); white-space: nowrap; }
.msg-top small.ko { color: var(--orange-ink); font-weight: 700; }
.msg p { margin: 0 0 14px; white-space: pre-line; font-size: 15px; line-height: 1.65; color: var(--ink); }
.msg-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sent { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 700; color: var(--green-ink); animation: fadeIn .3s; }

.need { background: #FFF8EC; border: 1px solid var(--amber-line); border-radius: 16px; padding: 14px 16px; }
.need p { margin: 0 0 10px; font-size: 13.5px; color: var(--orange-ink); line-height: 1.45; white-space: normal; }
.need label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.need-row { display: flex; gap: 10px; }
.need-row + .need-row { margin-top: 8px; }
.inp { flex: 1; min-width: 0; height: 46px; padding: 0 14px; border: 1px solid #D5D8DE; border-radius: 12px; background: #fff; font-size: 15.5px; transition: border-color .2s, box-shadow .2s; }
.inp:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(75, 63, 209, .15); }
.tick { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); margin-top: 10px; cursor: pointer; }
.tick input { width: 17px; height: 17px; accent-color: var(--violet); }

/* ── Mail al brand ── */
.mail { padding: 22px 30px 28px; }
.mail h3 { margin: 0; font-size: 19px; font-weight: 800; }
.mail > p { margin: 2px 0 16px; color: var(--muted); }
.seg { position: relative; display: inline-grid; grid-auto-flow: column; background: #EEF0F3; border-radius: 14px; padding: 4px; margin-bottom: 16px; }
.seg button { position: relative; z-index: 1; border: 0; background: transparent; padding: 9px 16px; border-radius: 10px; font-weight: 700; font-size: 14.5px; color: var(--muted); transition: color .2s; }
.seg button.on { color: var(--ink); }
.seg .seg-ind { position: absolute; top: 4px; bottom: 4px; left: 4px; background: #fff; border-radius: 10px; box-shadow: 0 1px 3px rgba(17, 24, 39, .1); transition: transform .3s var(--ease), width .3s var(--ease); }
.preview { border: 1px solid var(--line); border-radius: 18px; background: #FAFAFB; padding: 18px 22px 20px; }
.pv-head { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.pv-intro { margin: 0 0 6px; font-size: 15.5px; }
.pv-item { display: grid; grid-template-columns: 30px 1fr; padding: 12px 0; border-top: 1px solid var(--line-2); animation: fadeUp .35s var(--ease) both; }
.pv-item > span { color: var(--muted); font-weight: 600; padding-top: 1px; }
.pv-item b { font-size: 15.5px; }
.pv-links { display: flex; flex-wrap: wrap; column-gap: 18px; row-gap: 2px; margin-top: 2px; }
.pv-links a { color: var(--violet); font-size: 14.5px; word-break: break-all; }
.pv-links .gap { color: var(--orange-ink); font-size: 13.5px; font-weight: 600; }
.pv-item .need { margin-top: 10px; }
.pv-end { margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--line-2); font-size: 15.5px; line-height: 1.6; }
.mail-actions { margin-top: 16px; }

.panel-loading { padding: 30px; }
.sk { background: linear-gradient(90deg, #EEF0F3 25%, #F6F7F9 37%, #EEF0F3 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 10px; height: 14px; margin-bottom: 12px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.err-box { margin: 24px 30px; padding: 14px 16px; border-radius: 14px; background: #FEF2F2; color: #991B1B; font-size: 14px; }

/* ── Accesso, avvisi, toast ── */
.login { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 24px; padding: 30px 26px; text-align: center; animation: fadeUp .4s var(--ease); }
.login-icon { border-radius: 16px; margin-bottom: 10px; }
.login-card h2 { margin: 0 0 6px; font-size: 21px; font-weight: 800; }
.login-card p { font-size: 14px; margin: 0 0 18px; }
.login-card input { width: 100%; height: 52px; text-align: center; font-size: 22px; letter-spacing: .3em; font-weight: 700; border: 1px solid #D5D8DE; border-radius: 14px; margin-bottom: 12px; }
.login-card input:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(75, 63, 209, .15); }
.login-err { color: #B91C1C; font-size: 13.5px; margin: -4px 0 10px !important; }

.modal { position: fixed; inset: 0; z-index: 70; background: rgba(17, 24, 39, .4); display: grid; place-items: center; padding: 20px; animation: fadeIn .2s; }
.modal-card { width: 100%; max-width: 420px; background: #fff; border-radius: 22px; padding: 24px; animation: fadeUp .3s var(--ease); }
.modal-card h3 { margin: 0 0 8px; font-size: 19px; }
.modal-card ol { padding-left: 20px; margin: 0 0 18px; line-height: 1.6; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 90; background: #17181C; color: #fff; border-radius: 14px; padding: 12px 18px; font-weight: 600; font-size: 14.5px; max-width: calc(100vw - 32px); transition: opacity .25s, transform .3s var(--ease); box-shadow: 0 12px 30px rgba(0, 0, 0, .2); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #991B1B; }

/* ── Schermi medi ── */
@media (max-width: 1240px) {
  .layout { grid-template-columns: 300px minmax(280px, 1fr) minmax(400px, 1.3fr); gap: 20px; padding-left: 20px; padding-right: 20px; }
  .topbar-inner { padding: 0 20px; }
  .p-head, .tabs-wrap, .stats, .sec-head, .people, .prep, .msgs, .mail { padding-left: 22px; padding-right: 22px; }
  .day-title { font-size: 28px; }
}

/* ── Telefono: una colonna a tutta larghezza ── */
@media (max-width: 960px) {
  :root { --top: 60px; }
  .topbar-inner { padding: 0 16px; gap: 10px; }
  .brand { gap: 12px; }
  .brand-logo { height: 28px; }
  .brand-line { height: 24px; }
  .brand h1 { font-size: 18.5px; }
  .notif-btn .lbl { display: none; }
  .notif-btn { padding: 9px; }
  .layout { grid-template-columns: 1fr; padding: 4px 16px 40px; gap: 18px; }
  .col-left, .col-center { position: static; max-height: none; overflow: visible; padding-bottom: 0; }
  .col-left { gap: 18px; }
  .calendar { padding: 18px 16px 16px; }
  .day { width: 100%; max-width: 48px; height: 50px; font-size: 16px; }
  .day .dot { width: 6px; height: 6px; }
  .day-title { font-size: 28px; margin-top: 4px; }
  .p-head { padding: 22px 20px 18px; }
  .p-head h2 { font-size: 24px; }
  .tabs-wrap, .stats, .sec-head, .people, .prep, .msgs, .mail { padding-left: 20px; padding-right: 20px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat.n { grid-column: 1 / -1; }
  .person { grid-template-columns: auto auto 1fr; row-gap: 6px; }
  .p-right { grid-column: 3; justify-content: flex-start; gap: 8px; }
  .tab { font-size: 14px; padding: 10px 6px; }
  .need-row { flex-direction: column; }
  .need-row .btn { align-self: flex-start; }
  .msg-actions .btn { flex: 0 0 auto; }
  .ev-card:hover, .msg:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
