/* Editable controls need their own column geometry; read-only reports stay compact. */
html.olap-up #root table:has(tbody :is(input,select,textarea)){
  table-layout:auto!important;
  width:max-content!important;
  min-width:100%;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) :is(th,td){
  width:auto!important;
  min-width:80px;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) td{
  vertical-align:top;
  padding:8px 10px;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) td :is(input:not([type=checkbox]),select,textarea){
  max-width:100%;
  box-sizing:border-box;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) td input[type=date]{
  min-width:155px;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) td .input-group{
  min-width:220px;
  flex-wrap:nowrap;
}

/* Use the cell width instead of per-input inline widths in characters. */
html.olap-up #root table:has(tbody :is(input,select,textarea)) td :is(input.form-control:not([type=color]),select.form-control,textarea.form-control){
  width:100%!important;
  max-width:100%;
  box-sizing:border-box;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) td > :is(.input-group,[class$="-container"]){
  width:100%!important;
  max-width:100%;
  box-sizing:border-box;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) td .input-group > input.form-control{
  width:1%!important;
  flex:1 1 auto;
}

/* Center editable values consistently across deal and refund forms. */
html.olap-up #root table:has(tbody :is(input,select,textarea)) :is(th,td),
html.olap-up #root table:has(tbody :is(input,select,textarea)) :is(input:not([type=checkbox]):not([type=color]),select,textarea){
  text-align:center!important;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) :is([class$="-singleValue"],[class$="-placeholder"],[role=option]){
  text-align:center!important;
  justify-self:center;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) input[type=date]::-webkit-date-and-time-value{
  text-align:center;
}
/* The create-refund dialog is rendered outside #root. */
html.olap-up .modal:has(#pv) :is(input.form-control,textarea.form-control,select.form-control){
  width:100%!important;
  max-width:100%;
  box-sizing:border-box;
  text-align:center!important;
}
html.olap-up .modal:has(#pv) :is(.form-label,.modal-title){
  display:block;
  width:100%;
  text-align:center!important;
}

/* React Select renders its options in a portal outside the table. */
html.olap-up [role=listbox] [role=option]{text-align:center!important;}

/* Shared visual tokens for editable deal and refund controls. */
html.olap-up{
  --up-field-height:36px;
  --up-field-radius:8px;
  --up-field-border:#d5dbe7;
  --up-field-font:14px;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) td :is(input.form-control:not([type=color]),select.form-control),
html.olap-up .modal:has(#pv) :is(input.form-control,select.form-control){
  height:var(--up-field-height)!important;
  min-height:var(--up-field-height)!important;
  font-family:inherit!important;
  font-size:var(--up-field-font)!important;
  font-weight:400!important;
  line-height:20px!important;
  padding:7px 10px!important;
  border:1px solid var(--up-field-border)!important;
  border-radius:var(--up-field-radius)!important;
  box-shadow:none;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) td{
  font-size:var(--up-field-font)!important;
  line-height:20px!important;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) td:not(:has(input,select,textarea)){
  padding-top:16px;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) input[type=date]::-webkit-datetime-edit{
  padding:0;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) td .input-group{
  height:var(--up-field-height);
  border:1px solid var(--up-field-border);
  border-radius:var(--up-field-radius);
  background:#fff;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) td .input-group > .input-group-text{
  height:34px;
  width:40px;
  min-width:40px;
  padding:0;
  justify-content:center;
  border:0;
  border-right:1px solid var(--up-field-border);
  border-radius:7px 0 0 7px;
  background:#f8fafc;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) td .input-group > input.form-control{
  height:34px!important;
  min-height:34px!important;
  border:0!important;
  border-radius:0 7px 7px 0!important;
  padding:6px 10px!important;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) .form-check-input{
  width:16px;height:16px;min-height:0;margin:0;border-radius:4px;
}
/* React Select uses its own control and inner input; style the outer box only. */
html.olap-up #root table:has(tbody :is(input,select,textarea)) td [class$="-control"]{
  height:var(--up-field-height)!important;
  min-height:var(--up-field-height)!important;
  border:1px solid var(--up-field-border)!important;
  border-radius:var(--up-field-radius)!important;
  font-family:inherit!important;
  font-size:var(--up-field-font)!important;
  font-weight:400!important;
  line-height:20px!important;
  background:#fff;
  box-shadow:none;
  align-items:center;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) td [class$="-control"]>div:first-child{
  padding:0 10px!important;
  margin:0!important;
  min-height:0;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) td [class$="-control"] [class$="-singleValue"],
html.olap-up #root table:has(tbody :is(input,select,textarea)) td [class$="-control"] [class$="-placeholder"]{
  font:inherit!important;
  line-height:20px!important;
  margin:0!important;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) td [class$="-control"] input{
  font:inherit!important;
  line-height:20px!important;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) td :is(input.form-control,select.form-control):focus,
html.olap-up .modal:has(#pv) :is(input.form-control,select.form-control):focus,
html.olap-up #root table:has(tbody :is(input,select,textarea)) td [class$="-control"]:focus-within{
  border-color:#5076dd!important;
  outline:0;
  box-shadow:0 0 0 3px rgb(41 82 204 / 12%)!important;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) td input:disabled{
  background-color:#f1f3f7!important;
  color:#64748b;
}
/* Keep color presets on one line instead of stretching the entire edit row. */
html.olap-up #root table:has(tbody :is(input,select,textarea)) td:has(>input[type=color]){
  white-space:nowrap;
  min-width:202px;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) td:has(>input[type=color])>input[type=color]{
  display:inline-block!important;
  width:40px!important;height:36px!important;
  padding:4px!important;
  border-radius:8px!important;
  margin:0 5px 0 0!important;
  vertical-align:middle;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) td:has(>input[type=color])>.btn{
  display:inline-block!important;
  width:20px!important;min-width:20px!important;height:20px!important;
  padding:0!important;margin:0 3px!important;
  border-radius:5px!important;
  vertical-align:middle;
}
html.olap-up [role=listbox] [role=option]{font-size:14px;line-height:20px;}

html.olap-up #root table:has(tbody :is(input,select,textarea)) th{
  font-size:14px!important;
  line-height:20px!important;
  font-weight:600;
  padding-top:12px!important;
  padding-bottom:12px!important;
}
html.olap-up #root:has(table tbody :is(input,select,textarea)) center > button.btn{
  height:36px;
  border-radius:8px;
  padding:7px 12px;
  font-size:14px;
  line-height:20px;
}

/* Keep common control styling, but size each column for its content and task. */
html.olap-up #root table[data-up-edit-layout]{
  table-layout:fixed!important;
  width:var(--up-edit-width)!important;
  min-width:var(--up-edit-width)!important;
  max-width:var(--up-edit-width)!important;
}
html.olap-up #root table[data-up-edit-layout] :is(th,td)[data-up-column]{
  width:var(--up-column-width)!important;
  min-width:0!important;
  max-width:var(--up-column-width)!important;
  box-sizing:border-box;
  overflow-wrap:anywhere;
}
html.olap-up #root table[data-up-edit-layout] td{padding-left:8px;padding-right:8px;}
html.olap-up #root table[data-up-edit-layout] th{padding-left:8px!important;padding-right:8px!important;}
html.olap-up #root table[data-up-edit-layout] td :is(input.form-control:not([type=color]),select,textarea,.input-group,[class$="-container"]){
  min-width:0!important;
}
html.olap-up #root table[data-up-edit-layout] td .input-group{width:100%!important;min-width:0!important;}
html.olap-up #root table[data-up-edit-layout] td [class$="-control"]>div{min-width:0;}
html.olap-up #root [data-up-edit-scroll]{scrollbar-gutter:auto;scrollbar-width:none;}
/* Preserve native scrolling; hide its duplicate track beside the accessible controls. */
html.olap-up #root [data-up-edit-scroll]::-webkit-scrollbar{display:none;width:0;height:0;}
html.olap-up #root .up-edit-scrollbar{
  display:flex;align-items:center;gap:10px;width:100%;max-width:100%;
  margin:8px 0 4px;padding:0 2px;box-sizing:border-box;
}
html.olap-up #root .up-edit-scrollbar[hidden]{display:none;}
html.olap-up #root .up-edit-scrollbar button{
  flex:0 0 40px;height:32px;min-width:40px;padding:0;border:1px solid #d5dbe7;
  border-radius:8px;background:#fff;color:#2952cc;font-family:inherit;font-size:20px;line-height:30px;font-weight:600;cursor:pointer;
}
html.olap-up #root .up-edit-scrollbar button:disabled{opacity:.4;cursor:default;}
html.olap-up #root .up-edit-scrollbar button:hover:not(:disabled){background:#edf2ff;}
html.olap-up #root .up-edit-scrollbar input[type=range]{
  display:block;flex:1 1 auto;width:0;min-width:0;height:26px;margin:0;padding:0;
  accent-color:#5076dd;cursor:ew-resize;
}
html.olap-up #root .up-edit-scrollbar :focus-visible{outline:2px solid #5076dd;outline-offset:2px;}

/* The receipt action belongs to the saved-deal list, not data-entry forms.
   Keep the existing React input/state intact so editing cannot erase its value. */
html.olap-up #root table[data-up-edit-layout] [data-up-column="чек"]{display:none!important;}

/* Saved rows retain report filter classes while React opens the editor.
   Override those report-only offsets and indicators without changing list headers. */
html.olap-up #root table[data-up-edit-layout]:has(tbody :is(input,select,textarea)) thead th[data-up-column]{
  padding:12px 8px!important;
  text-align:center!important;
  vertical-align:middle!important;
  overflow-wrap:normal!important;
  word-break:normal!important;
}
html.olap-up #root table[data-up-edit-layout]:has(tbody :is(input,select,textarea)) thead th[data-up-column]::before,
html.olap-up #root table[data-up-edit-layout]:has(tbody :is(input,select,textarea)) thead th[data-up-column]::after{
  content:none!important;
  display:none!important;
}
html.olap-up #root table[data-up-edit-layout]:has(tbody :is(input,select,textarea)) thead th[data-up-column] .akf-btn{
  display:none!important;
}
/* Fields, calculated amounts and contact text share the same vertical center. */
html.olap-up #root table[data-up-edit-layout]:has(tbody :is(input,select,textarea)) tbody td[data-up-column]{
  padding:8px!important;
  vertical-align:middle!important;
  text-align:center!important;
}

/* This preset resets the row to white; keep it visible on every row background. */
html.olap-up #root table:has(tbody :is(input,select,textarea)) td:has(>input[type=color])>.btn-secondary{
  background:#fff!important;
  border:1px solid #8792a2!important;
}
html.olap-up #root table:has(tbody :is(input,select,textarea)) td:has(>input[type=color])>.btn-secondary:hover{
  background:#fff!important;
  border-color:#2952cc!important;
  box-shadow:0 0 0 2px rgb(41 82 204 / 15%);
}

/* Bootstrap 5.1 adds a currentColor (black) tbody divider. In collapsed
   tables its intersections leak through sticky headers while scrolling. */
html.olap-up #root :is(table.sale5table,table.sale6table,table.sale7table)>tbody{
  border-top:1px solid #dde3f0!important;
}
