/* Container */
.erg-wrap { max-width: 1000px; margin: 24px auto; padding: 0 12px; font-family: Arial, Helvetica, sans-serif; color: #111; }
.erg-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 20px; box-shadow: 0 10px 20px rgba(0,0,0,0.04); }
.erg-title { margin: 0 0 6px; font-size: 22px; }

/* Form */
#erg-form label { display: grid; gap: 6px; margin-bottom: 12px; font-size: 14px; }
#erg-form input, #erg-form textarea, #erg-form select { padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; width: 100%; }
#erg-form textarea { resize: vertical; }
.erg-fieldset { border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px; margin-bottom: 16px; }
.erg-fieldset legend { padding: 0 6px; color: #374151; font-weight: 600; }
.erg-grid { display: grid; gap: 16px; grid-template-columns: repeat( auto-fit, minmax(260px, 1fr) ); }

/* Items */
.erg-items-head { display: grid; grid-template-columns: 2fr 1.2fr .6fr 1fr 1fr 36px; gap: 8px; padding: 8px 6px; color:#6b7280; font-size: 12px; }
.erg-item-row { display: grid; grid-template-columns: 2fr 1.2fr .6fr 1fr 1fr 36px; gap: 8px; margin-bottom: 8px; align-items: center; }
.erg-item-total { text-align: right; padding-right: 8px; }
.erg-remove { background: #fee2e2; border: 1px solid #fecaca; border-radius: 8px; font-size: 18px; line-height: 1; padding: 6px 0; cursor: pointer; }
.erg-remove:hover { background: #fecaca; }

/* Add item button always visible */
#erg-add-item.erg-add-visible { display: inline-block; margin-top: 8px; }

/* Buttons */
.erg-actions { display:flex; gap: 10px; }
.erg-btn { border: 1px solid #d1d5db; background: #fff; border-radius: 10px; padding: 10px 14px; cursor: pointer; font-weight: 600; }
.erg-btn:hover { background: #f3f4f6; }
.erg-primary { background: #111827; color: #fff; border-color: #111827; }
.erg-primary:hover { background: #000; }
.erg-ghost { background: transparent; }

/* Receipt */
.erg-receipt-wrap { margin-top: 20px; }
.erg-receipt { background: #fff; border:1px solid #e5e7eb; border-radius: 12px; padding: 24px; position: relative; }
.erg-receipt-header { display:flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 12px; }
.erg-brand { display:flex; gap: 12px; align-items: center; }
.erg-logo { width: 48px; height: 48px; object-fit: contain; }
.erg-brand-text .erg-h1 { font-size: 24px; margin: 0; }
.erg-meta { text-align: right; font-size: 14px; }
.erg-columns { display:grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.erg-block { white-space: pre-wrap; }
.erg-table { width: 100%; border-collapse: collapse; }
.erg-table th, .erg-table td { border-top:1px solid #e5e7eb; padding: 10px 8px; font-size: 14px; }
.erg-table th { text-align: left; background: #f9fafb; }
.erg-table .num { text-align: right; }
.erg-total-row td { border-top:2px solid #111827; font-size: 16px; }
.erg-empty { text-align:center; color:#6b7280; }
.erg-notes { margin-top: 16px; }
.erg-footer { display:flex; justify-content: flex-end; margin-top: 16px; }

/* Print styles - force single page */
@media print {
  @page {
    size: A4;
    margin: 10mm;
  }
  body * { visibility: hidden !important; }
  #erg-print-area, #erg-print-area * { visibility: visible !important; }
  #erg-print-area { position: absolute; left: 0; top: 0; width: 100%; transform: scale(0.9); transform-origin: top left; }
  .erg-receipt { page-break-inside: avoid !important; }
  .erg-receipt * { page-break-inside: avoid !important; }
  .erg-footer { display:none; }
}
