:root {
  --paper: #f4efe4;
  --card: #fffdf8;
  --ink: #241c16;
  --muted: #5e564c;
  --line: #e2d7c6;
  --forest: #1d3b32;
  --forest-soft: #e6f0eb;
  --brick: #8d3b30;
  --brick-soft: #f6e6e1;
  --gold: #8d6b3e;
  --shadow: 0 10px 30px rgba(36, 28, 22, 0.06);
  --serif: "Fraunces", "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Outfit", "Segoe UI", sans-serif;
  --text-display: 1.35rem;
  --text-title: 1rem;
  --text-body: 0.875rem;
  --text-caption: 0.72rem;
  --lh: 1.28;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(141, 59, 48, 0.08), transparent 50%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--text-body);
  line-height: var(--lh);
}

.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--order-width, 320px);
  align-items: start;
  min-height: 100vh;
}

.page-main { min-width: 0; }

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

.site-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding: 12px 16px 10px;
  background: var(--forest);
  color: #f6f1e7;
}

.eyebrow {
  margin: 0 0 6px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: #d7c4a2;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 560; letter-spacing: -0.02em; }

h1 {
  display: flex;
  align-items: center;
  gap: 0.28em;
  margin: 0;
  font-size: 1.65rem;
  line-height: 1;
}

.title-ball {
  width: 1cap;
  height: 1cap;
  flex: 0 0 auto;
}

.lede { margin: 4px 0 0; max-width: 42rem; color: #efe6d6; font-size: var(--text-caption); line-height: var(--lh); }

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

.view-nav button {
  border: 1px solid rgba(246, 241, 231, 0.28);
  background: transparent;
  color: #f6f1e7;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: var(--text-caption);
  cursor: pointer;
}

.view-nav button[aria-pressed="true"] {
  background: #f6f1e7;
  color: var(--forest);
  border-color: #f6f1e7;
}

main { padding: 8px 14px 28px; }

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 6px 0 8px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px);
}

.toolbar-fields,
.toolbar-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
}

.toolbar-fields { align-items: end; }

.toolbar-fields .search { flex: 1.4 1 220px; }
.toolbar-fields .select { flex: 1 1 180px; }

label span { display: block; font-size: var(--text-caption); color: var(--muted); margin-bottom: 2px; line-height: var(--lh); }

.search input, .select select {
  width: 100%;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: var(--text-body);
  line-height: var(--lh);
}

.toolbar-flags { align-items: center; }

.check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check span { margin: 0; color: var(--ink); font-size: var(--text-caption); }

.count { margin: 0 0 0 auto; color: var(--muted); font-size: var(--text-caption); }

.terms-card, .buyer-card, .section-intro, .product-card, .dish-card, pre {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: none;
}

.buyer-card {
  padding: 8px 10px;
  margin-bottom: 6px;
  background: var(--forest-soft);
  border-color: color-mix(in srgb, var(--forest) 22%, var(--line));
  scroll-margin-top: 96px;
}

.buyer-kicker {
  margin: 0 0 8px;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--forest);
  font-weight: 600;
}

.buyer-points {
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
}

.buyer-points li { margin: 1px 0; font-size: var(--text-caption); line-height: var(--lh); }

.terms-card { padding: 4px 10px 2px; margin-bottom: 8px; }

.source-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}

.source-switch button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: var(--text-caption);
}

.source-switch button[aria-pressed="true"] {
  background: var(--forest);
  color: #f6f1e7;
  border-color: var(--forest);
}

.source-switch .logo-on-dark { display: none !important; }
body.logos-on .source-switch button[aria-pressed="true"] .logo-on-light { display: none !important; }
body.logos-on .source-switch button[aria-pressed="true"] .logo-on-dark { display: inline-block !important; }
body.logos-on .source-switch button[data-source="pris"] span,
body.logos-on .source-switch button[data-source="crebon"] span,
body.logos-on .source-switch button[data-source="volta"] span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.source-switch .brand-logo { height: 14px; }
.source-switch .brand-logo[data-brand="crebon"] { height: 18px; }
.source-switch .brand-logo[data-brand="volta"] { height: 16px; }

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

.fact {
  background: var(--forest-soft);
  color: var(--forest);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.86rem;
}

.terms-card button.link, .mail-actions .primary, .view-nav button {
  cursor: pointer;
}

button.link {
  border: 0;
  background: none;
  color: var(--brick);
  padding: 0 0 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

#term-details:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0 10px;
}

.term-block {
  border: 1px solid color-mix(in srgb, var(--forest) 18%, var(--line));
  border-radius: 10px;
  overflow: hidden;
  background: var(--card);
}

.term-supplier {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 10px;
  background: var(--forest-soft);
  border-bottom: 1px solid color-mix(in srgb, var(--forest) 16%, var(--line));
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--forest);
  font-weight: 600;
}

.term-supplier .brand-logo { height: 14px; }
.term-supplier .brand-logo[data-brand="crebon"] { height: 17px; }
.term-supplier .brand-logo[data-brand="volta"] { height: 15px; }

body.logos-on .term-supplier:has(.brand-logo) .term-supplier-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.term-list { padding: 2px 10px 4px; }

.term { padding: 8px 0 10px; border-top: 1px solid var(--line); }
.term:first-child { border-top: 0; }
.term h3 { margin: 0 0 4px; font-size: 1.05rem; }
.term p { margin: 0; color: var(--muted); white-space: pre-wrap; }

.category { margin: 4px 0 14px; }

.category h2 {
  margin: 0 0 6px;
  font-size: var(--text-title);
  line-height: var(--lh);
}

.lede-note {
  margin: -4px 0 12px;
  color: var(--muted);
}

.product-card .note {
  display: block;
  margin: 10px 0 0;
  border-radius: 10px;
}

.group-label {
  margin: 18px 0 10px;
  color: var(--gold);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
}

.dish-card, .product-card {
  padding: 8px;
  display: flex;
  flex-direction: column;
}

.shot {
  display: block;
  width: 100%;
  height: 104px;
  object-fit: contain;
  object-position: center;
  padding: 8px 12px;
  box-sizing: border-box;
  background: #fff;
  border-radius: 8px;
  margin-bottom: 4px;
  cursor: zoom-in;
}

.photo-credit {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.dish-card h3, .product-card h3 { margin: 0 0 4px; font-size: var(--text-title); line-height: var(--lh); }

.julbord-block { margin-top: 8px; }

.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.price {
  margin: 0;
  color: var(--brick);
  font-family: var(--serif);
  font-size: var(--text-display);
  line-height: 1.05;
}

.flags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.flag {
  flex: 0 0 auto;
  color: #fff8f4;
  font-family: var(--sans);
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 6px;
  line-height: 1.2;
  border-radius: 999px;
}

.flag.min { background: var(--brick); }
.flag.new { background: #c75b12; }
.flag.vegan { background: #3c8f58; }

.price small { font-family: var(--sans); font-size: var(--text-caption); font-weight: 400; }

.missing { color: var(--muted); font-size: var(--text-caption); font-family: var(--sans); }

.details { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.details li { margin: 2px 0; }

.note, .badge {
  display: inline-block;
  margin: 4px 4px 0 0;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: var(--text-caption);
  line-height: 1.3;
}

.note { background: #f3ecdf; color: #5c4630; }
.badge { background: #efe8dc; }
.badge.hot { background: #f8e7c8; color: #6d4a16; }

/* Logotyper. Syns bara när body har klassen logos-on (USE_BRAND_LOGOS i app.js). */
.brand-logo { display: none; height: 13px; width: auto; vertical-align: middle; }
.brand-logo[data-brand="crebon"] { height: 17px; }
.brand-logo[data-brand="volta"] { height: 15px; }
body.logos-on .brand-logo { display: inline-block; }
.logo-on-dark[data-brand="crebon"],
.logo-on-dark[data-brand="volta"] { filter: brightness(0) invert(1); }
body.logos-on .badge { display: inline-flex; align-items: center; padding: 3px 6px; }
body.logos-on .badge:has(.brand-logo) .badge-label,
body.logos-on .order-supplier:has(.brand-logo) .supplier-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
body.logos-on .order-supplier { position: relative; letter-spacing: 0; text-transform: none; }
body.logos-on .order-supplier .brand-logo { height: 18px; }
body.logos-on .order-supplier .brand-logo[data-brand="crebon"] { height: 22px; }
body.logos-on .order-supplier .brand-logo[data-brand="volta"] { height: 20px; }
.field-label .brand-logo { height: 12px; margin-left: 6px; }
.field-label .brand-logo[data-brand="crebon"] { height: 15px; }
.field-label .brand-logo[data-brand="volta"] { height: 13px; }

.variants { list-style: none; margin: 10px 0 0; padding: 0; }
.variants li, .qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
  border-top: 1px solid var(--line);
  font-size: var(--text-caption);
  line-height: var(--lh);
  min-width: 0;
}

.variants li > span,
.qty-row > span,
.variant-meta {
  min-width: 0;
  overflow-wrap: anywhere;
}

.variants li.pack-block {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.color-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.color-rows li {
  border-top: 0;
  padding: 4px 0;
}

.card-fold { margin-top: 4px; }
.card-more { margin-top: 4px; }
.card-more .details { margin-top: 4px; font-size: var(--text-caption); }

.more-colors {
  align-self: flex-start;
  border: 0;
  background: none;
  color: var(--brick);
  padding: 2px 0 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.slice-check {
  margin-top: 10px;
  padding-bottom: 0;
  cursor: pointer;
}

.qty-row { margin-top: 8px; }
.qty-row span { color: var(--muted); }

.qty {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  overflow: hidden;
}

.qty button {
  width: 26px;
  height: 26px;
  border: 0;
  background: var(--paper);
  cursor: pointer;
}

.qty input {
  width: 36px;
  border: 0;
  background: transparent;
  text-align: center;
  padding: 2px 0;
  font-size: var(--text-body);
}

.qty input::-webkit-outer-spin-button,
.qty input::-webkit-inner-spin-button { appearance: none; margin: 0; }

.dish-card.is-chosen { border-color: var(--forest); box-shadow: 0 0 0 2px rgba(29, 59, 50, 0.16); }

.order-dock {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--forest);
  color: #f6f1e7;
  padding: 10px 12px 8px;
  box-shadow: -8px 0 30px rgba(36, 28, 22, 0.16);
}

.order-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  flex: 0 0 auto;
}

.order-toggle {
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: default;
  padding: 4px 0;
  font-weight: 600;
  font-size: 1.02rem;
}

.order-close-hint { display: none; }

#order-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  margin-top: 8px;
}

.order-empty {
  margin: 12px 0 0;
  color: #d7c4a2;
  font-size: 0.92rem;
}

.order-backdrop,
.order-peek { display: none; }

.order-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding: 4px 0;
  border-top: 1px solid rgba(246, 241, 231, 0.16);
  font-size: var(--text-caption);
  line-height: var(--lh);
}

.order-line > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.order-line button {
  border: 0;
  background: none;
  color: #f0d2cb;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.order-sum { margin: 6px 0 0; font-family: var(--serif); font-size: var(--text-display); line-height: 1.1; }
.order-sum-note { margin: 4px 0 0; color: #d7c4a2; font-size: 0.9rem; }

.ghost, .clear-order {
  border: 1px solid rgba(246, 241, 231, 0.35);
  background: transparent;
  color: #f6f1e7;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: var(--text-caption);
  cursor: pointer;
}

.clear-order {
  display: block;
  margin: 10px 0 0;
}

.ghost:hover, .clear-order:hover { background: rgba(246, 241, 231, 0.1); }

.order-dock #copy-status { color: #d7c4a2; }
.artnr-line {
  margin: 2px 0 0;
  color: var(--forest);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.variant-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.artnr { font-variant-numeric: tabular-nums; color: var(--forest); font-weight: 600; }

.pack-price { color: var(--forest); font-size: 0.82rem; font-weight: 600; }
.pack-open { color: var(--muted); font-size: 0.82rem; }

.order-copies {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.order-copies .primary,
.order-bar .ghost {
  width: 100%;
}

.order-peek {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 7;
  border: 0;
  border-radius: 16px;
  padding: 14px 16px;
  background: var(--forest);
  color: #f6f1e7;
  box-shadow: 0 8px 30px rgba(36, 28, 22, 0.2);
  cursor: pointer;
  text-align: left;
  font-weight: 600;
}

.order-peek span:last-child {
  flex: 0 0 auto;
  font-size: 0.82rem;
  font-weight: 500;
  color: #d7c4a2;
}

.order-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 7;
  background: rgba(20, 16, 12, 0.45);
}

.order-supplier {
  margin: 12px 0 0;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #d7c4a2;
}

.mail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 0 0 14px;
}

.empty {
  padding: 28px;
  color: var(--muted);
}

.section-intro { padding: 8px 10px 4px; margin-bottom: 8px; }
.section-intro h2 { margin: 0 0 2px; font-size: var(--text-title); }
.section-intro p { margin: 0 0 6px; color: var(--muted); max-width: 46rem; font-size: var(--text-caption); }

.tier-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.tier-pill {
  border-radius: 12px;
  padding: 8px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
}
.tier-pill strong { display: block; font-family: var(--serif); font-size: 1.2rem; }
.tier-pill.lyx { background: var(--forest); color: #f6f1e7; border-color: var(--forest); }

.julbord-check { margin: 0 0 12px; }

.table-wrap { overflow-x: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 3px 6px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: var(--text-caption); line-height: var(--lh); overflow-wrap: anywhere; }
th { font-weight: 600; background: #fbf7f0; position: sticky; top: 0; }
td.yes { color: var(--forest); font-weight: 600; text-align: center; white-space: nowrap; }
td.no { color: #c8bfb2; text-align: center; white-space: nowrap; }
tr.group td {
  background: var(--forest);
  color: #f6f1e7;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding-top: 8px;
  padding-bottom: 8px;
}

.primary {
  position: relative;
  background: var(--brick);
  color: white;
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: var(--text-caption);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease, color 0.2s ease;
}

.primary.is-spinning {
  overflow: hidden;
  color: transparent;
}

.copy-ball {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  max-width: 22px;
  max-height: 22px;
  margin: -11px 0 0 -11px;
  object-fit: contain;
  pointer-events: none;
  animation: copy-spin 0.55s linear 1;
}

@keyframes copy-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.primary:hover { filter: brightness(1.08); }

.primary:active { transform: scale(0.94); }

.primary.is-copied {
  background: #e7f2ea;
  color: var(--forest);
}
#copy-status { margin: 0; color: var(--forest); min-height: 1.2em; }
pre {
  margin: 0;
  padding: 12px;
  white-space: pre-wrap;
  font-family: "Segoe UI", var(--sans);
  font-size: var(--text-body);
  line-height: 1.45;
}

pre strong {
  font-weight: 700;
}

.page-strip, .page-feature {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  margin: 0 0 18px;
  padding-bottom: 4px;
}

.page-strip button, .page-feature button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 14px;
  padding: 8px;
  cursor: zoom-in;
  text-align: left;
  box-shadow: var(--shadow);
}

.page-strip button { width: 148px; }
.page-feature button { width: min(420px, 86vw); }

.page-strip img, .page-feature img {
  display: block;
  width: 100%;
  background: var(--paper);
  border-radius: 8px;
  object-fit: contain;
}

.page-strip img { height: 198px; }
.page-feature img { height: auto; max-height: 520px; }

.page-strip span, .page-feature span {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}

.see-page {
  margin-top: 10px;
  border: 0;
  background: none;
  color: var(--forest);
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 0.86rem;
}

dialog {
  border: 0;
  padding: 16px;
  border-radius: 18px;
  background: #1c1915;
  color: #f6f1e7;
  max-width: min(880px, 96vw);
  max-height: 94vh;
}

dialog::backdrop { background: rgba(20, 16, 12, 0.72); }

dialog img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
  background: white;
  border-radius: 8px;
}

#lightbox-caption { margin: 8px 0 0; }

.lightbox-close {
  border: 0;
  background: transparent;
  color: #f6f1e7;
  cursor: pointer;
  margin-bottom: 8px;
  padding: 0;
}

button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--brick);
  outline-offset: 2px;
}

@media (max-width: 959px) {
  .page { display: block; }
  body { padding-bottom: 84px; }
  .order-dock {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(360px, 100%);
    height: 100%;
    z-index: 8;
    transform: translateX(100%);
    transition: transform 0.2s ease;
    box-shadow: none;
  }
  .order-dock.is-open {
    transform: none;
    box-shadow: -8px 0 30px rgba(36, 28, 22, 0.2);
  }
  .order-toggle { cursor: pointer; }
  .order-close-hint { display: inline; margin-left: 8px; color: #d7c4a2; font-weight: 500; font-size: 0.82rem; }
  .order-peek { display: flex; }
  .order-peek[hidden] { display: none; }
  .order-backdrop.is-on { display: block; }
}

@media (max-width: 760px) {
  .site-header { flex-direction: column; align-items: flex-start; padding: 22px 16px; }
  main { padding: 16px 16px 48px; }
  .count { margin-left: 0; }
  .search input, .select select { width: 100%; min-width: 0; }
  .search, .select { width: 100%; }
}
