@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/atkinson-hyperlegible-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fonts/atkinson-hyperlegible-latin-700-normal.woff2) format('woff2'); }

/* Layout: un calendario da muro in tasca — intestazione fissa, giorni come fogli
   di calendario con gli impegni sotto, un solo grande bottone in basso. */
:root {
  --bg: #F2F4F7;
  --surface: #FFFFFF;
  --surface-2: #E8ECF2;
  --ink: #16213A;
  --ink-2: #4B5670;
  --line: #D3D9E3;
  --primary: #16213A;
  --on-primary: #FFFFFF;
  --red: #C62F2F;
  --warn-bg: #FFF2CC;
  --warn-ink: #5C4100;
  --focus: #2563C9;
  --scrim: rgb(10 16 30 / .45);
  --shadow: 0 1px 2px rgb(22 33 58 / .06), 0 6px 18px rgb(22 33 58 / .07);
  --font: 'Atkinson Hyperlegible', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --r: 18px;
  --r-sm: 12px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  padding-top: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1420; --surface: #18202F; --surface-2: #222C3D; --ink: #EEF2F8; --ink-2: #AEB8C9;
    --line: #2C3749; --primary: #EEF2F8; --on-primary: #0E1420; --red: #FF7468;
    --warn-bg: #3B2F0B; --warn-ink: #FFE09A; --focus: #7FA8FF; --scrim: rgb(0 0 0 / .6);
    --shadow: 0 1px 2px rgb(0 0 0 / .3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1420; --surface: #18202F; --surface-2: #222C3D; --ink: #EEF2F8; --ink-2: #AEB8C9;
  --line: #2C3749; --primary: #EEF2F8; --on-primary: #0E1420; --red: #FF7468;
  --warn-bg: #3B2F0B; --warn-ink: #FFE09A; --focus: #7FA8FF; --scrim: rgb(0 0 0 / .6);
  --shadow: 0 1px 2px rgb(0 0 0 / .3); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 19px; line-height: 1.4; -webkit-tap-highlight-color: transparent;
}
body.locked { overflow: hidden; }
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 30; background: var(--bg);
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.wrap { padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.inner { max-width: 640px; margin: 0 auto; }
svg { flex: none; }

/* Intestazione */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg);
  padding-block: 14px 10px; border-bottom: 1px solid var(--line); }
.topbar .inner { display: grid; gap: 12px; }
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand h1 { margin: 0; font-size: 30px; line-height: 1.1; letter-spacing: -.01em; }
.brand p { margin: 2px 0 0; color: var(--ink-2); font-size: 17px; }
.icon-btn { width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center; color: var(--ink); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 14px; padding: 4px; }
.seg button { border: 0; background: transparent; padding: 12px 8px; border-radius: 11px; font-weight: 700;
  font-size: 18px; color: var(--ink-2); min-height: 50px; }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 8px; border: 2px solid var(--line);
  background: var(--surface); border-radius: 999px; padding: 8px 16px; font-size: 17px; font-weight: 700; min-height: 46px; }
.chip .dot { width: 14px; height: 14px; }
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--pc); flex: none; }

.demo-banner { background: var(--warn-bg); color: var(--warn-ink); font-size: 16px; padding-block: 10px; }

/* Contenuto */
.content { padding-block: 16px calc(120px + env(safe-area-inset-bottom, 0px)); }
.content .inner { display: grid; gap: 22px; }

.day { display: grid; gap: 10px; }
.day-head { display: flex; align-items: center; gap: 14px; }
.sheet { width: 62px; flex: none; border-radius: 12px; overflow: hidden; background: var(--surface);
  border: 1px solid var(--line); text-align: center; display: grid; font-variant-numeric: tabular-nums; }
.sheet-wd { background: var(--ink); color: var(--bg); font-size: 13px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; padding: 3px 0; }
.sheet-n { font-size: 28px; font-weight: 700; line-height: 1.1; padding-top: 4px; }
.sheet-m { font-size: 14px; color: var(--ink-2); padding-bottom: 4px; text-transform: lowercase; }
.sheet.is-sun .sheet-wd { background: var(--red); color: #fff; }
.sheet.is-today { border: 2px solid var(--red); }
.day-meta { min-width: 0; }
.day-rel { font-size: 22px; font-weight: 700; line-height: 1.2; }
.day-rel.is-today { color: var(--red); }
.day-long { color: var(--ink-2); font-size: 17px; }

.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.item { width: 100%; text-align: left; display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 12px;
  align-items: start; background: var(--surface); border: 1px solid var(--line); border-left: 8px solid var(--pc);
  border-radius: var(--r-sm); padding: 14px 14px 14px 12px; box-shadow: var(--shadow); }
.item-time { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; }
.item-time.none { color: var(--ink-2); font-size: 16px; font-weight: 400; padding-top: 4px; }
.item-body { display: grid; gap: 4px; min-width: 0; }
.item-who { display: inline-flex; align-items: center; gap: 7px; font-size: 16px; font-weight: 700; color: var(--ink-2); }
.item-title { font-size: 21px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.item-place { display: flex; gap: 6px; align-items: flex-start; color: var(--ink-2); font-size: 17px; overflow-wrap: anywhere; }
.item-place svg { margin-top: 3px; }

.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); padding: 22px;
  text-align: center; color: var(--ink-2); display: grid; gap: 12px; justify-items: center; }
.empty strong { color: var(--ink); font-size: 21px; }
.past-toggle { justify-self: center; }
.section-label { font-size: 15px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); margin: 6px 0 0; }

/* Calendario */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-head h2 { margin: 0; font-size: 24px; text-align: center; flex: 1; }
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; box-shadow: var(--shadow); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-wd { text-align: center; font-size: 15px; font-weight: 700; color: var(--ink-2); padding: 4px 0 6px; }
.cal-wd.sun { color: var(--red); }
.cell { aspect-ratio: 1 / 1.05; max-width: 100%; border: 0; background: transparent; border-radius: 12px; display: grid;
  grid-template-rows: 1fr auto; justify-items: center; align-items: center; padding: 4px 0 6px;
  font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cell.sun { color: var(--red); }
.cell.today .cell-n { background: var(--red); color: #fff; border-radius: 50%; width: 36px; height: 36px; display: grid; place-items: center; }
.cell.sel { background: var(--surface-2); outline: 2px solid var(--ink); outline-offset: -2px; }
.cell.blank { visibility: hidden; }
.dots { display: flex; gap: 3px; height: 9px; align-items: center; }
.dots .dot { width: 9px; height: 9px; }
.dots .more { font-size: 11px; line-height: 1; color: var(--ink-2); }
.cal-day { display: grid; gap: 10px; }
.cal-day h3 { margin: 0; font-size: 22px; }

/* Bottone in basso */
.bottombar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: linear-gradient(to top, var(--bg) 70%, transparent);
  padding-block: 18px calc(14px + env(safe-area-inset-bottom, 0px)); }

/* Bottoni */
.btn-primary, .btn-secondary, .btn-danger, .btn-danger-outline {
  border-radius: 16px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 12px 20px; font-size: 19px; border: 2px solid transparent; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger-outline { background: transparent; color: var(--red); border-color: var(--red); }
.btn-xl { width: 100%; min-height: 66px; font-size: 22px; border-radius: 18px; }
.btn-link { background: none; border: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 4px;
  font-size: 18px; padding: 12px; min-height: 48px; }
.btn-small { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px 14px; font-weight: 700; font-size: 17px; min-height: 46px; }
button:disabled { opacity: .45; }

/* Schermate a tutto schermo */
.screen { position: fixed; inset: 0; z-index: 40; background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-top: env(safe-area-inset-top, 0px); }
.screen-head { position: sticky; top: 0; z-index: 2; background: var(--bg); border-bottom: 1px solid var(--line); padding-block: 10px; }
.screen-head .inner { display: flex; align-items: center; gap: 8px; }
.screen-head h2 { margin: 0; font-size: 22px; flex: 1; min-width: 0; text-wrap: balance; }
.back { border: 0; background: none; display: inline-flex; align-items: center; gap: 2px; font-size: 19px; font-weight: 700;
  padding: 10px 8px 10px 0; min-height: 52px; color: var(--ink); }
.steps { color: var(--ink-2); font-size: 16px; white-space: nowrap; }
.screen-body { padding-block: 22px calc(40px + env(safe-area-inset-bottom, 0px)); }
.screen-body .inner { display: grid; gap: 20px; }
.lead { font-size: 26px; font-weight: 700; margin: 0; line-height: 1.25; text-wrap: balance; }
.example { margin: 0; color: var(--ink-2); font-size: 18px; }

.who-grid { display: grid; gap: 14px; }
.who { border: 0; border-radius: var(--r); min-height: 84px; background: var(--pc); color: #fff; font-size: 28px; font-weight: 700;
  display: flex; align-items: center; gap: 14px; padding: 0 24px; box-shadow: var(--shadow); }
.who::after { content: "›"; margin-left: auto; font-size: 34px; opacity: .8; }

.speak { display: grid; gap: 14px; justify-items: center; text-align: center; }
.speak .lead, .speak .example { justify-self: stretch; text-align: left; }
.mic { width: 148px; height: 148px; border-radius: 50%; border: 0; background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center; position: relative; margin-top: 6px; box-shadow: var(--shadow); }
.mic.on { background: var(--red); color: #fff; }
.mic.on::before { content: ""; position: absolute; inset: -12px; border-radius: 50%; border: 4px solid var(--red); opacity: .5;
  animation: pulse 1.4s ease-out infinite; }
@keyframes pulse { from { transform: scale(.92); opacity: .7; } to { transform: scale(1.12); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .mic.on::before { animation: none; } }
.mic-label { margin: 0; font-size: 22px; font-weight: 700; min-height: 1.4em; }
.speak .field { justify-self: stretch; text-align: left; }

.field { display: grid; gap: 8px; }
.field > label, .field-label { font-weight: 700; font-size: 18px; }
.opt { font-weight: 400; color: var(--ink-2); }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="time"], textarea {
  width: 100%; min-height: 58px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface);
  padding: 12px 14px; font-size: 20px; -webkit-appearance: none; appearance: none; }
input[type="date"], input[type="time"] { display: block; text-align: left; }
input::-webkit-date-and-time-value { text-align: left; }
textarea { resize: vertical; line-height: 1.35; }
input:focus, textarea:focus { border-color: var(--focus); outline: none; }
.field-help { margin: 0; color: var(--ink-2); font-size: 17px; }
.field.missing input { border-color: var(--red); }
.hint { margin: 0; display: flex; gap: 8px; align-items: flex-start; text-align: left; font-size: 18px; color: var(--ink);
  background: var(--surface-2); padding: 12px 14px; border-radius: 12px; justify-self: stretch; }
.heard { margin: 0; color: var(--ink-2); font-size: 18px; font-style: italic; overflow-wrap: anywhere; }
.warn { background: var(--warn-bg); color: var(--warn-ink); border-radius: 12px; padding: 12px 14px; font-size: 18px; font-weight: 700; }
.who-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.who-chip { border: 2px solid var(--pc); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 8px 18px;
  font-size: 19px; font-weight: 700; min-height: 50px; display: inline-flex; align-items: center; gap: 8px; }
.who-chip[aria-pressed="true"] { background: var(--pc); color: #fff; }
.who-chip[aria-pressed="true"] .dot { background: #fff; }
.actions { display: grid; gap: 12px; }

/* Impostazioni */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 14px; }
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.person-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
.person-row:first-child { border-top: 0; }
.person-row .dot { width: 18px; height: 18px; }
.pname { flex: 1; font-weight: 700; font-size: 20px; min-width: 0; overflow-wrap: anywhere; }
.muted { color: var(--ink-2); font-weight: 400; }
.swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.swatch { border: 3px solid transparent; background: var(--pc); border-radius: 14px; min-height: 52px; color: #fff; font-size: 15px; font-weight: 700; }
.swatch[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 3px var(--surface); }
.check { display: flex; gap: 12px; align-items: center; font-size: 18px; }
.check input { width: 26px; height: 26px; accent-color: var(--ink); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
.version { color: var(--ink-2); font-size: 15px; text-align: center; margin: 8px 0 0; }
.section-title { margin: 6px 0 0; font-size: 20px; }
p.note { margin: 0; color: var(--ink-2); font-size: 17px; }

/* Accesso */
.login { min-height: 100%; display: grid; align-content: center; padding-block: 32px; }
.login .inner { display: grid; gap: 16px; width: 100%; max-width: 460px; }
.login img { width: 84px; height: 84px; border-radius: 20px; }
.login h1 { margin: 0; font-size: 30px; }
.login form { display: grid; gap: 14px; }
.error { margin: 0; color: var(--red); font-weight: 700; }

/* Finestra di conferma e avvisi */
.modal { position: fixed; inset: 0; z-index: 60; background: var(--scrim); display: grid; align-items: end;
  padding: 16px var(--gutter-r) calc(16px + env(safe-area-inset-bottom, 0px)) var(--gutter-l); }
.modal-card { background: var(--surface); border-radius: 22px; padding: 22px; display: grid; gap: 18px; max-width: 520px; width: 100%; margin: 0 auto; }
.modal-card p { margin: 0; font-size: 21px; font-weight: 700; line-height: 1.35; }
.toast { position: fixed; left: var(--gutter-l); right: var(--gutter-r); bottom: calc(108px + env(safe-area-inset-bottom, 0px));
  z-index: 70; max-width: 560px; margin: 0 auto; background: var(--ink); color: var(--bg); border-radius: 14px;
  padding: 14px 18px; font-size: 18px; font-weight: 700; box-shadow: var(--shadow); }
