/* =========================================================
   ROES-style Order Builder — three-panel layout
   Catalog (left) · Workspace (center) · Cart (right)
   ========================================================= */

[v-cloak] { display: none; }

.rb-header {
  padding: clamp(30px, 4vw, 50px) var(--gutter) clamp(16px, 2vw, 24px);
  max-width: 1560px;
  margin: 0 auto;
}
.rb-header__inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}
.rb-cart-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dim);
}
.rb-cart-chip--filled {
  color: var(--text);
  border-color: var(--rust);
}

/* ---------- Layout ---------- */
.rb-layout {
  display: grid;
  grid-template-columns: 250px 1fr 300px;
  gap: 20px;
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 var(--gutter) 100px;
  align-items: start;
}

.rb-panel-title {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ---------- Catalog (left) ---------- */
.rb-catalog {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 104px);
  overflow-y: auto;
}
.rb-cat + .rb-cat { margin-top: 4px; }
.rb-cat__head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: none;
  border: none;
  padding: 10px 8px;
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  border-radius: 4px;
}
.rb-cat__head:hover { background: var(--bg-hover); }
.rb-cat__arrow { transition: transform 0.2s; font-size: 0.8rem; color: var(--text-faint); }
.rb-cat__arrow.open { transform: rotate(180deg); }
.rb-cat__body { padding: 2px 0 8px; display: grid; gap: 4px; }
.rb-product {
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--sans);
  transition: background 0.15s, border-color 0.15s;
}
.rb-product:hover { background: var(--bg-hover); }
.rb-product.active {
  background: var(--bg-hover);
  border-color: var(--rust);
}
.rb-product__name { font-size: 0.88rem; font-weight: 500; color: var(--text); }
.rb-product__desc { font-size: 0.74rem; color: var(--text-faint); }
.rb-product__price {
  font-size: 0.72rem;
  font-family: var(--mono), var(--sans);
  color: var(--rust);
  margin-top: 2px;
}

/* ---------- Workspace (center) ---------- */
.rb-workspace { display: grid; gap: 20px; min-width: 0; }

.rb-bin {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.rb-bin__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.rb-bin__head .rb-panel-title { margin-bottom: 0; }
.rb-bin__add {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--rust);
  cursor: pointer;
  padding: 6px 14px;
  border: 1px solid var(--rust);
  border-radius: 100px;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}
.rb-bin__add:hover { background: var(--rust); color: var(--cream); }
.rb-bin__strip {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;
  min-height: 104px;
  background: var(--surface);
  border: 2px dashed var(--border-strong);
  border-radius: 6px;
  align-items: center;
  transition: border-color 0.2s, background 0.2s;
}
.rb-bin__strip--dragging {
  border-color: var(--rust);
  background: rgba(176, 74, 38, 0.06);
}
.rb-bin__empty {
  font-size: 0.85rem;
  color: var(--text-faint);
  font-style: italic;
  padding: 8px 12px;
}
.rb-thumb {
  position: relative;
  flex-shrink: 0;
  width: 84px;
  height: 84px;
  border: 2px solid var(--border-strong);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  background: var(--bg);
  transition: border-color 0.15s, transform 0.15s;
}
.rb-thumb:hover { transform: scale(1.04); }
.rb-thumb.active { border-color: var(--rust); box-shadow: 0 0 0 2px rgba(176, 74, 38, 0.25); }
.rb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rb-thumb__badge {
  position: absolute;
  bottom: 3px; left: 3px;
  background: var(--rust);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 100px;
  font-family: var(--mono), var(--sans);
}
.rb-thumb__remove {
  position: absolute;
  top: 2px; right: 2px;
  width: 18px; height: 18px;
  background: rgba(7, 8, 11, 0.7);
  color: #fff;
  border-radius: 50%;
  font-size: 0.8rem;
  line-height: 18px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.15s;
}
.rb-thumb:hover .rb-thumb__remove { opacity: 1; }

/* ---------- Editor ---------- */
.rb-editor {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.rb-editor--empty {
  text-align: center;
  padding: 50px 24px;
  color: var(--text-dim);
  font-size: 0.95rem;
}
.rb-editor__ratio {
  font-family: var(--mono), var(--sans);
  font-size: 0.78rem;
  color: var(--rust);
  background: rgba(176, 74, 38, 0.1);
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 400;
}
.rb-field { margin-bottom: 20px; }
.rb-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono), var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.rb-label--check {
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
}
.rb-label--check input { accent-color: var(--rust); cursor: pointer; }
.rb-link {
  background: none;
  border: none;
  color: var(--rust);
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: underline;
  text-transform: none;
  letter-spacing: 0;
  padding: 0;
}
.rb-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.rb-chip {
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.rb-chip:hover { border-color: var(--rust); color: var(--text); }
.rb-chip.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.rb-chip__price {
  font-family: var(--mono), var(--sans);
  font-size: 0.7rem;
  opacity: 0.7;
}
.rb-swatch {
  width: 32px; height: 32px;
  border-radius: 4px;
  border: 2px solid var(--border-strong);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  padding: 0;
}
.rb-swatch:hover { transform: scale(1.1); }
.rb-swatch.active { border-color: var(--rust); box-shadow: 0 0 0 2px rgba(176, 74, 38, 0.3); }

/* Crop */
.rb-crop {
  position: relative;
  background: #1a1612;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: none;
  max-height: 400px;
}
.rb-crop img {
  display: block;
  max-width: 100%;
  max-height: 400px;
  width: auto;
  height: auto;
  opacity: 0.5;
  pointer-events: none;
}
.rb-crop__box {
  position: absolute;
  border: 2px solid #fff;
  box-shadow: 0 0 0 100vw rgba(7, 8, 11, 0.5);
  cursor: move;
  box-sizing: border-box;
  background-image:
    linear-gradient(to right, transparent 33.3%, rgba(255,255,255,0.2) 33.3%, rgba(255,255,255,0.2) 33.6%, transparent 33.6%, transparent 66.4%, rgba(255,255,255,0.2) 66.4%, rgba(255,255,255,0.2) 66.7%, transparent 66.7%),
    linear-gradient(to bottom, transparent 33.3%, rgba(255,255,255,0.2) 33.3%, rgba(255,255,255,0.2) 33.6%, transparent 33.6%, transparent 66.4%, rgba(255,255,255,0.2) 66.4%, rgba(255,255,255,0.2) 66.7%, transparent 66.7%);
}
.rb-crop__handle {
  position: absolute;
  width: 13px; height: 13px;
  background: #fff;
  border: 1.5px solid var(--rust);
  border-radius: 2px;
}
.rb-crop__handle--tl { top: -7px;    left: -7px;   cursor: nwse-resize; }
.rb-crop__handle--tr { top: -7px;    right: -7px;  cursor: nesw-resize; }
.rb-crop__handle--bl { bottom: -7px; left: -7px;   cursor: nesw-resize; }
.rb-crop__handle--br { bottom: -7px; right: -7px;  cursor: nwse-resize; }

.rb-dpi {
  margin-top: 8px;
  font-size: 0.8rem;
  font-family: var(--mono), var(--sans);
}
.rb-dpi--good { color: #4a7a3a; }
.rb-dpi--warn { color: var(--ochre); }
.rb-dpi--bad  { color: var(--rust); font-weight: 600; }

.rb-editor__foot {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.rb-qty {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  overflow: hidden;
}
.rb-qty button {
  width: 34px; height: 34px;
  background: var(--surface);
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text);
}
.rb-qty button:hover { background: var(--bg-hover); }
.rb-qty span {
  min-width: 40px;
  text-align: center;
  font-weight: 600;
  font-family: var(--mono), var(--sans);
}
.rb-editor__price {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-left: auto;
  font-family: var(--sans);
}
.rb-editor__price span { font-size: 0.9rem; color: var(--text-dim); font-weight: 400; }

/* ---------- Cart (right) ---------- */
.rb-cart {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.rb-cart__count {
  background: var(--rust);
  color: #fff;
  font-size: 0.72rem;
  min-width: 20px; height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono), var(--sans);
}
.rb-cart__empty {
  font-size: 0.85rem;
  color: var(--text-faint);
  font-style: italic;
  line-height: 1.5;
}
.rb-cart-item {
  display: grid;
  grid-template-columns: 44px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}
.rb-cart-item:hover { background: var(--bg-hover); border-color: var(--border); }
.rb-cart-item__thumb {
  width: 44px; height: 44px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
}
.rb-cart-item__info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.rb-cart-item__info strong {
  font-size: 0.84rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rb-cart-item__info span {
  font-size: 0.72rem;
  color: var(--text-faint);
  font-family: var(--mono), var(--sans);
}
.rb-cart-item__price {
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--mono), var(--sans);
}
.rb-cart-item__remove {
  width: 20px; height: 20px;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 50%;
}
.rb-cart-item__remove:hover { color: var(--rust); background: var(--bg-hover); }
.rb-cart__total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-strong);
}
.rb-cart__total span {
  font-family: var(--mono), var(--sans);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.rb-cart__total strong {
  font-size: 1.5rem;
  font-weight: 600;
}
.rb-cart__checkout {
  width: 100%;
  justify-content: center;
  margin-top: 14px;
}

/* ---------- Checkout modal ---------- */
.rb-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(7, 8, 11, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.rb-modal__card {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
}
.rb-modal__close {
  position: absolute;
  top: 12px; right: 16px;
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--text-dim);
  cursor: pointer;
}
.rb-modal__close:hover { color: var(--text); }
.rb-form { display: grid; gap: 12px; }
.rb-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-family: var(--mono), var(--sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.rb-form input,
.rb-form textarea {
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}
.rb-form input:focus, .rb-form textarea:focus { outline: none; border-color: var(--rust); }
.rb-form button[disabled] { opacity: 0.6; cursor: wait; }
.rb-form__alt {
  font-size: 0.8rem;
  color: var(--text-faint);
  text-align: center;
}
.rb-form__alt a { color: var(--rust); border-bottom: 1px solid var(--rust); }
.rb-error {
  color: var(--rust);
  font-size: 0.85rem;
  padding: 10px 12px;
  background: rgba(176, 74, 38, 0.08);
  border-left: 3px solid var(--rust);
  border-radius: 0 4px 4px 0;
}

.rb-success { text-align: center; padding: 12px 0; }
.rb-success__mark {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: #4a7a3a;
  color: #fff;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}
.rb-success__number {
  font-family: var(--mono), var(--sans);
  color: var(--rust);
  font-size: 1.1em;
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .rb-layout { grid-template-columns: 220px 1fr; }
  .rb-cart { grid-column: 1 / -1; position: static; max-height: none; }
}
@media (max-width: 800px) {
  .rb-layout { grid-template-columns: 1fr; }
  .rb-catalog { position: static; max-height: none; }
  .rb-editor__foot { flex-direction: column; align-items: stretch; }
  .rb-editor__price { margin-left: 0; text-align: center; }
}

/* ---------- Orientation toggle ---------- */
.rb-orient {
  display: inline-flex;
  gap: 0;
  margin-left: auto;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  overflow: hidden;
}
.rb-orient__btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--surface);
  border: none;
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.rb-orient__btn + .rb-orient__btn { border-left: 1px solid var(--border-strong); }
.rb-orient__btn:hover { color: var(--text); }
.rb-orient__btn.active {
  background: var(--text);
  color: var(--bg);
}

/* ---------- Editor drop-target state ---------- */
.rb-editor--dropping {
  outline: 2px dashed var(--rust);
  outline-offset: -2px;
  background: rgba(176, 74, 38, 0.05);
}
.rb-editor--dropping .rb-crop {
  box-shadow: inset 0 0 0 2px var(--rust);
}
/* While dragging, let the section itself catch the drop (children won't steal it) */
.rb-editor--dropping * { pointer-events: none; }

/* ---------- Designer (Cards & Collages) ---------- */
.rb-design-tools { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.rb-tool {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
}
.rb-tool:hover { border-color: var(--rust); color: var(--rust); }

.rb-design {
  position: relative;
  width: 100%;
  max-height: 460px;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  overflow: hidden;
  user-select: none;
  touch-action: none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04), 0 4px 16px rgba(42,32,26,0.08);
  margin-inline: auto;
}
.rb-box {
  position: absolute;
  box-sizing: border-box;
  border: 1px dashed rgba(42, 32, 26, 0.25);
  cursor: move;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.rb-box--locked { cursor: pointer; }
.rb-box--image { background-color: #f0ece3; background-repeat: no-repeat; }
.rb-box--empty { border-style: dashed; border-color: rgba(176, 74, 38, 0.45); }
.rb-box--text {
  border-color: transparent;
  line-height: 1.25;
  padding: 2px 4px;
  white-space: pre-wrap;
  word-break: break-word;
  align-items: flex-start;
  justify-content: flex-start;
  display: block;
  cursor: move;
}
.rb-box--text.rb-box--locked { cursor: pointer; }
.rb-box--selected { border: 2px solid var(--rust) !important; }
.rb-box__hint {
  font-family: var(--sans);
  font-size: 0.72rem;
  color: rgba(176, 74, 38, 0.75);
  text-align: center;
  line-height: 1.3;
  pointer-events: none;
}
.rb-box__textcontent { display: block; width: 100%; pointer-events: none; }
.rb-box__handle {
  position: absolute;
  right: -7px; bottom: -7px;
  width: 14px; height: 14px;
  background: #fff;
  border: 2px solid var(--rust);
  border-radius: 2px;
  cursor: nwse-resize;
  z-index: 2;
}
.rb-box__delete {
  position: absolute;
  top: -10px; right: -10px;
  width: 20px; height: 20px;
  background: var(--rust);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

/* ---------- Inspector ---------- */
.rb-inspector {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px;
}
.rb-inspector__text {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--bg-elevated);
  font-family: var(--sans);
  font-size: 0.92rem;
  color: var(--text);
  resize: vertical;
  box-sizing: border-box;
}
.rb-inspector__row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
}
.rb-inspector__row select {
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--bg-elevated);
  font-family: var(--sans);
  font-size: 0.84rem;
  color: var(--text);
}
.rb-inspector__size {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono), var(--sans);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}
.rb-inspector__size input[type="range"] { accent-color: var(--rust); width: 110px; }
.rb-inspector__hint {
  font-size: 0.8rem;
  color: var(--text-faint);
  font-style: italic;
  margin-top: 8px;
}
.rb-swatch--sm { width: 24px; height: 24px; }

/* ---------- Text overlays on regular prints ---------- */
.rb-printtext {
  position: absolute;
  cursor: move;
  white-space: pre-wrap;
  text-align: center;
  line-height: 1.25;
  text-shadow: 0 1px 3px rgba(0,0,0,0.35);
  padding: 2px 6px;
  z-index: 3;
  user-select: none;
}

/* ---------- Inspector toggles & groups ---------- */
.rb-toggle {
  width: 32px; height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
}
.rb-toggle:hover { border-color: var(--rust); color: var(--text); }
.rb-toggle.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.rb-inspector__grouplabel {
  font-family: var(--mono), var(--sans);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  min-width: 52px;
}
