/* ============================================================
   AKSHAR STUDIO — editor UI
   ============================================================ */
:root {
    --p: #0664AE; --p-dark: #054A80; --p-soft: #EAF3FC; --gold: #FFCC2A; --pink: #ED297B;
    --ink: #101828; --ink-2: #344054; --ink-3: #667085; --ink-4: #98A2B3;
    --line: #E4E7EC; --line-2: #D0D5DD; --bg: #EEF0F4; --white: #fff;
    --rail: #0E1525; --rail-2: #1A2336;
    --top-h: 58px; --rail-w: 76px; --panel-w: 340px; --ctx-h: 52px; --bottom-h: 64px;
    --r: 10px; --shadow: 0 10px 30px -10px rgba(16,24,40,.25), 0 2px 6px rgba(16,24,40,.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body.studio { font-family: 'Inter', system-ui, sans-serif; font-size: 14px; color: var(--ink); background: var(--bg); overflow: hidden; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
input, select { font: inherit; color: inherit; }
kbd { font-family: inherit; font-size: 11px; background: var(--bg); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--ink-2); }
[hidden] { display: none !important; }

.logo-mark { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px; background: #fff; color: var(--p); font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 17px; position: relative; }
.logo-mark::after { content: ''; position: absolute; right: -3px; top: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); border: 2px solid var(--p); }

/* Loading */
.st-loading { position: fixed; inset: 0; z-index: 9999; background: var(--bg); display: flex; align-items: center; justify-content: center; transition: opacity .35s, visibility .35s; }
.st-loading.done { opacity: 0; visibility: hidden; }
.st-loader { display: flex; align-items: center; gap: 12px; font-weight: 600; color: var(--ink-2); }
.st-loader .logo-mark { background: var(--p); color: #fff; }
.st-loader .logo-mark::after { border-color: var(--bg); }

/* ============ TOP BAR ============ */
.st-top {
    height: var(--top-h); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 12px;
    background: linear-gradient(90deg, #043A68 0%, #0664AE 55%, #0B8FD8 100%); color: #fff; position: relative; z-index: 50;
}
.st-top-left, .st-top-right { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.st-top-right { justify-content: flex-end; }
.st-top-center { display: flex; align-items: center; gap: 10px; min-width: 0; }
.st-brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 16px; padding: 0 6px; }
.top-icon { width: 38px; height: 38px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; color: #fff; position: relative; text-decoration: none; }
.top-icon:hover:not(:disabled) { background: rgba(255,255,255,.14); }
.top-btn { height: 38px; padding: 0 14px; border-radius: 9px; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; white-space: nowrap; color: #fff; }
.top-btn:hover { background: rgba(255,255,255,.14); }
.top-btn.ghost { background: rgba(255,255,255,.12); }
.top-btn.ghost:hover { background: rgba(255,255,255,.22); }
.top-btn.primary { background: var(--gold); color: #1B1B23; font-weight: 800; padding: 0 16px; box-shadow: 0 4px 14px -4px rgba(0,0,0,.35); }
.top-btn.primary:hover { background: #FFD84D; }
.top-btn.primary small { font-weight: 600; opacity: .75; }
.top-btn .fa-chevron-down { font-size: 10px; opacity: .8; }
.top-sep { width: 1px; height: 24px; background: rgba(255,255,255,.25); margin: 0 4px; }
.save-state { font-size: 12px; color: rgba(255,255,255,.8); display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; white-space: nowrap; }
.save-state i { font-size: 7px; }
.save-state.unsaved i { color: var(--gold); }
.save-state.saved i { font-size: 12px; }
.design-name { width: 200px; height: 34px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: #fff; font-weight: 600; padding: 0 10px; text-overflow: ellipsis; outline: none; }
.design-name:hover { border-color: rgba(255,255,255,.35); }
.design-name:focus { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.5); }
.product-chip { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border-radius: 10px; background: rgba(0,0,0,.18); max-width: 300px; }
.product-chip:hover { background: rgba(0,0,0,.28); }
.product-chip span { display: flex; flex-direction: column; text-align: left; line-height: 1.15; min-width: 0; }
.product-chip b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-chip small { font-size: 11px; opacity: .75; }
.product-chip .fa-chevron-down { font-size: 10px; opacity: .8; }
.cart-badge { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; border-radius: 9px; background: var(--pink); font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 4px; border: 2px solid #0664AE; }

/* Dropdowns */
.dd { position: relative; }
.dd-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 240px; background: #fff; color: var(--ink); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: none; z-index: 100; border: 1px solid var(--line); }
.dd-menu.right { left: auto; right: 0; }
.dd.open .dd-menu { display: block; animation: pop .15s ease; }
.dd-menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 500; text-align: left; }
.dd-menu button i { width: 16px; color: var(--ink-3); }
.dd-menu button small { margin-left: auto; color: var(--ink-4); font-size: 11.5px; }
.dd-menu button kbd { margin-left: auto; }
.dd-menu button:hover { background: var(--bg); }
.dd-menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.restore-bar { position: absolute; top: calc(var(--top-h) + 10px); left: 50%; transform: translateX(-50%); z-index: 60; background: var(--ink); color: #fff; border-radius: 12px; padding: 8px 8px 8px 16px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); font-size: 13px; white-space: nowrap; }
.restore-bar i { color: var(--gold); }
.restore-bar button { padding: 7px 12px; border-radius: 8px; background: var(--gold); color: #1B1B23; font-weight: 700; font-size: 12.5px; }
.restore-bar button.ghost { background: rgba(255,255,255,.12); color: #fff; }

/* ============ BODY ============ */
.st-body { display: flex; height: calc(100vh - var(--top-h)); height: calc(100dvh - var(--top-h)); }

/* Rail */
.st-rail { width: var(--rail-w); background: var(--rail); display: flex; flex-direction: column; align-items: center; padding: 8px 0; gap: 2px; flex-shrink: 0; overflow-y: auto; z-index: 20; }
.rail-btn { width: 66px; padding: 10px 2px 8px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; color: #A9B2C3; font-size: 10.5px; font-weight: 600; transition: background .15s, color .15s; }
.rail-btn i { font-size: 18px; }
.rail-btn:hover { color: #fff; background: var(--rail-2); }
.rail-btn.active { color: #fff; background: var(--rail-2); }
.rail-btn.active i { color: var(--gold); }

/* Panel */
.st-panel { width: 0; overflow: hidden; background: #fff; border-right: 1px solid var(--line); flex-shrink: 0; display: flex; flex-direction: column; transition: width .25s cubic-bezier(.2,.7,.2,1); z-index: 15; }
body.panel-open .st-panel { width: var(--panel-w); }
.st-panel-head { display: flex; align-items: center; gap: 6px; padding: 12px 12px 8px 16px; min-width: var(--panel-w); }
.st-panel-head h2 { font-size: 16px; font-weight: 800; flex: 1; font-family: 'Manrope', sans-serif; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-3); }
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.st-panel-body { flex: 1; overflow-y: auto; padding: 4px 16px 24px; min-width: var(--panel-w); scrollbar-width: thin; }
.panel-label { font-size: 12px; font-weight: 700; color: var(--ink-2); margin: 18px 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-label small { font-weight: 500; color: var(--ink-4); }
.panel-tip { font-size: 12.5px; color: var(--ink-3); background: var(--bg); border-radius: 8px; padding: 10px 12px; margin: 10px 0; line-height: 1.5; }
.panel-tip i { color: var(--p); margin-right: 4px; }
.panel-tip code { font-size: 11.5px; word-break: break-all; }
.panel-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 10px; color: var(--ink-4); text-align: center; font-size: 13px; }
.panel-empty i { font-size: 28px; }
.panel-search { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 10px; padding: 0 12px; height: 40px; border: 1.5px solid transparent; }
.panel-search:focus-within { border-color: var(--p); background: #fff; }
.panel-search i { color: var(--ink-4); }
.panel-search input { border: 0; background: transparent; outline: none; flex: 1; min-width: 0; height: 100%; }
.panel-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; height: 42px; border-radius: 10px; background: var(--bg); font-weight: 600; margin-bottom: 8px; }
.panel-btn:hover { background: var(--line); }
.panel-btn.primary { background: var(--p); color: #fff; }
.panel-btn.primary:hover { background: var(--p-dark); }
.panel-btn.ghost { background: #fff; border: 1px solid var(--line-2); }
.panel-btn .dot { width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--line-2); }
.link-btn { color: var(--p); font-size: 12px; font-weight: 600; }

/* Templates */
.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tpl-card { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.tpl-img { display: flex; align-items: center; justify-content: center; width: 100%; border-radius: 8px; background: var(--bg); overflow: hidden; border: 1px solid var(--line); transition: box-shadow .15s, transform .15s; color: var(--ink-4); max-height: 220px; }
.tpl-img img { width: 100%; height: 100%; object-fit: contain; }
.tpl-card:hover .tpl-img { box-shadow: 0 0 0 2px var(--p); transform: translateY(-1px); }
.tpl-name { font-size: 12px; font-weight: 600; color: var(--ink-2); }

/* Elements */
.el-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.el-grid.lines { grid-template-columns: repeat(3, 1fr); }
.el-btn { aspect-ratio: 1; border-radius: 10px; background: var(--bg); display: flex; align-items: center; justify-content: center; transition: background .15s, transform .15s; }
.el-grid.lines .el-btn { aspect-ratio: 2.2; }
.el-btn:hover { background: var(--p-soft); transform: translateY(-1px); }
.el-btn svg { width: 58%; height: 58%; fill: #2A3447; stroke: #2A3447; }
.el-grid.lines svg { width: 80%; fill: #2A3447; }
.el-btn.icon i { font-size: 22px; color: #2A3447; }
.frame-ico { width: 44%; aspect-ratio: 1; background: repeating-linear-gradient(45deg, #C3CAD6 0 4px, #D9DEE6 4px 8px); }
.frame-ico.r { border-radius: 8px; } .frame-ico.c { border-radius: 50%; }

/* Text */
.text-add { width: 100%; text-align: left; border-radius: 10px; background: var(--bg); padding: 14px 16px; margin-bottom: 8px; color: var(--ink); }
.text-add:hover { background: var(--line); }
.text-add.h { font-family: 'Montserrat', sans-serif; font-weight: 800; font-size: 24px; }
.text-add.s { font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 17px; }
.text-add.b { font-size: 13px; }
.combo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.combo { background: var(--bg); border-radius: 10px; padding: 16px 8px 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; min-height: 104px; justify-content: center; }
.combo:hover { box-shadow: 0 0 0 2px var(--p); }
.combo b { font-family: 'Montserrat', sans-serif; font-weight: 800; font-size: 17px; line-height: 1.1; }
.combo small { font-size: 11px; color: var(--ink-3); letter-spacing: .06em; }
.combo em { font-style: normal; font-size: 10.5px; color: var(--ink-4); margin-top: 6px; }

/* Uploads */
.upload-drop { border: 2px dashed var(--line-2); border-radius: 12px; padding: 22px 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.upload-drop:hover { border-color: var(--p); background: var(--p-soft); }
.upload-drop i { font-size: 28px; color: var(--p); }
.upload-drop strong { font-size: 14px; }
.upload-drop span { font-size: 12px; color: var(--ink-3); }
.upload-pending { margin-top: 10px; font-size: 13px; color: var(--p); font-weight: 600; }
.up-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.up-item { position: relative; border-radius: 8px; overflow: hidden; background: repeating-conic-gradient(#EEF0F4 0 25%, #fff 0 50%) 0 0/14px 14px; aspect-ratio: 1; border: 1px solid var(--line); }
.up-item img { width: 100%; height: 100%; object-fit: contain; cursor: pointer; }
.up-item:hover { box-shadow: 0 0 0 2px var(--p); }
.up-actions { position: absolute; top: 4px; right: 4px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.up-item:hover .up-actions { opacity: 1; }
.up-actions button { width: 26px; height: 26px; border-radius: 6px; background: rgba(16,24,40,.75); color: #fff; font-size: 11px; }

/* Colours */
.sw-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.sw { aspect-ratio: 1; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(16,24,40,.12); transition: transform .12s; }
.sw:hover { transform: scale(1.12); box-shadow: inset 0 0 0 1px rgba(16,24,40,.12), 0 0 0 2px #fff, 0 0 0 4px var(--p); }
.color-custom { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.color-custom input[type=color], .color-now input[type=color] { width: 40px; height: 40px; border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; background: #fff; cursor: pointer; }
.color-now { display: flex; align-items: center; gap: 8px; margin: 6px 0 12px; }
.color-now input[type=text] { flex: 1; height: 40px; border: 1.5px solid var(--line-2); border-radius: 10px; padding: 0 12px; font-family: ui-monospace, monospace; font-weight: 600; outline: none; min-width: 0; }
.color-now input[type=text]:focus { border-color: var(--p); }
.color-now .icon-btn { width: 40px; height: 40px; border: 1px solid var(--line-2); }

/* Fonts */
.font-list { display: flex; flex-direction: column; gap: 2px; }
.font-item { text-align: left; padding: 9px 12px; border-radius: 8px; font-size: 17px; display: flex; align-items: center; justify-content: space-between; }
.font-item:hover { background: var(--bg); }
.font-item.active { background: var(--p-soft); color: var(--p-dark); }
.font-item i { font-size: 12px; color: var(--p); }

/* Fields */
.field-s { margin-bottom: 12px; flex: 1; }
.field-s label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field-s input[type=text], .field-s select { width: 100%; height: 40px; border: 1.5px solid var(--line-2); border-radius: 10px; padding: 0 12px; outline: none; background: #fff; }
.field-s input:focus, .field-s select:focus { border-color: var(--p); }
.field-s input[type=color] { width: 100%; height: 40px; border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; background: #fff; }
.field-row { display: flex; gap: 10px; }
.range-row { margin-bottom: 14px; }
.range-top { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.range-top output { font-variant-numeric: tabular-nums; color: var(--ink-3); background: var(--bg); padding: 0 8px; border-radius: 6px; min-width: 40px; text-align: center; }
input[type=range] { width: 100%; accent-color: var(--p); }
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; font-weight: 500; cursor: pointer; }
.switch-row input { width: 38px; height: 22px; appearance: none; background: var(--line-2); border-radius: 11px; position: relative; cursor: pointer; transition: background .2s; }
.switch-row input::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch-row input:checked { background: var(--p); }
.switch-row input:checked::after { transform: translateX(16px); }
.btn-grid-2, .btn-grid-3 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.btn-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.btn-grid-2 button, .btn-grid-3 button { height: 38px; border-radius: 8px; background: var(--bg); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; }
.btn-grid-2 button:hover, .btn-grid-3 button:hover { background: var(--line); }
.pos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.pos-grid label { display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: 8px; padding: 0 10px; font-size: 12px; font-weight: 700; color: var(--ink-3); }
.pos-grid input { flex: 1; min-width: 0; height: 36px; border: 0; background: transparent; outline: none; font-weight: 600; color: var(--ink); text-align: right; }
.filter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.filter-grid button { height: 36px; border-radius: 8px; background: var(--bg); font-size: 12.5px; font-weight: 600; }
.filter-grid button.active { background: var(--p); color: #fff; }

/* Layers */
.layer-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.layer { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; border-radius: 8px; background: var(--bg); cursor: grab; border: 1.5px solid transparent; }
.layer.active { border-color: var(--p); background: var(--p-soft); }
.layer.dragging { opacity: .4; }
.l-ico { width: 28px; height: 28px; border-radius: 6px; background: #fff; display: flex; align-items: center; justify-content: center; color: var(--ink-3); font-size: 12px; flex-shrink: 0; }
.l-name { flex: 1; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer button { width: 28px; height: 28px; border-radius: 6px; color: var(--ink-3); font-size: 12px; }
.layer button:hover { background: #fff; color: var(--ink); }

/* ============ STAGE ============ */
.st-stage { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.st-context {
    height: var(--ctx-h); background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 4px; padding: 0 10px;
    overflow-x: auto; overflow-y: visible; scrollbar-width: none; flex-shrink: 0; z-index: 10;
}
.st-context::-webkit-scrollbar { display: none; }
.ctx-group { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.ctx-sep { width: 1px; height: 24px; background: var(--line); margin: 0 6px; flex-shrink: 0; }
.ctx-spacer { flex: 1; min-width: 8px; }
.ctx-hint { font-size: 12.5px; color: var(--ink-3); padding: 0 8px; white-space: nowrap; }
.size-hint i { margin-right: 4px; }
.ctx-btn { height: 36px; min-width: 36px; padding: 0 9px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.ctx-btn:hover { background: var(--bg); color: var(--ink); }
.ctx-btn.on { background: var(--p-soft); color: var(--p); }
.ctx-btn.danger:hover { background: #FEF2F2; color: #D92D20; }
.ctx-btn.primary-soft { background: var(--p-soft); color: var(--p); }
.ctx-btn .aa { font-weight: 800; font-size: 13px; }
.font-btn { border: 1px solid var(--line-2); min-width: 150px; max-width: 190px; justify-content: space-between; font-size: 14px; font-weight: 500; }
.font-btn span { overflow: hidden; text-overflow: ellipsis; }
.font-btn i { font-size: 10px; color: var(--ink-4); }
.swatch { width: 24px; height: 24px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(16,24,40,.15); display: block; }
.swatch.ring { background: transparent !important; border: 4px solid; box-shadow: none; }
.t-swatch { display: flex; flex-direction: column; align-items: center; font-weight: 800; font-size: 15px; line-height: 1; font-family: 'Manrope', sans-serif; }
.t-swatch span { width: 20px; height: 5px; border-radius: 2px; margin-top: 2px; box-shadow: inset 0 0 0 1px rgba(16,24,40,.15); }
.num-stepper { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 8px; height: 36px; margin: 0 4px; overflow: hidden; }
.num-stepper button { width: 28px; height: 100%; font-size: 10px; color: var(--ink-3); }
.num-stepper button:hover { background: var(--bg); color: var(--ink); }
.num-stepper input { width: 46px; height: 100%; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; font-weight: 600; outline: none; -moz-appearance: textfield; }
.num-stepper input::-webkit-outer-spin-button, .num-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.ctx-pop-wrap { position: relative; }
.ctx-pop { position: fixed; margin-top: 8px; width: 250px; background: #fff; border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--line); padding: 14px 14px 2px; display: none; z-index: 200; }
.ctx-pop.open { display: block; animation: pop .15s ease; }

.st-workspace { flex: 1; overflow: auto; position: relative; background: var(--bg); background-image: radial-gradient(#D5DAE2 1px, transparent 1px); background-size: 22px 22px; }
.st-workspace.drop::after { content: 'Drop images to upload'; position: absolute; inset: 12px; border: 3px dashed var(--p); border-radius: 16px; background: rgba(6,100,174,.06); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; color: var(--p); pointer-events: none; z-index: 5; }
.st-stage-inner { min-width: 100%; min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 40px; width: max-content; height: max-content; }
.st-canvas-holder { position: relative; box-shadow: 0 1px 2px rgba(16,24,40,.08), 0 18px 40px -16px rgba(16,24,40,.35); flex-shrink: 0; background: #fff; }
.st-overlay { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 3; overflow: visible; }
.canvas-container { z-index: 2; }

.st-bottom { height: var(--bottom-h); background: #fff; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 12px; gap: 12px; flex-shrink: 0; }
.pages { display: flex; align-items: center; gap: 8px; }
.page-thumb { display: flex; align-items: center; gap: 8px; height: 46px; padding: 4px 12px 4px 4px; border-radius: 10px; border: 1.5px solid var(--line); font-size: 12.5px; font-weight: 700; color: var(--ink-3); }
.page-thumb img { height: 36px; width: 54px; object-fit: contain; border-radius: 4px; background: var(--bg); }
.page-thumb img:not([src]) { visibility: hidden; }
.page-thumb.active { border-color: var(--p); color: var(--p); box-shadow: 0 0 0 1px var(--p); }
.mini-btn { height: 34px; min-width: 34px; padding: 0 10px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.mini-btn:hover { background: var(--bg); color: var(--ink); }
.mini-btn.on { color: var(--p); background: var(--p-soft); }
.bottom-tools { display: flex; align-items: center; gap: 4px; }
.zoom { display: flex; align-items: center; background: var(--bg); border-radius: 10px; margin-left: 6px; }
.zoom button { height: 34px; min-width: 34px; padding: 0 8px; border-radius: 10px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.zoom button:hover { background: var(--line); }
#stZoomLabel { min-width: 42px; display: inline-block; }

/* Context menu */
.st-menu { position: fixed; z-index: 500; width: 230px; background: #fff; border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--line); padding: 6px; }
.st-menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: 13px; text-align: left; }
.st-menu button i { width: 16px; color: var(--ink-3); }
.st-menu button kbd { margin-left: auto; font-size: 10px; }
.st-menu button:hover:not(:disabled) { background: var(--bg); }
.st-menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }

/* Toasts */
.st-toasts { position: fixed; bottom: calc(var(--bottom-h) + 16px); left: 50%; transform: translateX(-50%); z-index: 9000; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.st-toast { background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow); animation: toastIn .25s ease; transition: opacity .3s, transform .3s; max-width: 90vw; }
.st-toast.success { background: #067647; }
.st-toast.error { background: #B42318; }
.st-toast.warning { background: #93370D; }
.st-toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ============ MODALS ============ */
.st-modal { position: fixed; inset: 0; background: rgba(16,24,40,.6); backdrop-filter: blur(3px); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 20px; }
.st-modal.open { display: flex; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card { background: #fff; border-radius: 18px; width: 100%; max-width: 460px; max-height: calc(100vh - 40px); overflow-y: auto; padding: 26px; position: relative; box-shadow: 0 30px 60px -20px rgba(0,0,0,.45); animation: rise .25s cubic-bezier(.2,.7,.2,1); }
.modal-card.wide { max-width: 940px; }
.modal-card.tall { height: calc(100vh - 40px); display: flex; flex-direction: column; overflow: hidden; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-card h3 { font-family: 'Manrope', sans-serif; font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.modal-x { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%; background: var(--bg); color: var(--ink-3); z-index: 2; }
.modal-x:hover { background: var(--line); color: var(--ink); }
.modal-card p { color: var(--ink-3); line-height: 1.55; }
.modal-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--p-soft); color: var(--p); display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 14px; }
.modal-icon.ok { background: #ECFDF3; color: #12A150; border-radius: 50%; margin: 0 auto 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.mbtn { height: 42px; padding: 0 18px; border-radius: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--bg); color: var(--ink); text-decoration: none; font-size: 14px; }
.mbtn:hover { background: var(--line); }
.mbtn.primary { background: var(--p); color: #fff; }
.mbtn.primary:hover { background: var(--p-dark); }
.mbtn.block { width: 100%; height: 48px; font-size: 15px; }
.mlabel { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin: 14px 0 8px; }
.minput { width: 100%; height: 42px; border: 1.5px solid var(--line-2); border-radius: 10px; padding: 0 12px; outline: none; background: #fff; }
.minput:focus { border-color: var(--p); box-shadow: 0 0 0 4px rgba(6,100,174,.12); }
.mnote { font-size: 12.5px; color: var(--ink-3); margin-top: 8px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--ink-2); margin: 14px 0; cursor: pointer; line-height: 1.4; }
.check input { width: 17px; height: 17px; margin-top: 1px; accent-color: var(--p); flex-shrink: 0; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* Preview */
.pv-host { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; margin-top: 18px; padding: 24px; background: var(--bg); border-radius: 14px; min-height: 200px; }
.pv-loading { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-weight: 600; margin: auto; }
.pv-item { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pv-item figcaption { font-size: 12px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .1em; }
.pv-flat { max-width: min(400px, 80vw); max-height: 50vh; box-shadow: 0 20px 40px -14px rgba(16,24,40,.45); border-radius: 3px; background: #fff; }
.pv-flat.round { border-radius: 50%; }
.mk-tee { position: relative; width: 320px; }
.mk-tee svg { width: 100%; display: block; filter: drop-shadow(0 16px 24px rgba(16,24,40,.2)); }
.mk-tee img { position: absolute; left: 30%; top: 24%; width: 40%; }
.mk-mug { position: relative; display: flex; align-items: center; }
.mug-body { width: 300px; height: 230px; background: #fff; border-radius: 10px 10px 40px 40px; overflow: hidden; box-shadow: inset -30px 0 40px -20px rgba(0,0,0,.12), 0 18px 30px -12px rgba(16,24,40,.35); display: flex; align-items: center; justify-content: center; }
.mug-body img { width: 165%; max-width: none; margin-left: 30%; }
.mug-handle { width: 70px; height: 120px; border: 18px solid #fff; border-left: 0; border-radius: 0 60px 60px 0; box-shadow: 6px 6px 14px -6px rgba(16,24,40,.3); }

/* Order */
.order-grid { display: grid; grid-template-columns: 1fr 380px; gap: 28px; }
.order-previews { background: var(--bg); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; min-height: 300px; }
.order-previews figure { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.order-previews img { max-width: 100%; max-height: 260px; box-shadow: 0 14px 30px -12px rgba(16,24,40,.4); background: #fff; }
.order-previews img.round { border-radius: 50%; }
.order-previews figcaption { font-size: 11px; font-weight: 700; color: var(--ink-3); letter-spacing: .1em; text-transform: uppercase; }
.o-group { margin-top: 4px; }
.o-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; gap: 4px; padding: 8px 12px; border-radius: 9px; border: 1.5px solid var(--line-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.chip span small { color: var(--ink-4); font-weight: 500; }
.chip input:checked + span { border-color: var(--p); background: var(--p-soft); color: var(--p-dark); }
.qchip { padding: 8px 12px; border-radius: 9px; border: 1.5px solid var(--line-2); font-weight: 700; font-size: 13px; }
.qchip.on { border-color: var(--p); background: var(--p-soft); color: var(--p-dark); }
.qinput { width: 100px; height: 38px; }
.o-price { background: var(--bg); border-radius: 12px; padding: 14px 16px; margin-top: 16px; display: grid; gap: 6px; }
.o-price > div { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--ink-3); }
.o-price .total b { font-family: 'Manrope', sans-serif; font-size: 26px; color: var(--ink); }
.o-price .save { color: #067647; font-weight: 600; font-size: 12.5px; }
.order-done { text-align: center; padding: 20px 10px; }
.order-done .modal-actions { justify-content: center; }

/* Product picker */
.pp-head { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.pp-head p { margin-bottom: 14px; }
.pp-list { flex: 1; overflow-y: auto; padding-top: 6px; }
.pp-cat h4 { font-size: 13px; font-weight: 800; margin: 18px 0 10px; color: var(--ink-2); }
.pp-cat h4 i { color: var(--p); margin-right: 6px; }
.pp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.pp-item { border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; transition: border-color .15s, box-shadow .15s; }
.pp-item:hover { border-color: var(--p); box-shadow: 0 6px 16px -8px rgba(6,100,174,.4); }
.pp-item.current { border-color: var(--p); background: var(--p-soft); }
.pp-shape { width: 100%; height: 56px; background: var(--bg); border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.pp-shape i { display: block; background: #fff; box-shadow: 0 3px 8px -2px rgba(16,24,40,.25); border-radius: 2px; }
.pp-name { font-size: 13px; font-weight: 700; line-height: 1.3; }
.pp-item small { font-size: 11.5px; color: var(--ink-3); }

.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin-top: 16px; }
.keys div { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.keys span { margin-left: 6px; color: var(--ink-3); }

/* ============ RESPONSIVE ============ */
@media (max-width: 1280px) {
    .hide-md { display: none; }
    .design-name { width: 150px; }
}
@media (max-width: 1060px) {
    .design-name { display: none; }
    .save-state { display: none; }
}
@media (max-width: 899px) {
    :root { --top-h: 54px; --ctx-h: 50px; --bottom-h: 56px; --rail-h: 62px; }
    .hide-sm { display: none !important; }
    .st-top { padding: 0 6px; gap: 4px; }
    .st-brand span:not(.logo-mark) { display: none; }
    .product-chip { max-width: 44vw; padding: 0 10px; }
    .top-btn.primary { padding: 0 12px; }
    .st-body { flex-direction: column; height: calc(100dvh - var(--top-h)); }
    .st-rail { order: 3; width: 100%; height: var(--rail-h); flex-direction: row; justify-content: space-around; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); overflow-x: auto; overflow-y: hidden; gap: 0; }
    .rail-btn { width: auto; min-width: 58px; padding: 6px 4px; font-size: 10px; gap: 4px; }
    .rail-btn i { font-size: 17px; }
    .st-panel { position: fixed; left: 0; right: 0; bottom: var(--rail-h); width: 100% !important; height: 0; border-right: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; box-shadow: 0 -16px 40px -12px rgba(16,24,40,.3); transition: height .25s cubic-bezier(.2,.7,.2,1); z-index: 40; }
    body.panel-open .st-panel { height: 52vh; }
    .st-panel-head, .st-panel-body { min-width: 0; }
    .st-stage { order: 1; flex: 1; min-height: 0; }
    .st-stage-inner { padding: 14px; }
    .st-bottom { padding: 0 8px; gap: 6px; overflow-x: auto; scrollbar-width: none; }
    .page-thumb { height: 38px; padding: 0 12px; }
    .page-thumb img { display: none; }
    .bottom-tools .mini-btn span { display: none; }
    .bottom-tools [data-guide="grid"], .bottom-tools [data-guide="snap"], #btnCopyToBack { display: none; }
    .st-brand, .cart-link, .st-top-right .top-btn.ghost { display: none; }
    .top-btn { padding: 0 10px; }
    .dd > .top-btn span { display: none; }
    .product-chip small { display: none; }
    .order-grid { grid-template-columns: 1fr; }
    .order-previews { min-height: 160px; padding: 14px; }
    .modal-card { padding: 20px; border-radius: 16px; }
    .st-modal { padding: 10px; align-items: flex-end; }
    .modal-card.tall { height: calc(100dvh - 20px); }
    .keys { grid-template-columns: 1fr; }
    .restore-bar { left: 10px; right: 10px; transform: none; white-space: normal; }
    .st-toasts { bottom: calc(var(--rail-h) + var(--bottom-h) + 12px); }
}
