@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Newsreader:opsz,wght@6..72,600&display=swap");

:root {
  --forest: #315c4c;
  --forest-dark: #23483b;
  --sage: #dfe9df;
  --sage-dark: #abc4ad;
  --cream: #f6f2e9;
  --paper: #fffdf8;
  --ink: #20312b;
  --muted: #68766f;
  --terracotta: #c96848;
  --terracotta-soft: #f3ded4;
  --gold: #d7a947;
  --line: #dce2dc;
  --danger: #a33c35;
  --shadow: 0 12px 35px rgba(31, 56, 47, 0.09);
  --radius: 22px;
}

* { box-sizing: border-box; }

html { background: var(--cream); scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 95% -5%, rgba(201, 104, 72, 0.12), transparent 28rem),
    var(--cream);
  font-family: "DM Sans", system-ui, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: var(--forest); }

.skip-link {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--ink);
  color: white;
  border-radius: 8px;
}
.skip-link:focus { top: 12px; }

#app {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 18px calc(104px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(20px + env(safe-area-inset-top)) 0 17px;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 13px;
  color: white;
  background: var(--forest);
  font-family: "Newsreader", serif;
  font-size: 24px;
}
.brand-name { font-family: "Newsreader", Georgia, serif; font-size: 25px; line-height: 1; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }

.icon-btn {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 248, .75);
  cursor: pointer;
}
.icon-btn:hover, .icon-btn:focus-visible { border-color: var(--forest); background: white; }
.icon { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.15; }
h1 { margin-bottom: 8px; font-family: "Newsreader", Georgia, serif; font-size: clamp(34px, 9vw, 48px); font-weight: 600; letter-spacing: -.02em; }
h2 { margin-bottom: 14px; font-family: "Newsreader", Georgia, serif; font-size: 28px; font-weight: 600; }
h3 { margin-bottom: 7px; font-size: 17px; }
.eyebrow { margin-bottom: 7px; color: var(--terracotta); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.lead { max-width: 540px; margin-bottom: 22px; color: var(--muted); font-size: 16px; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }

.hero {
  position: relative;
  overflow: hidden;
  min-height: 244px;
  padding: 27px 24px;
  border-radius: 30px;
  color: #f9fbf8;
  background: var(--forest);
  box-shadow: var(--shadow);
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; }
.hero::before { width: 190px; height: 190px; right: -58px; top: -66px; border: 35px solid rgba(255,255,255,.08); }
.hero::after { width: 126px; height: 126px; right: 28px; bottom: -68px; background: var(--terracotta); opacity: .85; }
.hero-content { position: relative; z-index: 1; width: 74%; }
.hero h1 { font-size: 39px; }
.hero p { color: rgba(255,255,255,.78); }
.hero .eyebrow { color: #f4bd94; }
.date-label { display: inline-flex; gap: 7px; align-items: center; margin-top: 7px; font-size: 12px; font-weight: 600; }

.section { margin-top: 29px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head a, .link-btn { border: 0; color: var(--forest); background: transparent; font-weight: 700; cursor: pointer; text-decoration: none; }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick-card, .card {
  border: 1px solid rgba(49, 92, 76, .09);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, .9);
  box-shadow: 0 7px 25px rgba(38, 63, 54, .05);
}
.quick-card {
  min-height: 144px;
  padding: 18px;
  text-align: left;
  cursor: pointer;
}
.quick-card:hover, .quick-card:focus-visible { transform: translateY(-2px); border-color: var(--sage-dark); }
.quick-icon { display: grid; width: 39px; height: 39px; margin-bottom: 17px; place-items: center; border-radius: 13px; background: var(--sage); color: var(--forest); }
.quick-card:nth-child(2) .quick-icon { background: var(--terracotta-soft); color: var(--terracotta); }
.quick-card strong { display: block; font-size: 15px; }
.quick-card span { color: var(--muted); font-size: 12px; }

.card { padding: 19px; }
.reading-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 18px; }
.reading-value { font-family: "Newsreader", serif; font-size: 38px; line-height: 1; }
.reading-value small { color: var(--muted); font-family: "DM Sans", sans-serif; font-size: 12px; }
.status-pill, .tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--sage);
  color: var(--forest-dark);
  font-size: 11px;
  font-weight: 700;
}
.status-pill { padding: 7px 10px; }
.status-pill.neutral { background: #ece9df; color: #656155; }

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 15px;
  border: 1px solid #e6d8bd;
  border-radius: 17px;
  background: #fff8e8;
  color: #665531;
  font-size: 13px;
}
.notice strong { display: block; margin-bottom: 2px; }
.notice .icon { flex: 0 0 auto; margin-top: 1px; }
.notice.danger { border-color: #edc3bd; background: #fff0ed; color: #77342e; }

.page-head { padding: 12px 2px 8px; }
.search-wrap { position: relative; margin: 15px 0; }
.search-wrap .icon { position: absolute; left: 15px; top: 14px; color: var(--muted); }
.search {
  width: 100%;
  height: 50px;
  padding: 0 16px 0 45px;
  border: 1px solid var(--line);
  border-radius: 17px;
  outline: 0;
  color: var(--ink);
  background: var(--paper);
}
.search:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(49,92,76,.1); }
.chips { display: flex; gap: 8px; margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.chip { flex: 0 0 auto; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); font-size: 12px; font-weight: 600; cursor: pointer; }
.chip.active { border-color: var(--forest); color: white; background: var(--forest); }

.recipe-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.recipe-card { overflow: hidden; padding: 0; cursor: pointer; text-align: left; }
.recipe-art { position: relative; display: grid; height: 116px; place-items: center; overflow: hidden; background: linear-gradient(135deg, #e7d8b9, #f5ead3); }
.recipe-art::before { content: ""; width: 75px; height: 75px; border-radius: 50%; background: rgba(255,255,255,.65); box-shadow: 0 0 0 8px rgba(255,255,255,.25); }
.recipe-art::after { content: attr(data-mark); position: absolute; color: var(--forest); font-family: "Newsreader", serif; font-size: 29px; font-weight: 600; }
.recipe-card:nth-child(3n+2) .recipe-art { background: linear-gradient(135deg, #c9ddc9, #edf4e9); }
.recipe-card:nth-child(3n) .recipe-art { background: linear-gradient(135deg, #efd2c4, #f8e9de); }
.recipe-copy { padding: 14px; }
.recipe-copy h3 { min-height: 39px; font-size: 14px; }
.recipe-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }

.days { padding-bottom: 2px; }
.planner-slot { margin-bottom: 11px; }
.planner-slot label { display: block; margin: 0 0 6px 4px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.planner-select { width: 100%; min-height: 56px; padding: 0 44px 0 15px; border: 1px solid var(--line); border-radius: 17px; color: var(--ink); background: var(--paper); }
.shopping-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shopping-item { display: flex; gap: 8px; align-items: flex-start; padding: 11px; border-radius: 12px; background: var(--cream); font-size: 12px; }
.shopping-item input { accent-color: var(--forest); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { margin-bottom: 14px; }
.field.full { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.input, .select, .textarea { width: 100%; border: 1px solid var(--line); border-radius: 14px; outline: none; color: var(--ink); background: white; }
.input, .select { height: 48px; padding: 0 13px; }
.textarea { min-height: 84px; padding: 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(49,92,76,.1); }
.primary, .secondary, .danger-btn { min-height: 48px; padding: 0 18px; border-radius: 14px; font-weight: 700; cursor: pointer; }
.primary { border: 1px solid var(--forest); color: white; background: var(--forest); }
.primary:hover { background: var(--forest-dark); }
.secondary { border: 1px solid var(--line); background: var(--paper); }
.danger-btn { border: 1px solid #edc3bd; color: var(--danger); background: #fff3f1; }
.full-btn { width: 100%; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; }

.chart { display: flex; height: 150px; gap: 8px; align-items: end; padding: 22px 4px 3px; border-bottom: 1px solid var(--line); }
.bar-wrap { display: flex; flex: 1; height: 100%; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; }
.bar { width: min(24px, 70%); min-height: 3px; border-radius: 6px 6px 2px 2px; background: var(--forest); }
.bar-value { color: var(--muted); font-size: 9px; }
.bar-date { color: var(--muted); font-size: 8px; }
.history-list { margin-top: 14px; }
.history-item { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 13px 3px; border-bottom: 1px solid var(--line); }
.history-item:last-child { border: 0; }
.history-item strong { font-size: 16px; }
.delete-reading { width: 34px; height: 34px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; cursor: pointer; }

.guide-grid { display: grid; gap: 11px; }
.guide-card { display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: center; padding: 16px; text-align: left; cursor: pointer; }
.guide-number { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 14px; color: var(--forest); background: var(--sage); font-family: "Newsreader", serif; font-size: 20px; }
.guide-card p { margin: 0; color: var(--muted); font-size: 12px; }
.review-badge { display: inline-block; margin-top: 5px; color: #816521; font-size: 10px; font-weight: 700; }

.bottom-nav {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(100%, 760px);
  margin: auto;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(49, 92, 76, .1);
  background: rgba(255, 253, 248, .93);
  backdrop-filter: blur(18px);
}
.nav-btn { display: flex; min-width: 0; padding: 5px 2px; border: 0; flex-direction: column; align-items: center; gap: 2px; color: #78847f; background: transparent; font-size: 9px; font-weight: 700; cursor: pointer; }
.nav-btn .icon { width: 21px; }
.nav-btn.active { color: var(--forest); }
.nav-btn.active::before { content: ""; position: absolute; width: 25px; height: 3px; margin-top: -8px; border-radius: 0 0 5px 5px; background: var(--terracotta); }

.sheet {
  width: min(100% - 20px, 600px);
  max-height: min(88vh, 820px);
  margin: auto auto 10px;
  padding: 0;
  border: 0;
  border-radius: 28px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 24px 70px rgba(20, 39, 32, .25);
}
.sheet::backdrop { background: rgba(24, 38, 33, .53); backdrop-filter: blur(3px); }
.sheet-inner { max-height: inherit; padding: 21px; overflow-y: auto; }
.sheet-head { position: sticky; z-index: 2; top: -21px; display: flex; align-items: center; justify-content: space-between; margin: -21px -21px 19px; padding: 17px 21px 12px; background: rgba(255,253,248,.96); }
.sheet-head h2 { margin: 0; font-size: 25px; }
.sheet-close { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: white; cursor: pointer; }
.modal-art { display: grid; height: 170px; margin-bottom: 20px; place-items: center; border-radius: 22px; background: linear-gradient(135deg, var(--sage), #f3e9d5); }
.modal-art span { display: grid; width: 95px; height: 95px; place-items: center; border: 9px solid rgba(255,255,255,.5); border-radius: 50%; color: var(--forest); background: rgba(255,255,255,.55); font-family: "Newsreader", serif; font-size: 38px; }
.nutrition { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin: 18px 0; }
.nutrition div { padding: 10px 4px; border-radius: 12px; background: var(--cream); text-align: center; }
.nutrition strong { display: block; font-size: 13px; }
.nutrition span { color: var(--muted); font-size: 9px; }
.ingredients, .steps { padding-left: 20px; }
.ingredients li, .steps li { margin-bottom: 8px; }
.reference { padding: 12px 0; border-top: 1px solid var(--line); font-size: 12px; }
.evidence-list { display: grid; gap: 9px; margin: 18px 0 23px; }
.evidence-row { padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--cream); }
.evidence-row strong { display: block; margin-bottom: 3px; }
.evidence-row p { margin: 0; color: var(--muted); font-size: 12px; }
.evidence-label { display: inline-block; margin-top: 7px; padding: 4px 8px; border-radius: 999px; color: #6b5622; background: #f2e3b8; font-size: 9px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }

.onboarding { text-align: center; }
.onboarding-logo { display: grid; width: 76px; height: 76px; margin: 5px auto 18px; place-items: center; border-radius: 24px; color: white; background: var(--forest); font-family: "Newsreader", serif; font-size: 43px; }
.onboarding h1 { font-size: 37px; }
.onboarding-list { margin: 22px 0; text-align: left; }
.onboarding-list div { display: flex; gap: 11px; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
.check { display: grid; flex: 0 0 auto; width: 23px; height: 23px; place-items: center; border-radius: 50%; color: white; background: var(--forest); font-size: 12px; }

.reminder-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.reminder-time { color: var(--forest); font-family: "Newsreader", serif; font-size: 21px; }
.empty { padding: 29px 15px; color: var(--muted); text-align: center; }
.empty-mark { display: grid; width: 55px; height: 55px; margin: 0 auto 11px; place-items: center; border-radius: 18px; background: var(--sage); color: var(--forest); }

.toast { position: fixed; z-index: 80; right: 20px; bottom: 95px; left: 20px; width: fit-content; max-width: calc(100% - 40px); margin: auto; padding: 11px 17px; border-radius: 12px; opacity: 0; color: white; background: var(--ink); font-size: 13px; pointer-events: none; transform: translateY(10px); transition: .25s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (min-width: 650px) {
  #app { padding-right: 28px; padding-left: 28px; }
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
  .recipe-grid { grid-template-columns: repeat(3, 1fr); }
  .sheet { margin-bottom: auto; }
  .hero-content { width: 60%; }
}

@media (max-width: 370px) {
  #app { padding-right: 13px; padding-left: 13px; }
  .recipe-grid { grid-template-columns: 1fr; }
  .recipe-art { height: 135px; }
  .nutrition { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
