* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, sans-serif;
  background: #f3f6fb;
  color: #172033;
  min-height: 100vh;
  padding: 30px;
}

.app-container {
  max-width: 1400px;
  margin: 0 auto;
}

.hero-section {
  text-align: center;
  margin-bottom: 30px;
}

.hero-section h1 {
  font-size: 42px;
  color: #0f172a;
  margin-bottom: 10px;
}

.hero-section p {
  color: #64748b;
  line-height: 1.6;
}

.invoice-layout {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 24px;
  align-items: start;
}

.form-panel,
.preview-panel {
  background: #ffffff;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.08);
}

.form-panel h2,
.preview-panel h2 {
  color: #0f172a;
  margin-bottom: 20px;
}

.form-section {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 14px;
  background: #fbfdff;
}

.form-section h3 {
  font-size: 18px;
  margin-bottom: 12px;
  color: #1e293b;
}

label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 7px;
  margin-top: 10px;
}

input,
textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 15px;
  outline: none;
  background: #ffffff;
  color: #0f172a;
}

textarea {
  resize: vertical;
  min-height: 72px;
}

input:focus,
textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.invoice-items-section {
  padding-bottom: 18px;
}

.items-list {
  margin-top: 14px;
}

.item-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 5px solid #2563eb;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
}

.item-card strong {
  display: block;
  margin-bottom: 4px;
}

.item-card span {
  color: #64748b;
  font-size: 14px;
}

.primary-btn,
.secondary-btn,
.light-btn,
.print-btn,
.download-btn,
.remove-btn {
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}

.primary-btn {
  background: #2563eb;
  color: #ffffff;
}

.primary-btn:hover {
  background: #1d4ed8;
}

.secondary-btn {
  background: #0f766e;
  color: #ffffff;
  width: 100%;
  margin-top: 12px;
}

.secondary-btn:hover {
  background: #115e59;
}

.light-btn {
  background: #e2e8f0;
  color: #0f172a;
}

.light-btn:hover {
  background: #cbd5e1;
}

.print-btn {
  background: #16a34a;
  color: #ffffff;
}

.print-btn:hover {
  background: #15803d;
}

.download-btn {
  background: #7c3aed;
  color: #ffffff;
}

.download-btn:hover {
  background: #6d28d9;
}

.remove-btn {
  background: #fee2e2;
  color: #b91c1c;
  padding: 9px 12px;
  font-size: 14px;
}

.remove-btn:hover {
  background: #fecaca;
}

.message {
  min-height: 0;
  margin: 4px 0 6px;
  font-weight: 700;
  color: #dc2626;
}

.message.success {
  color: #16a34a;
}

.button-row {
  display: flex;
  gap: 12px;
  margin-top: 0;
}

.button-row button {
  flex: 1;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.preview-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.invoice-preview {
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 28px;
  background: #ffffff;
}

.invoice-top {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 20px;
  margin-bottom: 22px;
}

.invoice-top p,
.bill-to-box p {
  color: #64748b;
  line-height: 1.5;
}

.invoice-title-box {
  text-align: right;
}

.invoice-title-box h1 {
  color: #2563eb;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.bill-to-box {
  background: #f8fafc;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 22px;
}

.small-label {
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
  color: #2563eb !important;
  margin-bottom: 6px;
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 22px;
}

.invoice-table th,
.invoice-table td {
  padding: 13px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.invoice-table th {
  background: #0f172a;
  color: #ffffff;
  font-size: 14px;
}

.totals-box {
  max-width: 300px;
  margin-left: auto;
  background: #f8fafc;
  border-radius: 14px;
  padding: 16px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
}

.grand-total {
  border-top: 2px solid #cbd5e1;
  margin-top: 8px;
  padding-top: 14px;
  color: #16a34a;
  font-size: 20px;
}

.thank-you-text {
  text-align: center;
  margin-top: 28px;
  color: #64748b;
  font-weight: 700;
}

@media print {
  body {
    background: #ffffff;
    padding: 0;
  }

  .hero-section,
  .form-panel,
  .preview-header {
    display: none;
  }

  .invoice-layout {
    display: block;
  }

  .preview-panel {
    box-shadow: none;
    padding: 0;
  }

  .invoice-preview {
    border: none;
    border-radius: 0;
  }
}

@media (max-width: 950px) {
  body {
    padding: 18px;
  }

  .invoice-layout {
    grid-template-columns: 1fr;
  }

  .hero-section h1 {
    font-size: 34px;
  }

  .preview-header {
    flex-direction: column;
    align-items: stretch;
  }

  .preview-actions {
    width: 100%;
  }

  .preview-actions button {
    flex: 1;
  }
}

@media (max-width: 600px) {
  body {
    padding: 12px;
  }

  .form-panel,
  .preview-panel {
    padding: 16px;
    border-radius: 16px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .invoice-top {
    flex-direction: column;
  }

  .invoice-title-box {
    text-align: left;
  }

  .button-row,
  .preview-actions {
    flex-direction: column;
  }

  .item-card {
    grid-template-columns: 1fr;
  }

  .remove-btn {
    width: 100%;
  }

  .invoice-preview {
    padding: 18px;
  }
}