*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f0ede8;
  min-height: 100vh;
  padding: 24px 16px 48px;
  color: #1a1a1a;
}

.container {
  max-width: 580px;
  margin: 0 auto;
}

header {
  margin-bottom: 24px;
}

h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.store-label {
  font-size: 0.8rem;
  color: #888;
  margin-top: 4px;
  letter-spacing: 0.5px;
}

.register-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

h2 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
  margin-bottom: 14px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

label span {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #888;
}

input[type="text"],
input[type="number"] {
  border: 1.5px solid #e0e0e0;
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 0.9rem;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.15s;
  background: #fafafa;
}

input:focus {
  outline: none;
  border-color: #3b82f6;
  background: #fff;
}

/* Items list */
.item-row {
  display: grid;
  grid-template-columns: 1fr 110px 36px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.header-row {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #888;
  margin-bottom: 6px;
}

.item-row input {
  margin: 0;
}

.btn-remove {
  background: none;
  border: 1.5px solid #e0e0e0;
  border-radius: 7px;
  color: #999;
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  height: 36px;
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-remove:hover {
  border-color: #f87171;
  color: #ef4444;
  background: #fef2f2;
}

.btn-add {
  background: none;
  border: 1.5px dashed #cbd5e1;
  border-radius: 7px;
  color: #64748b;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 14px;
  width: 100%;
  margin-top: 4px;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-add:hover {
  border-color: #3b82f6;
  color: #3b82f6;
  background: #eff6ff;
}

.subtotal-preview {
  margin-top: 12px;
  font-size: 0.85rem;
  color: #64748b;
  text-align: right;
  min-height: 20px;
}

.subtotal-preview strong {
  color: #1a1a1a;
}

.btn-generate {
  width: 100%;
  padding: 15px;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 20px;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.3px;
}

.btn-generate:hover { background: #333; }
.btn-generate:active { transform: scale(0.99); }
.btn-generate:disabled { background: #94a3b8; cursor: not-allowed; }

/* Output */
.output-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

#receiptImg {
  max-width: 100%;
  border-radius: 6px;
  display: block;
  margin: 0 auto 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.btn-download {
  display: inline-block;
  padding: 10px 24px;
  background: #f8f8f8;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #333;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-download:hover {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #fff;
}

.error {
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  border-radius: 8px;
  padding: 12px 16px;
  color: #dc2626;
  font-size: 0.88rem;
  margin-top: 8px;
}

.hidden { display: none; }

@media (max-width: 480px) {
  .grid-2 { grid-template-columns: 1fr; }
}
