/* KOVLEON fluid layout: remove horizontal page navigation and avoid desktop-only sideways scrolling.
   Loaded last so modules inherit one responsive system without changing business data or actions. */

html,body{max-width:100%;overflow-x:hidden}

/* Navigation: every destination stays visible. Tabs wrap into calm rows instead of a horizontal rail. */
.dw-tabs,.wh-tabs,.loan-center-tabs,.bank-workspace-nav,.dr-switch,.kpss-center-tabs,.op-tabs,.dashboard-news-categories{
  max-width:100%;
  overflow:visible!important;
  flex-wrap:wrap!important;
  white-space:normal!important;
}
.dw-tabs{
  position:relative;
  gap:8px;
  border:1px solid rgba(91,130,177,.22);
  padding:8px;
  background:
    radial-gradient(circle at 18% -35%,rgba(77,158,255,.14),transparent 34%),
    linear-gradient(180deg,rgba(248,251,255,.96),rgba(239,245,252,.96));
  border-radius:16px;
  box-shadow:
    0 10px 28px rgba(29,55,88,.07),
    inset 0 1px 0 rgba(255,255,255,.9),
    inset 0 -1px 0 rgba(104,143,188,.08);
}
.dw-tabs::before{
  content:'';
  position:absolute;
  inset:0;
  pointer-events:none;
  border-radius:inherit;
  background:linear-gradient(112deg,transparent 0 38%,rgba(255,255,255,.5) 48%,transparent 58% 100%);
  opacity:.45;
}
.dw-tab{
  position:relative;
  z-index:1;
  flex:1 1 145px;
  min-width:0;
  min-height:48px;
  display:flex;
  align-items:center;
  justify-content:center;
  white-space:normal!important;
  text-align:center;
  line-height:1.2;
  padding:11px 12px;
  color:#536b87;
  background:
    linear-gradient(180deg,rgba(255,255,255,.98),rgba(246,249,253,.94));
  border:1px solid rgba(112,143,180,.22);
  border-radius:11px;
  box-shadow:
    0 3px 10px rgba(31,60,96,.05),
    inset 0 1px 0 rgba(255,255,255,.95);
  font-weight:750;
  letter-spacing:.005em;
  cursor:pointer;
  transition:
    transform .16s ease,
    color .16s ease,
    border-color .16s ease,
    background .16s ease,
    box-shadow .16s ease;
}
.dw-tab::after{
  content:'';
  position:absolute;
  left:18%;
  right:18%;
  bottom:5px;
  height:2px;
  border-radius:999px;
  background:linear-gradient(90deg,transparent,rgba(39,114,205,.42),transparent);
  opacity:0;
  transform:scaleX(.65);
  transition:opacity .16s ease,transform .16s ease;
}
.dw-tab:hover{
  color:#1f5d9f;
  border-color:rgba(73,132,201,.5);
  background:linear-gradient(180deg,#fff,#f1f7ff);
  box-shadow:
    0 7px 18px rgba(37,91,151,.11),
    0 0 0 1px rgba(113,172,236,.08),
    inset 0 1px 0 #fff;
  transform:translateY(-1px);
}
.dw-tab:hover::after{opacity:1;transform:scaleX(1)}
.dw-tab[aria-selected="true"]{
  color:#fff;
  border-color:rgba(42,108,190,.72);
  background:
    radial-gradient(circle at 22% 0,rgba(117,192,255,.34),transparent 34%),
    linear-gradient(135deg,#123b70 0%,#1769c8 62%,#2584e7 100%);
  box-shadow:
    0 10px 24px rgba(20,88,166,.24),
    0 0 0 1px rgba(82,157,241,.15),
    inset 0 1px 0 rgba(255,255,255,.3),
    inset 0 -8px 18px rgba(6,49,105,.16);
  text-shadow:0 1px 2px rgba(4,31,68,.3);
  transform:translateY(-1px);
}
.dw-tab[aria-selected="true"]::after{
  left:24%;
  right:24%;
  opacity:1;
  transform:scaleX(1);
  background:linear-gradient(90deg,transparent,rgba(203,232,255,.95),transparent);
}
.dw-tab:focus-visible{
  outline:0;
  border-color:#4c9cff;
  box-shadow:
    0 0 0 3px rgba(53,139,238,.2),
    0 8px 20px rgba(34,92,158,.15);
}
@media(prefers-reduced-motion:reduce){
  .dw-tab,.dw-tab::after{transition:none}
  .dw-tab:hover,.dw-tab[aria-selected="true"]{transform:none}
}
.wh-tabs{gap:6px;border-bottom:0;padding:5px;background:#f4f7fb;border-radius:11px}
.wh-tabs button{flex:1 1 135px;min-width:0;white-space:normal!important;border-radius:8px;border-bottom:0!important}
.loan-center-tab{flex:1 1 135px;min-width:0;white-space:normal;text-align:center}
.bank-workspace-nav button{flex:1 1 150px;min-width:0;white-space:normal}
.dr-switch{width:100%}
.dr-switch button{flex:1 1 150px;min-width:0;white-space:normal}
.kpss-center-tabs,.op-tabs,.dashboard-news-categories{gap:6px;overflow:visible!important;scrollbar-width:auto!important}
.kpss-center-tabs button,.op-tabs button,.dashboard-news-categories button,.dashboard-news-categories a{
  flex:1 1 135px;min-width:0;max-width:100%;white-space:normal!important;text-align:center
}

/* CRM kanban keeps every stage on-screen by wrapping columns into a grid. */
.crm-board{
  display:grid!important;
  grid-template-columns:repeat(auto-fit,minmax(235px,1fr));
  gap:11px;
  overflow:visible!important;
  scroll-snap-type:none!important;
  padding-bottom:2px!important;
}
.crm-board-column{width:auto!important;min-width:0!important;max-width:none!important;flex:none!important}

/* Standard registries: desktop tables use the width they actually have instead of an artificial minimum. */
@media screen and (min-width:769px){
  .deals-table-wrap,.counterparty-table-wrap,.loan-table-wrap,.loan-lender-inner,
  .dr-table-scroll,.bank-center-table-wrap,.loan-center-report-wrap,.wh-table-scroll,
  .kv-registry-table-shell,.korvex-table-wrap,.power-table-wrap,.dw-table-wrap,.deal-detail-scroll,
  .saas-table-wrap,.platform-console .saas-table-wrap{
    max-width:100%;
    overflow-x:visible!important;
  }

  #dealsTable,#counterpartiesTable,#loansTable,.loan-lender-inner table,
  .dr-table,.bank-center-table-wrap table,.loan-center-report-table,.wh-table,
  .kv-registry-table-shell table,.korvex-table-wrap table,.power-table-wrap table,.dw-table,
  .deal-detail-block table,.saas-table-wrap table,.platform-console .saas-table-wrap table{
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    table-layout:fixed;
  }

  #dealsTable th,#dealsTable td,#counterpartiesTable th,#counterpartiesTable td,
  #loansTable th,#loansTable td,.loan-lender-inner th,.loan-lender-inner td,
  .dr-table th,.dr-table td,.bank-center-table-wrap th,.bank-center-table-wrap td,
  .loan-center-report-table th,.loan-center-report-table td,.wh-table th,.wh-table td,
  .kv-registry-table-shell th,.kv-registry-table-shell td,.korvex-table-wrap th,.korvex-table-wrap td,
  .power-table-wrap th,.power-table-wrap td,.dw-table th,.dw-table td,.deal-detail-block th,.deal-detail-block td,
  .saas-table-wrap th,.saas-table-wrap td,.platform-console .saas-table-wrap th,.platform-console .saas-table-wrap td{
    min-width:0!important;
    max-width:none!important;
    white-space:normal!important;
    overflow-wrap:anywhere;
    word-break:normal;
  }

  .deal-title,.deal-row-actions,.deal-cell-stack,.deal-progress,.deal-inline-status{
    min-width:0!important;
    max-width:100%;
  }
  .deal-money-main,.deal-finance-badge,.deal-status{white-space:normal!important}
  .deal-row-actions .btn,.wh-row-action,.bank-center-action{white-space:normal!important;max-width:100%}
}

/* Laptop/low-resolution Windows: existing labelled registry tables become cards before they need a scrollbar. */
@media screen and (min-width:769px) and (max-width:1180px){
  #mainApp .kv-mobile-registry-wrap{
    width:100%!important;max-width:100%!important;min-width:0!important;
    overflow:visible!important;border:0!important;background:transparent!important;
  }
  #mainApp table.kv-mobile-registry{
    display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;
    margin:0!important;table-layout:auto!important;border:0!important;background:transparent!important;
    overflow:visible!important;white-space:normal!important;
  }
  #mainApp table.kv-mobile-registry>colgroup,
  #mainApp table.kv-mobile-registry>thead{display:none!important}
  #mainApp table.kv-mobile-registry>tbody{
    display:grid!important;grid-template-columns:repeat(auto-fit,minmax(310px,1fr));
    gap:10px;width:100%;min-width:0;
  }
  #mainApp table.kv-mobile-registry>tbody>tr{
    display:grid!important;grid-template-columns:minmax(0,1fr);
    width:100%;min-width:0;padding:8px 13px;border:1px solid #dce4ed;border-radius:12px;
    background:#fff;box-shadow:0 2px 8px rgba(15,52,96,.05);overflow:visible;
  }
  #mainApp table.kv-mobile-registry>tbody>tr>td{
    display:grid!important;grid-template-columns:minmax(105px,38%) minmax(0,1fr);
    align-items:start!important;gap:10px;min-width:0!important;width:100%!important;height:auto!important;
    padding:9px 0!important;margin:0!important;border:0!important;border-bottom:1px solid #edf1f5!important;
    background:transparent!important;font-size:12px;line-height:1.4;text-align:left!important;
    vertical-align:top!important;overflow-wrap:anywhere;white-space:normal!important;
  }
  #mainApp table.kv-mobile-registry>tbody>tr>td:last-child{border-bottom:0!important}
  #mainApp table.kv-mobile-registry>tbody>tr>td::before{
    content:attr(data-kv-label);display:block;min-width:0;color:#667085;font-size:10px;
    line-height:1.4;font-weight:700;overflow-wrap:anywhere;
  }
  #mainApp table.kv-mobile-registry>tbody>tr>td>*{min-width:0;max-width:100%}
  #mainApp table.kv-mobile-registry>tbody>tr.kv-mobile-wide-row{display:block!important;padding:0;border:0;background:transparent;box-shadow:none}
  #mainApp table.kv-mobile-registry>tbody>tr>td.kv-mobile-wide-cell{display:block!important;padding:12px!important;border:1px solid #dce4ed!important;border-radius:11px;background:#fff!important}
  #mainApp table.kv-mobile-registry>tbody>tr>td.kv-mobile-wide-cell::before{display:none!important}
  #mainApp table.kv-mobile-registry>tbody>tr.loan-lender-detail-row:not(.show){display:none!important}
  #mainApp table.kv-mobile-registry>tbody>tr.loan-lender-detail-row.show{display:block!important;padding:0!important;border:0!important;background:transparent!important;box-shadow:none!important}
}

/* Dense matrix editors: preserve every column but fit it to the viewport instead of forcing an artificial rail. */
@media screen and (min-width:900px){
  .kpss-table-wrap,.estimate-section-table-wrap,.estimate-import-preview,
  #estimateModal[data-layout-mode="combined"] .estimate-section-table-wrap{
    max-width:100%;overflow-x:visible!important;
  }
  .kpss-table{
    width:100%!important;min-width:0!important;table-layout:fixed!important;
  }
  .kpss-table th,.kpss-table td{
    white-space:normal!important;overflow-wrap:anywhere;
    padding:5px 4px!important;font-size:10px!important;
  }
  .kpss-table th:first-child,.kpss-table td:first-child{
    min-width:0!important;max-width:none!important;width:22%;
  }
  .kpss-value-btn{white-space:normal!important;font-size:10px}

  .estimate-editor-table,
  #estimateModal[data-layout-mode="combined"] .estimate-editor-table{
    width:100%!important;min-width:0!important;table-layout:fixed!important;
  }
  .estimate-editor-table th{
    white-space:normal!important;overflow-wrap:anywhere;line-height:1.2;
    padding:5px 3px!important;font-size:8px!important;
  }
  .estimate-editor-table td{min-width:0!important;padding:4px 3px!important}
  .estimate-editor-table input,.estimate-editor-table select{
    min-width:0!important;width:100%!important;padding:5px 3px!important;font-size:10px!important;
  }
  .estimate-editor-table .est-name,.estimate-editor-table .estimate-name,
  .estimate-editor-table .estimate-code,.estimate-editor-table .estimate-item-type,
  .estimate-editor-table .estimate-unit,.estimate-editor-table .estimate-qty,
  .estimate-editor-table .estimate-cost,.estimate-editor-table .estimate-price,
  #estimateModal[data-layout-mode="combined"] .estimate-name,
  #estimateModal[data-layout-mode="combined"] .estimate-comment{
    min-width:0!important;
  }
  .estimate-calc{white-space:normal!important;font-size:10px!important}
  .estimate-import-preview table{width:100%!important;min-width:0!important;table-layout:fixed}
  .estimate-import-preview th,.estimate-import-preview td{white-space:normal!important;overflow-wrap:anywhere}
}

/* Never let one control widen the page. */
img,svg,canvas{max-width:100%}


/* Standalone estimate workspace: the section list itself must not recreate a horizontal rail. */
body.estimate-editor-page{overflow-x:hidden!important}
body.estimate-editor-page .estimate-editor-sections{overflow-x:visible!important;max-width:100%}

/* Timesheet already has a complete card/calendar representation.
   Use it on normal laptop widths rather than forcing 31 day-columns sideways. */
@media screen and (min-width:721px) and (max-width:1800px){
  #timesheetWorkspace .ts-table-wrap{display:none!important}
  #timesheetWorkspace .ts-mobile-cards{display:block!important}
  #timesheetWorkspace .ts-mobile-fields{grid-template-columns:repeat(3,minmax(0,1fr))}
  #timesheetWorkspace .ts-mobile-calendar{grid-template-columns:repeat(7,minmax(0,1fr))}
}

/* Administration tables follow the same registry rule. */
@media screen and (min-width:769px){
  .saas-table-wrap,.platform-console .saas-table-wrap{overflow-x:visible!important;max-width:100%}
  .saas-table-wrap table,.platform-console .saas-table-wrap table{
    width:100%!important;min-width:0!important;max-width:100%!important;table-layout:fixed
  }
  .saas-table-wrap th,.saas-table-wrap td,.platform-console .saas-table-wrap th,.platform-console .saas-table-wrap td{
    white-space:normal!important;overflow-wrap:anywhere;min-width:0!important
  }
}
