:root {
  --ink: #2c2134;
  --muted: #77677f;
  --deep: #5d416d;
  --lilac: #cdb4db;
  --lilac-strong: #9b72b0;
  --peach: #ffc8a2;
  --peach-strong: #f29d72;
  --cream: #fff8f0;
  --glass: rgba(255, 255, 255, .42);
  --glass-strong: rgba(255, 255, 255, .62);
  --line: rgba(255, 255, 255, .65);
  --line-dark: rgba(92, 65, 109, .16);
  --shadow: 0 28px 90px rgba(91, 55, 118, .18);
  --inner: inset 0 1px 0 rgba(255, 255, 255, .72);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 10% 8%, rgba(255, 200, 162, .82), transparent 24rem),
    radial-gradient(circle at 88% 10%, rgba(205, 180, 219, .78), transparent 27rem),
    radial-gradient(circle at 35% 88%, rgba(255, 223, 186, .58), transparent 28rem),
    linear-gradient(135deg, #fff7ef 0%, #f4eaff 48%, #ffe9d9 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, .22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .18) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.6), transparent 72%);
}

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

.shell {
  width: min(1160px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--inner);
  backdrop-filter: blur(24px) saturate(145%);
  -webkit-backdrop-filter: blur(24px) saturate(145%);
  border-radius: 30px;
}

.hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 20px;
  padding: 30px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  width: 250px;
  height: 250px;
  right: -80px;
  top: -90px;
  background: radial-gradient(circle, rgba(255, 200, 162, .72), transparent 68%);
  pointer-events: none;
}

.hero-main { position: relative; z-index: 1; }

.top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 6px;
}

.user-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.logout-button {
  border: 1px solid rgba(255, 255, 255, .72);
  background: rgba(255, 255, 255, .46);
  color: var(--deep);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 900;
  box-shadow: var(--inner);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--lilac-strong);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1, h2, h3 { margin: 0; letter-spacing: -.04em; }
h1 { font-family: Georgia, serif; font-size: clamp(40px, 6vw, 76px); line-height: .95; color: #2a1c32; }
h2 { font-size: 26px; color: #2a1c32; }
h3 { font-size: 16px; color: #2a1c32; }

.lede { color: var(--muted); margin: 12px 0 0; font-size: 18px; }

.hero-card {
  min-width: 230px;
  border-radius: 24px;
  padding: 18px;
  background: rgba(255,255,255,.46);
  border: 1px solid rgba(255,255,255,.76);
  display: grid;
  align-content: center;
  gap: 5px;
  position: relative;
  z-index: 1;
  box-shadow: var(--inner);
}
.hero-card span { color: var(--muted); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .12em; }
.hero-card strong { font-size: 28px; font-family: Georgia, serif; }
.hero-card small { color: var(--muted); }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  border-radius: 24px;
  background: rgba(255,255,255,.42);
  padding: 16px;
  border: 1px solid rgba(255,255,255,.68);
  box-shadow: var(--inner);
  backdrop-filter: blur(18px);
}
.stat strong { display: block; font-size: 32px; line-height: 1; }
.stat span { display: block; font-weight: 900; font-size: 13px; margin-top: 8px; }
.stat small { display: block; color: var(--muted); margin-top: 4px; line-height: 1.35; }

.tracker-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .8fr);
  gap: 18px;
}

.timeline-card, .log-card { padding: 22px; }

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}
.toolbar.stacked { align-items: flex-start; }

.month-jump {
  color: var(--muted);
  font-size: 12px;
  display: grid;
  gap: 6px;
  min-width: 160px;
  font-weight: 800;
}
select, input, textarea {
  width: 100%;
  border: 1px solid var(--line-dark);
  background: rgba(255,255,255,.54);
  color: var(--ink);
  border-radius: 16px;
  padding: 11px 12px;
  outline: none;
  box-shadow: var(--inner);
}
select:focus, input:focus, textarea:focus {
  border-color: rgba(155, 114, 176, .55);
  box-shadow: 0 0 0 4px rgba(205, 180, 219, .22), var(--inner);
}
textarea { resize: vertical; }

.progress-bar {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  margin-bottom: 14px;
}
.progress-segment {
  height: 10px;
  border: 0;
  border-radius: 999px;
  background: rgba(92, 65, 109, .10);
}

.month-buttons {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.month-button {
  border: 1px solid rgba(255,255,255,.68);
  background: rgba(255,255,255,.42);
  border-radius: 18px;
  padding: 10px 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  box-shadow: var(--inner);
}
.month-button.active { border-width: 2px; transform: translateY(-1px); }
.month-button .icon { display: block; font-size: 22px; margin-bottom: 3px; }

.month-card {
  border-radius: 26px;
  padding: 20px;
  border: 2px solid transparent;
  box-shadow: var(--inner);
}
.month-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}
.month-card-head .icon { font-size: 44px; }
.month-range { font-size: 11px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.month-subtitle { margin-top: 4px; color: var(--muted); font-weight: 700; }
.focus { color: #4a3b53; line-height: 1.7; margin: 16px 0; }
.callout {
  background: rgba(255,255,255,.58);
  border-radius: 16px;
  border-left: 4px solid currentColor;
  padding: 10px 12px;
  margin: 10px 0;
  color: #4a3b53;
  line-height: 1.55;
  box-shadow: var(--inner);
}
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 12px; }
.tab-button {
  border: 1px solid rgba(255,255,255,.64);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255,255,255,.54);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  box-shadow: var(--inner);
}
.tab-button.active { color: white; }
.tab-content {
  background: rgba(255,255,255,.58);
  border: 1px solid rgba(255,255,255,.62);
  border-radius: 20px;
  padding: 12px;
  box-shadow: var(--inner);
}
.check-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid rgba(92, 65, 109, .10);
  line-height: 1.55;
}
.check-row:last-child { border-bottom: none; }
.check-row input { width: auto; margin-top: 4px; accent-color: var(--lilac-strong); }
.check-row.done span { text-decoration: line-through; color: var(--muted); }

.entry-form { display: grid; gap: 12px; }
.entry-form label { color: #5d4d66; font-size: 12px; font-weight: 900; display: grid; gap: 6px; }
.score-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.habit-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.habit-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.46);
  border: 1px solid rgba(255,255,255,.62);
  padding: 10px;
  border-radius: 16px;
  box-shadow: var(--inner);
}
.habit-list input { width: auto; accent-color: var(--peach-strong); }
.entry-form button, .primary-button {
  border: none;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--lilac-strong), var(--peach-strong));
  color: white;
  padding: 13px 16px;
  font-weight: 950;
  box-shadow: 0 12px 30px rgba(155, 114, 176, .28), var(--inner);
}
.pill {
  background: rgba(255,255,255,.52);
  border: 1px solid rgba(255,255,255,.68);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  box-shadow: var(--inner);
}
.recent { margin-top: 22px; }
.entry {
  border-radius: 18px;
  background: rgba(255,255,255,.44);
  border: 1px solid rgba(255,255,255,.62);
  padding: 12px;
  margin-top: 10px;
  box-shadow: var(--inner);
}
.entry strong { display: block; }
.entry small { color: var(--muted); display: block; margin-top: 4px; }
.entry p { margin: 8px 0 0; color: #5d4d66; line-height: 1.45; }
.disclaimer { margin-top: 18px; padding: 18px; color: #5d4d66; line-height: 1.6; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(440px, 100%);
  padding: 28px;
}
.login-card h1 { font-size: clamp(36px, 8vw, 58px); }
.login-form { display: grid; gap: 14px; margin-top: 22px; }
.login-form label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 900; }
.alert {
  margin-top: 14px;
  border-radius: 16px;
  padding: 12px;
  line-height: 1.45;
  background: rgba(255,255,255,.58);
  border: 1px solid rgba(255,255,255,.68);
  color: #7a3048;
}
.muted { color: var(--muted); }

@media (max-width: 860px) {
  .hero, .toolbar, .top-row { flex-direction: column; align-items: stretch; }
  .stats, .tracker-grid { grid-template-columns: 1fr; }
  .month-buttons { grid-template-columns: repeat(4, 1fr); }
  .score-grid, .habit-list { grid-template-columns: 1fr; }
}


.section-lede {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.meal-planner {
  margin-top: 18px;
  padding: 22px;
}

.meal-toolbar { align-items: flex-start; }

.meal-view-toggle {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.meal-toggle {
  border: 1px solid rgba(255,255,255,.68);
  background: rgba(255,255,255,.48);
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 950;
  box-shadow: var(--inner);
}

.meal-toggle.active {
  color: white;
  background: linear-gradient(135deg, var(--lilac-strong), var(--peach-strong));
}

.meal-summary {
  display: grid;
  gap: 8px;
  margin: 12px 0 18px;
}

.meal-summary div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.meal-summary strong { color: var(--deep); }

.meal-meter {
  height: 8px;
  border-radius: 999px;
  background: rgba(92, 65, 109, .10);
  overflow: hidden;
  box-shadow: var(--inner);
}

.meal-meter span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--lilac-strong), var(--peach-strong));
  transition: width .25s ease;
}

.meal-grid-scroll { overflow-x: auto; padding-bottom: 8px; }

.meal-grid {
  min-width: 980px;
  display: grid;
  gap: 8px;
}

.meal-day-head,
.meal-slot-label,
.meal-cell {
  border: 1px solid rgba(255,255,255,.68);
  background: rgba(255,255,255,.44);
  border-radius: 18px;
  box-shadow: var(--inner);
}

.meal-day-head {
  padding: 10px;
  text-align: center;
  color: var(--deep);
  font-weight: 950;
  font-size: 13px;
}

.meal-slot-label {
  min-height: 86px;
  padding: 10px 8px;
  display: grid;
  place-items: center;
  text-align: center;
  align-content: center;
  gap: 2px;
}

.meal-slot-label span { font-size: 20px; }
.meal-slot-label strong { color: var(--deep); font-size: 11px; }
.meal-slot-label small { color: var(--muted); font-size: 10px; }

.meal-cell {
  min-height: 86px;
  padding: 8px;
  display: grid;
  gap: 5px;
  align-content: space-between;
}

.meal-cell.empty {
  border-style: dashed;
  color: rgba(92, 65, 109, .38);
  display: grid;
  place-items: center;
  font-size: 26px;
}

.meal-cell-main {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}

.meal-cell-main strong {
  display: block;
  line-height: 1.25;
  font-size: 12px;
}

.meal-cell-main small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.meal-clear {
  justify-self: end;
  border: 0;
  background: transparent;
  color: rgba(92, 65, 109, .52);
  padding: 0;
  font-size: 10px;
  font-weight: 900;
}

.meal-actions { text-align: center; margin-top: 8px; }
.meal-actions button,
.shopping-head button {
  border: 1px solid rgba(255,255,255,.68);
  background: rgba(255,255,255,.48);
  color: var(--deep);
  border-radius: 999px;
  padding: 9px 13px;
  font-size: 12px;
  font-weight: 950;
  box-shadow: var(--inner);
}

.shopping-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.shopping-head p { margin: 5px 0 0; color: var(--muted); }

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

.shopping-list label {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255,255,255,.46);
  border: 1px solid rgba(255,255,255,.66);
  border-radius: 16px;
  padding: 10px;
  color: #4a3b53;
  box-shadow: var(--inner);
}

.shopping-list input { width: auto; accent-color: var(--lilac-strong); }

.empty-shopping,
.staples-box {
  border-radius: 20px;
  background: rgba(255,255,255,.46);
  border: 1px solid rgba(255,255,255,.66);
  padding: 18px;
  color: var(--muted);
  line-height: 1.6;
  box-shadow: var(--inner);
}

.staples-box { margin-top: 14px; color: #4a3b53; }

.meal-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  align-items: end;
}

.meal-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(42, 28, 50, .38);
  backdrop-filter: blur(6px);
}

.meal-modal-panel {
  position: relative;
  width: min(920px, calc(100% - 20px));
  max-height: min(82vh, 760px);
  overflow: auto;
  margin: 0 auto 10px;
  padding: 22px;
}

.meal-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.meal-modal-head p { margin: 5px 0 0; color: var(--muted); }

.meal-modal-close {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.7);
  background: rgba(255,255,255,.5);
  color: var(--deep);
  font-size: 22px;
  box-shadow: var(--inner);
}

.meal-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}

.meal-filter {
  border: 1px solid rgba(255,255,255,.68);
  background: rgba(255,255,255,.48);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 11px;
  font-weight: 900;
  box-shadow: var(--inner);
}

.meal-filter.active {
  background: linear-gradient(135deg, var(--lilac-strong), var(--peach-strong));
  color: white;
}

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

.meal-option {
  text-align: left;
  border: 1.5px solid rgba(255,255,255,.68);
  border-radius: 20px;
  padding: 14px;
  box-shadow: var(--inner);
}

.meal-option strong,
.meal-option span,
.meal-option b { display: block; }
.meal-option strong { font-size: 14px; margin-bottom: 5px; }
.meal-option span { color: #4a3b53; line-height: 1.5; font-size: 12px; }
.meal-option small { display: flex; flex-wrap: wrap; gap: 5px; margin: 9px 0; }
.meal-option em { border-radius: 999px; padding: 3px 7px; font-style: normal; font-size: 10px; font-weight: 900; }
.meal-option b { color: var(--muted); line-height: 1.45; font-size: 10px; font-weight: 700; }

@media (max-width: 860px) {
  .meal-toolbar,
  .shopping-head,
  .meal-modal-head { flex-direction: column; align-items: stretch; }
  .shopping-list,
  .meal-options { grid-template-columns: 1fr; }
}
