/* ═══════════════════════════════════════════════════════════════
   MarketingX1 · Invoice Generator — style.css
   Arabic · RTL · A4 Print Ready
   Primary dark: rgb(17, 24, 39) = #111827
═══════════════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────────── */
:root {
  --dark:          #111827;
  --dark-2:        #1F2937;
  --dark-3:        #374151;
  --dark-4:        #4B5563;
  --mid:           #6B7280;
  --border:        #D1D5DB;
  --border-dark:   #374151;
  --bg:            #F3F4F6;
  --bg-2:          #E9EAED;
  --white:         #FFFFFF;

  --accent:        #D4AF37;
  --accent-light:  #EDD97A;
  --accent-muted:  #FBF5DC;

  --inv-header-bg: #111827;
  --inv-text:      #111827;
  --inv-text-2:    #374151;
  --inv-border:    #D1D5DB;
  --inv-row-alt:   #F9FAFB;

  --font: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
  --radius:    10px;
  --radius-lg: 16px;
  --shadow-card: 0 2px 12px rgba(17,24,39,.07);
  --shadow-lg:   0 8px 40px rgba(17,24,39,.14);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--dark);
  direction: rtl;
  -webkit-font-smoothing: antialiased;
}
input, textarea, select, button { font-family: var(--font); font-size: inherit; }
.hidden { display: none !important; }

/* ── App Header ─────────────────────────────────────────────── */
.app-header {
  background: var(--dark);
  padding: 1rem 2rem;
  position: sticky; top: 0; z-index: 100;
  border-bottom: 2px solid var(--accent);
}
.app-header__inner {
  max-width: 860px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
}
.app-header__brand { display: flex; align-items: center; }
.app-logo { height: 38px; object-fit: contain; }
.app-header__sub { font-size: .8rem; color: var(--mid); display: none; }
@media (min-width: 600px) { .app-header__sub { display: block; } }

/* ── Form Layout ────────────────────────────────────────────── */
.form-container { max-width: 860px; margin: 2rem auto 4rem; padding: 0 1.25rem; }
.card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.75rem 1.75rem 2rem;
  margin-bottom: 1.5rem;
}
.card__legend {
  font-size: .95rem; font-weight: 700; color: var(--dark);
  padding: 0 .5rem; margin-bottom: 1.25rem;
  display: flex; align-items: center; gap: .45rem;
  border: none; float: none; width: 100%;
}
.legend-icon { font-size: 1rem; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.25rem; }
@media (max-width: 580px) { .form-grid { grid-template-columns: 1fr; } }
.col-span-2 { grid-column: span 2; }
@media (max-width: 580px) { .col-span-2 { grid-column: span 1; } }

.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group label { font-size: .8rem; font-weight: 700; color: var(--dark-2); letter-spacing: .02em; }
.req { color: var(--accent); }

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%; padding: .65rem .85rem;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  color: var(--dark); background: var(--white);
  transition: border-color .2s, box-shadow .2s; outline: none; line-height: 1.6;
}
.form-group textarea { resize: vertical; min-height: 70px; }
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--dark-3);
  box-shadow: 0 0 0 3px rgba(17,24,39,.1);
}
.form-group input.input-error { border-color: #DC2626; box-shadow: 0 0 0 3px rgba(220,38,38,.1); }
.hint { font-size: .74rem; color: var(--mid); }

/* ── Date Input ─────────────────────────────────────────────── */
.date-input-wrap { display: flex; gap: .5rem; align-items: center; }
.date-input-wrap input { flex: 1; }
.btn-today {
  flex-shrink: 0; padding: .55rem .8rem;
  background: var(--dark); color: var(--white);
  border: none; border-radius: var(--radius);
  font-size: .75rem; font-weight: 700; cursor: pointer;
  font-family: var(--font); white-space: nowrap; transition: background .2s;
}
.btn-today:hover { background: var(--dark-3); }

/* ── File Upload ────────────────────────────────────────────── */
.file-upload-wrap { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.file-upload-wrap input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-upload-label {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .52rem .95rem;
  background: var(--dark); color: #ffffff !important; border-radius: var(--radius);
  font-size: .8rem; font-weight: 700; cursor: pointer;
  transition: background .2s; white-space: nowrap; user-select: none;
}
.file-upload-label:hover { background: var(--dark-2); }
#logo-filename { font-size: .78rem; color: var(--mid); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Items Table ────────────────────────────────────────────── */
.items-table-wrap { border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem; }
.items-table-head {
  display: grid; grid-template-columns: 1fr 80px 110px 100px 36px;
  background: var(--dark); color: var(--white);
  font-size: .74rem; font-weight: 700; padding: .6rem 1rem; letter-spacing: .05em;
}
@media (max-width: 620px) { .items-table-head { display: none; } }

.item-row { border-bottom: 1px solid var(--border); background: var(--white); }
.item-row:last-child { border-bottom: none; }
.item-row:nth-child(even) { background: var(--inv-row-alt); }
.item-row__fields { display: grid; grid-template-columns: 1fr 80px 110px 100px 36px; align-items: start; padding: .55rem .75rem; }
@media (max-width: 620px) { .item-row__fields { grid-template-columns: 1fr 1fr; gap: .5rem; padding: .75rem; } }
.item-main { display: flex; flex-direction: column; gap: .28rem; }

.item-row input,
.item-row textarea {
  width: 100%; border: 1.5px solid transparent; border-radius: 6px;
  padding: .42rem .55rem; font-size: .86rem; background: transparent;
  color: var(--dark); outline: none; transition: border-color .2s, background .2s;
  font-family: var(--font);
}
.item-row input:focus,
.item-row textarea:focus { border-color: var(--dark-3); background: var(--white); }
.item-title { font-weight: 600; }
.item-desc {
  font-size: .78rem;
  color: var(--mid);
  resize: vertical;
  min-height: 38px;
  white-space: pre-wrap;
  line-height: 1.5;
  field-sizing: content;
}
.item-qty, .item-price { text-align: center; }
.item-amount { text-align: center; font-weight: 700; color: var(--dark); background: var(--bg) !important; cursor: default; border-color: transparent !important; }
.item-remove-btn {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border: none; background: transparent; color: #9CA3AF;
  cursor: pointer; border-radius: 6px; margin-top: .25rem; transition: background .15s, color .15s; flex-shrink: 0;
}
.item-remove-btn:hover { background: #FEE2E2; color: #DC2626; }

.btn-add-item {
  display: flex; align-items: center; justify-content: center; gap: .45rem; width: 100%;
  background: transparent; color: var(--dark-3); border: 2px dashed var(--border-dark);
  border-radius: var(--radius); padding: .65rem; font-size: .86rem; font-weight: 700;
  cursor: pointer; transition: all .2s; font-family: var(--font); margin-bottom: 1.25rem;
}
.btn-add-item:hover { background: var(--dark); color: var(--white); border-color: var(--dark); }

/* ── Live Totals ────────────────────────────────────────────── */
.live-totals { background: var(--dark); border-radius: var(--radius); padding: 1rem 1.25rem; }
.live-totals__row {
  display: flex; justify-content: space-between; padding: .32rem 0;
  color: #9CA3AF; font-size: .86rem; border-bottom: 1px solid rgba(255,255,255,.05);
}
.live-totals__row:last-child { border-bottom: none; }
.live-totals__row--total { color: var(--white); font-weight: 800; font-size: 1rem; padding-top: .55rem; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--dark); color: var(--white); border: none;
  border-radius: var(--radius); padding: .7rem 1.5rem;
  font-size: .92rem; font-weight: 700; cursor: pointer;
  transition: background .2s, transform .1s, box-shadow .2s;
  font-family: var(--font); letter-spacing: .02em;
}
.btn-primary:hover { background: var(--dark-2); box-shadow: 0 4px 18px rgba(17,24,39,.3); }
.btn-primary:active { transform: scale(.98); }
.btn-large { padding: .9rem 2.5rem; font-size: 1rem; border-radius: var(--radius-lg); }

.btn-outline {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--white); color: var(--dark); border: 2px solid var(--border);
  border-radius: var(--radius); padding: .65rem 1.25rem;
  font-size: .88rem; font-weight: 700; cursor: pointer;
  transition: border-color .2s; font-family: var(--font);
}
.btn-outline:hover { border-color: var(--dark); }
.form-actions { display: flex; justify-content: center; padding: 1rem 0; }

/* ── Invoice wrapper / actions ──────────────────────────────── */
.invoice-actions {
  max-width: 860px; margin: 1.5rem auto .75rem; padding: 0 1.25rem;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.invoice-wrapper { max-width: 860px; margin: 0 auto 4rem; padding: 0 1.25rem; }

/* ═══════════════════════════════════════════════════════════════
   INVOICE DOCUMENT
═══════════════════════════════════════════════════════════════ */
.invoice {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
  font-size: .92rem; color: var(--inv-text); line-height: 1.65;
}

.inv-header {
  background: var(--dark);
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  padding: 1.75rem 2.25rem; flex-wrap: wrap;
}
.inv-header__logo-wrap { flex-shrink: 0; display: flex; align-items: center; }
.inv-logo {
  max-height: 68px;
  max-width: 210px;
  object-fit: contain;
  mix-blend-mode: screen;   /* blends black bg away on dark header */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}
.inv-header__company { flex: 1; min-width: 180px; }
.inv-header__company * { direction: ltr; text-align: left; }
.inv-company-name { font-size: 1.1rem; font-weight: 800; color: var(--accent); margin-bottom: .25rem; letter-spacing: .04em; }
.inv-header__company p { font-size: .78rem; color: rgba(255,255,255,.6); margin: .08rem 0; }

.inv-meta-bar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem; padding: 1.2rem 2.25rem;
  border-bottom: 1.5px solid var(--inv-border);
}
.inv-meta-bar__title { display: flex; align-items: baseline; gap: .9rem; }
.inv-meta-bar__title h1 { font-size: 1.75rem; font-weight: 900; color: var(--dark); letter-spacing: -.02em; }
.inv-number { font-size: .95rem; font-weight: 600; color: var(--mid); }
.inv-meta-bar__dates { display: flex; flex-direction: column; gap: .3rem; }
.inv-date-row { display: flex; gap: .75rem; align-items: center; justify-content: flex-end; }
.inv-date-label { font-size: .75rem; color: var(--mid); font-weight: 500; }
.inv-date-val   { font-size: .86rem; font-weight: 700; color: var(--dark); }

.inv-balance-banner {
  background: var(--dark);
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 2.25rem; gap: 1rem;
}
.inv-balance-label { font-size: .72rem; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: .1em; }
.inv-balance-amount { font-size: 1.55rem; font-weight: 900; color: var(--white); }

.inv-bill-to { padding: 1.4rem 2.25rem; border-bottom: 1.5px solid var(--inv-border); }
.inv-section-title { font-size: .68rem; font-weight: 800; color: var(--dark-3); text-transform: uppercase; letter-spacing: .12em; margin-bottom: .5rem; }
.inv-client-name    { font-size: 1.05rem; font-weight: 700; color: var(--dark); }
.inv-client-details { font-size: .82rem; color: var(--inv-text-2); margin-top: .3rem; white-space: pre-line; }

.inv-items-section { overflow-x: auto; }
.inv-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.inv-table thead tr { background: var(--dark); color: var(--white); }
.inv-table th {
  padding: .75rem 1.1rem; font-weight: 700; font-size: .72rem;
  letter-spacing: .07em; text-align: right; white-space: nowrap;
}
.th-num    { width: 40px;  text-align: center; }
.th-qty    { width: 70px;  text-align: center; }
.th-price  { width: 120px; text-align: center; }
.th-amount { width: 130px; text-align: center; }

.inv-table tbody tr { border-bottom: 1px solid var(--inv-border); }
.inv-table tbody tr:nth-child(even) { background: var(--inv-row-alt); }
.inv-table tbody tr:last-child { border-bottom: none; }
.inv-table td { padding: .82rem 1.1rem; color: var(--inv-text-2); vertical-align: top; }
.td-num { text-align: center; color: var(--mid); font-size: .78rem; }
.td-title strong { display: block; color: var(--dark); font-weight: 600; margin-bottom: .12rem; }
.item-desc-text { display: block; font-size: .78rem; color: var(--mid); white-space: pre-wrap; }
.td-qty, .td-price { text-align: center; }
.td-amount { text-align: center; font-weight: 700; color: var(--dark); white-space: nowrap; }
.empty-row { text-align: center; padding: 1.5rem; color: var(--mid); font-size: .85rem; }

.inv-totals {
  display: flex; justify-content: flex-start;
  padding: 1.4rem 2.25rem;
  border-top: 1.5px solid var(--inv-border); border-bottom: 1.5px solid var(--inv-border);
}
.inv-totals__inner { width: 100%; max-width: 340px; margin-right: auto; }
.inv-totals__row {
  display: flex; justify-content: space-between; align-items: center;
  padding: .38rem 0; font-size: .86rem; color: var(--inv-text-2);
  border-bottom: 1px solid var(--inv-border); gap: 1rem;
}
.inv-totals__row:last-child { border-bottom: none; }
.inv-totals__row--grand { font-size: 1rem; font-weight: 800; color: var(--dark); padding: .55rem 0; }
.inv-totals__row--balance {
  background: var(--dark); color: var(--white); font-size: 1rem; font-weight: 800;
  padding: .6rem .85rem; border-radius: 8px; margin-top: .35rem; border-bottom: none;
}

.inv-footer-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  border-bottom: 1.5px solid var(--inv-border);
}
@media (max-width: 600px) { .inv-footer-grid { grid-template-columns: 1fr; } }
.inv-footer-block { padding: 1.4rem 2.25rem; border-right: 1px solid var(--inv-border); }
.inv-footer-block:last-child { border-right: none; }
[dir="rtl"] .inv-footer-block { border-right: 1px solid var(--inv-border); border-left: none; }
[dir="rtl"] .inv-footer-block:last-child { border-right: none; }
.inv-footer-block h4 { font-size: .68rem; font-weight: 800; color: var(--dark-3); text-transform: uppercase; letter-spacing: .12em; margin-bottom: .55rem; }
.inv-footer-block p  { font-size: .82rem; color: var(--inv-text-2); white-space: pre-line; line-height: 1.75; }

.inv-policy { padding: .75rem 2.25rem; background: var(--bg); border-bottom: 1.5px solid var(--inv-border); }
.inv-policy p { font-size: .76rem; color: var(--mid); text-align: center; white-space: pre-wrap; }

.inv-divider-bottom { height: 5px; background: var(--dark); }
.inv-thank-you { text-align: center; padding: .9rem; font-size: .74rem; font-weight: 700; color: var(--mid); letter-spacing: .1em; text-transform: uppercase; }

/* ── App Footer ─────────────────────────────────────────────── */
.app-footer { text-align: center; padding: 1.5rem; font-size: .76rem; color: var(--mid); border-top: 1px solid var(--border); margin-top: 2rem; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 700px) {
  .inv-header         { padding: 1.25rem; flex-direction: column; align-items: flex-start; }
  .inv-meta-bar       { padding: 1rem 1.25rem; }
  .inv-meta-bar__title h1 { font-size: 1.4rem; }
  .inv-balance-banner { padding: .8rem 1.25rem; }
  .inv-balance-amount { font-size: 1.2rem; }
  .inv-bill-to, .inv-totals { padding: 1rem 1.25rem; }
  .inv-footer-block   { padding: 1rem 1.25rem; border-right: none !important; border-top: 1px solid var(--inv-border) !important; }
  .inv-footer-grid    { grid-template-columns: 1fr; }
  .inv-policy         { padding: .6rem 1.25rem; }
  .inv-totals__inner  { max-width: 100%; }
  .invoice-actions    { flex-direction: column-reverse; }
  .btn-primary, .btn-outline { width: 100%; justify-content: center; }
}

  to   { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════
   PDF TIP MODAL
═══════════════════════════════════════════════════════════════ */
.pdf-modal {
  position: fixed;
  inset: 0;
  background: rgba(17,24,39,.65);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.pdf-modal__box {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(17,24,39,.25);
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

.pdf-modal__icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--dark);
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1.1rem;
}

.pdf-modal__box h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 1rem;
}

.pdf-modal__steps {
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  margin-bottom: 1.5rem;
}
.pdf-modal__steps li {
  counter-increment: step;
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  font-size: .87rem;
  color: var(--dark-4);
  line-height: 1.55;
}
.pdf-modal__steps li::before {
  content: counter(step);
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--dark);
  color: var(--white);
  font-size: .72rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin-top: .1rem;
}
.pdf-modal__steps strong { color: var(--dark); }

.pdf-modal__actions {
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
}
.btn-sm { padding: .55rem 1.1rem !important; font-size: .85rem !important; }

/* ═══════════════════════════════════════════════════════════════
   PRINT — BULLETPROOF
   Uses browser's native engine → perfect Arabic, vector text
═══════════════════════════════════════════════════════════════ */
@media print {
  /* ── Global reset ─────────────────────── */
  *,
  *::before,
  *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html, body {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* ── Hide everything except invoice ───── */
  #form-section,
  .app-header,
  .app-footer,
  .no-print,
  .invoice-actions,
  .pdf-modal          { display: none !important; }

  #invoice-section    { display: block !important; }

  .invoice-wrapper {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .invoice {
    box-shadow: none !important;
    border-radius: 0 !important;
    width: 100% !important;
  }

  /* ── Force dark backgrounds ────────────── */
  .inv-header {
    background: #111827 !important;
    padding: 14mm 12mm 10mm !important;
  }
  .inv-header__company p  { color: rgba(255,255,255,.65) !important; }
  .inv-company-name       { color: #D4AF37 !important; }

  .inv-balance-banner {
    background: #111827 !important;
    padding: 6mm 12mm !important;
  }
  .inv-balance-label  { color: #D4AF37 !important; }
  .inv-balance-amount { color: #fff !important; }

  .inv-table thead tr { background: #111827 !important; color: #fff !important; }
  .inv-table th       { color: #fff !important; }
  .inv-table tbody tr:nth-child(even) { background: #F9FAFB !important; }

  .inv-totals__row--balance {
    background: #111827 !important;
    color: #fff !important;
    border-radius: 6px !important;
  }

  .inv-divider-bottom { background: #111827 !important; }
  .inv-policy         { background: #F3F4F6 !important; }

  /* ── Spacing on print ──────────────────── */
  .inv-meta-bar    { padding: 6mm 12mm !important; }
  .inv-bill-to     { padding: 6mm 12mm !important; }
  .inv-totals      { padding: 6mm 12mm !important; }
  .inv-footer-block{ padding: 6mm 12mm !important; }
  .inv-policy      { padding: 4mm 12mm !important; }

  /* ── Table sizing ──────────────────────── */
  .inv-table th,
  .inv-table td    { padding: .45rem .85rem !important; font-size: .8rem !important; }

  /* ── Page breaks ───────────────────────── */
  .inv-table tr    { page-break-inside: avoid !important; }
  .inv-header      { page-break-inside: avoid !important; }
  .inv-totals      { page-break-inside: avoid !important; }
  .inv-footer-grid { page-break-inside: avoid !important; }

  /* ── A4 page ───────────────────────────── */
  @page {
    size: A4 portrait;
    margin: 10mm 8mm;
  }
}



/* ═══════════════════════════════════════════════════════════════
   HEADER — logo + title stack
═══════════════════════════════════════════════════════════════ */
.app-header {
  background: var(--dark);
  border-bottom: 2px solid var(--accent);
  padding: 1.1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header__inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-header__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
}

.app-header__title {
  font-size: .85rem;
  font-weight: 600;
  color: rgba(255,255,255,.7);
  letter-spacing: .06em;
  text-align: center;
  order: -1;
}

.app-logo {
  height: 48px;
  max-width: 200px;
  object-fit: contain;
  mix-blend-mode: screen;
}

@media (min-width: 600px) {
  .app-logo { height: 58px; }
  .app-header__title { font-size: .9rem; }
}

/* ═══════════════════════════════════════════════════════════════
   FOOTER — WhatsApp CTA + logo
═══════════════════════════════════════════════════════════════ */
.app-footer {
  background: var(--dark);
  border-top: 2px solid var(--accent);
  padding: 1.25rem 1.5rem;
  margin-top: 2rem;
}

.app-footer__inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.app-footer__cta {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.footer-cta-text {
  font-size: .8rem;
  color: rgba(255,255,255,.55);
  font-weight: 500;
}

.footer-wa-btn {
  display: inline-flex;
  align-items: center;
  gap: .38rem;
  background: #128C7E;
  color: #fff;
  text-decoration: none;
  padding: .38rem .8rem;
  border-radius: 7px;
  font-size: .75rem;
  font-weight: 700;
  transition: opacity .2s;
  font-family: var(--font);
  white-space: nowrap;
}
.footer-wa-btn:hover { opacity: .85; }

.footer-brand {
  flex-shrink: 0;
}

.footer-logo {
  height: 56px;
  max-width: 200px;
  object-fit: contain;
  mix-blend-mode: screen;
  display: block;
}

@media (max-width: 580px) {
  .app-footer__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: .85rem;
  }
  .footer-brand {
    align-self: flex-end;
  }
}

/* ═══════════════════════════════════════════════════════════════
   INVOICE FALLBACK logo text
═══════════════════════════════════════════════════════════════ */
.inv-logo-text {
  font-size: 1.35rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile first
═══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .form-container { padding: 0 .75rem; }
  .card { padding: 1.25rem 1rem 1.5rem; }
  .items-table-head { display: none; }
  .item-row__fields {
    grid-template-columns: 1fr 1fr;
    gap: .45rem;
    padding: .65rem .6rem;
  }
  .item-main { grid-column: span 2; }
  .invoice-actions {
    flex-direction: column-reverse;
    padding: 0 .75rem;
  }
  .btn-primary, .btn-outline { width: 100%; justify-content: center; }
  .inv-header { padding: 1.1rem; flex-direction: column; align-items: flex-start; }
  .inv-meta-bar { padding: .85rem 1rem; }
  .inv-meta-bar__title h1 { font-size: 1.3rem; }
  .inv-balance-banner { padding: .75rem 1rem; }
  .inv-balance-amount { font-size: 1.1rem; }
  .inv-bill-to, .inv-totals { padding: .85rem 1rem; }
  .inv-footer-block { padding: .85rem 1rem; border-right: none !important; border-top: 1px solid var(--inv-border) !important; }
  .inv-footer-grid { grid-template-columns: 1fr; }
  .inv-totals__inner { max-width: 100%; }
  .pdf-modal__box { padding: 1.25rem; }
  .pdf-modal__steps li { font-size: .82rem; }
}

@media (min-width: 481px) and (max-width: 768px) {
  .form-container { padding: 0 1rem; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .invoice-wrapper { padding: 0 1rem; }
  .invoice-actions { padding: 0 1rem; }
}

@media (min-width: 769px) {
  .app-header { padding: 1.1rem 2rem; }
  .app-footer { padding: 1.25rem 2rem; }
}
