/* Customer theme: the profile form is the palette authority.
 * Loaded by every customer HTML entry. Component styles consume these tokens
 * with their previous colors as fallbacks for the shared admin workshop.
 * Theme changes only paint: layout, typography, media and chart data stay local.
 */
html[data-gx-theme="olive"]:not([data-workshop-surface="admin"]) {
  color-scheme: light;
  --gx-ui-page: #fffdf9;
  --gx-ui-surface: #ffffff;
  --gx-ui-text: #211f1b;
  --gx-ui-muted: #625f58;
  --gx-ui-primary: #4c6331;
  --gx-ui-primary-hover: #405329;
  --gx-ui-on-primary: #ffffff;
  --gx-ui-soft: #e7eddf;
  --gx-ui-selected-text: #26331a;
  --gx-ui-border: #cfd7c7;
  --gx-ui-disabled-bg: #f4f5f0;
  --gx-ui-disabled-text: #7c7c75;
  --gx-ui-disabled-border: #dde0d8;
  --gx-ui-error: #9b382d;
  --gx-ui-error-soft: #fbefec;
  --gx-ui-warning: #805d24;
  --gx-ui-warning-soft: #fbf3e4;
  --gx-ui-focus: rgba(76, 99, 49, 0.16);
  --gx-ui-primary-rgb: 76, 99, 49;
  --gx-ui-text-rgb: 33, 31, 27;
  --gx-ui-shadow-rgb: 44, 52, 35;
  background-color: var(--gx-ui-page);
  background-image: none;
}

/* Page shells remain warm white; controls/cards use the white surface token. */
html[data-gx-theme="olive"]:not([data-workshop-surface="admin"]) body {
  color: var(--gx-ui-text);
  background-color: var(--gx-ui-page);
  background-image: none;
}

html[data-gx-theme="olive"]:not([data-workshop-surface="admin"]) :is(input, textarea, select) {
  accent-color: var(--gx-ui-primary);
  caret-color: var(--gx-ui-primary);
}

html[data-gx-theme="olive"]:not([data-workshop-surface="admin"]) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), textarea, select) {
  color: var(--gx-ui-text);
  border-color: var(--gx-ui-border);
  background-color: var(--gx-ui-surface);
}

html[data-gx-theme="olive"]:not([data-workshop-surface="admin"]) :is(input, textarea)::placeholder {
  color: var(--gx-ui-muted);
  -webkit-text-fill-color: var(--gx-ui-muted);
}

/* Match browser autofill to the form surface without changing entered values. */
html[data-gx-theme="olive"]:not([data-workshop-surface="admin"]) input:autofill,
html[data-gx-theme="olive"]:not([data-workshop-surface="admin"]) input:-webkit-autofill {
  -webkit-text-fill-color: var(--gx-ui-text);
  box-shadow: inset 0 0 0 1000px var(--gx-ui-surface);
}

html[data-gx-theme="olive"]:not([data-workshop-surface="admin"]) :is(button, a, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--gx-ui-primary);
  outline-offset: 2px;
}

html[data-gx-theme="olive"]:not([data-workshop-surface="admin"]) :is(input, textarea, select):focus {
  border-color: var(--gx-ui-primary);
  box-shadow: 0 0 0 3px var(--gx-ui-focus);
}

/* Menus: selected row olive/white; hover soft green/dark text. */
html[data-gx-theme="olive"]:not([data-workshop-surface="admin"]) [role="listbox"] {
  background-color: var(--gx-ui-surface);
  border-color: var(--gx-ui-border);
}

html[data-gx-theme="olive"]:not([data-workshop-surface="admin"]) [role="option"]:hover {
  color: var(--gx-ui-selected-text);
  background: var(--gx-ui-soft);
}

html[data-gx-theme="olive"]:not([data-workshop-surface="admin"]) [role="option"][aria-selected="true"],
html[data-gx-theme="olive"]:not([data-workshop-surface="admin"]) option:checked {
  color: var(--gx-ui-on-primary);
  background: var(--gx-ui-primary);
  -webkit-text-fill-color: var(--gx-ui-on-primary);
}

/* Segment choices are distinct from dropdown rows and solid action buttons. */
html[data-gx-theme="olive"]:not([data-workshop-surface="admin"]) :is(.calendar-type-card, .loop-card, .choice-card, .advisor-choice).is-selected {
  color: var(--gx-ui-selected-text);
  -webkit-text-fill-color: var(--gx-ui-selected-text);
  border-color: var(--gx-ui-primary);
  background: var(--gx-ui-soft);
}

/* These legacy titles previously reused the error token for selection. */
html[data-gx-theme="olive"]:not([data-workshop-surface="admin"]) :is(.bead-card.is-selected strong, .bead-card.is-selected .bead-name, .main-stone-card.is-selected .main-stone-card-head h3) {
  color: var(--gx-ui-primary);
}

/* Customer main actions shared by the independently styled page families. */
html[data-gx-theme="olive"]:not([data-workshop-surface="admin"]) :is(.primary-action, .form-primary, .fixed-primary, .result-primary, .cart-primary-action, .report-primary-action, .mini-cta, .customize-link, .design-actions button[data-design-checkout], .gx-design-share [data-share-confirm], .gx-design-share [data-share-download]) {
  background: var(--gx-ui-primary);
  border-color: var(--gx-ui-primary);
  color: var(--gx-ui-on-primary);
}

html[data-gx-theme="olive"]:not([data-workshop-surface="admin"]) :is(.primary-action, .form-primary, .fixed-primary, .result-primary, .cart-primary-action, .report-primary-action, .mini-cta, .customize-link, .design-actions button[data-design-checkout], .gx-design-share [data-share-confirm], .gx-design-share [data-share-download]):hover:not(:disabled) {
  background: var(--gx-ui-primary-hover);
  border-color: var(--gx-ui-primary-hover);
}

/* State colors have priority over the component's normal paint. */
html[data-gx-theme="olive"]:not([data-workshop-surface="admin"]) :is(input, textarea, select)[aria-invalid="true"] {
  color: var(--gx-ui-text);
  border-color: var(--gx-ui-error) !important;
  box-shadow: 0 0 0 3px rgba(155, 56, 45, 0.10);
}

/* Quantity buttons keep their appearance while requests temporarily disable them. */
html[data-gx-theme="olive"]:not([data-workshop-surface="admin"]) :is(button:disabled, input:disabled, select:disabled, textarea:disabled, button[aria-disabled="true"], a[aria-disabled="true"]):not([data-site-fixed-quantity]) {
  color: var(--gx-ui-disabled-text) !important;
  -webkit-text-fill-color: var(--gx-ui-disabled-text) !important;
  border-color: var(--gx-ui-disabled-border) !important;
  background: var(--gx-ui-disabled-bg) !important;
  box-shadow: none !important;
}

.site-cart-quantity button:disabled {
  cursor: not-allowed;
}

/* Shared customer navigation: 33px transparent circle, 18px green chevron.
   The 44px hit area is identical on touch and desktop; navigation stays local. */
html:not([data-workshop-surface="admin"]) body :is(
  .gx-task-header__back, .main-stone-back-icon-btn,
  [data-fixed-product-back], [data-inspiration-back],
  .energy-analysis-home-return, .custom-form-home-return,
  .preferences-back, .wallet-back, .archive-back, .auth-card-back,
  .back-home, [data-designs-back], [data-contact-back], [data-back-to-login],
  a[aria-label^="返回"]:not(.result-brand):not(.brand),
  button[aria-label^="返回"]
) {
  position: relative;
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  max-width: 44px !important;
  max-height: 44px !important;
  flex: 0 0 44px;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: transparent !important;
  box-shadow: none !important;
  color: rgba(var(--gx-ui-primary-rgb, 76, 99, 49), .675) !important;
  font-size: 0 !important;
  line-height: 0 !important;
  text-decoration: none !important;
  -webkit-appearance: none;
  appearance: none;
}
html:not([data-workshop-surface="admin"]) body :is(
  .gx-task-header__back, .main-stone-back-icon-btn,
  [data-fixed-product-back], [data-inspiration-back],
  .energy-analysis-home-return, .custom-form-home-return,
  .preferences-back, .wallet-back, .archive-back, .auth-card-back,
  .back-home, [data-designs-back], [data-contact-back], [data-back-to-login],
  a[aria-label^="返回"]:not(.result-brand):not(.brand),
  button[aria-label^="返回"]
)[hidden] { display: none !important; }
html:not([data-workshop-surface="admin"]) body :is(
  .gx-task-header__back, .main-stone-back-icon-btn,
  [data-fixed-product-back], [data-inspiration-back],
  .energy-analysis-home-return, .custom-form-home-return,
  .preferences-back, .wallet-back, .archive-back, .auth-card-back,
  .back-home, [data-designs-back], [data-contact-back], [data-back-to-login],
  a[aria-label^="返回"]:not(.result-brand):not(.brand),
  button[aria-label^="返回"]
) > * { display: none !important; }
html:not([data-workshop-surface="admin"]) body :is(
  .gx-task-header__back, .main-stone-back-icon-btn,
  [data-fixed-product-back], [data-inspiration-back],
  .energy-analysis-home-return, .custom-form-home-return,
  .preferences-back, .wallet-back, .archive-back, .auth-card-back,
  .back-home, [data-designs-back], [data-contact-back], [data-back-to-login],
  a[aria-label^="返回"]:not(.result-brand):not(.brand),
  button[aria-label^="返回"]
)::before {
  content: "" !important;
  position: absolute !important;
  box-sizing: border-box;
  top: 50% !important;
  left: 50% !important;
  width: 33px !important;
  height: 33px !important;
  transform: translate(-50%, -50%) !important;
  border: 1px solid currentColor !important;
  border-radius: 50% !important;
  background: transparent !important;
  box-shadow: none !important;
  pointer-events: none;
}
html:not([data-workshop-surface="admin"]) body :is(
  .gx-task-header__back, .main-stone-back-icon-btn,
  [data-fixed-product-back], [data-inspiration-back],
  .energy-analysis-home-return, .custom-form-home-return,
  .preferences-back, .wallet-back, .archive-back, .auth-card-back,
  .back-home, [data-designs-back], [data-contact-back], [data-back-to-login],
  a[aria-label^="返回"]:not(.result-brand):not(.brand),
  button[aria-label^="返回"]
)::after {
  content: "" !important;
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  width: 18px !important;
  height: 18px !important;
  transform: translate(-50%, -50%) !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: currentColor !important;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m15 5-7 7 7 7' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m15 5-7 7 7 7' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  pointer-events: none;
}

/* Keep return controls at the leading edge of their page container. */
html:not([data-workshop-surface="admin"]) body :is(
  .gx-task-header__back, .main-stone-back-icon-btn,
  [data-fixed-product-back], [data-inspiration-back],
  .energy-analysis-home-return, .custom-form-home-return,
  .preferences-back, .wallet-back, .archive-back, .auth-card-back,
  .back-home, [data-designs-back], [data-contact-back], [data-back-to-login],
  a[aria-label^="返回"]:not(.result-brand):not(.brand),
  button[aria-label^="返回"]
) {
  justify-self: start;
  margin-left: 0;
  margin-right: auto;
}
html:not([data-workshop-surface="admin"]) body.gx-contact-page .contact-heading {
  min-height: 44px;
  padding-inline: 52px;
}
html:not([data-workshop-surface="admin"]) body.gx-contact-page .contact-heading > [data-contact-back] {
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
}

/* Keep the workshop return control out of the centered title's flex flow. */
html[data-workshop-surface="customer"] body.gx-app.bead-board-body .bead-board-title-row > .main-stone-back-icon-btn {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
}
html[data-workshop-surface="customer"] body.gx-app.bead-board-body .bead-board-title {
  text-align: center;
  margin-inline: auto;
}
@container gx-workshop-host (max-width: 359px) {
  html[data-workshop-surface="customer"] body.gx-app.bead-board-body .bead-board-title-row > .main-stone-back-icon-btn {
    position: relative;
    inset: auto;
    transform: none;
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
  }
}

/* Contact title and return control share one centered header row. */
html:not([data-workshop-surface="admin"]) body.gx-contact-page .contact-main {
  padding-top: env(safe-area-inset-top, 0px);
}
html:not([data-workshop-surface="admin"]) body.gx-contact-page .contact-heading {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
  padding: 0;
  min-height: 44px;
}
html:not([data-workshop-surface="admin"]) body.gx-contact-page .contact-heading > [data-contact-back] {
  position: relative;
  inset: auto;
  transform: none;
  grid-column: 1;
  grid-row: 1;
  margin: 0;
}
html:not([data-workshop-surface="admin"]) body.gx-contact-page .contact-heading > div {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}
html:not([data-workshop-surface="admin"]) body.gx-contact-page .contact-heading h1 {
  padding: 0;
  margin: 0;
  text-align: center;
}

/* Enlarge the marked workshop controls to 120%; capsule widths stay unchanged. */
html[data-workshop-surface="customer"] body.gx-app.bead-board-body:not(.is-dimensional-focus) .customer-editor-toolbar {
  --toolbar-size: clamp(27.6px, 8.79996cqi, 42.24px);
  flex-wrap: wrap;
}
html[data-workshop-surface="customer"] body.gx-app.bead-board-body:not(.is-dimensional-focus) :is(.workshop-game-toggle, .workshop-settings-toggle, .workshop-share-button, .tray-history-undo),
html[data-workshop-surface="customer"] body.gx-app.bead-board-body .customer-header-actions > :is(.workshop-share, .workshop-game-toggle, .workshop-settings) {
  width: 42.24px;
  min-width: 42.24px;
  max-width: 42.24px;
  height: 42.24px;
  min-height: 42.24px;
  max-height: 42.24px;
  flex-basis: 42.24px;
}
html[data-workshop-surface="customer"] body.gx-app.bead-board-body:not(.is-dimensional-focus) :is(.workshop-game-toggle, .workshop-settings-toggle, .workshop-share-button, .tray-history-undo, .customer-editor-toolbar [data-workshop-setting], .customer-editor-toolbar [data-quick-save-version]) > :is(img, svg) {
  width: 23.04px;
  height: 23.04px;
  max-width: 23.04px;
  max-height: 23.04px;
}

/* Place wrist sizing above the toolbar at the tray's lower-left edge. */
html[data-workshop-surface="customer"] body.gx-app.bead-board-body:not(.is-dimensional-focus) .customer-editor-toolbar {
  position: relative;
}
html[data-workshop-surface="customer"] body.gx-app.bead-board-body:not(.is-dimensional-focus) .customer-editor-toolbar > .wrist-measure-toggle {
  position: absolute;
  left: 0;
  right: auto;
  top: auto;
  bottom: calc(100% + 4px);
  transform: none;
  margin: 0;
  z-index: 6;
}

/* Use the desktop material typography on phones as well. */
html[data-workshop-surface="customer"] body.gx-app.bead-board-body .bead-picker {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html[data-workshop-surface="customer"] body.gx-app.bead-board-body .material-tabs :is(.material-tab, .material-inline-version) {
  font-size: 16px;
  line-height: 1.4;
}
html[data-workshop-surface="customer"] body.gx-app.bead-board-body .color-series-button {
  font-size: 14px;
  line-height: 1.4;
}
html[data-workshop-surface="customer"] body.gx-app.bead-board-body .bead-card :is(.bead-name, small, .bead-size-label) {
  font-size: 12px;
  line-height: 1.35;
}
html[data-workshop-surface="customer"] body.gx-app.bead-board-body .material-tabs .material-inline-search .material-search-hint {
  font-size: 11px;
}
/* Preserve the desktop column proportions on phones, including the search field. */
@container gx-workshop-host (max-width: 440px) {
  html[data-workshop-surface="customer"] body.gx-app.bead-board-body .material-tabs {
    display: grid;
    grid-template-columns: minmax(0, 60fr) minmax(0, 60fr) minmax(0, 60fr) minmax(0, 96fr) minmax(0, 164fr);
    grid-template-rows: 32px;
    column-gap: 3px;
    row-gap: 0;
    align-items: center;
  }
  html[data-workshop-surface="customer"] body.gx-app.bead-board-body .material-tabs > :is(.material-tab, .material-inline-version) {
    grid-row: 1;
    grid-column: auto;
    min-width: 0;
    padding-inline: 0;
    white-space: nowrap;
  }
  html[data-workshop-surface="customer"] body.gx-app.bead-board-body .material-tabs .material-inline-search {
    grid-column: 5;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    height: 28px;
    min-height: 28px;
    max-height: 28px;
    box-sizing: border-box;
    padding-inline: 4px;
  }
  html[data-workshop-surface="customer"] body.gx-app.bead-board-body .material-tabs .material-inline-search .material-search-hint {
    left: 20px;
    right: 3px;
    font-size: clamp(8px, 2.5cqi, 11px);
  }
  html[data-workshop-surface="customer"] body.gx-app.bead-board-body .material-inline-search .tray-search-icon {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
  }
}

/* Phone controls and type share the 480px desktop reference scale. */
@container gx-workshop-host (max-width: 440px) {
  html[data-workshop-surface="customer"] body.gx-app.bead-board-body .material-tabs :is(.material-tab, .material-inline-version) {
    font-size: 3.3333cqi;
    letter-spacing: 0;
  }
  html[data-workshop-surface="customer"] body.gx-app.bead-board-body .color-series-button {
    font-size: 2.9167cqi;
    min-height: 8.3333cqi;
  }
  html[data-workshop-surface="customer"] body.gx-app.bead-board-body .bead-picker {
    grid-template-columns: 13.3333cqi minmax(0, 1fr);
  }
  html[data-workshop-surface="customer"] body.gx-app.bead-board-body .crystal-card :is(.bead-name, .bead-count) {
    font-size: 2.5cqi;
  }
  html[data-workshop-surface="customer"] body.gx-app.bead-board-body .material-tabs .material-inline-search .material-search-hint {
    font-size: 2.2917cqi;
    left: 18px;
    right: 2px;
  }
  html[data-workshop-surface="customer"] body.gx-app.bead-board-body:not(.is-dimensional-focus) .customer-editor-toolbar {
    flex-wrap: nowrap;
  }
  html[data-workshop-surface="customer"] body.gx-app.bead-board-body:not(.is-dimensional-focus) :is(.workshop-game-toggle, .workshop-settings-toggle, .workshop-share-button, .tray-history-undo),
  html[data-workshop-surface="customer"] body.gx-app.bead-board-body .customer-header-actions > :is(.workshop-share, .workshop-game-toggle, .workshop-settings) {
    width: 8.8cqi; min-width: 8.8cqi; max-width: 8.8cqi;
    height: 8.8cqi; min-height: 8.8cqi; max-height: 8.8cqi;
    flex-basis: 8.8cqi;
  }
  html[data-workshop-surface="customer"] body.gx-app.bead-board-body:not(.is-dimensional-focus) :is(.workshop-game-toggle, .workshop-settings-toggle, .workshop-share-button, .tray-history-undo, .customer-editor-toolbar [data-workshop-setting], .customer-editor-toolbar [data-quick-save-version]) > :is(img, svg) {
    width: 4.8cqi; height: 4.8cqi; max-width: 4.8cqi; max-height: 4.8cqi;
  }
}

/* Share the row proportionally: labels 65%, search 35%, matching desktop. */
html[data-workshop-surface="customer"] body.gx-app.bead-board-body .material-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.4fr 2.4fr;
  grid-template-rows: 32px;
  align-items: center;
  gap: clamp(2px, .6cqi, 4px);
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
html[data-workshop-surface="customer"] body.gx-app.bead-board-body .material-tabs > :is(.material-tab, .material-inline-version) {
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  justify-content: center;
  box-sizing: border-box;
  padding-inline: clamp(2px, .8cqi, 6px);
  white-space: nowrap;
}
html[data-workshop-surface="customer"] body.gx-app.bead-board-body .material-tabs .material-inline-search {
  flex: 1 1 0;
  width: 100%;
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
  overflow: hidden;
  margin: 0;
}
html[data-workshop-surface="customer"] body.gx-app.bead-board-body .material-tabs .material-inline-search input {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
}
html[data-workshop-surface="customer"] body.gx-app.bead-board-body .material-tabs .material-inline-search .material-search-hint {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
