:root {
  color-scheme: light;
  --ink: #173c32;
  --muted: #5f6f69;
  --paper: rgba(255, 253, 248, .94);
  --line: #cfddd7;
  --green: #176b55;
  --red: #c90843;
  --orange: #e96b20;
  --blue: #2f6ea8;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 16px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  overflow-x: clip;
  color: var(--ink);
  background: #f4efe5 url("/assets/images/sauerland-collage-creme-v1.png") center / cover fixed;
  min-height: 100vh;
}
body::before { content: ""; position: fixed; inset: 0; background: rgba(255,253,248,.78); z-index: -1; }
a { color: var(--green); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.account-header {
  position: sticky; top: 0; z-index: 10; min-height: 68px; padding: 10px clamp(14px, 4vw, 44px);
  display: flex; align-items: center; gap: 18px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line);
}
.account-header > *, .account-main > *, .panel > * { min-width: 0; }
.account-header .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; }
.account-header .brand img { width: 48px; height: 40px; object-fit: contain; }
.account-header nav { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.account-header nav a, .button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font-weight: 700; text-decoration: none;
}
.button.primary { background: var(--red); border-color: var(--red); color: white; }
.button.secondary { background: #edf8f4; border-color: #a9cdc0; }
.button.danger { color: #a9002f; border-color: #e7a9ba; }
.button:disabled, input:disabled { cursor: not-allowed; opacity: .52; }
.account-main { width: min(1440px, calc(100% - 28px)); margin: 28px auto 100px; }
.narrow { width: min(560px, calc(100% - 28px)); }
.panel {
  container-type: inline-size;
  scroll-margin-top: 84px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(16px, 3vw, 28px);
  margin-bottom: 18px;
  box-shadow: 0 12px 32px rgba(30,62,51,.08);
}
.panel h1, .panel h2, .panel h3 { margin: 0 0 12px; line-height: 1.15; }
.lead { color: var(--muted); line-height: 1.5; }
.eyebrow { margin: 0 0 5px; color: var(--orange); text-transform: uppercase; font-size: .78rem; font-weight: 800; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
  gap: 12px;
}
.form-grid .wide { grid-column: 1 / -1; }
.preference-group {
  margin: 0;
  padding: 12px;
  border: 1px solid #cbdad3;
  background: rgba(255, 255, 255, .72);
}
.preference-group legend {
  padding: 0 6px;
  font-weight: 800;
  color: #234f43;
}
.preference-group .check {
  display: inline-flex;
  width: auto;
  margin: 4px 14px 4px 0;
}
label { display: grid; gap: 5px; font-weight: 700; }
input, select, textarea {
  width: 100%; min-height: 42px; border: 1px solid #aec4bb; border-radius: 5px; padding: 9px 11px;
  background: #fff; color: #173c32;
}
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; align-items: flex-start; gap: 9px; font-weight: 500; }
.check input { width: 18px; min-height: 18px; margin-top: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.message { display: none; padding: 10px 12px; border-radius: 5px; margin: 12px 0; background: #e7f5ef; border-left: 4px solid var(--green); }
.message.show { display: block; }
.message.error { background: #fff0f3; border-color: var(--red); color: #8b0b30; }
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 10px;
}
.summary-grid > div { background: #fff; border: 1px solid var(--line); padding: 12px; border-radius: 6px; }
.summary-grid span { display: block; color: var(--muted); font-size: .78rem; }
.summary-grid strong { font-size: 1.05rem; }
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 10px;
}
.item-card { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 12px; min-width: 0; }
.item-card h3 { font-size: 1rem; overflow-wrap: anywhere; }
.item-card p { color: var(--muted); font-size: .9rem; line-height: 1.35; }
.price { color: var(--red); font-weight: 800; }
.recipe-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 14px; }
.recipe-heading .lead { max-width: 58ch; }
.portal-kalle {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  border-left: 4px solid #e4b339;
  padding: 10px 12px;
  background: #fff8e8;
}
.portal-kalle img { width: 52px; height: 52px; border-radius: 5px; object-fit: cover; }
.portal-kalle p { margin: 0; color: #46564f; font-size: .88rem; line-height: 1.4; }
.recipe-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(150px, .7fr));
  gap: 10px;
  margin-bottom: 8px;
}
.recipe-status { margin: 0 0 12px; color: var(--muted); font-size: .82rem; font-weight: 700; }
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr));
  align-items: start;
  gap: 12px;
}
.recipe-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.recipe-image { width: 100%; aspect-ratio: 16 / 8; object-fit: cover; background: #f1eee8; }
.recipe-card-body { padding: 12px; }
.recipe-card h3 { margin: 5px 0 7px; overflow-wrap: anywhere; font-size: 1.03rem; }
.recipe-card-body > p { min-height: 3.8em; margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.35; }
.recipe-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.recipe-tags span {
  border-radius: 999px;
  padding: 3px 7px;
  color: #9a430d;
  background: #fff0e4;
  font-size: .69rem;
  font-weight: 800;
  text-transform: uppercase;
}
.recipe-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-top: 10px;
}
.recipe-metrics span { border-left: 3px solid #c5d9d0; padding: 3px 6px; font-size: .76rem; font-weight: 750; }
.nutrition-badge {
  display: inline-flex;
  margin-top: 9px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: .72rem;
  font-weight: 850;
}
.nutrition-badge.estimated { color: #165b39; background: #e5f6e9; }
.nutrition-badge.sourced { color: #315f86; background: #e8f2fb; }
.recipe-details { margin-top: 10px; border-top: 1px solid #e3e9e5; padding-top: 8px; }
.recipe-details summary { color: var(--blue); font-weight: 800; cursor: pointer; }
.recipe-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 10px; }
.recipe-detail-grid section { min-width: 0; }
.recipe-detail-grid h4 { margin: 0 0 5px; font-size: .86rem; }
.recipe-detail-grid ul, .recipe-detail-grid ol { margin: 0; padding-left: 20px; color: #46564f; font-size: .8rem; line-height: 1.4; }
.recipe-detail-grid li + li { margin-top: 4px; }
.recipe-products { margin: 10px 0 0; border-left: 3px solid #e4b339; padding-left: 8px; color: var(--muted); font-size: .78rem; }
.recipe-more-row { justify-content: center; }
.recipe-empty { grid-column: 1 / -1; border: 1px dashed var(--line); padding: 16px; color: var(--muted); }
.table-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; color: var(--muted); }
.table-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 210px; }
.table-actions .button { min-height: 34px; padding: 6px 9px; font-size: .82rem; }
.status { display: inline-block; padding: 3px 7px; border-radius: 999px; background: #edf8f4; font-size: .78rem; font-weight: 800; }
.account-footer { position: fixed; bottom: 0; inset-inline: 0; padding: 8px 14px; background: #153f34; color: white; text-align: center; font-size: .8rem; }
.account-footer a { color: white; margin-left: 12px; }
.hidden { display: none !important; }
img, svg, video { display: block; max-width: 100%; height: auto; }
.customer-dialog {
  width: min(1120px, calc(100% - 28px));
  max-height: min(88vh, 920px);
  margin: auto;
  padding: clamp(16px, 3vw, 28px);
  overflow: auto;
  color: var(--ink);
  background: rgba(255, 253, 248, .99);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(19, 56, 46, .28);
}
.customer-dialog::backdrop { background: rgba(12, 37, 31, .56); backdrop-filter: blur(3px); }
.dialog-heading { position: sticky; top: -28px; z-index: 2; display: flex; align-items: start; justify-content: space-between; gap: 16px; margin: -6px -6px 18px; padding: 12px 6px; background: rgba(255,253,248,.98); border-bottom: 1px solid var(--line); }
.dialog-heading h2 { margin: 0; line-height: 1.15; overflow-wrap: anywhere; }
.customer-summary { margin-bottom: 18px; }
.customer-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.customer-detail-grid section { min-width: 0; padding: 16px 0; border-top: 1px solid var(--line); }
.customer-detail-grid h3, .customer-orders h3 { margin: 0 0 10px; font-size: 1rem; }
.detail-list { margin: 0; }
.detail-list > div { display: grid; grid-template-columns: minmax(120px, .7fr) minmax(0, 1.3fr); gap: 10px; padding: 6px 0; border-bottom: 1px solid #edf1ef; }
.detail-list dt { color: var(--muted); font-size: .78rem; font-weight: 800; }
.detail-list dd { margin: 0; overflow-wrap: anywhere; font-size: .88rem; }
.legal-note { margin: 10px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.4; }
.customer-orders { padding-top: 16px; border-top: 1px solid var(--line); }
.order-history-item { margin-bottom: 8px; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.order-history-item > summary { display: grid; grid-template-columns: minmax(160px, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer; }
.order-history-body { padding: 0 12px 12px; }
.order-history-body p { margin: 9px 0 0; color: var(--muted); font-size: .82rem; }

@container (max-width: 620px) {
  .form-grid .wide { grid-column: auto; }
  .recipe-heading { display: block; }
  .recipe-heading .lead { margin-top: 8px; }
  .recipe-toolbar { grid-template-columns: 1fr 1fr; }
  .recipe-search { grid-column: 1 / -1; }
  .recipe-detail-grid { grid-template-columns: 1fr; }
}

@container (max-width: 390px) {
  .recipe-toolbar { grid-template-columns: 1fr; }
  .recipe-search { grid-column: 1; }
}

@media (max-width: 760px) {
  .account-header { align-items: flex-start; flex-wrap: wrap; }
  .account-header nav { width: 100%; }
  .account-header nav a, .account-header nav button { flex: 1 1 auto; }
  .panel { scroll-margin-top: 184px; }
  .email-table thead { display: none; }
  .email-table, .email-table tbody, .email-table tr, .email-table td { display: block; width: 100%; }
  .email-table tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .email-table td {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 8px;
    padding: 5px 8px;
    border: 0;
    overflow-wrap: anywhere;
  }
  .email-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
  }
  .email-table td[data-label="Aktion"] { align-items: start; }
  .email-table td[data-label="Aktion"] .button { width: 100%; margin-bottom: 5px; }
  .customer-detail-grid { grid-template-columns: 1fr; }
  .dialog-heading { top: -16px; }
  .detail-list > div { grid-template-columns: 1fr; gap: 2px; }
  .order-history-item > summary { grid-template-columns: 1fr auto; }
  .order-history-item > summary > strong { grid-column: 1 / -1; }
}
