@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

body { font-family: 'Plus Jakarta Sans', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }

.tmpl-card-desc {
  line-height: 1.35;
  min-height: 2.6rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.offline-banner {
  position: fixed;
  top: auto;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 0.45rem 1rem;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(90deg, #4f46e5, #7c3aed, #db2777);
  box-shadow: 0 -8px 20px -12px rgba(79, 70, 229, 0.6);
}
@media (max-width: 767px) {
  .offline-banner {
    bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
  }
}
.offline-banner.hidden { display: none !important; }
body.has-offline-banner {
  padding-bottom: 2.75rem;
}
@media (max-width: 767px) {
  body.has-offline-banner {
    padding-bottom: calc(7.25rem + env(safe-area-inset-bottom, 0px));
  }
}
.offline-feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5, #7c3aed, #db2777);
  box-shadow: 0 10px 20px -10px rgba(79, 70, 229, 0.7);
}

/* Thin theme scrollbars (hide Windows up/down arrows) */
html {
  scrollbar-width: thin;
  scrollbar-color: #7c3aed #eef2ff;
}
* {
  scrollbar-width: thin;
  scrollbar-color: #7c3aed #eef2ff;
}
*::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
*::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}
*::-webkit-scrollbar-track {
  background: #eef2ff;
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #6366f1, #7c3aed, #ec4899);
  border-radius: 999px;
  border: 1.5px solid #eef2ff;
}
*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #4f46e5, #a855f7, #db2777);
}
*::-webkit-scrollbar-corner {
  background: transparent;
}

#cloudInvoicesDrawer,
#cloudInvoicesDrawer * {
  scrollbar-color: #c084fc rgba(15, 23, 42, 0.35);
}
#cloudInvoicesDrawer ::-webkit-scrollbar-track,
#cloudInvoicesList::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
}
#cloudInvoicesDrawer ::-webkit-scrollbar-thumb,
#cloudInvoicesList::-webkit-scrollbar-thumb {
  border-color: transparent;
  background: linear-gradient(180deg, #818cf8, #a855f7, #f472b6);
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
}

.animate-float { animation: float 4s ease-in-out infinite; }
.paper-shadow { box-shadow: 0 20px 40px -15px rgba(79, 70, 229, 0.12), 0 0 20px rgba(0, 0, 0, 0.04); }

.img-remove-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 9999px;
  background: #ef4444;
  color: #fff;
  border: 2px solid #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 8;
  padding: 0;
  line-height: 0;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.45);
}
.img-remove-btn:hover {
  background: #dc2626;
}
#logoUploadZone.logo-preview {
  overflow: visible;
}
#logoUploadZone .img-remove-btn {
  top: -6px;
  right: -6px;
}
.card-hover { transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.card-hover:hover { transform: translateY(-5px); box-shadow: 0 20px 30px -10px rgba(99, 102, 241, 0.2); }
.gradient-border { background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899); }
.gradient-text { background: linear-gradient(135deg, #4f46e5, #7c3aed, #db2777); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* Tab / keyboard focus — theme gradient ring (replaces native black outline) */
body:not(.pdf-export):not(.printing-invoice) #heroApp input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):focus,
body:not(.pdf-export):not(.printing-invoice) #heroApp textarea:focus,
body:not(.pdf-export):not(.printing-invoice) #heroApp select:focus {
  outline: none !important;
  border-color: #7c3aed !important;
  box-shadow:
    0 0 0 1px #4f46e5,
    0 0 0 3px rgba(168, 85, 247, 0.55),
    0 0 10px rgba(236, 72, 153, 0.4);
}
body:not(.pdf-export):not(.printing-invoice) #heroApp .li-unit:focus {
  background-color: #fff;
  position: relative;
  z-index: 1;
}

.gold-gradient-text {
  background: linear-gradient(135deg, #fff3a1 0%, #eab308 50%, #b45309 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.silver-gradient-text {
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 50%, #64748b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

/* Dedicated print root — only this is printed.
   On screen it must stay MEASURABLE (display:none makes offsetHeight 0 and
   fitPlainA4Sheet then stretches the footer to a full page → 2-page print).
   So keep it laid out but invisible and off-screen. */
#printRoot {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 210mm;
  background: #fff;
  visibility: hidden;
  pointer-events: none;
}

/* Classic A4 tax invoice — black & white for Print / Save PDF / Preview */
.plain-a4-invoice {
  --plain-g: #252525;
  --plain-line: #252525;
  --plain-ink: #252525;
  --plain-on-fill: #fff;
  --plain-border: #000;
  box-sizing: border-box;
  width: 100%;
  max-width: 210mm;
  min-height: 277mm;
  margin: 0 auto;
  background: #fff;
  color: #000;
  font-family: 'Plus Jakarta Sans', Arial, Helvetica, sans-serif;
  font-size: 11px;
  line-height: 1.45;
  border: none;
  border-radius: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  color-adjust: exact;
}
.plain-a4-invoice * { box-sizing: border-box; font-family: inherit; }
.plain-a4-invoice .muted { color: #000; font-size: 9.5px; font-weight: 500; }
.plain-band {
  position: relative;
  background: var(--plain-g);
  color: var(--plain-on-fill);
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.16em;
  font-size: 13px;
  padding: 10px 88px;
  text-transform: uppercase;
  flex: 0 0 auto;
}
.plain-copy {
  position: absolute;
  right: 10px;
  top: 10px;
  font-size: 8px;
  letter-spacing: 0.04em;
  font-weight: 600;
  text-transform: none;
}
.plain-sec {
  width: 100%;
  border-collapse: collapse;
  flex: 0 0 auto;
}
.plain-sec > tbody > tr > td {
  vertical-align: middle;
}
.plain-top > tbody > tr > td.plain-seller { width: 58%; padding: 12px; }
.plain-top > tbody > tr > td.plain-meta-cell { width: 42%; padding: 12px 12px 12px 0; vertical-align: middle; }
.plain-seller-inner { width: 100%; border-collapse: collapse; }
.plain-seller-inner td {
  vertical-align: middle;
  border: none;
  padding: 0;
  background: transparent;
}
.plain-logo-cell { width: 96px; padding-right: 12px !important; }
.plain-logo {
  max-height: 64px;
  max-width: 96px;
  object-fit: contain;
  display: block;
}
.plain-biz { font-size: 16px; font-weight: 800; color: var(--plain-ink); margin-bottom: 3px; line-height: 1.3; }
.plain-meta { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.plain-meta th,
.plain-meta td {
  border: 1px solid var(--plain-line);
  padding: 7px 8px;
  text-align: left;
  vertical-align: middle;
  background: #fff;
  color: #000;
}
.plain-meta th { width: 42%; font-weight: 700; }
.plain-parties td {
  width: 50%;
  font-size: 11px;
  line-height: 1.45;
}
.plain-parties td:first-child { border-right: 1px solid var(--plain-line); }
.plain-parties .plain-party-labels td {
  text-align: center;
  vertical-align: middle;
  padding: 8px 12px 2px;
  border-top: 1px solid var(--plain-line);
  border-bottom: none;
}
.plain-parties .plain-party-labels .plain-lbl {
  margin-bottom: 0;
}
.plain-parties .plain-party-content td {
  text-align: left;
  vertical-align: top;
  padding: 6px 12px 12px;
  border-top: none;
  border-bottom: 1px solid var(--plain-line);
}
.plain-party-body {
  text-align: left;
  font-size: 11px;
  font-weight: 400;
}
.plain-party-body .plain-biz {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 3px;
}
.plain-party-body .plain-party-addr {
  font-size: 11px;
  font-weight: 400;
  line-height: 1.45;
}
.plain-lbl {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--plain-ink);
  display: inline-block;
  white-space: nowrap;
  border-bottom: 1px solid var(--plain-line);
  padding-bottom: 1px;
  margin-bottom: 6px;
  background: var(--plain-g);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.plain-items-wrap {
  flex: 0 0 auto;
  margin: 15px 8px;
  padding: 0;
  border: none;
  border-radius: 5px;
  overflow: hidden;
}
.plain-items-wrap::after {
  content: '';
  display: block;
  height: 5px;
  background: var(--plain-g);
  border-radius: 0 0 5px 5px;
}
.plain-items { width: 100%; border-collapse: collapse; table-layout: auto; }
.plain-items thead {
  background: var(--plain-g);
}
.plain-items th {
  background: transparent;
  color: var(--plain-on-fill);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 8px 6px;
  border: none;
  white-space: nowrap;
  vertical-align: middle;
}
.plain-items td {
  border: none;
  border-right: 1px solid var(--plain-line);
  border-bottom: 1px solid var(--plain-line);
  padding: 8px 6px;
  vertical-align: middle;
  background: #fff;
  color: #000;
}
.plain-items td:first-child { border-left: 1px solid var(--plain-line); }
.plain-items td:last-child { border-right: 1px solid var(--plain-line); }
.plain-items tbody tr:last-child td { border-bottom: none; }
.plain-items .c { text-align: center; }
.plain-items .r { text-align: right; font-variant-numeric: tabular-nums; font-weight: 400; }
.plain-below {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0 8px;
  width: auto;
  overflow: visible;
}
.plain-bottom {
  flex: 1 1 auto;
  height: 100%;
  margin-top: 0;
}
.plain-bottom > tbody,
.plain-bottom > tbody > tr { height: 100%; }
.plain-bottom > tbody > tr > td.plain-left {
  width: 58%;
  padding: 10px 12px;
  border-right: 1px solid var(--plain-line);
  border-top: 1px solid var(--plain-line);
  vertical-align: top;
  height: 100%;
}
.plain-left > .plain-block + .plain-block {
  border-top: 1px solid var(--plain-line);
  margin-top: 8px;
  padding-top: 8px;
}
.plain-bottom > tbody > tr > td.plain-totals-cell {
  width: 42%;
  padding: 0;
  border-top: 1px solid var(--plain-line);
  vertical-align: top;
  height: 100%;
}
.plain-pay { width: 100%; border-collapse: collapse; }
.plain-pay td { border: none; padding: 0; vertical-align: middle; background: transparent; }
.plain-pay-info { width: auto; }
.plain-pay-qr {
  width: 92px;
  text-align: right;
  padding-left: 10px !important;
  vertical-align: middle;
}
.plain-upi {
  margin-top: 4px;
  font-size: 9.5px;
  font-weight: 700;
  word-break: break-all;
}
.plain-totals { width: 100%; height: auto; border-collapse: collapse; }
.plain-totals th,
.plain-totals td {
  padding: 8px 10px;
  line-height: 1.3;
  border-bottom: 1px solid var(--plain-line);
  font-size: 11px;
  height: auto;
  background: #fff;
  color: #000;
  vertical-align: middle;
}
.plain-totals th { text-align: left; font-weight: 600; }
.plain-totals td { text-align: right; font-variant-numeric: tabular-nums; font-weight: 800; font-size: 13px; }
.plain-totals tr:last-child th,
.plain-totals tr:last-child td {
  border-bottom: none;
}
.plain-totals .grand td {
  background: var(--plain-g);
  color: var(--plain-on-fill);
  border: none;
  padding: 0;
}
.plain-grand-in {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  font-weight: 800;
  font-size: 13px;
  color: var(--plain-on-fill);
}
.plain-grand-in span:last-child { font-size: 15px; }
.plain-totals .words { height: auto; }
.plain-totals .words td {
  text-align: left;
  font-weight: 400;
  padding: 8px 10px;
  background: #fff;
  color: #000;
  white-space: normal;
  line-height: 1.4;
  font-size: 11px;
  vertical-align: middle;
}
.plain-totals .words .plain-lbl {
  display: inline-block;
  margin-bottom: 4px;
}
.plain-totals .words em {
  display: block;
  font-size: 12px;
  font-style: italic;
  font-weight: 400;
  color: #000;
}
.plain-hsn { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 9px; }
.plain-hsn th,
.plain-hsn td { border: 1px solid var(--plain-line); padding: 5px 6px; background: #fff; color: #000; vertical-align: middle; }
.plain-hsn th { font-weight: 700; text-align: left; }
.plain-hsn .r { text-align: right; font-weight: 700; }
.plain-qr { width: 72px; height: 72px; border: 1px solid var(--plain-line); padding: 2px; background: #fff; display: block; margin-left: auto; }
.plain-sign td {
  padding: 12px;
  border-top: 1px solid var(--plain-line);
  vertical-align: top;
}
.plain-policy {
  width: 60%;
  text-align: left;
  font-size: 10px;
  line-height: 1.4;
}
.plain-sign-box { text-align: right; width: 40%; vertical-align: middle; }
.plain-sign-inner { display: inline-block; text-align: center; }
.plain-sign-img { margin-bottom: 6px; text-align: center; }
.plain-sign-img img {
  max-height: 48px;
  max-width: 140px;
  display: inline-block;
  vertical-align: middle;
}
.plain-sign-line { width: 140px; border-top: 1px solid var(--plain-line); margin: 26px auto 4px; }
.plain-foot {
  width: 100%;
  border-collapse: collapse;
  font-size: 8px;
  color: #000;
  flex: 0 0 auto;
}
.plain-foot td {
  padding: 6px 12px;
  border-top: 1px dashed var(--plain-line);
  vertical-align: middle;
}
.plain-foot-left { text-align: left; width: 50%; }
.plain-foot-right { text-align: right; width: 50%; }
.plain-avoid {
  break-inside: avoid;
  page-break-inside: avoid;
}
.plain-below .plain-sign { flex: 0 0 auto; }

/* Color tokens only — layout/labels stay shared */
.plain-tmpl-gradient {
  --plain-g: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #db2777 100%);
  --plain-line: #8b5cf6;
  --plain-ink: #5b21b6;
  --plain-border: #7c3aed;
}
.plain-tmpl-emerald {
  --plain-g: linear-gradient(135deg, #047857 0%, #059669 50%, #0d9488 100%);
  --plain-line: #34d399;
  --plain-ink: #065f46;
  --plain-border: #059669;
}
.plain-tmpl-ocean {
  --plain-g: linear-gradient(135deg, #0369a1 0%, #2563eb 50%, #4f46e5 100%);
  --plain-line: #38bdf8;
  --plain-ink: #1e3a8a;
  --plain-border: #2563eb;
}

/* Corporate Blue — Freepik-style layout, reference blues only */
.plain-tmpl-corporate {
  --corp-blue: #1A5DA4;
  --corp-fold-dark: #0A2E5C;
  --corp-fold-mid: #0F3D7A;
  --corp-zebra: #F3F4F6;
  --corp-ink: #111827;
  --corp-muted: #6B7280;
  border: none;
  border-radius: 0;
  color: #111827;
  position: relative;
  overflow: hidden;
}
.plain-tmpl-corporate .muted { color: #6B7280; font-size: 9px; font-weight: 500; }
.plain-tmpl-corporate.plain-tmpl-corp-slate {
  --corp-blue: #334155;
  --corp-fold-dark: #0f172a;
  --corp-fold-mid: #1e293b;
}
.plain-tmpl-corporate.plain-tmpl-corp-wine {
  --corp-blue: #9F1239;
  --corp-fold-dark: #4C0519;
  --corp-fold-mid: #6B0F2A;
}
.plain-tmpl-corporate.plain-tmpl-corp-forest {
  --corp-blue: #0F766E;
  --corp-fold-dark: #042F2E;
  --corp-fold-mid: #115E59;
}
.corp-topbar {
  height: 38px;
  background: var(--corp-blue);
  flex: 0 0 auto;
}
.corp-fold {
  position: absolute;
  top: 0;
  left: 0;
  width: 128px;
  height: 108px;
  z-index: 2;
  pointer-events: none;
}
.corp-fold-a,
.corp-fold-b,
.corp-fold-c {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
}
.corp-fold-a {
  width: 118px;
  height: 108px;
  background: var(--corp-fold-dark);
  clip-path: polygon(0 0, 100% 0, 0 100%);
}
.corp-fold-b {
  width: 86px;
  height: 86px;
  background: var(--corp-fold-mid);
  clip-path: polygon(0 0, 0 100%, 100% 100%);
}
.corp-fold-c {
  width: 52px;
  height: 52px;
  background: var(--corp-blue);
  clip-path: polygon(0 0, 100% 0, 0 100%);
}
.corp-pad {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: 20px 28px 12px;
  min-height: 0;
}
.corp-brand-row {
  display: flex;
  justify-content: flex-end;
  min-height: 64px;
  margin-bottom: 16px;
}
.corp-brand { text-align: right; max-width: 62%; }
.corp-logo-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 4px;
}
.corp-logo {
  max-height: 48px;
  max-width: 72px;
  object-fit: contain;
  display: block;
}
.corp-co {
  font-size: 17px;
  font-weight: 800;
  color: #111827;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
}
.corp-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 20px;
}
.corp-bill { flex: 1; min-width: 0; }
.corp-id { text-align: right; flex: 0 1 auto; min-width: 280px; max-width: 54%; }
.corp-inv-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--corp-blue);
  color: #fff;
  padding: 9px 14px;
  margin-bottom: 10px;
}
.corp-inv {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-transform: uppercase;
}
.corp-inv-status {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
}
.corp-k {
  font-size: 12px;
  font-weight: 800;
  color: #111827;
}
.corp-k-gap { margin-top: 12px; }
.corp-who {
  font-size: 18px;
  font-weight: 800;
  color: #111827;
  margin: 2px 0 4px;
}
.corp-sub {
  font-size: 10.5px;
  color: #6B7280;
  line-height: 1.45;
}
.corp-sub b { color: #111827; font-weight: 700; }
.corp-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 14px;
  row-gap: 2px;
  text-align: left;
}
.corp-meta {
  font-size: 10.5px;
  color: #111827;
  line-height: 1.45;
}
.corp-meta b { font-weight: 700; }
.corp-items {
  width: 100%;
  border-collapse: collapse;
  flex: 0 0 auto;
}
.corp-items th {
  background: var(--corp-blue);
  color: #fff;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 8px;
  border: none;
  white-space: nowrap;
  vertical-align: middle;
}
.corp-items th:first-child,
.corp-items td:first-child { text-align: center; }
.corp-items td {
  border: none;
  padding: 10px 8px;
  vertical-align: middle;
  color: #111827;
  background: #fff;
}
.corp-items tbody tr:nth-child(even) td { background: var(--corp-zebra); }
.corp-items .c { text-align: center; }
.corp-items .r { text-align: right; font-variant-numeric: tabular-nums; }
.corp-desc b { font-weight: 800; display: block; }
.corp-foot {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 36px;
  margin-top: 20px;
  flex: 1 1 auto;
  min-height: 0;
}
.corp-left {
  flex: 1;
  min-width: 0;
  max-width: 58%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.corp-slot {
  display: flex;
  align-items: center;
  min-height: 0;
  overflow: hidden;
  border: none;
}
.corp-slot-in { width: 100%; min-width: 0; }
.corp-slot-pay { flex: 50 1 0; }
.corp-slot-notes { flex: 25 1 0; }
.corp-slot-policy { flex: 25 1 0; }
.corp-left-end { display: none; }
.corp-pay-block {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}
.corp-pay-copy { flex: 1; min-width: 0; }
.corp-pay { margin: 2px 0 0; }
.corp-pay-row {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 10px;
  font-size: 11px;
  color: #111827;
  line-height: 1.75;
}
.corp-pay-row b { font-weight: 700; }
.corp-pay-plain { grid-template-columns: 1fr; }
.corp-terms {
  font-size: 10.5px;
  color: #6B7280;
  line-height: 1.5;
  max-width: 360px;
}
.corp-sum {
  width: 236px;
  flex: 0 0 236px;
  padding-top: 2px;
  display: flex;
  flex-direction: column;
}
.corp-sum-top { flex: 0 0 auto; }
.corp-sum-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  font-size: 12px;
  color: #111827;
  padding: 3px 0;
}
.corp-sum-row span:first-child { font-weight: 400; }
.corp-sum-row span:last-child {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 88px;
  text-align: right;
}
.corp-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--corp-blue);
  color: #fff;
  font-weight: 800;
  padding: 11px 14px;
  font-size: 13px;
  margin-top: 10px;
}
.corp-extra {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  flex: 0 0 auto;
}
.corp-qr-wrap {
  flex: 0 0 100px;
  width: 100px;
  text-align: center;
}
.corp-qr {
  width: 90px;
  height: 90px;
  margin: 0 auto;
  background: #fff;
  display: block;
}
.corp-qr-upi {
  margin-top: 4px;
  font-size: 8.5px;
  font-weight: 700;
  color: #111827;
  word-break: break-all;
  line-height: 1.3;
}
.corp-hsn-wrap {
  width: 420px;
  max-width: 100%;
}
.corp-hsn {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin-top: 6px;
  font-size: 9px;
}
.corp-hsn th,
.corp-hsn td {
  padding: 5px 6px;
  border: none;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
}
.corp-hsn th {
  background: var(--corp-blue);
  color: #fff;
  font-weight: 700;
  text-align: right;
}
.corp-hsn td {
  background: var(--corp-zebra);
  color: #111827;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.corp-hsn th:first-child,
.corp-hsn td:first-child { text-align: left; }
.corp-hsn th:nth-child(1),
.corp-hsn td:nth-child(1) { width: 22%; }
.corp-hsn th:nth-child(2),
.corp-hsn td:nth-child(2) { width: 22%; }
.corp-hsn th:nth-child(3),
.corp-hsn td:nth-child(3),
.corp-hsn th:nth-child(4),
.corp-hsn td:nth-child(4),
.corp-hsn th:nth-child(5),
.corp-hsn td:nth-child(5) { width: 18.66%; }
.corp-hsn tbody tr:nth-child(even) td { background: #fff; }
.corp-sign {
  margin-top: auto;
  padding-top: 16px;
  text-align: center;
  align-self: center;
  width: 100%;
  font-size: 10.5px;
  color: #111827;
}
.corp-sign-img { margin-bottom: 4px; text-align: center; }
.corp-sign-img img {
  max-height: 40px;
  max-width: 120px;
  display: inline-block;
  vertical-align: middle;
}
.corp-words {
  width: 100%;
  margin-top: 10px;
  text-align: left;
}
.corp-words em {
  display: block;
  font-size: 10.5px;
  font-style: italic;
  color: #6B7280;
  margin-top: 2px;
  font-weight: 400;
}
.corp-spacer { display: none; }
.corp-bottombar {
  height: 26px;
  background: var(--corp-blue);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  color: #fff;
  font-size: 8px;
  font-weight: 600;
}
.corp-bottombar,
.corp-bottombar * { color: #fff !important; }
.corp-bottombar a { text-decoration: none; }

@media print {
  html, body {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }

  body.printing-invoice > *:not(#printRoot) {
    display: none !important;
  }

  body.printing-invoice #printRoot {
    display: block !important;
    position: static !important;
    left: 0 !important;
    top: 0 !important;
    visibility: visible !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Not printing via the app (plain Ctrl+P): keep the hidden root out entirely */
  body:not(.printing-invoice) #printRoot {
    display: none !important;
  }

  body.printing-invoice #printRoot .plain-a4-invoice {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
    border: none !important;
    border-radius: 0 !important;
    font-family: 'Plus Jakarta Sans', Arial, Helvetica, sans-serif !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  body.printing-invoice #printRoot .plain-tmpl-corporate {
    border: none !important;
    border-radius: 0 !important;
  }

  body.printing-invoice #printRoot .invoice-clean-view {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .plain-a4-invoice thead { display: table-header-group !important; }
  .plain-below,
  .plain-bottom,
  .plain-sign,
  .corp-foot,
  .plain-avoid {
    break-inside: auto !important;
    page-break-inside: auto !important;
  }

  .invoice-clean-view .invoice-paper-edge {
    display: none !important;
  }
}

/*
 * html2canvas / html2pdf do NOT apply @media print.
 * downloadPDF() and print preview temporarily add body.pdf-export.
 */
body.pdf-export #invoicePaperCanvas {
  box-shadow: none !important;
  border: none !important;
  border-radius: 0 !important;
  background: #fff !important;
  overflow: visible !important;
  max-width: none !important;
  box-sizing: border-box !important;
}

body.pdf-export #invoicePaperCanvas .gradient-border {
  border-radius: 0 !important;
}

body.pdf-export #invoicePaperCanvas .overflow-x-auto {
  overflow: visible !important;
  width: 100% !important;
}

body.pdf-export #invoicePaperCanvas table {
  width: 100% !important;
  table-layout: fixed !important;
}

body.pdf-export #invoicePaperCanvas table th,
body.pdf-export #invoicePaperCanvas table td {
  word-wrap: break-word !important;
  overflow-wrap: anywhere !important;
}

body.pdf-export #invoicePaperCanvas .li-name,
body.pdf-export #invoicePaperCanvas .li-desc {
  width: 100% !important;
  max-width: 100% !important;
  white-space: normal !important;
}

/* Empty logo upload chrome → hide; uploaded logo → clean image only */
body.pdf-export #logoUploadZone:not(.logo-preview) {
  display: none !important;
}
body.pdf-export #logoUploadZone.logo-preview {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  height: auto !important;
  min-height: 0 !important;
  width: auto !important;
  max-width: 220px !important;
  cursor: default !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 0 !important;
}
body.pdf-export #logoUploadZone.logo-preview img {
  max-height: 72px !important;
  max-width: 220px !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  display: block !important;
}

/* Interactive / form chrome */
body.pdf-export #invoicePaperCanvas button,
body.pdf-export #senderProfileSelect,
body.pdf-export #clientProfileSelect,
body.pdf-export .edit-only,
body.pdf-export .pdf-hide {
  display: none !important;
}

body.pdf-export .pdf-only {
  display: inline !important;
}

/* Line-item actions column */
body.pdf-export #invoicePaperCanvas table thead th:last-child,
body.pdf-export #lineItemsBody td:last-child {
  display: none !important;
}

/* Receipt attach upload UI (not invoice content) */
body.pdf-export #invoicePaperCanvas .border-dashed.border-slate-300 {
  display: none !important;
}

/* QR “Live Preview” chip */
body.pdf-export #invoicePaperCanvas .bg-emerald-100.text-emerald-800 {
  display: none !important;
}

/* Remaining dashed edit affordances → solid */
body.pdf-export #invoicePaperCanvas .border-dashed {
  border-style: solid !important;
}

/* Flatten inputs/selects so they read as printed text (keep status stamp colors) */
body.pdf-export #invoicePaperCanvas input,
body.pdf-export #invoicePaperCanvas textarea,
body.pdf-export #invoicePaperCanvas select:not(#invoiceStatus) {
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  border-radius: 0 !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  pointer-events: none !important;
  color: inherit !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

body.pdf-export #invoicePaperCanvas input::placeholder,
body.pdf-export #invoicePaperCanvas textarea::placeholder {
  color: transparent !important;
  opacity: 0 !important;
}

body.pdf-export #invoiceStatus {
  -webkit-appearance: none !important;
  appearance: none !important;
  pointer-events: none !important;
  background-image: none !important;
  box-shadow: none !important;
}

body.pdf-export #invoicePaperCanvas input[type="date"]::-webkit-calendar-picker-indicator {
  display: none !important;
  opacity: 0 !important;
}

body.pdf-export #invoicePaperCanvas select {
  background-image: none !important;
  padding-right: 0 !important;
}

.logo-preview img { max-height: 88px; max-width: 100%; object-fit: contain; }

.if-widget-hidden { display: none !important; }
.if-ad-slot.hidden { display: none; }
.if-ad-slot .if-ad-item + .if-ad-item { margin-top: 0.75rem; }
.blog-content h2, .policy-content h2 { font-size: 1.125rem; font-weight: 800; color: #0f172a; margin-top: 1.5rem; }
.blog-content h3, .policy-content h3 { font-size: 1rem; font-weight: 700; color: #1e293b; margin-top: 1rem; }
.blog-content p, .policy-content p { margin-top: 0.75rem; }

/* Clean read-only invoice (Preview modal + PDF capture clone + public share paper) */
.invoice-clean-view,
.share-invoice-paper {
  box-shadow: none !important;
  background: #fff !important;
  box-sizing: border-box !important;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
  position: relative !important;
  overflow: visible !important;
}
.invoice-clean-view,
.invoice-clean-view *,
.share-invoice-paper,
.share-invoice-paper *,
.invoice-field-text {
  font-family: 'Plus Jakarta Sans', sans-serif !important;
}
.invoice-preview-paper {
  border: 1px solid #e0e7ff !important;
  border-radius: 1.25rem !important;
  overflow: visible !important;
  position: relative !important;
  background: #fff !important;
}
/* Preview + PDF: strip old inside gradient from clone */
.invoice-preview-paper > .gradient-border {
  display: none !important;
}

/* Same top/bottom gradient bars for Preview AND PDF capture */
.invoice-preview-paper .invoice-paper-edge,
#pdfCaptureHost .invoice-paper-edge {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  height: 10px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(90deg, #4f46e5, #7c3aed, #db2777) !important;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.invoice-preview-paper .invoice-paper-edge-top,
#pdfCaptureHost .invoice-paper-edge-top {
  top: 0 !important;
  bottom: auto !important;
  border-radius: 1.25rem 1.25rem 0 0 !important;
}
.invoice-preview-paper .invoice-paper-edge-bottom,
#pdfCaptureHost .invoice-paper-edge-bottom {
  bottom: 0 !important;
  top: auto !important;
  border-radius: 0 0 1.25rem 1.25rem !important;
}

.preview-modal-edge {
  display: none !important;
}

.invoice-clean-view > .gradient-border,
.share-invoice-paper > .gradient-border {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  display: block !important;
  width: 100% !important;
  height: 12px !important;
  margin: 0 !important;
  border-radius: 0 !important;
  background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899) !important;
}
.invoice-clean-view .edit-only,
.invoice-clean-view .pdf-hide,
.invoice-clean-view button,
.share-invoice-paper .edit-only {
  display: none !important;
}
.invoice-clean-view .pdf-only {
  display: block !important;
}

/* Colored From / Bill To (match editor) */
.invoice-clean-view .party-box-from,
.share-invoice-paper .party-box-from {
  background-color: #eef2ff !important;
  border: 1px solid #e0e7ff !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}
.invoice-clean-view .party-box-to,
.share-invoice-paper .party-box-to {
  background-color: #faf5ff !important;
  border: 1px solid #f3e8ff !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

/* Logo: no upload frame — image only, sized to content */
.invoice-clean-view #logoUploadZone,
.invoice-clean-view .logo-preview,
.share-invoice-paper .logo-preview {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  height: auto !important;
  min-height: 0 !important;
  width: auto !important;
  max-width: 220px !important;
  padding: 0 !important;
  margin: 0 !important;
  cursor: default !important;
  display: block !important;
  border-radius: 0 !important;
}
.invoice-clean-view #logoUploadZone img,
.invoice-clean-view .logo-preview img,
.share-invoice-paper img[alt="Logo"] {
  max-height: 72px !important;
  max-width: 220px !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  display: block !important;
}
.invoice-clean-view .gst-print-summary {
  background: #fffbeb !important;
  border: 1px solid #fde68a !important;
  border-radius: 12px !important;
  padding: 10px 12px !important;
  font-size: 11px !important;
  color: #92400e !important;
  line-height: 1.45 !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}
.invoice-clean-view .gst-print-summary strong {
  display: block;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #92400e;
  margin-bottom: 4px;
}
  align-items: flex-start !important;
  gap: 1rem !important;
  padding-bottom: 1rem !important;
}

.invoice-clean-view .invoice-generated-via {
  display: inline-block !important;
  color: #94a3b8 !important;
  font-size: 10px !important;
}
.invoice-generated-via.hidden,
.invoice-clean-view .invoice-generated-via.hidden {
  display: none !important;
}
.invoice-generated-via a {
  color: inherit;
  text-decoration: none;
}
.invoice-generated-via a:hover {
  text-decoration: underline;
}
.invoice-clean-view .invoice-signature {
  margin-left: auto !important;
  text-align: center !important;
}

/* Light signature label — easy to sign over */
.invoice-sig-label {
  color: #dbe3f0 !important;
  border-color: #e2e8f0 !important;
}
.invoice-clean-view .invoice-sig-label,
.share-invoice-paper .invoice-sig-label {
  color: #d4dce8 !important;
}

/* Sale-style hanging ribbons — single SVG shape (folds never separate) */
.party-box {
  overflow: visible !important;
}
.party-ribbon {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 34px;
  z-index: 6;
  display: block;
  padding: 0 !important;
  margin: 0 !important;
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  filter: drop-shadow(0 3px 5px rgba(15, 23, 42, 0.28));
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.party-ribbon::before,
.party-ribbon::after {
  content: none !important;
  display: none !important;
}
.party-ribbon-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.party-ribbon-text {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0 10px 5px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

/* Header: business name fallback when no logo; meta stays right */
.invoice-brand-fallback {
  max-width: 220px;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1.25;
  color: #312e81;
  letter-spacing: -0.02em;
}
.invoice-clean-view .invoice-meta-right,
.share-invoice-paper .invoice-meta-right {
  margin-left: auto !important;
  text-align: right !important;
  width: auto !important;
}

/* Items table — full content width to the right edge */
.invoice-items-table,
.invoice-clean-view .invoice-items-table,
.share-invoice-paper .invoice-items-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  table-layout: auto !important;
}
.invoice-clean-view .overflow-x-auto,
.share-invoice-paper .overflow-x-auto {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: visible !important;
}
.invoice-items-thead tr {
  background: #eef2ff !important;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.invoice-items-thead th {
  border-bottom: 2px solid #c7d2fe !important;
  background: #eef2ff !important;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
/* Column plan: # | Name | HSN | Qty | Unit | Price | Disc % | Tax % | Amount (+ trash in editor) */
.invoice-items-thead th:first-child {
  border-radius: 12px 0 0 0 !important;
  width: 4% !important;
}
.invoice-items-thead th:nth-child(2) { width: 27% !important; }
.invoice-items-thead th:nth-child(3) { width: 9% !important; }
.invoice-items-thead th:nth-child(4) { width: 7% !important; }
.invoice-items-thead th:nth-child(5) { width: 9% !important; }
.invoice-items-thead th:nth-child(6) { width: 12% !important; }
.invoice-items-thead th:nth-child(7) { width: 8% !important; }
.invoice-items-thead th:nth-child(8) { width: 8% !important; }
.invoice-items-thead th:last-child {
  border-radius: 0 12px 0 0 !important;
}
.invoice-clean-view .invoice-items-thead th:last-child,
.share-invoice-paper .invoice-items-thead th:last-child {
  border-radius: 0 12px 0 0 !important;
  width: 16% !important;
}
/* Editor: keep trash column narrow so Amount sits toward the right edge */
#invoicePaperCanvas:not(.invoice-clean-view) .invoice-items-thead th:last-child {
  width: 2.25rem !important;
  max-width: 2.25rem !important;
  padding-left: 0 !important;
  padding-right: 0.25rem !important;
  border-radius: 0 12px 0 0 !important;
}
#invoicePaperCanvas:not(.invoice-clean-view) .invoice-items-thead th:nth-last-child(2) {
  width: 14% !important;
}

/* ─── Payment QR card — template colored ─── */
.qr-embed-card {
  background: linear-gradient(135deg, #eef2ff 0%, #faf5ff 55%, #fdf2f8 100%);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.qr-code-box {
  background: #ffffff;
  border: 2px solid #c7d2fe;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.12);
}
.qr-code-box img,
.qr-code-box canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
.qr-code-box.qr-empty {
  background: #f8fafc;
  border-style: dashed;
  border-color: #cbd5e1;
  box-shadow: none;
}

/* Additional Notes — sticky-note icon, bold label / normal value */
.invoice-clean-view #customFieldsSection,
.share-invoice-paper .additional-notes-block {
  background: #fffbeb !important;
  border: 1px solid #fde68a !important;
  border-radius: 1rem !important;
  padding: 0.85rem 1rem !important;
}
.invoice-clean-view #customFieldsContainer,
.additional-notes-list {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.55rem !important;
  background: transparent !important;
  border: none !important;
}
.invoice-clean-view #customFieldsContainer > div,
.additional-note-item {
  display: flex !important;
  align-items: flex-start !important;
  gap: 0.55rem !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0.1rem 0 !important;
  box-shadow: none !important;
}
.additional-note-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: #d97706;
}
.additional-note-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}
.additional-note-text {
  font-size: 12px;
  color: #334155;
  line-height: 1.45;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.additional-note-label {
  font-weight: 800 !important;
  color: #0f172a !important;
}
.additional-note-value {
  font-weight: 400 !important;
  color: #475569 !important;
}

#previewModalBody {
  font-family: 'Plus Jakarta Sans', sans-serif !important;
}
#previewModalBody .invoice-clean-view {
  box-shadow: 0 10px 30px -12px rgba(79, 70, 229, 0.15) !important;
}
#previewModalBody .plain-a4-invoice {
  box-shadow: 0 12px 28px -14px rgba(15, 23, 42, 0.28);
}

#pdfCaptureHost {
  pointer-events: none !important;
}
#pdfCaptureHost .plain-a4-invoice {
  overflow: visible !important;
  background: #fff !important;
  border: none !important;
  border-radius: 0 !important;
}
#pdfCaptureHost .plain-tmpl-corporate,
#previewModalBody .plain-tmpl-corporate {
  border: none !important;
  border-radius: 0 !important;
}

#invoicePaperCanvas.tmpl-corporate .invoice-items-thead {
  background: #0f172a;
  color: #fff;
}
#invoicePaperCanvas.tmpl-creative {
  background: linear-gradient(180deg, #fff 0%, #fdf4ff 100%);
}
#invoicePaperCanvas.tmpl-pos {
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
  padding: 1rem !important;
  font-size: 12px;
}

/* PDF capture: same paper look as Preview (keep rounded edges + overflow visible for ribbons) */
#pdfCaptureHost .invoice-clean-view,
#pdfCaptureHost .invoice-preview-paper {
  border: 1px solid #e0e7ff !important;
  border-radius: 1.25rem !important;
  overflow: visible !important;
  background: #fff !important;
}
#pdfCaptureHost .invoice-items-table th,
#pdfCaptureHost .invoice-items-table td {
  word-break: break-word !important;
  overflow: visible !important;
  white-space: normal !important;
}

.billing-hub-head {
  background: #312e81;
}
.bh-tab {
  font-size: 11px;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 12px 12px 0 0;
  color: #64748b;
  white-space: nowrap;
  border: 0;
  background: transparent;
}
.bh-tab.is-active {
  color: #4f46e5;
  background: #eef2ff;
}
.bh-stat {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 10px 12px;
}
.bh-stat .k { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: #64748b; }
.bh-stat .v { font-size: 18px; font-weight: 800; color: #0f172a; line-height: 1.2; margin-top: 2px; }
.bh-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.bh-table th { text-align: left; font-size: 10px; font-weight: 800; text-transform: uppercase; color: #94a3b8; padding: 8px 6px; border-bottom: 1px solid #e2e8f0; }
.bh-table td { padding: 10px 6px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.bh-pill { font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 999px; display: inline-block; }
.bh-pill-paid { background: #ecfdf5; color: #047857; }
.bh-pill-due { background: #fffbeb; color: #b45309; }
.bh-pill-overdue { background: #fff1f2; color: #e11d48; }
.bh-pill-draft { background: #f1f5f9; color: #475569; }
.bh-pill-partial { background: #e0f2fe; color: #0369a1; }
.bh-pill-quote { background: #f5f3ff; color: #6d28d9; }
.bh-pill-cn { background: #ffe4e6; color: #9f1239; }
.bh-btn { font-size: 10px; font-weight: 800; padding: 6px 10px; border-radius: 10px; border: 1px solid #e2e8f0; background: #fff; color: #334155; }
.bh-btn-primary { background: #4f46e5; color: #fff; border-color: #4f46e5; }
.bh-input { width: 100%; font-size: 12px; padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 12px; background: #f8fafc; }

.pwa-install-banner {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.75rem;
  background: #fff;
  border: 1px solid #c7d2fe;
  border-radius: 1rem;
  box-shadow: 0 12px 40px -12px rgba(79, 70, 229, 0.45);
}
.pwa-install-banner-icon {
  width: 40px;
  height: 40px;
  border-radius: 0.75rem;
  flex-shrink: 0;
}
@media (min-width: 768px) {
  #pwaInstallBanner { display: none !important; }
}
@media (display-mode: standalone) {
  #pwaInstallBtn,
  #pwaInstallBanner { display: none !important; }
}

body.if-modal-lock { overflow: hidden; }

.if-modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 6, 23, 0.58);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow-y: auto;
}
.if-modal.is-open { display: flex !important; }
.if-modal.is-open > .if-modal-card,
.if-modal.is-open > .billing-hub {
  animation: ifModalIn 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes ifModalIn {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
.if-modal-card {
  position: relative;
  width: 100%;
  max-width: 28rem;
  margin: auto;
  flex-shrink: 0;
  background: #fff;
  border-radius: 24px;
  border: 1px solid #e0e7ff;
  box-shadow: 0 28px 64px -20px rgba(15, 23, 42, 0.45);
  max-height: min(92vh, 920px);
  overflow-y: auto;
}
.if-modal-card.if-modal-card-md { max-width: 32rem; }
.if-modal-card.if-modal-card-lg {
  max-width: 64rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#autoSaveToast {
  z-index: 400 !important;
}
#ifDialogOverlay { z-index: 230; }
#otpModalOverlay { z-index: 170; }
#shareModalOverlay { z-index: 165; }
#inventoryModalOverlay { z-index: 160; }
#previewModalOverlay { z-index: 158; }
#billingHubOverlay { z-index: 150; }
#billingHubOverlay.if-modal {
  padding: 0;
  align-items: stretch;
}
@media (min-width: 640px) {
  #billingHubOverlay.if-modal {
    padding: 16px;
    align-items: center;
  }
}
.if-dialog-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.if-dialog-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eef2ff;
  color: #4f46e5;
}
.if-dialog-icon.tone-rose { background: #fff1f2; color: #e11d48; }
.if-dialog-icon.tone-amber { background: #fffbeb; color: #d97706; }
.if-dialog-icon.tone-emerald { background: #ecfdf5; color: #059669; }
.if-dialog-title {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
}
.if-dialog-msg {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  line-height: 1.45;
}
.if-dialog-x {
  margin-left: auto;
  flex-shrink: 0;
  padding: 6px;
  border-radius: 12px;
  color: #f43f5e;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.if-dialog-x:hover { background: #fff1f2; color: #be123c; }
.if-dialog-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}
.if-field span {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: #334155;
  margin-bottom: 4px;
}
.if-field input,
.if-field textarea,
.if-field select {
  width: 100%;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
  outline: none;
  font-family: inherit;
}
.if-field input:focus,
.if-field textarea:focus,
.if-field select:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
  background: #fff;
}
.if-dialog-form.if-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.if-field-span { grid-column: 1 / -1; }
@media (max-width: 480px) {
  .if-dialog-form.if-form-grid { grid-template-columns: 1fr; }
  .if-field-span { grid-column: auto; }
}
.inv-chip {
  font-size: 10px;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #e0e7ff;
  background: #eef2ff;
  color: #3730a3;
  cursor: pointer;
  font-family: inherit;
}
.inv-chip:hover { background: #e0e7ff; }
.if-dialog-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}
.if-btn-ghost,
.if-btn-primary,
.if-btn-danger {
  flex: 1;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
}
.if-btn-ghost {
  background: #f1f5f9;
  color: #334155;
  border-color: #e2e8f0;
}
.if-btn-ghost:hover { background: #e2e8f0; }
.if-btn-primary {
  background: #4f46e5;
  color: #fff;
  box-shadow: 0 8px 18px -8px rgba(79, 70, 229, 0.7);
}
.if-btn-primary:hover { background: #4338ca; }
.if-btn-danger {
  background: #e11d48;
  color: #fff;
  box-shadow: 0 8px 18px -8px rgba(225, 29, 72, 0.65);
}
.if-btn-danger:hover { background: #be123c; }

/* Hero chips — 2 rows × 3, fill the original strip */
.hero-chips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  width: 100%;
}
@media (min-width: 640px) {
  .hero-chips { grid-template-columns: 1fr 1fr 1fr; }
}
.hero-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  text-align: center;
  min-width: 0;
}
.hero-chip i { color: #c4b5fd; flex-shrink: 0; }
.hero-chip-hl {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(52, 211, 153, 0.35);
}
.hero-chip-hl i { color: #6ee7b7; }

.hsn-suggest {
  position: absolute;
  z-index: 80;
  min-width: 240px;
  max-width: 360px;
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  box-shadow: 0 18px 40px -18px rgba(79, 70, 229, 0.45);
  padding: 4px;
}
.hsn-suggest button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}
.hsn-suggest button:hover,
.hsn-suggest button.is-active { background: #eef2ff; }
.hsn-suggest .hsn-code {
  font-size: 11px;
  font-weight: 800;
  color: #3730a3;
}
.hsn-suggest .hsn-desc {
  font-size: 10px;
  color: #64748b;
  font-weight: 600;
  line-height: 1.3;
}
.hsn-suggest .hsn-gst {
  font-size: 9px;
  font-weight: 800;
  color: #059669;
  white-space: nowrap;
}
  font-size: 9px;
  font-weight: 700;
  color: #64748b;
  padding: 6px 8px 4px;
  border-top: 1px solid #e2e8f0;
  line-height: 1.35;
}

.doc-type-switch {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 5px;
  gap: 3px;
}
.doc-type-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 12px;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s ease;
  background: transparent;
}
.doc-type-btn-on {
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
  color: #fff;
  box-shadow: 0 8px 16px -8px rgba(79, 70, 229, 0.75);
}
.doc-type-btn-off {
  color: #94a3b8;
}
.doc-type-btn-off:hover {
  color: #64748b;
  background: rgba(255, 255, 255, 0.7);
}

.blog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 700px) {
  .blog-grid { grid-template-columns: 1fr 1fr; }
}
.blog-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 1.25rem;
  padding: 1.25rem 1.35rem;
  text-decoration: none;
  color: inherit;
  min-height: 100%;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.blog-card:hover {
  border-color: #c7d2fe;
  box-shadow: 0 16px 30px -18px rgba(79, 70, 229, 0.35);
  transform: translateY(-2px);
}
.blog-content h2, .blog-content h3, .policy-content h2, .policy-content h3 {
  font-weight: 800;
  color: #0f172a;
  margin: 1.25rem 0 0.5rem;
}
.blog-content h2 { font-size: 1.35rem; margin-top: 2rem; }
.blog-content h3 { font-size: 1.05rem; margin-top: 1.4rem; }
.blog-content p, .policy-content p { margin: 0.6rem 0; }
.blog-content ul, .policy-content ul { margin: 0.5rem 0 0.5rem 1.1rem; list-style: disc; }
.blog-content ol { margin: 0.5rem 0 0.5rem 1.25rem; list-style: decimal; }
.blog-content li { margin: 0.3rem 0; }
.blog-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.85rem;
}
.blog-content table th {
  background: #eef2ff;
  color: #312e81;
  font-weight: 800;
  text-align: left;
}
.blog-content table th,
.blog-content table td {
  border: 1px solid #e2e8f0;
  padding: 0.55rem 0.7rem;
  vertical-align: top;
}
.blog-content table tr:nth-child(even) td { background: #f8fafc; }
.blog-content img {
  display: block;
  max-width: 640px;
  width: 100%;
  height: auto;
  margin: 1.25rem auto;
  border: 1px solid #e2e8f0;
  border-radius: 0.9rem;
  box-shadow: 0 10px 24px -18px rgba(15, 23, 42, 0.35);
}
.blog-content blockquote {
  border-left: 3px solid #6366f1;
  background: #eef2ff;
  padding: 0.6rem 1rem;
  margin: 1rem 0;
  border-radius: 0 0.6rem 0.6rem 0;
  font-style: italic;
  color: #3730a3;
}
.blog-content a { color: #4f46e5; font-weight: 600; text-decoration: underline; }
.blog-content code {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 0.3rem;
  padding: 0.05rem 0.35rem;
  font-size: 0.85em;
}

