/* makemystickers.app — shared stylesheet */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: #edeae4; color: #1a1a1a; min-height: 100vh; }
.app { display: grid; grid-template-columns: clamp(460px, 30vw, 510px) minmax(0,1fr) 210px; min-height: 100vh; }
.ad-side { background: #edeae4; display: flex; flex-direction: column; align-items: center; padding: 1.25rem 0.5rem; gap: .9rem; }
.supplies-card { width: 194px; background: #fff; border: 1px solid #d8d4ce; border-radius: 8px; padding: .72rem; box-shadow: 0 2px 16px rgba(0,0,0,.06); flex-shrink: 0; }
.supplies-card .sl { margin-bottom: .5rem; }
.layout-card { width: 194px; background: #fff; border: 1px solid #d8d4ce; border-radius: 8px; padding: .72rem; box-shadow: 0 2px 16px rgba(0,0,0,.06); flex-shrink: 0; }
.layout-card .sl { margin-bottom: .55rem; color: #888; }
.layout-list { display: flex; flex-direction: column; gap: 1px; }
.layout-link { display: block; color: #555; text-decoration: none; font-size: 11px; line-height: 1.2; padding: 3px 7px; border-radius: 4px; border: 1px solid transparent; transition: background .15s, border-color .15s, color .15s; }
.layout-link:hover { background: #faf7f1; border-color: #ede9e1; color: #c47a4a; }
.layout-link-name { display: block; font-weight: 600; }
.layout-link-meta { display: none; }
.supplies-list { display: flex; flex-direction: column; gap: 5px; }
.supply { display: flex; align-items: center; gap: 7px; color: #1a1a1a; text-decoration: none; background: #f6f3ee; border: 1px solid #e3ded6; border-radius: 6px; padding: 5px 6px; transition: border-color .15s, background .15s; min-height: 44px; }
.supply[href]:hover { background: #fffaf4; border-color: #e8a87c; }
.supply-thumb { width: 34px; height: 34px; border-radius: 5px; border: 1px solid #ddd4c8; background: #fff; position: relative; flex: 0 0 34px; overflow: hidden; }
.supply-thumb::before, .supply-thumb::after { content: ""; position: absolute; display: block; }
.thumb-paper::before { inset: 6px 8px 5px; background: #fff; border: 1px solid #d5d5d5; box-shadow: 3px 3px 0 #f1efe9; }
.thumb-paper::after { left: 11px; right: 11px; top: 12px; height: 2px; background: #e8a87c; box-shadow: 0 5px 0 #84a59d, 0 10px 0 #d8d4ce; }
.thumb-scissors::before { width: 17px; height: 2px; background: #777; left: 11px; top: 17px; transform: rotate(-28deg); box-shadow: 0 0 0 1px #777; }
.thumb-scissors::after { width: 17px; height: 2px; background: #777; left: 11px; top: 17px; transform: rotate(28deg); box-shadow: -9px -6px 0 -2px #e8a87c, -9px 6px 0 -2px #e8a87c; }
.thumb-ruler::before { width: 24px; height: 8px; left: 5px; top: 13px; background: #f8de7e; border: 1px solid #d1ad39; transform: rotate(-14deg); }
.thumb-ruler::after { width: 1px; height: 5px; left: 12px; top: 14px; background: #8c7628; box-shadow: 5px -1px 0 #8c7628, 10px -2px 0 #8c7628, 15px -3px 0 #8c7628; transform: rotate(-14deg); }
.thumb-knife::before { width: 5px; height: 24px; left: 15px; top: 8px; background: #777; border-radius: 3px; transform: rotate(38deg); }
.thumb-knife::after { width: 0; height: 0; left: 9px; top: 4px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 11px solid #d8d4ce; transform: rotate(38deg); }
.thumb-mat::before { inset: 5px; background: #cfe8f3; border: 1px solid #8fb8c8; background-image: linear-gradient(#9fc8d8 1px, transparent 1px), linear-gradient(90deg, #9fc8d8 1px, transparent 1px); background-size: 6px 6px; }
.thumb-laminate::before { inset: 7px 6px 6px 8px; background: rgba(132,165,157,.22); border: 1px solid rgba(132,165,157,.55); transform: rotate(-5deg); }
.thumb-laminate::after { inset: 6px 8px 7px 6px; background: rgba(255,255,255,.7); border: 1px solid #d8d4ce; transform: rotate(5deg); }
.thumb-cutmat::before { inset: 5px; background: #9fd6c2; border: 1px solid #5f9d87; background-image: linear-gradient(#77b39d 1px, transparent 1px), linear-gradient(90deg, #77b39d 1px, transparent 1px); background-size: 7px 7px; }
.thumb-squeegee::before { width: 23px; height: 12px; left: 5px; top: 12px; background: #e75a94; border-radius: 3px; transform: rotate(-8deg); }
.thumb-squeegee::after { width: 22px; height: 3px; left: 6px; top: 24px; background: #777; border-radius: 2px; transform: rotate(-8deg); }
.thumb-printer::before { width: 22px; height: 13px; left: 6px; top: 10px; background: #888; border-radius: 3px 3px 2px 2px; }
.thumb-printer::after  { width: 16px; height: 8px; left: 9px; top: 20px; background: #fff; border: 1px solid #ccc; border-radius: 0 0 2px 2px; box-shadow: 0 -4px 0 0 #888; }
.supply-copy { min-width: 0; }
.supply-name { display: block; font-size: 10.5px; font-weight: 700; line-height: 1.18; }
.supply-meta { display: block; color: #777; font-size: 9px; line-height: 1.25; margin-top: 1px; }
.supply-disclosure { color: #777; font-size: 8.5px; line-height: 1.3; margin-top: .55rem; }
.supply-affiliate { color: #777; font-weight: 400; text-transform: none; letter-spacing: 0; }
.ad-box { width: 160px; min-height: 600px; flex-shrink: 0; }

/* SIDEBAR */
.sidebar { background: #1a1a1a; color: #f0ede8; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #2e2e2e transparent; }
.sidebar-scroll { padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .55rem; }
.sidebar-actions { position: sticky; bottom: 0; padding: .8rem 1.1rem; background: #161616; border-top: 1px solid #2a2a2a; box-shadow: 0 -4px 12px rgba(0,0,0,.25); z-index: 1; }
@media print { .sidebar-actions { display: none !important; } }
.logo { font-size: .95rem; font-weight: 700; letter-spacing: .03em; display: flex; align-items: center; gap: 6px; }
.logo-dot { width: 7px; height: 7px; border-radius: 50%; background: #e8a87c; flex-shrink: 0; }
.sub-nav { font-size: 10px; color: #999; margin-top: -.5rem; padding-left: 13px; letter-spacing: .04em; }
.sub-nav a { color: #bbb; text-decoration: none; border-bottom: 1px dotted #555; }
.sub-nav a:hover { color: #e8a87c; border-bottom-color: #e8a87c; }
.sl { font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: #888; margin-bottom: 5px; font-weight: 700; }

/* Content inputs — stack in single-input modes, row in combo (both visible) */
.content-inputs { display: flex; flex-direction: column; gap: 8px; }
.content-inputs.combo-row { display: grid; grid-template-columns: minmax(190px,.95fr) minmax(210px,1.05fr); align-items: stretch; gap: 8px; }
.content-inputs.combo-row > div { min-width: 0; display: flex; flex-direction: column; }
.content-inputs.combo-row .drop-zone { flex: 1 1 auto; min-height: 166px; padding: .85rem .65rem; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.content-inputs.combo-row .drop-zone strong { font-size: 12.5px; line-height: 1.2; }
.content-inputs.combo-row .drop-zone p { max-width: 22ch; font-size: 10px; line-height: 1.35; }
.content-inputs.combo-row .drop-icon { font-size: 22px; margin-bottom: 5px; }
.content-inputs.combo-row .text-input-area { flex: 1 1 auto; min-height: 166px; display: flex; flex-direction: column; padding: .85rem .75rem .65rem; }
.content-inputs.combo-row .text-input-area textarea { flex: 1 1 auto; min-height: 0; line-height: 1.45; }
.content-inputs.combo-row .text-input-area .ti-meta { flex-shrink: 0; margin-top: 6px; }
.content-inputs.combo-row .icon-tools { margin-top: 6px; display: grid; grid-template-columns: 142px minmax(126px,1fr); align-items: center; gap: 9px; }
.content-inputs.combo-row .icon-open-btn { padding: 6px 7px; white-space: nowrap; }
.content-inputs.combo-row .icon-color-tools { justify-content: flex-start; gap: 5px; min-width: 0; overflow: visible; padding-left: 1px; }
.content-inputs.combo-row .icon-color-tools span { display: none; }
.content-inputs.combo-row .icon-swatch { width: 17px; height: 17px; flex: 0 0 17px; }
.content-inputs.combo-row #iconColorInput { width: 19px; height: 19px; flex: 0 0 19px; }
#comboHint { align-items: center; gap: 4px; margin-top: 7px !important; padding: 5px 7px; background: #201b16; border: 1px solid #33281f; border-radius: 6px; color: #aaa !important; line-height: 1.25 !important; }
#comboHint span { font-weight: 700; }

/* Drop zone */
.drop-zone { border: 1.5px dashed #333; border-radius: 9px; padding: .9rem; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; background: #212121; }
.drop-zone:hover, .drop-zone.dragging { border-color: #e8a87c; background: #241e17; }
.drop-zone:focus-visible { outline: 2px solid #e8a87c; outline-offset: 2px; border-color: #e8a87c; }
.swatch:focus-visible { outline: 2px solid #e8a87c; outline-offset: 2px; }
.drop-zone p { font-size: 11px; color: #999; margin-top: 3px; }
.drop-zone strong { font-size: 12px; color: #ddd; }
.drop-icon { font-size: 20px; margin-bottom: 3px; display: block; }
.drop-zone input { display: none; }

/* Thumbs */
.thumb-grid { display: grid; grid-template-columns: repeat(6,1fr); gap: 3px; max-height: 110px; overflow-y: auto; }
.thumb { aspect-ratio: 1; border-radius: 3px; overflow: hidden; position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.icon-thumb { background: #fff; border: 1px solid #ddd4c8; }
.thumb.icon-thumb img { object-fit: contain; padding: 16%; }
.thumb .del { position: absolute; top: 1px; right: 1px; background: rgba(0,0,0,.8); color: #fff; border: none; border-radius: 2px; font-size: 8px; padding: 1px 3px; cursor: pointer; display: none; line-height: 1.4; }
.thumb:hover .del { display: block; }

/* Built-in icon picker */
.icon-tools { display: flex; flex-direction: column; gap: 6px; margin-top: 7px; }
.icon-open-btn { color: #bbb; border-color: #363636; background: #202020; }
.icon-open-btn:hover { color: #e8a87c; border-color: #e8a87c; background: #241e17; }
.icon-color-tools { display: flex; align-items: center; gap: 5px; color: #aaa; font-size: 10.5px; line-height: 1; }
.icon-color-tools span { margin-right: auto; }
.icon-swatch { width: 19px; height: 19px; border-radius: 50%; border: 2px solid #333; background: var(--icon-color); cursor: pointer; padding: 0; flex: 0 0 19px; }
.icon-swatch.active { border-color: #e8a87c; box-shadow: 0 0 0 1px rgba(232,168,124,.18); }
#iconColorInput { width: 21px; height: 21px; }

.icon-picker { position: fixed; inset: 0; z-index: 300; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,.58); }
.icon-picker.open { display: flex; }
.icon-picker-panel { width: min(760px, calc(100vw - 32px)); max-height: min(760px, calc(100vh - 32px)); background: #181818; border: 1px solid #2e2e2e; border-radius: 8px; box-shadow: 0 18px 70px rgba(0,0,0,.46); display: flex; flex-direction: column; overflow: hidden; }
.icon-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 14px 10px; border-bottom: 1px solid #252525; }
.icon-picker-head strong { display: block; color: #f0ede8; font-size: 14px; line-height: 1.2; }
.icon-picker-head span { display: block; color: #999; font-size: 10.5px; margin-top: 2px; }
.icon-picker-close { width: 28px; height: 28px; border-radius: 6px; border: 1px solid #303030; background: #202020; color: #999; cursor: pointer; font-weight: 700; }
.icon-picker-close:hover { color: #e8a87c; border-color: #e8a87c; }
.icon-search { margin: 10px 12px 8px; background: #222; border: 1px solid #333; border-radius: 7px; color: #ddd; padding: 8px 10px; font-size: 13px; outline: none; }
.icon-search:focus { border-color: #e8a87c; box-shadow: 0 0 0 1px rgba(232,168,124,.14); }
.icon-tabs { display: flex; gap: 5px; flex-wrap: wrap; padding: 0 12px 8px; }
.icon-tab { border: 1px solid #303030; background: #202020; color: #bbb; border-radius: 999px; padding: 5px 9px; font-size: 11px; cursor: pointer; }
.icon-tab:hover, .icon-tab.active { color: #e8a87c; border-color: #e8a87c; background: #241e17; }
.icon-picker-meta { display: flex; justify-content: space-between; gap: 10px; padding: 0 13px 8px; color: #999; font-size: 10.5px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; overflow-y: auto; padding: 10px 12px 12px; background: #101010; border-top: 1px solid #252525; border-bottom: 1px solid #252525; }
.icon-choice { min-height: 78px; border: 1px solid #ded8ce; border-radius: 7px; background: #f7f3ec; color: #1a1a1a; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 7px 6px; transition: transform .12s, border-color .12s, box-shadow .12s; }
.icon-choice:hover { border-color: #e8a87c; box-shadow: 0 2px 10px rgba(232,168,124,.22); transform: translateY(-1px); }
.icon-choice-art { color: var(--icon-preview-color, #1a1a1a); display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; }
.icon-choice-art svg { width: 28px; height: 28px; display: block; }
.icon-choice-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9.5px; line-height: 1.15; color: #555; }
.icon-picker-status { min-height: 34px; color: #999; font-size: 11px; padding: 10px 13px; line-height: 1.35; }

/* Controls */
.cr { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.cr label { font-size: 11.5px; color: #999; white-space: nowrap; }
.cr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.cr-grid .cr { min-width: 0; }
.cr-grid .cr input[type="range"] { min-width: 0; flex: 1 1 auto; }
input[type="range"] { flex: 1; accent-color: #e8a87c; height: 3px; cursor: pointer; }
.vb { background: #252525; border-radius: 4px; padding: 2px 6px; font-size: 11px; min-width: 28px; text-align: center; color: #ccc; }
select { background: #242424; color: #ccc; border: 1px solid #303030; border-radius: 6px; padding: 4px 7px; font-size: 11.5px; cursor: pointer; outline: none; flex: 1; }
select:hover { background: #2a2a2a; }

/* Shapes */
.shape-row { display: flex; gap: 5px; }
.shape-btn { flex: 1; background: #1e1e1e; border: 1.5px solid #2e2e2e; border-radius: 7px; color: #aaa; padding: 7px 3px 5px; font-size: 10px; cursor: pointer; transition: all .15s; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.shape-btn.active { border-color: #e8a87c; color: #e8a87c; background: #1e1810; }
.shape-btn svg { width: 17px; height: 17px; }

/* Toggles */
.tog-row { display: flex; gap: 5px; flex-wrap: wrap; }
.tog { background: #1e1e1e; border: 1.5px solid #2e2e2e; border-radius: 20px; color: #aaa; padding: 4px 10px; font-size: 11px; cursor: pointer; transition: all .15s; white-space: nowrap; }
.tog.active { border-color: #e8a87c; color: #e8a87c; background: #1e1810; }

.mode-tabs { display: grid; grid-template-columns: 1fr 1fr 1.28fr; gap: 6px; margin-bottom: 10px; }
.mode-tab { min-width: 0; background: #1e1e1e; border: 1.5px solid #2e2e2e; border-radius: 9px; color: #bbb; padding: 9px 8px; font-size: 11.5px; font-weight: 600; cursor: pointer; transition: all .15s; display: flex; align-items: center; justify-content: center; gap: 5px; letter-spacing: .01em; white-space: nowrap; }
.mode-tab:hover { border-color: #444; color: #ddd; }
.mode-tab.active { border-color: #e8a87c; color: #e8a87c; background: #251c14; box-shadow: 0 0 0 1px rgba(232,168,124,.15); }
.mode-tab .mt-icon { font-size: 14px; line-height: 1; }
.mode-tab-label { line-height: 1.1; }

/* Presets */
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.preset-pill { background: #1e1e1e; border: 1.5px solid #2e2e2e; border-radius: 7px; color: #bbb; padding: 5px 8px; font-size: 10.5px; cursor: pointer; transition: all .15s; text-align: left; line-height: 1.3; }
.preset-pill:hover { border-color: #555; color: #ededed; }
.preset-pill.active { border-color: #e8a87c; color: #e8a87c; background: #1e1810; }
.preset-pill .ps { display: block; font-size: 9px; color: #999; margin-top: 1px; }

/* Swatches */
.swatch-row { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.swatch-cr { align-items: center; }
.swatch-cr > label { flex-shrink: 0; }
.swatch-cr .swatch-row { flex: 1 1 auto; justify-content: flex-end; }
.swatch { width: 21px; height: 21px; border-radius: 4px; cursor: pointer; border: 2px solid transparent; transition: border-color .15s; flex-shrink: 0; }
.swatch.active { border-color: #e8a87c; }
input[type="color"] { width: 21px; height: 21px; border: none; background: none; padding: 0; cursor: pointer; border-radius: 4px; }

/* Buttons */
.btn-primary { background: #e8a87c; color: #1a1a1a; border: none; border-radius: 8px; padding: 9px; font-size: 13px; font-weight: 700; cursor: pointer; transition: background .15s; width: 100%; }
.btn-primary:hover { background: #f0b98d; }
.btn-row { display: flex; gap: 5px; }
.btn-sm { flex: 1; background: #202020; color: #bbb; border: 1px solid #2e2e2e; border-radius: 7px; padding: 7px 8px; font-size: 11.5px; cursor: pointer; transition: all .15s; }
.btn-sm:hover { background: #282828; color: #ccc; }
.btn-full { width: 100%; }

.divider { border: none; border-top: 1px solid #222; margin: 0; }
.tip { font-size: 10.5px; color: #888; line-height: 1.65; }



/* Canvas */
.canvas-area { padding: 1.25rem 1.75rem 0; display: flex; flex-direction: column; align-items: center; gap: 1rem; position: relative; }
.canvas-top { width: 100%; max-width: 1100px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.canvas-logo { display: inline-flex; align-items: center; gap: 7px; font-size: 1rem; font-weight: 700; letter-spacing: .01em; color: #1a1a1a; text-decoration: none; flex-shrink: 0; }
.canvas-logo:hover { color: #c47a4a; }
.canvas-logo .logo-dot { width: 8px; height: 8px; }
.stat-pills { display: flex; gap: 5px; flex-wrap: wrap; }
.stat-pill { background: #d8d4ce; color: #555; border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 600; }
.share-btn { background: #1a1a1a; color: #f0ede8; border: none; border-radius: 7px; padding: 6px 13px; font-size: 12px; font-weight: 600; cursor: pointer; transition: background .15s; white-space: nowrap; }
.share-btn:hover { background: #2a2a2a; }

.sheet-container { background: white; box-shadow: 0 4px 40px rgba(0,0,0,.12); position: relative; flex-shrink: 0; }
.sticker-grid-display { display: grid; }
.sticker-cell { display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; cursor: pointer; }
.sticker-cell:hover { outline: 1.5px solid rgba(232,168,124,.55); outline-offset: -1.5px; }
.sticker-cell.selected { outline: 2px solid #e8a87c; outline-offset: -2px; }
.sticker-cell.cell-customized::after { content: ""; position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: #e8a87c; box-shadow: 0 0 0 2px rgba(255,255,255,.9); pointer-events: none; }
.sticker-cell img { width: 100%; height: 100%; display: block; }
.sticker-cell.fit-contain img { object-fit: contain; }
.sticker-cell.fit-cover img   { object-fit: cover; }
.sticker-cell.fit-stretch img { object-fit: fill; }
.sticker-cell.circle  { border-radius: 50%; }
.sticker-cell.rounded { border-radius: 18%; }
.sticker-cell.hexagon { clip-path: polygon(50% 0%,93% 25%,93% 75%,50% 100%,7% 75%,7% 25%); }
.cut-guides .sticker-cell { outline: .5px dashed #ccc; }
.border-on .sticker-cell { box-shadow: inset 0 0 0 1.5px rgba(0,0,0,.12); }

/* Per-cell editor */
.cell-editor { position: fixed; right: 232px; top: 96px; width: 286px; max-height: calc(100vh - 122px); overflow-y: auto; z-index: 80; display: none; background: #181818; color: #ddd; border: 1px solid #2e2e2e; border-radius: 8px; box-shadow: 0 14px 45px rgba(0,0,0,.35); padding: 10px; gap: 8px; }
.cell-editor.open { display: flex; flex-direction: column; }
.cell-editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; border-bottom: 1px solid #252525; padding-bottom: 8px; }
.cell-editor-head strong { display: block; font-size: 13px; color: #f0ede8; line-height: 1.2; }
.cell-editor-head span { display: block; font-size: 10px; color: #999; margin-top: 2px; }
.cell-editor-head button { width: 24px; height: 24px; border-radius: 5px; border: 1px solid #303030; background: #202020; color: #999; cursor: pointer; font-weight: 700; }
.cell-editor-head button:hover { color: #e8a87c; border-color: #e8a87c; }
.cell-editor-field { display: flex; flex-direction: column; gap: 4px; }
.cell-editor-field span, .cell-editor-check span { color: #aaa; font-size: 10.5px; }
.cell-editor-field textarea { width: 100%; min-height: 58px; resize: vertical; border: 1px solid #303030; border-radius: 6px; background: #222; color: #ddd; outline: none; padding: 7px 8px; font: 12px/1.35 inherit; }
.cell-editor-field textarea:focus { border-color: #e8a87c; box-shadow: 0 0 0 1px rgba(232,168,124,.12); }
.cell-editor-field select { width: 100%; flex: 0 0 auto; }
.cell-editor-check { display: flex; align-items: center; gap: 7px; }
.cell-editor-check input { accent-color: #e8a87c; }
.cell-editor-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.cell-editor-actions #cellClear { grid-column: 1 / -1; }

/* History bar — bottom of canvas */
.history-bar { display: flex; align-items: center; gap: 6px; padding: 7px 10px; margin-top: 10px; background: #181818; border: 1px solid #2a2a2a; border-radius: 8px; }
.hb-btn { flex: 0 0 auto; background: #202020; color: #bbb; border: 1px solid #303030; border-radius: 6px; padding: 4px 11px; font-size: 14px; line-height: 1; cursor: pointer; transition: all .15s; }
.hb-btn:hover:not(:disabled) { color: #e8a87c; border-color: #e8a87c; background: #1e1810; }
.hb-btn:disabled { opacity: .3; cursor: not-allowed; }
.hb-track { flex: 1 1 auto; min-width: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin; padding: 1px; }
.hb-track::-webkit-scrollbar { height: 4px; }
.hb-track::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }
.hb-chip { flex: 0 0 auto; background: #202020; color: #999; border: 1px solid #2e2e2e; border-radius: 5px; padding: 4px 9px; font-size: 10.5px; cursor: pointer; white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis; transition: all .12s; }
.hb-chip:hover { color: #e8a87c; border-color: #e8a87c; }
.hb-chip.current { background: #1e1810; color: #e8a87c; border-color: #e8a87c; font-weight: 600; }
.hb-chip.future { opacity: .55; font-style: italic; }
.hb-chip.future:hover { opacity: 1; }

/* Text mode */
.text-input-area { background: #212121; border: 1.5px dashed #333; border-radius: 9px; padding: .7rem; transition: border-color .2s, background .2s; }
.text-input-area:focus-within { border-color: #e8a87c; background: #241e17; }
.text-input-area textarea { width: 100%; min-height: 120px; background: transparent; border: none; outline: none; color: #ddd; font-family: inherit; font-size: 12px; resize: vertical; line-height: 1.5; }
.text-input-area textarea::placeholder { color: #888; }
.text-input-area .ti-meta { display: flex; justify-content: space-between; font-size: 10px; color: #888; margin-top: 4px; padding: 0 2px; }
.csv-tools { display: flex; align-items: center; gap: 7px; margin-top: 7px; }
.csv-tools .btn-sm { flex: 0 0 auto; width: 96px; padding: 6px 8px; }
.csv-tools span { color: #999; font-size: 10px; line-height: 1.25; }
.sticker-cell-text { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 4%; box-sizing: border-box; text-align: center; word-break: break-word; line-height: 1.2; color: #1a1a1a; }
.sticker-cell-text.multiline { white-space: pre-line; line-height: 1.16; }
.sticker-cell-text.align-left   { justify-content: flex-start; text-align: left; }
.sticker-cell-text.align-right  { justify-content: flex-end;   text-align: right; }
.sticker-cell-text.valign-top    { align-items: flex-start; }
.sticker-cell-text.valign-middle { align-items: center; }
.sticker-cell-text.valign-bottom { align-items: flex-end; }

/* CSV import modal */
.csv-importer { position: fixed; inset: 0; z-index: 290; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,.58); }
.csv-importer.open { display: flex; }
.csv-panel { width: min(620px, calc(100vw - 32px)); max-height: min(760px, calc(100vh - 32px)); background: #181818; border: 1px solid #2e2e2e; border-radius: 8px; box-shadow: 0 18px 70px rgba(0,0,0,.46); display: flex; flex-direction: column; overflow: hidden; }
.csv-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 14px 10px; border-bottom: 1px solid #252525; }
.csv-head strong { display: block; color: #f0ede8; font-size: 14px; line-height: 1.2; }
.csv-head span { display: block; color: #999; font-size: 10.5px; margin-top: 2px; }
.csv-close { width: 28px; height: 28px; border-radius: 6px; border: 1px solid #303030; background: #202020; color: #999; cursor: pointer; font-weight: 700; }
.csv-close:hover { color: #e8a87c; border-color: #e8a87c; }
.csv-body { padding: 12px 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.csv-check { color: #aaa; font-size: 11.5px; display: flex; align-items: center; gap: 7px; }
.csv-check input { accent-color: #e8a87c; }
.csv-map { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.csv-map label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.csv-map span { color: #aaa; font-size: 10.5px; }
.csv-map select { width: 100%; flex: 0 0 auto; }
.csv-preview { background: #101010; border: 1px solid #252525; border-radius: 7px; padding: 10px; }
.csv-preview-title { color: #999; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; margin-bottom: 7px; }
.csv-preview-card { background: #f7f3ec; color: #1a1a1a; border: 1px solid #ded8ce; border-radius: 6px; padding: 9px 10px; font-size: 12px; line-height: 1.35; margin-bottom: 7px; white-space: normal; }
.csv-preview-card:last-child { margin-bottom: 0; }
.csv-preview-empty { color: #999; font-size: 11px; line-height: 1.4; }
.csv-actions { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid #252525; background: #161616; }
.csv-actions .btn-sm, .csv-actions .btn-primary { width: auto; flex: 1; }

/* Combo (image + text) mode */
.sticker-cell.combo { display: block; position: relative; }
.sticker-cell.combo .ct-img-wrap { width: 100%; height: 100%; display: block; overflow: hidden; }
.sticker-cell.combo .ct-img-wrap img { width: 100%; height: 100%; display: block; }
.sticker-cell.combo.fit-contain .ct-img-wrap img { object-fit: contain; }
.sticker-cell.combo.fit-cover   .ct-img-wrap img { object-fit: cover; }
.sticker-cell.combo.fit-stretch .ct-img-wrap img { object-fit: fill; }
.sticker-cell.combo .ct-text { box-sizing: border-box; word-break: break-word; line-height: 1.15; text-align: center; padding: 4% 5%; }
.sticker-cell.combo .ct-text.align-left  { text-align: left; }
.sticker-cell.combo .ct-text.align-right { text-align: right; }

/* Overlay positions: text floats on top of the image */
.sticker-cell.combo.pos-overlay-top    .ct-text,
.sticker-cell.combo.pos-overlay-bottom .ct-text { position: absolute; left: 0; right: 0; text-shadow: 0 1px 4px rgba(0,0,0,.7), 0 0 2px rgba(0,0,0,.5); }
.sticker-cell.combo.pos-overlay-top    .ct-text { top: 0; }
.sticker-cell.combo.pos-overlay-bottom .ct-text { bottom: 0; }

/* Band positions: text on a translucent white strip — most legible over any photo */
.sticker-cell.combo.pos-band-top    .ct-text,
.sticker-cell.combo.pos-band-bottom .ct-text { position: absolute; left: 0; right: 0; background: rgba(255,255,255,.88); padding: 5% 6%; }
.sticker-cell.combo.pos-band-top    .ct-text { top: 0; }
.sticker-cell.combo.pos-band-bottom .ct-text { bottom: 0; }

/* Polaroid: image and caption are stacked sub-zones (no overlap) */
.sticker-cell.combo.pos-polaroid-bottom,
.sticker-cell.combo.pos-polaroid-top { display: flex; flex-direction: column; }
.sticker-cell.combo.pos-polaroid-bottom .ct-img-wrap,
.sticker-cell.combo.pos-polaroid-top    .ct-img-wrap { flex: 1 1 auto; min-height: 0; }
.sticker-cell.combo.pos-polaroid-bottom .ct-text,
.sticker-cell.combo.pos-polaroid-top    .ct-text { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.sticker-cell.combo.pos-polaroid-top    .ct-text { order: -1; }

.empty-hint { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; gap: 8px; color: #ccc; }
.empty-hint .big { font-size: 2.2rem; }
.empty-hint p { font-size: 13px; }



/* FAQ */
.faq-section { background: #1a1a1a; padding: 3rem 2rem; }
.faq-inner { max-width: 900px; margin: 0 auto; }
.page-h1 { font-size: 2rem; font-weight: 700; color: #f0eee8; margin-bottom: .4rem; letter-spacing: -.01em; line-height: 1.15; }
.page-tagline { font-size: 13px; color: #e8a87c; margin-bottom: 1.5rem; font-weight: 500; letter-spacing: .04em; }
.page-tagline a { color: #e8a87c; text-decoration: none; border-bottom: 1px dotted rgba(232,168,124,.5); padding-bottom: 1px; }
.page-tagline a:hover { border-bottom-color: #e8a87c; }
.faq-title { font-size: 1rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #999; margin-bottom: 1.5rem; }
.site-footer { background: #1a1a1a; color: #999; font-size: 11px; padding: 1.5rem 2rem 2.5rem; text-align: center; border-top: 1px solid #2a2a2a; }
.site-footer a { color: #bbb; text-decoration: none; border-bottom: 1px dotted #666; }
.site-footer a:hover { color: #e8a87c; border-bottom-color: #e8a87c; }
.site-footer p { max-width: 720px; margin: 0 auto .6rem; line-height: 1.6; }
.faq-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: #2a2a2a; border: 1px solid #2a2a2a; border-radius: 10px; overflow: hidden; }
.faq-item { background: #1a1a1a; padding: 0; }
.faq-item summary { list-style: none; cursor: pointer; padding: 1.1rem 1.25rem; font-size: 13.5px; font-weight: 600; color: #e0ddd8; display: flex; justify-content: space-between; align-items: center; gap: 1rem; user-select: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-size: 18px; font-weight: 300; color: #e8a87c; flex-shrink: 0; transition: transform .2s; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item summary:hover { background: #212121; }
.faq-item p { padding: .1rem 1.25rem 1.1rem; font-size: 13px; color: #aaa; line-height: 1.75; }
.faq-item strong { color: #ddd; font-weight: 600; }
@media (max-width: 640px) { .faq-grid { grid-template-columns: 1fr; } }
@media (max-width: 1320px) {
  .app { grid-template-columns: clamp(460px, 38vw, 510px) minmax(0,1fr); }
  .ad-side { grid-column: 2; position: static; height: auto; flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: flex-start; overflow: visible; padding: 1rem; }
  .cell-editor { right: 18px; }
}

/* ═══════════ MOBILE (≤760px) ═══════════
   Stack to a single column, with the preview at the top, controls below,
   and the action bar fixed to the viewport so Print is always one tap away.
   Desktop layout is untouched; print behavior is untouched. */
@media (max-width: 760px) {
  /* Reserve room at the bottom so the fixed action bar never covers content */
  body { padding-bottom: 88px; }

  /* Stack the app and reorder so the sheet preview is visible at the top */
  .app          { display: flex; flex-direction: column; }
  .canvas-area  { order: 1; padding: .85rem .6rem 0; gap: .75rem; }
  .sidebar      { order: 2; position: static; height: auto; width: 100%; }
  .ad-side      { order: 3; }

  .sidebar-scroll { padding: .9rem 1rem; gap: .55rem; }

  /* Action bar: detach from the (now non-sticky) sidebar and fix to viewport */
  .sidebar-actions {
    position: fixed !important;
    bottom: 0; left: 0; right: 0;
    z-index: 100;
    padding: .5rem .65rem calc(.5rem + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(0,0,0,.4);
  }
  #print { gap: 5px !important; }
  #print .btn-primary { padding: 9px; font-size: 12.5px; }
  #print .btn-sm      { font-size: 11.5px; padding: 7px 6px; }
  /* Hide the redundant standalone Share — Share is also in the canvas-top header */
  #print > .btn-sm.btn-full { display: none; }

  /* Canvas top: stack vertically so logo, stats, and Share all fit cleanly */
  .canvas-top   { flex-direction: column; align-items: center; gap: .5rem; }
  .stat-pills   { justify-content: center; }
  .canvas-logo  { font-size: 1.05rem; }

  /* Right column: stack the supplies, layouts, and ad */
  .ad-side {
    flex-direction: column !important;
    align-items: center !important;
    padding: 1rem .75rem !important;
    height: auto !important;
    position: static !important;
    overflow: visible !important;
    gap: 1rem;
  }
  .supplies-card,
  .layout-card { width: 100% !important; max-width: 380px; }
  .cell-editor {
    position: fixed;
    left: .65rem;
    right: .65rem;
    bottom: 82px;
    width: auto;
    max-height: 46vh;
    overflow-y: auto;
  }
  .ad-box {
    width: 100% !important;
    max-width: 320px;
    min-height: auto !important;
    display: flex;
    justify-content: center;
  }

  /* Minor tightening so things breathe on a small viewport */
  .content-inputs.combo-row { grid-template-columns: 1fr; }
  .content-inputs.combo-row .drop-zone,
  .content-inputs.combo-row .text-input-area { min-height: 122px; }
  .content-inputs.combo-row .icon-tools { grid-template-columns: 1fr; }
  .content-inputs.combo-row .icon-color-tools span { display: inline; }
  .thumb-grid               { grid-template-columns: repeat(5, 1fr); }
  .csv-importer             { padding: 0; align-items: stretch; }
  .csv-panel                { width: 100%; max-height: none; border-radius: 0; border-left: 0; border-right: 0; }
  .csv-map                  { grid-template-columns: 1fr; }
  .icon-picker              { padding: 0; align-items: stretch; }
  .icon-picker-panel        { width: 100%; max-height: none; border-radius: 0; border-left: 0; border-right: 0; }
  .icon-grid                { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); }
  .icon-choice              { min-height: 70px; }
  .preset-grid .preset-pill { font-size: 10.5px; }
  .page-h1                  { font-size: 1.5rem; }
  .page-tagline             { font-size: 12.5px; }
  .faq-section              { padding: 2rem 1rem; }
  .faq-item summary         { padding: 1rem 1.1rem; font-size: 13px; }
  .faq-item p               { padding: .1rem 1.1rem 1rem; font-size: 12.5px; }
  .site-footer              { padding: 1.25rem 1rem 2rem; }
  .site-footer p            { font-size: 11.5px; }
}

@media print { .faq-section, .site-footer { display: none !important; } }

/* Print */
@media print {
  /* Force backgrounds, fills, and gradients to print. Without these, Chrome
     and Safari strip background colors by default to "save ink", which makes
     filled cells render as transparent. */
  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  html, body { background: white; margin: 0; padding: 0; }
  .sidebar, .canvas-top, .ad-leaderboard, .empty-hint, .ad-zone, .ad-side, .icon-picker, .csv-importer, .cell-editor { display: none !important; }
  .canvas-area { padding: 0; margin: 0; }
  .app { display: block; padding: 0; margin: 0; }
  .sheet-container {
    box-shadow: none !important;
    margin: 0 !important;
    /* Use real physical dimensions set as CSS vars in render(), so the
       printed output matches the selected paper exactly — not the
       on-screen preview scale. Falls back to US Letter if vars are unset. */
    width:  var(--sheet-w-mm, 215.9mm) !important;
    height: var(--sheet-h-mm, 279.4mm) !important;
  }
  /* Override the grid's preview-scale pixel dimensions so it fills the full
     physical sheet. Cells become equal fractions (1fr) of the available area
     after the user's margin/gap, computed in real mm. */
  #stickerGrid {
    width:  100% !important;
    height: 100% !important;
    box-sizing: border-box !important;
    grid-template-columns: repeat(var(--cols, 1), 1fr) !important;
    grid-template-rows:    repeat(var(--rows, 1), 1fr) !important;
    padding: var(--margin-mm, 10mm) !important;
    gap:     var(--gap-mm, 3mm) !important;
  }
  .sticker-cell { outline: none !important; cursor: default !important; }
  .sticker-cell::after { display: none !important; }
}
