/* Custom cap builder (capbuilder.php) */
.cb-head { display: flex; flex-wrap: wrap; gap: .75rem 2rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1rem; }
.cb-head p { max-width: 62ch; }
.cb-head-price a { display: inline-block; background: #fff8e1; border: 1px solid #f0d27a; color: #5a4300; border-radius: 999px; padding: .35rem .9rem; font-weight: 600; font-size: .9rem; text-decoration: none; }
.cb-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 991px) { .cb-grid { grid-template-columns: 1fr; } }
.cb-left { position: sticky; top: .75rem; }
@media (max-width: 991px) { .cb-left { position: static; } }
.cb-stage-wrap { position: relative; background: radial-gradient(ellipse at 50% 40%, #ffffff 0%, #f1f2f4 70%, #e7e9ec 100%); border: 1px solid #dde0e4; border-radius: 14px; overflow: hidden; touch-action: none; }
.cb-stage svg { display: block; width: 100%; height: auto; user-select: none; }
.cb-stage [data-part] { cursor: pointer; }
.cb-stage [data-part]:hover { filter: brightness(1.08); }
.cb-stage .cb-logo { cursor: move; }
.cb-stage .cb-resize { cursor: nwse-resize; }
.cb-drop-hint { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; font-size: 1.4rem; font-weight: 700; color: #0d6efd; background: rgba(13, 110, 253, .08); border: 3px dashed #0d6efd; border-radius: 14px; pointer-events: none; }
.cb-stage-wrap.drag .cb-drop-hint { display: flex; }
.cb-msg { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); max-width: 92%; padding: .45rem .9rem; border-radius: 8px; font-size: .9rem; box-shadow: 0 4px 14px rgba(0, 0, 0, .15); }
.cb-msg.ok { background: #1d7d45; color: #fff; }
.cb-msg.bad { background: #b4212b; color: #fff; }
.cb-views { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-top: .6rem; }
.cb-views button { background: #fff; border: 2px solid #dde0e4; border-radius: 10px; padding: .25rem .25rem .35rem; font-size: .8rem; font-weight: 600; color: #444; }
.cb-views button.active { border-color: #212529; color: #000; }
.cb-thumb svg { display: block; width: 100%; height: auto; pointer-events: none; }
.cb-tools { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; align-items: center; }

.cb-card { background: #fff; border: 1px solid #dde0e4; border-radius: 12px; padding: .9rem 1rem; margin-bottom: .9rem; }
.cb-h { font-size: 1.02rem; font-weight: 700; margin: 0 0 .6rem; }
.cb-styles { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
@media (max-width: 520px) { .cb-styles { grid-template-columns: 1fr; } }
.cb-style { text-align: left; background: #f8f9fa; border: 2px solid #dde0e4; border-radius: 10px; padding: .5rem .6rem; line-height: 1.2; }
.cb-style b { display: block; font-size: .88rem; }
.cb-style small { color: #666; font-size: .74rem; }
.cb-style.active { border-color: #212529; background: #fff; box-shadow: 0 0 0 2px rgba(33, 37, 41, .1); }
.cb-mat-row { display: flex; gap: .5rem; align-items: center; margin-bottom: .45rem; flex-wrap: wrap; }
.cb-mat-row > span { width: 105px; font-size: .85rem; font-weight: 600; }
.cb-mat-row > div { display: flex; gap: .3rem; flex-wrap: wrap; }
.cb-pill { display: inline-flex; align-items: center; gap: .3rem; border: 1px solid #ced4da; border-radius: 999px; padding: .15rem .65rem; font-size: .82rem; cursor: pointer; background: #fff; }
.cb-pill:has(input:checked) { background: #212529; color: #fff; border-color: #212529; }
.cb-pill input { accent-color: #ffc107; }

.cb-presets { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .75rem; }
.cb-preset { display: inline-flex; align-items: center; gap: .35rem; font-size: .76rem; border: 1px solid #ced4da; background: #fff; border-radius: 999px; padding: .15rem .55rem .15rem .2rem; }
.cb-preset.active { border-color: #212529; box-shadow: 0 0 0 1px #212529; }
.cb-preset-sw { display: inline-flex; border-radius: 999px; overflow: hidden; border: 1px solid rgba(0, 0, 0, .2); }
.cb-preset-sw i { width: 9px; height: 18px; display: block; }

.cb-parts { border: 1px solid #e3e6ea; border-radius: 10px; overflow: hidden; }
.cb-part + .cb-part { border-top: 1px solid #e3e6ea; }
.cb-part-head { width: 100%; display: flex; align-items: center; gap: .6rem; background: #fff; border: 0; padding: .5rem .7rem; text-align: left; }
.cb-part-head:hover { background: #f8f9fa; }
.cb-chips { display: inline-flex; gap: 2px; }
.cb-chips i { width: 26px; height: 26px; border-radius: 50%; display: block; border: 1px solid rgba(0, 0, 0, .25); box-shadow: inset 0 -3px 6px rgba(0, 0, 0, .18), inset 0 3px 5px rgba(255, 255, 255, .25); }
.cb-part-label { flex: 1; font-weight: 600; font-size: .9rem; line-height: 1.15; }
.cb-part-label small { display: block; font-weight: 400; color: #666; font-size: .76rem; }
.cb-caret { color: #999; transition: transform .15s; }
.cb-part.open .cb-caret { transform: rotate(180deg); }
.cb-part-body { display: none; padding: .2rem .7rem .8rem; background: #fafbfc; }
.cb-part.open .cb-part-body { display: block; }
.cb-part.open .cb-part-head { background: #f1f3f5; }
@keyframes cbflash { 0% { box-shadow: inset 0 0 0 3px #ffc107; } 100% { box-shadow: inset 0 0 0 3px transparent; } }
.cb-part.flash { animation: cbflash 1.2s ease-out; }
.cb-pal-title { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #777; margin: .4rem 0 .3rem; }
.cb-pal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: .35rem; }
.cb-sw { background: none; border: 0; padding: 2px; border-radius: 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cb-sw span { width: 36px; height: 36px; border-radius: 50%; background: var(--c); border: 1px solid rgba(0, 0, 0, .25); box-shadow: inset 0 -4px 7px rgba(0, 0, 0, .2), inset 0 3px 6px rgba(255, 255, 255, .25); }
.cb-sw.thread span { background: repeating-linear-gradient(-28deg, var(--c) 0 3px, color-mix(in srgb, var(--c) 78%, #000) 3px 4px); border-radius: 7px; width: 30px; height: 36px; }
.cb-sw em { font-style: normal; font-size: .64rem; line-height: 1.1; color: #444; text-align: center; }
.cb-sw:hover { background: #e9ecef; }
.cb-sw.on { background: #212529; }
.cb-sw.on em { color: #fff; }
.cb-custom { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .55rem; color: #555; }
.cb-custom .cb-hex { width: 96px; height: 28px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; text-transform: uppercase; padding: 0 6px; }
.cb-custom .cb-hex.is-invalid { border-color: #dc3545; box-shadow: 0 0 0 2px rgba(220,53,69,.2); }
.cb-custom .btn { padding: .1rem .55rem; }
.cb-override-note { margin-top: .3rem; }
.cb-custom input[type=color] { width: 42px; height: 28px; border: 1px solid #ced4da; border-radius: 6px; padding: 0 2px; background: #fff; }

.cb-logo-list { display: grid; gap: .5rem; }
.cb-logo-row { display: flex; gap: .6rem; align-items: flex-start; border: 1px solid #e3e6ea; border-radius: 10px; padding: .5rem; cursor: pointer; }
.cb-logo-row.on { border-color: #0d6efd; box-shadow: 0 0 0 1px #0d6efd; }
.cb-logo-row img { width: 56px; height: 56px; object-fit: contain; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 12px 12px; border-radius: 6px; }
.min-w-0 { min-width: 0; }
.cb-spec th { width: 38%; font-weight: 600; color: #444; font-size: .82rem; }
.cb-spec td { font-size: .82rem; }
.cb-price { font-size: .95rem; }
.cb-quote-card { border: 2px solid #212529; }
@media (max-width: 991px) {
  .cb-left { position: sticky; top: 0; z-index: 30; background: #f8f9fa; padding-bottom: .4rem; margin: 0 -.25rem; padding-left: .25rem; padding-right: .25rem; }
  .cb-stage svg { max-height: 30vh; width: auto; max-width: 100%; margin: 0 auto; }
  .cb-views button { font-size: .7rem; padding: .1rem; }
  .cb-thumb svg { max-height: 44px; margin: 0 auto; width: auto; }
  .cb-left > p { display: none; }
  .cb-tools { margin-top: .35rem; }
  .cb-tools .btn { padding: .1rem .45rem; font-size: .78rem; }
}
/* 3D stage */
.cb-stage { width: 100%; aspect-ratio: 4 / 3; cursor: grab; }
.cb-stage canvas { display: block; width: 100% !important; height: 100% !important; touch-action: none; outline: none; }
.cb-stage canvas:active { cursor: grabbing; }
.cb-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: .4rem; font-weight: 600; color: #555; background: rgba(255,255,255,.6); }
.cb-loading[hidden] { display: none; }
.cb-views { grid-template-columns: repeat(5, 1fr); }
.cb-views button { padding: .45rem .25rem; }
#cbSpin.active { background: #212529; color: #fff; }
@media (max-width: 991px) {
  .cb-stage { aspect-ratio: auto; height: 34vh; }
}
/* accounts: save bar, saved caps, logo library, text card */
.cb-account { background: #fff; border: 1px solid #dde0e4; border-radius: 12px; padding: .6rem .9rem; margin-bottom: 1rem; }
.cb-acc-row { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: center; }
.cb-acc-icon { font-size: 1.4rem; }
.cb-title-wrap span { white-space: nowrap; }
.cb-title-wrap { display: flex; align-items: center; gap: .4rem; margin: 0; flex: 1 1 260px; }
.cb-title-wrap input { min-width: 0; }
.cb-cust { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; flex: 1 1 360px; }
.cb-cust > div { flex: 1 1 200px; }
.cb-cust-list { position: absolute; z-index: 50; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid #ced4da; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.15); max-height: 320px; overflow: auto; }
.cb-cust-list button { display: block; width: 100%; text-align: left; border: 0; background: #fff; padding: .35rem .6rem; font-size: .85rem; }
.cb-cust-list button:hover { background: #f1f3f5; }
.cb-mine { margin-top: .7rem; border-top: 1px solid #e3e6ea; padding-top: .7rem; }
.cb-mine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .6rem; max-height: 420px; overflow: auto; }
.cb-mine-item { border: 1px solid #dde0e4; border-radius: 10px; overflow: hidden; background: #fafbfc; display: flex; flex-direction: column; }
.cb-mine-item.on { border-color: #212529; box-shadow: 0 0 0 1px #212529; }
.cb-mine-open { border: 0; background: none; padding: 0 0 .3rem; text-align: left; display: flex; flex-direction: column; }
.cb-mine-open img, .cb-mine-noimg { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: radial-gradient(ellipse at 50% 40%, #fff 0%, #eceef1 100%); display: grid; place-items: center; font-size: 2rem; }
.cb-mine-open b { font-size: .82rem; padding: .25rem .5rem 0; line-height: 1.2; }
.cb-mine-open small { font-size: .7rem; color: #666; padding: 0 .5rem; }
.cb-mine-act { display: flex; gap: .3rem; justify-content: flex-end; padding: 0 .4rem .4rem; }
.cb-lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: .4rem; max-height: 220px; overflow: auto; margin-bottom: .5rem; }
.cb-lib-item { border: 1px solid #dde0e4; border-radius: 8px; padding: 3px; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 12px 12px; aspect-ratio: 1; }
.cb-lib-item:hover { border-color: #0d6efd; box-shadow: 0 0 0 1px #0d6efd; }
.cb-lib-item img { width: 100%; height: 100%; object-fit: contain; }
.cb-saved { color: #1d7d45; font-weight: 700; }
#cbTextCard.editing { border-color: #ffc107; box-shadow: 0 0 0 2px rgba(255, 193, 7, .35); }
#cbTextCard .tx-preview { background: repeating-conic-gradient(#e9ecef 0 25%, #f8f9fa 0 50%) 0 0 / 14px 14px; }

/* sandwich bill + bill-edge zoom */
.cb-sand { background: #f6f7f9; border-radius: 10px; padding: .75rem .85rem; margin: -.2rem 0 .6rem; }
.cb-sand-sw { display: inline-block; width: 18px; height: 18px; border-radius: 5px; border: 1px solid rgba(0,0,0,.25); }
.cb-zoombar { display: flex; align-items: center; gap: .75rem; margin-top: .6rem; background: #111317; color: #fff; border-radius: 10px; padding: .45rem .75rem; }
.cb-zoombar .form-range { flex: 1; }
.cb-zoombar .btn { color: #fff; border-color: rgba(255,255,255,.5); }

/* language switch */
.cb-lang { display: inline-flex; align-items: center; gap: .25rem; background: #f1f2f4; border-radius: 999px; padding: .2rem .3rem .2rem .6rem; align-self: flex-start; }
.cb-lang button { border: 0; background: transparent; border-radius: 999px; padding: .25rem .7rem; font-size: .875rem; font-weight: 600; color: #333; }
.cb-lang button.active { background: #111317; color: #fff; }
.cb-lang button:hover:not(.active) { background: #e2e4e8; }
