/* ConstructNav v0.9.2.71 — wide estimate workspace.
   This layer changes only the working interface. Proposal and workbook output stay untouched. */

#estimating.cn-ew-enhanced{
  --cn-ew-navy:#072747;
  --cn-ew-blue:#135f94;
  --cn-ew-blue-soft:#eaf4fb;
  --cn-ew-line:#d7e2ec;
  --cn-ew-sheet:#f7f9fc;
  --cn-ew-selected:#edf8f2;
  --cn-ew-selected-line:#2b9462;
}

#estimating.cn-ew-enhanced .estimating-mode-tabs{
  align-items:center;
  background:#fff;
  border:1px solid var(--cn-ew-line);
  border-radius:12px 12px 0 0;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:0;
  padding:10px 12px;
}

.cn-ew-toolbar{
  align-items:center;
  background:linear-gradient(100deg,#072747,#0d3b66);
  border-radius:0 0 12px 12px;
  box-shadow:0 8px 24px rgba(7,39,71,.14);
  color:#fff;
  display:flex;
  gap:16px;
  justify-content:space-between;
  margin:0 0 14px;
  min-height:64px;
  padding:10px 12px;
  position:relative;
  z-index:30;
}

.cn-ew-toolbar-title{
  align-items:center;
  display:flex;
  flex:0 0 auto;
  gap:10px;
  min-width:220px;
}

.cn-ew-toolbar-title>span:last-child{
  display:grid;
  gap:2px;
}

.cn-ew-toolbar-title strong{
  font-size:14px;
  letter-spacing:.01em;
}

.cn-ew-toolbar-title small{
  color:#bcd1e4;
  display:block;
  font-size:10px;
  font-weight:700;
  letter-spacing:.04em;
  text-transform:uppercase;
}

.cn-ew-toolbar-mark{
  align-items:center;
  background:#fff;
  border-radius:8px;
  color:var(--cn-ew-navy);
  display:flex;
  font-size:19px;
  font-weight:950;
  height:36px;
  justify-content:center;
  width:36px;
}

.cn-ew-toolbar-actions{
  align-items:center;
  display:flex;
  flex-wrap:wrap;
  gap:7px;
  justify-content:flex-end;
}

.cn-ew-toolbar .btn{
  background:#fff;
  border-color:rgba(255,255,255,.32);
  color:var(--cn-ew-navy);
  min-height:36px;
  white-space:nowrap;
}

.cn-ew-toolbar .btn.primary{
  background:#2780b8;
  border-color:#4b9acb;
  color:#fff;
}

/* Reset the two workbook panels; they are workspace panels, not the application navigation. */
#estimating #excelEstimateMode aside.excel-step-card,
#estimating #excelEstimateMode aside.excel-summary-card{
  background:#fff!important;
  bottom:auto!important;
  color:var(--ink,#09294b)!important;
  height:auto!important;
  inset:auto!important;
  left:auto!important;
  max-width:none!important;
  min-height:0!important;
  overflow:auto!important;
  padding:18px!important;
  position:static!important;
  right:auto!important;
  top:auto!important;
  transform:none!important;
  width:auto!important;
  z-index:auto!important;
}

#estimating #excelEstimateMode main.excel-input-card{
  height:auto!important;
  inset:auto!important;
  margin:0!important;
  max-width:none!important;
  min-height:0!important;
  min-width:0!important;
  padding:18px!important;
  position:static!important;
  transform:none!important;
  width:auto!important;
}

#estimating.cn-ew-enhanced .excel-estimate-layout{
  align-items:stretch;
  display:grid!important;
  gap:12px;
  grid-template-columns:250px minmax(0,1fr) 285px!important;
  min-width:0;
}

#estimating[data-cn-ew-panels="collapsed"] .excel-estimate-layout{
  grid-template-columns:minmax(0,1fr)!important;
}

#estimating[data-cn-ew-panels="collapsed"] #excelEstimateMode .excel-step-card,
#estimating[data-cn-ew-panels="collapsed"] #excelEstimateMode .excel-summary-card,
#estimating[data-cn-ew-panels="collapsed"] #constructnavEstimateMode .estimate-list-card{
  display:none!important;
}

#estimating[data-cn-ew-panels="collapsed"] #constructnavEstimateMode .estimate-shell{
  grid-template-columns:minmax(0,1fr)!important;
}

#estimating.cn-ew-enhanced .excel-input-card{
  display:flex;
  flex-direction:column;
  min-width:0;
}

#estimating.cn-ew-enhanced #xeFields{
  min-height:0;
  min-width:0;
}

#estimating.cn-ew-enhanced .xe-catalog{
  background:#fff;
  border:1px solid var(--cn-ew-line);
  border-radius:10px;
  max-height:calc(100vh - 390px);
  min-height:420px;
  overflow:auto;
  overscroll-behavior:contain;
  position:relative;
}

#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid{
  border-collapse:separate;
  border-spacing:0;
  min-width:1460px;
  width:100%;
}

#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid thead{
  position:sticky;
  top:0;
  z-index:15;
}

#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid th{
  background:#e9f0f6;
  border-bottom:1px solid #b9cad8;
  box-shadow:inset 0 -1px 0 #b9cad8;
  color:#173c5d;
  font-size:10px;
  letter-spacing:.045em;
  padding:8px 7px;
  text-transform:uppercase;
}

#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid td{
  background:#fff;
  border-bottom:1px solid #e3eaf0;
  padding:5px 6px;
  transition:background .12s ease,opacity .12s ease;
}

#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid tr:hover td{
  background:#f3f8fc;
}

#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid .xe-selected-line td{
  background:var(--cn-ew-selected);
}

#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid .xe-selected-line td:first-child{
  box-shadow:inset 4px 0 0 var(--cn-ew-selected-line);
}

#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid .xe-unselected-line{
  opacity:.62;
}

#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid .xe-unselected-line:hover{
  opacity:1;
}

#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid .xe-division-row td{
  background:#dfe9f2;
  color:#163d5f;
  font-size:11px;
  font-weight:900;
  letter-spacing:.025em;
  position:sticky;
  top:35px;
  z-index:7;
}

#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid .xe-division-row.xe-unselected-line{
  opacity:1;
}

#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid th:nth-child(1),
#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid td:nth-child(1){
  left:0;
  min-width:54px;
  position:sticky;
  width:54px;
  z-index:8;
}

#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid th:nth-child(2),
#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid td:nth-child(2){
  left:54px;
  min-width:118px;
  position:sticky;
  width:118px;
  z-index:8;
}

#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid thead th:nth-child(1),
#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid thead th:nth-child(2){
  z-index:20;
}

#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid td:nth-child(3){
  min-width:225px;
}

#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid td:nth-child(4){
  min-width:300px;
}

#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid td:nth-child(n+6):nth-child(-n+10){
  min-width:92px;
}

#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid td:last-child{
  font-weight:850;
  min-width:110px;
  text-align:right;
}

#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid input:not([type="checkbox"]),
#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid textarea{
  background:transparent;
  border:1px solid transparent;
  border-radius:5px;
  font-size:12px;
  min-height:32px;
  padding:5px 6px;
  width:100%;
}

#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid input:focus,
#estimating.cn-ew-enhanced .xe-catalog .cn-ew-grid textarea:focus{
  background:#fff;
  border-color:#2b82b8;
  box-shadow:0 0 0 3px rgba(43,130,184,.15);
  outline:0;
}

#estimating.cn-ew-enhanced .xe-selection-toolbar,
#estimating.cn-ew-enhanced .xe-template-bar{
  position:relative;
  z-index:16;
}

#estimating.cn-ew-enhanced .xe-estimate-total{
  background:#f0f6fb;
  border:1px solid #cadbe8;
  border-radius:10px;
  bottom:0;
  box-shadow:0 -4px 16px rgba(7,39,71,.08);
  margin-top:8px;
  padding:10px 14px;
  position:sticky;
  z-index:18;
}

/* ConstructNav/imported estimate spreadsheet view. */
#estimating.cn-ew-enhanced .estimate-editor{
  min-width:0;
}

.cn-ew-native-view-controls{
  align-items:center;
  background:#eef5fa;
  border:1px solid #cbdce8;
  border-radius:10px;
  display:flex;
  gap:12px;
  justify-content:space-between;
  margin:12px 0;
  padding:9px 10px;
}

.cn-ew-native-view-controls>div:first-child{
  display:grid;
  gap:2px;
}

.cn-ew-native-view-controls span{
  color:#60768c;
  font-size:11px;
}

.cn-ew-native-view-actions{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}

#estimateEditor[data-cn-ew-native-view="sheet"] .cn-ew-native-details,
#estimateEditor[data-cn-ew-native-view="sheet"] .cn-ew-native-catalog,
#estimateEditor[data-cn-ew-native-view="details"] .cn-ew-native-sheet,
#estimateEditor[data-cn-ew-native-view="details"] .cn-ew-native-catalog,
#estimateEditor[data-cn-ew-native-view="catalog"] .cn-ew-native-sheet,
#estimateEditor[data-cn-ew-native-view="catalog"] .cn-ew-native-details{
  display:none!important;
}

#estimateEditor .cn-ew-grid{
  border-collapse:separate;
  border-spacing:0;
  min-width:1290px;
  width:100%;
}

#estimateEditor .cn-ew-grid caption.cn-ew-grid-totals{
  background:#eef5fa;
  border:1px solid #c9dbe8;
  caption-side:top;
  padding:10px 12px;
  position:sticky;
  text-align:left;
  top:0;
  z-index:12;
}

.cn-ew-grid-totals,
.cn-ew-grid-total-pair{
  align-items:center;
  display:flex;
  gap:18px;
  justify-content:space-between;
}

.cn-ew-grid-totals>span:first-child{
  display:grid;
  gap:2px;
}

.cn-ew-grid-totals small{
  color:#5e7487;
  font-size:10px;
}

.cn-ew-grid-total-pair strong{
  color:#0b365c;
  font-size:21px;
}

#estimateEditor .cn-ew-grid thead{
  position:sticky;
  top:62px;
  z-index:10;
}

#estimateEditor .cn-ew-grid th{
  background:#e4edf4;
  border-bottom:1px solid #b8cad7;
  color:#173b5b;
  font-size:10px;
  letter-spacing:.045em;
  text-transform:uppercase;
}

#estimateEditor .cn-ew-grid td{
  background:#fff;
  border-bottom:1px solid #e3e9ef;
  padding:6px;
}

#estimateEditor .cn-ew-grid .cn-ew-row-selected td{
  background:#edf8f2;
}

#estimateEditor .cn-ew-grid .cn-ew-row-selected td:first-child{
  box-shadow:inset 4px 0 0 var(--cn-ew-selected-line);
}

#estimateEditor .cn-ew-grid .cn-ew-use-heading,
#estimateEditor .cn-ew-grid .cn-ew-use-cell{
  left:0;
  min-width:52px;
  position:sticky;
  text-align:center;
  width:52px;
  z-index:9;
}

#estimateEditor .cn-ew-grid .cn-ew-use-heading{
  z-index:15;
}

#estimateEditor .cn-ew-grid input:not([type="checkbox"]),
#estimateEditor .cn-ew-grid textarea{
  background:transparent;
  border:1px solid transparent;
  border-radius:5px;
  min-height:32px;
  padding:5px 6px;
  width:100%;
}

#estimateEditor .cn-ew-grid input:focus,
#estimateEditor .cn-ew-grid textarea:focus{
  background:#fff;
  border-color:#2b82b8;
  box-shadow:0 0 0 3px rgba(43,130,184,.14);
  outline:0;
}

#estimateEditor .cn-ew-grid .desc-input{
  min-width:230px;
}

#estimateEditor .cn-ew-grid .proposal-desc-input{
  min-width:280px;
}

#estimateEditor .cn-ew-grid input[type="number"]{
  min-width:86px;
}

/* Full-screen focus mode. */
html.cn-ew-wide,
html.cn-ew-wide body{
  height:100%;
  overflow:hidden!important;
}

html.cn-ew-wide #estimating.cn-ew-enhanced{
  background:#f1f5f9;
  display:flex!important;
  flex-direction:column;
  inset:0;
  max-width:none!important;
  overflow:hidden;
  padding:10px;
  position:fixed;
  width:100vw;
  z-index:10000;
}

html.cn-ew-wide #estimating .estimating-mode-tabs{
  border-radius:10px 10px 0 0;
  flex:0 0 auto;
}

html.cn-ew-wide #estimating .cn-ew-toolbar{
  border-radius:0 0 10px 10px;
  flex:0 0 auto;
  margin-bottom:10px;
}

html.cn-ew-wide #constructnavEstimateMode,
html.cn-ew-wide #excelEstimateMode{
  flex:1 1 auto;
  min-height:0;
  overflow:hidden;
}

html.cn-ew-wide #constructnavEstimateMode .estimate-shell{
  height:100%;
  min-height:0;
}

html.cn-ew-wide #constructnavEstimateMode .estimate-list-card,
html.cn-ew-wide #constructnavEstimateMode .estimate-editor{
  height:100%;
  min-height:0;
  overflow:auto;
}

html.cn-ew-wide #constructnavEstimateMode .estimate-editor{
  padding:14px;
}

html.cn-ew-wide #excelEstimateMode{
  /*
   * setEstimatingMode('excel') writes display:block inline. The !important is
   * required so full-screen mode actually becomes the constrained flex column
   * described below instead of a 66,000px block clipped by its parent.
   */
  display:flex!important;
  flex-direction:column;
}

html.cn-ew-wide #excelEstimateMode .excel-estimate-hero{
  align-items:center;
  flex:0 0 auto;
  margin-bottom:9px;
  padding:9px 12px;
}

html.cn-ew-wide #excelEstimateMode .excel-estimate-hero h2{
  font-size:17px;
  margin:0;
}

html.cn-ew-wide #excelEstimateMode .excel-estimate-hero p{
  display:none;
}

html.cn-ew-wide #excelEstimateMode .excel-estimate-layout{
  flex:1 1 auto;
  height:auto;
  min-height:0;
  overflow:hidden;
  /*
   * This explicit row is the constraint that makes the workbook card a real
   * scrollport. Without it, CSS Grid sizes its implicit auto row from all
   * 1,345 workbook lines (roughly 66,000px tall). The parent then clips that
   * giant row, while the card itself has no overflow delta and cannot scroll.
   */
  grid-template-rows:minmax(0,1fr);
}

/*
 * Keep the full-screen workbook grid inside the viewport.  The earlier reset
 * rules intentionally use two IDs plus !important, so this selector must be at
 * least as specific or the main card falls back to height:auto and clips the
 * 1,345-row catalog behind overflow:hidden.
 */
html.cn-ew-wide #estimating.cn-ew-enhanced #excelEstimateMode .excel-step-card,
html.cn-ew-wide #estimating.cn-ew-enhanced #excelEstimateMode .excel-summary-card,
html.cn-ew-wide #estimating.cn-ew-enhanced #excelEstimateMode .excel-input-card{
  height:100%!important;
  max-height:100%!important;
  min-height:0!important;
}

html.cn-ew-wide #estimating.cn-ew-enhanced #excelEstimateMode .excel-step-card,
html.cn-ew-wide #estimating.cn-ew-enhanced #excelEstimateMode .excel-summary-card{
  overflow:auto!important;
}

html.cn-ew-wide #estimating.cn-ew-enhanced #excelEstimateMode .excel-input-card{
  /*
   * Own all full-screen workbook scrolling here. A nested
   * #xeFields -> .xe-catalog flex scrollport can collapse after the section
   * header, selection tools, total, and footer are included. One scroll owner
   * keeps wheel, trackpad, touch, Page Up/Down, and horizontal scrolling
   * available over the entire estimate.
   */
  overflow:auto!important;
  overscroll-behavior:contain;
  padding:12px!important;
  scrollbar-gutter:stable both-edges;
  touch-action:pan-x pan-y;
  -webkit-overflow-scrolling:touch;
}

html.cn-ew-wide #estimating.cn-ew-enhanced #excelEstimateMode .excel-input-card:focus{
  outline:2px solid rgba(39,128,184,.7);
  outline-offset:-2px;
}

html.cn-ew-wide #estimating.cn-ew-enhanced #excelEstimateMode #xeFields{
  flex:0 0 auto;
  height:auto;
  min-height:0;
  overflow:visible;
}

html.cn-ew-wide #excelEstimateMode[data-cn-ew-section="complete-estimate"] #xeFields{
  display:block;
  min-width:1460px;
}

html.cn-ew-wide #excelEstimateMode[data-cn-ew-section="complete-estimate"] #xeAIWorkbench{
  display:block;
  flex:0 0 auto;
  margin-bottom:8px;
  max-height:320px;
  overflow:auto;
}

.xe-proposal-ai-actions{
  align-items:center;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.xe-proposal-ai-actions select{
  min-width:140px;
  width:auto;
}

.xe-proposal-ai-actions .muted{
  flex:1 1 240px;
  font-size:11px;
}

html.cn-ew-wide #excelEstimateMode .xe-template-bar{
  margin-bottom:6px;
  padding:7px 9px;
}

html.cn-ew-wide #excelEstimateMode .xe-selection-toolbar{
  margin-bottom:5px;
}

html.cn-ew-wide #estimating.cn-ew-enhanced #excelEstimateMode .xe-catalog{
  flex:0 0 auto;
  max-height:none;
  min-height:0;
  min-width:100%;
  overflow:visible;
  width:max-content;
}

html.cn-ew-wide #excelEstimateMode .excel-estimate-footer{
  flex:0 0 auto;
  margin-top:6px;
}

#estimating[data-cn-ew-density="compact"] .cn-ew-grid td{
  padding-bottom:3px!important;
  padding-top:3px!important;
}

#estimating[data-cn-ew-density="compact"] .cn-ew-grid input:not([type="checkbox"]),
#estimating[data-cn-ew-density="compact"] .cn-ew-grid textarea{
  font-size:11px!important;
  min-height:27px!important;
  padding:3px 5px!important;
}

#estimating[data-cn-ew-density="comfortable"] .cn-ew-grid td{
  padding-bottom:8px!important;
  padding-top:8px!important;
}

@media(max-width:1100px){
  .cn-ew-toolbar{
    align-items:stretch;
    flex-direction:column;
  }
  .cn-ew-toolbar-actions{
    justify-content:flex-start;
  }
  #estimating.cn-ew-enhanced .excel-estimate-layout{
    grid-template-columns:minmax(0,1fr)!important;
  }
  #estimating[data-cn-ew-panels="open"] #excelEstimateMode .excel-estimate-layout{
    grid-template-areas:
      "setup summary"
      "sheet sheet";
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
  html.cn-ew-wide #estimating[data-cn-ew-panels="open"] #excelEstimateMode .excel-estimate-layout{
    grid-template-rows:minmax(0,230px) minmax(0,1fr);
  }
  #estimating[data-cn-ew-panels="open"] #excelEstimateMode .excel-step-card{
    display:block!important;
    grid-area:setup;
    max-height:230px;
  }
  #estimating[data-cn-ew-panels="open"] #excelEstimateMode .excel-summary-card{
    display:block!important;
    grid-area:summary;
    max-height:230px;
  }
  #estimating[data-cn-ew-panels="open"] #excelEstimateMode .excel-input-card{
    grid-area:sheet;
  }
}

@media(max-width:720px){
  .cn-ew-toolbar-title{
    min-width:0;
  }
  .cn-ew-toolbar-actions{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .cn-ew-toolbar .btn{
    width:100%;
  }
  #estimating[data-cn-ew-panels="open"] #excelEstimateMode .excel-estimate-layout{
    grid-template-areas:
      "setup"
      "summary"
      "sheet";
    grid-template-columns:minmax(0,1fr)!important;
  }
  html.cn-ew-wide #estimating[data-cn-ew-panels="open"] #excelEstimateMode .excel-estimate-layout{
    grid-template-rows:minmax(0,170px) minmax(0,170px) minmax(0,1fr);
  }
  .cn-ew-native-view-controls{
    align-items:stretch;
    flex-direction:column;
  }
}
