/* STATIONERY_V18: scoped to the addon. Existing book cards are unchanged. */
#stationery-builder[hidden],
.card[data-item-mode="stationery"] #builder,
.card[data-item-mode="stationery"] .reference-edit-controls { display:none!important; }
#stationery-builder { padding:20px; border:0; margin:0; }
#builder .stationery-trigger { display:block; width:100%; margin:12px 0 0; padding:11px 14px; border:1px solid #dce5f3; border-radius:10px; background:#f8faff; color:#315fcf; font-size:14px; font-weight:600; text-align:left; }
.stationery-trigger-detail { display:block; margin-top:3px; color:#657188; font-size:12px; font-weight:400; }
.stationery-toolbar { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:12px; }
.stationery-back { min-height:44px; padding:8px 12px; border:1px solid #dce5f3; border-radius:9px; background:#fff; color:#315fcf; font-size:13px; }
.stationery-demo { font-size:11px; color:#657188; }
.stationery-title { margin:0 0 14px; font-size:18px; line-height:1.3; color:#18243c; }
.stationery-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
.stationery-choice { box-sizing:border-box; min-width:0; min-height:90px; padding:12px 8px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:7px; border:1px solid #e1e6ed; border-radius:11px; background:#fff; color:#18243c; font:inherit; font-size:13px; font-weight:600; line-height:1.3; text-align:center; }
.stationery-choice svg, .stationery-product svg { width:32px; height:32px; fill:none; stroke:#5775b9; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; flex-shrink:0; }
.stationery-choice small { font-size:11px; font-weight:400; color:#657188; }
.stationery-bags { grid-template-columns:repeat(2,minmax(0,1fr)); }
.stationery-bags svg { width:56px; height:56px; }
.stationery-product { display:flex; align-items:center; gap:12px; padding:12px; margin-bottom:14px; background:#f7f9fd; border:1px solid #e1e6ed; border-radius:11px; }
.stationery-product strong, .stationery-product span { display:block; }
.stationery-product strong { font-size:14px; color:#18243c; }
.stationery-product span { margin-top:3px; font-size:12px; color:#657188; }
.stationery-label { margin:0 0 8px; color:#39465d; font-size:13px; font-weight:600; }
.stationery-variants { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:16px; }
.stationery-variants .stationery-choice { min-height:44px; padding:8px 13px; }
.stationery-variants .selected { background:#eef3ff; border-color:#3d6ce7; box-shadow:inset 0 0 0 1px #3d6ce7; }
.stationery-quantity-row { display:flex; justify-content:space-between; align-items:center; gap:12px; margin:14px 0; }
.stationery-quantity-row label { margin:0; }
.stationery-quantity { display:flex; align-items:center; gap:5px; }
.stationery-quantity button { width:44px; height:44px; padding:0; background:#f5f7fc; border:1px solid #dce5f3; border-radius:9px; color:#315fcf; font-size:20px; }
.stationery-quantity input { width:56px; height:44px; padding:4px; text-align:center; border:1px solid #dce5f3; border-radius:9px; background:#fff; color:#18243c; font:inherit; }
.stationery-add { width:100%; min-height:44px; border:0; border-radius:10px; background:#3d6ce7; color:#fff; padding:11px 14px; font:inherit; font-size:14px; font-weight:600; }
.stationery-add:disabled { opacity:.5; }
.stationery-status { margin:8px 0 0; color:#9a3b35; font-size:12px; }
.stationery-status:empty { display:none; }
#stationery-builder button:focus-visible, #stationery-builder input:focus-visible,
.stationery-trigger:focus-visible { outline:2px solid #3d6ce7; outline-offset:3px; }
@media (max-width:767px) {
  #stationery-builder { padding:12px; }
  .stationery-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .stationery-families { grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px; }
  .stationery-families .stationery-choice { min-height:78px; padding:8px 3px; font-size:11px; }
  .stationery-title { font-size:16px; }
}
@media (hover:hover) {
  #stationery-builder .stationery-choice:not(.selected):hover { background:#f7f9fd; border-color:#b9c9e9; }
}

/* STATIONERY_MULTI_VARIANT_V19 */
#stationery-builder .stationery-product { margin-bottom:12px; }
#stationery-builder .stationery-matrix {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(190px,1fr));
  gap:8px;
  margin:0 0 14px;
}
#stationery-builder .stationery-variant-row {
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px;
  min-width:0;
  border:1px solid #e1e6ed;
  border-radius:10px;
  background:#fff;
}
#stationery-builder .stationery-variant-row.selected {
  border-color:#b5c7f2;
  background:#f4f7ff;
}
#stationery-builder .stationery-variant-label {
  color:#18243c;
  font-size:13px;
  font-weight:600;
  line-height:1.3;
}
@media(max-width:767px) {
  #stationery-builder .stationery-matrix { grid-template-columns:1fr; gap:6px; }
  #stationery-builder .stationery-variant-row {
    flex-direction:row;
    justify-content:space-between;
    padding:6px 10px;
    gap:8px;
  }
}

/* STATIONERY_MODEL_CARDS_V20 */
#stationery-builder .stationery-models {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(145px,1fr));
  gap:8px;
  margin:0 0 14px;
}
#stationery-builder .stationery-models .stationery-choice {
  min-height:76px;
  padding:10px 8px;
}
#stationery-builder .stationery-models .selected {
  background:#eef3ff;
  border-color:#3d6ce7;
  box-shadow:inset 0 0 0 1px #3d6ce7;
}
#stationery-builder .stationery-models .stationery-choice:nth-child(1) svg { stroke:#59935a; }
#stationery-builder .stationery-models .stationery-choice:nth-child(2) svg { stroke:#916bac; }
#stationery-builder .stationery-models .stationery-choice:nth-child(3) svg { stroke:#b45f57; }
#stationery-builder .stationery-models .stationery-choice:nth-child(4) svg { stroke:#bd8c46; }
#stationery-builder .stationery-variant-label { display:flex; align-items:center; gap:7px; }
.stationery-swatch { width:13px; height:13px; border-radius:50%; display:inline-block; flex-shrink:0; border:1px solid #ffffff; box-shadow:0 0 0 1px #b8c1cf; }
.stationery-pack-note { margin:0 0 12px; font-size:12px; color:#596579; }
@media(min-width:768px) {
  #stationery-builder .stationery-matrix[data-variant-count="4"] { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media(max-width:767px) {
  #stationery-builder .stationery-models { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

/* STATIONERY_COMPACT_V28: same blue, borders and compact book card proportions. */
#stationery-builder {padding:14px 18px;}
#stationery-builder .stationery-toolbar {margin-bottom:9px;}
#stationery-builder .stationery-title {font-size:17px;margin-bottom:10px;}
#stationery-builder .stationery-label {margin-bottom:6px;}
#stationery-builder .stationery-choice {min-height:68px;padding:8px 6px;gap:5px;border-radius:9px;}
#stationery-builder .stationery-models .stationery-choice {min-height:64px;padding:7px 6px;}
#stationery-builder .stationery-models {gap:6px;margin-bottom:10px;}
#stationery-builder .stationery-choice svg {width:25px;height:25px;}
#stationery-builder .stationery-product {padding:9px;gap:8px;margin-bottom:10px;border-radius:9px;}
#stationery-builder .stationery-product svg {width:25px;height:25px;}
#stationery-builder .stationery-variant-row {padding:7px;gap:5px;}
#stationery-builder .stationery-matrix {gap:6px;margin-bottom:10px;}
.card[data-item-mode="stationery"] .reference-banner {padding:14px 18px;}
.card[data-item-mode="stationery"] .reference-banner h2 {font-size:23px;line-height:1.2;}
.card[data-item-mode="stationery"] .reference-detail {font-size:12px;line-height:1.3;margin-top:5px;}
@media(max-width:767px) {
  #stationery-builder {padding:10px 12px;}
  .card[data-item-mode="stationery"] .reference-banner {padding:12px;gap:8px;align-items:start;}
  .card[data-item-mode="stationery"] .reference-caption {display:none;}
  .card[data-item-mode="stationery"] .reference-banner h2 {font-size:18px;}
  .card[data-item-mode="stationery"] .reference-list {min-width:0;padding:8px 9px;min-height:48px;}
  .card[data-item-mode="stationery"] .reference-list strong {font-size:10px;}
  .card[data-item-mode="stationery"] .reference-list span {font-size:16px;}
  #stationery-builder .stationery-toolbar {gap:6px;margin-bottom:8px;}
  #stationery-builder .stationery-demo {display:none;}
  #stationery-builder .stationery-back {min-height:36px;padding:5px 8px;font-size:11px;}
  #stationery-builder .stationery-title {font-size:15px;margin-bottom:8px;}
  #stationery-builder .stationery-label {font-size:12px;margin-bottom:5px;}
  #stationery-builder .stationery-grid {gap:5px;}
  #stationery-builder .stationery-models {grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;}
  #stationery-builder .stationery-choice,
  #stationery-builder .stationery-models .stationery-choice {min-height:62px;padding:5px 4px;gap:4px;font-size:11px;line-height:1.2;}
  #stationery-builder .stationery-choice svg {width:22px;height:22px;}
  #stationery-builder .stationery-choice small {font-size:9px;}
  #stationery-builder .stationery-models .stationery-choice>span {display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}
  #stationery-builder .stationery-product {padding:7px;margin-bottom:8px;}
  #stationery-builder .stationery-product strong {font-size:12px;line-height:1.3;}
  #stationery-builder .stationery-product span {font-size:10px;margin-top:2px;}
  #stationery-builder .stationery-matrix {grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;}
  #stationery-builder .stationery-matrix[data-variant-count="1"] {grid-template-columns:1fr;}
  #stationery-builder .stationery-variant-row {flex-direction:column;justify-content:center;padding:6px;gap:5px;}
  #stationery-builder .stationery-variant-label {font-size:11px;gap:5px;}
  #stationery-builder .stationery-quantity {gap:3px;}
  #stationery-builder .stationery-quantity button {width:28px;height:36px;min-width:28px;min-height:36px;font-size:17px;border-radius:7px;}
  #stationery-builder .stationery-quantity input {width:38px;height:36px;min-height:36px;font-size:13px;padding:2px;border-radius:7px;}
  #stationery-builder .stationery-pack-note {font-size:10px;margin-bottom:8px;}
  #stationery-builder .stationery-add {min-height:42px;padding:8px 10px;font-size:13px;}
}

/* CONTINUITY_V28 */
.stationery-models[hidden],#stationery-builder .stationery-label[hidden],.byo-next[hidden]{display:none!important;}
.card[data-journey-stage="added"] #builder,
.card[data-journey-stage="added"] #stationery-builder,
.card[data-journey-stage="added"] .reference-edit-controls {display:none!important;}
.byo-next {padding:16px 18px;}
.byo-added {margin:0 0 10px;color:#356343;font-size:13px;font-weight:600;}
.byo-next h3 {margin:0 0 12px;color:#18243c;font-size:17px;}
.byo-next-actions,.byo-quick-items {display:flex;flex-wrap:wrap;gap:7px;}
.byo-next-actions {margin-bottom:12px;}
.byo-next button {min-height:42px;padding:8px 11px;border:1px solid #cfdbf3;border-radius:9px;background:#fff;color:#315fcf;font:inherit;font-size:13px;}
.byo-next-actions button:first-child {background:#3d6ce7;color:#fff;border-color:#3d6ce7;}
.byo-quick-items button {min-height:36px;font-size:12px;}
.byo-next button:focus-visible {outline:2px solid #3d6ce7;outline-offset:3px;}
.steps {display:none;}
@media(max-width:767px) {
  .byo-next {padding:12px;}
  .byo-next h3 {font-size:15px;}
  .byo-next-actions {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;}
  .byo-next-actions button {padding:6px 4px;font-size:11px;}
  .byo-quick-items {gap:5px;}
}

/* PACK_LANGUAGE_V30 */
.byo-next-actions button {display:flex;align-items:center;justify-content:center;gap:6px;}
.byo-next-actions button svg {width:17px;height:17px;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;}
.byo-quick-items .byo-recent-book {display:flex;flex-direction:column;align-items:flex-start;text-align:left;gap:3px;}
.byo-recent-book>span {font-weight:600;}
.byo-recent-book>small {font-size:10px;line-height:1.3;color:#6c7890;overflow-wrap:anywhere;}
@media(max-width:767px) {
  .byo-next-actions button {flex-direction:column;gap:4px;min-height:52px;line-height:1.25;white-space:normal;}
  .byo-quick-items .byo-recent-book {flex-basis:100%;}
}

/* SHARED_SELECTION_TEMPLATE_V32: existing buttons and handlers preserved */
#stationery-builder .stationery-grid {grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;}
#stationery-builder .stationery-grid>.stationery-choice {border:0;background:transparent;box-shadow:none;border-radius:14px;min-height:112px;padding:10px 5px;gap:9px;font-size:14px;line-height:1.3;}
#stationery-builder .stationery-grid>.stationery-choice svg {box-sizing:border-box;width:64px;height:64px;padding:17px;background:#eef3ff;border-radius:22px;stroke:#4267b2;}
#stationery-builder .stationery-grid>.stationery-choice:nth-child(3n+2) svg {background:#e9f5ef;stroke:#487866;}
#stationery-builder .stationery-grid>.stationery-choice:nth-child(3n) svg {background:#f6efe7;stroke:#8a7152;}
#stationery-builder .stationery-grid>.stationery-choice.selected {background:#eef3ff;box-shadow:none;}
#stationery-builder .stationery-variants>.stationery-choice {border:0;background:transparent;box-shadow:none;}
#stationery-builder .stationery-variants>.stationery-choice.selected {background:#eef3ff;}
@media(hover:hover){#stationery-builder .stationery-grid>.stationery-choice:not(.selected):hover {background:#f6f8fc;}}
@media(max-width:767px){
 #stationery-builder .stationery-grid,#stationery-builder .stationery-models,#stationery-builder .stationery-families,#stationery-builder .stationery-bags {grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;}
 #stationery-builder .stationery-grid>.stationery-choice {min-height:98px;padding:8px 3px;gap:7px;font-size:12px;}
 #stationery-builder .stationery-grid>.stationery-choice svg {width:54px;height:54px;padding:14px;border-radius:19px;}
 #stationery-builder .stationery-grid>.stationery-choice small {font-size:10px;line-height:1.3;}
}

/* SHARED_SELECTION_TEMPLATE_V33: existing buttons and handlers preserved */
#stationery-builder .stationery-grid {grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;}
#stationery-builder :is(.stationery-grid,.stationery-models)>.stationery-choice {border:0;background:transparent;box-shadow:none;border-radius:14px;min-height:112px;padding:10px 5px;gap:9px;font-size:14px;line-height:1.3;}
#stationery-builder :is(.stationery-grid,.stationery-models)>.stationery-choice svg {box-sizing:border-box;width:64px;height:64px;padding:17px;background:#eef3ff;border-radius:22px;stroke:#4267b2;}
#stationery-builder :is(.stationery-grid,.stationery-models)>.stationery-choice:nth-child(3n+2) svg {background:#e9f5ef;stroke:#487866;}
#stationery-builder :is(.stationery-grid,.stationery-models)>.stationery-choice:nth-child(3n) svg {background:#f6efe7;stroke:#8a7152;}
#stationery-builder :is(.stationery-grid,.stationery-models)>.stationery-choice.selected {background:#eef3ff;box-shadow:none;}
#stationery-builder .stationery-variants>.stationery-choice {border:0;background:transparent;box-shadow:none;}
#stationery-builder .stationery-variants>.stationery-choice.selected {background:#eef3ff;}
@media(hover:hover){#stationery-builder :is(.stationery-grid,.stationery-models)>.stationery-choice:not(.selected):hover {background:#f6f8fc;}}
@media(max-width:767px){
 #stationery-builder .stationery-grid,#stationery-builder .stationery-models,#stationery-builder .stationery-families,#stationery-builder .stationery-bags {grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;}
 #stationery-builder :is(.stationery-grid,.stationery-models)>.stationery-choice {min-height:98px;padding:8px 3px;gap:7px;font-size:12px;}
 #stationery-builder :is(.stationery-grid,.stationery-models)>.stationery-choice svg {width:54px;height:54px;padding:14px;border-radius:19px;}
 #stationery-builder :is(.stationery-grid,.stationery-models)>.stationery-choice small {font-size:10px;line-height:1.3;}
}

/* BYO_PRODUCT_IMAGES_V47: scoped to stationery model choices. */
#stationery-builder .stationery-models {grid-template-columns:repeat(4,minmax(0,1fr));}
#stationery-builder :is(.stationery-models,.stationery-grid)>.byo47-model {min-width:0;min-height:112px;padding:8px 3px;gap:5px;font-size:13px;justify-content:flex-start;}
#stationery-builder .byo47-image {display:grid!important;place-items:center;width:64px;height:64px;flex-shrink:0;background:#fff;border:1px solid #edf0f6;border-radius:20px;overflow:hidden;position:relative;-webkit-line-clamp:unset!important;}
#stationery-builder .byo47-image img {width:100%;height:100%;object-fit:contain;grid-area:1/1;display:block;}
#stationery-builder .byo47-image>svg {grid-area:1/1;width:64px;height:64px;padding:17px;}
#stationery-builder .byo47-image>svg[hidden] {display:none;}
#stationery-builder .byo47-pen img {transform:rotate(-40deg) scale(1.3);}
#stationery-builder .byo47-model-name {font-size:13px;line-height:1.3;overflow-wrap:anywhere;display:block!important;-webkit-line-clamp:unset!important;}
#stationery-builder .byo47-preview-label {font-size:10px;line-height:1.3;}
#stationery-builder .byo47-model .byo47-price {font-size:11px;font-weight:700;color:#243654;line-height:1.3;}
@media(max-width:767px){
 #stationery-builder .stationery-models {grid-template-columns:repeat(4,minmax(0,1fr));gap:5px;}
 #stationery-builder :is(.stationery-models,.stationery-grid)>.byo47-model {padding:7px 1px;gap:4px;font-size:11px;}
 #stationery-builder .byo47-image {width:52px;height:52px;border-radius:17px;}
 #stationery-builder .byo47-image>svg {width:52px;height:52px;padding:14px;}
 #stationery-builder .byo47-model-name {font-size:11px;}
 #stationery-builder .byo47-model .byo47-price {font-size:10px;}
}
@media(max-width:359px){#stationery-builder .byo47-image{width:46px;height:46px;border-radius:15px;}}

/* BYO_COMPACT_DESKTOP_V48: mobile-sized model cards, fit available space. */
@media(min-width:768px){
 #stationery-builder .stationery-models {grid-template-columns:repeat(auto-fill,80px);justify-content:start;gap:5px;}
 #stationery-builder :is(.stationery-models,.stationery-grid)>.byo47-model {padding:7px 1px;gap:4px;font-size:11px;}
 #stationery-builder .byo47-image {width:52px;height:52px;border-radius:17px;}
 #stationery-builder .byo47-image>svg {width:52px;height:52px;padding:14px;}
 #stationery-builder .byo47-model-name {font-size:11px;}
 #stationery-builder .byo47-model .byo47-price {font-size:10px;}
}

/* BYO_CATEGORY_PHOTOS_V49: preserve category grid and selection styling. */
#stationery-builder .byo49-category-name {display:block!important;-webkit-line-clamp:unset!important;overflow-wrap:anywhere;}
#stationery-builder .stationery-grid>.byo49-category .byo47-image>svg[hidden] {display:none!important;}

/* BOOK_CATEGORY_PHOTOS_V50: replace only the icon after a successful image load. */
#builder #categories>button.byo50-book-loaded::before {display:none!important;}
#builder #categories .byo50-book-image {display:grid;place-items:center;order:-1;width:52px;height:52px;flex-shrink:0;background:#fff;border:1px solid #edf0f6;border-radius:17px;overflow:hidden;}
#builder #categories .byo50-book-image[hidden] {display:none!important;}
#builder #categories .byo50-book-image img {display:block;width:100%;height:100%;object-fit:contain;}
#stationery-builder .stationery-families .byo47-image>svg[hidden] {display:none!important;}
@media(max-width:767px){#builder #categories .byo50-book-image {width:46px;height:46px;border-radius:15px;}}
