/* Home Color Visualizer — page styles (works with main A1 site CSS) */

.hcv-page {
  background: #f6f4f0;
}

.hcv-wrap {
  max-width: 1400px;
  margin: 0 auto;
  /* Clear the A1 badge that hangs below the sticky header */
  padding: 3.25rem 1.25rem 3rem;
  padding-top: clamp(2.75rem, 5vw, 4rem);
}

/* Extra air under the sticky header bar itself */
.hcv-page .site-header {
  margin-bottom: 0.35rem;
}

/* Phone tip — larger screens are better for precise work */
.hcv-screen-tip {
  display: none;
  margin: 0 0 0.85rem;
  padding: 0.7rem 0.9rem;
  background: #fff8f0;
  border: 1px solid rgba(208, 33, 39, 0.18);
  border-left: 4px solid #d02127;
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #3d3832;
}

.hcv-screen-tip strong {
  color: #1a1a1a;
}

/* Interior whites disclaimer — shown only in interior mode */
.hcv-white-warning {
  display: none;
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.95rem;
  background: #fff9e8;
  border: 1px solid rgba(180, 130, 20, 0.35);
  border-left: 4px solid #c49212;
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #3d3832;
}

.hcv-white-warning[hidden] {
  display: none !important;
}

.hcv-white-warning:not([hidden]) {
  display: block;
}

.hcv-white-warning strong {
  color: #1a1a1a;
  display: inline;
}

.hcv-white-warning em {
  font-style: normal;
  font-weight: 600;
  color: #5c4a10;
}

/* Push main content clear of the overhanging logo on desktop */
@media (min-width: 768px) {
  .hcv-wrap {
    padding-top: 4.25rem;
  }
}

@media (min-width: 960px) {
  .hcv-wrap {
    padding-top: 4.75rem;
  }
}

.hcv-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.hcv-intro h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  color: var(--ink, #1a1a1a);
  line-height: 1.2;
}

.hcv-intro .lede {
  margin: 0.4rem 0 0;
  color: #5c564e;
  max-width: 42rem;
  line-height: 1.5;
}

.hcv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

/* Brand picker — sits in sidebar above the color chart */
.hcv-brand-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.9rem 1rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  margin-bottom: 1.15rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.hcv-brand-bar-sidebar {
  margin: 0;
  padding: 0.65rem 1rem 0.75rem;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: none;
  background: #faf9f7;
  flex-shrink: 0;
}

.hcv-brand-bar-sidebar .hcv-brand-buttons {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
}

.hcv-brand-bar-sidebar .brand-btn {
  min-width: 0;
  max-width: none;
  flex: none;
  width: 100%;
  padding: 0.5rem 0.65rem;
  gap: 0.55rem;
}

.hcv-brand-bar-sidebar .brand-logo-wrap {
  width: 36px;
  height: 36px;
}

.hcv-page .hcv-brand-bar-sidebar .brand-logo-wrap img,
.hcv-brand-bar-sidebar .brand-logo-wrap img {
  width: 36px !important;
  height: 36px !important;
}

.hcv-brand-bar-sidebar .brand-text strong {
  font-size: 0.82rem;
}

.hcv-brand-bar-sidebar .brand-text small {
  font-size: 0.7rem;
}

.hcv-brand-bar .tool-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b6560;
}

.hcv-brand-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  flex: 1;
}

.brand-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  min-width: 200px;
  flex: 1 1 200px;
  max-width: 320px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.brand-btn:hover {
  border-color: rgba(208, 33, 39, 0.35);
}

.brand-btn.active {
  border-color: #d02127;
  background: #fff8f8;
  box-shadow: 0 0 0 2px rgba(208, 33, 39, 0.12);
}

.brand-logo-wrap {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Override site-wide img { max-width:100%; height:auto } so logos always show in the button */
.hcv-page .brand-logo-wrap img,
.brand-logo-wrap img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain !important;
  display: block !important;
}

.brand-logo-wrap .brand-fallback {
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-fallback.bm {
  background: linear-gradient(145deg, #1a3a5c 50%, #c4a35a 50%);
}
.brand-fallback.sw {
  background: #006341;
}
.brand-fallback.cabot {
  background: linear-gradient(145deg, #5c3a1e, #c4a060);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}

.brand-text strong {
  font-size: 0.88rem;
  font-weight: 700;
}

.brand-text small {
  font-size: 0.72rem;
  color: #6b6560;
}

/* Layout — taller page so photo tools + paint chart both have room */
.hcv-main {
  display: grid;
  grid-template-columns: 1fr minmax(360px, 420px);
  gap: 1.25rem;
  align-items: stretch;
  /* Taller overall so Other targets + paint list still have room */
  min-height: min(96vh, 1200px);
}

@media (max-width: 960px) {
  .hcv-main {
    grid-template-columns: 1fr;
    min-height: 0;
  }
}

.hcv-workspace {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
  min-height: 100%;
}

/* Drop zone / canvas — white panel, stretches with the page */
.drop-zone {
  position: relative;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  min-height: 520px;
  flex: 1 1 auto;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-zone.drag-over {
  border-color: #d02127;
  background: #fff8f8;
}

.drop-zone-inner {
  text-align: center;
  padding: 2rem 1.25rem;
  max-width: 480px;
}

.drop-zone-inner h2 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
}

.drop-zone-inner p {
  color: #5c564e;
  margin: 0 0 1.1rem;
  line-height: 1.5;
  font-size: 0.95rem;
}

.drop-icon {
  font-size: 2.25rem;
  margin-bottom: 0.5rem;
}

.room-mode-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin: 0 auto 1.1rem;
  max-width: 400px;
  text-align: left;
}

.room-mode-btn {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  background: #faf9f7;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
}

.room-mode-btn small {
  font-weight: 400;
  font-size: 0.74rem;
  color: #6b6560;
}

.room-mode-btn.active {
  border-color: #d02127;
  background: #fff8f8;
  box-shadow: 0 0 0 2px rgba(208, 33, 39, 0.1);
}

.canvas-wrap {
  position: relative;
  width: 100%;
  /* Taller photo stage — more vertical room */
  height: min(82vh, 940px);
  min-height: 560px;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  background: #e8e4db;
  touch-action: none;
  overflow: hidden;
}

.canvas-viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  cursor: crosshair;
}

.canvas-stage {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  will-change: transform;
}

#display-canvas,
.mask-overlay {
  display: block;
  max-width: none;
  max-height: none;
}

#display-canvas {
  position: relative;
  z-index: 1;
}

.mask-overlay {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.55;
  mix-blend-mode: multiply;
}

/* Lines tool draft — full opacity, no multiply so cyan/yellow guides stay vivid */
.poly-overlay {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 1;
  mix-blend-mode: normal;
}

.zoom-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.65rem;
  background: rgba(30, 30, 30, 0.92);
  color: #f7f5f1;
  flex-shrink: 0;
  z-index: 6;
}

.zoom-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #f7f5f1;
  border-radius: 8px;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.55rem;
  font-weight: 700;
  cursor: pointer;
}

.zoom-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.zoom-btn.zoom-pct {
  min-width: 3.5rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.zoom-note {
  margin-left: 0.35rem;
  font-size: 0.72rem;
  opacity: 0.85;
}

.status-toast {
  position: absolute;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(28, 25, 22, 0.9);
  color: #f7f5f1;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  pointer-events: none;
  z-index: 5;
  max-width: 90%;
  text-align: center;
}

/* Toolbar — fixed tall white panel
   Top row: Photo | Surface | Tool (all labels LEFT of buttons, same baseline)
   Under Tool only: Sensitivity / Brush / Lines options
   Bottom: Undo · Redo · Clear · Reset · Download · Remove */
.hcv-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 1.2rem 1.35rem 1.15rem;
  min-height: 14rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
  box-sizing: border-box;
}

.hcv-toolbar-main {
  display: flex;
  /* Keep Photo · Surface · Tool on ONE row (Brush options stack under Tool only) */
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 1rem 1.35rem;
  flex: 1 1 auto;
  min-width: 0;
}

/* Bottom action bar — centered in the row */
.hcv-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem 0.55rem;
  min-height: 2.5rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  flex: 0 0 auto;
}

.hcv-toolbar-actions .btn-ghost {
  min-height: 2.15rem;
  padding: 0.4rem 0.75rem;
}

.tool-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: nowrap; /* keep label + controls on one line with Photo/Surface/Tools */
  flex-shrink: 0;
}

.hcv-toolbar-main > .tool-group,
.hcv-toolbar-main > .tool-group-tools {
  flex-shrink: 1;
  min-width: 0;
}

/* Prime area — single button under Lines / Brush / Select extras (right column) */
.prime-tool-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 0.55rem !important;
}

#prime-tool-group:not([hidden]) {
  display: flex !important;
}

.seg-prime {
  border: none;
  background: #f0ebe4;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #5c564e;
  cursor: pointer;
}

.seg-prime:hover {
  color: #1a1a1a;
  background: #e8e2d8;
}

.seg-prime.active,
.seg-prime.primed-on {
  background: #fff;
  color: #1a1a1a;
  box-shadow: 0 0 0 2px rgba(42, 157, 143, 0.4);
}

/* No prime is the default selected state */
#btn-no-prime.active {
  box-shadow: 0 0 0 2px rgba(92, 86, 78, 0.35);
}

/* Tool column stacks under Photo/Surface-style rows (same gap: 0.55rem from .tool-group) */
.tool-group-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* don't stretch — keeps controls tight to labels */
  gap: 0.5rem;
  flex: 0 1 auto;
  min-width: 0;
}

/* These rows use .tool-group class in HTML for identical Photo/Surface spacing */
.tool-group-tools-row,
#tolerance-group,
.brush-size-row,
.brush-modes-row {
  width: auto;
  max-width: 100%;
  flex-wrap: nowrap !important;
  flex-direction: row !important;
  align-items: center !important;
}

.tool-group-tools-row > .tools-main-seg,
.brush-modes-row > .segmented {
  flex: 0 0 auto;
}

/* Brush size: label left, slider to the RIGHT (never stacked under the word) */
.brush-size-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 0.55rem !important;
}

.brush-size-row > .tool-label {
  flex: 0 0 auto !important;
  white-space: nowrap;
  width: auto !important;
  display: inline-block !important;
}

.brush-size-row .tools-extra-controls {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  flex: 0 1 auto;
}

.hcv-toolbar-extras {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  min-height: 2.75rem;
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
}

.tools-extra-controls {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.45rem;
  min-width: 0;
  flex: 0 1 auto;
}

.tools-extra-controls input[type="range"] {
  width: 10rem;
  min-width: 6rem;
  max-width: 12rem;
  flex: 0 0 auto;
}

#brush-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  width: auto;
  max-width: 100%;
}

#brush-group:not([hidden]) {
  display: flex !important;
}

/* Invisible "Tool" = same width as Tool label so Fill/Edge/Erase starts under Lines */
.brush-modes-spacer {
  visibility: hidden;
  pointer-events: none;
  flex: 0 0 auto;
  user-select: none;
}

/* Other = dropdown inside Surface segmented control (not a second-row select) */
.other-dropdown {
  position: relative;
  display: inline-flex;
  align-items: stretch;
}

.other-dropdown > .seg {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.other-caret {
  font-size: 0.65rem;
  opacity: 0.75;
  line-height: 1;
}

.other-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 40;
  min-width: 8.5rem;
  padding: 0.3rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.other-menu[hidden] {
  display: none !important;
}

.other-menu-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-align: left;
  padding: 0.45rem 0.55rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 600;
  color: #3d3832;
  cursor: pointer;
}

.other-menu-item:hover,
.other-menu-item:focus {
  background: #f3f1ec;
  outline: none;
}

.other-menu-item.active {
  background: #eef8f6;
}

/* Distinct dots: Body orange, Trim steel blue, Door purple, Others differ */
.other1-dot {
  background: #2a9d8f; /* teal */
}
.other2-dot {
  background: #e76f51; /* coral */
}
.other3-dot {
  background: #6d597a; /* plum */
}

/* display:flex above would ignore the hidden attribute without this */
.tool-group[hidden],
#brush-group[hidden],
#lines-group[hidden],
#prime-tool-group[hidden],
#tolerance-group[hidden],
#show-mask-group[hidden] {
  display: none !important;
}

#lines-group:not([hidden]) {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
}

.seg-line {
  border: none;
  background: transparent;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #5c564e;
  cursor: pointer;
}

.seg-line.active {
  background: #fff;
  color: #1a1a1a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.tool-group-end {
  margin-left: auto;
}

.tool-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b6560;
}

.tool-meta {
  font-size: 0.82rem;
  color: #6b6560;
  min-width: 2.2rem;
}

.tool-meta-inline {
  font-size: 0.75rem;
  opacity: 0.75;
}

.segmented {
  display: inline-flex;
  background: #f0ebe4;
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  flex-wrap: nowrap; /* keep Body/Trim/Door/Other on one strip */
  align-items: center;
}

/* Target borders for Other surfaces (right panel) */
.target-btn[data-target="other1"] {
  border-color: #2a9d8f;
}
.target-btn[data-target="other2"] {
  border-color: #e76f51;
}
.target-btn[data-target="other3"] {
  border-color: #6d597a;
}
.target-btn[data-target="other1"].active {
  box-shadow: 0 0 0 2px rgba(42, 157, 143, 0.28);
  background: #f0faf8;
}
.target-btn[data-target="other2"].active {
  box-shadow: 0 0 0 2px rgba(231, 111, 81, 0.28);
  background: #fff6f3;
}
.target-btn[data-target="other3"].active {
  box-shadow: 0 0 0 2px rgba(109, 89, 122, 0.28);
  background: #f7f4f9;
}

.seg,
.seg-tool,
.seg-brush,
.seg-room,
.seg-finish {
  border: none;
  background: transparent;
  padding: 0.38rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: #5c564e;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.seg.active,
.seg-tool.active,
.seg-brush.active,
.seg-room.active,
.seg-finish.active {
  background: #fff;
  color: #1a1a1a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.swatch-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

/* Shared surface colors — Surface dots + color-target borders (top right) */
:root {
  --hcv-wall: #d27828;   /* orange */
  --hcv-trim: #2c78b4;   /* steel blue */
  --hcv-door: #8c3cb4;   /* purple */
}

.body-dot {
  background: var(--hcv-wall);
}
.trim-dot {
  background: var(--hcv-trim);
}
.door-dot {
  background: var(--hcv-door);
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: #5c564e;
  cursor: pointer;
}

#brush-size,
#tolerance {
  width: 95px;
  accent-color: #d02127;
}

.hcv-hint {
  margin: 0;
  font-size: 0.85rem;
  color: #5c564e;
  line-height: 1.45;
}









/* Ghost / secondary buttons on page */
.hcv-page .btn-ghost {
  background: transparent;
  border: none;
  color: #5c564e;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}

.hcv-page .btn-ghost:hover:not(:disabled) {
  background: #f0ebe4;
  color: #1a1a1a;
}

.hcv-page .btn-ghost:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Sidebar chart — taller so more paint chips show (name + color) despite Other rows */
.hcv-sidebar {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 64px);
  min-height: min(94vh, 1100px);
  overflow: hidden;
  position: sticky;
  top: 4.5rem;
}

@media (max-width: 960px) {
  .hcv-sidebar {
    max-height: none;
    min-height: 620px;
    position: static;
  }
}

.hcv-sidebar-header {
  padding: 1.1rem 1.15rem 0.5rem;
  flex-shrink: 0;
}

.hcv-sidebar-header h2 {
  margin: 0;
  font-size: 1.3rem;
}

.hcv-sidebar-header p {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  color: #6b6560;
}

.apply-target {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  flex-shrink: 0;
}

@media (max-width: 420px) {
  .apply-target {
    grid-template-columns: 1fr;
  }
}

.target-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  text-align: left;
  padding: 0.5rem 0.55rem;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  background: #faf9f7;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

/* Match Surface toolbar dots: Wall orange · Trim steel blue · Ceiling purple */
.target-btn[data-target="body"] {
  border-color: var(--hcv-wall);
}
.target-btn[data-target="trim"] {
  border-color: var(--hcv-trim);
}
.target-btn[data-target="door"] {
  border-color: var(--hcv-door);
}

.target-btn.active {
  background: #fff;
}
.target-btn[data-target="body"].active {
  border-color: var(--hcv-wall);
  box-shadow: 0 0 0 2px rgba(210, 120, 40, 0.28);
  background: #fff8f0;
}
.target-btn[data-target="trim"].active {
  border-color: var(--hcv-trim);
  box-shadow: 0 0 0 2px rgba(44, 120, 180, 0.28);
  background: #f3f8fc;
}
.target-btn[data-target="door"].active {
  border-color: var(--hcv-door);
  box-shadow: 0 0 0 2px rgba(140, 60, 180, 0.28);
  background: #f8f4fc;
}

.target-btn strong {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
}
.target-btn strong .swatch-dot {
  flex-shrink: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}
.target-btn strong .target-name-text {
  display: inline-block;
}

.target-btn small {
  display: block;
  font-size: 0.65rem;
  color: #6b6560;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 72px;
}

.target-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
  background: repeating-conic-gradient(#ddd 0% 25%, #fff 0% 50%) 50% / 10px 10px;
}

.finish-panel {
  padding: 0 1rem 0.7rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.finish-segmented {
  display: flex;
  width: 100%;
}

.finish-segmented .seg-finish {
  flex: 1;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.45rem 0.2rem;
  white-space: nowrap;
}

.finish-hint {
  margin: 0;
  font-size: 0.74rem;
  color: #6b6560;
}

.search-row {
  padding: 0 1rem 0.65rem;
  flex-shrink: 0;
}

#color-search {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  background: #faf9f7;
  outline: none;
  font-size: 0.92rem;
}

#color-search:focus {
  border-color: #d02127;
  box-shadow: 0 0 0 2px rgba(208, 33, 39, 0.1);
}

.family-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0 1rem 0.4rem;
  flex-shrink: 0;
}

.family-tab {
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #faf9f7;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  color: #5c564e;
}

.family-tab.active {
  background: #d02127;
  border-color: #d02127;
  color: #fff;
}

.scroll-hint {
  margin: 0;
  padding: 0 1rem 0.35rem;
  font-size: 0.74rem;
  color: #6b6560;
  flex-shrink: 0;
}

.color-scroll {
  flex: 1;
  min-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 0 1rem 1.15rem;
  scrollbar-width: thick;
}

.color-section {
  margin-bottom: 1rem;
}

.color-section-title {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 0 0.5rem;
  padding: 0.4rem 0.5rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fff 70%, rgba(255, 255, 255, 0.85));
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 0.75rem;
  align-content: start;
}

.color-grid.nested {
  padding: 0;
}

.color-card {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
  padding: 0;
  text-align: left;
  min-height: 132px;
}

.color-card:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.color-card.selected {
  border-color: #d02127;
  box-shadow: 0 0 0 2px rgba(208, 33, 39, 0.25);
}

.color-chip {
  height: 92px;
  width: 100%;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.color-chip.finish-semisolid {
  background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 55%);
}

.color-chip.finish-semi {
  background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent 50%);
}

.color-meta {
  padding: 0.55rem 0.55rem 0.65rem;
}

.color-meta .name {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.25;
  /* Show more of the name — wrap instead of clipping hard */
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.color-meta .code {
  display: block;
  font-size: 0.74rem;
  color: #6b6560;
  margin-top: 0.15rem;
}

.hcv-disclaimer {
  margin: 0;
  padding: 0.7rem 1rem 0.9rem;
  font-size: 0.68rem;
  line-height: 1.4;
  color: #6b6560;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: #faf9f7;
}

/* estimate slot lives in main styles.css (.nav-estimate-slot) */

@media (min-width: 960px) {
  .nav-desktop .nav-reserved-slot {
    display: inline-block;
  }
}

.hcv-logo-note {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  color: #6b6560;
}

/* ========== Phone / small tablet ========== */
@media (max-width: 767px) {
  /* Logo hangs below sticky header — keep title clear of badge */
  .hcv-wrap {
    padding: 1rem 0.75rem 2.5rem;
    padding-top: 5.25rem;
  }

  .hcv-screen-tip {
    display: block;
  }

  .hcv-intro {
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
  }

  .hcv-intro h1 {
    font-size: 1.4rem;
  }

  .hcv-intro .lede {
    font-size: 0.92rem;
  }

  .hcv-actions {
    width: 100%;
  }

  .hcv-actions .btn,
  .hcv-actions label.btn {
    flex: 1 1 auto;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .hcv-brand-bar {
    padding: 0.7rem 0.75rem;
    gap: 0.55rem;
  }

  .hcv-brand-bar .tool-label {
    width: 100%;
  }

  .brand-btn {
    min-width: 0;
    flex: 1 1 100%;
    max-width: none;
    padding: 0.65rem 0.8rem;
    min-height: 52px;
  }

  .brand-logo-wrap {
    width: 44px;
    height: 44px;
  }

  .hcv-page .brand-logo-wrap img,
  .brand-logo-wrap img {
    width: 44px !important;
    height: 44px !important;
  }

  .drop-zone {
    min-height: min(52vh, 360px);
    border-radius: 10px;
  }

  .drop-zone-inner {
    padding: 1.25rem 0.9rem;
  }

  .drop-zone-inner h2 {
    font-size: 1.15rem;
  }

  .room-mode-picker {
    max-width: none;
    gap: 0.45rem;
  }

  .room-mode-btn {
    min-height: 52px;
    padding: 0.6rem 0.55rem;
    font-size: 0.88rem;
  }

  /* Toolbar: stack groups on phone — still fixed tall box */
  .hcv-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 1rem 0.9rem 1rem;
    min-height: 15rem;
  }

  .hcv-toolbar-main {
    flex-direction: column;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.7rem;
  }

  .tool-group-tools {
    min-width: 0;
    width: 100%;
  }

  .tool-group-tools-row {
    flex-wrap: wrap;
  }

  .hcv-toolbar-extras {
    min-height: 3.25rem;
    padding-left: 0;
  }



  .hcv-toolbar-actions {
    gap: 0.4rem;
  }

  .hcv-toolbar-actions .btn-ghost {
    min-height: 40px;
    flex: 1 1 auto;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #faf9f7;
  }

  .tool-group {
    width: 100%;
    gap: 0.45rem 0.55rem;
  }

  .tool-group-end {
    margin-left: 0;
    justify-content: flex-start;
    gap: 0.35rem;
  }

  .tool-group-end .btn-ghost {
    min-height: 40px;
    flex: 1 1 auto;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #faf9f7;
  }

  .segmented {
    width: 100%;
    flex-wrap: wrap;
  }

  .seg,
  .seg-tool,
  .seg-brush,
  .seg-room,
  .seg-finish {
    flex: 1 1 auto;
    min-height: 40px;
    justify-content: center;
    padding: 0.45rem 0.55rem;
    font-size: 0.82rem;
  }

  #brush-size,
  #tolerance {
    flex: 1;
    width: auto;
    min-width: 120px;
    height: 28px;
  }

  .checkbox-label {
    min-height: 36px;
    font-size: 0.82rem;
  }

  .hcv-hint {
    font-size: 0.8rem;
  }

  /* Canvas: keep room to paint with thumbs */
  .canvas-viewport {
    touch-action: none;
    min-height: min(48vh, 340px);
  }

  .zoom-controls {
    bottom: 10px;
    right: 10px;
    gap: 6px;
  }

  .zoom-controls button {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .hcv-sidebar {
    min-height: 420px;
    max-height: none;
    border-radius: 10px;
  }

  .apply-target {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.4rem;
    padding: 0.6rem 0.75rem;
  }

  .target-btn {
    flex-direction: column;
    align-items: flex-start;
    min-height: 64px;
    padding: 0.45rem;
  }

  .target-btn small {
    max-width: 100%;
    white-space: normal;
  }

  .color-grid {
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  }

  .color-chip {
    min-height: 72px;
  }

  /* Status toast: don't cover thumbs at bottom */
  .status-toast {
    bottom: 72px;
    font-size: 0.78rem;
    padding: 0.5rem 0.85rem;
  }
}

@media (max-width: 420px) {
  .apply-target {
    grid-template-columns: 1fr;
  }

  .target-btn {
    flex-direction: row;
    align-items: center;
    min-height: 48px;
  }

  .hcv-actions .btn,
  .hcv-actions label.btn {
    flex: 1 1 100%;
  }
}

/* Slightly tighter desktop nav label for Color Visualizer */
@media (min-width: 960px) and (max-width: 1180px) {
  .nav-desktop a[href*="home-color-visualizer"] {
    font-size: 0.82rem;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
  }
}

/* brand-logo-fix-20260817 — keep BM / SW / Cabot logos crisp */
.hcv-page .brand-logo-wrap {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
  overflow: hidden !important;
  background: #fff !important;
}
.hcv-page .hcv-brand-bar-sidebar .brand-logo-wrap {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
}
.hcv-page .brand-logo-wrap img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  transform: none !important;
  position: static !important;
}
/* Instructions modal */
.hcv-help-modal { position:fixed; inset:0; z-index:10050; display:flex; align-items:center; justify-content:center; padding:1rem; }
.hcv-help-modal[hidden] { display:none !important; }
.hcv-help-backdrop { position:absolute; inset:0; background:rgba(20,16,12,.55); }
.hcv-help-panel { position:relative; z-index:1; width:min(560px,100%); max-height:min(86vh,720px); display:flex; flex-direction:column; background:#fff; border-radius:14px; box-shadow:0 20px 50px rgba(0,0,0,.28); overflow:hidden; }
.hcv-help-head { display:flex; align-items:center; justify-content:space-between; gap:.75rem; padding:.9rem 1.1rem; border-bottom:1px solid rgba(0,0,0,.08); background:#faf8f5; }
.hcv-help-head h2 { margin:0; font-size:1.15rem; }
.hcv-help-close { border:0; background:transparent; font-size:1.6rem; cursor:pointer; color:#666; }
.hcv-help-body { padding:1rem 1.15rem .5rem; overflow-y:auto; font-size:.92rem; line-height:1.5; color:#333; }
.hcv-help-lead { margin:0 0 .85rem; padding:.65rem .8rem; background:#fff8f0; border-left:4px solid #d02127; border-radius:8px; }
.hcv-help-body h3 { margin:.85rem 0 .35rem; font-size:.95rem; }
.hcv-help-body ul { margin:0 0 .35rem; padding-left:1.2rem; }
.hcv-help-foot { margin:.85rem 0 .5rem; font-size:.85rem; color:#666; font-style:italic; }
.hcv-help-foot-bar { padding:.75rem 1.1rem 1rem; border-top:1px solid rgba(0,0,0,.06); display:flex; justify-content:flex-end; }
.hcv-hint-help { display:inline; margin-left:.35rem; padding:0; border:0; background:none; color:#d02127; font:inherit; font-weight:700; text-decoration:underline; cursor:pointer; }
.hcv-actions { display:flex; flex-wrap:wrap; gap:.5rem; align-items:center; }