/* App SPA layout, layered over the shared design system (styles.css). */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px var(--gutter);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.app-header__nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.9rem;
  font-weight: 600;
}

.app-header__nav a {
  color: var(--ink-soft);
  text-decoration: none;
}

.app-header__nav a.is-active,
.app-header__nav a:hover {
  color: var(--plum);
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(20px, 3vw, 36px) var(--gutter) 64px;
}

/* ---------- Intake ---------- */

.intake {
  max-width: 720px;
  margin: 0 auto;
}

.intake h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-bottom: 8px;
}

.intake__lede {
  color: var(--ink-soft);
  margin-bottom: 28px;
}

.intake__step {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  padding: clamp(20px, 3vw, 30px);
  margin-bottom: 18px;
}

.intake__step h2 {
  font-size: 1.15rem;
  margin-bottom: 4px;
}

.intake__step > p {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin-bottom: 14px;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-grid .chip[aria-pressed="true"] {
  background: var(--plum);
  border-color: var(--plum);
  color: var(--white);
}

.intake textarea {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  background: var(--paper);
  resize: vertical;
  min-height: 90px;
}

.intake textarea:focus,
.intake input:focus,
.intake select:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  background: var(--paper);
}

.stepper button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: var(--white);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-s);
}

.stepper span {
  min-width: 26px;
  text-align: center;
  font-weight: 700;
}

.intake__row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
}

.intake__row label {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.intake input[type="date"],
.intake select {
  font: inherit;
  font-size: 0.95rem;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  background: var(--white);
  color: var(--ink);
}

.intake__submit {
  margin-top: 8px;
  display: grid;
  gap: 10px;
  justify-items: start;
}

.intake__note {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---------- Planner workspace ---------- */

.workspace {
  display: grid;
  gap: 20px;
}

@media (min-width: 1020px) {
  .workspace {
    grid-template-columns: minmax(320px, 420px) 1fr;
    align-items: start;
  }
}

.chat {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 140px);
  position: sticky;
  top: 84px;
}

.chat__scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.chat__msg {
  max-width: 92%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.chat__msg--user {
  justify-self: end;
  background: var(--plum);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.chat__msg--assistant {
  justify-self: start;
  background: var(--paper);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.chat__msg--thinking {
  color: var(--ink-soft);
  font-style: italic;
}

.chat__form {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 12px;
}

.chat__form input {
  flex: 1;
  font: inherit;
  font-size: 0.95rem;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
}

.chat__form input:focus {
  outline: 2px solid var(--gold);
}

/* ---------- Plan board ---------- */

.plan-board__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.plan-board__head h1 {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  margin: 0;
}

.plan-day {
  margin-bottom: 18px;
}

.plan-day > h2 {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-family: var(--font-body);
  margin-bottom: 8px;
}

.meal-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  padding: 14px 16px;
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
}

.meal-card__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.meal-card__slot {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sage-deep);
  background: var(--sage-wash);
  padding: 2px 9px;
  border-radius: 999px;
}

.meal-card h3 {
  font-size: 1.02rem;
  margin: 0;
}

.meal-card h3 a {
  color: inherit;
  text-decoration: none;
}

.meal-card h3 a:hover {
  color: var(--coral-deep);
  text-decoration: underline;
}

.meal-card__facts {
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.meal-card__reason {
  font-size: 0.88rem;
  color: var(--ink-soft);
}

/* ---------- Auth ---------- */

.auth-card {
  max-width: 420px;
  margin: 6vh auto 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  padding: clamp(24px, 4vw, 36px);
  box-shadow: var(--shadow-m);
}

.auth-card h1 {
  font-size: 1.6rem;
  margin-bottom: 6px;
}

.auth-card > p {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin-bottom: 18px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.auth-form input {
  font: inherit;
  font-size: 0.95rem;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  background: var(--paper);
}

.auth-form input:focus {
  outline: 2px solid var(--gold);
}

.auth-error {
  background: #fdf0ec;
  border: 1px solid rgba(158, 68, 35, 0.35);
  color: var(--coral-deep);
  border-radius: var(--r-s);
  padding: 10px 14px;
  font-size: 0.88rem;
}

.auth-alt {
  margin-top: 16px;
  text-align: center;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  margin: 16px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.btn--google {
  width: 100%;
  justify-content: center;
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--ink);
}

/* ---------- Account ---------- */

.account-grid {
  display: grid;
  gap: 18px;
}

@media (min-width: 900px) {
  .account-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.account-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  padding: clamp(18px, 3vw, 26px);
}

.account-card h2 {
  font-size: 1.15rem;
  margin-bottom: 12px;
}

.plan-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.plan-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  padding: 10px 14px;
  font-size: 0.92rem;
}

.plan-list time {
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.shopping-list {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  gap: 24px;
  font-size: 0.9rem;
}

.shopping-list li {
  break-inside: avoid;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}

.danger-zone {
  border-color: rgba(158, 68, 35, 0.35);
}

.app-empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 40px 0;
}

.app-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--white);
  font-size: 0.9rem;
  padding: 11px 22px;
  border-radius: 999px;
  box-shadow: var(--shadow-m);
  z-index: 80;
}
