:root {
  --onyx-950: #07080A;
  --onyx-900: #0B0D10;
  --onyx-850: #111418;
  --onyx-800: #161A20;
  --onyx-700: #1E2430;
  --onyx-600: #2A3140;
  --onyx-400: #6B7385;
  --onyx-200: #B8BECB;
  --onyx-100: #E8EAEE;
  --action: #FF6A00;
  --action-hover: #FF8533;
  --action-muted: rgba(255, 106, 0, 0.16);
  --success: #3DDC97;
  --warn: #F5C542;
  --danger: #FF4D6D;
  --radius: 1rem;
  --radius-sm: 0.75rem;
  --nav-h: 4.5rem;
  --sidebar-w: 260px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

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

html { scroll-behavior: smooth; }

body.p0207-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255, 106, 0, 0.08), transparent 55%),
    radial-gradient(900px 500px at -10% 30%, rgba(61, 220, 151, 0.04), transparent 50%),
    linear-gradient(180deg, var(--onyx-900) 0%, var(--onyx-950) 100%);
  color: var(--onyx-100);
  -webkit-font-smoothing: antialiased;
}

/* Shell: desktop sidebar + content */
.p0207-shell {
  display: block;
  min-height: 100vh;
}

.p0207-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  flex-direction: column;
  padding: 1.5rem 1.15rem;
  background: rgba(11, 13, 16, 0.96);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 1040;
}

.p0207-sidebar-goal {
  background: var(--onyx-800);
  border: 1px solid rgba(255, 106, 0, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
}

.p0207-side-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.p0207-side-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.85rem;
  border-radius: 0.7rem;
  color: var(--onyx-200);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.15s, color 0.15s;
}

.p0207-side-link i { color: var(--onyx-400); font-size: 1.1rem; }

.p0207-side-link:hover,
.p0207-side-link.active {
  background: var(--action-muted);
  color: #fff;
}

.p0207-side-link:hover i,
.p0207-side-link.active i { color: var(--action); }

.p0207-sidebar-foot {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--onyx-400);
}

.p0207-content { min-width: 0; }

@media (min-width: 992px) {
  .p0207-content {
    margin-left: var(--sidebar-w);
  }
  .p0207-main {
    max-width: 1100px;
    padding-bottom: 2.5rem !important;
  }
  .pb-nav { padding-bottom: 2rem; }
}

/* Header */
.p0207-header {
  background: rgba(11, 13, 16, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 1030;
}

.p0207-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.p0207-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.65rem;
  background: linear-gradient(145deg, var(--action), #FF3D00);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: -0.03em;
  box-shadow: 0 6px 20px rgba(255, 106, 0, 0.35);
}

.p0207-logo-text {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--onyx-200);
  letter-spacing: -0.02em;
}

.p0207-logo-text strong { color: #fff; font-weight: 800; }

.p0207-countdown-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--onyx-400);
}

.p0207-countdown-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--action);
}

.p0207-main {
  padding-top: 1.15rem;
  max-width: 720px;
  margin: 0 auto;
}

.pb-nav {
  padding-bottom: calc(var(--nav-h) + 1.5rem + env(safe-area-inset-bottom, 0px));
}

/* Cards */
.p0207-card {
  background: var(--onyx-800);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.p0207-card .card-body { padding: 1.1rem 1.15rem; }

.p0207-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--onyx-400);
  margin-bottom: 0.75rem;
}

.p0207-hero-stat {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: #fff;
}

.p0207-hero-stat span {
  font-size: 1rem;
  font-weight: 600;
  color: var(--onyx-400);
}

.page-lead {
  font-size: 0.9rem;
  color: var(--onyx-400);
  margin-bottom: 1.25rem;
}

/* Buttons */
.btn-action {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--action);
  --bs-btn-border-color: var(--action);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--action-hover);
  --bs-btn-hover-border-color: var(--action-hover);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #E85F00;
  --bs-btn-active-border-color: #E85F00;
  font-weight: 600;
  border-radius: 0.75rem;
  padding: 0.65rem 1.15rem;
}

.btn-ghost {
  background: var(--onyx-700);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--onyx-100);
  border-radius: 0.75rem;
  font-weight: 600;
}

.btn-ghost:hover { background: var(--onyx-600); color: #fff; }

.btn-outline-action {
  border: 1px solid var(--action);
  color: var(--action);
  background: transparent;
  border-radius: 0.75rem;
  font-weight: 600;
}

.btn-outline-action:hover,
.btn-outline-action.active {
  background: var(--action);
  color: #fff;
}

/* Forms */
.form-control,
.form-select {
  background: var(--onyx-850);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: var(--radius-sm);
}

.form-control:focus,
.form-select:focus {
  background: var(--onyx-850);
  border-color: var(--action);
  color: #fff;
  box-shadow: 0 0 0 0.2rem var(--action-muted);
}

.form-control::placeholder { color: var(--onyx-400); }
.form-label { font-size: 0.8rem; font-weight: 600; color: var(--onyx-200); }

/* Badges */
.badge-lf {
  background: rgba(61, 220, 151, 0.15);
  color: var(--success);
  font-weight: 600;
  border-radius: 0.4rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.72rem;
}

.badge-safe {
  background: var(--action-muted);
  color: var(--action);
  font-weight: 600;
  border-radius: 0.4rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.72rem;
}

.badge-caution {
  background: rgba(245, 197, 66, 0.15);
  color: var(--warn);
  font-weight: 600;
  border-radius: 0.4rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.72rem;
}

.badge-fat {
  background: rgba(255, 106, 0, 0.12);
  color: var(--action-hover);
  font-weight: 600;
  border-radius: 0.4rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.72rem;
}

.badge-evening-no {
  background: rgba(255, 77, 109, 0.12);
  color: var(--danger);
  font-weight: 600;
  border-radius: 0.4rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.72rem;
}

/* Sticky bottom nav — mobile only */
.p0207-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1040;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(11, 13, 16, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.p0207-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  text-decoration: none;
  color: var(--onyx-400);
  font-size: 0.62rem;
  font-weight: 600;
  transition: color 0.15s ease;
}

.p0207-nav-item i { font-size: 1.2rem; line-height: 1; }
.p0207-nav-item.active,
.p0207-nav-item:hover { color: var(--action); }

/* Workout */
.workout-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.workout-pick-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--onyx-800);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 1.15rem;
  transition: border-color 0.15s, transform 0.15s;
}

.workout-pick-card:hover,
.workout-pick-card.active {
  border-color: var(--action);
  color: inherit;
  transform: translateY(-2px);
}

.workout-pick-card .code {
  font-size: 2rem;
  font-weight: 800;
  color: var(--action);
  line-height: 1;
}

.workout-card .video-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--onyx-950);
  overflow: hidden;
}

.workout-card .video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.9;
}

.workout-card .video-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.55));
}

.workout-card .video-play-btn {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  background: var(--action);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  box-shadow: 0 8px 24px rgba(255, 106, 0, 0.45);
}

.set-grid {
  display: grid;
  grid-template-columns: 0.7fr 1fr 1fr 1fr;
  gap: 0.45rem;
  align-items: end;
}

.set-grid .form-control {
  text-align: center;
  padding: 0.45rem 0.35rem;
  font-weight: 600;
}

.prev-session {
  background: var(--onyx-850);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  font-size: 0.8rem;
  color: var(--onyx-200);
  border: 1px dashed rgba(255, 106, 0, 0.25);
}

.prev-session strong { color: var(--action); }

/* Desktop workout: two column card */
@media (min-width: 992px) {
  .workout-card-desktop {
    display: grid;
    grid-template-columns: 280px 1fr;
  }
  .workout-card-desktop .video-thumb {
    height: 100%;
    min-height: 200px;
    aspect-ratio: auto;
  }
}

/* Achievements */
.achievement-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .achievement-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 992px) {
  .achievement-grid { grid-template-columns: repeat(4, 1fr); }
}

.achievement-tile {
  background: var(--onyx-850);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  opacity: 0.45;
}

.achievement-tile.unlocked {
  opacity: 1;
  border-color: rgba(255, 106, 0, 0.35);
}

.achievement-tile i { font-size: 1.35rem; color: var(--action); }
.achievement-tile h6 { margin: 0.4rem 0 0.15rem; font-size: 0.85rem; font-weight: 700; }
.achievement-tile p { margin: 0; font-size: 0.72rem; color: var(--onyx-400); }

/* Macro / water */
.macro-track {
  height: 0.55rem;
  background: var(--onyx-700);
  border-radius: 999px;
  overflow: hidden;
}

.macro-track > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--action), #FFB347);
  border-radius: 999px;
}

.water-glasses {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.water-glass {
  width: 2rem;
  height: 2.4rem;
  border-radius: 0.35rem 0.35rem 0.5rem 0.5rem;
  border: 2px solid rgba(91, 192, 235, 0.45);
  background: transparent;
  cursor: pointer;
}

.water-glass.filled {
  background: linear-gradient(180deg, rgba(91, 192, 235, 0.85), rgba(91, 192, 235, 0.35));
  border-color: #5BC0EB;
}

/* Pain matrix */
.pain-matrix svg {
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  display: block;
}

.pain-zone {
  cursor: pointer;
  transition: fill 0.15s ease;
  stroke: rgba(255, 255, 255, 0.15);
  stroke-width: 1.5;
  fill: var(--onyx-600);
}

.pain-zone.green { fill: #2E8B65; }
.pain-zone.yellow { fill: #C9A227; }
.pain-zone.red { fill: #C93A55; }
.pain-zone:hover { filter: brightness(1.15); }

.pain-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--onyx-200);
  margin-right: 0.75rem;
}

.pain-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  display: inline-block;
}

.pain-dot.green { background: var(--success); }
.pain-dot.yellow { background: var(--warn); }
.pain-dot.red { background: var(--danger); }

/* Photo timeline */
.photo-timeline {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .photo-timeline { grid-template-columns: repeat(3, 1fr); }
}

.photo-tile {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--onyx-850);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-tile .meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.5rem 0.65rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  font-size: 0.75rem;
}

.alert-db {
  background: rgba(255, 77, 109, 0.12);
  border: 1px solid rgba(255, 77, 109, 0.35);
  color: #FFB3C1;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
}

.alert-ok {
  background: rgba(61, 220, 151, 0.12);
  border: 1px solid rgba(61, 220, 151, 0.3);
  color: var(--success);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
}

.text-muted-onyx { color: var(--onyx-400) !important; }

.stat-tile {
  background: var(--onyx-850);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.grocery-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.grocery-item.checked {
  opacity: 0.45;
  text-decoration: line-through;
}

.desktop-grid-2 {
  display: grid;
  gap: 1rem;
}

@media (min-width: 992px) {
  .desktop-grid-2 {
    grid-template-columns: 1.4fr 1fr;
    align-items: start;
  }
  .desktop-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
}
