/* V15 extends the existing portal palette and typography. */
.v17-subscription .lead-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 16px}
.v17-subscription .lead-wide{grid-column:1/-1}
.v17-subscription label{min-width:0}
.v17-subscription fieldset{min-width:0;border:1px solid var(--border,#d9dfe6);border-radius:6px}
.v17-subscription label:has(input[type=checkbox]){flex-direction:row;align-items:center;justify-content:flex-start}
.v17-subscription input[type=checkbox]{flex:0 0 auto;margin:0}
.v17-subscription [data-remove-contact]{justify-self:start;align-self:center}
.v17-subscription [data-contact]+[data-contact]{border-top:1px solid var(--border,#d9dfe6)}
@media(max-width:720px){.v17-subscription .lead-grid{grid-template-columns:1fr}.v17-subscription .lead-wide{grid-column:1}}
.v13-smart-search{position:relative}
.v13-smart-search>[data-results]:empty{display:none}
label>.v13-smart-search{flex:0 0 auto}
[data-client]>[data-selected]{min-height:18px;margin:8px 0}
.product-quick-upload{display:grid!important;grid-template-columns:repeat(5,minmax(22px,1fr));gap:2px}
.product-quick-upload .btn{padding:2px!important;min-width:0;min-height:22px!important;white-space:nowrap;font-size:12px!important}
.v13-smart-search>[data-results]:not(:empty){position:absolute;left:0;right:0;top:100%;z-index:80;max-height:280px;overflow:auto;background:var(--surface,#fff);border:1px solid var(--border,#d9dfe6);box-shadow:0 4px 12px #0002}
.v13-smart-search>[data-results] .btn{display:block;width:100%;text-align:left;padding:3px 6px;min-height:26px}
.v13-smart-search .btn{min-height:34px;box-sizing:border-box}
#appShell>main,.tab-panel,.table-wrap{min-width:0;max-width:100%}
.table-wrap{overflow-x:auto}
/* V17: keep the horizontal scrollbar in view even with a long registry. */
#tab-registry{min-width:0;max-width:100%}
#tab-registry>.table-wrap{max-width:100%;max-height:65vh;overflow:auto;scrollbar-gutter:stable;overscroll-behavior:contain}
#purchasesTable{width:max-content;min-width:100%}
#purchasesTable th:first-child,#purchasesTable td:first-child{width:60px;min-width:60px;max-width:60px;white-space:normal;overflow-wrap:anywhere;padding-inline:4px}
#purchasesTable th:first-child input{width:52px;min-width:0;box-sizing:border-box}
#purchasesTable th:first-child button{white-space:normal;max-width:60px;overflow-wrap:anywhere}
.v13-tree details{padding:3px 4px;margin:3px 0}
.v13-tree summary{min-height:24px}
.product-spec-table small{display:block}
.product-details-table input:not([type=checkbox]),.product-details-table textarea{min-height:28px!important;height:28px;box-sizing:border-box;padding:3px 5px}
.product-details-table textarea:focus{height:64px}
.product-details-table td,.product-details-table th{padding:3px 4px}
.product-details-table td:first-child{min-width:145px}
.product-quick-upload{display:flex;flex-wrap:wrap;gap:3px;max-width:200px}
.product-quick-upload .btn{font-size:12px;padding:2px 4px;min-height:24px}
.v15-equipment{display:flex;flex-direction:column;gap:8px}
.v15-equipment [data-cu-filters]{grid-template-columns:1fr}
.ds-split>[data-table]{min-width:0;overflow:hidden}
.ds-config .v15-equipment [name=qty],.ds-config .v15-equipment [name=discount_pct]{width:100%}
.product-toolbar{align-items:center;gap:6px;flex-wrap:wrap}
.product-toolbar label.btn{margin:0}
.product-toolbar a.btn,.sales-box a.btn{display:inline-flex;align-items:center;min-height:32px;padding:6px 12px;border-radius:6px;color:inherit;background:var(--surface-alt,#f0f0f0);text-decoration:none;box-sizing:border-box}
.product-toolbar input[type=file]{max-width:220px}
.sales-box .row-actions>.btn{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;min-height:32px;line-height:1.2;margin:2px 0}
@media(min-width:721px){.v13-menu-toggle{display:none!important}}
[hidden]{display:none!important}
.ds-config form>label[hidden],.ds-config [hidden],.v15-equipment [hidden]{display:none!important}
.ds-requisites{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 16px;align-items:start}
.ds-requisites>p,.ds-requisites>.ds-wide,.ds-requisites>.ds-all{grid-column:1/-1;margin:0}
.ds-requisites>label{min-height:34px;grid-template-columns:145px minmax(0,1fr)}
.ds-requisites input,.ds-requisites select{box-sizing:border-box;min-height:32px;width:100%}
.ds-requisites textarea{box-sizing:border-box;width:100%}
.ds-requisites>label.ds-check{align-self:center}
.ds-requisites>label.ds-check input{width:auto;min-height:0}
@media(max-width:720px){.ds-requisites{grid-template-columns:minmax(0,1fr)}}
.v15-tree-row{display:flex;align-items:center;gap:8px;padding:2px 4px;flex-wrap:wrap}
.v15-tree-row .v13-tree-lead{flex:1;text-align:left;min-width:180px;font:inherit;padding:3px 6px}
.v15-tree-actions{display:inline-flex;gap:3px;margin-left:auto}
.v15-tree-action{padding:2px 6px;min-height:26px}
.v13-tree summary{display:flex;align-items:center;gap:6px;padding:4px;cursor:pointer}
.v13-tree details details{margin-left:16px}
.v15-folder-icon{display:inline-block;width:14px;height:10px;border:1px solid currentColor;border-radius:2px;position:relative;flex:none}
.v15-folder-icon:before{content:"";position:absolute;left:0;top:-4px;width:6px;height:3px;border:1px solid currentColor;border-bottom:0;border-radius:2px 2px 0 0}
.v15-description{font:inherit;white-space:pre-wrap;overflow-wrap:anywhere}
.product-number-list{display:block;margin-top:4px;white-space:normal;overflow-wrap:anywhere}
[data-cu-filters]{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.v15-equipment label{min-width:0}
.v15-equipment select{max-width:100%}
.lead-table td,.lead-table th,.registry-table td,.registry-table th{padding-top:5px;padding-bottom:5px}
.v15-equipment input,[data-price-group]{max-width:100%}
@media(max-width:760px){
  [data-cu-filters]{grid-template-columns:repeat(2,minmax(0,1fr))}
  .v15-tree-actions{margin-left:0}
  .v15-tree-action{min-width:38px;min-height:38px}
  .v13-tree details details{margin-left:8px}
  .v15-tree-row .hint{flex-basis:100%}
}
/* Dense operational lists; keep full text available instead of truncating it. */
.table-wrap th,.table-wrap td,.sales-table-wrap th,.sales-table-wrap td{padding:5px 7px;vertical-align:top}
.v15-filter-row input{width:100%;min-width:55px;box-sizing:border-box;padding:4px 6px;font-size:12px}
.v15-sort{font:inherit;color:inherit;background:none;border:0;padding:0;text-align:left;cursor:pointer}
#suppliersGrid{display:block;overflow:auto}
#suppliersGrid table{width:100%;border-collapse:collapse}
#purchasesTable td:nth-child(1),#purchasesTable th:nth-child(1){width:65px}
#purchasesTable td:nth-child(2),#purchasesTable th:nth-child(2){width:125px;white-space:normal}
#purchasesTable td:nth-child(4),#purchasesTable th:nth-child(4){width:110px;white-space:normal}
.v15-purchase-summary{display:flex;gap:14px;align-items:center;flex-wrap:wrap}
.v15-purchase-summary h2{font-size:22px;margin:6px 0}
#purchaseForm{min-width:0}
#purchaseForm .purchase-items-table,#requestForm .purchase-items-table{table-layout:fixed;width:100%;min-width:0}
#purchaseForm .purchase-items-table td,#requestForm .purchase-items-table td{overflow-wrap:anywhere;white-space:normal}
#purchaseForm .purchase-items-table th,#requestForm .purchase-items-table th{overflow-wrap:anywhere;white-space:normal}
#purchaseForm .purchase-items-table button,#requestForm .purchase-items-table button{min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere}
#purchaseForm .purchase-items-table textarea,#requestForm .purchase-items-table textarea{min-height:38px;height:38px}
#purchaseForm .purchase-items-table input,#requestForm .purchase-items-table input{min-height:38px;height:38px}
#purchaseForm textarea,#purchaseForm input,#purchaseForm select{max-width:100%;box-sizing:border-box}
#purchaseForm textarea{min-height:38px}
#purchaseForm .modal-footer,#requestForm .modal-footer{flex-wrap:wrap}
#purchaseForm .modal-footer .btn,#requestForm .modal-footer .btn{max-width:100%;white-space:normal}
.draft-status{grid-column:1/-1;white-space:normal}
.portal-navigation .section-btn,.portal-navigation .tab-btn{text-transform:uppercase;border-bottom:0}
.v13-smart-search{display:grid;grid-template-columns:minmax(160px,1fr) auto;gap:6px;align-items:end}
.v13-smart-search [data-results]{grid-column:1/-1}
.v13-smart-search input,input[type=search]{min-height:34px;font-size:14px}
#purchasesTable tbody td:nth-child(3),#purchasesTable th:nth-child(3){white-space:normal;min-width:220px;max-width:none}
#purchasesTable tbody td:nth-child(3) br,#ordersTable tbody td:nth-child(4) br{display:block}
#ordersTable tbody td:nth-child(4){white-space:normal;max-width:none}
[data-new-contract]{display:flex;align-items:end;gap:8px;flex-wrap:wrap}
[data-new-contract] label{flex:1 1 240px;margin:0}
.ds-grid .lead-table{table-layout:auto;min-width:1080px}
.ds-grid .lead-table th,.ds-grid .lead-table td{overflow:visible;text-overflow:clip}
.ds-grid .lead-table th:first-child{width:30px}
.ds-grid .lead-table th:nth-child(2){width:40%;min-width:270px}
.ds-grid .lead-table td:nth-child(2){white-space:normal;min-width:270px;max-width:600px;overflow-wrap:anywhere}
.ds-grid .lead-table th:nth-child(3),.ds-grid .lead-table td:nth-child(3){width:auto;min-width:50px}
.ds-grid .lead-table th:nth-child(n+4){width:auto;min-width:65px}
.ds-grid .lead-table td[data-cell=price],.ds-grid .lead-table td[data-cell=priceBase],.ds-grid .lead-table td[data-cell=total]{min-width:95px}
@media(max-width:720px){
  #appShell.v13-menu-collapsed,#appShell:not(.v13-menu-collapsed){grid-template-columns:58px minmax(0,1fr)}
  #appShell>.portal-navigation{z-index:20;background:var(--bg,#f4f5fa)}
  #appShell:not(.v13-menu-collapsed)>.portal-navigation{width:220px;box-sizing:border-box;box-shadow:6px 0 18px #0002}
  .v13-smart-search{grid-template-columns:minmax(0,1fr) auto}
  .v13-smart-search input,.v13-smart-search label{min-width:0;max-width:100%;box-sizing:border-box}
  .v15-tree-row .v13-tree-lead{min-width:0}
  #purchaseForm .purchase-items-table thead,#requestForm .purchase-items-table thead{display:none}
  #purchaseForm .purchase-items-table tr,#requestForm .purchase-items-table tr{display:grid;grid-template-columns:1fr 1fr;height:auto;gap:6px;border-bottom:1px solid var(--border,#d9dfe6);padding:8px 0}
  #purchaseForm .purchase-items-table td,#requestForm .purchase-items-table td{display:block;width:auto;min-width:0;padding:2px!important}
  #purchaseForm .purchase-items-table td::before,#requestForm .purchase-items-table td::before{content:attr(data-label);display:block;font-size:12px}
  #purchaseForm .purchase-items-table td:nth-child(2),#requestForm .purchase-items-table td:nth-child(2){grid-column:1/-1}
  .sales-flow-dialog{width:94vw;box-sizing:border-box}
  .v15-purchase-summary{gap:6px}
}
