:root {
  --accent-color: #5ce1e6;
  --bg: #f5f5f5;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  box-sizing: border-box;
  height: 100%;
}

#splash {
  position: fixed;
  inset: 0;
  background: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#splash.hidden {
  opacity: 0;
  visibility: hidden;
}

#splash .pan {
  font-size: 50px;
  animation: jiggleSpin 3s ease-in-out infinite;
  transform-origin: center;
  margin-bottom: 12px;
}

.splash-text {
  font-size: 18px;
  color: #333;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.emoji {
  font-size: 22px;
}

#dots,
#dots-loading {
  display: inline-block;
  min-width: 1.5em;
  text-align: left;
  vertical-align: bottom;
}

#app {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  height: 100dvh;
  box-sizing: border-box;
}

#chat {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  margin: 0 16px;
  padding-bottom: 90px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.message {
  max-width: 80%;
  padding: 10px 15px;
  border-radius: 18px;
  font-size: 16px;
  line-height: 1.4;
  animation: fadeIn 0.3s ease forwards;
}

.message.ai {
  white-space: pre-wrap;
}

.user {
  background: #49d6db;
  color: white;
  text-shadow: 0 0px 2px rgba(0, 0, 0, 0.3);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.ai {
  background: #e5e5ea;
  color: #333;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-style: italic;
  color: #666;
  font-size: 15px;
  align-self: center;
  animation: fadeIn 0.3s ease forwards;
}

.loading .pan {
  font-style: normal;
  font-size: 40px;
  animation: jiggleSpin 3s ease-in-out infinite;
  transform-origin: center;
  margin-bottom: 5px;
}

.loading-text {
  margin-top: 10px;
  font-size: 18px;
  color: #333;
  font-style: normal;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

@keyframes jiggleSpin {
  0%   { transform: translate(0, 0) rotate(0deg); }
  6%   { transform: translate(-4px, -4px) rotate(0deg); }
  14%  { transform: translate(4px, 4px) rotate(0deg); }
  22%  { transform: translate(-2px, -2px) rotate(0deg); }
  30%  { transform: translate(1px, 1px) rotate(0deg); }
  33%  { transform: translate(0px, 0px) rotate(0deg); }
  100% { transform: translate(0px, 0px) rotate(360deg); }
}

.typing-bubble {
  display: inline-flex;
  gap: 4px;
  padding: 10px 14px;
  background: #e5e5ea;
  border-radius: 16px;
  max-width: 60px;
}
.typing-bubble .dot {
  width: 6px;
  height: 6px;
  background-color: #555;
  border-radius: 50%;
  animation: blink 1.4s infinite ease-in-out both;
}
.typing-bubble .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

/* Button Styles Shared (Modal + Onboarding) */
.chat-button {
  flex: 1 0 0;           /* ✅ Equal width distribution */
  width: 100%;           /* ✅ Force equal size */
  max-width: 280px;      /* ✅ Keeps desktop sizes tidy */
  white-space: nowrap;   /* ✅ Prevents wrapping */
  text-align: center;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: bold;
  border-radius: 4px;
  border: 2px solid;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-button:active {
  transform: scale(0.96);
}

.chat-button.green {
  border-color: #28a745;
  color: #000000;
}

.chat-button.green:hover {
  background: rgba(40, 167, 69, 0.15);
  color: #28a745;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chat-button.red {
  border-color: #dc3545;
  color: #000000;
}

.chat-button.red:hover {
  background: rgba(220, 53, 69, 0.15);
  color: #dc3545;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Onboarding CTA Container */
.cta-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
  padding-bottom: 2px;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeSlideUp 0.4s ease-out forwards;
  animation-delay: 0.4s;
}

/* Onboarding Specific Override */
.onboarding-button {
  width: auto;
  min-width: 240px;
  max-width: 100%;
}

@keyframes fadeSlideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 520px) {
  .cta-buttons {
    flex-direction: column;
    align-items: center;
  }

  .chat-button {
    width: 100%;
    max-width: 280px;
  }
}

/* Tab Bar Styles */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70px; 
  background: linear-gradient(to bottom, #ffffff 60px, var(--accent-color) 60px);
  border-top: 1px solid #ddd;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.05);
  z-index: 100;
  box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.05), 
              0 2px 10px rgba(0, 0, 0, 0.06); /* subtle upward and downward shadow */
  padding-bottom: env(safe-area-inset-bottom);
}

.tab-bar a {
  flex: 1;
  text-decoration: none;
  color: #444;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.tab-bar a:last-child {
  border-right: none;
}

.tab-bar a span {
  font-size: 22px;
  display: block;
  line-height: 1.2;
}

.tab-bar a.active {
  color: #000;
  font-weight: bold;
  background-color: var(--accent-color);
  opacity: 0.9;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.06); /* soft upward lift */
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-bottom: none; /* prevent visible seam between tabs */
  z-index: 2; /* ensures it's above other tabs visually */
}

/* Modal Specific */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal.hidden {
  display: none;
  pointer-events: none;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  padding: 24px 20px;
  border-radius: 12px;
  max-width: 440px;
  width: 80%;
  min-width: 280px;
  margin: 0 16px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  font-size: 16px;
  color: #333;
  line-height: 1.4;
}

.modal-content strong {
  display: block;
  font-size: 22px;
}

.checkbox-row {
  margin-top: 14px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.modal-actions {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.modal-actions a {
  display: inline-block;
  width: 100%;
  max-width: 280px;
  flex: 1 1 0;
}

.modal.active .modal-content {
  opacity: 1;
  transform: translateY(0);
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.chip {
  padding: 6px 10px;
  border: 1px solid var(--primary-color, #ccc);
  border-radius: 20px;
  background: #f8f8f8;
  cursor: pointer;
}
.chip.active {
  background: var(--primary-color, #333);
  color: white;
}
textarea {
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  margin-bottom: 12px;
}

/* Page Fade-In Transition */
body {
  opacity: 0;
  transition: opacity 0.4s ease;
}

body.fade-in {
  opacity: 1;
}
/* Fix: Ensure tab active state shows after fade-in completes */
body:not(.ready) .tab-bar a.active {
  opacity: 0;
  pointer-events: none;
}

body.ready .tab-bar a.active {
  opacity: 1;
}

.save-button,
.copy-button {
  font-size: 16px;
  padding: 4px 6px;
  background: transparent;
  color: #666;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.3s ease;
}

.save-button:hover,
.copy-button:hover {
  color: #000;
  background-color: transparent;
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.15);
}

.button-group {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
}

#filters button {
  background-color: white;
  border: 1px solid #ccc;
  color: #333;
  font-size: 14px;
  padding: 6px 10px;
  margin-right: 6px;
  border-radius: 6px;
  cursor: pointer;
}

#filters button:hover {
  background-color: #f2f2f2;
}

/* === Notebook Styles === */

.notebook-container {
  padding: 24px;
  padding-bottom: 100px;
  max-width: 800px;
  margin: auto;
  background-color: var(--bg);
}

.notebook-controls-inner {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.page-title {
  font-size: 26px;
  font-weight: bold;
  color: #333;
  margin-bottom: 14px;
}

.notebook-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

#searchInput {
  flex: 1;
  padding: 8px 12px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 8px;
}

.active-filter {
  background-color: rgba(92, 225, 230, 0.2);
  color: #2c7d80;
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
}

.clear-filter-button {
  background: none;
  border: none;
  color: #999;
  font-size: 14px;
  cursor: pointer;
}

.clear-filter-button:hover {
  color: #000;
}

.filter-buttons {
  margin-bottom: 20px;
}

.filter-button {
  background-color: white;
  border: 1px solid #ccc;
  color: #333;
  font-size: 14px;
  padding: 6px 12px;
  margin-right: 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-button:hover {
  background-color: #f2f2f2;
  color: #000;
}

.saved-message {
  padding: 14px 18px;
  background: #fff;
  border-radius: 12px;
  margin-bottom: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.saved-message .card-title {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 4px;
  color: #222;
}

.saved-message .card-summary {
  font-size: 14px;
  color: #555;
  margin-bottom: 10px;
  line-height: 1.5;
}

.saved-message .card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.saved-message .message-content {
  font-size: 15px;
  line-height: 1.6;
  color: #333;
  white-space: pre-wrap;
}

/* Modal Specific */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  padding: 24px;
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.modal.active .modal-content {
  opacity: 1;
  transform: translateY(0);
}

.modal input,
.modal textarea {
  font-family: inherit;
  font-size: 16px;
  line-height: 1.4;
}

.modal-type {
  font-size: 14px;
  color: var(--accent-color);
  font-weight: bold;
  margin-bottom: 8px;
}

.modal-body {
  font-size: 15px;
  line-height: 1.6;
  color: #333;
}

/* Markdown Cleanup */
.modal-body h1,
.modal-body h2,
.modal-body h3 {
  font-size: 17px;
  margin: 16px 0 6px;
  font-weight: 600;
}

.modal-body p {
  margin: 4px 0;
  line-height: 1.5;
}

.modal-body strong {
  font-weight: 600;
  font-size: inherit; /* prevents it from looking like a heading */
}

.modal-body ul {
  margin: 6px 0 16px 0;
  padding-left: 20px;
}

.modal-body li {
  margin-bottom: 4px;
  line-height: 1.4;
}

.modal-content hr {
  margin: 24px 0;  /* or adjust as needed */
  border: none;
  border-top: 1px solid #ccc;  /* optional: custom styling */
}

.close-button {
  position: absolute;
  top: 12px;
  right: 16px;
  cursor: pointer;
  font-size: 20px;
  color: #999;
}

.close-button:hover {
  color: #000;
}

.tag {
  background-color: rgba(92, 225, 230, 0.2); /* soft teal */
  color: #2c7d80; /* deeper brand-aligned tone */
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.tag:hover {
  background-color: rgba(92, 225, 230, 0.35);
}

.search-wrapper {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto 12px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: #999;
  pointer-events: none;
}

#searchInput {
  width: 100%;
  padding: 10px 18px 10px 42px; /* match card side padding (18px) + 24px for icon space */
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-sizing: border-box;
}

.filter-status-row {
  max-width: 800px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tag.placeholder {
  opacity: 0.7;
  font-style: italic;
  background: transparent;
  border: 1px dashed var(--accent-color);
  color: var(--accent-color);
}

.tag.removeable {
  background-color: rgba(92, 225, 230, 0.25);
  color: #2c7d80;
  font-size: 12px;
  padding: 4px 8px 4px 10px;
  border-radius: 12px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
}

.tag.removeable .x {
  margin-left: 6px;
  color: #666;
  font-weight: bold;
}
.tag.removeable:hover {
  background-color: rgba(92, 225, 230, 0.35);
}

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #333;
  color: #fff;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 99999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  text-align: center;
  max-width: 80%;
}

.toast.show {
  opacity: 1;
}

.toast.hidden {
  display: none;
}

/* Loading toast layout + readable text on dark chip */
.toast .loading { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
}

.toast .loading .loading-text {
  color: #fff;           /* ensure it shows on the dark toast */
  white-space: nowrap;   /* keep text on one line */
}

/* Fix the dot container width so the toast doesn't grow/shrink */
.toast .loading #dots-toast {
  display: inline-block;
  width: 1.5em;          /* room for 3 dots */
  text-align: left;
}

/* Dim background for loading state */
#toastBackdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.28); /* tweak to taste */
  backdrop-filter: blur(1px);   /* subtle polish */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 99980;
}

#toastBackdrop.show {
  opacity: 1;
  pointer-events: auto; /* blocks clicks while loading */
}

.calendar-week {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
}

.calendar-wrapper {
  width: min(700px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calendar-month-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-weight: bold;
  font-size: 18px;
}

.nav-arrow {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
}

.calendar-month-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  font-weight: bold;
  font-size: 0.85rem;
  color: #666;
  padding: 0 2px;
  text-align: center;         /* ✅ add this */
  justify-items: center;      /* ✅ and this */
}

.calendar-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  min-width: 100%;
  gap: 4px;
  margin-top: 2px;
  align-items: stretch;
  grid-auto-rows: 100px;
}

.calendar-month-day {
  border: 1px solid #ccc;
  padding: 4px;
  box-sizing: border-box;
  height: 100%;
  overflow: hidden;
  min-width: 0;
  font-size: 0.9rem;
  position: relative;
  background: white;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;    /* ← avoid top/bottom stretch weirdness */
}

.calendar-month-day.today {
  border: 2px solid #5ce1e6;
  background: #eaffff;
}

.calendar-month-day .day-label {
  font-weight: bold;
  margin-bottom: -4px;
}

.calendar-month-day .meal-pill {
  display: inline-block;
  font-size: 0.7rem;
  margin-top: 2px;
  width: fit-content;
  white-space: nowrap;
}

.pill-row {
  display: flex;
  flex-direction: column;
  align-items: flex-end; /* 👈 aligns pills to the right */
  gap: 0px;
  margin-top: auto;
}

.calendar-month-grid.collapsed,
.calendar-month-headers.collapsed {
  opacity: 0;
  transform: scaleY(0.95);
  pointer-events: none;
  transition: all 0.3s ease;
}

.calendar-day.active {
  outline: 2px solid var(--accent-color);
  background: #e6fcff;
}

.calendar-days.collapsed {
  display: none;
}

.calendar-month-day.empty {
  background: #f9f9f9;
  border: 1px solid #eee;
  cursor: default;
}

.day-label.dimmed {
  color: #bbb;
}

/* === Week Grid (shares month grid look) === */

/* Hide week grid when collapsed */
#calendarWeek.collapsed {
  display: none;
}

/* Optional but nice: selected day highlight (distinct from "today") */
.calendar-month-day.active {
  border: 2px solid var(--accent-color, #5ce1e6);
  background: #e6fcff;
}

/* Small helper class in case you want to tweak spacing for week grid only */
.calendar-week-grid {
  margin-top: 2px; /* match .calendar-month-grid */
}

.nav-arrow {
  background: none;
  border: none;
  font-size: 1.7em;
  color: var(--accent-color, #5ce1e6);
  cursor: pointer;
  padding: 0 10px;
  transition: color 0.18s;
}
.nav-arrow:active {
  color: #43a047;
}
.calendar-week-info {
  font-weight: 600;
  font-size: 1.1em;
  margin: 0 12px;
  min-width: 120px;
  text-align: center;
}
.calendar-days {
  display: flex;
  gap: 8px;
  flex: 1;
  justify-content: center;
}
.calendar-day {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e0f7fa;
  min-width: 90px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  cursor: pointer;
  position: relative;
  transition: box-shadow 0.18s;
}

.calendar-day-label {
  font-size: 0.98em;
  font-weight: 500;
  margin-bottom: 2px;
}

/* Week grid only: make 'today' subtle unless selected */
#calendarWeek .calendar-month-day.today:not(.active) {
  border: 1px solid #e6e6e6;  /* reset width + color */
  background: #fff;           /* remove the blue fill */
}

#calendarWeek .calendar-month-day.today::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 6px;
  width: 6px;
  height: 6px;
  background: var(--accent-color, #5ce1e6);
  border-radius: 50%;
  opacity: 0.85;
}

/* 📆 Collapse month to week view */
#monthControls.collapsed,
#calendarMonth.collapsed,
#calendarHeaders.collapsed {
  display: none;
}

#calendarDays {
  display: block;
  margin-bottom: 12px;
  transition: max-height 0.3s ease;
}

#calendarDays.collapsed {
  max-height: 0;
  overflow: hidden;
}

.day-scroll-container {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding: 4px 0;
}

.tag.meal-pill {
  font-size: 0.83rem;
  padding: 2px 8px;
  border-radius: 12px;
  margin-bottom: 2px;
  background: #e0f7fa;
  color: #222;
  cursor: grab;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  margin-right: 2px;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none; /* prevent iOS copy/lookup menu */
  touch-action: manipulation;  /* hint: tap/scroll only */
}

/* Mobile tighten */
@media (max-width: 520px) {
  .tag.meal-pill {
    font-size: 0.64rem;  /* ~12.5px */
    padding: 1px 6px;
    /*border-radius: 10px;*/
  }
}

/* Mobile/touch only: remove tap flash on calendar tiles */
@media (hover: none) and (pointer: coarse) {
  .calendar-month-day,
  .calendar-day {
    -webkit-tap-highlight-color: transparent; /* iOS Safari */
  }
}

/* When the drawer is open, hide the CTA block and the planner-page disclaimer that follows it */
body:has(#dayDrawer.open) .cta-buttons,
body:has(#dayDrawer.open) .cta-buttons + .ai-disclaimer {
  display: none !important;
}

.tag.meal-pill.more {
  background: #e0e0e0;
  color: #888;
  cursor: default;
}
/* === Chat Input Textarea === */
#inputWrapper {
  background: var(--bg);
  margin-top: 8px; /* space from chat box */
  padding: 0 16px calc(70px + env(safe-area-inset-bottom)) 16px; /* lift off tab bar */
  display: flex;
  justify-content: center;
  z-index: 10;
  flex-direction: column;
}

.input-container {
  flex: 1;
  max-width: 100%;
  margin: 0;
  background: white;
  border: 1px solid #ccc;
  border-radius: 12px;
  padding: 6px 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#userInput {
  padding: 6px;
  font-size: 16px;
  line-height: 1.4;
  min-height: 37px;
  max-height: 150px;
  height: auto;
  overflow-y: auto;
  resize: none;
  border: none;
  outline: none;
  font-family: inherit;
  transition: height 0.1s ease-in-out;
  box-sizing: border-box;
  margin-bottom: 0;
}

#textarea-clone {
  position: absolute;
  top: -9999px;
  left: -9999px;
  visibility: hidden;
  white-space: pre-wrap;
  word-wrap: break-word;
  height: auto;
  overflow: hidden;
  padding: 6px;
  font-size: 16px;
  line-height: 1.4;
  font-family: inherit;
  box-sizing: border-box;
}

#userInput::placeholder {
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 1.4em;
  display: block;
}

.input-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 6px;
  border-top: 1px solid #eee;
  margin-top: 0px;
}

.left-buttons,
.right-buttons {
  display: flex;
  gap: 10px;
}

.meal-modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  padding-top: 12px;
  margin-top: 12px;
}

.modal-icon-btn {
  font-size: 20px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.2s;
}

.icon-btn {
  font-size: 18px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 0.2s;
}

.icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

#sendButton {
  background-color: #49d6db;
  color: white;
  text-shadow: 0 0px 2px rgba(0, 0, 0, 0.3);
  font-weight: bold;
  padding: 8px 16px;
  font-size: 15px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

#sendButton:hover {
  background-color: #49d6db;
}

#sendButton:active {
  transform: scale(0.96);
}

.day-drawer {
  position: fixed;
  top: 220px;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: calc(100vh - 130px);
  background: white;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
  border-radius: 12px 12px 0 0;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  z-index: 1000;
  overflow-y: auto;
}

.day-drawer.open {
  transform: translateY(0);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  font-weight: 600;
}

.drawer-close {
  font-size: 24px;
  background: none;
  border: none;
  cursor: pointer;
  color: #888;
}

.drawer-content {
  padding: 16px;
}

.drawer-meal {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 16px;
}

.drawer-meal img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: #f2f2f2;
}

.drawer-meal .info {
  flex: 1;
}

.drawer-meal .actions button {
  margin-left: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
}

/* Week Planner inline layout */
.week-options {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap; /* good for mobile fallback */
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.week-options select,
.week-options input[type="date"] {
  padding: 4px 4px;
  font-size: 0.875rem;
  border-radius: 6px;
  border: 1px solid #ccc;
}

.hidden {
  display: none !important;
}

.drawer-meal {
  margin-bottom: 24px;
}

.drawer-meal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  width: 100%;
}

.drawer-meal-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  align-items: center;
}

.meal-type {
  font-size: 22px;
  font-weight: 600;
}

.meal-emoji {
  font-size: 22px;
}

.drawer-meal-actions button {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  margin-left: 6px;
}

.meal-title {
  font-size: 16px;
  font-weight: 500;
  margin: 2px 0;
}

.meal-description {
  font-size: 14px;
  line-height: 1.4;
  color: #333;
  margin: 2px 0 4px;
}

.meal-macros {
  font-size: 13px;
  font-style: italic;
  color: #666;
  margin-bottom: 8px;
}

.drawer-divider {
  border: none;
  border-bottom: 1px solid #eee;
}

.meal-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tooltip-bubble {
  position: fixed;
  transform: translateX(-50%) translateY(-100%);
  background: #333;
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: opacity 0.2s ease;
  opacity: 0.95;
}

/* === AI Disclaimer tweaks === */
.ai-disclaimer {
  display: flex;
  align-items: center;
  justify-content: center;   /* center the line */
  gap: 2px;
  margin-top: 6px;
  margin-bottom: 8px;
  font-size: 9px;
  line-height: 1.3;
  color: rgba(0, 0, 0, 0.7);
  text-align: center;        /* center the text itself */
  font-style: italic;
}

/* Base: make the disclaimer span the row & center its contents */
.cta-buttons + .ai-disclaimer {
  display: flex;
  justify-content: center;
  width: 100%;
}

/* Mobile: cap width but keep the whole block centered */
@media (max-width: 520px) {
  #planner .cta-buttons + .ai-disclaimer,
  #dayDrawer .ai-disclaimer {
    width: auto;            /* allow it to shrink */
    max-width: 280px;       /* your existing constraint */
    margin-inline: auto;    /* center the block itself */
  }
}

#drawerContent .ai-disclaimer {
  max-width: 280px;
}

.ai-disclaimer-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  color: var(--accent-color, #5ce1e6);
}

.ai-disclaimer-trigger:focus-visible {
  outline: 2px solid var(--accent-color, #5ce1e6);
  outline-offset: 2px;
}

/* Inline, text-like button so wrapping is natural */
.ai-disclaimer-inline {
  all: unset;                 /* strip default button styles */
  display: inline;            /* participate in text flow */
  cursor: pointer;
  font: inherit;
  line-height: inherit;
  color: inherit;
}

/* Focus style for accessibility */
.ai-disclaimer-inline:focus-visible {
  outline: 2px solid var(--accent-color, #5ce1e6);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Icon that sits on the baseline like the first word */
.ai-i{
  display:inline-block;
  font-size:11px;
  color:#009da3;
  margin-right:2px;
  margin-top: -3px;
  vertical-align:text-top;
  background:rgba(92,225,230,.18);
  border: 0.6px solid #009da3;
  border-radius:999px;
  padding:0px 3px;
}

.ai-disclaimer-icon { font-size: 12px; line-height: 1; }

/* Chat page: when injected after the input container, center & constrain a bit */
.input-container + .ai-disclaimer {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

#ai-legal-disclaimer .modal-body { text-align:left; }
#ai-legal-disclaimer .modal-body h1 { font-size:24px; line-height:1.25; margin:0 0 12px; text-align:center; }
#ai-legal-disclaimer .modal-body p { margin:0 0 16px; }

/* --- Recipe instructions loader (scoped to the planner modal) --- */
.recipe-loader {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;       /* keeps layout from jumping */
}

.recipe-loader .pan {
  font-style: normal;     /* don't italicize the emoji */
  font-size: 20px;        /* slightly smaller than chat's 40px so it fits the modal */
  transform-origin: center;
  animation: jiggleSpin 3s ease-in-out infinite; /* reuses your existing keyframes */
}

.recipe-loader .loading-text {
  display: inline-flex;
  align-items: baseline;
  font-style: normal;
  color: #333;
}

/* Make the dots reserve the same width as your chat loader */
#dots,
#dots-loading,
.recipe-loader .loader-dots {
  display: inline-block;
  min-width: 1.5em;
  text-align: left;
  vertical-align: bottom;
}

/* CSS version of your 0..3 dots at 400ms cadence (1.6s loop) */
.recipe-loader .loader-dots::after {
  content: '';
  animation: dotty 1.6s steps(4, end) infinite;
}

/* '', '.', '..', '...', '' — same rhythm as chat */
@keyframes dotty {
  0%   { content: '';   }
  25%  { content: '.';  }
  50%  { content: '..'; }
  75%  { content: '...';}
  100% { content: '';   }
}

/* Planner recipe loader — center + line break to match chat */
#mealModal .recipe-loader {
  width: 100%;
  display: flex;
  flex-direction: column;   /* ⟵ puts text on a new line under the pan */
  align-items: center;      /* ⟵ centers icon + text horizontally */
  justify-content: center;
  text-align: center;       /* ⟵ centers the text itself */
  gap: 6px;
  padding: 8px 0;
}

#mealModal .recipe-loader .pan {
  font-size: 35px;          /* ⟵ same visual presence as chat */
  line-height: 1;
  transform-origin: center;
  /* still uses your existing jiggleSpin animation */
}

#mealModal .recipe-loader .loading-text {
  font-style: normal;     
  font-size: 0.95rem;
  line-height: 1.2;
}

#mealModal .recipe-loader .loader-dots {
  display: inline-block;
  min-width: 1.5em;         /* prevents text wiggle as dots change */
  text-align: left;
  vertical-align: bottom;
}