:root {
  --recipe-surface: #fff; --recipe-heading: #f3f5f6; --recipe-border: #d7dce0;
  --recipe-text: #30343b; --recipe-muted: #66717c; --recipe-group: #eef6fb;
}
html[data-bo-theme="dark"] {
  color-scheme: dark;
  --recipe-surface: #202427; --recipe-heading: #2c3236; --recipe-border: #495055;
  --recipe-text: #eceef0; --recipe-muted: #b3bdc6; --recipe-group: #25343e;
  background: #202427; color: #eceef0;
}
.bo-theme-control { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; position: relative; cursor: pointer; font-size: 13px; white-space: nowrap; }
.bo-theme-control input[role="switch"] { position: absolute; width: 44px; height: 26px; margin: 0; opacity: 0; z-index: 1; cursor: pointer; }
.bo-theme-track { width: 44px; height: 26px; flex: 0 0 44px; border-radius: 15px; background: #66727a; border: 1px solid #53616b; position: relative; }
.bo-theme-track::after { content: ''; width: 18px; height: 18px; border-radius: 50%; background: white; position: absolute; top: 3px; left: 3px; }
.bo-theme-control input:checked + .bo-theme-track { background: #237846; border-color: #1b6539; }
.bo-theme-control input:checked + .bo-theme-track::after { transform: translateX(18px); }
.bo-theme-control input:focus-visible + .bo-theme-track { outline: 3px solid #1769aa; outline-offset: 3px; }
html[data-bo-theme="dark"] .bo-theme-track::after { background: #fff; }
html[data-bo-theme="dark"] .bo-theme-control input:checked + .bo-theme-track { background: #237846; border-color: #6cba88; }
.technical-card-panel { color: var(--recipe-text); }
.technical-card-panel :is(.technical-card-grid,.technical-card-history-table,.technical-price-summary) {
  border-collapse: collapse; background: var(--recipe-surface); color: var(--recipe-text); font: 13px/1.4 "Segoe UI", sans-serif;
}
.technical-card-panel :is(.technical-card-grid,.technical-card-history-table,.technical-price-summary) :is(th,td) {
  border: 1px solid var(--recipe-border); vertical-align: middle;
}
.technical-card-panel :is(.technical-card-grid,.technical-card-history-table,.technical-price-summary) thead th,
.technical-card-panel .technical-card-grid tfoot td { background: var(--recipe-heading); color: var(--recipe-text); }
.technical-card-panel .technical-card-grid :is(input,select) { color: var(--recipe-text); }
.technical-card-panel .technical-card-grid:not(.editing) :is(input,select) { opacity: 1; }
.technical-price-summary-wrap { margin-top: 18px; overflow-x: auto; max-width: 100%; }
.technical-price-summary { width: 100%; min-width: 0; table-layout: fixed; }
.technical-price-summary caption { text-align: left; font-size: 14px; font-weight: 600; padding: 0 0 8px; color: var(--recipe-text); }
.technical-price-summary th, .technical-price-summary td { padding: 8px 12px; text-align: right; font-variant-numeric: tabular-nums; }
.technical-price-summary th:nth-child(-n+2), .technical-price-summary tbody td:first-of-type { text-align: left; }
.technical-price-summary thead th { font-weight: 600; position: relative; }
.technical-price-summary .recipe-size-cell { width: 13%; text-align: left; background: var(--recipe-group); vertical-align: top; font-weight: 600; }
.technical-price-summary .recipe-size-start > * { border-top-width: 2px; }
.technical-price-summary tbody tr:hover td { background: var(--recipe-heading); }
html[data-bo-theme="dark"] :is(input,select,textarea) { color: #eceef0; background-color: #202427; border-color: #495055; }
html[data-bo-theme="dark"] :is(input,textarea)::placeholder { color: #99a5ae; opacity: 1; }
html[data-bo-theme="dark"] :is(input,select,textarea):disabled { color: #b3bdc6; }
html[data-bo-theme="dark"] .technical-card-grid tbody tr:focus-within td { background-color: #29485b; }
html[data-bo-theme="dark"] .technical-card-grid :is(input,select) { background: transparent; }
html[data-bo-theme="dark"] .technical-card-grid :is(input,select):focus { background: #202427; }
html[data-bo-theme="dark"] .technical-card-receipt-cost { color: #eceef0; }
html[data-bo-theme="dark"] .primary-nav { background: #25333c; }
html[data-bo-theme="dark"] .primary-nav-item.active { background: #35566a; }
html[data-bo-theme="dark"] :is(.button-primary,button.button:not(.button-secondary)):not(:disabled) { background-color: #116996; color: #fff; }


/* A drawer is a bounded layout: fit the table rather than clipping cost columns. */
.card-editor, .card-editor .tab-panel, .technical-card-panel { min-width: 0; grid-template-columns: minmax(0, 1fr); }
.card-editor > *, .technical-card-panel > *, .technical-card-grid-wrap { min-width: 0; max-width: 100%; }
.technical-card-grid[data-resizable-fit] { width: 100%; min-width: 0; }
.technical-card-grid[data-resizable-fit] :is(th,td) { min-width: 0; width: auto; overflow-wrap: anywhere; }
.technical-card-grid[data-resizable-fit] :is(input,select) { min-width: 0; max-width: 100%; box-sizing: border-box; }
.technical-card-grid[data-resizable-fit].editing :is(th,td):first-child { min-width: 0; width: auto; }
.technical-card-grid[data-resizable-fit] .technical-card-row-order { display: inline-flex; flex-wrap: wrap; margin-left: 0; }
.technical-card-grid[data-resizable-fit] .technical-card-row-order button { width: 18px; min-width: 18px; padding: 0; }
.technical-price-summary :is(th,td) { overflow-wrap: anywhere; padding: 7px 8px; }
.card-editor .tab-strip { flex-wrap: wrap; }
.card-editor .tab { white-space: normal; overflow-wrap: anywhere; }

.card-editor .tab-strip-row { grid-template-columns: minmax(90px, 15%) minmax(0, 1fr); gap: 16px; }
html[data-bo-theme="dark"] .card-editor .tab.active { background: #3c4952; border-color: #8aa9bc; box-shadow: inset 0 -3px #72cbf2; }

.technical-card-grid[data-resizable-fit] thead th { position: relative; }
.recipe-cost-heading-clip {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: clip;
}
.recipe-cost-heading-clip > span { display: inline-block; }
.card-editor .tab { font-size: 14px; padding: 5px 4px; overflow-wrap: normal; }

/* Compact card tabs stay on a single line; colour carries the selection. */
.card-editor { container-type: inline-size; container-name: product-card; }
.card-editor .subtab-strip { flex-wrap: nowrap; gap: 3px; overflow-x: auto; max-width: 100%; margin: 4px 0 8px; }
.card-editor .subtab, .drawer.nomenclature-editor .card-editor .subtab {
  min-height: 32px; min-width: 0; padding: 6px 8px; font-size: 13px; font-weight: 600;
  line-height: 1.3; white-space: nowrap; flex: 0 0 auto; border: 1px solid #9aa7b0;
  border-radius: 4px; background: #f2f5f7; color: #28343e; cursor: pointer;
}
.drawer.nomenclature-editor .card-editor .subtab:hover, .card-editor .subtab:hover { background: #e1ecf3; border-color: #457797; }
.drawer.nomenclature-editor .card-editor .subtab.active, .card-editor .subtab.active { background: #116b9a; border-color: #07527c; color: #fff; box-shadow: inset 0 -2px #083b59; }
.card-editor .subtab:focus-visible { outline: 2px solid #168bd0; outline-offset: -2px; }
.card-editor .tab, .drawer.nomenclature-editor .card-editor .tab { min-height: 36px; font-size: 14px; padding: 6px; font-weight: 600; cursor: pointer; }
.drawer.nomenclature-editor .card-editor .tab-strip-row { grid-template-columns: minmax(90px, 15%) minmax(0, 1fr); gap: 14px; }
html[data-bo-theme="dark"] .card-editor .subtab { background: #30393f !important; border-color: #687780 !important; color: #edf2f5 !important; }
html[data-bo-theme="dark"] .card-editor .subtab:hover { background: #3d4e59 !important; border-color: #9ebed3 !important; }
html[data-bo-theme="dark"] .card-editor .subtab.active { background: #215d80 !important; border-color: #8ecdf3 !important; color: #fff !important; box-shadow: inset 0 -2px #8ecdf3 !important; }
@container product-card (max-width: 760px) {
  .card-editor .subtab-strip { gap: 1px; }
  .card-editor .subtab, .drawer.nomenclature-editor .card-editor .subtab { font-size: 12px; font-weight: 500; padding: 6px 2px; }
}
.card-editor .product-images-table { table-layout: fixed; width: 100%; min-width: 0; }
.card-editor .product-image-cell-preview { justify-content: center; min-height: 164px; padding: 8px; }
.card-editor .product-image-thumb-button { display: grid; place-items: center; width: 100%; max-width: 240px; padding: 0; border: 0; }
.card-editor .product-image-thumb-button img { width: 100%; max-width: 240px; height: 160px; object-fit: contain; border: 1px solid #aebbc4; border-radius: 6px; background: #eef1f3; }
.card-editor .product-image-thumb-button:hover img { border-color: #168bd0; }
.card-editor .product-image-thumb-button:focus-visible { outline: 3px solid #168bd0; outline-offset: 3px; border-radius: 6px; }
html[data-bo-theme="dark"] .card-editor .product-image-thumb-button img { background: #2c3236; border-color: #667984; }
.card-editor .product-images-panel .product-packaging-table-wrap { max-height: none; overflow: visible; }
.card-editor .product-image-add-controls { grid-template-columns: minmax(0, 1fr); }

/* A single nutrition editor per recipe; comparison details stay collapsed. */
.recipe-nutrition-source { display:flex; align-items:center; gap:12px; max-width:420px; }
.recipe-nutrition-source select { flex:1; min-width:0; }
.recipe-nutrition-calculation { margin:8px 0 16px; }
.recipe-nutrition-calculation summary { cursor:pointer; padding:10px 0; font-weight:600; }
.recipe-nutrition-table { width:100%; table-layout:fixed; }
.recipe-nutrition-table th { position:relative; padding-right:10px; }
.recipe-nutrition-table th, .recipe-nutrition-table td { overflow-wrap:anywhere; }
.recipe-nutrition-warning { border-left:3px solid #ba8124; padding:8px 12px; }


/* Recipe row inspection is read-only and never part of the saved ingredient grid. */
.recipe-expand-toggle { flex:0 0 22px; width:22px; min-width:22px; padding:0; height:24px; border:0; background:transparent; color:var(--accent,#0786ba); cursor:pointer; font-size:17px; }
.recipe-expand-toggle:hover, .recipe-expand-toggle:focus-visible { background:var(--bo-hover,#dcecf5); outline:1px solid var(--line,#aebbc2); }
.recipe-expandable-row > td { cursor:pointer; }
.recipe-expandable-row input:not([readonly]) { cursor:text; }
.recipe-composition-row > td { padding:10px 12px !important; background:var(--recipe-heading); border-left:3px solid var(--accent,#0786ba); }
.recipe-composition-heading { display:flex; flex-wrap:wrap; gap:4px 18px; align-items:baseline; }
.recipe-composition-heading span, .recipe-composition-hint { font-size:12px; color:var(--recipe-muted); }
.recipe-composition-hint { margin:5px 0 8px; white-space:normal; }
.recipe-composition-table { width:100%; min-width:0 !important; table-layout:fixed; border-collapse:collapse; font-size:12px; }
.recipe-composition-table th, .recipe-composition-table td { padding:5px 7px; border:1px solid var(--recipe-border); overflow-wrap:anywhere; white-space:normal; }
.recipe-composition-table th { position:relative; background:var(--recipe-heading); text-align:left; }
.recipe-component-name { display:flex; align-items:center; min-width:0; }
.recipe-ingredient-menu { position:fixed; z-index:13060; padding:4px; min-width:170px; border:1px solid var(--recipe-border); box-shadow:0 5px 18px #0004; background:var(--recipe-surface); color:var(--recipe-text); }
.recipe-ingredient-menu button { display:block; width:100%; padding:8px 12px; border:0; text-align:left; background:transparent; color:inherit; cursor:pointer; }
.recipe-ingredient-menu button:hover, .recipe-ingredient-menu button:focus-visible { background:var(--bo-hover,#deedf5); outline:0; }
[data-bo-theme="dark"] .recipe-composition-row > td, [data-bo-theme="dark"] .recipe-composition-table th { background:#282f33; }
[data-bo-theme="dark"] .recipe-ingredient-menu { background:#242b2f; color:#e6e9eb; }
[data-bo-theme="dark"] .recipe-ingredient-menu button:hover, [data-bo-theme="dark"] .recipe-ingredient-menu button:focus-visible { background:#3c484f; }

.technical-card-ingredient-field:has(> [data-recipe-expand]) { grid-template-columns:22px minmax(0,1fr) 24px; }
.technical-card-ingredient-field.locked:has(> [data-recipe-expand]) { grid-template-columns:22px minmax(0,1fr); }
.technical-card-ingredient-field:has(> [data-recipe-expand]):has([data-technical-card-suggestions-open]:not([hidden])) { grid-template-columns:22px minmax(0,1fr) 24px 24px; }

.price-order-dialog .price-category-tabs .tab[aria-pressed="true"] {
  background: #dcecf7;
  border-color: #377da7;
  box-shadow: inset 0 -3px #176298;
  color: #173f59;
  font-weight: 700;
}
html[data-bo-theme="dark"] .price-order-dialog .price-category-tabs .tab[aria-pressed="true"] {
  background: #394e5b;
  border-color: #88b2ca;
  box-shadow: inset 0 -3px #72cbf2;
  color: #fff;
}

.technical-ingredient-filter-header .table-header-popup {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.technical-ingredient-filter-header .table-header-popup::after { content: '▾'; color: var(--recipe-muted); }
.technical-ingredient-filter-header .table-header-popup:focus-visible { outline: 2px solid var(--accent,#168bd0); }
.recipe-suggestion-filter {
  position: fixed;
  inset: auto;
  z-index: 13060;
  box-sizing: border-box;
  margin: 0;
  max-width: calc(100vw - 8px);
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--recipe-border);
  background: var(--recipe-surface);
  color: var(--recipe-text);
  box-shadow: 0 4px 14px #0003;
}
.recipe-suggestion-filter legend { float: left; padding: 0 0 4px; font-size: 12px; font-weight: 600; }
.recipe-suggestion-filter label {
  clear: both;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  cursor: pointer;
}
.recipe-suggestion-filter input[type="checkbox"] { width: 16px; height: 16px; margin: 0; }
