.receipt-layout {
  display: grid; grid-template-columns: 420px 1fr;
  gap: 24px; align-items: start;
}
.receipt-form-panel {
  background: #fff; border: 1px solid var(--border); border-radius: 18px;
  padding: 24px; box-shadow: var(--sh); display: flex; flex-direction: column; gap: 20px;
}
.rform-section { display: flex; flex-direction: column; gap: 10px; }
.rform-title {
  font-size: 12px; font-weight: 800; color: var(--text2);
  text-transform: uppercase; letter-spacing: .6px;
  padding-bottom: 8px; border-bottom: 2px solid var(--p-lt);
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11px; font-weight: 600; color: var(--text2); letter-spacing: .3px; }
.field input, .field select {
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: 'Inter', sans-serif; color: var(--text);
  background: #fff; outline: none; transition: border-color .18s;
}
.field input:focus, .field select:focus { border-color: var(--p); box-shadow: 0 0 0 3px rgba(105,56,239,.1); }
.field select {
  appearance: none; cursor: pointer;
  background-image: 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='%23667085' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Line items */
#lineItems { display: flex; flex-direction: column; gap: 8px; }
.line-item-row { display: grid; grid-template-columns: 1fr 60px 80px 30px; gap: 6px; align-items: center; }
.line-item-row input {
  padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 7px;
  font-size: 12.5px; font-family: 'Inter', sans-serif; color: var(--text);
  outline: none; transition: border-color .15s;
}
.line-item-row input:focus { border-color: var(--p); }
.remove-item-btn {
  width: 28px; height: 28px; border: none; background: #fee2e2; color: #b91c1c;
  border-radius: 6px; cursor: pointer; font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.remove-item-btn:hover { background: #fecaca; }
.add-line-btn {
  align-self: flex-start; padding: 7px 14px; background: var(--p-lt); color: var(--p);
  border: none; border-radius: 8px; font-size: 12px; font-weight: 700;
  font-family: 'Inter', sans-serif; cursor: pointer; transition: background .15s;
}
.add-line-btn:hover { background: #ddd6fe; }

.preview-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 13px; background: var(--p); color: #fff; border: none;
  border-radius: 11px; font-size: 14px; font-weight: 700;
  font-family: 'Inter', sans-serif; cursor: pointer;
  box-shadow: 0 4px 16px rgba(105,56,239,.3); transition: background .15s, transform .1s;
}
.preview-btn:hover { background: var(--p-d); transform: translateY(-1px); }

/* Preview Panel */
.receipt-preview-panel {
  background: #fff; border: 1px solid var(--border); border-radius: 18px;
  box-shadow: var(--sh); overflow: hidden; position: sticky; top: 20px;
}
.preview-header {
  padding: 14px 20px; background: var(--p-llt); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.preview-label { font-size: 13px; font-weight: 700; color: var(--text); }
.print-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px; background: var(--p); color: #fff; border: none;
  border-radius: 8px; font-size: 12.5px; font-weight: 700;
  font-family: 'Inter', sans-serif; cursor: pointer; transition: background .15s;
}
.print-btn:hover:not(:disabled) { background: var(--p-d); }
.print-btn:disabled { opacity: .45; cursor: not-allowed; }
.receipt-preview-area { padding: 24px; min-height: 400px; }
.receipt-preview-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 300px; color: var(--text3); text-align: center;
}
.prev-empty-icon {
  width: 60px; height: 60px; border-radius: 50%; background: var(--p-lt); color: var(--p);
  display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
}
.receipt-preview-placeholder p { font-size: 14px; }

/* Receipt body (generated) */
.receipt-body {
  font-family: 'Courier New', Courier, monospace; font-size: 13px;
  max-width: 380px; margin: 0 auto; background: #fff;
  border: 1px solid #e0e0e0; border-radius: 4px; padding: 24px 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
}
.receipt-store-name { font-size: 18px; font-weight: 700; text-align: center; margin-bottom: 4px; font-family: 'Inter', sans-serif; }
.receipt-store-addr { font-size: 12px; text-align: center; color: #444; margin-bottom: 4px; }
.receipt-divider { border: none; border-top: 1px dashed #999; margin: 10px 0; }
.receipt-meta { font-size: 11.5px; color: #555; }
.receipt-meta-row { display: flex; justify-content: space-between; margin-bottom: 2px; }
.receipt-items-header { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; font-weight: 700; font-size: 11.5px; padding: 4px 0; border-bottom: 1px solid #ccc; }
.receipt-item-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; padding: 3px 0; font-size: 12.5px; }
.receipt-totals { margin-top: 4px; }
.receipt-total-row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 2px 0; }
.receipt-total-row.grand { font-weight: 700; font-size: 14px; border-top: 1px solid #999; padding-top: 6px; margin-top: 4px; }
.receipt-footer { text-align: center; font-size: 11.5px; color: #555; margin-top: 8px; }
.receipt-barcode { text-align: center; font-size: 28px; letter-spacing: 2px; margin: 8px 0 4px; color: #333; }

@media (max-width: 960px) {
  .receipt-layout { grid-template-columns: 1fr; }
  .receipt-preview-panel { position: static; }
}
@media (max-width: 640px) {
  .line-item-row { grid-template-columns: 1fr 50px 70px 28px; }
  .receipt-form-panel { padding: 18px; }
}

@media print {
  body { background: white; }
  nav, footer, #hero, #tool-wrapper, .pg-section, .cta-banner { display: none !important; }
  .receipt-body { box-shadow: none; border: none; max-width: 100%; }
}
