/* Basic layout */
.ttl-receipt-wrap { box-sizing: border-box; }
.ttl-receipt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .ttl-receipt-grid { grid-template-columns: 1fr; } }

.ttl-form, .ttl-preview { background: #fff; padding: 16px; border: 1px solid #e5e7eb; border-radius: 12px; }
.ttl-form h3 { margin-top: 0; }
.ttl-row { display: flex; flex-direction: column; margin-bottom: 10px; }
.ttl-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ttl-row label { font-weight: 600; margin-bottom: 4px; }
.ttl-row input, .ttl-row textarea { padding: 8px; border: 1px solid #d1d5db; border-radius: 8px; width: 100%; }

.ttl-items { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.ttl-items th, .ttl-items td { border: 1px solid #e5e7eb; padding: 6px; font-size: 14px; }
.ttl-items input { width: 100%; padding: 6px; box-sizing: border-box; }

.ttl-btn { padding: 8px 12px; border: 1px solid #d1d5db; background: #f9fafb; border-radius: 8px; cursor: pointer; }
.ttl-btn:hover { background: #f3f4f6; }
.ttl-btn.primary { background: #111827; color: #fff; border-color: #111827; }
.ttl-btn:disabled { opacity: .6; cursor: not-allowed; }
.ttl-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

.ttl-note { font-size: 12px; color: #6b7280; }

/* Preview paper (A4-ish) */
.receipt-paper { background: #fff; color: #111827; padding: 18px; border: 1px solid #e5e7eb; border-radius: 8px; }
.r-header { display: grid; grid-template-columns: 120px 1fr 240px; gap: 12px; align-items: center; }
.r-logo img { max-width: 100%; height: auto; }
.r-name { font-size: 18px; font-weight: 700; }
.r-doc .r-title { font-size: 20px; font-weight: 800; margin-bottom: 6px; }

.r-customer { border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px; margin: 10px 0; }
.r-table { width: 100%; border-collapse: collapse; }
.r-table th, .r-table td { border: 1px solid #e5e7eb; padding: 6px; font-size: 13px; }
.r-table th { background: #f3f4f6; }

.r-summary { display: grid; grid-template-columns: 1fr 320px; gap: 12px; margin-top: 10px; }
.r-summary-right > div { display: flex; justify-content: space-between; padding: 4px 0; }
.r-summary-right .r-grand { font-weight: 800; border-top: 2px solid #000; margin-top: 6px; padding-top: 8px; }

.r-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 24px; }
.r-sign-box { text-align: center; }
.r-sign-box .line { border-bottom: 1px solid #111827; margin: 40px 40px 8px; }

/* Print styles */
@media print {
  .ttl-actions, .ttl-preview-actions { display: none !important; }
  .ttl-receipt-grid { grid-template-columns: 1fr; }
  .ttl-form { display: none; }
  .receipt-paper { border: none; }
}
