body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f4f4f4;
  color: #222;
}

.app {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 20px;
  padding: 20px;
  height: 100vh;
  box-sizing: border-box;
  overflow: hidden;
}

.panel {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  min-height: 0;
  overflow-y: auto;
}

label {
  display: block;
  margin-top: 12px;
  margin-bottom: 6px;
  font-weight: bold;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

input,
textarea,
select,
button {
  width: 100%;
  padding: 8px;
  font-size: 14px;
  margin-bottom: 8px;
  box-sizing: border-box;
}

button {
  background: rgb(249, 249, 249);
  color: black;
  border: 1px solid #bbb;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background: #cbcbcb;
}

.secondary-action-btn {
  background: black;
  color: white;
  border: none;
}

.secondary-action-btn:hover {
  background: #292929;
}

.preview-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.backup-note{
  font-size: 12px;
  color: rgb(100, 100, 100);
}

.invoice-preview {
  background: white;
  color: #111;
  border: none;
  padding: 52px 60px 56px;
  min-height: auto;
  box-shadow: none;
  font-size: 13px;
  line-height: 1.38;
  box-sizing: border-box;
}

.invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 28px;
  margin-bottom: 24px;
}

.invoice-title {
  font-size: 25px;
  font-weight: 800;
  letter-spacing: 1.8px;
  margin-bottom: 12px;
}

.invoice-head-right {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.invoice-identity {
  max-width: 300px;
}

.business-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 2px;
  line-height: 1.2;
}

.muted {
  color: #666;
  white-space: pre-line;
  line-height: 1.35;
}

.invoice-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  min-width: 170px;
  text-align: right;
}

.invoice-meta div {
  margin-bottom: 0;
  line-height: 1.2;
}

.invoice-meta .section-label {
  margin-bottom: 2px;
}

.invoice-blocks {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 28px;
  margin-bottom: 34px;
}

.section-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  font-weight: 700;
  color: #a2a2a2;
  margin-bottom: 8px;
}

.info-card {
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
  line-height: 1.38;
}

.items-section {
  margin-bottom: 26px;
}

.preview-item {
  display: grid;
  grid-template-columns: 2.6fr 60px 110px 110px;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid #ddddda;
  align-items: start;
}

.preview-item > div:last-child {
  text-align: right;
}

.preview-item.header {
  font-weight: 700;
  border-bottom: 1px solid #b5b5b3;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1.3px;
  color: #a0a0a0;
  padding-bottom: 8px;
}

.preview-item.header > div:last-child {
  text-align: right;
}

.totals-wrap {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 42px;
}

.totals-box {
  width: 300px;
  padding-top: 0;
  border-top: none;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid transparent;
}

.grand-total {
  font-size: 16px;
  font-weight: 800;
  border-top: 2px solid #8d8d8b;
  margin-top: 4px;
  padding-top: 12px;
}

.bottom-sections {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: 18px;
}

.notes-box {
  background: transparent;
  border: none;
  padding: 0 0 4px 0;
}

.notes-text {
  color: #555;
  line-height: 1.45;
}

.payment-table {
  background: transparent;
  border: none;
  padding: 0;
  max-width: 360px;
}

.payment-row {
  display: grid;
  grid-template-columns: 100px auto;
  gap: 10px;
  padding: 4px 0;
  align-items: start;
}

.payment-row div:last-child {
  text-align: left;
  font-weight: 500;
  padding-left: 40px;
}

.payment-label {
  color: #7d7d7d;
}

#previewPayment {
  white-space: normal;
  line-height: 1.7;
}

.form-section {
  border-bottom: 1px solid #e7e7e7;
  padding-bottom: 14px;
  margin-bottom: 18px;
}

.form-section summary {
  list-style: none;
  cursor: pointer;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
  text-transform: lowercase;
}

.form-section summary::-webkit-details-marker {
  display: none;
}

.form-section summary::after {
  content: "+";
  float: right;
  font-size: 20px;
  font-weight: 400;
  color: #888;
}

.form-section[open] summary::after {
  content: "−";
}

.form-panel {
  display: flex;
  flex-direction: column;
}

#previewClientName {
  font-weight: 700;
  margin-bottom: 6px;
}

#previewClientAddress {
  margin-bottom: 6px;
  line-height: 1.4;
}

#previewClientContact {
  margin-bottom: 6px;
}

#previewClientTax {
  margin-bottom: 0;
  max-width: 260px;
}

#previewYourAddress,
#previewClientAddress,
#previewClientTax,
#previewNotes {
  white-space: pre-line;
}

@page {
  size: A4 portrait;
  margin: 0;
}