/* ============================================================
   MealMate — handcrafted styles.
   Warm, editorial, cookbook-inspired. No frameworks.
   ============================================================ */

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/fraunces-400.ttf') format('truetype');
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/fraunces-500.ttf') format('truetype');
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/fraunces-600.ttf') format('truetype');
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/dmsans-400.ttf') format('truetype');
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/dmsans-500.ttf') format('truetype');
}

:root {
  --paper: #f7f3ec;
  --paper-2: #f1ebe1;
  --surface: #ffffff;
  --ink: #211e1b;
  --ink-soft: #4b463f;
  --muted: #8c8579;
  --line: #e7dfd2;
  --line-strong: #d9cfbe;

  --terracotta: #bc5a3c;
  --terracotta-deep: #a44b30;
  --terracotta-wash: #f4e5dd;
  --sage: #5f6b4e;
  --sage-wash: #e9ebe0;

  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --shadow-sm: 0 1px 2px rgba(60, 48, 30, 0.04);
  --shadow-md: 0 8px 24px -12px rgba(66, 50, 30, 0.18);
  --shadow-lg: 0 24px 60px -30px rgba(66, 50, 30, 0.3);
  --radius: 14px;
  --radius-lg: 20px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

/* Visible focus ring for keyboard users (not on mouse click). */
:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Respect users who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Skip-to-content link, visible only on keyboard focus. */
.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 12px;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--sans);
  background-color: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Subtle paper grain via layered radial tints — keeps it from feeling flat. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 12% -8%, #fbf8f2 0%, rgba(251, 248, 242, 0) 60%),
    radial-gradient(800px 600px at 100% 0%, #f3ece0 0%, rgba(243, 236, 224, 0) 55%);
}

button {
  font-family: inherit;
  cursor: pointer;
}

a {
  color: inherit;
}

/* ---------- Layout shell ---------- */
.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 32px 80px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 30px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.brand .mark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 25px;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.brand .mark .dot {
  color: var(--terracotta);
}

.brand .tagline {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
  position: relative;
}

.whoami {
  text-align: right;
  line-height: 1.25;
}
.whoami .name {
  font-weight: 500;
  font-size: 14px;
}
.whoami .sub {
  font-size: 12px;
  color: var(--muted);
}
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  background: var(--terracotta);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 17px;
  transition: transform 0.15s ease;
}
.avatar:hover {
  transform: scale(1.05);
}

/* ---------- Main grid ---------- */
.layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 34px;
  align-items: start;
}

/* ---------- Plan header ---------- */
.plan-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  font-weight: 500;
  color: var(--terracotta);
  margin-bottom: 8px;
}

.plan-head h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 33px;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.05;
}

.plan-head .week {
  color: var(--muted);
  font-size: 14px;
  margin-top: 6px;
}

.head-actions {
  display: flex;
  gap: 10px;
}

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  border-radius: 10px;
  padding: 9px 15px;
  font-size: 13.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.16s ease;
  box-shadow: var(--shadow-sm);
}
.btn:hover {
  border-color: var(--muted);
  background: #fffdf9;
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}
.btn .ico {
  width: 15px;
  height: 15px;
  display: inline-block;
}
.btn-primary {
  background: var(--terracotta);
  border-color: var(--terracotta);
  color: #fff;
}
.btn-primary:hover {
  background: var(--terracotta-deep);
  border-color: var(--terracotta-deep);
}
.btn-ghost {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  padding: 9px 12px;
}
.btn-ghost:hover {
  background: var(--paper-2);
  border-color: transparent;
}

/* ---------- Day cards ---------- */
.plan-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.day {
  display: grid;
  grid-template-columns: 78px 1fr auto;
  gap: 20px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
  position: relative;
}
.day:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
}
.day.is-busy {
  opacity: 0.55;
}

.day-date {
  text-align: center;
  border-right: 1px solid var(--line);
  padding-right: 18px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.day-date .dow {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.day-date .slot {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.day-date .day-kcal {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--terracotta-deep);
  background: var(--terracotta-wash);
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.meal-main {
  min-width: 0;
}
.meal-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 5px;
  line-height: 1.2;
}
.meal-desc {
  color: var(--ink-soft);
  font-size: 13.5px;
  margin: 0 0 11px;
  max-width: 52ch;
}
.meal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.tag {
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tag.cuisine {
  background: var(--sage-wash);
  border-color: #dde0d0;
  color: var(--sage);
}
.tag.time {
  background: #fff;
}
.tag.macro {
  background: var(--sage-wash);
  border-color: #dde0d0;
  color: var(--sage);
}
.tag.macro strong {
  color: var(--ink);
  font-weight: 600;
}
.tag .ico {
  width: 12px;
  height: 12px;
  opacity: 0.8;
}

.meal-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  opacity: 0;
  transition: opacity 0.16s ease;
}
.day:hover .meal-actions {
  opacity: 1;
}
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: all 0.15s ease;
}
.icon-btn:hover {
  background: var(--paper-2);
  color: var(--ink);
  border-color: var(--line);
}
.icon-btn.danger:hover {
  background: var(--terracotta-wash);
  color: var(--terracotta-deep);
}
.icon-btn .ico {
  width: 17px;
  height: 17px;
}

.num-badge {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 11px;
  color: var(--line-strong);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Empty / add-meal row */
.day.empty {
  border-style: dashed;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  cursor: pointer;
  justify-content: center;
  grid-template-columns: 1fr;
  text-align: center;
  padding: 16px;
}
.day.empty:hover {
  border-color: var(--terracotta);
  color: var(--terracotta);
}

.add-row {
  margin-top: 4px;
  display: flex;
  justify-content: center;
}

/* ---------- Sidebar ---------- */
.aside {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
}
.card-head h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 17px;
  margin: 0;
  letter-spacing: -0.01em;
}
.card-body {
  padding: 4px 18px 18px;
}

.pref-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}
.pref {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pref .k {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.pref .v {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-transform: capitalize;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.disclaimer {
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
  margin: 8px 0 0;
}
.chip {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--terracotta-wash);
  color: var(--terracotta-deep);
  font-weight: 500;
}
.chip.muted {
  background: var(--paper-2);
  color: var(--ink-soft);
}
.divider {
  height: 1px;
  background: var(--line);
  margin: 14px 0;
}

/* ---------- Assistant ---------- */
.assistant {
  display: flex;
  flex-direction: column;
  min-height: 360px;
}
.chat {
  padding: 6px 18px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
  flex: 1;
}
.msg {
  font-size: 13.5px;
  line-height: 1.45;
  padding: 10px 13px;
  border-radius: 13px;
  max-width: 88%;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg.bot {
  background: var(--paper-2);
  color: var(--ink);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.msg.user {
  background: var(--terracotta);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.msg strong {
  font-weight: 600;
}
.msg.bot strong {
  color: var(--terracotta-deep);
}
.msg-link {
  display: inline-block;
  font-weight: 500;
  color: var(--terracotta-deep);
  background: var(--terracotta-wash);
  padding: 1px 8px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 12.5px;
}
.msg-link:hover {
  background: #efd9cf;
}
.typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: blink 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) {
  animation-delay: 0.2s;
}
.typing span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes blink {
  0%, 60%, 100% { opacity: 0.25; }
  30% { opacity: 1; }
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 18px 4px;
}
.suggestion {
  font-size: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  padding: 5px 11px;
  border-radius: 999px;
  transition: all 0.15s ease;
}
.suggestion:hover {
  border-color: var(--terracotta);
  color: var(--terracotta-deep);
  background: var(--terracotta-wash);
}

.composer {
  display: flex;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}
.composer input {
  flex: 1;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 13px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--paper);
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.composer input:focus {
  border-color: var(--terracotta);
  background: #fff;
}
.send {
  width: 42px;
  border-radius: 10px;
  border: none;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
  transition: background 0.15s ease;
}
.send:hover {
  background: #000;
}
.send .ico {
  width: 17px;
  height: 17px;
}

/* ---------- Overlay / modal ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(33, 30, 27, 0.38);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
}
.overlay.open {
  display: flex;
}
.modal {
  background: var(--paper);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  overflow: hidden;
}
.modal-head {
  padding: 20px 22px 0;
}
.modal-head h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 21px;
  margin: 0 0 2px;
}
.modal-head p {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}
.modal-body {
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 60vh;
  overflow-y: auto;
}
.modal-foot {
  padding: 16px 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  background: #fffdf9;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.field input,
.field select {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
.field input:focus,
.field select:focus {
  border-color: var(--terracotta);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.seg {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.seg button {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 500;
  text-transform: capitalize;
}
.seg button.on {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

/* Skip-meals grid: rows of day → slot cells you can toggle off */
.skip-grid {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.skip-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.skip-row .d {
  width: 40px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: capitalize;
  flex: none;
}
.skip-cells {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.cell {
  border: 1px solid var(--sage);
  background: var(--sage);
  color: #fff;
  border-radius: 8px;
  padding: 5px 11px;
  font-size: 12.5px;
  font-weight: 500;
  text-transform: capitalize;
  transition: all 0.13s ease;
}
.cell.skipped {
  background: #fff;
  color: var(--muted);
  border-color: var(--line-strong);
  border-style: dashed;
  text-decoration: line-through;
}
.skip-empty {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}

/* Shopping list (interactive) */
.shop-add {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}
.shop-add input {
  flex: 1;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 13px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease;
}
.shop-add input:focus {
  border-color: var(--terracotta);
}

.shop-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.shop-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line);
}
.shop-item:last-child {
  border-bottom: none;
}
.shop-item .check {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1.6px solid var(--line-strong);
  background: #fff;
  display: grid;
  place-items: center;
  color: #fff;
  flex: none;
  transition: all 0.15s ease;
}
.shop-item .check:hover {
  border-color: var(--terracotta);
}
.shop-item.done .check {
  background: var(--sage);
  border-color: var(--sage);
}
.shop-item .check .ico {
  width: 13px;
  height: 13px;
}
.shop-name {
  flex: 1;
  font-size: 14.5px;
  color: var(--ink);
  text-transform: capitalize;
}
.shop-item.done .shop-name {
  color: var(--muted);
  text-decoration: line-through;
}
.shop-name .qty {
  font-size: 12px;
  color: var(--muted);
  text-transform: none;
  margin-left: 6px;
}
.src {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  color: var(--terracotta-deep);
  background: var(--terracotta-wash);
  padding: 2px 7px;
  border-radius: 999px;
}
.shop-item .del {
  width: 30px;
  height: 30px;
  opacity: 0.5;
}
.shop-item .del:hover {
  opacity: 1;
}
.shop-item .del .ico {
  width: 15px;
  height: 15px;
}
.shop-empty {
  padding: 20px 4px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* Share menu (popover above the Share button) */
.share-wrap {
  position: relative;
}
.menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 200px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: none;
  flex-direction: column;
  z-index: 10;
}
.menu.open {
  display: flex;
  animation: rise 0.16s ease;
}
.menu button {
  text-align: left;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 13.5px;
  padding: 9px 12px;
  border-radius: 8px;
  transition: background 0.13s ease;
}
.menu button:hover {
  background: var(--paper-2);
}

/* ---------- Order / subscribe modal ---------- */
.plus-perks {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.plus-perks li {
  position: relative;
  padding-left: 26px;
  font-size: 14px;
  color: var(--ink-soft);
}
.plus-perks li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--sage);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 11px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 11px no-repeat;
}
.upsell-price {
  margin: 16px 0 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}
.demo-flag {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--paper-2);
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
}

.ord-review {
  font-size: 13px;
  color: #a4521f;
  background: #fbe7df;
  border-radius: 10px;
  padding: 9px 12px;
  margin-bottom: 12px;
}
.ord-lines {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}
.ord-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.ord-line.needs-review {
  background: #fdf3ee;
  border-radius: 9px;
  padding-left: 8px;
  padding-right: 8px;
}
.ord-change {
  font-size: 12.5px;
}
.ord-del {
  width: 28px;
  height: 28px;
}
.ord-del .ico {
  width: 14px;
  height: 14px;
}
.ord-alts {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0 2px;
}
.alt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 9px;
  padding: 8px 11px;
  text-align: left;
  font-size: 13.5px;
  transition: all 0.14s ease;
}
.alt-row:hover {
  border-color: var(--terracotta);
  background: var(--terracotta-wash);
}
.alt-row.on {
  border-color: var(--sage);
  background: var(--sage-wash);
}
.alt-price {
  font-weight: 500;
  color: var(--terracotta-deep);
  white-space: nowrap;
}
.ord-line:last-child {
  border-bottom: none;
}
.ord-q {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: none;
  width: 28px;
}
.ord-name {
  flex: 1;
  color: var(--ink);
  text-transform: capitalize;
  display: flex;
  align-items: center;
  gap: 7px;
}
.ord-price {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.ord-pick {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}
.handoff-open {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-bottom: 10px;
}
.slot-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.slot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 11px;
  padding: 11px 14px;
  text-align: left;
  transition: all 0.14s ease;
}
.slot-row:hover {
  border-color: var(--terracotta);
  background: var(--terracotta-wash);
  transform: translateY(-1px);
}
.slot-row:disabled {
  opacity: 0.5;
}
.slot-when {
  font-weight: 500;
  font-size: 14px;
  display: flex;
  flex-direction: column;
}
.slot-when span {
  font-weight: 400;
  font-size: 12.5px;
  color: var(--muted);
}
.slot-price {
  font-weight: 500;
  color: var(--terracotta-deep);
}

.ord-done {
  text-align: center;
  padding: 8px 0 4px;
}
.ord-tick {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--sage);
  color: #fff;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
}
.ord-tick .ico {
  width: 26px;
  height: 26px;
}
.ord-total {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.ord-meta {
  color: var(--muted);
  font-size: 13.5px;
  margin-top: 2px;
}
.ord-when {
  margin-top: 12px;
  font-weight: 500;
  font-size: 15px;
}
.ord-ref {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.ord-sent {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 14px;
}

/* ---------- Auth screen ---------- */
#auth-screen {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.pre-auth #auth-screen {
  display: flex;
}
.pre-auth .shell {
  display: none;
}
#account-menu {
  position: absolute;
  top: 52px;
  right: 0;
}
.account-menu {
  min-width: 220px;
}
.account-email {
  padding: 8px 12px 10px;
  font-size: 12.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
  word-break: break-all;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 34px 28px;
  margin: auto;
}
.auth-brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: -0.02em;
  margin-bottom: 26px;
}
.auth-brand .dot {
  color: var(--terracotta);
}
.auth-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.auth-sub {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 22px;
}
.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  padding: 11px 16px;
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  transition: all 0.15s ease;
}
.oauth-btn:hover {
  border-color: var(--muted);
  background: #fffdf9;
  transform: translateY(-1px);
}
.oauth-btn .ico {
  width: 19px;
  height: 19px;
}
.oauth-btn.apple {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.oauth-btn.apple:hover {
  background: #000;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
#auth-form .field,
#mfa-form .field {
  margin-bottom: 13px;
}
.auth-error {
  color: var(--terracotta-deep);
  background: var(--terracotta-wash);
  border-radius: 9px;
  padding: 8px 11px;
  font-size: 13px;
  margin-bottom: 12px;
}
.auth-submit {
  width: 100%;
  justify-content: center;
  padding: 11px;
  font-size: 14.5px;
  margin-top: 4px;
}
.auth-toggle {
  text-align: center;
  margin-top: 18px;
  font-size: 13.5px;
  color: var(--muted);
}
.linkbtn {
  border: none;
  background: none;
  color: var(--terracotta-deep);
  font-weight: 500;
  font-size: inherit;
  cursor: pointer;
  padding: 0 2px;
}
.linkbtn:hover {
  text-decoration: underline;
}
.mfa-prompt {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0 0 14px;
}
.auth-forgot {
  text-align: center;
  margin-top: 12px;
  font-size: 13px;
}
.auth-ok {
  color: var(--sage);
  background: var(--sage-wash);
  border-radius: 9px;
  padding: 8px 11px;
  font-size: 13px;
  margin-bottom: 12px;
}
.verify-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--terracotta-wash);
  color: var(--terracotta-deep);
  border: 1px solid #e9cabb;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13.5px;
  margin-bottom: 18px;
}
.verify-banner span {
  flex: 1;
}
.verify-dismiss {
  border: none;
  background: none;
  color: inherit;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.mfa-input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  padding: 12px;
  font-family: var(--serif);
  font-size: 26px;
  letter-spacing: 0.4em;
  text-align: center;
  outline: none;
  margin-bottom: 12px;
}
.mfa-input:focus {
  border-color: var(--terracotta);
}
#mfa-back {
  display: block;
  margin: 12px auto 0;
}

/* MFA setup modal */
.mfa-qr {
  display: block;
  width: 188px;
  height: 188px;
  margin: 4px auto 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.mfa-secret {
  text-align: center;
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.12em;
  background: var(--paper-2);
  border-radius: 9px;
  padding: 9px;
  margin-bottom: 14px;
  word-break: break-all;
}
.backup-codes {
  list-style: none;
  margin: 12px 0;
  padding: 14px;
  background: var(--paper-2);
  border-radius: 11px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 16px;
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.06em;
  text-align: center;
}
.mfa-on {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--sage);
  background: var(--sage-wash);
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid #dde0d0;
}
.mfa-on .ico {
  width: 14px;
  height: 14px;
  flex: none;
}

/* ---------- Week navigation ---------- */
.week-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.weeknav-btn {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.14s ease;
}
.weeknav-btn:hover {
  border-color: var(--terracotta);
  color: var(--terracotta-deep);
}
#week-today {
  font-size: 12.5px;
}
.recipe-love-on {
  background: var(--terracotta-wash) !important;
  border-color: var(--terracotta) !important;
  color: var(--terracotta-deep) !important;
}

/* ---------- Switches (auto-pilot) ---------- */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.switch-row:first-child {
  padding-top: 2px;
}
.switch-title {
  font-weight: 500;
  font-size: 14.5px;
}
.switch-note {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
  max-width: 42ch;
}
.switch {
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  cursor: pointer;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch span {
  position: absolute;
  inset: 0;
  background: var(--line-strong);
  border-radius: 999px;
  transition: background 0.18s ease;
}
.switch span::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.18s ease;
  box-shadow: var(--shadow-sm);
}
.switch input:checked + span {
  background: var(--sage);
}
.switch input:checked + span::before {
  transform: translateX(18px);
}

/* ---------- Recipe & onboarding ---------- */
.meal-title {
  cursor: pointer;
}
.meal-title:hover {
  color: var(--terracotta-deep);
}
.recipe-macros {
  font-size: 13.5px;
  color: var(--ink-soft);
  background: var(--sage-wash);
  border: 1px solid #dde0d0;
  border-radius: 10px;
  padding: 9px 12px;
  margin-bottom: 16px;
}
.recipe-h {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 16px;
  margin: 16px 0 8px;
}
.recipe-ings {
  list-style: none;
  margin: 0;
  padding: 0;
}
.recipe-ings li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.recipe-ings li:last-child {
  border-bottom: none;
}
.recipe-ings .amt {
  color: var(--muted);
  white-space: nowrap;
}
.recipe-steps {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.recipe-steps li {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-soft);
  padding-left: 4px;
}

.ob-dots {
  display: flex;
  gap: 6px;
  margin-right: auto;
  align-items: center;
}
.ob-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
}
.ob-dots i.on {
  background: var(--terracotta);
}
.ob-step .field {
  margin-bottom: 16px;
}

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 11px 18px;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 9px;
  animation: rise 0.25s ease;
}
.toast .ico {
  width: 16px;
  height: 16px;
  color: #9fd0a0;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Status pill for confirmed plan */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--sage);
  background: var(--sage-wash);
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid #dde0d0;
}
.status-pill .ico {
  width: 13px;
  height: 13px;
}

/* skeleton */
.skeleton {
  background: linear-gradient(90deg, #f0e9dd 25%, #f6f0e6 37%, #f0e9dd 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .shell {
    padding: 20px 18px 64px;
  }
  .layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .aside {
    position: static;
  }
  .plan-head {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  .plan-head h1 {
    font-size: 27px;
  }
  .head-actions {
    flex-wrap: wrap;
  }
  .head-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
  .topbar .tagline {
    display: none;
  }
  .day {
    grid-template-columns: 64px 1fr;
    gap: 14px;
  }
  .meal-actions {
    opacity: 1;
    grid-column: 1 / -1;
    justify-content: flex-end;
    margin-top: 4px;
  }
  .num-badge {
    display: none;
  }
}
