:root {
  --ink: #17201b;
  --muted: #62706a;
  --paper: #fbfaf4;
  --panel: rgba(255, 255, 255, 0.92);
  --line: rgba(23, 32, 27, 0.12);
  --green: #2f7d4c;
  --tomato: #d24f3f;
  --mustard: #d89a25;
  --blue: #346a86;
  --shadow: 0 24px 70px rgba(25, 32, 28, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.main-menu {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: grid;
  align-items: stretch;
}

.main-menu-media,
.main-menu-shade {
  position: absolute;
  inset: 0;
}

.main-menu-media {
  background: url("assets/meal-planning-table.png") center / cover no-repeat;
}

.main-menu-shade {
  background:
    linear-gradient(90deg, rgba(251, 250, 244, 0.99) 0%, rgba(251, 250, 244, 0.96) 32%, rgba(251, 250, 244, 0.55) 58%, rgba(251, 250, 244, 0.08) 100%),
    linear-gradient(180deg, rgba(23, 32, 27, 0.08), rgba(23, 32, 27, 0.18));
}

.main-menu-card {
  position: relative;
  z-index: 1;
  width: min(540px, 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 5vw, 58px);
  background: rgba(251, 250, 244, 0.92);
  box-shadow: 18px 0 50px rgba(23, 32, 27, 0.08);
}

.home-topbar {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 28px clamp(24px, 4vw, 46px);
}

.home-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.home-actions .primary-action,
.home-actions .secondary-action {
  min-height: 40px;
  padding: 0 18px;
}

.auth-panel {
  position: absolute;
  z-index: 4;
  top: 92px;
  right: clamp(24px, 4vw, 46px);
  width: min(390px, calc(100% - 48px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: var(--shadow);
  padding: 18px;
  backdrop-filter: blur(14px);
}

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

.auth-form h2 {
  margin: 0;
  font-size: 1.45rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-tabs button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--muted);
  font-weight: 800;
}

.auth-tabs button.active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.auth-message {
  min-height: 21px;
  color: var(--tomato);
  font-size: 0.9rem;
  line-height: 1.45;
}

.auth-message.success {
  color: var(--green);
}

.dashboard {
  min-height: 100vh;
  background: var(--paper);
}

.dashboard-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 42px);
  border-bottom: 1px solid var(--line);
  background: rgba(251, 250, 244, 0.94);
  backdrop-filter: blur(14px);
}

.dashboard-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-weight: 800;
}

.dashboard-hero {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: clamp(22px, 4vw, 42px) clamp(18px, 4vw, 42px) 18px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
}

.dashboard-layout {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 42px) clamp(30px, 5vw, 60px);
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-panel {
  width: min(1320px, 100%);
  margin: 0 auto 18px;
  padding: 18px clamp(18px, 4vw, 42px);
}

.admin-panel-head {
  margin-bottom: 12px;
}

.admin-users-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.admin-user-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 14px;
  box-shadow: 0 14px 35px rgba(25, 32, 28, 0.08);
}

.admin-user-card strong,
.admin-user-card span {
  display: block;
}

.admin-user-card span,
.admin-user-card p,
.admin-user-card li {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.admin-user-card ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

.history-panel {
  position: sticky;
  top: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: 0 16px 45px rgba(25, 32, 28, 0.08);
  padding: 16px;
}

.history-head h2 {
  font-size: 1.35rem;
}

.saved-plans-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.saved-plan-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.saved-plan-card strong {
  display: block;
  line-height: 1.25;
}

.saved-plan-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.saved-plan-card button {
  width: 100%;
  min-height: 34px;
  margin-top: 10px;
  border: 1px solid rgba(47, 125, 76, 0.22);
  border-radius: 999px;
  background: rgba(47, 125, 76, 0.09);
  color: var(--green);
  font-weight: 800;
}

.history-empty {
  color: var(--muted);
  line-height: 1.45;
}

.planner-workspace {
  display: grid;
  gap: 18px;
}

.planner-hero {
  position: relative;
  min-height: 86vh;
  overflow: hidden;
  display: grid;
  align-items: center;
  padding: clamp(18px, 4vw, 54px);
}

.dashboard .planner-hero {
  min-height: auto;
  border-radius: 8px;
}

.dashboard .planner-grid {
  width: 100%;
}

.compact-brand {
  display: none;
}

.hero-media,
.hero-shade {
  position: absolute;
  inset: 0;
}

.hero-media {
  background: url("assets/meal-planning-table.png") center / cover no-repeat;
  transform: scale(1.01);
}

.hero-shade {
  background:
    linear-gradient(90deg, rgba(251, 250, 244, 0.95) 0%, rgba(251, 250, 244, 0.84) 37%, rgba(251, 250, 244, 0.22) 74%),
    linear-gradient(180deg, rgba(23, 32, 27, 0.14), rgba(23, 32, 27, 0.04));
}

.planner-grid {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: minmax(300px, 540px) minmax(260px, 360px);
  gap: 18px;
  align-items: end;
}

.input-panel,
.summary-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.input-panel {
  border-radius: 8px;
  padding: clamp(22px, 4vw, 38px);
}

.summary-panel {
  border-radius: 8px;
  padding: 22px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--green);
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 0.82rem;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 22px;
  max-width: 11ch;
  font-size: clamp(2.45rem, 5.2vw, 5.2rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.planner-form {
  margin-top: 28px;
  display: grid;
  gap: 14px;
}

label,
.field {
  color: var(--ink);
  font-weight: 700;
}

textarea,
select,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  outline: none;
}

textarea {
  margin-top: 8px;
  min-height: 148px;
  padding: 14px;
  resize: vertical;
  line-height: 1.45;
}

.ingredient-picker {
  position: relative;
}

.ingredient-menu-button {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  font-weight: 800;
  text-align: left;
  padding: 0 12px;
}

.ingredient-menu-button::after {
  content: "▾";
  float: right;
  color: var(--muted);
}

.ingredient-menu-button:hover,
.ingredient-menu-button[aria-expanded="true"] {
  border-color: rgba(47, 125, 76, 0.42);
}

.ingredient-menu {
  position: absolute;
  z-index: 4;
  top: calc(100% + 7px);
  left: 0;
  width: min(320px, 100%);
  border: 1px solid #d7d7d7;
  background: #fff;
  box-shadow: 0 18px 36px rgba(23, 32, 27, 0.16);
}

.ingredient-filter {
  height: 35px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid #e2e2e2;
  border-radius: 0;
  background: #fff;
  font-size: 0.9rem;
}

.ingredient-filter:focus {
  border-color: #d7d7d7;
  box-shadow: none;
}

.ingredient-checklist {
  max-height: 284px;
  overflow-y: auto;
  padding: 0;
}

.ingredient-option {
  display: flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  color: #1d1d1d;
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.2;
}

.ingredient-option:hover {
  background: #f5f5f5;
}

.ingredient-option input {
  width: 13px;
  height: 13px;
  margin: 0 4px 0 0;
  accent-color: #5874a5;
}

.ingredient-option.divider {
  border-top: 1px solid #e5e5e5;
}

.ingredient-empty {
  padding: 10px;
  color: #666;
  font-size: 0.9rem;
  font-weight: 400;
}

.ingredient-count {
  margin-top: -6px;
  color: var(--muted);
  font-size: 0.85rem;
}

.selected-ingredients {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 30px;
}

.selected-ingredients button {
  border: 1px solid rgba(47, 125, 76, 0.22);
  border-radius: 999px;
  background: rgba(47, 125, 76, 0.1);
  color: var(--green);
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

select,
input {
  margin-top: 8px;
  height: 44px;
  padding: 0 12px;
}

textarea:focus,
select:focus,
input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(47, 125, 76, 0.12);
}

.quick-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-picks button,
.secondary-action {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdf8;
  color: var(--ink);
  min-height: 38px;
  padding: 0 14px;
  font-weight: 700;
}

.quick-picks button:hover,
.secondary-action:hover {
  border-color: rgba(47, 125, 76, 0.42);
  color: var(--green);
}

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

.diet-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 253, 248, 0.72);
}

.diet-panel legend {
  padding: 0 4px;
  color: var(--ink);
  font-weight: 800;
}

.diet-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.diet-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  border: 1px solid rgba(23, 32, 27, 0.13);
  border-radius: 999px;
  background: #fffdf8;
  padding: 0 10px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
}

.diet-options input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: var(--green);
}

.primary-action {
  border: 0;
  border-radius: 8px;
  min-height: 52px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.primary-action:hover {
  background: #26332c;
}

.spark {
  color: var(--mustard);
}

.summary-kicker,
.section-kicker {
  display: block;
  color: var(--tomato);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-panel p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.stat-strip {
  margin-top: 22px;
  display: grid;
  gap: 10px;
}

.stat-strip div {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.stat-strip strong {
  display: block;
  font-size: 1.55rem;
}

.stat-strip span {
  color: var(--muted);
  font-size: 0.9rem;
}

.week-section {
  padding: clamp(26px, 5vw, 62px);
}

.section-heading {
  width: min(1180px, 100%);
  margin: 0 auto 18px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
}

h2 {
  margin-top: 5px;
  font-size: clamp(1.7rem, 3vw, 2.7rem);
  letter-spacing: 0;
}

.empty-state {
  width: min(1180px, 100%);
  min-height: 220px;
  margin: 0 auto;
  border: 1px dashed rgba(23, 32, 27, 0.22);
  border-radius: 8px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.48);
}

.empty-state span {
  color: var(--blue);
  font-size: 2rem;
}

.week-grid {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(7, minmax(210px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.day-card {
  min-width: 210px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  overflow: hidden;
}

.day-head {
  min-height: 70px;
  padding: 14px;
  background: var(--ink);
  color: #fff;
}

.day-head span {
  color: #f4c65d;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.day-head h3 {
  margin: 5px 0 0;
  font-size: 1.25rem;
}

.meal-list {
  display: grid;
}

.meal {
  min-height: 132px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.meal:first-child {
  border-top: 0;
}

.meal-type {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.meal-type span:last-child {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: currentColor;
}

.meal h4 {
  margin: 8px 0 6px;
  font-size: 1rem;
  line-height: 1.25;
}

.meal p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.recipe-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin-top: 10px;
  border: 1px solid rgba(52, 106, 134, 0.24);
  border-radius: 999px;
  color: var(--blue);
  background: rgba(52, 106, 134, 0.08);
  padding: 0 11px;
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: none;
}

.recipe-link:hover {
  border-color: rgba(52, 106, 134, 0.48);
  background: rgba(52, 106, 134, 0.13);
}

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

.tags span {
  border-radius: 999px;
  background: rgba(47, 125, 76, 0.1);
  color: var(--green);
  padding: 4px 8px;
  font-size: 0.74rem;
  font-weight: 700;
}

@media (max-width: 880px) {
  .home-topbar {
    align-items: start;
    flex-direction: column;
  }

  .auth-panel {
    position: relative;
    top: auto;
    right: auto;
    width: min(520px, calc(100% - 36px));
    margin: -16px auto 26px;
  }

  .main-menu-card {
    width: min(100%, 560px);
  }

  .dashboard-topbar,
  .dashboard-hero {
    align-items: start;
    flex-direction: column;
  }

  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .history-panel {
    position: static;
  }

  .planner-hero {
    min-height: auto;
    padding-top: 26px;
  }

  .hero-shade {
    background: linear-gradient(180deg, rgba(251, 250, 244, 0.96) 0%, rgba(251, 250, 244, 0.82) 62%, rgba(251, 250, 244, 0.6) 100%);
  }

  .planner-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    max-width: 12ch;
  }
}

@media (max-width: 560px) {
  .home-actions {
    width: 100%;
  }

  .home-actions button {
    flex: 1;
  }

  .main-menu-card {
    min-height: 100vh;
  }

  .main-menu-shade {
    background: rgba(251, 250, 244, 0.86);
  }

  .input-panel,
  .summary-panel {
    padding: 18px;
  }

  h1 {
    font-size: 2.35rem;
  }

  .settings-row {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .secondary-action {
    width: 100%;
  }
}
