/* Layout: barra in alto fissa con legenda sport; calendario a 7 colonne + riepilogo settimanale.
   Sotto 1100px il riepilogo va sotto la settimana; sotto 820px (telefono) ogni settimana è un elenco
   di giorni compatto, le azioni passano in una barra in basso e il riepilogo si apre a richiesta. */
/* Colori: l'arancio è quello di partenza; nel Profilo ognuno sceglie il suo (viola, rosso, blu, lime)
   e l'aspetto chiaro, scuro o come il telefono. data-accent e data-theme li mette js/theme.js. */
:root {
  --bg: #F6F3F0;
  --surface: #FFFFFF;
  --surface-2: #FAF7F4;
  --ink: #1F1B18;
  --muted: #6F665F;
  --line: #E7DFD8;
  --accent: #EE5A12;
  --accent-ink: #FFFFFF;

  /* colori per sport */
  --swim: #1B82C4;
  --bike: #E06A1B;
  --run: #D03A5C;
  --brick: #B4841A;
  --strength: #7A52CB;
  --powerlifting: #C0392B;
  --calisthenics: #3FA34D;
  --crossfit: #5B6CFF;
  --mobility: #12988A;
  --other: #637587;
  --rest: #8A959F;
  --note: #4C5B69;

  /* esito rispetto al previsto */
  --ok: #1F9358;
  --partial: #BF920C;
  --off: #B4541A;
  --missed: #C93636;

  /* zone di intensità */
  --z1: #9AB2C2;
  --z2: #3C98D4;
  --z3: #2DAA70;
  --z4: #E3B82A;
  --z5: #EC842F;
  --z6: #DE4F3A;
  --z7: #9E254B;

  --f-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --f-body: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;

  --r: 10px;
  --shadow: 0 1px 2px rgb(16 24 32 / .06), 0 6px 18px rgb(16 24 32 / .07);
  --gutter: clamp(16px, 2vw, 28px);
  --bar-h: 58px;
}
:root[data-accent="viola"] { --bg: #F3F2F7; --surface-2: #F8F7FB; --ink: #1C1A26; --muted: #666377; --line: #E1DFEA; --accent: #6D3FD1; }
:root[data-accent="rosso"] { --bg: #F6F2F2; --surface-2: #FAF6F6; --ink: #211A1B; --muted: #6F6263; --line: #E8DDDD; --accent: #D21F3C; }
:root[data-accent="blu"] { --bg: #ECEFEE; --surface-2: #F4F6F5; --ink: #16202A; --muted: #5A6871; --line: #D6DCDA; --accent: #2446C4; }
:root[data-accent="lime"] { --bg: #F2F4EC; --surface-2: #F8FAF3; --ink: #1A1F14; --muted: #62695A; --line: #DEE3D3; --accent: #5F8F00; }
:root[data-accent="rosa"] { --bg: #F7F1F4; --surface-2: #FBF6F9; --ink: #231A1F; --muted: #6F6168; --line: #EADCE3; --accent: #D02E7D; }

/* scuro: le stesse regole due volte, per «come il telefono» e per «scuro» scelto a mano */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F0E0D; --surface: #191715; --surface-2: #211E1B; --ink: #F4EFEA; --muted: #A69C93; --line: #302B27;
    --accent: #FF7A30; --accent-ink: #1B0E05;
    --swim: #3CA2E2; --bike: #F28A3F; --run: #EE5F7E; --brick: #D6A73A; --strength: #A17EEC; --mobility: #2DBBA9; --other: #8597A8; --rest: #77838E; --note: #8E9DAA;
    --powerlifting: #E0574A; --calisthenics: #5BC26A; --crossfit: #8290FF;
    --ok: #3FBE80; --partial: #E1B52C; --off: #EB8F52; --missed: #F26666;
    --z1: #7893A6; --z2: #3E9EDD; --z3: #35B97C; --z4: #E8C23A; --z5: #F08D3B; --z6: #EC5E48; --z7: #C8406B;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 18px rgb(0 0 0 / .3);
    color-scheme: dark;
  }
  :root[data-accent="viola"]:not([data-theme="light"]) { --bg: #0E0D14; --surface: #17161F; --surface-2: #1F1D29; --ink: #EEEDF5; --muted: #9C99AE; --line: #2C2A3A; --accent: #A98BFF; --accent-ink: #140B2E; }
  :root[data-accent="rosso"]:not([data-theme="light"]) { --bg: #110D0E; --surface: #1B1617; --surface-2: #241D1E; --ink: #F5EDEE; --muted: #A9999B; --line: #34292A; --accent: #FF5C6F; --accent-ink: #2A060C; }
  :root[data-accent="blu"]:not([data-theme="light"]) { --bg: #0D1215; --surface: #151C21; --surface-2: #1A2329; --ink: #E4EBEE; --muted: #93A2AB; --line: #29353C; --accent: #819CFF; --accent-ink: #0A1130; }
  :root[data-accent="lime"]:not([data-theme="light"]) { --bg: #0A0F1C; --surface: #111A2C; --surface-2: #172238; --ink: #E9EEF8; --muted: #8F9BB4; --line: #233050; --accent: #C5F04A; --accent-ink: #0A0F1C; }
  :root[data-accent="rosa"]:not([data-theme="light"]) { --bg: #120D10; --surface: #1C1619; --surface-2: #251D21; --ink: #F6EDF2; --muted: #AB99A2; --line: #362A30; --accent: #FF7EB9; --accent-ink: #2E0A1C; }
}
:root[data-theme="dark"] {
  --bg: #0F0E0D; --surface: #191715; --surface-2: #211E1B; --ink: #F4EFEA; --muted: #A69C93; --line: #302B27;
  --accent: #FF7A30; --accent-ink: #1B0E05;
  --swim: #3CA2E2; --bike: #F28A3F; --run: #EE5F7E; --brick: #D6A73A; --strength: #A17EEC; --mobility: #2DBBA9; --other: #8597A8; --rest: #77838E; --note: #8E9DAA;
  --powerlifting: #E0574A; --calisthenics: #5BC26A; --crossfit: #8290FF;
  --ok: #3FBE80; --partial: #E1B52C; --off: #EB8F52; --missed: #F26666;
  --z1: #7893A6; --z2: #3E9EDD; --z3: #35B97C; --z4: #E8C23A; --z5: #F08D3B; --z6: #EC5E48; --z7: #C8406B;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 18px rgb(0 0 0 / .3);
  color-scheme: dark;
}
:root[data-accent="viola"][data-theme="dark"] { --bg: #0E0D14; --surface: #17161F; --surface-2: #1F1D29; --ink: #EEEDF5; --muted: #9C99AE; --line: #2C2A3A; --accent: #A98BFF; --accent-ink: #140B2E; }
:root[data-accent="rosso"][data-theme="dark"] { --bg: #110D0E; --surface: #1B1617; --surface-2: #241D1E; --ink: #F5EDEE; --muted: #A9999B; --line: #34292A; --accent: #FF5C6F; --accent-ink: #2A060C; }
:root[data-accent="blu"][data-theme="dark"] { --bg: #0D1215; --surface: #151C21; --surface-2: #1A2329; --ink: #E4EBEE; --muted: #93A2AB; --line: #29353C; --accent: #819CFF; --accent-ink: #0A1130; }
:root[data-accent="lime"][data-theme="dark"] { --bg: #0A0F1C; --surface: #111A2C; --surface-2: #172238; --ink: #E9EEF8; --muted: #8F9BB4; --line: #233050; --accent: #C5F04A; --accent-ink: #0A0F1C; }
:root[data-accent="rosa"][data-theme="dark"] { --bg: #120D10; --surface: #1C1619; --surface-2: #251D21; --ink: #F6EDF2; --muted: #AB99A2; --line: #362A30; --accent: #FF7EB9; --accent-ink: #2E0A1C; }

/* colore dello sport come variabile locale */
.sheet, .card, .lg, .sp-opt, .lib-item { --c: var(--accent); }
.s-swim { --c: var(--swim); } .s-bike { --c: var(--bike); } .s-run { --c: var(--run); }
.s-brick { --c: var(--brick); } .s-strength { --c: var(--strength); } .s-mobility { --c: var(--mobility); }
.s-powerlifting { --c: var(--powerlifting); } .s-calisthenics { --c: var(--calisthenics); } .s-crossfit { --c: var(--crossfit); }
.s-other { --c: var(--other); } .s-rest { --c: var(--rest); } .s-note { --c: var(--note); }
.st-ok { --st: var(--ok); } .st-partial { --st: var(--partial); } .st-off { --st: var(--off); }
.st-missed { --st: var(--missed); } .st-planned { --st: var(--muted); } .st-extra { --st: var(--ok); }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
body {
  margin: 0;
  background: var(--bg); color: var(--ink);
  font: 400 14px/1.4 var(--f-body);
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
table { font: inherit; }
svg { display: block; }
.wrap { padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px)); }
.muted { color: var(--muted); }
.mono { font-family: var(--f-mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- pulsanti ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: 13px; line-height: 1.2; cursor: pointer; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.btn.danger { color: var(--missed); }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn.is-armed, .icon-btn.is-armed { background: var(--missed); border-color: var(--missed); color: #fff; width: auto; padding-inline: 10px; font-size: 12.5px; font-weight: 600; }
/* armato e ancora sotto il dito: su iPhone dopo il tocco il tasto resta in :hover e .btn.ghost:hover gli toglieva il rosso
   (23/11/2026, Stefano: «Conferma eliminazione» trasparente, scritta sopra gli altri tasti del dettaglio) */
.btn.is-armed:hover, .icon-btn.is-armed:hover { background: var(--missed); border-color: var(--missed); color: #fff; }
.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none;
  border: 0; border-radius: 6px; background: transparent; cursor: pointer; color: var(--muted);
}
.icon-btn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- barra superiore ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.tb-row { display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; padding-block: 6px 4px; }
.brand { display: flex; align-items: center; gap: 8px; margin-right: auto; min-width: 0; }
/* logo omnifit: formica e «FIT» sempre nell'arancio del marchio, non nel colore scelto nel Profilo */
.logo { width: auto; height: 30px; flex: none; }
.brand-name { font: 600 32px/1 "Teko", var(--f-display); text-transform: uppercase; letter-spacing: .01em; padding: .14em .06em 0 0; transform: skewX(-9deg); }
.brand-name .fit { color: #FF7A30; }
/* logo e nome riportano alla home (js/main.js goHome, 4/11) */
.topbar .brand > .is-home { cursor: pointer; border-radius: 6px; }
.topbar .brand > .is-home:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.topbar .brand > .brand-name.is-home:hover .fit, .topbar .brand > .brand-name.is-home:hover { filter: brightness(1.15); }
/* la formica davanti al titolo delle pagine principali del telefono (R.sheetTop in panels.js): la barra in alto
   col logo lì è coperta. Disegno di .logo, occhio vuoto (si vede il fondo dell'intestazione); sul PC non serve */
.sh-mark {
  display: none; flex: none; width: 26px; height: 22px; margin-right: -1px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='56 88 412 340'%3E%3Cg transform='translate(-8 6)' fill='%23FF7A30'%3E%3Cellipse cx='160' cy='292' rx='86' ry='66' transform='rotate(-12 160 292)'/%3E%3Ccircle cx='246' cy='282' r='16'/%3E%3Cellipse cx='290' cy='266' rx='48' ry='32' transform='rotate(-22 290 266)'/%3E%3Cpath fill-rule='evenodd' d='M316 222a50 50 0 1 0 100 0a50 50 0 1 0-100 0zM373 210a9 9 0 1 0 18 0a9 9 0 1 0-18 0z'/%3E%3Cg fill='none' stroke='%23FF7A30' stroke-width='18' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M356 176C352 132 376 108 410 100M380 178C392 140 424 124 456 128'/%3E%3Cpath d='M270 284L222 334L196 398M290 288L292 342L270 402M312 280L352 328L378 392'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
}
.brand-ath { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.brand-ath b { color: var(--ink); font-weight: 600; }
.weeknav { display: flex; align-items: center; gap: 2px; }
.range { font: 600 16px/1 var(--f-display); letter-spacing: .02em; margin-left: 6px; white-space: nowrap; }
.tb-actions { display: flex; gap: 2px; flex-wrap: wrap; }
/* «Atleti»: solo per chi allena altri atleti (main.js), apre l'area allenatore */
.coach-btn { flex: none; margin-left: 2px; }

/* legenda degli sport: solo sul PC (sul telefono non c'è filtro) */
.legend { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; padding-block: 2px 6px; }
.lg {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 3px; flex: none;
  border-radius: 99px; border: 1px solid color-mix(in srgb, var(--c) 35%, var(--line));
  background: color-mix(in srgb, var(--c) 9%, var(--surface)); cursor: pointer;
  font-size: 12px; font-weight: 600;
}
.lg .c-ico { width: 18px; height: 18px; }
.lg .c-ico svg { width: 13px; height: 13px; }
.lg[aria-pressed="false"] { opacity: .45; text-decoration: line-through; background: transparent; }
.cmp-key { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; flex: none; }

/* PC: la barra in alto più grande e leggibile (sul telefono resta com'è) */
@media (min-width: 821px) {
  .tb-row { padding-block: 8px 6px; }
  .logo { height: 34px; }
  .brand-name { font-size: 36px; }
  .brand-ath { font-size: 15px; }
  .btn.coach-btn { padding: 6px 12px; font-size: 14px; }
  .coach-btn svg { width: 18px; height: 18px; }
  .weeknav { gap: 4px; }
  .weeknav .icon-btn { width: 34px; height: 34px; }
  .weeknav .icon-btn svg { width: 20px; height: 20px; }
  #todayBtn { padding: 6px 12px; font-size: 14px; }
  .range { font-size: 21px; }
  .tb-actions { gap: 4px; }
  .tb-actions .btn { padding: 8px 13px; font-size: 15px; }
  .tb-actions .btn svg { width: 18px; height: 18px; }
  .tb-row > .nt-bell { width: 38px; height: 38px; }
  .tb-row > .nt-bell svg { width: 22px; height: 22px; }
  .legend { gap: 6px; padding-block: 4px 8px; }
  .lg { gap: 6px; padding: 3px 11px 3px 4px; font-size: 13.5px; }
  .lg .c-ico { width: 21px; height: 21px; }
  .lg .c-ico svg { width: 15px; height: 15px; }
  .cmp-key { gap: 6px; }
  .cmp-key .pill { padding: 2px 8px 2px 7px; font-size: 12px; }
  .cmp-key .pill::before { width: 7px; height: 7px; }
  .topbar .cal-head span { padding-block: 6px; font-size: 13.5px; }
  .coach-row .cr-who { font-size: 15px; }
  .coach-row .btn.small { padding: 6px 11px; font-size: 14px; }
}

.cal-head {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(160px, .9fr);
  border-top: 1px solid var(--line); background: var(--surface-2);
}
.cal-head span { padding: 4px 7px; font: 600 12px/1 var(--f-display); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

/* ---------- avviso dati di esempio ---------- */
.demo {
  display: flex; align-items: center; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap;
  margin-top: 10px; padding: 7px 12px; border-radius: var(--r); font-size: 13px;
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
}
.demo p { margin: 0; max-width: 72ch; }
.demo-actions { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------- calendario ---------- */
.calendar { display: flex; flex-direction: column; gap: 14px; padding-block: 10px 6px; }
.week { scroll-margin-top: 112px; }
.w-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; margin-bottom: 4px; }
.w-head h3 { margin: 0; white-space: nowrap; font: 700 17px/1 var(--f-display); text-transform: uppercase; letter-spacing: .04em; }
.w-range { color: var(--muted); font-size: 13px; }
.w-now {
  font: 700 10.5px/1 var(--f-body); text-transform: uppercase; letter-spacing: .06em;
  color: var(--accent); padding: 3px 6px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.w-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(160px, .9fr);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
}
.day { min-width: 0; min-height: 84px; padding: 5px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.day.is-past { background: color-mix(in srgb, var(--surface-2) 70%, var(--surface)); }
/* oggi: una riga sottile nel colore dell'app lungo il lato sinistro e un fondo appena tinto */
.day.is-today { background: color-mix(in srgb, var(--accent) 3%, var(--surface)); box-shadow: inset 2px 0 0 var(--accent); }
.day.is-drop { outline: 2px dashed var(--accent); outline-offset: -4px; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.day.is-flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); } }
@keyframes slide-next { from { opacity: .3; transform: translateX(28px); } }
@keyframes slide-prev { from { opacity: .3; transform: translateX(-28px); } }
.d-head { display: flex; align-items: center; gap: 5px; min-height: 22px; }
/* giorno della settimana + numero (sul PC il giorno della settimana è nell'intestazione delle colonne) */
.d-lab { display: flex; align-items: center; gap: 5px; flex: none; min-width: 0; }
.d-dow { display: none; font: 600 11.5px/1 var(--f-display); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.d-num { font: 600 16px/1 var(--f-display); }
/* oggi: tutta l'etichetta del giorno è il tasto della pagina Oggi. Numero in un cerchietto pieno, giorno della settimana
   nel colore dell'app; con promemoria da fare (has-dot, js/health.js) un puntino piccolo sul cerchio */
.d-today {
  position: relative; z-index: 1; margin: 0; padding: 0; border: 0; border-radius: 99px;
  background: none; color: inherit; cursor: pointer;
}
.d-today .d-dow { color: var(--accent); font-weight: 700; }
.d-today .d-num {
  position: relative; display: grid; place-items: center; width: 22px; height: 22px; padding-top: 1px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: 14px; transition: transform .1s ease;
}
@media (hover: hover) { .d-today:hover .d-num { background: color-mix(in srgb, var(--accent) 86%, var(--ink)); } }
.d-today:active .d-num { transform: scale(.92); }
.d-today.has-dot .d-num::after {
  content: ""; position: absolute; top: -2px; right: -3px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--missed); box-shadow: 0 0 0 1.5px var(--surface);
}
.d-free { display: none; }
.d-add { margin-left: auto; width: 22px; height: 22px; display: grid; place-items: center; border: 1px dashed transparent; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; opacity: 0; flex: none; }
.d-add svg { width: 14px; height: 14px; }
.day:hover .d-add, .d-add:focus-visible { opacity: 1; border-color: var(--line); }
.d-add:hover { color: var(--accent); border-color: var(--accent); }
@media (hover: none) { .d-add { opacity: 1; border-color: var(--line); } }
.d-items { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

/* ---------- scheda allenamento ---------- */
.card {
  display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: center; column-gap: 6px;
  grid-template-areas: "ico title" "met met" "prof prof" "foot foot";
  position: relative; cursor: pointer; min-width: 0;
  padding: 5px 6px; border-radius: 6px;
  background: color-mix(in srgb, var(--c) 6%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--c) 28%, var(--line));
  border-top: 2px solid var(--c);
  transition: transform .12s ease, box-shadow .12s ease;
}
.card.is-done { background: color-mix(in srgb, var(--c) 14%, var(--surface)); }
.card.cs-missed { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--missed) 7%, var(--surface)) 0 6px, var(--surface) 6px 12px); }
.card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.card.is-dragging { opacity: .4; }
.c-ico { grid-area: ico; width: 20px; height: 20px; flex: none; display: grid; place-items: center; border-radius: 5px; background: var(--c); color: var(--surface); }
.c-ico svg { width: 14px; height: 14px; }
.c-title { grid-area: title; margin: 0; font-size: 12.5px; font-weight: 700; line-height: 1.2; overflow-wrap: break-word; hyphens: auto; }
.c-met { grid-area: met; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; min-width: 0; margin-top: 3px; }
.c-big { font: 600 16px/1.1 var(--f-display); letter-spacing: .01em; }
.c-sub { font-size: 11.5px; color: var(--muted); }
.c-prof { grid-area: prof; margin-top: 2px; min-width: 0; }
.mini-prof { width: 100%; height: 16px; color: var(--c); }
.c-desc { grid-area: met; margin: 3px 0 0; font-size: 11.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.c-foot { grid-area: foot; display: flex; gap: 6px; align-items: center; margin-top: 4px; padding-top: 4px; border-top: 1px solid color-mix(in srgb, var(--c) 22%, var(--line)); font-size: 11px; min-width: 0; }
.c-rpe { font-weight: 700; white-space: nowrap; }
.c-note { color: var(--muted); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.pill {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  padding: 1px 6px 1px 5px; border-radius: 99px; white-space: nowrap;
  font-size: 10.5px; font-weight: 700; line-height: 1.35;
  background: color-mix(in srgb, var(--st) 15%, transparent);
  color: color-mix(in srgb, var(--st) 72%, var(--ink));
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--st); }
.pill.st-planned::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--st); }

/* ---------- riepilogo settimana ---------- */
.w-sum { padding: 8px 10px; background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 12px; }
.ws-head, .ws-extra { display: flex; flex-direction: column; gap: 6px; }
.ws-extra { flex: 1; }
.ws-k { font: 600 11px/1 var(--f-display); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.ws-big { display: flex; align-items: baseline; gap: 5px; }
.ws-big b { font: 700 25px/1 var(--f-display); }
.ws-big span { color: var(--muted); }
.ws-meter { height: 5px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 10%, transparent); overflow: hidden; }
.ws-meter i { display: block; height: 100%; background: var(--ok); border-radius: inherit; }
.ws-stack { display: flex; height: 8px; border-radius: 3px; overflow: hidden; gap: 2px; }
.ws-stack i { background: var(--c); min-width: 3px; }
.ws-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ws-list li { display: grid; grid-template-columns: 9px 1fr auto auto; align-items: baseline; gap: 5px; }
.ws-list .dot { width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.ws-list b { font-weight: 700; }
.ws-list em { font-style: normal; color: var(--muted); }
.ws-figs { display: flex; gap: 14px; margin: 0; }
.ws-figs > div { display: flex; flex-direction: column; }
.ws-figs dt { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.ws-figs dd { margin: 0; color: var(--muted); }
.ws-figs dd b { color: var(--ink); font-size: 13px; }
.ws-toggle { display: none; }
.ws-copy { margin-top: auto; display: inline-flex; align-items: center; gap: 5px; align-self: flex-start; padding: 4px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 11.5px; font-weight: 600; cursor: pointer; }
.ws-copy svg { width: 13px; height: 13px; }
.ws-copy:hover { border-color: var(--accent); color: var(--accent); }
.ws-copy.is-armed { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ws-empty { margin: 0; color: var(--muted); }
.ws-gym { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 5px; margin: 0; color: var(--muted); }
.ws-gym b { color: var(--ink); }
.ws-gym .dot { width: 8px; height: 8px; border-radius: 2px; background: var(--c); align-self: center; }

.foot-hint { color: var(--muted); font-size: 12px; padding-block: 2px 24px; margin: 0; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; margin: 0; }

/* vecchia tendina dell'atleta: resta nella pagina ma sempre nascosta (al suo posto il tasto «Atleti») */
.ath-sel {
  max-width: 180px; padding: 4px 26px 4px 9px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface-2); font-weight: 600; font-size: 13px; min-width: 0;
}
/* «Stai guardando: …» in cima al calendario di un atleta: a sinistra porta all'area Atleti, «Torna al mio» al proprio */
.coach-row {
  display: flex; align-items: center; gap: 6px; margin-top: 10px; padding: 4px 6px 4px 4px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}
.coach-row[hidden] { display: none; }
.cr-who {
  display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; min-height: 40px; padding: 0 8px;
  border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.cr-who:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.cr-who:active { background: color-mix(in srgb, var(--ink) 9%, transparent); }
.cr-t { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
/* il nome dell'atleta: un tasto accanto a «Torna al mio» */
.cr-go {
  display: inline-flex; align-items: center; gap: 2px; flex: 0 1 auto; min-width: 0; padding: 5px 6px 5px 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); border-radius: 8px; background: var(--surface);
}
.cr-go b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--ink); }
.cr-go svg { flex: none; width: 16px; height: 16px; color: color-mix(in srgb, var(--accent) 80%, var(--ink)); }
.cr-who:hover .cr-go { border-color: var(--accent); }
.cr-back, .cr-chat { flex: none; gap: 4px; padding-left: 8px; white-space: nowrap; }
.cr-back svg, .cr-chat svg { width: 15px; height: 15px; }
.cr-chat { color: color-mix(in srgb, var(--accent) 85%, var(--ink)); }
/* sul PC la chat è già aperta accanto: «Scrivi» serve solo dopo averla chiusa */
body.has-dock .cr-chat { display: none; }
/* telefono: una riga sottile, ‹ (torna al mio) · nome (apre «Atleti») · fumetto (scrivi) */
@media (max-width: 820px) {
  .coach-row { gap: 2px; margin-top: 6px; padding: 2px; border-radius: 10px; }
  .cr-t, .cr-bt, .cr-go svg { display: none; }
  .cr-who { min-height: 36px; padding: 0 6px; font-size: 14.5px; }
  .cr-go { flex: 1 1 auto; padding: 0; border: 0; background: transparent; }
  .cr-back, .cr-chat { order: -1; display: grid; place-items: center; width: 36px; height: 36px; min-height: 0; padding: 0; border-radius: 8px; }
  .cr-back svg, .cr-chat svg { width: 20px; height: 20px; }
  .coach-row .btn.cr-back { background: transparent; border-color: transparent; color: var(--ink); }
  .coach-row .btn.cr-chat { order: 1; border-color: transparent; background: color-mix(in srgb, var(--accent) 16%, transparent); }
}

/* ---------- accesso ---------- */
.auth {
  position: fixed; inset: 0; z-index: 100; overflow-y: auto;
  display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px));
  background:
    repeating-linear-gradient(90deg, transparent 0 46px, color-mix(in srgb, var(--accent) 6%, transparent) 46px 52px),
    var(--bg);
}
.auth-card {
  width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px;
  padding: 26px 22px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.auth-brand { margin: 0 0 4px; gap: 10px; justify-content: center; }
.auth-brand .logo { height: 44px; }
.auth-brand .brand-name { font-size: 50px; }
.auth-legal { margin: 0; text-align: center; font-size: 12.5px; color: var(--muted); }
.auth-legal a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
/* Profilo → Elimina account: l'avviso sopra la casella di conferma */
.acc-warn { margin: 0 0 8px; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.auth-card h1 { margin: 6px 0 0; font: 700 34px/1 var(--f-display); text-transform: uppercase; letter-spacing: .02em; }
.auth-lead { margin: 0; color: var(--muted); line-height: 1.5; }
.auth-lead.small { font-size: 12.5px; text-align: center; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 16px; }
.auth-form input:focus { border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent); outline-offset: 0; }
#authCode { letter-spacing: .3em; font-size: 22px; text-align: center; }
/* l'occhio della password (js/password.js): login e Profilo → Password */
.pw-box { position: relative; display: block; }
.acc-row .pw-box { flex: 1; min-width: 0; }
.pw-box input[type], .pr-xb .acc-row .pw-box input { width: 100%; padding-right: 44px; }
.pw-box input::-ms-reveal, .pw-box input::-ms-clear { display: none; }
.pw-eye {
  position: absolute; top: 0; right: 0; bottom: 0; width: 44px; display: grid; place-items: center;
  padding: 0; border: 0; border-radius: 0 8px 8px 0; background: none; color: var(--muted); cursor: pointer;
}
.pw-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pw-eye .pw-x { display: none; }
.pw-eye[aria-pressed="true"] { color: var(--accent); }
.pw-eye[aria-pressed="true"] .pw-x { display: inline; }
.pw-eye:focus-visible { outline: 2px solid var(--accent); outline-offset: -5px; }
.auth-form .btn { justify-content: center; padding: 11px 14px; font-size: 15px; }
.auth .f-err { margin: 0; }
/* «Nuova password» dopo l'accesso con il codice (js/main.js R.openNewPw): due caselle una sotto l'altra */
.sec.np { display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.np-lead { margin: 0 0 4px; color: var(--muted); line-height: 1.5; }
.auth-local { align-self: center; white-space: normal; text-align: center; color: var(--muted); }
.auth-off { display: flex; flex-direction: column; gap: 12px; }
.auth-off p { margin: 0; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.auth-off .btn { justify-content: center; padding: 11px 14px; font-size: 15px; }
.bottombar { display: none; }

/* novità del social: pastiglia sul tasto Social (barra in basso, barra in alto del PC) */
.bb-badge {
  display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 99px; background: var(--accent); color: var(--accent-ink);
  font: 700 10.5px/1 var(--f-body); font-variant-numeric: tabular-nums; letter-spacing: 0;
}

/* ---------- avviso in basso ---------- */
/* sopra le pagine del telefono (z-index 25 e in su, una per pagina aperta) e sopra la barra in basso */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 80;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 14px; width: max-content; max-width: calc(100% - 32px);
  padding: 9px 14px; border-radius: var(--r); background: var(--ink); color: var(--bg);
  box-shadow: var(--shadow); font-weight: 500; font-size: 13px;
}
.toast-undo { flex: none; min-height: 36px; padding: 8px 6px; border: 0; background: transparent; color: var(--bg); font-weight: 700; text-decoration: underline; cursor: pointer; }

/* ---------- schermi medi: riepilogo sotto ---------- */
@media (max-width: 1100px) {
  .cal-head, .w-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .cal-head span:last-child { display: none; }
  .day:nth-child(7) { border-right: 0; }
  .w-sum { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 22px; border-top: 1px solid var(--line); }
  .w-sum.is-empty { display: none; }
  .ws-head, .ws-extra { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 20px; }
  .ws-meter, .ws-stack { width: 130px; }
  .ws-list { flex-direction: row; flex-wrap: wrap; gap: 3px 14px; }
  .ws-list li { display: flex; }
  .ws-copy { margin-top: 0; }
}
/* con la chat accanto al calendario (PC, js/chat.js: fino a 420px) i giorni sono più stretti: il riepilogo va sotto prima */
@media (min-width: 821px) and (max-width: 1520px) {
  body.has-dock .cal-head, body.has-dock .w-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  body.has-dock .cal-head span:last-child { display: none; }
  body.has-dock .day:nth-child(7) { border-right: 0; }
  body.has-dock .w-sum { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 22px; border-top: 1px solid var(--line); }
  body.has-dock .w-sum.is-empty { display: none; }
  body.has-dock .ws-head, body.has-dock .ws-extra { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 20px; }
  body.has-dock .ws-meter, body.has-dock .ws-stack { width: 130px; }
  body.has-dock .ws-list { flex-direction: row; flex-wrap: wrap; gap: 3px 14px; }
  body.has-dock .ws-list li { display: flex; }
  body.has-dock .ws-copy { margin-top: 0; }
}

/* ---------- telefono ---------- */
@media (max-width: 820px) {
  body { padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px)); font-size: 14px; }

  /* barra in alto: una riga sola, sotto la tacca del telefono quando l'app è installata */
  .topbar { top: 0; padding-top: env(safe-area-inset-top, 0px); }
  /* marchio e tasti a misura fissa; se proprio manca spazio si accorcia solo la data della settimana (con i puntini) */
  .tb-row { flex-wrap: nowrap; gap: 4px; padding-block: 2px; }
  .tb-row .icon-btn { width: 40px; height: 40px; }
  .tb-row .brand { flex-shrink: 0; }
  .weeknav { min-width: 0; }
  .logo { height: 26px; }
  .brand-name { font-size: 29px; }
  .brand-ath, .tb-actions { display: none; }
  #todayBtn { padding: 5px 9px; margin-right: 2px; }
  .ath-sel { max-width: 110px; font-size: 12.5px; padding-block: 3px; }
  /* chi allena: «Atleti» accanto alla formica, al posto del nome dell'app */
  .coach-btn { margin-left: 0; padding: 4px 9px 4px 7px; gap: 5px; font-size: 12.5px; }
  .tb-row .brand:has(.coach-btn:not([hidden])) .brand-name { display: none; }
  .range { font-size: 14px; line-height: 1.3; margin-left: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .legend { display: none; }
  .cal-head, .foot-hint { display: none; }


  .demo { margin-top: 8px; padding: 7px 10px; font-size: 12.5px; }
  body { overflow-x: clip; }
  .calendar { gap: 10px; padding-block: 8px 12px; }
  .calendar.slide-next { animation: slide-next .22s ease-out; }
  .calendar.slide-prev { animation: slide-prev .22s ease-out; }
  .week { scroll-margin-top: 54px; }
  .w-head { display: none; }

  /* striscia dei 7 giorni: la settimana intera in una riga */
  .wstrip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 8px; }
  .wsd {
    display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0;
    padding: 5px 0 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer;
  }
  .wsd:active { background: var(--surface-2); transform: scale(.96); }
  .card, .wsd, .bb, .btn, .d-add, .ws-toggle { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  .wsd, .card { transition: transform .1s ease; }
  .wsd-dow { font: 600 10.5px/1 var(--f-display); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
  .wsd-num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font: 600 16px/1 var(--f-display); }
  .wsd.is-past .wsd-num { color: var(--muted); }
  /* oggi come nell'elenco: cerchietto pieno e giorno nel colore dell'app, bordo normale */
  .wsd.is-today .wsd-dow { color: var(--accent); font-weight: 700; }
  .wsd.is-today .wsd-num { background: var(--accent); color: var(--accent-ink); }
  .wsd-bars { display: flex; flex-direction: column; gap: 2px; width: 100%; min-height: 16px; padding-inline: 6px; }
  .wsd-bars i { height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--c) 40%, transparent); }
  .wsd-bars i.is-done { background: var(--c); }
  .wsd-bars i.is-missed { background: color-mix(in srgb, var(--missed) 60%, transparent); }
  .wsd-t { min-height: 10px; font: 500 10px/1 var(--f-mono); color: var(--muted); }

  /* settimana = elenco di giorni */
  .w-grid { display: flex; flex-direction: column; }
  .day {
    display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 8px;
    min-height: 0; padding: 5px 8px 5px 5px; border-right: 0; border-bottom: 1px solid var(--line);
    scroll-margin: 60px 0 70px;
  }
  .day:last-of-type { border-bottom: 0; }
  .d-head { position: relative; flex-direction: column; align-items: center; justify-content: flex-start; gap: 1px; min-height: 0; padding-bottom: 18px; }
  .d-lab { flex-direction: column; gap: 1px; }
  .d-dow { display: block; font-size: 10.5px; }
  .d-num { font-size: 17px; }
  /* oggi: giorno sopra, cerchietto sotto, largo quanto la colonna; si tocca anche un po' fuori dal bordo */
  .d-today { width: 30px; gap: 3px; border-radius: 8px; }
  .d-today::before { content: ""; position: absolute; inset: -5px -4px -3px; }
  .d-today .d-num { width: 24px; height: 24px; font-size: 15px; }
  .d-add {
    position: absolute; inset: 0; width: auto; height: auto; margin: 0; padding-bottom: 3px;
    display: grid; place-items: end center; border: 0; border-radius: 6px; opacity: 1;
  }
  .d-add svg { width: 14px; height: 14px; }
  .d-add:active { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
  .d-items { gap: 4px; }

  /* giorno libero: una riga sola */
  .day.is-free { position: relative; grid-template-columns: minmax(0, 1fr); padding-block: 7px; }
  .day.is-free .d-head { position: static; padding-bottom: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; align-items: center; }
  .day.is-free .d-lab { display: grid; grid-template-columns: 30px 24px; column-gap: 8px; align-items: center; justify-items: center; }
  .day.is-free .d-num { font-size: 15px; }
  .day.is-free .d-free { display: block; color: var(--muted); font-size: 12px; }
  .day.is-free .d-today { width: auto; }
  .day.is-free .d-today .d-num { width: 22px; height: 22px; font-size: 14px; }
  .day.is-free .d-add { place-items: center end; padding: 0 14px 0 0; border-radius: 0; }
  .day.is-free .d-items { display: none; }

  /* scheda su due righe: icona | titolo · esito | numeri · profilo */
  .card {
    grid-template-columns: 24px minmax(0, 1fr) auto; column-gap: 8px; row-gap: 2px;
    grid-template-areas: "ico title foot" "ico met prof";
    padding: 5px 8px; border-top-width: 1px;
    background: color-mix(in srgb, var(--c) 9%, var(--surface));
    border-color: color-mix(in srgb, var(--c) 38%, var(--line));
  }
  .card:not(:has(.c-foot)) { grid-template-areas: "ico title title" "ico met prof"; }
  .card:not(:has(.c-prof)) { grid-template-areas: "ico title foot" "ico met met"; }
  .card:not(:has(.c-foot)):not(:has(.c-prof)) { grid-template-areas: "ico title title" "ico met met"; }
  .card.is-done { background: color-mix(in srgb, var(--c) 17%, var(--surface)); }
  .card:hover { transform: none; box-shadow: none; }
  .card:active { transform: scale(.985); }
  .c-ico { width: 24px; height: 24px; border-radius: 6px; }
  .c-ico svg { width: 16px; height: 16px; }
  .c-title { font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .c-met { flex-wrap: nowrap; margin: 0; white-space: nowrap; overflow: hidden; }
  .c-big { font-size: 15px; }
  .c-sub { font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .c-prof { width: 72px; margin: 0; }
  .mini-prof { height: 18px; }
  .c-desc { -webkit-line-clamp: 1; margin: 0; font-size: 12px; }
  .c-foot { justify-self: end; gap: 5px; margin: 0; padding: 0; border: 0; }
  .c-foot .c-rpe, .c-foot .c-note { display: none; }

  /* riepilogo compatto, si apre con «Dettagli» */
  .w-sum { order: -1; flex-direction: column; align-items: stretch; gap: 6px; padding: 7px 10px; border-top: 0; border-bottom: 1px solid var(--line); }
  .ws-head { flex-wrap: nowrap; gap: 10px; }
  .ws-k { display: none; }
  .ws-big b { font-size: 20px; }
  .ws-big span { font-size: 12px; white-space: nowrap; }
  .ws-meter { flex: 1 1 40px; width: auto; }
  .ws-figs { gap: 10px; }
  .ws-figs > div { flex-direction: row; align-items: baseline; gap: 3px; }
  .ws-figs dd { white-space: nowrap; }
  .ws-figs > div:last-child { display: none; }
  .ws-toggle {
    display: inline-flex; align-items: center; gap: 3px; flex: none; min-height: 34px; padding: 4px 10px; border-radius: 8px;
    border: 1px solid var(--line); background: var(--surface); font-size: 12px; font-weight: 600; cursor: pointer;
  }
  .ws-toggle svg { width: 14px; height: 14px; transition: transform .15s; }
  .w-sum.is-open .ws-toggle svg { transform: rotate(180deg); }
  .ws-extra { display: none; }
  .w-sum.is-open .ws-extra { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
  .ws-stack { width: auto; }
  .ws-list { flex-direction: row; flex-wrap: wrap; gap: 3px 14px; }
  .ws-copy { align-self: flex-start; min-height: 36px; padding-inline: 10px; }
  .w-sum.is-empty { flex-direction: row; align-items: center; }

  /* barra azioni in basso: sopra tutte le pagine (z-index 25 + quante ne sono aperte, panels.js) */
  .bottombar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .bb {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0 2px;
    border: 0; background: transparent; color: var(--muted); font-size: 10.5px; font-weight: 600; cursor: pointer;
  }
  .bb svg { width: 22px; height: 22px; }
  /* novità: in alto a destra dell'icona, staccata dalla barra con un bordo del colore della barra */
  .bb .bb-badge { position: absolute; top: 1px; left: calc(50% + 5px); box-shadow: 0 0 0 2px var(--surface); }
  .bb:active, .bb.is-active { color: var(--accent); }
  .bb-add.is-active { color: var(--ink); }
  body.has-screen { overflow: hidden; }
  body.is-typing .bottombar { display: none; }
  /* «Nuovo»: la formica nel cerchio del colore scelto nel Profilo (la formica col colore del testo sul colore,
     scura nel tema scuro e bianca nel chiaro; l'occhio è un buco del colore del cerchio) */
  .bb-plus {
    display: grid; place-items: center; width: 46px; height: 46px; margin-top: -16px; border-radius: 50%;
    background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow);
  }
  .bb-plus svg { width: 30px; height: 25px; }
  .bb-add { color: var(--ink); }
  /* i coach hanno anche «Atleti» (main.js showCoachTabs): 6 tasti, un po' più stretti, le scritte su una riga */
  .bottombar.six { grid-template-columns: repeat(6, minmax(0, 1fr)); padding-inline: 2px; }
  .bottombar.six .bb { white-space: nowrap; }
  /* a 6 tasti le scritte a 9,5 px non si leggevano: resta solo quella del tasto attivo (e «Nuovo»), le altre lasciano il posto ma non si vedono */
  .bottombar.six .bb:not(.is-active):not(.bb-add) .bb-l { opacity: 0; } /* opacity e non visibility: i lettori di schermo leggono ancora il nome */
  .toast { bottom: calc(var(--bar-h) + 10px + env(safe-area-inset-bottom, 0px)); }

  /* marchio nelle schede della barra (Social, Corpo, Profilo, Nuovo) e nella pagina Oggi (anche quando è
     l'allenamento del giorno, aperto direttamente) */
  :is(#socialDlg, #bodyDlg, #settingsDlg, #todayDlg, #newDlg, #detailDlg[data-tab="oggi"]) .sh-mark { display: block; }
}
@media (max-width: 820px) {
  /* tasti almeno da 36–40 px: si toccano col dito senza sbagliare */
  .btn { min-height: 40px; }
  .btn.small { min-height: 36px; }
  .icon-btn { width: 38px; height: 38px; }
}
/* telefoni stretti (360 px e meno): il grafichino si stringe, poi sparisce, per non tagliare i numeri */
@media (max-width: 400px) {
  .c-prof { width: 50px; }
  .c-sub { font-size: 11.5px; }
}
@media (max-width: 360px) {
  /* 320–360 px: il nome dell'app nella barra in alto lascia spazio alle frecce (accesso e benvenuto lo tengono), il riepilogo va a capo */
  .tb-row .brand-name { display: none; }
  .coach-btn { padding-inline: 8px; }
  .coach-btn .cb-t { display: none; } /* resta l'icona; il nome «Atleti» è nell'aria-label */
  .ws-head { flex-wrap: wrap; }
  .bottombar.six .bb { font-size: 9px; letter-spacing: -.02em; } /* 6 tasti in 320–360 px: «Calendario» resta intero */
}
@media (max-width: 340px) {
  .c-prof { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* profilo di un altro (9/11/2026) */
.cr-s { display: none; }
.other-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; padding: 6px 6px 6px 12px;
  border: 1px solid var(--accent); border-radius: 10px; background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  color: var(--ink); font-size: 13.5px; line-height: 1.25;
}
.other-strip b { font-weight: 700; overflow-wrap: anywhere; }
.other-strip .btn { flex: none; }
@media (max-width: 820px) {
  .coach-row { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
  .cr-who { gap: 6px; }
  .cr-s { display: inline; flex: none; color: var(--ink); font-size: 13.5px; }
}
