/* Shared disclosure and select controls. Loaded after page styles. */
:root{--control-green:#34b03e;--control-border:#e1e8e2;--control-radius:14px;--control-focus:#34b03e40}
details{border:1px solid var(--control-border);border-radius:var(--control-radius);background:#fff;margin:16px 0;padding:0;min-width:0}
details>summary{display:flex;align-items:center;justify-content:space-between;gap:12px;list-style:none;cursor:pointer;padding:14px 16px;min-height:48px;box-sizing:border-box;border-radius:var(--control-radius);color:#324b38;font-size:14px;font-weight:600;line-height:1.5;transition:background .15s,color .15s}
details>summary::-webkit-details-marker{display:none}
details>summary::marker{content:''}
details>summary::after{content:'';width:8px;height:8px;flex:0 0 8px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:rotate(45deg);margin:0 3px 4px 8px;transition:transform .18s}
details>summary:hover{background:#f0f8f1;color:#267d2e}
details>summary:focus-visible{outline:3px solid var(--control-focus);outline-offset:2px}
details[open]>summary{background:#edf8ee;color:#24782c;border-radius:var(--control-radius) var(--control-radius) 0 0}
details[open]>summary::after{transform:rotate(225deg);margin-bottom:0}
details>form,details>.field,details>p,details>.allergen-columns{margin-left:16px;margin-right:16px}
details>form{padding:4px 0 16px}
.product-editor details.editor-extra{border:1px solid var(--control-border);padding:0;margin:18px 0;border-radius:var(--control-radius)}
.product-editor details.editor-extra>summary,.product-editor details.nutrition-allergens>summary{padding:14px 16px;font-size:14px;line-height:1.5}
.product-editor details.nutrition-allergens{padding:0;border:1px solid var(--control-border);border-radius:var(--control-radius)}
.product-editor details.nutrition-allergens>summary>span[aria-hidden]{display:none}
.product-editor details.nutrition-picker{margin:12px 0;padding:0;border:1px solid var(--control-border);border-radius:var(--control-radius)}
.product-editor details.nutrition-picker>summary{padding:12px 14px;min-height:48px;font-size:13px;line-height:1.5;border-radius:var(--control-radius);box-shadow:none}
.nutrition-source-tail>span[aria-hidden]{display:none}
.product-editor details.nutrition-picker>summary::after{margin-left:0}
.product-editor details.nutrition-picker .nutrition-source-tail{margin-left:auto}
select{appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23536057' stroke-width='1.8'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");background-position:right 12px center;background-repeat:no-repeat;cursor:pointer;border:1px solid var(--control-border);border-radius:12px;padding:12px 38px 12px 14px;color:#324b38;font:inherit}
.product-editor select{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23536057' stroke-width='1.8'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");background-position:right 12px center;background-repeat:no-repeat;padding-right:38px}
select:focus-visible{outline:3px solid var(--control-focus);outline-offset:2px;border-color:var(--control-green)}
@media(prefers-reduced-motion:reduce){details>summary,details>summary::after{transition:none}}

/* Consistent spacing and unit conversion controls. */
.product-editor .editor-global-footer,.product-editor .measure-entry-actions,.product-editor .weight-actions,.dialog-actions{gap:16px;flex-wrap:wrap}
.product-editor .editor-global-footer>button,.product-editor .measure-entry-actions>button,.product-editor .weight-actions>button{margin:0;min-height:44px}
.product-editor .editor-global-footer .secondary-link,.product-editor .measure-entry-actions .secondary-link,.product-editor .weight-actions .secondary-link{display:inline-flex;align-items:center;justify-content:center;padding:11px 18px;border:1px solid #dce5de;border-radius:12px;background:#f3f6f3;color:#4a5c4d;font:inherit;font-size:13px;font-weight:600;cursor:pointer}
.product-editor .editor-global-footer .secondary-link:hover,.product-editor .measure-entry-actions .secondary-link:hover,.product-editor .weight-actions .secondary-link:hover{background:#e7eee8}
.product-editor .editor-pair{column-gap:16px;row-gap:12px;align-items:start}
.product-editor .measure-tabs{gap:16px;margin-bottom:20px}
.product-editor .measure-add{margin-top:16px;margin-bottom:20px}
.product-editor .weight-trigger{margin-top:12px;margin-bottom:8px;min-height:40px;padding:10px 16px}
.product-editor details>form>.primary{margin-top:16px;margin-bottom:4px}
.product-editor select,.ingredient-dialog select,.nutrition-create select{appearance:none;-webkit-appearance:none;box-sizing:border-box;min-height:46px;width:100%;min-width:0;border:1px solid #dbe5dd;border-radius:12px;background-color:#f4f8f4;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%232b7a34' stroke-width='2'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");background-position:right 12px center;background-repeat:no-repeat;padding:12px 36px 12px 14px;font:inherit;font-size:14px;line-height:1.5;color:#2f4934;cursor:pointer;transition:border-color .15s,background-color .15s}
.product-editor select:hover,.ingredient-dialog select:hover{border-color:#83c88a;background-color:#edf7ee}
.product-editor select:focus-visible,.ingredient-dialog select:focus-visible{outline:3px solid #34b03e40;outline-offset:2px;border-color:#34b03e}
select option{background:#fff;color:#2f4934;padding:10px}
.product-editor [data-use-unit]{display:flex;align-items:center;min-height:46px;box-sizing:border-box;padding:12px 14px;background:#f4f8f4;border:1px solid #dbe5dd;border-radius:12px;color:#2f4934}
@media(max-width:480px){.product-editor .editor-global-footer{gap:12px;padding:14px 18px}.product-editor .editor-global-footer>button{flex:1}.product-editor .editor-pair{column-gap:12px;grid-template-columns:minmax(0,1fr) 100px}}

/* Custom popup: avoid platform-native option menu. */
.styled-select{position:relative;min-width:0;width:100%}
select.select-data-source,.product-editor select.select-data-source{display:none!important}
.styled-select-trigger{display:flex;align-items:center;justify-content:space-between;gap:12px;box-sizing:border-box;width:100%;min-height:46px;padding:12px 14px;border:1px solid #dbe5dd;border-radius:12px;background:#f4f8f4;color:#2f4934;font:inherit;font-size:14px;line-height:1.5;text-align:left;cursor:pointer}
.styled-select-trigger::after{content:'';flex:0 0 7px;width:7px;height:7px;border-right:2px solid #36833e;border-bottom:2px solid #36833e;transform:rotate(45deg);margin:0 3px 4px 6px}
.styled-select-trigger[aria-expanded=true]{border-color:#34b03e;background:#edf8ee;box-shadow:0 0 0 3px #34b03e20}
.styled-select-trigger[aria-expanded=true]::after{transform:rotate(225deg);margin-bottom:0}
.styled-select-trigger:focus-visible{outline:3px solid #34b03e40;outline-offset:2px}
.styled-select-options{position:absolute;top:calc(100% + 6px);left:0;right:0;z-index:30;max-height:230px;overflow:auto;overscroll-behavior:contain;box-sizing:border-box;padding:6px;background:white;border:1px solid #dfe8e1;border-radius:14px;box-shadow:0 10px 28px #183b2026}
.styled-select-options[hidden]{display:none!important}
.styled-select-options button[role=option]{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;min-height:40px;box-sizing:border-box;padding:9px 12px;margin:0 0 3px;border:0;border-radius:9px;background:#fff;color:#3d5141;text-align:left;font:inherit;font-size:14px;line-height:1.5;cursor:pointer}
.styled-select-options button[role=option]:last-child{margin-bottom:0}
.styled-select-options button[role=option]:hover,.styled-select-options button[role=option]:focus{background:#f0f8f1;outline:none;color:#267d2e}
.styled-select-options button[role=option].selected{background:#e5f6e7;color:#23822d;font-weight:600}
.styled-select-options button[role=option].selected::after{content:'✓';font-size:16px;color:#34b03e}
.styled-select-options button[role=option]:disabled,.styled-select-trigger:disabled{opacity:.5;cursor:default}

/* Whole-control hit area and white selector surfaces. */
.styled-select-trigger,.styled-select-trigger:hover,.styled-select-trigger:focus,.styled-select-trigger[aria-expanded=true]{background:#fff}
.sort-form{position:relative;padding:0;min-width:110px}
.sort-form>.icon{position:absolute;left:14px;top:50%;transform:translateY(-50%);pointer-events:none;z-index:1}
.sort-form .styled-select{height:100%;width:100%}
.sort-form .styled-select-trigger{height:100%;min-height:63px;border:0;border-radius:19px;padding:12px 18px 12px 44px;white-space:nowrap;box-shadow:none;background:#fff;gap:12px}
.sort-form .styled-select-trigger[aria-expanded=true]{box-shadow:inset 0 0 0 1px #34b03e}
.sort-form .styled-select-options{min-width:140px;left:auto;right:0}
.product-editor .styled-select-trigger,.ingredient-dialog .styled-select-trigger{background:#fff}
@media(max-width:700px){.sort-form .styled-select-trigger{min-height:48px}}

.styled-select-options .select-search{position:sticky;top:-6px;z-index:1;display:block;padding:4px 2px 10px;margin:0;background:#fff}
.styled-select-options .select-search input,.product-editor .styled-select-options .select-search input{box-sizing:border-box;width:100%;min-height:40px;border:1px solid #dde6df;border-radius:10px;background:#fff;padding:10px 12px;font:inherit;font-size:13px;color:#324b38}
.styled-select-options .select-search input:focus{outline:2px solid #34b03e40;border-color:#34b03e}
.select-no-results{padding:12px 8px;margin:0;color:#7a827b;font-size:12px;line-height:1.5}
.styled-select-options button[hidden],.styled-select-options .select-no-results[hidden]{display:none!important}

input.money-input{font-variant-numeric:tabular-nums;text-align:left}

.product-editor-header{gap:20px;padding:24px 30px}
.product-photo-tools{position:relative;flex:0 0 120px;width:120px;height:120px;margin:0}
.product-photo-expand{box-sizing:border-box;border:1px solid #f0f0f3;background:white;padding:0;width:120px;height:120px;border-radius:50%;cursor:zoom-in;position:relative}
.product-editor-header .product-photo-expand img{display:block;width:100%;height:100%;object-fit:contain;border-radius:0;background:transparent}
.photo-zoom-mark,.photo-camera{box-sizing:border-box;position:absolute;display:flex;align-items:center;justify-content:center;border:1px solid #e8e8ed;border-radius:50%;background:#f5f5f7;color:#171a1f}
.photo-zoom-mark{width:28px;height:28px;top:-5px;left:-5px;color:#737581}.photo-zoom-mark svg{width:16px;height:16px}
.photo-camera{width:40px;height:40px;bottom:-5px;right:-5px;padding:9px;box-shadow:0 1px 3px #0001;cursor:pointer}.photo-camera svg{width:20px;height:20px}
.product-title-area{min-width:0;flex:1}.product-title-line{display:flex;align-items:center;gap:8px;margin-bottom:8px}.product-title-line h2{margin:0;font-size:24px;line-height:1.2;letter-spacing:-.6px;overflow-wrap:anywhere}
.product-title-line .icon-button{flex:0 0 32px;width:32px;height:32px;padding:6px;background:transparent;border:0;border-radius:50%;color:#747580;box-shadow:none}.product-title-line .icon-button svg{width:20px;height:20px}
.product-title-line .icon-button:hover{background:#f5f5f7}.product-name-help{display:flex;align-items:center;justify-content:center;flex:0 0 24px;width:24px;height:24px;color:#747580}.product-name-help svg{width:22px;height:22px}
.product-editor-header .product-category{display:inline-block;border:1px solid #d1d2d7;background:#f4f4f6;border-radius:20px;padding:3px 10px;font-size:14px;line-height:20px;color:#343740}
[data-name-slot] input{width:100%;margin:8px 0;padding:10px 12px;border:1px solid #34b03e;border-radius:10px;font-size:17px;background:white}
.product-photo-viewer[open]{--photo-zoom:1;--photo-size:min(650px,calc(96vw - 48px),calc(94dvh - 124px));display:flex;flex-direction:column;box-sizing:border-box;width:min(1100px,96vw);height:94dvh;max-width:96vw;max-height:94dvh;margin:auto;padding:20px;border:0;border-radius:22px;background:#f5f5f7;overflow:hidden}
.photo-viewer-toolbar{display:flex;align-items:center;justify-content:space-between;flex-shrink:0;padding-bottom:12px;gap:16px}.photo-zoom-controls{display:flex;align-items:center;gap:8px;padding:4px 8px;border:1px solid #e6e7eb;border-radius:32px;background:#f5f5f7;box-shadow:0 1px 3px #0001}.photo-zoom-controls button{width:42px;height:42px;padding:0;border:0;border-radius:50%;background:transparent;color:#171a1b;font-size:25px;cursor:pointer}.photo-zoom-controls button:disabled{color:#a0a2a5;cursor:default}.photo-zoom-controls output{font-size:14px;color:#6e7179;min-width:48px;text-align:center;font-variant-numeric:tabular-nums}.photo-viewer-toolbar>.icon-button{width:44px;height:44px;border:1px solid #e6e7eb;border-radius:50%;background:#f5f5f7;box-shadow:0 2px 5px #0002;color:#171a1b}
.photo-viewer-viewport{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain}.photo-viewer-stage{width:max-content;min-width:100%;min-height:100%;display:grid;place-items:center}.photo-zoom-image{box-sizing:border-box;width:calc(var(--photo-size) * var(--photo-zoom));height:calc(var(--photo-size) * var(--photo-zoom));padding:0;border:0;border-radius:20px;background:#eeeff1;box-shadow:0 5px 15px #0001;overflow:hidden;cursor:zoom-in}
.product-editor-header .product-photo-viewer img{display:block;width:100%;height:100%;max-width:none;max-height:none;object-fit:contain;border-radius:50%;background:white}.product-photo-viewer::backdrop{background:#0006;backdrop-filter:blur(3px)}
@media(max-width:600px){.product-editor-header{padding:24px;gap:20px}.product-photo-tools,.product-photo-expand{width:112px;height:112px}.product-photo-tools{flex-basis:112px}.product-title-line{gap:6px}.product-title-line h2{font-size:24px}.product-photo-viewer[open]{padding:12px;--photo-size:min(650px,calc(96vw - 28px),calc(94dvh - 108px))}.photo-zoom-controls button{width:36px;height:36px}}

@media(max-width:420px){.product-editor-header{padding:24px 20px;gap:16px}.product-photo-tools,.product-photo-expand{width:92px;height:92px}.product-photo-tools{flex-basis:92px}.product-photo-expand{padding:0}.product-title-line{gap:3px}.product-title-line h2{font-size:20px}.product-title-line .icon-button{flex-basis:28px;width:28px;height:28px;padding:4px}.product-name-help{flex-basis:22px;width:22px}}

/* Shared required and server validation feedback. */
.required-mark{color:#c62828;font-weight:700;margin-left:3px}
.field-error{display:block;color:#b42318;font-size:13px;line-height:1.5;margin:8px 0 12px}
input[aria-invalid="true"],select[aria-invalid="true"],textarea[aria-invalid="true"],.product-editor input[aria-invalid="true"]{border:1px solid #d92d20!important;box-shadow:0 0 0 3px #d92d2012!important}

.supplier-pending-card>span{display:block;font-weight:650}.supplier-pending-label{display:block;color:#247b2b;margin:8px 0 12px}.supplier-pending-card .secondary-link{margin-top:4px}

.supplier-card{display:flex;align-items:center;justify-content:space-between;gap:16px}.supplier-card>div{min-width:0;overflow-wrap:anywhere}.supplier-delete{display:inline-flex;align-items:center;justify-content:center;flex:0 0 40px;width:40px;height:40px;padding:9px;border:1px solid #fecaca;border-radius:12px;background:#fff5f5;color:#d92d20;cursor:pointer}.supplier-delete:hover{background:#fee2e2;border-color:#f87171}.supplier-delete svg{width:20px;height:20px}.supplier-pending-card>div>span{font-weight:650}

.feedback-toast{--feedback-color:#34b03e;position:fixed;inset: max(20px,env(safe-area-inset-top)) 16px auto;margin:0 auto;box-sizing:border-box;width:min(720px,calc(100vw - 32px));display:flex;align-items:center;gap:18px;padding:24px 24px 28px;border:1px solid #ececf1;border-bottom:6px solid var(--feedback-color);border-radius:16px;background:#fff;color:#242739;box-shadow:0 12px 48px #0003;z-index:2147483647;animation:feedback-enter .28s ease-out}
.feedback-toast[data-type="error"]{--feedback-color:#e43d51}.feedback-toast-icon{flex:0 0 42px;color:var(--feedback-color)}.feedback-toast-icon svg{display:block;width:42px;height:42px}.feedback-toast>div{flex:1;min-width:0}.feedback-toast strong{display:block;font-size:18px;line-height:1.35;margin-bottom:5px}.feedback-toast p{font-size:15px;line-height:1.5;color:#74798d;margin:0;overflow-wrap:anywhere}.feedback-toast-close{align-self:flex-start;flex:0 0 28px;width:28px;height:28px;padding:0;border:0;background:transparent;color:#74798d;font-size:25px;border-radius:50%}.feedback-toast.is-leaving{animation:feedback-exit .22s ease-in forwards}.feedback-toast::backdrop{background:transparent;pointer-events:none}
@keyframes feedback-enter{from{opacity:0;transform:translateY(-35px)}to{opacity:1;transform:translateY(0)}}@keyframes feedback-exit{to{opacity:0;transform:translateY(-25px)}}
@media(max-width:600px){.feedback-toast{padding:18px 14px 20px;gap:12px}.feedback-toast strong{font-size:16px}.feedback-toast p{font-size:14px}.feedback-toast-icon,.feedback-toast-icon svg{width:32px;height:32px;flex-basis:32px}}
@media(prefers-reduced-motion:reduce){.feedback-toast,.feedback-toast.is-leaving{animation:none}}

/* Compact system notification with a countdown bar. */
.feedback-toast{width:min(460px,calc(100vw - 32px));gap:12px;padding:16px 16px 20px;border-bottom:0;border-radius:14px;overflow:hidden}
.feedback-toast strong{font-size:15px;line-height:1.35;margin-bottom:4px}.feedback-toast p{font-size:13px;line-height:1.45}.feedback-toast-icon{flex-basis:30px}.feedback-toast-icon svg{width:30px;height:30px}.feedback-toast-close{flex-basis:24px;width:24px;height:24px;font-size:22px}
.feedback-toast-progress{position:absolute;left:0;right:0;bottom:0;height:4px;background:var(--feedback-color);transform-origin:left;animation:feedback-countdown linear forwards}
@keyframes feedback-countdown{from{transform:scaleX(1)}to{transform:scaleX(0)}}
@media(max-width:600px){.feedback-toast{padding:14px 14px 18px;gap:10px}.feedback-toast strong{font-size:14px}.feedback-toast p{font-size:12px}.feedback-toast-icon,.feedback-toast-icon svg{width:28px;height:28px;flex-basis:28px}}
@media(prefers-reduced-motion:reduce){.feedback-toast-progress{animation:none}}

[data-editor-save]:disabled{opacity:.45;cursor:not-allowed;filter:grayscale(.3)}
