/* Custom Invoice only: existing A4/thermal and all transaction UIs remain untouched. */
.ci-designer{margin-top:16px;border:1px solid #cfe3fa;border-radius:16px;background:linear-gradient(135deg,#fff,#eff8ff);padding:18px;color:#15345b}
.ci-designer header h2{font-size:17px;margin:0 0 5px}.ci-designer header small{font-size:12px;line-height:1.5}
.ci-controls{display:grid;grid-template-columns:2fr repeat(3,1fr);gap:12px;margin:16px 0}.ci-controls label{display:grid;gap:5px;font-size:12px;font-weight:700}
.ci-controls input,.ci-controls select{width:100%;min-width:0;height:36px;border:1px solid #bdd8f7;border-radius:8px;background:#fff;color:#17375b;padding:6px;font:inherit}
.ci-controls input[readonly]{background:#edf3fa}.ci-switch-groups{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.ci-switch-groups fieldset{min-width:0;margin:0;border:1px solid #cde1f6;border-radius:12px;padding:10px;background:#ffffffc7}.ci-switch-groups legend{font-size:13px;font-weight:800}.ci-switch-groups label{display:flex;align-items:center;gap:8px;min-height:32px;font-size:12px;line-height:1.4}.ci-switch-groups input[type=checkbox]{appearance:auto;width:18px!important;height:18px!important;min-height:18px!important;flex:0 0 18px;accent-color:#0078ff;margin:0}
.ci-help{font-size:12px;line-height:1.5}.ci-editor-actions{display:flex;flex-wrap:wrap;gap:8px}.ci-editor-actions button{min-height:36px;border:1px solid #bdd8f7;border-radius:8px;background:#fff;color:#0066df;padding:7px 14px;font:700 12px Arial,sans-serif;cursor:pointer}.ci-editor-actions [data-ci-save],.ci-editor-actions [data-ci-once]{background:linear-gradient(130deg,#00b6ff,#0066ff);color:white}.ci-editor-actions button:disabled{opacity:.5;cursor:not-allowed}
[data-ci-status]{font-size:12px;line-height:1.5}.ci-preview-viewport{max-width:100%;max-height:680px;overflow:auto;border:1px solid #ccd9e8;background:#e7edf4;padding:10px;margin-top:12px}.ci-dialog{width:min(1200px,94vw);max-height:92dvh;overflow:auto;border:1px solid #bcd7f4;border-radius:16px;padding:15px;background:#f5faff}.ci-dialog::backdrop{background:#18354e80}.ci-close{display:block;margin-left:auto;border:1px solid #c7dff6;border-radius:8px;background:white;color:#15345b;width:36px;height:36px;font-size:24px}.ci-dialog .ci-designer{margin:8px 0 0}
.ci-offscreen{position:fixed;left:-20000px;top:0;pointer-events:none}
.bill-receipt-page:has(>.custom-invoice){max-width:none;overflow:auto}
.bill-printable.custom-invoice{display:block!important;width:var(--ci-width);max-width:none!important;margin:0!important;padding:0!important;border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important;color:#000!important;font:8pt/1.3 Arial,sans-serif!important}
.custom-invoice .ci-page{box-sizing:border-box!important;position:relative;display:block;width:var(--ci-width);height:var(--ci-height);padding:var(--ci-margin);margin:0 0 12px;background:white;color:#000;box-shadow:0 2px 8px #0002;overflow:visible}
.custom-invoice .ci-content{display:block;width:100%;margin:0;padding:0}
/* The document is actual paper, not an interactive mobile responsive table. */
.custom-invoice table.ci-items{display:table!important;min-width:0!important}
.custom-invoice table.ci-items thead{display:table-header-group!important}
.custom-invoice table.ci-items tbody{display:table-row-group!important}
.custom-invoice table.ci-items tr{display:table-row!important;position:static!important;margin:0!important;box-shadow:none!important;border-radius:0!important;background:white!important;min-height:0!important}
.custom-invoice table.ci-items th,.custom-invoice table.ci-items td{display:table-cell!important;position:static!important;grid-area:auto!important;min-width:0!important;max-width:none!important;width:auto!important;transform:none!important}
.custom-invoice table.ci-items td::before,.custom-invoice table.ci-items td::after{content:none!important;display:none!important}
.custom-invoice .ci-content *{box-sizing:border-box;color:#000;font-family:Arial,sans-serif;letter-spacing:normal;overflow-wrap:anywhere}
.custom-invoice .ci-content section,.custom-invoice .ci-content div,.custom-invoice .ci-content p,.custom-invoice .ci-content h1{margin:0;border-radius:0;box-shadow:none;background:#fff}
.custom-invoice .ci-title{height:6mm;font:bold 12pt/1 Arial,sans-serif;text-align:center}
.custom-invoice span{display:block;white-space:pre-wrap}.custom-invoice .ci-bold,.custom-invoice b{font-weight:700}
.custom-invoice img{filter:grayscale(1)}
.custom-invoice .ci-head{display:grid;grid-template-columns:51% 49%;border:0.2mm solid #000;min-height:34mm}
.custom-invoice .ci-head:has(+.ci-items){border-bottom:0}
.custom-invoice .ci-store{padding:2mm 4mm;line-height:1.35}.custom-invoice .ci-store>strong{display:block;font-size:13pt;line-height:1.4}.custom-invoice .ci-store img{float:right;object-fit:contain;max-width:18mm;max-height:18mm}
.custom-invoice .ci-invoice-meta{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-rows:auto 1fr;min-width:0;border-left:.2mm solid #000}.custom-invoice .ci-invoice-meta>div{min-width:0;padding:1.5mm 2mm;border-bottom:.2mm solid #000}.custom-invoice .ci-invoice-meta>div+div{border-left:.2mm solid #000}.custom-invoice .ci-invoice-meta b{font-size:10pt}
.custom-invoice .ci-party{grid-column:1/-1;min-width:0;padding:1.5mm 2mm;border:0;line-height:1.5}.custom-invoice .ci-party b{display:block;font-size:10pt}
.custom-invoice table.ci-items{table-layout:fixed;border-collapse:collapse;border-spacing:0;width:100%;margin:0;font-size:8pt;border:0.2mm solid #000}
.custom-invoice table.ci-items th,.custom-invoice table.ci-items td{border:0.2mm solid #000;border-radius:0;white-space:normal;overflow:visible;vertical-align:middle;padding:1.5mm 1.2mm;background:#fff;color:#000;font:8pt/1.3 Arial,sans-serif;text-align:left;overflow-wrap:anywhere}
.custom-invoice table.ci-items th{height:9mm;font-weight:700;font-size:7.5pt}.custom-invoice table.ci-items td{height:12mm}.custom-invoice table.ci-items td:last-child{text-align:right}.custom-invoice table.ci-items td.ci-bold,.custom-invoice table.ci-items .ci-total td{font-weight:700}.custom-invoice table.ci-items .ci-total td{height:8mm}
.custom-invoice .ci-summary{display:grid;grid-template-columns:51% 49%;min-height:29mm;border:0.2mm solid #000;border-top:0}.custom-invoice .ci-words{padding:2mm 2.5mm;line-height:1.5}.custom-invoice .ci-words>.ci-bold{margin-top:1mm}.custom-invoice .ci-amounts{border-left:.2mm solid #000}.custom-invoice .ci-amounts>div{display:flex;align-items:center;justify-content:space-between;gap:2mm;min-height:6mm;padding:1mm 2.5mm;border-bottom:.2mm solid #000}.custom-invoice .ci-amounts>div:last-child{border-bottom:0}
.custom-invoice .ci-payment{display:grid;grid-template-columns:repeat(3,1fr);gap:2mm;min-height:15mm;padding:2mm 2.5mm;border:.2mm solid #000;border-top:0;align-items:center}
.custom-invoice .ci-bank-sign{display:grid;grid-template-columns:51% 49%;min-height:29mm;border:.2mm solid #000;border-top:0}.custom-invoice .ci-bank-sign>div{padding:2mm 2.5mm;line-height:1.5}.custom-invoice .ci-bank-sign>.ci-signature{border-left:.2mm solid #000;display:flex;flex-direction:column;justify-content:space-between;text-align:center;padding:4mm}.custom-invoice .ci-bank-sign>div:only-child{grid-column:1/-1;border-left:0}.custom-invoice .ci-qr{display:block;width:20mm;height:20mm;object-fit:contain;margin-top:2mm}
.custom-invoice .ci-terms{min-height:23mm;border:.2mm solid #000;border-top:0;padding:2mm 2.5mm;line-height:1.5}.custom-invoice .ci-thanks{display:flex;align-items:center;justify-content:center;min-height:11mm;text-align:center;border:.2mm solid #000;border-top:0;padding:2mm}.custom-invoice .ci-page-number{position:absolute;bottom:1mm;right:var(--ci-margin);font:6pt Arial,sans-serif}
.custom-invoice .ci-head{min-height:32mm}.custom-invoice .ci-amounts>div{min-height:5mm;padding:.7mm 2.5mm}.custom-invoice .ci-payment{min-height:12mm}.custom-invoice .ci-bank-sign{min-height:27mm}.custom-invoice .ci-bank-sign>div{font-size:7.5pt;line-height:1.3}.custom-invoice .ci-terms{min-height:20mm}.custom-invoice .ci-thanks{min-height:10mm}.custom-invoice .ci-summary:has(>.ci-amounts:only-child){grid-template-columns:1fr}.custom-invoice .ci-amounts:only-child{border-left:0}
@media(max-width:600px){.ci-designer{padding:12px}.ci-controls{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.ci-switch-groups{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.ci-switch-groups label{font-size:11px}.ci-dialog{padding:8px;width:96vw}.ci-preview-viewport{max-height:420px}.ci-editor-actions button{min-height:40px}}
/* Custom paper must retain the same existing table geometry after the Mobile
   shell labels tables. This changes cascade priority, not invoice columns. */
@media screen{
  html[data-medaliza-ui-mode="mobile"] #app .bill-receipt-page > .bill-printable.custom-invoice table.ci-items{display:table!important;table-layout:fixed!important;min-width:0!important;max-width:none!important;width:100%!important;border:.2mm solid #000!important;background:#fff!important}
  html[data-medaliza-ui-mode="mobile"] #app .bill-receipt-page > .bill-printable.custom-invoice table.ci-items colgroup{display:table-column-group!important}
  html[data-medaliza-ui-mode="mobile"] #app .bill-receipt-page > .bill-printable.custom-invoice table.ci-items thead{display:table-header-group!important;position:static!important;width:auto!important;height:auto!important;overflow:visible!important;clip-path:none!important}
  html[data-medaliza-ui-mode="mobile"] #app .bill-receipt-page > .bill-printable.custom-invoice table.ci-items tbody{display:table-row-group!important}
  html[data-medaliza-ui-mode="mobile"] #app .bill-receipt-page > .bill-printable.custom-invoice table.ci-items tr{display:table-row!important;position:static!important;margin:0!important;padding:0!important;border:0!important;border-radius:0!important;box-shadow:none!important;background:#fff!important}
  html[data-medaliza-ui-mode="mobile"] #app .bill-receipt-page > .bill-printable.custom-invoice table.ci-items td{display:table-cell!important;position:static!important;grid-area:auto!important;width:auto!important;min-width:0!important;max-width:none!important;padding:1.5mm 1.2mm!important;border:.2mm solid #000!important;border-radius:0!important;white-space:normal!important;text-align:left!important;font:8pt/1.3 Arial,sans-serif!important;color:#000!important;background:#fff!important}
  html[data-medaliza-ui-mode="mobile"] #app .bill-receipt-page > .bill-printable.custom-invoice table.ci-items td:last-child{text-align:right!important}
  html[data-medaliza-ui-mode="mobile"] #app .bill-receipt-page > .bill-printable.custom-invoice table.ci-items :is(td.ci-bold,.ci-total td){font-weight:700!important}
}
@media print{
  .bill-receipt-page > .custom-invoice,.bill-receipt-page > .custom-invoice *{visibility:visible!important}
  body:has(.bill-receipt-page > .custom-invoice) .sidebar,body:has(.bill-receipt-page > .custom-invoice) .topbar,body:has(.bill-receipt-page > .custom-invoice) .mobile-shell-header,body:has(.bill-receipt-page > .custom-invoice) .medaliza-mobile-bottom-nav,body:has(.bill-receipt-page > .custom-invoice) .bill-receipt-actions,body:has(.bill-receipt-page > .custom-invoice) #toastRoot,body:has(.bill-receipt-page > .custom-invoice) #modalRoot{display:none!important}
  body:has(.bill-receipt-page > .custom-invoice),body:has(.bill-receipt-page > .custom-invoice) .app-shell,body:has(.bill-receipt-page > .custom-invoice) .main-content,body:has(.bill-receipt-page > .custom-invoice) #app,body:has(.bill-receipt-page > .custom-invoice) .bill-receipt-page,body:has(.bill-receipt-page > .custom-invoice) [data-mobile-route="billing-receipt"]{margin:0!important;padding:0!important;width:auto!important;max-width:none!important;min-height:0!important;height:auto!important;overflow:visible!important;background:white!important}
  .bill-printable.custom-invoice{page:ci-custom;overflow:visible!important}.custom-invoice .ci-page{page:ci-custom;margin:0!important;box-shadow:none!important;break-inside:avoid;break-after:page;page-break-after:always}.custom-invoice .ci-page:last-child{break-after:auto;page-break-after:auto}
}
