﻿@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&family=Tajawal:wght@400;500;700;800&family=Inter:wght@400;500;600;700;800&display=swap');

/* ==========================================================================
   Hisabat SA - Streamlined Invoice Generator Stylesheet
   - Authentic A4 Invoice Paper (Single-page fit & Clean multi-page overflow)
   - Pristine Arabic Typography (No broken Arabic letters/ligatures)
   - Dynamic Invoice Language Switching (Arabic RTL & English LTR)
   - Zero-clutter Print & PDF output (Delete buttons/actions strictly hidden)
   ========================================================================== */

:root {
  --ig-primary: #006C35;
  --ig-primary-hover: #00552a;
  --ig-paper-bg: #ffffff;
  --ig-paper-text: #1f2937;
  --ig-paper-border: #e5e7eb;
  --ig-paper-muted: #6b7280;
  --ig-table-header-bg: #006C35;
  --ig-table-header-text: #ffffff;
  --ig-row-alt: #f9fafb;
  --ig-focus-ring: rgba(0, 108, 53, 0.25);
  --ig-radius: 6px;
  --ig-font-ar: 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, sans-serif;
  --ig-font-en: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

button, input, select, textarea {
  font-family: inherit;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 12 Color Theme & Template Presets */
.ig-paper.theme-emerald {
  --ig-primary: #006C35;
  --ig-table-header-bg: #006C35;
  --ig-focus-ring: rgba(0, 108, 53, 0.25);
}
.ig-paper.theme-navy {
  --ig-primary: #1e3a8a;
  --ig-table-header-bg: #1e3a8a;
  --ig-focus-ring: rgba(30, 58, 138, 0.25);
}
.ig-paper.theme-charcoal {
  --ig-primary: #374151;
  --ig-table-header-bg: #374151;
  --ig-focus-ring: rgba(55, 65, 81, 0.25);
}
.ig-paper.theme-executive {
  --ig-primary: #0f172a;
  --ig-table-header-bg: #0f172a;
  --ig-focus-ring: rgba(15, 23, 42, 0.25);
}
.ig-paper.theme-forest {
  --ig-primary: #065f46;
  --ig-table-header-bg: #065f46;
  --ig-focus-ring: rgba(6, 95, 70, 0.25);
}
.ig-paper.theme-crimson,
.ig-paper.theme-burgundy {
  --ig-primary: #991b1b;
  --ig-table-header-bg: #991b1b;
  --ig-focus-ring: rgba(153, 27, 27, 0.25);
}
.ig-paper.theme-slate {
  --ig-primary: #475569;
  --ig-table-header-bg: #475569;
  --ig-focus-ring: rgba(71, 85, 105, 0.25);
}
.ig-paper.theme-purple {
  --ig-primary: #6d28d9;
  --ig-table-header-bg: #6d28d9;
  --ig-focus-ring: rgba(109, 40, 217, 0.25);
}
.ig-paper.theme-classic {
  --ig-primary: #1f2937;
  --ig-table-header-bg: #1f2937;
  --ig-focus-ring: rgba(31, 41, 55, 0.25);
}
.ig-paper.theme-blue {
  --ig-primary: #0284c7;
  --ig-table-header-bg: #0284c7;
  --ig-focus-ring: rgba(2, 132, 199, 0.25);
}
.ig-paper.theme-amber {
  --ig-primary: #b45309;
  --ig-table-header-bg: #b45309;
  --ig-focus-ring: rgba(180, 83, 9, 0.25);
}
.ig-paper.theme-teal {
  --ig-primary: #0d9488;
  --ig-table-header-bg: #0d9488;
  --ig-focus-ring: rgba(13, 148, 136, 0.25);
}

/* Screen-Adaptive App Container */
.ig-app-main {
  width: 100%;
  max-width: 100%;
  padding: 16px clamp(12px, 3vw, 36px) 64px;
  margin: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: calc(100vh - 65px);
  background: #f8fafc;
}

/* Master Layout Wrapper - Screen Adaptive & Always Centered */
.ig-app-wrapper {
  width: 100%;
  max-width: 1020px;
  margin: 0 auto !important;
  padding: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ==========================================================================
   THE INVOICE PAPER (Authentic A4 Document)
   ========================================================================== */
.ig-sheet-container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 0 40px;
  box-sizing: border-box;
}

.ig-paper {
  width: 100%;
  max-width: 960px;
  margin: 0 auto !important;
  min-height: auto; /* Dynamic height that hugs content compactly */
  background: var(--ig-paper-bg);
  color: var(--ig-paper-text);
  font-size: 13px;
  line-height: 1.5;
  padding: var(--ig-paper-padding, 32px 36px);
  border-radius: var(--ig-radius);
  border: 1px solid var(--border, #e5e7eb);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
  position: relative;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

/* Pristine Arabic Typography: Never break cursive connections */
.ig-paper[dir="rtl"] {
  direction: rtl;
  text-align: right;
  font-family: var(--ig-font-ar) !important;
  letter-spacing: 0 !important;
  word-spacing: normal !important;
  font-feature-settings: "liga" 1, "calt" 1, "kern" 1;
  -webkit-font-smoothing: antialiased;
}

.ig-paper[dir="rtl"] *,
.ig-paper[dir="rtl"] input,
.ig-paper[dir="rtl"] textarea,
.ig-paper[dir="rtl"] table,
.ig-paper[dir="rtl"] th,
.ig-paper[dir="rtl"] td {
  letter-spacing: 0 !important;
  font-feature-settings: "liga" 1, "calt" 1, "kern" 1;
}

/* Clean English Typography */
.ig-paper[dir="ltr"] {
  direction: ltr;
  text-align: left;
  font-family: var(--ig-font-en) !important;
}

@media (max-width: 768px) {
  .ig-paper {
    padding: 18px 14px;
    font-size: 12px;
    min-height: auto;
  }
}

/* Inline Editable Paper Elements */
.ig-paper input[type="text"],
.ig-paper input[type="number"],
.ig-paper input[type="date"],
.ig-paper textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 4px 6px;
  box-sizing: border-box;
  transition: border-color 0.15s, background-color 0.15s;
  width: 100%;
}

.ig-paper input:not(.ig-th-input):hover,
.ig-paper textarea:hover {
  border-color: #cbd5e1;
  background-color: #f8fafc;
}

.ig-paper input:not(.ig-th-input):focus,
.ig-paper textarea:focus {
  outline: none;
  border-color: var(--ig-primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 2px var(--ig-focus-ring);
}

.ig-paper textarea {
  resize: vertical;
  line-height: 1.4;
}

/* ==========================================================================
   PAPER HEADER: Logo, Title, Number & ZATCA QR
   ========================================================================== */
.ig-paper-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--ig-paper-border);
  margin-bottom: 20px;
  page-break-inside: avoid;
  break-inside: avoid;
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.ig-paper-header .ig-logo-zone {
  grid-column: 1 / 2;
  justify-self: start;
}

.ig-paper-header .ig-header-meta {
  grid-column: 2 / 3;
  justify-self: center;
  text-align: center;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.ig-paper-header .ig-header-spacer {
  grid-column: 3 / 4;
  justify-self: end;
  width: 100%;
}

@media (max-width: 768px) {
  .ig-paper-header {
    grid-template-columns: 1fr;
    gap: 14px;
    justify-items: center;
  }
  .ig-paper-header .ig-header-meta {
    grid-column: 1;
  }
}

/* Logo Dropzone */
.ig-logo-zone {
  min-width: 120px;
  max-width: 220px;
  min-height: 50px;
  border: 1.5px dashed #cbd5e1;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  justify-self: start;
  position: relative;
  cursor: pointer;
  background: #f8fafc;
  overflow: visible;
  transition: all 0.2s;
}

/* Borderless when logo is loaded */
.ig-logo-zone.has-logo {
  border: none !important;
  background: transparent !important;
  min-width: auto;
  min-height: auto;
}

.ig-logo-zone:hover:not(.has-logo) {
  border-color: var(--ig-primary);
  background: #f0fdf4;
}

.ig-logo-empty {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ig-paper-muted);
  font-size: 11.5px;
  font-weight: 600;
  text-align: start;
  padding: 8px 12px;
}

.ig-logo-empty .ig-logo-icon {
  font-size: 18px;
}

.ig-logo-filled {
  width: auto;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  position: relative;
}

.ig-logo-filled img {
  max-width: 220px;
  max-height: 85px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  border: none !important;
}

.ig-remove-logo-btn {
  position: absolute;
  top: 4px;
  inset-inline-end: 4px;
  width: 20px;
  height: 20px;
  background: rgba(220, 38, 38, 0.9);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.2s;
}

.ig-logo-zone:hover .ig-remove-logo-btn {
  opacity: 1;
}

/* Title in Header (Centered) */
.ig-header-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  justify-self: center;
  width: 100%;
}

.ig-paper[dir="rtl"] .ig-header-meta,
.ig-paper[dir="ltr"] .ig-header-meta {
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  display: flex;
  align-items: center;
}

.ig-input-title {
  font-size: 24px !important;
  font-weight: 800 !important;
  color: var(--ig-primary) !important;
  padding: 4px 14px !important;
  text-align: center !important;
  background: transparent !important;
  border: 1.5px dashed transparent !important;
  border-radius: 6px !important;
  box-shadow: none !important;
  width: auto;
  min-width: 200px;
  max-width: 100%;
  cursor: text !important;
  transition: all 0.15s ease !important;
  font-family: inherit !important;
  box-sizing: border-box;
}

.ig-input-title:hover {
  background: rgba(0, 108, 53, 0.05) !important;
  border-color: #cbd5e1 !important;
}

.ig-input-title:focus {
  background: #ffffff !important;
  border: 1.5px solid var(--ig-primary) !important;
  box-shadow: 0 0 0 3px var(--ig-focus-ring, rgba(0, 108, 53, 0.15)) !important;
  outline: none !important;
}

.ig-title-edit-hint {
  display: none !important;
}

/* Editable Labels (Invoice #, Date, Due Date, P.O., From, To...) */
.ig-editable-label {
  background: transparent !important;
  border: 1px dashed transparent !important;
  border-radius: 4px;
  font-family: inherit;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  color: #475569 !important;
  padding: 1px 4px !important;
  margin: 0 !important;
  cursor: text !important;
  outline: none !important;
  transition: all 0.15s ease;
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
}

.ig-editable-label:hover {
  border-color: #94a3b8 !important;
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

.ig-editable-label:focus {
  border-color: var(--ig-primary) !important;
  border-style: solid !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 2px var(--ig-focus-ring, rgba(0, 108, 53, 0.15)) !important;
  color: #0f172a !important;
}

.ig-field-label-input {
  font-size: 12px !important;
  font-weight: 800 !important;
  color: #1e293b !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow: visible !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ig-pdf-mode .ig-input-title,
body.ig-pdf-mode .ig-input-title {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

.ig-pdf-mode .ig-title-edit-hint,
body.ig-pdf-mode .ig-title-edit-hint {
  display: none !important;
}

.ig-pdf-mode .ig-editable-label,
body.ig-pdf-mode .ig-editable-label,
.ig-pdf-mode .ig-field-label-input,
body.ig-pdf-mode .ig-field-label-input {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  max-width: 100% !important;
  overflow: visible !important;
}

.ig-pdf-mode .ig-date-input,
body.ig-pdf-mode .ig-date-input {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  max-width: none !important;
  overflow: visible !important;
}

@media print {
  .ig-input-title {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  .ig-title-edit-hint {
    display: none !important;
  }
  .ig-editable-label,
  .ig-field-label-input {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    max-width: 100% !important;
    overflow: visible !important;
  }
  .ig-date-input {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    max-width: none !important;
    overflow: visible !important;
  }
}

.ig-paper[dir="rtl"] .ig-input-title,
.ig-paper[dir="ltr"] .ig-input-title {
  text-align: center !important;
}

.ig-meta-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ig-meta-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ig-paper-muted);
}

.ig-input-meta {
  width: 130px !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  border: 1px solid #e2e8f0 !important;
  background: #f8fafc !important;
  text-align: center;
}
.ig-header-spacer {
  width: 100%;
}

/* ==========================================================================
   PARTIES & DATES SECTION (From / To / Dates)
   ========================================================================== */
.ig-parties-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 22px;
  margin-bottom: 22px;
  align-items: start;
  page-break-inside: avoid;
  break-inside: avoid;
}

@media (max-width: 860px) {
  .ig-parties-grid {
    grid-template-columns: 1fr 1fr;
  }
  .ig-dates-box {
    grid-column: 1 / -1;
  }
}

@media (max-width: 600px) {
  .ig-parties-grid {
    grid-template-columns: 1fr;
  }
}

.ig-party-box,
.ig-dates-box {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ig-party-box .ig-paper-textarea {
  font-size: 11.5px !important;
  line-height: 1.5 !important;
  color: #334155 !important;
  padding: 3px 5px !important;
  min-height: 38px;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  resize: vertical;
  white-space: pre-wrap;
  word-break: break-word;
}

.ig-field-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ig-paper-muted);
  margin-bottom: 3px;
  letter-spacing: 0.5px;
}

.ig-input-with-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px dashed #cbd5e1;
  background: transparent;
  padding: 1px 0;
  margin: 2px 0;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.ig-input-with-tag .ig-tag,
.ig-input-with-tag .ig-tag-input {
  padding: 0 !important;
  background: transparent !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  color: #64748b !important;
  white-space: nowrap;
  flex: 0 0 auto !important;
  field-sizing: content;
  width: auto;
  min-width: 28px;
  max-width: fit-content;
  border: none !important;
  box-shadow: none !important;
  font-family: inherit !important;
  outline: none !important;
  cursor: text;
  border-bottom: 1px dashed transparent !important;
  transition: all 0.15s ease;
}

[dir="rtl"] .ig-input-with-tag .ig-tag-input,
.ig-paper[dir="rtl"] .ig-input-with-tag .ig-tag-input {
  padding: 0 !important;
  text-align: right;
}

.ig-input-with-tag .ig-tag-input:hover {
  color: #0f172a !important;
  border-bottom-color: #94a3b8 !important;
}

.ig-input-with-tag .ig-tag-input:focus {
  color: #0f172a !important;
  border-bottom-color: var(--ig-primary) !important;
  background: rgba(255, 255, 255, 0.9) !important;
}

.ig-pdf-mode .ig-tag-input {
  border-bottom: none !important;
  color: #475569 !important;
}

.ig-input-with-tag input,
.ig-input-with-tag input.ig-paper-input {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 2px 0 !important;
  font-size: 11.5px !important;
  font-family: inherit;
  width: auto !important;
  min-width: 0;
  flex: 1;
  text-align: start !important;
}

.ig-date-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
  width: 100%;
}

.ig-date-row .ig-editable-label {
  flex: 1 1 auto;
  min-width: 0;
  width: auto !important;
  white-space: nowrap;
  overflow: visible !important;
  text-overflow: clip;
}

.ig-date-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ig-paper-muted);
  white-space: nowrap;
}

.ig-date-input {
  flex: 0 0 auto;
  min-width: 100px;
  max-width: 140px;
  font-size: 11.5px !important;
  border: 1px solid #e2e8f0 !important;
  padding: 2px 5px !important;
  box-sizing: border-box;
}

#igInvoiceNumber.ig-date-input,
.ig-date-input.font-bold {
  font-weight: 800 !important;
  font-size: 12.5px !important;
  color: #0f172a !important;
  background: #f8fafc !important;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   LINE ITEMS TABLE (Direct Inline Table)
   ========================================================================== */
.ig-table-container {
  margin: 16px 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--ig-paper-border);
  page-break-inside: auto;
}

.ig-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  text-align: start;
}

.ig-table thead {
  display: table-header-group;
}

.ig-table th {
  background: var(--ig-table-header-bg);
  color: var(--ig-table-header-text);
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: normal !important;
}

.ig-table td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--ig-paper-border);
  vertical-align: middle;
}

.ig-table tr {
  page-break-inside: avoid;
  break-inside: avoid;
}

.ig-table tr:hover td {
  background-color: rgba(0, 0, 0, 0.015);
}

/* Column Widths - Wide description column, slim compact numeric columns */
.ig-col-desc { width: 56%; text-align: start; }
.ig-col-qty  { width: 8%; text-align: center !important; }
.ig-col-rate { width: 12%; text-align: center !important; }
.ig-col-disc { width: 10%; text-align: center !important; }
.ig-col-tax  { width: 9%; text-align: center !important; }
.ig-col-amt  { width: 15%; text-align: center !important; }
.ig-col-act  { width: 28px; text-align: center !important; }

/* When Discount Column is Active: */
.ig-has-disc-col .ig-col-desc { width: 46%; }
.ig-has-disc-col .ig-col-qty  { width: 8%; }
.ig-has-disc-col .ig-col-rate { width: 12%; }
.ig-has-disc-col .ig-col-disc { width: 10%; text-align: center !important; }
.ig-has-disc-col .ig-col-tax  { width: 9%; }
.ig-has-disc-col .ig-col-amt  { width: 15%; }

/* Default state: Hide discount column unless explicitly enabled */
.ig-col-disc,
.ig-hide-disc-col .ig-col-disc,
body.ig-hide-disc-col .ig-col-disc,
.ig-pdf-mode.ig-hide-disc-col .ig-col-disc,
body.ig-pdf-mode.ig-hide-disc-col .ig-col-disc {
  display: none !important;
}

.ig-has-disc-col .ig-col-disc,
body.ig-has-disc-col .ig-col-disc,
.ig-pdf-mode.ig-has-disc-col .ig-col-disc,
body.ig-pdf-mode.ig-has-disc-col .ig-col-disc {
  display: table-cell !important;
}

@media print {
  .ig-col-disc,
  .ig-hide-disc-col .ig-col-disc,
  body.ig-hide-disc-col .ig-col-disc {
    display: none !important;
  }
  .ig-has-disc-col .ig-col-disc,
  body.ig-has-disc-col .ig-col-disc {
    display: table-cell !important;
  }
}

/* Editable Table Header Input */
.ig-table th .ig-th-input,
.ig-th-input {
  width: 100%;
  background: transparent !important;
  border: 1px dashed transparent !important;
  border-radius: 4px;
  font-family: inherit;
  font-size: 11px !important;
  font-weight: 700 !important;
  color: var(--ig-table-header-text, #ffffff) !important;
  text-align: inherit;
  padding: 2px 4px !important;
  margin: 0;
  outline: none !important;
  cursor: text;
  transition: all 0.15s ease;
}

.ig-table th .ig-th-input:hover,
.ig-th-input:hover {
  background: rgba(255, 255, 255, 0.14) !important;
  border: 1px dashed rgba(255, 255, 255, 0.6) !important;
  color: #ffffff !important;
}

.ig-table th .ig-th-input:focus,
.ig-th-input:focus {
  background: rgba(255, 255, 255, 0.24) !important;
  border: 1.5px solid #ffffff !important;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35) !important;
  color: #ffffff !important;
  caret-color: #ffffff !important;
  outline: none !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.ig-col-qty .ig-th-input,
.ig-col-rate .ig-th-input,
.ig-col-disc .ig-th-input,
.ig-col-tax .ig-th-input,
.ig-col-amt .ig-th-input {
  text-align: center !important;
}

/* Table Item Cell Inputs (TBody only) */
.ig-table td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--ig-paper-border);
  vertical-align: middle;
}

.ig-table td input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 3px 5px;
  font-family: inherit;
  font-size: 11.5px !important;
  color: var(--ig-paper-text);
  background: transparent;
  transition: all 0.15s ease;
}

.ig-table td input:hover {
  border-color: rgba(148, 163, 184, 0.4);
  background: rgba(248, 250, 252, 0.6);
}

.ig-table td input:focus {
  border-color: var(--ig-primary);
  background: #ffffff;
  outline: none;
  box-shadow: 0 0 0 2px rgba(30, 58, 138, 0.1);
}

.ig-table .item-desc {
  font-size: 11.5px !important;
  font-weight: 500 !important;
  color: #1e293b !important;
  text-align: start;
}

.ig-table .ig-calc-input {
  font-size: 11.5px !important;
  font-weight: 500 !important;
  color: #1e293b !important;
  text-align: center !important;
  font-variant-numeric: tabular-nums;
  padding: 3px 2px !important;
}

.ig-table th.ig-col-qty,
.ig-table th.ig-col-rate,
.ig-table th.ig-col-disc,
.ig-table th.ig-col-tax,
.ig-table th.ig-col-amt,
.ig-table td.ig-col-qty,
.ig-table td.ig-col-rate,
.ig-table td.ig-col-disc,
.ig-table td.ig-col-tax,
.ig-table td.ig-col-amt,
.ig-table td.ig-col-qty input,
.ig-table td.ig-col-rate input,
.ig-table td.ig-col-disc input,
.ig-table td.ig-col-tax input,
.ig-table td.ig-col-amt input,
.ig-table td.ig-col-amt .item-amt-calc {
  text-align: center !important;
}

/* PDF & Print: Completely Clean Inputs (No borders, no focus) */
.ig-pdf-mode .ig-th-input,
body.ig-pdf-mode .ig-th-input,
.ig-pdf-mode .ig-table td input,
body.ig-pdf-mode .ig-table td input {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
}

@media print {
  .ig-th-input {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .ig-table input {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 2px 0 !important;
  }
}

.ig-table .item-amt-calc {
  font-size: 11.5px !important;
  font-weight: 600 !important;
  color: #0f172a !important;
  text-align: center !important;
  white-space: nowrap;
  display: block;
  width: 100%;
  font-variant-numeric: tabular-nums;
}

.ig-del-row-btn {
  background: transparent;
  color: #94a3b8;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.ig-del-row-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

.ig-add-row-bar {
  padding: 8px 12px;
  background: #f8fafc;
  border-top: 1px solid var(--ig-paper-border);
  display: flex;
  justify-content: flex-start;
}

.ig-add-row-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  color: var(--ig-primary);
  border: 1px solid var(--ig-primary);
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.ig-add-row-btn:hover {
  background: var(--ig-primary);
  color: #ffffff;
}

/* ==========================================================================
   BOTTOM SECTION: Notes, Bank, Signature & Totals Stack
   ========================================================================== */
.ig-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 20px;
  margin-top: 20px; /* Sits naturally right below items table without huge gap */
  padding-top: 8px;
  align-items: start; /* Prevents totals box or columns from stretching vertically */
  page-break-inside: avoid;
  break-inside: avoid;
}

@media (max-width: 768px) {
  .ig-bottom-grid {
    grid-template-columns: 1fr;
  }
}

.ig-bottom-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  page-break-inside: avoid;
  break-inside: avoid;
}

.ig-sec-title-sm {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ig-paper-muted);
  margin-bottom: 3px;
}

/* Structured Information Boxes: Notes/Terms & Bank Details - Balanced Corporate Design */
.ig-notes-box,
.ig-bank-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  page-break-inside: avoid;
  break-inside: avoid;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ig-notes-box:hover,
.ig-bank-box:hover {
  border-color: #cbd5e1;
}

.ig-notes-box .ig-sec-title-sm,
.ig-bank-box .ig-sec-title-sm {
  font-family: 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  letter-spacing: 0 !important;
  font-feature-settings: "liga" 1, "calt" 1;
  color: #334155 !important;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 4px 0;
  padding-bottom: 5px;
  border-bottom: 1px solid #eef2f6;
}

.ig-notes-box .ig-paper-textarea {
  font-family: 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif !important;
  font-size: 12px !important;
  line-height: 1.65 !important;
  letter-spacing: 0 !important;
  font-feature-settings: "liga" 1, "calt" 1;
  color: #1e293b !important;
  background: transparent !important;
  border: none !important;
  padding: 2px 0 !important;
  width: 100% !important;
  min-height: 48px;
  resize: vertical;
  box-sizing: border-box;
}

.ig-notes-box .ig-paper-textarea:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.9) !important;
  border-radius: 4px;
  padding: 2px 6px !important;
}

.ig-bank-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ig-bank-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.ig-bank-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 11.5px;
  min-width: 0;
  padding: 1px 0;
}

.ig-bank-label {
  font-family: 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif !important;
  font-weight: 600 !important;
  color: #64748b !important;
  font-size: 11px !important;
  letter-spacing: 0 !important;
  font-feature-settings: "liga" 1, "calt" 1;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 85px;
}

.ig-bank-val {
  flex: 1;
  font-family: 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #0f172a !important;
  letter-spacing: 0 !important;
  font-feature-settings: "liga" 1, "calt" 1;
  padding: 1px 4px;
  min-width: 0;
  background: transparent;
  border: none;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.4);
}

.ig-bank-val:focus {
  border-bottom-color: var(--ig-primary);
  background: rgba(30, 58, 138, 0.04);
}

/* Guaranteed Bank & Terms Display in Print & PDF Mode */
.ig-pdf-mode .ig-notes-box,
body.ig-pdf-mode .ig-notes-box,
.ig-pdf-mode .ig-bank-box,
body.ig-pdf-mode .ig-bank-box {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 6px !important;
  padding: 8px 12px !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.ig-pdf-mode .ig-bottom-grid,
body.ig-pdf-mode .ig-bottom-grid {
  display: grid !important;
  grid-template-columns: 1fr 310px !important;
  gap: 20px !important;
  margin-top: 18px !important;
  padding-top: 10px !important;
  align-items: start !important;
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

.ig-pdf-mode.ig-single-page-pdf .ig-bottom-grid,
body.ig-pdf-mode.ig-single-page-pdf .ig-bottom-grid {
  margin-top: auto !important;
}

.ig-pdf-mode .ig-bottom-left,
body.ig-pdf-mode .ig-bottom-left {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  order: 1 !important;
}

.ig-pdf-mode .ig-totals-column,
body.ig-pdf-mode .ig-totals-column {
  order: 2 !important;
}

.ig-totals-column .ig-totals-box,
.ig-pdf-mode .ig-totals-box,
body.ig-pdf-mode .ig-totals-box,
.ig-pdf-mode .ig-totals-column .ig-totals-box,
body.ig-pdf-mode .ig-totals-column .ig-totals-box {
  order: 1 !important;
}

.ig-totals-column .ig-zatca-qr-block,
.ig-pdf-mode .ig-zatca-qr-block,
body.ig-pdf-mode .ig-zatca-qr-block,
.ig-pdf-mode .ig-totals-column .ig-zatca-qr-block,
body.ig-pdf-mode .ig-totals-column .ig-zatca-qr-block {
  order: 2 !important;
}

.ig-pdf-mode .ig-bank-row,
body.ig-pdf-mode .ig-bank-row {
  display: flex !important;
  visibility: visible !important;
}

.ig-pdf-mode .ig-bank-val,
body.ig-pdf-mode .ig-bank-val {
  border-bottom: none !important;
  background: transparent !important;
}

@media print {
  .ig-notes-box,
  .ig-bank-box {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    display: flex !important;
  }
  .ig-bank-row {
    display: flex !important;
  }
  .ig-bank-val {
    border-bottom: none !important;
    background: transparent !important;
  }
  .ig-bottom-grid {
    display: grid !important;
    grid-template-columns: 1fr 310px !important;
    gap: 20px !important;
    align-items: start !important;
    margin-top: 18px !important;
  }
}

/* Signature & Stamp: Clean Line instead of Box */
.ig-sig-box,
.ig-sig-wrapper {
  margin-top: 10px;
  width: 230px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  page-break-inside: avoid;
  break-inside: avoid;
}

.ig-sig-area {
  height: 52px;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.ig-sig-canvas {
  width: 100%;
  height: 52px;
  background: transparent;
  border: none;
  cursor: crosshair;
  touch-action: none;
}

.ig-sig-img {
  max-height: 50px;
  max-width: 100%;
  object-fit: contain;
  display: block;
}

.ig-sig-line {
  height: 1.5px;
  background: #475569;
  width: 100%;
  margin-top: 2px;
}

.ig-sig-caption {
  font-family: 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif !important;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  margin-top: 4px;
  text-align: center;
  letter-spacing: 0 !important;
  font-feature-settings: "liga" 1, "calt" 1;
}

.ig-sig-actions,
.ig-sig-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 5px;
}

.ig-sig-upload-btn {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ig-primary);
  background: #f1f5f9;
  border: 1px dashed #cbd5e1;
  border-radius: 4px;
  padding: 2px 7px;
  cursor: pointer;
  transition: all 0.15s;
}

.ig-sig-upload-btn:hover {
  background: #e2e8f0;
  border-color: var(--ig-primary);
}

.ig-sig-clear-btn {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 5px;
}

/* ==========================================================================
   ORGANIZED SAUDI ZATCA QR CODE BLOCK & SIGNATURE FOOTER
   ========================================================================== */
.ig-bottom-left-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed rgba(148, 163, 184, 0.4);
  page-break-inside: avoid;
  break-inside: avoid;
}

.ig-zatca-qr-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1.5px solid #006C35;
  border-radius: 8px;
  padding: 8px 10px;
  box-shadow: 0 2px 6px rgba(0, 108, 53, 0.08);
  width: 136px;
  min-width: 136px;
  flex-shrink: 0;
  text-align: center;
  box-sizing: border-box;
  page-break-inside: avoid;
  break-inside: avoid;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ig-zatca-qr-block:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 108, 53, 0.15);
}

.ig-qr-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8.5px;
  font-weight: 800;
  background: #e6f4ea;
  color: #006C35;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 5px;
  letter-spacing: 0;
  text-transform: uppercase;
  line-height: 1.2;
}

.ig-qr-canvas-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 2px;
  border-radius: 4px;
}

.ig-zatca-qr-block canvas {
  width: 96px !important;
  height: 96px !important;
  display: block;
  margin: 0 auto;
  border-radius: 4px;
}

.ig-qr-caption {
  font-size: 9px;
  font-weight: 800;
  color: #006C35;
  margin-top: 5px;
  text-align: center;
  line-height: 1.3;
  letter-spacing: 0;
}

.ig-qr-subtext {
  font-size: 7.5px;
  font-weight: 600;
  color: #64748b;
  margin-top: 2px;
  text-align: center;
  line-height: 1.2;
  letter-spacing: 0;
}

@media (max-width: 640px) {
  .ig-bottom-left-footer {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }
}

/* Totals Stack - Compact, neat, fits exact content */
.ig-totals-box {
  background: #f8fafc;
  border: 1px solid var(--ig-paper-border);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100% !important;
  box-sizing: border-box;
  height: fit-content !important;
  page-break-inside: avoid;
  break-inside: avoid;
}

.ig-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
  color: #374151;
  padding: 1px 0;
}

.ig-total-label {
  font-weight: 600;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ig-total-val {
  font-weight: 700;
  font-size: 12px;
  color: #111827;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.ig-total-row.discount-row input,
.ig-total-row.shipping-row input {
  width: 68px !important;
  font-size: 11px !important;
  padding: 2px 4px !important;
  border: 1px solid #e2e8f0 !important;
  background: #ffffff !important;
  text-align: end;
}

.ig-total-row.grand-total {
  border-top: 1.5px solid var(--ig-paper-border);
  padding-top: 6px;
  margin-top: 2px;
}

.ig-total-row.grand-total .ig-total-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ig-primary);
}

.ig-total-row.grand-total .ig-total-val {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ig-primary);
  font-variant-numeric: tabular-nums;
}

/* Tafqeet Box - Compact & balanced */
.ig-tafqeet-box {
  margin-top: 4px;
  padding: 4px 6px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 600;
  color: #166534;
  line-height: 1.35;
  text-align: center;
  page-break-inside: avoid;
  break-inside: avoid;
}

/* Footer stamp on paper */
.ig-paper-footer-note {
  margin-top: 20px;
  padding-top: 10px;
  border-top: 1px solid #e5e7eb;
  font-size: 10px;
  color: #94a3b8;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  text-align: center !important;
  width: 100% !important;
  box-sizing: border-box !important;
  page-break-inside: avoid;
  break-inside: avoid;
}

.ig-paper-footer-note #igFooterText {
  text-align: center !important;
  display: block;
}

.ig-page-num-badge {
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 2px 14px;
  border-radius: 12px;
  letter-spacing: 0.5px;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 auto !important;
  text-align: center !important;
}

/* In PDF mode, the DOM badge is hidden because jsPDF stamps vector page numbers directly onto each page */
.ig-pdf-mode .ig-page-num-badge,
body.ig-pdf-mode .ig-page-num-badge {
  display: none !important;
}

.ig-pdf-mode .ig-paper-footer-note,
body.ig-pdf-mode .ig-paper-footer-note {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  width: 100% !important;
}

/* ==========================================================================
   STREAMLINED APP HEADER BAR (Branding, Language, Save, Drafts, Download PDF)
   ========================================================================== */
.ig-top-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  padding: 8px 0;
}

.ig-header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Brand Section */
.ig-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ig-brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.ig-brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  object-fit: contain;
}

.ig-brand-text {
  display: flex;
  flex-direction: column;
}

.ig-brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
}

.ig-brand-tag,
.ig-brand-badge {
  display: none !important;
}

/* Mobile Menu Toggle Button (hidden on desktop) */
.ig-mobile-menu-toggle-btn {
  display: none;
  position: relative;
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 9px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #0f172a;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ig-mobile-menu-toggle-btn:hover,
.ig-mobile-menu-toggle-btn:active {
  background: #f1f5f9;
  border-color: #94a3b8;
  transform: scale(0.97);
}

.ig-menu-icon-bars {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 18px;
  height: 13px;
}

.ig-menu-icon-bars span {
  display: block;
  height: 2px;
  width: 100%;
  background: #0f172a;
  border-radius: 2px;
  transition: all 0.2s ease;
}

/* ==========================================================================
   MOBILE MENU DRAWER & BOTTOM SHEET SYSTEM
   ========================================================================== */
body.ig-drawer-open {
  overflow: hidden !important;
  touch-action: none;
}

.ig-mobile-drawer {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
}

.ig-mobile-drawer.active {
  display: block;
}

.ig-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ig-mobile-drawer.active .ig-drawer-backdrop {
  opacity: 1;
}

.ig-drawer-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  inset-inline-end: 0;
  width: min(88vw, 360px);
  background: #ffffff;
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  transform: translateX(105%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  font-family: inherit;
  letter-spacing: 0 !important;
  font-feature-settings: "liga" 1, "calt" 1;
  z-index: 2;
}

[dir="rtl"] .ig-drawer-panel,
html[lang="ar"] .ig-drawer-panel {
  transform: translateX(-105%);
}

.ig-mobile-drawer.active .ig-drawer-panel {
  transform: translateX(0) !important;
}

.ig-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.ig-drawer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ig-drawer-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: contain;
}

.ig-drawer-title {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

.ig-drawer-close-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #64748b;
  cursor: pointer;
  transition: all 0.18s ease;
}

.ig-drawer-close-btn:hover,
.ig-drawer-close-btn:active {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

.ig-drawer-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ig-drawer-cta-section {
  padding-bottom: 2px;
}

.ig-drawer-btn-download {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #006C35 0%, #005228 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 13px 18px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 108, 53, 0.35);
  transition: all 0.2s ease;
  letter-spacing: 0 !important;
}

.ig-drawer-btn-download:active {
  transform: scale(0.98);
  box-shadow: 0 2px 6px rgba(0, 108, 53, 0.25);
}

.ig-drawer-nav-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ig-drawer-group-title {
  font-size: 11.5px;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0 !important;
  padding: 0 6px 4px 6px;
}

.ig-drawer-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #f1f5f9;
  text-decoration: none;
  color: #0f172a;
  cursor: pointer;
  text-align: start;
  transition: all 0.18s ease;
  font-family: inherit;
  letter-spacing: 0 !important;
}

.ig-drawer-nav-item:hover,
.ig-drawer-nav-item:active {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.ig-drawer-item-icon {
  font-size: 19px;
  line-height: 1;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.ig-drawer-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.ig-drawer-item-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.ig-drawer-item-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}

.ig-drawer-item-desc {
  font-size: 11px;
  color: #64748b;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ig-drawer-count-badge {
  background: #006C35;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
  line-height: 1.4;
}

.ig-drawer-footer {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.ig-drawer-footer-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 700;
  color: #475569;
  text-align: center;
  line-height: 1.3;
}

.ig-drawer-footer-badge .ig-vat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #006C35;
  display: inline-block;
}

/* Center: Invoice Document Language Toggle */
.ig-header-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ig-doc-lang-pills {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  padding: 3px 6px;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ig-doc-lang-label {
  font-size: 11.5px;
  font-weight: 800;
  color: #334155;
  padding-inline-start: 6px;
  letter-spacing: 0;
  user-select: none;
}

.ig-pills-wrap {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  padding: 2.5px;
  border-radius: 999px;
  gap: 2px;
}

.ig-pill-btn,
.ig-lang-pill {
  border: none;
  background: transparent;
  color: #475569;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
  line-height: 1.4;
  letter-spacing: 0;
}

.ig-pill-btn:hover,
.ig-lang-pill:hover {
  color: #0f172a;
}

.ig-pill-btn.active,
.ig-lang-pill.active {
  background: var(--ig-primary, #006C35) !important;
  color: #ffffff !important;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 108, 53, 0.28);
}

/* Right Header Actions */
.ig-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ig-header-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.ig-header-tool-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.ig-draft-badge {
  background: var(--ig-primary, #006C35);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
}

.ig-header-btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  min-width: 40px;
  height: 38px;
  padding: 0 14px;
  background: var(--ig-primary, #006C35);
  color: #ffffff;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 108, 53, 0.25);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0 !important;
}

.ig-header-btn-download .ig-download-btn-text {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1;
  letter-spacing: 0 !important;
}

.ig-pdf-icon-logo {
  display: block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.ig-header-btn-download:hover {
  background: var(--ig-primary-hover, #00552a);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 108, 53, 0.35);
}

.ig-header-btn-download:active {
  transform: translateY(0);
}

@keyframes igSpin {
  to { transform: rotate(360deg); }
}
.ig-spin {
  animation: igSpin 0.7s linear infinite;
}

/* ==========================================================================
   FLOATING ACTION BUTTON (New Invoice + at Bottom)
   ========================================================================== */
.ig-fab-new-invoice {
  position: fixed;
  bottom: 28px;
  inset-inline-start: 28px;
  z-index: 990;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #006C35, #005027);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  padding: 10px 18px 10px 14px;
  box-shadow: 0 8px 24px rgba(0, 108, 53, 0.35), 0 2px 6px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ig-fab-new-invoice:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 30px rgba(0, 108, 53, 0.45);
  background: linear-gradient(135deg, #007a3c, #005f2f);
}

.ig-fab-new-invoice .ig-fab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
}

/* ==========================================================================
   PARTY HEADER & REMEMBER BUSINESS PROFILE TOGGLE
   ========================================================================== */
.ig-party-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  gap: 8px;
  flex-wrap: wrap;
}

.ig-remember-profile-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  background: #f8fafc;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  transition: all 0.15s;
}

.ig-remember-profile-label:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
}

.ig-remember-profile-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--ig-primary, #006C35);
  margin: 0;
}

/* Toast Notifications */
.ig-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  z-index: 1050;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ig-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   MOBILE & RESPONSIVE PERFECTION (Clean, Minimal Buttons & Zero Clutter)
   ========================================================================== */
@media (max-width: 768px) {
  /* 1. Sleek Single-Line Header (Zero Wrapping) */
  .ig-top-header {
    padding: 6px 10px !important;
  }
  .ig-header-container {
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 6px !important;
    height: 48px !important;
  }
  .ig-header-brand {
    order: 1 !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
  }
  .ig-brand-tag {
    display: none !important;
  }
  .ig-brand-title {
    font-size: 13.5px !important;
    white-space: nowrap !important;
  }
  .ig-brand-logo {
    width: 26px !important;
    height: 26px !important;
  }
  /* Hide invoice doc language pill row on mobile (available inside ⚙️ Settings) */
  .ig-header-center {
    display: none !important;
  }
  /* Mobile menu button visible, secondary toolbar buttons tucked neatly into drawer */
  .ig-mobile-menu-toggle-btn {
    display: inline-flex !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    border-radius: 9px !important;
  }
  .ig-header-actions .ig-header-tool-btn {
    display: none !important;
  }
  .ig-header-btn-download {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    width: auto !important;
    min-width: 40px !important;
    height: 38px !important;
    padding: 0 9px !important;
    border-radius: 9px !important;
  }
  .ig-header-btn-download .ig-pdf-icon-logo {
    width: 19px !important;
    height: 19px !important;
  }
  .ig-header-btn-download .ig-download-btn-text {
    display: inline-block !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    line-height: 1 !important;
    letter-spacing: 0 !important;
  }
  .ig-draft-badge,
  .ig-badge-count {
    position: absolute !important;
    top: -4px !important;
    inset-inline-end: -4px !important;
    font-size: 9px !important;
    padding: 1px 4px !important;
    min-width: 14px !important;
    height: 14px !important;
    line-height: 12px !important;
    border-radius: 999px !important;
    box-shadow: 0 0 0 1.5px #fff !important;
  }

  /* 2. Compact Circular Floating Action Button (+) */
  .ig-fab-new-invoice {
    bottom: 16px !important;
    inset-inline-start: 16px !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    justify-content: center !important;
    box-shadow: 0 4px 14px rgba(0, 108, 53, 0.4) !important;
  }
  .ig-fab-new-invoice .ig-fab-text {
    display: none !important;
  }
  .ig-fab-new-invoice .ig-fab-icon {
    font-size: 24px !important;
    background: transparent !important;
    width: auto !important;
    height: auto !important;
    line-height: 1 !important;
  }

  /* 3. Compact Mode Switcher Bar */
  .ig-mode-switcher-bar {
    margin: 6px 0 10px !important;
  }
  .ig-mode-segmented {
    padding: 3px !important;
    width: 100% !important;
    max-width: 320px !important;
    display: flex !important;
  }
  .ig-mode-btn {
    flex: 1 !important;
    padding: 6px 8px !important;
    font-size: 12px !important;
    gap: 4px !important;
  }

  /* 4. Sheet Toolbar: 2 Slim Rows, No Sprawling */
  .ig-sheet-toolbar {
    flex-direction: column !important;
    padding: 8px 10px !important;
    gap: 6px !important;
    margin-bottom: 10px !important;
    border-radius: 10px !important;
  }
  .ig-toolbar-swatches {
    display: none !important;
  }
  .ig-toolbar-label {
    display: none !important;
  }
  .ig-sheet-toolbar .ig-toolbar-group {
    width: 100% !important;
    display: flex !important;
    gap: 6px !important;
    justify-content: space-between !important;
  }
  .ig-toolbar-select {
    width: 100% !important;
    flex: 1 !important;
    min-width: 0 !important;
    padding: 6px 8px !important;
    font-size: 11.5px !important;
  }
  .ig-color-picker-btn {
    padding: 6px 8px !important;
    height: 33px !important;
    flex-shrink: 0 !important;
    justify-content: center !important;
  }
  .ig-color-picker-text {
    display: none !important;
  }
  .ig-tb-actions {
    width: 100% !important;
    display: flex !important;
    gap: 4px !important;
    justify-content: space-between !important;
  }
  .ig-tb-btn {
    flex: 1 !important;
    justify-content: center !important;
    padding: 6px 4px !important;
    font-size: 11px !important;
    white-space: nowrap !important;
  }

  /* 5. Clean Paper Sheet on Mobile */
  .ig-app-main {
    padding: 8px 6px 56px !important;
  }
  .ig-paper {
    padding: 14px 10px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    min-height: auto !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05) !important;
  }
  .ig-paper-header {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
    padding-bottom: 10px !important;
  }
  .ig-logo-zone {
    max-width: 130px !important;
    margin: 0 auto !important;
  }
  .ig-header-spacer {
    display: none !important;
  }
  .ig-input-title {
    font-size: 1.15rem !important;
    text-align: center !important;
  }
  .ig-parties-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    margin-bottom: 12px !important;
  }
  .ig-party-box,
  .ig-dates-box {
    width: 100% !important;
  }
  .ig-table-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin: 10px 0 !important;
    border-radius: 6px !important;
  }
  .ig-table {
    min-width: 440px !important;
    font-size: 11.5px !important;
  }
  .ig-table th,
  .ig-table td {
    padding: 5px 4px !important;
  }
  .ig-col-desc {
    min-width: 140px !important;
  }
  .ig-bottom-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    padding-top: 12px !important;
  }
  .ig-totals-column,
  .ig-totals-box {
    order: 1 !important;
  }
  .ig-bottom-left {
    order: 2 !important;
  }
  .ig-bank-grid {
    grid-template-columns: 1fr !important;
    gap: 4px !important;
  }
  .ig-sig-box {
    width: 100% !important;
    max-width: 220px !important;
  }
  .ig-zatca-qr-container {
    justify-content: center !important;
    margin-top: 8px !important;
  }
  /* Settings & Drafts Modals on Mobile */
  .ig-settings-card,
  .ig-modal-card {
    width: calc(100% - 24px) !important;
    max-width: 100% !important;
    margin: 16px auto !important;
    border-radius: 12px !important;
  }
  .ig-settings-body {
    padding: 12px 14px !important;
    gap: 10px !important;
  }
  .ig-setting-row {
    padding: 12px !important;
    gap: 10px !important;
    flex-wrap: wrap;
  }
  .ig-setting-title {
    font-size: 13px !important;
  }
  .ig-setting-desc {
    font-size: 11px !important;
  }
  .ig-setting-control {
    width: 100%;
    display: flex;
    justify-content: flex-start;
  }
  .ig-setting-select {
    width: 100% !important;
  }
  .ig-setting-actions {
    width: 100%;
    display: flex;
    gap: 6px;
  }
  .ig-setting-actions .ig-tb-btn {
    flex: 1;
    text-align: center;
    padding: 8px 6px;
    font-size: 11.5px;
  }
}

/* Legacy side panel if referenced */
.ig-sidebar {
  display: none !important;
}

.ig-side-panel {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: var(--ig-radius);
  padding: 14px;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.05));
}

.ig-btn-download-pdf {
  width: 100%;
  min-height: 44px;
  background: var(--ig-primary);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 108, 53, 0.25);
  transition: all 0.2s;
}

.ig-btn-download-pdf:hover {
  background: var(--ig-primary-hover);
  transform: translateY(-1px);
}

.ig-btn-print {
  width: 100%;
  margin-top: 6px;
  min-height: 36px;
  background: transparent;
  color: var(--color-text-primary, #1f2937);
  border: 1px solid var(--border, #d1d5db);
  border-radius: 6px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.ig-btn-print:hover {
  background: #f3f4f6;
}

.ig-control-group {
  margin-bottom: 12px;
}

.ig-control-group:last-child {
  margin-bottom: 0;
}

.ig-control-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--color-text-secondary, #4b5563);
  margin-bottom: 4px;
}

.ig-select {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 6px;
  background: var(--bg-input, #ffffff);
  color: var(--color-text-primary, #1f2937);
  font-family: inherit;
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
}

.ig-select:focus {
  border-color: var(--ig-primary);
  box-shadow: 0 0 0 2px var(--ig-focus-ring);
}

/* Color Palette Swatches */
.ig-swatches {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.ig-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px #d1d5db;
  cursor: pointer;
  transition: transform 0.15s;
  padding: 0;
}

.ig-swatch:hover,
.ig-swatch.active {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px #111827;
}

/* Preset Quick Actions */
.ig-presets-row {
  display: flex;
  gap: 6px;
}

.ig-btn-preset {
  flex: 1;
  padding: 5px 6px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.ig-btn-preset:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* ==========================================================================
   STRICT HIDING OF ACTIONS/DELETE IN PDF & PRINT
   Zero delete icons, zero close buttons, zero add-bars in final document
   ========================================================================== */
.ig-pdf-mode .no-print,
.ig-pdf-mode .ig-col-act,
.ig-pdf-mode th.ig-col-act,
.ig-pdf-mode td.ig-col-act,
.ig-pdf-mode .ig-del-row-btn,
.ig-pdf-mode button.ig-del-row-btn,
.ig-pdf-mode .ig-add-row-bar,
.ig-pdf-mode #igAddRowBtn,
.ig-pdf-mode .ig-remove-logo-btn,
.ig-pdf-mode .ig-sig-actions,
.ig-pdf-mode .ig-sig-controls,
.ig-pdf-mode .ig-sig-upload-btn,
.ig-pdf-mode .ig-sig-clear-btn,
.ig-pdf-mode .ig-logo-empty,
.ig-pdf-mode .ig-logo-zone:not(.has-logo),
body.ig-pdf-mode .no-print,
body.ig-pdf-mode .ig-col-act,
body.ig-pdf-mode th.ig-col-act,
body.ig-pdf-mode td.ig-col-act,
body.ig-pdf-mode .ig-del-row-btn,
body.ig-pdf-mode button.ig-del-row-btn,
body.ig-pdf-mode .ig-add-row-bar,
body.ig-pdf-mode #igAddRowBtn,
body.ig-pdf-mode .ig-remove-logo-btn,
body.ig-pdf-mode .ig-sig-actions,
body.ig-pdf-mode .ig-sig-controls,
body.ig-pdf-mode .ig-sig-upload-btn,
body.ig-pdf-mode .ig-sig-clear-btn,
body.ig-pdf-mode .ig-logo-empty,
body.ig-pdf-mode .ig-logo-zone:not(.has-logo) {
  display: none !important;
  visibility: hidden !important;
  width: 0 !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  opacity: 0 !important;
}

.ig-pdf-mode .ig-logo-zone,
body.ig-pdf-mode .ig-logo-zone {
  border: none !important;
  background: transparent !important;
}

/* Center header title perfectly in PDF mode when NO logo is uploaded */
.ig-pdf-mode.no-logo .ig-paper-header,
.ig-pdf-mode .ig-paper-header.no-logo,
.ig-pdf-mode.ig-paper:not(.has-logo) .ig-paper-header,
.ig-pdf-mode:not(.has-logo) .ig-paper-header,
.ig-pdf-mode .ig-paper-header:not(.has-logo),
body.ig-pdf-mode .ig-paper-header.no-logo,
body.ig-pdf-mode .ig-paper:not(.has-logo) .ig-paper-header,
body.ig-pdf-mode .ig-paper-header:not(.has-logo) {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  text-align: center !important;
  width: 100% !important;
}

.ig-pdf-mode.no-logo .ig-logo-zone,
.ig-pdf-mode.no-logo .ig-header-spacer,
.ig-pdf-mode .ig-paper-header.no-logo .ig-logo-zone,
.ig-pdf-mode .ig-paper-header.no-logo .ig-header-spacer,
.ig-pdf-mode.ig-paper:not(.has-logo) .ig-logo-zone,
.ig-pdf-mode.ig-paper:not(.has-logo) .ig-header-spacer,
.ig-pdf-mode:not(.has-logo) .ig-logo-zone,
.ig-pdf-mode:not(.has-logo) .ig-header-spacer,
.ig-pdf-mode .ig-paper-header:not(.has-logo) .ig-logo-zone,
.ig-pdf-mode .ig-paper-header:not(.has-logo) .ig-header-spacer,
body.ig-pdf-mode .ig-paper-header.no-logo .ig-logo-zone,
body.ig-pdf-mode .ig-paper-header.no-logo .ig-header-spacer,
body.ig-pdf-mode .ig-paper:not(.has-logo) .ig-logo-zone,
body.ig-pdf-mode .ig-paper:not(.has-logo) .ig-header-spacer {
  display: none !important;
  visibility: hidden !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.ig-pdf-mode.no-logo .ig-header-meta,
.ig-pdf-mode .ig-paper-header.no-logo .ig-header-meta,
.ig-pdf-mode.ig-paper:not(.has-logo) .ig-header-meta,
.ig-pdf-mode:not(.has-logo) .ig-header-meta,
.ig-pdf-mode .ig-paper-header:not(.has-logo) .ig-header-meta,
body.ig-pdf-mode .ig-paper-header.no-logo .ig-header-meta,
body.ig-pdf-mode .ig-paper:not(.has-logo) .ig-header-meta,
body.ig-pdf-mode .ig-paper-header:not(.has-logo) .ig-header-meta {
  width: 100% !important;
  max-width: 100% !important;
  text-align: center !important;
  margin: 0 auto !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

.ig-pdf-mode.no-logo .ig-input-title,
.ig-pdf-mode .ig-paper-header.no-logo .ig-input-title,
.ig-pdf-mode.ig-paper:not(.has-logo) .ig-input-title,
.ig-pdf-mode:not(.has-logo) .ig-input-title,
.ig-pdf-mode .ig-paper-header:not(.has-logo) .ig-input-title,
body.ig-pdf-mode .ig-paper-header.no-logo .ig-input-title,
body.ig-pdf-mode .ig-paper:not(.has-logo) .ig-input-title,
body.ig-pdf-mode .ig-paper-header:not(.has-logo) .ig-input-title {
  text-align: center !important;
  margin: 0 auto !important;
  width: auto !important;
}

.ig-pdf-mode.ig-paper,
.ig-pdf-mode .ig-paper,
body.ig-pdf-mode .ig-paper {
  box-shadow: none !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  background: #ffffff !important;
  display: flex !important;
  flex-direction: column !important;
}

.ig-pdf-mode .ig-paper.ig-single-page-pdf,
body.ig-pdf-mode .ig-paper.ig-single-page-pdf {
  min-height: calc(297mm - (var(--ig-print-margin, 8mm) * 2) - 8mm) !important;
  box-sizing: border-box !important;
}

.ig-pdf-mode input,
.ig-pdf-mode textarea,
body.ig-pdf-mode input,
body.ig-pdf-mode textarea {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.ig-pdf-text-clone {
  white-space: pre-wrap !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  box-sizing: border-box !important;
  overflow: visible !important;
}

.ig-party-box .ig-pdf-text-clone,
.ig-pdf-mode .ig-party-box .ig-paper-textarea,
body.ig-pdf-mode .ig-party-box .ig-paper-textarea {
  font-size: 11.5px !important;
  line-height: 1.5 !important;
  color: #334155 !important;
  padding: 3px 5px !important;
  width: 100% !important;
  display: block !important;
  white-space: pre-wrap !important;
  word-break: break-word !important;
  overflow: visible !important;
}

.ig-notes-box .ig-pdf-text-clone,
.ig-pdf-mode .ig-notes-box .ig-paper-textarea,
body.ig-pdf-mode .ig-notes-box .ig-paper-textarea {
  font-size: 10.5pt !important;
  line-height: 1.55 !important;
  color: #1e293b !important;
  padding: 4px 6px !important;
  width: 100% !important;
  display: block !important;
  white-space: pre-wrap !important;
  word-break: break-word !important;
  overflow: visible !important;
}

.ig-bank-row .ig-pdf-text-clone {
  font-size: 11px !important;
  font-weight: 600 !important;
  color: #0f172a !important;
  flex: 1 !important;
  min-width: 0 !important;
  padding: 1px 4px !important;
  white-space: pre-wrap !important;
  word-break: break-word !important;
}

.ig-pdf-mode .ig-paper-header,
.ig-pdf-mode .ig-parties-grid,
.ig-pdf-mode .ig-totals-box,
.ig-pdf-mode .ig-sig-box,
.ig-pdf-mode .ig-sig-wrapper,
body.ig-pdf-mode .ig-paper-header,
body.ig-pdf-mode .ig-parties-grid,
body.ig-pdf-mode .ig-totals-box,
body.ig-pdf-mode .ig-sig-box,
body.ig-pdf-mode .ig-sig-wrapper {
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

.ig-pdf-mode .ig-table tr,
body.ig-pdf-mode .ig-table tr {
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

/* ==========================================================================
   SMART STEP-BY-STEP INVOICE WIZARD (معالج الفاتورة التدريجي)
   ========================================================================== */
.ig-mode-switcher-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 8px 0 20px;
  gap: 8px;
}

.ig-mode-segmented {
  display: inline-flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 12px;
  gap: 4px;
  border: 1px solid #e2e8f0;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
}

.ig-mode-btn {
  padding: 8px 18px;
  font-family: var(--ig-font-ar) !important;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0 !important;
  font-feature-settings: "liga" 1, "calt" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  border: none;
  background: transparent;
  color: #64748b;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  user-select: none;
  line-height: 1.4;
}

.ig-mode-btn:hover:not(.active) {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.6);
}

.ig-mode-btn.active {
  background: #ffffff;
  color: var(--ig-primary, #006C35);
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(0, 108, 53, 0.12), 0 1px 3px rgba(0, 0, 0, 0.06);
}

.ig-mode-icon {
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.ig-mode-text {
  font-family: inherit !important;
  font-weight: inherit;
  letter-spacing: 0 !important;
  line-height: 1.4;
}

/* Wizard Card Container */
.ig-wizard-container {
  max-width: 1000px;
  margin: 0 auto 36px;
  width: 100%;
}

.ig-wizard-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  box-shadow: 0 8px 24px -4px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

/* Wizard Progress Header */
.ig-wizard-header {
  padding: 18px 26px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.ig-wz-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 800;
  color: #1e293b;
}

.ig-wz-step-badge {
  background: #e6f4ea;
  color: var(--ig-primary);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.ig-wz-progress-bg {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.ig-wz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #006C35, #10b981);
  width: 14.28%;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Wizard Step Contents */
.ig-wizard-step {
  padding: 26px 30px;
  display: none;
}

.ig-wizard-step.active {
  display: block;
  animation: igFadeIn 0.25s ease-out;
}

@keyframes igFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.ig-wz-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 6px;
}

.ig-wz-desc {
  font-size: 13.5px;
  color: #64748b;
  margin: 0 0 20px;
  line-height: 1.5;
}

/* Card Selection Grids */
.ig-wz-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.ig-wz-card-choice {
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  background: #ffffff;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ig-wz-card-choice:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.ig-wz-card-choice.selected {
  border-color: var(--ig-primary);
  background: #f0fdf4;
  box-shadow: 0 0 0 1px var(--ig-primary);
}

.ig-wz-card-icon {
  font-size: 26px;
}

.ig-wz-card-name {
  font-size: 14.5px;
  font-weight: 800;
  color: #0f172a;
}

.ig-wz-card-desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

/* Wizard Form Grid */
.ig-wz-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

@media (max-width: 640px) {
  .ig-wz-form-grid {
    grid-template-columns: 1fr;
  }
}

.ig-wz-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ig-wz-group.full {
  grid-column: 1 / -1;
}

.ig-wz-label {
  font-size: 12.5px;
  font-weight: 700;
  color: #1e293b;
}

.ig-wz-input,
.ig-wz-select,
.ig-wz-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  color: #0f172a;
  background: #ffffff;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ig-wz-input:focus,
.ig-wz-select:focus,
.ig-wz-textarea:focus {
  outline: none;
  border-color: var(--ig-primary);
  box-shadow: 0 0 0 3px rgba(0, 108, 53, 0.12);
}

/* Wizard Items Builder List */
.ig-wz-items-builder {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.ig-wz-items-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.ig-wz-item-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ig-wz-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ig-wz-item-title {
  font-weight: 700;
  font-size: 14px;
  color: #0f172a;
}

.ig-wz-item-calc {
  font-size: 12px;
  color: #64748b;
  font-family: monospace;
}

.ig-wz-btn-del {
  border: none;
  background: #fee2e2;
  color: #dc2626;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: background 0.15s;
}

.ig-wz-btn-del:hover {
  background: #fecaca;
}

/* Wizard Summary Box */
.ig-wz-summary-box {
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
  border: 2px solid #bbf7d0;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.ig-wz-sum-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px dashed #dcfce7;
  font-size: 14px;
  color: #334155;
}

.ig-wz-sum-row.total {
  border-bottom: none;
  padding-top: 12px;
  font-size: 18px;
  font-weight: 800;
  color: var(--ig-primary);
}

.ig-wz-tafqeet-preview {
  margin-top: 10px;
  padding: 8px 12px;
  background: #ffffff;
  border-radius: 6px;
  font-size: 12.5px;
  color: #166534;
  font-weight: 600;
  border: 1px solid #bbf7d0;
}

/* Wizard Footer Navigation */
.ig-wizard-footer {
  padding: 16px 26px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.ig-wz-btn-back {
  padding: 10px 20px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ig-wz-btn-back:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.ig-wz-btn-next {
  padding: 10px 24px;
  border: none;
  background: var(--ig-primary);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(0, 108, 53, 0.25);
}

.ig-wz-btn-next:hover {
  background: var(--ig-primary-dark);
  box-shadow: 0 4px 12px rgba(0, 108, 53, 0.35);
}

.ig-wz-btn-finish {
  background: linear-gradient(135deg, #006C35 0%, #059669 100%) !important;
  font-size: 15px !important;
  padding: 12px 28px !important;
}

/* ==========================================================================
   PRINT STYLES: Pure Crisp A4 Sheet (Exact Multi-Page & Zero Delete Icons)
   ========================================================================== */
@page {
  size: A4 portrait;
  margin: var(--ig-print-margin, 8mm);
}

@media print {
  body * {
    visibility: hidden;
  }
  
  .site-header,
  .site-footer,
  .breadcrumb-nav,
  .calc-card,
  .ig-sidebar,
  .no-print,
  .ig-col-act,
  .ig-del-row-btn,
  .ig-add-row-bar,
  .ig-remove-logo-btn,
  .ig-sig-actions,
  .ig-sig-controls,
  .ig-sig-upload-btn,
  .ig-sig-clear-btn,
  .ig-logo-empty {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .ig-sheet-container,
  .ig-sheet-container * {
    visibility: visible;
  }

  .ig-sheet-container {
    position: absolute;
    left: 0;
    top: 0;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .ig-paper {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    font-size: 10pt !important;
    color: #000000 !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .ig-paper-header.no-logo,
  .ig-paper.no-logo .ig-paper-header,
  .ig-paper:not(.has-logo) .ig-paper-header,
  .ig-paper-header:not(.has-logo) {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
    width: 100% !important;
  }

  .ig-paper-header.no-logo .ig-logo-zone,
  .ig-paper.no-logo .ig-logo-zone,
  .ig-paper:not(.has-logo) .ig-paper-header .ig-logo-zone,
  .ig-paper-header:not(.has-logo) .ig-logo-zone,
  .ig-paper-header.no-logo .ig-header-spacer,
  .ig-paper.no-logo .ig-header-spacer,
  .ig-paper:not(.has-logo) .ig-paper-header .ig-header-spacer,
  .ig-paper-header:not(.has-logo) .ig-header-spacer,
  .ig-logo-zone:not(.has-logo) {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .ig-paper-header.no-logo .ig-header-meta,
  .ig-paper.no-logo .ig-paper-header .ig-header-meta,
  .ig-paper:not(.has-logo) .ig-paper-header .ig-header-meta,
  .ig-paper-header:not(.has-logo) .ig-header-meta {
    width: 100% !important;
    max-width: 100% !important;
    text-align: center !important;
    margin: 0 auto !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }

  .ig-paper-header.no-logo .ig-input-title,
  .ig-paper.no-logo .ig-paper-header .ig-input-title,
  .ig-paper:not(.has-logo) .ig-paper-header .ig-input-title,
  .ig-paper-header:not(.has-logo) .ig-input-title {
    text-align: center !important;
    margin: 0 auto !important;
    width: auto !important;
  }

  .ig-paper.ig-single-page-pdf {
    min-height: calc(297mm - (var(--ig-print-margin, 8mm) * 2) - 8mm) !important;
    box-sizing: border-box !important;
  }

  .ig-paper input,
  .ig-paper textarea {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    color: #000000 !important;
  }

  .ig-party-box .ig-paper-textarea,
  .ig-notes-box .ig-paper-textarea,
  .ig-party-box .ig-pdf-text-clone,
  .ig-notes-box .ig-pdf-text-clone {
    font-size: 9.5pt !important;
    line-height: 1.5 !important;
    color: #000000 !important;
    overflow: visible !important;
    white-space: pre-wrap !important;
    word-break: break-word !important;
    width: 100% !important;
    display: block !important;
  }

  .ig-table th {
    background-color: #f1f5f9 !important;
    color: #000000 !important;
    border: 1px solid #cbd5e1 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .ig-table td {
    border: 1px solid #cbd5e1 !important;
  }

  /* Multi-page clean break rules */
  .ig-paper-header,
  .ig-parties-grid,
  .ig-bottom-grid,
  .ig-totals-box,
  .ig-sig-box,
  .ig-sig-wrapper {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .ig-table tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
}

/* ==========================================================================
   INVOICE WORKSPACE SEO, FEATURES & CAPABILITIES SHOWCASE
   (Completely hidden from print & PDF via .no-print)
   ========================================================================== */
.ig-seo-workspace-guide {
  width: 100%;
  max-width: 960px;
  margin: 48px auto 0 auto !important;
  box-sizing: border-box;
}

/* Feature Ribbon / Badges */
.ig-seo-ribbon {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 36px;
}

.ig-seo-badge-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  transition: transform 0.2s, box-shadow 0.2s;
}

.ig-seo-badge-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  border-color: #cbd5e1;
}

.ig-seo-badge-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.ig-seo-badge-text {
  display: flex;
  flex-direction: column;
}

.ig-seo-badge-title {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
}

.ig-seo-badge-desc {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

/* Main Content Box */
.ig-seo-article-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.05);
  margin-bottom: 32px;
  box-sizing: border-box;
}

.ig-seo-header-wrap {
  text-align: center;
  max-width: 860px;
  margin: 0 auto 36px;
}

.ig-seo-chip {
  display: inline-block;
  background: #e6f4ea;
  color: #006C35;
  font-size: 11.5px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ig-seo-h2 {
  font-size: 1.65rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 12px;
  line-height: 1.35;
}

.ig-seo-subtitle {
  font-size: 14px;
  color: #475569;
  line-height: 1.7;
  margin: 0;
}

/* Capabilities 6-Grid */
.ig-capabilities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 32px 0 44px;
}

.ig-cap-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 22px 20px;
  transition: all 0.2s ease;
}

.ig-cap-card:hover {
  background: #ffffff;
  border-color: #006C35;
  box-shadow: 0 8px 20px rgba(0, 108, 53, 0.08);
  transform: translateY(-2px);
}

.ig-cap-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.ig-cap-icon {
  font-size: 24px;
  line-height: 1;
}

.ig-cap-title {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
}

.ig-cap-desc {
  font-size: 12.5px;
  color: #475569;
  line-height: 1.65;
  margin: 0 0 12px;
}

.ig-cap-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 11.5px;
  color: #334155;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ig-cap-list li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ig-cap-list li::before {
  content: "✔";
  color: #006C35;
  font-weight: 800;
  font-size: 10px;
}

/* 3-Step How It Works */
.ig-how-steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 28px 0 40px;
}

@media (max-width: 768px) {
  .ig-how-steps-grid {
    grid-template-columns: 1fr;
  }
}

.ig-step-box {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px 20px;
  position: relative;
  text-align: center;
}

.ig-step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #006C35;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  margin: -38px auto 14px;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 108, 53, 0.3);
}

.ig-step-title {
  font-size: 14.5px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 8px;
}

.ig-step-desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.6;
  margin: 0;
}

/* Comparison Matrix */
.ig-vs-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 32px 0 40px;
}

.ig-vs-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  font-size: 12.5px;
  text-align: start;
}

.ig-vs-table th {
  background: #f1f5f9;
  padding: 14px 18px;
  font-weight: 800;
  color: #0f172a;
  border-bottom: 2px solid #cbd5e1;
}

.ig-vs-table th.col-highlight {
  background: #e6f4ea;
  color: #006C35;
  font-weight: 900;
}

.ig-vs-table td {
  padding: 13px 18px;
  border-bottom: 1px solid #e2e8f0;
  color: #334155;
}

.ig-vs-table tr:last-child td {
  border-bottom: none;
}

.ig-vs-table td.col-highlight {
  background: #f0fdf4;
  font-weight: 700;
  color: #006C35;
}

/* Interactive FAQ Accordion */
.ig-faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.ig-faq-item {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  background: #ffffff;
  transition: border-color 0.15s;
}

.ig-faq-item:hover {
  border-color: #cbd5e1;
}

.ig-faq-question {
  width: 100%;
  text-align: inherit;
  background: #f8fafc;
  border: none;
  padding: 16px 20px;
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.15s;
}

.ig-faq-question:hover {
  background: #f1f5f9;
}

.ig-faq-icon {
  font-size: 11px;
  color: #64748b;
  transition: transform 0.2s ease;
}

.ig-faq-item.active .ig-faq-icon {
  transform: rotate(180deg);
  color: #006C35;
}

.ig-faq-answer {
  display: none;
  padding: 16px 20px;
  font-size: 13px;
  line-height: 1.75;
  color: #475569;
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
}

.ig-faq-item.active .ig-faq-answer {
  display: block;
}

/* ==========================================================================
   SAVED INVOICES HISTORY MODAL OVERLAY (HIDDEN BY DEFAULT)
   ========================================================================== */
.history-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.history-modal-backdrop.active {
  display: flex !important;
}

.history-modal-card {
  background: #ffffff;
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  animation: igModalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid #e2e8f0;
}

@keyframes igModalPop {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.history-modal-card .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.history-modal-card .modal-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

.history-modal-card .modal-body {
  padding: 16px;
  max-height: 70vh;
  overflow-y: auto;
}

/* ==========================================================================
   SHEET TOOLBAR: 12 TEMPLATES, 28 CURRENCIES & PRESETS
   ========================================================================== */
.ig-sheet-toolbar {
  display: none !important;
}

.ig-toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ig-toolbar-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 700;
  color: #475569;
}

.ig-toolbar-select {
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #f8fafc;
  color: #0f172a;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: all 0.15s;
}

.ig-toolbar-select:focus {
  border-color: var(--ig-primary);
  background: #ffffff;
  box-shadow: 0 0 0 2px var(--ig-focus-ring);
}

.ig-toolbar-swatches {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.ig-toolbar-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px #cbd5e1;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  padding: 0;
}

.ig-toolbar-swatch:hover,
.ig-toolbar-swatch.active {
  transform: scale(1.2);
  box-shadow: 0 0 0 2px #0f172a;
}

/* Custom Color Picker Button */
.ig-color-picker-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  overflow: hidden;
}

.ig-color-picker-btn:hover {
  background: #ffffff;
  border-color: #94a3b8;
  color: #0f172a;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.ig-color-picker-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
  margin: 0;
}

.ig-color-picker-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
  display: inline-block;
  flex-shrink: 0;
  transition: transform 0.15s ease, background-color 0.2s ease;
}

.ig-color-picker-btn:hover .ig-color-picker-icon {
  transform: scale(1.2);
}

.ig-color-picker-text {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.ig-tb-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ig-tb-btn {
  padding: 6px 11px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ig-tb-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.ig-tb-btn-danger:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

/* ==========================================================================
   SETTINGS MODAL & TOGGLE SWITCHES
   ========================================================================== */
.ig-settings-card {
  max-width: 520px;
}

.ig-settings-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px !important;
}

.ig-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  transition: all 0.15s ease;
}

.ig-setting-row:hover {
  border-color: #cbd5e1;
  background: #ffffff;
}

.ig-setting-info {
  flex: 1;
  min-width: 0;
}

.ig-setting-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ig-setting-desc {
  font-size: 11.5px;
  line-height: 1.5;
  color: #64748b;
}

.ig-setting-control {
  flex-shrink: 0;
}

/* Modern iOS / Material Toggle Switch */
.ig-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  margin: 0;
  cursor: pointer;
}

.ig-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
}

.ig-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  border-radius: 26px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.ig-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.ig-switch input:checked + .ig-slider {
  background-color: var(--ig-primary, #006C35);
}

.ig-switch input:checked + .ig-slider:before {
  transform: translateX(22px);
}

[dir="rtl"] .ig-switch input:checked + .ig-slider:before,
.ig-paper[dir="rtl"] .ig-switch input:checked + .ig-slider:before {
  transform: translateX(-22px);
}

/* Lang Switch Pills inside Settings */
.ig-lang-switch-toggle {
  display: inline-flex;
  background: #e2e8f0;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.ig-toggle-pill-btn {
  padding: 5px 12px;
  border: none;
  background: transparent;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.ig-toggle-pill-btn.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* Currency Select & Preset Actions inside Settings Modal */
.ig-setting-select {
  min-width: 230px;
  max-width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  color: #1e293b;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
}

.ig-setting-select:focus {
  border-color: var(--ig-primary, #006C35);
  box-shadow: 0 0 0 3px rgba(0, 108, 53, 0.12);
}

.ig-setting-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ig-setting-actions .ig-tb-btn {
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 7px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.ig-setting-actions .ig-tb-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
  transform: translateY(-1px);
}

.ig-header-color-btn:hover {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

.ig-header-clear-btn:hover {
  background: #fef2f2 !important;
  border-color: #fca5a5 !important;
  color: #b91c1c !important;
}





/* Tax Column Percentage Indicator Styling */
.ig-tax-input-wrap {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 1px !important;
  width: auto !important;
  margin: 0 auto !important;
}

.ig-tax-input-wrap .item-tax {
  width: 24px !important;
  max-width: 28px !important;
  text-align: end !important;
  font-size: 11.5px !important;
  font-weight: 500 !important;
  padding: 2px 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

.ig-tax-pct-sym {
  font-size: 10.5px !important;
  font-weight: 500 !important;
  color: #64748b !important;
  user-select: none !important;
  pointer-events: none !important;
  margin-inline-start: 1px !important;
}

.ig-pdf-mode .ig-tax-input-wrap,
body.ig-pdf-mode .ig-tax-input-wrap {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 1px !important;
}

.ig-pdf-mode .ig-tax-pct-sym,
body.ig-pdf-mode .ig-tax-pct-sym {
  display: inline-block !important;
  font-size: 10.5px !important;
  font-weight: 500 !important;
  color: #0f172a !important;
  margin-inline-start: 1px !important;
}

/* ==========================================================================
   Totals Column & Repositioned ZATCA QR Code Block
   ========================================================================== */
.ig-totals-column {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  align-items: center !important;
  width: 100% !important;
  min-width: 0 !important;
  align-self: start !important;
  height: fit-content !important;
}

.ig-totals-column .ig-totals-box {
  order: 1 !important;
  width: 100% !important;
  box-sizing: border-box !important;
  height: fit-content !important;
}

.ig-totals-column .ig-zatca-qr-block {
  order: 2 !important;
  margin: 6px auto 0 !important;
  width: 130px !important;
}

/* ==========================================================================
   Bank Details & Payment Terms Visibility Toggles (Screen, Print, and PDF)
   ========================================================================== */
.ig-hide-bank #igBankBox,
body.ig-hide-bank #igBankBox,
.ig-pdf-mode.ig-hide-bank #igBankBox,
body.ig-pdf-mode.ig-hide-bank #igBankBox,
.ig-pdf-mode.ig-hide-bank .ig-bank-box,
body.ig-pdf-mode.ig-hide-bank .ig-bank-box,
#igBankBox.ig-hide-box {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  opacity: 0 !important;
}

.ig-hide-terms #igNotesBox,
body.ig-hide-terms #igNotesBox,
.ig-pdf-mode.ig-hide-terms #igNotesBox,
body.ig-pdf-mode.ig-hide-terms #igNotesBox,
.ig-pdf-mode.ig-hide-terms .ig-notes-box,
body.ig-pdf-mode.ig-hide-terms .ig-notes-box,
#igNotesBox.ig-hide-box {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  opacity: 0 !important;
}

.ig-pdf-mode .ig-totals-column,
body.ig-pdf-mode .ig-totals-column {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  align-items: center !important;
  align-self: start !important;
  height: fit-content !important;
  order: 2 !important;
  width: 100% !important;
}

.ig-pdf-mode .ig-totals-column .ig-totals-box,
body.ig-pdf-mode .ig-totals-column .ig-totals-box {
  order: 1 !important;
  width: 100% !important;
  height: fit-content !important;
}

body.ig-hide-zatca #igZatcaQrBlock,
.ig-hide-zatca #igZatcaQrBlock,
#igZatcaQrBlock.ig-hide-box,
body.ig-pdf-mode.ig-hide-zatca #igZatcaQrBlock,
body.ig-pdf-mode .ig-hide-zatca #igZatcaQrBlock,
body.ig-pdf-mode #igZatcaQrBlock.ig-hide-box,
body.ig-pdf-mode .ig-totals-column #igZatcaQrBlock.ig-hide-box {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.ig-pdf-mode:not(.ig-hide-zatca) .ig-totals-column .ig-zatca-qr-block:not(.ig-hide-box),
body.ig-pdf-mode:not(.ig-hide-zatca) .ig-totals-column .ig-zatca-qr-block:not(.ig-hide-box) {
  order: 2 !important;
  display: flex !important;
  margin: 8px auto 0 !important;
}

@media print {
  body.ig-hide-bank #igBankBox,
  .ig-hide-bank #igBankBox,
  #igBankBox.ig-hide-box {
    display: none !important;
  }
  body.ig-hide-terms #igNotesBox,
  .ig-hide-terms #igNotesBox,
  #igNotesBox.ig-hide-box {
    display: none !important;
  }
  body.ig-hide-zatca #igZatcaQrBlock,
  .ig-hide-zatca #igZatcaQrBlock,
  #igZatcaQrBlock.ig-hide-box {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .ig-totals-column {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    align-items: center !important;
    align-self: start !important;
  }
  .ig-totals-column .ig-totals-box {
    order: 1 !important;
  }
  .ig-totals-column .ig-zatca-qr-block {
    order: 2 !important;
  }
}

/* ==========================================================================
   SEO Educational Content Section Below Invoice (Screen Only)
   ========================================================================== */
.ig-seo-container {
  width: 100%;
  max-width: 960px;
  margin: 48px auto 0;
  box-sizing: border-box;
}

.ig-seo-article-card {
  background: #ffffff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: clamp(20px, 4vw, 36px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  margin-bottom: 24px;
}

.ig-seo-title {
  font-size: clamp(1.25rem, 2.5vw, 1.55rem);
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ig-seo-subtitle {
  font-size: clamp(1.05rem, 2vw, 1.22rem);
  font-weight: 700;
  color: #1e293b;
  margin: 24px 0 10px;
}

.ig-seo-text {
  font-size: 0.95rem;
  line-height: 1.85;
  color: #475569;
  margin-bottom: 14px;
}

.ig-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 20px 0 28px;
}

.ig-feature-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 18px 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.ig-feature-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.ig-feature-icon {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.ig-feature-heading {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
}

.ig-feature-desc {
  font-size: 0.88rem;
  line-height: 1.65;
  color: #64748b;
}

.ig-compare-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 20px 0;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.ig-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  text-align: start;
}

.ig-compare-table th {
  background: #f1f5f9;
  color: #1e293b;
  font-weight: 700;
  padding: 12px 14px;
  border-bottom: 2px solid #cbd5e1;
}

.ig-compare-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
  color: #334155;
  line-height: 1.6;
}

.ig-compare-table tr:hover td {
  background: #f8fafc;
}

.ig-related-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.ig-related-tool-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  text-decoration: none;
  color: #1e293b;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.ig-related-tool-card:hover {
  background: #ffffff;
  border-color: #006C35;
  color: #006C35;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 108, 53, 0.1);
}

.ig-related-tool-icon {
  font-size: 1.3rem;
}

.ig-page-intro {
  width: min(100%, 860px);
  margin: 0 auto 16px;
  padding: 12px 16px 0;
  text-align: start;
}

.ig-page-intro h1 {
  margin: 0 0 4px;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
}

.ig-page-intro p {
  margin: 0;
  line-height: 1.6;
}

[lang="ar"] .ig-page-intro {
  font-family: "Cairo", "Tajawal", sans-serif;
  letter-spacing: 0 !important;
  font-feature-settings: "liga" 1, "calt" 1;
}
