:root { font-family: Arial, Helvetica, sans-serif; color: #111; background: #eef1f5; }
* { box-sizing: border-box; }
body { margin: 0; }
.layout { display: grid; grid-template-columns: minmax(320px, 450px) minmax(620px, 1fr); gap: 28px; padding: 28px; align-items: start; }
.panel { background: white; border-radius: 14px; padding: 24px; box-shadow: 0 8px 30px rgba(0,0,0,.08); position: sticky; top: 20px; }
h1 { margin: 0 0 8px; font-size: 24px; }
.hint, .print-help { color: #667085; font-size: 13px; line-height: 1.55; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label { font-size: 13px; font-weight: 700; }
label small { display:block; margin-top:4px; color:#667085; font-weight:400; }
input, select, textarea { width: 100%; margin-top: 6px; padding: 10px 11px; border: 1px solid #cfd5df; border-radius: 8px; font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
button { border: 0; border-radius: 9px; padding: 11px 16px; font-weight: 700; background: #175cd3; color: white; cursor: pointer; }
button.secondary { background: #e8eef8; color: #344054; }
button.print-button { background: #067647; }
.model-settings, .position-settings { margin-top: 18px; border: 1px solid #d0d5dd; border-radius: 10px; padding: 12px; }
.model-settings summary, .position-settings summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.position-grid { margin-top: 12px; }
.preview-wrap { overflow: auto; padding-bottom: 20px; }
.paper { width: 210mm; height: 297mm; margin: 0 auto; background: white; box-shadow: 0 6px 24px rgba(0,0,0,.18); position: relative; }
.ticket { position:absolute; left:50%; width:var(--table-width, 174mm); transform-origin:top center; }
.ticket-top { top:var(--top-ticket-y, 20mm); transform:translateX(-50%) scale(var(--top-scale, 1)); }
.ticket-bottom { top:var(--bottom-ticket-y, 164mm); transform:translateX(-50%) scale(var(--bottom-scale, 1)); }
.ticket h2 { margin:0 0 5mm; text-align:center; font-size:18px; }
table { width:100%; border-collapse:collapse; table-layout:fixed; }
th, td { border:1px solid #111; height:var(--row-height, 13.2mm); }
th { width:var(--label-width, 69mm); text-align:left; padding:0 4mm; font-size:14px; font-weight:700; }
td { text-align:center; padding:0 3mm; font-size:20px; font-weight:700; overflow-wrap:anywhere; }
.tear { position:absolute; top:var(--tear-y, 150.5mm); left:13mm; right:13mm; border-top:1px dashed #111; }
.tear span { position:absolute; left:-7mm; top:-3.5mm; font-size:12px; }
@media (max-width: 1050px) { .layout { grid-template-columns: 1fr; } .panel { position: static; } }
@media (max-width: 600px) { .layout { padding: 14px; } .grid { grid-template-columns: 1fr; } }

select { background: white; }
textarea { margin-top: 8px; min-height: 150px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; line-height: 1.45; }
.model-save-button { margin-top: 10px; background: #7f56d9; }
.saved-message { margin: 8px 0 0; color: #067647; font-size: 13px; font-weight: 700; }

.settings-save-button { margin-top: 12px; background: #b54708; }
