:root{
  --bg:#f5f2ed;--panel:#fff;--text:#191817;--muted:#77716b;--line:#e7e1d9;
  --red:#b51d25;--red2:#7d1117;--soft:#fff1f1;--green:#17754b;--amber:#a76105;
  --shadow:0 18px 60px rgba(44,35,28,.10);--radius:18px
}
*{box-sizing:border-box}
body{margin:0;background:radial-gradient(circle at 15% 0,rgba(181,29,37,.07),transparent 28%),var(--bg);color:var(--text);font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif}
button,input,select,textarea{font:inherit}button{cursor:pointer;border:0}button:disabled{opacity:.42;cursor:not-allowed}
.topbar{height:74px;display:flex;align-items:center;justify-content:space-between;padding:0 26px;border-bottom:1px solid rgba(120,110,100,.15);background:rgba(255,255,255,.82);backdrop-filter:blur(18px);position:sticky;top:0;z-index:50}
.brand{display:flex;align-items:center;gap:12px}.brand-mark{width:40px;height:40px;border-radius:12px;display:grid;place-items:center;color:#fff;background:linear-gradient(135deg,var(--red),var(--red2));font-weight:900;letter-spacing:-.04em}
.brand strong{display:block}.brand span{display:block;font-size:11px;color:var(--muted);margin-top:2px}.top-actions{display:flex;align-items:center;gap:9px}
.status-chip{padding:8px 10px;border-radius:999px;font-size:11px;font-weight:800;border:1px solid var(--line)}.status-chip.neutral{background:#f6f3ef;color:#736c65}.status-chip.ok{background:#edf8f2;color:var(--green);border-color:#d8eee1}.status-chip.bad{background:#fff1f1;color:#a41a22;border-color:#f2d4d6}
.ghost-btn,.secondary,.primary,.danger-btn{border-radius:11px;min-height:41px;padding:9px 13px;font-weight:800}.ghost-btn{background:white;border:1px solid var(--line)}
.layout{display:grid;grid-template-columns:360px minmax(0,1fr);min-height:calc(100vh - 74px)}.sidebar{padding:18px;border-right:1px solid var(--line);background:rgba(255,255,255,.45)}
.card,.card-wide{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);box-shadow:0 5px 22px rgba(30,24,20,.035)}.card{padding:17px;margin-bottom:13px}
.section-heading{display:flex;gap:11px;margin-bottom:14px}.section-heading .num{width:28px;height:28px;display:grid;place-items:center;flex:0 0 28px;border-radius:9px;background:var(--soft);color:var(--red);font-size:12px;font-weight:900}.section-heading h2{font-size:15px;margin:0 0 3px}.section-heading p{font-size:11px;color:var(--muted);margin:0;line-height:1.4}
.drop{min-height:100px;border:1.5px dashed #cec6bd;border-radius:14px;display:grid;place-content:center;text-align:center;gap:4px;background:#fbfaf8;cursor:pointer;transition:.2s}.drop:hover{border-color:var(--red);background:var(--soft)}.drop input{display:none}.drop-icon{margin:0 auto 3px;width:38px;height:44px;border:1px solid #ddd6cd;border-radius:8px;display:grid;place-items:center;background:white;color:var(--red);font-size:10px;font-weight:900}.drop strong{font-size:12px}.drop small{font-size:10px;color:var(--muted)}.drop.compact{min-height:76px}
label{display:grid;gap:6px;margin-bottom:10px;font-size:11px;font-weight:700;color:#554f4a}label small{font-weight:500;color:var(--muted);line-height:1.35}
input,select,textarea{width:100%;border:1px solid #ddd6ce;background:#fff;border-radius:10px;padding:9px 10px;color:var(--text);outline:none}input:focus,select:focus,textarea:focus{border-color:var(--red);box-shadow:0 0 0 3px rgba(181,29,37,.08)}input[type=color]{min-height:39px;padding:4px}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:9px}.inline-controls{display:grid;grid-template-columns:40px 1fr 40px;gap:8px;margin-top:10px}.inline-controls select{height:40px}
.square{width:40px;height:40px;border-radius:10px;background:#fff;border:1px solid var(--line);font-size:18px}.full{width:100%}.secondary{background:#f6f3ef;border:1px solid #e8e1d8;color:#312d29;margin-top:8px}.primary{color:#fff;background:linear-gradient(135deg,var(--red),var(--red2));box-shadow:0 9px 20px rgba(181,29,37,.15);margin-top:8px}.primary.outline{background:#fff;color:var(--red);border:1px solid rgba(181,29,37,.28);box-shadow:none}.danger-btn{color:#a41a22;background:#fff3f3;border:1px solid #f0d8da}
.info{font-size:11px;color:var(--muted);padding:9px 10px;margin-top:9px;border:1px solid #ece7e0;background:#f8f6f3;border-radius:10px;overflow-wrap:anywhere}.divider{display:flex;align-items:center;gap:8px;margin:10px 0}.divider:before,.divider:after{content:"";height:1px;background:var(--line);flex:1}.divider span{text-transform:uppercase;font-size:9px;color:#aaa29b;letter-spacing:.12em}
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;margin-top:12px}.stats div{padding:9px;border:1px solid #ece7e0;background:#faf8f5;border-radius:11px}.stats strong{display:block;font-size:16px}.stats span{font-size:9px;color:var(--muted)}
.content{padding:22px;min-width:0}.preview-head{display:flex;justify-content:space-between;align-items:center;gap:15px;margin-bottom:12px}.preview-head h1{font-size:20px;margin:0 0 3px}.preview-head p{font-size:11px;color:var(--muted);margin:0}.zoom{display:flex;align-items:center;gap:7px}.zoom span{font-size:11px;color:var(--muted);min-width:46px;text-align:center}
.preview-area{min-height:610px;max-height:72vh;overflow:auto;display:grid;place-items:start center;padding:30px;border-radius:22px;border:1px solid var(--line);background:linear-gradient(45deg,#ece7e0 25%,transparent 25%),linear-gradient(-45deg,#ece7e0 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ece7e0 75%),linear-gradient(-45deg,transparent 75%,#ece7e0 75%);background-size:22px 22px;background-position:0 0,0 11px,11px -11px,-11px 0}
.empty-preview{align-self:center;justify-self:center;text-align:center;max-width:420px;color:var(--muted);padding:60px 20px}.empty-preview h3{color:#3f3934;margin:14px 0 7px}.empty-preview p{font-size:12px;line-height:1.55}.paper-icon{margin:auto;width:66px;height:80px;display:grid;place-items:center;border-radius:12px;border:1px solid #ddd6ce;background:#fff;color:var(--red);box-shadow:var(--shadow);font-weight:900}
.canvas-wrap{position:relative;background:white;box-shadow:0 24px 80px rgba(35,28,22,.20);cursor:crosshair;line-height:0}.canvas-wrap canvas{display:block}.name-overlay{position:absolute;z-index:3;pointer-events:none;white-space:nowrap;line-height:1.15;padding:3px 5px;border-radius:5px;border:1px dashed rgba(181,29,37,.55);background:rgba(255,255,255,.55);backdrop-filter:blur(2px)}.hidden{display:none!important}
.queue{margin-top:18px;overflow:hidden}.queue-head{display:flex;justify-content:space-between;gap:15px;align-items:center;padding:16px 18px;border-bottom:1px solid var(--line)}.queue-head h2{font-size:15px;margin:0 0 3px}.queue-head p{font-size:11px;color:var(--muted);margin:0}.queue-tools{display:flex;gap:8px}.queue-tools input{width:220px}.table-scroll{overflow:auto}table{width:100%;border-collapse:collapse;font-size:11px}th{text-align:left;padding:10px 12px;background:#faf8f5;color:#756e67;font-size:9px;text-transform:uppercase;letter-spacing:.08em}td{padding:11px 12px;border-top:1px solid #f0ece7;vertical-align:middle}tr.selected{background:var(--soft)}.empty-row{text-align:center;color:var(--muted);padding:28px}.guest-name{font-weight:800;max-width:300px}.status{display:inline-flex;padding:5px 8px;border-radius:999px;font-size:9px;font-weight:900}.status.pending{background:#f2efeb;color:#6b635b}.status.generated{background:#fff6e7;color:var(--amber)}.status.sent{background:#eaf7ef;color:var(--green)}.status.failed{background:#fff0f0;color:#a41a22}.row-actions{display:flex;gap:6px;flex-wrap:wrap}.mini{padding:6px 8px;border-radius:8px;background:#f3f0ec;font-weight:800;font-size:10px}.mini.send{background:#edf8f2;color:var(--green)}.mini.pdf{background:#fff0f0;color:var(--red)}
.toast{position:fixed;right:20px;bottom:20px;max-width:360px;background:#181716;color:#fff;padding:11px 14px;border-radius:11px;box-shadow:var(--shadow);font-size:11px;opacity:0;transform:translateY(10px);pointer-events:none;transition:.2s;z-index:100}.toast.show{opacity:1;transform:none}
dialog{border:0;padding:0;background:transparent}dialog::backdrop{background:rgba(20,17,15,.46);backdrop-filter:blur(4px)}.dialog-card{width:min(560px,calc(100vw - 28px));background:white;border-radius:20px;padding:20px;box-shadow:var(--shadow)}.dialog-head{display:flex;justify-content:space-between;gap:15px}.dialog-head h2{font-size:18px;margin:0 0 4px}.dialog-head p{font-size:11px;color:var(--muted);margin:0}.api-panel,.note{padding:11px;border-radius:11px;margin:14px 0;font-size:11px;line-height:1.5}.api-panel{background:#f7f5f2;border:1px solid var(--line)}.note{background:#fff9ec;border:1px solid #f2e0b9;color:#75551f}
@media(max-width:900px){.layout{display:block}.sidebar{border-right:0}.content{padding:14px}.topbar{padding:0 15px}.status-chip{display:none}.preview-area{min-height:420px;padding:14px}.queue-head{align-items:flex-start;flex-direction:column}.queue-tools{width:100%}.queue-tools input{flex:1;width:auto}}
@media(max-width:520px){.grid2{grid-template-columns:1fr}.stats{grid-template-columns:repeat(3,1fr)}.queue-tools{flex-direction:column}.topbar{height:auto;padding-top:11px;padding-bottom:11px}.brand span{display:none}}
