/* ExpressQuote theme — layered on top of Bootstrap 5.3 (dashboard-style shell). */

:root {
  --eq-sidebar-bg: #131c2b;
  --eq-main-bg: #f4f6f9;
  --eq-accent: #0dcaf0;
}

body {
  background-color: var(--eq-main-bg);
}

.eq-shell {
  min-height: 100vh;
}

/* Print-only branded header — hidden on screen, see @media print below */
.eq-print-header {
  display: none;
}

/* Sidebar: static column at ≥lg, Bootstrap offcanvas drawer below (the
   offcanvas-lg classes on the nav handle positioning there — these
   variables theme the drawer, and the desktop geometry lives in the
   media query so it can't fight the drawer's fixed positioning). */
.eq-sidebar {
  --bs-offcanvas-width: 280px;
  --bs-offcanvas-bg: var(--eq-sidebar-bg);
  --bs-offcanvas-color: #fff;
  background-color: var(--eq-sidebar-bg);
}

@media (min-width: 992px) {
  .eq-sidebar {
    width: 260px;
    min-height: 100vh;
    position: sticky;
    top: 0;
    height: 100vh;
    /* Bootstrap's .offcanvas-lg resets to transparent !important above the
       breakpoint; this loads later so the sidebar keeps its color. */
    background-color: var(--eq-sidebar-bg) !important;
  }
}

/* Mobile top bar (hamburger + brand), sticky so the menu is always reachable */
.eq-mobile-topbar {
  background-color: var(--eq-sidebar-bg);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.eq-hamburger {
  color: #fff;
  border: 0;
  line-height: 1;
}

.eq-hamburger:hover,
.eq-hamburger:focus {
  color: var(--eq-accent);
}

.eq-sidebar .nav-link {
  color: #aab4c4;
  border-radius: 0.5rem;
}

.eq-sidebar .nav-link:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.06);
}

.eq-sidebar .nav-link.active {
  background-color: var(--eq-accent);
  color: #06232b;
  font-weight: 600;
}

.eq-sidebar .eq-nav-heading {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  list-style: none;
}

/* Honeypot: visually removed but present in the DOM for bots. */
.eq-hp {
  position: absolute;
  left: -9999px;
  height: 0;
  overflow: hidden;
}

/* Lead journey timeline dots (leads/show) */
.eq-journey-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.eq-sidebar {
  overflow-y: auto;
}

.eq-main {
  min-width: 0;
}

.eq-auth {
  background: linear-gradient(160deg, #131c2b 0%, #1d2c44 60%, #10304a 100%);
}

.eq-stat-card {
  border: 0;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
}

.eq-stat-card .stat-value {
  font-size: 1.9rem;
  font-weight: 700;
}

.card {
  border-radius: 0.75rem;
}

.table > :not(caption) > * > * {
  padding: 0.65rem 0.75rem;
}

[data-bs-toggle="collapse"] .bi-chevron-right {
  display: inline-block;
  transition: transform 0.15s ease-in-out;
}

[data-bs-toggle="collapse"][aria-expanded="true"] .bi-chevron-right {
  transform: rotate(90deg);
}

.eq-mono {
  font-family: SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
}

pre.eq-json {
  background: #131c2b;
  color: #c7d2e4;
  border-radius: 0.5rem;
  padding: 1rem;
  font-size: 0.8rem;
  max-height: 420px;
  overflow: auto;
}

/* Scaled roof diagram (Diagram::RoofDiagramBuilder) — SVG scales to its
   container via viewBox, so these are relative units, not real pixels. */
.eq-diagram-svg {
  width: 100%;
  max-width: 640px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.eq-diagram-footprint {
  fill: none;
  stroke: #1f2937;
  stroke-width: 2.5;
}

.eq-diagram-facet {
  fill: rgba(13, 202, 240, 0.06);
  stroke: #cbd5e1;
  stroke-width: 1;
  stroke-dasharray: 3 2;
}

.eq-diagram-facet-label {
  font-size: 9px;
  fill: #475569;
}

.eq-diagram-feature-line {
  stroke-width: 2.5;
}

/* A label drawn over lines stays legible on its own white outline. */
.eq-diagram-halo {
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 3px;
  stroke-linejoin: round;
}

.eq-diagram-feature-label {
  font-size: 8px;
  font-weight: 600;
}

.eq-diagram-component {
  stroke: #fff;
  stroke-width: 1.5;
}

.eq-diagram-component-label {
  font-size: 7px;
  fill: #fff;
  font-weight: 700;
}

.eq-diagram-scalebar line {
  stroke: #334155;
  stroke-width: 1.5;
}

.eq-diagram-scalebar-label,
.eq-diagram-north {
  font-size: 9px;
  fill: #334155;
  font-weight: 600;
}

/* Isometric "proposed 3D shape" (Diagram::VisionRoofDiagramBuilder) — same
   viewBox-scaled SVG convention as .eq-diagram-svg above. Shapes are drawn
   back-to-front (painter's algorithm) by the builder, so paint order here
   must stay document order, not z-index. */
.eq-diagram-3d-svg {
  max-width: 480px;
}

.eq-diagram-3d-shape {
  stroke: #1f2937;
  stroke-width: 1;
  stroke-linejoin: round;
}

.eq-diagram-3d-wall {
  stroke: #94a3b8;
}

.eq-legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}

.eq-legend-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  color: #fff;
  font-size: 7px;
  font-weight: 700;
  margin-right: 4px;
  vertical-align: middle;
}

/* ---------------------------------------------------------------------------
   Print: a clean portrait report — no sidebar, browser-like two-column layout
   scaled to fit the page width. Bootstrap 5 has no built-in print styles, so
   grid breakpoints (which don't trigger at print viewport widths) are pinned
   here to match the on-screen desktop layout.
--------------------------------------------------------------------------- */
@media print {
  /* No page margin — the header needs to reach the true physical edges, and
     Chrome's print-to-PDF clips content strictly at the @page margin box, so
     a negative-margin "bleed" trick on the header doesn't work here. Instead
     the page has zero margin and everything BELOW the header gets its inset
     from .eq-main's own padding (below), so only the header is edge-to-edge. */
  @page {
    size: portrait;
    margin: 0;
  }

  body {
    margin: 0;
    background: #fff;
    font-size: 11px;
  }

  /* Branded header bar — full-bleed edge to edge, flush with the page top */
  .eq-print-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    line-height: 1;
    background: var(--eq-sidebar-bg);
    color: #fff;
    padding: 6mm 9mm;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .eq-print-header .bi-house-gear-fill {
    font-size: 1.3rem;
    color: var(--eq-accent);
  }

  .eq-print-header .eq-print-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.02em;
  }

  .eq-shell {
    display: block;
    min-height: auto;
  }

  .eq-main {
    padding: 6mm 9mm 9mm !important;
  }

  /* Chrome/navigation that makes no sense on paper */
  .alert,
  .btn,
  .pagination,
  #scan-progress {
    display: none !important;
  }

  h1 {
    font-size: 1.35rem;
  }

  /* Pin the desktop grid: 4-across stat cards row via floats (Bootstrap's
     flex row fragments across a page break and paints stray dark slices of
     images — floats avoid that for this short, uniform-height row). */
  .row {
    display: block;
  }

  .row::after {
    content: "";
    display: table;
    clear: both;
  }

  .row > [class*="col-"] {
    float: left;
    width: 50%;
  }

  .row > [class*="col-xl-3"] {
    width: 25%;
  }

  /* The two-column report body (Facets/Features/... beside Imagery/Waste/...)
     stacks single-column instead. Floated columns of very different heights
     don't paginate reliably in Chrome print: a card with break-inside:avoid
     in the shorter column waits for the taller column to finish before it's
     allowed to start, producing a large blank gap. Single-column avoids the
     bug entirely — cards just flow and break normally. */
  .row > [class*="col-lg-6"] {
    float: none;
    width: 100%;
  }

  /* Imagery thumbnails 3-across in print so the imagery card fits on the
     first page beside the facets, like the on-screen layout */
  .card .card-body .row > .col-6 {
    width: 33.333%;
  }

  /* inline-block is the one display mode Chrome reliably refuses to split
     across pages, even inside floated columns — each card moves to the next
     page whole instead of being sliced (which paints image-fragment bands). */
  .card {
    display: inline-block;
    width: 100%;
    vertical-align: top;
    break-inside: avoid;
    page-break-inside: avoid;
    border: 1px solid #d5dbe3;
    box-shadow: none;
  }

  .eq-stat-card .stat-value {
    font-size: 1.1rem;
  }

  .table > :not(caption) > * > * {
    padding: 0.3rem 0.4rem;
  }

  .table-responsive {
    overflow: visible;
  }

  /* Print the full source JSON instead of a scroll box, light-on-white
     (avoids a Chrome flex-fragmentation paint artifact and saves toner) */
  pre.eq-json {
    max-height: none;
    overflow: visible;
    white-space: pre-wrap;
    word-break: break-all;
    background: #fff;
    color: #111;
    border: 1px solid #d5dbe3;
  }

  /* Keep badge/table-highlight/diagram colors on paper */
  .badge,
  .table-success,
  .eq-diagram-svg,
  .eq-diagram-3d-svg,
  .eq-legend-swatch,
  .eq-legend-dot {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .eq-diagram-svg,
  .eq-diagram-3d-svg {
    max-width: 100%;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  /* Never slice a photo across a page boundary (causes dark fragment bands) */
  img {
    max-width: 100%;
    break-inside: avoid;
  }
}

/* Email chips on Settings → Notifications: the chip box impersonates a
   form control, the inner input stays chromeless so chips + input read as
   one field. */
.eq-chip-box {
  min-height: 3rem;
  cursor: text;
}

.eq-chip {
  font-size: .85rem;
  font-weight: 500;
  padding: .4rem .35rem .4rem .65rem;
}

.eq-chip-close {
  font-size: .55rem;
}

.eq-chip-input {
  outline: none;
  min-width: 12ch;
  background: transparent;
}

.eq-event-card:has(input:checked) {
  border-color: var(--bs-primary) !important;
  background: rgba(13, 110, 253, .04);
}

/* Pinned summary on the pricing screens. The number a roofing company
   judges a quote by is cost per square, and it is the one thing you
   cannot see while scrolling a long price list — so it follows you. */
.eq-pricing-footer {
  position: sticky;
  bottom: 0;
  z-index: 1020;
  margin: 0 -0.75rem -1.5rem;
}

@media print {
  .eq-pricing-footer { display: none; }
}

/* ---------------------------------------------------------------------------
   Production: board, stepper, timeline.
--------------------------------------------------------------------------- */

/* The board scrolls sideways rather than squeezing nine columns into the
   viewport; a column narrower than a card is unreadable. */
.eq-board {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  align-items: flex-start;
}

.eq-board-phase { flex: 0 0 auto; }

.eq-board-phase-label {
  letter-spacing: 0.06em;
  padding: 0 0.25rem 0.35rem;
  border-bottom: 2px solid #dee2e6;
  margin-bottom: 0.5rem;
}

.eq-board-phase-columns { display: flex; gap: 0.6rem; }

.eq-board-column {
  width: 15.5rem;
  background: #eceff3;
  border-radius: 0.6rem;
  padding: 0.5rem;
  transition: background-color 0.12s ease-in-out, box-shadow 0.12s ease-in-out;
}

.eq-board-column.eq-drop-target {
  background: #dff4fb;
  box-shadow: inset 0 0 0 2px var(--eq-accent);
}

.eq-board-column-head { padding: 0.15rem 0.25rem 0.5rem; }

.eq-board-column-body { min-height: 6rem; }

.eq-board-empty {
  border: 1px dashed #c5ccd6;
  border-radius: 0.5rem;
  padding: 1.25rem 0.5rem;
}

.eq-project-card {
  border: 0;
  border-left: 3px solid transparent;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
  cursor: grab;
}

.eq-project-card:hover { box-shadow: 0 2px 8px rgba(16, 24, 40, 0.14); }
.eq-project-card--stuck { border-left-color: #f5b400; }
.eq-project-card--hold { border-left-color: #dc3545; }
.eq-project-card.eq-dragging { opacity: 0.45; }

.eq-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: #cfe7f5;
  color: #0a4a6b;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Stage stepper, grouped by phase. Wraps rather than scrolls on a phone. */
.eq-stepper { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; }
.eq-stepper-phase { flex: 1 1 14rem; }

.eq-stepper-phase-label {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: #6c757d;
  margin-bottom: 0.4rem;
}

.eq-stepper-steps { display: flex; gap: 0.35rem; }

.eq-step {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  min-width: 0;
}

.eq-step::before {
  content: "";
  position: absolute;
  top: 0.9rem;
  left: -50%;
  width: 100%;
  height: 2px;
  background: #dee2e6;
  z-index: 0;
}

.eq-step:first-child::before { display: none; }
.eq-step--done::before,
.eq-step--current::before { background: var(--eq-accent); }

.eq-step-dot {
  position: relative;
  z-index: 1;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 2px solid #dee2e6;
  color: #adb5bd;
  font-size: 0.85rem;
}

.eq-step--done .eq-step-dot { background: var(--eq-accent); border-color: var(--eq-accent); color: #06232b; }
.eq-step--current .eq-step-dot { border-color: var(--eq-accent); color: #0a7a93; box-shadow: 0 0 0 4px rgba(13, 202, 240, 0.2); }

.eq-step-label {
  font-size: 0.72rem;
  margin-top: 0.3rem;
  color: #6c757d;
  line-height: 1.15;
}

.eq-step--current .eq-step-label { color: #212529; font-weight: 600; }

.eq-timeline-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.8rem;
}

.eq-thumb {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 0.4rem;
  border: 1px solid #dee2e6;
}

.eq-thumb--lg { width: 160px; height: 120px; }

.eq-line-table .form-control-sm,
.eq-line-table .form-select-sm { min-width: 5rem; }

@media print {
  .eq-board, .eq-stepper { display: none; }
  .nav-tabs, .eq-lineage, .dropdown, form button, .btn { display: none !important; }
}

/* Anchor target from a production page's "Connect a service" menu. */
.eq-integration-tile { background: #fff; }
[id^="integration-"]:target .eq-integration-tile {
  border-color: var(--eq-accent) !important;
  box-shadow: 0 0 0 3px rgba(13, 202, 240, 0.25);
}

/* Settings overview tiles (settings/overviews/show). */
.eq-settings-tile { transition: box-shadow 0.12s ease-in-out, border-color 0.12s ease-in-out; }
.eq-settings-tile:hover { border-color: var(--eq-accent); box-shadow: 0 2px 10px rgba(16, 24, 40, 0.08); }

.eq-settings-tile-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #e8f7fb;
  color: #0a7a93;
  font-size: 1.15rem;
}
