/* Ratelyt dashboard tokens and controls, shared with the collection editor. */
@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url('/assets/nunito-sans-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url('/assets/nunito-sans-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
:root {
  font-family: 'Nunito Sans', 'Segoe UI', Arial, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: #111;
  background: #eff0eb;
  color-scheme: light;
  --background: #eff0eb;
  --card: #fbfbf9;
  --foreground: #111;
  --muted: #6b6b6b;
  --border: #e9e9e9;
  --input: #d4d4d4;
  --primary: #2f6feb;
  --accent: #ebebeb;
  --ease: cubic-bezier(.22,.9,.3,1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; line-height: 1.4; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Compact application chrome and editor header. */
.top {
  min-height: 58px;
  padding: 0 clamp(16px, 3vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.brand-group { display: flex; min-width: 0; align-items: center; gap: 10px; }
.mark { width: 30px; height: 30px; flex: none; display: block; object-fit: contain; border-radius: 6px; }
.brand { color: var(--foreground); font-size: 15px; font-weight: 700; white-space: nowrap; }
.brand span { color: var(--muted); font-weight: 500; }
.badge { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.badge span { width: 6px; height: 6px; border-radius: 50%; background: #17a34a; }
.top > a { color: var(--muted); white-space: nowrap; font-weight: 600; }
.top > a:hover { color: var(--primary); }
main { width: 100%; max-width: none; padding: 24px clamp(16px, 3vw, 40px) 60px; }
.heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 0 0 20px; }
.heading h1 { font-size: 20px; font-weight: 700; }
.heading p { color: var(--muted); margin-top: 3px; }
.heading-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.panel { width: 100%; min-width: 0; background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.editor-top { padding: 20px 24px 16px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.editor-top h2 { font-size: 15px; font-weight: 700; }
.editor-top .hint { margin-top: 3px; }
.hint, .section-heading p, .questions-head p { color: var(--muted); font-size: 12.5px; line-height: 1.5; }

/* Dashboard buttons are all 30px high and use blue only for the main action. */
.primary, .secondary, .add-question, .open-store, .text-button, .remove-question, .close-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--input);
  border-radius: 6px;
  background: var(--card);
  color: var(--foreground);
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
  transition: color .2s var(--ease), background-color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.primary:hover:not(:disabled) { background: #2863d2; border-color: #2863d2; }
.secondary:hover:not(:disabled), .add-question:hover:not(:disabled), .open-store:hover:not([aria-disabled='true']) { border-color: var(--primary); }
:is(.primary, .secondary, .add-question, .open-store):hover:not(:disabled):not([aria-disabled='true']) { transform: translateY(-1px); }
:is(.primary, .secondary, .add-question, .open-store):active:not(:disabled) { transform: scale(.97); }
:is(.primary, .secondary, .add-question, .open-store):disabled, .open-store[aria-disabled='true'] { border-color: var(--border); background: var(--background); color: var(--muted); opacity: .65; }
.text-button, .remove-question, .close-step { background: transparent; border-color: transparent; }
.text-button:hover, .close-step:hover { background: var(--accent); }
.remove-question { color: #c93c3c; }
.remove-question:hover { border-color: #c93c3c; }
.close-step { width: 30px; height: 30px; flex: none; padding: 0; font-size: 20px; font-weight: 400; }

/* Filled dashboard tabs, with the active tab on a white surface. */
.mode-switch, .editor-tabs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.mode-switch button, .editor-tabs button {
  display: inline-flex; align-items: center; justify-content: center;
  height: 30px; padding: 0 12px; border: 1px solid transparent; border-radius: 6px;
  background: var(--background); color: var(--muted); font-weight: 700;
  white-space: nowrap; transition: color .2s var(--ease), background-color .2s var(--ease), border-color .2s var(--ease);
}
.mode-switch button:hover, .editor-tabs button:hover { background: var(--accent); color: var(--foreground); }
.mode-switch button.active, .editor-tabs button[aria-selected='true'] { border-color: var(--border); background: var(--card); color: var(--foreground); }
.editor-tabs { padding: 0 24px 16px; border-bottom: 1px solid var(--border); }
.editor-section { min-width: 0; padding: 24px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.section-heading h2 { font-size: 15px; font-weight: 700; }
.section-heading p { margin-top: 3px; }

/* Like the attribute collection, questions sit in one ordered list and expand inline. */
.collection-layout, .collection-content { min-width: 0; }
.collection-content { padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.questions-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.questions-head h3, .editor-card h3 { font-size: 15px; font-weight: 700; }
.questions-head p { margin-top: 3px; }
.step-count { color: var(--muted); white-space: nowrap; font-size: 12px; }
#questions { display: grid; gap: 8px; }
.question-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0;
  min-height: 64px; padding: 10px 12px; text-align: left;
  border: 1px solid var(--border); border-radius: 12px; background: var(--card); color: var(--foreground);
  transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
.question-row:hover { background: var(--accent); }
.welcome-step { margin-bottom: 8px; }
.step-number { display: grid; place-items: center; width: 32px; height: 32px; flex: none; background: var(--background); border-radius: 8px; color: var(--muted); font-size: 12.5px; font-weight: 700; }
.step-copy { display: grid; gap: 1px; flex: 1; min-width: 0; }
.step-copy strong { overflow: hidden; text-overflow: ellipsis; font-size: 13px; font-weight: 700; }
.step-copy small { color: var(--muted); font-size: 11.5px; }
.row-edit { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; }
.row-edit span { font-size: 20px; font-weight: 400; line-height: 1; }
.question-row:hover .row-edit { color: var(--foreground); }
.editor-card { min-width: 0; padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.focused-editor { min-width: 0; padding: 16px; border: 1px solid var(--primary); border-radius: 12px; background: var(--card); }
#welcome-editor { margin-bottom: 8px; }
.focused-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.focused-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.focused-title > div { min-width: 0; }
.focused-title h3 { font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.focused-heading p { color: var(--muted); font-size: 12px; }
.question-body { min-width: 0; }
.question-body h4 { font-size: 13px; font-weight: 700; margin: 22px 0 10px; }
.question-order { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 16px; margin-top: 20px; border-top: 1px solid var(--border); }
.question-order button:disabled { background: var(--background); color: var(--muted); border-color: var(--border); }
.question-editor-item > .question-body > .remove-question { margin-top: 10px; }

/* Fields and nested answer, condition and product editors. */
label { display: block; color: var(--foreground); font-size: 13px; font-weight: 600; }
.editor-card > label, .question-body > label, .answer-entry > label, .branch-row > label, .condition-row > label, .live-card > label, #advanced > label, .row label, .product-action-details label { margin-top: 16px; }
input:not([type='checkbox']):not([type='color']):not([type='file']), select, textarea {
  display: block; width: 100%; min-width: 0; min-height: 30px; margin-top: 6px; padding: 4px 10px;
  border: 1px solid var(--input); border-radius: 6px; background: var(--card); color: var(--foreground);
  outline: none; transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
input:not([type='checkbox']):not([type='color']):not([type='file']):hover, select:hover, textarea:hover { border-color: var(--primary); }
input:not([type='checkbox']):not([type='color']):not([type='file']):focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,111,235,.16); }
input::placeholder, textarea::placeholder { color: #6b6b6b; }
textarea { min-height: 72px; resize: vertical; line-height: 1.5; }
input[type='checkbox'] { width: 15px; height: 15px; flex: none; margin: 0; accent-color: var(--primary); }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.row > div { min-width: 0; }
.toggles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin: 18px 0; }
.toggles label, .reuse-image, .points-extra-toggle, .answer-other-toggle, .condition-choices label { display: flex; align-items: flex-start; gap: 8px; font-weight: 500; line-height: 1.5; }
.reuse-image, .points-extra-toggle, .answer-other-toggle { margin: 16px 0 !important; }
.toggles input, .reuse-image input, .points-extra-toggle input, .answer-other-toggle input, .condition-choices input { margin-top: 2px; }
.palette-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; }
.colors { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 12px; }
.colors label { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.colors input { width: 30px; height: 30px; padding: 2px; border: 1px solid var(--input); border-radius: 6px; background: var(--card); cursor: pointer; }
.image-control { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.image-control > label:first-child { width: 100%; }
.image-upload { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 30px; padding: 0 10px; border: 1px solid var(--input); border-radius: 6px; background: var(--card); font-weight: 700; overflow: hidden; cursor: pointer; }
.image-upload:hover { border-color: var(--primary); }
.image-upload:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.image-upload input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.image-thumb { width: 42px; height: 42px; object-fit: cover; border: 1px solid var(--border); border-radius: 6px; }
.answer-list { display: grid; gap: 8px; margin: 10px 0; }
.question:not(.question-editor-item), .answer-entry, .condition-group { min-width: 0; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--background); }
.question:not(.question-editor-item) { margin: 8px 0; }
summary { color: var(--foreground); font-weight: 700; cursor: pointer; }
summary::marker { color: var(--muted); }
.option-images { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.option-images .hint, .condition-group .hint { margin: 8px 0; }
.branch-row, .condition-row { padding: 12px 0; border-bottom: 1px solid var(--border); }
.branch-row:last-of-type, .condition-row:last-of-type { border-bottom: 0; }
.routing-rule-title { display: block; font-weight: 700; }
.condition-group { margin: 12px 0; }
.condition-group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.condition-choices { min-width: 0; padding: 0; margin: 14px 0; border: 0; }
.condition-choices legend { font-weight: 700; }
.condition-choices label { margin-top: 8px; }
.product-action-details { margin-top: 14px; padding-left: 12px; border-left: 2px solid var(--border); }

/* Recommendations, appearance, and advanced settings use the same surfaces. */
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.editor-grid .hint, .catalog-card .hint, #advanced .hint, .live-card .hint { margin: 10px 0; }
.catalog-card { margin-top: 16px; }
#catalog { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 8px; align-items: start; }
#catalog .question { margin: 0; }
#advanced { margin-top: 16px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
#config { min-height: 300px; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.editor-footer { display: flex; justify-content: flex-end; padding: 12px 24px; border-top: 1px solid var(--border); }
.live-card { margin: 24px; max-width: 1000px; }
.live-card .primary { margin-top: 12px; }
#feedback { padding: 0 24px 18px; color: var(--muted); font-size: 12.5px; }
#feedback:empty { display: none; }
.heading-actions #feedback { flex: 0 1 300px; max-width: 300px; min-width: 0; padding: 0; text-align: right; overflow-wrap: anywhere; }

@media (max-width: 800px) {
  main { padding: 20px 16px 40px; }
  .top { padding: 0 16px; }
  .editor-top, .section-heading { flex-wrap: wrap; }
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .editor-section { padding: 20px 16px; }
  .collection-content, .editor-card { padding: 16px; }
  .editor-top { padding: 18px 16px 14px; }
  .editor-tabs { padding: 0 16px 14px; }
  .editor-footer { padding: 12px 16px; }
  .live-card { margin: 16px; }
  #feedback { padding: 0 16px 16px; }
}
@media (max-width: 520px) {
  .top { min-height: 56px; }
  .top > a { font-size: 12px; }
  .badge { display: none; }
  .heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .heading-actions { width: 100%; justify-content: flex-start; }
  .heading-actions > * { flex: 1 1 auto; }
  .heading-actions #feedback { flex: 1 1 100%; max-width: none; text-align: left; }
  .editor-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .editor-tabs button { min-width: 0; height: auto; min-height: 38px; padding: 4px 6px; white-space: normal; line-height: 1.2; text-align: center; font-size: 12px; }
  .editor-top { align-items: flex-start; }
  .section-heading { align-items: flex-start; }
  .row, .toggles { grid-template-columns: minmax(0, 1fr); }
  .question-row { min-height: 60px; }
  .row-edit { font-size: 12px; }
  .primary, .secondary, .add-question, .open-store, .text-button, .remove-question, .close-step { min-height: 38px; }
  .close-step { width: 38px; height: 38px; }
  input:not([type='checkbox']):not([type='color']):not([type='file']), select { min-height: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Connected store products are selected, never edited in the catalog. */
.products-section { margin-bottom: 16px; }
.products-section > label { margin-top: 14px; }
.product-signin { display: inline-block; margin-top: 4px; color: var(--primary); font-weight: 700; }
.product-signin:hover { text-decoration: underline; }
.product-picker-list, .selected-products { display: grid; gap: 8px; margin-top: 12px; }
.product-picker-row, .selected-product { min-width: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
.product-picker-row { display: flex; align-items: center; gap: 12px; padding: 8px; }
.product-picker-row strong { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.product-thumb { position: relative; display: grid; place-items: center; width: 50px; height: 50px; flex: none; overflow: hidden; border: 1px solid var(--border); border-radius: 6px; background: var(--background); color: var(--muted); }
.product-thumb img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.product-no-image { font-size: 10px; text-align: center; }
.product-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 12px; color: var(--muted); }
.selected-heading { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); }
.selected-heading h4, #product-actions h4 { font-size: 13px; }
.selected-product { padding: 10px; }
.selected-product > summary { display: flex; align-items: center; gap: 12px; list-style: none; }
.selected-product > summary::-webkit-details-marker { display: none; }
.selected-product > summary::after { content: 'Edit image'; margin-left: auto; color: var(--muted); font-size: 12px; }
.selected-product strong { min-width: 0; overflow-wrap: anywhere; }
.previous-sample { color: var(--muted); font-size: 11px; white-space: nowrap; }
.selected-product > .hint { margin: 10px 0; }
.selected-product > .remove-question { margin-left: 6px; }
.selected-product > .remove-question:disabled { color: var(--muted); }
.product-choice-list { display: grid; gap: 9px; min-width: 0; margin: 16px 0; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.product-choice-list legend { padding: 0 4px; font-weight: 700; }
.product-choice-list label { display: flex; align-items: flex-start; gap: 8px; font-weight: 500; overflow-wrap: anywhere; }
.product-choice-list input { margin-top: 2px; }
.results-grid, .appearance-grid { margin-top: 16px; }
#product-actions { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
#product-actions .hint { margin: 8px 0; }
@media (max-width: 520px) {
 .product-picker-row { gap: 8px; }
 .product-thumb { width: 42px; height: 42px; }
 .selected-product > summary::after { font-size: 11px; white-space: nowrap; }
}
