/* Premium Invoice Styles - Maheera ERP */
#modal:has(.invoice-paper){max-width:1120px}
.invoice-actions{display:flex;gap:9px;align-items:center}
.whatsapp-btn{background:#1f9d5a;color:#fff;text-decoration:none;border-radius:8px;padding:10px 16px;font-size:12px;font-weight:700;display:inline-flex;align-items:center;gap:6px;transition:background .15s}
.whatsapp-btn:hover{background:#168048}

/* Interactive Design Switcher Toolbar */
.invoice-design-toolbar{display:flex;align-items:center;gap:10px;background:#f8fafc;border:1px solid #e2e8f0;padding:10px 14px;border-radius:12px;margin-bottom:18px;flex-wrap:wrap;box-shadow:0 1px 3px rgba(0,0,0,0.04)}
.design-toolbar-label{font-size:12px;font-weight:700;color:#334155;white-space:nowrap}
.design-pill-group{display:flex;gap:7px;flex-wrap:wrap}
.design-pill{background:#ffffff;border:1px solid #cbd5e1;color:#475569;padding:6px 13px;border-radius:20px;font-size:11px;font-weight:600;cursor:pointer;transition:all .18s cubic-bezier(0.16,1,0.3,1);box-shadow:0 1px 2px rgba(0,0,0,0.03)}
.design-pill:hover{background:#f1f5f9;color:#0f172a;border-color:#94a3b8}
.design-pill.active{background:#2563eb;color:#ffffff;border-color:#1d4ed8;box-shadow:0 2px 8px rgba(37,99,235,0.38)}

/* Base Paper Layout */
.invoice-paper{--invoice-accent:#263d7c;max-width:900px;min-height:1120px;margin:auto;background:#fff;color:#1e2737;padding:48px;box-shadow:0 20px 60px rgba(21,32,58,0.12);box-sizing:border-box;position:relative}
.invoice-ribbon{display:flex;justify-content:space-between;align-items:center;margin-bottom:24px;text-transform:uppercase;font-size:9px;letter-spacing:1.4px}
.invoice-ribbon b{padding:6px 12px;border-radius:20px;letter-spacing:.8px;font-size:10px}
.status-paid{background:#e5f6ea;color:#188348;font-weight:700}
.status-partial{background:#fff0d6;color:#a66a08;font-weight:700}
.status-unpaid{background:#ffe5e7;color:#b3283c;font-weight:700}
.status-warn{background:#ef4444;color:#ffffff;font-weight:700}

/* Header & Brand */
.invoice-top{display:flex;justify-content:space-between;gap:35px;border-bottom:3px solid var(--invoice-accent);padding-bottom:26px}
.invoice-brand{display:flex;gap:16px;align-items:flex-start}
.bill-logo,.bill-logo-fallback{width:62px;height:62px;object-fit:contain;flex:0 0 62px}
.bill-logo-fallback{display:grid;place-items:center;background:var(--invoice-accent);color:#fff;border-radius:12px;font-size:30px;font-weight:800}
.eyebrow{font-size:10px;font-weight:700;letter-spacing:1.2px;text-transform:uppercase;color:#64748b}
.invoice-top h1{margin:4px 0 6px;font-size:28px;line-height:1.2;font-weight:800}
.invoice-top p{margin:0;font-size:11px;line-height:1.65;color:#475569}
.invoice-number{text-align:right;min-width:190px}
.invoice-number small{font-size:9px;letter-spacing:1.2px;color:#64748b;font-weight:700;display:block}
.invoice-number h2{margin:4px 0;font-size:20px;color:#0f172a}
.invoice-number p{margin:0;font-size:10px;line-height:1.6;color:#64748b}
.invoice-barcode{display:block;width:150px;height:38px;margin:10px 0 0 auto;fill:currentColor}
.invoice-barcode text{font:5px monospace}

/* Order & Shipping Strip */
.order-strip,.shipping-strip{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;background:#f8fafc;border:1px solid #e2e8f0;padding:12px 16px;border-radius:8px;margin:18px 0}
.shipping-strip{grid-template-columns:repeat(2,1fr)}
.order-strip span,.shipping-strip span{font-size:9px;color:#64748b;text-transform:uppercase;letter-spacing:.6px}
.order-strip b,.shipping-strip b{display:block;color:#0f172a;margin-top:3px;font-size:11px;font-weight:700}

/* Bill To Card */
.bill-to{margin:22px 0;padding:18px 20px;background:#f8fafc;border-left:4px solid var(--invoice-accent);border-radius:0 8px 8px 0}
.bill-to small{font-size:9px;letter-spacing:1.2px;display:block;margin-bottom:6px;font-weight:700;text-transform:uppercase;color:#64748b}
.bill-to b{font-size:15px;color:#0f172a;display:block;margin-bottom:4px}
.bill-to span{display:block;font-size:11px;color:#475569;line-height:1.6}

/* Product Table */
.premium-table{overflow-x:auto;margin:24px 0}
.premium-table table{width:100%;border-collapse:collapse;white-space:normal}
.premium-table th{background:var(--invoice-accent);color:#fff;padding:12px 16px;font-size:11px;font-weight:700;letter-spacing:.5px;text-align:left;border:0}
.premium-table th:nth-child(2),.premium-table th:nth-child(3),.premium-table th:nth-child(4){text-align:right}
.premium-table td{padding:14px 16px;border-bottom:1px solid #e2e8f0;font-size:11px;vertical-align:middle}
.premium-table td:nth-child(2),.premium-table td:nth-child(3),.premium-table td:nth-child(4){text-align:right}
.premium-table td:first-child strong{display:block;font-size:12px;color:#0f172a}
.premium-table td:first-child small{display:block;font-size:10px;color:#64748b;margin-top:3px}
.bill-product{width:36px;height:36px;object-fit:cover;border-radius:6px;float:left;margin-right:10px;border:1px solid #e2e8f0}

/* Lower Section: QR, Bank, Summary */
.invoice-lower{display:grid;grid-template-columns:1fr 320px;gap:28px;margin-top:24px;align-items:start}
.payment-qr{display:flex;gap:14px;align-items:center;font-size:11px;color:#334155}
.payment-qr img,.payment-qr svg{width:86px;height:86px;flex:0 0 86px;border-radius:6px;border:1px solid #cbd5e1;padding:3px;background:#fff}
.payment-qr span{line-height:1.5}
.payment-qr b{color:#0f172a;font-size:11px}
.bank-box{margin-top:16px;border:1px solid #e2e8f0;background:#f8fafc;padding:12px 14px;border-radius:8px}
.bank-box b{display:block;font-size:9px;color:#64748b;letter-spacing:.6px;margin-bottom:4px;text-transform:uppercase}
.bank-box span{display:block;font-size:10px;line-height:1.6;color:#334155}

/* Summary Card */
.invoice-summary{width:auto!important;margin:0!important;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden;background:#fff}
.invoice-summary div{display:flex;justify-content:space-between;padding:8px 14px!important;font-size:11px;border-bottom:1px solid #f1f5f9;color:#334155}
.invoice-summary .grand{background:var(--invoice-accent)!important;color:#fff!important;font-size:14px;font-weight:700;padding:12px 14px!important;border-bottom:0}

/* Terms & Sign Box */
.invoice-terms{display:grid;grid-template-columns:1fr 190px;gap:30px;margin-top:38px;border-top:1px solid #e2e8f0;padding-top:20px;align-items:flex-start}
.invoice-terms b{font-size:10px;letter-spacing:.8px;text-transform:uppercase;color:#334155;display:block;margin-bottom:6px}
.invoice-terms p{font-size:10px;line-height:1.6;color:#64748b;margin:0}
.sign-box{text-align:center;display:flex;flex-direction:column;align-items:center;min-height:90px;justify-content:flex-end}
.bill-signature,.signature-space{height:52px;max-width:150px;object-fit:contain;display:block;margin-bottom:4px}
.sign-box b{display:block;font-size:10px;color:#0f172a}
.sign-box small{font-size:9px;color:#64748b;display:block}

/* Footer Note */
.invoice-foot{margin-top:28px!important;padding:14px 0 0!important;display:flex!important;justify-content:space-between;background:transparent!important;color:#64748b!important;font-size:10px;border-top:1px solid #e2e8f0!important}

/* Default Hidden Elements */
.vyapar-blessing,.luxury-crest,.stamp-seal{display:none}

/* ========================================================
   THEME 1: EXECUTIVE SAPPHIRE (Corporate Tech & Enterprise)
   ======================================================== */
.theme-executive{
  --invoice-accent:#1e40af;
  border-top:10px solid #1e40af;
  border-bottom:4px solid #1e40af;
  background:linear-gradient(180deg,#f8fafc 0,#ffffff 180px);
}
.theme-executive .invoice-top{
  border-bottom:2px solid #e2e8f0;
  position:relative;
}
.theme-executive .invoice-top::after{
  content:"";
  position:absolute;
  bottom:-2px;
  left:0;
  width:140px;
  height:3px;
  background:linear-gradient(90deg,#1e40af,#3b82f6);
}
.theme-executive .bill-to{
  background:#f1f5f9;
  border-left:4px solid #1e40af;
}
.theme-executive .premium-table th{
  background:#1e3a8a;
  letter-spacing:.8px;
}
.theme-executive .invoice-summary .grand{
  background:linear-gradient(135deg,#1e3a8a,#2563eb)!important;
}

/* ========================================================
   THEME 2: ROYAL BOUTIQUE / ATELIER (Luxury Bags & Couture)
   ======================================================== */
.theme-luxury{
  --invoice-accent:#b48316;
  background:#faf7f2;
  color:#292524;
  font-family:Georgia,"Times New Roman",serif;
  border:2px solid #b48316;
  outline:1px solid #d4af37;
  outline-offset:-8px;
  padding:44px;
}
.theme-luxury .luxury-crest{
  display:block;
  text-align:center;
  font-size:10px;
  letter-spacing:3px;
  color:#b48316;
  font-weight:700;
  border-bottom:1px solid #e7dec8;
  padding-bottom:10px;
  margin-bottom:18px;
}
.theme-luxury .invoice-ribbon{
  letter-spacing:2px;
}
.theme-luxury .invoice-ribbon b{
  border:1px solid #b48316;
  background:#fff8eb;
  color:#92400e;
}
.theme-luxury .invoice-top{
  border-bottom:1px solid #b48316;
}
.theme-luxury .bill-logo-fallback{
  background:#b48316;
  border-radius:4px;
  color:#faf7f2;
}
.theme-luxury .eyebrow{
  color:#b48316;
  letter-spacing:2px;
}
.theme-luxury .invoice-top h1{
  font-family:Georgia,serif;
  letter-spacing:1px;
  color:#1c1917;
}
.theme-luxury .bill-to{
  background:#f4efe6;
  border-left:4px solid #b48316;
  border-radius:4px;
}
.theme-luxury .bill-to small{
  color:#b48316;
  letter-spacing:2px;
}
.theme-luxury .order-strip,.theme-luxury .shipping-strip{
  background:#f4efe6;
  border:1px solid #e7dec8;
}
.theme-luxury .premium-table th{
  background:#292524;
  color:#fef3c7;
  font-family:Georgia,serif;
  letter-spacing:1.5px;
  border-bottom:2px solid #b48316;
}
.theme-luxury .premium-table td{
  border-bottom:1px solid #e7dec8;
}
.theme-luxury .invoice-summary{
  border:1px solid #d4af37;
  background:#fdfbf7;
}
.theme-luxury .invoice-summary .grand{
  background:#b48316!important;
  color:#fff!important;
  font-family:Georgia,serif;
  letter-spacing:1px;
}
.theme-luxury .stamp-seal{
  display:flex;
  width:92px;
  height:92px;
  border:2px dashed #b48316;
  border-radius:50%;
  color:#b48316;
  margin:10px auto;
  align-items:center;
  justify-content:center;
  text-align:center;
  transform:rotate(-6deg);
  background:rgba(217,119,6,0.04);
}
.theme-luxury .seal-inner span{
  display:block;
  font-size:7px;
  font-weight:bold;
  letter-spacing:1px;
}
.theme-luxury .seal-inner small{
  font-size:6px;
  letter-spacing:1px;
  color:#78350f;
  display:block;
  margin-top:2px;
}

/* ========================================================
   THEME 3: E-COMMERCE PRO DISPATCH (Marketplace & Courier)
   ======================================================== */
.theme-ecommerce{
  --invoice-accent:#4f46e5;
  border-top:10px solid #4f46e5;
  border-radius:18px;
  box-shadow:0 10px 40px rgba(79,70,229,0.1);
}
.theme-ecommerce .invoice-top{
  border-bottom:2px solid #e0e7ff;
}
.theme-ecommerce .bill-logo-fallback{
  background:linear-gradient(135deg,#4f46e5,#6366f1);
  border-radius:14px;
}
.theme-ecommerce .order-strip{
  background:#eef2ff;
  border:1px solid #c7d2fe;
  border-radius:10px;
}
.theme-ecommerce .order-strip b{
  color:#3730a3;
}
.theme-ecommerce .bill-to{
  border:2px dashed #6366f1;
  border-radius:10px;
  background:#f8fafc;
  border-left:5px solid #4f46e5;
}
.theme-ecommerce .bill-to-label{
  color:#4f46e5!important;
  font-weight:800!important;
}
.theme-ecommerce .shipping-strip{
  background:#f1f5f9;
  border:1px solid #cbd5e1;
  border-radius:8px;
}
.theme-ecommerce .premium-table table{
  border-radius:8px;
  overflow:hidden;
}
.theme-ecommerce .premium-table th{
  background:#4f46e5;
}
.theme-ecommerce .premium-table tbody tr:nth-child(even){
  background:#f8fafc;
}
.theme-ecommerce .invoice-summary{
  border-radius:12px;
  border:1px solid #c7d2fe;
}
.theme-ecommerce .invoice-summary .grand{
  background:#4f46e5!important;
}

/* ========================================================
   THEME 4: HERITAGE VYAPAR RUBY (Indian Wholesale Mandi)
   ======================================================== */
.theme-maroon{
  --invoice-accent:#881337;
  background:#fffdfa;
  border:2px solid #881337;
  border-top:12px solid #881337;
  border-bottom:6px solid #881337;
}
.theme-maroon .vyapar-blessing{
  display:block;
  text-align:center;
  color:#881337;
  font-weight:bold;
  font-size:12px;
  letter-spacing:1.5px;
  border-bottom:2px solid #fecdd3;
  padding-bottom:6px;
  margin-bottom:14px;
  background:#fff1f2;
  border-radius:4px;
}
.theme-maroon .invoice-top{
  border-bottom:2px solid #881337;
}
.theme-maroon .bill-logo-fallback{
  background:#881337;
  border-radius:6px;
}
.theme-maroon .eyebrow{
  color:#881337;
}
.theme-maroon .invoice-top h1{
  color:#4c0519;
}
.theme-maroon .bill-to{
  background:#fff1f2;
  border:1px solid #fecdd3;
  border-left:5px solid #881337;
}
.theme-maroon .premium-table th{
  background:#881337;
  border-bottom:3px solid #d97706;
}
.theme-maroon .invoice-summary{
  border:1px solid #fecdd3;
  background:#fffdfa;
}
.theme-maroon .invoice-summary .grand{
  background:#881337!important;
  color:#fff!important;
}
.theme-maroon .stamp-seal{
  display:flex;
  width:94px;
  height:94px;
  border:2.5px solid #b91c1c;
  border-radius:50%;
  color:#b91c1c;
  margin:10px auto;
  align-items:center;
  justify-content:center;
  text-align:center;
  transform:rotate(-8deg);
  background:rgba(239,68,68,0.03);
  box-shadow:inset 0 0 0 2px #fff,inset 0 0 0 4px #b91c1c;
}
.theme-maroon .seal-inner span{
  display:block;
  font-size:7px;
  font-weight:800;
  letter-spacing:.8px;
}
.theme-maroon .seal-inner small{
  color:#dc2626;
  font-size:6px;
  display:block;
  margin-top:2px;
  font-weight:700;
}

/* ========================================================
   THEME 5: THERMAL COMPACT (80mm Roll & 4×6 Label Format)
   ======================================================== */
.theme-thermal{
  width:80mm!important;
  max-width:80mm!important;
  min-height:auto;
  padding:7mm 5mm!important;
  font-family:'Courier New',Courier,monospace;
  font-size:9px;
  color:#111;
  background:#fff!important;
  box-shadow:none!important;
  border:1px solid #ccc;
}
.theme-thermal .invoice-ribbon{margin-bottom:10px}
.theme-thermal .invoice-top{display:block;text-align:center;border-bottom:1px dashed #111;padding-bottom:12px}
.theme-thermal .invoice-brand{display:block}
.theme-thermal .bill-logo,.theme-thermal .bill-logo-fallback{margin:0 auto 6px;width:40px;height:40px}
.theme-thermal .invoice-top h1{font-size:16px;margin:2px 0}
.theme-thermal .invoice-number{text-align:center;margin-top:10px}
.theme-thermal .invoice-barcode{margin:8px auto}
.theme-thermal .bill-to{margin:12px 0;padding:8px;background:#fff;border:1px dashed #111;border-radius:0}
.theme-thermal .shipping-strip,.theme-thermal .order-strip{grid-template-columns:1fr;padding:6px;background:#fff;border:1px dashed #111}
.theme-thermal th,.theme-thermal td{font-size:8px!important;padding:5px 2px!important;background:#fff!important;color:#111!important;border-top:1px dashed #111;border-bottom:0}
.theme-thermal .bill-product{display:none}
.theme-thermal .invoice-lower{display:block;margin-top:10px}
.theme-thermal .payment-qr{justify-content:center;margin-bottom:10px}
.theme-thermal .bank-box{border:1px dashed #111;background:#fff}
.theme-thermal .invoice-summary{border:0;background:#fff}
.theme-thermal .invoice-summary div{border-bottom:1px dashed #ddd}
.theme-thermal .invoice-summary .grand{background:#fff!important;color:#111!important;border-top:2px dashed #111;border-bottom:2px dashed #111;font-size:12px}
.theme-thermal .invoice-terms{display:block;margin-top:12px;padding-top:8px;border-top:1px dashed #111}
.theme-thermal .sign-box{margin-top:16px}
.theme-thermal .invoice-foot{display:block!important;text-align:center!important;margin-top:14px!important}

/* Paper sizing presets */
.paper-a5:not(.theme-thermal){max-width:620px;min-height:850px;padding:34px}
.paper-80mm{width:80mm!important;max-width:80mm!important}
.paper-80mm:not(.theme-thermal){padding:8mm 5mm;min-height:auto}
.paper-80mm:not(.theme-thermal) .invoice-lower{grid-template-columns:1fr}
.paper-80mm:not(.theme-thermal) .invoice-top{display:block}
.paper-80mm:not(.theme-thermal) .invoice-number{text-align:left;margin-top:20px}
.paper-4x6{width:100mm!important;max-width:100mm!important;min-height:148mm;padding:6mm 5mm!important;font-size:10px}
.paper-4x6 .invoice-top{gap:12px;padding-bottom:12px}
.paper-4x6 .invoice-top h1{font-size:19px}
.paper-4x6 .invoice-brand{gap:10px}
.paper-4x6 .bill-to{margin:12px 0;padding:10px}
.paper-4x6 .shipping-strip,.paper-4x6 .order-strip{grid-template-columns:1fr;gap:6px;padding:8px}
.paper-4x6 .premium-table th,.paper-4x6 .premium-table td{padding:8px 6px;font-size:10px}
.paper-4x6 .invoice-lower{grid-template-columns:1fr;gap:14px;margin-top:14px}
.paper-4x6 .payment-qr img{width:70px;height:70px}
.paper-4x6 .invoice-terms{grid-template-columns:1fr;gap:12px;margin-top:16px;padding-top:10px}

/* Mobile & Print Media */
@media(max-width:700px){
  #modal:has(.invoice-paper){padding:10px}
  .invoice-paper{padding:20px;min-height:auto}
  .invoice-top,.invoice-lower,.invoice-terms{grid-template-columns:1fr;display:grid}
  .invoice-number{text-align:left}
  .invoice-barcode{margin-left:0}
  .order-strip,.shipping-strip{grid-template-columns:1fr}
  .invoice-actions{flex-wrap:wrap}
  .whatsapp-btn{padding:8px 12px}
}
@media print{
  .invoice-design-toolbar,.whatsapp-btn{display:none!important}
  .invoice-paper{box-shadow:none!important;margin:auto}
  .paper-a5{@page{size:A5;margin:6mm}}
  .paper-4x6{@page{size:4in 6in;margin:3mm}}
  .theme-thermal{@page{size:80mm auto;margin:2mm}}
}
