/* ============================================================
   RESET GLOBALE MOBILE-FIRST
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  min-width: 0;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

html, body {
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-ui);
  font-size: 16px;
  color: var(--text);
  background: linear-gradient(140deg, var(--bg), var(--bg-alt));
  overscroll-behavior: none;
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: touch;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y;
}

/* FIX RESPONSIVE: interattivi — no zoom su tap */
button,
a,
[role="button"],
label,
select,
.tab,
.btab,
.machine-item,
.day-cell {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* FIX RESPONSIVE: input 16px impedisce zoom iOS */
input,
textarea,
select {
  font-size: 16px !important;
  user-select: text;
  -webkit-user-select: text;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  max-width: 100%;
}

/* FIX RESPONSIVE: media — mai overflow */
img, video, canvas, iframe {
  max-width: 100%;
  height: auto;
  display: block;
}

/* FIX RESPONSIVE: testo — parole non rompono layout */
p, h1, h2, h3, h4, h5, h6, li, td, th {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* ============================================================
   CSS VARIABLES — LIGHT (default)
   ============================================================ */

:root {
  --font-ui:   "Bricolage Grotesque", "Segoe UI", sans-serif;
  --font-mono: "Space Mono", monospace;

  /* Sfondi */
  --bg:           #eef2eb;
  --bg-alt:       #dfe8dd;
  --card:         rgba(255, 255, 255, 0.72);
  --panel-solid:  rgba(255, 255, 255, 0.94);

  /* Testo */
  --text:   #10221a;
  --muted:  #4f5e57;

  /* Colori funzionali */
  --accent:        #f28b4b;
  --accent-strong: #d46a2a;
  --good:          #2f9e44;
  --warn:          #e8590c;
  --bad:           #c92a2a;

  /* Struttura */
  --line:   rgba(16, 34, 26, 0.18);
  --shadow: 0 8px 24px rgba(16, 34, 26, 0.12), 0 2px 8px rgba(16, 34, 26, 0.08);

  /* Danger */
  --danger-start: #e03131;
  --danger-end:   #c92a2a;

  /* Orbs background */
  --orb-a: #f6a26e;
  --orb-b: #2b8a3e;

  /* Bottoni ghost */
  --ghost-bg:       rgba(128, 128, 128, 0.10);
  --ghost-hover-bg: rgba(128, 128, 128, 0.18);
  --menu-ghost-bg:  rgba(255, 255, 255, 0.20);

  /* Input */
  --input-bg: rgba(255, 255, 255, 0.80);

  /* Tab active */
  --tab-active-a: rgba(242, 139, 75, 0.22);
  --tab-active-b: rgba(47, 158, 68, 0.22);

  /* Swipe card */
  --swipe-card-a:      rgba(242, 139, 75, 0.16);
  --swipe-card-b:      rgba(47, 158, 68, 0.16);
  --swipe-card-shadow: 0 16px 32px rgba(16, 34, 26, 0.18);

  /* Badge */
  --badge-bg: rgba(242, 139, 75, 0.20);

  /* Machine item */
  --machine-pending-bg:    rgba(134, 142, 150, 0.12);
  --machine-in-progress-bg: rgba(34, 139, 230, 0.14);
  --machine-completed-bg:  rgba(64, 192, 87, 0.18);
  --machine-stopped-bg:    rgba(232, 89, 12, 0.18);

  /* Session sets */
  --session-done-bg:    rgba(64, 192, 87, 0.12);
  --session-skipped-bg: rgba(255, 146, 43, 0.12);

  /* Calendar dots */
  --dot-blue: #228be6;
  --dot-rest: #15aabf;
  --dot-gray: #868e96;

  /* Calendar day bg */
  --day-green-bg:  rgba(64, 192, 87, 0.18);
  --day-red-bg:    rgba(201, 42, 42, 0.18);
  --day-orange-bg: rgba(232, 89, 12, 0.18);
  --day-blue-bg:   rgba(34, 139, 230, 0.18);
  --day-rest-bg:   rgba(21, 170, 191, 0.20);
  --day-gray-bg:   rgba(134, 142, 150, 0.14);

  /* Kcal */
  --exercise-kcal-bg: rgba(242, 139, 75, 0.10);

  /* Toast */
  --toast-bg:     #111;
  --toast-text:   #fff;
  --toast-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);

  /* Modal */
  --modal-backdrop: rgba(9, 12, 14, 0.58);

  /* Chart */
  --chart-bg:   rgba(255, 255, 255, 0.14);
  --chart-axis: rgba(127, 127, 127, 0.50);

  /* Session banner */
  --session-banner-a: rgba(242, 139, 75, 0.18);
  --session-banner-b: rgba(242, 139, 75, 0.08);

  /* Num buttons */
  --num-btn-bg:        rgba(128, 128, 128, 0.12);
  --num-btn-active-bg: rgba(242, 139, 75, 0.20);
}

/* ============================================================
   CSS VARIABLES — DARK
   ============================================================ */

:root[data-theme="dark"] {
  --bg:          #0d1518;
  --bg-alt:      #132228;
  --card:        rgba(19, 30, 35, 0.82);
  --panel-solid: rgba(10, 17, 21, 0.96);

  --text:  #f4faf7;
  --muted: #c2d2cb;

  --accent:        #ffad72;
  --accent-strong: #ffc896;
  --good:          #68e085;
  --warn:          #ffb85c;
  --bad:           #ff8e8e;

  --line:   rgba(244, 250, 247, 0.22);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.40), 0 2px 8px rgba(0, 0, 0, 0.30);

  --danger-start: #ff6b6b;
  --danger-end:   #fa5252;

  --orb-a: #ffb07b;
  --orb-b: #3bc97b;

  --ghost-bg:       rgba(255, 255, 255, 0.08);
  --ghost-hover-bg: rgba(255, 255, 255, 0.14);
  --menu-ghost-bg:  rgba(255, 255, 255, 0.08);

  --input-bg: rgba(26, 40, 46, 0.90);

  --tab-active-a: rgba(255, 173, 114, 0.33);
  --tab-active-b: rgba(104, 224, 133, 0.26);

  --swipe-card-a:      rgba(255, 173, 114, 0.26);
  --swipe-card-b:      rgba(104, 224, 133, 0.22);
  --swipe-card-shadow: 0 16px 32px rgba(0, 0, 0, 0.42);

  --badge-bg: rgba(255, 173, 114, 0.28);

  --machine-pending-bg:     rgba(173, 181, 189, 0.22);
  --machine-in-progress-bg: rgba(92, 168, 255, 0.26);
  --machine-completed-bg:   rgba(104, 224, 133, 0.28);
  --machine-stopped-bg:     rgba(255, 184, 92, 0.30);

  --session-done-bg:    rgba(104, 224, 133, 0.22);
  --session-skipped-bg: rgba(255, 184, 92, 0.22);

  --dot-blue: #5ca8ff;
  --dot-rest: #34c7da;
  --dot-gray: #adb5bd;

  --day-green-bg:  rgba(104, 224, 133, 0.28);
  --day-red-bg:    rgba(255, 142, 142, 0.28);
  --day-orange-bg: rgba(255, 184, 92,  0.32);
  --day-blue-bg:   rgba(92,  168, 255, 0.28);
  --day-rest-bg:   rgba(52,  199, 218, 0.30);
  --day-gray-bg:   rgba(173, 181, 189, 0.22);

  --exercise-kcal-bg: rgba(255, 173, 114, 0.16);

  --toast-bg:     #0b1012;
  --toast-text:   #f4faf7;
  --toast-shadow: 0 8px 25px rgba(0, 0, 0, 0.52);

  --modal-backdrop: rgba(1, 5, 7, 0.68);

  --chart-bg:   rgba(255, 255, 255, 0.08);
  --chart-axis: rgba(201, 214, 208, 0.55);

  --session-banner-a: rgba(255, 173, 114, 0.34);
  --session-banner-b: rgba(255, 173, 114, 0.16);

  --num-btn-bg:        rgba(173, 181, 189, 0.20);
  --num-btn-active-bg: rgba(255, 173, 114, 0.30);
}

/* ============================================================
   SFONDO DECORATIVO
   ============================================================ */

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.12;
  pointer-events: none;
  z-index: -3;
}

.bg-orb {
  position: fixed;
  width: min(44vw, 420px);
  height: min(44vw, 420px);
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.32;
  pointer-events: none;
  z-index: -2;
}

.orb-a { top: -90px;    left: -60px;   background: var(--orb-a); }
.orb-b { bottom: -120px; right: -70px; background: var(--orb-b); }

/* ============================================================
   LAYOUT — SHELL
   ============================================================ */

.shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 16px;
}

/* ============================================================
   GLASS EFFECT
   ============================================================ */

.glass3d {
  backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .glass3d {
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ============================================================
   TOPBAR
   ============================================================ */

.topbar {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  border-radius: 18px;
  background: var(--card);
  padding: 12px 16px;
  z-index: 120;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  letter-spacing: 0.02em;
  font-weight: 800;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.brand-logo {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Menu dropdown */
.menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  gap: 6px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  width: min(240px, 92vw);
  z-index: 300;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  animation: fade-up 0.18s ease;
}

.menu-panel .ghost {
  background: var(--menu-ghost-bg);
  text-align: left;
  justify-content: flex-start;
}

/* ============================================================
   TIPOGRAFIA
   ============================================================ */

.muted {
  color: var(--muted);
  margin: 4px 0 0;
  line-height: 1.5;
}

.home-daily-message {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 4px 0;
  line-height: 1.4;
}

.home-completed-banner {
  background: linear-gradient(135deg, rgba(34,197,94,0.18), rgba(16,185,129,0.10));
  border: 1px solid rgba(34,197,94,0.35);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 8px 0 10px;
  text-align: center;
}

.completed-celebrate {
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--good);
  margin-bottom: 4px;
}

.panel {
  margin-top: 10px;
}

/* ============================================================
   CARD
   ============================================================ */

.card {
  border-radius: 18px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.card + .card {
  margin-top: 12px;
}

.inset {
  background: var(--panel-solid);
  border-radius: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  margin-top: 10px;
}

/* Hero card (landing page) */
.hero-card {
  text-align: center;
  display: grid;
  gap: 14px;
  padding: 28px 20px;
}

.hero-card h2 {
  margin: 0;
  font-size: clamp(1.4rem, 5.5vw, 2.2rem);
  font-weight: 800;
  line-height: 1.2;
}

.hero-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}

.hero-logo {
  width: 56px;
  height: 56px;
  opacity: 0.9;
}

/* Feature pills sul hero */
.hero-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 4px 0;
}

.feature-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--ghost-bg);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

/* Legal links */
.legal-links {
  margin-top: 12px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.legal-links a {
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.88rem;
  transition: opacity 0.15s;
}

.legal-links a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */

input, select, textarea, button {
  font: inherit;
}

input, select, textarea {
  width: 100%;
  max-width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px 13px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 16px;
  user-select: text;
  -webkit-user-select: text;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(242, 139, 75, 0.18);
  background: var(--input-bg);
}

:root[data-theme="dark"] input:focus,
:root[data-theme="dark"] select:focus,
:root[data-theme="dark"] textarea:focus {
  box-shadow: 0 0 0 3px rgba(255, 173, 114, 0.20);
}

label {
  display: grid;
  gap: 5px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.inline-check {
  display: flex;
  grid-template-columns: unset;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.inline-check input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}

.field-inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.field-inline input {
  flex: 1;
}

/* ============================================================
   BUTTONS
   ============================================================ */

button {
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  max-width: 100%;
  touch-action: manipulation;
  transition: transform 0.12s ease, filter 0.15s ease, box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

button:active {
  transform: translateY(1px);
  filter: brightness(0.95);
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: 0 4px 12px rgba(242, 139, 75, 0.30);
}

button.primary:hover {
  box-shadow: 0 6px 16px rgba(242, 139, 75, 0.40);
}

button.ghost {
  background: var(--ghost-bg);
  color: var(--text);
  border: 1.5px solid var(--line);
}

button.ghost:hover {
  background: var(--ghost-hover-bg);
}

button.danger {
  background: linear-gradient(135deg, var(--danger-start), var(--danger-end));
  color: #fff;
  box-shadow: 0 4px 12px rgba(201, 42, 42, 0.25);
}

button.danger:hover {
  box-shadow: 0 6px 16px rgba(201, 42, 42, 0.35);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  padding: 10px 16px;
  background: var(--ghost-bg);
  color: var(--text);
  border: 1.5px solid var(--line);
  text-decoration: none;
  font-weight: 700;
  transition: background 0.15s;
}

.button-link:hover {
  background: var(--ghost-hover-bg);
}

.small-btn {
  padding: 7px 12px;
  font-size: 0.85rem;
}

.tiny-btn {
  padding: 5px 9px;
  font-size: 0.78rem;
  border-radius: 8px;
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */

.hidden {
  display: none !important;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.row.between {
  justify-content: space-between;
}

.wrap-row {
  flex-wrap: wrap;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.actions-row {
  justify-content: center;
  margin-top: 12px;
}

/* ============================================================
   BADGE
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--badge-bg);
  border: 1px solid var(--line);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-good {
  background: rgba(47, 158, 68, 0.18);
  color: var(--good);
  border-color: rgba(47, 158, 68, 0.30);
}

.badge-warn {
  background: rgba(232, 89, 12, 0.18);
  color: var(--warn);
  border-color: rgba(232, 89, 12, 0.30);
}

.badge-bad {
  background: rgba(201, 42, 42, 0.18);
  color: var(--bad);
  border-color: rgba(201, 42, 42, 0.30);
}

.badge-rest {
  background: rgba(21, 170, 191, 0.18);
  color: var(--dot-rest);
  border-color: rgba(21, 170, 191, 0.30);
}

.badge-gray {
  background: rgba(134, 142, 150, 0.18);
  color: var(--dot-gray);
  border-color: rgba(134, 142, 150, 0.30);
}

:root[data-theme="dark"] .badge-good  { background: rgba(104, 224, 133, 0.20); border-color: rgba(104, 224, 133, 0.35); }
:root[data-theme="dark"] .badge-warn  { background: rgba(255, 184, 92,  0.22); border-color: rgba(255, 184, 92,  0.35); }
:root[data-theme="dark"] .badge-bad   { background: rgba(255, 142, 142, 0.22); border-color: rgba(255, 142, 142, 0.35); }
:root[data-theme="dark"] .badge-rest  { background: rgba(52,  199, 218, 0.22); border-color: rgba(52,  199, 218, 0.35); }
:root[data-theme="dark"] .badge-gray  { background: rgba(173, 181, 189, 0.22); border-color: rgba(173, 181, 189, 0.35); }

/* ============================================================
   DESKTOP TABBAR
   ============================================================ */

.tabbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 6px;
  margin: 12px 0;
  background: var(--card);
  border-radius: 14px;
  padding: 6px;
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(16, 34, 26, 0.07);
}

.tab,
.tablike {
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 9px 10px;
  transition: all 0.18s ease;
}

.tab:hover,
.tablike:hover {
  background: var(--ghost-bg);
  color: var(--text);
  transform: none;
  filter: none;
}

.tab.active,
.tablike.active {
  background: linear-gradient(135deg, var(--tab-active-a), var(--tab-active-b));
  border-color: var(--line);
  color: var(--text);
  font-weight: 700;
}

.mobile-nav-wrap {
  display: none;
  margin-bottom: 12px;
}

/* ============================================================
   TAB CONTENT
   ============================================================ */

.tab-content {
  display: none;
  animation: fade-up 0.28s ease;
}

.tab-content.visible {
  display: block;
}

/* ============================================================
   HOME — SWIPE DECK
   ============================================================ */

.swipe-zone {
  position: relative;
  margin-top: 10px;
  min-height: 200px;
  border: 1.5px dashed var(--line);
  border-radius: 16px;
  padding: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
}

.swipe-deck {
  display: grid;
  place-items: center;
  min-height: 180px;
  position: relative;
}

.swipe-card {
  width: min(440px, 100%);
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(155deg, var(--swipe-card-a), var(--swipe-card-b));
  padding: 16px;
  word-break: break-word;
  box-shadow: var(--swipe-card-shadow);
  transition: transform 0.26s ease, opacity 0.26s ease;
}

.swipe-card h4 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.swipe-card p {
  font-size: 0.9rem;
  line-height: 1.5;
}

.swipe-card.enter-left  { animation: swipe-enter-left  0.24s ease; }
.swipe-card.enter-right { animation: swipe-enter-right 0.24s ease; }

.swipe-card.exit-left  { transform: translateX(-55px) rotate(-5deg); opacity: 0; }
.swipe-card.exit-right { transform: translateX(55px)  rotate(5deg);  opacity: 0; }

/* Frecce swipe */
.swipe-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  padding: 8px 10px;
  opacity: 0.70;
  background: var(--card) !important;
  border: 1.5px solid var(--line) !important;
  border-radius: 10px !important;
  will-change: opacity;
  transition: opacity 0.15s;
}

.swipe-arrow:hover {
  opacity: 1;
  transform: translateY(-50%) !important;
  filter: none !important;
}

.swipe-arrow-left  { left: 4px; }
.swipe-arrow-right { right: 4px; }

/* Session active banner */
.session-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--session-banner-a), var(--session-banner-b));
  border: 1.5px solid var(--accent);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 10px;
  font-weight: 700;
  color: var(--accent-strong);
  animation: fade-up 0.3s ease;
}

/* ============================================================
   METRIC CARD — statistiche chiave
   ============================================================ */

.mini-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.metric {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 10px 12px 10px 16px;
  word-break: break-word;
  background: var(--panel-solid);
  overflow: hidden;
  transition: transform 0.12s ease;
}

.metric::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 13px 0 0 13px;
  background: linear-gradient(180deg, var(--accent), var(--good));
}

.metric small {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}

.metric strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.metric .metric-sub {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
  margin-top: 2px;
}

/* ============================================================
   SESSION — LIVE WORKOUT
   ============================================================ */

.machine-item,
.day-cell {
  width: 100%;
  text-align: left;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  background: var(--panel-solid);
  transition: all 0.15s ease;
  font-weight: 500;
  cursor: pointer;
}

.machine-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
  border-color: var(--accent);
  filter: none;
}

.machine-item strong {
  font-size: 0.95rem;
  font-weight: 700;
}

.machine-item .muted {
  font-size: 0.84rem;
  margin-top: 4px;
}

.machine-item.pending       { background: var(--machine-pending-bg); }
.machine-item.in_progress   { background: var(--machine-in-progress-bg); border-color: var(--dot-blue); }
.machine-item.completed     { background: var(--machine-completed-bg); border-color: var(--good); }
.machine-item.stopped,
.machine-item.skipped       { background: var(--machine-stopped-bg); border-color: var(--warn); }

/* Session set rows */
.session-set {
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--ghost-bg);
}

.session-set.done {
  border-style: solid;
  border-color: var(--good);
  background: var(--session-done-bg);
}

.session-set.skipped {
  border-style: solid;
  border-color: var(--warn);
  background: var(--session-skipped-bg);
}

.session-set strong {
  font-size: 0.9rem;
  font-weight: 700;
}

/* Rest timer */
.rest-timer-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 0;
}

.rest-timer-circle-container {
  position: relative;
  width: 110px;
  height: 110px;
}

.rest-timer-svg {
  transform: rotate(-90deg);
  width: 110px;
  height: 110px;
}

.rest-timer-bg {
  fill: none;
  stroke: var(--line);
  stroke-width: 8;
}

.rest-timer-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.9s linear;
}

.rest-timer-number {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--accent);
}

.rest-timer-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* Sticky session actions */
#session-global-actions {
  position: sticky;
  bottom: 0;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 10px 16px;
  margin: 10px -16px -16px;
  border-radius: 0 0 18px 18px;
  z-index: 10;
  backdrop-filter: blur(8px);
}

/* Set +/- buttons */
.set-num-control {
  display: flex;
  align-items: center;
  gap: 4px;
}

.set-num-control input[type="number"] {
  width: 64px;
  text-align: center;
  padding: 8px 4px;
  border-radius: 10px;
}

.set-num-control .num-btn {
  padding: 8px 11px;
  font-size: 1.1rem;
  font-weight: 700;
  min-width: 38px;
  min-height: 38px;
  background: var(--num-btn-bg);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.set-num-control .num-btn:active {
  background: var(--num-btn-active-bg);
  transform: translateY(1px);
}

/* ============================================================
   CALENDAR
   ============================================================ */

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  font-size: 0.84rem;
  color: var(--muted);
  margin-bottom: 12px;
  padding: 8px 10px;
  background: var(--ghost-bg);
  border-radius: 10px;
  border: 1px solid var(--line);
}

.dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 50%;
  margin-right: 3px;
  flex-shrink: 0;
}

.dot.green  { background: var(--good); }
.dot.red    { background: var(--bad); }
.dot.orange { background: var(--warn); }
.dot.blue   { background: var(--dot-blue); }
.dot.rest   { background: var(--dot-rest); }
.dot.gray   { background: var(--dot-gray); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.day-cell {
  min-height: 76px;
  padding: 8px 6px;
  font-size: 0.84rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  background: var(--day-gray-bg);
  font-weight: 500;
}

.day-cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
}

.day-cell strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.day-cell small {
  font-size: 0.72rem;
  color: var(--muted);
  display: block;
  line-height: 1.3;
  margin-top: 2px;
}

.day-cell.green  { background: var(--day-green-bg);  border-color: rgba(47, 158, 68, 0.30); }
.day-cell.red    { background: var(--day-red-bg);    border-color: rgba(201, 42, 42, 0.30); }
.day-cell.orange { background: var(--day-orange-bg); border-color: rgba(232, 89, 12, 0.30); }
.day-cell.blue   { background: var(--day-blue-bg);   border-color: rgba(34, 139, 230, 0.30); }
.day-cell.rest   { background: var(--day-rest-bg);   border-color: rgba(21, 170, 191, 0.30); }
.day-cell.gray   { background: var(--day-gray-bg); }

/* ============================================================
   WORKOUT PLANNER
   ============================================================ */

.workout-item {
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  background: var(--panel-solid);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.workout-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 34, 26, 0.10);
}

.workout-title {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.workout-title strong {
  font-size: 1rem;
  font-weight: 700;
}

.exercise-line {
  font-size: 0.88rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
}

.exercise-line:last-child {
  border-bottom: none;
}

.workout-kcal {
  margin: 6px 0 2px;
  font-size: 0.82rem;
  color: var(--accent-strong);
  font-weight: 600;
}

.exercise-kcal {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--accent-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--exercise-kcal-bg);
  font-weight: 700;
}

/* ============================================================
   PR — RECORD PERSONALI
   ============================================================ */

.pr-item {
  border: 1.5px solid var(--line);
  border-radius: 13px;
  padding: 11px 13px 11px 17px;
  word-break: break-word;
  background: var(--panel-solid);
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
  overflow: hidden;
}

.pr-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 13px 0 0 13px;
  background: linear-gradient(180deg, var(--accent), var(--warn));
}

.pr-item .pr-name {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.pr-item .pr-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--accent);
  line-height: 1.2;
}

.pr-item .pr-date {
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 1px;
}

/* ============================================================
   REPORT — CHARTS
   ============================================================ */

.chart-wrap {
  margin-top: 12px;
}

.chart-wrap h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.chart {
  width: 100%;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: var(--chart-bg);
}

.chart svg {
  width: 100%;
  height: 200px;
  display: block;
}

/* ============================================================
   COMPOSIZIONE CORPOREA
   ============================================================ */

#body-metrics {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  margin-bottom: 14px;
}

.body-weight-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: end;
}

.body-weight-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
}

@media (max-width: 560px) {
  .body-weight-form {
    grid-template-columns: 1fr 1fr;
  }
  .body-weight-form button {
    grid-column: 1 / -1;
  }
}

#body-weight-table .row {
  font-size: 0.9rem;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

#body-weight-table .row:last-child {
  border-bottom: none;
}

/* ============================================================
   ADMIN PANEL
   ============================================================ */

.admin-filters {
  flex: 1;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.admin-filters input,
.admin-filters select,
#admin-session-status-filter {
  width: min(220px, 100%);
}

.admin-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.admin-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  display: grid;
  gap: 7px;
  background: var(--panel-solid);
  transition: box-shadow 0.12s;
}

.admin-row:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.admin-row-main {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.admin-row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.admin-detail {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: var(--panel-solid);
}

.admin-detail-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.admin-detail label {
  min-width: 0;
}

.admin-code {
  font-family: var(--font-mono);
  padding: 10px;
  border-radius: 10px;
  border: 1px dashed var(--line);
  word-break: break-all;
  font-size: 0.82rem;
  background: var(--ghost-bg);
}

.admin-json-editor,
.admin-log-box {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-log-box {
  min-height: 180px;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: var(--input-bg);
  line-height: 1.5;
}

/* ============================================================
   MODAL
   ============================================================ */

.modal::backdrop {
  background: var(--modal-backdrop);
  backdrop-filter: blur(4px);
}

.modal {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 100%;
  overflow: visible;
}

.modal-card {
  width: min(560px, 96vw);
  margin: 0 auto;
  background: var(--panel-solid);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 18px !important;
}

#profile-modal .modal-card {
  max-height: calc(100dvh - 24px);
}

.auth-form {
  margin-top: 10px;
}

.visible-form {
  display: flex;
}

/* ============================================================
   TOAST
   ============================================================ */

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--toast-bg);
  color: var(--toast-text);
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: var(--toast-shadow);
  z-index: 999;
  max-width: min(92vw, 560px);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
  animation: fade-up 0.22s ease;
}

/* ============================================================
   COOKIE BANNER
   ============================================================ */

.cookie-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 500;
  background: var(--panel-solid);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
}

/* ============================================================
   COLOR PALETTE PREVIEW (profilo)
   ============================================================ */

.color-master-preview {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  max-height: 260px;
  overflow: auto;
  background: var(--card);
  display: grid;
  gap: 12px;
}

.color-list-block {
  display: grid;
  gap: 6px;
}

.color-list-block h5 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.color-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  font-size: 0.80rem;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 4px;
}

.color-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.color-value {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.empty-icon {
  font-size: 2.8rem;
  display: block;
  margin-bottom: 6px;
  opacity: 0.50;
  line-height: 1;
}

.empty-state p {
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 260px;
}

/* ============================================================
   STATO DISPONIBILITÀ USERNAME
   ============================================================ */

.available     { color: var(--good);  font-weight: 700; }
.not-available { color: var(--bad);   font-weight: 700; }

/* ============================================================
   CELEBRATE ANIMATION
   ============================================================ */

.celebrate {
  animation: party 0.7s ease;
}

/* ============================================================
   SESSION DIRECT MODE (nasconde nav durante sessione)
   ============================================================ */

.session-direct-mode .tabbar,
.session-direct-mode .mobile-nav-wrap,
.session-direct-mode .bottom-tabbar {
  display: none !important;
}

/* ============================================================
   KEYFRAMES
   ============================================================ */

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes party {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.02) rotate(-0.3deg); }
  70%  { transform: scale(0.995) rotate(0.3deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes swipe-enter-left {
  from { transform: translateX(60px) rotate(4deg);  opacity: 0; }
  to   { transform: translateX(0) rotate(0deg);     opacity: 1; }
}

@keyframes swipe-enter-right {
  from { transform: translateX(-60px) rotate(-4deg); opacity: 0; }
  to   { transform: translateX(0) rotate(0deg);      opacity: 1; }
}

/* ============================================================
   BOTTOM TABBAR (mobile)
   ============================================================ */

.bottom-tabbar {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--panel-solid);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(20px) saturate(1.4);
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.btab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 9px 4px 7px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.59rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease;
  border-radius: 0;
  position: relative;
  letter-spacing: 0.02em;
}

.btab svg {
  transition: stroke 0.15s ease, transform 0.15s ease;
}

.btab.active {
  color: var(--accent);
}

.btab.active svg {
  stroke: var(--accent);
  transform: scale(1.08);
}

/* Indicatore superiore tab attivo */
.btab.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 25%;
  right: 25%;
  height: 2.5px;
  border-radius: 0 0 3px 3px;
  background: var(--accent);
  animation: fade-up 0.15s ease;
}

/* Session dot (indicatore sessione in corso) */
.btab .session-dot {
  position: absolute;
  top: 7px;
  right: calc(50% - 14px);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  border: 1.5px solid var(--bg);
}

/* ============================================================
   RESPONSIVE — breakpoint principali
   ============================================================ */

@media (max-width: 860px) {
  .tabbar { display: none; }
  .mobile-nav-wrap { display: none !important; }
  .bottom-tabbar { display: grid; }
  .shell { padding-bottom: 82px; }
  .cookie-banner { bottom: 82px; }
  .toast { bottom: 94px; }
}

@media (max-width: 680px) {
  .shell { padding-top: 10px; padding-left: 10px; padding-right: 10px; }

  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 10px 12px;
  }

  .calendar-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 3px;
  }

  .day-cell {
    min-height: 48px;
    padding: 4px 3px;
    font-size: 0.70rem;
  }

  .day-cell strong {
    font-size: 0.80rem;
  }

  .day-cell small {
    display: none;
  }

  .calendar-legend {
    font-size: 0.75rem;
    gap: 6px;
  }

  .actions-row { flex-wrap: wrap; }

  .field-inline {
    flex-direction: column;
    align-items: stretch;
  }

  .field-inline .tiny-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .topbar .muted { display: none; }
  .topbar h1 { font-size: 1.3rem; }
}

@media (max-width: 430px) {
  .card { padding: 12px 13px; }
  .mini-grid { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
  .admin-detail-grid { grid-template-columns: 1fr; }
  .set-num-control input[type="number"] { width: 52px; }
  .hero-card { padding: 20px 14px; }
}

@media (max-width: 375px) {
  body { font-size: 14px; }
  .shell { padding-top: 8px; padding-left: 8px; padding-right: 8px; }
  .modal-card { max-height: calc(100dvh - 16px); }
  .btab span { font-size: 0.52rem; }
  .card { padding: 10px 11px; }
  .metric { padding: 8px 10px 8px 14px; }
}

@media (min-width: 860px) {
  .shell { padding: 20px; }
  .card { padding: 18px 20px; }
  #session-global-actions { margin: 10px -20px -18px; padding: 12px 20px; }
  .mini-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
}

@media (min-width: 1024px) {
  body { font-size: 16px; }
}

/* ============================================================
   HOME EXERCISE LIST
   ============================================================ */

.home-ex-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.home-ex-title {
  margin: 0 0 8px;
  font-size: 0.88rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.home-ex-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--card);
  border-radius: 10px;
  border: 1px solid var(--line);
}

.home-ex-emoji { font-size: 1.2rem; flex-shrink: 0; }
.home-ex-name { flex: 1; font-weight: 600; font-size: 0.92rem; }
.ex-detail { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.ex-detail.cardio { color: var(--accent); }

/* ============================================================
   CALENDAR SESSION DETAIL
   ============================================================ */

.cal-session-detail { margin-top: 4px; }
.cal-session-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.cal-session-stats { font-size: 0.82rem; margin-bottom: 6px; }
.cal-note { font-size: 0.82rem; font-style: italic; margin: 4px 0 6px; }

.cal-exercises-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cal-exercise-row {
  background: var(--inset);
  border-radius: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
}

.cal-ex-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cal-ex-emoji { font-size: 1rem; flex-shrink: 0; }
.cal-ex-name { font-weight: 600; font-size: 0.88rem; flex: 1; min-width: 80px; }
.cal-ex-target { font-size: 0.78rem; }
.cal-ex-kcal { font-size: 0.75rem; margin-left: auto; }

.cal-sets-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 5px;
  padding-left: 24px;
}

.cal-set-row {
  font-size: 0.78rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.cal-set-row.done { color: var(--good); }
.cal-set-row.skipped { color: var(--muted); text-decoration: line-through; }

/* ============================================================
   PROGRAMS BAR (Planner)
   ============================================================ */

.programs-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.program-chip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  min-width: 120px;
  transition: border-color 0.15s;
}

.program-chip.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--inset));
}

.program-chip > span { font-weight: 600; font-size: 0.9rem; }
.program-chip-actions { display: flex; gap: 4px; flex-wrap: wrap; }

/* ============================================================
   MACHINE IMAGES
   ============================================================ */

.machine-thumb-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.machine-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  border: 1px solid var(--line);
}

/* ============================================================
   BODY FIGURE & MEASUREMENTS
   ============================================================ */

.body-figure-wrap {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.body-figure-svg {
  width: 100px;
  flex-shrink: 0;
}

.body-figure-labels {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  min-width: 180px;
}

.body-figure-label {
  display: flex;
  flex-direction: column;
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
}

.body-label-name { font-size: 0.72rem; color: var(--muted); }
.body-label-val { font-size: 0.9rem; font-weight: 700; }

.measurement-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.measurement-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0;
}

/* ============================================================
   STATS / PREDICTIONS
   ============================================================ */

.stat-section { margin-bottom: 20px; }
.stat-section h4 { margin: 0 0 10px; }

.stat-pred-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-pred-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
}

.stat-pred-label {
  font-weight: 700;
  font-size: 0.9rem;
  min-width: 120px;
  flex-shrink: 0;
}

.stat-pred-vals {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  flex: 1;
  font-size: 0.82rem;
}

.stat-pred-trend { font-weight: 700; }

.sparkline {
  width: 90px;
  height: 28px;
  flex-shrink: 0;
}

/* ============================================================
   MULTI-LINE CHART LEGEND
   ============================================================ */

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 8px;
  font-size: 0.8rem;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ============================================================
   PROFILE PHOTO BUTTON (bottom nav)
   ============================================================ */

.btab-profile {
  width: 34px;
  height: 34px;
  border-radius: 50% !important;
  background-size: cover !important;
  background-position: center !important;
  border: 2px solid var(--accent) !important;
  font-size: 1rem;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto;
  align-self: center;
}

/* Dating button bottom nav */
.btab-dating svg {
  stroke: #e84393;
}
.btab-dating:hover svg,
.btab-dating:active svg {
  stroke: #c0356e;
  transform: scale(1.12);
}

/* Chat button bottom nav */
.btab-chat svg {
  stroke: #2e7c7b;
}
.btab-chat:hover svg,
.btab-chat:active svg {
  stroke: #245f5e;
  transform: scale(1.12);
}

/* FitDiet button bottom nav */
.btab-fitdiet svg {
  stroke: #237a57;
}
.btab-fitdiet:hover svg,
.btab-fitdiet:active svg {
  stroke: #15543b;
  transform: scale(1.12);
}

/* VideoLive button bottom nav */
.btab-videolive svg {
  stroke: #0f766e;
}
.btab-videolive:hover svg,
.btab-videolive:active svg {
  stroke: #115e59;
  transform: scale(1.12);
}

/* Shop button bottom nav */
.btab-shop svg {
  stroke: #f97316;
}
.btab-shop:hover svg,
.btab-shop:active svg {
  stroke: #ea6600;
  transform: scale(1.12);
}

/* ============================================================
   MODAL CENTERING FIX
   ============================================================ */

dialog.modal {
  position: fixed;
  inset: 0;
  margin: auto;
  width: fit-content;
  height: fit-content;
  max-width: 100vw;
  max-height: calc(100dvh - 20px);
  overflow-y: auto;
  overflow-x: hidden;
  border: none;
  background: transparent;
  padding: 0;
}

@media (max-width: 860px) {
  .bottom-tabbar { grid-template-columns: repeat(9, minmax(52px, 1fr)); }
  .btab span { font-size: 0.5rem; }
}

/* ── Global nav 9 voci ────────────────────────────── */
.bottom-tabbar {
  grid-template-columns: repeat(9, minmax(52px, 1fr));
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.bottom-tabbar::-webkit-scrollbar { display: none; }

/* ── Fits sub-nav (sostituisce la vecchia tabbar interna) ── */
.fits-subnav {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.fits-subnav::-webkit-scrollbar { display: none; }
.fits-subnav .tab {
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Landing page pills ──────────────────────────── */
.landing-apps-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 8px 0;
}
.landing-app-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--pill-color, rgba(255,255,255,0.1));
  color: var(--pill-text, var(--text));
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid currentColor;
  opacity: 0.8;
}

/* ── Hub Home ────────────────────────────────────── */
.hub-home-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}
.hub-home-header h3 {
  margin: 0;
}

/* ── Fits hub / hub home griglia icone app ────────── */
.fits-hub-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 14px;
}
@media (max-width: 480px) {
  .fits-hub-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
}

.fits-app-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 8px 12px;
  border-radius: 18px;
  background: var(--ghost-bg);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
  color: var(--text);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.fits-app-card:hover {
  background: var(--surface-2, var(--ghost-bg));
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
.fits-app-card:active {
  transform: scale(0.96);
}
.fits-card-icon {
  font-size: 1.8rem;
  line-height: 1;
}
.fits-card-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--muted);
}

/* Colori accent per ogni card */
.fits-card-allenamento { --card-accent: rgba(47,128,95,0.15); }
.fits-card-calendario  { --card-accent: rgba(30,140,200,0.15); }
.fits-card-report      { --card-accent: rgba(99,91,255,0.15); }
.fits-card-scheda      { --card-accent: rgba(199,151,59,0.15); }
.fits-card-corpo       { --card-accent: rgba(243,154,113,0.15); }
.fits-card-stats       { --card-accent: rgba(206,107,134,0.15); }

.fits-card-allenamento, .fits-card-calendario,
.fits-card-report, .fits-card-scheda,
.fits-card-corpo, .fits-card-stats {
  background: var(--card-accent);
}

.fits-card-fits    { background: rgba(47,128,95,0.15); }
.fits-card-dating  { background: rgba(206,107,134,0.15); }
.fits-card-event   { background: rgba(99,91,255,0.15); }
.fits-card-diet    { background: rgba(243,154,113,0.15); }
.fits-card-video   { background: rgba(30,140,200,0.15); }
.fits-card-chat    { background: rgba(44,56,88,0.15); }
.fits-card-shop    { background: rgba(199,151,59,0.15); }
.fits-card-social  { background: rgba(77,121,255,0.15); }

