:root {
  --bg: #f3f8f6;
  --panel: #ffffff;
  --text: #172025;
  --muted: #5c6d68;
  --brand: #0d8b68;
  --brand-dark: #096c51;
  --accent: #ffb347;
  --line: #dce8e3;
  --shadow: 0 16px 40px rgba(10, 40, 32, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(145deg, #f4f8e9 0%, var(--bg) 45%, #eef7ff 100%);
  min-height: 100vh;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(30px);
  opacity: 0.55;
  pointer-events: none;
}

.bg-shape-a {
  width: 260px;
  height: 260px;
  background: #ffe599;
  top: -60px;
  right: -40px;
}

.bg-shape-b {
  width: 300px;
  height: 300px;
  background: #b4efe0;
  bottom: -80px;
  left: -90px;
}

.app-shell {
  width: min(1100px, 94vw);
  margin: 20px auto 36px auto;
  position: relative;
  z-index: 1;
  animation: liftIn 380ms ease-out;
}

.hero {
  text-align: center;
  margin-bottom: 14px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
}

.hero p {
  margin: 6px 0 0 0;
  color: var(--muted);
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.login-card {
  margin-top: 10px;
}

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

#cookbookCuisineTabs {
  margin-bottom: 10px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  background: #fff;
  cursor: pointer;
  transition: 160ms ease;
  text-transform: capitalize;
}

.chip.active,
.chip:hover {
  transform: translateY(-1px);
  border-color: var(--brand);
  color: var(--brand-dark);
  background: #f1fff9;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.tab-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  font-weight: 700;
  cursor: pointer;
}

.tab-btn.active {
  background: linear-gradient(180deg, #e1fcef, #d0f6e4);
  border-color: #a7d8c6;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.recipes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.recipe-tile {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: #fcfffd;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recipe-title {
  font-weight: 700;
  line-height: 1.2;
}

.day-select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.stars {
  display: flex;
  gap: 4px;
}

.star-btn {
  border: 1px solid #e6d6b6;
  background: #fff8e9;
  color: #9a7f33;
  border-radius: 8px;
  padding: 4px 7px;
  cursor: pointer;
}

.star-btn.active {
  background: #ffd684;
  border-color: #efc366;
}

.select-btn,
.custom-form button,
#editForm button[type="submit"] {
  border: 0;
  border-radius: 10px;
  padding: 9px 10px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, var(--brand), var(--brand-dark));
  cursor: pointer;
}

.select-btn.selected {
  background: linear-gradient(180deg, #2fa2ff, #1d6fc6);
}

.muted {
  color: var(--muted);
}

.custom-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.custom-form input,
#editForm input,
#editForm textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font: inherit;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
  font: inherit;
}

#calendarGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.calendar-card {
  margin-bottom: 0;
}

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.calendar-head h3 {
  margin: 0;
}

.clear-btn {
  border-color: #e6b6b6;
  color: #7b1f1f;
  background: #fff5f5;
  white-space: nowrap;
}

.custom-form input {
  flex: 1;
  min-width: 210px;
}

.summary-table,
.shop-table {
  width: 100%;
  border-collapse: collapse;
}

.summary-table th,
.summary-table td,
.shop-table th,
.shop-table td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 8px;
  font-size: 0.95rem;
}

.plan-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 10px;
}

.plan-item h4 {
  margin: 0 0 8px 0;
}

.action-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.delete-btn {
  border-color: #e6b6b6;
  color: #7b1f1f;
  background: #fff5f5;
}

.cuisine-group {
  margin-bottom: 16px;
}

.cuisine-group > h3 {
  margin: 0 0 8px 0;
  padding: 6px 10px;
  border-radius: 10px;
  background: #edf7f2;
  border: 1px solid var(--line);
}

.method {
  white-space: pre-line;
  color: #32413d;
  margin-top: 8px;
}

.mini-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
}

dialog {
  width: min(620px, 95vw);
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 0;
}

#editForm {
  padding: 14px;
}

#editForm label {
  display: block;
  margin-bottom: 10px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

#cancelEdit {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

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

@media (max-width: 760px) {
  .recipes-grid {
    grid-template-columns: 1fr;
  }
  .tabs {
    grid-template-columns: 1fr;
  }
  #calendarGrid {
    grid-template-columns: 1fr;
  }
  .calendar-card .summary-table {
    table-layout: fixed;
  }
  .calendar-card .summary-table th,
  .calendar-card .summary-table td {
    padding: 6px 4px;
    font-size: 0.84rem;
  }
  .calendar-card .summary-table th:nth-child(1),
  .calendar-card .summary-table td:nth-child(1) {
    width: 24%;
  }
  .calendar-card .summary-table th:nth-child(2),
  .calendar-card .summary-table td:nth-child(2) {
    width: 22%;
    min-width: 64px;
  }
  .calendar-card .summary-table th:nth-child(3),
  .calendar-card .summary-table td:nth-child(3) {
    width: 34%;
  }
  .calendar-card .summary-table th:nth-child(4),
  .calendar-card .summary-table td:nth-child(4) {
    width: 20%;
    padding-left: 6px;
  }
  .calendar-card select {
    font-size: 0.82rem;
    padding: 6px 4px;
  }
  .calendar-card .mini-btn {
    padding: 6px;
    font-size: 0.82rem;
    white-space: nowrap;
  }
}
