/**
 * Static Mobile-First Modern CSS for Apnea Trainer v2.
 * Pure CSS3 with custom properties, Flexbox, CSS Grid, touch-friendly controls (>= 48px),
 * slide-in hamburger drawer, swipeable views, and bottom-sheet modals.
 * Zero external CSS frameworks.
 */

:root {
  --bg-deep: #050d16;
  --bg-surface: #0b1929;
  --bg-elevated: #11263c;
  --bg-input: #071320;
  --border-subtle: rgba(148, 197, 240, 0.14);
  --border-focus: #38bdf8;
  --text-primary: #f2f8ff;
  --text-secondary: #9bbcd9;
  --text-muted: #6284a3;
  --accent-primary: #0ea5e9;
  --accent-primary-hover: #0284c7;
  --accent-teal: #14b8a6;
  --accent-amber: #f59e0b;
  --accent-danger: #ef4444;
  --accent-success: #10b981;
  --env-dry-bg: rgba(20, 184, 166, 0.14);
  --env-dry-text: #2dd4bf;
  --env-pool-bg: rgba(14, 165, 233, 0.16);
  --env-pool-text: #38bdf8;
  --env-gym-bg: rgba(245, 158, 11, 0.16);
  --env-gym-text: #fbbf24;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --touch-min: 42px;
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.22);
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    Oxygen, Ubuntu, Cantarell, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scrollbar-gutter: stable;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100vh;
  overflow-x: clip;
  background: radial-gradient(circle at 50% 0%, #0d233a 0%, var(--bg-deep) 65%);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

html.modal-open,
body.modal-open,
html.drawer-open,
body.drawer-open {
  overflow: hidden !important;
  overscroll-behavior: none !important;
  height: 100%;
}

/* ==========================================================================
   Mobile App Shell & Minimal Top Bar
   ========================================================================== */

.app-shell {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 36px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.app-topbar {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 500;
  flex-shrink: 0;
  width: 100%;
  background: linear-gradient(
    180deg,
    rgba(14, 30, 48, 0.98) 0%,
    rgba(8, 20, 33, 0.96) 100%
  );
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(56, 189, 248, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5),
    0 4px 20px -2px rgba(2, 6, 12, 0.7);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Subtle luminous bevel line on bottom */
.app-topbar::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 8%;
  right: 8%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(56, 189, 248, 0.5) 50%,
    transparent 100%
  );
  pointer-events: none;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.icon-btn:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: var(--border-focus);
}

.icon-btn-discreet {
  width: 36px;
  height: 36px;
  font-size: 0.95rem;
  color: var(--text-secondary);
  background-color: rgba(255, 255, 255, 0.02);
  border-color: var(--border-subtle);
}

.brand-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.brand-app-name {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.015em;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.topbar-section-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--env-pool-text);
  background: var(--env-pool-bg);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 1px 7px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.brand-subtitle {
  margin: 0;
  font-size: 0.74rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lang-switch-sm {
  border-radius: 9999px;
  background-color: rgba(7, 19, 32, 0.7);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.lang-switch-sm .lang-btn {
  min-height: 32px;
  min-width: 34px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  transition: all 0.15s ease;
}

.lang-switch-sm .lang-btn.active {
  background-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(14, 165, 233, 0.4);
}

.topbar-athlete-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  padding: 3px 10px 3px 3px;
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.topbar-athlete-pill:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--border-focus);
}

.avatar-circle-xs {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-teal));
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.topbar-athlete-name {
  max-width: 90px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 480px) {
  .topbar-athlete-name {
    display: none;
  }
  .topbar-athlete-pill {
    padding: 3px;
  }
}

.main-viewport {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

/* ==========================================================================
   Hamburger Side Drawer (Clean, Non-Redundant Menu)
   ========================================================================== */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  background-color: rgba(3, 8, 14, 0.75);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: flex-start;
  animation: fadeIn 0.18s ease-out;
  overscroll-behavior: none;
  touch-action: none;
}

.drawer-panel {
  width: 82vw;
  max-width: 300px;
  height: 100%;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: none;
  overscroll-behavior-y: none;
  touch-action: pan-y;
  box-shadow: var(--shadow-card);
  animation: slideInLeft 0.2s ease-out;
}

.drawer-user-box {
  background: linear-gradient(
    145deg,
    rgba(14, 165, 233, 0.14),
    rgba(20, 184, 166, 0.08)
  );
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-circle {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-teal));
  color: #ffffff;
  font-weight: 800;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.drawer-nav-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drawer-link {
  min-height: var(--touch-min);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background-color: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  width: 100%;
  transition: background-color 0.15s ease, color 0.15s ease;
}

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

.drawer-link.active {
  background-color: rgba(14, 165, 233, 0.16);
  border-color: rgba(56, 189, 248, 0.35);
  color: var(--text-primary);
}

.drawer-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.drawer-install-btn {
  min-height: 42px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-subtle);
  background-color: rgba(255, 255, 255, 0.025);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease;
}

.drawer-install-btn:hover {
  background-color: rgba(14, 165, 233, 0.08);
  border-color: rgba(56, 189, 248, 0.35);
  color: var(--text-primary);
}

.drawer-install-tag {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 999px;
  background-color: rgba(155, 188, 217, 0.12);
  color: var(--text-muted);
}

/* ==========================================================================
   Modern Segmented Tab Bar & Swipe Stage
   ========================================================================== */

.stepper-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 3px;
  background-color: rgba(7, 19, 32, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  scrollbar-width: none;
}

.stepper-bar::-webkit-scrollbar {
  display: none;
}

.step-pill {
  min-height: 32px;
  padding: 5px 12px;
  border-radius: 999px;
  border: none;
  background-color: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
  flex: 1;
  text-align: center;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.step-pill.active {
  background-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
}

.swipe-stage {
  display: flex;
  flex-direction: column;
  gap: 14px;
  touch-action: pan-y;
  animation: fadeSlideIn 0.2s ease-out;
}

.swipe-dots-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 2px 0;
}

.step-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background-color: rgba(155, 188, 217, 0.25);
  transition: width 0.2s ease, background-color 0.2s ease;
}

.step-dot.active {
  width: 20px;
  background-color: var(--accent-primary);
}

/* ==========================================================================
   Buttons, Inputs & Interactive Rating Pills (Touch-friendly >= 48px)
   ========================================================================== */

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: 1rem;
}

.btn {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.15s ease, opacity 0.15s ease,
    border-color 0.15s ease;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #0284c7);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-primary-hover);
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--border-focus);
  background-color: rgba(255, 255, 255, 0.08);
}

.btn-success {
  background: linear-gradient(135deg, var(--accent-success), #059669);
  color: #ffffff;
}

.btn-danger {
  background-color: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.btn-sm {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 0.8rem;
  border-radius: 6px;
}

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: var(--bg-input);
  flex-shrink: 0;
}

.lang-btn {
  min-height: 38px;
  min-width: 44px;
  padding: 4px 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}

.lang-btn.active {
  background-color: var(--accent-primary);
  color: #ffffff;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.form-group > .form-control,
.form-group > .form-input,
.form-group > input,
.form-group > select,
.form-group > textarea {
  margin-top: auto;
}

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

@media (max-width: 480px) {
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-control,
.form-input {
  width: 100%;
  min-height: var(--touch-min);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-input);
  color: var(--text-primary);
  box-sizing: border-box;
}

.form-control:focus,
.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

select.form-control,
select.form-input {
  background-color: var(--bg-input);
  color: var(--text-primary);
  appearance: auto;
}

textarea.form-control,
textarea.form-input {
  background-color: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  resize: vertical;
}

.admin-nav-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-nav-tabs .segment-btn {
  flex: 1 0 auto;
  white-space: nowrap;
  padding: 8px 14px;
  font-size: 0.85rem;
  border-radius: 6px;
}

.admin-var-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  align-items: end;
}

.admin-var-grid .var-col-3 {
  grid-column: span 2;
}

.admin-var-grid .var-col-2 {
  grid-column: span 3;
}

@media (max-width: 520px) {
  .admin-var-grid {
    grid-template-columns: 1fr 1fr;
  }
  .admin-var-grid .var-col-3,
  .admin-var-grid .var-col-2 {
    grid-column: span 1;
  }
  .admin-var-grid .var-col-2:last-child {
    grid-column: span 2;
  }
}

.env-chip-group {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.env-chip-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.env-chip-label:hover {
  border-color: var(--border-focus);
}

.env-chip-label input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 16px;
  height: 16px;
}

.admin-checklist-card {
  padding: 8px 12px;
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  scrollbar-gutter: stable;
}

.admin-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.85rem;
  padding: 6px 4px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.admin-checklist-item:last-child {
  border-bottom: none;
}

.admin-checklist-item span,
.admin-checklist-item div {
  word-break: break-word;
}

.admin-checklist-item input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
}

.admin-env-segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin: 12px 0 16px 0;
}

.admin-env-segmented .segment-btn {
  min-height: 40px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-env-segmented .segment-btn.active {
  background-color: var(--accent-primary);
  color: #ffffff;
}

.segment-btn {
  min-height: 42px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}

.segment-btn.active {
  background-color: var(--accent-primary);
  color: #ffffff;
}

.rating-pill-group {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.rating-pill {
  position: relative;
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-input);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease;
}

.rating-pill.is-prev:not(.active) {
  border-color: rgba(56, 189, 248, 0.5);
  color: var(--text-primary);
}

.rating-pill.is-prev::after {
  content: '';
  position: absolute;
  bottom: 5px;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.65);
}

.rating-pill.active {
  background-color: var(--accent-primary);
  border-color: var(--border-focus);
  color: #ffffff;
}

.metric-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
}

.metric-label-row .form-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prev-metric-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.prev-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background-color: rgba(155, 188, 217, 0.12);
  color: var(--text-secondary);
  white-space: nowrap;
}

.delta-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.delta-badge.up {
  background-color: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.delta-badge.same {
  background-color: rgba(155, 188, 217, 0.12);
  color: var(--text-secondary);
}

.delta-badge.down {
  background-color: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

/* ==========================================================================
   Modern Cards, Week Summary Cards & Session Digest Cards
   ========================================================================== */

.card {
  background: linear-gradient(
    165deg,
    rgba(17, 38, 60, 0.78),
    rgba(11, 25, 41, 0.94)
  );
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

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

.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-subtitle {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.slot-list,
.goal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slot-item,
.goal-item {
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slot-item-header,
.goal-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.bmi-banner {
  background-color: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.bmi-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--border-focus);
}

/* Week Summary Cards */
.week-summary-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.week-summary-card {
  background: linear-gradient(
    165deg,
    rgba(17, 38, 60, 0.75),
    rgba(11, 25, 41, 0.94)
  );
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.week-summary-card:hover {
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.week-summary-card.completed {
  background: linear-gradient(
    165deg,
    rgba(16, 185, 129, 0.22),
    rgba(6, 78, 59, 0.45)
  );
  border-color: rgba(52, 211, 153, 0.55);
}

.week-chevron {
  font-size: 1.25rem;
  color: var(--text-secondary);
  font-weight: 700;
  line-height: 1;
}

/* Compact Session Card */
.sessions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.session-card {
  background: linear-gradient(
    165deg,
    rgba(17, 38, 60, 0.72),
    rgba(11, 25, 41, 0.92)
  );
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-card);
}

.session-card.completed {
  background: linear-gradient(
    165deg,
    rgba(16, 185, 129, 0.22),
    rgba(6, 78, 59, 0.45)
  );
  border-color: rgba(52, 211, 153, 0.55);
}

.session-card.cancelled {
  background: linear-gradient(
    165deg,
    rgba(30, 41, 59, 0.65),
    rgba(15, 23, 42, 0.85)
  );
  border-color: rgba(100, 116, 139, 0.4);
  opacity: 0.75;
}

.session-card.locked {
  background: linear-gradient(
    165deg,
    rgba(17, 30, 45, 0.55),
    rgba(10, 20, 32, 0.75)
  );
  border-color: rgba(148, 163, 184, 0.2);
  opacity: 0.88;
}

.session-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.session-date-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.session-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.session-timing-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.timing-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.timing-chip.programmed {
  background-color: rgba(14, 165, 233, 0.14);
  color: var(--border-focus);
  border-color: rgba(56, 189, 248, 0.3);
}

.session-compact-exercises {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background-color: rgba(7, 19, 32, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.session-compact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.8rem;
}

.session-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.session-card-actions.single {
  justify-content: stretch;
}

.session-card-actions.single .btn {
  width: 100%;
}

/* Detailed Exercise Item inside Modal */
.exercise-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.exercise-item {
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.exercise-name {
  font-weight: 700;
  font-size: 0.94rem;
  color: var(--text-primary);
}

.exercise-prescription {
  font-size: 0.88rem;
  color: var(--border-focus);
  font-weight: 500;
}

.exercise-skills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.skill-tag {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 6px;
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.exercise-result-box {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-subtle);
  font-size: 0.85rem;
  color: #34d399;
  font-weight: 600;
}

/* ==========================================================================
   Badges & Progress Bars
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-DRY {
  background-color: var(--env-dry-bg);
  color: var(--env-dry-text);
  border: 1px solid rgba(45, 212, 191, 0.3);
}

.badge-POOL {
  background-color: var(--env-pool-bg);
  color: var(--env-pool-text);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-GYM {
  background-color: var(--env-gym-bg);
  color: var(--env-gym-text);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-intense {
  background-color: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.badge-recovery {
  background-color: rgba(16, 185, 129, 0.14);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-completed {
  background-color: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.badge-cancelled {
  background-color: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.badge-locked {
  background-color: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.btn-outline-danger {
  background: transparent;
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.45);
}

.btn-outline-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #fca5a5;
}

.badge-pending {
  background-color: rgba(158, 193, 223, 0.12);
  color: var(--text-secondary);
}

.badge-admin {
  background-color: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.45);
}

.badge-blocked {
  background-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.45);
}

.badge-active {
  background-color: rgba(34, 197, 94, 0.15);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.weight-bar-track {
  width: 100%;
  height: 7px;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.weight-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-teal));
  border-radius: 999px;
  transition: width 0.25s ease;
}

.archive-callout-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: #93c5fd;
}

.block-evaluation-callout {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: var(--radius-sm);
  box-shadow: none;
}

.block-evaluation-callout .callout-content strong {
  display: block;
  font-size: 0.95rem;
  color: #38bdf8;
  margin-bottom: 2px;
}

.block-evaluation-callout .callout-content p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   Archived Plan Summary Components
   ========================================================================== */

.archive-summary-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.archive-completeness-card {
  background: rgba(14, 165, 233, 0.06);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.archive-completeness-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.archive-completeness-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-teal);
  line-height: 1;
}

.archive-completeness-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.archive-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.archive-stat-box {
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.archive-stat-box .stat-num {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.archive-stat-box .stat-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.archive-blocks-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.archive-block-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.archive-block-chip.completed {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(52, 211, 153, 0.4);
  color: #34d399;
}

.archive-block-chip.partial {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}

.archive-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-top: 4px;
}

.archive-exercise-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.archive-exercise-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.archive-exercise-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.85rem;
}

.archive-exercise-name {
  font-weight: 600;
  color: var(--text-primary);
}

.archive-exercise-time {
  font-weight: 700;
  color: var(--accent-teal);
  font-size: 0.82rem;
}

.archive-env-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (min-width: 600px) {
  .block-evaluation-callout {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.weights-summary-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.weight-pill {
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.weight-pill-label {
  font-size: 0.84rem;
  color: var(--text-primary);
  font-weight: 600;
}

.weight-pill-val {
  font-size: 1rem;
  font-weight: 800;
  color: var(--border-focus);
}

/* ==========================================================================
   Bottom-Sheet Modals & Floating Asynchronous Toasts
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(3, 8, 14, 0.78);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  z-index: 1000;
  animation: fadeIn 0.16s ease-out;
  overscroll-behavior: none;
  touch-action: none;
}

.modal-backdrop.closing {
  opacity: 0;
  transition: opacity 0.18s ease-out;
}

.modal-dialog {
  background-color: var(--bg-surface);
  border-top: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: none;
  overscroll-behavior-y: none;
  touch-action: pan-y;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-card);
  animation: slideUpSheet 0.22s ease-out;
}

.modal-dialog.completed {
  background: linear-gradient(
    165deg,
    rgba(16, 185, 129, 0.2),
    rgba(8, 36, 36, 0.96)
  );
  border-top-color: rgba(52, 211, 153, 0.6);
}

.sheet-handle {
  width: 40px;
  height: 5px;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.18);
  margin: 0 auto 4px;
  flex-shrink: 0;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.modal-actions.single {
  grid-template-columns: 1fr;
}

.toast-container {
  position: fixed;
  top: 68px;
  right: 14px;
  left: 14px;
  max-width: 380px;
  margin-left: auto;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-banner {
  pointer-events: auto;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(8px);
  animation: fadeSlideIn 0.18s ease-out;
}

.toast-banner.error {
  background-color: rgba(127, 29, 29, 0.95);
  border: 1px solid var(--accent-danger);
  color: #fecaca;
}

.toast-banner.success {
  background-color: rgba(6, 78, 59, 0.95);
  border: 1px solid var(--accent-success);
  color: #a7f3d0;
}

/* ==========================================================================
   PWA Install Invitation Banner
   ========================================================================== */

.pwa-install-banner {
  background: linear-gradient(
    145deg,
    rgba(14, 165, 233, 0.2),
    rgba(20, 184, 166, 0.12)
  );
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-card);
  animation: fadeSlideIn 0.2s ease-out;
}

.pwa-banner-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.pwa-banner-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.pwa-app-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ==========================================================================
   Onboarding & Contextual Guidance Banners
   ========================================================================== */

.onboarding-guide-banner {
  background: linear-gradient(
    145deg,
    rgba(20, 184, 166, 0.2),
    rgba(14, 165, 233, 0.14)
  );
  border: 1px solid rgba(45, 212, 191, 0.45);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-card);
  animation: fadeSlideIn 0.2s ease-out;
}

.guided-highlight {
  border-color: rgba(45, 212, 191, 0.55) !important;
  box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.2), var(--shadow-card);
}

/* ==========================================================================
   Animations & Tablet/Desktop Adjustments
   ========================================================================== */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slideUpSheet {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 600px) {
  .form-row {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .week-summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .modal-backdrop {
    align-items: center;
    padding: 16px;
  }

  .modal-dialog {
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: var(--radius-md);
    padding: 20px;
  }

  .sheet-handle {
    display: none;
  }
}

/* ==========================================================================
   Google OAuth 2.0 / GIS Styles
   ========================================================================== */

.auth-card {
  text-align: center;
  padding: 32px 24px;
}

.auth-logo-badge {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 8px;
}

.google-auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #ffffff;
  color: #3c4043;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: 9999px;
  border: 1px solid #dadce0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s, transform 0.1s;
  min-height: 48px;
  width: 100%;
  max-width: 280px;
}

.google-auth-btn:hover {
  background: #f8fafd;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.google-auth-btn:active {
  background: #eeeeee;
  transform: scale(0.99);
}

.google-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.avatar-circle-xs img,
img.avatar-circle-xs {
  border-radius: 50%;
  width: 22px;
  height: 22px;
  object-fit: cover;
}

.avatar-circle img,
img.avatar-circle {
  border-radius: 50%;
  width: 44px;
  height: 44px;
  object-fit: cover;
}
