:root {
  --green: #05ab45;
  --bg: #efefef;
  --line: #6f6f6f;
  --text: #2a2a2a;
  --danger: #c13f3f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background: var(--bg);
}

body.auth-only {
  background: linear-gradient(90deg, #cfeee1 0 34%, #ececec 34% 100%);
}

body.auth-only .topbar {
  display: none;
}

body.auth-only main.container {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.container {
  width: calc(100% - 40px);
  max-width: 1800px;
  margin: 0 auto;
}

.topbar {
  background: var(--green);
  color: #fff;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  gap: 16px;
}

.menu {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.menu-link {
  border: 0;
  background: transparent;
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 16px;
}

.menu-link.active {
  border-bottom: 2px solid #fff;
}

.menu-dropdown {
  position: relative;
}

.menu-dropdown-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 300px;
  background: #fff;
  border: 1px solid #d6d6d6;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
  z-index: 20;
  padding: 8px 0;
}

.menu-dropdown-list.hidden {
  display: none;
}

.menu-dropdown-item {
  width: 100%;
  min-height: 40px;
  border: 0;
  background: #fff;
  text-align: left;
  padding: 8px 12px;
  font-size: 18px;
  line-height: 1.25;
  white-space: nowrap;
}

.menu-dropdown-item:hover {
  background: #f2f2f2;
}

.menu-dropdown-item.active {
  background: #eaf7ef;
  color: #058a39;
  font-weight: 600;
}

.session-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

#sessionText {
  font-size: 14px;
}

.auth-layout {
  display: flex;
  justify-content: center;
  padding: 22px 0 42px;
}

.auth-layout .card {
  width: min(100%, 640px);
  margin: 0 auto;
}

.auth-layout .auth-grid {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.card {
  background: #fff;
  border: 1px solid #ddd;
  padding: 20px;
}

.auth-grid {
  grid-template-columns: 1fr;
}

body.auth-only .auth-layout {
  width: 100%;
  padding: 0;
}

body.auth-only .auth-layout .card {
  width: min(100%, 420px);
  border: 1px solid #d6dde3;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(18, 38, 63, 0.06);
  padding: 14px 14px 12px;
}

body.auth-only .auth-layout .auth-grid {
  max-width: none;
}

body.auth-only #authPage h1 {
  margin: 2px 0 8px;
  font-size: 37px;
  line-height: 1.15;
  color: #1d2636;
  font-weight: 750;
}

body.auth-only #authPage label {
  font-size: 14px;
  color: #3d4756;
  margin-bottom: 6px;
}

body.auth-only #authPage input {
  min-height: 36px;
  border: 1px solid #d2d9e3;
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 16px;
}

body.auth-only #authPage .auth-grid {
  gap: 10px;
}

body.auth-only #authPage #loginBtn {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: #0f8278;
  color: #fff;
  font-weight: 700;
}

body.auth-only #authPage .hint {
  margin-top: 10px;
  font-size: 14px;
  color: #5b6778;
}

.hint {
  color: #666;
  margin-top: 14px;
}

.hidden {
  display: none;
}

.page {
  display: none;
  padding: 24px 0 48px;
}

.page.active {
  display: block;
}

h1 {
  font-size: 30px;
  margin: 0 0 20px;
}

h2 {
  color: #cf2b2b;
  margin: 8px 0 14px;
  font-size: 24px;
}

.panel {
  background: #fff;
  border: 1px solid #ddd;
  padding: 20px;
  margin-top: 18px;
}

.panel-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-title-row h2 {
  margin: 8px 0 14px;
}

.panel-title-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.staff-visibility-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.staff-visibility-toggle input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
}

.settings-tab {
  display: none;
}

.settings-tab.active {
  display: block;
}

.order-email-config-grid {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.order-email-config-note {
  margin-top: 0;
  margin-bottom: 12px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row label {
  margin: 0;
}

.checkbox-row input[type="checkbox"] {
  width: auto;
  min-height: auto;
}

#settingsBlocks {
  display: grid;
  gap: 18px;
}

.product-settings-block {
  margin-top: 0;
}

.grid {
  display: grid;
  gap: 14px;
}

.label-with-visibility {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}

.label-with-visibility > span:first-child {
  flex: 1 1 260px;
  min-width: 180px;
}

.visibility-toggles {
  display: none;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #4d4d4d;
  white-space: nowrap;
  flex: 0 0 auto;
}

.visibility-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.visibility-toggle input {
  width: auto;
  min-height: auto;
  margin: 0;
}

.drag-handle {
  display: none;
  cursor: grab;
  font-size: 14px;
  color: #777;
  user-select: none;
}

.order-controls {
  display: none;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex: 0 0 auto;
  white-space: nowrap;
}

.order-btn {
  width: 24px;
  min-height: 24px;
  padding: 0;
  line-height: 1;
  font-size: 12px;
}

.order-btn[data-option-choices] {
  width: auto;
  min-width: 86px;
  padding: 0 6px;
  white-space: nowrap;
}

.order-btn[data-option-edit],
.order-btn[data-option-delete],
.order-btn[data-input-edit],
.order-btn[data-input-delete] {
  width: auto;
  min-width: 52px;
  padding: 0 6px;
  white-space: nowrap;
}

.field-draggable {
  border: 1px dashed transparent;
  border-radius: 4px;
  padding: 4px;
}

.field-draggable.dragging {
  opacity: 0.5;
}

.field-draggable.drag-over {
  border-color: #4f82ff;
  background: #f5f9ff;
}

.form-grid {
  grid-template-columns: repeat(5, minmax(130px, 1fr));
}

.user-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.decal-type-grid {
  grid-template-columns: repeat(7, minmax(150px, 1fr));
}

.size-conversion-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.lamination-price-grid {
  grid-template-columns: repeat(5, minmax(170px, 1fr));
}

.basic-config-grid {
  grid-template-columns: repeat(6, minmax(150px, 1fr));
}

.custom-table-create-grid {
  grid-template-columns: minmax(260px, 1fr) 180px;
}

.custom-table-search-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.custom-table-search-row > div {
  width: min(420px, 100%);
}

.custom-table-field-grid {
  grid-template-columns: minmax(220px, 1fr) 120px;
}

.custom-table-row-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.custom-field-list {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.custom-field-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #bcbcbc;
  padding: 6px 8px;
  background: #fff;
}

.custom-field-chip.drag-over {
  border-color: #4f82ff;
  background: #f5f9ff;
}

.table-code-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid #bcbcbc;
  background: #fafafa;
  padding: 4px 8px;
  font-size: 13px;
  color: #404040;
  width: auto;
  min-height: auto;
  cursor: pointer;
}

.field-code-under {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 500;
  color: #666;
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

.field-code-hint {
  display: none;
}

.pricing-grid,
.two-col {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  margin-top: 14px;
}

#pricingProductRow {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

#pricingProductRow .pricing-product-main {
  flex: 1 1 560px;
  min-width: 320px;
}

.product-visibility-actions {
  margin-top: 0;
  justify-content: flex-start;
  flex: 0 0 auto;
}

.product-crud-actions {
  margin-top: 0;
  justify-content: flex-start;
  flex: 0 0 auto;
}

#productStaffVisibilityPanel {
  margin-top: 10px;
}

#productStaffVisibilityPanel h3 {
  margin: 0 0 10px;
  font-size: 18px;
  color: #333;
}

#productStaffVisibilityPanel .matrix-checkbox-cell input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  height: 18px;
}

#pricingFieldsGrid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}

#pricingFieldsGrid input::placeholder,
#pricingFieldsGrid textarea::placeholder {
  color: transparent;
}

#pricingFieldsGrid input::-webkit-input-placeholder,
#pricingFieldsGrid textarea::-webkit-input-placeholder {
  color: transparent;
}

#pricingFieldsGrid input::-ms-input-placeholder,
#pricingFieldsGrid textarea::-ms-input-placeholder {
  color: transparent;
}

.fields-row-shell {
  display: block;
}

.fields-row-shell.with-row-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 14px;
  align-items: end;
}

.fields-row {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(var(--row-cols, 1), minmax(180px, 1fr));
}

body.embed-mode .fields-row {
  grid-template-columns: repeat(var(--row-cols, 1), minmax(140px, 1fr));
}

.fields-row.drag-over {
  outline: 1px dashed #4f82ff;
  outline-offset: 2px;
}

.row-size-control label {
  display: block;
  margin-bottom: 6px;
}

.row-size-control select {
  width: 100%;
}

.button-col {
  display: flex;
  flex-direction: column;
  justify-content: end;
}

input,
select,
textarea,
button {
  width: 100%;
  min-height: 42px;
  border: 1px solid #9a9a9a;
  padding: 8px 10px;
  font-size: 16px;
}

.option-multiselect {
  position: relative;
}

.choice-target-multiselect {
  min-width: 260px;
}

.option-multiselect-trigger {
  width: 100%;
  min-height: 42px;
  text-align: left;
  border: 1px solid #9a9a9a;
  background: #fff;
  padding: 8px 32px 8px 10px;
  font-size: 16px;
  line-height: 1.2;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.option-multiselect-trigger::after {
  content: "▾";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #333;
}

.option-multiselect-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  border: 1px solid #9a9a9a;
  background: #fff;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.option-multiselect-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  white-space: nowrap;
  overflow-x: auto;
}

.option-multiselect-item:hover {
  background: #f5f5f5;
}

.option-multiselect-item input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  height: 16px;
  margin: 0;
}

button {
  cursor: pointer;
  background: #fff;
}

button:hover {
  background: #f5f5f5;
}

.secondary {
  width: auto;
  min-height: 34px;
  padding: 6px 10px;
}

.small {
  font-size: 14px;
}

.table-wrap {
  margin-top: 16px;
  overflow-x: auto;
}

.custom-pricing-table-wrap {
  max-height: 62vh;
  overflow-x: auto;
  overflow-y: auto;
}

.custom-pricing-table-wrap thead th {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.custom-table-pagination {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.custom-table-pagination-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.custom-table-pagination-left label {
  margin: 0;
  white-space: nowrap;
}

.custom-table-pagination-left select {
  width: auto;
  min-width: 80px;
  min-height: 34px;
}

.custom-table-pagination-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border: 1px solid var(--line);
  text-align: center;
  padding: 10px;
}

.matrix-checkbox-cell {
  text-align: center;
}

.matrix-checkbox-cell input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
  height: 20px;
}

.actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.actions.hidden {
  display: none;
}

.quick-field-actions {
  margin-top: 10px;
  justify-content: flex-start;
}

.quick-field-actions .quick-save-btn {
  margin-left: auto;
}

.action-link {
  border: 0;
  background: transparent;
  color: #1f1f1f;
  min-height: auto;
  width: auto;
  padding: 0 4px;
}

.action-link.delete {
  color: var(--danger);
}

.center {
  text-align: center;
}

.result-box {
  margin-top: 20px;
  width: 100%;
  max-width: none;
  border-top: 0;
  padding-top: 0;
}

.result-box p {
  margin: 6px 0;
  font-size: 16px;
}

.place-order-actions {
  margin-top: 10px;
  justify-content: stretch;
}

.manual-debug-box {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #d5d5d5;
  background: #fafafa;
}

.pricing-layout-preview-box {
  margin-top: 10px;
}

.manual-debug-title {
  display: block;
  margin-bottom: 6px;
}

.manual-debug-output {
  margin-top: 8px;
  padding: 8px;
  border: 1px dashed #c7c7c7;
  background: #fff;
  color: #222;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 16px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

#manualDebugLinesInput {
  font-size: 16px;
  line-height: 1.5;
}

.manual-debug-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.manual-debug-save-notice {
  color: #666;
  font-size: 13px;
  line-height: 1.4;
}

#openOrderFormBtn {
  display: block;
  width: 100%;
  min-height: 42px;
  border-radius: 3px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

.vat {
  margin-top: 18px;
  color: var(--danger);
  font-weight: 600;
  font-size: 16px;
}

.required-red {
  color: var(--danger);
}

.order-form-panel {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.order-form-panel.hidden {
  display: none !important;
}

.order-form-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 1px solid #cfcfcf;
  border-radius: 3px;
  padding: 14px;
  background: #f2f2f2;
}

/* Embed: keep same centered modal style as in pricing app. */
body.embed-mode .order-form-panel {
  background: transparent;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

body.embed-mode .order-form-card {
  width: min(460px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  margin: 0 auto;
  background: #f2f2f2;
}

.order-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.order-form-actions {
  margin-top: 14px;
  justify-content: flex-start;
  gap: 10px;
}

.debug-box {
  margin-top: 18px;
}

.sub-print-sidebar {
  position: fixed;
  top: 82px;
  right: 8px;
  width: 268px;
  background: #f3f3f3;
  border-left: 1px solid #d7d7d7;
  padding: 8px 6px;
  z-index: 30;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  overflow-x: visible;
}

.sub-print-sidebar.manage-mode {
  width: 268px;
}

.sub-print-sidebar.manage-mode .sub-print-toggle-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
}

.sub-print-sidebar.manage-mode .sub-print-slot-check {
  min-width: 0;
}

.sub-print-sidebar.collapsed {
  width: 24px;
  padding: 8px 3px;
}

.sub-print-sidebar-toggle {
  position: static;
  display: block;
  margin: 0 0 8px;
  width: 18px;
  height: 30px;
  border: 1px solid #bfbfbf;
  background: #fff;
  color: #444;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.sub-print-sidebar.collapsed .sub-print-toggle-row,
.sub-print-sidebar.collapsed .sub-print-add-btn,
.sub-print-sidebar.collapsed .sub-print-add-editor {
  display: none;
}

.sub-print-toggle-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 12px;
}

.sub-print-row-remove {
  width: 20px;
  height: 20px;
  border: 1px solid #bbb;
  background: #fff;
  color: #555;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  justify-self: end;
}

.sub-print-row-reset {
  width: 20px;
  height: 20px;
  border: 1px solid #bbb;
  background: #fff;
  color: #0f8278;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  justify-self: end;
}

.sub-print-add-btn {
  width: 100%;
  border: 1px solid #bbb;
  background: #fff;
  color: #333;
  font-size: 12px;
  padding: 6px 4px;
  cursor: pointer;
}

.sub-print-add-editor {
  margin-top: 6px;
  border: 1px solid #c9c9c9;
  background: #fff;
  padding: 6px;
}

.sub-print-add-editor input {
  width: 100%;
  min-height: 30px;
  padding: 4px 6px;
  font-size: 12px;
  margin: 0;
}

.sub-print-add-editor-actions {
  margin-top: 6px;
  display: flex;
  gap: 6px;
}

.sub-print-add-confirm,
.sub-print-add-cancel {
  flex: 1 1 0;
  min-height: 28px;
  border: 1px solid #bcbcbc;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
}

.sub-print-toggle-row select {
  flex: 1 1 auto;
  min-width: 0;
  height: 30px;
  font-size: 12px;
  padding: 4px 6px;
}

.sub-print-slot-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.sub-print-toggle-row input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  height: 16px;
  margin: 0;
}

.sub-print-jobs {
  margin-top: 8px;
  display: grid;
  gap: 0;
}

.sub-print-job-card {
  border: 0;
  background: transparent;
  padding: 0;
}

.sub-print-job-title {
  margin: 0 0 4px;
  color: #444;
  font-size: 14px;
}

.sub-print-job-frame {
  width: 100%;
  min-height: 0;
  border: 0;
  background: transparent;
  display: block;
}

.sub-print-job-total {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 600;
}

.debug-box h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: #444;
}

.debug-box pre {
  margin: 0;
  background: #f6f6f6;
  border: 1px solid #d8d8d8;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.45;
}

.formula-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-bottom: 8px;
}

.formula-actions-left,
.formula-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.formula-actions-right {
  margin-left: auto;
}

.formula-script-input {
  width: 100%;
  min-height: 150px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  border: 1px solid #d8d8d8;
  background: #fff;
  padding: 10px;
  margin-bottom: 8px;
  resize: vertical;
}

.formula-preview-box {
  margin-top: 8px;
}

.formula-layout-preview-box {
  margin-top: 8px;
  border: 1px solid #d8d8d8;
  background: #fbfbfb;
  padding: 10px;
}

.formula-layout-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.formula-layout-preview-title {
  font-size: 13px;
  font-weight: 600;
  color: #3f3f3f;
}

.formula-layout-preview-toggle-btn {
  min-height: 26px;
  padding: 0 10px;
  white-space: nowrap;
}

.formula-layout-preview-meta {
  margin-top: 4px;
  font-size: 12px;
  color: #676767;
}

.formula-layout-preview-svg {
  margin-top: 8px;
  width: 100%;
  height: auto;
  min-height: 220px;
  border: 1px solid #e0e0e0;
  background: #ffffff;
  display: block;
}

.formula-layout-preview-box.option-only > .formula-layout-preview-meta,
.formula-layout-preview-box.option-only > .formula-layout-preview-svg {
  display: none !important;
}

.formula-layout-preview-list {
  margin-top: 10px;
  display: block;
}

.formula-layout-preview-box.is-collapsed .formula-layout-preview-list {
  display: none !important;
}

.formula-layout-mode-group {
  margin-bottom: 14px;
}

.formula-layout-mode-title {
  font-size: 13px;
  font-weight: 700;
  color: #333;
  margin: 0 0 8px 2px;
}

.formula-layout-mode-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 1400px) {
  .formula-layout-mode-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .formula-layout-mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .formula-layout-mode-grid {
    grid-template-columns: 1fr;
  }
}

.formula-layout-option-card {
  border: 1px solid #dcdcdc;
  background: #fff;
  padding: 8px;
}

.formula-layout-option-title {
  font-size: 13px;
  font-weight: 600;
  color: #333;
}

.formula-layout-option-meta {
  margin-top: 2px;
  font-size: 12px;
  color: #666;
}

.formula-layout-preview-svg-small {
  min-height: 180px;
}

.empty {
  text-align: center;
  color: #686868;
}

.embed-cell {
  min-width: 240px;
}

.embed-code {
  display: block;
  width: 100%;
  min-height: 76px;
  border: 1px solid #d2d2d2;
  background: #fafafa;
  padding: 8px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-all;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  width: min(760px, 100%);
  max-height: min(85vh, 900px);
  overflow: auto;
  background: #fff;
  border: 1px solid #cfcfcf;
  padding: 14px;
}

#optionChoicesModal .modal-card {
  width: min(99.5vw, 1900px);
}

#optionChoicesModal .table-wrap {
  overflow-x: auto;
}

#optionChoicesModal table {
  min-width: 2060px;
}

#optionChoicesModal th,
#optionChoicesModal td {
  white-space: nowrap;
}

#optionChoicesModal td:nth-child(1),
#optionChoicesModal td:nth-child(2) {
  min-width: 120px;
}

#optionChoicesModal td:nth-child(3),
#optionChoicesModal td:nth-child(4),
#optionChoicesModal td:nth-child(5),
#optionChoicesModal td:nth-child(6),
#optionChoicesModal td:nth-child(7) {
  min-width: 110px;
}

#optionChoicesModal td:nth-child(8) {
  min-width: 220px;
}

#optionChoicesModal .choice-target-multiselect {
  min-width: 160px;
}

#optionChoicesModal td:nth-child(9) {
  min-width: 120px;
}

#optionChoicesModal td:nth-child(10) {
  min-width: 180px;
}

#optionChoicesModal td:nth-child(11) {
  min-width: 320px;
}

#optionChoicesModal td:nth-child(12) {
  min-width: 310px;
}

#optionChoicesModal td:nth-child(13) {
  min-width: 220px;
}

#optionChoicesModal .choice-target-multiselect .option-multiselect-trigger {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#optionChoicesModal .choice-inline-toggles {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

#optionChoicesModal .choice-inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 18px;
}

#optionChoicesModal .choice-inline-toggle input[type="checkbox"] {
  width: 14px;
  height: 14px;
  min-height: 14px;
  margin: 0;
}

#optionChoicesModal .choice-image-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

#optionChoicesModal .choice-image-cell input[data-choice-image-url] {
  min-width: 160px;
}

#optionChoicesModal .choice-image-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#optionChoicesModal .choice-image-preview {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border: 1px solid #bbb;
}

.modal-header h3 {
  margin: 0 0 10px;
  font-size: 20px;
  color: #cf2b2b;
}

.modal-actions {
  margin-top: 12px;
  justify-content: flex-end;
}

.choice-visibility-table th:first-child,
.choice-visibility-table td:first-child {
  text-align: left;
}

.choice-visibility-table input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  height: 18px;
}

.choice-image-hint {
  margin-top: 0;
  margin-bottom: 0;
  text-align: left;
  padding-left: 0;
  line-height: 1.15;
}

.choice-image-hint-btn {
  border: none;
  background: none;
  padding: 0;
  color: #058a39;
  text-decoration: none;
  cursor: pointer;
  font-size: 15px;
  line-height: 1.2;
  text-align: left;
  display: inline-block;
  margin-left: 0;
}

.choice-image-preview-modal-card {
  max-width: min(92vw, 900px);
}

#choiceImagePreviewImg {
  display: block;
  max-width: 100%;
  max-height: min(72vh, 700px);
  margin: 0 auto;
  border: 1px solid #ddd;
  background: #fff;
}

/* Force image preview to behave like centered popup (same spirit as order form modal) */
#choiceImagePreviewModal {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  display: block !important;
  padding: 18px !important;
  background: rgba(0, 0, 0, 0.42) !important;
  z-index: 999999 !important;
}

#choiceImagePreviewModal.hidden {
  display: none !important;
}

#choiceImagePreviewModal .choice-image-preview-modal-card {
  position: fixed !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: min(900px, 92vw) !important;
  max-height: min(86vh, 900px) !important;
  overflow: auto !important;
  margin: 0 !important;
}

.choice-image-preview-fallback {
  margin-top: 10px;
  text-align: center;
  font-size: 16px;
}

body.embed-mode {
  background: transparent;
}

body.embed-mode #authPage {
  display: none !important;
}

body.embed-mode #appPage {
  display: block !important;
}

body.embed-mode main {
  background: transparent;
  padding: 0;
  margin: 0;
}

body.embed-mode .container {
  width: 100% !important;
  max-width: none;
  margin: 0;
  padding: 0;
}

body.embed-mode #appPage,
body.embed-mode #pricingPage {
  padding: 0;
  margin: 0;
  background: transparent;
}

body.embed-mode #pricingLayoutRoot {
  background: transparent;
  margin: 0;
  padding: 0;
}

body.embed-mode #pricingLayoutRoot > .panel {
  background: transparent;
  border: 0;
  margin-top: 0;
  padding: 0;
  box-shadow: none;
}

body.embed-mode .result-box,
body.embed-mode .debug-box pre {
  background: transparent;
}

body.embed-mode .result-box {
  margin-top: 8px;
}

body.embed-mode input,
body.embed-mode select,
body.embed-mode textarea,
body.embed-mode button {
  border-radius: 0 !important;
  background: #fff !important;
  box-shadow: none !important;
}

body.embed-mode select {
  -webkit-appearance: none;
  appearance: none;
  color: #058a39;
  background-image: linear-gradient(45deg, transparent 50%, #444 50%),
    linear-gradient(135deg, #444 50%, transparent 50%);
  background-position: calc(100% - 15px) calc(50% - 3px), calc(100% - 10px) calc(50% - 3px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

body.embed-mode select option {
  color: #058a39;
}

@media (max-width: 900px) {
  .auth-layout {
    display: block;
  }

  .form-grid,
  .user-grid,
  .decal-type-grid,
  .size-conversion-grid,
  .lamination-price-grid,
  .basic-config-grid,
  .order-email-config-grid {
    grid-template-columns: 1fr 1fr;
  }

  .button-col {
    grid-column: 1 / -1;
  }

  .pricing-grid,
  .two-col {
    grid-template-columns: 1fr;
  }

  #pricingProductRow {
    align-items: stretch;
  }

  #pricingProductRow .pricing-product-main {
    min-width: 100%;
    flex-basis: 100%;
  }

  body:not(.embed-mode) #pricingFieldsGrid .fields-row-shell.with-row-control {
    grid-template-columns: 1fr;
  }

  body:not(.embed-mode) #pricingFieldsGrid .fields-row {
    grid-template-columns: 1fr !important;
  }

  .formula-actions-right {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
  }

  .topbar-inner {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 0;
  }

  .sub-print-sidebar {
    position: static;
    width: 100%;
    border-left: 0;
    border: 1px solid #d8d8d8;
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .sub-print-sidebar-toggle {
    position: static;
    width: 30px;
    height: 30px;
  }

  .sub-print-toggle-row {
    margin-bottom: 0;
  }

  body.embed-mode input,
  body.embed-mode select,
  body.embed-mode textarea,
  body.embed-mode button {
    min-height: 36px;
    font-size: 14px;
    padding: 6px 8px;
  }
}
