/* ── Buyer Portal CSS ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f7f6f3; }
#pcrm-buyer-app a { text-decoration: none; }

/* ── Auth pages ───────────────────────────────────────────── */
.buyer-auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem; background: #f7f6f3; }
.buyer-auth-logo { margin-bottom: 1.5rem; text-align: center; }
.buyer-auth-logo .auth-logo { max-height: 44px; }
.buyer-auth-logo .auth-site-name { font-size: 20px; font-weight: 600; color: #1a1a1a; }
.buyer-auth-card { background: #fff; border: 1px solid #e8e8e4; border-radius: 14px; padding: 2rem; width: 100%; max-width: 420px; }
.buyer-auth-card h1 { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.buyer-auth-card p { font-size: 14px; color: #888; margin-bottom: 1.5rem; }
.buyer-field { margin-bottom: 1rem; }
.buyer-field label { display: block; font-size: 13px; font-weight: 500; color: #444; margin-bottom: 5px; }
.buyer-field input { width: 100%; padding: 10px 13px; border: 1px solid #ddd; border-radius: 9px; font-size: 14px; color: #1a1a1a; outline: none; font-family: inherit; transition: border-color .15s; }
.buyer-field input:focus { border-color: #1a1a1a; }
.buyer-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt { font-weight: 400; color: #bbb; font-size: 11px; margin-left: 3px; }
.buyer-btn-primary { width: 100%; padding: 11px; background: #1a1a1a; color: #fff; border: none; border-radius: 9px; font-size: 14px; font-weight: 500; cursor: pointer; margin-top: 4px; transition: opacity .15s; }
.buyer-btn-primary:hover { opacity: .85; }
.buyer-btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.buyer-auth-footer { text-align: center; margin-top: 1rem; font-size: 13px; color: #888; }
.buyer-auth-footer a { color: #1a1a1a; font-weight: 500; }
.buyer-alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 1rem; }
.buyer-alert-error { background: #fff0f0; border: 1px solid #fcc; color: #c00; }
.buyer-alert-success { background: #e6f7ee; border: 1px solid #a0dbb8; color: #1a7a40; }

/* ── Portal layout ────────────────────────────────────────── */
#pcrm-buyer-app { display: flex; min-height: 100vh; }
.buyer-sidebar { width: 230px; flex-shrink: 0; background: #fff; border-right: 1px solid #ece9e4; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; }
.buyer-sidebar-logo { padding: 1.5rem 1.25rem 1.25rem; border-bottom: 1px solid #ece9e4; }
.buyer-sidebar-logo .site-logo { max-height: 36px; }
.buyer-site-name { font-size: 16px; font-weight: 600; color: #1a1a1a; }
.buyer-main { margin-left: 230px; flex: 1; background: #f7f6f3; min-height: 100vh; }
.buyer-view { display: none; padding: 2rem; }
.buyer-view.active { display: block; }
.buyer-view-header { margin-bottom: 1.5rem; }
.buyer-view-header h1 { font-size: 22px; font-weight: 600; color: #1a1a1a; }

/* ── Sidebar nav ──────────────────────────────────────────── */
.buyer-nav { flex: 1; padding: 1rem 0; }
.buyer-nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 1.25rem; font-size: 13px; color: #666; transition: background .12s, color .12s; border-radius: 0; cursor: pointer; }
.buyer-nav-item:hover { background: #f7f6f3; color: #1a1a1a; }
.buyer-nav-item.active { background: #f0ede8; color: #1a1a1a; font-weight: 500; }
.buyer-nav-item svg { flex-shrink: 0; opacity: .7; }
.buyer-nav-badge { background: #d44; color: #fff; font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 10px; margin-left: auto; }
.buyer-sidebar-user { display: flex; align-items: center; gap: 10px; padding: 1rem 1.25rem; border-top: 1px solid #ece9e4; }
.buyer-avatar { width: 34px; height: 34px; border-radius: 50%; background: #e8e4de; color: #555; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.buyer-user-info { flex: 1; min-width: 0; }
.buyer-user-name { font-size: 13px; font-weight: 500; color: #1a1a1a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buyer-user-role { font-size: 11px; color: #aaa; }
.buyer-logout { color: #bbb; transition: color .15s; }
.buyer-logout:hover { color: #1a1a1a; }

/* ── Summary cards ────────────────────────────────────────── */
.buyer-metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-bottom: 1.5rem; }
.buyer-metric { background: #fff; border: 1px solid #e8e4de; border-radius: 11px; padding: 1rem 1.25rem; }
.buyer-metric-label { font-size: 12px; color: #888; margin-bottom: 6px; }
.buyer-metric-value { font-size: 26px; font-weight: 600; color: #1a1a1a; }
.buyer-metric-sub { font-size: 12px; color: #aaa; margin-top: 3px; }

/* ── Cards ────────────────────────────────────────────────── */
.buyer-card { background: #fff; border: 1px solid #e8e4de; border-radius: 12px; overflow: hidden; margin-bottom: 1rem; }
.buyer-card-header { padding: .875rem 1.25rem; border-bottom: 1px solid #f0ede8; font-size: 11px; font-weight: 600; color: #999; text-transform: uppercase; letter-spacing: .06em; }
.buyer-card-body { padding: 1.25rem; }

/* ── Property cards ───────────────────────────────────────── */
.prop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.prop-card { background: #fff; border: 1px solid #e8e4de; border-radius: 12px; overflow: hidden; }
.prop-card-img { width: 100%; height: 150px; object-fit: cover; background: #f0ede8; display: block; }
.prop-card-img-placeholder { width: 100%; height: 150px; background: linear-gradient(135deg,#f0ede8,#e8e4de); display: flex; align-items: center; justify-content: center; color: #bbb; font-size: 13px; }
.prop-card-body { padding: 1rem; }
.prop-card-price { font-size: 18px; font-weight: 600; color: #1a1a1a; margin-bottom: 2px; }
.prop-card-addr { font-size: 13px; color: #555; margin-bottom: 6px; }
.prop-card-meta { display: flex; gap: 10px; font-size: 12px; color: #888; margin-bottom: 10px; }
.prop-card-actions { display: flex; gap: 6px; }
.buyer-btn-sm { padding: 6px 12px; border-radius: 7px; font-size: 12px; font-weight: 500; cursor: pointer; transition: opacity .15s; }
.buyer-btn-dark { background: #1a1a1a; color: #fff; border: none; }
.buyer-btn-dark:hover { opacity: .85; }
.buyer-btn-outline { background: #fff; color: #1a1a1a; border: 1px solid #ddd; }
.buyer-btn-outline:hover { background: #f7f6f3; }
.buyer-btn-danger { background: #fff; color: #c00; border: 1px solid #fcc; }
.buyer-btn-danger:hover { background: #fff0f0; }

/* ── Milestone tracker ────────────────────────────────────── */
.milestone-track { display: flex; align-items: flex-start; gap: 0; margin: 1.5rem 0; position: relative; }
.milestone-track::before { content: ''; position: absolute; top: 18px; left: 18px; right: 18px; height: 2px; background: #e8e4de; z-index: 0; }
.milestone-step { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; z-index: 1; }
.milestone-dot { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid #e8e4de; background: #fff; font-size: 14px; transition: all .3s; }
.milestone-dot.done { background: #1a1a1a; border-color: #1a1a1a; color: #fff; }
.milestone-dot.current { background: #fff; border-color: #1a1a1a; border-width: 2px; }
.milestone-label { font-size: 11px; color: #888; margin-top: 8px; text-align: center; max-width: 70px; line-height: 1.3; }
.milestone-label.done { color: #1a1a1a; font-weight: 500; }
.milestone-label.current { color: #1a1a1a; font-weight: 600; }

/* ── Viewing cards ────────────────────────────────────────── */
.viewing-card { background: #fff; border: 1px solid #e8e4de; border-radius: 12px; padding: 1.25rem; margin-bottom: 12px; display: flex; gap: 1rem; align-items: flex-start; }
.viewing-date-block { background: #f7f6f3; border-radius: 10px; padding: 10px 14px; text-align: center; min-width: 58px; flex-shrink: 0; }
.viewing-date-day { font-size: 22px; font-weight: 700; color: #1a1a1a; line-height: 1; }
.viewing-date-month { font-size: 11px; color: #888; margin-top: 2px; text-transform: uppercase; letter-spacing: .04em; }
.viewing-info { flex: 1; }
.viewing-addr { font-size: 14px; font-weight: 600; color: #1a1a1a; margin-bottom: 3px; }
.viewing-time { font-size: 13px; color: #888; margin-bottom: 8px; }
.viewing-status { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ── Offer cards ──────────────────────────────────────────── */
.offer-track-card { background: #fff; border: 1px solid #e8e4de; border-radius: 12px; padding: 1.25rem; margin-bottom: 12px; }
.offer-track-amount { font-size: 24px; font-weight: 700; color: #1a1a1a; margin-bottom: 2px; }
.offer-track-addr { font-size: 13px; color: #666; margin-bottom: 10px; }
.offer-track-status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.ots-pending  { background: #fff7e0; color: #7a5c00; }
.ots-accepted { background: #e6f7ee; color: #1a7a40; }
.ots-rejected { background: #fff0f0; color: #a00; }
.ots-withdrawn{ background: #f0f0f0; color: #666; }
.ots-countered{ background: #f0f0ff; color: #334; }

/* ── Message thread ───────────────────────────────────────── */
.buyer-msg-wrap { display: flex; flex-direction: column; height: calc(100vh - 200px); }
.buyer-msg-thread { flex: 1; overflow-y: auto; padding: 1rem 0; display: flex; flex-direction: column; gap: 10px; }
.buyer-msg { max-width: 75%; padding: 10px 14px; border-radius: 14px; font-size: 13px; line-height: 1.5; }
.buyer-msg-me { background: #1a1a1a; color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.buyer-msg-them { background: #f0ede8; color: #1a1a1a; align-self: flex-start; border-bottom-left-radius: 4px; }
.buyer-msg-time { font-size: 10px; opacity: .55; margin-top: 3px; }
.buyer-msg-compose { display: flex; gap: 8px; padding-top: 12px; border-top: 1px solid #ece9e4; margin-top: 12px; }
.buyer-msg-compose textarea { flex: 1; padding: 10px 13px; border: 1px solid #ddd; border-radius: 9px; font-size: 13px; resize: none; font-family: inherit; outline: none; }
.buyer-msg-compose textarea:focus { border-color: #1a1a1a; }
.buyer-msg-compose button { align-self: flex-end; padding: 10px 18px; background: #1a1a1a; color: #fff; border: none; border-radius: 9px; font-size: 13px; cursor: pointer; white-space: nowrap; }

/* ── Profile form ─────────────────────────────────────────── */
.profile-form { max-width: 480px; }
.profile-section { background: #fff; border: 1px solid #e8e4de; border-radius: 12px; padding: 1.5rem; margin-bottom: 1rem; }
.profile-section h2 { font-size: 14px; font-weight: 600; margin-bottom: 1rem; color: #1a1a1a; }
.profile-toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f0ede8; font-size: 13px; color: #444; }
.profile-toggle-row:last-child { border-bottom: none; }
.ptoggle { width: 38px; height: 22px; background: #ddd; border-radius: 22px; position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; border: none; }
.ptoggle::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: left .2s; }
.ptoggle.on { background: #1a1a1a; }
.ptoggle.on::after { left: 19px; }

/* ── Badges ───────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-scheduled { background: #e8f0ff; color: #1a4fa0; }
.badge-confirmed  { background: #e6f7ee; color: #1a7a40; }
.badge-completed  { background: #f0f0f0; color: #666; }
.badge-cancelled  { background: #fff0f0; color: #a00; }
.badge-no_show    { background: #fff7e0; color: #7a5c00; }

/* ── Verify banner ────────────────────────────────────────── */
.buyer-verify-banner { background: #1a1a1a; color: #fff; text-align: center; padding: 10px; font-size: 13px; }
.buyer-verify-banner.success { background: #1a7a40; }
.buyer-verify-banner.error   { background: #a00; }

/* ── Loading / empty ──────────────────────────────────────── */
.buyer-loading { padding: 2rem; text-align: center; color: #aaa; font-size: 13px; }
.buyer-empty { padding: 3rem 2rem; text-align: center; }
.buyer-empty-icon { font-size: 36px; margin-bottom: 12px; opacity: .3; }
.buyer-empty h3 { font-size: 15px; font-weight: 500; color: #666; margin-bottom: 6px; }
.buyer-empty p { font-size: 13px; color: #aaa; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .buyer-sidebar { width: 100%; height: 56px; flex-direction: row; position: fixed; bottom: 0; top: auto; border-right: none; border-top: 1px solid #ece9e4; }
  .buyer-sidebar-logo, .buyer-sidebar-user { display: none; }
  .buyer-nav { display: flex; flex-direction: row; padding: 0; overflow-x: auto; }
  .buyer-nav-item { flex-direction: column; gap: 2px; font-size: 10px; padding: 8px 12px; min-width: 56px; text-align: center; }
  .buyer-nav-item svg { width: 18px; height: 18px; }
  .buyer-main { margin-left: 0; margin-bottom: 56px; }
  .buyer-metric-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Onboarding overlay ───────────────────────────────────────────── */
#ob-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: ob-fadein .25s ease;
}
@keyframes ob-fadein { from { opacity:0 } to { opacity:1 } }

.ob-modal {
  background: #fff;
  border-radius: 18px;
  width: 100%; max-width: 520px;
  padding: 32px 36px 28px;
  position: relative;
  box-shadow: 0 24px 64px rgba(0,0,0,.18);
  animation: ob-slidein .25s ease;
}
@keyframes ob-slidein { from { transform:translateY(16px);opacity:0 } to { transform:none;opacity:1 } }

.ob-skip {
  position: absolute; top: 18px; right: 20px;
  background: none; border: none; font-size: 12px; color: #aaa;
  cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.ob-skip:hover { color: #555; background: #f5f5f3; }

.ob-progress {
  display: flex; gap: 6px; margin-bottom: 28px;
}
.ob-dot {
  height: 4px; flex: 1; border-radius: 2px;
  background: #e8e8e4; transition: background .2s;
}
.ob-dot.active { background: #1a1a1a; }
.ob-dot.done   { background: #888; }

.ob-step { animation: ob-fadein .2s ease; }
.ob-title { font-size: 20px; font-weight: 700; color: #1a1a1a; margin: 0 0 6px; }
.ob-sub   { font-size: 14px; color: #888; margin: 0 0 24px; }
.ob-hint  { font-size: 12px; color: #aaa; margin: 8px 0 0; }

/* Choice cards (step 1) */
.ob-choice-row { display: flex; gap: 12px; flex-wrap: wrap; }
.ob-choice {
  flex: 1; min-width: 120px;
  border: 2px solid #e8e8e4; border-radius: 12px;
  background: #fff; padding: 18px 12px; cursor: pointer;
  text-align: center; transition: border-color .15s, background .15s;
}
.ob-choice:hover  { border-color: #888; }
.ob-choice.selected { border-color: #1a1a1a; background: #f5f5f3; }
.ob-choice-icon   { font-size: 28px; margin-bottom: 8px; }
.ob-choice-label  { font-size: 13px; font-weight: 600; color: #1a1a1a; }

/* Budget / text inputs */
.ob-field-wrap {
  display: flex; align-items: center;
  border: 1.5px solid #e8e8e4; border-radius: 10px;
  overflow: hidden; background: #fff;
  transition: border-color .15s;
}
.ob-field-wrap:focus-within { border-color: #1a1a1a; }
.ob-field-wrap--full { width: 100%; }
.ob-input-prefix {
  padding: 0 12px; font-size: 16px; color: #888;
  background: #f5f5f3; border-right: 1px solid #e8e8e4;
  height: 48px; display: flex; align-items: center;
}
.ob-input {
  flex: 1; border: none; outline: none;
  font-size: 15px; padding: 0 14px; height: 48px;
  font-family: inherit; color: #1a1a1a; background: transparent;
  width: 100%;
}

/* Bed buttons */
.ob-beds-row { display: flex; gap: 10px; flex-wrap: wrap; }
.ob-bed-btn {
  width: 60px; height: 48px; border: 2px solid #e8e8e4;
  border-radius: 10px; background: #fff; font-size: 14px;
  font-weight: 600; color: #555; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.ob-bed-btn:hover   { border-color: #888; }
.ob-bed-btn.selected { border-color: #1a1a1a; background: #1a1a1a; color: #fff; }

/* Multi-select chips */
.ob-chips { display: flex; gap: 10px; flex-wrap: wrap; }
.ob-chip {
  padding: 9px 16px; border: 1.5px solid #e8e8e4;
  border-radius: 20px; background: #fff; font-size: 13px;
  color: #555; cursor: pointer; transition: all .15s;
}
.ob-chip:hover   { border-color: #888; }
.ob-chip.selected { border-color: #1a1a1a; background: #1a1a1a; color: #fff; }

/* Toggle rows */
.ob-toggles { display: flex; flex-direction: column; gap: 12px; }
.ob-toggle-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; color: #333; cursor: default;
}
.ob-toggle {
  min-width: 60px; height: 34px; border: 1.5px solid #e8e8e4;
  border-radius: 8px; background: #fff; font-size: 13px;
  font-weight: 600; color: #888; cursor: pointer;
  transition: all .15s;
}
.ob-toggle.on { background: #1a1a1a; border-color: #1a1a1a; color: #fff; }

/* Footer buttons */
.ob-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 28px; gap: 10px;
}
.ob-btn-next {
  background: #1a1a1a; color: #fff; border: none;
  padding: 12px 28px; border-radius: 10px; font-size: 14px;
  font-weight: 600; cursor: pointer; margin-left: auto;
  transition: background .15s;
}
.ob-btn-next:hover    { background: #333; }
.ob-btn-next:disabled { opacity: .5; cursor: not-allowed; }
.ob-btn-back {
  background: none; border: 1.5px solid #e8e8e4;
  padding: 11px 20px; border-radius: 10px; font-size: 13px;
  color: #888; cursor: pointer; transition: border-color .15s;
}
.ob-btn-back:hover { border-color: #888; color: #333; }

@media (max-width: 520px) {
  .ob-modal { padding: 24px 20px 20px; border-radius: 14px; }
  .ob-title { font-size: 17px; }
  .ob-choice-row { flex-direction: column; }
}
