@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
  --bg: #faf8f5;
  --bg-card: #ffffff;
  --bg-elevated: #f0ede8;
  --text: #1a1a1a;
  --text-muted: #78716c;
  --accent: #7c3aed;
  --accent-dark: #6d28d9;
  --accent-subtle: rgba(124, 58, 237, 0.1);
  --border: #e0dbd4;
  --radius: 12px;
  --radius-sm: 8px;
  --header-height: 60px;
  --nav-height: 72px;
  --error: #dc2626;
  --error-subtle: rgba(220, 38, 38, 0.1);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
}

/* ========================
   APP HEADER
   ======================== */

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  padding-top: env(safe-area-inset-top);
}

.app-header .logo {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.app-header .logo span {
  color: var(--accent);
}

.app-header .header-action {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-header .header-action button,
.app-header .header-action a {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background 0.2s;
}

.app-header .header-action button:hover,
.app-header .header-action a:hover {
  background: var(--bg-elevated);
}

.header-back {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 14px;
}

.header-back svg {
  flex-shrink: 0;
}

.header-title {
  font-size: 16px;
  font-weight: 600;
}

/* ========================
   BOTTOM NAV
   ======================== */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  padding-top: 10px;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  transition: color 0.2s;
  min-width: 56px;
}

.bottom-nav a.active,
.bottom-nav a:hover {
  color: var(--accent);
}

.bottom-nav a svg {
  width: 22px;
  height: 22px;
}

/* ========================
   PAGE LAYOUT
   ======================== */

.page {
  min-height: 100vh;
  padding-top: calc(var(--header-height) + env(safe-area-inset-top));
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 16px);
  padding-left: 16px;
  padding-right: 16px;
}

.page-no-nav {
  padding-bottom: 24px;
}

/* ========================
   CARDS
   ======================== */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.2s;
}

.card:hover {
  border-color: #3a3a3a;
}

.card-accent {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  font-size: 15px;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  width: 100%;
  font-family: inherit;
}

.btn:active {
  transform: scale(0.98);
  background: var(--accent-dark);
}

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

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:active {
  background: var(--bg-elevated);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-sm {
  min-height: 36px;
  padding: 8px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  width: auto;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  min-height: unset;
  width: unset;
}

/* ========================
   EXERCISE CARDS
   ======================== */

.exercise-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: border-color 0.2s, background 0.2s;
}

.exercise-card.completed {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.exercise-card .exercise-info {
  flex: 1;
  min-width: 0;
}

.exercise-card .exercise-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.exercise-card .exercise-meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.exercise-card .exercise-notes {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  font-style: italic;
}

.exercise-image {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  background: var(--bg-elevated);
}

.exercise-video-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  background: var(--error-subtle);
  color: var(--error);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
}

.exercise-video-btn:active {
  background: rgba(220, 38, 38, 0.2);
}

.completion-check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-top: 2px;
}

.completion-check.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.completion-check svg {
  width: 14px;
  height: 14px;
  color: #ffffff;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s ease;
}

.completion-check.checked svg {
  opacity: 1;
  transform: scale(1);
}

/* ========================
   MEAL CARDS
   ======================== */

.meal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.meal-card .meal-type-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-bottom: 4px;
}

.meal-card .meal-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.meal-card .meal-description {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.meal-card .meal-macros {
  display: flex;
  gap: 12px;
  font-size: 12px;
}

.macro-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  color: var(--text-muted);
}

.macro-pill strong {
  color: var(--text);
}

/* ========================
   CHAT
   ======================== */

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 80px;
}

.chat-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.chat-bubble.user {
  background: var(--accent);
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-bubble.assistant {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-bubble-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.chat-bubble-time.user {
  text-align: right;
  align-self: flex-end;
}

.chat-input-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
  align-items: flex-end;
  z-index: 50;
}

.chat-input-bar textarea {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 16px;
  resize: none;
  max-height: 120px;
  min-height: 44px;
  overflow-y: auto;
  line-height: 1.4;
}

.chat-input-bar textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  border: none;
  transition: background 0.2s, transform 0.1s;
}

.chat-send-btn:active {
  transform: scale(0.95);
  background: var(--accent-dark);
}

.chat-send-btn:disabled {
  opacity: 0.5;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing-bounce 1.2s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}

/* ========================
   PROGRESS
   ======================== */

.progress-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.progress-photo {
  aspect-ratio: 3/4;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
  position: relative;
}

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

.progress-photo .photo-date {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.5));
  padding: 20px 8px 8px;
  font-size: 11px;
  color: white;
}

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.metric-row:last-child {
  border-bottom: none;
}

.metric-label {
  font-size: 14px;
  color: var(--text-muted);
}

.metric-value {
  font-size: 16px;
  font-weight: 600;
}

.metric-value .metric-unit {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 2px;
}

/* ========================
   TABS
   ======================== */

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
  margin-bottom: 16px;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

/* ========================
   BADGES
   ======================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.badge-accent {
  background: var(--accent-subtle);
  color: var(--accent);
}

.badge-muted {
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.badge-success {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

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

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  gap: 12px;
}

.empty-state .empty-icon {
  font-size: 48px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
}

.empty-state p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 260px;
}

/* ========================
   LOADER
   ======================== */

.loader {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loader-center {
  display: flex;
  justify-content: center;
  padding: 48px;
}

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

/* ========================
   TRAINER CLIENT CARD
   ======================== */

.trainer-client-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-decoration: none;
  color: inherit;
}

.trainer-client-card:active {
  background: var(--bg-elevated);
}

.trainer-client-card:hover {
  border-color: #3a3a3a;
}

.client-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  flex-shrink: 0;
  overflow: hidden;
}

.client-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.client-info {
  flex: 1;
  min-width: 0;
}

.client-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-meta {
  font-size: 13px;
  color: var(--text-muted);
}

/* ========================
   FORMS
   ======================== */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="time"],
textarea,
select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-size: 16px;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="number"]::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

.field-row {
  display: flex;
  gap: 10px;
}

/* ========================
   CHAT SHEET (contextual)
======================== */
.cs-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

.chat-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-radius: 20px 20px 0 0;
  z-index: 201;
  max-height: 72dvh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  padding-bottom: env(safe-area-inset-bottom);
}

.chat-sheet.open { transform: translateY(0); }

.cs-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

.cs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.cs-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.cs-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 80px;
}

.cs-input-bar {
  display: flex;
  gap: 10px;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  align-items: flex-end;
  flex-shrink: 0;
}

.cs-input-bar textarea {
  flex: 1;
  font-size: 16px;
  border-radius: 16px;
  min-height: 44px;
  max-height: 100px;
  resize: none;
  padding: 10px 14px;
  line-height: 1.4;
  width: auto;
}

.cs-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.5;
  max-width: 88%;
  word-wrap: break-word;
}

.cs-user {
  background: var(--accent);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.cs-assistant {
  background: var(--bg-elevated);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.cs-thinking { display: flex; gap: 4px; align-items: center; padding: 14px; }
.cs-thinking span {
  width: 7px; height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: bounce 1s infinite;
}
.cs-thinking span:nth-child(2) { animation-delay: 0.15s; }
.cs-thinking span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

.exercise-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-subtle);
  border: none;
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
}

.meal-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-subtle);
  border: none;
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
}

.field-row .form-group {
  flex: 1;
}

/* File input */
input[type="file"] {
  display: none;
}

.file-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  transition: border-color 0.2s;
}

.file-label:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* ========================
   SECTION HEADERS
   ======================== */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
}

.section-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

/* ========================
   STATS / SUMMARY CARDS
   ======================== */

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* ========================
   EXERCISE SEARCH
   ======================== */

.search-results {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 4px;
}

.search-result-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover,
.search-result-item:active {
  background: var(--bg-elevated);
}

.search-result-item .result-name {
  font-size: 14px;
  font-weight: 500;
}

.search-result-item .result-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ========================
   ROUTINE BUILDER
   ======================== */

.day-builder {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}

.day-builder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
}

.day-builder-header h4 {
  font-size: 15px;
  font-weight: 600;
}

.day-builder-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
}

.added-exercise {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.added-exercise .ex-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.added-exercise .ex-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.added-exercise .ex-fields input {
  padding: 6px 8px;
  font-size: 12px;
}

/* ========================
   PROGRESS CHART
   ======================== */

.weight-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.weight-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.weight-entry:last-child {
  border-bottom: none;
}

.weight-date {
  font-size: 13px;
  color: var(--text-muted);
}

.weight-val {
  font-size: 18px;
  font-weight: 700;
}

/* ========================
   UTILITIES
   ======================== */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.p-4 { padding: 16px; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.font-bold { font-weight: 700; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 22px; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ========================
   ANIMATIONS
   ======================== */

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.animate-fade-in {
  animation: fade-in 0.3s ease forwards;
}

.animate-slide-up {
  animation: slide-up 0.3s ease forwards;
}

/* ========================
   DIVIDER
   ======================== */

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ========================
   HOME PAGE QUICK CARDS
   ======================== */

.quick-nav-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quick-nav-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, background 0.2s;
}

.quick-nav-card:active {
  background: var(--bg-elevated);
}

.quick-nav-card .qnc-icon {
  font-size: 28px;
}

.quick-nav-card .qnc-label {
  font-size: 15px;
  font-weight: 600;
}

.quick-nav-card .qnc-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.greeting {
  padding: 20px 0 8px;
}

.greeting h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.greeting .day-label {
  font-size: 14px;
  color: var(--text-muted);
}

/* ========================
   TOGGLE SWITCH
   ======================== */

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.toggle-label {
  font-size: 15px;
  font-weight: 500;
}

.toggle {
  position: relative;
  width: 44px;
  height: 26px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-slider:before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-muted);
  top: 2px;
  left: 2px;
  transition: transform 0.2s, background 0.2s;
}

.toggle input:checked + .toggle-slider {
  background: var(--accent-subtle);
  border-color: var(--accent);
}

.toggle input:checked + .toggle-slider:before {
  background: var(--accent);
  transform: translateX(18px);
}

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

.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 200;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  border-color: var(--accent);
  color: var(--accent);
}

.toast.error {
  border-color: var(--error);
  color: var(--error);
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
}

/* ========================
   HOME
   ======================== */

.home-greeting {
  padding: 0.5rem 0 1rem;
}

.greeting-text {
  font-size: 1.4rem;
  font-weight: 700;
}

.day-label {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

.home-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.home-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-decoration: none;
  color: var(--text);
}

.home-card:active {
  background: var(--bg-elevated);
}

.home-card-icon {
  font-size: 1.75rem;
  flex-shrink: 0;
}

.home-card-body {
  flex: 1;
  min-width: 0;
}

.home-card-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.home-card-summary {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.2rem;
}

.home-card-stat {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.chat-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-decoration: none;
  color: var(--text);
}

.chat-cta:active {
  background: var(--bg-card);
}

/* ========================
   CLIENT PROFILE
   ======================== */

.client-profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0 1rem;
}

.client-avatar.large {
  width: 64px;
  height: 64px;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

/* ========================
   DASHBOARD
   ======================== */

.page-inner {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
}

/* ========================
   SCROLLBAR
   ======================== */

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}
