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

:root {
  --green: #83ce18;
  --green-dark: #6fb516;
  --green-vivid: #83ce18;
  --red-vivid: #f53b5f;
  --amber: #ffba24;
  --red-meal: #f53b5f;
  --gray-mid: #929292;
  --text: #1A1A1A;
  --text-muted: #929292;
  --border: #e8ecef;
  --bg: #f9fbfc;
  --white: #ffffff;
  --breakfast: #83ce18;
  --lunch: #ffba24;
  --dinner: #f53b5f;
  --snack: #929292;
  --radius: 14px;
  --tab-h: 64px;
  --header-h: 56px;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ── AUTH ── */
#auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background: var(--white);
}

.auth-box {
  width: 100%;
  max-width: 380px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo h1 { font-size: 28px; font-weight: 700; }
.auth-logo p { color: var(--text-muted); font-size: 15px; margin-top: 4px; }

.auth-box h2 { font-size: 22px; font-weight: 600; margin-bottom: 20px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }

input[type="email"], input[type="password"], input[type="text"],
input[type="date"], input[type="number"], select, textarea {
  width: 100%;
  padding: 13px 15px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  background: var(--white);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
  appearance: none;
  -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus { border-color: var(--green-dark); }
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 12px center;
  padding-right: 36px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 13px 20px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }

.btn-primary { background: var(--green); color: var(--text); width: 100%; }
.btn-primary:hover { background: var(--green-dark); }
.btn-outline { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-sm { padding: 9px 15px; font-size: 14px; border-radius: 8px; }

.auth-toggle { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-muted); }
.auth-toggle a { color: var(--text); font-weight: 600; cursor: pointer; text-decoration: underline; }

.error-msg {
  background: #fee2e2;
  color: #dc2626;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

/* ── APP SHELL ── */
#app-screen { display: none; height: 100vh; flex-direction: column; }
#app-screen.visible { display: flex; }

.app-header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

.app-header h1 { font-size: 20px; font-weight: 700; flex: 1; }

.header-email {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── TAB CONTENT ── */
.tabs-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.tab-pane {
  display: none;
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(var(--tab-h) + 72px);
}
.tab-pane.active { display: block; }

/* ── BOTTOM NAV ── */
.bottom-nav {
  height: var(--tab-h);
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-muted);
  font-family: inherit;
  transition: color .15s;
  padding: 0;
}
.nav-btn.active { color: var(--green-dark); font-weight: 600; }
.nav-btn svg { width: 22px; height: 22px; }

/* ── FAB ── */
.fab {
  position: fixed;
  bottom: calc(var(--tab-h) + 16px);
  right: 16px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--green);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  z-index: 20;
  transition: transform .15s;
}
.fab:active { transform: scale(.93); }
.fab svg { width: 24px; height: 24px; }

.fab-menu {
  position: fixed;
  bottom: calc(var(--tab-h) + 78px);
  right: 16px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity .2s, transform .2s;
}
.fab-menu.open { opacity: 1; pointer-events: auto; transform: translateY(0); }

.fab-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  white-space: nowrap;
  font-family: inherit;
}
.fab-menu-item:hover { background: var(--bg); }

/* ── CARDS ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  margin-bottom: 12px;
}

.meal-type-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 7px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.meal-type-label::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.meal-type-label.breakfast { color: var(--breakfast); }
.meal-type-label.lunch { color: var(--lunch); }
.meal-type-label.dinner { color: var(--dinner); }
.meal-type-label.snack { color: var(--snack); }

.meal-name { font-size: 17px; font-weight: 600; margin-bottom: 5px; line-height: 1.4; }
.meal-details { font-size: 14px; color: var(--text-muted); margin-bottom: 6px; }
.meal-hint { font-size: 13px; color: var(--text-muted); font-style: italic; margin-bottom: 14px; }
.meal-hint a { color: inherit; }

.meal-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.meal-actions .btn { flex: 1; min-width: 100px; }

/* ── COMPACT MEAL BOTTOM ROW ── */
.meal-bottom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.meal-bottom-row .btn { flex-shrink: 0; }

.btn-meal-log {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  border-radius: 7px;
  border: 1.5px solid var(--border);
  background: var(--white);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-muted);
  transition: all .15s;
  white-space: nowrap;
}
.btn-meal-log.logged {
  background: var(--green);
  border-color: var(--green);
  color: var(--text);
  font-weight: 600;
}
.btn-meal-log:active { transform: scale(.96); }

/* ── MEAL STATUS BUTTONS ── */
.meal-status-btns {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-left: auto;
}

.status-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  transition: all .15s;
  flex-shrink: 0;
  color: var(--text-muted);
  font-family: inherit;
}
.status-btn:active { transform: scale(.88); }
.status-btn.planned { background: var(--green-vivid); border-color: var(--green-vivid); color: #fff; }
.status-btn.skipped { background: var(--red-meal); border-color: var(--red-meal); color: #fff; }

.status-label {
  font-size: 12px;
  color: var(--gray-mid);
  font-style: italic;
  white-space: nowrap;
}
.status-label.planned { color: var(--green-vivid); font-style: normal; font-weight: 600; }
.status-label.skipped { color: var(--red-meal); font-style: normal; font-weight: 600; }

/* ── ADHERENCE CARD ── */
.adherence-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.adherence-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 10px;
}
.adherence-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
  display: flex;
  margin-bottom: 10px;
}
.adherence-seg { height: 100%; transition: width .4s ease; }
.adherence-seg.planned { background: var(--green-vivid); }
.adherence-seg.skipped { background: var(--red-meal); }
.adherence-stats {
  display: flex;
  gap: 14px;
  font-size: 13px;
  flex-wrap: wrap;
}
.adherence-stat { display: flex; align-items: center; gap: 4px; font-weight: 500; }
.adherence-stat.planned { color: var(--green-vivid); }
.adherence-stat.skipped { color: var(--red-meal); }
.adherence-stat.untracked { color: var(--gray-mid); }

/* ── DAY SELECTOR ── */
.day-selector-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 16px;
}
.week-arrow {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--white);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-family: inherit;
  transition: background .15s, opacity .15s;
}
.week-arrow:hover:not(:disabled) { background: var(--bg); }
.week-arrow:disabled { opacity: .25; cursor: default; }

.day-selector {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.day-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7px 4px;
  border-radius: 10px;
  background: var(--white);
  border: 1.5px solid var(--border);
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
  min-width: 0;
}
.day-btn .dow { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.day-btn .day-num { font-size: 17px; font-weight: 700; line-height: 1.1; }
.day-btn.today { border-color: #aaa; }
.day-btn.selected { background: var(--green); border-color: var(--green); }
.day-btn.selected .dow, .day-btn.selected .day-num { color: var(--text); }

/* ── DRINKS ── */
.drinks-card {
  background: #edf7d6;
  border: 1px solid #c6e8a0;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  color: #447010;
  margin-bottom: 12px;
}
.drinks-card strong { display: block; margin-bottom: 2px; }

/* ── PLAN EMPTY ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state svg { opacity: .3; margin-bottom: 12px; }
.empty-state p { font-size: 15px; margin-bottom: 16px; }

/* ── CALENDAR ── */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.calendar-header h2 { font-size: 17px; font-weight: 700; }
.cal-nav { background: none; border: 1.5px solid var(--border); border-radius: 8px; width: 36px; height: 36px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 600; color: var(--text-muted); padding: 4px 0; }
.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  position: relative;
  background: var(--white);
  border: 1px solid transparent;
  transition: background .1s;
}
.cal-day:hover { background: var(--bg); }
.cal-day.today { border-color: var(--green-dark); font-weight: 700; }
.cal-day.selected { background: var(--green); }
.cal-day.other-month { color: var(--text-muted); opacity: .5; }
.cal-day .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green-dark); position: absolute; bottom: 4px; }

.cal-detail {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  margin-top: 16px;
}
.cal-detail h3 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.cal-meal-row { padding: 8px 0; border-bottom: 1px solid var(--border); }
.cal-meal-row:last-child { border-bottom: none; }
.cal-meal-row .type { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.cal-meal-row .name { font-size: 14px; }

/* ── SHOPPING ── */
.shopping-toggles {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--bg);
  border-radius: 10px;
  margin-bottom: 10px;
}
.toggle-btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background .2s, color .15s, box-shadow .15s;
  text-align: center;
  white-space: nowrap;
}
.toggle-btn.active {
  background: var(--green);
  color: var(--white);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

.shopping-category { font-size: 13px; font-weight: 700; color: var(--text-muted); margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .5px; }
.shopping-category:first-child { margin-top: 0; }

.shopping-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--white);
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 6px;
  cursor: pointer;
  transition: opacity .15s;
}
.shopping-item.checked { opacity: .55; }
.shopping-item.checked .item-text { text-decoration: line-through; color: var(--text-muted); }

.check-box {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .15s;
}
.check-box.checked { background: var(--green); border-color: var(--green); }

.item-text { flex: 1; font-size: 15px; }
.item-qty { font-size: 14px; color: var(--text-muted); }

/* ── DIARY ── */
.diary-date-group { margin-bottom: 20px; }
.diary-date-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
  padding-left: 2px;
}

.diary-entry {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.diary-entry-body { flex: 1; }
.diary-meal-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  margin-bottom: 4px;
  text-transform: uppercase;
}
.diary-meal-badge.breakfast { background: #e8f8d0; color: var(--breakfast); }
.diary-meal-badge.lunch { background: #fff4d6; color: #c8900a; }
.diary-meal-badge.dinner { background: #fde0e6; color: var(--dinner); }
.diary-meal-badge.snack { background: #f0f0f0; color: var(--snack); }

.diary-status { font-size: 14px; font-weight: 500; }
.diary-dish { font-size: 13px; color: var(--text-muted); }
.diary-comment { font-size: 12px; color: var(--text-muted); margin-top: 2px; font-style: italic; }
.diary-delete { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; flex-shrink: 0; }
.diary-delete:hover { color: #dc2626; }

/* ── PROFILE ── */
.profile-section { margin-bottom: 24px; }
.profile-section h3 { font-size: 17px; font-weight: 700; margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

.q-section { margin-bottom: 8px; border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.q-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: var(--white); cursor: pointer;
  font-size: 15px; font-weight: 700; user-select: none;
}
.q-section-header .q-arrow { font-size: 12px; color: var(--text-muted); transition: transform .2s; }
.q-section-header.open .q-arrow { transform: rotate(180deg); }
.q-section-body { padding: 16px; background: var(--white); display: none; }
.q-section-body.open { display: block; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s;
  margin-bottom: 12px;
}
.upload-area:hover { border-color: var(--green-dark); }
.upload-area input[type="file"] { display: none; }
.upload-area p { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

.menu-info {
  background: #edf7d6;
  border: 1px solid #c6e8a0;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  color: #447010;
  margin-bottom: 16px;
}

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

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal-sheet {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--white);
  border-radius: 20px 20px 0 0;
  padding: 20px 20px 32px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }

.modal-handle { width: 36px; height: 4px; background: var(--border); border-radius: 2px; margin: 0 auto 16px; }
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; }

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--bg);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-muted);
}

.ingredients-list { list-style: none; }
.ingredients-list li { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.ingredients-list li:last-child { border-bottom: none; }

.instructions { font-size: 14px; line-height: 1.7; color: var(--text); background: var(--bg); padding: 12px; border-radius: 8px; margin-top: 8px; }

/* ── AI CHAT ── */
.chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.chat-overlay.open { opacity: 1; pointer-events: auto; }

.chat-panel {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--white);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  height: 92vh;
  transform: translateY(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.chat-overlay.open .chat-panel { transform: translateY(0); }

.chat-header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.chat-header h3 { flex: 1; font-size: 16px; font-weight: 700; }
.chat-close { background: var(--bg); border: none; border-radius: 50%; width: 32px; height: 32px; cursor: pointer; font-size: 18px; color: var(--text-muted); display: flex; align-items: center; justify-content: center; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}
.chat-msg.user { background: var(--green); align-self: flex-end; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.chat-msg.assistant { background: var(--bg); align-self: flex-start; border-bottom-left-radius: 4px; }
.chat-msg.assistant strong { font-weight: 700; }
.chat-msg.assistant em { font-style: italic; }
.chat-msg.assistant code { background: #eee; padding: 1px 5px; border-radius: 3px; font-size: .88em; font-family: monospace; }

.chat-typing { display: flex; gap: 4px; align-items: center; padding: 10px 14px; background: var(--bg); border-radius: 16px; border-bottom-left-radius: 4px; align-self: flex-start; }
.chat-typing span { width: 7px; height: 7px; background: var(--text-muted); border-radius: 50%; animation: bounce .9s infinite; }
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,60%,100%{ transform:translateY(0) } 30%{ transform:translateY(-6px) } }

.chat-input-row {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.chat-input-row textarea {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 10px 14px;
  border-radius: 22px;
  resize: none;
  font-size: 14px;
  overflow-y: auto;
}
.chat-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--green);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: flex-end;
}
.chat-send:disabled { opacity: .4; pointer-events: none; }
.chat-send svg { width: 20px; height: 20px; }

/* ── MISC ── */
.section-title { font-size: 20px; font-weight: 700; margin-bottom: 16px; }
.week-label { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; }
.hint-text { font-size: 14px; color: var(--text-muted); margin-bottom: 12px; }
.hint-link { color: var(--green-dark); cursor: pointer; font-weight: 600; }

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--green-dark);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 32px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── TRIAL BANNER ── */
.trial-banner {
  background: #fff8e1;
  border-bottom: 1px solid #ffe082;
  padding: 8px 16px;
  font-size: 13px;
  color: #7a5c00;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.trial-banner a {
  color: var(--amber);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  margin-left: auto;
}

/* ── PAYWALL MODAL ── */
.paywall-limit-badge {
  display: inline-block;
  background: #ffe0e6;
  color: var(--red-meal);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.paywall-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.3;
}
.paywall-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.6;
}
.paywall-perks {
  list-style: none;
  margin-bottom: 20px;
}
.paywall-perks li {
  font-size: 14px;
  padding: 5px 0;
  display: flex;
  gap: 8px;
  align-items: center;
}
.paywall-perks li::before {
  content: '✓';
  color: var(--green-vivid);
  font-weight: 700;
  flex-shrink: 0;
}
.paywall-success {
  text-align: center;
  padding: 24px 0;
}
.paywall-success .big-icon { font-size: 48px; margin-bottom: 12px; }
.paywall-success p { font-size: 15px; color: var(--text-muted); line-height: 1.6; }

/* ── ADMIN PANEL ── */
.admin-sub-tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--bg);
  border-radius: 10px;
  margin-bottom: 16px;
}
.admin-sub-tab {
  flex: 1;
  padding: 7px 12px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background .2s, color .15s, box-shadow .15s;
  text-align: center;
}
.admin-sub-tab.active {
  background: var(--green);
  color: var(--white);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

.admin-stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.admin-stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  text-align: center;
}
.admin-stat-card .val { font-size: 24px; font-weight: 700; color: var(--text); }
.admin-stat-card .lbl { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.admin-user-row {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
}
.admin-user-email { font-size: 14px; font-weight: 600; margin-bottom: 4px; word-break: break-all; }
.admin-user-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.admin-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.admin-badge.premium { background: #e8f8d0; color: #3a8a10; }
.admin-badge.trial { background: #fff4d6; color: #9a6800; }
.admin-badge.expired { background: #fde0e6; color: var(--red-meal); }

.admin-request-row {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
}
.admin-request-contact { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.admin-request-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.admin-request-msg {
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  font-style: italic;
}

/* ── AI MENU PREVIEW ── */
.ai-menu-gen-intro {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.6;
}
.ai-menu-loading {
  text-align: center;
  padding: 36px 0;
}
.ai-menu-loading p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 14px;
  line-height: 1.6;
}
.ai-menu-preview-day {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--bg);
}
.ai-menu-day-header {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text);
}
.ai-menu-meal {
  display: flex;
  gap: 6px;
  font-size: 13px;
  padding: 2px 0;
  align-items: baseline;
}
.ai-menu-meal-lbl {
  font-weight: 600;
  flex-shrink: 0;
  width: 72px;
}
.ai-menu-meal-lbl.breakfast { color: var(--breakfast); }
.ai-menu-meal-lbl.lunch { color: var(--lunch); }
.ai-menu-meal-lbl.dinner { color: var(--dinner); }
.ai-menu-meal-lbl.snack { color: var(--snack); }
.ai-menu-meal-name { color: var(--text); }
.ai-menu-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  position: sticky;
  bottom: 0;
  background: var(--white);
  padding: 12px 0 4px;
}

/* AI Plans list */
.ai-plans-list { display: flex; flex-direction: column; gap: 12px; padding-bottom: 8px; }
.ai-plan-item {
  background: var(--surface);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ai-plan-meta { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ai-plan-dates { font-weight: 600; font-size: 15px; color: var(--text); }
.ai-plan-created { font-size: 12px; color: var(--text-muted); }
.ai-plan-draft-badge { font-size: 11px; font-weight: 600; background: #fef3c7; color: #92400e; border-radius: 6px; padding: 1px 7px; }
.ai-plan-preview { font-size: 13px; color: var(--text-muted); line-height: 1.4; }
.ai-plan-apply-btn { align-self: flex-start; padding: 8px 18px; font-size: 14px; }
.ai-plan-actions { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }

@media (min-width: 480px) {
  .tab-pane { padding-left: calc(50vw - 224px); padding-right: calc(50vw - 224px); }
  .bottom-nav { max-width: 480px; left: 50%; transform: translateX(-50%); position: fixed; bottom: 0; width: 100%; }
  .fab { right: calc(50vw - 224px); }
  .fab-menu { right: calc(50vw - 224px); }
  .app-header { max-width: 480px; margin: 0 auto; position: sticky; }
}

/* ─────────────────────────────────────────────
   DIARY SUB-TABS
───────────────────────────────────────────── */
.diary-subtabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--bg);
  border-radius: 10px;
  margin-bottom: 12px;
}
.diary-subtab {
  flex: 1;
  padding: 9px 12px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s, color .15s, box-shadow .15s;
  font-family: inherit;
  text-align: center;
}
.diary-subtab.active {
  background: var(--green);
  color: var(--white);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

/* ─────────────────────────────────────────────
   HEALTH DIARY ENTRIES
───────────────────────────────────────────── */
.health-date-group { margin-bottom: 20px; }
.health-date-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
  padding-left: 2px;
}
.health-entry {
  background: var(--white);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.health-entry-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.bp-entry { padding: 10px 14px; }
.bp-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bp-time-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 40px;
}
.health-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.health-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg);
  color: var(--text);
}
.health-chip.good { background: #e6f9d0; color: #3a7d00; }
.health-chip.warn { background: #fff3cd; color: #856404; }
.health-chip.bad  { background: #fde8e8; color: #c0392b; }
.health-entry-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-line;
}

/* ─────────────────────────────────────────────
   ZEPP PROFILE SECTION
───────────────────────────────────────────── */
.zepp-status-bar {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 10px;
  background: #e6f9d0;
  color: #3a7d00;
}

/* ── Zepp instruction (collapsible) ── */
.zepp-guide {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  margin: 10px 0;
  overflow: hidden;
}
.zepp-guide-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  user-select: none;
  background: var(--bg);
}
.zepp-guide-toggle::-webkit-details-marker { display: none; }
.zepp-guide-toggle::after {
  content: '▸';
  font-size: 13px;
  color: var(--text-muted);
  transition: transform .2s;
}
details[open] .zepp-guide-toggle::after { transform: rotate(90deg); }
.zepp-guide-body {
  padding: 4px 14px 14px;
  border-top: 1px solid var(--border);
  background: var(--white);
}
.zepp-guide-section { margin-top: 14px; }
.zepp-guide-step-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.zepp-guide-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.zepp-guide-list li { font-size: 13px; line-height: 1.5; color: var(--text); }
.zepp-guide-note {
  margin-top: 8px;
  padding: 8px 10px;
  background: #f0f9e0;
  border-radius: 7px;
  font-size: 12px;
  color: #4a7c00;
  line-height: 1.5;
}

.zepp-key-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}
.zepp-key-row input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--white);
  color: var(--text);
}
.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 13px;
}

/* ─────────────────────────────────────────────
   MEAL SWAP MODAL
───────────────────────────────────────────── */
.swap-source-label {
  font-size: 13px;
  color: var(--text-muted);
  padding: 4px 0 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
/* Sections */
.swap-section { margin-bottom: 14px; }
.swap-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
/* Custom input row */
.swap-custom-row {
  display: flex;
  gap: 8px;
}
.swap-custom-input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: var(--white);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.swap-custom-input:focus { border-color: var(--primary); }
.swap-custom-save {
  flex-shrink: 0;
  padding: 9px 16px;
  font-size: 14px;
}
/* List */
.swap-list { max-height: 42vh; overflow-y: auto; }
.swap-option {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  margin-bottom: 6px;
  transition: background .15s;
}
.swap-option:hover { background: var(--bg); }
.swap-opt-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.swap-opt-left {
  display: flex;
  flex-direction: column;
  min-width: 40px;
  flex-shrink: 0;
}
.swap-opt-date { font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.2; }
.swap-opt-diff { font-size: 11px; color: var(--text-muted); }
.swap-opt-name { flex: 1; font-size: 14px; color: var(--text); }
.swap-opt-recipe-badge {
  font-size: 10px;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 1px 5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.swap-opt-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.btn-swap-action {
  font-size: 12px;
  font-family: inherit;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: var(--white);
  color: var(--text);
  transition: background .15s, color .15s;
}
.btn-swap-copy {
  border-color: var(--primary);
  color: var(--primary);
}
.btn-swap-copy:hover { background: var(--primary); color: #fff; }
.btn-swap-swap:hover { background: var(--bg); }

/* ── Monday picker ── */
.monday-picker { margin-top: 4px; }
.monday-picker-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.monday-option {
  display: block;
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.monday-option:hover { background: var(--primary-light, #f0f9e0); border-color: var(--primary); }
.monday-week-tag { font-size: 11px; color: var(--text-muted); margin-left: 4px; }

/* ── AI plans inline ── */
.ai-plans-inline { margin-top: 4px; }


/* ── Strategy display ── */
.strategy-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.strategy-actions .btn { flex: 1 1 0; min-width: 0; text-align: center; display: flex; align-items: center; justify-content: center; }
.strategy-display {
  margin-top: 16px;
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

/* ── Strategy collapsible ── */
.strategy-header {
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; font-weight: 600; font-size: 14px;
  padding: 4px 0 8px;
  user-select: none;
}
.strategy-body { font-size: 14px; line-height: 1.65; }

/* ── Plan detail ── */
.plan-detail { margin-top: 10px; }
.plan-detail-inner { display: flex; flex-direction: column; gap: 12px; }
.pd-day { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.pd-day-title {
  background: var(--bg); padding: 8px 12px;
  font-weight: 600; font-size: 13px; color: var(--text-muted);
}
.pd-meal { padding: 8px 12px; border-top: 1px solid var(--border); }
.pd-meal-name { font-weight: 600; font-size: 14px; margin-bottom: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pd-meal-details { font-size: 12px; color: var(--text-muted); margin-bottom: 3px; }
.pd-meal-ingr { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.pd-recipe { font-size: 13px; }
.pd-recipe summary { cursor: pointer; color: var(--primary-dark, #5a8a00); font-weight: 500; padding: 2px 0; }
.pd-recipe p { margin: 6px 0 0; white-space: pre-wrap; line-height: 1.55; }
.pd-drinks { padding: 6px 12px; font-size: 13px; color: var(--text-muted); border-top: 1px solid var(--border); }
.pd-shopping { border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.pd-section-title { font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.pd-cat-title { font-weight: 600; font-size: 13px; color: var(--text-muted); margin: 8px 0 4px; }
.pd-cat-list { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.7; }
