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

body {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* ===== Cards ===== */
.card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 12px rgba(0,0,0,0.03);
  padding: 20px;
  margin-bottom: 0;
  transition: box-shadow 0.2s ease;
}

@media (max-width: 768px) {
  .card {
    border-radius: 14px;
    padding: 16px;
  }
}

/* ===== Typography ===== */
.section-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #1a1a2e;
  letter-spacing: -0.01em;
}

.field-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ===== Stat boxes ===== */
.stat-box {
  text-align: center;
  padding: 10px 8px;
  border-radius: 12px;
}

/* ===== Empty states ===== */
.empty-state {
  text-align: center;
  color: #94a3b8;
  font-size: 0.8125rem;
  padding: 8px 0;
}

/* ===== Navigation ===== */
.tab-active {
  color: #0ea5e9;
  position: relative;
}
.tab-active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: #0ea5e9;
  border-radius: 2px;
}

@media (min-width: 769px) {
  .tab-active::after {
    bottom: auto;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
  }
}

.sidebar-nav {
  background: #1a1a2e;
  width: 220px;
  min-height: 100vh;
  padding: 24px 0;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 40;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #e2e8f0;
  z-index: 40;
  padding: 4px 0;
  padding-bottom: env(safe-area-inset-bottom, 4px);
}

/* ===== Progress ===== */
.progress-bar-track {
  background: #e2e8f0;
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
}
.progress-bar-track.h-1\.5 { height: 6px; }
.progress-bar-track.h-2 { height: 8px; }
.progress-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.ring-progress {
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ===== Inputs ===== */
.numeric-input {
  width: 5rem;
  text-align: center;
  padding: 0.375rem 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.15s;
  outline: none;
}
.numeric-input:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
}

.stepper-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 0.625rem;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 700;
  color: #475569;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
  user-select: none;
  -webkit-user-select: none;
}
.stepper-btn:hover { background: #e2e8f0; }
.stepper-btn:active { background: #cbd5e1; transform: scale(0.95); }

.text-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  transition: all 0.15s;
  outline: none;
}
.text-input:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
}

.range-input {
  width: 100%;
  height: 0.5rem;
  background: #e2e8f0;
  border-radius: 0.5rem;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  accent-color: #0ea5e9;
}

.segment-control {
  display: flex;
  background: #f1f5f9;
  border-radius: 0.75rem;
  padding: 0.25rem;
  gap: 0.25rem;
}
.segment-active {
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.settings-btn {
  padding: 0.625rem 1rem;
  background: #f1f5f9;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #1a1a2e;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
}
.settings-btn:hover { background: #e2e8f0; }

/* ===== Expandable ===== */
.expandable-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}
.expandable-content.open {
  max-height: 1000px;
  opacity: 1;
}

/* ===== Step number ===== */
.step-number {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: #0ea5e9;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ===== Mode explainer ===== */
.mode-explainer {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid;
}
.mode-clone {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #6d28d9;
}
.mode-physio {
  background: #f0fdfa;
  border-color: #99f6e4;
  color: #0d9488;
}

/* ===== Onboarding ===== */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.onboarding-card {
  background: white;
  border-radius: 20px;
  padding: 28px 24px 24px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

/* ===== Tooltip ===== */
.tooltip-wrapper {
  position: relative;
  display: inline-flex;
}
.tooltip-popup {
  position: absolute;
  z-index: 50;
  background: #1a1a2e;
  color: white;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
}
.tooltip-top {
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
}

/* ===== Animations ===== */
.fade-in {
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.pulse {
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ===== Calendar Picker ===== */
.calendar-picker-overlay {
  position: absolute;
  top: 100%;
  left: -4px;
  right: -4px;
  z-index: 50;
  padding-top: 4px;
}
.calendar-picker {
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  padding: 16px;
  border: 1px solid #e2e8f0;
}

/* ===== Photo flow animation ===== */
@keyframes analyzingBar {
  0% { width: 0%; margin-left: 0%; }
  50% { width: 60%; margin-left: 20%; }
  100% { width: 0%; margin-left: 100%; }
}

/* ===== Photo upload area ===== */
.photo-upload-area {
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.photo-upload-area:hover {
  border-color: #0ea5e9;
  background: rgba(14, 165, 233, 0.03);
}

/* ===== Meal confirmation card ===== */
.confirmation-card {
  border: 2px solid #ddd6fe;
  background: rgba(245, 243, 255, 0.3);
  border-radius: 16px;
}