.dsg-cz { --dsg-accent: #6a4bd8; --dsg-ink: #1c1f2a; --dsg-muted: #8a90a2; --dsg-border: #e8eaf1; width: 100%; }

.dsg-cz-stage {
    width: 100%;
    display: flex;
    justify-content: center;
    background: linear-gradient(180deg,#fafbff,#f4f5fb);
    border: 1px solid var(--dsg-border);
    border-radius: 18px;
    padding: 22px;
}
.dsg-cz-canvas { position: relative; width: 100%; max-width: 520px; user-select: none; }
.dsg-cz-template { display: block; width: 100%; height: auto; position: relative; z-index: 10; pointer-events: none; }
.dsg-cz-layers { position: absolute; inset: 0; z-index: auto; pointer-events: none; }

.dsg-cz-text { position: absolute; display: flex; overflow: visible; box-sizing: border-box; }
.dsg-cz-text-val { display: inline-block; max-width: 100%; word-break: break-word; }
.dsg-cz-text-val.is-ghost { opacity: .38; }

.dsg-cz-img-render {
    position: absolute; box-sizing: border-box;
    background-size: cover; background-position: center; background-repeat: no-repeat;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.dsg-cz-img-render.is-empty {
    border: 1.5px dashed rgba(106,75,216,.45);
    background: rgba(255,255,255,.4);
    -webkit-backdrop-filter: blur(1px); backdrop-filter: blur(1px);
}
.dsg-cz-img-render.is-empty.is-front { background: rgba(255,255,255,.6); border-style: solid; border-color: rgba(106,75,216,.4); }
.dsg-cz-ph { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--dsg-accent); text-align: center; padding: 4px; }
.dsg-cz-ph b { font-size: 12px; font-weight: 600; line-height: 1.1; }
.dsg-cz-ph i { font-size: 10px; font-style: normal; opacity: .7; }

.dsg-cz-hint {
    display: flex; align-items: center; gap: 9px;
    margin-top: 12px; padding: 11px 15px;
    background: rgba(106,75,216,.06); border-radius: 12px;
    font-size: 13px; color: #4b5163; line-height: 1.4;
}
.dsg-cz-hint-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dsg-accent); flex: 0 0 auto; box-shadow: 0 0 0 4px rgba(106,75,216,.15); }

/* ---------- FIELDS PANEL ---------- */
.dsg-fld { --dsg-accent: #6a4bd8; --dsg-border: #e8eaf1; margin: 4px 0 22px; }
.dsg-fld-head { margin-bottom: 14px; }
.dsg-fld-badge {
    display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    color: var(--dsg-accent); background: rgba(106,75,216,.1); padding: 4px 10px; border-radius: 999px; margin-bottom: 8px;
}
.dsg-fld-title { font-size: 18px; font-weight: 700; color: #1c1f2a; margin: 0 0 4px; }
.dsg-fld-sub { font-size: 13px; color: #8a90a2; margin: 0; line-height: 1.45; }

.dsg-fld-list { display: flex; flex-direction: column; gap: 12px; }
.dsg-fld-item { border: 1px solid var(--dsg-border); border-radius: 14px; padding: 14px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.dsg-fld-item:focus-within { border-color: var(--dsg-accent); box-shadow: 0 0 0 3px rgba(106,75,216,.1); }
.dsg-fld-row { display: flex; align-items: center; gap: 11px; margin-bottom: 10px; }
.dsg-fld-num {
    width: 26px; height: 26px; flex: 0 0 26px; border-radius: 8px;
    background: rgba(106,75,216,.1); color: var(--dsg-accent);
    display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.dsg-fld-info { display: flex; flex-direction: column; gap: 1px; }
.dsg-fld-info b { font-size: 14px; font-weight: 600; color: #1c1f2a; }
.dsg-fld-info span { font-size: 11.5px; color: #9aa0b0; }

.dsg-fld-input {
    width: 100%; height: 44px; border: 1px solid var(--dsg-border); border-radius: 10px;
    padding: 0 13px; font-size: 14px; color: #1c1f2a; outline: none; background: #fbfcfe;
    transition: border-color .15s, box-shadow .15s;
}
textarea.dsg-fld-input { height: auto; min-height: 64px; padding: 11px 13px; resize: vertical; }
.dsg-fld-input:focus { border-color: var(--dsg-accent); box-shadow: 0 0 0 3px rgba(106,75,216,.12); background: #fff; }
.dsg-fld-locked { padding: 11px 13px; background: #f5f6fa; border-radius: 10px; font-size: 14px; color: #5b6172; }

.dsg-fld-img { display: flex; align-items: center; gap: 12px; }
.dsg-fld-thumb {
    width: 56px; height: 56px; flex: 0 0 56px; border-radius: 10px;
    border: 1px solid var(--dsg-border); background: #f5f6fa #fff;
    background-size: cover; background-position: center;
    display: flex; align-items: center; justify-content: center; color: #b6bccb;
}
.dsg-fld-thumb.has-image { border-color: var(--dsg-accent); }
.dsg-fld-img-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dsg-fld-upload, .dsg-fld-recrop {
    border: none; border-radius: 10px; padding: 10px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
    transition: background .15s, transform .05s;
}
.dsg-fld-upload { background: var(--dsg-accent); color: #fff; }
.dsg-fld-upload:hover { background: #5836c4; }
.dsg-fld-upload:active { transform: translateY(1px); }
.dsg-fld-recrop { background: #f0f1f6; color: #4b5163; }
.dsg-fld-recrop:hover { background: #e6e8f0; }

/* ---------- CROP MODAL ---------- */
.dsg-crop-ov {
    position: fixed; inset: 0; z-index: 99999;
    background: rgba(18,20,28,.62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center; padding: 18px;
}
.dsg-crop-modal {
    width: 100%; max-width: 460px; background: #fff; border-radius: 18px; overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,.4); display: flex; flex-direction: column;
}
.dsg-crop-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid #eef0f5; }
.dsg-crop-head b { font-size: 16px; color: #1c1f2a; }
.dsg-crop-x { border: none; background: none; font-size: 24px; line-height: 1; color: #9aa0b0; cursor: pointer; padding: 0 4px; }
.dsg-crop-x:hover { color: #1c1f2a; }
.dsg-crop-stage {
    position: relative; width: 100%; height: 360px; background: #20232c; overflow: hidden; cursor: grab; touch-action: none;
}
.dsg-crop-stage:active { cursor: grabbing; }
.dsg-crop-stage img { position: absolute; max-width: none; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.dsg-crop-frame {
    position: absolute; box-sizing: border-box;
    border: 2px solid #fff; border-radius: 2px;
    box-shadow: 0 0 0 9999px rgba(18,20,28,.55);
    pointer-events: none;
}
.dsg-crop-tools { display: flex; align-items: center; gap: 12px; padding: 14px 18px; }
.dsg-crop-tools span { font-size: 12px; color: #8a90a2; font-weight: 600; white-space: nowrap; }
.dsg-crop-tools input[type="range"] { flex: 1; -webkit-appearance: none; appearance: none; height: 5px; border-radius: 999px; background: #e8eaf1; outline: none; }
.dsg-crop-tools input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--dsg-accent,#6a4bd8); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(106,75,216,.4); cursor: pointer; }
.dsg-crop-tools input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #6a4bd8; border: 3px solid #fff; cursor: pointer; }
.dsg-crop-foot { display: flex; gap: 10px; padding: 0 18px 18px; }
.dsg-crop-foot button { flex: 1; border: none; border-radius: 11px; padding: 13px; font-size: 14px; font-weight: 600; cursor: pointer; }
.dsg-crop-cancel { background: #f0f1f6; color: #4b5163; }
.dsg-crop-cancel:hover { background: #e6e8f0; }
.dsg-crop-apply { background: #6a4bd8; color: #fff; }
.dsg-crop-apply:hover { background: #5836c4; }

/* ---------- MANUAL CROP BOX ---------- */
.dsg-crop-stage { cursor: default; }
.dsg-crop-box {
    position: absolute; box-sizing: border-box;
    border: 2px solid #fff;
    box-shadow: 0 0 0 9999px rgba(18,20,28,.55);
    cursor: move;
}
.dsg-crop-box::before, .dsg-crop-box::after {
    content: ""; position: absolute; background: rgba(255,255,255,.45);
}
.dsg-crop-box::before { left: 33.33%; right: 33.33%; top: 0; bottom: 0; border-left: 1px solid rgba(255,255,255,.45); border-right: 1px solid rgba(255,255,255,.45); }
.dsg-crop-box::after { top: 33.33%; bottom: 33.33%; left: 0; right: 0; border-top: 1px solid rgba(255,255,255,.45); border-bottom: 1px solid rgba(255,255,255,.45); }
.dsg-crop-h {
    position: absolute; width: 16px; height: 16px; background: #fff; border: 2px solid #6a4bd8;
    border-radius: 50%; box-shadow: 0 1px 4px rgba(0,0,0,.3); z-index: 2;
}
.dsg-crop-h.h-nw { left: -9px; top: -9px; cursor: nwse-resize; }
.dsg-crop-h.h-ne { right: -9px; top: -9px; cursor: nesw-resize; }
.dsg-crop-h.h-sw { left: -9px; bottom: -9px; cursor: nesw-resize; }
.dsg-crop-h.h-se { right: -9px; bottom: -9px; cursor: nwse-resize; }
.dsg-crop-tip { text-align: center; font-size: 12px; color: #8a90a2; margin: 12px 18px 4px; }

/* ---------- STYLE BUTTON ON TEXT CARD ---------- */
.dsg-fld-style {
    margin-left: auto; border: 1px solid var(--dsg-border,#e8eaf1); background: #fff; color: #4b5163;
    border-radius: 9px; padding: 7px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px; transition: background .15s, border-color .15s;
}
.dsg-fld-style:hover { background: #f5f6fa; border-color: #6a4bd8; color: #6a4bd8; }
.dsg-fld-style .dsg-aa { font-weight: 800; color: #6a4bd8; }

/* ---------- QTY TOTAL ---------- */
.dsg-fld-total {
    margin-top: 6px; padding: 14px 16px; border-radius: 14px;
    background: linear-gradient(180deg,#f7f5ff,#f1eefc); border: 1px solid #e6e0fb;
}
.dsg-fld-total-row { display: flex; align-items: baseline; justify-content: space-between; }
.dsg-fld-total-row span { font-size: 13px; color: #6b6480; font-weight: 600; }
.dsg-fld-total-row b { font-size: 22px; font-weight: 800; color: #2b2150; }
.dsg-fld-total-sub { font-size: 12px; color: #8a83a3; margin-top: 2px; }

/* ---------- TEXT STYLE MODAL ---------- */
.dsg-ts-modal { width: 100%; max-width: 420px; background: #fff; border-radius: 18px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.4); display: flex; flex-direction: column; max-height: 90vh; }
.dsg-ts-body { padding: 16px 18px; overflow-y: auto; }
.dsg-ts-prev {
    height: 92px; border-radius: 12px; background: #f6f7fb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Crect width='10' height='10' fill='%23eef0f5'/%3E%3Crect x='10' y='10' width='10' height='10' fill='%23eef0f5'/%3E%3C/svg%3E");
    display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px; margin-bottom: 16px; overflow: hidden;
}
.dsg-ts-lbl { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: #8a90a2; margin: 14px 0 7px; }
.dsg-ts-lbl span { color: #6a4bd8; background: rgba(106,75,216,.1); padding: 2px 8px; border-radius: 999px; font-size: 11px; }
.dsg-ts-dd { position: relative; }
.dsg-ts-dd-t { width: 100%; height: 42px; border: 1px solid #e8eaf1; border-radius: 10px; background: #fff; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; font-size: 14px; cursor: pointer; }
.dsg-ts-dd-t i { color: #8a90a2; }
.dsg-ts-dd.open .dsg-ts-dd-t { border-color: #6a4bd8; box-shadow: 0 0 0 3px rgba(106,75,216,.12); }
.dsg-ts-dd-p { display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid #e8eaf1; border-radius: 12px; box-shadow: 0 16px 40px rgba(20,22,30,.16); padding: 6px; max-height: 220px; overflow-y: auto; z-index: 5; }
.dsg-ts-dd.open .dsg-ts-dd-p { display: block; }
.dsg-ts-dd-i { display: block; width: 100%; text-align: left; border: none; background: none; border-radius: 8px; padding: 9px 11px; font-size: 16px; cursor: pointer; color: #1c1f2a; }
.dsg-ts-dd-i:hover { background: #f5f6fa; }
.dsg-ts-range { width: 100%; -webkit-appearance: none; appearance: none; height: 5px; border-radius: 999px; background: #e8eaf1; outline: none; }
.dsg-ts-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #6a4bd8; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(106,75,216,.4); cursor: pointer; }
.dsg-ts-range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #6a4bd8; border: 3px solid #fff; cursor: pointer; }
.dsg-ts-seg { display: flex; gap: 4px; padding: 4px; background: #f6f7fb; border: 1px solid #e8eaf1; border-radius: 11px; }
.dsg-ts-seg-b { flex: 1; border: none; background: none; border-radius: 8px; padding: 8px 4px; font-size: 12px; color: #8a90a2; cursor: pointer; transition: background .12s, color .12s; }
.dsg-ts-seg-b.on { background: #fff; color: #6a4bd8; box-shadow: 0 1px 3px rgba(20,22,30,.12); }
.dsg-ts-colors { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dsg-ts-pick { position: relative; width: 42px; height: 38px; border: 1px solid #e8eaf1; border-radius: 10px; overflow: hidden; flex: 0 0 42px; cursor: pointer; }
.dsg-ts-pick input { position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); border: none; padding: 0; cursor: pointer; }
.dsg-ts-sw { display: flex; flex-wrap: wrap; gap: 7px; }
.dsg-ts-sw-b { width: 26px; height: 26px; border-radius: 7px; border: 1px solid rgba(0,0,0,.1); cursor: pointer; transition: transform .1s; }
.dsg-ts-sw-b:hover { transform: scale(1.12); }

.dsg-ts-dd-empty { padding: 12px; text-align: center; font-size: 12.5px; color: #9aa0b0; }

.dsg-cz-img-render:not(.is-empty) .dsg-cz-ph { display: none; }
.tf-product-media-wrap .dsg-cz { width: 100%; }

.dsg-ap-modal { width: 100%; max-width: 760px; background: #fff; border-radius: 18px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.4); display: flex; flex-direction: column; max-height: 92vh; }
.dsg-ap-body { display: flex; gap: 20px; padding: 20px; overflow-y: auto; }
.dsg-ap-prev { flex: 0 0 300px; max-width: 300px; background: linear-gradient(180deg,#fafbff,#f4f5fb); border: 1px solid #e8eaf1; border-radius: 14px; padding: 14px; align-self: flex-start; }
.dsg-ap-side { flex: 1; min-width: 220px; }
.dsg-ap-note { font-size: 13px; color: #6b6480; background: rgba(106,75,216,.06); padding: 11px 13px; border-radius: 10px; margin-bottom: 14px; line-height: 1.4; }
.dsg-ap-err { background: #fff1f1; border: 1px solid #ffd4d4; border-radius: 10px; padding: 11px 13px; margin-bottom: 14px; }
.dsg-ap-err b { font-size: 13px; color: #c0392b; }
.dsg-ap-err ul { margin: 6px 0 0; padding-left: 18px; }
.dsg-ap-err li { font-size: 12.5px; color: #c0392b; margin: 2px 0; }
.dsg-ap-sum { display: flex; flex-direction: column; gap: 1px; }
.dsg-ap-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px; border-bottom: 1px solid #f0f1f5; }
.dsg-ap-row:last-child { border-bottom: none; }
.dsg-ap-k { font-size: 13px; color: #8a90a2; font-weight: 600; flex: 0 0 auto; }
.dsg-ap-v { font-size: 14px; color: #1c1f2a; text-align: right; word-break: break-word; }
.dsg-ap-thumb { display: inline-block; width: 42px; height: 42px; border-radius: 8px; background-size: cover; background-position: center; border: 1px solid #e8eaf1; vertical-align: middle; }
.dsg-ap-miss { color: #c0392b; font-size: 12px; font-weight: 600; }
.dsg-crop-apply[disabled] { opacity: .5; cursor: not-allowed; }
@media (max-width: 640px) { .dsg-ap-body { flex-direction: column; } .dsg-ap-prev { flex: none; max-width: 100%; align-self: stretch; } }

.dsg-fld-thumb.is-loading { position: relative; }
.dsg-fld-thumb.is-loading::after { content: ""; position: absolute; inset: 0; background: rgba(17,17,17,0.45); border-radius: inherit; }
.dsg-fld-spin { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(17,17,17,0.25); border-top-color: #111; border-radius: 50%; animation: dsgSpin 0.7s linear infinite; position: relative; z-index: 1; }
.dsg-fld-thumb.is-loading .dsg-fld-spin { border-color: rgba(255,255,255,0.45); border-top-color: #fff; }
.dsg-ap-wait { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #111; background: #f4f4f5; border: 1px solid #e5e5e8; border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
@keyframes dsgSpin { to { transform: rotate(360deg); } }
