/* ===== Dashboard Styles ===== */

/* Dashboard Hero */
.dash-hero {
  padding: 7rem 2rem 3rem;
  background: var(--bg);
  position: relative;
}
.dash-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background: radial-gradient(ellipse at 50% 0%, rgba(212,168,67,0.06) 0%, transparent 60%);
  pointer-events: none;
}
.dash-hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}
.dash-welcome { flex: 1; }
.dash-headline {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 0.75rem;
}
.dash-headline em { color: var(--accent); font-style: italic; }
.dash-sub { font-size: 0.95rem; color: var(--fg-muted); }

.btn-new-roadmap {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.5rem;
  background: var(--accent);
  color: #0B1628;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 12px;
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-new-roadmap:hover { background: var(--accent-light); transform: translateY(-1px); }

/* Nav User area */
.nav-user { display: flex; align-items: center; gap: 1rem; position: relative; }
.nav-greeting { font-size: 0.85rem; color: var(--fg-muted); }
.nav-link-back { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--fg-muted); transition: color 0.2s; }
.nav-link-back:hover { color: var(--accent); }

.logout-form { display: inline; }
.btn-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.78rem;
  font-family: var(--font-body);
  padding: 0.3rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-logout:hover { border-color: rgba(248,113,113,0.4); color: #f87171; }

/* Notification Bell */
.notif-bell {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fg-muted);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border-radius: 8px;
  transition: color 0.2s;
}
.notif-bell:hover { color: var(--accent); }
.notif-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--accent);
  color: #0B1628;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* Notification Panel */
.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #111f38;
  border: 1px solid rgba(212,168,67,0.15);
  border-radius: 12px;
  width: 300px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.4);
  z-index: 100;
  overflow: hidden;
}
.notif-panel-header {
  padding: 0.875rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.notif-list { max-height: 320px; overflow-y: auto; }
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: background 0.15s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: rgba(255,255,255,0.03); }
.notif-icon { font-size: 1.1rem; flex-shrink: 0; line-height: 1; padding-top: 1px; }
.notif-body { flex: 1; }
.notif-title { font-size: 0.8rem; font-weight: 500; color: var(--fg); margin-bottom: 0.2rem; }
.notif-meta { font-size: 0.7rem; color: var(--fg-muted); }

/* Dashboard Content */
.dash-content { padding: 1rem 2rem 5rem; }
.dash-container { max-width: 1100px; margin: 0 auto; }

/* Empty State */
.dash-empty {
  padding: 5rem 2.5rem;
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
}
.dash-empty-icon { margin-bottom: 2rem; display: flex; justify-content: center; }
.dash-empty-title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 400; margin-bottom: 0.75rem; }
.dash-empty-sub { font-size: 0.9rem; color: var(--fg-muted); line-height: 1.6; margin-bottom: 2rem; }

/* Section Header */
.dash-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.dash-section-title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 400; }
.dash-roadmap-count { font-size: 0.8rem; color: var(--fg-muted); background: rgba(255,255,255,0.05); border: 1px solid var(--border); border-radius: 100px; padding: 0.25rem 0.75rem; }

/* Roadmap Grid */
.roadmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-bottom: 3rem;
}

.roadmap-card { padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }

.rc-header { display: flex; align-items: center; gap: 1.25rem; }
.rc-score-ring { position: relative; flex-shrink: 0; }
.rc-score-center {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
}
.rc-score-num { font-size: 1.5rem; font-weight: 800; color: var(--fg); line-height: 1; }
.rc-meta { display: flex; flex-direction: column; gap: 0.4rem; }

.tier-badge-sm {
  font-size: 0.68rem;
  font-weight: 700;
  border: 1px solid;
  border-radius: 100px;
  padding: 0.2rem 0.6rem;
  display: inline-block;
}
.rc-date { font-size: 0.75rem; color: var(--fg-muted); }

.rc-info { display: flex; flex-direction: column; gap: 0.5rem; }
.rc-field { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; }
.rc-field-label { color: var(--fg-muted); }
.rc-field-val { font-weight: 600; color: var(--fg); }

.btn-view-roadmap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: rgba(212,168,67,0.1);
  border: 1px solid rgba(212,168,67,0.25);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  transition: all 0.2s;
  margin-top: auto;
}
.btn-view-roadmap:hover { background: rgba(212,168,67,0.2); border-color: rgba(212,168,67,0.4); }

/* Dashboard CTA */
.dash-cta { display: flex; align-items: center; justify-content: center; gap: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.dash-cta-text { font-size: 0.85rem; color: var(--fg-muted); }
.btn-ghost-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.5rem;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  font-size: 0.875rem;
  color: var(--fg-muted);
  transition: all 0.2s;
}
.btn-ghost-outline:hover { color: var(--accent); border-color: var(--accent); }

/* ===== Roadmap Detail Page ===== */
.rd-hero {
  padding: 7rem 2rem 3rem;
  text-align: center;
  background: var(--bg);
}
.rd-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 60%;
  background: radial-gradient(ellipse at 50% 0%, rgba(212,168,67,0.07) 0%, transparent 60%);
  pointer-events: none;
}
.rd-hero-inner { max-width: 640px; margin: 0 auto; }
.rd-headline {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 0.75rem;
}
.rd-headline em { color: var(--accent); font-style: italic; }
.rd-sub { font-size: 0.9rem; color: var(--fg-muted); }
.rd-sub strong { color: var(--accent); }

.rd-content { min-height: 70vh; }
.rd-container { max-width: 900px; margin: 0 auto; padding: 0 2rem 5rem; }

/* Milestone status badges */
.ms-status-badges { display: flex; align-items: center; gap: 0.5rem; }
.ms-badge {
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 100px;
  padding: 0.2rem 0.6rem;
  border: 1px solid;
}
.ms-badge-done { background: rgba(74,222,128,0.12); color: #4ade80; border-color: rgba(74,222,128,0.25); }
.ms-badge-progress { background: rgba(212,168,67,0.12); color: var(--accent); border-color: rgba(212,168,67,0.25); }
.ms-badge-pending { background: rgba(255,255,255,0.04); color: var(--fg-muted); border-color: var(--border); }

/* Input summary grid */
.rd-section { margin-bottom: 3rem; }
.input-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.input-card { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; }
.input-label { font-size: 0.72rem; color: var(--fg-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.input-val { font-size: 1.1rem; font-weight: 700; color: var(--fg); }

/* Actions bar */
.rd-actions { display: flex; align-items: center; gap: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* Responsive */
@media (max-width: 768px) {
  .dash-hero-inner { flex-direction: column; align-items: flex-start; }
  .input-grid { grid-template-columns: repeat(2, 1fr); }
  .roadmap-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .input-grid { grid-template-columns: 1fr; }
  .rd-actions { flex-direction: column; }
}

/* Lender comparison table */
.lender-compare-wrap { overflow-x: auto; }
.lender-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.lender-compare-table th {
  text-align: left;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.lender-compare-table td {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.lender-compare-table tr:last-child td { border-bottom: none; }
.lender-compare-table tr:hover td { background: rgba(255,255,255,0.02); }
.lct-name { font-weight: 600; color: var(--fg); }
.lct-muted { color: var(--fg-muted); }
.lct-rate { color: var(--accent); font-weight: 600; }
.lct-score { font-weight: 500; }
.lct-loan { font-weight: 500; }
.btn-lct-learn {
  display: inline-block;
  padding: 0.45rem 1rem;
  background: rgba(212,168,67,0.1);
  border: 1px solid rgba(212,168,67,0.25);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s;
}
.btn-lct-learn:hover { background: rgba(212,168,67,0.2); border-color: rgba(212,168,67,0.4); }

/* Lender tier filter pill row */
.lender-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1rem 1.25rem 0;
  margin-bottom: 0.25rem;
}
.tier-pill {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.35rem 0.85rem;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.tier-pill:hover { color: var(--fg); border-color: rgba(255,255,255,0.16); }
.tier-pill-active {
  color: var(--accent);
  border-color: rgba(212,168,67,0.4);
  background: rgba(212,168,67,0.1);
}

/* Tier group header inside the lender comparison table */
.lender-tier-row td {
  padding: 0.65rem 1.25rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  background: transparent;
  border-bottom: 1px solid var(--border);
}
.lender-tier-row:hover td { background: transparent; }
.lender-tier-rec-label {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--accent);
  font-size: 0.7rem;
}

/* Recommended badge inside lender name cell */
.lender-recommended-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 100px;
  border: 1px solid rgba(212,168,67,0.35);
  background: rgba(212,168,67,0.12);
  color: var(--accent);
  vertical-align: middle;
}

@media (max-width: 768px) {
  .lender-compare-table th:nth-child(5),
  .lender-compare-table td:nth-child(5) { display: none; }
}

@media (max-width: 639px) {
  /* Listings page filter pill rows — stack vertically on small viewports
     so long city names don't wrap into an awkward cluster and pages don't
     overflow horizontally. Pills stretch full-width with consistent gutters;
     desktop >=640px layout is unaffected (.lender-filter-row stays flex-wrap:wrap). */
  .lender-filter-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .tier-pill {
    width: 100%;
    text-align: center;
  }

  /* Listings page hero — clamp() in .dash-headline resolves to its 2rem (32px)
     floor on a 360px viewport, which is too large. Scope to .listings-page so
     /dashboard, /chat, and /contact hero typography is untouched. */
  .listings-page .dash-headline {
    font-size: 1.75rem;
    line-height: 1.15;
    letter-spacing: -0.01em;
  }
  .listings-page .dash-sub {
    font-size: 0.9rem;
    line-height: 1.5;
  }
  /* Safety net against any single long city / price string forcing
     document-level horizontal scroll before the per-card guards in
     roadmap.css kick in. */
  body.listings-page {
    overflow-x: hidden;
  }
}

/* Lenders index grid — wider than the dashboard's fixed 3-col so the public catalog
   reflows naturally across breakpoints. */
.lenders-page .lender-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* Live Listings Feed — compact rows of newest listings inside a glass card.
   Server-renders #feed-initial-list at first paint; the poller prepends
   server-fetched rows into #feed-new-listings with a fade-in. */
.live-feed {
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
}
.feed-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid rgba(212, 168, 67, 0.12);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}
.feed-item:last-child { border-bottom: none; }
.feed-item:hover { background: rgba(212, 168, 67, 0.04); }
.feed-item-main { flex: 1; min-width: 0; }
.feed-item-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feed-item-meta {
  font-size: 0.78rem;
  color: var(--fg-muted);
}
.feed-item-tier { flex-shrink: 0; }
.feed-time {
  font-size: 0.72rem;
  color: var(--fg-muted);
  flex-shrink: 0;
  min-width: 5rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.feed-new {
  opacity: 0;
  animation: feedFadeIn 0.4s ease forwards;
}
@keyframes feedFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}