/*
 * Body — design system. Graphite ink + energetic red (the ninja), warm-neutral paper,
 * quiet borders over heavy shadows, rounded cards, mobile-first with a bottom tab bar.
 */
:root {
  /* ink & surfaces */
  --ink: #17191c;
  --ink-soft: #3a3f45;
  --ink-muted: #6b7178;
  --ink-faint: #9aa0a7;
  --paper: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --line: #e7e9ee;
  --line-strong: #d6dae1;

  /* brand — orange accent ("arancione come colore generale") */
  --red: #ef6c14;
  --red-600: #d65c0a;
  --red-700: #b4490a;
  --red-soft: #fdeedd;
  --red-ink: #b04708;
  --graphite: #23262b;
  --danger: #e11d2a;

  /* status / categorical chart palette */
  --c-red: #e11d2a;
  --c-graphite: #3b4149;
  --c-amber: #e8a33d;
  --c-teal: #2b9ca0;
  --c-violet: #7c5cd6;
  --c-green: #37a26b;
  --c-blue: #3b7fd0;
  --c-orange: #ef7a3d;
  --good: #37a26b;
  --good-soft: #e6f4ec;
  --ok: #e8a33d;
  --ok-soft: #fbf2e1;
  --bad: #e1554b;
  --bad-soft: #fbeceb;

  /* shape */
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 18px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 2px rgb(20 22 25 / 0.05);
  --shadow: 0 1px 2px rgb(20 22 25 / 0.05), 0 6px 18px -10px rgb(20 22 25 / 0.18);
  --shadow-pop: 0 8px 30px -8px rgb(20 22 25 / 0.28);

  --maxw: 540px;
  --nav-h: 76px;
  /* spacing scale (4-based) — one rhythm across the app */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px;
  --gutter: 16px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --ink: #eef0f3;
    --ink-soft: #c7ccd3;
    --ink-muted: #969ca4;
    --ink-faint: #6c727a;
    --paper: #0f1113;
    --surface: #191c20;
    --surface-2: #202429;
    --line: #2a2f35;
    --line-strong: #3a4047;
    --red-soft: #3a2410;
    --red-ink: #ffb27a;
    --graphite: #3a4047;
    --good-soft: #15291f;
    --ok-soft: #2e2512;
    --bad-soft: #301715;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px -12px rgb(0 0 0 / 0.6);
    --shadow-pop: 0 10px 34px -8px rgb(0 0 0 / 0.7);
  }
}
:root[data-theme='dark'] {
  --ink: #eef0f3; --ink-soft: #c7ccd3; --ink-muted: #969ca4; --ink-faint: #6c727a;
  --paper: #0f1113; --surface: #191c20; --surface-2: #202429; --line: #2a2f35; --line-strong: #3a4047;
  --graphite: #3a4047;
  --red-soft: #3a2410; --red-ink: #ffb27a; --good-soft: #15291f; --ok-soft: #2e2512; --bad-soft: #301715;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px -12px rgb(0 0 0 / 0.6);
  --shadow-pop: 0 10px 34px -8px rgb(0 0 0 / 0.7);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  background-color: var(--paper);
  /* lively multi-blob orange wash ("sfondo più mosso") */
  background-image:
    radial-gradient(42% 30% at 12% 2%, color-mix(in srgb, var(--red) 20%, transparent), transparent 70%),
    radial-gradient(48% 34% at 95% 6%, color-mix(in srgb, var(--c-amber) 20%, transparent), transparent 70%),
    radial-gradient(55% 40% at 82% 44%, color-mix(in srgb, var(--red) 13%, transparent), transparent 72%),
    radial-gradient(60% 42% at 8% 60%, color-mix(in srgb, var(--red) 11%, transparent), transparent 72%),
    linear-gradient(180deg, color-mix(in srgb, var(--red) 8%, var(--paper)), var(--paper) 44%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
  overscroll-behavior-y: none;
}
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.02em; font-weight: 800; }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 16px; }
img { max-width: 100%; display: block; }
::selection { background: var(--red-soft); color: var(--red-ink); }

/* ---------------------------------------------------------------- layout */
#app { min-height: 100dvh; }
.app-shell {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: transparent; /* let the body's soft gradient show through */
  position: relative;
}
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 12px) var(--gutter) 12px;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 20px; letter-spacing: -0.03em; }
.topbar .brand img { width: 30px; height: 30px; border-radius: 8px; }
.topbar .brand .dot { color: var(--red); }
.topbar .spacer { flex: 1; }
.topbar .tb-title { font-size: 15px; font-weight: 700; color: var(--ink-muted); }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  border-radius: var(--r-pill); transition: transform .15s var(--ease);
}
.icon-btn:active { transform: scale(0.92); }

main.view {
  flex: 1;
  padding: 16px 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px);
  animation: fade .22s var(--ease);
}
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- bottom nav */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.5) blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  background: none; border: 0; color: var(--ink-faint);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 0; font-size: 10.5px; font-weight: 700; letter-spacing: 0;
  white-space: nowrap; min-width: 0;
  transition: color .15s;
}
.tabbar button svg { width: 26px; height: 26px; padding: 8px; border-radius: 14px; box-sizing: content-box; transition: background .18s var(--ease), transform .18s var(--ease); }
.tabbar button.active { color: var(--red); }
.tabbar button.active svg { background: var(--red-soft); color: var(--red); transform: translateY(-1px); }
.tabbar button:active svg { transform: scale(.9); }

/* ---------------------------------------------------------------- cards & bits */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); padding: 16px; margin-bottom: 16px;
}
.card.pad-sm { padding: 12px; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-h h3 { font-size: 16px; }
.card-h .sub { font-size: 13px; color: var(--ink-muted); font-weight: 600; }
.card-h > svg:first-child { width: 18px; height: 18px; padding: 7px; background: var(--red-soft); color: var(--red); border-radius: 12px; box-sizing: content-box; flex-shrink: 0; }
.card-h .spacer { flex: 1; }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-faint); margin: 24px 2px 12px; }
.section-title svg { color: var(--red); flex-shrink: 0; }

.muted { color: var(--ink-muted); }
.faint { color: var(--ink-faint); }
.tiny { font-size: 12px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--r-pill);
  padding: 12px 20px; font-weight: 800; font-size: 15px; background: var(--surface-2); color: var(--ink);
  transition: transform .12s var(--ease), background .15s, box-shadow .15s;
}
.btn svg { width: 19px; height: 19px; }
.btn:active { transform: scale(0.97); }
.btn.primary { background: linear-gradient(180deg, color-mix(in srgb, var(--red) 92%, #fff), var(--red)); color: #fff; box-shadow: 0 8px 18px -8px var(--red); }
.btn.primary:active { background: var(--red-600); }
.btn.dark { background: var(--red-700); color: #fff; box-shadow: 0 6px 16px -10px var(--red-700); } /* deep-orange secondary — keeps the orange vibe */
.btn.ghost { background: color-mix(in srgb, var(--red) 5%, var(--surface)); border-color: color-mix(in srgb, var(--red) 28%, var(--line-strong)); color: var(--red-ink); }
.btn.ghost:active { background: var(--red-soft); }
.btn.danger-ic { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, var(--line-strong)); background: transparent; }
.btn.disabled, .btn.disabled * { opacity: .5; pointer-events: none; }
.btn.block { display: flex; width: 100%; }
.btn.lg { padding: 16px 24px; font-size: 16px; }
.btn.sm { padding: 10px 16px; font-size: 13px; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-row { display: flex; gap: 10px; }
/* icon-only buttons in a row/footer stay square so the real CTA leads */
/* icon-only buttons (single svg, no text) collapse to a round 48px; text buttons keep their width */
.btn-row .btn:not(.grow):not(.block):has(> svg:only-child), .g-foot .btn:not(.grow):has(> svg:only-child) { width: 48px; padding-left: 0; padding-right: 0; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1.5px solid var(--line-strong); background: var(--surface);
  color: var(--ink-soft); border-radius: var(--r-pill); padding: 10px 14px;
  font-weight: 700; font-size: 13px; transition: all .14s var(--ease);
}
.chip svg { width: 17px; height: 17px; }
.chip.on { background: var(--red); border-color: var(--red); color: #fff; }
.chip.on svg { color: #fff; }

/* inputs */
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; font-weight: 700; color: var(--ink-muted); margin-bottom: 6px; }
.input, select.input {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line-strong);
  border-radius: var(--r-sm); background: var(--surface); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, select.input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 30%, transparent); }
textarea.input { resize: vertical; min-height: 64px; }

/* stepper */
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line-strong); border-radius: var(--r-pill); overflow: hidden; }
.stepper button { width: 42px; height: 42px; border: 0; background: var(--surface-2); color: var(--ink); font-size: 22px; font-weight: 700; display: grid; place-items: center; }
.stepper button:active { background: var(--line); }
.stepper .val { min-width: 58px; text-align: center; font-weight: 800; font-size: 17px; }
.stepper .val small { display: block; font-size: 10px; color: var(--ink-faint); font-weight: 700; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow-sm); }
.tile .k { font-size: 12px; font-weight: 700; color: var(--ink-muted); display: flex; align-items: center; gap: 6px; }
.tile .k svg { width: 15px; height: 15px; color: var(--red); }
.tile .v { font-size: 26px; font-weight: 900; letter-spacing: -0.03em; margin-top: 4px; }
.tile .v small { font-size: 13px; font-weight: 700; color: var(--ink-faint); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: var(--r-pill); }
.badge.area { background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line); }
.badge.ai { background: var(--graphite); color: #fff; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.ok { background: var(--ok-soft); color: #9a6a12; }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.pill-red { background: var(--red-soft); color: var(--red-ink); }

/* exercise card */
.ex { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.ex:first-child { border-top: 0; }
.ex .thumb { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--surface-2); flex-shrink: 0; border: 1px solid var(--line); }
.ex .meta { flex: 1; min-width: 0; }
.ex .meta .nm { font-weight: 800; font-size: 14px; }
.ex .meta .mus { font-size: 12px; color: var(--ink-muted); font-weight: 600; margin-top: 2px; }
.ex .meta .scheme { font-size: 13px; color: var(--red-ink); font-weight: 800; margin-top: 3px; }
.ex .act { flex-shrink: 0; }

/* muscles explicit list */
.muscles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mtag { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: var(--r-pill); background: var(--red-soft); color: var(--red-ink); }
.mtag.sec { background: var(--surface-2); color: var(--ink-muted); border: 1px solid var(--line); }

/* progress ring + bars */
.ring-wrap { display: flex; align-items: center; gap: 16px; }
.bar { height: 8px; background: var(--surface-2); border-radius: var(--r-pill); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--red); border-radius: var(--r-pill); transition: width .5s var(--ease); }

/* heatmap (github-style) */
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.heat .cell { width: 13px; height: 13px; border-radius: 3px; background: var(--surface-2); }
.heat .cell[data-l='1'] { background: color-mix(in srgb, var(--red) 28%, var(--surface-2)); }
.heat .cell[data-l='2'] { background: color-mix(in srgb, var(--red) 52%, var(--surface-2)); }
.heat .cell[data-l='3'] { background: color-mix(in srgb, var(--red) 76%, var(--surface-2)); }
.heat .cell[data-l='4'] { background: var(--red); }
.heat-legend { display: flex; align-items: center; gap: 5px; justify-content: flex-end; font-size: 11px; color: var(--ink-faint); margin-top: 8px; }
.heat-legend .cell { width: 11px; height: 11px; border-radius: 3px; }

/* donut legend */
.legend { display: flex; flex-direction: column; gap: 7px; }
.legend .li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend .li .sw { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.legend .li .lab { flex: 1; color: var(--ink-soft); font-weight: 600; }
.legend .li .val { font-weight: 800; }
.donut-row { display: flex; align-items: center; gap: 16px; }

/* list rows */
.lrow { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.lrow:first-child { border-top: 0; }
.lrow .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--red-soft); color: var(--red); flex-shrink: 0; }
.lrow .ic svg { width: 20px; height: 20px; }
.lrow .main { flex: 1; min-width: 0; }
.lrow .main .t { font-weight: 800; font-size: 14px; }
.lrow .main .s { font-size: 13px; color: var(--ink-muted); }
.lrow .end { text-align: right; font-weight: 800; }

/* avatar */
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 18px; flex-shrink: 0; }
.avatar.lg { width: 72px; height: 72px; font-size: 28px; }

/* mascot hero */
.hero { display: flex; align-items: center; gap: 14px; }
.hero img { width: 74px; height: 74px; object-fit: contain; filter: drop-shadow(0 6px 10px rgb(20 22 25 / 0.12)); }
.hero .hi { font-size: 13px; color: var(--ink-muted); font-weight: 700; }
.hero .nm { font-size: 22px; font-weight: 900; letter-spacing: -0.03em; }

/* segmented */
.seg { display: flex; background: var(--surface-2); border-radius: var(--r-pill); padding: 4px; gap: 4px; }
.seg button { flex: 1; border: 0; background: none; padding: 11px 8px; border-radius: var(--r-pill); font-weight: 800; font-size: 13px; color: var(--ink-muted); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button svg { width: 16px; height: 16px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* modal / sheet */
.sheet-bg { position: fixed; inset: 0; background: rgb(10 12 14 / 0.42); z-index: 80; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
/* kill the ugly native number-input spinners app-wide (weight widget, durations, …) */
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.sheet {
  background: var(--surface); width: 100%; max-width: var(--maxw);
  border-radius: 22px 22px 0 0; padding: 10px 18px calc(env(safe-area-inset-bottom) + 20px);
  box-shadow: var(--shadow-pop); animation: up .3s var(--ease); max-height: 92dvh; overflow-y: auto;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
body.scroll-locked { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
.sheet .grab { width: 40px; height: 4px; border-radius: 3px; background: var(--line-strong); margin: 4px auto 14px; }

/* guided session full screen */
.guided { position: fixed; inset: 0; z-index: 70; background: var(--paper); display: flex; flex-direction: column; max-width: var(--maxw); margin: 0 auto; }
.guided .g-top { padding: calc(env(safe-area-inset-top) + 12px) 18px 10px; display: flex; align-items: center; gap: 12px; }
.guided .g-body { flex: 1; overflow-y: auto; padding: 4px 18px 20px; }
.guided .g-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--line); }
.guided .g-foot { padding: 12px 18px calc(env(safe-area-inset-bottom) + 14px); border-top: 1px solid var(--line); background: var(--surface); display: flex; gap: 10px; }
.gprog { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin: 2px 0 0; }
.gprog > i { display: block; height: 100%; background: var(--red); transition: width .4s var(--ease); }
.setlog { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.setrow { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; }
.setrow .stepper button { width: 38px; height: 38px; font-size: 19px; }
.setrow .stepper .val { min-width: 42px; font-size: 15px; }
.setrow.done { border-color: var(--good); background: var(--good-soft); }
.setrow.done .icon-btn { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, var(--line-strong)); }
.setrow .sn { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 800; font-size: 12px; flex-shrink: 0; }

/* coach chat (conversational) */
.coach { position: fixed; inset: 0; z-index: 72; background: var(--paper); display: flex; flex-direction: column; max-width: var(--maxw); margin: 0 auto; height: 100dvh; }
.coach-top { padding: calc(env(safe-area-inset-top) + 12px) 16px 12px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px); }
.coach-top .coach-ic { width: 20px; height: 20px; padding: 8px; background: var(--red-soft); color: var(--red); border-radius: 12px; box-sizing: content-box; flex-shrink: 0; display: grid; place-items: center; }
.coach-top .coach-h { flex: 1; min-width: 0; }
.coach-top .coach-h .t { font-weight: 900; font-size: 16px; letter-spacing: -0.01em; }
.coach-top .coach-h .s { font-size: 12.5px; color: var(--ink-muted); font-weight: 600; }
.coach-msgs { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 16px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.c-bubble { max-width: 84%; padding: 11px 14px; border-radius: 18px; font-size: 14.5px; line-height: 1.45; font-weight: 500; word-wrap: break-word; animation: up .22s var(--ease); }
.c-bubble.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); color: var(--ink); border-bottom-left-radius: 6px; }
.c-bubble.user { align-self: flex-end; background: linear-gradient(180deg, color-mix(in srgb, var(--red) 92%, #fff), var(--red)); color: #fff; border-bottom-right-radius: 6px; box-shadow: 0 8px 18px -10px var(--red); }
.c-typing { display: inline-flex; gap: 4px; align-items: center; }
.c-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); animation: cblink 1.2s infinite ease-in-out; }
.c-typing span:nth-child(2) { animation-delay: .18s; }
.c-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes cblink { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.coach-card { align-self: stretch; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; box-shadow: var(--shadow-sm); animation: up .22s var(--ease); }
.coach-card .cw-head { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; }
.coach-card .cw-ic { width: 15px; height: 15px; padding: 6px; background: var(--red-soft); color: var(--red); border-radius: 9px; box-sizing: content-box; flex-shrink: 0; display: grid; place-items: center; }
.coach-card .cw-t { flex: 1; min-width: 0; font-weight: 800; font-size: 15px; }
.coach-card .cw-n { font-size: 11px; font-weight: 800; color: var(--ink-muted); background: var(--surface-2); border: 1px solid var(--line); padding: 3px 8px; border-radius: var(--r-pill); flex-shrink: 0; }
.coach-card .cw-note { font-size: 13px; color: var(--ink-muted); font-weight: 600; margin: 2px 0 10px; }
.coach-card .cw-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }
.coach-card .cw-row { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 7px 10px 7px 7px; }
.coach-card .cw-row img { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; background: var(--surface); flex-shrink: 0; }
.coach-card .cw-row .ph { width: 44px; height: 44px; border-radius: 9px; display: grid; place-items: center; background: var(--surface); color: var(--ink-faint); flex-shrink: 0; }
.coach-card .cw-row .m { min-width: 0; }
.coach-card .cw-row .n { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coach-card .cw-row .d { font-size: 12px; color: var(--ink-muted); font-weight: 600; }
.coach-card .cw-actions { display: flex; gap: 8px; }
.coach-card .cw-actions .grow { flex: 1; }
.coach-card .cw-actions .btn { padding: 11px 14px; font-size: 14px; }
.coach-input { display: flex; align-items: center; gap: 8px; padding: 10px 12px calc(env(safe-area-inset-bottom) + 12px); border-top: 1px solid var(--line); background: var(--surface); }
.coach-field { flex: 1; min-width: 0; padding: 12px 16px; border: 1.5px solid var(--line-strong); border-radius: var(--r-pill); background: var(--paper); color: var(--ink); font-size: 15px; }
.coach-field:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.coach-input .icon-btn { flex-shrink: 0; width: 44px; height: 44px; }
.coach-input .c-send { background: var(--red); border-color: var(--red); color: #fff; }
.coach-input .c-mic.recording { background: var(--red); border-color: var(--red); color: #fff; animation: cpulse 1.1s infinite; }
@keyframes cpulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--red) 55%, transparent); } 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--red) 0%, transparent); } }

/* rest timer */
.rest { text-align: center; }
.rest .t { font-size: 44px; font-weight: 900; font-variant-numeric: tabular-nums; }

/* onboarding / auth */
.auth { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; max-width: 440px; margin: 0 auto; padding: 24px 22px calc(env(safe-area-inset-bottom) + 24px); }
.auth .logo { text-align: center; margin-bottom: 18px; }
.auth .logo img { width: 92px; height: 92px; margin: 0 auto 8px; object-fit: contain; }
.auth .logo .nm { font-size: 34px; font-weight: 900; letter-spacing: -0.04em; }
.auth .logo .nm .dot { color: var(--red); }
.auth .logo .tag { color: var(--ink-muted); font-weight: 600; font-size: 13.5px; }
.account-pick { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.account { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--surface); }
.account .nm { font-weight: 800; }
.account .un { font-size: 12px; color: var(--ink-faint); }

/* toast */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 16px); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: var(--graphite); color: #fff; padding: 11px 18px; border-radius: var(--r-pill); font-weight: 700; font-size: 13.5px; box-shadow: var(--shadow-pop); animation: up .25s var(--ease); max-width: 90%; }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--good); }

/* misc */
.empty { text-align: center; padding: 30px 16px; color: var(--ink-muted); }
.empty img { width: 92px; margin: 0 auto 10px; opacity: .9; }
.empty .t { font-weight: 800; color: var(--ink-soft); margin-bottom: 4px; }
.spin { width: 22px; height: 22px; border: 2.5px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.loading-full { min-height: 60dvh; display: grid; place-items: center; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.link { color: var(--red); font-weight: 700; background: none; border: 0; padding: 0; font-size: inherit; }

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

/* ================================================================= v2 components */
/* dark-mode: keep the amber "ok" badge legible on dark ok-soft */
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .badge.ok { color: var(--ok); } }
:root[data-theme='dark'] .badge.ok { color: var(--ok); }

/* desktop sidebar (hidden on mobile) */
.sidebar { display: none; }
.avatar.sm { width: 36px; height: 36px; font-size: 14px; }

/* "come vuoi allenarti" ways */
.ways { display: grid; gap: 12px; margin-bottom: 4px; }
.way {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px; box-shadow: var(--shadow-sm); color: var(--ink); transition: transform .14s var(--ease), box-shadow .14s, border-color .14s;
}
.way:active { transform: scale(.985); }
.way:hover { border-color: color-mix(in srgb, var(--red) 35%, var(--line)); box-shadow: var(--shadow); }
.way-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0; color: #fff; }
.way-ic.c1 { background: linear-gradient(145deg, #ff9a3d, var(--red)); }
.way-ic.c2 { background: linear-gradient(145deg, #ffb24d, #e8820f); }
.way-ic.c3 { background: linear-gradient(145deg, var(--c-graphite), var(--graphite)); } /* deliberate graphite neutral for the secondary "manual" path */
.way .main { flex: 1; min-width: 0; }
.way .main .t { font-weight: 800; font-size: 15px; }
.way .main .s { font-size: 12px; color: var(--ink-muted); margin-top: 1px; }
.way > svg { color: var(--ink-faint); flex-shrink: 0; }

/* islands + sub-islands */
.island { border-radius: var(--r-lg); border: 1px solid color-mix(in srgb, var(--red) 26%, var(--line)); box-shadow: var(--shadow); }
.island.draft-island { background: linear-gradient(180deg, color-mix(in srgb, var(--red) 6%, var(--surface)), var(--surface) 120px); }
.isl-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--red-soft); color: var(--red); flex-shrink: 0; }
.sub-islands { display: flex; flex-direction: column; gap: 12px; }
.sub-island { margin-bottom: 0; border-radius: var(--r); padding: 12px; box-shadow: var(--shadow-sm); }
.sub-island .nm { font-weight: 800; font-size: 14.5px; }
.sub-island .mus { font-size: 11.5px; color: var(--ink-muted); font-weight: 600; margin-top: 2px; }
.sub-island .scheme { font-size: 12.5px; color: var(--red-ink); font-weight: 800; }
.sub-island .thumb { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--line); flex-shrink: 0; }
.draft-island .sub-island { background: var(--surface-2); } /* nested cards read as contained within the plan island */
.thumb.ph { display: grid; place-items: center; color: var(--red); background: var(--red-soft); border: 0; }
.sec-tag { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); background: var(--surface-2); border-radius: 6px; padding: 1px 6px; vertical-align: middle; }
.badge.soft { background: var(--red-soft); color: var(--red-ink); }
.icon-btn.sm { width: 38px; height: 38px; }
.icon-btn.danger-ic { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, var(--line-strong)); }

/* coach hint */
.hint { display: flex; align-items: center; gap: 12px; background: linear-gradient(135deg, var(--red-soft), color-mix(in srgb, var(--c-amber) 16%, var(--surface))); border: 1px solid color-mix(in srgb, var(--red) 25%, var(--line)); border-radius: var(--r-lg); padding: 14px; margin-bottom: 16px; }
.hint-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); color: var(--red); flex-shrink: 0; box-shadow: var(--shadow-sm); }
.hint-lab { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--red-ink); }
.hint-msg { font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-top: 1px; }
.hint.applied { opacity: .7; }

/* favorites quick row */
.fav-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 4px; }
.fav-chip { display: inline-flex; align-items: center; gap: 7px; background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--r-pill); padding: 9px 14px; font-weight: 800; font-size: 13px; color: var(--ink); white-space: nowrap; flex-shrink: 0; }
.fav-chip svg { color: var(--red); }
.fav-chip small { color: var(--ink-faint); font-weight: 700; }

/* tiles variants */
.tiles-3 { grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tile.accent { background: linear-gradient(150deg, color-mix(in srgb, var(--red) 12%, var(--surface)), var(--surface)); border-color: color-mix(in srgb, var(--red) 22%, var(--line)); }
.done-today { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 25%, var(--line)); }

/* weight widget */
.weight-big { display: flex; align-items: baseline; gap: 12px; margin-top: 2px; }
.weight-big .num { font-size: 42px; font-weight: 900; letter-spacing: -.03em; line-height: 1; }
.weight-big .num small { font-size: 16px; font-weight: 700; color: var(--ink-faint); }
.trend { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 800; padding: 3px 9px; border-radius: var(--r-pill); background: var(--red-soft); color: var(--red-ink); }
.weight-spark { margin-top: 8px; }
.weight-edit { display: flex; align-items: center; gap: 10px; }
.weight-edit .rnd { width: 46px; height: 46px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: var(--surface-2); font-size: 24px; font-weight: 700; color: var(--ink); flex-shrink: 0; }
.weight-edit .rnd:active { background: var(--line); }
.weight-field { flex: 1; display: flex; align-items: baseline; justify-content: center; gap: 4px; background: var(--surface-2); border-radius: var(--r); padding: 6px 10px; border: 1.5px solid var(--line); }
.weight-field .winput { width: 100%; max-width: 120px; border: 0; background: transparent; text-align: center; font-size: 30px; font-weight: 900; color: var(--ink); padding: 0; }
.weight-field .winput:focus { outline: none; }
.weight-field > span { font-weight: 800; color: var(--ink-faint); }
.weight-edit .btn.primary { width: 46px; height: 46px; padding: 0; border-radius: 50%; flex-shrink: 0; } /* matches the round ± steppers */

/* composer */
.composer .g-body { display: flex; flex-direction: column; }
.composer .empty { margin: auto 0; padding: 40px 24px; }
.composer .c-title { width: 100%; border: 0; background: transparent; font-weight: 800; font-size: 15px; color: var(--ink); padding: 4px 0; }
.composer .c-title:focus { outline: none; }
.field.mini { margin-bottom: 0; }
.field.mini > span { font-size: 11.5px; }
.setlog.mini .setrow { padding: 6px 8px; }

/* set tracker in guided session */
.set-track { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-top: 16px; box-shadow: var(--shadow-sm); }
.set-track .st-lab { font-weight: 800; font-size: 13px; color: var(--ink-soft); }
.set-track .st-count { font-weight: 800; }
.set-track .st-count b { font-size: 18px; color: var(--red); }
.set-track .st-goal { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; color: var(--ink-soft); }
.set-track .st-goal svg { color: var(--red); flex-shrink: 0; }
.set-track .st-goal b { color: var(--ink); font-weight: 800; }
/* in-session cardio timer */
.timer-card { text-align: center; }
.timer-card .tmr { font-size: 56px; font-weight: 900; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.05; }
.timer-card .tmr.done { color: var(--red); }
.timer-card .tmr-sub { font-size: 13px; font-weight: 700; color: var(--ink-muted); margin-top: 2px; }
.timer-card .btn.running { background: var(--graphite); color: #fff; }

/* -------- Exercise Builder -------- */
.builder { display: grid; grid-template-columns: 1fr; gap: 16px; }
.bld-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bld-title { flex: 1; min-width: 150px; border: none; background: transparent; font-size: 18px; font-weight: 800; color: var(--ink); padding: 4px 2px; }
.bld-title:focus { outline: none; }
.bld-title::placeholder { color: var(--ink-faint); font-weight: 700; }
.bld-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.drop-zone { display: flex; flex-direction: column; gap: 10px; min-height: 160px; border: 2px dashed var(--line-strong); border-radius: var(--r-lg); padding: 12px; transition: background .15s, border-color .15s; }
.drop-zone.over { border-color: var(--red); background: var(--red-soft); }
.drop-empty { margin: auto; text-align: center; color: var(--ink-muted); padding: 24px 12px; }
.drop-empty svg { color: var(--line-strong); }
.drop-empty .t { font-weight: 800; margin-top: 8px; color: var(--ink-soft); }
.drop-empty .s { font-size: 13px; margin-top: 2px; }
.drop-empty b { color: var(--red); }
.bld-card { display: flex; align-items: flex-start; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; box-shadow: var(--shadow-sm); }
.bld-card.dragging { opacity: .45; }
.bld-grip { color: var(--ink-faint); cursor: grab; padding-top: 16px; flex-shrink: 0; }
.bld-grip:active { cursor: grabbing; }
.bld-card > .thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: var(--surface-2); }
.bld-card > .thumb.ph { display: grid; place-items: center; color: var(--ink-faint); border: 1px solid var(--line); }
.bld-body { flex: 1; min-width: 0; }
.bld-top { display: flex; align-items: flex-start; gap: 8px; }
.bld-top .nm { font-weight: 800; font-size: 14px; flex: 1; min-width: 0; }
.bld-card-actions { display: flex; gap: 4px; flex-shrink: 0; }
.bld-fields { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.bld-fields .bf { display: flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-faint); background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 5px 10px; transition: border-color .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease); }
.bld-fields .bf:focus-within { border-color: color-mix(in srgb, var(--red) 50%, var(--line)); background: var(--surface); box-shadow: 0 0 0 3px var(--red-soft); }
.bld-fields .bf input { width: 36px; border: none; background: transparent; font-size: 15px; font-weight: 900; letter-spacing: -.02em; color: var(--ink); text-align: center; padding: 0; }
.bld-fields .bf input:focus { outline: none; }
.bld-fields .bf input[data-f="targetReps"] { width: 48px; }
.bld-fields .bf > span { font-size: 9.5px; font-weight: 800; color: var(--ink-faint); }
.bld-cat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; overflow: hidden; }
.bld-cat-head { padding: 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.bld-cat-title { font-weight: 800; display: flex; align-items: center; gap: 8px; }
.bld-cat-title svg { color: var(--red); }
.bcat-chips { gap: 6px; }
.bcat-chips .chip { padding: 6px 12px; font-size: 12px; }
.bld-cat-list { padding: 8px; overflow-y: auto; max-height: 56dvh; display: flex; flex-direction: column; gap: 4px; }
.bcat-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; border: 1px solid transparent; cursor: grab; }
.bcat-item:hover { background: var(--surface-2); border-color: var(--line); }
.bcat-item.drag { opacity: .45; }
.bcat-item .thumb.sm { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; flex-shrink: 0; background: var(--surface-2); }
.bcat-item .meta { flex: 1; min-width: 0; cursor: pointer; }
.bcat-item .meta .nm { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bcat-item .meta .mus { font-size: 11.5px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.howto { padding-left: 18px; color: var(--ink-soft); font-size: 13.5px; line-height: 1.6; margin: 0; }
.howto li { margin-bottom: 6px; }
.btn.primary.all-done { background: var(--good); box-shadow: none; }

/* guided nav + jump list */
.icon-btn.nav { width: 40px; height: 40px; }
.icon-btn.nav:disabled { opacity: .35; pointer-events: none; }
.g-title { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex.jump { cursor: pointer; }
.ex.jump.cur { background: var(--red-soft); border-radius: var(--r); margin: 0 -8px; padding: 10px 8px; border-top: 0; }
.thumb.sm { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.thumb.sm.ph { display: grid; place-items: center; color: var(--red); background: var(--red-soft); }

/* area bars (progressi) */
.abars { display: flex; flex-direction: column; gap: 10px; }
.abar { display: flex; align-items: center; gap: 10px; }
.abar .al { width: 72px; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); flex-shrink: 0; }
.abar .at { flex: 1; height: 12px; background: var(--surface-2); border-radius: var(--r-pill); overflow: hidden; }
.abar .at > i { display: block; height: 100%; border-radius: var(--r-pill); transition: width .5s var(--ease); }
.abar .av { font-size: 12px; font-weight: 800; color: var(--ink-muted); width: 44px; text-align: right; flex-shrink: 0; }

/* ---------------------------------------------------------------- desktop layout */
@media (min-width: 900px) {
  .app-shell {
    max-width: min(1280px, 100% - 48px); display: grid; grid-template-columns: 248px minmax(0, 1fr);
    grid-template-areas: "side main"; gap: 0; align-items: start;
  }
  .topbar { display: none; }
  .tabbar { display: none; }
  .sidebar {
    grid-area: side; display: flex; flex-direction: column; gap: 6px;
    position: sticky; top: 0; height: 100dvh; padding: 24px 16px;
    border-right: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: blur(8px);
  }
  .sidebar .brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 22px; letter-spacing: -.03em; padding: 4px 10px 16px; }
  .sidebar .brand img { width: 34px; height: 34px; border-radius: 9px; }
  .sidebar .brand .dot { color: var(--red); }
  .side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
  .side-nav button { display: flex; align-items: center; gap: 12px; border: 0; background: none; color: var(--ink-muted); font-weight: 800; font-size: 14.5px; padding: 12px 14px; border-radius: var(--r); text-align: left; transition: background .15s, color .15s; }
  .side-nav button svg { flex-shrink: 0; }
  .side-nav button:hover { background: var(--surface-2); color: var(--ink); }
  .side-nav button.active { background: var(--red-soft); color: var(--red-ink); }
  .side-nav button.active svg { color: var(--red); }
  .side-foot { border-top: 1px solid var(--line); padding-top: 12px; }
  .side-user { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
  .side-user .nm { font-weight: 800; font-size: 14px; }
  main.view { grid-area: main; max-width: none; width: 100%; margin: 0; padding: 28px 32px 44px; }
  main.view > h2 { font-size: 26px; margin-bottom: 16px; }
  .ways { grid-template-columns: repeat(3, 1fr); }
  .way { flex-direction: column; align-items: flex-start; gap: 10px; }
  .way > svg { display: none; }
  .tiles { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .tiles-3 { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  /* sheets become centered dialogs on desktop */
  .sheet-bg { align-items: center; }
  .sheet { max-width: 560px; border-radius: 22px; }

  /* guided / composer: a floating centered dialog over a full-viewport scrim (box-shadow spread) */
  .guided {
    inset: 24px auto; top: 24px; bottom: 24px; height: auto; max-height: calc(100dvh - 48px);
    max-width: 760px; border-radius: 22px; overflow: hidden;
    box-shadow: 0 0 0 100vmax rgb(10 12 14 / 0.55), var(--shadow-pop);
  }

  /* dashboard: weekly bars span the top row, weight + nutrition sit side by side */
  .dash-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
  .dash-2 .card { margin-bottom: 0; }
  .dash-2 > .card:first-child { grid-column: 1 / -1; }

  /* generator: compact two-column form; wide chip pickers span full width */
  .gen-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
  .gen-grid > .card { margin-bottom: 0; padding: 14px 16px; }
  .gen-grid > .gspan { grid-column: 1 / -1; }
  #generate { max-width: 420px; margin-left: auto; margin-right: auto; }

  /* generated plan: two-column exercise sub-islands */
  .draft-island .sub-islands { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
  .draft-island .sub-islands .sub-island { margin-bottom: 0; }

  /* exercise builder: canvas + sticky catalog */
  .builder { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
  .bld-cat { position: sticky; top: 24px; }
  .bld-cat-list { max-height: calc(100dvh - 240px); }

  /* progressi: a real grid instead of fragile css columns */
  #pBody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
  #pBody > .card { margin-bottom: 0; }
  #pBody > .tiles { grid-column: 1 / -1; }
  #pBody > .empty { grid-column: 1 / -1; padding: 44px 24px; }

  /* diario: two-column lists; forms, charts and empty states stay full width */
  main.view > .seg { max-width: 480px; }
  #dBody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; align-content: start; }
  #dBody .lrow { border-top: 0; border-bottom: 1px solid var(--line); }
  #dBody > .card, #dBody > .empty { grid-column: 1 / -1; }

  /* profilo: two-column settings sections */
  .profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; align-items: start; }
  .profile-grid .section-title { margin-top: 14px; }

  .hero img { width: 84px; height: 84px; }
  /* planned workout CTA doesn't stretch the full width */
  .wcard .btn-row { justify-content: flex-start; }
  .wcard .btn.primary.grow { flex: 0 0 auto; min-width: 240px; }
  /* charts use the width without leaving a right-side void */
  .donut-row { justify-content: flex-start; }
  .donut-row .legend { max-width: 340px; }
  .heat { justify-content: center; }
}
@media (min-width: 1200px) {
  .app-shell { max-width: min(1440px, 100% - 64px); }
  main.view { max-width: none; padding: 32px 44px 56px; }
  .tiles-3 { grid-template-columns: repeat(6, 1fr); gap: 16px; }
  /* three-up home dashboard: weekly bars + weight + nutrition in one row */
  .dash-2 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-2 > .card:first-child { grid-column: auto; }
}
@media (min-width: 1536px) {
  .app-shell { max-width: 1600px; }
  #pBody { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
