:root {
  --red: #E11D48;
  --red-hover: #BE123C;
  --red-soft: #FFE4E8;
  --ink: #111111;
  --ink-2: #5C5C5C;
  --ink-3: #8C8C8C;
  --line: #EAEAEA;
  --line-2: #D9D9D9;
  --fill: #EFEFEF;
  --fill-2: #F6F6F6;
  --panel: #FFFFFF;
  --stage: #EDECEA;
  --blue: #0B6BDE;
  --r: 12px;
  --pill: 999px;
  --font: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 13px/1.4 var(--font); color: var(--ink); background: var(--stage); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.i { display: block; flex: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
[hidden] { display: none !important; }

/* ── top bar ── */
.top { height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); position: relative; z-index: 6; }
.brand { display: flex; align-items: center; gap: 9px; flex: none; padding-right: 6px; }
.brand .mark svg { display: block; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.tpl-chip { display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: var(--pill); background: var(--fill); font-weight: 600; white-space: nowrap; flex: none; max-width: 260px; }
.tpl-chip:hover { background: #E4E4E4; }
.tpl-chip b { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; }
.tpl-chip span { overflow: hidden; text-overflow: ellipsis; }
.tpl-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: #F59E0B; flex: none; }
.hist, .zoom { display: flex; align-items: center; gap: 2px; }
.ibtn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--ink); flex: none; }
.ibtn:hover { background: var(--fill); }
.ibtn:disabled { color: #C4C4C4; background: none; cursor: default; }
.ibtn.sm { width: 28px; height: 28px; border-radius: 8px; }
.title-field { flex: 1; min-width: 120px; }
.title-field input { width: 100%; height: 38px; border: 1px solid transparent; background: var(--fill-2); border-radius: var(--pill); padding: 0 16px; font-weight: 500; font-size: 14px; outline: none; }
.title-field input:hover { border-color: var(--line-2); }
.title-field input:focus { background: #fff; border-color: var(--ink); }
.zoom-val { min-width: 50px; height: 34px; border-radius: 10px; font-weight: 600; font-variant-numeric: tabular-nums; }
.zoom-val:hover { background: var(--fill); }
.btn { height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 16px; border-radius: var(--pill); font-weight: 600; background: var(--fill); white-space: nowrap; flex: none; }
.btn:hover { background: #E2E2E2; }
.btn.primary { background: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-hover); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.dark:hover { background: #333; }
.btn.ghost { background: none; border: 1px solid var(--line-2); }
.btn.ghost:hover { background: var(--fill-2); }
.btn.block { width: 100%; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 12.5px; }
.btn.danger { color: var(--red); }
.btn.attn { background: var(--ink); color: #fff; }
.split { display: flex; gap: 2px; flex: none; }
.split .btn:first-child { border-radius: var(--pill) 6px 6px var(--pill); padding-right: 14px; }
.split-more { width: 34px; padding: 0 !important; border-radius: 6px var(--pill) var(--pill) 6px !important; }

/* ── layout ── */
.app { display: grid; grid-template-columns: 72px auto 1fr 320px; height: calc(100% - 56px); }
.rail { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; padding: 10px 6px; }
.rail button { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 9px 0 8px; border-radius: 12px; font-size: 11px; font-weight: 600; color: var(--ink-2); }
.rail button:hover { background: var(--fill-2); color: var(--ink); }
.rail button.on { background: var(--ink); color: #fff; }
.drawer { width: 296px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.drawer.closed { display: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; height: 52px; padding: 0 10px 0 16px; flex: none; }
.drawer-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.drawer-body { flex: 1; overflow-y: auto; padding: 2px 14px 16px; scrollbar-width: thin; }
.panel { background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }

/* ── stage ── */
.stage { position: relative; overflow: auto; display: grid; min-width: 0; }
.canvas-wrap { margin: auto; padding: 72px 40px 40px; }
#pin { display: block; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 10px 30px rgba(0,0,0,.10); touch-action: none; background: #fff; }
.drop-hint { position: absolute; inset: 12px; border: 2px dashed var(--ink); border-radius: 16px; display: none; align-items: center; justify-content: center; gap: 8px; font-weight: 600; font-size: 14px; background: rgba(255,255,255,.5); pointer-events: none; }
.stage.dragging .drop-hint { display: flex; }
.stage-hint { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: rgba(17,17,17,.88); color: #fff; padding: 7px 13px; border-radius: var(--pill); font-size: 12px; font-weight: 500; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 20; }
.stage-hint.show { opacity: 1; }

/* contextual toolbar */
.ctxbar { position: sticky; top: 12px; justify-self: center; align-self: start; grid-area: 1 / 1; z-index: 4; display: flex; align-items: center; gap: 2px; background: #fff; border-radius: 14px; padding: 5px; box-shadow: 0 0 0 1px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.10); max-width: calc(100% - 24px); overflow-x: auto; scrollbar-width: none; }
.canvas-wrap { grid-area: 1 / 1; }
.tb { height: 34px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; border-radius: 9px; font-weight: 600; font-size: 12.5px; white-space: nowrap; color: var(--ink); flex: none; }
.tb:hover { background: var(--fill); }
.tb.on { background: var(--ink); color: #fff; }
.tb.icon { width: 34px; padding: 0; justify-content: center; }
.tb .chip { width: 20px; height: 20px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.tb.font { min-width: 132px; justify-content: space-between; font-size: 14px; font-weight: 500; border: 1px solid var(--line-2); }
.tb.font span { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.tb.danger:hover { color: var(--red); background: var(--red-soft); }
.tsep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; flex: none; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 9px; height: 34px; flex: none; }
.stepper button { width: 28px; height: 32px; display: grid; place-items: center; color: var(--ink-2); border-radius: 8px; }
.stepper button:hover { color: var(--ink); background: var(--fill-2); }
.stepper input { width: 40px; border: 0; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; outline: none; background: none; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { display: none; }
.mini-seg { display: flex; background: var(--fill); border-radius: 9px; padding: 2px; flex: none; }
.mini-seg button { height: 30px; padding: 0 10px; border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 5px; }
.mini-seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.14); }

.inline-edit { position: fixed; z-index: 30; resize: none; border: 2px solid var(--blue); border-radius: 10px; background: rgba(255,255,255,.97); box-shadow: 0 8px 28px rgba(0,0,0,.18); padding: 10px 12px; font: 500 15px/1.4 var(--font); outline: none; min-height: 64px; }

/* ── drawers ── */
.search { position: relative; margin-bottom: 12px; }
.search .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search input { width: 100%; height: 38px; border-radius: var(--pill); border: 1px solid var(--line-2); padding: 0 12px 0 34px; outline: none; background: #fff; }
.search input:focus { border-color: var(--ink); }
.sec-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 16px 0 8px; display: flex; justify-content: space-between; align-items: center; }
.sec-title:first-child { margin-top: 4px; }
.tgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tcard { position: relative; border-radius: var(--r); padding: 6px; border: 1.5px solid transparent; cursor: pointer; }
.tcard:hover { background: var(--fill-2); }
.tcard.on { border-color: var(--ink); background: var(--fill-2); }
.tcard .thumb { position: relative; border-radius: 8px; overflow: hidden; background: var(--fill); display: flex; align-items: flex-start; justify-content: center; height: 200px; }
.tcard canvas { display: block; max-width: 100%; max-height: 100%; }
.tcard .num { position: absolute; top: 6px; left: 6px; background: rgba(255,255,255,.96); border-radius: 6px; padding: 1px 6px; font-weight: 700; font-size: 11px; font-variant-numeric: tabular-nums; }
.tcard .badge { position: absolute; bottom: 6px; left: 6px; background: var(--ink); color: #fff; border-radius: 6px; padding: 1px 6px; font-weight: 600; font-size: 10.5px; }
.tcard .more { position: absolute; top: 9px; right: 9px; width: 28px; height: 28px; border-radius: 8px; background: rgba(255,255,255,.96); display: grid; place-items: center; opacity: 0; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.tcard:hover .more, .tcard .more:focus-visible { opacity: 1; }
.tcard .tname { display: block; margin-top: 6px; font-weight: 600; font-size: 12px; line-height: 1.25; }
.tcard .tsize { display: block; color: var(--ink-3); font-size: 11px; margin-top: 1px; }
.blank-card .thumb { align-items: center; flex-direction: column; gap: 6px; color: var(--ink-2); font-weight: 600; border: 1.5px dashed var(--line-2); background: #fff; }
.drawer-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 16px; }
.note { margin-top: 12px; padding: 10px 12px; background: var(--fill-2); border-radius: 10px; color: var(--ink-2); font-size: 12px; line-height: 1.45; }

.el-text { display: grid; gap: 6px; }
.el-text button { text-align: left; padding: 10px 12px; border-radius: 10px; background: var(--fill-2); line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.el-text button:hover { background: var(--fill); }
.el-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.el-grid button { aspect-ratio: 1; border-radius: 10px; background: var(--fill-2); display: grid; place-items: center; padding: 12px; }
.el-grid button:hover { background: var(--fill); }
.el-grid svg { width: 100%; height: 100%; display: block; }
.el-grid .lbl { font-size: 10.5px; font-weight: 600; color: var(--ink-2); }
.el-frames button { display: flex; flex-direction: column; gap: 6px; padding: 10px 8px 8px; aspect-ratio: auto; }

.upload-zone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 12px; border: 1.5px dashed var(--line-2); border-radius: 12px; color: var(--ink-2); text-align: center; width: 100%; }
.upload-zone:hover { border-color: var(--ink); color: var(--ink); background: var(--fill-2); }
.upload-zone b { color: var(--ink); font-size: 13px; }
.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.ph { position: relative; border-radius: 10px; overflow: hidden; background: var(--fill); aspect-ratio: 3 / 4; cursor: grab; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph:hover { outline: 2px solid var(--ink); outline-offset: -2px; }
.ph .x { position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; border-radius: 7px; background: rgba(255,255,255,.95); display: grid; place-items: center; opacity: 0; }
.ph:hover .x { opacity: 1; }
.ph .x:hover { color: var(--red); }

.roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.role { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 10px; border: 1px solid var(--line); text-align: left; min-width: 0; }
.role:hover { border-color: var(--line-2); background: var(--fill-2); }
.role .chip { width: 24px; height: 24px; border-radius: 7px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.role span { font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.schemes { display: grid; gap: 8px; }
.scheme { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; border: 1.5px solid var(--line); text-align: left; }
.scheme:hover { background: var(--fill-2); }
.scheme.on { border-color: var(--ink); }
.strip { display: flex; height: 30px; width: 100px; border-radius: 7px; overflow: hidden; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.strip i { flex: 1; }
.scheme b { font-weight: 600; font-size: 12.5px; }

.layer { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 4px 0 6px; border-radius: 10px; cursor: pointer; }
.layer:hover { background: var(--fill-2); }
.layer.on { background: var(--ink); color: #fff; }
.layer.drop-above { box-shadow: inset 0 2px 0 var(--blue); }
.layer.drop-below { box-shadow: inset 0 -2px 0 var(--blue); }
.layer .grip { color: var(--ink-3); cursor: grab; }
.layer .lico { width: 26px; height: 26px; border-radius: 7px; background: var(--fill); display: grid; place-items: center; flex: none; color: var(--ink-2); }
.layer.on .lico { background: #333; color: #fff; }
.layer .lname { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.layer .ibtn { width: 28px; height: 28px; color: inherit; opacity: .5; border-radius: 7px; }
.layer .ibtn:hover { opacity: 1; background: rgba(127,127,127,.18); }
.layer.off .lname, .layer.off .lico { opacity: .4; }

/* ── properties panel ── */
.p-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px; border-bottom: 1px solid var(--line); flex: none; }
.p-head .kind { width: 32px; height: 32px; border-radius: 9px; background: var(--fill); display: grid; place-items: center; flex: none; }
.p-head input { flex: 1; min-width: 0; height: 32px; border: 1px solid transparent; border-radius: 8px; padding: 0 8px; font-weight: 600; font-size: 14px; outline: none; background: none; }
.p-head input:hover { border-color: var(--line); }
.p-head input:focus { border-color: var(--ink); }
.p-head h2 { margin: 0; font-size: 15px; font-weight: 700; flex: 1; padding-left: 4px; }
.p-tabs { display: flex; gap: 4px; padding: 10px 12px 0; flex: none; }
.p-tabs button { flex: 1; height: 34px; border-radius: 10px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; justify-content: center; gap: 6px; }
.p-tabs button:hover { background: var(--fill-2); color: var(--ink); }
.p-tabs button.on { background: var(--fill); color: var(--ink); }
.p-body { flex: 1; overflow-y: auto; padding: 6px 16px 20px; scrollbar-width: thin; }
.sec { padding: 12px 0; border-bottom: 1px solid var(--line); display: grid; gap: 12px; }
.sec:last-child { border-bottom: 0; }
.sec > h3 { margin: 0; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; }
.f { display: grid; gap: 6px; }
.f-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.f-top label, .f-top .lbl { font-size: 12px; color: var(--ink-2); font-weight: 500; }
.f-top .val { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); background: var(--fill-2); border-radius: 6px; padding: 1px 6px; min-width: 34px; text-align: center; border: 0; width: 52px; outline: none; }
.f-top .val:focus { box-shadow: 0 0 0 1.5px var(--ink); background: #fff; }
.f-top .reset { font-size: 11px; color: var(--ink-3); font-weight: 600; }
.f-top .reset:hover { color: var(--ink); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; }
.toggle-row span { font-weight: 600; font-size: 12.5px; }
.toggle-row small { display: block; color: var(--ink-3); font-size: 11.5px; font-weight: 400; }
textarea.txt { width: 100%; min-height: 92px; resize: vertical; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 11px; outline: none; font-size: 14px; line-height: 1.45; background: #fff; }
textarea.txt:focus, .in:focus { border-color: var(--ink); }
.hint { color: var(--ink-3); font-size: 11.5px; line-height: 1.45; }
.hint code { background: var(--fill); padding: 0 4px; border-radius: 4px; font-size: 11px; color: var(--ink); }
.in { height: 36px; border: 1px solid var(--line-2); border-radius: 10px; padding: 0 10px; outline: none; background: #fff; min-width: 0; width: 100%; }
select.in { appearance: none; padding-right: 28px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; }
input[type=range] { width: 100%; accent-color: var(--ink); height: 20px; margin: 0; cursor: pointer; }
.seg { display: flex; background: var(--fill); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { flex: 1; height: 30px; min-width: 30px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 0 6px; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.14); }
.cfield { height: 36px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line-2); border-radius: 10px; padding: 0 10px 0 5px; min-width: 0; width: 100%; background: #fff; text-align: left; }
.cfield:hover { border-color: #BDBDBD; }
.cfield .chip { width: 26px; height: 26px; border-radius: 7px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.14); flex: none; }
.cfield .chip.none { background: repeating-linear-gradient(45deg, #fff 0 4px, #eee 4px 8px) !important; }
.cfield span { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.cfield em { font-style: normal; color: var(--ink-3); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.fontfield { height: 40px; width: 100%; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line-2); border-radius: 10px; padding: 0 10px 0 12px; font-size: 17px; background: #fff; min-width: 0; }
.fontfield:hover { border-color: #BDBDBD; }
.fontfield span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switch { position: relative; width: 36px; height: 22px; border-radius: 11px; background: #CFCFCF; flex: none; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch.on { background: var(--ink); }
.switch.on::after { transform: translateX(14px); }
.sub { display: grid; gap: 12px; padding: 12px; background: var(--fill-2); border-radius: 12px; }
.xywh { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.xywh label { display: flex; align-items: center; gap: 6px; height: 36px; border: 1px solid var(--line-2); border-radius: 10px; padding: 0 10px; color: var(--ink-3); font-size: 11.5px; font-weight: 700; background: #fff; }
.xywh label:focus-within { border-color: var(--ink); }
.xywh input { border: 0; outline: none; width: 100%; min-width: 0; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); font-size: 13px; background: none; }
.abtns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.abtns button { height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 10px; background: var(--fill-2); font-weight: 600; font-size: 12.5px; }
.abtns button:hover { background: var(--fill); }
.abtns button.danger:hover { background: var(--red-soft); color: var(--red); }
.align6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.align6 button { height: 36px; border-radius: 9px; background: var(--fill-2); display: grid; place-items: center; }
.align6 button:hover { background: var(--fill); }
.filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.filters button { display: grid; gap: 5px; font-size: 11px; font-weight: 600; color: var(--ink-2); text-align: center; }
.filters canvas, .filters .fph { width: 100%; aspect-ratio: 1; border-radius: 9px; display: block; background: var(--fill); object-fit: cover; outline: 2px solid transparent; outline-offset: 1px; }
.filters button.on canvas, .filters button.on .fph { outline-color: var(--ink); }
.filters button.on { color: var(--ink); }
.shape-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.shape-pick button { height: 52px; border-radius: 10px; background: var(--fill-2); display: grid; place-items: center; border: 1.5px solid transparent; }
.shape-pick button.on { border-color: var(--ink); background: #fff; }
.shape-pick svg { width: 26px; height: 26px; }
.empty-sel { padding: 14px 0 4px; }
.field { display: grid; gap: 6px; }
.field > label { font-weight: 600; font-size: 12px; display: flex; justify-content: space-between; }
.field > label em { font-style: normal; font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.field textarea.in { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; line-height: 1.4; }
.filename { display: flex; align-items: center; gap: 6px; padding: 9px 10px; border-radius: 10px; background: var(--fill-2); font-size: 12px; color: var(--ink-2); word-break: break-all; }
.tpl-box { display: flex; gap: 10px; align-items: center; }
.tpl-box canvas { border-radius: 6px; box-shadow: 0 0 0 1px var(--line); flex: none; }
.tpl-box b { display: block; font-size: 13px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-2); margin-top: 3px; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: #22A06B; }
.status.dirty i { background: #F59E0B; }
.kbd { display: grid; grid-template-columns: 1fr auto; gap: 7px 10px; font-size: 12px; color: var(--ink-2); }
.kbd kbd { font: 600 11px var(--font); background: var(--fill); border-radius: 5px; padding: 2px 6px; color: var(--ink); justify-self: end; }

/* ── popovers / modal ── */
.pop { position: fixed; z-index: 50; background: #fff; border-radius: 14px; box-shadow: 0 0 0 1px rgba(0,0,0,.06), 0 12px 32px rgba(0,0,0,.16); padding: 12px; width: 268px; max-height: calc(100vh - 24px); overflow: auto; }
.pop .sec-title { margin-top: 2px; }
.menu { display: grid; gap: 2px; margin: -4px; }
.menu button { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border-radius: 9px; font-weight: 500; text-align: left; }
.menu button:hover { background: var(--fill-2); }
.menu button small { margin-left: auto; color: var(--ink-3); font-size: 11.5px; }
.menu button.danger { color: var(--red); }
.menu hr { border: 0; height: 1px; background: var(--line); margin: 4px 6px; }
.sw-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin-bottom: 12px; }
.sw { aspect-ratio: 1; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.14); position: relative; width: 100%; }
.sw:hover { transform: scale(1.06); }
.sw.on::after { content: ''; position: absolute; inset: -3px; border: 2px solid var(--ink); border-radius: 10px; }
.sw-label { display: block; font-size: 9.5px; text-align: center; color: var(--ink-3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-row { display: flex; gap: 6px; align-items: center; }
.pick-row input[type=color] { width: 40px; height: 36px; border: 1px solid var(--line-2); border-radius: 9px; padding: 2px; background: #fff; cursor: pointer; flex: none; }
.pick-row .in { font-variant-numeric: tabular-nums; text-transform: uppercase; }
.font-list { display: grid; gap: 1px; max-height: 380px; overflow: auto; margin: 0 -6px; padding: 0 6px; }
.font-item { display: flex; align-items: center; justify-content: space-between; height: 40px; padding: 0 10px; border-radius: 8px; font-size: 19px; text-align: left; white-space: nowrap; }
.font-item:hover { background: var(--fill-2); }
.font-item.on { background: var(--fill); }
.font-cat { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 10px 10px 4px; font-family: var(--font); }
.modal-bg { position: fixed; inset: 0; z-index: 70; background: rgba(17,17,17,.38); display: grid; place-items: center; padding: 16px; }
.modal { width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 20px; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.modal h3 { margin: 0 0 6px; font-size: 17px; }
.modal p { margin: 0 0 14px; color: var(--ink-2); line-height: 1.5; }
.modal .in { margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--pill); font-weight: 500; opacity: 0; pointer-events: none; transition: all .2s; z-index: 80; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1280px) {
  .brand-name { display: none; }
  .app { grid-template-columns: 68px auto 1fr 296px; }
  .drawer { width: 264px; }
  #saveTplBtn span:last-child { display: none; }
}
@media (max-width: 960px) {
  body { overflow: auto; }
  .top { flex-wrap: wrap; height: auto; padding: 8px 16px; }
  .title-field { order: 9; flex-basis: 100%; }
  .zoom, .tpl-chip { display: none; }
  .app { display: flex; flex-direction: column; height: auto; }
  .rail { flex-direction: row; border: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .rail button { flex: 1; min-width: 64px; }
  .drawer { width: auto; border: 0; max-height: 60vh; }
  .stage { min-height: 75vh; }
  .panel { border: 0; border-top: 1px solid var(--line); }
  .p-body { overflow: visible; }
}
