* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 20px;
  font-family: "Times New Roman", serif;
  background: #f3f4f6;
}

.layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.panel {
  background: #ffffff;
  padding: 16px 20px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.form-panel {
  width: 35%;
  max-width: 420px;
}

.preview-panel {
  width: 65%;
}

h1 {
  font-size: 22px;
  margin: 0 0 10px;
}

label {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
  margin-top: 8px;
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-family: inherit;
  font-size: 13px;
}

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

.row {
  display: flex;
  gap: 10px;
}

.row > div {
  flex: 1;
}

button {
  padding: 8px 14px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  background: #111827;
  color: #fff;
  margin-top: 10px;
  transition: 0.15s;
}

button:hover {
  opacity: 0.9;
}

.secondary-btn {
  background: #e5e7eb;
  color: #111827;
}

/* ===== form items ===== */
.form-section-title {
  font-size: 14px;
  font-weight: 700;
  margin-top: 12px;
  margin-bottom: 4px;
}

.item-form-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.item-form-row > div {
  flex: 1;
}

/* ===== Document ===== */
.doc {
  position: relative;
  width: 800px;
  min-height: 1120px;
  margin: 0 auto;
  padding: 170px 70px 80px;
  background-image: url("../images/bg.png");
  background-size: 100% auto;
  background-repeat: no-repeat;
  background-position: top center;
  font-size: 13px;
  color: #000;
}

.invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 18px;
}

.invoice-title {
  font-size: 45px;
  font-weight: 900;
  letter-spacing: 3px;
}

.receipt-title {
  font-size: 35px;
  font-weight: 900;
  letter-spacing: 3px;
}

.invoice-meta-right {
  font-size: 13px;
  text-align: right;
}

.inline-label {
  font-weight: 700;
}

.highlight {
  font-weight: 700;
}

/* BILL TO */
.billto-box {
  margin-top: 14px;
  padding: 10px 12px;
  background: #8fd0f487;
}

.billto-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.billto-grid {
  display: flex;
  justify-content: flex-start;  
  gap: 12px;                   
  font-size: 13px;
}

.billto-grid > div:first-child {
  flex: 0 0 50%;
}

.billto-grid > div:last-child {
  flex: 0 0 50%;
  text-align: left;           
}

.billto-grid > div > div {
  margin: 2px 0;
}

/* Items table */
.items-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 18px;
  margin-bottom: 0;
}

.items-table th,
.items-table td {
  border: 1px solid #000;
  padding: 6px 8px;
  text-align: left;
}

.items-table th {
  font-weight: 700;
  text-align: center;
}

.item-col {
  font-weight: 700;
  vertical-align: middle;
  text-align: center;
}

.desc-col {
  text-align: center;
  vertical-align: middle;
}

.amount-col {
  text-align: right !important;
  vertical-align: middle;
}

.delete-item-btn {
    background: #ff4d4d;
    color: white;
    border: none;
    font-size: 16px;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    height: fit-content;
    align-self: flex-end;
    margin-top: 24px;
    }

    .delete-item-btn:hover {
    background: #e60000;
    }
/* column alignment for items + summary */
.col-1 {
  width: 65%;
  vertical-align: top;
}

.col-2 {
  width: 20%;
  padding-right: 10px;
  font-weight: 700;
  vertical-align: middle;
  border-right: 1px solid #000;
}

.col-3 {
  width: 15%;
  text-align: right !important;
  padding-right: 10px;
  font-weight: 700;
  vertical-align: middle;
  border-left: 1px solid #000;
}

/* Summary table */
.summary-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0;
  margin-bottom: 18px;
}

.summary-table td {
  border: 1px solid #000;
  padding: 6px 10px;
}

.summary-left {
  font-size: 12px;
  vertical-align: top;
}

/* Payment Instructions */
.section-heading {
  font-weight: 700;
  margin-top: 8px;
  margin-bottom: 4px;
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-actions .actions-row {
  display: flex;
  align-items: center;
}

.full-width-note {
  width: 100%;
}

.form-actions .actions-main .form-actions-right,
.form-actions .actions-create .form-actions-right {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* Note field fix */
.note-field {
  width: 100%;
  display: block;
  margin-top: 15px;
}

.note-field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  text-align: left;
}

.note-field textarea {
  width: 100% !important;
  box-sizing: border-box;
  padding: 10px;
  resize: vertical;
}

.payment-box {
  margin-top: 4px;
  background: #8fd0f487;
  padding: 10px 12px;
  display: flex;
  gap: 30px;
  font-size: 12px;
}

.payment-col {
  flex: 1;
}

.payment-box p {
  margin: 2px 0;
}

.payment-strong {
  font-weight: 700;
}

.transparentText {
    color: #8fd0f487;
  }

/* Terms */
.terms {
  margin-top: 12px;
  font-size: 12px;
}

.terms p {
  margin: 2px 0 4px;
}

/* Print */
@media print {
  body {
    background: #fff;
    padding: 0;
  }

  .layout {
    display: block;
  }

  .form-panel {
    display: none !important;
  }

  .preview-panel {
    width: 100%;
    box-shadow: none;
    padding: 0;
  }

  .doc {
    width: 100%;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 170px 70px 80px;
  }

  button {
    display: none;
  }

  

    
}

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

@media print {
  html, body {
    margin: 0;
    padding: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .doc {
    background-image: url("../images/bg.png");  
    background-size: 100% auto;
    background-repeat: no-repeat;
    background-position: top center;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

.input-error {
  border: 2px solid #ff4d4d !important;
  background: #ffecec !important;
}

.form-actions {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.form-actions-left,
.form-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-actions-right .primary-btn {
  font-weight: 600;
}


.btn-secondary { background: #1e75c8; color: white }
.btn-secondary:hover { background: #155ea3; }

.btn-purple { background: #7e44e3; color: white}
.btn-purple:hover { background: #622bb8; }