:root { --rm-accent:#2563eb; }
    .rm-shell { max-width:1280px; margin:0 auto; padding:28px 20px 70px; }
    .rm-head { text-align:center; margin-bottom:22px; }
    .rm-head h1 { font-size:30px; font-weight:800; margin:0 0 8px; color:var(--gray-900,#0f172a); letter-spacing:-0.5px; }
    .rm-head p { color:var(--gray-500,#64748b); margin:0; font-size:15px; }

    /* Template gallery */
    .rm-gallery { display:flex; gap:14px; overflow-x:auto; padding:6px 2px 16px; margin-bottom:22px; scrollbar-width:thin; }
    .rm-tpl { flex:0 0 auto; width:188px; background:#fff; border:2px solid #e7ebf0; border-radius:14px; padding:0; cursor:pointer; text-align:left; transition:.15s; overflow:hidden; }
    .rm-tpl:hover { border-color:#cbd5e1; transform:translateY(-2px); }
    .rm-tpl.active { border-color:var(--rm-accent); box-shadow:0 8px 24px -8px rgba(37,99,235,.35); }
    .rm-tpl-thumb { display:block; height:222px; overflow:hidden; background:#fff; border-bottom:1px solid #eef2f7; position:relative; }
    .rm-tpl-scale { display:block; transform-origin:top left; }
    .rm-tpl-name { display:block; padding:11px 14px 2px; font-weight:700; font-size:14px; color:#0f172a; }
    .rm-tpl-name em { font-style:normal; font-size:11px; font-weight:700; color:var(--rm-accent); background:#eff4ff; padding:2px 7px; border-radius:6px; margin-left:4px; }
    .rm-tpl-desc { display:block; padding:0 14px 12px; font-size:12px; color:#94a3b8; }
    .rm-tpl.active .rm-tpl-desc::after { content:'✓'; float:right; color:#fff; background:var(--rm-accent); width:18px; height:18px; border-radius:50%; text-align:center; line-height:18px; font-size:11px; }

    /* Builder grid */
    .rm-builder { display:grid; grid-template-columns:minmax(0,420px) 1fr; gap:28px; align-items:start; }
    .rm-form { background:#fff; border:1px solid #e7ebf0; border-radius:16px; padding:6px 20px 20px; }
    .rm-section { padding:16px 0; border-bottom:1px solid #f1f5f9; }
    .rm-section:last-child { border-bottom:none; }
    .rm-section h3 { font-size:12px; font-weight:800; text-transform:uppercase; letter-spacing:.07em; color:#64748b; margin:0 0 12px; }
    .rm-row { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:10px; }
    .rm-field { display:flex; flex-direction:column; gap:4px; }
    .rm-field.full { grid-column:1 / -1; }
    .rm-field label { font-size:11px; font-weight:600; color:#94a3b8; }
    .rm-in { width:100%; box-sizing:border-box; padding:9px 11px; border:1px solid #e2e8f0; border-radius:9px; font-size:13px; font-family:'Inter',sans-serif; color:#0f172a; background:#fff; outline:none; transition:.12s; }
    .rm-in:focus { border-color:var(--rm-accent); box-shadow:0 0 0 3px rgba(37,99,235,.12); }
    textarea.rm-in { resize:vertical; min-height:54px; }

    /* Items */
    .rm-item { display:grid; grid-template-columns:1fr 64px 80px 30px; gap:7px; margin-bottom:7px; align-items:center; }
    .rm-item .rm-in { padding:8px 9px; }
    .rm-item-del { border:none; background:#fef2f2; color:#ef4444; width:30px; height:34px; border-radius:8px; cursor:pointer; font-size:18px; line-height:1; }
    .rm-item-del:hover { background:#fee2e2; }
    .rm-item-head { display:grid; grid-template-columns:1fr 64px 80px 30px; gap:7px; font-size:10px; font-weight:700; color:#94a3b8; text-transform:uppercase; letter-spacing:.05em; margin-bottom:6px; padding:0 2px; }
    .rm-add { width:100%; margin-top:6px; padding:9px; border:1px dashed #cbd5e1; background:#f8fafc; color:#475569; border-radius:9px; font-weight:600; font-size:13px; cursor:pointer; }
    .rm-add:hover { border-color:var(--rm-accent); color:var(--rm-accent); }

    .rm-logo-row { display:flex; gap:8px; align-items:center; }
    .rm-file { font-size:12px; }
    .rm-mini { padding:8px 12px; border:1px solid #e2e8f0; background:#fff; border-radius:9px; font-size:12px; font-weight:600; color:#475569; cursor:pointer; }
    .rm-color-row { display:flex; align-items:center; gap:10px; }
    .rm-color-row input[type=color] { width:42px; height:34px; border:1px solid #e2e8f0; border-radius:9px; padding:2px; background:#fff; cursor:pointer; }

    /* Stage / preview */
    .rm-stage { position:sticky; top:84px; min-width:0; }
    .rm-actions { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:14px; }
    .rm-btn { display:inline-flex; align-items:center; gap:7px; padding:11px 18px; border-radius:11px; font-weight:700; font-size:14px; border:none; cursor:pointer; transition:.12s; }
    .rm-btn--primary { background:var(--rm-accent); color:#fff; box-shadow:0 6px 18px -6px rgba(37,99,235,.6); }
    .rm-btn--primary:hover { filter:brightness(1.05); }
    .rm-btn--ghost { background:#fff; border:1px solid #e2e8f0; color:#334155; }
    .rm-btn--ghost:hover { border-color:#cbd5e1; }
    .rm-btn:disabled { opacity:.6; cursor:default; }
    .rm-total { font-size:13px; color:#64748b; margin-bottom:12px; font-weight:600; }
    .rm-preview-wrap { background:#eef2f7; border:1px solid #e2e8f0; border-radius:16px; padding:30px; display:flex; justify-content:center; overflow:auto; min-height:420px; }
    #receipt-preview .receipt-paper { box-shadow:0 12px 40px -12px rgba(15,23,42,.25); }

    @media (max-width:980px) {
      .rm-builder { grid-template-columns:1fr; }
      .rm-stage { position:static; }
    }
    @media (max-width:560px) {
      .rm-shell { padding:20px 14px 56px; }
      .rm-preview-wrap { padding:16px; }
      .rm-form { padding:4px 14px 16px; }
    }
