/* ========================================
   speisen_details.css
   All styles for speisen details page
   ======================================== */

/* ========================================
   Page Background & Layout
   ======================================== */
body.speisen-details-page,
body.speisen-details-page .ke-page-content {
  background: var(--ke-bg) !important;
}
body.speisen-details-page {
  color: var(--ke-text);
  font-family: var(--font-family-base, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}

/* ========================================
   Header / Image Layout
   ======================================== */
body.speisen-details-page .header-container,
body.speisen-details-page .detail-page .header-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: stretch;
  background: var(--ke-surface);
  padding: 12px;
  margin: 8px auto;
  max-width: var(--layout-max-width, 900px);
  gap: 12px;
  width: calc(100% - 16px);
  border: 1px solid var(--ke-border);
  border-radius: var(--ke-radius);
}
body.speisen-details-page .header-text {
  flex: 1 1 280px;
  min-width: 0;
  padding-right: 10px;
}
body.speisen-details-page .header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
}
body.speisen-details-page .header-actions .ke-btn {
  white-space: nowrap;
  flex-shrink: 0;
  width: auto;
}
body.speisen-details-page .header-actions form {
  display: contents;
}
body.speisen-details-page .header-actions a {
  text-decoration: none;
}
body.speisen-details-page .header-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}
body.speisen-details-page .sd-action-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--ke-border);
  border-radius: 10px;
  background: var(--ke-surface);
}
body.speisen-details-page .sd-action-group__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ke-text-muted);
}
body.speisen-details-page .sd-action-group__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
body.speisen-details-page .item-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 8px;
}
body.speisen-details-page .item-diet-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
body.speisen-details-page .image-container,
body.speisen-details-page .detail-page .image-container {
  flex: 0 0 clamp(200px, 26vw, 320px);
  width: clamp(200px, 26vw, 320px);
  max-width: clamp(200px, 26vw, 320px);
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-height: 240px;
}
body.speisen-details-page .gallery-main-wrap {
  flex: 1 1 auto;
  min-height: 220px;
  display: flex;
  flex-direction: column;
}
body.speisen-details-page #speisen-gallery-main-image {
  flex: 1 1 auto;
  width: 100%;
  min-height: 220px;
  object-fit: cover;
  object-position: center;
  border-radius: var(--ke-radius-sm);
  border: 1px solid var(--ke-border);
  cursor: zoom-in;
  display: block;
}
body.speisen-details-page #speisen-gallery-manage-open {
  width: auto;
}

/* ========================================
   Section Title
   ======================================== */
.section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--ke-text);
  letter-spacing: 0.01em;
}

/* ========================================
   Info Blocks (Cards)
   ======================================== */
.info-block {
  width: calc(100% - 16px);
  max-width: var(--layout-max-width);
  margin: 0 auto 16px;
  padding: 16px;
  background: var(--ke-surface);
  border: 1px solid var(--ke-border);
  border-radius: var(--ke-radius);
}

/* ========================================
   Info Rows
   ======================================== */
.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  margin: 0;
  border-bottom: 1px solid var(--ke-border);
}
.info-row + .info-row {
  margin-top: 0;
}

.info-label {
  flex: 2;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ke-text);
  padding: 8px 4px 8px 0;
}

.info-value {
  flex: 1;
  font-size: 14px;
  text-align: center;
  white-space: nowrap;
  overflow: visible;
  color: var(--ke-text);
  padding: 8px 0;
}

.info-row div {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  gap: 5px;
}

/* ========================================
   Speisen Table Rows
   ======================================== */
.speisen-table-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(140px, var(--speisen-values-col, 188px));
  column-gap: var(--speisen-values-gap, 22px);
  align-items: center !important;
  justify-content: initial !important;
}
.speisen-table-row > .info-label {
  grid-column: 1;
  min-width: 0;
}
.speisen-table-row > .speisen-values-grid {
  grid-column: 2;
}
.speisen-table-row .info-value {
  width: auto !important;
}
.speisen-values-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--speisen-values-gap, 22px);
  align-items: center;
  width: 100%;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
.speisen-values-grid .speisen-qty-cell,
.speisen-values-grid .speisen-price-cell,
.zutat-values-row .speisen-qty-cell,
.zutat-values-row .speisen-price-cell {
  display: block;
  width: 100%;
  min-width: 0;
  text-align: right !important;
  justify-self: end;
  white-space: nowrap;
}
.speisen-values-grid .speisen-qty-cell,
.zutat-values-row .speisen-qty-cell {
  color: var(--ke-text-muted);
}
.speisen-table-row--head .speisen-values-grid .speisen-qty-cell,
.speisen-table-row--head .speisen-values-grid .speisen-price-cell {
  color: var(--ke-text-muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ========================================
   Zutaten / Ingredient Styles
   ======================================== */
.zutaten-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.zutaten-section-title {
  min-width: 0;
  flex: 0 1 auto;
  font-size: 16px;
  font-weight: 700;
  color: var(--ke-text);
}
.zutaten-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  flex: 1 1 420px;
  margin-left: auto;
}
.zutaten-header-actions .ke-btn {
  max-width: 100%;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
}
.zutaten-header-actions-main,
.zutaten-header-actions-side {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  max-width: 100%;
}
.zutaten-header-actions-main {
  flex: 1 1 320px;
  justify-content: flex-end;
}
.zutaten-header-actions-side {
  flex: 0 1 auto;
  justify-content: flex-end;
}

.zutat-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  width: 100%;
  min-width: 0;
  text-align: left;
}
.zutat-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
  align-self: stretch;
}
.zutat-main-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  flex: 1 1 0;
  width: 100%;
  max-width: none;
  min-width: 0;
  text-align: left;
  align-self: stretch;
  margin-right: auto;
}
.zutat-name-row {
  display: block;
  width: 100%;
  min-width: 0;
  overflow: visible;
  text-align: left;
}
.zutat-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  justify-content: flex-start;
  width: 100%;
  text-align: left;
  align-self: stretch;
  margin-right: auto;
}
.zutat-values-row {
  display: grid;
  width: min(100%, var(--speisen-values-col, 188px));
  margin-left: auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--speisen-values-gap, 22px);
  align-items: center;
  font-size: 13px;
  color: var(--ke-text-muted);
  padding-top: 2px;
  font-variant-numeric: tabular-nums;
}
.zutat-values-row .zutat-menge {
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 4px;
  white-space: nowrap;
  font-size: 1.18em;
}
.zutat-values-row .zutat-menge-value {
  font-size: 1.3em;
  font-weight: 700;
  line-height: 1;
}
.zutat-values-row .zutat-menge-unit {
  font-size: 1.08em;
  font-weight: 600;
  line-height: 1;
}
.zutat-values-row .preis-trend-span.speisen-price-cell {
  border-left: none !important;
  padding-left: 0 !important;
  margin-left: 0 !important;
  font-weight: 600 !important;
  letter-spacing: 0.01em;
  touch-action: manipulation;
}

.ingredient-entry-row {
  display: flex !important;
  flex-direction: column !important;
  border-bottom: 1px solid var(--ke-border) !important;
  padding: 6px 0 !important;
  margin: 0 !important;
  align-items: stretch !important;
  text-align: left !important;
}
.ingredient-entry-row > .zutat-card {
  width: 100%;
  margin-right: auto;
}
.ingredient-entry-row .zutat-meta-row,
.ingredient-entry-row .diet-flags-row {
  justify-content: flex-start !important;
  margin-left: 0 !important;
  margin-right: auto !important;
}
.ingredient-entry-row .ingredient-name-cell,
.ingredient-entry-row .ingredient-name-cell a,
.ingredient-entry-row .diet-flags-row,
.ingredient-entry-row .on-stock-check,
.ingredient-entry-row .on-shopping-check {
  display: block;
  width: auto;
  text-align: left;
  justify-content: flex-start;
  align-self: flex-start;
}
.ingredient-entry-row .ingredient-name-cell,
.ingredient-entry-row .ingredient-name-cell a {
  width: 100%;
}
.ingredient-name-cell {
  min-width: 0;
  flex: 0 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ingredient-name-cell a {
  color: var(--ke-primary) !important;
  text-decoration: none;
}
.ingredient-name-cell a:hover {
  text-decoration: underline;
}
.ingredient-main-cell {
  flex: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  align-items: center;
  column-gap: 8px;
  min-width: 0;
}
.ingredient-block-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  border-bottom: 1px solid var(--ke-border) !important;
  padding: 6px 0 !important;
  margin: 0 !important;
  background: var(--ke-surface) !important;
}

.loss-applied {
  color: var(--ke-primary) !important;
}

/* ========================================
   Diet Badges
   ======================================== */
.diet-flags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 2px;
  width: 100%;
  justify-content: flex-start;
  align-items: center;
  text-align: left;
  margin-right: auto;
}
.diet-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(0, 0, 0, 0.42);
  color: #f5f7fa;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.diet-vegan { color: #76e593; border-color: rgba(118, 229, 147, 0.6); }
.diet-glutenfrei { color: #ffd56a; border-color: rgba(255, 213, 106, 0.6); }
.diet-laktosefrei { color: #9fd7ff; border-color: rgba(159, 215, 255, 0.6); }
.diet-alkohol { color: #ffb26b; border-color: rgba(255, 178, 107, 0.6); }

/* ========================================
   Stock & Shopping Checks
   ======================================== */
.on-shopping-check {
  color: var(--ke-success);
  margin-left: 6px;
  font-weight: 600;
  font-size: 0.85em;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  flex: 0 0 auto;
}
.on-stock-check {
  margin-left: 6px;
  font-weight: 600;
  font-size: 0.85em;
  flex: 0 0 auto;
}
.stock-ok { color: var(--ke-success); }
.stock-low { color: var(--ke-danger); }

/* ========================================
   Small / Utility Buttons
   ======================================== */
.small-button {
  background-color: var(--ke-primary);
  color: white;
  border: none;
  padding: 5px 10px;
  margin: 5px;
  border-radius: var(--ke-radius-sm);
  cursor: pointer;
  font-weight: bold;
}
.small-button:hover { filter: brightness(1.1); }
.small-button:active { transform: scale(0.98); }

.edit-button {
  background-color: var(--ke-primary);
  color: white;
  border: none;
  border-radius: var(--ke-radius-sm);
  padding: 5px 10px;
  margin-left: 10px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
}
.edit-button:hover { filter: brightness(1.1); }

.bestand-open-trigger {
  cursor: pointer;
  text-decoration: underline;
  background: transparent;
  border: none;
  color: var(--ke-primary) !important;
  padding: 0;
  font: inherit;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  -webkit-appearance: none;
  appearance: none;
}

.block-gear-btn,
.zutat-gear-btn {
  background: none;
  border: none;
  color: var(--ke-text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  -webkit-appearance: none;
  appearance: none;
}
.block-gear-btn:hover,
.zutat-gear-btn:hover {
  color: var(--ke-text);
}

/* ========================================
   Context Menus (Zutat & Block)
   ======================================== */
.zutat-menu,
.block-menu {
  background: var(--ke-surface) !important;
  border: 1px solid var(--ke-border) !important;
  border-radius: var(--ke-radius) !important;
  width: 240px !important;
  min-width: 240px !important;
  max-width: 240px !important;
  box-shadow: var(--ke-shadow-s) !important;
  overflow: hidden;
  box-sizing: border-box !important;
}
.zutat-menu form,
.block-menu form {
  margin: 0 !important;
  padding: 0 !important;
  display: block !important;
}
.zutat-menu button,
.zutat-menu form button,
.block-menu button {
  width: 100% !important;
  display: block !important;
  text-align: left !important;
  background: var(--ke-surface) !important;
  color: var(--ke-text) !important;
  border: 0 !important;
  border-top: 1px solid var(--ke-border) !important;
  border-radius: 0 !important;
  padding: 0 14px !important;
  min-height: 46px !important;
  height: 46px !important;
  line-height: 1.2 !important;
  font-size: 16px !important;
  font-weight: 500 !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
  font-family: inherit !important;
}
.zutat-menu button:first-child,
.block-menu button:first-child {
  border-top: 0 !important;
}
.zutat-menu button:hover,
.zutat-menu form button:hover,
.block-menu button:hover {
  background: var(--ke-surface-2) !important;
}
.zutat-menu button:disabled,
.zutat-menu form button:disabled {
  color: var(--ke-text-muted) !important;
  background: var(--ke-surface) !important;
  cursor: default !important;
}
.menu-action-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  text-align: left !important;
  min-height: 46px !important;
  height: 46px !important;
}
.menu-action-icon {
  width: 18px;
  min-width: 18px;
  text-align: center;
  color: var(--ke-text-muted);
  font-size: 16px;
  line-height: 1;
  font-weight: 600;
}
.zutat-menu .menu-action-btn > span,
.block-menu .menu-action-btn > span {
  font-size: 16px !important;
  line-height: 1.2 !important;
  font-weight: inherit !important;
}
.menu-action-btn--danger {
  color: var(--ke-danger) !important;
  font-weight: 600 !important;
}
.menu-action-btn--success {
  color: var(--ke-success) !important;
  font-weight: 600 !important;
}

/* ========================================
   Button Styles
   ======================================== */
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 90px;
  padding: 10px 5px;
  border-radius: var(--ke-radius-sm);
  font-size: 13px;
  font-weight: bold;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background-color: var(--ke-primary);
  color: white;
}
.button:hover { filter: brightness(1.1); }
.button:active { transform: scale(0.98); }

.remove-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 90px;
  padding: 10px 5px;
  border-radius: var(--ke-radius-sm);
  font-size: 13px;
  font-weight: bold;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background-color: var(--ke-danger);
  color: white;
}
.remove-button:hover { filter: brightness(1.2); }

.button-container {
  display: flex;
  position: relative;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 20px;
  z-index: auto;
}

/* ========================================
   Detail Section
   ======================================== */
.detail-section {
  position: relative;
  z-index: 10;
  background-color: var(--ke-surface);
  margin-bottom: 30px;
}
.detail-section .detail-actions {
  justify-content: stretch;
}
.detail-section .detail-actions > .ke-btn {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  max-width: none;
}

/* ========================================
   Quantity Controls
   ======================================== */
.quantity-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
}
.quantity-group {
  display: flex;
  align-items: center;
  border: 1px solid var(--ke-border);
  border-radius: var(--ke-radius-sm);
  overflow: hidden;
  background-color: var(--ke-surface-2);
}
.unit-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.quantity-input {
  width: 60px;
  padding: 6px 3px;
  text-align: center;
  font-size: 14px;
  border: none;
  border-left: 1px solid var(--ke-border);
  border-right: 1px solid var(--ke-border);
  background-color: var(--ke-surface-2);
  color: var(--ke-text);
}
.adjust-button {
  width: 30px;
  padding: 6px 0;
  font-size: 16px;
  font-weight: bold;
  background-color: var(--ke-primary);
  border: none;
  cursor: pointer;
  color: #ffffff;
  transition: background-color 0.2s;
}
.adjust-button:hover { filter: brightness(1.1); }
.save-button {
  background-color: var(--ke-primary);
  padding: 6px 10px;
  font-size: 14px;
}
.save-button:hover { filter: brightness(1.1); }
.styled-input {
  width: 100px;
  padding: 6px 8px;
  border-radius: var(--ke-radius-sm);
  border: 1px solid var(--ke-border);
  font-size: 14px;
  background-color: var(--ke-surface-2);
  color: var(--ke-text);
}

/* ========================================
   Overlay / Modal Styles
   ======================================== */
.edit-overlay,
.quantity-unit-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  padding: 15px;
}
.edit-overlay.hidden {
  display: none !important;
}
.overlay-content {
  background-color: var(--ke-surface);
  padding: 15px;
  border-radius: var(--ke-radius);
  border: 1px solid var(--ke-border);
  box-shadow: var(--ke-shadow-s);
  width: 500px;
  max-width: 900px;
  max-height: 80vh;
  overflow-y: auto;
  color: var(--ke-text);
  position: relative;
}
.overlay-content h3 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 16px;
  text-align: center;
  color: var(--ke-success);
}
.text-edit-area {
  width: 100%;
  min-height: 600px;
  max-height: 600px;
  padding: 10px;
  margin-bottom: 15px;
  border-radius: var(--ke-radius-sm);
  border: 1px solid var(--ke-border);
  background-color: var(--ke-surface-2);
  color: var(--ke-text);
  font-size: 16px;
  resize: vertical;
  overflow-y: auto;
}
#edit-zutat-menge, #edit-zutat-einheit {
  min-height: unset;
  max-height: unset;
  height: auto;
  overflow-y: visible;
}
.button-group {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

/* ========================================
   Price Tooltip
   ======================================== */
.preis-trigger-button,
.zutat-values-row .preis-trend-button {
  display: block;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  text-align: right;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
.preis-desktop-trigger { display: block; }
.preis-mobile-backdrop {
  display: none;
  position: fixed;
  top: var(--ke-content-safe-top, var(--top-nav-height, 64px));
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2147483646;
  background: rgba(0, 0, 0, .88);
}
.preis-mobile-details {
  display: none;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  justify-self: end;
  align-self: center;
}
.preis-mobile-details > summary {
  display: block;
  width: 100%;
  list-style: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  text-align: right;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.preis-mobile-details > summary::-webkit-details-marker { display: none; }
.preis-mobile-panel {
  position: fixed;
  left: 50%;
  right: auto;
  width: min(calc(100vw - 24px), 480px);
  transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--bottom-nav-height, 60px) + var(--footer-height, 42px) + 12px);
  z-index: 2147483647;
  background: var(--ke-surface);
  color: var(--ke-text);
  border: 1px solid var(--ke-border);
  border-radius: 12px;
  padding: 8px 10px;
  box-sizing: border-box;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - var(--bottom-nav-height, 60px) - var(--footer-height, 42px) - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  line-height: 1.45;
  font-size: 13px;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
.preis-mobile-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}
.preis-mobile-panel-title {
  font-size: 12px;
  color: var(--ke-primary);
  letter-spacing: .01em;
  font-weight: 700;
}
.preis-mobile-panel-note {
  font-size: 10px;
  color: var(--ke-text-muted);
  text-align: right;
}
.preis-mobile-panel-body {
  display: grid;
  gap: 6px;
  width: 100%;
  min-width: 0;
  max-width: none;
}
.preis-tooltip-section {
  display: grid;
  gap: 2px;
}
.preis-tooltip-section + .preis-tooltip-section {
  padding-top: 6px;
  border-top: 1px solid var(--ke-border);
}

/* ========================================
   Aggregate Nutrition/Ingredient Blocks
   ======================================== */
.info-row-ingredient-aggregate,
.info-row-nutrition-aggregate {
  display: block !important;
  padding: 8px 0 !important;
  margin: 0 !important;
  border-bottom: 0 !important;
}
.info-row-ingredient-aggregate .info-label {
  display: block !important;
  flex: none !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  margin-bottom: 6px;
}
.info-row-ingredient-aggregate .info-value {
  display: block !important;
  flex: none !important;
  width: 100% !important;
  text-align: left !important;
  white-space: normal !important;
  overflow: visible !important;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.info-row-ingredient-aggregate div,
.info-row-nutrition-aggregate .pi-value div {
  display: block !important;
  flex: none !important;
  justify-content: flex-start !important;
  width: auto !important;
}
.info-row-ingredient-aggregate .aggregated-row {
  display: grid !important;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}
.info-row-ingredient-aggregate .ingredient-item {
  display: block !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.info-row-nutrition-aggregate .pi-field,
.info-row-ingredient-aggregate .pi-field {
  background: var(--ke-surface);
  border: 2px solid var(--ke-border) !important;
  border-radius: var(--ke-radius);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
  padding: 12px 14px;
  display: flex !important;
  flex-direction: column !important;
}
#speisen-naehrwerte-aggregate,
#speisen-zutaten-aggregate {
  background: var(--ke-surface);
}
#speisen-naehrwerte-aggregate .pi-label,
#speisen-zutaten-aggregate .pi-label {
  display: inline-flex !important;
  align-self: flex-start;
  background: var(--ke-text);
  color: var(--ke-bg);
  border: 1px solid var(--ke-border);
  border-radius: var(--ke-radius-sm);
  padding: 2px 7px;
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 800;
  margin: 0 0 8px 0;
  opacity: 1;
}
#speisen-naehrwerte-aggregate .pi-value,
#speisen-zutaten-aggregate .pi-value {
  font-size: .96rem;
  line-height: 1.45;
  letter-spacing: .005em;
  white-space: normal;
}
#speisen-naehrwerte-aggregate .pi-value {
  border-top: 2px solid var(--ke-border);
  padding-top: 8px;
}
.info-row-nutrition-aggregate .missing-data-links,
.info-row-ingredient-aggregate .missing-data-links {
  display: block !important;
  text-align: left;
  line-height: 1.4;
}
.info-row-nutrition-aggregate .missing-link-wrap,
.info-row-ingredient-aggregate .missing-link-wrap {
  display: inline !important;
}
.info-row-nutrition-aggregate .missing-data-link,
.info-row-ingredient-aggregate .missing-data-link {
  display: inline !important;
  width: auto !important;
  min-width: 0 !important;
  text-align: left !important;
  margin: 0 !important;
  padding: 0 !important;
  white-space: normal !important;
  color: var(--ke-warning) !important;
  text-decoration: underline;
  background: transparent !important;
  border: 0 !important;
  cursor: pointer;
}

/* ========================================
   Autocomplete
   ======================================== */
.ui-autocomplete {
  max-width: none;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
  background-color: var(--ke-surface);
  border: 1px solid var(--ke-border);
  border-radius: var(--ke-radius-sm);
  padding: 0;
  z-index: 5000;
  position: absolute;
}
.ui-front { z-index: 5000 !important; }
.autocomplete-item {
  display: flex;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid var(--ke-border);
  transition: background-color 0.3s ease;
}
.autocomplete-item:hover {
  background-color: var(--ke-surface-2);
}
.autocomplete-image {
  width: 30px;
  height: 30px;
  margin-right: 10px;
  object-fit: cover;
  border-radius: var(--ke-radius-sm);
}
.autocomplete-label {
  flex: 1;
  color: var(--ke-text);
  font-size: 14px;
}
.ui-autocomplete .ui-menu-item {
  padding: 0;
  margin: 0;
  border: none;
}
.ui-autocomplete .ui-menu-item:last-child .autocomplete-item {
  border-bottom: none;
}
.ui-autocomplete.ui-menu,
.ui-autocomplete .ui-menu-item-wrapper,
.ui-autocomplete .ui-menu-item {
  background-color: var(--ke-surface) !important;
  color: var(--ke-text) !important;
  border-color: var(--ke-border) !important;
}
.ui-autocomplete .ui-state-active,
.ui-autocomplete .ui-menu-item-wrapper.ui-state-active {
  background-color: var(--ke-surface-2) !important;
  color: var(--ke-text) !important;
  border-color: var(--ke-border) !important;
}
.ui-state-active,
.ui-widget-content .ui-state-active {
  background: var(--ke-surface-2) !important;
  border: none !important;
  margin: 0 !important;
}

/* ========================================
   Center Content
   ======================================== */
.center-content {
  width: 100%;
  max-width: var(--layout-max-width);
  margin: 0 auto;
  padding: 10px;
}

/* ========================================
   Truncate Utility
   ======================================== */
.truncate-three-words {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================
   Gallery Modal
   ======================================== */
#speisen-gallery-manage-modal {
  display: none;
  position: fixed;
  top: var(--ke-content-safe-top, var(--top-nav-height, 64px));
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10060;
  background: rgba(0, 0, 0, .86);
  align-items: center;
  justify-content: center;
  padding: 12px;
  padding-bottom: calc(var(--ke-content-safe-bottom, calc(var(--bottom-nav-height, 60px) + var(--footer-height, 42px))) + 12px);
  box-sizing: border-box;
}

/* ========================================
   Light Mode Overrides
   ======================================== */
[data-theme="light"] body.speisen-details-page {
  color: var(--ke-text);
}
[data-theme="light"] .diet-badge {
  border-color: rgba(0, 0, 0, 0.18);
  background: rgba(255, 255, 255, 0.8);
}
[data-theme="light"] .ingredient-name-cell a {
  color: var(--ke-primary) !important;
}
[data-theme="light"] .zutat-menu,
[data-theme="light"] .block-menu {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}
[data-theme="light"] .preis-mobile-panel {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
[data-theme="light"] #speisen-gallery-manage-modal {
  background: rgba(255, 255, 255, .86);
}

/* ========================================
   Inline-Style Overrides for Light Mode
   Fängt hartcodierte background:#000 / color:#xxx ab
   ======================================== */
[data-theme="light"] [style*="background:#000"],
[data-theme="light"] [style*="background:#000000"],
[data-theme="light"] [style*="background-color:#000"] {
  background: var(--ke-bg) !important;
}
[data-theme="light"] [style*="background:#0b0b0b"],
[data-theme="light"] [style*="background:#111"] {
  background: var(--ke-surface-2) !important;
}
[data-theme="light"] [style*="color:#9ecfff"],
[data-theme="light"] [style*="color:#7ecfff"] {
  color: var(--ke-primary) !important;
}
[data-theme="light"] [style*="color:#ff7b7b"] {
  color: var(--ke-danger) !important;
}
[data-theme="light"] [style*="color:#ffc107"] {
  color: var(--ke-warning) !important;
}
[data-theme="light"] [style*="color:#ddd"],
[data-theme="light"] [style*="color:#888"],
[data-theme="light"] [style*="color:#aaa"],
[data-theme="light"] [style*="color:#c9d3df"],
[data-theme="light"] [style*="color:#95afcd"],
[data-theme="light"] [style*="color:#9aa8b8"] {
  color: var(--ke-text-muted) !important;
}
[data-theme="light"] [style*="color:#fff"],
[data-theme="light"] [style*="color:#f5f7fa"],
[data-theme="light"] [style*="color:#f2f2f2"] {
  color: var(--ke-text) !important;
}
[data-theme="light"] [style*="border-color:#444"],
[data-theme="light"] [style*="border-color:#2f2f2f"] {
  border-color: var(--ke-border) !important;
}
[data-theme="light"] #speisen-gallery-main-caption {
  color: var(--ke-text-muted) !important;
}
[data-theme="light"] #speisen-gallery-counter {
  color: var(--ke-text-muted) !important;
}
[data-theme="light"] .bestand-open-trigger {
  color: var(--ke-primary) !important;
}
[data-theme="light"] [style*="border-top: 2px solid #555"],
[data-theme="light"] [style*="border-top:2px solid #555"] {
  border-top-color: var(--ke-border) !important;
}
[data-theme="light"] [style*="border-top:1px dashed #444"] {
  border-top-color: var(--ke-border) !important;
}

/* ========================================
   Responsive Media Queries
   ======================================== */
@media (max-width: 768px) {
  body.speisen-details-page .header-container,
  body.speisen-details-page .detail-page .header-container {
    flex-direction: column;
    align-items: flex-start;
  }
  body.speisen-details-page .header-text {
    flex: 0 0 100%;
    padding-right: 0;
  }
  body.speisen-details-page .image-container,
  body.speisen-details-page .detail-page .image-container {
    flex: 0 0 100%;
    width: 100%;
    max-width: 400px;
    min-height: unset;
    margin: 0 auto;
    align-self: auto;
  }
  body.speisen-details-page .gallery-main-wrap { min-height: unset; }
  body.speisen-details-page #speisen-gallery-main-image {
    min-height: clamp(180px, 55vw, 280px);
    height: clamp(180px, 55vw, 280px);
    flex: 0 0 auto;
  }

  .info-block {
    width: calc(100% - 12px);
  }
  .info-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    margin: 0;
  }
  .info-label {
    flex: 2;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .info-value {
    flex: 1;
    font-size: 12px;
    text-align: center;
    white-space: nowrap;
    overflow: visible;
  }
  .info-row div {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    gap: 5px;
  }
  .small-button {
    font-size: 10px;
    padding: 2px 5px;
  }
  .edit-button {
    padding: 4px 8px;
    font-size: 12px;
  }
  .overlay-content {
    padding: 15px;
    width: 100%;
  }
  .text-edit-area {
    min-height: 400px;
    font-size: 14px;
  }
  .action-button {
    padding: 8px;
    font-size: 14px;
  }
  .info-row-ingredient-aggregate .aggregated-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
@media (max-width: 600px) {
  .quantity-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .unit-group { width: 100%; }
  .styled-input { flex: 1; }
  .center-content { padding: 8px; }
  .button-container { gap: 6px; }
}
@media (max-width: 480px) {
  .overlay-content { padding: 12px; }
  .text-edit-area { min-height: 300px; }
  .action-button { padding: 7px; font-size: 13px; }
}

/* ========================================
   sd-* Classes (speisen_details)
   ======================================== */

/* --- Utilities --- */
.sd-mb20 { margin-bottom: 20px; }
.sd-mb25 { margin-bottom: 25px; }
.sd-mt8 { margin-top: 8px; }
.sd-text-center { text-align: center; }
.sd-text-light { color: var(--ke-text); }
.sd-text-muted-light { color: var(--ke-text-muted); font-size: 13px; }
.sd-grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sd-actions-right { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* --- Text Colors --- */
.sd-text--muted { color: var(--ke-text-muted); }
.sd-text--muted-dim { color: var(--ke-text-muted); opacity: 0.7; font-size: 13px; }
.sd-text--success { color: var(--ke-success); }
.sd-text--warning { color: var(--ke-warning); }
.sd-label--green { color: var(--ke-success); }

/* --- Link --- */
.sd-link { color: var(--ke-info); text-decoration: none; font-weight: 600; }
.sd-link:hover { text-decoration: underline; color: var(--ke-info); }

/* --- Divider --- */
.sd-divider-dashed { border-top: 1px dashed var(--ke-border); margin: 12px 0; }

/* --- Season Badge --- */
.sd-season-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(76, 175, 80, 0.15);
  color: var(--ke-success);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(76, 175, 80, 0.3);
}

/* --- Missing Note / Link --- */
.sd-missing-note { list-style: none; padding: 6px 0; font-size: 13px; color: var(--ke-text-muted); }
.sd-missing-link { color: var(--ke-info); text-decoration: none; font-weight: 500; cursor: pointer; }
.sd-missing-link:hover { text-decoration: underline; }

/* --- Row Variants --- */
.sd-row { list-style: none; }
.sd-row--head { font-weight: 600; font-size: 13px; color: var(--ke-text-muted); }
.sd-row--ingredient { min-height: 44px; }
.sd-row--summary { border-top: 1px solid var(--ke-border); padding-top: 8px; font-weight: 600; }
.sd-row--portion { padding: 8px 0; }
.sd-row--cta { padding: 10px 0; text-align: center; }
.sd-row--warning { color: var(--ke-warning); font-size: 13px; padding: 6px 0; }
.sd-row--aggregate { padding: 10px 0; border-top: 1px solid var(--ke-border); }
.sd-row--component-type { font-weight: 600; color: var(--ke-text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; padding: 8px 0 4px; }

/* --- Bestand Value --- */
.sd-bestand-value { font-variant-numeric: tabular-nums; font-weight: 600; }

/* --- Portion Sublabel --- */
.sd-portion-sublabel { font-size: 0.85em; color: var(--ke-text-muted); font-weight: 400; }

/* --- Overlay --- */
.sd-overlay { position: fixed; inset: 0; z-index: 14000; display: none; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.75); }
.sd-overlay[open], .sd-overlay.active { display: flex; }
.sd-overlay-backdrop { position: fixed; inset: 0; z-index: 13500; background: rgba(0, 0, 0, 0.7); display: none; align-items: center; justify-content: center; padding: 0 !important; }
.sd-overlay-backdrop.active { display: flex; }
.sd-overlay-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.sd-overlay-title { font-size: 1.2em; font-weight: 700; color: var(--ke-text); margin: 0; }
.sd-overlay-item-name { color: var(--ke-text); font-size: 14px; }
.sd-overlay-label { font-size: 13px; font-weight: 600; color: var(--ke-text-muted); margin-bottom: 4px; display: block; }
.sd-overlay-select { width: 100%; padding: 8px 10px; border: 1px solid var(--ke-border); border-radius: var(--ke-radius-sm); background: var(--ke-surface); color: var(--ke-text); font-size: 14px; }
.sd-overlay-image { width: 100%; max-height: 200px; object-fit: cover; border-radius: var(--ke-radius-sm); }

/* --- Modal --- */
.sd-modal { background: var(--ke-bg); border: 1px solid var(--ke-border); border-radius: var(--ke-radius); padding: 20px; max-width: 560px; width: 90vw; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.sd-modal-lg { max-width: 800px; }
.sd-modal-sm { max-width: 400px; }
.sd-modal-header { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--ke-border); }
.sd-modal-title { font-size: 1.15em; font-weight: 700; color: var(--ke-text); margin: 0; }
.sd-modal-footer { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--ke-border); display: flex; justify-content: flex-end; gap: 8px; }

/* --- Buttons --- */
.sd-btn-action { flex: 1; }
.sd-btn-cancel { background: none; border: 1px solid var(--ke-border); color: var(--ke-text-muted); border-radius: var(--ke-radius-sm); padding: 8px 16px; cursor: pointer; font-size: 14px; }
.sd-btn-cancel:hover { background: var(--ke-surface); color: var(--ke-text); }
.sd-btn-confirm { background: var(--ke-success); color: #fff; border: none; border-radius: var(--ke-radius-sm); padding: 8px 16px; cursor: pointer; font-weight: 600; font-size: 14px; }
.sd-btn-confirm:hover { opacity: 0.9; }
.sd-btn-group { display: flex; gap: 8px; justify-content: flex-end; }
.sd-btn-sm { font-size: 13px; padding: 6px 12px; }
.sd-gear-btn { background: none; border: none; color: var(--ke-text-muted); cursor: pointer; padding: 4px; font-size: 16px; appearance: none; }
.sd-gear-btn:hover { color: var(--ke-text); }

/* --- Quantity Controls --- */
.sd-qty-section { margin: 12px 0; }
.sd-qty-container { display: flex; align-items: center; gap: 8px; }
.sd-qty-btn { width: 36px; height: 36px; border: 1px solid var(--ke-border); border-radius: var(--ke-radius-sm); background: var(--ke-surface); color: var(--ke-text); font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.sd-qty-btn:hover { background: var(--ke-border); }
.sd-qty-input { width: 60px; text-align: center; padding: 6px; border: 1px solid var(--ke-border); border-radius: var(--ke-radius-sm); background: var(--ke-surface); color: var(--ke-text); font-size: 14px; }

/* --- Multiplier Controls --- */
.sd-multiplier-controls { display: flex; align-items: center; gap: 8px; justify-content: center; margin: 8px 0; }
.sd-multiplier-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--ke-border); background: var(--ke-surface); color: var(--ke-text); font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.sd-multiplier-btn:hover { background: var(--ke-border); }
.sd-multiplier-btn--minus { color: var(--ke-danger); }
.sd-multiplier-btn--plus { color: var(--ke-success); }
.sd-multiplier-display { text-align: center; }
.sd-multiplier-value { font-size: 1.4em; font-weight: 700; color: var(--ke-text); min-width: 48px; display: inline-block; }

/* --- Portion Modal --- */
.sd-portion-title { font-size: 1.15em; font-weight: 700; color: var(--ke-text); margin: 0 0 16px; text-align: center; }
.sd-portion-input { width: 80px; text-align: center; padding: 8px; border: 1px solid var(--ke-border); border-radius: var(--ke-radius-sm); background: var(--ke-surface); color: var(--ke-text); font-size: 16px; font-weight: 600; }
.sd-portion-select { padding: 8px 10px; border: 1px solid var(--ke-border); border-radius: var(--ke-radius-sm); background: var(--ke-surface); color: var(--ke-text); font-size: 14px; }

/* --- Recipe Info --- */
.sd-recipe-info { background: var(--ke-surface); border: 1px solid var(--ke-border); border-radius: var(--ke-radius-sm); padding: 12px; margin: 12px 0; }
.sd-recipe-info-label { font-size: 12px; color: var(--ke-text-muted); margin-bottom: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }

/* --- Form --- */
.sd-form-label { display: block; font-size: 13px; font-weight: 600; color: var(--ke-text-muted); margin-bottom: 4px; }
.sd-form-label-lg { display: block; font-size: 15px; font-weight: 600; color: var(--ke-text); margin-bottom: 6px; }
.sd-form-input { width: 100%; padding: 8px 10px; border: 1px solid var(--ke-border); border-radius: var(--ke-radius-sm); background: var(--ke-surface); color: var(--ke-text); font-size: 14px; }
.sd-form-input:focus { border-color: var(--ke-info); outline: none; }
.sd-checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ke-text); cursor: pointer; }
.sd-textarea { width: 100%; min-height: 120px; padding: 10px; border: 1px solid var(--ke-border); border-radius: var(--ke-radius-sm); background: var(--ke-surface); color: var(--ke-text); font-size: 14px; resize: vertical; font-family: inherit; }

/* --- Table --- */
.sd-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sd-table-row:nth-child(even) { background: rgba(255, 255, 255, 0.03); }
.sd-table-row:hover { background: rgba(255, 255, 255, 0.06); }
.sd-th { padding: 8px 10px; text-align: left; font-weight: 600; color: var(--ke-text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; border-bottom: 2px solid var(--ke-border); }
.sd-th--center { text-align: center; }
.sd-th--left { text-align: left; }
.sd-totals { margin-top: 12px; padding: 10px; background: var(--ke-surface); border: 1px solid var(--ke-border); border-radius: var(--ke-radius-sm); font-weight: 600; }

/* --- Loss Grid --- */
.sd-loss-grid-header { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: center; font-size: 12px; font-weight: 600; color: var(--ke-text-muted); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 8px; }

/* --- Max Capacity --- */
.sd-max-capacity-center { text-align: center; margin: 8px 0; }
.sd-max-capacity-btn { background: none; border: 1px solid var(--ke-border); color: var(--ke-info); border-radius: var(--ke-radius-sm); padding: 6px 14px; cursor: pointer; font-size: 13px; font-weight: 500; }
.sd-max-capacity-btn:hover { background: var(--ke-surface); }
.sd-capacity-warning { color: var(--ke-warning); font-size: 13px; margin-top: 6px; }

/* --- Calculator --- */
.sd-calc-preview { background: var(--ke-surface); border: 1px solid var(--ke-border); border-radius: var(--ke-radius-sm); padding: 12px; margin: 10px 0; }
.sd-calc-label { font-size: 13px; color: var(--ke-text-muted); margin-bottom: 4px; }
.sd-calc-total { font-size: 1.3em; font-weight: 700; color: var(--ke-text); }
.sd-calc-portions { font-size: 14px; color: var(--ke-text-muted); margin-top: 4px; }

/* --- Calendar Center --- */
.sd-calendar-center { text-align: center; margin: 8px 0; }

/* --- Recurring --- */
.sd-recurring-section { margin: 12px 0; }
.sd-recurring-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.sd-weekdays-row { margin-bottom: 8px; }
.sd-weekday-options { display: flex; flex-wrap: wrap; gap: 6px; }

/* --- Unit Modal --- */
.sd-unit-modal { background: var(--ke-bg); border: 1px solid var(--ke-border); border-radius: var(--ke-radius); padding: 20px; max-width: 600px; width: 90vw; max-height: 80vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.sd-unit-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--ke-border); }
.sd-unit-modal-title { font-size: 1.15em; font-weight: 700; color: var(--ke-text); margin: 0; }
.sd-unit-modal-close { background: none; border: none; color: var(--ke-text-muted); font-size: 24px; cursor: pointer; padding: 4px 8px; line-height: 1; }
.sd-unit-modal-close:hover { color: var(--ke-text); }
.sd-unit-section { margin-bottom: 16px; }
.sd-unit-info { background: var(--ke-surface); border: 1px solid var(--ke-border); border-radius: var(--ke-radius-sm); padding: 12px; margin: 12px 0; }
.sd-unit-info-text { font-size: 13px; color: var(--ke-text-muted); line-height: 1.5; }
.sd-unit-help { font-size: 12px; color: var(--ke-text-muted); margin-top: 4px; display: block; }

/* --- Conversion Rules --- */
.sd-rule-title { font-size: 14px; font-weight: 700; color: var(--ke-text); margin: 0 0 10px; }
.sd-rule-label { font-size: 13px; font-weight: 600; color: var(--ke-text-muted); margin-bottom: 4px; display: block; }
.sd-rule-equals { font-size: 18px; font-weight: 700; color: var(--ke-text-muted); text-align: center; padding: 8px 0; }
.sd-rule-actions { display: flex; gap: 8px; margin-top: 10px; }
.sd-test-result { margin-top: 10px; padding: 10px; border-radius: var(--ke-radius-sm); font-size: 13px; background: var(--ke-surface); border: 1px solid var(--ke-border); }

/* --- Base Unit --- */
.sd-base-unit-controls { margin: 10px 0; }
.sd-base-unit-status { font-size: 12px; color: var(--ke-text-muted); margin-top: 4px; display: block; }

/* --- Image Container --- */
.sd-image-container { position: relative; }

/* --- Season --- */
.sd-season-form { margin-top: 12px; }
.sd-season-input { width: 100%; padding: 8px 10px; border: 1px solid var(--ke-border); border-radius: var(--ke-radius-sm); background: var(--ke-surface); color: var(--ke-text); font-size: 14px; }
.sd-season-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

/* ---- Karten-Layout (Detailseite) ---- */
body.speisen-details-page .detail-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
body.speisen-details-page .detail-page > .info-block {
  order: 2;
  width: 100%;
  max-width: var(--layout-max-width, 1000px);
  margin: 0 auto;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.06);
  padding: 16px 18px;
}
body.speisen-details-page .detail-page > .info-block.sd-card--zutaten {
  order: 1;
  border-left: 4px solid var(--ke-accent, #0ea5e9);
}
body.speisen-details-page .detail-page > .image-container {
  order: 3;
}
body.speisen-details-page .detail-page > .header-container {
  order: 0;
}

/* ---- Nährwerte (übersichtliche Tabelle) ---- */
body.speisen-details-page .sd-nutri {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--ke-border);
  border-radius: 12px;
  background: var(--ke-surface);
}
body.speisen-details-page .sd-nutri__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
body.speisen-details-page .sd-nutri__title {
  font-weight: 800;
  font-size: 15px;
  margin-right: 4px;
}
body.speisen-details-page .sd-nutri__chip {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--ke-border);
  color: var(--ke-text-muted);
}
body.speisen-details-page .sd-nutri__chip--ok {
  color: var(--ke-success);
  border-color: var(--ke-success);
}
body.speisen-details-page .sd-nutri__chip--warn {
  color: var(--ke-warning);
  border-color: var(--ke-warning);
}
body.speisen-details-page .sd-nutri__scroll {
  overflow-x: auto;
}
body.speisen-details-page .sd-nutri__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
body.speisen-details-page .sd-nutri__table th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--ke-text-muted);
  padding: 6px 8px;
  border-bottom: 2px solid var(--ke-border);
}
body.speisen-details-page .sd-nutri__table th.num,
body.speisen-details-page .sd-nutri__table td.num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
body.speisen-details-page .sd-nutri__table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--ke-surface-2, rgba(128,128,128,.18));
  vertical-align: middle;
}
body.speisen-details-page .sd-nutri__table tbody tr:nth-child(even) {
  background: rgba(128,128,128,.06);
}
body.speisen-details-page .sd-nutri__main td:first-child {
  font-weight: 700;
}
body.speisen-details-page .sd-nutri__sub td {
  color: var(--ke-text-muted);
  font-size: 13px;
}
body.speisen-details-page .sd-nutri__sub td:first-child {
  padding-left: 22px;
}
body.speisen-details-page .sd-nutri__missing {
  margin-top: 10px;
  font-size: 12px;
  color: var(--ke-warning);
  line-height: 1.6;
}
body.speisen-details-page .sd-nutri__missing a {
  color: var(--ke-warning);
  text-decoration: underline;
}

/* ---- Zutaten & Deklaration (übersichtlich) ---- */
body.speisen-details-page .sd-decl {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--ke-border);
  border-radius: 12px;
  background: var(--ke-surface);
}
body.speisen-details-page .sd-decl__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
body.speisen-details-page .sd-decl__title {
  font-weight: 800;
  font-size: 15px;
  margin-right: 4px;
}
body.speisen-details-page .sd-decl__group {
  margin-top: 10px;
}
body.speisen-details-page .sd-decl__label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ke-text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
}
body.speisen-details-page .sd-decl__hint {
  text-transform: none;
  font-weight: 400;
  letter-spacing: 0;
}
body.speisen-details-page .sd-decl__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
body.speisen-details-page .sd-chip {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--ke-border);
  background: rgba(128,128,128,.08);
  color: var(--ke-text);
}
body.speisen-details-page .sd-chip--allergen {
  border-color: var(--ke-warning);
  color: var(--ke-warning);
  background: rgba(255,138,61,.10);
  font-weight: 700;
}
body.speisen-details-page .sd-chip--trace {
  border-style: dashed;
  color: var(--ke-warning);
}
body.speisen-details-page .sd-decl__group--allergen {
  padding: 10px 12px;
  border-left: 4px solid var(--ke-warning);
  border-radius: 8px;
  background: rgba(255,138,61,.06);
}
body.speisen-details-page .sd-decl__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0 18px;
}
body.speisen-details-page .sd-decl__list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(128,128,128,.18);
  font-size: 14px;
}
body.speisen-details-page .sd-decl__list li.sd-decl__list-item--decl > span:first-child {
  font-weight: 700;
}
body.speisen-details-page .sd-decl__amount {
  white-space: nowrap;
  color: var(--ke-text-muted);
  font-variant-numeric: tabular-nums;
}

/* ---- Zubereitung & Bemerkung: gut lesbar ---- */
body.speisen-details-page .detail-page #speise-zubereitung-display,
body.speisen-details-page .detail-page #speise-note-display,
body.speisen-details-page .detail-page #speise-zubereitung-display *,
body.speisen-details-page .detail-page #speise-note-display * {
  font-size: 16px !important;
  line-height: 1.6 !important;
}
body.speisen-details-page .detail-page #speise-zubereitung-display,
body.speisen-details-page .detail-page #speise-note-display {
  color: var(--ke-text);
  padding: 4px 0;
}

/* ---- Kopfbereich: Aktionen in einer Zeile ---- */
body.speisen-details-page .header-actions {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
}
body.speisen-details-page .sd-action-group {
  flex: 0 1 auto;
  padding: 8px 10px;
  gap: 6px;
}
body.speisen-details-page .sd-action-group__buttons {
  flex-wrap: wrap;
  gap: 6px;
}
body.speisen-details-page .sd-action-group__buttons .ke-btn {
  padding: 6px 10px;
  font-size: 13px;
}

/* ---- Aktionsleiste am Seitenende: sticky über der Navigation ---- */
body.speisen-details-page .detail-section {
  margin-bottom: 12px;
}
body.speisen-details-page .detail-section .detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-top: 1px solid var(--ke-border);
  background: var(--ke-surface);
  border-radius: 0 0 12px 12px;
  position: sticky;
  bottom: 64px;
  z-index: 5;
}
body.speisen-details-page .detail-section .detail-actions .ke-btn {
  flex: 1 1 120px;
  min-height: 40px;
}

/* ---- Mobile: kompakter ---- */
@media (max-width: 720px) {
  body.speisen-details-page .header-actions {
    flex-direction: column;
  }
  body.speisen-details-page .sd-action-group {
    width: 100%;
  }
  body.speisen-details-page .image-container #speisen-gallery-thumbs {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  body.speisen-details-page .sd-nutri__table {
    font-size: 13px;
  }
  body.speisen-details-page .sd-decl__list {
    grid-template-columns: 1fr;
  }
  body.speisen-details-page .detail-section .detail-actions .ke-btn {
    flex: 1 1 100%;
  }
}

/* ---- ToDo-Detail: visuell an Speisen-Detail angeglichen (ohne Struktur-Änderung) ---- */
body.todos-details-page .ke-card,
body.ke-detail-page--todo .ke-card {
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.06);
  padding: 16px 18px;
  margin-bottom: 14px;
  border: 1px solid var(--ke-border);
  background: var(--ke-surface);
}
body.todos-details-page .todos-section-title,
body.ke-detail-page--todo .todos-section-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ke-border);
  text-align: center;
  color: var(--ke-text);
}
body.todos-details-page .ke-header-container {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
body.todos-details-page .ke-btn-group--todo {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  width: 100%;
}
body.todos-details-page .ke-btn-group--todo .sd-action-group {
  padding: 8px 10px;
  border: 1px solid var(--ke-border);
  border-radius: 10px;
  background: var(--ke-surface);
}
body.todos-details-page .ke-btn-group--todo .sd-action-group__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ke-text-muted);
  margin-bottom: 4px;
}
body.todos-details-page .ke-btn-group--todo .sd-action-group__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
body.todos-details-page .ke-btn-group--todo .sd-action-group__buttons .ke-btn {
  padding: 6px 10px;
  font-size: 13px;
}
body.todos-details-page .detail-section .detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-top: 1px solid var(--ke-border);
  background: var(--ke-surface);
  border-radius: 0 0 12px 12px;
  position: sticky;
  bottom: 64px;
  z-index: 5;
}
body.todos-details-page .detail-section .detail-actions .ke-btn {
  flex: 1 1 120px;
  min-height: 40px;
}
@media (max-width: 720px) {
  body.todos-details-page .ke-btn-group--todo {
    flex-direction: column;
  }
  body.todos-details-page .ke-btn-group--todo .sd-action-group {
    width: 100%;
  }
  body.todos-details-page .detail-section .detail-actions .ke-btn {
    flex: 1 1 100%;
  }
}

/* ---- Waren-Detail: Buttons gruppiert & Karten ---- */
body.item-details-page .header-actions.sd-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
}
body.item-details-page .info-block {
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.06);
  padding: 16px 18px;
  margin-bottom: 14px;
}
body.item-details-page .section-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ke-border);
  text-align: center;
  color: var(--ke-text);
}
body.item-details-page .detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-top: 1px solid var(--ke-border);
  background: var(--ke-surface);
  border-radius: 0 0 12px 12px;
  position: sticky;
  bottom: 64px;
  z-index: 5;
}
body.item-details-page .detail-actions .ke-btn {
  flex: 1 1 120px;
  min-height: 40px;
}
@media (max-width: 720px) {
  body.item-details-page .header-actions.sd-header-actions {
    flex-direction: column;
  }
  body.item-details-page .detail-actions .ke-btn {
    flex: 1 1 100%;
  }
}

/* ---- Waren-Detail: Nährwert-Tabelle wie bei Speisen ---- */
body.item-details-page .nutrients-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  display: grid;
  gap: 0;
}
body.item-details-page .nh-h {
  font-size: 12px;
  font-weight: 700;
  color: var(--ke-text-muted);
  padding: 6px 8px;
  border-bottom: 2px solid var(--ke-border);
  text-align: left;
}
body.item-details-page .nh-h:nth-child(2),
body.item-details-page .nh-cell.nh-nowrap {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
body.item-details-page .nh-cell {
  padding: 7px 8px;
  border-bottom: 1px solid var(--ke-surface-2, rgba(128,128,128,.18));
  vertical-align: middle;
}
body.item-details-page .nh-name {
  font-weight: 600;
}
body.item-details-page .nutrients-grid-base.nutrients-grid-2 {
  grid-template-columns: minmax(0, 1fr) auto;
  max-width: 420px;
  margin: 0 auto;
}
body.item-details-page .nutrients-grid-base.nutrients-grid-3 {
  grid-template-columns: minmax(0, 1fr) auto auto;
  max-width: 500px;
  margin: 0 auto;
}
body.item-details-page .nutrients-basis-header {
  font-size: 12px;
  color: var(--ke-success);
  margin-bottom: 6px;
  font-weight: 600;
}
body.item-details-page .nutrients-empty {
  font-size: 13px;
  opacity: .7;
  padding: 8px 0;
}

/* ---- Waren-Detail: Schriftgrößen wie Speisen-Detail ---- */
body.item-details-page .info-row {
  font-size: 14px;
}
body.item-details-page .info-label {
  font-size: 13px;
  color: var(--ke-text-muted);
}
body.item-details-page .info-value {
  font-size: 14px;
  color: var(--ke-text);
}
body.item-details-page .product-info .pi-label,
body.item-details-page .product-info .pi-meta-label {
  font-size: 13px !important;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ke-text-muted);
  margin: 0 0 6px 0;
}
body.item-details-page .product-info .pi-value,
body.item-details-page .product-info .pi-value div,
body.item-details-page .product-info .pi-value span,
body.item-details-page .product-info .pi-value p {
  font-size: 16px !important;
  line-height: 1.6 !important;
  color: var(--ke-text);
}
body.item-details-page .product-info .pi-value-note,
body.item-details-page .pi-lagerung-note,
body.item-details-page .nutrients-basis-note,
body.item-details-page .nutrients-basis-header {
  font-size: 12px !important;
  line-height: 1.5 !important;
  color: var(--ke-text-muted);
}
body.item-details-page .product-info .pi-field {
  padding: 12px 0;
  border-bottom: 1px solid var(--ke-surface-2, rgba(128,128,128,.18));
}
body.item-details-page .product-info .pi-field:last-child {
  border-bottom: none;
}
body.item-details-page .item-title {
  font-size: 22px;
  font-weight: 800;
  text-align: center;
}
body.item-details-page .section-title span {
  font-size: 18px;
}

/* ---- Nährwerte & Deklaration: volle Breite, kein Spalten-Layout der alten info-row ---- */
body.speisen-details-page li.sd-nutri,
body.speisen-details-page li.sd-decl {
  display: block !important;
  width: 100% !important;
  flex: 0 0 100% !important;
  list-style: none;
  margin: 0 0 14px 0;
  padding: 14px 16px !important;
}
body.speisen-details-page .sd-nutri div,
body.speisen-details-page .sd-decl div {
  display: block;
  flex: none;
  justify-content: initial;
  gap: 0;
}
body.speisen-details-page .sd-nutri__head,
body.speisen-details-page .sd-decl__head {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
body.speisen-details-page .sd-nutri__scroll {
  width: 100%;
  overflow-x: auto;
}
body.speisen-details-page .sd-nutri__table {
  width: 100%;
  table-layout: auto;
  white-space: normal;
}
body.speisen-details-page .sd-nutri__table td,
body.speisen-details-page .sd-nutri__table th {
  word-break: normal;
  overflow-wrap: normal;
  white-space: nowrap;
}
body.speisen-details-page .sd-nutri__table td:first-child,
body.speisen-details-page .sd-nutri__table th:first-child {
  white-space: normal;
  width: 100%;
}
body.speisen-details-page .sd-nutri__missing,
body.speisen-details-page .sd-decl__group {
  display: block !important;
  width: 100%;
}

/* ---- Fehlende Nährwertdaten: eigener Block unter der Tabelle ---- */
body.speisen-details-page .sd-nutri__missing {
  display: block !important;
  clear: both;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--ke-border);
  font-size: 13px;
  line-height: 1.7;
  color: var(--ke-warning);
}
body.speisen-details-page .sd-nutri__missing > span {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}
body.speisen-details-page .sd-nutri__missing .missing-data-link {
  display: inline;
  white-space: normal;
}

