:root {
  --brand: #596D56;
  --brand-dark: #435241;
  --brand-tint: #EBEDEB;
  --brand-text: #435241;
  --field-bg: #FFFFFF;
  --field-border: color-mix(in srgb, var(--brand) 45%, #FFFFFF);
  --field-label: var(--brand-dark);
  --app-surface: #FFFFFF;
  --app-border: #CCD7BE;
  --app-input-border: #C9CDD3;
  --app-text: #262826;
  --app-muted: #59614F;
  --app-account-bg: #E4EBD8;
  --app-error-bg: #F6E1E1;
  --app-error-text: #7A2E2E;
}

body { margin: 0; font-family: Inter, system-ui, sans-serif; color: var(--app-text); }

/* White top bar with a bottom border (contract gym-and-appearance §4). */
.app-bar { border-bottom: 1px solid var(--app-border); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.user-menu-header { display: flex; flex-direction: column; padding: 8px 16px 12px; }
.privacy-text p { margin: 0 0 12px; line-height: 1.6; white-space: pre-line; }

.color-picker { margin-top: 6px; width: 48px; height: 48px; padding: 0; border: 0; background: none; cursor: pointer; flex: none; }
.brand-preview { border: 1px solid var(--app-border); border-radius: 8px; overflow: hidden; max-width: 520px; }
.brand-preview-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: var(--app-text); background: var(--app-surface); border-bottom: 1px solid var(--app-border); }
.brand-preview-menu { font-weight: 600; font-size: 14px; }
.brand-preview-body { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px; background: var(--app-surface); }
.brand-preview-button { padding: 8px 14px; border-radius: 6px; color: #FFFFFF; font-size: 14px; font-weight: 600; }
.brand-preview-chip { padding: 4px 12px; border-radius: 16px; color: #FFFFFF; font-size: 13px; }

/* Attività e sale (docs/contracts/schedule/rooms-and-activities.md §4) */
.activity-icon { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px;
  color: var(--c); background: color-mix(in srgb, var(--c) 15%, #FFFFFF); }
.activity-icon svg { width: 22px; height: 22px; }
.activity-icon.small { width: 28px; height: 28px; border-radius: 8px; }
.activity-icon.small svg { width: 18px; height: 18px; }
.activity-dialog { padding: 0 !important; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.icon-grid button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px 6px; border: 2px solid transparent; border-radius: 12px;
  background: none; font: inherit; font-size: 11px; line-height: 1.15; color: var(--app-muted); cursor: pointer; text-align: center; }
.icon-grid button[aria-pressed="true"] { border-color: var(--brand); color: var(--app-text); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatches button { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: var(--c); cursor: pointer; }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--app-surface), 0 0 0 4px var(--c); }
.activity-preview { display: flex; flex-direction: column; gap: 6px; max-width: 220px; padding: 12px; border: 1px solid var(--app-border);
  border-radius: 14px; background: var(--app-surface); }
.activity-preview h3 { margin: 2px 0 0; font-size: 15px; }
.activity-preview p { white-space: pre-line; margin: 0; font-size: 12.5px; color: var(--app-muted); line-height: 1.35; }
.activity-preview .price { font-size: 12px; font-weight: 600; }

/* Piani e calendario (docs/contracts/schedule/plans-and-sessions.md §4) */
.activity-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.day-choice { display: flex; flex-wrap: wrap; gap: 6px; }
.day-choice button { min-width: 48px; padding: 8px 10px; border: 1px solid var(--app-border); border-radius: 999px; background: var(--app-surface);
  font: inherit; font-size: 14px; font-weight: 600; color: var(--app-text); cursor: pointer; }
.day-choice button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #FFFFFF; }
.overlap-list { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.cal-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--app-border); overflow-x: auto; }
.cal-tabs a { padding: 10px 16px; color: var(--app-muted); text-decoration: none; font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; white-space: nowrap; }
.cal-tabs a[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
.cal-wrap { overflow-x: auto; border: 1px solid var(--app-border); border-radius: 10px; background: var(--app-surface); }
.cal-grid { display: grid; grid-template-columns: 56px repeat(7, minmax(118px, 1fr)); min-width: 890px; }
.cal-corner, .cal-head, .cal-time { position: sticky; background: var(--app-surface); z-index: 1; }
.cal-corner, .cal-time { left: 0; }
.cal-head { padding: 8px; font-size: 13px; color: var(--app-muted); border-bottom: 1px solid var(--app-border); text-align: center; }
.cal-head.today { color: var(--brand); background: var(--brand-tint); }
.cal-time { padding: 10px 6px; font-size: 12px; font-weight: 600; color: var(--app-muted); border-top: 1px solid var(--app-border); font-variant-numeric: tabular-nums; }
.cal-cell { padding: 4px; border-top: 1px solid var(--app-border); border-left: 1px solid var(--app-border); display: flex; flex-direction: column; gap: 4px; min-height: 64px; }
.cal-lesson { display: flex; flex-direction: column; gap: 3px; text-align: left; border: 0; border-left: 4px solid var(--c); border-radius: 6px;
  background: color-mix(in srgb, var(--c) 10%, #FFFFFF); padding: 6px 8px; font: inherit; font-size: 12px; color: var(--app-text); cursor: pointer; }
.cal-lesson.past { opacity: .55; }
.cal-lesson.dim { opacity: .3; }
.cal-lesson { align-items: stretch; min-width: 0; overflow: hidden; }
.cal-lesson > * { text-align: left; }
.cal-top { display: flex; justify-content: space-between; gap: 4px; min-width: 0; }
.cal-name { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-instr { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-instr { color: var(--app-muted); }
.cal-badge { align-self: flex-start; font-size: 10px; font-weight: 700; padding: 0 6px; border-radius: 999px; background: var(--app-border); }
.cal-bar { display: block; height: 4px; border-radius: 2px; background: var(--app-border); overflow: hidden; }
.cal-bar i { display: block; height: 100%; background: var(--c); }
.cal-free { flex: 1; min-height: 52px; border: 1px dashed var(--app-border); border-radius: 6px; background: transparent; color: var(--app-muted);
  font: inherit; font-size: 12px; cursor: pointer; }
.cal-free:hover { border-color: var(--brand); color: var(--brand); }
.cal-free.avail { border-style: solid; border-color: #1E7A46; color: #1E7A46; background: #E2F2E8; }
.cal-free.busy { cursor: default; opacity: .6; }
.cal-free.past { cursor: default; border: 0; background: repeating-linear-gradient(135deg, transparent 0 6px, #EEF1EA 6px 12px); }
.cal-cancelled { border: 0; background: none; padding: 0 4px; text-align: left; font: inherit; font-size: 11px; color: var(--app-muted); cursor: pointer; }
/* Gestione side panels (aggiustamenti spec goal 4, mockup part 1): brand header, sections, sticky footer. */
.side-panel { display: flex; flex-direction: column; min-height: 100%; background: var(--app-surface); }
.p-head { position: relative; background: var(--brand); color: #FFFFFF; padding: 18px 52px 16px 18px; }
.p-head .p-x { position: absolute; top: 10px; right: 10px; color: #FFFFFF; background: rgba(255,255,255,.16); }
.p-act { display: flex; gap: 12px; align-items: center; }
.p-icon { display: grid; place-items: center; flex: none; padding: 4px; border-radius: 14px; background: rgba(255,255,255,.9); }
.p-name { font-size: 20px; font-weight: 700; line-height: 1.2; }
.p-when { font-size: 14px; opacity: .9; margin-top: 2px; }
.p-over { font-size: 12px; opacity: .85; margin-bottom: 2px; }
.p-time { display: inline-flex; gap: 6px; align-items: center; margin-top: 12px; padding: 6px 12px; border-radius: 999px;
  background: rgba(255,255,255,.16); font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.p-body { flex: 1; padding: 0 18px 18px; }
.p-sec { padding: 16px 0; border-bottom: 1px solid var(--app-border); }
.p-sec:last-child { border-bottom: 0; }
.p-sec-t { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 24px; margin: 0 0 10px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--app-muted); }
.p-sec-t .mud-button-root, .p-sec-t .mud-switch { text-transform: none; letter-spacing: normal; font-weight: 600; }
.p-sec-t .mud-switch { margin: -8px -8px -8px 0; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.facts > .wide { grid-column: 1 / -1; }
.fact { background: var(--brand-tint); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.fact .k { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--app-muted); }
.fact .v { font-size: 14px; font-weight: 600; margin-top: 1px; overflow-wrap: anywhere; }
.count { display: flex; align-items: center; gap: 16px; background: color-mix(in srgb, var(--brand) 16%, white); border-radius: 12px; padding: 12px 14px; }
.count .n { font-size: 34px; font-weight: 700; line-height: 1; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.count .n small { font-size: 18px; font-weight: 600; color: var(--app-muted); }
.count .l { display: flex; flex-direction: column; font-size: 13px; color: var(--app-muted); }
.count .l b { color: var(--app-text); font-size: 14px; }
.meter { height: 8px; width: 150px; max-width: 100%; margin-top: 6px; border-radius: 4px; background: rgba(255,255,255,.7); overflow: hidden; }
.meter i { display: block; height: 100%; }
.people { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.people li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--app-border); }
.people li:last-child { border-bottom: 0; }
.people .av { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: color-mix(in srgb, var(--brand) 22%, white); color: var(--brand-dark); font-size: 12px; font-weight: 700; }
.people .who { flex: 1; min-width: 0; }
.people .tag { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: var(--brand-tint); color: var(--brand-dark); }
.p-foot { position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 18px;
  background: var(--brand-tint); border-top: 1px solid var(--app-border); }
.p-foot > * { flex: 1 1 auto; }
.p-foot .mud-button-root { white-space: nowrap; }
.p-foot .p-foot-note { flex: 1 0 100%; font-size: 12.5px; color: var(--app-muted); }
/* Short confirmation (UI-R05): compact brand header with the question, one or two sentences, Annulla + action. */
.p-head.compact { padding: 14px 52px 12px 18px; }
.p-head.compact .p-x { top: 7px; }
.p-head.compact .p-name { font-size: 16px; font-weight: 600; }
.p-head.compact ~ .p-body { padding: 0; }
.confirm-body { padding: 16px 18px; line-height: 1.5; }
/* An error or progress bar placed straight in a form window's body, before the first section, keeps off the brand header. */
.form-dialog .p-body > .mud-alert:first-child, .form-dialog .p-body > .mud-progress-linear:first-child { margin-top: 16px; }

/* Shared form pieces of the modal windows (customer window, sheet window) */
.p-initials { display: grid; place-items: center; width: 40px; height: 40px; font-size: 17px; font-weight: 700; color: var(--brand-dark); }
.p-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.p-label { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 600; color: var(--app-muted); }
.p-req { color: var(--mud-palette-error); }
.p-help { font-size: 12px; color: var(--app-muted); }
.p-note { margin-top: 10px; padding: 8px 10px; border-radius: 9px; background: #FFF0D6; color: #5C3A00; font-size: 12.5px; }
.p-seg { display: inline-flex; border: 1px solid var(--app-border); border-radius: 10px; overflow: hidden; }
.p-seg button { padding: 8px 14px; border: 0; border-right: 1px solid var(--app-border); background: transparent; font: inherit; font-weight: 600; color: var(--app-muted); cursor: pointer; }
.p-seg button:last-child { border-right: 0; }
.p-seg button[aria-pressed="true"] { background: var(--brand-tint); color: var(--brand-dark); }
.p-seg button.danger[aria-pressed="true"] { background: #FBE4E2; color: #B3261E; }
.p-seg button:disabled { opacity: .5; cursor: default; }
@media (max-width: 599px) {
  .p-grid2 { grid-template-columns: 1fr; }
  .mud-dialog.modal-phone { width: 100%; max-width: 100%; margin: 0; max-height: 100%; border-radius: 0; }
}

.attendees { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.attendees li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--app-border); }
.attendees .muted { color: var(--app-muted); }
.attendees .small { font-size: 12px; }

/* Fixed bookings and waitlist (docs/contracts/bookings/recurring-and-waitlist.md §4 «Gestione») */
.attendees .tag { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: var(--brand-tint, #DAE5CC); color: var(--brand-strong, #44543F); }
.cal-badge.risk { background: #FBE3DF; color: #9A2A1B; }
.cal-badge.wait { background: #FAEFD9; color: #8F5600; }

/* Instructor absences, moves and recoveries (docs/contracts/schedule/instructor-absences.md §4) */
.cal-badge.bad { background: #FBE3DF; color: #9A2A1B; }
.cal-badge.sub { background: #FAEFD9; color: #8F5600; }
.cal-badge.assign { background: #FAEFD9; color: #8F5600; }
.cal-badge.moved { background: #E1ECF7; color: #1F4F7A; }
.cal-ghost { opacity: .6; font-style: italic; }
.pick { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.pick button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 8px 12px; border: 1px solid var(--app-border);
  border-radius: 8px; background: var(--app-surface); font: inherit; font-size: 14px; color: var(--app-text); cursor: pointer; }
.pick button:hover:not(:disabled) { border-color: var(--brand); }
.pick button:disabled { opacity: .5; cursor: default; }
.pick .small { font-size: 12px; color: var(--app-muted); }

/* Panoramica (overview.md §4) */
.dash { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 1fr) minmax(300px, 0.8fr); gap: 16px; align-items: start; }
.dash-col { min-width: 0; overflow: hidden; }
.dash-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--app-border); }
.dash-head a { color: var(--brand); font-weight: 600; font-size: 14px; text-decoration: none; }
.todo-list { display: flex; flex-direction: column; }
.todo, .dash-sess { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--app-border); background: transparent; padding: 12px 16px; color: inherit; text-decoration: none; font: inherit; cursor: pointer; }
.todo:last-child, .dash-sess:last-child { border-bottom: 0; }
.todo:hover, .dash-sess:hover { background: var(--brand-tint); }
.todo-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--brand); }
.todo-dot.high { background: #C23B2A; }
.todo-dot.medium { background: #D98A12; }
.todo-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.todo-n { min-width: 30px; height: 30px; border-radius: 15px; background: var(--brand-tint); display: grid; place-items: center; font-weight: 700; padding: 0 8px; }
.todo-go { color: var(--app-muted); }
.dash-time { display: flex; flex-direction: column; width: 52px; font-size: 12px; flex: none; }
.dash-time b { font-size: 15px; color: var(--app-text); }
.dash-day { padding: 8px 16px 4px; font-weight: 600; border-top: 1px solid var(--app-border); }
.dash-day:first-child { border-top: 0; }
.dash-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.dash-occ { display: grid; grid-template-columns: auto 70px; gap: 4px 10px; align-items: center; justify-items: end; flex: none; }
.muted { color: var(--app-muted); }
.small { font-size: 12px; }
.dash-stats { display: flex; flex-direction: column; gap: 16px; overflow: visible; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.tile b { font-size: 28px; line-height: 1.15; letter-spacing: -.02em; }
.tile-l { font-size: 12px; color: var(--app-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.tile-wide { grid-column: 1 / -1; color: inherit; text-decoration: none; }
/* Backup tile (settings/backup.md §4): status text instead of a number, border and dot by state. */
.tile-backup .tile-status { display: flex; align-items: center; gap: 8px; }
.tile-backup .tile-status b { font-size: 15px; line-height: 1.3; letter-spacing: 0; overflow-wrap: anywhere; }
.tile-backup .todo-dot { background: #8A8F98; }
.tile-backup.green { border-color: #3E8E5A; }
.tile-backup.green .todo-dot { background: #3E8E5A; }
.tile-backup.red { border-color: #C23B2A; }
.tile-backup.red .todo-dot { background: #C23B2A; }
a.tile-wide:hover { border-color: var(--brand); }
a.tile-wide:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.hbars { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; }
.hbar { display: grid; grid-template-columns: minmax(112px, 160px) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; }
.hbar-name { display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-name .dash-dot { flex: none; }
.hbar-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 10px; border-radius: 5px; background: var(--brand-tint); overflow: hidden; }
.hbar-track i { display: block; height: 100%; background: var(--c); border-radius: 5px; }
.hbar-v { text-align: right; font-size: 13px; }
.vbars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; padding: 14px 16px 12px; }
.vbar { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.vbar-v { font-size: 12px; font-weight: 600; white-space: nowrap; }
.vbar-track { width: 100%; max-width: 30px; height: 110px; border-radius: 6px; background: var(--brand-tint); display: flex; align-items: flex-end; overflow: hidden; }
.vbar-track i { display: block; width: 100%; background: var(--brand); border-radius: 6px 6px 0 0; }
.vbar-d { font-size: 12px; color: var(--app-muted); text-align: center; line-height: 1.25; white-space: nowrap; }
@media (max-width: 560px) { .hbar { grid-template-columns: 96px minmax(0, 1fr) 70px; } }
@media (min-width: 1101px) and (max-width: 1400px) {
  .dash { grid-template-columns: minmax(0, 1fr) minmax(380px, 1fr); }
  .dash-stats { grid-column: 1 / -1; }
  .dash-stats .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1100px) { .dash { grid-template-columns: minmax(0, 1fr); } }
.dash-sess .todo-txt > span, .dash-sess .todo-txt > b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Calendario: vista Mese */
.cal-mode { display: inline-flex; border: 1px solid var(--app-border); border-radius: 8px; overflow: hidden; }
.cal-mode a { padding: 6px 14px; font-size: 14px; font-weight: 600; color: var(--app-muted); text-decoration: none; }
.cal-mode a[aria-current="true"] { background: var(--brand); color: #fff; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.m-dow { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--app-muted); padding: 2px 6px; }
.m-day { border: 1px solid var(--app-border); border-radius: 10px; min-height: 118px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; text-decoration: none; color: inherit; }
.m-day.out { background: transparent !important; border-style: dashed; opacity: .55; }
.m-day.past { opacity: .6; }
.m-day.today { border: 2px solid var(--brand); }
.m-day.heat { background: color-mix(in srgb, var(--brand) var(--h), var(--app-surface)); }
.m-day.heat:hover { outline: 2px solid var(--brand); }
.m-date { display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 6px; padding: 2px 4px; font-weight: 700; }
.m-cov { font-size: 11px; font-weight: 600; color: var(--app-muted); }
.m-big { font-size: 22px; font-weight: 700; line-height: 1; margin-top: 4px; }
.m-big small { font-size: 13px; color: var(--app-muted); font-weight: 600; }
.m-lbl { font-size: 11px; color: var(--app-muted); }
.m-flag { font-size: 10.5px; font-weight: 700; border-radius: 5px; padding: 1px 5px; }
.m-flag.bad { background: #FBE3DF; color: #9A2A1B; }
.m-flag.warn { background: #FAEFD9; color: #8F5600; }
@media (max-width: 900px) { .m-day { min-height: 74px; } .m-big { font-size: 16px; } .m-lbl, .m-cov, .m-t { display: none; } .m-flag { padding: 0 4px; } }

/* Grids: column headers centred (Gestione, desktop layout). */
.mud-table-head .mud-table-cell, .mud-simple-table table thead th { text-align: center; white-space: nowrap; }
/* Grid header and footer (pager) tinted with the brand colour instead of white. */
.mud-table-head .mud-table-cell, .mud-simple-table table thead th,
.mud-table-foot .mud-table-cell, .mud-table-pagination-toolbar { background: color-mix(in srgb, var(--brand) 24%, white); }
.mud-table-root .mud-table-head .mud-table-cell, .mud-simple-table table thead th { color: var(--brand-dark); font-weight: 600; }

/* FocusOnNavigate (Routes.razor) focuses the page h1 for screen readers: no visible outline on it. */
h1:focus { outline: none; }

/* Application version (docs/contracts/platform/app-version.md §4): small and grey, at the bottom of the drawer. */
.app-version { font-size: 12px; color: var(--app-muted); }
.drawer-version { margin-top: auto; padding: 16px; }

/* «Applica ai piani» (activity window and its dialog) */
.apply-box { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--brand-tint); }
.apply-box b { display: block; font-size: 13px; }
.apply-box > div > span { font-size: 12px; color: var(--app-muted); }
.apply-plans { width: 100%; border-collapse: collapse; font-size: 14px; }
.apply-plans th { text-align: left; padding: 4px 0; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--app-muted); }
.apply-plans td { padding: 7px 0; border-top: 1px solid var(--app-border); font-variant-numeric: tabular-nums; }
.chip-warn { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: #FAEFD9; color: #8F5600; font-size: 12px; font-weight: 600; }
.box-warn { margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: #FAEFD9; color: #8F5600; font-size: 13px; }
.fact .v span { color: var(--app-muted); }
.exit-summary { padding: 10px 12px; border-radius: 10px; color: var(--mud-palette-error); background: color-mix(in srgb, var(--mud-palette-error) 12%, white); font-size: 14px; }
.exit-summary.plain { padding: 0; background: none; color: var(--app-text); }
.exit-summary p { margin: 0 0 4px; }

/* «Crea piani dalle fasce» */
.wizard-steps { display: flex; gap: 6px; padding: 12px 18px 0; }
.wizard-steps .step { flex: 1; font-size: 12px; font-weight: 600; color: var(--app-muted); border-top: 3px solid var(--app-border); padding-top: 6px; }
.wizard-steps .step.done { color: var(--brand-strong, var(--brand)); border-color: var(--brand); }
.wizard-steps .step.cur { color: var(--app-text); border-color: var(--brand); }
.slots-scroll { overflow-x: auto; }
table.slot-grid { border-collapse: separate; border-spacing: 4px; width: 100%; min-width: 360px; }
table.slot-grid th { font-size: 12px; color: var(--app-muted); font-weight: 600; padding: 2px; }
table.slot-grid th.t { text-align: right; padding-right: 6px; width: 54px; }
table.slot-grid td { padding: 0; }
.slot-cell { width: 100%; height: 34px; border-radius: 8px; border: 1px solid var(--app-border); background: var(--app-surface); font: inherit; font-weight: 700; color: #FFFFFF; cursor: pointer; }
.slot-cell.busy { background: #FAEFD9; border-color: #E8C690; }
.slot-cell.on { background: var(--brand); border-color: var(--brand); }
.slot-cell.busy.on { background: #C77700; border-color: #C77700; }
.slot-cell.taken { cursor: not-allowed; border-color: var(--app-border); font-size: 11px; color: var(--app-muted);
    background: repeating-linear-gradient(45deg, #EEF1EA, #EEF1EA 3px, #E2E7DB 3px, #E2E7DB 6px); }
.slot-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--app-muted); margin-top: 8px; }
.slot-legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 5px; border: 1px solid var(--app-border); }
.new-plans { width: 100%; border-collapse: collapse; font-size: 14px; }
.new-plans th { text-align: left; padding: 4px 0; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--app-muted); }
.new-plans td { padding: 6px 6px 6px 0; border-top: 1px solid var(--app-border); vertical-align: top; }
.chip-block { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #FBE3E0; color: #A3261B; font-size: 12px; font-weight: 600; }

/* Messaggi automatici (docs/contracts/settings/automatic-messages.md §4) */
.am-tools { display: flex; justify-content: flex-end; gap: 6px; margin-bottom: 8px; }
.am-tool { padding: 3px 10px; border: 1px solid var(--app-border); border-radius: 999px; background: var(--app-surface); font: inherit; font-size: 12px; color: var(--brand-text); cursor: pointer; }
.am-tool:hover, .am-tool:focus-visible { background: var(--brand-tint); }
.am-groups { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: start; }
@media (min-width: 900px) { .am-groups { grid-template-columns: 1fr 1fr; } }
.am-group { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 12px; overflow: hidden; min-width: 0; }
.am-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; border: 0; background: var(--brand); color: #fff; font: inherit; text-align: left; cursor: pointer; }
.am-head:focus-visible { outline: 2px solid var(--brand-text); outline-offset: -3px; }
.am-head-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; }
.am-head-count { font-size: 12px; opacity: .85; }
.am-head-badge { padding: 1px 8px; border-radius: 999px; background: var(--secondary); color: #fff; font-size: 11px; font-weight: 600; }
.am-head-chev { display: inline-block; font-size: 16px; line-height: 1; transition: transform .15s; }
.am-head[aria-expanded="false"] .am-head-chev { transform: rotate(-90deg); }
.am-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--app-border);
  background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.am-group .am-row:last-child { border-bottom: 0; }
.am-row:hover, .am-row:focus-visible { background: var(--brand-tint); }
.am-grow { flex: 1; min-width: 0; }
.am-grow b { display: block; font-size: 14px; }
.am-grow small { display: block; margin-top: 2px; font-size: 12px; color: var(--app-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-chev { color: var(--app-muted); font-size: 18px; }
.am-body { display: grid; grid-template-columns: 1.1fr 1fr; align-items: start; }
.am-fields, .am-preview { min-width: 0; padding: 0 18px; }
.am-preview { border-left: 1px solid var(--app-border); background: color-mix(in srgb, var(--brand-tint) 35%, var(--app-surface)); }
.am-ph { display: flex; flex-wrap: wrap; gap: 6px; }
.am-ph button { padding: 3px 8px; border: 0; border-radius: 6px; background: var(--brand-tint); color: var(--brand-dark); cursor: pointer;
  font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.am-ph button:hover { background: color-mix(in srgb, var(--brand) 25%, white); }
.am-auto { margin: 0; padding: 9px 11px; border-radius: 10px; background: color-mix(in srgb, var(--brand-tint) 50%, var(--app-surface)); font-size: 12.5px; line-height: 1.5; color: var(--app-muted); }
ul.am-auto { padding-left: 28px; }
.am-subject { margin-bottom: 6px; font-size: 12px; color: var(--app-muted); overflow-wrap: anywhere; }
.am-email { border: 1px solid var(--app-border); border-radius: 12px; overflow: hidden; background: var(--app-surface); font-size: 13px; }
.am-email-bar { height: 6px; background: var(--brand); }
.am-email-in { padding: 14px 16px; }
.am-email-logo { margin-bottom: 10px; }
.am-email h5 { margin: 0 0 8px; font-size: 17px; overflow-wrap: anywhere; }
.am-email p { margin: 0 0 8px; line-height: 1.5; overflow-wrap: anywhere; }
.am-email-out { margin: 6px 0 4px; padding: 8px 10px; border-radius: 8px; background: var(--brand-tint); color: var(--brand-dark); font-weight: 600; }
.am-push { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(30, 32, 30, .86); color: #FFFFFF; font-size: 12.5px; }
.am-push b, .am-push span:not(.am-push-ic) { display: block; overflow-wrap: anywhere; }
.am-push-ic { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 7px; background: var(--brand); }
.am-example { margin-top: 8px; font-size: 12px; color: var(--app-muted); }
@media (max-width: 720px) {
  .am-body { grid-template-columns: 1fr; }
  .am-preview { border-left: 0; border-top: 1px solid var(--app-border); }
}

/* UI-R04 fields */
/* White background, brand-coloured frame and label (errors keep MudBlazor's red). */
.mud-input.mud-input-outlined { background: var(--field-bg); }
.mud-input.mud-input-outlined .mud-input-outlined-border { border-color: var(--field-border); }
.mud-input.mud-input-outlined:focus-within .mud-input-outlined-border { border-color: var(--brand); border-width: 2px; }
.mud-input.mud-input-outlined.mud-input-error .mud-input-outlined-border { border-color: var(--mud-palette-error); }
.mud-input-control .mud-input-label-outlined { color: var(--field-label); font-weight: 600; background: var(--field-bg); padding: 0 4px; }
.mud-input-control .mud-input-label-outlined.mud-input-error { color: var(--mud-palette-error); }
.mud-input.mud-input-outlined .mud-input-slot { color: #262826; }
.mud-input-control .mud-input-helper-text { color: var(--app-muted); }
.mud-input-control .mud-input-helper-text.mud-input-error { color: var(--mud-palette-error); }
.mud-input.mud-input-outlined.mud-disabled { background: var(--brand-tint); }
.mud-input.mud-input-outlined.mud-disabled .mud-input-slot { color: var(--app-muted); }
.mud-input.mud-input-outlined.mud-disabled .mud-input-outlined-border { border-color: var(--field-border); }
/* Windows that keep the label above the field (customer window) take background and frame only. */
.cd-field .mud-input.mud-input-outlined { background: var(--field-bg); }
.cd-field .mud-input.mud-input-outlined .mud-input-outlined-border { border-color: var(--field-border); }
/* /UI-R04 */

/* Side menu (UI-R02/UI-R03): dark brand drawer, three titled groups, white pill on the active item. */
.app-drawer.mud-drawer { background: var(--brand-dark); }
.app-drawer .app-nav .nav-group-title { padding: 16px 16px 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: color-mix(in srgb, var(--brand-tint) 70%, transparent); }
.app-drawer .app-nav .mud-nav-link { color: #FFFFFF; border-radius: 10px; margin: 1px 8px; }
.app-drawer .app-nav .mud-nav-link .mud-icon-root { color: color-mix(in srgb, var(--brand-tint) 85%, transparent); }
.app-drawer .app-nav .mud-nav-link:hover { background: rgba(255,255,255,.08); }
.app-drawer .app-nav .mud-nav-link.active, .app-drawer .app-nav .mud-nav-link.active:hover { background: #FFFFFF; color: var(--brand); font-weight: 700; }
.app-drawer .app-nav .mud-nav-link.active .mud-icon-root { color: var(--brand); }
.app-drawer .drawer-version.app-version { color: color-mix(in srgb, var(--brand-tint) 70%, transparent); }

/* Grids (UI-R09…UI-R15): frame filling the window, sticky toolbar/filters/header, brand header, person cell, state chips, pager, ⋯ menu. */
.grid-frame { display: flex; flex-direction: column; height: calc(100dvh - var(--grid-offset, 190px)); min-height: 420px; background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 12px; overflow: hidden; }
/* Toolbar and filters in one sticky head, so both stay in view at every width (UI-R12). */
.grid-head { flex: none; position: sticky; top: 0; z-index: 3; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: var(--app-surface); border-bottom: 1px solid var(--app-border); }
.grid-toolbar, .grid-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.grid-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.grid-body > .mud-table { flex: 1 1 auto; min-height: 0; height: 100%; display: flex; flex-direction: column; box-shadow: none; border-radius: 0; }
.grid-body > .mud-table > .mud-table-container { flex: 1 1 auto; min-height: 0; height: auto !important; overflow: auto; }
.grid-body > .mud-table > .mud-table-pagination { flex: none; border-top: 1px solid var(--app-border); }
/* Out-ranks MudBlazor's FixedHeader rule `.mud-table-sticky-header * .mud-table-root .mud-table-head .mud-table-cell` (surface background). */
.grid-frame .mud-table .mud-table-root .mud-table-head .mud-table-cell, .grid-look .mud-table .mud-table-root .mud-table-head .mud-table-cell, .grid-look thead th { background: var(--brand-tint); color: var(--brand-text); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.grid-frame .mud-table-body .mud-table-row, .grid-look .mud-table-body .mud-table-row, .grid-look tbody tr { height: 52px; }
.grid-frame .mud-table-body .mud-table-cell, .grid-look .mud-table-body .mud-table-cell, .grid-look tbody td { padding: 12px; vertical-align: middle; }
.status-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.status-chip { padding: 4px 12px; border: 1px solid var(--field-border); border-radius: 999px; background: var(--app-surface); color: var(--app-muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.status-chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #FFFFFF; }
.person-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person-initials { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-tint); color: var(--brand-text); font-size: 12px; font-weight: 700; }
.person-text { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.person-name { font-weight: 600; color: var(--brand-text); text-decoration: none; overflow-wrap: anywhere; }
a.person-name:hover { text-decoration: underline; }
.person-secondary { font-size: 12px; color: var(--app-muted); overflow-wrap: anywhere; }
.state-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.state-chip.ok { background: #E2F2E8; color: #1E7A46; }
.state-chip.warn { background: #FAEFD9; color: #8F5600; }
.state-chip.bad { background: #FBE3E0; color: #A3261B; }
.state-chip.neutral { background: color-mix(in srgb, var(--app-muted) 14%, #FFFFFF); color: var(--app-muted); }
.state-chip.brand { background: var(--brand-tint); color: var(--brand-text); }
.grid-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; width: 100%; padding: 8px 12px; font-size: 13px; color: var(--app-muted); }
.grid-pager-pages { margin-left: auto; }
.row-action .mud-menu-item-text { display: flex; flex-direction: column; }
.row-action.destructive .row-action-label, .row-action.destructive .mud-icon-root { color: var(--mud-palette-error); }
.row-action-reason { font-size: 11.5px; color: var(--app-muted); white-space: normal; max-width: 240px; }
@media (max-width: 599px) {
  .grid-frame { height: auto; min-height: 0; overflow: visible; }
  .grid-head { top: var(--grid-sticky-top, 56px); gap: 6px; padding: 8px; }
  .grid-body > .mud-table > .mud-table-container { overflow: visible; }
  .grid-pager-pages { margin-left: 0; }
}
/* /Grids */

/* Customer card (user-management.md §4 «Scheda del cliente», aspetto dal 2026-12-03): header with initials and actions,
   Dati | Scheda anamnesi side by side from 1000 px, Documenti below; one column on smaller screens. */
.customer-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 16px; }
.customer-initials { flex: none; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--brand-tint); color: var(--brand-text); font-size: 22px; font-weight: 700; }
.customer-title { flex: 1 1 240px; min-width: 0; }
.customer-name { margin: 0 0 4px; font-size: 24px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.customer-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.customer-created { margin-top: 4px; font-size: 12px; color: var(--app-muted); }
.customer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.customer-columns { display: grid; grid-template-columns: 1fr; gap: 16px; }
.customer-columns > * { min-width: 0; }
.fact .s { font-size: 12px; color: var(--app-muted); margin-top: 1px; }
@media (min-width: 1000px) {
  .customer-columns { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}
/* Summarised anamnesis sheet (membership-requests.md §4 «Forma riassunta»): question muted, answer beside, «da sapere» in red. */
.sheet-origin { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-bottom: 4px; }
.sheet-line { display: flex; flex-wrap: wrap; gap: 2px 8px; padding: 6px 0; border-bottom: 1px solid var(--app-border); font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.sheet-line .q { color: var(--app-muted); }
.sheet-line .a { font-weight: 600; }
.sheet-line.know .q, .sheet-line.know .a { color: var(--mud-palette-error); }
.sheet-links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; }
/* Documents of the card (documents.md §4, aspetto dal 2026-12-03): one card per category, side by side; stacked on phone. */
.docs-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.doc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; align-items: start; }
.doc-card { min-width: 0; border: 1px solid var(--app-border); border-radius: 10px; padding: 10px 12px; background: var(--app-surface); }
.doc-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 6px; }
.doc-card-name { font-weight: 700; font-size: 14px; margin-right: auto; }
.doc-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--app-border); }
.doc-row .doc-icon { flex: none; color: var(--brand); }
.doc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.doc-text b { font-size: 14px; }
.doc-text small { font-size: 12px; color: var(--app-muted); }
@media (max-width: 599px) {
  .customer-initials { width: 52px; height: 52px; font-size: 18px; }
  .customer-name { font-size: 19px; }
  .customer-actions { width: 100%; flex-wrap: nowrap; margin-left: 0; }
  .doc-cards { grid-template-columns: 1fr; }
}

/* Phone bar (gestione-ui.md UI-R16, §4 «Telefono»): under 600 px the drawer and the hamburger give way to a fixed bottom bar
   with at most 5 places; «Altro» and «Profilo» open bottom sheets. From 600 px nothing changes. */
.phone-bar, .phone-title, .user-menu-initials, .phone-sheet, .mud-overlay.phone-sheet-overlay { display: none; }
/* Layers: side menu 1100 < bar 1150 < popovers (dropdowns, pickers) 1200 < sheet overlay 1290 < sheet 1295 < app bar 1300
   < temporary drawers (side panels) 1302 < dialogs 1400. */
.phone-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1150; grid-template-columns: repeat(var(--phone-bar-slots, 5), minmax(0, 1fr));
  background: var(--app-surface); border-top: 1px solid var(--app-border); padding-bottom: env(safe-area-inset-bottom); }
.phone-bar-slot { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; padding: 8px 2px 9px;
  border: 0; background: none; font: inherit; font-size: 11px; font-weight: 500; line-height: 1.2; color: var(--app-muted); text-decoration: none; cursor: pointer; }
.phone-bar-slot .mud-icon-root { font-size: 22px; }
.phone-bar-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone-bar-slot.active { color: var(--brand); font-weight: 600; }
.phone-bar-slot.active::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
.phone-bar-dot { position: absolute; top: 4px; right: calc(50% - 20px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  display: grid; place-items: center; background: var(--mud-palette-warning); color: #4A3500; font-size: 10px; font-weight: 700; }
.phone-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1295; max-height: 80dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: 6px 12px calc(14px + env(safe-area-inset-bottom)); background: var(--app-surface); border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .2); transition: transform .2s ease; }
.phone-sheet.dragging { transition: none; }
.phone-sheet-grab { display: block; width: 100%; height: 22px; padding: 0; border: 0; background: none; cursor: grab; touch-action: none; }
.phone-sheet-grab::before { content: ""; display: block; width: 40px; height: 4px; margin: 0 auto; border-radius: 2px; background: var(--app-border); }
.phone-sheet-group { padding: 10px 8px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--app-muted); }
.phone-sheet-item { display: flex; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; padding: 11px 8px; border: 0; border-radius: 10px; background: none;
  font: inherit; font-size: 15px; font-weight: 500; color: var(--app-text); text-align: left; text-decoration: none; cursor: pointer; }
.phone-sheet-item .mud-icon-root { color: var(--brand-dark); }
.phone-sheet-item.active { background: var(--brand-tint); color: var(--brand-text); font-weight: 600; }
.phone-sheet-count { margin-left: auto; padding: 1px 8px; border-radius: 999px; background: var(--mud-palette-warning); color: #4A3500; font-size: 11px; font-weight: 700; }
.phone-sheet .user-menu-header { padding: 4px 8px 10px; border-bottom: 1px solid var(--app-border); margin-bottom: 4px; }
.user-menu-initials { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; place-items: center; background: var(--brand-tint);
  color: var(--brand-text); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
@media (max-width: 599.98px) {
  /* Only the layout's drawer and its scrim: the side panels (temporary drawers) keep theirs. */
  .app-menu-toggle, .app-drawer.mud-drawer, .mud-drawer-overlay-responsive, .app-brand-name { display: none !important; }
  .phone-bar { display: grid; }
  .phone-sheet { display: block; }
  .mud-overlay.phone-sheet-overlay { display: flex; }
  .phone-title { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; font-weight: 700; }
  .user-menu-icon { display: none !important; }
  .user-menu-initials { display: grid; }
  /* «Profilo» holds the user menu: no initials in the top bar then. */
  body:has(.phone-bar[data-end="profile"]) .app-bar .user-menu { display: none; }
  .mud-main-content { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
}
/* /Phone bar */

/* Toasts (gestione-ui.md UI-R18): white card, icon in a circle; the one rule for every snackbar. */
.mud-snackbar { background: var(--app-surface) !important; color: var(--app-text) !important; border: 1px solid var(--app-border) !important; border-radius: 14px;
  box-shadow: 0 10px 28px rgba(40, 52, 38, .18); padding: 8px 10px; gap: 11px; font-size: 13.5px; line-height: 1.35; }
.mud-snackbar .mud-snackbar-icon { width: 32px; height: 32px; flex: none; margin: 0; padding: 0; opacity: 1; border-radius: 50%; align-items: center; justify-content: center;
  background: var(--brand-tint); color: var(--brand-dark); }
.mud-snackbar .mud-snackbar-icon .mud-icon-root { font-size: 18px; color: inherit; }
.mud-snackbar.mud-alert-outlined-warning .mud-snackbar-icon { background: #FBEED3; color: #8A5A00; }
.mud-snackbar.mud-alert-outlined-error .mud-snackbar-icon { background: #F6E2E2; color: #A23B3B; }
.mud-snackbar .mud-snackbar-content-message { padding: 4px 0; color: var(--app-text); }
.mud-snackbar .mud-snackbar-content-action { margin-right: 0; padding-left: 4px; }
.mud-snackbar .mud-snackbar-content-action > button { color: var(--app-muted); }
@media (max-width: 599.98px) {
  /* Above the phone bar (UI-R16). */
  .mud-snackbar-location-bottom-center { bottom: calc(72px + env(safe-area-inset-bottom)); max-width: calc(100vw - 20px); }
}

/* Comunicazioni of the Gestione (docs/contracts/messages/communications.md §4): tabs, window, detail, phone preview. */
.msg-tabs { display: flex; gap: 4px; margin: 0 0 12px; border-bottom: 1px solid var(--app-border); }
.msg-tabs a { padding: 8px 16px; margin-bottom: -1px; border-bottom: 3px solid transparent; font-weight: 600; color: var(--app-muted); text-decoration: none; }
.msg-tabs a[aria-current="page"] { color: var(--brand-text); border-bottom-color: var(--brand); }
.cm-emoji-cell { font-size: 20px; width: 40px; }
.cm-field-label { font-size: 12px; color: var(--app-muted); margin-bottom: 6px; }
.cm-emojis { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.cm-emojis button { min-width: 40px; height: 40px; padding: 0 8px; border: 1px solid var(--app-border); border-radius: 10px; background: var(--app-surface); font-size: 20px; cursor: pointer; }
.cm-emojis button.none { font-size: 12px; color: var(--app-muted); }
.cm-emojis button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-tint); box-shadow: 0 0 0 1px var(--brand); }
.cm-attachment { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--app-border); border-radius: 10px; }
.cm-file-icon { flex: none; display: grid; place-items: center; width: 32px; height: 38px; border-radius: 6px; background: var(--brand-tint); color: var(--brand-text); font-size: 10px; font-weight: 700; }
.cm-file-text { flex: 1 1 140px; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.cm-file-text small { color: var(--app-muted); font-size: 12px; }
.cm-answer-row { display: flex; align-items: center; gap: 4px; margin-bottom: 10px; }
.cm-answer-row .mud-input-control { flex: 1; }
.cm-detail-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }
.cm-detail-title { overflow-wrap: anywhere; }
.cm-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 8px; }
.cm-kpi { background: var(--brand-tint); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; }
.cm-kpi b { font-size: 26px; line-height: 1.1; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.cm-kpi small { color: var(--app-muted); font-size: 12px; }
.cm-warn { color: var(--app-error-text); }
.cm-results { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.cm-results-until { margin-left: 4px; font-weight: 400; color: var(--app-muted); font-size: 12.5px; }
.cm-result-line { display: flex; align-items: center; gap: 10px; }
.cm-result-name { flex: 0 1 200px; font-weight: 600; overflow-wrap: anywhere; }
.cm-bar { flex: 1; height: 10px; border-radius: 999px; background: var(--brand-tint); overflow: hidden; }
.cm-bar i { display: block; height: 100%; background: var(--brand); }
.cm-result-n { min-width: 28px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
/* Anteprima: a phone-shaped box with the communication as the customer sees it (CSS only). */
.cm-phone { width: 300px; max-width: 100%; margin: 0 auto; padding: 14px 10px; border: 8px solid #262826; border-radius: 34px; background: #262826; }
.cm-phone-screen { background: #F4F5F3; border-radius: 22px; padding: 10px; min-height: 360px; max-height: 520px; overflow-y: auto; }
.cm-card { background: var(--app-surface); border-radius: 14px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.cm-card-band { background: var(--brand); color: #FFFFFF; padding: 14px; }
.cm-card-emoji { font-size: 30px; line-height: 1.1; }
.cm-card-title { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.cm-card-when { font-size: 12px; opacity: .9; margin-top: 2px; }
.cm-card-text { padding: 12px 14px; font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.cm-card-file { margin: 0 14px 12px; padding: 8px 10px; border: 1px solid var(--app-border); border-radius: 10px; font-size: 13px; overflow-wrap: anywhere; }
.cm-card-file small { color: var(--app-muted); }
.cm-card-poll { display: flex; flex-direction: column; gap: 8px; padding: 0 14px 14px; font-size: 14px; }
.cm-card-poll small { color: var(--app-muted); }
.cm-card-choice { padding: 10px 12px; border: 1px solid var(--field-border); border-radius: 10px; text-align: center; font-weight: 600; color: var(--brand-text); overflow-wrap: anywhere; }
/* Test environment banner (docs/contracts/platform/test-environment.md §4): fixed strip above everything (app bar 1300, side panels 1302);
   while it is on the page, --test-banner-h (28px) is the height every layout shifts down by. Colors do not depend on the brand. */
.test-banner { position: fixed; top: 0; left: 0; right: 0; height: 28px; z-index: 1500; display: flex; align-items: center; justify-content: center;
  padding: 0 8px; box-sizing: border-box; background: #F57C00; color: #1A1A1A; font: 600 13px/1 Inter, system-ui, sans-serif; text-align: center;
  white-space: nowrap; overflow: hidden; }
.test-banner-short { display: none; }
@media (max-width: 599.98px) { .test-banner-long { display: none; } .test-banner-short { display: inline; } }
:root:has(.test-banner) { --test-banner-h: 28px; }
body:has(.test-banner) { padding-top: var(--test-banner-h); }
/* Staff layout: the app bar is position fixed (top 0) and the clipped drawer is fixed under it: move both down by the banner;
   the main content already follows the body padding. The drawer stretches to the bottom instead of using a calculated height. */
:root:has(.test-banner) .mud-appbar.mud-appbar-fixed-top { top: var(--test-banner-h); }
:root:has(.test-banner) .app-drawer.mud-drawer-fixed.mud-drawer-clipped-always { margin-top: var(--test-banner-h); height: auto; bottom: 0; }
