/* BF-UI-SHELL-01 — BidFloor NEW LOOK foundation.
   Design tokens + app shell chrome (left nav / topbar / canvas) + shared cards.
   Visual only. Does not change yardage / packer / pricing math, auth, or desks. */
:root {
  --bf-navy: #0F2742;
  --bf-teal: #0F766E;
  --bf-canvas: #F6F8FA;
  --bf-ink: #0F2742;
  --bf-muted: #5B6B7C;
  --bf-line: #D7E0E8;
  --bf-panel: #ffffff;
  --bf-shadow: 0 10px 28px rgba(15, 39, 66, .08);
  --bf-radius: 12px;
  --ink: var(--bf-ink);
  --muted: var(--bf-muted);
  --line: var(--bf-line);
  --panel: var(--bf-panel);
  --soft: var(--bf-canvas);
  --blue: var(--bf-teal);
  --teal: var(--bf-teal);
}

html.bf-ui-shell,
html.bf-ui-shell body {
  color: var(--bf-ink);
  background: var(--bf-canvas);
}

html.bf-ui-shell .bf-ui-shell-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fdba74;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
  white-space: nowrap;
}

html.bf-ui-shell .bf-ui-shell-phone-banner,
html.bf-ui-shell .bf-ui-shell-phone-strip,
html.bf-ui-shell .bf-ui-shell-menu,
html.bf-ui-shell .bf-ui-shell-backdrop {
  display: none;
}

html.bf-ui-shell .sidebar {
  background: var(--bf-navy);
  color: #fff;
  padding: 12px 10px;
}

html.bf-ui-shell .brand {
  padding: 0 4px 10px;
  border-bottom-color: rgba(255, 255, 255, .12);
}

html.bf-ui-shell .brand strong {
  color: #fff;
}

html.bf-ui-shell .brand span {
  color: #C5D0DA;
}

html.bf-ui-shell .sidebar-toggle {
  border-color: rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .08);
}

html.bf-ui-shell .nav-section-toggle {
  color: #9BB3C6;
}

html.bf-ui-shell .nav-link {
  color: #D7E4EE;
}

html.bf-ui-shell .nav-section-toggle:hover,
html.bf-ui-shell .nav-link:hover {
  background: rgba(255, 255, 255, .1);
  color: #fff;
}

html.bf-ui-shell .nav-link.active {
  background: rgba(15, 118, 110, .28);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--bf-teal);
}

html.bf-ui-shell .nav-home-link {
  border-color: rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .06);
}

html.bf-ui-shell .quick-create summary {
  border-color: var(--bf-teal);
  background: var(--bf-teal);
  color: #fff;
}

html.bf-ui-shell .quick-create-menu {
  border-color: rgba(255, 255, 255, .12);
  background: rgba(0, 0, 0, .18);
}

html.bf-ui-shell .sidebar-jumps {
  border-top-color: rgba(255, 255, 255, .12);
}

html.bf-ui-shell .sidebar-jumps button {
  border-color: rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .08);
}

html.bf-ui-shell .main {
  min-width: 0;
  background: var(--bf-canvas);
}

/* Authentication prepends a third direct child to .main. Keep both header
   rows content-sized and reserve the remaining height for the workspace. */
html.bf-ui-shell .main:has(> #bidfloorAccountBar) {
  grid-template-rows: auto auto minmax(0, 1fr);
}

html.bf-ui-shell .topbar {
  min-height: 56px;
  padding: 8px 18px;
  background: #fff;
  border-bottom: 1px solid var(--bf-line);
  position: sticky;
  top: 0;
  z-index: 30;
}

html.bf-ui-shell .title h1 {
  color: var(--bf-navy);
  font-size: 20px;
  letter-spacing: -.02em;
}

html.bf-ui-shell .title p {
  color: var(--bf-muted);
}

html.bf-ui-shell .cloud-status {
  border-color: var(--bf-line);
  background: var(--bf-canvas);
  color: var(--bf-muted);
}

html.bf-ui-shell .header-actions-menu {
  border-color: var(--bf-line);
  box-shadow: var(--bf-shadow);
}

html.bf-ui-shell .btn.primary,
html.bf-ui-shell .btn.choice-option.choice-selected,
html.bf-ui-shell .btn.choice-option[aria-pressed="true"] {
  background: var(--bf-teal);
  border-color: var(--bf-teal);
  color: #fff;
}

html.bf-ui-shell .btn.choice-option.choice-selected,
html.bf-ui-shell .btn.choice-option[aria-pressed="true"] {
  box-shadow: 0 0 0 2px rgba(15, 118, 110, .16);
}

html.bf-ui-shell .main > .content {
  background: var(--bf-canvas);
  padding: 14px 16px 18px;
  gap: 14px;
}

html.bf-ui-shell .workspace {
  gap: 12px;
}

html.bf-ui-shell .panel,
html.bf-ui-shell .card,
html.bf-ui-shell .job-card,
html.bf-ui-shell .metric,
html.bf-ui-shell .sales-tool-card,
html.bf-ui-shell .estimate-finder,
html.bf-ui-shell .sales-filter-bar,
html.bf-ui-shell .sales-table-wrap {
  background: var(--bf-panel);
  border-color: var(--bf-line);
  border-radius: var(--bf-radius);
}

html.bf-ui-shell .panel,
html.bf-ui-shell .card,
html.bf-ui-shell .estimate-finder,
html.bf-ui-shell .sales-table-wrap {
  box-shadow: 0 1px 2px rgba(15, 39, 66, .04);
}

html.bf-ui-shell .job-card,
html.bf-ui-shell .metric,
html.bf-ui-shell .sales-tool-card {
  box-shadow: 0 1px 2px rgba(15, 39, 66, .03);
}

html.bf-ui-shell .panel-head,
html.bf-ui-shell .section-title,
html.bf-ui-shell .job-card strong,
html.bf-ui-shell .metric strong {
  color: var(--bf-navy);
}

html.bf-ui-shell .job-card.active {
  border-color: var(--bf-teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .14);
}

html.bf-ui-shell button.metric:hover {
  border-color: var(--bf-teal);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, .12);
}

html.bf-ui-shell button.metric.active {
  border-color: var(--bf-teal);
  background: #F0FDFA;
  box-shadow: inset 4px 0 0 var(--bf-teal);
}

html.bf-ui-shell .pdf-scope-card:hover,
html.bf-ui-shell .pdf-scope-card:has(input:checked) {
  border-color: var(--bf-teal);
}

html.bf-ui-shell .pdf-scope-card:hover {
  background: #F0FDFA;
}

html.bf-ui-shell .pdf-scope-card:has(input:checked) {
  background: #CCFBF1;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, .12);
}

html.bf-ui-shell .pdf-scope-card input {
  accent-color: var(--bf-teal);
}

html.bf-ui-shell .auth-tabs .btn.active,
html.bf-ui-shell #authSubmitBtn {
  background: var(--bf-teal);
  border-color: var(--bf-teal);
  color: #fff;
}

html.bf-ui-shell #authModal .auth-card h2 {
  color: var(--bf-navy);
}

@media (min-width: 768px) {
  html.bf-ui-shell,
  html.bf-ui-shell body {
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
  }

  html.bf-ui-shell .app {
    height: 100%;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  html.bf-ui-shell .sidebar {
    height: 100%;
    max-height: 100%;
    overflow-y: auto;
  }

  html.bf-ui-shell .main {
    min-height: 0;
    height: 100%;
    overflow: hidden;
    grid-template-rows: auto minmax(0, 1fr);
  }

  html.bf-ui-shell .topbar {
    position: sticky;
    top: 0;
  }

  html.bf-ui-shell .main > .content {
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }

  html.bf-ui-shell #authModal.active {
    background: rgba(15, 39, 66, .72);
  }
}

@media (max-width: 767px) {
  [data-nav-tab="pdfreader"],
  [data-nav-tab="homeblueprint"],
  [data-multiview-open="pdfreader"],
  [data-multiview-open="homeblueprint"] { display: none !important; }
  html.bf-ui-shell,
  html.bf-ui-shell body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Overlay the desktop rail so first paint is 100vw — no sideways scrub. */
  html.bf-ui-shell .app {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    --sidebar-width: 0px;
    grid-template-columns: minmax(0, 1fr);
    overflow-x: hidden;
  }

  html.bf-ui-shell .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(86vw, 280px);
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    z-index: 50;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }

  html.bf-ui-shell.bf-ui-shell-nav-open .sidebar {
    transform: translateX(0);
  }

  html.bf-ui-shell .bf-ui-shell-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 39, 66, .48);
    z-index: 45;
  }

  html.bf-ui-shell.bf-ui-shell-nav-open .bf-ui-shell-backdrop {
    display: block;
  }

  html.bf-ui-shell .main,
  html.bf-ui-shell .topbar,
  html.bf-ui-shell .main > .content,
  html.bf-ui-shell .workspace,
  html.bf-ui-shell .panel,
  html.bf-ui-shell .summary-grid,
  html.bf-ui-shell .metric,
  html.bf-ui-shell .job-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  html.bf-ui-shell .main {
    grid-column: 1;
  }

  html.bf-ui-shell .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 0 12px 8px;
  }

  html.bf-ui-shell .title {
    flex: 1 1 auto;
    min-width: 0;
  }

  html.bf-ui-shell .title h1 {
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html.bf-ui-shell .top-actions {
    flex: 1 1 100%;
    justify-content: flex-start;
    min-width: 0;
  }

  html.bf-ui-shell .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Full-width first row of the topbar — visible on first paint. */
  html.bf-ui-shell .bf-ui-shell-phone-strip {
    display: block;
    flex: 1 0 100%;
    order: -2;
    margin: 0 -12px 0;
    padding: 4px 8px;
    background: #fff7ed;
    color: #9a3412;
    border-bottom: 1px solid #fdba74;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .02em;
    text-align: center;
  }

  html.bf-ui-shell .bf-ui-shell-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    order: -1;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border: 1px solid var(--bf-line);
    border-radius: 8px;
    background: #fff;
    color: var(--bf-navy);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
  }

  html.bf-ui-shell .bf-ui-shell-chip {
    display: inline-flex;
    padding: 3px 7px;
    font-size: 10px;
    line-height: 1.2;
  }

  /* Compact mark on the sign-in card. Not a second sticky page banner,
     so PR #74's measure banner and BF-009 scrollport stay intact. */
  html.bf-ui-shell .bf-ui-shell-phone-banner {
    display: block;
    margin: 0 0 10px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fdba74;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .02em;
    text-align: center;
  }
}

@media print {
  html.bf-ui-shell,
  html.bf-ui-shell body,
  html.bf-ui-shell .app,
  html.bf-ui-shell .main,
  html.bf-ui-shell .main > .content {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  html.bf-ui-shell .bf-ui-shell-chip,
  html.bf-ui-shell .bf-ui-shell-phone-strip,
  html.bf-ui-shell .bf-ui-shell-menu,
  html.bf-ui-shell .bf-ui-shell-backdrop {
    display: none !important;
  }
}

html.bf-ui-shell body.multiview-mode .topbar {
  display: none;
}

html.bf-ui-shell body.printing-document .sidebar,
html.bf-ui-shell body.printing-document .topbar,
html.bf-ui-shell body.printing-document .bf-ui-shell-chip,
html.bf-ui-shell body.printing-document .bf-ui-shell-phone-strip,
html.bf-ui-shell body.printing-document .bf-ui-shell-menu {
  display: none !important;
}

/* Estimate item editing uses the browser top layer, outside the narrow item column. */
html.bf-ui-shell dialog.estimate-line-change-panel {
  width: min(640px, calc(100vw - 24px)); max-width: none;
  max-height: calc(100dvh - 32px); overflow: auto; box-sizing: border-box;
  margin: auto; padding: 24px; border: 1px solid #cbd5e1; border-radius: 14px;
  background: white; color: #0F2742; box-shadow: 0 20px 65px #0f274244;
  text-align: left; white-space: normal;
}
html.bf-ui-shell dialog.estimate-line-change-panel::backdrop { background: #0f274280; }
html.bf-ui-shell .estimate-line-change-panel h2 { margin: 0 0 12px; font-size: 22px; }
html.bf-ui-shell .estimate-change-current { overflow-wrap: anywhere; }
html.bf-ui-shell .estimate-line-change-panel > .form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
html.bf-ui-shell .estimate-line-change-panel label { display: grid; gap: 8px; min-width: 0; }
html.bf-ui-shell .estimate-line-change-panel .catalog-product-picker { grid-template-columns: minmax(0, 1fr); gap: 10px; }
html.bf-ui-shell .estimate-line-change-panel :is(input, select) { width: 100%; min-width: 0; min-height: 44px; box-sizing: border-box; }
html.bf-ui-shell .estimate-line-change-panel .catalog-product-picker-results { position: static; max-height: 200px; }
html.bf-ui-shell .estimate-change-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
html.bf-ui-shell .estimate-change-actions button { min-height: 44px; }
@media(max-width: 480px) {
  html.bf-ui-shell dialog.estimate-line-change-panel { padding: 16px; }
  html.bf-ui-shell .estimate-line-change-panel details .form-grid { grid-template-columns: minmax(0, 1fr); }
}

/* PDF reader step 2 fills the viewport. The stepper stays in normal flow,
   and the preview column keeps the 3D bar inside the frame. */
@media (min-width: 768px) {
  html.bf-ui-shell:has(#pdfreader.active),
  html.bf-ui-shell:has(#pdfreader.active) body,
  html.bf-ui-shell .app:has(#pdfreader.active) {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
  }

  html.bf-ui-shell .app:has(#pdfreader.active) .main {
    width: 100%;
    min-width: 0;
    height: 100%;
    min-height: 0;
  }

  html.bf-ui-shell .app:has(#pdfreader.active) .main > .content {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding: 0;
    gap: 0;
  }

  html.bf-ui-shell .app:has(#pdfreader.active) .workspace,
  html.bf-ui-shell .app:has(#pdfreader.active) .panel:has(#pdfreader.active) {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  html.bf-ui-shell .app:has(#pdfreader.active) .panel:has(#pdfreader.active) > #pdfreader.active {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
  }
}

/* Hide legacy preview markup before the chrome installer removes it. */
#bfMeasureVisualDraftBanner, #bfUiShellDraftChip, #bfUiShellSignInMark { display: none !important; }
html.bf-ui-shell .estimate-quick-filters {
  display: grid; grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(130px, 1fr)); gap: 12px;
}
html.bf-ui-shell .estimate-quick-filters label { min-width: 0; }
html.bf-ui-shell .estimate-quick-filters label[hidden] { display: none; }
html.bf-ui-shell .estimate-quick-filters :is(input, select) { width: 100%; min-width: 0; box-sizing: border-box; }
@media (max-width: 1000px) { html.bf-ui-shell .estimate-quick-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { html.bf-ui-shell .estimate-quick-filters { grid-template-columns: minmax(0, 1fr); } }
