/* Product Dialog Core Styles - Tailwind CSS Equivalent */

/* Dialog Overlay & Container */
.product-dialog {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
}

.product-dialog-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.product-dialog-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

/* Dialog Body - bg-card-light w-full max-w-[1200px] h-[85vh] rounded-xl shadow-2xl flex flex-col overflow-hidden border */
.product-dialog-body {
  background-color: #ffffff;
  width: 100%;
  max-width: 1440px; /* wider: the products column needs the room */
  height: 90vh;
  border-radius: 16px; /* rounded-xl */
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); /* shadow-2xl */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e5e7eb;
 padding: 24px 0px 24px 0px;
}

/* Header - flex justify-between items-start px-8 py-6 border-b shrink-0 */
.product-dialog-body > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
    padding: 0rem 1.5rem 0.5rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

/* text-xl font-bold */
.product-dialog-body h1 {
  font-size: 1.25rem; /* text-xl */
  line-height: 1.75rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

/* text-sm mt-1 */
.product-dialog-body > div:first-child p {
  font-size: 0.875rem; /* text-sm */
  line-height: 1.25rem;
  color: #6b7280;
  margin-top: 0.25rem; /* mt-1 */
  margin-bottom: 0;
}

/* Close button - transition-colors */
.product-dialog-close {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition-property: color;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

.product-dialog-close:hover {
  color: #111827;
}

.product-dialog-close .material-icons {
  font-size: 1.5rem; /* text-2xl */
}

/* Main Content - flex flex-1 overflow-hidden */
.product-dialog-body > div:nth-child(2) {
  display: flex;
  flex: 1 1 0%;
  overflow: hidden;
}

/* Left Panel - w-1/3 flex flex-col p-6 border-r overflow-y-auto custom-scrollbar */
.product-dialog-body > div:nth-child(2) > div:first-child {
  width: 29%;
  display: flex;
  flex-direction: column;
  padding: 1.5rem; /* p-6 */
  border-right: 1px solid #e5e7eb;
  overflow-y: auto;
}

/* mb-4 */
.product-dialog-body > div:nth-child(2) > div:first-child > div:first-child {
  margin-bottom: 1rem; /* mb-4 */
}

/* text-base font-semibold */
.product-dialog-body > div:nth-child(2) > div:first-child h2 {
  font-size: 1rem; /* text-base */
  line-height: 1.5rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

/* text-xs mt-1 */
.product-dialog-body > div:nth-child(2) > div:first-child > div:first-child > p {
  font-size: 0.75rem; /* text-xs */
  line-height: 1rem;
  color: #6b7280;
  margin-top: 0.25rem; /* mt-1 */
  margin-bottom: 0;
}

/* Layout Options Container - space-y-6 */
.product-dialog-body > div:nth-child(2) > div:first-child > div:last-child {
  display: flex;
  flex-direction: column;
  gap: 1.5rem; /* space-y-6 */
}

/* Layout Option Item - flex items-center gap-4 group */
.layout-option {
  display: flex;
  align-items: center;
  gap: 1rem; /* gap-4 */
  cursor: pointer;
}

/* Custom Radio Button (Layout Preview) */
.layout-radio-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}

/* Hide the default radio button */
.layout-radio {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Custom radio visual */
.custom-radio {
  width: 1.25rem; /* 20px */
  height: 1.25rem; /* 20px */
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem; /* 4px - rounded */
  border: 1px solid rgba(224, 224, 224, 1);
  background-color: #ffffff;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

/* Checkmark icon - hidden by default */
.radio-checkmark {
  opacity: 0;
  transform: scale(0);
  transition: all 0.2s ease;
}

/* When radio is checked */
.layout-radio:checked + .custom-radio {
  background: rgba(231, 0, 11, 0.1);
  border: 1px solid rgba(224, 224, 224, 1);
}

/* Show checkmark when checked */
.layout-radio:checked + .custom-radio .radio-checkmark {
  opacity: 1;
  transform: scale(1);
}

/* Hover effect */
.layout-radio-wrapper:hover .custom-radio {
  border-color: rgba(224, 224, 224, 1);
}

/* Focus visible for accessibility */
.layout-radio:focus-visible + .custom-radio {
  outline: 2px solid rgba(224, 224, 224, 1);
  outline-offset: 2px;
}

/* flex-1 bg-white border rounded-xl p-4 shadow-sm hover:shadow-md transition-shadow cursor-pointer */
.layout-option > div:last-child {
  flex: 1 1 0%;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px; /* rounded-xl */
  padding: 1rem; /* p-4 */
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); /* shadow-sm */
  cursor: pointer;
  transition: all 0.2s ease;
}
.dark .layout-option > div:last-child {
  background-color: rgb(255 255 255 / 15%) !important;
}

.layout-option > div:last-child:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); /* hover:shadow-md */
}

/* When layout is selected, change the preview card background and border */
.layout-option:has(.layout-radio:checked) > div:last-child,
.layout-option.layout-selected > div:last-child {
  /* background: rgba(231, 0, 11, 0.1) !important; */
  border: 1px solid rgba(231, 0, 11, 1) !important;
}

/* Centered Layout Preview - flex flex-col items-center text-center */
.layout-option > div:last-child > div:first-child {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* w-16 h-16 rounded-full object-cover mb-3 */
.layout-option[data-layout="centered"] img {
  width: 4rem; /* w-16 */
  height: 4rem; /* h-16 */
  border-radius: 9999px; /* rounded-full */
  object-fit: cover;
  margin-bottom: 0.75rem; /* mb-3 */
}

/* font-semibold text-sm */
.layout-option[data-layout="centered"] h3 {
  font-weight: 600;
  font-size: 0.875rem; /* text-sm */
  line-height: 1.25rem;
  color: #111827;
  margin: 0;
}
.dark .layout-option[data-layout="centered"] h3 {
 color:white;
}

/* text-xs mt-1 */
.layout-option[data-layout="centered"] p:first-of-type {
  font-size: 0.75rem; /* text-xs */
  line-height: 1rem;
  color: #6b7280;
  margin-top: 0.25rem; /* mt-1 */
  margin-bottom: 0;
}
.dark .layout-option[data-layout="centered"] p:first-of-type {
  color:white;
}

/* text-sm font-bold text-primary mt-2 */
.layout-option[data-layout="centered"] p:last-of-type {
  font-size: 0.875rem; /* text-sm */
  line-height: 1.25rem;
  font-weight: 700;
  color: #EC003F; /* text-primary */
  margin-top: 0.5rem; /* mt-2 */
  margin-bottom: 0;
      width: 68px;
    height: 24px;
    background: #FDF2F8;
    border-radius: 16px;
}

/* Horizontal Layout Preview - flex items-center gap-4 */
.layout-option[data-layout="horizontal"] > div:last-child > div {
  display:flex;
  flex-direction: row;
  gap: 1rem; /* gap-4 */
}

/* w-14 h-14 rounded-full object-cover */
.layout-option[data-layout="horizontal"] img {
  width: 3.5rem; /* w-14 */
  height: 3.5rem; /* h-14 */
  border-radius: 9999px; /* rounded-full */
  object-fit: cover;
}

/* font-semibold text-sm */
.layout-option[data-layout="horizontal"] h3 {
  font-weight: 600;
  font-size: 0.875rem; /* text-sm */
  line-height: 1.25rem;
  color: #111827;
  margin: 0;
}
.dark .layout-option[data-layout="horizontal"] h3 {
  color:white;
}

/* text-xs mt-1 */
.layout-option[data-layout="horizontal"] p:first-of-type {
  font-size: 0.75rem; /* text-xs */
  line-height: 1rem;
  color: #6b7280;
  margin-top: 0.25rem; /* mt-1 */
  margin-bottom: 0;
}
.dark .layout-option[data-layout="horizontal"] p:first-of-type {
  color:white;
}

/* text-sm font-bold text-primary mt-1 */
.layout-option[data-layout="horizontal"] p:last-of-type {
  font-size: 0.875rem; /* text-sm */
  line-height: 1.25rem;
  font-weight: 700;
  color: #EC003F; /* text-primary */
  margin-top: 0.25rem; /* mt-1 */
  margin-bottom: 0;
  width: 68px;
    height: 24px;
    background: #FDF2F8;
    border-radius: 16px;
}

/* Card Layout Preview - overflow-hidden */
.layout-option[data-layout="card"] > div:last-child {
  overflow: hidden;
}

/* h-24 w-full relative */
.layout-option[data-layout="card"] > div:last-child > div:first-child {
  height: 6rem; /* h-24 */
  width: 100%;
  position: relative;
}

/* w-full h-full object-cover */
.layout-option[data-layout="card"] > div:last-child > div:first-child img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* p-3 */
.layout-option[data-layout="card"] > div:last-child > div:last-child {
  padding: 0.75rem; /* p-3 */
}

/* font-semibold text-sm */
.layout-option[data-layout="card"] h3 {
  font-weight: 600;
  font-size: 0.875rem; /* text-sm */
  line-height: 1.25rem;
  color: #111827;
  margin: 0;
}
.dark .layout-option[data-layout="card"] h3 {
  color:white;
}

/* text-xs mt-1 */
.layout-option[data-layout="card"] p:first-of-type {
  font-size: 0.75rem; /* text-xs */
  line-height: 1rem;
  color: #6b7280;
  margin-top: 0.25rem; /* mt-1 */
  margin-bottom: 0;
}
.dark .layout-option[data-layout="card"] p:first-of-type {
  color:white;
}

/* text-sm font-bold text-primary mt-2 */
.layout-option[data-layout="card"] p:last-of-type {
  font-size: 0.875rem; /* text-sm */
  line-height: 1.25rem;
  font-weight: 700;
  color: #EC003F; /* text-primary */
  margin-top: 0.5rem; /* mt-2 */
  margin-bottom: 0;
  width: 68px;
    height: 24px;
    background: #FDF2F8;
    border-radius: 16px;
    text-align: center;

}

/* Middle Panel - w-1/3 flex flex-col border-r bg-background-light/50 */
.product-dialog-body > div:nth-child(2) > div:nth-child(2) {
  width: 41%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e5e7eb;
  background-color: rgba(249, 250, 251, 0.5);
}

/* Search Header - p-4 border-b flex gap-3 sticky top-0 bg-card-light z-10 */
.product-dialog-body > div:nth-child(2) > div:nth-child(2) > div:first-child {
  padding: 1rem; /* p-4 */
  display: flex;
  gap: 0.75rem; /* gap-3 */
  position: sticky;
  top: 0;
  background-color: #ffffff;
  z-index: 10;
}

/* relative flex-1 */
.product-dialog-body > div:nth-child(2) > div:nth-child(2) > div:first-child > div {
  position: relative;
  flex: 1 1 0%;
}

/* absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-lg */
.product-dialog-body > div:nth-child(2) > div:nth-child(2) > div:first-child > div .material-icons {
  position: absolute;
  left: 0.75rem; /* left-3 */
  top: 50%;
  transform: translateY(-50%); /* -translate-y-1/2 */
  color: #9ca3af; /* text-gray-400 */
  font-size: 1.125rem; /* text-lg */
  line-height: 1.75rem;
}

/* w-full pl-10 pr-4 py-2 text-sm bg-white border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none placeholder-gray-400 */
#dialog-product-search {
  width: 100%;
  padding-left: 2.5rem; /* pl-10 */
  padding-right: 1rem; /* pr-4 */
  padding-top: 0.5rem; /* py-2 */
  padding-bottom: 0.5rem;
  font-size: 0.875rem; /* text-sm */
  line-height: 1.25rem;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px; /* rounded-lg */
  outline: 2px solid transparent;
  outline-offset: 2px;
  color: #111827;
  transition-property: color, background-color, border-color, box-shadow;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}
.dark #dialog-product-search{
  background-color:transparent;
  color:white;
}

#dialog-product-search:focus {
  border-color: transparent; /* focus:border-transparent */
  box-shadow: white; /* focus:ring-2 focus:ring-primary */
}

#dialog-product-search::placeholder {
  color: #9ca3af; /* placeholder-gray-400 */
}
.dark #dialog-product-search::placeholder {
  color: white; /* placeholder-gray-400 */
}

/* px-3 py-2 text-sm font-medium bg-white border rounded-lg hover:bg-gray-50 transition-colors whitespace-nowrap */
#dialog-select-all-btn {
  padding-left: 0.75rem; /* px-3 */
  padding-right: 0.75rem;
  padding-top: 0.5rem; /* py-2 */
  padding-bottom: 0.5rem;
  font-size: 0.875rem; /* text-sm */
  line-height: 1.25rem;
  font-weight: 500;
  color: #6b7280;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px; /* rounded-lg */
  white-space: nowrap;
  cursor: pointer;
  transition-property: color, background-color, border-color;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}
.dark #dialog-select-all-btn {
  background-color: transparent;
  color:white;
}

#dialog-select-all-btn:hover {
  background-color: #f9fafb; /* hover:bg-gray-50 */
}
.dark #dialog-select-all-btn:hover {  background-color: white;
  color:black;
}

/* Products List - flex-1 overflow-y-auto p-4 space-y-3 custom-scrollbar */
#dialog-products-list {
  flex: 1 1 0%;
  overflow-y: auto;
  padding: 1rem; /* p-4 */
  display: flex;
  flex-direction: column;
  gap: 0.75rem; /* space-y-3 */
  height: 90px;
}

/* text-center py-8 */
#dialog-products-list > div {
  text-align: center;
  padding-top: 2rem; /* py-8 */
  padding-bottom: 2rem;
  color: #6b7280;
}
.dark #dialog-products-list > div {
   background-color: rgb(255 255 255 / 15%) !important;
}

/* Product Item - flex items-center gap-3 bg-white p-3 rounded-lg border hover:border-gray-300 transition-colors group cursor-pointer */
.dialog-product-item {
  display: flex;
  align-items: center;
  gap: 0.75rem; /* gap-3 */
  background-color: #ffffff;
  padding: 0.75rem; /* p-3 */
  border-radius:16px; /* rounded-lg */
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition-property: border-color;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
  height: auto;
}

.dialog-product-item:hover {
  border-color: #d1d5db; /* hover:border-gray-300 */
}

/* text-gray-300 cursor-move */
.dialog-product-item .material-icons {
  color: #d1d5db; /* text-gray-300 */
  cursor: move;
  font-size: 1.25rem;
}

/* w-5 h-5 flex items-center justify-center rounded bg-gray-50 border */
.dialog-product-item > div:nth-child(2) {
  width: 1.25rem; /* w-5 */
  height: 1.25rem; /* h-5 */
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem; /* rounded */
  background-color: #f9fafb; /* bg-gray-50 */
accent-color: #E7000B1A; /* text-primary */

}

/* w-10 h-10 rounded-lg object-cover bg-gray-100 */
.dialog-product-item img {
  width: 64px; /* w-10 */
  height: 64px; /* h-10 */
  border-radius: 16px; /* rounded-lg */
  object-fit: cover;
  background-color: #f3f4f6; /* bg-gray-100 */
}

/* flex-1 min-w-0 */
.dialog-product-item > div:nth-child(4) {
  min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: start;
}

/* text-sm font-medium truncate */
.dialog-product-item h4 {
  font-size: 0.875rem; /* text-sm */
  line-height: 1.25rem;
  font-weight: 500;
  color: #111827;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-wrap: unset;
}
.dark .dialog-product-item h4 {
  color:white;
}
/* text-xs */
.dialog-product-item > div:nth-child(4) > p {
  font-size: 0.75rem; /* text-xs */
  line-height: 1rem;
  color: #6b7280;
  margin-top: 0.25rem;
  margin-bottom: 0;
}
.dark .dialog-product-item > div:nth-child(4) > p {
  color:white;
}
/* Right Panel - w-1/3 flex flex-col p-6 items-center justify-center text-center */
.product-dialog-body > div:nth-child(2) > div:last-child {
  width: 30%;
  display: flex;
  flex-direction: column;
  padding: 1.5rem; /* p-6 */
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* w-full flex justify-start mb-4 */
.product-dialog-body > div:nth-child(2) > div:last-child > div:first-child {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  margin-bottom: 1rem; /* mb-4 */
}

/* text-base font-semibold */
.product-dialog-body > div:nth-child(2) > div:last-child > div:first-child h2 {
  font-size: 1rem; /* text-base */
  line-height: 1.5rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

/* flex-1 overflow-y-auto space-y-3 custom-scrollbar */
#dialog-selected-products {
  flex: 1 1 0%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem; /* space-y-3 */
  width: 100%;
  overflow-y: auto; /* Enable vertical scrolling */
  max-height: 100%; /* Ensure it respects parent height constraints */
}

/* flex flex-col items-center justify-center py-8 */
#dialog-selected-products > div.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 0.75rem;
  background: #FFFFFF;
  text-align: center;
}

#dialog-selected-products > div.empty-state svg {
  margin-bottom: 1rem;
}

/* text-sm */
#dialog-selected-products > div.empty-state p {
  font-size: 0.875rem; /* text-sm */
  line-height: 1.25rem;
  color: #6b7280;
  margin: 0;
}

/* Selected Product Item - horizontal row layout */
.selected-product-item {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 0.75rem !important;
  background-color: #ffffff;
  padding: 0.75rem;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  width: 100%;
}
.dark .selected-product-item {
 background-color: rgb(255 255 255 / 15%) !important;
}
.selected-product-item img {
  width: 64px !important;
  height: 64px !important;
  min-width: 64px !important;
  max-width: 64px !important;
  flex-shrink: 0 !important;
  border-radius: 16px;
  object-fit: cover;
  background-color: #f3f4f6;
}

.selected-product-info {
  flex: 1 !important;
  min-width: 0 !important;
  text-align: left !important;
}

.selected-product-info h4 {
  font-size: 0.875rem;
  font-weight: 500;
  color: #111827;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dark .selected-product-info h4 {
  color: white;
}

.selected-product-info p {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.25rem;
  margin-bottom: 0;
}
.dark .selected-product-info p {
  color: white;
}

/* Selected Product Item - flex items-center gap-3 bg-white p-3 rounded-lg border */
#dialog-selected-products > div[data-id] {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 0.75rem; /* gap-3 */
  background-color: #ffffff;
  padding: 0.75rem; /* p-3 */
  border-radius: 16px; /* rounded-lg */
  border: 1px solid #e5e7eb;
}

/* Force row layout for first product too */
#dialog-selected-products > div[data-id]:first-child,
#dialog-selected-products > div[data-id]:first-of-type {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
}

/* Ensure no column layout on any selected product */
#dialog-selected-products > div:not(.empty-state) {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
}

/* w-12 h-12 rounded-lg object-cover bg-gray-100 */
#dialog-selected-products img {
  width: 64px; /* w-12 */
  height: 64px; /* h-12 */
  min-width: 64px;
  max-width: 64px;
  flex-shrink: 0;
  border-radius: 16px; /* rounded-lg */
  object-fit: cover;
  background-color: #f3f4f6; /* bg-gray-100 */
}

/* flex-1 min-w-0 text-left */
#dialog-selected-products > div[data-id] > div:nth-child(2) {
  flex: 1 1 0%;
  min-width: 0;
  text-align: left;
}

/* text-sm font-medium truncate */
#dialog-selected-products h4 {
  font-size: 0.875rem; /* text-sm */
  line-height: 1.25rem;
  font-weight: 500;
  color: #111827;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dark #dialog-selected-products h4 {
  color: white;
}

/* text-xs */
#dialog-selected-products > div[data-id] > div:nth-child(2) p {
  font-size: 0.75rem; /* text-xs */
  line-height: 1rem;
  color: #6b7280;
  margin-top: 0.25rem;
  margin-bottom: 0;
}
.dark #dialog-selected-products > div[data-id] > div:nth-child(2) p {
  color: white;
}

/* text-red-500 hover:text-red-700 transition */
.remove-selected-product {
  background: none;
  border: none;
  color: #ef4444; /* text-red-500 */
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition-property: color;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

.remove-selected-product:hover {
  color: #dc2626; /* hover:text-red-700 */
}

/* text-lg */
.remove-selected-product .material-icons {
  font-size: 1.125rem; /* text-lg */
  line-height: 1.75rem;
}

/* Footer - flex justify-end items-center gap-3 px-8 py-5 border-t shrink-0 */
.product-dialog-body > div:last-child {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem; /* gap-3 */
  padding-left: 2rem; /* px-8 */
  padding-right: 2rem;
  padding-top: 1.25rem; /* py-5 */
  padding-bottom: 1.25rem;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}

/* Cancel button - px-6 py-2.5 text-sm font-medium bg-white border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors */
.product-dialog-body > div:last-child button:first-child {
  padding-left: 1.5rem; /* px-6 */
  padding-right: 1.5rem;
  padding-top: 0.625rem; /* py-2.5 */
  padding-bottom: 0.625rem;
  font-size: 0.875rem; /* text-sm */
  line-height: 1.25rem;
  font-weight: 500;
  color: #6b7280;
  background-color: #ffffff;
  border: 1px solid #d1d5db; /* border-gray-300 */
  border-radius: 16px; /* rounded-lg */
  cursor: pointer;
  transition-property: background-color;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}
.dark .product-dialog-body > div:last-child button:first-child{
background-color: transparent;
  color: white;
}

.product-dialog-body > div:last-child button:first-child:hover {
  background-color: #f9fafb; /* hover:bg-gray-50 */
  color: black;
}

/* Update Menu button - px-6 py-2.5 text-sm font-medium text-white bg-primary rounded-lg hover:bg-primary-hover shadow-sm transition-colors */
.product-dialog-body > div:last-child button:last-child {
  padding-left: 1.5rem; /* px-6 */
  padding-right: 1.5rem;
  padding-top: 0.625rem; /* py-2.5 */
  padding-bottom: 0.625rem;
  font-size: 0.875rem; /* text-sm */
  line-height: 1.25rem;
  font-weight: 500;
  color: #ffffff;
  background-color: #BA474C; /* bg-primary */
  border: none;
  border-radius: 16px; /* rounded-lg */
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); /* shadow-sm */
  cursor: pointer;
  transition-property: background-color;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

.product-dialog-body > div:last-child button:last-child:hover {
  background-color: rgba(231, 0, 11, 1); /* hover:bg-primary-hover (blue-700) */
}

/* Custom Scrollbar - Tailwind doesn't have default scrollbar styling, this is custom */
.custom-scrollbar::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background-color: #f3f4f6; /* gray-100 */
  border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background-color: #d1d5db; /* gray-300 */
  border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background-color: #9ca3af; /* gray-400 */
}

/* Dark Mode Support - dark: variants in Tailwind.
   Keyed to the app theme (.dark on <html>), not the OS setting. :where() keeps
   the selectors at the same specificity, so the .dark rules elsewhere still win. */
/* dark:bg-card-dark dark:border-border-dark */
:where(.dark) .product-dialog-body {
  background-color: #1f2937; /* gray-800 */
  border-color: #374151; /* gray-700 */
}

/* dark:text-text-main-dark */
:where(.dark) .product-dialog-body h1,
:where(.dark) .product-dialog-body h2,
:where(.dark) .product-dialog-body h3 {
  color: #f9fafb; /* gray-50 */
}

/* dark:text-text-sub-dark */
:where(.dark) .product-dialog-body p {
  color: #9ca3af; /* gray-400 */
}

/* dark:border-border-dark */
:where(.dark) .product-dialog-body > div:first-child,
:where(.dark) .product-dialog-body > div:nth-child(2) > div:first-child,
:where(.dark) .product-dialog-body > div:nth-child(2) > div:nth-child(2),
:where(.dark) .product-dialog-body > div:last-child {
  border-color: #374151; /* gray-700 */
}

/* dark:bg-gray-800 dark:border-gray-600 */
:where(.dark) .layout-option > div:last-child,
:where(.dark) .dialog-product-item,
:where(.dark) .selected-product-item,
:where(.dark) #dialog-selected-products > div[data-id],
:where(.dark) #dialog-product-search,
:where(.dark) #dialog-select-all-btn {
  background-color: #1f2937; /* gray-800 */
  border-color: #4b5563; /* gray-600 */
  color: #f9fafb;
}

/* dark:text-text-main-dark */
:where(.dark) .dialog-product-item h4,
:where(.dark) .selected-product-item h4,
:where(.dark) #dialog-selected-products h4 {
  color: #f9fafb;
}

/* dark:bg-background-dark/50 */
:where(.dark) .product-dialog-body > div:nth-child(2) > div:nth-child(2) {
  background-color: rgba(17, 24, 39, 0.5); /* gray-900/50 */
}

/* dark:bg-card-dark */
:where(.dark) .product-dialog-body > div:nth-child(2) > div:nth-child(2) > div:first-child {
  background-color: #1f2937; /* gray-800 */
}

/* dark:hover:bg-gray-700 */
:where(.dark) #dialog-select-all-btn:hover {
  background-color: #374151; /* gray-700 */
}

/* dark:bg-transparent dark:border-gray-600 */
:where(.dark) .product-dialog-body > div:last-child button:first-child {
  background-color: transparent;
  border-color: #4b5563; /* gray-600 */
  color: #9ca3af;
}

/* dark:hover:bg-gray-800 */
:where(.dark) .product-dialog-body > div:last-child button:first-child:hover {
  background-color: #1f2937; /* gray-800 */
}

/* dark:hover:text-text-main-dark */
:where(.dark) .product-dialog-close:hover {
  color: #f9fafb;
}

/* Dark mode for custom radio buttons */
:where(.dark) .custom-radio {
  background-color: #374151; /* gray-700 */
  border-color: transparent;
}

:where(.dark) .layout-radio-wrapper:hover .custom-radio {
  border-color: transparent;
}


/* ------------------------------------------------------------------ */
/* Products column: menu + category filters, options row, chips,      */
/* "Showing X of Y", category group headers                           */
/* ------------------------------------------------------------------ */

.dialog-filters {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0 1rem 1rem;
  background-color: #ffffff;
}

.dialog-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
}

.dialog-select-wrap,
.dialog-category-filter {
  position: relative;
  min-width: 0;
}

#dialog-business-menu-filter,
.dialog-category-toggle {
  width: 100%;
  height: 44px;
  padding: 0 2.5rem 0 1rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: #111827;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  outline: none;
  cursor: pointer;
  transition: border-color 150ms, background-color 150ms, color 150ms;
}

#dialog-business-menu-filter {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  /* Global form styles draw their own arrow; ours is the svg. */
  background-image: none !important;
  text-overflow: ellipsis;
}

/* Product rows: left-aligned like the design. Beats the
   `#dialog-products-list > div` empty-message rule (centred, 2rem padding). */
#dialog-products-list > .dialog-product-item {
  text-align: left;
  padding: 0.75rem;
  flex-shrink: 0;
}

#dialog-business-menu-filter:focus,
.dialog-category-toggle:focus-visible {
  border-color: #E7000B;
}

.dialog-filter-chevron {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #374151;
  pointer-events: none;
  transition: transform 150ms;
}

.dialog-category-toggle {
  display: flex;
  align-items: center;
  text-align: left;
}

.dialog-category-toggle-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-category-toggle.is-open {
  border-color: #E7000B;
}

.dialog-category-toggle.is-open .dialog-filter-chevron {
  transform: translateY(-50%) rotate(180deg);
}

.dialog-category-toggle.has-selection {
  border-color: #E7000B;
  background-color: #FEF2F2;
  color: #E7000B;
}

.dialog-category-toggle.has-selection .dialog-filter-chevron {
  color: #E7000B;
}

.dialog-category-toggle:disabled {
  color: #9ca3af;
  background-color: #f9fafb;
  cursor: not-allowed;
}

.dialog-category-toggle:disabled .dialog-filter-chevron {
  color: #d1d5db;
}

.dialog-category-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 280px;
  overflow-y: auto;
  padding: 0.375rem;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.dialog-category-option {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: #111827;
  text-align: left;
  background: none;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

.dialog-category-option:hover {
  background-color: #f9fafb;
}

.dialog-category-option-all.is-active {
  color: #E7000B;
  font-weight: 500;
}

.dialog-category-option-checkbox {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: #E7000B;
  cursor: pointer;
}

.dialog-category-option-name {
  flex: 1 1 0%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-category-option-count {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: #9ca3af;
}

.dialog-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.dialog-customize-fields-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 40px;
  padding: 0 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  background-color: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 9999px;
  cursor: pointer;
  white-space: nowrap;
}

.dialog-customize-fields-btn:hover {
  background-color: #f9fafb;
}

.dialog-category-wise {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: #111827;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.dialog-category-wise input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #E7000B;
  cursor: pointer;
}

.dialog-category-chips {
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.dialog-category-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  max-width: 100%;
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #E7000B;
  background-color: #FEF2F2;
  border: 1px solid #E7000B;
  border-radius: 9999px;
}

.dialog-category-chip-remove {
  display: inline-flex;
  padding: 0;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

.dialog-category-clear-all {
  padding: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #E7000B;
  background: none;
  border: none;
  cursor: pointer;
}

.dialog-products-count {
  padding: 0.75rem 1rem 0;
  font-size: 0.75rem;
  line-height: 1rem;
  color: #6b7280;
}

.dialog-products-count:empty {
  display: none;
}

/* Beats the `#dialog-products-list > div` message styling. */
#dialog-products-list > .dialog-category-group-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  padding: 0.25rem 0.25rem 0;
  text-align: left;
  color: #6b7280;
  background: transparent;
}

.dialog-category-group-check {
  display: inline-flex;
  margin: 0;
  cursor: pointer;
}

.dialog-category-group-checkbox {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #E7000B;
  cursor: pointer;
}

.dialog-category-group-name {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4b5563;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

.dialog-category-group-count {
  flex-shrink: 0;
  padding: 0 0.5rem;
  font-size: 0.6875rem;
  line-height: 1.25rem;
  color: #6b7280;
  background-color: #f3f4f6;
  border-radius: 9999px;
}

.dialog-category-group-line {
  flex: 1 1 0%;
  height: 1px;
  background-color: #e5e7eb;
}

.dialog-category-group-toggle {
  display: inline-flex;
  padding: 0.25rem;
  color: #6b7280;
  background: none;
  border: none;
  cursor: pointer;
  transition: transform 150ms;
}

.dialog-category-group-header.is-collapsed .dialog-category-group-toggle {
  transform: rotate(180deg);
}

/* Dark theme */
.dark .dialog-filters {
  background-color: transparent;
}

.dark #dialog-business-menu-filter,
.dark .dialog-category-toggle,
.dark .dialog-customize-fields-btn,
.dark .dialog-category-panel {
  color: #ffffff;
  background-color: rgb(255 255 255 / 8%);
  border-color: #4b5563;
}

.dark #dialog-business-menu-filter option {
  background-color: #252d37;
  color: #f3f4f6;
}

.dark .dialog-category-panel {
  background-color: #1f2937;
}

.dark .dialog-filter-chevron,
.dark .dialog-category-option,
.dark .dialog-category-wise {
  color: #ffffff;
}

.dark .dialog-category-option:hover,
.dark .dialog-customize-fields-btn:hover {
  background-color: rgb(255 255 255 / 10%);
}

.dark .dialog-category-toggle.has-selection {
  color: #ffffff;
  background-color: rgb(231 0 11 / 25%);
  border-color: #E7000B;
}

.dark .dialog-category-toggle:disabled {
  color: #9ca3af;
}

.dark .dialog-category-chip {
  color: #ffffff;
  background-color: rgb(231 0 11 / 25%);
}

.dark .dialog-products-count,
.dark .dialog-category-group-name {
  color: #d1d5db;
}

.dark #dialog-products-list > .dialog-category-group-header {
  background-color: transparent !important;
}

.dark .dialog-category-group-line {
  background-color: #4b5563;
}

/* ------------------------------------------------------------------ */
/* Header, footer, category panel (search / Apply), project checkboxes */
/* ------------------------------------------------------------------ */

.product-dialog-body > .product-dialog-topbar {
  align-items: center;
  gap: 1.5rem;
  padding: 0 1.75rem 1.25rem;
}

.product-dialog-heading {
  min-width: 0;
}

.product-dialog-heading h1 {
  font-size: 1.375rem;
  line-height: 1.75rem;
}

.product-dialog-topbar-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-shrink: 0;
}

.product-dialog-add-new-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  color: #ffffff;
  background-color: #BA474C;
  border: none;
  border-radius: 12px;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.product-dialog-add-new-btn:hover {
  background-color: rgba(231, 0, 11, 1);
}

.product-dialog-body > .product-dialog-footer {
  justify-content: space-between;
  padding: 1.25rem 1.75rem 0;
}

.product-dialog-selection-summary {
  margin: 0 auto 0 0; /* pinned left even where another rule forces flex-end */
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: #6b7280;
}

.product-dialog-footer-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.product-dialog-footer-actions button {
  min-width: 96px;
  border-radius: 12px !important;
}

.product-dialog-footer-actions .product-dialog-update-btn:disabled,
.product-dialog-footer-actions .product-dialog-update-btn:disabled:hover {
  background-color: #BA474C;
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.dark .product-dialog-selection-summary {
  color: #d1d5db;
}

/* Category panel: search on top, list scrolls, footer with Clear / Apply. */
.dialog-category-panel {
  display: flex;
  flex-direction: column;
  min-width: 300px;
  max-height: none;
  overflow: hidden;
  padding: 0.75rem;
}

.dialog-category-search {
  position: relative;
  margin-bottom: 0.5rem;
  color: #6b7280;
}

.dialog-category-search svg {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

#dialog-category-search {
  width: 100%;
  height: 40px;
  padding: 0 0.875rem 0 2.25rem;
  font-size: 0.875rem;
  color: #111827;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  outline: none;
  box-shadow: none;
}

#dialog-category-search:focus {
  border-color: rgba(231, 0, 11, 0.5);
  background-color: #ffffff;
}

.dialog-category-options {
  max-height: 320px;
  overflow-y: auto;
}

.dialog-category-option {
  gap: 0.75rem;
  padding-top: 0.625rem;
  padding-bottom: 0.625rem;
}

.dialog-category-option-count {
  font-size: 0.8125rem;
  color: #6b7280;
}

.dialog-category-no-match {
  padding: 1rem 0.75rem;
  font-size: 0.8125rem;
  color: #9ca3af;
  text-align: center;
}

.dialog-category-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
}

.dialog-category-selected-count {
  flex: 1 1 0%;
  font-size: 0.8125rem;
  color: #6b7280;
}

.dialog-category-clear {
  padding: 0.5rem 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #6b7280;
  background: none;
  border: none;
  cursor: pointer;
}

.dialog-category-clear:hover {
  color: #111827;
}

.dialog-category-apply {
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #ffffff;
  background-color: #BA474C;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: background-color 150ms;
}

.dialog-category-apply:hover {
  background-color: rgba(231, 0, 11, 1);
}

.dark #dialog-category-search {
  color: #ffffff;
  background-color: rgb(255 255 255 / 8%);
  border-color: #4b5563;
}

.dark .dialog-category-footer {
  border-color: #4b5563;
}

.dark .dialog-category-selected-count,
.dark .dialog-category-clear,
.dark .dialog-category-option-count {
  color: #d1d5db;
}

/* Chips: "+N more" / "Show less" after the first three. */
.dialog-category-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

.dialog-category-see-more {
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #374151;
  background-color: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  cursor: pointer;
}

.dialog-category-see-more:hover {
  background-color: #e5e7eb;
}

.dark .dialog-category-see-more {
  color: #ffffff;
  background-color: rgb(255 255 255 / 10%);
  border-color: #4b5563;
}

/* Checkboxes in the project's style (the Layout Preview tick): light grey
   box, pale red fill with a red tick when checked. The ID keeps these above
   the global form styles, which paint checkboxes blue. */
#product-dialog .dialog-category-option-checkbox,
#product-dialog .dialog-category-wise input,
#product-dialog .dialog-category-group-checkbox,
#product-dialog .product-checkbox {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  display: inline-block;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  vertical-align: middle;
  color: #E7000B;
  background-color: #ffffff;
  background-image: none;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 12px 10px;
  border: 1px solid rgba(224, 224, 224, 1);
  border-radius: 6px;
  box-shadow: none;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

#product-dialog .dialog-category-option-checkbox:hover,
#product-dialog .dialog-category-wise input:hover,
#product-dialog .dialog-category-group-checkbox:hover,
#product-dialog .product-checkbox:hover {
  border-color: #d1d5db;
}

#product-dialog .dialog-category-option-checkbox:checked,
#product-dialog .dialog-category-wise input:checked,
#product-dialog .dialog-category-group-checkbox:checked,
#product-dialog .product-checkbox:checked {
  background-color: rgba(231, 0, 11, 0.1);
  border-color: rgba(224, 224, 224, 1);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='10' viewBox='0 0 12 10' fill='none'%3E%3Cpath d='M1 5L4.5 8.5L11 1' stroke='%23E7000B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

#product-dialog .dialog-category-group-checkbox:indeterminate {
  background-color: rgba(231, 0, 11, 0.1);
  border-color: rgba(224, 224, 224, 1);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='10' viewBox='0 0 12 10' fill='none'%3E%3Cpath d='M2 5H10' stroke='%23E7000B' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

#product-dialog .dialog-category-option-checkbox:focus,
#product-dialog .dialog-category-wise input:focus,
#product-dialog .dialog-category-group-checkbox:focus,
#product-dialog .product-checkbox:focus {
  outline: none;
  box-shadow: none;
}

#product-dialog .dialog-category-option-checkbox:focus-visible,
#product-dialog .dialog-category-wise input:focus-visible,
#product-dialog .dialog-category-group-checkbox:focus-visible,
#product-dialog .product-checkbox:focus-visible {
  outline: 2px solid rgba(231, 0, 11, 0.4);
  outline-offset: 2px;
}

.dark #product-dialog .dialog-category-option-checkbox,
.dark #product-dialog .dialog-category-wise input,
.dark #product-dialog .dialog-category-group-checkbox,
.dark #product-dialog .product-checkbox {
  background-color: #374151;
  border-color: #4b5563;
}

.dark #product-dialog .dialog-category-option-checkbox:checked,
.dark #product-dialog .dialog-category-wise input:checked,
.dark #product-dialog .dialog-category-group-checkbox:checked,
.dark #product-dialog .product-checkbox:checked,
.dark #product-dialog .dialog-category-group-checkbox:indeterminate {
  background-color: rgba(231, 0, 11, 0.25);
}

/* The row checkbox sits in a small grey box; let the checkbox fill it. */
.dialog-product-item > div:nth-child(2) {
  width: auto;
  height: auto;
  background-color: transparent;
}

/* ------------------------------------------------------------------ */
/* Step 3: selected rows, image placeholders, Selected Products column, */
/* Layout Preview (first selected product, round radios)               */
/* ------------------------------------------------------------------ */

/* Product image or the dashed "no image" box. */
.dialog-thumb {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  overflow: hidden;
  color: #9ca3af;
}

.dialog-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dialog-thumb .dialog-thumb-placeholder {
  display: none;
}

.dialog-thumb.is-empty {
  background-color: #f9fafb;
  border: 1.5px dashed #d1d5db;
}

.dialog-thumb.is-empty img {
  display: none !important;
}

.dialog-thumb.is-empty .dialog-thumb-placeholder {
  display: block;
}

/* Centre list: a selected product's row is highlighted. */
#dialog-products-list > .dialog-product-item.is-selected {
  background-color: rgba(231, 0, 11, 0.05);
  border-color: rgba(231, 0, 11, 1);
}

.dark #dialog-products-list > .dialog-product-item.is-selected {
  background-color: rgba(231, 0, 11, 0.15) !important;
}

/* Selected Products column: top-aligned list instead of a centred block. */
#product-dialog .dialog-selected-column {
  align-items: stretch;
  justify-content: flex-start;
  text-align: left;
  min-height: 0;
}

#product-dialog .dialog-selected-column > .dialog-selected-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 0.375rem;
}

.dialog-selected-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dialog-selected-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #E7000B;
  background-color: rgba(231, 0, 11, 0.1);
  border-radius: 9999px;
}

.dialog-selected-clear-all {
  padding: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #E7000B;
  background: none;
  border: none;
  cursor: pointer;
}

.dialog-selected-tools {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-bottom: 0.875rem;
}

#product-dialog .dialog-selected-hint {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1rem;
  color: #6b7280;
}

#dialog-selected-products {
  gap: 0.625rem;
  min-height: 0;
}

#dialog-selected-products > div.empty-state {
  flex: 1 1 auto;
  background: transparent;
}

#product-dialog #dialog-selected-products .empty-state-title {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
}

#product-dialog #dialog-selected-products .empty-state-hint {
  max-width: 290px;
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  line-height: 1.25rem;
  color: #6b7280;
}

.dark #product-dialog #dialog-selected-products .empty-state-title {
  color: #f3f4f6;
}

#dialog-selected-products > .dialog-selected-group-header {
  flex-shrink: 0;
  padding: 0.5rem 0 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4b5563;
  background: transparent;
  border: none;
}

#dialog-selected-products > .dialog-selected-group-header:first-child {
  padding-top: 0;
}

#dialog-selected-products > .selected-product-item {
  flex-shrink: 0;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 12px;
  cursor: grab;
}

#dialog-selected-products > .selected-product-item.is-dragging {
  opacity: 0.5;
}

.selected-product-drag {
  display: inline-flex;
  flex-shrink: 0;
  color: #9ca3af;
}

#dialog-selected-products .selected-product-item .dialog-thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
}

#dialog-selected-products .selected-product-item .dialog-thumb img {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  border-radius: 0;
}

#product-dialog .selected-product-info h4 {
  font-weight: 600;
}

.selected-product-customize {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  color: #4b5563;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  cursor: pointer;
}

.selected-product-customize:hover {
  background-color: #f9fafb;
  border-color: #d1d5db;
}

#dialog-selected-products .remove-selected-product {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  color: #6b7280;
  background-color: #f3f4f6;
  border-radius: 9999px;
}

#dialog-selected-products .remove-selected-product:hover {
  color: #E7000B;
  background-color: rgba(231, 0, 11, 0.1);
}

.dark .selected-product-customize,
.dark #dialog-selected-products .remove-selected-product {
  color: #f3f4f6;
  background-color: rgb(255 255 255 / 10%);
  border-color: #4b5563;
}

.dark #product-dialog .dialog-selected-hint,
.dark #dialog-selected-products > .dialog-selected-group-header {
  color: #d1d5db;
}

/* Layout Preview: round radios like the design (the cards stay static samples). */
#product-dialog .custom-radio {
  width: 20px;
  height: 20px;
  border: 1.5px solid #9ca3af;
  border-radius: 9999px;
  background-color: #ffffff;
}

#product-dialog .custom-radio .radio-checkmark {
  display: none;
}

#product-dialog .layout-radio:checked + .custom-radio {
  border: 2px solid #E7000B;
  background: radial-gradient(circle, #E7000B 0 4.5px, #ffffff 5px);
}

.dark #product-dialog .custom-radio {
  background-color: #374151;
}

.dark #product-dialog .layout-radio:checked + .custom-radio {
  background: radial-gradient(circle, #E7000B 0 4.5px, #374151 5px);
}

/* ------------------------------------------------------------------ */
/* Customize Fields: button badge, strips, per-product tag, modal       */
/* ------------------------------------------------------------------ */

.dialog-customize-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #374151;
  background-color: #f3f4f6;
  border-radius: 9999px;
}

.dialog-customize-fields-btn.is-customized {
  color: #E7000B;
  background-color: rgba(231, 0, 11, 0.05);
  border-color: #E7000B;
}

.dialog-customize-fields-btn.is-customized .dialog-customize-badge {
  color: #ffffff;
  background-color: #E7000B;
}

.dialog-fields-strip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  font-size: 0.75rem;
  color: #374151;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

.dialog-fields-strip svg {
  flex-shrink: 0;
  color: #6b7280;
}

.dialog-fields-strip-text {
  flex: 1 1 0%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-fields-strip-action {
  flex-shrink: 0;
  padding: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: #E7000B;
  background: none;
  border: none;
  cursor: pointer;
}

.dialog-fields-strip.is-custom {
  color: #E7000B;
  background-color: rgba(231, 0, 11, 0.05);
  border-color: #E7000B;
}

.dialog-fields-strip.is-custom svg {
  color: #E7000B;
}

.selected-fields-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.25rem;
  padding: 0.0625rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1rem;
  color: #6b7280;
  background-color: #f3f4f6;
  border-radius: 9999px;
}

.selected-fields-tag.is-custom {
  color: #E7000B;
  background-color: rgba(231, 0, 11, 0.08);
}

.dark .dialog-fields-strip {
  color: #f3f4f6;
  background-color: rgb(255 255 255 / 6%);
  border-color: #4b5563;
}

.dark .selected-fields-tag {
  color: #d1d5db;
  background-color: rgb(255 255 255 / 10%);
}

/* The modal sits over the whole product dialog. */
.fields-modal {
  position: absolute;
  inset: 0;
  /* Above .product-dialog-content (z-index 10001, designStyle.css). */
  z-index: 10002;
}

.fields-modal-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(17, 24, 39, 0.35);
}

.fields-modal-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  overflow-y: auto;
  padding: 1.5rem;
  background-color: #ffffff;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.fields-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

#product-dialog .fields-modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 700;
  color: #111827;
}

#product-dialog .fields-modal-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: #6b7280;
}

.fields-modal-close {
  flex-shrink: 0;
  padding: 0.25rem;
  color: #6b7280;
  background: none;
  border: none;
  cursor: pointer;
}

.fields-modal-close:hover {
  color: #111827;
}

.fields-modal-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.25rem 0 0.75rem;
}

.fields-modal-count {
  flex: 1 1 0%;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #6b7280;
}

.fields-modal-link {
  padding: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #E7000B;
  background: none;
  border: none;
  cursor: pointer;
}

.fields-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.fields-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  padding: 0.75rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #111827;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  transition: background-color 150ms, border-color 150ms;
}

.fields-option:hover {
  border-color: #d1d5db;
}

.fields-option.is-checked {
  background-color: rgba(231, 0, 11, 0.05);
  border-color: #E7000B;
}

#product-dialog .fields-option-checkbox {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  background-color: #ffffff;
  background-image: none;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 12px 10px;
  border: 1px solid rgba(224, 224, 224, 1);
  border-radius: 6px;
  box-shadow: none;
  cursor: pointer;
}

#product-dialog .fields-option-checkbox:checked {
  background-color: rgba(231, 0, 11, 0.1);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='10' viewBox='0 0 12 10' fill='none'%3E%3Cpath d='M1 5L4.5 8.5L11 1' stroke='%23E7000B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

#product-dialog .fields-option-checkbox:focus {
  outline: none;
  box-shadow: none;
}

#product-dialog .fields-option-checkbox:focus-visible {
  outline: 2px solid rgba(231, 0, 11, 0.4);
  outline-offset: 2px;
}

#product-dialog .fields-modal-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0;
  font-size: 0.8125rem;
  color: #6b7280;
}

.fields-modal-info svg {
  flex-shrink: 0;
}

.fields-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.fields-modal-reset {
  padding: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #E7000B;
  background: none;
  border: none;
  cursor: pointer;
}

.fields-modal-footer-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.fields-modal-cancel,
.fields-modal-apply {
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 150ms;
}

.fields-modal-cancel {
  color: #374151;
  background-color: #ffffff;
  border: 1px solid #d1d5db;
}

.fields-modal-cancel:hover {
  background-color: #f9fafb;
}

.fields-modal-apply {
  color: #ffffff;
  background-color: #BA474C;
  border: none;
}

.fields-modal-apply:hover {
  background-color: rgba(231, 0, 11, 1);
}

.fields-modal-apply:disabled,
.fields-modal-apply:disabled:hover {
  background-color: #BA474C;
  opacity: 0.4;
  cursor: not-allowed;
}

.dark .fields-modal-card {
  background-color: #1f2937;
}

.dark #product-dialog .fields-modal-header h3,
.dark .fields-option {
  color: #f3f4f6;
}

.dark .fields-option {
  background-color: rgb(255 255 255 / 6%);
  border-color: #4b5563;
}

.dark .fields-modal-footer {
  border-color: #4b5563;
}

.dark .fields-modal-cancel {
  color: #f3f4f6;
  background-color: transparent;
  border-color: #4b5563;
}

/* Description line of a product row (products list + Selected Products):
   between name and price, two lines at most. */
#product-dialog .dialog-product-item > div:nth-child(4) {
  flex: 1;
}
#product-dialog .dialog-product-description {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  white-space: normal;
  word-break: break-word;
  font-size: 0.75rem;
  line-height: 1rem;
  color: #6b7280;
  margin: 0.125rem 0 0;
}
.dark #product-dialog .dialog-product-description {
  color: #d1d5db;
}

/* Customize Fields (one product): the records of a ticked field with
   several (sizes, allergens, ingredients, tags), to pick which to show. */
.fields-modal-records {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

#product-dialog .fields-records-hint {
  margin: 0;
  font-size: 0.8125rem;
  color: #6b7280;
}

.fields-records-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.fields-records-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #111827;
}

.fields-records-status {
  font-size: 0.75rem;
  color: #6b7280;
}

.fields-records-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.fields-record {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.4375rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #111827;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  transition: background-color 150ms, border-color 150ms;
}

.fields-record:hover {
  border-color: #d1d5db;
}

.fields-record.is-checked {
  background-color: rgba(231, 0, 11, 0.05);
  border-color: #E7000B;
}

.fields-record-detail {
  color: #6b7280;
  font-weight: 400;
}

#product-dialog .fields-record-checkbox,
#product-dialog .fields-value-checkbox {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  background-color: #ffffff;
  background-image: none;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 10px 8px;
  border: 1px solid rgba(224, 224, 224, 1);
  border-radius: 5px;
  box-shadow: none;
  cursor: pointer;
}

#product-dialog .fields-record-checkbox:checked,
#product-dialog .fields-value-checkbox:checked {
  background-color: rgba(231, 0, 11, 0.1);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='10' viewBox='0 0 12 10' fill='none'%3E%3Cpath d='M1 5L4.5 8.5L11 1' stroke='%23E7000B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

#product-dialog .fields-record-checkbox:focus,
#product-dialog .fields-value-checkbox:focus {
  outline: none;
  box-shadow: none;
}

#product-dialog .fields-record-checkbox:focus-visible,
#product-dialog .fields-value-checkbox:focus-visible {
  outline: 2px solid rgba(231, 0, 11, 0.4);
  outline-offset: 2px;
}

.dark .fields-modal-records {
  border-color: #4b5563;
}

.dark .fields-records-title,
.dark .fields-record {
  color: #f3f4f6;
}

.dark .fields-record {
  background-color: rgb(255 255 255 / 6%);
  border-color: #4b5563;
}

.dark .fields-record-detail,
.dark #product-dialog .fields-records-hint,
.dark .fields-records-status {
  color: #9ca3af;
}

/* Update Menu flow: "Choose display layout", "Review before updating",
   "Customized fields selected". Shares the Customize Fields modal shell. */
#product-dialog .flow-modal-card {
  width: min(560px, calc(100% - 32px));
}
#product-dialog .flow-modal-card[data-step="review"] {
  width: min(780px, calc(100% - 32px));
}
/* Categories side by side (two cards each) need the room. */
#product-dialog .flow-modal-card[data-step="review"][data-grouped="1"] {
  width: min(1040px, calc(100% - 32px));
}

.flow-footer {
  margin-top: 1.25rem;
}
#product-dialog .flow-footer--plain {
  border-top: 0;
  padding-top: 0;
}

/* Choose display layout */
.flow-layout-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.875rem;
  margin-top: 1.25rem;
}
.flow-layout-option {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  margin: 0;
  padding: 0.875rem;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #ffffff;
  cursor: pointer;
  user-select: none;
  transition: background-color 150ms, border-color 150ms;
}
.flow-layout-option:hover {
  border-color: #d1d5db;
}
.flow-layout-option.is-checked {
  background-color: rgba(231, 0, 11, 0.05);
  border-color: #E7000B;
}
#product-dialog .flow-layout-radio,
#product-dialog .fields-display-radio {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.flow-layout-art {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  height: 150px;
  padding: 1rem;
  border-radius: 12px;
  background: #f9fafb;
  overflow: hidden;
  box-sizing: border-box;
}
.flow-layout-option.is-checked .flow-layout-art {
  background: #ffffff;
}
.flow-layout-art .art-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.flow-layout-art i {
  display: block;
  height: 4px;
  border-radius: 4px;
  background: #e5e7eb;
}
.flow-layout-art .art-head {
  width: 40%;
  height: 6px;
  background: #6b7280;
}
.flow-layout-art .art-line {
  width: 75%;
}
.flow-layout-art .art-line--short {
  width: 50%;
}
.flow-layout-art--side .art-head {
  width: 20%;
}
.flow-layout-art--side .art-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.flow-layout-art--side .art-cols > span {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.flow-layout-option.is-checked .art-head {
  background: #E7000B;
}
.flow-layout-option.is-checked .art-line {
  background: rgba(231, 0, 11, 0.12);
}
.flow-layout-name {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #111827;
}
.flow-layout-option.is-checked .flow-layout-name {
  color: #E7000B;
}
.flow-radio-dot {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 1.5px solid #d1d5db;
  border-radius: 50%;
  background: #ffffff;
  box-sizing: border-box;
}
.flow-layout-option.is-checked .flow-radio-dot {
  border-color: #E7000B;
  box-shadow: inset 0 0 0 4px #ffffff;
  background: #E7000B;
}

/* Review before updating */
.flow-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.875rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #E7000B;
  background: rgba(231, 0, 11, 0.08);
  border-radius: 999px;
}
.flow-review-box {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 0.875rem;
  padding: 1.25rem;
  max-height: 52vh;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
}
.flow-review-group-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.9375rem;
  font-weight: 700;
  /* As on the board: categories in the accent colour. */
  color: #E7000B;
}
.flow-review-group-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}
.flow-cards {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1.125rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
}
/* Cards keep their width, so a category's panel is as wide as its cards
   and several categories can share a line, as on the canvas. */
.flow-cards--card > .flow-card,
.flow-cards--centered > .flow-card {
  width: 170px;
}
.flow-cards--horizontal > .flow-card {
  width: 240px;
}
.flow-cards--stacked > .flow-card {
  width: 300px;
}
.flow-cards--inline > .flow-card {
  width: 100%;
}
.flow-cards--inline {
  gap: 0.375rem;
}
.flow-cards--side > .flow-card {
  width: 560px;
  max-width: 100%;
}

/* Categories side by side, wrapping onto a new line. */
.flow-review-box.is-grouped {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1.25rem 1.5rem;
}
.flow-review-box.is-grouped > .flow-review-group {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
}

.flow-card {
  box-sizing: border-box;
  min-width: 0;
  padding: 0.75rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
}
.flow-card-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: #111827;
}
.flow-card-price {
  font-size: 0.875rem;
  font-weight: 700;
  color: #E7000B;
}
#product-dialog .flow-card-desc,
#product-dialog .flow-card-extra {
  margin: 0.375rem 0 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: #6b7280;
}
/* Options: one line per option group, as on the board. */
#product-dialog .flow-card-extra {
  white-space: pre-line;
}
.flow-card-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.625rem;
}
.flow-card-cover-image,
.flow-card-round,
.flow-card-banner {
  display: block;
  overflow: hidden;
  background: #f3f4f6;
}
.flow-card-cover-image img,
.flow-card-round img,
.flow-card-banner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.flow-card-cover-image {
  height: 84px;
  border-radius: 10px;
}
.flow-card--centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.flow-card--centered .flow-card-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0.5rem;
}
.flow-card--horizontal {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.flow-card--horizontal .flow-card-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.flow-card-round {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 50%;
}
.flow-card--centered .flow-card-price,
.flow-card--horizontal .flow-card-price {
  margin-top: 0.375rem;
}
.flow-card--inline {
  padding: 0.5rem 0.75rem;
}
.flow-inline-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
/* As the canvas draws an inline row: the price in dark grey, not red. */
.flow-card--inline .flow-card-price {
  font-weight: 500;
  color: #333333;
}
.dark .flow-card--inline .flow-card-price {
  color: #e5e7eb;
}
#product-dialog .flow-card--inline .flow-card-desc,
#product-dialog .flow-card--inline .flow-card-extra {
  margin-top: 0.125rem;
}
/* A category's inline list keeps a list's width, so lists can sit side
   by side; one ungrouped list uses the full width. */
/* As wide as its longest row (as the board's list grows), at least 300px. */
.flow-review-box.is-grouped .flow-cards--inline {
  /* width: 300px; */
  width: max-content;
  min-width: 300px;
  max-width: 100%;
  box-sizing: border-box;
}
.flow-card-dots {
  flex: 1;
  border-bottom: 1px dotted #d1d5db;
}

/* A display layout's card: the Layout Preview card on top (its own
   border and padding dropped), then a line and the other fields. */
.flow-card--split {
  display: flex;
  flex-direction: column;
  padding: 0;
}
.flow-card--split > .flow-card {
  border: 0;
  background: transparent;
}
.flow-card-below {
  margin: 0 0.75rem;
  padding: 0.625rem 0 0.75rem;
  border-top: 1px solid #e5e7eb;
}
.flow-card-below > .flow-inline-fields {
  margin-top: 0;
}
.dark .flow-card-below {
  border-top-color: #374151;
}
.flow-cards--side > .flow-card--split {
  width: 460px;
}

/* Label/value cards (display layouts) */
.flow-card--labelled {
  padding: 1.125rem 1.25rem;
  background: #f9fafb;
}
.flow-cards--stacked .flow-card--labelled,
.flow-cards--side .flow-card--labelled {
  background: #ffffff;
}
#product-dialog .flow-card-name {
  margin: 0 0 0.625rem;
  font-size: 1.0625rem;
  font-weight: 700;
  color: #111827;
}
.flow-card-banner {
  width: 170px;
  height: 80px;
  margin-bottom: 0.875rem;
  border-radius: 8px;
}
.flow-rows {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.flow-rows--two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}
.flow-rows-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}
.flow-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  min-width: 0;
}
.flow-row-label {
  flex-shrink: 0;
  width: 92px;
  font-size: 0.75rem;
  line-height: 1.25rem;
  color: #6b7280;
}
.flow-row-value {
  min-width: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25rem;
  color: #111827;
  overflow-wrap: break-word;
}
/* The price reads like the other fields; sizes come three to a line. */
.flow-row-value,
.flow-card-price,
.flow-inline-value {
  white-space: pre-line;
}
/* No image: the slot stays, a grey box with an image icon. */
.flow-card-banner.is-empty,
.flow-card-round.is-empty,
.flow-card-cover-image.is-empty {
  background: #F3F4F6 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='1.5' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='M3 16l5-5 4 4 3-3 6 6'/%3E%3Ccircle cx='15.5' cy='9.5' r='1.5'/%3E%3C/svg%3E") center / 34% no-repeat;
}
.flow-card-round.is-empty {
  border: 1px solid #E5E7EB;
}

#product-dialog .flow-info {
  margin: 0.875rem 0 0;
}

/* Customized fields selected */
.flow-confirm-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.flow-warning-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  color: #E7000B;
  background: rgba(231, 0, 11, 0.08);
}
#product-dialog .flow-confirm-title {
  margin: 1rem 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
}
#product-dialog .flow-confirm-text {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #4b5563;
}

.dark .flow-layout-option,
.dark .flow-card,
.dark .flow-cards--stacked .flow-card--labelled,
.dark .flow-cards--side .flow-card--labelled {
  background-color: rgb(255 255 255 / 6%);
  border-color: #4b5563;
}
.dark .flow-layout-art,
.dark .flow-cards {
  background: rgb(255 255 255 / 4%);
  border-color: #4b5563;
}
.dark .flow-review-box {
  border-color: #4b5563;
}
.dark .flow-review-group-title::after {
  background: #4b5563;
}
.dark .flow-layout-name,
.dark .flow-card-title,
.dark #product-dialog .flow-card-name,
.dark .flow-row-value,
.dark #product-dialog .flow-confirm-title {
  color: #f3f4f6;
}
.dark #product-dialog .flow-confirm-text,
.dark .flow-row-label {
  color: #9ca3af;
}

/* Inline rows with a display layout: each field's name in small grey
   capitals, its content under it; "side" puts the fields in two columns. */
.flow-inline-fields {
  display: flex;
  gap: 1.25rem;
  margin-top: 0.5rem;
}
.flow-inline-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.flow-inline-field {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.flow-inline-label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #9ca3af;
}
.flow-inline-value {
  font-size: 0.75rem;
  line-height: 1.35;
  color: #374151;
  overflow-wrap: break-word;
}
.dark .flow-inline-value {
  color: #d1d5db;
}
.flow-inline-value--tags {
  font-weight: 600;
  color: #ba474c;
}
.flow-inline-value--availability {
  font-weight: 700;
}
.flow-cards--inline-stacked,
.flow-cards--inline-side {
  gap: 0.625rem;
}
/* Two columns of fields need a wider list. */
.flow-review-box.is-grouped .flow-cards--inline-side {
  width: 460px;
}

/* The Edit button of a selected inline list: a pill hanging from the
   bottom-middle point of the selection border, joined to it by a short
   line, in the border's colour (--edit-accent, set from the canvas). */
.inline-edit-pill {
  position: absolute;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: none;
  border-radius: 999px;
  background: var(--edit-accent, #c00000);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  cursor: pointer;
}
.inline-edit-pill::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 2px;
  height: 12px;
  margin-left: -1px;
  background: var(--edit-accent, #c00000);
}
.inline-edit-pill:hover {
  filter: brightness(1.1);
}
.inline-edit-pill:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: -4px;
}

/* Layout Preview cards in the review, as the preview draws them: the name,
   the description in grey, the price in a pink pill; "card" insets its
   image in the card's padding with the text stacked under it. */
.flow-cards--card > .flow-card {
  width: 220px;
}
.flow-card--cover {
  padding: 0.75rem;
}
.flow-card--cover .flow-card-cover-image {
  height: 92px;
  border-radius: 8px;
}
.flow-card--cover .flow-card-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.625rem 0.5rem 0.25rem;
}
.flow-card--centered .flow-card-title,
.flow-card--horizontal .flow-card-title,
.flow-card--cover .flow-card-title {
  font-weight: 600;
}
.flow-card--horizontal .flow-card-text {
  align-items: flex-start;
}
.flow-card--centered .flow-card-price,
.flow-card--horizontal .flow-card-price,
.flow-card--cover .flow-card-price {
  display: inline-block;
  margin-top: 0.375rem;
  padding: 0.125rem 0.625rem;
  border-radius: 12px;
  background: #fdf2f8;
  color: #ec003f;
  font-weight: 700;
  font-size: 0.75rem;
  /* Long sizes wrap between sizes inside the card (inside one only when it
     cannot fit a line alone), as the board does. */
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
}
/* Under category titles: two cards to a line, as the board places them. */
.flow-cards.flow-cards--two {
  display: grid;
  grid-template-columns: repeat(2, max-content);
}
/* Side-by-side cards are too wide for two in the review: they wrap. */
.flow-cards--side.flow-cards--two {
  display: flex;
}

/* Category availability: a badge with the schedule after it, in the category
   filter, the category group headers and the Selected Products headers.
   States and words come from productAvailability.js. */
.category-availability-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 0 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.125rem;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 9999px;
}

.category-availability-badge.is-available,
.category-availability-badge.is-available_now {
  color: #047857;
  background-color: #ecfdf5;
  border-color: #a7f3d0;
}

.category-availability-badge.is-unavailable_now {
  color: #b45309;
  background-color: #fffbeb;
  border-color: #fde68a;
}

.category-availability-badge.is-scheduled {
  color: #1d4ed8;
  background-color: #eff6ff;
  border-color: #bfdbfe;
}

.category-availability-badge.is-ended {
  color: #4b5563;
  background-color: #f3f4f6;
  border-color: #e5e7eb;
}

.category-availability-badge.is-hidden {
  color: #b91c1c;
  background-color: #fef2f2;
  border-color: #fecaca;
}

/* Not shown any more: a category badge's detail is in its tooltip.
.category-availability-detail {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #6b7280;
}
*/

.dialog-category-option-main {
  display: flex;
  flex: 1 1 0%;
  flex-direction: column;
  min-width: 0;
}

.dialog-category-option-main > .dialog-category-option-name {
  flex: none;
}

.dialog-category-option-detail {
  overflow: hidden;
  font-size: 0.6875rem;
  line-height: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #6b7280;
}

#dialog-selected-products > .dialog-selected-group-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

/* A long title gives way (…) so the badge always shows. */
.dialog-selected-group-title {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dark .category-availability-badge.is-available,
.dark .category-availability-badge.is-available_now {
  color: #6ee7b7;
  background-color: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
}

.dark .category-availability-badge.is-unavailable_now {
  color: #fcd34d;
  background-color: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.35);
}

.dark .category-availability-badge.is-scheduled {
  color: #93c5fd;
  background-color: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.35);
}

.dark .category-availability-badge.is-ended {
  color: #d1d5db;
  background-color: rgba(107, 114, 128, 0.2);
  border-color: rgba(107, 114, 128, 0.4);
}

.dark .category-availability-badge.is-hidden {
  color: #fca5a5;
  background-color: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
}

/* .dark .category-availability-detail: not shown any more (see above). */
.dark .dialog-category-option-detail {
  color: #9ca3af;
}

/* A product's availability per order type (product rows and Selected
   Products): one badge when table and pickup agree, else one each. The
   reasons are in the badges' tooltips. */
.product-availability {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
  min-width: 0;
  /* Its column aligns items to the start, which would size this to its
     content: keep it inside the card. */
  max-width: 100%;
  margin-top: 0.25rem;
}

.product-availability-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-width: 0;
  max-width: 100%;
}

.product-availability-method {
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #4b5563;
}

.product-availability-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 0 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.125rem;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 9999px;
}

.product-availability-badge.is-available {
  color: #047857;
  background-color: #ecfdf5;
  border-color: #a7f3d0;
}

.product-availability-badge.is-unavailable {
  color: #b91c1c;
  background-color: #fef2f2;
  border-color: #fecaca;
}

.product-availability-badge.is-sold_out {
  color: #b45309;
  background-color: #fffbeb;
  border-color: #fde68a;
}

/* Not shown any more: a product badge's reason is in its tooltip.
.product-availability-reason {
  min-width: 0;
  overflow: hidden;
  font-size: 0.6875rem;
  color: #6b7280;
  text-overflow: ellipsis;
  white-space: nowrap;
}
*/

.dark .product-availability-method {
  color: #d1d5db;
}

/* Not shown any more (see .product-availability-reason above).
.dark .product-availability-reason {
  color: #9ca3af;
}
*/

.dark .product-availability-badge.is-available {
  color: #6ee7b7;
  background-color: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
}

.dark .product-availability-badge.is-unavailable {
  color: #fca5a5;
  background-color: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
}

.dark .product-availability-badge.is-sold_out {
  color: #fcd34d;
  background-color: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.35);
}

/* The Availability badge(s) in the Update Menu review, where the canvas puts
   them: a card's top-right corner, the end of an inline row's first line. */
.flow-card {
  position: relative;
}

.flow-availability {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  max-width: 60%;
  font-size: 0.6875rem;
  line-height: 1.3;
  text-align: right;
}

/* A label/value card: floated into the same corner (the negative margins
   undo the card's padding), so a long name wraps clear of it, as the canvas
   narrows the name, rather than running under it. */
#product-dialog .flow-card--labelled > .flow-availability {
  position: static;
  float: right;
  /* 60% of the card's padding box, as when it was positioned: a float's
     percentage is of the content box (1.25rem padding each side). */
  max-width: calc(60% + 1.5rem);
  margin: -0.625rem -0.75rem 0 0.5rem;
}

#product-dialog .flow-card--labelled > .flow-card-name ~ * {
  clear: right;
}

.flow-inline-head .flow-availability {
  position: static;
  flex-shrink: 0;
  max-width: none;
  margin-left: 0.5rem;
}

/* A labelled inline row's head has only the name: push the badge to the
   line's end, where the canvas puts it. */
.flow-card--inline-labelled .flow-inline-head .flow-availability {
  margin-left: auto;
  padding-left: 0.5rem;
}

/* A search box's clear (x) button: shown only while the box holds text. */
#product-dialog .dialog-search-clear {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  color: #6b7280;
  background: #f3f4f6;
  border: 0;
  border-radius: 9999px;
  cursor: pointer;
  transition: color 150ms, background-color 150ms;
}
#product-dialog .dialog-search-clear:hover,
#product-dialog .dialog-search-clear:focus-visible {
  color: #E7000B;
  background: rgba(231, 0, 11, 0.1);
  outline: none;
}
#product-dialog input:placeholder-shown + .dialog-search-clear {
  display: none;
}
/* The category search places its own icon with `svg`: not this one. */
#product-dialog .dialog-search-clear svg {
  position: static;
  transform: none;
  pointer-events: none;
}
#product-dialog #dialog-product-search,
#product-dialog #dialog-category-search {
  padding-right: 2.25rem;
}
.dark #product-dialog .dialog-search-clear {
  color: #d1d5db;
  background: #374151;
}
/* Same weight as the rule above, so it has to be repeated after it. */
.dark #product-dialog .dialog-search-clear:hover,
.dark #product-dialog .dialog-search-clear:focus-visible {
  color: #f87171;
  background: rgba(231, 0, 11, 0.2);
}

/* AppyFeed's "Contains alcohol" switch, on product rows and categories. */
.alcohol-tag {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 0.25rem;
  padding: 0 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.125rem;
  white-space: nowrap;
  color: #86198f;
  background: #fae8ff;
  border: 1px solid #f5d0fe;
  border-radius: 9999px;
}
.product-alcohol {
  display: flex;
  margin-top: 0.25rem;
}
/* On a category's row: the glass alone (the words are its tooltip). */
.alcohol-tag.is-compact {
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  cursor: help;
}
.dialog-selected-group-header .alcohol-tag {
  text-transform: none;
  letter-spacing: normal;
}
.dark .alcohol-tag {
  color: #f0abfc;
  background: rgba(217, 70, 239, 0.15);
  border-color: rgba(217, 70, 239, 0.35);
}
.flow-inline-value--alcohol,
.flow-row-value.flow-inline-value--alcohol {
  font-weight: 600;
  color: #ba474c;
}
/* Beats `.dark .flow-inline-value` / `.dark .flow-row-value`; lighter so it
   reads on the dark card. */
.dark .flow-inline-value.flow-inline-value--alcohol,
.dark .flow-row-value.flow-inline-value--alcohol {
  color: #f87171;
}

/* Narrow screens (small laptops, tablets, phones): the three columns don't
   fit side by side, so they stack and the dialog scrolls as one page. The
   product list and Selected Products keep their own scroll areas. */
@media (max-width: 1199px) {
  #product-dialog .product-dialog-content {
    padding: 0.75rem;
  }
  #product-dialog .product-dialog-body {
    height: calc(100vh - 1.5rem);
    height: calc(100dvh - 1.5rem);
    padding: 1rem 0;
  }
  #product-dialog .product-dialog-body > div:nth-child(2) {
    flex-direction: column;
    overflow-y: auto;
  }
  #product-dialog .product-dialog-body > div:nth-child(2) > div {
    flex: none;
    width: 100%;
    border-right: 0;
  }
  #product-dialog .product-dialog-body > div:nth-child(2) > div:first-child {
    overflow: visible;
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
  }
  /* Layout Preview: the choices in one row that scrolls sideways. */
  #product-dialog .product-dialog-body > div:nth-child(2) > div:first-child > div:last-child {
    flex-direction: row;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }
  #product-dialog .layout-option {
    flex: 0 0 auto;
  }
  #product-dialog .product-dialog-body > div:nth-child(2) > div:nth-child(2) {
    height: 75vh;
    min-height: 26rem;
    border-bottom: 1px solid #e5e7eb;
  }
  #product-dialog .dialog-selected-column {
    height: 70vh;
    min-height: 22rem;
  }
  .dark #product-dialog .product-dialog-body > div:nth-child(2) > div {
    border-color: #374151;
  }
}

@media (max-width: 639px) {
  #product-dialog .product-dialog-content {
    padding: 0.5rem;
  }
  #product-dialog .product-dialog-body {
    height: calc(100vh - 1rem);
    height: calc(100dvh - 1rem);
  }
  #product-dialog .product-dialog-body > .product-dialog-topbar {
    padding: 0 1rem 0.75rem;
  }
  #product-dialog .product-dialog-body > .product-dialog-footer {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1rem 0;
  }
  #product-dialog .dialog-filter-row {
    grid-template-columns: minmax(0, 1fr);
  }
  #product-dialog .dialog-options-row {
    flex-wrap: wrap;
  }
}

/* One design, one menu: why the menu dropdown is locked, and the prompt
   shown until a menu is chosen. */
#product-dialog .dialog-menu-lock-note {
  display: flex;
  margin: 0 0 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  line-height: 1.35;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
}
.dark #product-dialog .dialog-menu-lock-note {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
}
#product-dialog #dialog-business-menu-filter:disabled {
  cursor: not-allowed;
  opacity: 0.75;
}
#dialog-products-list > .dialog-menu-prompt {
  padding: 2rem 1rem;
  font-size: 0.875rem;
  line-height: 1.4;
  text-align: center;
  color: #6b7280;
}

/* "Customize fields" on a card of the board: the fields window opens
   without the product dialog, so only the dialog's shell shows. */
#product-dialog.is-fields-only > .product-dialog-overlay,
#product-dialog.is-fields-only > .product-dialog-content {
  display: none !important;
}

/* A card's Customize fields, display step: the layout pictures. */
.fields-modal-display .flow-layout-options {
  margin: 0.25rem 0 1rem;
}

/* Customize Fields, Options: each group a card (its tick, name, rule and
   how many of its choices show), opened to tick its choices one by one;
   greyed while the group is unticked. The rule is AppyFeed's, as customers
   see it (Required / Optional, Single select, Choose at least N). */
.fields-records-list--options {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.5rem;
}

.fields-records-status {
  display: inline-flex;
  align-items: baseline;
  gap: 0.75rem;
}

#product-dialog .fields-options-toggle-all,
#product-dialog .fields-option-select-all {
  padding: 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: #E7000B;
  background: none;
  border: 0;
  cursor: pointer;
}

#product-dialog .fields-options-toggle-all:hover,
#product-dialog .fields-option-select-all:hover {
  text-decoration: underline;
}

.fields-option-group {
  min-width: 0;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  transition: border-color 150ms;
}

.fields-option-group.is-open {
  border-color: rgba(231, 0, 11, 0.35);
}

.fields-option-group-head {
  display: flex;
  align-items: flex-start;
}

.fields-option-group-tick {
  display: flex;
  margin: 0;
  padding: 0.75rem 0 0.75rem 0.75rem;
  cursor: pointer;
}

#product-dialog .fields-option-toggle {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  padding: 0.625rem 0.75rem;
  color: inherit;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 0 10px 10px 0;
  cursor: pointer;
}

#product-dialog .fields-option-toggle:disabled {
  cursor: default;
}

#product-dialog .fields-option-toggle:focus-visible {
  outline: 2px solid rgba(231, 0, 11, 0.4);
  outline-offset: -2px;
}

.fields-option-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.fields-option-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.375rem;
}

.fields-option-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #111827;
}

.fields-option-preview {
  overflow: hidden;
  font-size: 0.75rem;
  color: #6b7280;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.fields-option-count {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
}

.fields-option-count.is-partial {
  color: #E7000B;
}

.fields-option-chevron {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin: 0 0.125rem 0.1875rem 0;
  border-right: 1.5px solid #9ca3af;
  border-bottom: 1.5px solid #9ca3af;
  transform: rotate(45deg);
  transition: transform 150ms;
}

.fields-option-group.is-open .fields-option-chevron {
  margin-bottom: -0.1875rem;
  transform: rotate(-135deg);
}

.fields-option-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem 0.75rem;
  border-top: 1px solid #f3f4f6;
}

#product-dialog .fields-option-select-all {
  margin-left: 0.5rem;
}

.fields-option-values {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.125rem 0.375rem;
  align-self: stretch;
}

.fields-option-value {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0;
  padding: 0.375rem 0.5rem;
  font-size: 0.8125rem;
  color: #111827;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}

.fields-option-value:hover {
  background-color: rgba(231, 0, 11, 0.04);
}

.fields-option-value:not(.is-checked) .fields-option-value-text {
  color: #9ca3af;
}

.fields-option-value.is-disabled {
  cursor: not-allowed;
}

.fields-option-value.is-disabled:hover {
  background-color: transparent;
}

.fields-option-value-text {
  min-width: 0;
  line-height: 1rem;
}

.fields-option-value-price {
  display: block;
  font-size: 0.6875rem;
  color: #9ca3af;
}

/* An unticked group: greyed, its choices (when opened) out of reach. */
.fields-option-group.is-off .fields-option-name,
.fields-option-group.is-off .fields-option-preview {
  color: #9ca3af;
}

.fields-option-group.is-off .fields-option-rule-badge,
.fields-option-group.is-off .fields-option-rule-tag,
.fields-option-group.is-off .fields-option-values {
  opacity: 0.55;
}

/* A group with some choices unticked: a dash in its tick (indeterminate,
   which does not match :checked). */
#product-dialog .fields-record-checkbox:indeterminate {
  background-color: rgba(231, 0, 11, 0.1);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='2' viewBox='0 0 10 2' fill='none'%3E%3Cpath d='M1 1H9' stroke='%23E7000B' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-size: 10px 2px;
}

.fields-option-rule-badge {
  padding: 0.0625rem 0.5rem;
  border-radius: 999px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.125rem;
  white-space: nowrap;
}

.fields-option-rule-badge.is-required {
  background: #fee2e2;
  color: #b91c1c;
}

.fields-option-rule-tag {
  padding: 0 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  color: #6b7280;
  font-size: 0.6875rem;
  line-height: 1.125rem;
  white-space: nowrap;
}

.dark .fields-option-group {
  background-color: rgb(255 255 255 / 4%);
  border-color: #4b5563;
}

.dark .fields-option-group.is-open {
  border-color: rgba(231, 0, 11, 0.55);
}

.dark .fields-option-body {
  border-top-color: #374151;
}

.dark .fields-option-name,
.dark .fields-option-value {
  color: #f3f4f6;
}

.dark .fields-option-preview,
.dark .fields-option-count {
  color: #9ca3af;
}

.dark .fields-option-count.is-partial,
.dark #product-dialog .fields-options-toggle-all,
.dark #product-dialog .fields-option-select-all {
  color: #f87171;
}

.dark .fields-option-value:hover {
  background-color: rgb(255 255 255 / 6%);
}

.dark .fields-option-value:not(.is-checked) .fields-option-value-text,
.dark .fields-option-value-price,
.dark .fields-option-group.is-off .fields-option-name,
.dark .fields-option-group.is-off .fields-option-preview {
  color: #6b7280;
}

.dark .fields-option-rule-badge {
  background: rgb(255 255 255 / 8%);
  color: #d1d5db;
}

.dark .fields-option-rule-badge.is-required {
  background: rgb(220 38 38 / 20%);
  color: #fca5a5;
}

.dark .fields-option-rule-tag {
  border-color: #4b5563;
  color: #9ca3af;
}

/* ── Custom products: the user's own, added by hand ──────────────────────
   The list's "Menu products / Custom products" switch, the Add product row,
   the edit button on a row, the empty state, and the add / edit form that
   takes the list's place (Layout Preview, Selected Products and the footer
   fade while it is open). */

/* The switch sits on its own line above the search box. */
#dialog-products-column > div:first-child {
  flex-wrap: wrap;
}

#dialog-products-column > div:first-child > .dialog-source-switch {
  flex: 1 1 100%;
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background-color: #f3f4f6;
  border-radius: 14px;
}

.dialog-source-tab {
  flex: 1 1 0%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25rem;
  color: #4b5563;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  transition: background-color 150ms, color 150ms, border-color 150ms;
}

.dialog-source-tab:hover {
  color: #111827;
}

.dialog-source-tab.is-active {
  color: #E7000B;
  background-color: #ffffff;
  border-color: rgba(231, 0, 11, 0.35);
}

/* Focus: a red ring on white controls; on a red button a white ring, edged
   red so it shows on the white dialog. */
.dialog-source-tab:focus-visible,
.dialog-custom-edit-btn:focus-visible,
.dialog-custom-form button:focus-visible {
  outline: 2px solid #E7000B;
  outline-offset: 2px;
}

.dialog-custom-add-btn:focus-visible,
.dialog-custom-form .dialog-custom-save:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #E7000B;
}

/* Custom products have no menu, categories or category grouping. */
.dialog-products-column.is-custom-source .dialog-filter-row,
.dialog-products-column.is-custom-source .dialog-menu-lock-note,
.dialog-products-column.is-custom-source .dialog-options-row .dialog-category-wise,
.dialog-products-column.is-custom-source .dialog-category-chips {
  display: none !important;
}

/* "Add product": on Customize Fields' row, at its right, the same height
   and shape; shown on "Custom products" to users only. */
.dialog-custom-add-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  flex-shrink: 0;
  height: 40px;
  padding: 0 1.125rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
  color: #ffffff;
  white-space: nowrap;
  background-color: #E7000B;
  border: 1px solid #E7000B;
  border-radius: 9999px;
  cursor: pointer;
  transition: background-color 150ms;
}

.dialog-products-column.is-custom-source.can-edit-custom .dialog-custom-add-btn {
  display: inline-flex;
}

.dialog-custom-add-btn:hover {
  background-color: #c50009;
}

/* A custom product's edit button, at the end of its row. */
.dialog-custom-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  margin-left: auto;
  padding: 0;
  color: #6b7280;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  transition: color 150ms, border-color 150ms;
}

.dialog-custom-edit-btn:hover {
  color: #E7000B;
  border-color: rgba(231, 0, 11, 0.35);
}

.dialog-product-item > div:has(> h4) {
  flex: 1 1 0%;
  min-width: 0;
}

.selected-custom-tag {
  display: inline-flex;
  align-items: center;
  margin: 0.25rem 0.25rem 0 0;
  padding: 0.0625rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1rem;
  color: #b91c1c;
  background-color: rgba(231, 0, 11, 0.08);
  border-radius: 9999px;
}

/* No custom products yet. */
#dialog-products-list > .dialog-custom-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  padding: 2.5rem 1rem;
}

.dialog-custom-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: 0.25rem;
  color: #6b7280;
  background-color: #f3f4f6;
  border-radius: 9999px;
}

.dialog-custom-empty-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #111827;
}

.dialog-custom-empty-hint {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  color: #6b7280;
}

/* The form: in the list's place, the rest of the dialog faded. */
.dialog-products-column.is-custom-editing > :not(#dialog-custom-form) {
  display: none !important;
}

.product-dialog-body.is-custom-editing > div:nth-child(2) > div:first-child,
.product-dialog-body.is-custom-editing .dialog-selected-column,
.product-dialog-body.is-custom-editing > .product-dialog-footer {
  opacity: 0.35;
  pointer-events: none;
  user-select: none;
}

.dialog-custom-form {
  display: flex;
  flex: 1 1 0%;
  flex-direction: column;
  min-height: 0;
  margin: 0;
  background-color: #ffffff;
}

.dialog-custom-form-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid #f0f0f0;
}

.dialog-custom-form-head h3 {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dialog-custom-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  color: #374151;
  background: none;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

.dialog-custom-back:hover {
  background-color: #f3f4f6;
}

.dialog-custom-form-body {
  display: flex;
  flex: 1 1 0%;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
  padding: 1rem;
  overflow-y: auto;
}

.dialog-custom-top {
  display: flex;
  gap: 0.875rem;
}

.dialog-custom-main {
  display: grid;
  flex: 1 1 0%;
  grid-template-columns: minmax(0, 1fr) 7rem;
  gap: 0.75rem;
  align-content: start;
  min-width: 0;
}

.dialog-custom-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  min-width: 0;
  margin: 0;
}

.dialog-custom-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #374151;
}

.dialog-custom-required {
  color: #E7000B;
}

.dialog-custom-hint {
  font-size: 0.6875rem;
  color: #9ca3af;
}

#dialog-custom-form .dialog-custom-input {
  width: 100%;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: #111827;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
}

#dialog-custom-form textarea.dialog-custom-input {
  resize: vertical;
  min-height: 4.5rem;
}

#dialog-custom-form .dialog-custom-input::placeholder {
  color: #9ca3af;
}

#dialog-custom-form .dialog-custom-input:focus {
  border-color: #E7000B;
  box-shadow: 0 0 0 3px rgba(231, 0, 11, 0.15);
}

#dialog-custom-form .dialog-custom-input.is-invalid {
  border-color: #E7000B;
}

.dialog-custom-error {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1rem;
  color: #dc2626;
}

.dialog-custom-error:empty {
  display: none;
}

.dialog-custom-error.is-form {
  padding: 0.5rem 0.75rem;
  background-color: rgba(231, 0, 11, 0.06);
  border-radius: 10px;
}

/* The image: a tile opening the media library. */
.dialog-custom-image-field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.375rem;
  flex-shrink: 0;
}

.dialog-custom-image {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  width: 5.5rem;
  height: 5.5rem;
  padding: 0;
  overflow: hidden;
  font-size: 0.6875rem;
  font-weight: 500;
  color: #6b7280;
  background-color: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 150ms, color 150ms;
}

.dialog-custom-image:hover {
  color: #E7000B;
  border-color: rgba(231, 0, 11, 0.5);
}

.dialog-custom-image svg {
  width: 1.5rem;
  height: 1.5rem;
}

.dialog-custom-image.has-image {
  border-style: solid;
  border-color: #e5e7eb;
}

.dialog-custom-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dialog-custom-image.is-broken img {
  visibility: hidden;
}

.dialog-custom-image-remove {
  padding: 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: #E7000B;
  background: none;
  border: none;
  cursor: pointer;
}

.dialog-custom-image-remove:hover {
  text-decoration: underline;
}

/* Sizes and add-ons: name + price + remove, then a dashed "add" button. */
.dialog-custom-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid #f3f4f6;
}

.dialog-custom-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.dialog-custom-rows {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dialog-custom-row-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dialog-custom-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 6.5rem 2.5rem;
  overflow: hidden;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

#dialog-custom-form .dialog-custom-pair .dialog-custom-input {
  border: none;
  border-radius: 0;
}

#dialog-custom-form .dialog-custom-pair .dialog-custom-input + .dialog-custom-input {
  border-left: 1px solid #e5e7eb;
}

#dialog-custom-form .dialog-custom-pair .dialog-custom-input:focus {
  box-shadow: inset 0 0 0 2px #E7000B;
}

#dialog-custom-form .dialog-custom-pair .dialog-custom-input.is-invalid {
  box-shadow: inset 0 0 0 1px #E7000B;
}

.dialog-custom-remove-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: #E7000B;
  background: none;
  border: none;
  border-left: 1px solid #e5e7eb;
  cursor: pointer;
}

.dialog-custom-remove-row:hover {
  background-color: rgba(231, 0, 11, 0.06);
}

.dialog-custom-add-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  width: 100%;
  padding: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #374151;
  background: none;
  border: 1px dashed #d1d5db;
  border-radius: 12px;
  cursor: pointer;
  transition: color 150ms, border-color 150ms;
}

.dialog-custom-add-row:hover {
  color: #E7000B;
  border-color: rgba(231, 0, 11, 0.5);
}

.dialog-custom-form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid #f0f0f0;
}

.dialog-custom-foot-actions {
  display: flex;
  gap: 0.5rem;
}

.dialog-custom-delete,
.dialog-custom-cancel,
.dialog-custom-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 150ms, border-color 150ms, opacity 150ms;
}

.dialog-custom-delete {
  color: #E7000B;
  background-color: #ffffff;
  border: 1px solid rgba(231, 0, 11, 0.35);
}

.dialog-custom-delete:hover:not(:disabled) {
  background-color: rgba(231, 0, 11, 0.06);
}

.dialog-custom-cancel {
  color: #111827;
  background-color: #ffffff;
  border: 1px solid #d1d5db;
}

.dialog-custom-cancel:hover {
  background-color: #f9fafb;
}

.dialog-custom-save {
  min-width: 5.5rem;
  color: #ffffff;
  background-color: #E7000B;
  border: 1px solid #E7000B;
}

.dialog-custom-save:hover:not(:disabled) {
  background-color: #c50009;
}

.dialog-custom-delete:disabled,
.dialog-custom-save:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* The product panel's "My own products". */
.product-source-custom-hint {
  margin: 0 0 0.25rem;
  padding: 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.25rem;
  color: #4b5563;
  background-color: #f9fafb;
  border-radius: 12px;
}

.dark #dialog-products-column > div:first-child > .dialog-source-switch {
  background-color: rgb(255 255 255 / 8%);
}

.dark .dialog-source-tab {
  color: #d1d5db;
}

.dark .dialog-source-tab.is-active {
  color: #fca5a5;
  background-color: rgb(255 255 255 / 10%);
  border-color: rgba(231, 0, 11, 0.55);
}

.dark .dialog-custom-edit-btn,
.dark .dialog-custom-cancel,
.dark .dialog-custom-delete,
.dark #dialog-custom-form .dialog-custom-input,
.dark .dialog-custom-pair {
  color: #f3f4f6;
  background-color: rgb(255 255 255 / 6%);
  border-color: #4b5563;
}

.dark .dialog-custom-delete {
  color: #fca5a5;
}

.dark #dialog-custom-form .dialog-custom-pair .dialog-custom-input {
  background-color: transparent;
}

.dark #dialog-custom-form .dialog-custom-pair .dialog-custom-input + .dialog-custom-input,
.dark .dialog-custom-remove-row {
  border-left-color: #4b5563;
}

.dark .dialog-custom-form,
.dark .product-source-custom-hint {
  background-color: transparent;
}

.dark .dialog-custom-form-head,
.dark .dialog-custom-form-foot,
.dark .dialog-custom-section {
  border-color: #374151;
}

.dark .dialog-custom-form-head h3,
.dark .dialog-custom-empty-title,
.dark .dialog-custom-back {
  color: #f3f4f6;
}

.dark .dialog-custom-label,
.dark .dialog-custom-add-row,
.dark .product-source-custom-hint {
  color: #d1d5db;
}

.dark .dialog-custom-image,
.dark .dialog-custom-empty-icon {
  background-color: rgb(255 255 255 / 6%);
  border-color: #4b5563;
}

.dark .dialog-custom-add-row {
  border-color: #4b5563;
}

.dark .dialog-custom-back:hover {
  background-color: rgb(255 255 255 / 8%);
}

.dark .selected-custom-tag {
  color: #fca5a5;
  background-color: rgb(220 38 38 / 20%);
}
