.neksiotool-invoice {
  font-family: Arial, sans-serif;
  max-width: 1100px;
  margin: 0 auto;
  background: #f5f7fa;
  padding: 20px;
}

/* Print Styles - COMPLETELY FIXED WITH COLORS */
@media print {
  /* Hide EVERYTHING except preview */
  body, 
  body *:not(#ni-preview):not(#ni-preview *) {
    visibility: hidden !important;
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
  }
  
  /* Show ONLY preview */
  #ni-preview,
  .ni-preview,
  .ni-preview * {
    visibility: visible !important;
    display: block !important;
    position: relative !important;
    width: auto !important;
    height: auto !important;
    opacity: 1 !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #000000 !important;
    background: white !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  /* Preview container */
  .ni-preview {
    display: block !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
    z-index: 999999 !important;
    box-shadow: none !important;
    border: none !important;
  }
  
  .ni-preview.show {
    display: block !important;
  }
  
  .ni-preview-inner {
    padding: 30px !important;
    background: white !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
  }
  
  /* Page settings */
  @page {
    margin: 15mm;
    size: A4 portrait;
  }
  
  /* FIX: Force background colors for print - THIS IS THE KEY FIX */
  .ni-preview-header {
    background-color: #233242 !important;
    background: #233242 !important;
    color: white !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    forced-color-adjust: none !important;
  }
  
  .ni-header-left {
    background-color: #233242 !important;
    background: #233242 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    forced-color-adjust: none !important;
  }
  
  .ni-header-middle {
    background: #7cb342 !important;
    background-color: #7cb342 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    forced-color-adjust: none !important;
  }
  
  .ni-header-right {
    background-color: #233242 !important;
    background: #233242 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    forced-color-adjust: none !important;
  }
  
  .ni-invoice-title {
    color: #7cb342 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .ni-items-table th {
    background-color: #7cb342 !important;
    background: #7cb342 !important;
    color: white !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    forced-color-adjust: none !important;
  }
  
  .ni-items-table th.text-center,
  .ni-items-table th.text-right {
    background-color: #233242 !important;
    background: #233242 !important;
    color: white !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    forced-color-adjust: none !important;
  }
  
  .ni-totals-section {
    border: 2px solid #7cb342 !important;
  }
  
  .ni-grand-total {
    color: #233242 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .ni-address-title,
  .ni-section-title {
    color: #7cb342 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .ni-footer-thanks {
    color: #7cb342 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .ni-footer-section {
    background-color: #233242 !important;
    background: #233242 !important;
    color: white !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    forced-color-adjust: none !important;
  }
  
  /* Hide all other elements */
  .neksiotool-invoice,
  .ni-controls,
  .ni-form,
  .ni-btn,
  .no-print,
  #ni-toggle-preview,
  #ni-print,
  #ni-add-item,
  input,
  textarea,
  button,
  label,
  .ni-items,
  .ni-row,
  .ni-col,
  .ni-hint {
    display: none !important;
    visibility: hidden !important;
  }
  
  /* Clean print output */
  * {
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  /* Page break control */
  .ni-preview-inner {
    page-break-inside: avoid;
  }
  
  .ni-items-table {
    page-break-inside: avoid;
  }
  
  .ni-bottom-section {
    page-break-inside: avoid;
  }
}

/* Controls */
.ni-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  padding: 15px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  flex-wrap: wrap;
  align-items: center;
}

.ni-btn {
  padding: 10px 20px;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s;
}

.ni-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.ni-btn--primary {
  background: #233242;
  color: #fff;
}

.ni-btn--success {
  background: #7cb342;
  color: #fff;
}

.ni-btn--outline {
  background: #fff;
  border: 2px solid #7cb342;
  color: #7cb342;
}

.ni-hint {
  margin-left: auto;
  font-size: 13px;
  color: #666;
}

.ni-hint strong {
  color: #233242;
}

/* Form layout */
.ni-form {
  background: #fff;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

.ni-row {
  display: flex;
  gap: 25px;
  margin-bottom: 20px;
}

.ni-col {
  flex: 1;
}

.ni-col label {
  font-size: 13px;
  color: #233242;
  margin-bottom: 5px;
  display: block;
  font-weight: 600;
}

.ni-col input,
.ni-col textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  margin-bottom: 15px;
  font-size: 14px;
  transition: border-color 0.3s;
}

.ni-col input:focus,
.ni-col textarea:focus {
  outline: none;
  border-color: #7cb342;
}

.ni-col textarea {
  min-height: 100px;
  resize: vertical;
}

/* Items Area */
.ni-items {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  margin: 25px 0;
  border: 2px solid #e9ecef;
}

.ni-items-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.ni-items-header h3 {
  margin: 0;
  color: #233242;
  font-size: 18px;
}

/* Items list styling */
.ni-item {
  display: grid;
  grid-template-columns: 2fr 100px 80px 100px 40px;
  gap: 10px;
  align-items: start;
  padding: 12px;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  margin-bottom: 10px;
}

.ni-item-desc {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ni-item-index {
  font-weight: bold;
  color: #233242;
}

.ni-input-desc {
  padding: 8px;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-weight: 600;
}

.ni-input-details {
  padding: 6px 8px;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-size: 13px;
  resize: vertical;
  min-height: 40px;
}

.ni-item-price input,
.ni-item-qty input {
  width: 100%;
  padding: 8px;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  text-align: center;
}

.ni-item-total-display {
  padding: 8px;
  font-weight: 600;
  color: #233242;
  text-align: center;
  background: #f8f9fa;
  border-radius: 4px;
}

.ni-btn-remove {
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 4px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.ni-btn-remove:hover {
  background: #c82333;
}

/* Preview */
.ni-preview {
  margin-top: 20px;
  padding: 0;
  background: #fff;
  border-radius: 0;
  box-shadow: 0 0 30px rgba(0,0,0,0.1);
  display: none;
}

.ni-preview.show {
  display: block;
}

.ni-preview-inner {
  padding: 30px;
  min-height: 1123px;
}

/* Header design */
.ni-preview-header {
  display: flex;
  background: #233242;
  color: #fff;
  min-height: 150px;
  position: relative;
  overflow: hidden;
}

.ni-header-left {
  flex: 0 0 60%;
  padding: 25px;
  display: flex;
  gap: 20px;
  align-items: center;
}

.ni-logo-area {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
}

.ni-preview-logo {
  width: 120px;
  height: 120px;
  object-fit: contain;
  background: #fff;
  border-radius: 4px;
}

.ni-company-info-preview {
  flex: 1;
}

.ni-company-name-preview {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 5px;
}

.ni-company-tagline-preview {
  font-size: 14px;
  color: #cbd5e1;
}

.ni-header-middle {
  width: 80px;
  background: linear-gradient(180deg, #7cb342, #558b2f);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 20% 100%);
}

.ni-header-right {
  flex: 1;
  padding: 25px;
  text-align: right;
}

.ni-invoice-title {
  font-size: 36px;
  font-weight: 900;
  color: #7cb342;
  margin-bottom: 15px;
  letter-spacing: 1px;
}

.ni-invoice-number,
.ni-invoice-date {
  font-size: 14px;
  margin-bottom: 5px;
}

/* Addresses */
.ni-addresses {
  display: flex;
  justify-content: space-between;
  margin-top: 25px;
  padding: 20px 0;
  border-bottom: 2px solid #e9ecef;
}

.ni-to-address,
.ni-from-address {
  flex: 1;
}

.ni-address-title {
  color: #7cb342;
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 10px;
}

.ni-client-name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 5px;
  color: #233242;
}

.ni-client-position {
  color: #666;
  font-size: 14px;
  margin-bottom: 8px;
}

.ni-client-contact {
  color: #666;
  font-size: 14px;
  margin-bottom: 3px;
}

.ni-from-address {
  text-align: right;
}

/* Table */
.ni-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 25px;
  font-size: 13px;
}

.ni-items-table th {
  background: #7cb342;
  color: #fff;
  padding: 12px 10px;
  text-align: left;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ni-items-table th.text-center {
  background: #233242;
  text-align: center;
}

.ni-items-table th.text-right {
  background: #233242;
  text-align: right;
}

.ni-items-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #e9ecef;
}

.ni-item-title {
  font-weight: 600;
  color: #233242;
  margin-bottom: 5px;
}

.ni-item-desc {
  font-size: 12px;
  color: #666;
  line-height: 1.4;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

/* Bottom Section */
.ni-bottom-section {
  display: flex;
  justify-content: space-between;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 2px solid #e9ecef;
}

.ni-payment-section {
  flex: 1;
}

.ni-section-title {
  color: #7cb342;
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 15px;
}

.ni-payment-details {
  font-size: 14px;
  color: #233242;
  line-height: 1.8;
}

.ni-signature {
  margin-top: 40px;
}

.ni-totals-section {
  width: 320px;
}

.ni-totals {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 6px;
}

.ni-total-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #dee2e6;
  font-size: 14px;
  color: #233242;
}

.ni-grand-total {
  display: flex;
  justify-content: space-between;
  padding: 15px 0;
  font-size: 20px;
  font-weight: 700;
  color: #233242;
  border-top: 2px solid #dee2e6;
  margin-top: 10px;
}

/* Terms */
.ni-terms-section {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e9ecef;
}

.ni-terms-text {
  font-size: 12px;
  color: #666;
  line-height: 1.6;
  text-align: justify;
}

/* Footer */
.ni-footer-section {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e9ecef;
  text-align: center;
  background: #233242;
  color: white;
  padding: 25px;
  margin-bottom: 0;
}

.ni-footer-contact {
  font-size: 13px;
  color: #cbd5e1;
  margin-bottom: 10px;
}

.ni-footer-thanks {
  font-size: 16px;
  font-weight: 600;
  color: #7cb342;
}