:root {
  --bg: #F4F1EA;
  --surface: #FFFDF8;
  --surface-2: #EDE8DD;
  --ink: #1F3A2F;
  --ink-2: #5B6F64;
  --line: #E2DCCF;
  --sage: #7C9A7E;
  --sage-soft: #DCE6D9;
  --clay: #D98E6A;
  --clay-soft: #F5DFD3;
  --sky: #8FB3C4;
  --sky-soft: #DCE9EF;
  --sun: #E2B85C;
  --danger: #B85C4A;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(31,58,47,.04), 0 8px 24px rgba(31,58,47,.06);
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
}
/* versione scura predefinita (pagina di accesso); dopo il login il tema dell'utente arriva da index.php (themes.php) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141A17; --surface: #1C2420; --surface-2: #242E29; --ink: #E9EFE9; --ink-2: #9DB0A4;
    --line: #2C3832; --sage: #93B495; --sage-soft: #2A3A2E; --clay: #E3A07F; --clay-soft: #3D2C24;
    --sky: #9CC1D1; --sky-soft: #22343C; --note-bg: #3A3320; --shadow: 0 8px 24px rgba(0,0,0,.25);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 30px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
.muted { color: var(--ink-2); }
.eyebrow { margin: 0 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); }
a { color: inherit; }

/* Login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 20% 10%, var(--sage-soft), transparent 50%), radial-gradient(circle at 90% 90%, var(--clay-soft), transparent 45%), var(--bg); }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border-radius: 28px; padding: 36px 28px; box-shadow: var(--shadow); text-align: center; }
.login-card h1 { margin-top: 14px; }
.login-card form { margin-top: 24px; display: grid; gap: 12px; }
.brand-mark img { width: 64px; height: 64px; }
.err { color: var(--danger); margin: 0; font-size: 14px; }

/* Shell */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; padding: 28px 18px; display: flex; flex-direction: column; gap: 28px; border-right: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 22px; font-weight: 600; padding: 0 10px; }
.logo img { width: 32px; height: 32px; }
.nav { display: grid; gap: 4px; }
.nav a, .tabbar a { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink-2); font-weight: 500; border-radius: 14px; padding: 10px 12px; cursor: pointer; }
.nav a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.nav a:hover:not(.on) { background: var(--surface-2); }
.nav svg, .tabbar svg { width: 20px; height: 20px; flex: none; }

.content { padding: 32px 40px 60px; max-width: 1100px; width: 100%; }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 24px; gap: 12px; }
.tabbar { display: none; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: calc(14px + env(safe-area-inset-top)) 16px calc(110px + env(safe-area-inset-bottom)); }
  h1 { font-size: 26px; }
  .topbar { margin-bottom: 18px; align-items: center; }
  .top-avatar { display: grid; }
  .tabbar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) 64px repeat(2, minmax(0, 1.5fr)); align-items: center; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { flex-direction: column; gap: 3px; font-size: 11px; padding: 6px 2px; justify-content: center; border-radius: 14px; min-height: 52px; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.on { color: var(--ink); }
  .tabbar a.on svg { background: var(--sage-soft); border-radius: 99px; padding: 3px 14px; width: 52px; height: 28px; box-sizing: border-box; }
  .fab { justify-self: center; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg); display: grid; place-items: center;
    box-shadow: 0 8px 20px rgba(31,58,47,.28); transform: translateY(-14px); cursor: pointer; }
  .fab svg { width: 26px; height: 26px; }
  .fab:active { transform: translateY(-14px) scale(.94); }
  /* niente zoom automatico di iOS sui campi: almeno 16px */
  input, select, textarea { font-size: 16px; }
  .btn { min-height: 40px; }
  .btn.sm { min-height: 34px; }
  .card { padding: 16px; border-radius: 20px; }
  .card-head { flex-wrap: wrap; }
  .card-head > .actions, #diet-tools, #diet-tools.actions { width: 100%; }
  .seg { width: 100%; } .seg button { flex: 1; }
  .datebar { width: 100%; } .datebar input { flex: 1; }
  /* .ring-wrap .ring: più specifico della regola generale .ring (132px) che sta più sotto, altrimenti il testo non è centrato */
  .ring-wrap { gap: 14px; } .ring-wrap .ring { width: 116px; height: 116px; } .ring svg { width: 116px; height: 116px; }
  .set-row { grid-template-columns: 24px 1fr 1fr 32px; } .set-row input { padding: 12px 8px; }
  .item { padding: 14px; }
  .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
  .sheet { max-height: 92dvh; }
}


/* Cards & grid */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 820px) { .g2, .g3 { grid-template-columns: 1fr; } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card.tint-sage { background: var(--sage-soft); box-shadow: none; }
.card.tint-clay { background: var(--clay-soft); box-shadow: none; }
.card.tint-sky { background: var(--sky-soft); box-shadow: none; }
.section { margin-top: 28px; }
.section > .card-head { margin-bottom: 12px; }

/* Stats */
.stat .label { font-size: 13px; color: var(--ink-2); }
.stat .value { font-family: var(--serif); font-size: 28px; font-weight: 600; line-height: 1.1; margin-top: 4px; }
.stat .value small { font-family: var(--sans); font-size: 13px; font-weight: 500; color: var(--ink-2); margin-left: 2px; }
.delta { font-size: 12px; font-weight: 600; margin-top: 4px; }
.delta.good { color: #4E7D55; } .delta.bad { color: var(--danger); } .delta.flat { color: var(--ink-2); }

/* Ring */
.ring-wrap { display: flex; align-items: center; gap: 20px; }
.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .center b { font-family: var(--serif); font-size: 26px; }
.ring .center span { font-size: 12px; color: var(--ink-2); }
.macros { display: grid; gap: 10px; flex: 1; min-width: 0; }
.bar-row .top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; transition: width .4s ease; }

/* Week dots */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.week div { font-size: 11px; color: var(--ink-2); }
.week .dot { width: 34px; height: 34px; margin: 6px auto 0; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 13px; color: var(--ink-2); }
.week .dot.done { background: var(--sage); color: #fff; }
.week .dot.today { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Lists */
.list { display: grid; gap: 8px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border-radius: var(--radius-sm); border: 1px solid var(--line); }
.item .main { flex: 1; min-width: 0; }
.item .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .sub { font-size: 13px; color: var(--ink-2); }
.item .kcal { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.slot-group { margin-top: 18px; }
.slot-group h3 { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.slot-group h3 span { font-family: var(--sans); font-size: 13px; font-weight: 500; color: var(--ink-2); }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-2); border: 1.5px dashed var(--line); border-radius: var(--radius); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--ink-2); }
.pill.sage { background: var(--sage-soft); color: var(--ink); }
.pill.clay { background: var(--clay-soft); color: var(--ink); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th { text-align: left; font-weight: 500; color: var(--ink-2); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: var(--surface-2); }

/* Buttons & form */
.btn { appearance: none; border: 0; border-radius: 99px; padding: 10px 18px; font: 500 14px var(--sans); cursor: pointer; background: var(--surface-2); color: var(--ink); display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.sage { background: var(--sage); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; color: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.block { width: 100%; justify-content: center; padding: 13px; }
.btn.icon { padding: 8px; border-radius: 50%; }
.btn svg { width: 16px; height: 16px; }
.chip svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
input, select, textarea { width: 100%; font: 15px var(--sans); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--sage); box-shadow: 0 0 0 3px var(--sage-soft); }
label { display: grid; gap: 5px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.form { display: grid; gap: 12px; }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 99px; padding: 4px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 99px; font: 500 13px var(--sans); color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.datebar { display: flex; align-items: center; gap: 8px; }
.datebar input { width: auto; padding: 8px 12px; }

/* Sheet (modal) */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(20,30,25,.35); backdrop-filter: blur(2px); z-index: 40; }
.sheet { position: fixed; z-index: 50; background: var(--bg); width: min(560px, 100%); max-height: 90dvh; overflow-y: auto; padding: 24px;
  left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.sheet h2 { margin-bottom: 16px; }
@media (max-width: 820px) {
  .sheet { top: auto; bottom: 0; transform: translateX(-50%); border-radius: 28px 28px 0 0; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}
.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-size: 14px; z-index: 60; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.cal .h { font-size: 11px; color: var(--ink-2); text-transform: uppercase; padding-bottom: 4px; }
.cal .d { aspect-ratio: 1; border-radius: 12px; display: grid; place-items: center; font-size: 14px; background: var(--surface-2); color: var(--ink-2); position: relative; max-height: 52px; }
.cal .d.gym { background: var(--sage); color: #fff; font-weight: 600; cursor: pointer; }
.cal .d.today { outline: 2px solid var(--ink); outline-offset: 1px; }
.cal .d.out { background: transparent; }

/* Exercises */
.day-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.ex { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.ex-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.ex-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.sets { display: grid; gap: 6px; margin-top: 12px; }
.set-row { display: grid; grid-template-columns: 28px 1fr 1fr 36px; gap: 8px; align-items: center; }
.set-row input { padding: 8px 10px; text-align: center; }
.set-row .n { font-size: 13px; color: var(--ink-2); text-align: center; }
.chart-box { position: relative; height: 220px; }
.files { display: grid; gap: 8px; }
.file-link { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); text-decoration: none; }
.file-link span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hide-m { } @media (max-width: 820px) { .hide-m { display: none; } }

/* ---- v2: account, admin, importazione AI ---- */
.small { font-size: 13px; }
code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }
.note { background: var(--note-bg, #F6EBCF); color: var(--ink); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 10px 0; }
.auth-form { margin-top: 24px; display: grid; gap: 10px; text-align: left; }
.auth-form .muted, .auth-form .err, .auth-form .note { text-align: center; margin: 4px 0 0; }
.switch { margin: 18px 0 0; font-size: 14px; color: var(--ink-2); }
.switch a { color: var(--ink); font-weight: 600; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; font-weight: 400; color: var(--ink-2); margin: 10px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; flex: none; margin: 1px 0 0; accent-color: var(--sage); }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; }
.me b { display: block; font-size: 14px; line-height: 1.2; }
.me a { font-size: 13px; color: var(--ink-2); text-decoration: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--sage-soft); color: var(--ink); display: grid; place-items: center; font-weight: 600; flex: none; }
.drop { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 28px 16px; border: 1.5px dashed var(--sage); border-radius: var(--radius); background: var(--sage-soft); color: var(--ink); cursor: pointer; font-size: 15px; }
.drop:hover { filter: brightness(.98); }
.drop-icon svg { width: 28px; height: 28px; }
.ai-loading { display: flex; gap: 14px; align-items: center; padding: 18px; border-radius: var(--radius); background: var(--surface); }
.ai-loading p { margin: 2px 0 0; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--sage-soft); border-top-color: var(--sage); animation: spin .9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.sheet.wide { width: min(760px, 100%); }
.rev-list { display: grid; gap: 8px; margin: 10px 0; }
.rev-row { display: grid; gap: 8px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); }
.rev-top { display: flex; gap: 8px; align-items: center; }
.rev-top > input, .rev-top > select { flex: 1; }
.rev-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 6px; }
.rev-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.rev-row input, .rev-row select, .rev-row textarea { padding: 8px 10px; font-size: 14px; }
.rev-day { margin-top: 16px; }
.rev-day .day-label { font-family: var(--serif); font-weight: 600; font-size: 17px; border: 0; background: transparent; padding: 4px 0; }
.sticky-actions { position: sticky; bottom: -24px; background: var(--bg); padding: 14px 0 4px; margin-top: 12px; }

/* ---- v4: azioni rapide, avatar, esercizi a tempo, avanzamento ---- */
.top-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--sage-soft); color: var(--ink); place-items: center; font-weight: 600; text-decoration: none; flex: none; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick button { display: grid; gap: 4px; justify-items: start; text-align: left; padding: 16px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.quick button svg { width: 26px; height: 26px; color: var(--sage); margin-bottom: 4px; }
.quick button span { font-size: 12px; color: var(--ink-2); }
.quick button:active { transform: scale(.98); }
.progress-card { margin-bottom: 12px; padding: 14px 16px; }
.progress-top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.progress-top b { font-family: var(--serif); font-size: 22px; }
.ex-type { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.ex.is-done { border-color: var(--sage); background: color-mix(in srgb, var(--sage-soft) 45%, var(--surface)); }
.done-btn { width: 48px; height: 48px; flex: none; border-radius: 50%; border: 2px solid var(--sage); background: transparent; color: var(--sage); font-size: 20px; font-weight: 700; cursor: pointer; display: grid; place-items: center; }
.done-btn:not(:hover) { color: transparent; }
.ex.is-done .done-btn { color: #fff; }
.ex.is-done .done-btn { background: var(--sage); }
.ex-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--clay); vertical-align: 1px; }
.ex-dot.t-cardio { background: var(--sky); } .ex-dot.t-allungamento { background: var(--sage); }
.type-sel { max-width: 140px; }

.set-row input::placeholder, .rev-row input::placeholder { color: var(--ink-2); opacity: .45; }
@media (max-width: 820px) { .rev-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; } .rev-grid label { font-size: 12px; } }

/* ---- v5: alternative del piano, referto completo, email ---- */
.alt-title { margin: 14px 0 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.slot-group .actions { margin-top: 2px; }
.alt-in { max-width: 84px; text-align: center; text-transform: uppercase; }
.pick-list { display: grid; gap: 10px; }
.pick-slot { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.pick-head { display: flex; align-items: center; gap: 10px; padding: 14px; cursor: pointer; font-size: 15px; color: var(--ink); font-weight: 400; }
.pick-head input { width: 20px; height: 20px; accent-color: var(--sage); flex: none; margin: 0; }
.pick-head .muted { margin-left: auto; }
.pick-body { display: none; padding: 0 14px 14px; }
.pick-slot.open .pick-body { display: grid; gap: 10px; }
.pick-slot.open { border-color: var(--sage); }
.pick-fixed { display: grid; gap: 2px; padding: 10px 12px; background: var(--surface-2); border-radius: 12px; font-size: 14px; }
.pick-alts { display: grid; gap: 8px; }
.alt-card { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; font-size: 14px; color: var(--ink); font-weight: 400; }
.alt-card input { width: 20px; height: 20px; accent-color: var(--sage); margin: 1px 0 0; flex: none; }
.alt-card:has(input:checked) { border-color: var(--sage); background: color-mix(in srgb, var(--sage-soft) 50%, var(--surface)); }
.alt-card .alt-line { display: block; color: var(--ink-2); margin-top: 2px; }
.mini-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-top: 12px; }
.mini { background: var(--surface); border-radius: 14px; padding: 10px 12px; display: grid; gap: 2px; border: 1px solid var(--line); }
.mini span { font-size: 12px; color: var(--ink-2); }
.mini b { font-family: var(--serif); font-size: 18px; }
.mini small { font-family: var(--sans); font-size: 12px; color: var(--ink-2); margin-left: 2px; font-weight: 500; }
.goal-card { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; background: var(--sage-soft); box-shadow: none; }
.goal-card > div { display: grid; gap: 2px; }
.goal-card b { font-family: var(--serif); font-size: 22px; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.kv { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 2px; }
.kv span { font-size: 12px; color: var(--ink-2); }
.kv b { font-size: 16px; } .kv b small { font-weight: 500; color: var(--ink-2); }
.kv .delta { margin: 0; }
.rev-other summary { cursor: pointer; font-size: 13px; color: var(--ink-2); padding: 6px 0; }
.rev-other .kv-grid { margin-top: 8px; }

/* ---- mobile: rifinitura di tutte le pagine ---- */
@media (max-width: 820px) {
  .grid.g4 { gap: 10px; }
  .stat .value { font-size: 24px; }
  .card.stat { padding: 14px; }
  .slot-group { margin-top: 20px; }
  .slot-group h3 { font-size: 17px; }
  .slot-group .actions .btn { flex: 1; justify-content: center; }
  .item .title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .item .kcal { font-size: 15px; }
  .card .actions .btn:not(.sm) { flex: 1 1 auto; justify-content: center; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  td, th { padding: 10px 8px; }
  .chart-box { height: 200px !important; }
  .kv-grid { grid-template-columns: 1fr 1fr; }
  .mini-row { grid-template-columns: repeat(2, 1fr); }
  .goal-card { grid-template-columns: 1fr 1fr; }
  .sheet h2 { font-size: 21px; padding-right: 8px; }
  .sheet .form .row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick button { padding: 14px; }
  .day-tabs { margin: 0 -16px 12px; padding: 0 16px 4px; }
  .cal .d { border-radius: 10px; font-size: 13px; }
  .list .item .btn.icon { width: 40px; height: 40px; }
}
@media (max-width: 820px) { .rev-grid.rev-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .card-head .seg { order: 2; } }
.item > svg { width: 18px; height: 18px; flex: none; color: var(--ink-2); }
@media (max-width: 820px) {
  .user-item { flex-wrap: wrap; row-gap: 8px; }
  .user-item .main { flex: 1 1 calc(100% - 52px); }
  .user-item .pill:first-of-type { margin-left: 48px; }
  .user-item [data-approve] { margin-left: auto; }
}

/* ---- v6: piani alimentari ---- */
.plan-card .plan-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.plan-card.is-active { border: 1px solid var(--sage); }
.plan-card h2 { margin-top: 2px; }

/* ---- v6: più foto, foto del pasto ---- */
.pick-files { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.small-drop { padding: 18px 10px; font-size: 14px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; margin: 12px 0 4px; }
.thumbs:empty { display: none; }
.thumb { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .pdf { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; color: var(--clay); }
.thumb-n { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; border-radius: 99px; padding: 1px 7px; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; cursor: pointer; }
.thumb button svg { width: 14px; height: 14px; }
.quick { grid-template-columns: 1fr 1fr; }
@media (max-width: 820px) { .rev-grid.rev-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; } .rev-grid.rev-5 input { padding: 8px 4px; text-align: center; } }

/* ---- v7: scelte passo passo, timer, foto esercizi ---- */
.step { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-top: 4px; }
.step-n { width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-size: 11px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 14px; padding: 9px 12px; font: 14px var(--sans); text-align: left; cursor: pointer; line-height: 1.3; }
.chip small { color: var(--ink-2); }
.chip.on { border-color: var(--sage); background: color-mix(in srgb, var(--sage-soft) 60%, var(--surface)); box-shadow: inset 0 0 0 1px var(--sage); }
.chips.big .chip { flex: 1 1 120px; padding: 12px; }
.pick-items { display: grid; gap: 10px; }
.pick-line { font-size: 14px; padding: 8px 12px; background: var(--surface-2); border-radius: 12px; }
.pick-choice { display: grid; gap: 6px; }
.pick-label { font-size: 13px; font-weight: 600; }
.timer-bar { position: fixed; left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 30; max-width: 520px; margin: 0 auto;
  background: var(--ink); color: var(--bg); border-radius: 20px; padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
@media (min-width: 821px) { .timer-bar { bottom: 24px; left: 260px; } }
.timer-bar .t-info { display: grid; }
.timer-bar .t-label { font-size: 12px; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer-bar .t-time { font-family: var(--serif); font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.timer-bar .t-actions { display: flex; gap: 6px; align-items: center; }
.timer-bar .t-actions button { border: 0; border-radius: 99px; padding: 10px 14px; font: 600 14px var(--sans); background: rgba(255,255,255,.14); color: inherit; cursor: pointer; }
.timer-bar .t-bar { grid-column: 1 / -1; height: 5px; background: rgba(255,255,255,.15); border-radius: 99px; overflow: hidden; }
.timer-bar .t-bar i { display: block; height: 100%; background: var(--sage); transition: width .25s linear; }
.session-clock { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.session-clock > div { display: grid; }
.session-clock b { font-family: var(--serif); font-size: 26px; font-variant-numeric: tabular-nums; }
.ex-main { min-width: 0; flex: 1; }
.ex-side { display: flex; align-items: flex-start; gap: 12px; flex: none; }
.side-act { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 52px; }
.side-act small { font-size: 12px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ex-photo { width: 100%; max-height: 180px; object-fit: cover; border-radius: 12px; margin-top: 10px; cursor: zoom-in; display: block; }
.ex-links { display: flex; gap: 12px; margin-top: 8px; font-size: 13px; }
.ex-links a { color: var(--ink-2); }
.ex-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; flex: none; border: 1px solid var(--line); }
.ex-thumb.is-info { object-fit: contain; background: #fff; padding: 3px; }
label.btn.icon { cursor: pointer; }
.timer-bar[hidden] { display: none; }

/* alternative con il loro contenuto */
.chips.big .alt-chip { flex: 1 1 260px; display: flex; gap: 10px; align-items: flex-start; }
.alt-chip b { display: block; font-weight: 600; line-height: 1.35; }
.alt-chip small { display: block; margin-top: 2px; }
.alt-letter { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; margin-right: 6px; vertical-align: 1px; }
.alt-chip .alt-letter { margin: 0; }
.alt-chip.on .alt-letter { background: var(--sage); color: #fff; }
.alt-title .alt-letter { text-transform: none; letter-spacing: 0; }
.alt-title { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--ink); }
@media (max-width: 820px) { .chips.big .alt-chip { flex-basis: 100%; } }

.key-row { display: grid; gap: 6px; margin-bottom: 10px; }
.key-row .actions { align-items: center; }

/* foto del pasto: corrispondenza con il piano e fonti dei valori */
.match-box { display: grid; gap: 8px; margin-bottom: 12px; }
.match-box .alt-card small { font-weight: 500; }
.rev-list.dimmed { opacity: .45; pointer-events: none; }
.src-line { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.src-line a { color: var(--ink-2); }

/* ---- v1.9: aggiornamenti e novità ---- */
.update-bar { position: fixed; z-index: 35; top: calc(10px + env(safe-area-inset-top)); left: 12px; right: 12px; max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px; background: var(--ink); color: var(--bg); border-radius: 18px; padding: 10px 10px 10px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.update-bar[hidden] { display: none; }
.update-bar > div { flex: 1; min-width: 0; display: grid; }
.update-bar span { font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.update-bar .btn.primary { background: var(--bg); color: var(--ink); }
.update-bar .btn.ghost { color: var(--bg); }
.cl-list { display: grid; gap: 14px; }
.cl-entry { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; }
.cl-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.cl-entry ul { margin: 8px 0 0; padding-left: 18px; } .cl-entry li { margin: 3px 0; font-size: 14px; }
@media (min-width: 821px) { .update-bar { left: 260px; } }

/* ---- v1.10: prossimo allenamento, rinomina giorni ---- */
.next-card h2 { font-size: 26px; margin-top: 2px; }
.next-card .btn.primary { padding: 14px 22px; font-size: 16px; }
.resume-card { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; text-decoration: none; border: 1px solid var(--sage); }
.day-title { display: inline-flex; align-items: center; gap: 4px; font-family: var(--serif); font-size: inherit; color: var(--ink); }
.day-title .btn.icon { padding: 4px; font-size: 14px; }
@media (max-width: 820px) { .next-card .btn.primary { width: 100%; justify-content: center; } }

/* ---- v1.11: dettagli esercizio ---- */
.set-kv { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) 40px; gap: 6px; margin-bottom: 8px; align-items: center; }
.set-kv input, .set-kv select { padding: 10px; min-width: 0; width: 100%; }
.set-kv .set-custom { grid-column: 1 / 3; }
.set-kv .set-custom[hidden] { display: none; }
.steps { margin: 6px 0 10px; padding-left: 20px; } .steps li { margin: 4px 0; }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.set-sum { color: var(--ink); }
.set-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip-s { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: var(--sky-soft); color: var(--ink); }
.howto { margin-top: 8px; padding-left: 0; }
.enrich-pill { cursor: pointer; font: inherit; position: fixed; z-index: 31; left: 50%; transform: translateX(-50%); top: calc(10px + env(safe-area-inset-top)); display: flex; align-items: center; gap: 10px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 99px; padding: 8px 8px 8px 14px; font-size: 13px; box-shadow: var(--shadow); max-width: calc(100% - 24px); }
.enrich-pill[hidden] { display: none; }
.enrich-pill button { border: 0; background: var(--surface-2); border-radius: 50%; width: 28px; height: 28px; display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.enrich-pill button svg { width: 14px; height: 14px; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
.enrich-pill { padding: 8px 14px; }
.dot-wait { width: 10px; height: 10px; border-radius: 50%; background: var(--clay); flex: none; }
.job-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; background: var(--surface); }

/* ---- allenamento guidato ---- */
body.no-scroll { overflow: hidden; }
.g-start { width: 100%; justify-content: center; padding: 16px; font-size: 16px; margin-bottom: 12px; }
.play-btn { width: 48px; height: 48px; flex: none; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg); font-size: 18px; cursor: pointer; display: grid; place-items: center; padding-left: 3px; }
.guide { position: fixed; inset: 0; z-index: 45; background: var(--bg); display: flex; flex-direction: column; padding: calc(10px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); }
.g-top { display: flex; align-items: center; gap: 12px; }
.g-x { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--ink); display: grid; place-items: center; cursor: pointer; font-size: 16px; flex: none; }
.g-x svg { width: 18px; height: 18px; }
.g-prog { flex: 1; display: grid; gap: 4px; font-size: 12px; color: var(--ink-2); text-align: center; }
.g-body { flex: 1; overflow-y: auto; padding: 18px 2px 10px; max-width: 620px; width: 100%; margin: 0 auto; }
.g-title { font-size: 30px; margin: 2px 0 8px; }
.g-photo { width: 100%; max-height: 32vh; object-fit: cover; border-radius: 16px; margin: 6px 0; }
.g-target { margin-top: 18px; background: var(--surface); border-radius: 20px; padding: 18px; text-align: center; display: grid; gap: 4px; box-shadow: var(--shadow); }
.g-target span { color: var(--ink-2); font-size: 14px; } .g-target b { font-family: var(--serif); font-size: 26px; } .g-target small { color: var(--ink-2); }
.g-clock { font-family: var(--sans); font-weight: 600; letter-spacing: -.03em; font-size: clamp(72px, 22vw, 120px); line-height: 1; text-align: center; margin-top: 24px; font-variant-numeric: tabular-nums; transition: color .2s; }
.g-clock.soon { color: var(--clay); }
.g-clock.paused { color: var(--ink-2); }
.g-done { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 2px; max-width: 620px; width: 100%; margin: 0 auto; scrollbar-width: none; min-height: 40px; align-items: center; }
.g-done::-webkit-scrollbar { display: none; }
.g-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1.5px solid color-mix(in srgb, var(--sage) 45%, transparent); background: var(--surface); color: var(--ink); font: 500 13px/1 var(--sans); white-space: nowrap; cursor: pointer; }
.g-chip b { color: var(--sage); }
.g-chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.g-chip.on b { color: inherit; }
.g-next { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding: 12px 16px; border-radius: 16px; background: var(--surface-2); }
.g-next div { display: grid; gap: 2px; min-width: 0; }
.g-next span { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.g-next b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-next small { color: var(--ink-2); }
.g-next em { font-style: normal; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 12px; background: color-mix(in srgb, var(--clay) 18%, transparent); flex: none; }
.g-side { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.g-side .btn { min-height: 44px; }
.g-sub { text-align: center; color: var(--ink-2); margin: 10px 0 0; }
.g-restbar { max-width: 320px; margin: 16px auto 0; height: 10px; }
.g-log { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.g-step { background: var(--surface); border-radius: var(--radius-sm); padding: 10px 8px 12px; box-shadow: var(--shadow); text-align: center; }
.g-step-l { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.g-step-row { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.g-step-row b { font: 600 30px/1 var(--serif); color: var(--ink); min-width: 0; flex: 1; font-variant-numeric: tabular-nums; }
.g-step-row button { width: 48px; height: 48px; flex: none; border-radius: 50%; border: 0; background: var(--sage-soft); color: var(--ink); font: 600 26px/1 var(--sans); cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.g-step-row button:active { background: var(--sage); color: #fff; }
.g-kgstep { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.g-kgstep span { margin-right: 4px; }
.g-kgstep button { min-width: 40px; height: 30px; padding: 0 8px; border-radius: 15px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 13px/1 var(--sans); cursor: pointer; }
.g-kgstep button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.g-actions { display: grid; justify-items: center; gap: 8px; max-width: 620px; width: 100%; margin: 0 auto; }
.g-play { width: 96px; height: 96px; border-radius: 50%; border: 0; background: var(--sage); color: #fff; font-size: 38px; cursor: pointer; box-shadow: 0 10px 30px rgba(31,58,47,.3); padding-left: 6px; }
.g-play.stop { background: var(--clay); padding-left: 0; font-size: 32px; }
.g-play:active { transform: scale(.95); }
.g-hint { margin: 0; font-weight: 600; }
.g-big { width: 100%; justify-content: center; padding: 16px; font-size: 17px; }
.g-nav { display: flex; justify-content: space-between; width: 100%; margin-top: 4px; }
.g-end { display: grid; place-content: center; text-align: center; }
.g-medal { font-size: 64px; }

/* ---- modifiche agli esercizi e storico ---- */
.g-links, .ex-links { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.g-links .btn:first-child, .ex-links .btn:first-child { padding-left: 0; }
.g-links .pill { font-size: 11px; padding: 1px 6px; }
.ch-box { margin: 14px 0 4px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.ch-box summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.ch-list { display: grid; gap: 8px; margin-top: 10px; }
.ch-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 13px; }
.ch-row .pill { font-size: 11px; white-space: nowrap; }
@media (max-width: 480px) { .ch-row { grid-template-columns: 56px minmax(0, 1fr); } .ch-row .pill { grid-column: 2; justify-self: start; } }
.check-item { cursor: pointer; gap: 12px; }
.check-item input { width: 20px; height: 20px; flex: none; accent-color: var(--sage); }

/* ---- aspetto: scelta del tema ---- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 12px; }
.theme-opt { border: 2px solid var(--line); border-radius: 16px; padding: 10px 8px 8px; background: var(--surface); cursor: pointer; display: grid; gap: 6px; justify-items: center; font: 500 13px var(--sans); color: var(--ink); }
.theme-opt.on { border-color: var(--ink); }
.theme-sw { width: 100%; height: 38px; border-radius: 10px; display: flex; overflow: hidden; border: 1px solid rgba(0,0,0,.06); }
.theme-sw i { flex: 1; }

/* ---- documenti ---- */
.pill.sky { background: var(--sky-soft); color: var(--ink); }
.pill.danger { background: color-mix(in srgb, var(--danger) 18%, var(--surface)); color: var(--ink); }

.doc-item .title a { text-decoration: none; }
.doc-item .sub .pill { font-size: 11px; padding: 1px 7px; }
.doc-thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: none; background: var(--surface-2); }
.doc-pdf { display: grid; place-items: center; font: 600 11px var(--sans); color: var(--ink-2); }
.section .chips { margin-bottom: 12px; }
.radio-card { display: flex !important; gap: 12px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 16px; padding: 12px; cursor: pointer; background: var(--surface); }
.radio-card:has(input:checked) { border-color: var(--sage); box-shadow: inset 0 0 0 1px var(--sage); }
.radio-card input[type=radio] { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--sage); }
.radio-card > div { display: grid; gap: 6px; flex: 1; min-width: 0; }
.radio-card b { display: flex; align-items: center; gap: 6px; } .radio-card b svg { width: 16px; height: 16px; }
.radio-card select:disabled { opacity: .45; }
.toast.has-action { width: max-content; max-width: calc(100vw - 32px); display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 18px; }
.toast button { border: 0; background: var(--bg); color: var(--ink); border-radius: 99px; padding: 7px 14px; font: 600 13px var(--sans); cursor: pointer; }
.toast[hidden] { display: none; }
.doc-link { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); }
.doc-link > svg { width: 24px; height: 24px; flex: none; }
.doc-link > div { flex: 1; }

/* ---- dal piano: alimenti e quantità ---- */
.food-rows { display: grid; gap: 6px; margin-top: 8px; }
.food-row { display: grid; grid-template-columns: minmax(0, 1fr) 116px 70px; gap: 8px; align-items: center; font-size: 14px; }
.fr-name { min-width: 0; overflow-wrap: anywhere; }
.fr-qty { display: flex; align-items: center; gap: 4px; }
.fr-qty input, .fr-qty select { width: 100%; min-width: 0; padding: 8px 8px; font-size: 15px; text-align: right; }
.fr-qty select { text-align: left; }
.fr-qty span { color: var(--ink-2); font-size: 13px; width: 22px; flex: none; }
.fr-kcal { text-align: right; color: var(--ink-2); font-size: 13px; white-space: nowrap; }
@media (max-width: 380px) { .food-row { grid-template-columns: minmax(0, 1fr) 100px 62px; } }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.color-opt { border: 2px solid transparent; border-radius: 14px; background: none; padding: 10px 4px 6px; display: grid; justify-items: center; gap: 8px; cursor: pointer; font: 500 12px var(--sans); color: var(--ink-2); }
.color-opt:hover { background: var(--surface-2); }
.color-opt.on { border-color: var(--ink); color: var(--ink); }
.color-dot { width: 34px; height: 34px; border-radius: 50%; }
#theme-card .alt-title { margin-top: 16px; }

/* avatar in alto: solo su mobile (su computer c'è il menu laterale) */
@media (min-width: 821px) { .top-avatar { display: none; } }
/* ---- account ---- */
.acc-head { display: flex; align-items: center; gap: 14px; }
.acc-head h2 { font-size: 22px; } .acc-head > div { flex: 1; min-width: 0; } .acc-head p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--sage); color: #fff; display: grid; place-items: center; font: 600 22px var(--sans); flex: none; }
.acc-avatar.sm { width: 40px; height: 40px; font-size: 16px; }
.acc-row { width: 100%; text-align: left; font: inherit; color: var(--ink); cursor: pointer; text-decoration: none; }
button.acc-row { border: 1px solid var(--line); }
.acc-ic { width: 36px; height: 36px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-size: 17px; flex: none; }
#view > #theme-card { margin-top: 20px; }
/* scelta file: fotocamera, galleria (più foto insieme), PDF */
.pick-files.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pick-files .drop small { color: var(--ink-2); font-size: 11px; line-height: 1.2; }
.pick-files .drop b { font-size: 13px; }
.pick-files .drop-icon svg { width: 24px; height: 24px; }
@media (max-width: 380px) { .pick-files.three .small-drop { padding: 14px 6px; } }
/* documenti in lettura o pronti, in cima alla pagina */
.an-banner { display: grid; gap: 8px; margin-bottom: 16px; }
.an-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--sky-soft); border: 1px solid var(--line); }
.an-row.ready { background: var(--sage-soft); } .an-row.failed { background: var(--clay-soft); }
.an-row .main { flex: 1; min-width: 0; display: grid; gap: 2px; } .an-row b { font-size: 14px; }
.an-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--sage); flex: none; } .an-row.failed .an-dot { background: var(--danger); }

/* menu in basso: 3 voci, il + al centro, 2 voci più larghe (stesso spazio per lato): etichette e pillola più compatte; l'avatar in alto non serve più */
@media (max-width: 820px) {
  .tabbar { padding-left: 2px; padding-right: 2px; }
  .tabbar a { font-size: 10px; padding: 6px 0; letter-spacing: -.01em; }
  .tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar a.on svg { width: 44px; padding: 3px 11px; }
  .fab { width: 52px; height: 52px; }
}
/* passi dell'importazione con l'AI */
.flow { list-style: none; display: flex; gap: 4px; padding: 0; margin: 4px 0 14px; counter-reset: none; }
.flow li { flex: 1; display: grid; justify-items: center; gap: 4px; text-align: center; font-size: 11px; line-height: 1.2; color: var(--ink-2); position: relative; }
.flow li span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 600; font-size: 12px; z-index: 1; }
.flow li:not(:last-child)::after { content: ''; position: absolute; top: 12px; left: calc(50% + 14px); right: calc(-50% + 14px); height: 2px; background: var(--line); }
.flow li.done span { background: var(--sage); color: #fff; }
.flow li.done::after { background: var(--sage); }
.flow li.now { color: var(--ink); font-weight: 600; }
.flow li.now span { background: var(--ink); color: var(--bg); }
.after-save { margin-top: 12px; }
/* mappa dei muscoli */
.muscle-map { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin: 6px 0 10px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); }
.muscle-map figure { margin: 0; text-align: center; }
.muscle-map svg { width: 100%; max-height: 220px; }
.muscle-map figcaption { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.muscle-map .mb { fill: var(--surface-2); stroke: var(--line); stroke-width: .8; }
.muscle-map .mm { fill: var(--surface-2); stroke: color-mix(in srgb, var(--ink-2) 35%, transparent); stroke-width: .8; }
.muscle-map .mm.m1 { fill: var(--danger); }
.muscle-map .mm.m2 { fill: color-mix(in srgb, var(--danger) 45%, var(--surface-2)); }
.mm-legend { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; }
.mm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mm-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.mm-legend i.m1 { background: var(--danger); } .mm-legend i.m2 { background: color-mix(in srgb, var(--danger) 45%, var(--surface-2)); }
.calc-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.td-del { width: 40px; padding: 0 !important; text-align: right; }
.td-del .btn { width: 32px; height: 32px; }
.an-more { text-decoration: none; padding-left: 4px; }

/* immagine illustrativa trovata dall'AI (cartello della macchina): intera, non ritagliata */
.ex-photo.is-info, .g-photo.is-info { object-fit: contain; background: var(--surface); }
/* lato in corso negli esercizi divisi destra/sinistra */
.g-side-tag { text-align: center; margin: 10px 0 0; font: 600 15px/1.2 var(--sans); color: var(--ink); }
/* miniatura dell'esercizio accanto al nome (foto propria o disegno trovato dall'AI) */
.ex-pic { width: 96px; height: 96px; flex: none; border-radius: 14px; object-fit: cover; cursor: zoom-in; border: 1px solid var(--line); }
.ex-pic.is-info { object-fit: contain; background: #fff; padding: 4px; }
@media (max-width: 520px) { .ex-pic { width: 64px; height: 64px; border-radius: 12px; } }
/* guida: immagine accanto al titolo dell'esercizio in corso e nella scheda "Dopo" */
.g-headrow { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.g-headrow > div { min-width: 0; flex: 1; }
.g-pic { width: 140px; height: 140px; flex: none; border-radius: 16px; object-fit: cover; border: 1px solid var(--line); cursor: zoom-in; }
.g-pic.is-info, .g-nextpic.is-info { object-fit: contain; background: #fff; padding: 4px; }
.g-nextpic { width: 56px; height: 56px; flex: none; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); }
.g-next .g-nexttxt { flex: 1; }
@media (max-width: 520px) { .g-pic { width: 96px; height: 96px; border-radius: 14px; } }

/* ===== Allenamento guidato come pagina unica ===== */
.gpage { display: grid; gap: 12px; max-width: 680px; margin: 0 auto; }
.gpage .g-top { gap: 12px; }
.gpage .g-prog b { font-variant-numeric: tabular-nums; color: var(--ink); }
.g-card { background: var(--surface); border-radius: 20px; padding: 16px; box-shadow: var(--shadow); }
.g-card .g-target { background: var(--surface-2); box-shadow: none; margin-top: 14px; }
.g-card .g-clock { margin-top: 14px; font-size: clamp(64px, 20vw, 110px); }
.g-card .g-title { font-size: 26px; }
.g-sec { margin: 6px 2px -4px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.g-list { display: grid; gap: 6px; }
.g-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px 8px 8px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); cursor: pointer; min-height: 56px; }
.g-row.is-done { background: var(--surface-2); box-shadow: none; opacity: .85; }
.g-row.on { outline: 2px solid var(--sage); }
#g-wait .g-row { background: color-mix(in srgb, var(--clay) 10%, var(--surface)); }
.g-rowpic { width: 44px; height: 44px; flex: none; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); }
.g-rowpic.is-info { object-fit: contain; background: #fff; padding: 2px; }
.g-rowpic.ph { display: grid; place-items: center; background: var(--surface-2); color: var(--sage); font-weight: 700; }
.g-rowtxt { flex: 1; min-width: 0; display: grid; gap: 2px; }
.g-rowtxt b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-rowtxt small { color: var(--ink-2); font-size: 12.5px; }
.g-tag { flex: none; font-style: normal; font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 10px; background: color-mix(in srgb, var(--clay) 18%, transparent); white-space: nowrap; }
.g-tag.next { background: var(--sage-soft); }
.g-rowedit { flex: none; }
/* comandi: tutti su una riga, fissi in basso sopra la barra dell'app */
.g-bar { position: sticky; bottom: 12px; z-index: 15; display: flex; gap: 6px; padding: 6px; border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow); border: 1px solid var(--line); }
.g-btn { flex: 1 1 0; min-width: 0; display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 60px; padding: 6px 2px; border: 0; border-radius: 14px;
  background: var(--surface-2); color: var(--ink); cursor: pointer; touch-action: manipulation; }
.g-btn span { font: 600 20px/1 var(--sans); }
.g-btn small { font-size: 11.5px; font-weight: 600; line-height: 1.15; text-align: center; overflow: hidden; text-overflow: ellipsis; max-width: 100%; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.g-btn.primary { flex-grow: 1.7; background: var(--sage); color: #fff; box-shadow: 0 6px 18px rgba(31,58,47,.25); }
.g-btn.primary.stop { background: var(--clay); }
.g-btn:active { transform: scale(.96); }
.g-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.gpage .g-end { padding: 10px 0; }
.gpage .g-medal { font-size: 48px; }
@media (max-width: 820px) { .g-bar { bottom: calc(76px + env(safe-area-inset-bottom)); } }
.g-again { display: flex; align-items: center; gap: 6px; width: 100%; margin-top: 12px; padding: 10px 12px; border-radius: 14px; border: 1px dashed var(--line); background: transparent; color: var(--ink); font: 500 14px/1.2 var(--sans); cursor: pointer; text-align: left; }
.g-again small { color: var(--ink-2); margin-left: auto; }
/* finestra di conferma */
.nc-wrap { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: rgba(20,30,25,.42); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: nc-fade .16s ease; }
.nc-wrap.out { opacity: 0; transition: opacity .15s; }
.nc-box { width: min(360px, 100%); background: var(--bg); border-radius: 24px; padding: 24px 20px 18px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.25); animation: nc-pop .2s cubic-bezier(.2,.9,.3,1.2); }
.nc-ic { width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; font: 600 26px/1 var(--sans); background: var(--sage-soft); color: var(--ink); }
.nc-ic.danger { background: color-mix(in srgb, var(--clay) 20%, transparent); color: var(--clay); }
.nc-box h3 { margin: 0 0 6px; font-size: 19px; }
.nc-box p { margin: 0; color: var(--ink-2); font-size: 14.5px; line-height: 1.45; }
.nc-box p b { color: var(--ink); }
.nc-act { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.nc-act .btn { justify-content: center; min-height: 48px; }
.btn.danger-solid { background: var(--clay); color: #fff; border-color: var(--clay); }
@keyframes nc-fade { from { opacity: 0; } }
@keyframes nc-pop { from { transform: scale(.9) translateY(10px); opacity: 0; } }

/* ===== Lista della spesa ===== */
.shop-empty { text-align: center; padding: 28px 20px; }
.shop-empty-ic { font-size: 48px; }
.shop-empty .muted { max-width: 520px; margin: 8px auto 16px; }
.shop-head select { max-width: 45%; }
.shop-add { display: flex; gap: 6px; margin-top: 14px; }
.shop-add input { flex: 1; min-width: 0; }
.shop-add .shop-add-q { flex: 0 0 76px; }
.shop-dept { margin-top: 16px; }
.shop-dept h3 { font-size: 13px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); margin: 0 2px 8px; }
.shop-list { display: grid; gap: 6px; }
.shop-item { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 14px; padding: 6px 4px 6px 8px; box-shadow: var(--shadow); min-height: 54px; }
.shop-item.is-done { background: var(--surface-2); box-shadow: none; }
.shop-item.is-done b { text-decoration: line-through; color: var(--ink-2); }
.shop-check { width: 32px; height: 32px; flex: none; border-radius: 50%; border: 2px solid var(--sage); background: transparent; color: #fff; font: 700 16px/1 var(--sans); cursor: pointer; display: grid; place-items: center; }
.shop-item.is-done .shop-check { background: var(--sage); }
.shop-main { flex: 1; min-width: 0; display: grid; gap: 2px; cursor: pointer; }
.shop-main b { font-size: 15px; font-weight: 600; }
.shop-main small { color: var(--ink-2); font-size: 12.5px; }
.shop-recipe summary { cursor: pointer; list-style: none; }
.shop-recipe summary::-webkit-details-marker { display: none; }
.shop-recipe summary div { display: grid; gap: 3px; }
.shop-recipe summary b { font-size: 16px; }
.sn-modes { display: grid; gap: 8px; }
.sn-mode { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 16px; cursor: pointer; background: var(--surface); }
.sn-mode.on { border-color: var(--sage); box-shadow: inset 0 0 0 1px var(--sage); background: color-mix(in srgb, var(--sage-soft) 50%, var(--surface)); }
.sn-mode input { position: absolute; opacity: 0; pointer-events: none; }
.sn-mode .sn-ic { font-size: 24px; line-height: 1; }
.sn-mode span:last-child { display: grid; gap: 2px; }
.sn-mode small { color: var(--ink-2); }
.sn-days { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sn-days .chip { min-width: 44px; text-align: center; }
.sn-days input { width: 72px; }
.pa-scan { display: grid; gap: 4px; margin: 14px 0; padding: 12px; border-radius: 16px; background: var(--surface-2); }

/* foto profilo: in alto a destra su mobile, nella barra laterale e in Account */
.top-avatar, .avatar, .acc-avatar { overflow: hidden; }
.top-avatar img, .avatar img, .acc-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.top-avatar { width: 44px; height: 44px; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--sage-soft); }
.acc-photo { position: relative; cursor: pointer; overflow: visible; }
.acc-photo img { border-radius: 50%; }
.acc-cam { position: absolute; right: -4px; bottom: -4px; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; box-shadow: 0 0 0 2px var(--surface); }
.acc-cam svg { width: 14px; height: 14px; }
/* "+": quattro azioni e una riga "Altro" */
.quick-col { grid-template-columns: 1fr; }
.quick-more { margin: 14px 2px 0; text-align: center; }
.linkish { border: 0; background: none; padding: 0; color: var(--ink); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
/* spesa: codice a barre e dettatura */
.shop-scan { width: 100%; justify-content: center; margin-top: 10px; cursor: pointer; min-height: 46px; }
.shop-scan svg { width: 20px; height: 20px; }
.shop-mic { flex: none; font-size: 18px; padding: 0 12px; }
.shop-prod { color: var(--sage) !important; font-weight: 500; }
.shop-exact { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-top: 14px; padding: 12px; border-radius: 16px; background: var(--surface-2); }
.shop-exact > div { display: grid; gap: 2px; min-width: 0; }
.shop-exact .btn { flex: none; cursor: pointer; }
.dict-btn { display: grid; place-items: center; width: 88px; height: 88px; margin: 6px auto 4px; border-radius: 50%; border: 0; background: var(--sage); color: #fff; font-size: 38px; cursor: pointer; box-shadow: 0 10px 28px rgba(31,58,47,.28); }
.dict-btn.on { background: var(--clay); animation: dict-pulse 1.2s ease-in-out infinite; }
@keyframes dict-pulse { 50% { box-shadow: 0 0 0 14px color-mix(in srgb, var(--clay) 25%, transparent); } }
.dict-state { text-align: center; margin: 0 0 10px; font-weight: 600; }

/* Casa → Da fare */
.td-item { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 14px; padding: 8px 10px 8px 8px; box-shadow: var(--shadow); min-height: 56px; }
.td-item.prio { box-shadow: var(--shadow), inset 3px 0 0 var(--clay); }
.td-item.is-done { background: var(--surface-2); box-shadow: none; }
.td-item.is-done b { text-decoration: line-through; color: var(--ink-2); }
.td-item.is-done .shop-check { background: var(--sage); }
.td-item .pill { flex: none; }
.td-buy { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); font-size: 14px; }
.td-done summary { cursor: pointer; list-style: none; }
.td-done summary::-webkit-details-marker { display: none; }
.td-done[open] summary { margin-bottom: 8px; }
.td-when { margin: -4px 0 4px; }
.td-when .chip { padding: 6px 10px; font-size: 13px; }

/* Casa → Desideri */
.wi-price { flex: none; font: 600 15px/1 var(--sans); font-variant-numeric: tabular-nums; }
.wi-item .btn.icon { flex: none; text-decoration: none; }

/* ---------- Casa condivisa ---------- */
.house-bar { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin-bottom: 14px; border: 1.5px dashed var(--line); border-radius: var(--radius);
  background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.house-bar.on { border-style: solid; background: var(--sage-soft); border-color: transparent; }
.house-bar > svg { width: 18px; height: 18px; flex: none; color: var(--ink-2); }
.hb-ic { font-size: 22px; }
.hb-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hb-txt small { color: var(--ink-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-avs { display: flex; flex: none; }
.hb-av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: var(--sage); color: #fff; font-weight: 600; font-size: 14px;
  border: 2px solid var(--surface); margin-left: -8px; }
.hb-av:first-child { margin-left: 0; }
.hb-av img, .hl-head .acc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.hs-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 14px 0; }
.hs-box { display: grid; gap: 10px; align-content: start; }
.hs-box h3 { margin: 0; }
.hs-box p { margin: 0; }
.hs-code { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; }
.hs-code-v { font-size: 24px; font-weight: 700; letter-spacing: .12em; font-variant-numeric: tabular-nums; }

/* ---------- Salute ---------- */
.hl-card { margin-bottom: 14px; }
.hl-head { display: flex; align-items: center; gap: 12px; }
.hl-head .main { flex: 1; min-width: 0; }
.hl-head h2, .hl-head h3 { margin: 0; }
.hl-head .acc-avatar { overflow: hidden; }
.hl-share { margin: 10px 0 0; }
.hl-head { flex-wrap: wrap; row-gap: 8px; }
.hl-head .main { flex: 1 1 80px; }
.hl-facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.hl-facts span { background: var(--surface-2); border-radius: 99px; padding: 5px 12px; font-size: 13px; }
.hl-facts a, .sos-dl a { color: inherit; font-weight: 600; }
.hl-notes { margin: 10px 0 0; color: var(--ink-2); }
.hl-list { display: grid; gap: 6px; }
.hl-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); }
.hl-row.tap { cursor: pointer; }
.hl-row .main { flex: 1; min-width: 0; }
.hl-row small { display: block; color: var(--ink-2); font-size: 12.5px; margin-top: 2px; }
.hl-row .pill { font-size: 11px; padding: 1px 8px; }
.hl-ic { font-size: 18px; line-height: 1.3; }
.hl-past { margin-top: 10px; }
.hl-past summary { cursor: pointer; margin-bottom: 6px; }
.chip-radio { cursor: pointer; position: relative; }
.chip-radio input { position: absolute; opacity: 0; pointer-events: none; }
.chip-radio span { display: inline-block; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); font-size: 13px; }
.chip-radio input:checked + span { background: var(--sage-soft); border-color: var(--sage); font-weight: 600; }
.chip-radio input:focus-visible + span { outline: 2px solid var(--sage); }
.sos-card { margin-bottom: 12px; }
.sos-dl { display: grid; grid-template-columns: 90px 1fr; gap: 6px 12px; margin: 12px 0 0; font-size: 14px; }
.sos-dl dt { color: var(--ink-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; }
.sos-dl dd { margin: 0; }
.sos-red { color: var(--danger); }
@media print {
  body.print-sheet > *:not(#sheet) { display: none !important; }
  body.print-sheet #sheet { position: static !important; transform: none !important; box-shadow: none !important; max-height: none !important; width: 100% !important; overflow: visible !important; }
  body.print-sheet #sheet .sticky-actions { display: none !important; }
}

/* ---------- schede (seg) su telefono: sempre dentro lo schermo ----------
   I pulsanti si dividono la larghezza in parti uguali (width: 0 + flex: 1) e non allargano mai la pagina;
   se un'etichetta non ci sta finisce con i puntini invece di spingere fuori il resto. */
@media (max-width: 820px) {
  .seg { display: flex; width: 100%; max-width: 100%; min-width: 0; }
  .seg button { flex: 1 1 0; width: 0; min-width: 0; padding: 8px 4px; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
/* Casa: 5 schede con l'icona sopra l'etichetta su telefono */
.casa-tabs { min-width: 0; }
.casa-tabs .seg-ic { margin-right: 5px; }
@media (max-width: 820px) {
  .casa-tabs { width: 100%; order: 2; }
  .casa-tabs .seg { border-radius: 18px; }
  .casa-tabs .seg button { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px 5px; border-radius: 14px; font-size: 11.5px; line-height: 1.2; }
  .casa-tabs .seg-ic { margin: 0; font-size: 19px; line-height: 1.2; }
  .casa-tabs .seg-l { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
}
/* la colonna delle pagine non si allarga mai oltre lo schermo per far posto al contenuto:
   tabelle e schede scorrono al loro interno, i grafici si adattano */
.content, #view { min-width: 0; }
.chart-box canvas { max-width: 100%; }
@media (max-width: 400px) { td, th { padding: 9px 5px; } }
/* Oggi/Dieta: anello delle calorie e barre dei macro vanno a capo se lo spazio è poco (testo grande, schermi piccoli) */
.ring-wrap { flex-wrap: wrap; justify-content: center; }
.macros { flex: 1 1 150px; }
.bar-row .top { gap: 8px; }
.bar-row .top > :last-child { white-space: nowrap; }
/* settimana: 7 giorni sempre dentro il riquadro */
.week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.week .dot { width: 100%; max-width: 34px; height: auto; aspect-ratio: 1; }
.datebar input { min-width: 0; }
/* calendario e liste a griglia: le colonne non si allargano per il contenuto */
.cal { grid-template-columns: repeat(7, minmax(0, 1fr)); }
@media (max-width: 820px) { .cal { gap: 4px; } }
.shop-list > *, .hl-list > *, .list > * { min-width: 0; }
.wi-price { white-space: nowrap; }
/* finestre: le righe con due campi diventano una colonna se lo spazio non basta (testo grande); i campi non escono mai */
.sheet .form .row { grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); }
.form label { min-width: 0; }
.form input, .form select, .form textarea { min-width: 0; max-width: 100%; }
/* schede di Casa: con poco spazio (testo grande) le etichette si rimpiccioliscono invece di essere tagliate */
@media (max-width: 820px) { .casa-tabs { container-type: inline-size; } } /* solo dove è larga 100%: altrove la misura la deciderebbe il contenuto */
@container (max-width: 320px) { .casa-tabs .seg button { font-size: 10px; padding-left: 1px; padding-right: 1px; } .casa-tabs .seg-ic { font-size: 17px; } }
.sn-mode { position: relative; } /* il radio nascosto resta dentro la sua scheda */
/* schermo molto stretto con testo al massimo: solo le icone (il nome resta per i lettori di schermo) */
@container (max-width: 230px) { .casa-tabs .seg-l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .casa-tabs .seg-ic { font-size: 21px; } .casa-tabs .seg button { padding: 8px 0; } }
/* icona della casa condivisa accanto alle schede di Casa */
#casa-house:empty { display: none; }
#casa-house { margin-left: auto; }
.house-chip { display: inline-flex; align-items: center; padding: 3px 5px 3px 3px; border: 0; border-radius: 99px; background: var(--sage-soft); cursor: pointer; }
.house-chip .hb-av { width: 28px; height: 28px; font-size: 12px; }
@media (max-width: 820px) { .card-head > #casa-tools { width: auto; flex: 1 1 auto; } }
/* lista della spesa: "Scansiona e spunta" e "Togli quello che ho già" affiancati (uno sotto l'altro se lo spazio è poco) */
.shop-scan-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 8px; margin-top: 12px; }
.shop-scan-row .shop-scan { margin-top: 0; width: 100%; }

/* note personali sugli esercizi */
.my-note { margin: 8px 0 0; padding: 8px 10px; border-radius: 12px; background: color-mix(in srgb, var(--sky-soft) 70%, var(--surface)); font-size: 14px; line-height: 1.4; white-space: pre-line; }
.my-note-sub { white-space: pre-line; color: var(--ink) !important; }
/* esercizi lasciati indietro: in alto, e la scelta "prima dello stretching" */
.g-pick { margin-top: 4px; }
.g-pick .g-row { cursor: default; gap: 6px; }
.g-pick .g-row .btn { flex: none; }

/* Salute: visite e referti */
.hl-ic.big { font-size: 26px; }
.vis-dx { display: block; color: var(--ink) !important; margin-top: 2px; }
.vis-out { color: var(--danger, #b3261e); font-weight: 600; }
.vis-txt { margin: 0; white-space: pre-line; font-size: 14.5px; line-height: 1.45; }
.vis-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; margin-top: 8px; }
.vis-res { display: grid; gap: 1px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.vis-res span { font-size: 12.5px; color: var(--ink-2); }
.vis-res b { font-size: 15px; } .vis-res b small { font-weight: 500; color: var(--ink-2); }
.vis-res em { font-style: normal; font-size: 12px; color: var(--danger, #b3261e); }
.vis-res.out { border-color: color-mix(in srgb, var(--danger, #b3261e) 45%, var(--line)); background: color-mix(in srgb, var(--danger, #b3261e) 7%, var(--surface)); }
.vis-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.vis-files img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.vis-pdf { display: grid; place-items: center; gap: 4px; aspect-ratio: 3/4; border-radius: 10px; border: 1px solid var(--line); padding: 8px; text-align: center; font-size: 12px; color: var(--ink); text-decoration: none; background: var(--surface-2); overflow: hidden; }
.vis-pdf span { word-break: break-word; }
.check-row { cursor: pointer; align-items: center; }
.check-row input { flex: none; width: 20px; height: 20px; accent-color: var(--sage); }
.md-box { font-size: 14.5px; line-height: 1.5; }
.md-box .md-h { font-size: 16px; margin: 14px 0 4px; }
.md-box ul { margin: 4px 0; padding-left: 20px; } .md-box p { margin: 4px 0; }

/* revisione del pasto descritto a parole: pasto di ogni voce */
.rev-slot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.rev-slot label { display: flex; align-items: center; gap: 6px; }
.rev-slot select, .rev-slot input { max-width: 170px; }

/* allenamento guidato: tempo in più per gli esercizi a tempo */
.g-extra { display: flex; justify-content: center; gap: 8px; margin: 4px 0 8px; }
.g-extra button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 99px; padding: 8px 14px; font: 600 14px/1 var(--sans); }
.g-extra button:active { background: var(--sage-soft); }

/* promemoria dei farmaci */
.med-remind { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; display: grid; gap: 8px; }
.med-times { display: flex; flex-wrap: wrap; gap: 8px; }
.med-time { display: inline-flex; align-items: center; gap: 2px; }
.med-time input { width: 110px; }
.med-remind.dimmed { opacity: .5; }

/* farmaci: assunzioni del giorno (pagina che si apre dalla notifica del promemoria) */
.md-head { margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.md-head h2::first-letter { text-transform: uppercase; }
.md-card { margin-bottom: 12px; scroll-margin-top: 80px; }
.md-card.focus { outline: 2px solid var(--sage); outline-offset: -2px; }
.md-row.done .main > b, .md-row.done .main > .muted { opacity: .7; }
.md-state { margin-top: 6px; }
.md-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.md-snooze { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
.md-due { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; text-decoration: none; color: inherit; background: var(--clay-soft); box-shadow: none; }
.md-due .main { flex: 1; min-width: 0; }
.md-due small { display: block; color: var(--ink-2); font-size: 12.5px; margin-top: 2px; }

/* Dieta → Ricette */
.rc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin-top: 12px; }
.rc-card { text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; padding: 12px 14px; cursor: pointer; font: 14px var(--sans); color: var(--ink); display: flex; flex-direction: column; gap: 6px; }
.rc-card:hover { border-color: var(--sage); }
.rc-t { font-weight: 600; font-size: 15px; }
.rc-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rc-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.rc-lbl { font-size: 13px; font-weight: 500; color: var(--ink-2); margin: 4px 0 6px; }
.rc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.rc-fav { font-size: 20px; color: var(--clay, #c8794a); }
.rc-serv { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 14px; }
.rc-serv b { min-width: 22px; text-align: center; }
.rc-macros { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; margin: 10px 0; }
.rc-macros div { background: var(--surface-2); border-radius: 12px; padding: 8px 10px; text-align: center; }
.rc-macros b { display: block; font-size: 17px; }
.rc-macros span { font-size: 11.5px; color: var(--ink-2); }
.rc-box { border-radius: 12px; padding: 10px 12px; margin: 10px 0; font-size: 13px; line-height: 1.45; }
.rc-box.warn { background: var(--clay-soft); }
.rc-box.ok { background: var(--sage-soft); }
.rc-box ul { margin: 4px 0 0; padding-left: 18px; }
.rc-box ul.rc-checks { list-style: none; padding-left: 0; }
.rc-sec { margin: 18px 0 6px; font-size: 15px; }
.rc-ing { list-style: none; padding: 0; margin: 0; }
.rc-ing li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.rc-ing b { white-space: nowrap; font-weight: 500; }
.rc-steps { padding-left: 22px; margin: 0; }
.rc-steps li { margin: 7px 0; line-height: 1.5; }
.rc-base-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 4px 0 6px; }
.rc-plan { border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; background: var(--surface-2); max-height: 50vh; overflow: auto; }
.rc-plan-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.rc-plan-slot { margin-top: 10px; }
.rc-plan-h { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.rc-plan-h .btn { margin-left: auto; padding: 2px 10px; }
.rc-plan .chip { padding: 6px 10px; font-size: 13px; }
/* consumi di Gemini (Impostazioni) */
.tbl { border-collapse: collapse; }
.tbl td { padding: 5px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ai-usage summary { cursor: pointer; color: var(--ink-2); }
