.neksiotool-invoice {
  font-family: Arial, sans-serif;
  max-width: 1100px;
  margin: 0 auto;
  background: #f5f7fa;
  padding: 20px;
}

/* Print Styles - STANDALONE GLOBAL SHELL & THEME COMPATIBLE */
@media print {
  /* Parent Ancestors must remain renderable */
  html,
  body,
  main,
  #page,
  #content,
  #primary,
  #main,
  .site,
  .site-content,
  .site-main,
  .elementor,
  .elementor-section,
  .elementor-container,
  .elementor-column,
  .elementor-widget,
  .nek-standalone-content,
  .nek-content-container,
  .nek-tool-ui-wrapper,
  .neksiotool-invoice {
    display: block !important;
    visibility: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    background: #ffffff !important;
    float: none !important;
    position: static !important;
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
    box-shadow: none !important;
  }
  
  /* Hide non-invoice site elements, header, footer, controls & form */
  header,
  footer,
  nav,
  aside,
  .site-header,
  .site-footer,
  .nek-standalone-header,
  .neksio-breadcrumb,
  .nek-tool-intro-block,
  .nek-shell-related-section,
  .nek-standalone-footer,
  .ni-controls,
  .ni-form,
  .ni-btn,
  .no-print,
  #ni-toggle-preview,
  #ni-print,
  #ni-preview-pdf,
  #ni-download-pdf,
  #ni-add-item,
  .ni-hint,
  .ni-pdf-modal,
  #ni-pdf-modal {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
  }

  /* Show Final Invoice Preview */
  #ni-preview,
  .ni-preview,
  .ni-preview.show,
  .ni-preview-inner {
    display: block !important;
    visibility: visible !important;
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
    background: #ffffff !important;
    box-shadow: none !important;
    border: none !important;
    opacity: 1 !important;
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
  }

  /* Page settings */
  @page {
    margin: 15mm;
    size: A4 portrait;
  }

  /* Force background colors and typography for print */
  .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;
  }

  /* Clean print output */
  * {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  /* Page break control */
  .ni-preview-inner,
  .ni-items-table,
  .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;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.ni-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.ni-btn:disabled,
.ni-btn.is-disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.ni-btn--primary {
  background: #233242;
  color: #fff;
}

.ni-btn--info {
  background: #0284c7;
  color: #fff;
}

.ni-btn--info:hover {
  background: #0369a1;
}

.ni-btn--success {
  background: #7cb342;
  color: #fff;
}

.ni-btn--success:hover {
  background: #689f38;
}

.ni-btn--outline {
  background: #fff;
  border: 2px solid #7cb342;
  color: #7cb342;
}

.ni-btn--outline:hover {
  background: #f1f8e9;
}

.ni-btn--small {
  padding: 6px 14px;
  font-size: 12px;
}

.ni-hint {
  margin-left: auto;
  font-size: 13px;
  color: #666;
}

.ni-hint strong {
  color: #233242;
}

/* PDF Preview Modal */
.ni-pdf-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ni-pdf-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
}

.ni-pdf-modal-container {
  position: relative;
  z-index: 2;
  width: 90%;
  max-width: 960px;
  height: 88vh;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ni-pdf-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #233242;
  color: #ffffff;
  border-bottom: 1px solid #334155;
}

.ni-pdf-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

.ni-pdf-modal-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ni-pdf-modal-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 24px;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}

.ni-pdf-modal-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.ni-pdf-modal-body {
  flex: 1;
  background: #525659;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ni-pdf-modal-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

/* 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;
  align-items: flex-start;
}

.ni-col {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.ni-field-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
}

.ni-col label,
.ni-field-group label {
  font-size: 13px;
  color: #233242;
  margin-bottom: 6px;
  display: block;
  font-weight: 600;
}

.ni-col input,
.ni-col textarea,
.ni-field-group input,
.ni-field-group textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  margin-bottom: 0;
  font-size: 14px;
  transition: border-color 0.3s;
}

.ni-col input:focus,
.ni-col textarea:focus,
.ni-field-group input:focus,
.ni-field-group 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;
}