/*
 * HDM Smart Search — "The Concierge" (design handoff v2, 2026-06-11).
 *
 * One anchor bar through every beat. Tokens, type sizes, spacing, and copy
 * come from the design handoff README and are treated as final.
 * Everything is scoped under .hdm-search-app.hdm-c2. Typography is Sen.
 *
 * State classes on the root drive all visibility:
 *   .is-idle  .is-working  .is-done  .mode-quick  .has-results  .is-fallback
 */

.hdm-search-app.hdm-c2 {
  /* Concierge tokens */
  --bg: #F6F8FC;
  --card: #FFFFFF;
  --ink: #1A2433;
  --ink-soft: #56627A;
  --blue: #115FEB;
  --blue-deep: #0C46B8;
  --blue-tint: #EEF4FE;
  --green: #37B44A;
  --green-deep: #1E8E33;
  --green-tint: #EAF7EC;
  --line: #DFE5EF;
  --amber: #8A6A1F;
  --amber-bg: #FFF6DF;
  --stop: #B23A26;
  --stop-bg: #FBEEEA;
  --shadow: 0 2px 12px rgba(16, 40, 90, .08);
  --placeholder: #93A0B8;

  box-sizing: border-box;
  display: block;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Sen', sans-serif;
  line-height: 1.45;
}
.hdm-search-app.hdm-c2 *,
.hdm-search-app.hdm-c2 *::before,
.hdm-search-app.hdm-c2 *::after { box-sizing: border-box; }

.hdm-search-app.hdm-c2 button {
  font-family: inherit;
  cursor: pointer;
}

/* The hidden attribute always wins over any display rule in this app. */
.hdm-search-app [hidden] { display: none !important; }
.hdm-search-app.hdm-c2 a { text-decoration: none; color: inherit; }
.hdm-search-app.hdm-c2 a:hover { text-decoration: none; }

.hdm-search-app .hdm-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Shell widths. Idle and working read at 1080, results with sidebar at 1160. */
.hdm-search-app .hdm-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 44px;
}
.hdm-search-app.is-done .hdm-shell,
.hdm-search-app.has-results .hdm-shell { max-width: 1160px; }

/* ------------------------------------------------------------------------- *
 * Visibility matrix
 * ------------------------------------------------------------------------- */

.hdm-search-app .hdm-heading,
.hdm-search-app .hdm-teach,
.hdm-search-app .hdm-idle-phone { display: none; }
.hdm-search-app.is-idle .hdm-heading,
.hdm-search-app.is-idle .hdm-teach,
.hdm-search-app.is-idle .hdm-idle-phone { display: block; }
/* Beats the later .hdm-phoneline display:flex at equal specificity. */
.hdm-search-app:not(.is-idle) .hdm-idle-phone { display: none !important; }
.hdm-search-app.is-idle .hdm-idle-phone { display: flex; }

.hdm-search-app .hdm-workzone { display: none; }
.hdm-search-app.is-working .hdm-workzone { display: block; }

.hdm-search-app .hdm-search-layout { display: none; }
.hdm-search-app.is-done .hdm-search-layout,
.hdm-search-app.has-results .hdm-search-layout { display: block; }

.hdm-search-app .hdm-answerhead,
.hdm-search-app .hdm-refine { display: none; }
.hdm-search-app.is-done .hdm-answerhead,
.hdm-search-app.is-done .hdm-refine { display: block; }

.hdm-search-app .hdm-nudge { display: none; }
.hdm-search-app.mode-quick.has-results:not(.is-fallback) .hdm-nudge { display: flex; }

/* Bar internals per state */
.hdm-search-app .hdm-seg { display: none; }
.hdm-search-app:not(.is-idle) .hdm-seg { display: inline-flex; }

.hdm-search-app .hdm-bar-modes { display: none; }
.hdm-search-app.is-idle .hdm-bar-modes { display: flex; }

.hdm-search-app .hdm-bar-clear { display: none; }
.hdm-search-app:not(.is-idle) .hdm-bar-clear { display: inline-flex; }

.hdm-search-app .hdm-bar-strip { display: none; }
.hdm-search-app.is-working .hdm-bar-strip--working { display: flex; }
.hdm-search-app.is-done .hdm-bar-strip--done { display: flex; }
.hdm-search-app.mode-quick.has-results:not(.is-working) .hdm-bar-strip--quick { display: block; }

/* Stronger than the later shared display:flex styling block. */
.hdm-search-app:not(.is-working) .hdm-bar-stop { display: none !important; }
.hdm-search-app.is-working .hdm-bar-go { display: none !important; }

/* ------------------------------------------------------------------------- *
 * Heading
 * ------------------------------------------------------------------------- */

.hdm-search-app .hdm-h1 {
  margin: 0;
  font-size: 29px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--ink);
}
.hdm-search-app .hdm-h1-sub {
  margin: 12px 0 24px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 640px;
}

/* ------------------------------------------------------------------------- *
 * The anchor bar
 * ------------------------------------------------------------------------- */

.hdm-search-app .hdm-bar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
}

.hdm-search-app .hdm-bar-labelrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.hdm-search-app .hdm-bar-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* Compact segmented switch */
.hdm-search-app .hdm-seg {
  background: var(--blue-tint);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}
.hdm-search-app .hdm-seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 1.5px solid transparent;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 14.5px;
  min-height: 40px;
  white-space: nowrap;
}
.hdm-search-app .hdm-seg-btn.is-on {
  background: #fff;
  border-color: var(--blue);
  color: var(--blue-deep);
}
.hdm-search-app .hdm-seg-btn .hdm-seg-star { display: none; color: var(--blue); line-height: 0; }
.hdm-search-app .hdm-seg-btn.is-on .hdm-seg-star { display: inline-flex; }

/* Input row */
.hdm-search-app .hdm-bar-inputrow {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hdm-search-app .hdm-bar-inputwrap {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #FAFBFE;
  padding: 14px 16px;
  min-height: 64px;
}
.hdm-search-app .hdm-bar-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  resize: none;
  overflow: hidden;
  background: transparent;
  box-shadow: none;   /* the theme gives every textarea a soft shadow box */
  font-family: inherit;
  font-size: 16.5px;
  line-height: 1.5;
  color: var(--ink);
  padding: 0;
  display: block;
}
.hdm-search-app .hdm-bar-input::placeholder { color: var(--placeholder); }
.hdm-search-app .hdm-bar-input:focus { outline: none; box-shadow: none; }
.hdm-search-app .hdm-bar-inputwrap:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-tint);
}

.hdm-search-app .hdm-bar-clear {
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
  background: none;
  border: 0;
  padding: 4px 6px;
  min-height: 32px;
}
.hdm-search-app .hdm-bar-clear:hover { color: var(--ink); }

/* Green action + Stop */
.hdm-search-app .hdm-bar-go,
.hdm-search-app .hdm-bar-stop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 12px;
  min-height: 56px;
  font-weight: 700;
  font-size: 17px;
  border: 0;
}
.hdm-search-app .hdm-bar-go {
  background: var(--green-deep);
  color: #fff;
}
.hdm-search-app .hdm-bar-go:hover { background: #197B2B; }
.hdm-search-app .hdm-bar-stop {
  background: var(--stop-bg);
  border: 2px solid var(--stop);
  color: var(--stop);
  font-size: 16.5px;
}

/* Desktop action sits in the input row, mobile action below the modes. */
.hdm-search-app .hdm-bar-actions--desktop { display: none; }
.hdm-search-app .hdm-bar-actions--mobile { display: block; }
.hdm-search-app .hdm-bar-actions--mobile .hdm-bar-go,
.hdm-search-app .hdm-bar-actions--mobile .hdm-bar-stop { width: 100%; font-size: 17.5px; }

/* Idle two-way choice */
.hdm-search-app .hdm-bar-modes {
  flex-direction: column;
  gap: 10px;
}
.hdm-search-app .hdm-mode-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 12px;
  flex: 1;
  text-align: left;
  border: 1.5px solid var(--line);
  background: #fff;
  min-height: 64px;
}
.hdm-search-app .hdm-mode-row.is-on {
  border: 2px solid var(--blue);
  background: var(--blue-tint);
  padding: 12.5px 15.5px;
}
.hdm-search-app .hdm-mode-dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #C2CBDB;
  background: #fff;
  color: transparent;
}
.hdm-search-app .hdm-mode-row.is-on .hdm-mode-dot {
  border: 0;
  background: var(--blue);
  color: #fff;
}
.hdm-search-app .hdm-mode-body { min-width: 0; }
.hdm-search-app .hdm-mode-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
}
.hdm-search-app .hdm-mode-title .hdm-seg-star { color: var(--blue); line-height: 0; }
.hdm-search-app .hdm-mode-sub {
  display: block;
  font-size: 14px;
  color: var(--ink-soft);
  margin-top: 2px;
}

/* Working strip */
.hdm-search-app .hdm-bar-strip--working {
  background: var(--blue-tint);
  border-radius: 12px;
  padding: 13px 16px;
  flex-direction: column;
  gap: 10px;
}
.hdm-search-app .hdm-strip-main {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 1;
}
.hdm-search-app .hdm-strip-step {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--blue-deep);
}
.hdm-search-app .hdm-strip-note {
  font-size: 14px;
  color: var(--ink-soft);
}

/* Done strip */
.hdm-search-app .hdm-bar-strip--done {
  background: var(--green-tint);
  border-radius: 12px;
  padding: 13px 16px;
  gap: 11px;
  align-items: center;
  color: var(--green-deep);
}
.hdm-search-app .hdm-done-circle {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--green-deep);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hdm-search-app .hdm-done-text {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--green-deep);
  flex: 1;
}

/* Quick helper */
.hdm-search-app .hdm-bar-strip--quick {
  font-size: 14.5px;
  color: var(--ink-soft);
}

/* Pulse dot (honest activity, no percent) */
.hdm-search-app .hdm-pulse {
  width: 11px; height: 11px;
  background: var(--blue);
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  animation: hdmPulse 1.6s ease-in-out infinite;
}
@keyframes hdmPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.45); opacity: .55; }
}

/* ------------------------------------------------------------------------- *
 * Idle zone + teaching
 * ------------------------------------------------------------------------- */

.hdm-search-app .hdm-idle-zone { display: block; }
.hdm-search-app .hdm-teach { margin-top: 34px; }
.hdm-search-app .hdm-teach-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 13px;
}
.hdm-search-app .hdm-teach-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.hdm-search-app .hdm-teach-slip {
  background: var(--blue-tint);
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  min-height: 44px;
  text-align: left;
}
.hdm-search-app .hdm-teach-slip:hover { background: #E2EDFD; }
.hdm-search-app .hdm-teach-quote { color: var(--green); font-weight: 800; }
.hdm-search-app .hdm-teach-quote:first-child { margin-right: 6px; }
.hdm-search-app .hdm-teach-cap {
  font-size: 14.5px;
  color: var(--ink-soft);
  margin-top: 11px;
}
.hdm-search-app .hdm-idle-phone { margin-top: 36px; }

.hdm-search-app .hdm-phoneline {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 15.5px;
}
.hdm-search-app .hdm-phoneline--center { justify-content: center; margin-top: 24px; }
.hdm-search-app .hdm-phoneline-ic { color: var(--green-deep); line-height: 0; }
.hdm-search-app .hdm-phoneline-num { font-weight: 800; color: var(--ink); }
.hdm-search-app .hdm-phoneline-num:hover { color: var(--blue-deep); }

/* ------------------------------------------------------------------------- *
 * Working zone
 * ------------------------------------------------------------------------- */

.hdm-search-app .hdm-workzone { margin-top: 22px; }
.hdm-search-app .hdm-workcard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
}
.hdm-search-app .hdm-workcard-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.hdm-search-app .hdm-workcard-head .hdm-pulse { width: 12px; height: 12px; }
.hdm-search-app .hdm-workcard-h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
}
.hdm-search-app .hdm-workcard-sub {
  font-size: 15.5px;
  color: var(--ink-soft);
  margin: 10px 0 18px;
  line-height: 1.5;
}
.hdm-search-app .hdm-workstep {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
}
.hdm-search-app .hdm-workstep + .hdm-workstep { border-top: 1px dashed var(--line); }
.hdm-search-app .hdm-workstep[data-state="todo"] { opacity: .45; }
.hdm-search-app .hdm-workstep-circle {
  width: 28px; height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F0F3F9;
}
.hdm-search-app .hdm-workstep-check { display: none; color: #fff; line-height: 0; }
.hdm-search-app .hdm-workstep-dot { display: none; width: 9px; height: 9px; }
.hdm-search-app .hdm-workstep[data-state="done"] .hdm-workstep-circle { background: var(--green-deep); }
.hdm-search-app .hdm-workstep[data-state="done"] .hdm-workstep-check { display: inline-flex; }
.hdm-search-app .hdm-workstep[data-state="active"] .hdm-workstep-circle {
  background: var(--blue-tint);
  border: 2px solid var(--blue);
}
.hdm-search-app .hdm-workstep[data-state="active"] .hdm-workstep-dot { display: inline-block; }
.hdm-search-app .hdm-workstep-label {
  font-size: 16.5px;
  font-weight: 600;
  color: var(--ink);
}
.hdm-search-app .hdm-workstep[data-state="active"] .hdm-workstep-label { font-weight: 700; }
.hdm-search-app .hdm-workstep-now {
  display: none;
  margin-left: auto;
  font-size: 13.5px;
  color: var(--ink-soft);
}
.hdm-search-app .hdm-workstep[data-state="active"] .hdm-workstep-now { display: inline; }

.hdm-search-app .hdm-outs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}
.hdm-search-app .hdm-out {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  border-radius: 12px;
  background: #fff;
  font-weight: 700;
  font-size: 16px;
}
.hdm-search-app .hdm-out--quick {
  border: 2px solid var(--blue);
  color: var(--blue-deep);
}
.hdm-search-app .hdm-out--call {
  border: 1.5px solid var(--line);
  color: var(--ink);
}
.hdm-search-app .hdm-out-ic { color: var(--green-deep); line-height: 0; }
.hdm-search-app .hdm-workzone-foot {
  font-size: 14.5px;
  color: var(--ink-soft);
  margin-top: 14px;
  text-align: center;
  line-height: 1.5;
}

/* ------------------------------------------------------------------------- *
 * Results — answer, tools, the one list
 * ------------------------------------------------------------------------- */

.hdm-search-app .hdm-search-layout { margin-top: 24px; }
.hdm-search-app .hdm-search-rail { display: none; }

.hdm-search-app .hdm-answer-h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--ink);
}
.hdm-search-app .hdm-answer-sub {
  font-size: 15.5px;
  color: var(--ink-soft);
  margin: 10px 0 0;
  line-height: 1.5;
}
.hdm-search-app .hdm-answerhead { margin-bottom: 20px; }

.hdm-search-app .hdm-softnote {
  background: var(--amber-bg);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  margin-bottom: 16px;
}
.hdm-search-app .hdm-softnote-lead { font-weight: 700; }

/* Desktop sort row hidden on mobile */
.hdm-search-app .hdm-sortrow { display: none; }
.hdm-search-app .hdm-count { font-size: 16.5px; color: var(--ink); }

/* Mobile tools */
.hdm-search-app .hdm-mtools {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}
.hdm-search-app .hdm-mtools-row { display: flex; gap: 10px; }
.hdm-search-app .hdm-mbtn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 50px;
  border-radius: 12px;
  background: #fff;
  font-weight: 700;
  font-size: 15.5px;
}
.hdm-search-app .hdm-mbtn--filters {
  border: 2px solid var(--blue);
  color: var(--blue-deep);
}
.hdm-search-app .hdm-mbtn--sort {
  border: 1.5px solid var(--line);
  color: var(--ink);
}
.hdm-search-app .hdm-mbtn-badge {
  background: var(--blue);
  color: #fff;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 800;
  padding: 2px 8px;
}

/* Active filter chips */
.hdm-search-app .hdm-chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.hdm-search-app .hdm-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--blue-tint);
  border: 1.5px solid var(--blue);
  color: var(--blue-deep);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 700;
  min-height: 40px;
}
.hdm-search-app .hdm-chip-x {
  background: none;
  border: 0;
  color: var(--blue-deep);
  font-size: 17px;
  line-height: 1;
  padding: 0 2px;
  font-weight: 700;
}
.hdm-search-app .hdm-chip-clear {
  background: none;
  border: 0;
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  min-height: 40px;
}

/* The one list */
.hdm-search-app .hdm-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: opacity .18s ease;
}
.hdm-search-app .hdm-list.is-loading { opacity: .6; }

/* Rich pick card */
.hdm-search-app .hdm-pick {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  position: relative;
}
.hdm-search-app .hdm-pick-media {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 150px;
  border: 1px solid #E4E7EC;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.hdm-search-app .hdm-pick-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}
.hdm-search-app .hdm-pick-noimg {
  display: block;
  width: 60%;
  height: 60%;
  border-radius: 8px;
  background: linear-gradient(135deg, #EDF0F5, #E0E5EC);
}
.hdm-search-app .hdm-pick-rank {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--blue-deep);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.hdm-search-app .hdm-pick-name {
  display: block;
  font-size: 17.5px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
}
.hdm-search-app .hdm-pick-name:hover { color: var(--blue-deep); }
.hdm-search-app .hdm-pick-price {
  font-size: 20px;
  font-weight: 800;
  color: var(--green-deep);
  margin-top: 5px;
}
.hdm-search-app .hdm-pick-reasons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.hdm-search-app .hdm-pick-reason {
  display: flex;
  gap: 9px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
}
.hdm-search-app .hdm-pick-check {
  color: var(--green);
  line-height: 0;
  margin-top: 2px;
  flex-shrink: 0;
}
.hdm-search-app .hdm-pick-tradeoff {
  font-size: 15px;
  line-height: 1.45;
  color: var(--amber);
  background: var(--amber-bg);
  border-radius: 8px;
  padding: 8px 10px;
}
.hdm-search-app .hdm-pick-tradeoff-lead { font-weight: 700; }
.hdm-search-app .hdm-pick-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 10px;
  border: 2px solid var(--green-deep);
  color: var(--green-deep);
  font-weight: 700;
  font-size: 15.5px;
}
.hdm-search-app .hdm-pick-cta:hover { background: var(--green-tint); }

/* Compact card */
.hdm-search-app .hdm-mini {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  gap: 14px;
  align-items: center;
}
.hdm-search-app .hdm-mini:active { background: #F4F8FE; }
.hdm-search-app .hdm-mini-media {
  width: 92px; height: 92px;
  flex-shrink: 0;
  border: 1px solid #E4E7EC;
  border-radius: 10px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.hdm-search-app .hdm-mini-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}
.hdm-search-app .hdm-mini-body { min-width: 0; flex: 1; }
.hdm-search-app .hdm-mini-name {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--blue-deep);
}
.hdm-search-app .hdm-mini-spec {
  display: block;
  font-size: 14px;
  color: var(--ink-soft);
  margin: 3px 0 4px;
}
.hdm-search-app .hdm-mini-price {
  display: block;
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
}
.hdm-search-app .hdm-mini-fits {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--green-deep);
}
.hdm-search-app .hdm-mini-fits span { line-height: 0; }
.hdm-search-app .hdm-mini-chev { color: var(--ink-soft); flex-shrink: 0; line-height: 0; }

/* Entry animation */
.hdm-search-app .hdm-in { animation: hdmIn .34s ease both; }
@keyframes hdmIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Show more */
.hdm-search-app .hdm-more-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
}
.hdm-search-app .hdm-more-wrap[hidden] { display: none; }
.hdm-search-app .hdm-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  border-radius: 12px;
  border: 2px solid var(--green-deep);
  color: var(--green-deep);
  font-weight: 700;
  font-size: 17px;
  background: #fff;
  width: 100%;
}
.hdm-search-app .hdm-more-btn:hover { background: var(--green-tint); }
.hdm-search-app .hdm-more-cap { font-size: 14.5px; color: var(--ink-soft); }

/* Refine card */
.hdm-search-app .hdm-refine {
  margin-top: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
}
.hdm-search-app .hdm-refine-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 11px;
}
.hdm-search-app .hdm-refine-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
.hdm-search-app .hdm-refine-chip {
  border: 1.5px solid var(--blue);
  color: var(--blue-deep);
  border-radius: 999px;
  padding: 10px 17px;
  font-size: 15px;
  font-weight: 700;
  background: #fff;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.hdm-search-app .hdm-refine-chip:hover { background: var(--blue-tint); }

/* Smart nudge (quick results) */
.hdm-search-app .hdm-nudge {
  margin-top: 22px;
  background: var(--blue-tint);
  border: 1.5px solid var(--blue);
  border-radius: 14px;
  padding: 16px;
  gap: 14px;
  flex-direction: column;
  align-items: flex-start;
}
.hdm-search-app .hdm-nudge-body {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex: 1;
}
.hdm-search-app .hdm-nudge-star { color: var(--blue); line-height: 0; margin-top: 2px; }
.hdm-search-app .hdm-nudge-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.hdm-search-app .hdm-nudge-sub {
  font-size: 14.5px;
  color: var(--ink-soft);
  margin-top: 3px;
  line-height: 1.5;
}
.hdm-search-app .hdm-nudge-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 12px;
  background: var(--blue);
  border: 0;
  color: #fff;
  font-weight: 700;
  font-size: 15.5px;
  padding: 0 24px;
  align-self: stretch;
}

/* Zero state */
.hdm-search-app .hdm-zero {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px 20px;
  text-align: center;
}
.hdm-search-app .hdm-zero-title { font-size: 17px; font-weight: 700; margin: 0 0 8px; }
.hdm-search-app .hdm-zero-hint { font-size: 15px; color: var(--ink-soft); margin: 0 0 8px; }
.hdm-search-app .hdm-zero-clear {
  background: none;
  border: 0;
  color: var(--blue);
  font-size: 15px;
  font-weight: 700;
  text-decoration: underline;
  padding: 0;
}
.hdm-search-app .hdm-zero-call { font-size: 15px; color: var(--ink-soft); margin: 0; }

/* ------------------------------------------------------------------------- *
 * Filter rail (desktop) / sheet contents (mobile drawer)
 * ------------------------------------------------------------------------- */

.hdm-search-app .hdm-rail-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.hdm-search-app .hdm-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.hdm-search-app .hdm-rail-title { margin: 0; font-size: 17px; font-weight: 800; color: var(--ink); }
.hdm-search-app .hdm-rail-clear {
  background: none;
  border: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--blue);
  text-decoration: underline;
}
.hdm-search-app .hdm-rail-inner { display: flex; flex-direction: column; gap: 22px; }

.hdm-search-app .hdm-fg { border: 0; padding: 0; margin: 0; min-width: 0; }
.hdm-search-app .hdm-fg-legend {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0 !important; /* the theme indents legends -30px */
}
.hdm-search-app .hdm-fg-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: 0;
  padding: 0 0 10px;
}
.hdm-search-app .hdm-fg-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.hdm-search-app .hdm-fg-caret {
  width: 9px; height: 9px;
  border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft);
  transform: rotate(45deg);
  transition: transform .15s ease;
}
.hdm-search-app .hdm-fg.is-collapsed .hdm-fg-caret { transform: rotate(-45deg); }
.hdm-search-app .hdm-fg-body { display: flex; flex-direction: column; gap: 2px; }
.hdm-search-app .hdm-fg-empty { font-size: 14px; color: var(--ink-soft); margin: 0; }
.hdm-search-app .hdm-fg-expander {
  background: none;
  border: 0;
  color: var(--blue);
  font-size: 14.5px;
  font-weight: 700;
  text-decoration: underline;
  text-align: left;
  padding: 8px 0 0;
}

/* Checkboxes */
.hdm-search-app .hdm-check {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 40px;
  cursor: pointer;
}
.hdm-search-app .hdm-check input {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
}
.hdm-search-app .hdm-check-box {
  width: 22px; height: 22px;
  border-radius: 6px;
  flex-shrink: 0;
  border: 2px solid #B9C3D6;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.hdm-search-app .hdm-check input:checked + .hdm-check-box {
  border: 0;
  background: var(--blue);
}
.hdm-search-app .hdm-check input:checked + .hdm-check-box::after {
  content: "";
  width: 11px; height: 6px;
  border-left: 2.6px solid #fff;
  border-bottom: 2.6px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
}
.hdm-search-app .hdm-check input:focus-visible + .hdm-check-box {
  outline: 3px solid var(--blue-tint);
}
.hdm-search-app .hdm-check-label { font-size: 15.5px; color: var(--ink); flex: 1; }
.hdm-search-app .hdm-check input:checked ~ .hdm-check-label { font-weight: 700; }
.hdm-search-app .hdm-check-count { font-size: 13.5px; color: var(--ink-soft); }

/* Preset chips (price, weight, speed, range bands) */
.hdm-search-app .hdm-price-presets,
.hdm-search-app .hdm-fg-body > div { gap: 8px; }
.hdm-search-app .hdm-price-presets { display: flex; flex-wrap: wrap; margin-bottom: 12px; }
.hdm-search-app .hdm-preset-chip {
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14.5px;
  font-weight: 700;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.hdm-search-app .hdm-preset-chip.is-active {
  border: 2px solid var(--blue);
  background: var(--blue-tint);
  color: var(--blue-deep);
  padding: 9.5px 15.5px;
}

/* Min/Max price inputs */
.hdm-search-app .hdm-price-inputs {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.hdm-search-app .hdm-price-cap { font-size: 13px; color: var(--ink-soft); margin-bottom: 4px; display: block; }
.hdm-search-app .hdm-price-dash { color: var(--ink-soft); margin-bottom: 12px; }
.hdm-search-app .hdm-num {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  min-height: 44px;
  background: #fff;
}
.hdm-search-app .hdm-num::placeholder { color: var(--placeholder); }

/* ------------------------------------------------------------------------- *
 * Mobile filter sheet
 * ------------------------------------------------------------------------- */

.hdm-search-app .hdm-scrim {
  position: fixed;
  inset: 0;
  background: rgba(18, 28, 48, .45);
  z-index: 99990;
}
.hdm-search-app .hdm-drawer {
  position: fixed;
  inset: 0;
  z-index: 99991;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  font-family: 'Sen', sans-serif;
}
.hdm-search-app .hdm-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.hdm-search-app .hdm-drawer-title { margin: 0; font-size: 18px; font-weight: 800; color: var(--ink); }
.hdm-search-app .hdm-drawer-close {
  width: 44px; height: 44px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 22px;
  line-height: 1;
  color: var(--ink);
}
.hdm-search-app .hdm-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
/* The rail node moves into the sheet on mobile; un-hide it there. */
.hdm-search-app .hdm-drawer-body .hdm-search-rail {
  display: block !important;
  position: static;
  max-height: none;
  overflow: visible;
}
.hdm-search-app .hdm-drawer-body .hdm-rail-card { box-shadow: none; border: 0; padding: 0; background: transparent; }
.hdm-search-app .hdm-drawer-foot {
  display: flex;
  gap: 12px;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--card);
  border-top: 1px solid var(--line);
}
.hdm-search-app .hdm-drawer-clear {
  flex: 0 0 auto;
  background: none;
  border: 0;
  color: var(--blue);
  font-size: 15px;
  font-weight: 700;
  text-decoration: underline;
  padding: 0 6px;
}
.hdm-search-app .hdm-drawer-show {
  flex: 1;
  background: var(--green-deep);
  color: #fff;
  border: 0;
  border-radius: 12px;
  min-height: 52px;
  font-weight: 700;
  font-size: 16px;
}
body.hdm-drawer-open { overflow: hidden; }

/* ------------------------------------------------------------------------- *
 * Telemetry (debug only)
 * ------------------------------------------------------------------------- */

.hdm-search-app .hdm-telemetry {
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.hdm-search-app .hdm-trace-pre {
  font-size: 11px;
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

/* ------------------------------------------------------------------------- *
 * Desktop (>= 768 / >= 1024)
 * ------------------------------------------------------------------------- */

@media (min-width: 768px) {
  .hdm-search-app .hdm-shell { padding: 48px 40px 56px; }

  .hdm-search-app .hdm-h1 { font-size: 42px; }
  .hdm-search-app .hdm-h1-sub { font-size: 18px; }

  .hdm-search-app .hdm-bar { padding: 20px 24px; }

  /* Idle: bar + teaching side by side */
  .hdm-search-app.is-idle .hdm-idle-zone {
    display: grid;
    grid-template-columns: minmax(0, 640px) minmax(0, 1fr);
    gap: 44px;
    align-items: start;
  }
  .hdm-search-app.is-idle .hdm-teach { margin-top: 4px; }

  /* Bar: input + action side by side; mobile action hidden */
  .hdm-search-app .hdm-bar-inputrow { flex-direction: row; align-items: stretch; }
  .hdm-search-app .hdm-bar-actions--desktop {
    display: flex;
    align-items: center;
    flex-shrink: 0;
  }
  .hdm-search-app .hdm-bar-actions--desktop .hdm-bar-go { padding: 0 28px; align-self: center; }
  .hdm-search-app .hdm-bar-actions--desktop .hdm-bar-stop { padding: 0 24px; align-self: center; }
  .hdm-search-app .hdm-bar-actions--mobile { display: none; }
  .hdm-search-app .hdm-bar-modes { flex-direction: row; }

  /* Working strip: one row */
  .hdm-search-app .hdm-bar-strip--working {
    flex-direction: row;
    gap: 14px;
    align-items: center;
  }

  /* Working zone centered at 660 */
  .hdm-search-app .hdm-workzone { max-width: 660px; margin: 26px auto 0; }
  .hdm-search-app .hdm-workcard { padding: 28px; }
  .hdm-search-app .hdm-workcard-h2 { font-size: 24px; }
  .hdm-search-app .hdm-outs { flex-direction: row; }

  /* Results: desktop tools */
  .hdm-search-app .hdm-answer-h1 { font-size: 30px; }
  .hdm-search-app .hdm-sortrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
  }
  .hdm-search-app .hdm-count { font-size: 17px; }
  .hdm-search-app .hdm-sortside { display: flex; align-items: center; gap: 9px; }
  .hdm-search-app .hdm-sort-label {
    font-size: 14px;
    color: var(--ink-soft);
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
  }
  .hdm-search-app .hdm-sort-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 9px 16px;
    font-size: 14.5px;
    font-weight: 700;
    min-height: 42px;
    border: 1.5px solid var(--line);
    background: #fff;
    color: var(--ink-soft);
  }
  .hdm-search-app .hdm-sort-pill.is-on {
    border: 2px solid var(--ink);
    background: var(--ink);
    color: #fff;
  }
  .hdm-search-app .hdm-mtools .hdm-mtools-row { display: none; }
  .hdm-search-app .hdm-mtools .hdm-count--m { display: none; }
  .hdm-search-app .hdm-mtools { margin-bottom: 14px; }

  /* Rich pick card: horizontal */
  .hdm-search-app .hdm-pick {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr) 150px;
    gap: 24px;
    align-items: center;
    padding: 20px;
  }
  .hdm-search-app .hdm-pick-media { height: 140px; }
  .hdm-search-app .hdm-pick-name { font-size: 18px; }
  .hdm-search-app .hdm-pick-cta { align-self: center; }

  .hdm-search-app .hdm-more-btn { width: 360px; }

  .hdm-search-app .hdm-nudge {
    flex-direction: row;
    align-items: center;
    padding: 18px 22px;
  }
  .hdm-search-app .hdm-nudge-btn { align-self: center; }

  .hdm-search-app .hdm-workzone, .hdm-search-app .hdm-bar { scroll-margin-top: 84px; }
}

@media (min-width: 1024px) {
  /* Results layout: sidebar + column */
  .hdm-search-app.is-done .hdm-search-layout,
  .hdm-search-app.has-results .hdm-search-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
    margin-top: 28px;
  }
  .hdm-search-app .hdm-search-rail {
    display: block;
    position: sticky;
    top: 16px;
    align-self: start;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
  }
  .hdm-search-app .hdm-mtools .hdm-chip-row { display: none; }
}

/* ------------------------------------------------------------------------- *
 * Reduced motion
 * ------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .hdm-search-app .hdm-pulse { animation: none; }
  .hdm-search-app .hdm-in { animation: none; opacity: 1; transform: none; }
  .hdm-search-app .hdm-list { transition: none; }
  .hdm-search-app .hdm-fg-caret { transition: none; }
}

/* The grey canvas reaches the viewport edges — the app box alone stops at
   the content column and reads as a grey card on a white page on desktop. */
body.hdm-search-page,
body.hdm-search-page .site-content,
body.hdm-search-page .hfeed { background: #F6F8FC; }

/* ---- Anchored-scope chip, grounded answer, Keep exploring ---- */
.hdm-search-app .hdm-ctxchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--blue-tint, #EEF4FE);
  border: 1px solid #BCD3F5;
  border-radius: 999px;
  padding: 6px 6px 6px 13px;
  margin-bottom: 12px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--blue-deep, #0C46B8);
}
.hdm-search-app .hdm-ctxchip[hidden] { display: none; }
.hdm-search-app .hdm-ctxchip .hdm-ctxchip-x {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--blue-deep, #0C46B8);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hdm-search-app .hdm-answertext {
  margin: 10px 0 0;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line, #DFE5EF);
  border-left: 3px solid var(--green-deep, #1E8E33);
  border-radius: 12px;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink, #1A2433);
  max-width: 720px;
}
.hdm-search-app .hdm-answertext[hidden] { display: none; }
.hdm-search-app .hdm-explore { margin: 26px 0 6px; }
.hdm-search-app .hdm-explore[hidden] { display: none; }
.hdm-search-app:not(.is-done) .hdm-explore { display: none !important; }
.hdm-search-app .hdm-explore-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink, #1A2433);
  margin-bottom: 12px;
}
.hdm-search-app .hdm-explore-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.hdm-search-app .hdm-explore-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--line, #DFE5EF);
  border-radius: 12px;
  padding: 12px;
  text-decoration: none;
  color: var(--ink, #1A2433);
  min-height: 64px;
}
.hdm-search-app .hdm-explore-card:hover { border-color: #BCD3F5; text-decoration: none; }
.hdm-search-app .hdm-explore-img {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: #F0F3F9;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hdm-search-app .hdm-explore-img img { max-width: 100%; max-height: 100%; object-fit: cover; }
.hdm-search-app .hdm-explore-body { min-width: 0; }
.hdm-search-app .hdm-explore-kind {
  display: block;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft, #56627A);
}
.hdm-search-app .hdm-explore-name {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.3;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Instant UI retired by default (backend toggle) ----
   The Smart/Quick mode switch and the "Show quick results now" out only
   exist when the instant_surfaces option is on. Off (default) = search is
   always smart; quick results appear only as the silent show-more fallback. */
.hdm-search-app.instant-off .hdm-seg,
.hdm-search-app.instant-off .hdm-bar-modes,
.hdm-search-app.instant-off .hdm-out--quick { display: none !important; }
