:root {
  /* ---- Pink & brown palette ---- */
  --bg: #fdf3f0;
  --bg-2: #f9e7e2;
  --surface: #fffafa;
  --surface-2: #fcebee;
  --border: #f1dbd6;
  --text: #4a352e;
  --muted: #a08a82;
  --primary: #f08aa8;
  --primary-hover: #e8769a;
  --primary-soft: #fcdce6;
  --accent: #b5836b;
  --accent-deep: #8a5d46;
  --danger: #e07a7a;
  --today: #f08aa8;
  --radius: 22px;
  --radius-sm: 14px;
  --radius-pill: 999px;
  --shadow: 0 8px 24px rgba(168, 123, 102, 0.13);
  --shadow-sm: 0 3px 10px rgba(168, 123, 102, 0.1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.app-header {
  padding: 2rem 2.5rem 0.5rem;
}
.app-header h1 { margin: 0; font-size: 1.9rem; font-weight: 800; letter-spacing: -0.01em; color: var(--accent-deep); }
.subtitle { margin: 0.4rem 0 0; color: var(--muted); font-size: 0.95rem; }

.layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.75rem;
  padding: 1.5rem 2.5rem 3rem;
  align-items: start;
}
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
}

/* ---- Cards / sidebar ---- */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 1rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 1rem; font-size: 1.1rem; font-weight: 700; color: var(--accent-deep); }

.meal-form label,
.macro-grid label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.7rem;
}
.macro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin-bottom: 0.5rem;
}

input[type="text"],
input[type="number"],
input[type="search"],
select {
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.6rem 0.8rem;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder { color: #c9b3ad; }
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
select { cursor: pointer; }

/* ---- Buttons ---- */
.btn {
  cursor: pointer;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 700;
  font-family: inherit;
  padding: 0.65rem 1.1rem;
  transition: background 0.15s, color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  width: 100%; margin-top: 0.5rem;
  background: var(--primary); color: #fff;
  box-shadow: 0 4px 12px rgba(240, 138, 168, 0.4);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--accent); color: #fff; }
.btn-secondary:hover { background: var(--accent-deep); }
.btn-ghost {
  background: var(--surface-2); color: var(--accent);
  padding: 0.45rem 0.75rem; font-size: 1rem; border-radius: var(--radius-pill);
}
.btn-ghost:hover { background: var(--primary-soft); color: var(--accent-deep); }

/* ---- Tab bar ---- */
.tabbar {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.1rem;
}
.tab {
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--accent);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius-pill);
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.tab:hover { color: var(--accent-deep); border-color: var(--primary-soft); }
.tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(240, 138, 168, 0.4);
}

/* ---- Library page ---- */
.library-page {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.75rem;
  padding: 1.5rem 2.5rem 3rem;
  align-items: start;
}
@media (max-width: 980px) {
  .library-page { grid-template-columns: 1fr; }
}
.add-meal-card { position: sticky; top: 1rem; }

/* On its own page the library breathes out into a card grid instead of a column. */
.meal-library.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.7rem;
  max-height: none;
}

/* ---- Library ---- */
.library-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; margin-bottom: 0.6rem;
}
.library-head h2 { margin: 0; }
.library-head input[type="search"] { width: 140px; margin-top: 0; }
.hint { margin: 0 0 0.8rem; font-size: 0.8rem; color: var(--muted); }

.meal-library {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 0.6rem;
  max-height: 55vh; overflow-y: auto;
}
.meal-chip {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-left: 5px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
  cursor: grab; user-select: none;
  transition: transform 0.1s, box-shadow 0.15s;
}
.meal-chip:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.meal-chip:active { cursor: grabbing; }
.meal-chip.dragging { opacity: 0.4; }
.meal-chip .chip-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.meal-chip .chip-name { font-weight: 700; font-size: 0.92rem; color: var(--accent-deep); }
.meal-chip .chip-macros { margin-top: 0.25rem; font-size: 0.74rem; color: var(--muted); }
.meal-chip .chip-row { display: flex; align-items: center; gap: 0.6rem; }
.meal-chip .chip-text { flex: 1; min-width: 0; }
.meal-chip .chip-thumb {
  width: 46px; height: 46px; flex-shrink: 0;
  border-radius: 12px; object-fit: cover;
  border: 1.5px solid var(--border);
}

/* ---- Photo field (add-meal form) ---- */
.photo-field {
  display: block;
  font-size: 0.78rem; font-weight: 600; color: var(--muted);
  margin-bottom: 0.7rem;
}
.photo-field .optional { font-weight: 400; opacity: 0.8; }
.photo-field input[type="file"] {
  display: block; width: 100%; margin-top: 0.3rem;
  font-family: inherit; font-size: 0.8rem; color: var(--text);
}
.photo-field input[type="file"]::file-selector-button {
  font-family: inherit; font-weight: 700; font-size: 0.8rem;
  cursor: pointer; margin-right: 0.6rem;
  padding: 0.45rem 0.9rem;
  border: none; border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--accent);
  transition: background 0.15s, color 0.15s;
}
.photo-field input[type="file"]::file-selector-button:hover {
  background: var(--primary-soft); color: var(--accent-deep);
}
.photo-preview {
  display: flex; align-items: center; gap: 0.7rem;
  margin-bottom: 0.7rem;
}
.photo-preview[hidden] { display: none; }
.photo-preview img {
  width: 60px; height: 60px;
  border-radius: var(--radius-sm); object-fit: cover;
  border: 1.5px solid var(--border);
}
.photo-clear {
  cursor: pointer; font-family: inherit;
  font-size: 0.78rem; font-weight: 700; color: var(--accent);
  background: none; border: none; padding: 0;
}
.photo-clear:hover { color: var(--danger); }
.delete-meal {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0 0.2rem;
  border-radius: var(--radius-pill);
}
.delete-meal:hover { color: var(--danger); }
.empty-state { color: var(--muted); font-size: 0.88rem; font-style: italic; }

/* ---- Calendar ---- */
.calendar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
}
.cal-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem;
}
.cal-nav { display: flex; align-items: center; gap: 0.6rem; }
.cal-title { margin: 0; font-size: 1.3rem; font-weight: 800; color: var(--accent-deep); min-width: 11rem; text-align: center; }
.cal-jump { display: flex; align-items: center; gap: 0.5rem; }
.cal-jump select { width: auto; margin-top: 0; border-radius: var(--radius-pill); font-weight: 600; font-size: 0.85rem; }
.cal-jump #year-select { width: 5.5rem; }

/* ---- View toggle ---- */
.view-toggle {
  display: inline-flex;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 3px;
}
.vt-btn {
  border: none; cursor: pointer;
  background: transparent; color: var(--accent);
  font-family: inherit; font-weight: 700; font-size: 0.85rem;
  padding: 0.4rem 1rem; border-radius: var(--radius-pill);
  transition: background 0.15s, color 0.15s;
}
.vt-btn.active { background: var(--primary); color: #fff; box-shadow: 0 3px 8px rgba(240, 138, 168, 0.4); }
.vt-btn:not(.active):hover { color: var(--accent-deep); }

.weekday-row, .cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.6rem;
}
.weekday-row { margin-bottom: 0.6rem; }
.weekday-row span {
  text-align: center; font-size: 0.74rem; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--accent); padding: 0.2rem 0;
}

.day-cell {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 130px;
  display: flex; flex-direction: column;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.day-cell.blank { background: transparent; border: 1.5px dashed transparent; }
.day-cell.today { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.day-cell-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.4rem 0.5rem 0.15rem;
}
.day-num { font-size: 0.88rem; font-weight: 700; color: var(--accent-deep); }
.day-cell.today .day-num {
  background: var(--primary); color: #fff;
  border-radius: 50%; width: 1.6rem; height: 1.6rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.clear-day {
  background: none; border: none; color: transparent;
  cursor: pointer; font-size: 0.85rem; line-height: 1; padding: 0 0.15rem;
  border-radius: var(--radius-pill);
}
.day-cell:hover .clear-day { color: var(--muted); }
.clear-day:hover { color: var(--danger) !important; }

.day-dropzone {
  list-style: none; margin: 0; padding: 0.15rem 0.4rem;
  flex: 1; display: flex; flex-direction: column; gap: 0.3rem;
  min-height: 28px; max-height: 160px; overflow-y: auto;
  border-radius: var(--radius-sm);
  transition: background 0.12s, outline 0.1s;
}
.day-dropzone.drag-over {
  background: var(--primary-soft);
  outline: 2px dashed var(--primary); outline-offset: -3px;
}
.planned-meal {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  padding: 0.3rem 0.45rem;
  font-size: 0.74rem;
  display: flex; justify-content: space-between; align-items: center; gap: 0.3rem;
  box-shadow: var(--shadow-sm);
}
.planned-meal .pm-thumb {
  width: 20px; height: 20px; flex-shrink: 0;
  border-radius: 6px; object-fit: cover;
}
.planned-meal .pm-name { flex: 1; font-weight: 700; color: var(--accent-deep); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.remove-planned {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 0.85rem; line-height: 1; flex-shrink: 0;
}
.remove-planned:hover { color: var(--danger); }

.day-totals {
  padding: 0.3rem 0.5rem;
  border-top: 1.5px dashed var(--border);
  font-size: 0.68rem;
  display: flex; flex-direction: column; gap: 1px;
}
.day-totals.empty { visibility: hidden; }
.t-cal { color: var(--primary-hover); font-weight: 700; }
.t-macros { color: var(--muted); }

/* Week view: fewer rows, so give the cells more room. */
.cal-grid.mode-week .day-cell { min-height: 320px; }
.cal-grid.mode-week .day-dropzone { max-height: 320px; }

/* ---- Week summary / targets progress ---- */
/* Flush-left with the day grid; cards stay narrow so values sit near labels. */
.week-summary {
  margin-top: 1.4rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.9rem;
}
.ws-heading { flex: 0 0 100%; margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--accent-deep); }
.ws-note { flex: 0 0 100%; margin: -0.4rem 0 0; font-size: 0.82rem; color: var(--muted); font-style: italic; }

.ws-card {
  flex: 0 1 340px;
  max-width: 340px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
}
.ws-card-title { font-weight: 800; font-size: 0.95rem; color: var(--accent-deep); margin-bottom: 0.7rem; }

.ws-row { margin-bottom: 0.7rem; }
.ws-row:last-child { margin-bottom: 0; }
.ws-row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; margin-bottom: 0.25rem; }
.ws-name { font-size: 0.82rem; font-weight: 700; color: var(--text); }
.ws-val { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.ws-bar {
  height: 9px;
  background: var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.ws-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-pill);
  transition: width 0.25s ease;
}
.ws-fill.near { background: var(--accent); }
.ws-fill.over { background: var(--danger); }

@media (max-width: 640px) {
  .day-cell { min-height: 92px; }
  .planned-meal { font-size: 0.68rem; }
  .cal-grid.mode-week .day-cell { min-height: 150px; }
}

/* ---- Floating praise (game damage numbers) ---- */
.praise-pop {
  --drift: 0px;
  --rot: 0deg;
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  transform: translate(-50%, -50%);
  font-family: inherit;
  font-weight: 900;
  font-size: 1.7rem;
  letter-spacing: -0.01em;
  color: #fff;
  white-space: nowrap;
  text-shadow:
    -2px -2px 0 var(--primary-hover),
     2px -2px 0 var(--primary-hover),
    -2px  2px 0 var(--primary-hover),
     2px  2px 0 var(--primary-hover),
     0 6px 14px rgba(232, 118, 154, 0.55);
  animation: praise-float 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes praise-float {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.4) rotate(var(--rot)); }
  18%  { opacity: 1; transform: translate(-50%, -50%) scale(1.3) rotate(var(--rot)); }
  35%  { transform: translate(calc(-50% + var(--drift)), -95%) scale(1) rotate(var(--rot)); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--drift)), -260%) scale(1) rotate(var(--rot)); }
}
@media (prefers-reduced-motion: reduce) {
  .praise-pop { animation: praise-fade 1s ease-out forwards; }
  @keyframes praise-fade {
    0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -120%); }
  }
}

/* The weekday label inside a cell is only used in the mobile week list. */
.day-dow { display: none; }

/* ===================== Day sheet (tap-to-manage) ===================== */
body.sheet-open { overflow: hidden; }

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(74, 53, 46, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-backdrop[hidden] { display: none; }

.sheet {
  background: var(--surface);
  width: 100%; max-width: 520px;
  max-height: 88vh; overflow-y: auto;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.2rem 1.3rem calc(1.6rem + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(74, 53, 46, 0.25);
  animation: sheet-up 0.22s ease;
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

@media (min-width: 640px) {
  .sheet-backdrop { align-items: center; padding: 1rem; }
  .sheet { border-radius: var(--radius); max-height: 85vh; animation: sheet-pop 0.18s ease; }
  @keyframes sheet-pop { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
}

.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.sheet-title { margin: 0; font-size: 1.2rem; font-weight: 800; color: var(--accent-deep); }
.sheet-close {
  flex-shrink: 0; cursor: pointer; border: none;
  width: 2.1rem; height: 2.1rem; border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--accent);
  font-size: 1.4rem; line-height: 1;
}
.sheet-close:hover { background: var(--primary-soft); color: var(--accent-deep); }
.sheet-totals { font-size: 0.85rem; font-weight: 700; color: var(--primary-hover); margin: 0.3rem 0 1.1rem; }

.sheet-section { margin-bottom: 1.2rem; }
.sheet-section:last-child { margin-bottom: 0; }
.sheet-section h3 { margin: 0 0 0.6rem; font-size: 0.98rem; font-weight: 800; color: var(--accent-deep); }
.sheet-section input[type="search"] { margin: 0 0 0.7rem; }
.sheet-empty { color: var(--muted); font-size: 0.85rem; font-style: italic; margin: 0.2rem 0 0; }

.sheet-planned, .sheet-add-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.sheet-add-list { max-height: 42vh; overflow-y: auto; }

.sheet-planned-item, .sheet-add-item {
  display: flex; align-items: center; gap: 0.7rem;
  background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.55rem 0.7rem;
}
.sheet-add-item { cursor: pointer; touch-action: manipulation; transition: background 0.12s, transform 0.08s; }
.sheet-add-item:hover { background: var(--primary-soft); }
.sheet-add-item:active { transform: scale(0.99); }

.sp-thumb, .sa-thumb { width: 42px; height: 42px; flex-shrink: 0; border-radius: 10px; object-fit: cover; }
.sp-text, .sa-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sp-name, .sa-name { font-weight: 700; font-size: 0.9rem; color: var(--accent-deep); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-macros, .sa-macros { font-size: 0.74rem; color: var(--muted); }
.sp-remove { flex-shrink: 0; background: none; border: none; cursor: pointer; color: var(--muted); font-size: 1.3rem; line-height: 1; padding: 0 0.2rem; }
.sp-remove:hover { color: var(--danger); }
.sa-plus {
  flex-shrink: 0; width: 1.9rem; height: 1.9rem; border-radius: var(--radius-pill);
  background: var(--primary); color: #fff; font-weight: 800; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
}

/* ===================== Mobile layout ===================== */
@media (max-width: 768px) {
  /* Avoid the iOS focus-zoom: inputs must be >= 16px. */
  input[type="text"], input[type="number"], input[type="search"], select { font-size: 16px; }
  .tab, .btn, .vt-btn { touch-action: manipulation; }

  .app-header { padding: 1.1rem 1.1rem 0.5rem; }
  .brand { gap: 0.7rem; }
  .app-header h1 { font-size: 1.35rem; }
  .subtitle { font-size: 0.84rem; }
  .logo { width: 48px; height: 48px; }

  /* App-style fixed bottom tab bar. */
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
    margin: 0; gap: 0.4rem;
    background: var(--surface);
    border-top: 1.5px solid var(--border);
    padding: 0.45rem 0.7rem calc(0.45rem + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(168, 123, 102, 0.12);
  }
  .tab { flex: 1; border: none; background: none; box-shadow: none; border-radius: var(--radius-sm); padding: 0.55rem; }
  .tab.active { background: var(--primary-soft); color: var(--accent-deep); border: none; box-shadow: none; }

  /* Single column; leave room for the bottom bar. */
  .layout, .library-page { grid-template-columns: 1fr; gap: 1rem; padding: 1rem 1rem 5.5rem; }
  .sidebar, .add-meal-card { position: static; }
  .card { padding: 1.1rem; }

  /* The palette is a drag source — useless on touch. Hide it; the day sheet adds meals. */
  .palette-card { display: none; }

  /* Calendar toolbar stacks into tidy rows. */
  .calendar { padding: 1.1rem; }
  .cal-toolbar { flex-direction: column; align-items: stretch; gap: 0.7rem; }
  .cal-nav { justify-content: space-between; }
  .cal-nav .btn-ghost { font-size: 1.25rem; }
  .cal-title { flex: 1; min-width: 0; font-size: 1.1rem; }
  .view-toggle { align-self: center; }
  .cal-jump { width: 100%; }
  .cal-jump select { flex: 1; min-width: 0; width: auto; }
  .cal-jump #year-select { flex: 0 0 5rem; }

  /* Touch targets: keep the per-day clear button visible (no hover on touch). */
  .clear-day { color: var(--muted); }

  /* --- Month view: compact grid, meals shown as a dot; tap to open the sheet --- */
  .weekday-row, .cal-grid { gap: 4px; }
  .weekday-row span { font-size: 0.6rem; }
  .cal-grid.mode-month .day-cell { min-height: 52px; border-radius: 10px; cursor: pointer; }
  .cal-grid.mode-month .day-cell-head { padding: 0.2rem 0.3rem 0; }
  .cal-grid.mode-month .day-num { font-size: 0.72rem; }
  .cal-grid.mode-month .day-cell.today .day-num { width: 1.3rem; height: 1.3rem; }
  .cal-grid.mode-month .day-dropzone,
  .cal-grid.mode-month .day-totals,
  .cal-grid.mode-month .clear-day { display: none; }
  .cal-grid.mode-month .day-cell.has-meals::after {
    content: ""; display: block; width: 7px; height: 7px; border-radius: 50%;
    background: var(--primary); margin: auto;
  }

  /* --- Week view: a readable vertical stack of day cards --- */
  .cal-grid.mode-week { grid-template-columns: 1fr; gap: 0.6rem; }
  .cal-grid.mode-week .day-cell { min-height: auto; cursor: pointer; }
  .cal-grid.mode-week .day-dropzone { max-height: none; }
  .cal-grid.mode-week .day-cell-head { gap: 0.4rem; }
  .cal-grid.mode-week .day-dow { display: inline; font-weight: 800; font-size: 0.82rem; color: var(--accent); }
  .cal-grid.mode-week .clear-day { margin-left: auto; }
  .cal-grid.mode-week .planned-meal { font-size: 0.85rem; padding: 0.5rem 0.6rem; }
  .cal-grid.mode-week .pm-thumb { width: 28px; height: 28px; border-radius: 8px; }

  /* Week summary cards span full width. */
  .ws-card { flex: 1 1 100%; max-width: none; }

  .praise-pop { font-size: 1.4rem; }
}

@media (max-width: 380px) {
  .subtitle { display: none; }
  .app-header h1 { font-size: 1.25rem; }
  .cal-grid.mode-month .day-cell { min-height: 46px; }
}
