:root {
  --bg: #f4f6f5;
  --panel: #ffffff;
  --ink: #1d2a26;
  --muted: #64736e;
  --line: #dfe5e2;
  --brand: #2f7d5b;
  --brand-2: #e6f2ec;
  --warn: #b7791f;
  --warn-bg: #fdf4e3;
  --danger: #c0392b;
  --danger-bg: #fbeae8;
  --info-bg: #e8f0fb;
  --radius: 10px;
  --leaf: #2f7d5b;
  --mint-soft: #e3f3e9;
  --good: #2f7d5b;
  --bad: #c0392b;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
  display: grid; grid-template-columns: 220px 1fr; min-height: 100vh;
}
.sidebar {
  background: #1f3d31; color: #cfe3da; padding: 18px 12px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.brand { font-weight: 700; font-size: 18px; color: #fff; display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; }
.brand img { height: 26px; width: auto; display: block; }
.logo { background: #7fc8a3; color: #1f3d31; border-radius: 8px; width: 30px; height: 30px; display: grid; place-items: center; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a, .nav-exit { color: inherit; text-decoration: none; padding: 9px 10px; border-radius: 8px; display: flex; align-items: center; gap: 10px; position: relative; }
.sidebar nav a:hover { background: rgba(255,255,255,.07); }
.sidebar nav a.active { background: rgba(127,200,163,.2); color: #fff; font-weight: 600; }
.nav-badge { background: var(--danger); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; margin-left: auto; }
/* Simboli del menu */
.ni { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.sidebar nav a.active .ni { opacity: 1; }
.nav-exit { border: 0; background: none; font: inherit; cursor: pointer; width: 100%; text-align: left; margin-top: 10px; color: #f1b9a5; border-top: 1px solid rgba(255,255,255,.08); border-radius: 0 0 8px 8px; padding-top: 12px; }
.nav-exit:hover { background: rgba(228,87,46,.15); color: #fff; border-radius: 8px; }
.sidebar-foot #logout { display: none; }
/* nome del simbolo: al passaggio del mouse (solo dove il menu mostra i simboli) o tenendo premuto */
.sidebar nav [data-tip]::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); background: #10322a; color: #fff; font-size: 12.5px; font-weight: 600; white-space: nowrap; padding: 5px 10px; border-radius: 7px; box-shadow: 0 6px 18px rgba(0,0,0,.25); pointer-events: none; opacity: 0; transition: opacity .12s; display: none; }
.sidebar-foot { margin-top: auto; font-size: 11px; opacity: .6; padding: 8px; }

main { padding: 24px 28px 60px; min-width: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 2px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { font-size: 26px; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 7px 13px; border-radius: 8px; cursor: pointer; font: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: #b9c6c0; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #276a4d; }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.link { border: 0; background: none; color: var(--brand); padding: 2px 4px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
tbody tr:hover { background: #fafcfb; }
tr.clickable { cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

form .fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 16px; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
label.f.wide { grid-column: 1 / -1; }
input, select, textarea { font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #a7d7bf; border-color: var(--brand); }
textarea { min-height: 70px; resize: vertical; }
input[type=checkbox] { width: auto; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0; }
legend { font-size: 12px; color: var(--muted); font-weight: 600; padding: 0 4px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: flex; align-items: center; gap: 5px; font-size: 13px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--brand); border-color: var(--brand); font-weight: 600; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 12px; background: var(--brand-2); color: #22573f; font-size: 12px; margin: 2px; }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.danger { background: var(--danger-bg); color: var(--danger); }
.chip.gray { background: #eef1f0; color: var(--muted); }
.chip button { border: 0; background: none; cursor: pointer; color: inherit; padding: 0; font-size: 14px; line-height: 1; }
.alert { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.alert.warn { background: var(--warn-bg); color: #7a5314; }
.alert.danger { background: var(--danger-bg); color: #8a261b; }
.alert.info { background: var(--info-bg); color: #28456e; }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.kpi { background: #f7faf8; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.kpi b { display: block; font-size: 18px; }
.kpi span { font-size: 11px; color: var(--muted); text-transform: uppercase; }

/* editor piano */
.day-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.day-tabs .btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.meal { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 12px; background: #fff; }
.meal-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #f7faf8; border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; }
.meal-head input { max-width: 240px; font-weight: 600; }
.meal table td { padding: 5px 8px; }
.meal input.grams { width: 80px; text-align: right; }
.meal input.note { min-width: 120px; }
.bar { height: 8px; border-radius: 4px; background: #e8eeeb; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); }
.bar.over > i { background: var(--danger); }
.totals-sticky { position: sticky; top: 10px; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.food-flag { font-size: 11px; }

.list-item { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); gap: 8px; }
.list-item:last-child { border-bottom: 0; }
.score { font-weight: 700; font-size: 18px; color: var(--brand); min-width: 54px; text-align: center; }
.chart-box { position: relative; height: 260px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,30,26,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 12px; width: min(760px, 100%); max-height: 90vh; overflow: auto; padding: 20px; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.modal.lg { width: min(980px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.x { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }

#toast { position: fixed; bottom: 84px; right: 20px; z-index: 62; max-width: min(420px, calc(100vw - 40px)); display: flex; flex-direction: column; gap: 8px; }
#toast div { background: #1f3d31; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); animation: fade .2s; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

/* utente e accesso */
.sidebar-foot { display: flex; flex-direction: column; gap: 4px; opacity: 1; font-size: 13px; }
.sidebar-foot .user-name { color: #fff; font-weight: 600; }
.sidebar-foot .small { opacity: .7; word-break: break-all; }
.sidebar-foot .btn { align-self: flex-start; margin-top: 6px; background: transparent; color: #cfe3da; border-color: rgba(255,255,255,.25); }
#auth-root:empty { display: none; }
body.auth-mode { display: block; }
body.auth-mode .sidebar, body.auth-mode main { display: none; }
#auth-root { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 28px; width: min(460px, 100%); }
.auth-card h1 { font-size: 22px; margin: 6px 0 4px; }
.auth-card > p { margin: 0 0 16px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--brand); margin-bottom: 14px; }
.auth-brand img { height: 30px; width: auto; display: block; }
.auth-brand .logo { background: var(--brand); color: #fff; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form.inline { flex-direction: row; }
.auth-form .btn.primary { justify-content: center; padding: 10px; }
.auth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.auth-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.auth-check input { margin-top: 3px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: 13px; flex-wrap: wrap; }
.hint { font-weight: 400; font-size: 11px; }
.otp-input { font-size: 22px; letter-spacing: 8px; text-align: center; font-variant-numeric: tabular-nums; }
.auth-step { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.auth-step h3 { margin-bottom: 4px; }
.auth-step p { margin: 0 0 8px; }
.auth-step.done { background: var(--brand-2); border-color: #bfdccd; }

/* visite e trascrizioni */
.totals-sticky { max-height: calc(100vh - 20px); overflow-y: auto; }
.transcript { white-space: pre-wrap; background: #f7faf8; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 6px 0 10px; font-size: 13px; line-height: 1.55; max-height: 320px; overflow-y: auto; }
.transcript-item { border-bottom: 1px solid var(--line); padding: 8px 0; }
.transcript-item:last-child { border-bottom: 0; }
.visit-mini { border-top: 1px solid var(--line); padding: 8px 0; }
.visit-mini summary { cursor: pointer; font-size: 13px; }
.visit-mini .transcript { max-height: 220px; }
.rec-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; background: var(--danger-bg); margin-bottom: 12px; }
.rec-bar b { font-size: 18px; font-variant-numeric: tabular-nums; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); animation: pulse 1.2s infinite; }
.rec-dot.paused { animation: none; background: var(--muted); }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }

/* piè di pagina con il titolare del marchio */
.app-legal { grid-column: 2; padding: 0 28px 28px; font-size: 12px; color: var(--muted); }
.app-legal a, .auth-legal a { color: inherit; }
body.auth-mode .app-legal { display: none; }
.auth-legal { text-align: center; font-size: 12px; color: var(--muted); margin: 16px 0 0; }
#auth-root { align-content: center; }

/* gruppi e quantità nel piano */
.meal .grp-row td { background: #fafcfb; padding: 7px 10px 5px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); border-bottom: 1px solid var(--line); }
.meal .grp-row td span { margin-right: 8px; }
.meal .grp-row .btn { text-transform: none; letter-spacing: 0; font-weight: 600; }
.meal .grp-empty td { color: #b6c2bc; padding: 4px 10px; font-size: 12px; }
.meal td.qty { white-space: nowrap; }
.meal td.qty .grams { width: 72px; }
.meal td.qty .unit { width: auto; padding: 6px 4px; margin-left: 4px; }
.meal td.qty [data-eq] { margin-left: 6px; }

/* consenso privacy e firma */
.consent-text { white-space: pre-wrap; background: #fafcfb; border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; max-height: 38vh; overflow-y: auto; font-size: 13px; line-height: 1.55; margin-bottom: 14px; }
.consent-item { margin-bottom: 10px; }
.consent-item label { white-space: nowrap; }
.consent-item legend { font-size: 13px; color: var(--ink); font-weight: 500; line-height: 1.4; }
.sig-wrap { position: relative; border: 2px dashed #b9c6c0; border-radius: 12px; background: #fff; }
.sig { display: block; width: 100%; height: min(260px, 40vh); touch-action: none; cursor: crosshair; }
.sig-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #b6c2bc; font-size: 22px; pointer-events: none; }
.sig-wrap::after { content: ""; position: absolute; left: 8%; right: 8%; bottom: 28%; border-bottom: 1px solid #d5ddd9; pointer-events: none; }

/* importazione alimenti */
.imp-list { display: grid; gap: 10px; max-height: 46vh; overflow-y: auto; padding-right: 4px; }
.imp-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.imp-choice { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; white-space: nowrap; }
.imp-diff { margin-top: 6px; font-size: 13px; }
.imp-diff th, .imp-diff td { padding: 4px 8px; }
.imp-diff td:first-child { color: var(--muted); width: 32%; }

/* ---------- misure antropometriche ---------- */
.modal.xl { width: min(1180px, 100%); }
.ms-layout { display: grid; grid-template-columns: 170px minmax(0, 1fr) 270px; gap: 18px; align-items: start; }
.ms-nav { display: grid; gap: 4px; position: sticky; top: 0; }
.ms-nav-btn { display: flex; justify-content: space-between; align-items: center; gap: 6px; text-align: left; border: 0; background: #f4f7f5; border-radius: 8px; padding: 9px 10px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink); }
.ms-nav-btn:hover { background: var(--brand-2); }
.ms-nav-btn b { font-size: 11px; color: var(--brand); }
.ms-body { max-height: 66vh; overflow-y: auto; padding-right: 6px; }
.ms-sec { border-top: 1px solid var(--line); padding: 14px 0 6px; }
.ms-sec h3 { margin-bottom: 10px; }
.ms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px 14px; }
.ms-field { position: relative; }
.ms-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.ms-tags i { font-style: normal; font-size: 10px; font-weight: 700; color: var(--brand); background: var(--brand-2); border-radius: 5px; padding: 1px 5px; }
.ms-live { position: sticky; top: 0; background: #f7faf8; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.ms-live-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.ms-live-row:last-child { border-bottom: 0; }
.ms-live-row span:first-child { color: var(--muted); }
.ms-live-row > :nth-child(3) { grid-column: 1 / -1; justify-self: start; }
.ms-actions { grid-column: 1 / -1; }

.anthro-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.seg a { padding: 7px 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 13px; }
.seg a.on { background: var(--brand); color: #fff; }
.visit-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; margin-bottom: 4px; }
.visit-chip { flex: none; display: grid; gap: 2px; text-align: center; padding: 9px 16px; border-radius: 10px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--ink); min-width: 120px; }
.visit-chip span { font-size: 11px; color: var(--brand); }
.visit-chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.visit-chip.on span { color: #d8efe3; }
.anthro-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.anthro-grid .card { margin: 0; }
.a-bmi { grid-column: span 2; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.card-h h3 { margin: 0; }
.help { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-2); color: var(--brand); font-weight: 700; font-size: 12px; cursor: help; flex: none; }
.a-bmi-body { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 18px; align-items: center; }
.big-kpi { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.big-kpi span:first-child { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); width: 100%; }
.big-kpi b { font-size: 34px; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kv-row { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.kv-row span { color: var(--muted); }
.kv-row b { font-variant-numeric: tabular-nums; }
.kv-row small { grid-column: 1 / -1; justify-self: end; }
.gauge-wrap svg { width: 100%; height: auto; }
.gauge .ax { font-size: 10.5px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.gauge .ax.b { font-weight: 700; font-size: 11px; }
table.risk td { padding: 8px 6px; font-size: 13.5px; white-space: nowrap; }
table.risk td:first-child { white-space: normal; }
table.risk td:first-child { color: var(--muted); }
.biotype { margin-top: 12px; padding: 12px; border-radius: 10px; background: #f7faf8; display: grid; gap: 4px; font-size: 13px; }
.biotype span { color: var(--muted); }
.mini-select { width: auto; padding: 4px 8px; font-size: 12.5px; }
.comp-bar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; background: #eef2ef; margin: 6px 0 10px; }
.comp-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }
.comp-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.somato { width: 100%; max-width: 300px; display: block; margin: 0 auto; }
.somato .lbl { font-size: 11px; font-weight: 800; letter-spacing: .08em; fill: var(--ink); }
.somato-vals { display: flex; justify-content: center; gap: 16px; font-size: 13px; color: var(--muted); }
.somato-vals b { color: var(--ink); }
.chip.ok { background: var(--brand-2); color: #22573f; }

.trend-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.trend-grid .card { margin: 0; }
.trend-grid .t-wide { grid-column: 1 / -1; }
.trend-table th:first-child { position: sticky; left: 0; background: #fff; text-align: left; white-space: nowrap; color: var(--ink); text-transform: none; font-size: 13px; letter-spacing: 0; }
.trend-table td { font-variant-numeric: tabular-nums; white-space: nowrap; }
.trend-table td.good { color: var(--good); font-weight: 700; }
.trend-table td.bad { color: var(--bad); font-weight: 700; }
.trend-table tbody tr:nth-child(odd) { background: #fafcfb; }

/* ---------- file del paziente ---------- */
.file-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.fchip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--ink); }
.fchip b { color: var(--muted); font-weight: 600; margin-left: 3px; }
.fchip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.fchip.on b { color: #d8efe3; }
.file-name { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); text-decoration: none; }
.file-name:hover { color: var(--brand); }
.ficon { flex: none; font-size: 9.5px; font-weight: 800; color: #fff; border-radius: 5px; padding: 5px 4px; min-width: 32px; text-align: center; }

/* ---------- video visita ---------- */
.video-card { border-left: 4px solid var(--brand); }
.video-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-2); color: var(--brand); font-size: 16px; margin-right: 6px; }
.video-link { display: flex; gap: 8px; margin: 12px 0; }
.video-link input { font-size: 13px; color: var(--muted); }
.video-send { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.video-send > div { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.video-send > div span { grid-column: 1; font-size: 12.5px; color: var(--muted); }
.video-send > div .btn { grid-column: 2; grid-row: 1 / span 2; }
.video-send > div.sent { background: var(--brand-2); border-color: #bfdccd; }
.video-send > div.sent b::after { content: " ✓"; color: var(--brand); }

@media (max-width: 1100px) {
  .ms-layout { grid-template-columns: minmax(0, 1fr) 240px; }
  .ms-nav { display: none; }
  .anthro-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .ms-layout, .anthro-grid, .trend-grid, .a-bmi-body, .video-send { grid-template-columns: 1fr; }
  .a-bmi { grid-column: auto; }
  .ms-live { position: static; }
  .ms-body { max-height: none; }
}

@media (max-width: 1100px) {
  .editor-layout { grid-template-columns: 1fr; }
  .totals-sticky { position: static; max-height: none; }
}
@media (max-width: 800px) {
  .app-legal { grid-column: 1; padding: 0 16px 20px; }
  body { grid-template-columns: minmax(0, 1fr); }   /* minmax(0…): il contenuto largo non allarga la pagina sul telefono */
  /* Sul telefono il menu diventa una barra di simboli fissa in basso */
  .sidebar { position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: auto; z-index: 55; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); min-width: 0; box-shadow: 0 -4px 18px rgba(0,0,0,.18); }
  .sidebar nav { flex-direction: row; gap: 0; justify-content: space-around; }
  .sidebar nav a, .nav-exit { flex: 1 1 0; min-width: 0; justify-content: center; padding: 11px 0; margin: 0; border: 0; border-radius: 10px; width: auto; }
  .nav-exit { color: #f1b9a5; }
  .ni { width: 23px; height: 23px; }
  .nl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nav-badge { position: absolute; top: 3px; left: calc(50% + 6px); margin: 0; font-size: 10.5px; padding: 0 5px; line-height: 16px; }
  .sidebar nav [data-tip]::after { display: block; }
  .sidebar nav .tip::after { opacity: 1; }
  .sidebar nav a:first-child::after { left: 4px; transform: none; }
  .sidebar nav .nav-exit::after { left: auto; right: 4px; transform: none; }
  main { padding-bottom: calc(84px + env(safe-area-inset-bottom)) !important; }
  .app-legal { padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important; }
  body #nx-help { bottom: calc(74px + env(safe-area-inset-bottom)); width: 46px; height: 46px; font-size: 20px; }
  body #nx-chat { bottom: calc(130px + env(safe-area-inset-bottom)); height: min(520px, calc(100vh - 160px)); }
  #toast { bottom: calc(132px + env(safe-area-inset-bottom)); }
  .sidebar-foot, .brand { display: none; }
  main { padding: 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* report per il paziente e logo */
.rep-item { display: grid; gap: 4px; padding: 8px 0; border-top: 1px solid var(--line); }
.rep-item .btn { justify-self: start; }
.sent-ok { color: var(--brand); font-weight: 700; }
.logo-prev { min-height: 60px; min-width: 160px; display: grid; place-items: center start; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 10px; background: #fff; }
.logo-prev img { max-height: 70px; max-width: 260px; display: block; }
.xu-row { margin-bottom: 6px; }

/* Foto del piatto */
.meal-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 16px; align-items: start; }
.meal-grid > * { margin: 0; }
#mres { display: grid; gap: 16px; }
#mres .card { margin: 0; }
.meal-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.meal-photos:empty { display: none; }
.meal-photos figure { margin: 0; position: relative; }
.meal-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.meal-photos .x { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 16px; cursor: pointer; }
.meal-drop { display: grid; gap: 4px; justify-items: center; text-align: center; padding: 28px 16px; border: 2px dashed #b9d6c6; border-radius: 12px; background: #f7fbf9; cursor: pointer; margin-top: 10px; }
.meal-drop:hover { border-color: var(--brand); background: var(--brand-2); }
.meal-drop[hidden] { display: none; }
.meal-wait { display: flex; gap: 14px; align-items: center; }
.spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--brand-2); border-top-color: var(--brand); animation: spin 1s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.meal-total { border-top: 4px solid var(--brand); }
.meal-kcal { font-size: 40px; font-weight: 800; line-height: 1.1; color: #10322a; letter-spacing: -.02em; }
.meal-kcal span { font-size: 18px; font-weight: 600; color: var(--muted); }
.meal-macros { display: flex; gap: 8px; }
.meal-macros div { background: #f7faf8; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; min-width: 92px; }
.meal-macros span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.meal-macros b { font-size: 17px; }
.meal-macros small { color: var(--muted); margin-left: 4px; }
.meal-range { position: relative; height: 10px; border-radius: 5px; background: #eef2f0; margin-top: 14px; }
.meal-range i { position: absolute; top: 0; bottom: 0; border-radius: 5px; background: linear-gradient(90deg, #bfe8cf, #2f7d5b); }
.meal-range b { position: absolute; top: -4px; width: 4px; height: 18px; margin-left: -2px; border-radius: 2px; background: #10322a; }
.meal-q { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.meal-q:first-of-type { border-top: 0; padding-top: 0; }
.meal-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.meal-opts button { display: grid; gap: 1px; text-align: left; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; font: inherit; font-size: 13.5px; }
.meal-opts button small { color: var(--muted); font-size: 11.5px; }
.meal-opts button:hover { border-color: var(--brand); }
.meal-opts button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.meal-opts button.on small { color: #d6efe1; }
.meal-table { table-layout: fixed; width: 100%; }
.meal-table th:nth-child(2), .meal-table td:nth-child(2) { width: 100px; }
.meal-table th:nth-child(3), .meal-table td:nth-child(3) { width: 84px; }
.meal-table th:nth-child(4), .meal-table td:nth-child(4) { width: 34px; padding-left: 0; padding-right: 0; }
.meal-table td { vertical-align: top; overflow-wrap: anywhere; }
.meal-table .meal-food { display: block; margin: 5px 0 3px; width: 100%; max-width: 100%; }
.meal-total .row > div:first-child { min-width: 0; }
.meal-total .muted.small { overflow-wrap: anywhere; }
@media (max-width: 640px) { .meal-table th:nth-child(2), .meal-table td:nth-child(2) { width: 84px; } .meal-table th:nth-child(3), .meal-table td:nth-child(3) { width: 64px; } .meal-table input.meal-g { width: 70px; } }
.meal-table input.meal-g { width: 84px; text-align: right; }
.meal-day { padding: 12px 0; border-top: 1px solid var(--line); }
.meal-day:first-of-type { border-top: 0; padding-top: 0; }
.meal-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; margin-top: 8px; }
.meal-card { display: grid; grid-template-columns: 76px 1fr auto; gap: 12px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 12px; color: inherit; background: #fff; }
.meal-card:hover { border-color: var(--brand); text-decoration: none; }
.meal-card img, .meal-noimg { width: 76px; height: 76px; border-radius: 8px; object-fit: cover; display: grid; place-items: center; background: #f2f5f3; font-size: 28px; }
@media (max-width: 1100px) { .meal-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .meal-macros { width: 100%; } .meal-macros div { flex: 1; min-width: 0; } .meal-kcal { font-size: 34px; } }

/* Richieste dal sito (amministratori) */
.lead-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.lead-row:first-child { border-top: 0; padding-top: 0; }
.lead-main { display: grid; gap: 4px; min-width: 0; }
.lead-side { display: grid; gap: 6px; justify-items: end; align-content: start; }
.lead-note { background: #f7faf8; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; max-width: 320px; white-space: pre-wrap; }
@media (max-width: 800px) { .lead-row { grid-template-columns: 1fr; } .lead-side { justify-items: start; } .lead-side .row { justify-content: flex-start !important; } .lead-side > .small { text-align: left !important; } }

/* Piani */
.plan-table th, .plan-table td { text-align: center; }
.plan-table th:first-child, .plan-table td:first-child { text-align: left; }
.plan-table th small { display: block; font-weight: 500; color: var(--brand); font-size: 11px; }
.plan-table .cur { background: var(--brand-2); }
.plan-table .ok { color: var(--brand); font-weight: 700; }
.danger-text { color: var(--danger); }
.acc-sec { padding: 14px 0; border-top: 1px solid var(--line); }
.acc-sec:first-of-type { border-top: 0; padding-top: 4px; }
.acc-sec h3 { margin: 0 0 8px; font-size: 15px; }
.acc-sec p { margin: 0 0 8px; }
.danger-zone h3 { color: var(--danger); }
.adm-actions { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; min-width: 110px; }

/* Proposta del piano con AI */
.ai-btn { border-color: #b7dcc6; background: #f2faf5; color: #1f5e44; font-weight: 600; }
.pl-h { margin: 18px 0 8px; font-size: 15px; }
.pl-brief { margin-top: 14px; background: #f2faf5; border: 1px solid #cfe7d9; border-radius: 10px; padding: 10px 14px; }
.pl-brief p { margin: 4px 0 0; font-size: 14px; white-space: pre-wrap; }
.pl-steps ul { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.pl-steps li { padding-left: 24px; position: relative; color: var(--muted); }
.pl-steps li::before { content: '○'; position: absolute; left: 4px; }
.pl-steps li.run { color: var(--ink); font-weight: 600; }
.pl-steps li.run::before { content: '◔'; color: var(--brand); }
.pl-steps li.ok { color: var(--ink); }
.pl-steps li.ok::before { content: '✓'; color: var(--brand); font-weight: 700; }
.pl-steps li.ko::before { content: '!'; color: var(--danger); font-weight: 700; }
.ai-banner { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; background: #fff8e8; border: 1px solid #f0d9a6; }
.ai-banner.done { background: #eef8f2; border-color: #cfe7d9; }
.ai-dish { margin-left: 8px; color: var(--brand); font-style: italic; }
.pcheck { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.pcheck li { display: grid; gap: 1px; padding: 6px 8px 6px 28px; border-radius: 8px; position: relative; font-size: 13px; }
.pcheck li span { color: var(--muted); font-size: 12px; }
.pcheck li::before { position: absolute; left: 8px; top: 6px; font-weight: 700; }
.pcheck li.ok::before { content: '✓'; color: var(--brand); }
.pcheck li.ko { background: #fff8e8; }
.pcheck li.ko::before { content: '!'; color: var(--warn); }
.pcheck li.soft { background: #f7f9f8; }
.pcheck li.soft::before { content: 'i'; color: var(--muted); }
.plan-table th .price { display: block; font-weight: 700; font-size: 13px; color: var(--ink); margin-top: 4px; text-transform: none; letter-spacing: 0; }
.plan-table th .price .muted { font-weight: 500; font-size: 11.5px; }
.founder { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 12px 14px; margin-bottom: 14px; border-radius: 10px; background: #fff8e8; border: 1px solid #f0d9a6; }
.founder span { color: var(--muted); font-size: 13px; }
.founder .btn { margin-left: auto; }

/* Guida e assistente */
.guide-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.guide-layout > .card { margin: 0; }
.guide-nav { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.guide-nav input { width: 100%; margin-bottom: 10px; }
.guide-nav h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 14px 0 4px; }
.guide-nav a { display: block; padding: 6px 8px; border-radius: 6px; color: var(--ink); font-size: 14px; }
.guide-nav a small { display: block; color: var(--muted); font-size: 11.5px; }
.guide-nav a:hover { background: var(--brand-2); text-decoration: none; }
.guide-nav a.on { background: var(--brand-2); color: var(--brand); font-weight: 600; }
.guide-art { min-height: 300px; }
.guide-art h2 { margin-top: 2px; }
.eyebrow-s { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--brand); margin: 0; font-weight: 600; }
.guide-body { line-height: 1.6; max-width: 720px; }
.guide-body ol, .guide-body ul { padding-left: 22px; }
.guide-body li { margin: 4px 0; }
.guide-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.guide-rel { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.guide-rel a { padding: 5px 10px; border-radius: 999px; background: var(--brand-2); font-size: 13px; }
.guide-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.guide-card { display: grid; gap: 4px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); }
.guide-card span { color: var(--muted); font-size: 13px; }
.guide-card:hover { border-color: var(--brand); text-decoration: none; }
#nx-help { position: fixed; right: 18px; bottom: 18px; z-index: 60; width: 52px; height: 52px; border-radius: 50%; border: 0; background: #10322a; color: #bfe8cf; font: 800 22px/1 system-ui, sans-serif; cursor: pointer; box-shadow: 0 8px 24px rgba(16, 50, 42, .35); }
#nx-help:hover { background: var(--brand); color: #fff; }
body.auth-mode #nx-help, body.auth-mode #nx-chat { display: none; }
#nx-chat { position: fixed; right: 18px; bottom: 80px; z-index: 61; width: min(380px, calc(100vw - 24px)); height: min(560px, calc(100vh - 110px)); display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .2); overflow: hidden; }
.nx-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: #10322a; color: #fff; flex-wrap: wrap; }
.nx-head .muted { color: #b9d3c5; }
.nx-head .btn.link { color: #bfe8cf; }
.nx-body { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: #f7faf8; }
.nx-msg { max-width: 88%; padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.5; }
.nx-msg p { margin: 2px 0; }
.nx-msg ol, .nx-msg ul { margin: 4px 0; padding-left: 18px; }
.nx-msg.bot { background: #fff; border: 1px solid var(--line); align-self: flex-start; }
.nx-msg.me { background: var(--brand); color: #fff; align-self: flex-end; }
.nx-links { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; font-size: 13px; }
.nx-sug { display: flex; flex-wrap: wrap; gap: 6px; }
.nx-sug button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 10px; font: inherit; font-size: 13px; cursor: pointer; color: var(--brand); }
.nx-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); background: #fff; }
.nx-form input { flex: 1; }
.nx-typing { display: flex; gap: 4px; }
.nx-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: nxb 1s infinite; }
.nx-typing i:nth-child(2) { animation-delay: .15s; } .nx-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes nxb { 50% { opacity: .3; transform: translateY(-3px); } }
.onboarding { border-left: 4px solid var(--brand); }
.ob-bar { height: 6px; border-radius: 3px; background: var(--brand-2); overflow: hidden; margin-bottom: 10px; }
.ob-bar i { display: block; height: 100%; background: var(--brand); }
.ob-list { margin: 0; padding-left: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; }
.ob-list li { display: flex; gap: 8px; align-items: baseline; }
.ob-list li::before { content: '○'; color: var(--muted); }
.ob-list li.ok::before { content: '✓'; color: var(--brand); font-weight: 700; }
.ob-list li.ok > a:first-child { color: var(--muted); text-decoration: line-through; }
@media (max-width: 900px) { .guide-layout { grid-template-columns: 1fr; } .guide-nav { position: static; max-height: none; } }

/* Fondatori: badge, riquadro e contatore */
.founder-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: linear-gradient(135deg, #f6e3a8, #e8c46a); color: #5a4300; font-size: 12px; font-weight: 700; letter-spacing: .02em; vertical-align: middle; white-space: nowrap; }
.founder-badge i { font-style: normal; }
h1 .founder-badge { font-size: 12.5px; margin-left: 6px; }
#user-badge { margin-top: 4px; }
.founder .f-meter { flex-basis: 100%; height: 6px; border-radius: 3px; background: #f0e2bf; overflow: hidden; }
.founder .f-meter i { display: block; height: 100%; background: #c99a2e; }
.founder-card { display: flex; gap: 16px; align-items: center; padding: 14px 16px; margin-bottom: 14px; border-radius: 12px; background: #fffaf0; border: 1px solid #ecd9a8; }
.founder-card p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.fc-no { display: grid; justify-items: center; min-width: 86px; padding: 8px 10px; border-radius: 10px; background: linear-gradient(135deg, #f6e3a8, #e8c46a); color: #5a4300; line-height: 1.15; }
.fc-no b { font-size: 22px; }
.fc-no small { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
@media (max-width: 600px) { .founder-card { flex-direction: column; align-items: flex-start; } }

/* nome del simbolo al passaggio del mouse, sugli schermi stretti con mouse o penna */
@media (max-width: 800px) and (hover: hover) { .sidebar nav [data-tip]:hover::after { opacity: 1; } }

/* Candidatura a fondatore (registrazione e "Il tuo piano") */
.auth-founder { display: grid; gap: 10px; padding: 12px 14px; border-radius: 10px; background: #fffaf0; border: 1px solid #ecd9a8; }
.auth-founder .f { margin: 0; }
#afnd-more { display: grid; gap: 10px; }
#afnd-more[hidden] { display: none; }
.fnd-panel { padding: 14px 16px; margin-bottom: 14px; border-radius: 12px; background: #fffaf0; border: 1px solid #ecd9a8; font-size: 14px; }
.fnd-panel p { margin: 0 0 10px; }
.fnd-steps { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 8px; }
.fnd-steps .btn { vertical-align: middle; }

/* Sezione Fondatore e firma con dito o pennino */
.fnd-card h2 { margin-top: 0; }
.fnd-head { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.fnd-sign { display: grid; gap: 12px; }
.fnd-doc { max-height: 260px; overflow: auto; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; background: #fafcfb; font-size: 13.5px; line-height: 1.55; }
.fnd-doc ul { padding-left: 18px; margin: 8px 0 0; }
.fnd-pads { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 14px; }
.sig-pad { display: block; width: 100%; border: 1.5px dashed #b8c7bf; border-radius: 10px; background: #fff; touch-action: none; cursor: crosshair; }
.sig-pad.sigla { aspect-ratio: 2 / 1; }
.sig-pad.firma { aspect-ratio: 4 / 1.4; }
.fnd-signed { padding: 14px 16px; border-radius: 10px; background: #eef7f1; border: 1px solid #cfe6d8; }
.fnd-signed p { margin: 6px 0 10px; }
@media (max-width: 640px) { .fnd-pads { grid-template-columns: 1fr; } .sig-pad.firma { aspect-ratio: 3 / 1.4; } .fnd-head { flex-direction: column; align-items: flex-start; } }

/* Riquadri di firma (si aprono a tutto schermo) */
.sig-slot { position: relative; display: grid; place-items: center; gap: 4px; padding: 10px; min-height: 96px; border: 1.5px dashed #9fb7aa; border-radius: 12px; background: #fff; cursor: pointer; font: inherit; color: var(--brand); }
.sig-slot.firma { min-height: 110px; }
.sig-slot:hover { border-color: var(--brand); background: #f6fbf8; }
.sig-slot-l { position: absolute; left: 10px; top: 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.sig-slot-e { font-weight: 600; }
.sig-slot img { max-height: 72px; max-width: 90%; }
.sig-slot-x { position: absolute; right: 10px; bottom: 6px; font-size: 11.5px; color: var(--muted); }
.sig-slot.done { border-style: solid; border-color: #b7d8c5; }
.sig-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(10, 25, 20, .7); display: grid; place-items: center; padding: 12px; }
.sig-box { width: min(900px, 100%); background: #fff; border-radius: 16px; padding: 14px; display: grid; gap: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.sig-box.sigla { width: min(520px, 100%); }
.sig-top { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.sig-area { position: relative; }
.sig-area canvas { display: block; width: 100%; aspect-ratio: 2.6 / 1; max-height: 62vh; border: 1.5px solid #cfdcd5; border-radius: 12px; background: #fff; touch-action: none; cursor: crosshair; }
.sig-box.sigla .sig-area canvas { aspect-ratio: 1.6 / 1; }
.sig-line { position: absolute; left: 6%; right: 6%; bottom: 24%; border-bottom: 1px dashed #c8d3cd; pointer-events: none; }
.sig-hint { position: absolute; inset: 0; display: grid; place-items: center; color: #b5c2bb; font-size: 22px; pointer-events: none; }
.sig-hint[hidden] { display: none; }
.sig-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.sig-rotate { margin: 0; display: none; }
@media (max-width: 640px) and (orientation: portrait) { .sig-rotate { display: block; } .sig-area canvas { aspect-ratio: 1.6 / 1; } }
@media (max-height: 500px) { .sig-overlay { padding: 4px; } .sig-box { padding: 8px; gap: 6px; } .sig-area canvas { max-height: 64vh; } }

/* Scheda fondatore in amministrazione: lista di controllo */
.fnd-check { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; counter-reset: s; }
.fnd-check li { display: grid; grid-template-columns: 26px 1fr; column-gap: 8px; align-items: baseline; padding: 8px 10px; border-radius: 8px; background: #f6f7f6; }
.fnd-check li::before { content: '○'; color: var(--muted); font-weight: 700; text-align: center; grid-row: span 2; }
.fnd-check li.ok { background: #eef7f1; }
.fnd-check li.ok::before { content: '✓'; color: var(--brand); }
.fnd-check li span { font-weight: 600; }
.fnd-check li small { grid-column: 2; color: var(--muted); }
.fnd-main { padding: 12px 14px; border-radius: 10px; background: #fffaf0; border: 1px solid #ecd9a8; margin-bottom: 12px; }
.fnd-main p { margin: 8px 0 0; }
.big-btn { font-size: 15px; padding: 10px 18px; }

/* Intolleranze, sensibilità e condizioni cliniche */
.sens .sens-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.sens-item { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; }
.sens-item.on { border-color: #e2b4a4; background: #fff8f5; grid-column: 1 / -1; }
.sens-head { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.sens-body { display: none; margin-top: 6px; }
.sens-item.on .sens-body { display: block; }
.sens-body p { margin: 0 0 6px; }
.sens-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 4px 14px; margin-top: 4px; }
.sens-groups > span { grid-column: 1 / -1; }
.sens-groups label { display: flex; gap: 6px; align-items: baseline; }
.sens-list { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; max-height: 60vh; overflow: auto; }
.sens-list span { padding: 2px 8px; background: #f4f6f5; border-radius: 6px; }
.pl-sens { margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: #fff8f5; border: 1px solid #f0d2c6; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pl-sens label { flex-basis: 100%; }
.bar.gluten { position: relative; }
.bar.gluten s { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); }
.fields > fieldset.wide { grid-column: 1 / -1; min-width: 0; }
fieldset.sens { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0; }
fieldset.sens legend { font-weight: 600; padding: 0 6px; }
.sens-groups label { display: block; padding-left: 22px; text-indent: -22px; }
.sens-groups label input { margin: 0 6px 0 0; vertical-align: -2px; }

/* Trascinamento dei pasti */
.drag-h { cursor: grab; color: var(--muted); font-size: 18px; line-height: 1; padding: 4px 2px; touch-action: none; user-select: none; }
.drag-h:hover { color: var(--brand); }
.meal.dragging { opacity: .55; }
.meal.drop-before { box-shadow: 0 -3px 0 var(--brand); }
.meal.drop-after { box-shadow: 0 3px 0 var(--brand); }
body:has(.meal.dragging) { cursor: grabbing; user-select: none; }

/* Novità versione per versione */
.news-link { display: flex !important; align-items: center; gap: 8px; margin: 2px 0 8px; font-weight: 600; color: var(--brand) !important; }
.news-link small { margin-left: auto; color: var(--muted); font-weight: 400; display: inline !important; }
.news-tag { display: inline-block; padding: 2px 9px; border-radius: 999px; background: #10322a; color: #bfe8cf; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; }
.news-ver { padding: 18px 0; border-top: 1px solid var(--line); }
.news-ver h3 { margin: 8px 0 4px; font-size: 18px; }
.news-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.news-items { display: grid; gap: 12px; margin-top: 10px; }
.news-item { padding: 10px 14px; border-left: 3px solid var(--brand-2); background: #fafcfb; border-radius: 0 8px 8px 0; }
.news-ver.last .news-item { border-left-color: var(--brand); }
.news-item .guide-body p { margin: 4px 0; }
.news-banner { display: grid; gap: 4px; padding: 14px 16px; margin-bottom: 18px; border-radius: 12px; background: #f1f8f4; border: 1px solid #cfe6d8; color: var(--ink); }
.news-banner:hover { text-decoration: none; border-color: var(--brand); }
.news-banner span:last-child { color: var(--muted); font-size: 13px; }
.news-alert { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 14px; border-radius: 10px; background: #f1f8f4; border: 1px solid #cfe6d8; }
.sidebar nav a.has-news { position: relative; }
.sidebar nav a.has-news::before { content: ''; position: absolute; top: 8px; left: 22px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger, #e4572e); box-shadow: 0 0 0 2px #1f3d31; }

/* Questionario pubblico */
body.survey-page { display: block; background: var(--bg); }
.survey-wrap { max-width: 760px; margin: 0 auto; padding: 24px 16px 40px; }
.survey-brand img { height: 30px; display: block; margin: 6px 0 18px; }
.survey-card h1 { margin: 0 0 8px; font-size: 24px; }
.sv-q { border: 0; padding: 0; margin: 18px 0 0; }
.sv-q legend { font-weight: 600; font-size: 15px; margin-bottom: 8px; padding: 0; }
.sv-n { float: left; margin: 18px 10px 0 0; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-2); color: var(--brand); font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.sv-opts { display: flex; flex-wrap: wrap; gap: 8px; clear: left; }
.sv-opts label { display: inline-flex; cursor: pointer; }
.sv-opts input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sv-opts span { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 14px; }
.sv-opts input:checked + span { background: #10322a; border-color: #10322a; color: #fff; }
.sv-opts input:focus-visible + span { outline: 2px solid var(--brand); }
.sv-other { margin-top: 8px; width: 100%; }
.sv-q textarea { width: 100%; clear: left; }
.sv-send { margin-top: 22px; width: 100%; padding: 12px; font-size: 16px; }
.sv-done { text-align: center; padding: 20px 6px; }
.sv-ok { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: var(--brand-2); color: var(--brand); font-size: 32px; display: grid; place-items: center; }
.survey-legal { text-align: center; font-size: 12px; color: var(--muted); margin-top: 18px; }
.sv-sum { padding: 12px 0; border-top: 1px solid var(--line); }
.sv-bar { display: grid; grid-template-columns: minmax(140px, 1fr) 2fr 30px; gap: 10px; align-items: center; font-size: 13px; margin-top: 6px; }
.sv-bar i { height: 8px; border-radius: 4px; background: var(--brand-2); overflow: hidden; }
.sv-bar em { display: block; height: 100%; background: var(--brand); }
.sv-bar b { text-align: right; }
.sv-one { border-top: 1px solid var(--line); padding: 8px 0; }
.sv-one summary { cursor: pointer; }
.sv-one dl { margin: 8px 0 0; font-size: 13.5px; }
.sv-one dt { font-weight: 600; margin-top: 6px; }
.sv-one dd { margin: 2px 0 0; color: var(--muted); }
.sv-list { display: grid; gap: 6px; max-height: 50vh; overflow: auto; }
@media (max-width: 640px) { .sv-bar { grid-template-columns: 1fr 70px 26px; } }

/* Nutrixia Clinica */
.clin-disclaimer { margin-bottom: 12px; }
.clin-form { margin-top: 10px; }
.clin-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.clin-kpis .kpi small { display: block; margin-top: 2px; }
.clin-chart { position: relative; height: 260px; margin: 10px 0; }
.clin-chart.small-chart { height: 200px; }
.clin-notes { margin-top: 12px; display: grid; gap: 8px; }
.clin-note { background: #f7faf8; border: 1px solid var(--line); border-left: 3px solid var(--primary, #2f7d5b); border-radius: 6px; padding: 8px 10px; font-size: 13px; }
.clin-side { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.clin-micro { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; }
.clin-micro > b { flex-basis: 100%; }
@media (max-width: 720px) { .clin-kpis { grid-template-columns: repeat(2, 1fr); } }

/* Assistenti */
.assistant-mode #f #del, .assistant-mode #nav-admin { display: none !important; }
.assist-list { display: grid; gap: 10px; margin-top: 8px; }
.assist-row { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.assist-row.off { opacity: .6; }
.assist-main { flex: 1; min-width: 240px; }
.assist-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.assist-checks { display: grid; gap: 6px; }
.assist-checks label { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.assist-checks input { width: auto; margin-top: 3px; }
.assist-perms { margin: 4px 0 10px; padding-left: 18px; }
.assist-invite { background: #f3f8f5; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }
.assist-invite ul { margin: 6px 0; padding-left: 18px; }
.auth-card.wide-card { width: min(760px, 100%); }
.assist-act { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px 14px; margin-bottom: 12px; font-size: 13.5px; background: #fff; }
.assist-act h3 { font-size: 14px; margin: 12px 0 4px; color: var(--brand); }
.assist-act p { margin: 3px 0; }

/* Farmaci */
.drug-list { display: grid; gap: 8px; }
.drug-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: inherit; background: #fff; }
.drug-row:hover { border-color: var(--leaf, #2f7d5b); background: #f7faf8; }
.drug-row b { color: var(--forest, #10322a); }
.drug-row small { flex-basis: 100%; }
.drug-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.drug-facts div { background: #f7faf8; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.drug-facts span { display: block; font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.drug-facts b { display: block; margin-top: 2px; }
.drug-sec { border-bottom: 1px solid var(--line); padding: 10px 0; }
.drug-sec summary { cursor: pointer; }
.drug-text { white-space: pre-wrap; font-size: 14px; line-height: 1.55; margin-top: 8px; }
.drug-notes { border-left: 4px solid var(--tomato, #e4572e); }
.drug-notes .drug-text { margin-top: 6px; }
/* Prescrizione */
.rx-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.4fr) 90px 28px; gap: 8px 10px; align-items: end; padding: 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: #fbfdfc; }
.rx-row .wide { grid-column: 1 / 4; }
.rx-row .rx-del { align-self: start; font-size: 20px; }
@media (max-width: 700px) { .rx-row { grid-template-columns: 1fr 80px; } .rx-row .wide, .rx-row label:first-child { grid-column: 1 / -1; } }
/* Esami: inserimento a tabella e lettura del referto */
.lb-import { display: grid; gap: 6px; background: #f3f8f5; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.lb-table { width: 100%; }
.lb-table td { padding: 4px 8px; vertical-align: middle; }
.lb-table td:first-child { font-size: 14px; }
.lb-table input { padding: 6px 8px; }
.lb-table td:nth-child(2) { width: 130px; }
.lb-table td:nth-child(3) { width: 120px; }
.lb-table tr.lb-read td { background: #fff7e0; }
/* Visita: esami, prescrizione, lettera */
.visit-blocks { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.visit-blocks .vb { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fbfdfc; }
.visit-blocks .vb p { margin: 6px 0 0; }
/* Bozze: modello o AI */
.draft-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: #f3f8f5; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.validate-row { gap: 8px; justify-content: flex-start; background: #fff7e0; border: 1px solid #f2d78a; border-radius: 8px; padding: 8px 12px; margin-top: 12px; }
.drug-missing { margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; display: grid; gap: 6px; }
.drug-missing .drug-row { align-items: center; }
.drug-missing .drug-row .btn { margin-left: auto; }
