/* Consistent purchase list/edit/view UI: responsive display only. No changes to saved ledger. */
/* Use standard purchase-entry panel, headings, item table and side totals/payment. */
.ph-unified-special .pro-head-meta{grid-template-columns:minmax(145px,1fr) minmax(235px,1.7fr);max-width:650px}
.ph-unified-special .ph-unified-company-field select,
.ph-unified-special .ph-unified-company-field input{display:block;width:100%;height:35px;margin-top:5px;font-size:13px;color:#173654;font-weight:500;padding:6px 9px;border:1px solid #cbd9e9;border-radius:5px;background:#fff}
.ph-unified-special .pro-ref input{cursor:default}
.ph-unified-safety-note{margin:0 0 12px;background:#f7f9fc;border:1px solid #d8e0e9;color:#486071;border-radius:6px;padding:9px 12px;font-size:12px;line-height:1.5}
.ph-unified-special .ph-unified-lines-scroll{width:100%;max-width:100%;overflow-x:auto!important;-webkit-overflow-scrolling:touch}
.ph-unified-special .ph-unified-lines{min-width:740px!important;width:100%!important;table-layout:fixed!important;border-spacing:4px 5px}
.ph-unified-special .ph-unified-lines th:nth-child(1){width:34px}
.ph-unified-special .ph-unified-lines th:nth-child(2){width:26%}
.ph-unified-special .ph-unified-lines th:nth-child(3){width:26%}
.ph-unified-special .ph-unified-lines th:nth-child(4){width:11%}
.ph-unified-special .ph-unified-lines th:nth-child(5){width:13%}
.ph-unified-special .ph-unified-lines th:nth-child(6){width:14%}
.ph-unified-special .ph-unified-lines td{padding:0 1px;vertical-align:top;min-width:0}
.ph-unified-special .ph-unified-lines input{width:100%;min-width:0;height:35px;font-size:12px;box-sizing:border-box;padding:5px 7px}
.ph-unified-special .ph-unified-lines input[readonly]{background:#fff;color:#1d334e;opacity:1;cursor:default}
.ph-unified-special .ph-unified-lines .line-total input{background:#f2f6fb}
.ph-unified-special .ph-unified-sl{font-size:12px;font-weight:700;color:#30445f;text-align:center;vertical-align:middle!important}
.ph-unified-special .ph-unified-count{display:flex;justify-content:flex-end;padding:5px 0 0;font-size:12px;font-weight:600;color:#455468}
.ph-unified-special .ph-unified-note textarea{width:100%;min-height:58px;padding:9px;border:1px solid #cbd6e3;border-radius:6px;font:inherit;box-sizing:border-box}
.ph-unified-special .ph-unified-payment-summary{margin:10px 0;padding:10px;background:#f7f9fb;border:1px solid #dfe6ee;border-radius:6px}
.ph-unified-special .ph-unified-payment-summary>div{display:flex;justify-content:space-between;gap:8px;margin:4px 0;font-size:12px}
.ph-unified-special .ph-unified-payment-summary>div:last-child{border-top:1px solid #dde5ef;padding-top:8px;margin-top:8px;font-weight:700;color:#8f321f}
.ph-unified-special .ph-unified-pay-hint{font-size:11px;color:#6b7787;line-height:1.5}
.ph-unified-special .ph-unified-footer{padding:8px 4px 12px}
@media(min-width:761px) and (max-width:1140px){.ph-unified-special .pro-transaction-grid{grid-template-columns:minmax(0,1fr) 260px!important}.ph-unified-special .pro-side-column{display:block}}
@media(max-width:760px){
  body .classic-invoice-register .table-wrap{overflow:visible!important;max-width:none!important}
  body .classic-invoice-register table.data-table,
  body .classic-invoice-register table.data-table tbody{display:block!important;width:100%!important;min-width:0!important;table-layout:auto!important}
  body .classic-invoice-register table.data-table thead{display:none!important}
  body .classic-invoice-register table.data-table tbody tr{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:7px 10px!important;width:100%!important;min-width:0!important;margin:8px 0 12px!important;padding:12px!important;border:1px solid #dce2e9!important;border-radius:10px!important;background:white!important;box-sizing:border-box!important}
  body .classic-invoice-register table.data-table tbody tr td{display:block!important;min-width:0!important;width:auto!important;max-width:none!important;padding:4px 2px!important;border:0!important;white-space:normal!important;overflow-wrap:anywhere!important;text-overflow:clip!important;line-height:1.45!important}
  body .classic-invoice-register table.data-table tbody tr td:nth-child(1),body .classic-invoice-register table.data-table tbody tr td:nth-child(2){grid-row:4!important}
  body .classic-invoice-register table.data-table tbody tr td:nth-child(3){grid-column:1!important;grid-row:2!important}
  body .classic-invoice-register table.data-table tbody tr td:nth-child(4){grid-column:1 / -1!important;grid-row:1!important;font-size:15px!important;font-weight:700!important}
  body .classic-invoice-register table.data-table tbody tr td:nth-child(5){grid-column:2!important;grid-row:2!important}
  body .classic-invoice-register table.data-table tbody tr td:nth-child(6){grid-column:1!important;grid-row:3!important}
  body .classic-invoice-register table.data-table tbody tr td:nth-child(7){grid-column:2!important;grid-row:3!important}
  body .classic-invoice-register table.data-table tbody tr td:nth-child(8){grid-column:1 / -1!important;grid-row:5!important}
  body .classic-invoice-register table.data-table tbody tr td:nth-child(3)::before{content:'Date: ';color:#6b7784;font-size:12px}
  body .classic-invoice-register table.data-table tbody tr td:nth-child(5)::before{content:'Supplier: ';color:#6b7784;font-size:12px}
  body .classic-invoice-register table.data-table tbody tr td:nth-child(6)::before{content:'Total: ';color:#6b7784;font-size:12px}
  body .classic-invoice-register table.data-table tbody tr td:nth-child(7)::before{content:'Due: ';color:#6b7784;font-size:12px}
  body .classic-invoice-register table.data-table tbody tr td:nth-child(1) .btn,
  body .classic-invoice-register table.data-table tbody tr td:nth-child(2) .btn{display:inline-flex!important;justify-content:center;align-items:center;min-height:36px;min-width:65px!important}
  body .purchase-edit-panel .compact-line-table-wrap,
  body .purchase-edit-panel .line-table-wrap{max-width:100%!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch!important}
  body .purchase-edit-panel table[data-line-table]{min-width:860px!important;width:860px!important;table-layout:auto!important}
  body .purchase-edit-panel table[data-line-table] th,
  body .purchase-edit-panel table[data-line-table] td{white-space:nowrap!important;min-width:0}
  body .purchase-edit-panel table[data-line-table] input{min-width:70px!important}

}

@media(max-width:760px){
 .ph-unified-special .ph-unified-meta{grid-template-columns:1fr!important;max-width:none}
 .ph-unified-special .pro-transaction-grid{grid-template-columns:1fr!important}
 .ph-unified-special .pro-side-column{display:grid;grid-template-columns:1fr!important}
 .ph-unified-special .pro-inner{padding:10px}
 .ph-unified-special .ph-unified-lines{min-width:740px!important;width:740px!important}
 .ph-unified-special .ph-unified-footer .pro-buttons{gap:6px;flex-wrap:wrap}
}
/* AI / Company Purchase Edit: optional appended Inventory lines. */
.ph-unified-special .ph-unified-add-area{margin:12px 0 5px;padding:11px 10px;border:1px solid #d4dfeb;border-radius:7px;background:#f9fbfe}
.ph-unified-special .ph-unified-add-area>strong{display:block;font-size:13px;color:#16344c;margin-bottom:3px}
.ph-unified-special .ph-unified-add-area>small{display:block;color:#647389;font-size:11px;margin:0 0 10px}
.ph-unified-special .ph-unified-new-lines{min-width:770px;width:100%;table-layout:fixed;border-collapse:separate;border-spacing:4px 6px}
.ph-unified-special .ph-unified-new-lines th{font-size:11px;font-weight:600;color:#4a6076;text-align:left;white-space:nowrap}
.ph-unified-special .ph-unified-new-lines th:nth-child(1){width:35px}
.ph-unified-special .ph-unified-new-lines th:nth-child(2){width:25%}
.ph-unified-special .ph-unified-new-lines th:nth-child(3){width:24%}
.ph-unified-special .ph-unified-new-lines th:nth-child(4){width:10%}
.ph-unified-special .ph-unified-new-lines th:nth-child(5){width:13%}
.ph-unified-special .ph-unified-new-lines th:nth-child(6){width:13%}
.ph-unified-special .ph-unified-new-lines th:nth-child(7){width:36px}
.ph-unified-special .ph-unified-new-lines td{position:relative;min-width:0;vertical-align:top}
.ph-unified-special .ph-unified-new-lines td>input{width:100%;min-width:0;box-sizing:border-box;height:36px;border:1px solid #c6d6e7;border-radius:5px;padding:6px;font:inherit;background:#fff;font-size:12px}
.ph-unified-special .ph-unified-new-lines td>input[readonly]{background:#eef4f9}
.ph-unified-special .ph-unified-new-lines .ph-unified-picks{position:absolute;left:0;top:38px;width:max(270px,100%);max-width:380px;max-height:300px;overflow-y:auto;z-index:1002;background:white;border:1px solid #ccd9e8;border-radius:7px;box-shadow:0 8px 25px #1a3d6324}
.ph-unified-special .ph-unified-new-lines .ph-unified-picks[hidden]{display:none!important}
.ph-unified-special .ph-unified-pick{display:flex;flex-direction:column;gap:2px;text-align:left;padding:9px 10px;border:0;border-bottom:1px solid #e7edf3;background:#fff;color:#193b58;width:100%;cursor:pointer}
.ph-unified-special .ph-unified-pick:hover,.ph-unified-special .ph-unified-pick:focus-visible{background:#eaf6ed}
.ph-unified-special .ph-unified-pick strong{font-size:12px}
.ph-unified-special .ph-unified-pick small{font-size:10px;color:#667987}
.ph-unified-special .ph-unified-no-results{font-size:11px;color:#8d3c1d;padding:10px;line-height:1.4}
.ph-unified-special .ph-unified-remove{min-width:28px!important;padding:6px!important}
.ph-unified-special .ph-unified-live-total{font-size:12px;color:#32485a;margin-left:10px}
.ph-unified-special #ph-unified-add-error{margin-top:8px;padding:8px;border:1px solid #e4b6b3;background:#fff2f1;color:#9d2526;font-size:12px;border-radius:5px}
.ph-unified-special #ph-unified-add-error[hidden]{display:none}
@media(max-width:760px){.ph-unified-special .ph-unified-new-lines{width:770px!important;min-width:770px!important}.ph-unified-special .ph-unified-add-area{padding:8px}.ph-unified-special .ph-unified-live-total{display:inline-block;margin-top:8px;margin-left:0}}

/* Floating medicine suggestions are appended to body so swipeable tables cannot clip them. */
.ph-unified-floating-picks{position:fixed!important;z-index:25000!important;box-sizing:border-box;max-width:calc(100vw - 12px);max-height:300px;overflow-y:auto;background:#fff;border:1px solid #ccd9e8;border-radius:7px;box-shadow:0 8px 25px #1a3d6324;}
.ph-unified-floating-picks[hidden]{display:none!important}
.ph-unified-floating-picks .ph-unified-pick{display:flex;flex-direction:column;gap:2px;width:100%;padding:10px;text-align:left;background:#fff;border:0;border-bottom:1px solid #e7edf3;cursor:pointer;color:#193b58;}
.ph-unified-floating-picks .ph-unified-pick:hover,.ph-unified-floating-picks .ph-unified-pick:focus-visible{background:#eaf6ed}
.ph-unified-floating-picks .ph-unified-pick strong{font-size:12px}
.ph-unified-floating-picks .ph-unified-pick small{font-size:10px;color:#667987}
.ph-unified-floating-picks .ph-unified-no-results{font-size:11px;color:#8d3c1d;padding:10px;}

/* Normal purchase-style editing: one list for existing and newly added medicines. */
.ph-unified-special .ph-unified-lines{min-width:820px!important}
.ph-unified-special .ph-unified-lines th:last-child{width:38px}
.ph-unified-special .ph-unified-lines td:last-child{width:38px;text-align:center}
.ph-unified-special .ph-unified-lines tr[hidden]{display:none!important}
.ph-unified-special .ph-unified-add-actions{display:flex;gap:10px;flex-wrap:wrap;align-items:center;padding:12px 4px 5px}
.ph-unified-special .ph-unified-search-cell{position:relative}
.ph-unified-special .ph-unified-search-cell>input[type=search]{width:100%;height:35px;padding:5px 7px;border:1px solid #cbd9e9;border-radius:5px;font:inherit;font-size:12px;box-sizing:border-box}
.ph-unified-special .ph-unified-lines .ph-unified-remove{display:inline-flex;justify-content:center;align-items:center;min-width:28px;min-height:33px;padding:3px 6px;border-color:#efcece;color:#ac3434}
.ph-unified-special .ph-unified-live-total{margin-left:0}
@media(max-width:760px){.ph-unified-special .ph-unified-lines{min-width:820px!important;width:820px!important}}


/* NKF PURCHASE EDIT — ACTUAL LINE TOTAL FIX, 05/11/2026.
   Works with BOTH HTML versions:
   - normal table: <table class="compact-line-table" data-line-table>, [data-line-total]
   - special table: <table class="compact-line-table ph-unified-lines">, [data-existing-total]
   The previous fix accidentally limited selectors to [data-line-table] and did
   not cover the special editor. The shared style.css also falsely assigned
   the 7th column 34px as if it were the Remove column, while in purchase
   with MRP column 7 is Total. */
body.app-body .purchase-edit-panel .compact-line-table-wrap,
body.app-body .purchase-edit-panel .ph-unified-lines-scroll {
  display:block !important;
  width:100% !important;
  max-width:100% !important;
  min-width:0 !important;
  box-sizing:border-box !important;
  overflow-x:auto !important;
  -webkit-overflow-scrolling:touch;
}
/* The main purchase form has eight columns (S/L, Medicine, Description,
   Qty, Purchase, MRP, Total, Remove). Give the Total a real 130px width.
   The 900px table fits most desktop content; smaller screens swipe the
   line table only rather than clipping the monetary figures. */
body.app-body .purchase-edit-panel table.compact-line-table {
  width:100% !important;
  min-width:920px !important;
  max-width:none !important;
  table-layout:fixed !important;
  box-sizing:border-box !important;
}
body.app-body .purchase-edit-panel table.compact-line-table:has(thead th:nth-child(8)) thead th:nth-child(1) {width:34px !important;min-width:34px !important;}
body.app-body .purchase-edit-panel table.compact-line-table:has(thead th:nth-child(8)) thead th:nth-child(2) {width:22% !important;}
body.app-body .purchase-edit-panel table.compact-line-table:has(thead th:nth-child(8)) thead th:nth-child(3) {width:20% !important;}
body.app-body .purchase-edit-panel table.compact-line-table:has(thead th:nth-child(8)) thead th:nth-child(4) {width:8% !important;}
body.app-body .purchase-edit-panel table.compact-line-table:has(thead th:nth-child(8)) thead th:nth-child(5) {width:12% !important;}
body.app-body .purchase-edit-panel table.compact-line-table:has(thead th:nth-child(8)) thead th:nth-child(6) {width:13% !important;}
body.app-body .purchase-edit-panel table.compact-line-table:has(thead th:nth-child(8)) thead th:nth-child(7) {width:134px !important;min-width:134px !important;}
body.app-body .purchase-edit-panel table.compact-line-table:has(thead th:nth-child(8)) thead th:nth-child(8) {width:36px !important;min-width:36px !important;}
/* Seven-column legacy version: Total is sixth column, Remove seventh. */
body.app-body .purchase-edit-panel table.compact-line-table:not(:has(thead th:nth-child(8))) thead th:nth-child(6) {width:134px !important;min-width:134px !important;}
body.app-body .purchase-edit-panel table.compact-line-table:not(:has(thead th:nth-child(8))) thead th:nth-child(7) {width:36px !important;min-width:36px !important;}
body.app-body .purchase-edit-panel table.compact-line-table tbody td.line-total {
  width:134px !important;
  min-width:134px !important;
  box-sizing:border-box !important;
  overflow:visible !important;
  padding:0 2px !important;
}
body.app-body .purchase-edit-panel table.compact-line-table tbody td.line-total input,
body.app-body .purchase-edit-panel table.compact-line-table tbody td.line-total input[data-line-total],
body.app-body .purchase-edit-panel table.compact-line-table tbody td.line-total input[data-existing-total] {
  display:block !important;
  width:100% !important;
  min-width:120px !important;
  max-width:none !important;
  box-sizing:border-box !important;
  padding:5px 7px !important;
  font-size:12px !important;
  line-height:20px !important;
  text-align:right !important;
  font-weight:700 !important;
  font-variant-numeric:tabular-nums;
  color:#1e344c !important;
  background:#f4f7fa !important;
  opacity:1 !important;
  text-overflow:clip !important;
}
/* Keep the Remove control separate so it cannot consume the Total width. */
body.app-body .purchase-edit-panel table.compact-line-table tbody td.line-remove,
body.app-body .purchase-edit-panel table.compact-line-table tbody td:last-child:not(.line-total) {
  width:36px !important;
  min-width:36px !important;
  box-sizing:border-box !important;
}
@media (max-width:760px) {
  body.app-body .purchase-edit-panel table.compact-line-table,
  body.app-body .purchase-edit-panel .ph-unified-lines {
    min-width:920px !important;
    width:920px !important;
  }
}

/* =============================================================
   NKF Purchase Invoice EDIT — 5-column compact rows, 05 Nov 2026
   Removes DESCRIPTION from presentation only; underlying input
   and data are not deleted. All figures remain unchanged.
   Works for 8-column Purchase+MRP and older 7-column Purchase.
   Scoped to purchase EDIT so Sales, Add New, and other tables
   do not change.
   ============================================================= */

/* Hide the Description heading and its matching cell in each
   Purchase Edit item row. CSS does not affect form submission. */
body.app-body .purchase-edit-panel .pro-items table.compact-line-table > thead > tr > th:nth-child(3),
body.app-body .purchase-edit-panel .pro-items table.compact-line-table > tbody > tr > td:nth-child(3),
body.app-body .purchase-edit-panel .ph-unified-add-area table.ph-unified-new-lines > thead > tr > th:nth-child(3),
body.app-body .purchase-edit-panel .ph-unified-add-area table.ph-unified-new-lines > tbody > tr > td:nth-child(3) {
  display:none !important;
}

/* With Description hidden, redistribute the space to Medicine
   Name, rates, and particularly TOTAL. Tables remain responsive. */
body.app-body .purchase-edit-panel .pro-items table.compact-line-table {
  table-layout:fixed !important;
  min-width:820px !important;
  width:100% !important;
  max-width:none !important;
  border-collapse:separate;
}
body.app-body .purchase-edit-panel .pro-items table.compact-line-table > thead > tr > th:nth-child(1),
body.app-body .purchase-edit-panel .pro-items table.compact-line-table > tbody > tr > td:nth-child(1) {
  width:36px !important; min-width:36px !important;
}
body.app-body .purchase-edit-panel .pro-items table.compact-line-table > thead > tr > th:nth-child(2) {
  width:34% !important; min-width:220px !important;
}
/* 8 cols: S/L, Medicine, hidden Desc, Qty, Purchase, MRP, Total, Remove */
body.app-body .purchase-edit-panel .pro-items table.compact-line-table:has(thead th:nth-child(8)) > thead > tr > th:nth-child(4) {
  width:10% !important; min-width:74px !important;
}
body.app-body .purchase-edit-panel .pro-items table.compact-line-table:has(thead th:nth-child(8)) > thead > tr > th:nth-child(5),
body.app-body .purchase-edit-panel .pro-items table.compact-line-table:has(thead th:nth-child(8)) > thead > tr > th:nth-child(6) {
  width:15% !important; min-width:115px !important;
}
body.app-body .purchase-edit-panel .pro-items table.compact-line-table:has(thead th:nth-child(8)) > thead > tr > th:nth-child(7) {
  width:148px !important; min-width:148px !important;
}
body.app-body .purchase-edit-panel .pro-items table.compact-line-table:has(thead th:nth-child(8)) > thead > tr > th:nth-child(8) {
  width:38px !important; min-width:38px !important;
}
/* 7 cols: S/L, Medicine, hidden Desc, Qty, Purchase, Total, Remove */
body.app-body .purchase-edit-panel .pro-items table.compact-line-table:not(:has(thead th:nth-child(8))) > thead > tr > th:nth-child(4) {
  width:12% !important; min-width:80px !important;
}
body.app-body .purchase-edit-panel .pro-items table.compact-line-table:not(:has(thead th:nth-child(8))) > thead > tr > th:nth-child(5) {
  width:21% !important; min-width:115px !important;
}
body.app-body .purchase-edit-panel .pro-items table.compact-line-table:not(:has(thead th:nth-child(8))) > thead > tr > th:nth-child(6) {
  width:148px !important; min-width:148px !important;
}
body.app-body .purchase-edit-panel .pro-items table.compact-line-table:not(:has(thead th:nth-child(8))) > thead > tr > th:nth-child(7) {
  width:38px !important; min-width:38px !important;
}
/* Total cell — not to be confused with MRP or delete control. */
body.app-body .purchase-edit-panel .pro-items table.compact-line-table > tbody > tr > td.line-total {
  width:148px !important;
  min-width:148px !important;
  max-width:none !important;
  box-sizing:border-box !important;
  overflow:visible !important;
  padding:0 2px !important;
}
body.app-body .purchase-edit-panel .pro-items table.compact-line-table > tbody > tr > td.line-total > input,
body.app-body .purchase-edit-panel .pro-items table.compact-line-table > tbody > tr > td.line-total input[data-existing-total],
body.app-body .purchase-edit-panel .pro-items table.compact-line-table > tbody > tr > td.line-total input[data-line-total] {
  display:block !important;
  width:100% !important;
  min-width:136px !important;
  max-width:none !important;
  height:35px !important;
  padding:5px 8px !important;
  font-size:12px !important;
  font-weight:700 !important;
  text-align:right !important;
  color:#173654 !important;
  box-sizing:border-box !important;
  text-overflow:clip !important;
  font-variant-numeric:tabular-nums;
  opacity:1 !important;
}
body.app-body .purchase-edit-panel .pro-items table.compact-line-table > tbody > tr > td:last-child:not(.line-total) {
  width:38px !important;
  min-width:38px !important;
  padding:0 1px !important;
}
/* Separate optional add-item table inside Purchase Edit. */
body.app-body .purchase-edit-panel .ph-unified-add-area table.ph-unified-new-lines {
  table-layout:fixed !important;
  width:100% !important;
  min-width:820px !important;
}
body.app-body .purchase-edit-panel .ph-unified-add-area table.ph-unified-new-lines > thead > tr > th:nth-child(2) {
  width:37% !important;
}
body.app-body .purchase-edit-panel .ph-unified-add-area table.ph-unified-new-lines > thead > tr > th:nth-child(4) {
  width:12% !important;
}
body.app-body .purchase-edit-panel .ph-unified-add-area table.ph-unified-new-lines > thead > tr > th:nth-child(5) {
  width:23% !important;
}
body.app-body .purchase-edit-panel .ph-unified-add-area table.ph-unified-new-lines > thead > tr > th:nth-child(6) {
  width:148px !important;
}
body.app-body .purchase-edit-panel .ph-unified-add-area table.ph-unified-new-lines > tbody > tr > td:nth-child(6) input {
  min-width:136px !important;
  width:100% !important;
  text-align:right !important;
}
@media(max-width:760px) {
  body.app-body .purchase-edit-panel .pro-items table.compact-line-table,
  body.app-body .purchase-edit-panel .ph-unified-add-area table.ph-unified-new-lines {
    min-width:820px !important;
    width:820px !important;
  }
}
