/* ==========================================================================
   HomePilot Buyer Dashboard — styles
   Built entirely on tokens.css / base.css / layout.css / components.css.
   No new colors, fonts, spacing, or radii are introduced here.
   ========================================================================== */

body[data-page="dashboard"] {
  background: var(--cloud-50);
}

/* ---- Dashboard header (distinct from the marketing site header) ---- */

.dash-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--mist-200);
}

.dash-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0.85rem var(--container-pad);
}

.dash-header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.dash-icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--mist-200);
  border-radius: var(--radius-sm);
  color: var(--ink-900);
}

.dash-icon-btn:hover {
  border-color: var(--mist-300);
}

.dash-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--teal-700);
  color: var(--paper);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.dash-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ink-900);
  color: var(--paper);
  border: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dash-notif-wrap,
.dash-account-wrap {
  position: relative;
}

.dash-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  max-width: 86vw;
  background: var(--paper);
  border: 1px solid var(--mist-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-4);
  z-index: 250;
}

.dash-dropdown[hidden] {
  display: none;
}

.dash-dropdown-head {
  font-weight: 700;
  color: var(--ink-900);
  margin-bottom: var(--sp-3);
  font-size: var(--fs-small);
}

.dash-dropdown-footer {
  display: block;
  text-align: center;
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--mist-200);
  font-size: var(--fs-caption);
  font-weight: 600;
  color: var(--teal-700);
}

.dash-dropdown--account {
  width: 240px;
  display: flex;
  flex-direction: column;
}

.dash-account-name {
  font-weight: 700;
  color: var(--ink-900);
  font-size: var(--fs-small);
}

.dash-account-email {
  color: var(--text-muted);
  font-size: var(--fs-caption);
}

.dash-dropdown--account a {
  padding: var(--sp-2) 0;
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--ink-900);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dash-disabled-link {
  color: var(--text-muted) !important;
}

.dash-soon {
  font-size: var(--fs-caption);
  background: var(--cloud-100);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}

/* ---- Quick nav ---- */

.dash-quicknav {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding: 0 var(--container-pad) var(--sp-3);
  max-width: var(--container-w);
  margin: 0 auto;
  scrollbar-width: none;
}

.dash-quicknav::-webkit-scrollbar {
  display: none;
}

.dash-quicknav-link {
  flex-shrink: 0;
  font-size: var(--fs-caption);
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--cloud-100);
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.9rem;
  white-space: nowrap;
  transition: background-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
}

.dash-quicknav-link.is-active {
  background: var(--ink-900);
  color: var(--paper);
}

/* ---- Section rhythm ---- */

.dash-main {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: var(--sp-7) var(--container-pad) var(--sp-9);
  display: flex;
  flex-direction: column;
  gap: var(--sp-9);
}

.dash-section {
  scroll-margin-top: 132px;
}

.dash-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.dash-section-head h2 {
  font-size: 1.4rem;
}

.dash-section-link {
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--teal-700);
  white-space: nowrap;
}

/* ---- Welcome ---- */

.welcome-card {
  background: linear-gradient(135deg, var(--ink-900) 0%, var(--ink-700) 100%);
  border-radius: var(--radius-lg);
  padding: var(--sp-7);
  color: var(--paper);
}

.welcome-card h1 {
  color: var(--paper);
  font-size: clamp(1.6rem, 4vw, 2.1rem);
}

.welcome-sub {
  margin-top: var(--sp-2);
  color: var(--on-dark-secondary);
  font-size: var(--fs-body-lg);
}

.advisor-strip {
  margin-top: var(--sp-6);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.advisor-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gold-500);
  color: var(--ink-900);
  font-family: var(--font-display);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.advisor-info {
  flex: 1;
  min-width: 180px;
}

.advisor-name {
  font-weight: 700;
  color: var(--paper);
  display: block;
  font-size: var(--fs-small);
}

.advisor-role {
  color: var(--on-dark-secondary);
  font-size: var(--fs-caption);
}

/* ---- Listing carousel / cards ---- */

.listing-row {
  display: flex;
  gap: var(--sp-5);
  overflow-x: auto;
  padding-bottom: var(--sp-2);
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.listing-row::-webkit-scrollbar {
  display: none;
}

@media (min-width: 760px) {
  .listing-row {
    flex-wrap: wrap;
    overflow: visible;
  }
}

.listing-card {
  flex: 0 0 270px;
  scroll-snap-align: start;
  background: var(--paper);
  border: 1px solid var(--mist-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out),
              opacity 280ms var(--ease-out);
}

.listing-card.is-leaving {
  opacity: 0;
  transform: scale(0.97);
}

.listing-card.is-entering {
  opacity: 0;
  transform: scale(0.97);
  transition: none;
}

.listing-interstitial {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-7) var(--sp-5);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--fs-small);
  font-weight: 600;
  height: 100%;
  min-height: 320px;
  box-sizing: border-box;
}

.thinking-dots {
  display: flex;
  gap: 5px;
}

.thinking-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal-700);
  animation: thinkingPulse 1.2s ease-in-out infinite;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes thinkingPulse {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

.listing-exhausted {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-7) var(--sp-5);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--fs-small);
  height: 100%;
  min-height: 320px;
  box-sizing: border-box;
}

.listing-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

@media (min-width: 760px) {
  .listing-card { flex: 1 1 280px; max-width: 340px; }
}

.listing-photo-wrap {
  position: relative;
  aspect-ratio: 4 / 2.6;
  background: var(--cloud-50);
}

.listing-photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.listing-sample-badge {
  position: absolute;
  top: var(--sp-3);
  left: var(--sp-3);
  background: rgba(11, 37, 69, 0.78);
  color: var(--paper);
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}

.listing-status-badge {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  background: var(--teal-700);
  color: var(--paper);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}

.listing-save-btn {
  position: absolute;
  bottom: var(--sp-3);
  right: var(--sp-3);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-900);
}

.listing-save-btn svg {
  width: 18px;
  height: 18px;
  transition: fill var(--dur-fast) var(--ease-out), stroke var(--dur-fast) var(--ease-out);
}

.listing-save-btn.is-saved svg {
  fill: #C0392B;
  stroke: #C0392B;
}

.listing-body {
  padding: var(--sp-4);
}

.listing-price {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--ink-900);
}

.listing-specs {
  margin-top: 2px;
  font-size: var(--fs-small);
  color: var(--text-secondary);
}

.listing-address {
  margin-top: var(--sp-2);
  font-size: var(--fs-small);
  color: var(--text-secondary);
}

.listing-why-label {
  margin-top: var(--sp-3);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.listing-reasons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: var(--sp-2);
}

.listing-match {
  margin-top: 0;
  display: flex;
  gap: 6px;
  align-items: flex-start;
  font-size: 12.5px;
  color: var(--teal-800);
  background: var(--teal-050);
  border-radius: var(--radius-sm);
  padding: var(--sp-2) var(--sp-3);
}

.reaction-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: var(--sp-4);
}

.reaction-btn {
  background: var(--paper);
  border: 1.5px solid var(--mist-200);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.4rem;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background-color var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out),
              color var(--dur-base) var(--ease-out);
}

.reaction-btn:hover {
  border-color: var(--mist-300);
}

.reaction-btn[data-reaction="pass"].is-selected {
  background: var(--cloud-100);
  border-color: var(--mist-300);
  color: var(--ink-900);
}

.reaction-btn[data-reaction="maybe"].is-selected {
  background: var(--gold-100);
  border-color: var(--gold-500);
  color: var(--ink-900);
}

.reaction-btn[data-reaction="love"].is-selected {
  background: var(--teal-700);
  border-color: var(--teal-700);
  color: var(--paper);
}

.listing-card.is-passed {
  opacity: 0.55;
}

.listing-actions {
  margin-top: var(--sp-4);
  display: flex;
  gap: var(--sp-2);
}

.listing-actions .btn {
  flex: 1;
  padding: 0.6rem 0.8rem;
  font-size: 13px;
}

/* ---- Empty states ---- */

.dash-empty {
  text-align: center;
  padding: var(--sp-7) var(--sp-5);
  border: 1.5px dashed var(--mist-300);
  border-radius: var(--radius-lg);
  background: var(--paper);
}

.dash-empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--cloud-100);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--sp-4);
}

.dash-empty h3 {
  font-size: 1.05rem;
}

.dash-empty p {
  margin-top: var(--sp-2);
  color: var(--text-secondary);
  font-size: var(--fs-small);
  max-width: 360px;
  margin-inline: auto;
}

.dash-empty .btn {
  margin-top: var(--sp-5);
}

/* ---- Ask HomePilot ---- */

.ask-card {
  padding: var(--sp-6);
}

.ask-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
}

.ask-chip {
  background: var(--cloud-100);
  border: 1px solid var(--mist-200);
  border-radius: var(--radius-pill);
  padding: 0.45rem 0.9rem;
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--ink-900);
  transition: background-color var(--dur-base) var(--ease-out);
}

.ask-chip:hover {
  background: var(--teal-100);
}

.ask-input-row {
  margin-top: var(--sp-5);
  display: flex;
  gap: var(--sp-2);
}

.ask-input-row input {
  flex: 1;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.8rem 1rem;
  border: 1.5px solid var(--mist-300);
  border-radius: var(--radius-sm);
}

.ask-send-btn {
  width: 46px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--teal-700);
  color: var(--paper);
  border: none;
  border-radius: var(--radius-sm);
}

.ask-response {
  margin-top: var(--sp-5);
  background: var(--cloud-50);
  border-left: 3px solid var(--teal-700);
  border-radius: var(--radius-sm);
  padding: var(--sp-4);
  font-size: var(--fs-small);
  color: var(--ink-900);
  display: none;
}

.ask-response.show {
  display: block;
}

.ask-disclaimer {
  margin-top: var(--sp-4);
  font-size: var(--fs-caption);
  color: var(--text-muted);
}

/* ---- Tour requests ---- */

.tour-card {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
}

.tour-card-photo {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--cloud-50);
}

.tour-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tour-card-body {
  flex: 1;
  min-width: 0;
}

.tour-card-address {
  font-weight: 700;
  color: var(--ink-900);
  font-size: var(--fs-small);
}

.tour-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--gold-500);
  margin-top: 4px;
}

.tour-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold-500);
}

/* ---- Messages ---- */

.message-card {
  padding: 0;
  overflow: hidden;
}

.message-thread-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--mist-200);
}

.message-thread-body {
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  max-height: 320px;
  overflow-y: auto;
}

.message-bubble-row {
  display: flex;
}

.message-bubble-row.is-sent {
  justify-content: flex-end;
}

.message-bubble {
  max-width: 80%;
  padding: 0.7rem 1rem;
  border-radius: 14px;
  font-size: var(--fs-small);
  line-height: 1.5;
}

.message-bubble-row:not(.is-sent) .message-bubble {
  background: var(--cloud-50);
  border: 1px solid var(--mist-200);
  color: var(--ink-900);
  border-bottom-left-radius: 4px;
}

.message-bubble-row.is-sent .message-bubble {
  background: var(--teal-700);
  color: var(--paper);
  border-bottom-right-radius: 4px;
}

.message-time {
  display: block;
  margin-top: 4px;
  font-size: 10.5px;
  opacity: 0.7;
}

.message-input-row {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--mist-200);
}

.message-input-row input {
  flex: 1;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--mist-300);
  border-radius: var(--radius-pill);
}

/* ---- Recent activity ---- */

.activity-list {
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--mist-200);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--teal-100);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-icon img { width: 16px; height: 16px; }

.activity-text {
  font-size: var(--fs-small);
  color: var(--ink-900);
}

.activity-time {
  font-size: var(--fs-caption);
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---- Notifications section ---- */

.notif-list-item {
  display: flex;
  gap: var(--sp-4);
  align-items: flex-start;
  padding: var(--sp-4);
  border-radius: var(--radius-md);
}

.notif-list-item + .notif-list-item {
  margin-top: var(--sp-2);
}

.notif-list-item.is-unread {
  background: var(--teal-050);
}

.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal-700);
  flex-shrink: 0;
  margin-top: 6px;
}

.notif-list-item:not(.is-unread) .notif-dot {
  background: transparent;
}

.notif-text {
  font-size: var(--fs-small);
  color: var(--ink-900);
}

.notif-time {
  font-size: var(--fs-caption);
  color: var(--text-muted);
  margin-top: 2px;
}

/* Items rendered inside the header dropdown reuse the same look, condensed */
.dash-dropdown .notif-list-item {
  padding: var(--sp-2) var(--sp-1);
}

/* ---- Living timeline (expandable stage cards, Your Path Home) ----
   Reuses .accordion-trigger / .accordion-panel / .accordion-icon from
   components.css for expand-collapse mechanics, and the same node-styling
   logic as .journey-node for visual consistency with the compact tracker
   above it. This is the only section rebuilt per the "redesign the buyer
   journey" task; every other dashboard section is unchanged. */

.stage-list {
  margin-top: var(--sp-7);
  display: flex;
  flex-direction: column;
}

.stage-item {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: var(--sp-4);
  position: relative;
  padding-bottom: var(--sp-6);
}

.stage-item:last-child {
  padding-bottom: 0;
}

.stage-marker {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  background: var(--cloud-100);
  border: 2px solid var(--mist-300);
  color: var(--text-muted);
  z-index: 2;
  flex-shrink: 0;
}

.stage-item.is-complete .stage-marker {
  background: var(--teal-700);
  border-color: var(--teal-700);
  color: var(--paper);
}

.stage-item.is-current .stage-marker {
  background: var(--paper);
  border-color: var(--teal-700);
  color: var(--teal-700);
  box-shadow: 0 0 0 4px var(--teal-100);
}

.stage-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 40px;
  width: 2px;
  bottom: calc(-1 * var(--sp-6));
  background-image: linear-gradient(var(--mist-300) 60%, transparent 0%);
  background-size: 2px 9px;
  background-repeat: repeat-y;
}

.stage-item.is-complete:not(:last-child)::before {
  background-image: none;
  background-color: var(--teal-700);
}

.stage-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  background: none;
  border: none;
  text-align: left;
  padding: 0;
  font-family: inherit;
}

.stage-trigger-text {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.stage-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--ink-900);
}

.stage-status-pill {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.stage-status-pill.status-complete {
  background: var(--teal-100);
  color: var(--teal-800);
}

.stage-status-pill.status-current {
  background: var(--gold-100);
  color: var(--gold-500);
}

.stage-status-pill.status-upcoming {
  background: var(--cloud-100);
  color: var(--text-muted);
}

.stage-panel-inner {
  padding: var(--sp-4) 0 0;
}

.stage-panel-inner p {
  font-size: var(--fs-small);
  color: var(--text-secondary);
  line-height: 1.6;
}

.stage-panel-inner p + p {
  margin-top: var(--sp-3);
}

.stage-faq {
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--mist-200);
}

.stage-faq-item + .stage-faq-item {
  margin-top: var(--sp-3);
}

.stage-faq-q {
  font-weight: 600;
  color: var(--ink-900);
  font-size: var(--fs-small);
}

.stage-faq-a {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: var(--fs-small);
}

.stage-ask-btn {
  margin-top: var(--sp-5);
}

/* The compact tracker above the stage list is clickable on the dashboard
   (JS adds role="button"); the visually identical tracker on the Thank You
   page has no JS attached and is correctly left non-interactive. */
.journey-node-wrap[role="button"] {
  cursor: pointer;
}

.journey-node-wrap[role="button"]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 8px;
}

/* Minimal empty-state line used inside list cards (activity, notifications)
   once real data replaces seed data and lists can legitimately be empty. */
.dash-list-empty {
  color: var(--text-muted);
  font-size: var(--fs-small);
  text-align: center;
  padding: var(--sp-4) 0;
}
