:root {
  color-scheme: light;
  --bg: #faf8f2;
  --surface: #fffdf8;
  --surface-2: #f2f0e7;
  --ink: #24352a;
  --muted: #596558;
  --line: #e4e0d3;
  --accent: #2a4936;
  --accent-ink: #fffdf4;
  --soft: #e6ebdc;
  --warm: #b35b40;
  --danger: #a3342a;
  --shadow: 0 18px 40px #2b403315;
  --serif: Georgia,"Times New Roman",serif;
  --sans: system-ui,-apple-system,"Segoe UI",sans-serif;
}

:root[data-theme=dark] {
  color-scheme: dark;
  --bg: #181e18;
  --surface: #222b21;
  --surface-2: #2c3529;
  --ink: #f9f0dc;
  --muted: #bac5b4;
  --line: #3d493b;
  --accent: #c9d8af;
  --accent-ink: #1b291e;
  --soft: #344330;
  --warm: #edac91;
  --danger: #ffaca0;
  --shadow: 0 18px 36px #0004;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none!important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  min-height: 100vh;
}

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

button,summary {
  cursor: pointer;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-underline-offset: 3px;
}

button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,[tabindex="-1"]:focus-visible {
  outline: 3px solid #bd7957;
  outline-offset: 3px;
}

img {
  max-width: 100%;
  display: block;
  object-fit: cover;
}

h1,h2,h3,p {
  margin-top: 0;
}

h1,h2,h3 {
  line-height: 1.12;
}

h1,h2 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -.045em;
}

h1 {
  font-size: clamp(2.5rem,5vw,4.4rem);
  margin-bottom: .28em;
}

h2 {
  font-size: clamp(1.8rem,3vw,2.55rem);
  margin-bottom: .45em;
}

h3 {
  font-size: 1.1rem;
  margin-bottom: .5em;
}

p {
  margin-bottom: .85em;
}

.skip-link {
  position: absolute;
  top: -80px;
  left: 10px;
  z-index: 30;
  background: var(--surface);
  padding: 10px;
}

.skip-link:focus {
  top: 8px;
}

.icon {
  height: 20px;
  width: 20px;
  flex: none;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.top {
  max-width: 1260px;
  margin: auto;
  min-height: 75px;
  padding: 0 28px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  justify-self: start;
  white-space: nowrap;
  font-family: var(--serif);
  font-size: 24px;
  letter-spacing: -.06em;
  font-weight: 700;
}

.brand img {
  width: 37px;
  height: 37px;
  border-radius: 11px;
}

.top nav {
  display: flex;
  gap: 3px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  padding: 11px 13px;
  border-radius: 10px;
  text-decoration: none;
  white-space: nowrap;
  font-size: .88rem;
  font-weight: 650;
}

.nav-link[aria-current=page] {
  background: var(--soft);
  color: var(--ink);
}

.nav-link:hover {
  background: var(--surface-2);
}

.header-end {
  justify-self: end;
  display: flex;
  gap: 12px;
  align-items: center;
}

.avatar {
  border-radius: 50%;
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  background: var(--soft);
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
}

#main {
  max-width: 1232px;
  margin: auto;
  padding: 38px 28px 76px;
}

.loading {
  color: var(--muted);
  padding: 40px 0;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .11em;
  font-size: .72rem;
  font-weight: 760;
  color: var(--warm);
  margin-bottom: .7rem;
}

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

.hint {
  font-size: .86rem;
}

.padded {
  padding: 20px;
}

.hero {
  display: grid;
  align-items: center;
  min-height: 343px;
  isolation: isolate;
  position: relative;
  overflow: hidden;
  border-radius: 25px;
  background: #253d2b;
  color: #fff9e8;
  margin: 26px 0 22px;
}

.hero img,.hero::after {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  object-position: center 55%;
}

.hero::after {
  content: '';
  background: linear-gradient(90deg,#1b3325 2%,#1b3325f2 24%,#1b3325bd 44%,#1b332536 68%,#15231914 100%);
}

.hero-content {
  padding: 42px clamp(25px,5vw,64px);
  max-width: 570px;
}

.hero .eyebrow {
  color: #f0c08e;
}

.hero h2 {
  font-size: clamp(2.2rem,4.5vw,4rem);
  line-height: 1.01;
  max-width: 475px;
  margin-bottom: .27em;
}

.hero p:not(.eyebrow) {
  max-width: 355px;
  color: #f0f1e2;
  margin: 0 0 19px;
  font-size: .95rem;
}

.hero .btn {
  background: #fbf5e8;
  color: #213628;
  border: 0;
}

.hero .btn:hover {
  background: #fff;
}

.toolbar,.row,.section-head,.heading {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.heading,.section-head {
  justify-content: space-between;
}

.heading {
  margin-bottom: 22px;
}

.heading h1,.section-head h2,.section-head h3 {
  margin: 0;
}

.section-head {
  margin: 32px 0 14px;
}

.heading .eyebrow {
  margin-bottom: 5px;
}

.heading p:last-child {
  margin-bottom: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 15px;
  min-height: 43px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  text-decoration: none;
  font-weight: 670;
  font-size: .89rem;
  white-space: normal;
}

.btn:hover {
  background: var(--surface-2);
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.btn.primary:hover {
  filter: brightness(1.13);
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  color: var(--danger);
}

.btn.icon-btn {
  width: 43px;
  padding: 0;
  flex: none;
}

.btn[disabled] {
  opacity: .55;
  cursor: wait;
}

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

.quick {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  text-decoration: none;
  min-width: 0;
}

.quick:hover {
  background: var(--soft);
}

.quick .icon:first-child {
  box-sizing: content-box;
  padding: 8px;
  border-radius: 9px;
  background: var(--soft);
}

.quick .icon:last-child {
  margin-left: auto;
  color: var(--muted);
}

.quick strong,.quick small {
  display: block;
}

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

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

.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 15px;
  overflow: hidden;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  box-shadow: 0 3px 7px #1b382606;
  min-width: 0;
}

.card:hover {
  box-shadow: var(--shadow);
}

.card-media {
  height: 148px;
  display: grid;
  place-items: center;
  background: #dbe3cf;
  color: #32503a;
  overflow: hidden;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-position: center 60%;
}

.card-media .icon {
  width: 48px;
  height: 48px;
  stroke-width: .9;
}

.card-media.tone-1 {
  background: #eddfce;
  color: #784e38;
}

.card-media.tone-2 {
  background: #d7e0dc;
  color: #365b50;
}

.card-media.tone-3 {
  background: #e8dcc9;
  color: #795b38;
}

.card-body {
  padding: 13px 14px 15px;
  min-height: 106px;
}

.card-body .eyebrow {
  font-size: .63rem;
  margin: 0 0 .44rem;
}

.card h3 {
  font: 500 1.23rem/1.1 var(--serif);
  letter-spacing: -.02em;
  margin: 0 0 6px;
}

.card-link {
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  font: inherit;
}

.card-link:after {
  content: '';
  position: absolute;
  inset: 0;
}

.card .hint {
  font-size: .75rem;
  margin: 6px 0 0;
}

.card-time {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  color: var(--muted);
  font-size: .78rem;
}

.card-time .icon {
  width: 14px;
  height: 14px;
}

.panel,.empty {
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  padding: 20px;
}

.empty {
  color: var(--muted);
  margin-top: 14px;
}

.panel h2 {
  font-size: 1.75rem;
}

.notice {
  padding: 11px 13px;
  border-radius: 9px;
  background: var(--soft);
  color: var(--ink);
  font-size: .9rem;
}

.offline {
  margin-bottom: 15px;
}

.searchbar {
  margin: 0 0 16px;
  display: grid;
  grid-template-columns: minmax(150px,2fr) 1fr 1fr;
  gap: 10px;
}

.field {
  display: grid;
  gap: 5px;
  min-width: 0;
  font-size: .86rem;
  font-weight: 650;
}

.field label {
  font-weight: 650;
}

input:not([type=checkbox]),textarea,select {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 8px 10px;
  width: 100%;
  font-size: 16px;
}

textarea {
  min-height: 116px;
  resize: vertical;
}

input::placeholder,textarea::placeholder {
  color: var(--muted);
  opacity: .75;
}

input[type=checkbox] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  margin: 0;
  flex: none;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  font-size: .89rem;
}

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

.fields.three {
  grid-template-columns: repeat(3,minmax(0,1fr));
}

.fields .full {
  grid-column: 1/-1;
}

.stack {
  display: grid;
  gap: 13px;
}

.form-error {
  color: var(--danger);
  margin: 0;
  font-size: .9rem;
}

.auth {
  display: grid;
  grid-template-columns: 1.04fr 1fr;
  margin: 17px auto;
  max-width: 960px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  background: var(--surface);
}

.auth-visual {
  position: relative;
  min-height: 440px;
  isolation: isolate;
  display: grid;
  align-content: end;
  padding: 32px;
  color: #fff9e8;
  background: #2e4431;
}

.auth-visual img,.auth-visual::after {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  object-position: 70% center;
}

.auth-visual::after {
  content: '';
  background: linear-gradient(0deg,#1e3020ed,#20362110 78%);
}

.auth-visual h1 {
  font-size: clamp(2.4rem,5vw,4.2rem);
  margin-bottom: 0;
}

.auth-content {
  padding: clamp(22px,4vw,45px);
  align-self: center;
}

.auth-content h2 {
  margin-bottom: 8px;
}

.settings {
  display: grid;
  grid-template-columns: minmax(0,1.7fr) minmax(270px,1fr);
  gap: 15px;
}

.settings aside {
  display: grid;
  gap: 15px;
  align-content: start;
}

.person,.product-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
}

.person:last-child,.product-line:last-child {
  border-bottom: 0;
}

.weekbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 9px;
  margin-bottom: 16px;
}

.weekbar strong {
  text-align: center;
  font-size: .97rem;
}

.days {
  display: grid;
  gap: 10px;
}

.day {
  display: grid;
  grid-template-columns: 132px minmax(0,1fr) minmax(0,1fr);
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px;
}

.day.today {
  border-color: var(--warm);
}

.day-label strong,.day-label small {
  display: block;
}

.day-label small {
  color: var(--muted);
}

.meal {
  display: flex;
  align-items: center;
  gap: 9px;
  justify-content: space-between;
  min-height: 58px;
  border-radius: 9px;
  background: var(--surface-2);
  padding: 9px 10px;
  text-align: left;
  border: 0;
  width: 100%;
}

.meal:hover {
  background: var(--soft);
}

.meal small,.meal strong {
  display: block;
}

.meal small {
  color: var(--muted);
  font-size: .73rem;
}

.meal strong {
  font-size: .86rem;
}

.meal.add {
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--muted);
}

.meal.add .icon {
  width: 17px;
  height: 17px;
}

.shop-layout {
  display: grid;
  grid-template-columns: minmax(230px,.9fr) minmax(0,2.1fr);
  gap: 18px;
  align-items: start;
}

.shop-layout aside {
  display: grid;
  gap: 13px;
}

.shop-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  margin-bottom: 10px;
}

.shop-group h3 {
  margin: 0;
  padding: 12px 15px;
  background: var(--surface-2);
  font-size: .9rem;
}

.shop-item {
  display: grid;
  grid-template-columns: minmax(0,1fr) 44px;
  align-items: center;
  gap: 4px;
  border-top: 1px solid var(--line);
  padding: 3px 7px 3px 14px;
}

.shop-item label {
  display: flex;
  align-items: center;
  min-height: 55px;
  gap: 12px;
  cursor: pointer;
}

.shop-item .quantity {
  color: var(--muted);
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
  font-size: .85rem;
}

.shop-item small {
  display: block;
  color: var(--muted);
  font-size: .75rem;
}

.shop-item.checked label strong,.shop-item.checked .quantity {
  text-decoration: line-through;
  color: var(--muted);
}

progress {
  width: 100%;
  height: 8px;
  accent-color: var(--accent);
}

dialog {
  width: min(720px,calc(100% - 22px));
  max-height: calc(100dvh - 28px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 80px #14221855;
}

dialog.wide {
  width: min(1020px,calc(100% - 22px));
}

dialog::backdrop {
  background: #17241ab0;
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.modal-header h2 {
  margin: 0;
  font-size: clamp(1.45rem,4vw,2rem);
}

.modal-content {
  padding: 17px 20px 23px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 5px;
}

.tabs {
  display: flex;
  gap: 6px;
}

.tabs button[aria-pressed=true] {
  background: var(--soft);
}

.recipe-hero {
  width: 100%;
  height: 215px;
  object-position: center 60%;
  border-radius: 11px;
  margin-bottom: 15px;
}

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  font-size: .85rem;
  color: var(--muted);
  margin: 8px 0 15px;
}

.recipe-columns,.import-columns {
  display: grid;
  grid-template-columns: minmax(0,.9fr) minmax(0,1.1fr);
  gap: 18px;
}

.recipe-columns ul,.recipe-columns ol {
  padding-left: 23px;
  margin: 0;
}

.recipe-columns li {
  margin-bottom: 7px;
}

.recipe-columns li small {
  color: var(--muted);
}

.portion-input {
  max-width: 90px;
}

.ingredient-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(120px,1fr) 67px 67px 110px 43px;
  gap: 5px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px;
}

.ingredient-row small,.ingredient-row .line-flags {
  grid-column: 1/-1;
}

.ingredient-row small {
  overflow-wrap: anywhere;
}

.ingredient-row .field {
  font-size: .73rem;
}

.ingredient-row input:not([type=checkbox]),.ingredient-row select {
  padding: 6px;
  min-height: 40px;
}

.line-flags {
  display: flex;
  gap: 11px;
  flex-wrap: wrap;
}

.source-preview {
  max-height: 440px;
  overflow: auto;
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--surface-2);
  padding: 12px;
  border-radius: 8px;
  font: inherit;
  font-size: .84rem;
}

.quality {
  padding: 11px 13px;
  background: var(--soft);
  border-radius: 9px;
}

.quality ul {
  padding-left: 18px;
  margin: 6px 0;
}

.quality a {
  font-size: .84rem;
}

.proposal-row {
  display: grid;
  grid-template-columns: minmax(105px,.65fr) minmax(0,1.5fr);
  align-items: center;
  gap: 8px;
}

.toast {
  position: fixed;
  z-index: 6;
  bottom: 22px;
  right: 25px;
  max-width: min(430px,calc(100% - 40px));
  padding: 11px 16px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow);
}

#bottom-nav {
  display: none;
}

@media(max-width:950px) {
  .top {
    gap: 11px;
    padding: 0 19px;
  }
  .top nav .nav-link {
    padding: 9px 8px;
    font-size: .78rem;
  }
  .top nav .icon {
    width: 17px;
    height: 17px;
  }
  #main {
    padding-left: 19px;
    padding-right: 19px;
  }
  .grid {
    grid-template-columns: repeat(3,minmax(0,1fr));
  }
}

@media(max-width:730px) {
  .top {
    grid-template-columns: 1fr auto;
    min-height: 62px;
  }
  .top nav {
    display: none;
  }
  #main {
    padding: 23px 15px 100px;
  }
  #bottom-nav {
    position: fixed;
    z-index: 5;
    inset: auto 0 0;
    display: grid;
    grid-template-columns: repeat(5,minmax(0,1fr));
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--line);
  }
  #bottom-nav a {
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: 5px 0;
    font-size: .66rem;
    min-height: 48px;
  }
  .hero {
    min-height: 275px;
    margin-top: 20px;
  }
  .hero::after {
    background: linear-gradient(90deg,#1b3325ed,#1b3325b6 55%,#1b332530 100%);
  }
  .hero-content {
    padding: 25px;
  }
  .grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 9px;
  }
  .card-media {
    height: 118px;
  }
  .card-body {
    padding: 11px;
    min-height: 95px;
  }
  .card h3 {
    font-size: 1.09rem;
  }
  .searchbar {
    grid-template-columns: 1fr 1fr;
  }
  .searchbar label:first-child {
    grid-column: 1/-1;
  }
  .settings,.shop-layout,.auth {
    grid-template-columns: 1fr;
  }
  .auth-visual {
    min-height: 180px;
    padding: 19px;
  }
  .auth-visual img {
    object-position: center 62%;
  }
  .auth {
    margin-top: 0;
  }
  .auth-content {
    padding: 22px;
  }
  .shop-layout aside {
    grid-template-columns: 1fr;
  }
  .day {
    grid-template-columns: 1fr 1fr;
    padding: 10px;
    gap: 7px;
  }
  .day-label {
    grid-column: 1/-1;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .toast {
    bottom: calc(66px + env(safe-area-inset-bottom));
    right: 10px;
  }
}

@media(max-width:550px) {
  .heading {
    gap: 13px;
  }
  .heading .toolbar {
    width: 100%;
  }
  .heading .toolbar .btn {
    flex: 1;
  }
  .section-head {
    margin-top: 26px;
  }
  .recipe-columns,.import-columns {
    grid-template-columns: 1fr;
  }
  .modal-header {
    padding: 11px 13px;
  }
  .modal-content {
    padding: 13px 13px 19px;
  }
  .ingredient-row {
    grid-template-columns: 1fr 1fr 1.2fr 43px;
  }
  .ingredient-row label:first-child {
    grid-column: 1/-1;
  }
  .fields.three {
    grid-template-columns: 1fr 1fr;
  }
  .quick {
    padding: 8px;
    gap: 7px;
    font-size: .85rem;
  }
  .quick small {
    display: none;
  }
}

.padded-top {
  margin-top: 15px;
}

.shop-layout .shop-group:first-of-type {
  margin-top: 10px;
}

.shop-item .quantity {
  max-width: 30%;
  overflow-wrap: anywhere;
  white-space: normal;
}

.card-link:focus-visible {
  outline-offset: 2px;
}

@media(max-width:730px) {
  .header-end {
    grid-row: 1;
    grid-column: 2;
  }
}
