:root {
  --bg-body: #090d16;
  --bg-sidebar: #060a11;
  --bg-card: #111827;
  --bg-card-subtle: #0d1321;
  --bg-input: #0a101d;

  --border-subtle: rgba(148, 163, 184, 0.12);
  --border-focus: rgba(0, 237, 100, 0.55);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --mongo-green: #00ed64;
  --emerald: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.14);
  --cyan: #06b6d4;
  --cyan-soft: rgba(6, 182, 212, 0.14);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --coral: #ef4444;
  --coral-soft: rgba(239, 68, 68, 0.14);

  --sidebar-width: 256px;
  --bottom-nav-height: 68px;
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

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

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background-color: var(--bg-body);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

.hidden {
  display: none !important;
}

.text-emerald {
  color: var(--mongo-green);
}

/* ==========================================
   SISTEMA A BADGE UNIFORME (CODICE COLORE RIGIDO)
   ========================================== */
.pill-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.3;
  white-space: nowrap;
}

.bg-blue-500 {
  background-color: #3b82f6;
  color: #ffffff;
}

.bg-red-500 {
  background-color: #ef4444;
  color: #ffffff;
}

.bg-green-500 {
  background-color: #22c55e;
  color: #ffffff;
}

.bg-gray-600 {
  background-color: #4b5563;
  color: #ffffff;
}

.badge-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==========================================
   LAYOUT SHELL (SIDEBAR DESKTOP + BOTTOM MOBILE)
   ========================================== */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
}

.desktop-sidebar {
  display: none;
}

@media (min-width: 1024px) {
  .desktop-sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    padding: 24px 16px;
    z-index: 40;
  }

  .main-viewport {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
  }

  .mobile-bottom-nav {
    display: none !important;
  }
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px 22px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-glyph {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #000000;
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.tc-logo-img {
  width: 36px;
  height: 36px;
  display: block;
}

.brand-meta {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-primary);
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 20px 12px 8px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.16s ease;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: rgba(0, 237, 100, 0.08);
  color: var(--mongo-green);
  border-left-color: var(--mongo-green);
  font-weight: 600;
}

.nav-icon {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.athlete-mini-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}

.athlete-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--emerald-soft);
  color: var(--mongo-green);
  font-size: 0.76rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.athlete-name {
  font-size: 0.82rem;
  font-weight: 600;
}

.athlete-stats {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* Solid safe-area shield under iOS clock / Dynamic Island (no blur overlay) */
.ios-safe-top-shield {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: env(safe-area-inset-top, 0px);
  background: var(--bg-body);
  z-index: 60;
  pointer-events: none;
}

/* Main Viewport */
.main-viewport {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 96px);
}

.page-content {
  max-width: 980px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 20px 28px;
  width: 100%;
}

@media (min-width: 1024px) {
  .ios-safe-top-shield {
    display: none;
  }

  .main-viewport {
    padding-bottom: 48px;
  }

  .page-content {
    padding: 28px 20px;
  }
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: auto;
  min-height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  background: rgba(6, 10, 17, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  z-index: 50;
  padding-top: 10px;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 0;
  min-height: 46px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.1;
  transition: color 0.16s ease;
}

.bottom-nav-item.active {
  color: var(--mongo-green);
}

/* Floating Action Button (#tony-voice-btn) */
.tony-fab {
  position: fixed;
  right: 18px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 88px);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00ed64, #10b981);
  color: #04130d;
  border: none;
  box-shadow: 0 8px 26px rgba(0, 237, 100, 0.34);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 55;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.tony-fab svg {
  width: 24px;
  height: 24px;
}

.tony-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 32px rgba(0, 237, 100, 0.45);
}

/* Stato: registrazione attiva (rosso pulsante) */
.tony-fab.is-recording {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  animation: tony-pulse 1.2s ease-out infinite;
}

@keyframes tony-pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 18px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Stato: caricamento (spinner al posto dell'icona) */
.tony-fab.is-loading {
  pointer-events: none;
  background: #1f2937;
  color: #00ed64;
}

.tony-fab.is-loading svg {
  display: none;
}

.tony-fab.is-loading::after {
  content: '';
  width: 22px;
  height: 22px;
  border: 3px solid rgba(0, 237, 100, 0.25);
  border-top-color: #00ed64;
  border-radius: 50%;
  animation: tony-spin 0.8s linear infinite;
}

@keyframes tony-spin {
  to { transform: rotate(360deg); }
}

/* Stato: Tony sta parlando */
.tony-fab.is-playing {
  animation: tony-speak 1s ease-in-out infinite;
}

@keyframes tony-speak {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* Fumetto con la risposta testuale di Tony */
.tony-bubble {
  position: fixed;
  right: 18px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 156px);
  max-width: min(340px, calc(100vw - 40px));
  padding: 12px 14px;
  background: #111827;
  color: #e5e7eb;
  border: 1px solid rgba(0, 237, 100, 0.35);
  border-radius: 14px 14px 4px 14px;
  font-size: 0.9rem;
  line-height: 1.4;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  z-index: 56;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.tony-bubble.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.tony-play-btn {
  display: block;
  margin-top: 10px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 237, 100, 0.45);
  background: rgba(0, 237, 100, 0.14);
  color: #00ed64;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

@media (min-width: 1024px) {
  .tony-bubble {
    right: 28px;
    bottom: 94px;
  }
}

@media (min-width: 1024px) {
  .tony-fab {
    bottom: 28px;
    right: 28px;
  }
}

/* ==========================================
   COMMON CARDS & TYPOGRAPHY
   ========================================== */
.dashboard-minimal,
.view-stack {
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: 100%;
}

.view-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

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

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

.eyebrow {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--mongo-green);
  text-transform: uppercase;
}

.view-title {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 2px;
}

.icon-sync-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.icon-sync-btn svg {
  width: 19px;
  height: 19px;
}

.icon-sync-btn:hover {
  border-color: var(--mongo-green);
  color: var(--mongo-green);
}

.icon-sync-btn.spinning svg {
  animation: spin 0.8s linear infinite;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.26);
  width: 100%;
}

.card-kicker {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 2px;
}

.card-desc {
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin: 8px 0 16px;
}

.card-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-emerald {
  background: var(--emerald-soft);
  color: var(--mongo-green);
  border: 1px solid rgba(0, 237, 100, 0.3);
}

.badge-amber {
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-outline {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.sub-pill {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-card-subtle);
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
}

/* ==========================================
   DASHBOARD BLOCK 1: HERO TODAY WORKOUT CARD
   ========================================== */
.hero-workout-card {
  background: linear-gradient(155deg, #131d31 0%, #0f172a 100%);
  border: 1px solid rgba(0, 237, 100, 0.28);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hero-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hero-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hero-caption {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--cyan);
}

.hero-workout-title {
  font-size: clamp(1.4rem, 3vw, 2.05rem);
  font-weight: 800;
  line-height: 1.2;
  color: var(--text-primary);
}

.hero-workout-detail {
  font-size: 0.94rem;
  color: var(--text-secondary);
}

/* 3-Phase Structured Workout Grid */
.workout-phases-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.phase-step-box {
  background: rgba(9, 13, 22, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.phase-step-main {
  border-color: rgba(0, 237, 100, 0.35);
  background: rgba(0, 237, 100, 0.05);
}

.phase-step-val {
  font-size: 0.92rem;
  font-weight: 700;
}

.hero-targets-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.target-box {
  background: rgba(9, 13, 22, 0.55);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.target-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.target-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--mongo-green);
}

.target-note {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* ==========================================
   DASHBOARD BLOCK 2: SLEEP SCORE & HRV RINGS
   ========================================== */
.gauges-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.gauge-item {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.ring-wrap {
  position: relative;
  width: 104px;
  height: 104px;
  flex-shrink: 0;
}

.ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: rgba(148, 163, 184, 0.12);
  stroke-width: 9;
}

.ring-fill {
  fill: none;
  stroke-width: 9;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.65s ease;
}

.ring-emerald {
  stroke: var(--mongo-green);
}

.ring-cyan {
  stroke: var(--cyan);
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ring-number {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1;
}

.ring-unit {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 3px;
}

.gauge-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.gauge-info h3 {
  font-size: 0.98rem;
  font-weight: 700;
}

.gauge-info p {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.status-tag {
  display: inline-block;
  width: fit-content;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--emerald-soft);
  color: var(--mongo-green);
  margin-top: 2px;
}

/* ==========================================
   DASHBOARD BLOCK 3: WEEKLY PROGRESS BAR
   ========================================== */
.weekly-progress-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.progress-header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.progress-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 2px;
}

.progress-numbers {
  font-size: 1.25rem;
  color: var(--text-secondary);
}

.progress-numbers strong {
  color: var(--mongo-green);
  font-size: 1.55rem;
}

.progress-track-lg {
  width: 100%;
  height: 14px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill-lg {
  height: 100%;
  background: linear-gradient(90deg, var(--mongo-green), var(--cyan));
  border-radius: 999px;
  transition: width 0.5s ease;
}

.progress-footer-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ==========================================
   UNIFORM CALENDAR 7-DAY GRID & CARDS
   ========================================== */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

.day-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  min-height: 215px;
}

.day-card.is-today {
  border-color: var(--mongo-green);
  box-shadow: 0 8px 24px rgba(0, 237, 100, 0.14);
}

/* Uniform Top Pill Row: Left (Day + Today) and Right (Rigid Color Pills) */
.day-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.day-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-primary);
}

.day-pills-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.day-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.day-workout-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
}

.day-zone-pill {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--mongo-green);
}

.day-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  gap: 8px;
}

.day-phases-mini {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.btn-push-day {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-push-day:hover {
  border-color: var(--mongo-green);
  color: var(--mongo-green);
}

/* ==========================================
   GOALS, FORMS & MODALS
   ========================================== */
.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.clean-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.control-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.form-input,
.form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.16s ease;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--mongo-green);
}

.form-row-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.form-row-inline .form-select {
  flex: 1;
  min-width: 220px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.16s ease;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 0.76rem;
}

.btn-full {
  width: 100%;
}

.btn-primary {
  background: var(--mongo-green);
  color: #03140a;
}

.btn-primary:hover {
  filter: brightness(1.07);
}

.btn-secondary {
  background: var(--bg-card-subtle);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  border-color: var(--mongo-green);
  color: var(--mongo-green);
}

.btn-accent-cyan {
  background: linear-gradient(135deg, #06b6d4 0%, #0ea5e9 100%);
  color: #031521;
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 6px 18px rgba(6, 182, 212, 0.25);
}

.btn-accent-cyan:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(14, 165, 233, 0.38);
}

.btn-accent-cyan:active {
  transform: translateY(0);
}

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

.race-item {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.race-meta h4 {
  font-size: 0.95rem;
  font-weight: 700;
}

.race-meta p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.race-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-delete-race {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: var(--coral);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}

/* Traffic Light */
.traffic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.traffic-card {
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  border: 1px solid var(--border-subtle);
}

.traffic-dot-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
  font-size: 0.74rem;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.dot-green { background: var(--mongo-green); }
.dot-yellow { background: var(--amber); }
.dot-red { background: var(--coral); }

/* Settings PBs & Zones */
.pb-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.pb-pill {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.pace-zones-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.pace-zone-chip {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

.zone-name {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.zone-pace {
  font-size: 0.86rem;
  font-weight: 700;
  margin-top: 2px;
}

/* Loading Banner, Modals & Toast */
.loading-banner {
  background: rgba(0, 237, 100, 0.1);
  border-bottom: 1px solid rgba(0, 237, 100, 0.3);
  padding: calc(env(safe-area-inset-top, 0px) + 9px) 16px 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.82rem;
  font-weight: 600;
}

@media (min-width: 1024px) {
  .loading-banner {
    padding: 9px 16px;
  }
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--mongo-green);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.toast {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: 20px;
  z-index: 95;
  background: #111827;
  border: 1px solid var(--mongo-green);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  max-width: calc(100vw - 40px);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 8, 15, 0.84);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 420px;
  width: 100%;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-card-lg {
  max-width: 540px;
}

.modal-header h3 {
  font-size: 1.2rem;
  font-weight: 800;
  margin-top: 2px;
}

.modal-header p {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.summary-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.summary-stat-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-stat-box strong {
  font-size: 1.15rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

/* Native DatePicker & Static Phase Box Fixes (Direttiva 3) */
.date-picker-field {
  position: relative;
  z-index: 20;
}

.date-input-native {
  position: relative;
  z-index: 25;
  pointer-events: auto !important;
  cursor: pointer;
  color-scheme: dark;
  -webkit-appearance: auto;
  appearance: auto;
}

.date-input-native::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.9;
  padding: 4px;
}

.static-phase-box {
  background: var(--bg-card-subtle);
  border: 1px solid rgba(0, 237, 100, 0.28);
  border-left: 4px solid var(--mongo-green);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.phase-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Visual Separation in /goals between Paces Reference and Races Planner */
.goals-split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: stretch;
}

.goals-split-layout > .card {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.goals-split-layout .clean-form {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.goals-submit-btn,
.goals-split-layout .clean-form > button[type="submit"] {
  margin-top: auto;
}

.card-paces-reference {
  border-top: 3px solid var(--mongo-green);
}

.card-races-planner {
  border-top: 3px solid var(--cyan);
}

.btn-activate-race {
  background: rgba(0, 237, 100, 0.14);
  border: 1px solid rgba(0, 237, 100, 0.45);
  color: var(--mongo-green);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
}

.btn-activate-race:hover {
  background: var(--mongo-green);
  color: #03140a;
}

.badge-active-phase {
  background: rgba(0, 237, 100, 0.12);
  border: 1px solid rgba(0, 237, 100, 0.35);
  color: var(--mongo-green);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0.65;
  cursor: not-allowed;
}

/* AI Read-Only Weekly Volume Box in /goals (Direttiva 1) */
.ai-volume-readonly-box {
  background: var(--bg-card-subtle);
  border: 1px solid rgba(6, 182, 212, 0.28);
  border-left: 4px solid var(--cyan);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ai-volume-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-volume-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Gym Workout Exercises Panel in Dashboard (Direttiva 2) */
.gym-exercises-box {
  background: rgba(9, 13, 22, 0.68);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gym-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.gym-exercises-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
}

.gym-exercises-list li {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 0.78rem;
  color: var(--text-primary);
}

/* Disabled States for Weekly Lock & Garmin Push Prevention (Direttiva 2 & 6) */
.btn:disabled,
.btn-push-day:disabled {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  pointer-events: none;
  filter: none !important;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
  .page-content {
    padding: calc(env(safe-area-inset-top, 0px) + 16px) 14px 24px;
  }

  .card,
  .hero-workout-card {
    padding: 18px;
  }

  .workout-phases-grid,
  .hero-targets-grid,
  .gauges-grid,
  .two-col-grid,
  .goals-split-layout,
  .form-grid-2,
  .traffic-grid,
  .summary-stats-grid {
    grid-template-columns: 1fr;
  }
}
