:root {
  --bg: #f7f8f5;
  --card: #fff;
  --ink: #223d37;
  --muted: #737d76;
  --green: #26765d;
  --line: #e2e6df;
  --soft: #eef1ea;
  --warn: #9a5b12;
  --fisk: #d7e8f4;
  --okse: #f3d9d4;
  --kylling: #f5ecc9;
  --svin: #f4dde9;
  --vegetar: #dce9b6;
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #141a18;
  --card: #1d2522;
  --ink: #e4ece8;
  --muted: #9aa8a1;
  --green: #5fb594;
  --line: #2e3a35;
  --soft: #26302c;
  --warn: #e0a95c;
  --fisk: #23394a;
  --okse: #4a2a26;
  --kylling: #463f22;
  --svin: #45283a;
  --vegetar: #34421f;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    15px/1.5 system-ui,
    -apple-system,
    'Segoe UI',
    sans-serif;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
}
:focus-visible {
  outline: 3px solid #5fa28b;
  outline-offset: 2px;
}
.top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px max(16px, calc((100vw - 1100px) / 2));
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.top h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.5px;
  flex: 1;
}
.brand {
  color: var(--muted);
  text-decoration: none;
}
.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px max(16px, calc((100vw - 1100px) / 2));
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.tab {
  padding: 8px 14px;
  border-radius: 999px;
  white-space: nowrap;
  color: var(--muted);
}
.tab[aria-selected='true'] {
  background: var(--soft);
  color: var(--ink);
  font-weight: 600;
}
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}
h2 {
  margin: 0 0 4px;
  font-size: 20px;
}
h3 {
  font-size: 16px;
  margin: 18px 0 6px;
}
.fine {
  color: var(--muted);
  font-size: 13px;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--green);
  font-weight: 600;
}
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.section-head > div:first-child {
  max-width: 600px;
}
.actions,
.bar {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.primary,
.secondary {
  border-radius: 8px;
  padding: 9px 14px;
}
.primary {
  background: var(--green);
  color: #fff;
}
:root[data-theme='dark'] .primary {
  color: #0f1513;
}
.secondary {
  background: var(--soft);
}
.small {
  padding: 5px 10px;
  font-size: 13px;
}
.ghost {
  color: var(--muted);
  font-size: 13px;
}
.textbtn {
  color: var(--green);
  text-decoration: underline;
  padding: 0;
  font-size: 13px;
}
input,
select {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  max-width: 100%;
}
.week-pick {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--muted);
}
#notice:not(:empty) {
  background: var(--vegetar);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.rules {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--soft);
  font-size: 12px;
  font-weight: 600;
}
.pill.warn {
  color: var(--warn);
  border: 1px solid currentColor;
  background: none;
}
.p-fisk {
  background: var(--fisk);
}
.p-okse {
  background: var(--okse);
}
.p-kylling {
  background: var(--kylling);
}
.p-svin {
  background: var(--svin);
}
.p-vegetar {
  background: var(--vegetar);
}
.days {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 12px;
}
.day {
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.day.off {
  opacity: 0.7;
  border-style: dashed;
}
.day.locked {
  border-color: var(--green);
}
.day-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.eaters {
  display: flex;
  gap: 10px;
}
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.step {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--soft);
  line-height: 1;
}
.val {
  min-width: 14px;
  text-align: center;
  font-weight: 600;
}
.meal h3 {
  margin: 6px 0 4px;
  font-size: 16px;
}
.kid {
  font-size: 13px;
  margin: 0 0 6px;
}
details summary {
  cursor: pointer;
  color: var(--green);
  font-size: 13px;
}
.meal ul,
.meal ol,
.recipe ul,
.recipe ol {
  font-size: 13px;
  padding-left: 20px;
}
.day-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}
.day-actions select {
  flex: 1 1 140px;
  min-width: 0;
  width: 100%;
  font-size: 13px;
}
.shop {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
}
.shop th,
.shop td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.shop th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.shop tr.skipped td:nth-child(n + 2) {
  opacity: 0.45;
  text-decoration: line-through;
}
.inline-form {
  display: flex;
  gap: 8px;
  margin: 14px 0;
  flex-wrap: wrap;
}
.inline-form input:first-child {
  flex: 1 1 220px;
}
#extraQty {
  width: 80px;
}
.pantry-used {
  margin: 10px 0 20px;
}
.chips {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chips li {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 6px 3px 12px;
}
.chip-x {
  color: var(--muted);
  padding: 0 6px;
}
.nemlig-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px 18px 14px;
}
.nemlig-box li {
  margin: 6px 0;
}
.bookmarklet {
  display: inline-block;
  background: var(--green);
  color: #fff;
  border-radius: 8px;
  padding: 3px 10px;
  text-decoration: none;
  cursor: grab;
}
.settings fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  margin: 0 0 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
}
.settings legend {
  font-weight: 600;
  padding: 0 6px;
}
.settings label {
  display: flex;
  gap: 6px;
  align-items: center;
}
.settings input[type='number'] {
  width: 72px;
}
.default-eaters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  width: 100%;
}
.default-eaters label {
  font-size: 13px;
  justify-content: space-between;
}
.default-eaters input[type='number'] {
  width: 56px;
}
.filebtn input {
  display: none;
}
.filebtn {
  cursor: pointer;
}
.recipe {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 6px;
}
.recipe summary {
  color: var(--ink);
  font-size: 15px;
}
.empty {
  padding: 30px;
  text-align: center;
  color: var(--muted);
}
@media (max-width: 600px) {
  .shop th:nth-child(3),
  .shop td:nth-child(3) {
    white-space: nowrap;
  }
  .shop th:nth-child(4),
  .shop td:nth-child(4) {
    width: 40px;
  }
  .days {
    grid-template-columns: 1fr;
  }
}
.pill.own {
  background: var(--green);
  color: #fff;
}
.recipe.is-hidden summary {
  opacity: 0.55;
}
.recipe-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}
.recipe-actions label {
  margin-right: auto;
}
.danger {
  color: #b23b3b;
}
.search {
  width: 100%;
  margin: 4px 0 8px;
  padding: 8px 10px;
}
.editor {
  background: var(--card);
  border: 1px solid var(--green);
  border-radius: 12px;
  padding: 4px 18px 16px;
  margin-bottom: 18px;
}
.editor h4 {
  margin: 16px 0 2px;
}
.editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
  gap: 10px 14px;
}
.editor-grid label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  gap: 3px;
}
.editor-grid .wide {
  grid-column: 1 / -1;
}
.ing-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) 80px 90px minmax(0, 1.5fr) 28px;
  gap: 6px;
  margin: 6px 0;
}
.editor textarea {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  font: inherit;
  color: inherit;
}
.errors:not(:empty) {
  color: #b23b3b;
  background: var(--okse);
  border-radius: 8px;
  padding: 8px 8px 8px 28px;
}
@media (max-width: 600px) {
  .ing-row {
    grid-template-columns: minmax(0, 1fr) 70px 80px 28px;
  }
  .ing-row [name='ing-query'] {
    grid-column: 1 / 4;
    grid-row: 2;
  }
}
.budget-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
}
.budget-row {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.budget-input {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--muted);
}
.budget-input span {
  color: var(--ink);
  font-size: 15px;
}
.budget-input input {
  width: 100px;
  font-weight: 600;
}
.budget-info {
  flex: 1 1 260px;
  min-width: 0;
}
.budget-track {
  height: 8px;
  background: var(--soft);
  border-radius: 999px;
  overflow: hidden;
  margin: 6px 0 4px;
}
.budget-fill {
  height: 100%;
  width: 0;
  background: var(--green);
  border-radius: 999px;
  transition: width 0.3s;
}
.budget-fill.near {
  background: #c99a2e;
}
.budget-fill.over {
  background: #b23b3b;
}
.over {
  color: #b23b3b;
  font-weight: 600;
}
.price-btn {
  color: var(--ink);
  border-bottom: 1px dashed var(--muted);
  padding: 0;
  white-space: nowrap;
}
.price-btn.own {
  color: var(--green);
  border-bottom-style: solid;
}
.price-edit td {
  background: var(--soft);
}
.price-edit input[name='price'] {
  width: 90px;
}
.shop-total {
  text-align: right;
  margin: 10px 4px;
}
.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
}
@media (max-width: 600px) {
  .shop th,
  .shop td {
    padding: 8px 5px;
  }
  .shop td:nth-child(2) .fine {
    display: none;
  }
  .shop td:last-child .textbtn {
    font-size: 12px;
  }
}
