/* ==========================================================================
   BADIGISOL DIGITAL HUB — Enterprise Billing & Analytics v3.0 Stylesheet
   Locked Palette: #008F6B | #D49B2A | #0B1F3A | #FFFFFF
   ========================================================================== */
:root {
  --emerald: #008F6B;
  --emerald-dark: #007356;
  --gold: #D49B2A;
  --navy: #0B1F3A;
  --white: #FFFFFF;
  --purple: #6D28D9;
  --bg: #EEF2F6;
  --border: #CBD5E1;
  --muted: #475569;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "DejaVu Sans", Arial, sans-serif;
}

@page { size: A4 portrait; margin: 0; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--navy); min-height: 100vh; }

/* TOP BAR */
.app-bar {
  position: sticky; top: 0; z-index: 40;
  background: var(--navy); color: var(--white);
  border-bottom: 3px solid var(--gold);
  padding: 9px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.app-brand { display: flex; align-items: center; gap: 9px; }
.app-brand img { height: 29px; width: auto; display: block; }
.app-brand .tag {
  font-size: 10px; font-weight: 800; letter-spacing: 0.6px; text-transform: uppercase;
  background: rgba(0,143,107,0.22); color: #6EE7B7; border: 1px solid rgba(0,143,107,0.5);
  padding: 3px 8px; border-radius: 999px;
}
.nav-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-tab {
  background: transparent; color: #CBD5E1; border: 1px solid transparent;
  padding: 6px 11px; border-radius: 7px; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.nav-tab:hover { color: var(--white); background: rgba(255,255,255,0.08); }
.nav-tab.active { background: var(--emerald); color: var(--white); }
.app-user { font-size: 12px; color: var(--gold); font-weight: 700; }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 8px 13px; border-radius: 7px; border: none; cursor: pointer;
  font-size: 12.5px; font-weight: 700; text-decoration: none; white-space: nowrap;
}
.btn-em { background: var(--emerald); color: var(--white); }
.btn-em:hover { background: var(--emerald-dark); }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-dark { background: #16325B; color: var(--white); }
.btn-wa { background: #25D366; color: #052E16; }
.btn-purple { background: var(--purple); color: var(--white); }
.btn-ghost { background: #F1F5F9; color: var(--navy); border: 1px solid var(--border); }
.btn-danger { background: #FEE2E2; color: #991B1B; }
.btn-sm { padding: 4px 8px; font-size: 11px; border-radius: 6px; }

/* PORTAL LAYOUT */
.portal-container { max-width: 1460px; margin: 0 auto; padding: 16px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi-card {
  background: var(--white); border-radius: 12px; padding: 15px 17px;
  border: 1px solid var(--border); border-top: 4px solid var(--navy);
  box-shadow: 0 4px 12px rgba(11,31,58,0.05);
}
.kpi-emerald { border-top-color: var(--emerald); }
.kpi-gold { border-top-color: var(--gold); }
.kpi-slate { border-top-color: #64748B; }
.kpi-lbl { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-val { font-size: 22px; font-weight: 900; color: var(--navy); margin: 4px 0; }
.kpi-sub { font-size: 11.5px; color: #64748B; }

.panel-box {
  background: var(--white); border-radius: 12px; padding: 16px;
  border: 1px solid var(--border); box-shadow: 0 4px 14px rgba(11,31,58,0.05);
}
.ca-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filter-bar input, .filter-bar select {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 7px; font-size: 12.5px; color: var(--navy);
}
.filter-bar input[type="search"] { flex: 1; min-width: 190px; }

/* TABLES & PILLS */
.table-scroll { overflow-x: auto; }
.ledger-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ledger-table th {
  background: var(--navy); color: var(--white); padding: 9px 10px; text-align: left;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; border-bottom: 2px solid var(--gold);
}
.ledger-table td { padding: 9px 10px; border-bottom: 1px solid #E2E8F0; vertical-align: middle; }
.ledger-table tr:hover { background: #F8FAFC; }
.ledger-table .num { text-align: right; }
.act-group { display: inline-flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

.pill-status, .pill-type, .seen-pill {
  display: inline-block; padding: 2.5px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.4px;
}
.st-paid { background: #E6F4F0; color: #007356; }
.st-partial { background: #FEF3C7; color: #92400E; }
.st-unpaid { background: #FEE2E2; color: #991B1B; }
.st-cancelled { background: #E2E8F0; color: #64748B; text-decoration: line-through; }
.tp-invoice { background: #E0E7FF; color: #1E3A8A; }
.tp-proforma { background: #DBEAFE; color: #1D4ED8; }
.tp-bos { background: #F1F5F9; color: #334155; }
.tp-quotation { background: #FEF3C7; color: #92400E; }
.tp-credit_note { background: #EDE9FE; color: #5B21B6; }
.seen-pill { background: #ECFDF5; color: #047857; border: 1px solid #A7F3D0; text-transform: none; margin-left: 4px; font-size: 10px; }

/* ANALYTICS PURE-CSS CHARTS */
.chart-legend { display: flex; gap: 16px; font-size: 12px; font-weight: 700; color: var(--muted); margin: 6px 0 12px; }
.lg-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.bar-chart-wrap {
  display: flex; align-items: flex-end; gap: 10px; height: 185px;
  padding: 18px 8px 6px; border-bottom: 1.5px solid var(--border); overflow-x: auto;
}
.bar-group {
  flex: 1; min-width: 58px; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end;
}
.bar-pair { display: flex; align-items: flex-end; gap: 4px; height: 132px; width: 100%; justify-content: center; }
.bar-col {
  width: 18px; border-radius: 4px 4px 0 0; min-height: 3px; transition: height 0.25s ease;
  position: relative;
}
.bar-billed { background: var(--navy); }
.bar-coll { background: var(--emerald); }
.bar-lbl { font-size: 11px; font-weight: 700; color: var(--navy); margin-top: 6px; }
.bar-amt { font-size: 9.5px; color: var(--muted); margin-top: 1px; }

.aging-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.aging-box { border: 1px solid var(--border); border-radius: 9px; padding: 12px; background: #F8FAFC; }
.aging-box.warn { background: #FFFBEB; border-color: #FCD34D; }
.aging-box.danger { background: #FEF2F2; border-color: #FCA5A5; }
.aging-box .ab-lbl { font-size: 11px; font-weight: 700; color: var(--muted); }
.aging-box .ab-val { font-size: 18px; font-weight: 900; color: var(--navy); margin: 3px 0; }
.aging-box.danger .ab-val { color: #991B1B; }
.aging-box .ab-cnt { font-size: 11px; color: #64748B; }

.funnel-stack { display: flex; flex-direction: column; gap: 11px; }
.funnel-row { display: flex; flex-direction: column; gap: 4px; }
.funnel-top { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; }
.funnel-track { height: 10px; border-radius: 999px; background: #E2E8F0; overflow: hidden; }
.funnel-fill { height: 100%; border-radius: 999px; background: var(--emerald); }

/* EDITOR */
.editor-split { display: grid; grid-template-columns: 460px 1fr; gap: 18px; align-items: start; }
.box-title-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.sub-h { font-size: 13px; color: var(--navy); margin-bottom: 8px; }
.sep { border: none; border-top: 1px solid #E2E8F0; margin: 13px 0; }
.mode-pills { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.mode-pill {
  border: 1.5px solid var(--border); background: #FFFFFF; border-radius: 9px; padding: 9px;
  text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px;
}
.mode-pill strong { font-size: 12px; color: var(--navy); }
.mode-pill span { font-size: 10.5px; color: var(--muted); }
.mode-pill.active { border-color: var(--emerald); background: #F0FDF9; }

.notice { font-size: 12px; padding: 8px 10px; border-radius: 7px; background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E; line-height: 1.45; }
.notice.safe { background: #F0FDF9; border-color: #A7F3D0; color: #065F46; }
.cn-ref-box { background: #F5F3FF; border: 1px solid #C4B5FD; border-radius: 8px; padding: 10px; }

.gstin-hint { font-size: 11px; font-weight: 700; margin-top: 3px; min-height: 14px; }
.gstin-ok { color: #007356; }
.gstin-igst { color: #1D4ED8; }
.gstin-bad { color: #DC2626; }

.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.fg { display: flex; flex-direction: column; gap: 3px; }
.fg.full { grid-column: 1 / -1; }
.fg label { font-size: 11px; font-weight: 700; color: #334155; }
.fg input, .fg select, .fg textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px;
  font-family: inherit; font-size: 12.5px; color: var(--navy); background: #FFFFFF;
}
.fg input:focus, .fg select:focus, .fg textarea:focus { outline: none; border-color: var(--emerald); }

.preset-bar { display: flex; flex-wrap: wrap; gap: 5px; }
.preset-chip {
  font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 6px;
  background: #E6F4F0; color: var(--emerald-dark); border: 1px solid #A7F3D0; cursor: pointer;
}
.preset-chip:hover { background: var(--emerald); color: var(--white); }

.items-stack { display: flex; flex-direction: column; gap: 8px; }
.item-row-ed { background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.item-row-top { display: flex; gap: 6px; }
.item-row-nums { display: grid; grid-template-columns: 1.1fr 0.7fr 1.1fr 0.8fr; gap: 6px; }
.save-bar { display: flex; gap: 8px; margin-top: 14px; }

.upload-preview-box {
  border: 1px dashed var(--border); border-radius: 8px; padding: 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #F8FAFC;
}
.upload-preview-box img { max-height: 44px; max-width: 140px; object-fit: contain; }
.upload-btns { display: flex; gap: 6px; }

/* PUBLIC VIEW BAR */
.public-view-body { display: flex; flex-direction: column; align-items: center; padding: 16px; gap: 14px; }
.pub-bar {
  width: 100%; max-width: 210mm; background: var(--navy); color: var(--white);
  padding: 10px 16px; border-radius: 10px; border-bottom: 3px solid var(--gold);
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
}
.pub-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* A4 DOCUMENT SHEET (EXACT 1-PAGE ARCHITECTURE) */
.preview-info { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.sheet-wrap { width: 100%; display: flex; justify-content: center; overflow-x: auto; padding-bottom: 20px; }
.a4-sheet {
  width: 210mm; height: 296mm; background: #FFFFFF;
  box-shadow: 0 12px 32px rgba(11,31,58,0.16);
  position: relative; overflow: hidden; flex-shrink: 0;
}
.multi-page-doc .a4-sheet { height: auto; min-height: 296mm; overflow: visible; }
.doc-top-bar { height: 3.5mm; background: linear-gradient(90deg, #0B1F3A 56%, #D49B2A 56%, #D49B2A 78%, #008F6B 78%); }
.doc-pad { padding: 6.5mm 12.5mm 16mm; }
.doc-header { display: flex; justify-content: space-between; align-items: center; gap: 6mm; padding-bottom: 4mm; border-bottom: 0.5mm solid #D49B2A; }
.brand-left { display: flex; align-items: center; max-width: 112mm; }
.brand-left img.doc-logo { max-height: 17mm; max-width: 56mm; width: auto; height: auto; object-fit: contain; display: block; }
.text-brand-title { font-size: 15pt; font-weight: 900; color: #0B1F3A; line-height: 1.1; }
.text-brand-sub { font-size: 7.5pt; color: #008F6B; font-weight: 700; margin-top: 1mm; }
.doc-title-block { text-align: right; }
.doc-badge {
  display: inline-block; background: #0B1F3A; color: #FFFFFF;
  font-size: 11.2pt; font-weight: 800; letter-spacing: 1.3px;
  padding: 2mm 4.6mm; border-radius: 1.5mm; border-left: 1.3mm solid #D49B2A;
}
.doc-badge.quote { background: #008F6B; }
.doc-badge.proforma { background: #1D4ED8; border-left-color: #D49B2A; }
.doc-badge.creditnote { background: #6D28D9; border-left-color: #D49B2A; }
.doc-badge.cancelled { background: #991B1B; border-left-color: #FCA5A5; }
.doc-sub { font-size: 7.2pt; color: #008F6B; font-weight: 700; margin-top: 1.2mm; letter-spacing: 0.5px; }

.cancel-banner {
  margin-top: 3mm; padding: 2.2mm 3.5mm; border-radius: 1.5mm;
  background: #FEF2F2; border: 0.4mm solid #EF4444; color: #991B1B; font-size: 7.7pt; line-height: 1.4;
}
.cn-banner {
  margin-top: 3mm; padding: 2.2mm 3.5mm; border-radius: 1.5mm;
  background: #F5F3FF; border: 0.4mm solid #8B5CF6; color: #4C1D95; font-size: 7.7pt; line-height: 1.4;
}
.cancelled-watermark {
  position: absolute; top: 46%; left: 50%;
  transform: translate(-50%, -50%) rotate(-32deg);
  font-size: 72pt; font-weight: 900; letter-spacing: 8px;
  color: rgba(220, 38, 38, 0.13); border: 4pt solid rgba(220, 38, 38, 0.15);
  padding: 4mm 12mm; border-radius: 4mm; pointer-events: none; z-index: 5;
}

.partner-strip {
  margin-top: 3mm; padding: 2mm 3.5mm; border-radius: 1.5mm;
  background: #F0FDF9; border: 0.3mm solid #A7F3D0;
  font-size: 7.8pt; color: #0B1F3A; display: none; justify-content: space-between;
}
.partner-strip strong { color: #008F6B; }
.meta-strip {
  display: flex; justify-content: space-between; align-items: center; gap: 2.5mm; flex-wrap: wrap;
  background: #0B1F3A; color: #FFFFFF; padding: 2.2mm 3.5mm;
  border-radius: 1.5mm; margin-top: 3.5mm; font-size: 7.3pt;
}
.meta-strip > div { white-space: nowrap; }
.meta-strip span.k { color: #D49B2A; font-weight: 700; margin-right: 1mm; }
.party-grid { display: flex; gap: 5mm; margin-top: 4mm; font-size: 8.2pt; line-height: 1.5; }
.party-box { flex: 1; background: #F8FAFC; border: 0.25mm solid #CBD5E1; border-radius: 1.5mm; padding: 2.8mm 3.6mm; color: #1E293B; }
.party-box h4 { font-size: 7.1pt; text-transform: uppercase; letter-spacing: 0.8px; color: #008F6B; border-bottom: 0.25mm solid #E2E8F0; padding-bottom: 1mm; margin-bottom: 1.4mm; }
.party-box strong.p-name { color: #0B1F3A; font-size: 9pt; display: block; margin-bottom: 0.3mm; }

table.doc-items { width: 100%; border-collapse: collapse; margin-top: 4mm; font-size: 8.2pt; }
table.doc-items thead th { background: #0B1F3A; color: #FFFFFF; padding: 2.3mm 2.2mm; text-align: left; font-size: 7.4pt; text-transform: uppercase; border-bottom: 0.7mm solid #D49B2A; }
table.doc-items thead th.num, table.doc-items tbody td.num { text-align: right; }
table.doc-items thead th.ctr, table.doc-items tbody td.ctr { text-align: center; }
table.doc-items tbody td { padding: 2.4mm 2.2mm; border-bottom: 0.25mm solid #E2E8F0; color: #0B1F3A; vertical-align: top; }
table.doc-items tbody tr:nth-child(even) { background: #F8FAFC; }
.item-note { font-size: 7.2pt; color: #64748B; display: block; margin-top: 0.3mm; }

.sum-grid { display: flex; justify-content: space-between; gap: 4.5mm; margin-top: 4.5mm; align-items: stretch; }
.bank-box { flex: 1.25; border: 0.25mm solid #CBD5E1; border-radius: 1.5mm; padding: 2.8mm 3.4mm; font-size: 7.8pt; line-height: 1.55; color: #1E293B; background: #F8FAFC; }
.bank-with-qr { display: flex; justify-content: space-between; align-items: center; gap: 3mm; }
.bank-info-col { flex: 1; min-width: 0; }
.bank-box h4 { font-size: 7.1pt; text-transform: uppercase; color: #0B1F3A; border-bottom: 0.4mm solid #008F6B; padding-bottom: 1mm; margin-bottom: 1.4mm; }

/* SCANNABLE VECTOR UPI QR CARD INSIDE A4 PDF */
.upi-qr-card {
  width: 26mm; flex-shrink: 0; background: #FFFFFF; border: 0.35mm solid #0B1F3A;
  border-radius: 1.5mm; padding: 1.3mm; text-align: center;
}
.upi-qr-svg svg { width: 22.5mm; height: 22.5mm; display: block; margin: 0 auto; }
.upi-qr-lbl { font-size: 5.5pt; font-weight: 800; color: #008F6B; margin-top: 1mm; letter-spacing: 0.2px; }
.qr-placeholder {
  width: 22.5mm; height: 22.5mm; margin: 0 auto; border: 0.35mm dashed #008F6B;
  display: flex; align-items: center; justify-content: center; font-size: 6pt; font-weight: 800; color: #0B1F3A;
}

.totals-col { width: 75mm; font-size: 8.3pt; }
.t-row { display: flex; justify-content: space-between; padding: 1.6mm 2.4mm; border-bottom: 0.25mm solid #E2E8F0; color: #0B1F3A; }
.t-grand { display: flex; justify-content: space-between; padding: 2.4mm 3mm; margin-top: 1.4mm; background: #008F6B; color: #FFFFFF; font-weight: 800; font-size: 9.8pt; border-radius: 1.2mm; }
.t-grand.cn-grand { background: #6D28D9; }
.words-box { margin-top: 3.5mm; padding: 2mm 3.4mm; background: #F0FDF9; border-left: 1mm solid #008F6B; font-size: 8pt; color: #0B1F3A; }
.bottom-sign { display: flex; justify-content: space-between; align-items: flex-end; gap: 6mm; margin-top: 5mm; padding-top: 3mm; border-top: 0.25mm dashed #CBD5E1; }
.terms-col { font-size: 7.3pt; color: #475569; line-height: 1.5; max-width: 112mm; white-space: pre-line; }
.terms-col strong { color: #0B1F3A; display: block; margin-bottom: 0.5mm; }
.sign-col { text-align: right; font-size: 8.1pt; color: #0B1F3A; min-width: 58mm; }
.sign-col img.sign-img { max-width: 46mm; max-height: 19mm; width: auto; height: auto; margin: 1.2mm 0; display: none; }
.sign-col .sign-gap { height: 12mm; }
.sign-col .auth-line { border-top: 0.35mm solid #0B1F3A; padding-top: 1.2mm; font-weight: 700; color: #008F6B; }

.doc-footer {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: #0B1F3A; color: #FFFFFF; padding: 3.2mm 12.5mm;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 7.3pt; border-top: 0.9mm solid #D49B2A;
}
.multi-page-doc .doc-footer { position: static; margin-top: 6mm; }

/* MODALS & TOAST */
.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(11,31,58,0.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: var(--white); border-radius: 12px; padding: 20px; width: 100%; max-width: 480px; box-shadow: 0 18px 40px rgba(0,0,0,0.28); }
.modal-card h3 { margin-bottom: 4px; color: var(--navy); }
.modal-sub { font-size: 12.5px; color: #475569; margin-bottom: 10px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.toast {
  position: fixed; bottom: 18px; right: 18px; z-index: 99;
  background: var(--navy); color: var(--white); border-left: 4px solid var(--emerald);
  padding: 10px 16px; border-radius: 8px; font-size: 13px; font-weight: 700;
  box-shadow: 0 8px 24px rgba(0,0,0,0.24); display: none;
}

@media (max-width: 1120px) {
  .editor-split, .ca-grid { grid-template-columns: 1fr; }
}

/* EXACT 1-PAGE A4 PRINT ENGINE */
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  html.single-page-doc,
  body.single-page-doc {
    width: 210mm !important; height: 296mm !important;
    min-height: 0 !important; max-height: 296mm !important;
    margin: 0 !important; padding: 0 !important; display: block !important; gap: 0 !important;
    overflow: hidden !important; background: #FFFFFF !important;
  }
  body.multi-page-doc {
    display: block !important; padding: 0 !important; margin: 0 !important; gap: 0 !important; background: #FFFFFF !important;
  }
  .pub-bar, .app-bar, .toast { display: none !important; }
  .sheet-wrap { display: block !important; padding: 0 !important; margin: 0 !important; overflow: hidden !important; width: 210mm !important; }
  .single-page-doc .a4-sheet {
    width: 210mm !important; height: 296mm !important; min-height: 0 !important; max-height: 296mm !important;
    box-shadow: none !important; margin: 0 !important; overflow: hidden !important;
    page-break-after: avoid !important; break-after: avoid !important;
  }
  .multi-page-doc .a4-sheet { width: 210mm !important; box-shadow: none !important; margin: 0 !important; }
}


/* ===== v4.0 ADDITIONS: NAV BADGES, RENEWALS, PAYMENTS HISTORY, CLIENT INTAKE ===== */
.nav-dot {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px;
  background: var(--gold); color: var(--navy); font-size: 10px; font-weight: 900; margin-left: 4px;
}
.renewal-box { background: #F0FDF9; border: 1px solid #A7F3D0; border-radius: 8px; padding: 9px; }
.intake-share-bar { border-left: 4px solid var(--emerald); }
.intake-url-pill {
  background: #F1F5F9; border: 1px dashed var(--border); border-radius: 7px;
  padding: 7px 10px; font-size: 12px; font-family: monospace; color: var(--navy); word-break: break-all;
}
.new-cli-badge {
  display: inline-block; background: #FEF3C7; color: #92400E; border: 1px solid #F59E0B;
  padding: 2px 7px; border-radius: 999px; font-size: 9.5px; font-weight: 800; margin-left: 4px;
}
.pay-history-box {
  background: #F8FAFC; border: 1px solid var(--border); border-radius: 8px; padding: 10px;
  max-height: 185px; overflow-y: auto; font-size: 12px;
}
.pay-hist-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid #E2E8F0;
}
.pay-hist-row:last-child { border-bottom: none; }

/* PUBLIC CLIENT GST SELF-ONBOARDING PAGE (client_intake.php) */
.intake-body {
  background: linear-gradient(135deg, #0B1F3A 0%, #16325B 50%, #008F6B 100%);
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px 14px;
}
.intake-shell { width: 100%; max-width: 600px; }
.intake-card {
  background: #FFFFFF; border-radius: 16px; overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3); border-top: 5px solid var(--gold);
}
.intake-header {
  background: var(--navy); color: #FFFFFF; padding: 22px 24px; text-align: center;
  border-bottom: 3px solid var(--gold);
}
.intake-logo { max-height: 46px; max-width: 200px; background: #FFFFFF; padding: 6px 12px; border-radius: 8px; margin-bottom: 10px; }
.intake-header h1 { font-size: 19px; letter-spacing: 0.4px; margin-bottom: 4px; }
.intake-header p { font-size: 12.5px; color: #CBD5E1; }
.intake-pad { padding: 22px 24px 24px; }
.intake-err {
  background: #FEF2F2; border: 1px solid #EF4444; color: #991B1B;
  padding: 10px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 700; margin-bottom: 14px;
}
.gst-toggle-wrap { background: #F8FAFC; border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.gt-lbl { font-size: 12px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.gt-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gt-opt {
  display: flex; align-items: center; gap: 7px; padding: 9px 10px; border-radius: 8px;
  border: 1.5px solid var(--border); background: #FFFFFF; cursor: pointer; font-size: 12px;
}
.gt-opt.active { border-color: var(--emerald); background: #F0FDF9; color: var(--emerald-dark); }
.intake-foot-note { text-align: center; font-size: 11px; color: #64748B; margin-top: 12px; }
.intake-success { text-align: center; padding: 8px 4px; }
.ok-badge {
  width: 54px; height: 54px; border-radius: 50%; background: var(--emerald); color: #FFFFFF;
  font-size: 28px; font-weight: 900; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 10px;
}
.intake-success h2 { color: var(--navy); margin-bottom: 6px; }
.intake-success p { font-size: 13px; color: #475569; line-height: 1.5; margin-bottom: 14px; }
.intake-summary-box {
  text-align: left; background: #F8FAFC; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; font-size: 12.5px; line-height: 1.75; margin-bottom: 16px;
}
@media (max-width: 540px) {
  .gt-btns, .fgrid { grid-template-columns: 1fr; }
  .intake-pad { padding: 18px 16px; }
}

.pager-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 10px; border-top: 1px solid #E2E8F0; }

/* ===== v6.0 MULTI-SECTOR ADDITIONS: PLANS GRID, DISPATCH, IRN BOX, THERMAL POS, A5 ===== */
.feat-check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); gap: 7px; margin-top: 4px; }
.feat-chk {
  display: flex; align-items: center; gap: 6px; padding: 7px 9px; border-radius: 7px;
  border: 1px solid var(--border); background: #F8FAFC; font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.feat-chk input { width: auto !important; }
.dispatch-details { background: #F8FAFC; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.dispatch-details summary { font-size: 12px; font-weight: 700; color: var(--navy); cursor: pointer; }
.dispatch-strip {
  margin-top: 3mm; padding: 2mm 3.5mm; border-radius: 1.5mm; background: #F8FAFC;
  border: 0.25mm solid #CBD5E1; display: flex; flex-wrap: wrap; gap: 2mm 5mm; font-size: 7.5pt; color: #1E293B;
}
.irn-header-box {
  margin-top: 3mm; padding: 2.2mm 3.5mm; border: 0.4mm solid #0B1F3A; border-radius: 1.5mm;
  background: #F8FAFC; display: flex; justify-content: space-between; align-items: center; gap: 4mm;
}
.irn-meta { font-size: 7.3pt; line-height: 1.55; color: #0B1F3A; word-break: break-all; }
.irn-meta code { font-family: monospace; font-size: 7pt; color: #007356; font-weight: 700; }
.irn-qr-box { width: 22mm; height: 22mm; flex-shrink: 0; border: 0.3mm solid #0B1F3A; padding: 0.8mm; background: #FFFFFF; }
.irn-qr-box svg { width: 100%; height: 100%; display: block; }

/* THERMAL POS RECEIPT (80mm & 58mm) */
.thermal-sheet {
  background: #FFFFFF; color: #000000; font-family: 'Courier New', Courier, monospace;
  padding: 4mm 3.5mm; box-shadow: 0 8px 24px rgba(0,0,0,0.16); border-radius: 4px;
}
.thermal-sheet.thermal80 { width: 80mm; font-size: 9pt; }
.thermal-sheet.thermal58 { width: 58mm; font-size: 8pt; }
.th-center { text-align: center; }
.th-title { font-size: 11.5pt; font-weight: 900; }
.th-sub { font-size: 7.5pt; line-height: 1.35; }
.th-sep { border-top: 1px dashed #000000; margin: 2.2mm 0; }
.th-kv { display: flex; justify-content: space-between; font-size: 8.2pt; line-height: 1.45; }
.th-grand { font-size: 10.5pt; font-weight: 900; margin-top: 1mm; }
.th-tbl { width: 100%; border-collapse: collapse; font-size: 8pt; }
.th-tbl th { border-bottom: 1px solid #000; text-align: left; padding: 1mm 0; }
.th-tbl td { padding: 1mm 0; vertical-align: top; }
.th-tbl .num { text-align: right; }
.th-qr { text-align: center; margin-top: 2.5mm; }
.th-qr svg { width: 32mm; height: 32mm; display: block; margin: 0 auto 1mm; }

/* A5 HALF-PAGE MODE */
.a5-sheet { width: 148mm; height: auto; min-height: 209mm; }
.a5-sheet .doc-pad { padding: 5mm 8mm 14mm; }
.a5-sheet .doc-header { padding-bottom: 2.5mm; }
.a5-sheet .brand-left img.doc-logo { max-height: 13mm; max-width: 42mm; }
.a5-sheet .party-grid { font-size: 7.4pt; gap: 3mm; }
.a5-sheet table.doc-items { font-size: 7.3pt; }
.a5-sheet .totals-col { width: 58mm; font-size: 7.5pt; }

@media print {
  html.format-thermal80, body.format-thermal80 { width: 80mm !important; margin: 0 !important; padding: 0 !important; background: #FFF !important; }
  html.format-thermal58, body.format-thermal58 { width: 58mm !important; margin: 0 !important; padding: 0 !important; background: #FFF !important; }
  .thermal-doc .thermal-sheet { box-shadow: none !important; margin: 0 !important; padding: 2mm !important; }
  .a5-doc .a4-sheet { width: 148mm !important; box-shadow: none !important; margin: 0 !important; }
}

/* ===== v7.0 ULTIMATE: RIGHT-ONLY TOTALS (WHEN BANK BOX HIDDEN) + LUT BANNER ===== */
.sum-right-only { justify-content: flex-end !important; }
.lut-banner {
  margin-top: 3mm; padding: 2mm 3.5mm; border-radius: 1.5mm;
  background: #EFF6FF; border: 0.4mm solid #3B82F6; color: #1E3A8A; font-size: 7.5pt; line-height: 1.4;
}

/* ===== TEMPLATE 2: MINIMALIST CORPORATE (INK-SAVER B2B) ===== */
.a4-sheet.tpl-minimal .doc-top-bar { height: 1.2mm; background: var(--navy); }
.a4-sheet.tpl-minimal .doc-header { border-bottom: 0.35mm solid #CBD5E1; }
.a4-sheet.tpl-minimal .doc-badge { background: #FFFFFF; color: var(--navy); border: 0.5mm solid var(--navy); border-left: 1.6mm solid var(--emerald); }
.a4-sheet.tpl-minimal .meta-strip { background: #F8FAFC; color: var(--navy); border: 0.3mm solid #CBD5E1; }
.a4-sheet.tpl-minimal .meta-strip span.k { color: var(--emerald); }
.a4-sheet.tpl-minimal .party-box { background: #FFFFFF; border-color: #E2E8F0; }
.a4-sheet.tpl-minimal table.doc-items thead th { background: #F1F5F9; color: var(--navy); border-top: 0.4mm solid var(--navy); border-bottom: 0.4mm solid var(--navy); }
.a4-sheet.tpl-minimal .t-grand { background: #FFFFFF; color: var(--navy); border: 0.55mm solid var(--navy); }
.a4-sheet.tpl-minimal .doc-footer { background: #FFFFFF; color: #475569; border-top: 0.35mm solid #CBD5E1; }

/* ===== TEMPLATE 3: BOLD AGENCY BANNER (MODERN SAAS) ===== */
.a4-sheet.tpl-modern .doc-top-bar { display: none; }
.a4-sheet.tpl-modern .doc-pad { padding-top: 0; }
.a4-sheet.tpl-modern .doc-header {
  margin: 0 -12.5mm 3mm; padding: 6.5mm 12.5mm 5.5mm;
  background: var(--navy); color: #FFFFFF; border-bottom: 1.2mm solid var(--gold);
}
.a4-sheet.tpl-modern .doc-header img.doc-logo { background: #FFFFFF; padding: 1.8mm 3mm; border-radius: 1.5mm; max-height: 15mm; }
.a4-sheet.tpl-modern .text-brand-title { color: #FFFFFF; }
.a4-sheet.tpl-modern .text-brand-sub { color: var(--gold); }
.a4-sheet.tpl-modern .doc-badge { background: var(--emerald); color: #FFFFFF; border-left: 1.2mm solid var(--gold); }
.a4-sheet.tpl-modern .doc-sub { color: #CBD5E1; }
.a4-sheet.tpl-modern .meta-strip { background: #F0FDF9; color: var(--navy); border: 0.35mm solid #A7F3D0; }
.a4-sheet.tpl-modern .meta-strip span.k { color: var(--emerald); }
.a4-sheet.tpl-modern table.doc-items thead th { background: var(--emerald); border-bottom-color: var(--navy); }

/* ===== TEMPLATE 4: TRADITIONAL INDIAN GST BOX GRID (TALLY STYLE) ===== */
.a4-sheet.tpl-tally .doc-top-bar { height: 1mm; background: #0B1F3A; }
.a4-sheet.tpl-tally .doc-pad { padding: 5.5mm 10mm 15mm; }
.a4-sheet.tpl-tally .doc-header { border: 0.4mm solid #0B1F3A; border-bottom: none; padding: 3.5mm 4mm; background: #FFFFFF; }
.a4-sheet.tpl-tally .meta-strip { margin-top: 0; border-radius: 0; border: 0.4mm solid #0B1F3A; background: #F1F5F9; color: #0B1F3A; }
.a4-sheet.tpl-tally .meta-strip span.k { color: #0B1F3A; }
.a4-sheet.tpl-tally .party-grid { margin-top: 0; gap: 0; }
.a4-sheet.tpl-tally .party-box { border-radius: 0; border: 0.4mm solid #0B1F3A; border-top: none; background: #FFFFFF; }
.a4-sheet.tpl-tally .party-box + .party-box { border-left: none; }
.a4-sheet.tpl-tally table.doc-items { margin-top: 0; border: 0.4mm solid #0B1F3A; border-top: none; }
.a4-sheet.tpl-tally table.doc-items th, .a4-sheet.tpl-tally table.doc-items td { border: 0.3mm solid #0B1F3A; }
.a4-sheet.tpl-tally table.doc-items thead th { background: #E2E8F0; color: #0B1F3A; border-bottom: 0.5mm solid #0B1F3A; }
.a4-sheet.tpl-tally .bank-box, .a4-sheet.tpl-tally .totals-col { border-radius: 0; }
.a4-sheet.tpl-tally .t-row, .a4-sheet.tpl-tally .t-grand { border-radius: 0; border: 0.3mm solid #0B1F3A; }
.a4-sheet.tpl-tally .t-grand { background: #0B1F3A; color: #FFFFFF; }
.a4-sheet.tpl-tally .words-box { border-radius: 0; border: 0.4mm solid #0B1F3A; background: #FFFFFF; }
.a4-sheet.tpl-tally .bottom-sign { border: 0.4mm solid #0B1F3A; border-top: none; padding: 3.5mm 4mm; margin-top: 0; }

/* TEMPLATE SELECTOR CARDS IN PROFILE TAB */
.tpl-picker-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 10px; margin-top: 6px; }
.tpl-card {
  border: 2px solid var(--border); border-radius: 10px; padding: 10px; cursor: pointer;
  background: #FFFFFF; text-align: center; transition: border-color 0.15s, background 0.15s;
}
.tpl-card.active { border-color: var(--emerald); background: #F0FDF9; }
.tpl-card input { display: none; }
.tpl-card strong { display: block; font-size: 12.5px; color: var(--navy); margin-top: 6px; }
.tpl-card small { font-size: 10.5px; color: var(--muted); }
.tpl-thumb { height: 42px; border-radius: 5px; border: 1px solid #CBD5E1; position: relative; overflow: hidden; background: #FFFFFF; }
.tpl-thumb.t-classic::before { content:''; position:absolute; top:0; left:0; right:0; height:6px; background:linear-gradient(90deg,#0B1F3A 55%,#D49B2A 55%,#D49B2A 78%,#008F6B 78%); }
.tpl-thumb.t-minimal::before { content:''; position:absolute; top:0; left:0; right:0; height:3px; background:#0B1F3A; }
.tpl-thumb.t-modern::before  { content:''; position:absolute; top:0; left:0; right:0; height:15px; background:#0B1F3A; border-bottom:2px solid #D49B2A; }
.tpl-thumb.t-tally { border: 2px solid #0B1F3A; background: repeating-linear-gradient(0deg,#FFF,#FFF 9px,#E2E8F0 9px,#E2E8F0 10px); }

/* ===== v7.1 PERFORMANCE & 1-CLICK SECTOR PRESETS ===== */
.tab-loading-bar {
  background: #F0FDF9; border: 1px solid #A7F3D0; color: var(--emerald-dark);
  padding: 9px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 700; margin-bottom: 12px;
}
.sector-preset-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 7px;
}
.sector-pill {
  border: 1.5px solid var(--border); background: #FFFFFF; border-radius: 8px;
  padding: 7px 9px; text-align: left; cursor: pointer; transition: 0.14s;
}
.sector-pill:hover { border-color: var(--emerald); }
.sector-pill.active { border-color: var(--emerald); background: #ECFDF5; box-shadow: 0 0 0 2px rgba(0,143,107,0.14); }
.sector-pill strong { display: block; font-size: 11px; color: var(--emerald-dark); text-transform: uppercase; letter-spacing: 0.4px; }
.sector-pill span { display: block; font-size: 11.5px; font-weight: 700; color: var(--navy); margin-top: 2px; }

/* ===== v7.2 INLINE AUTO-SAVE STATUS PILLS & WHATSAPP WELCOME MODAL ===== */
.autosave-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border);
  background: #F8FAFC; color: #475569; white-space: nowrap; transition: 0.16s;
}
.autosave-pill.is-idle   { background: #F8FAFC; color: #64748B; border-color: #E2E8F0; }
.autosave-pill.is-dirty  { background: #FFFBEB; color: #92400E; border-color: #FCD34D; }
.autosave-pill.is-saving { background: #EFF6FF; color: #1E40AF; border-color: #93C5FD; }
.autosave-pill.is-saved  { background: #ECFDF5; color: #007356; border-color: #6EE7B7; }
.autosave-pill.is-local  { background: #F0FDF9; color: #0F766E; border-color: #99F6E4; }
.autosave-pill.is-error  { background: #FEF2F2; color: #991B1B; border-color: #FCA5A5; cursor: pointer; }
.as-dot {
  width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block;
}
.autosave-pill.is-saving .as-dot { animation: baPulse 0.9s infinite ease-in-out; }
@keyframes baPulse { 0%, 100% { opacity: 0.25; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.25); } }
.modal-head-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
}
.welcome-preview-ta {
  width: 100%; min-height: 235px; padding: 11px 12px; border: 1.5px solid var(--border);
  border-radius: 9px; font-family: inherit; font-size: 13px; line-height: 1.55; color: var(--navy);
  background: #F8FAFC; resize: vertical;
}
