body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f7fa;
  margin: 0;
  padding: 20px;
  color: #333;
}

.invoice-container {
  background: #fff;
  max-width: 900px;
  margin: auto;
  padding: 40px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

/* === LOGO UPLOAD SECTION === */
.logo-upload {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 10px;
}
.logo-upload input[type="file"] {
  font-size: 13px;
  margin-top: 4px;
}
.logo-preview {
  max-height: 80px;
  max-width: 200px;
  object-fit: contain;
  padding: 5px;
  background: #fff;
  border-radius: 4px;
  margin-top: 10px;
  display: block;
}
.no-print .logo-preview {
  border: 1px solid #ccc;
}

/* === HEADER === */
.invoice-header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 30px;
  gap: 20px;
}
.left-header {
  flex: 1;
  min-width: 250px;
}
.invoice-meta {
  text-align: right;
}
.invoice-meta div {
  margin-bottom: 10px;
}
.invoice-meta label {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}
.invoice-meta input,
.invoice-meta select {
  padding: 10px 12px;
  height: 42px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  width: 160px;
  background-color: white;
  color: black;
}

.company-details h2 {
  margin: 0 0 10px;
}
.company-details p {
  margin: 0;
  white-space: pre-line;
}

/* === ADDRESS SECTION === */
.invoice-addresses {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 30px;
}
.invoice-addresses div {
  flex: 1;
}
.invoice-addresses label {
  display: block;
  font-weight: bold;
  margin-bottom: 6px;
}
.invoice-addresses textarea {
  width: 100%;
  height: 80px;
  padding: 10px 12px;
  resize: vertical;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}

/* === ITEMS TABLE === */
.invoice-items table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 15px;
}
.invoice-items th,
.invoice-items td {
  border: 1px solid #ddd;
  padding: 12px;
  text-align: left;
  font-size: 14px;
}
.invoice-items th {
  background-color: #f0f0f0;
}
.invoice-items td[contenteditable="true"] {
  background: #fcfcfc;
}
#add-row {
  background: #007bff;
  color: white;
  padding: 10px 14px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 10px;
}
#add-row:hover {
  background: #0056b3;
}

/* === NOTES AND TOTALS === */
.invoice-summary {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 30px;
  margin-top: 30px;
}
.invoice-notes {
  flex: 1;
}
.invoice-notes label {
  display: block;
  font-weight: bold;
  margin-bottom: 6px;
}
.invoice-notes textarea {
  width: 100%;
  height: 100px;
  padding: 10px 12px;
  resize: vertical;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}

/* === TOTALS BOX === */
.invoice-totals-box {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 15px;
  background: #fdfdfd;
  min-width: 260px;
  box-sizing: border-box;
}
.invoice-totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.invoice-totals-row input {
  width: 100px;
  height: 40px;                /* Ensures enough vertical space */
  line-height: 1.4;            /* Slightly taller line spacing */
  padding: 10px 12px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}
.invoice-totals-row label {
  flex: 1;
}
.invoice-totals-row.total {
  font-weight: bold;
  border-top: 1px solid #ccc;
  padding-top: 8px;
  margin-top: 12px;
}

/* === BUTTON === */
#download-btn {
  background: #28a745;
  color: white;
  padding: 12px 20px;
  border: none;
  font-size: 16px;
  border-radius: 4px;
  margin-top: 15px;
  cursor: pointer;
}
#download-btn:hover {
  background: #1e7e34;
}

/* === Responsive === */
@media (max-width: 768px) {
  .invoice-header,
  .invoice-summary,
  .invoice-addresses {
    flex-direction: column;
    text-align: left;
  }
  .invoice-meta {
    text-align: left;
  }
  .invoice-totals-box {
    margin-top: 20px;
  }
}

/* === PRINT CLEANUP === */
@media print {
  .no-print {
    display: none !important;
  }
}
