/* Business Brokerage CMS — shared styles (public site + admin) */
:root {
  --navy: #10243e;
  --navy-600: #1b3a5f;
  --blue: #1d6fb8;
  --blue-600: #155a97;
  --gold: #c9a227;
  --green: #1f8a4c;
  --red: #c0392b;
  --amber: #b7791f;
  --ink: #1a2433;
  --muted: #5b6b7f;
  --line: #e2e8f0;
  --bg: #f4f6f9;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 36, 62, .08), 0 8px 24px rgba(16, 36, 62, .06);
  --shadow-sm: 0 1px 2px rgba(16, 36, 62, .1);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--bg); line-height: 1.55; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; color: var(--navy); }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  font: inherit; font-weight: 600; padding: 11px 20px; border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; transition: .15s; text-decoration: none; background: #eef2f7; color: var(--ink); }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-600); }
.btn-gold { background: var(--gold); color: #3a2f00; }
.btn-gold:hover { background: #b8931f; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: #f0f4f8; }
.btn-danger { background: #fff; color: var(--red); border-color: #f0c8c3; }
.btn-danger:hover { background: #fdecea; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Badges ---------- */
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  letter-spacing: .02em; text-transform: uppercase; }
.badge-active { background: #e4f3ea; color: var(--green); }
.badge-under_offer { background: #fdf0d9; color: var(--amber); }
.badge-sold { background: #eceff3; color: var(--muted); }
.badge-draft { background: #eef2f7; color: var(--muted); }
.badge-withdrawn { background: #f7e9e7; color: var(--red); }
.badge-featured { background: var(--navy); color: #fff; }

/* ---------- Public header ---------- */
.site-header { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 96px; gap: 16px; }
.brand { display: flex; align-items: center; }
.brand a { color: #fff; }
.brand .name { font-family: var(--serif); font-size: 21px; font-weight: 700; letter-spacing: .01em; }
.brand-link { display: inline-flex; align-items: center; }
/* Logo art is dark-on-white, so give it a light plate to sit on in the navy bar. */
.brand-logo { height: 68px; width: auto; background: #fff; padding: 6px 12px; border-radius: 8px; }
.site-header nav a { color: #cfe0f0; margin-left: 22px; font-weight: 500; font-size: 15px; }
.site-header nav a:hover { color: #fff; }

/* ---------- Home ---------- */
.home-intro { padding: 40px 0 8px; max-width: 820px; }
.home-intro h1 { font-family: var(--serif); font-size: 32px; margin: 0 0 16px; }
.home-intro p { font-size: 17px; line-height: 1.65; color: #2b3644; margin: 0 0 14px; }
.home-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }

.service-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px; margin: 34px 0 48px; }
.service-card { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--blue);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 26px; }
.service-card h2 { font-size: 20px; margin: 0 0 12px; }
.service-card p { font-size: 15px; line-height: 1.6; color: #35485c; margin: 0 0 12px; }
.service-card p:last-child { margin-bottom: 0; }

@media (max-width: 620px) {
  .home-intro { padding-top: 26px; }
  .home-intro h1 { font-size: 25px; }
  .home-cta .btn { width: 100%; }
}

/* ---------- Listing list (single column) ---------- */
/* No hero band: the page opens straight into the listings, so give the first
   section a little more breathing room below the header. */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 16px; }
.section-head:first-child { margin-top: 34px; }
.section-head h2 { font-size: 22px; margin: 0; }
.results-count { color: var(--muted); font-size: 14px; }

.listing-list { display: flex; flex-direction: column; gap: 16px; padding-bottom: 32px; }
/* Fixed height + fixed thumbnail width => every card is identical, regardless
   of how much (or little) the body contains. */
.listing-row { display: grid; grid-template-columns: 200px 1fr; height: 160px; background: var(--card);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s; }
.listing-row:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(16,36,62,.14); text-decoration: none; }
.row-thumb { position: relative; background: #dfe6ee; overflow: hidden; }
.row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-thumb .badge { position: absolute; top: 10px; left: 10px; }
.row-body { padding: 16px 22px; display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.row-top { display: flex; align-items: center; gap: 10px; }
.row-body .cat { font-size: 12px; font-weight: 600; color: var(--blue); text-transform: uppercase; letter-spacing: .03em; }
/* Clamp the title to two lines so a long name can't push the card taller. */
.row-body .title { font-size: 18px; font-weight: 700; color: var(--navy); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-body .loc { font-size: 14px; color: var(--muted); }
.row-body .fin { margin-top: auto; display: flex; gap: 28px; padding-top: 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.row-body .fin div { line-height: 1.2; }
.row-body .fin .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.row-body .fin .val { font-size: 17px; font-weight: 700; color: var(--navy); }

/* ---------- Listing detail ---------- */
.detail { display: grid; grid-template-columns: 1fr 340px; gap: 30px; margin: 26px 0 60px; align-items: start; }
.breadcrumb { font-size: 14px; color: var(--muted); margin: 18px 0 6px; }
.detail h1 { font-family: var(--serif); font-size: 30px; margin: 4px 0 6px; }
.gallery { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #000; }
.gallery .main { aspect-ratio: 16 / 10; background: #10243e; }
.gallery .main img { width: 100%; height: 100%; object-fit: cover; }
.gallery .thumbs { display: flex; gap: 8px; padding: 8px; background: #fff; overflow-x: auto; }
.gallery .thumbs img { width: 92px; height: 62px; object-fit: cover; border-radius: 6px; cursor: pointer; opacity: .7; border: 2px solid transparent; }
.gallery .thumbs img.active, .gallery .thumbs img:hover { opacity: 1; border-color: var(--blue); }

.block { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; margin-top: 22px; }
.block h2 { font-size: 19px; margin: 0 0 12px; }
.desc { white-space: pre-wrap; color: #2b3644; font-size: 16px; }

.detail-table { width: 100%; border-collapse: collapse; }
.detail-table td { padding: 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 15px; }
.detail-table td:first-child { color: var(--muted); width: 42%; font-weight: 600; }

/* Financial sidebar */
/* Clears the sticky header (96px) plus a little breathing room. */
.finbox { position: sticky; top: 116px; }
.finbox .price-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.finbox .price-head { background: var(--navy); color: #fff; padding: 18px 22px; }
.finbox .price-head .lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #9db4cf; }
.finbox .price-head .amt { font-size: 30px; font-weight: 800; font-family: var(--serif); }
.finrow { display: flex; justify-content: space-between; padding: 13px 22px; border-bottom: 1px solid var(--line); font-size: 15px; }
.finrow .k { color: var(--muted); }
.finrow .v { font-weight: 700; color: var(--navy); }
.finbox .cta { padding: 18px 22px; display: flex; flex-direction: column; gap: 10px; }
.finbox .seller-fin { margin: 0 22px 16px; font-size: 13px; color: var(--green); font-weight: 600; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 8px; font: inherit; color: var(--ink); background: #fff; }
.field textarea { min-height: 110px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-note { font-size: 13px; color: var(--muted); }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(16,36,62,.55); display: flex; align-items: center;
  justify-content: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: var(--radius); max-width: 520px; width: 100%; box-shadow: var(--shadow);
  max-height: 92vh; overflow-y: auto; }
/* Wider editors: bios and descriptions are unreadable in a 520px column. */
.modal-wide { max-width: 940px; }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; font-size: 19px; }
.modal-body { padding: 22px 24px; }
.modal-x { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--muted); line-height: 1; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy);
  color: #fff; padding: 13px 22px; border-radius: 10px; box-shadow: var(--shadow); z-index: 80; font-weight: 500; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: #9db4cf; padding: 30px 0; margin-top: 40px; font-size: 14px; }
.site-footer a { color: #cfe0f0; }
.footer-sep { margin: 0 6px; color: #4a6a8c; }
.footer-admin { color: #7f97b4 !important; }
.footer-admin:hover { color: #cfe0f0 !important; }

/* ---------- Team / About ---------- */
.team-heading { font-size: 22px; color: var(--navy); margin: 30px 0 4px; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-top: 18px; }
.team-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; background: #fbfcfe; }
/* Square (lightly rounded) headshots. object-fit keeps non-square source
   photos from stretching — they crop to the box instead. */
.team-avatar { width: 132px; height: 132px; border-radius: 10px; background: var(--navy); color: #fff; display: flex;
  align-items: center; justify-content: center; font-weight: 700; font-size: 44px; font-family: var(--serif); margin-bottom: 14px; }
.team-name { font-size: 18px; font-weight: 700; color: var(--navy); }
.team-title { font-size: 13px; color: var(--blue); font-weight: 600; margin-bottom: 10px; }
.team-bio { font-size: 14px; color: #35485c; margin: 0 0 12px; white-space: pre-wrap; }
/* Firm blurb above the broker profiles. */
.about-panel { background: #e9f2fb; border: 1px solid #cfe1f2; border-left: 4px solid var(--blue);
  border-radius: var(--radius); padding: 22px 26px; margin: 4px 0 28px; }
.about-panel-heading { margin: 0 0 12px; font-size: 15px; font-weight: 800; color: var(--navy);
  text-transform: uppercase; letter-spacing: .06em; }
.about-panel .about-text { margin: 0 0 12px; }
.about-panel .about-text:last-child { margin-bottom: 0; }
.about-text { font-size: 17px; color: #2b3644; max-width: 780px; line-height: 1.6; }

@media (max-width: 620px) { .about-panel { padding: 18px; } }
.broker-bio { white-space: pre-wrap; }
.team-contact { display: flex; flex-direction: column; gap: 3px; font-size: 14px; font-weight: 600; }
.contact-details { display: flex; flex-direction: column; gap: 6px; font-size: 15px; color: #35485c; }
.team-avatar.photo { object-fit: cover; }
.team-name a { color: var(--navy); }

/* Broker profile page */
.broker-hero { display: flex; gap: 26px; align-items: flex-start; }
.broker-photo { width: 200px; height: 200px; border-radius: 10px; flex: 0 0 200px; background: var(--navy);
  color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--serif);
  font-size: 64px; font-weight: 700; object-fit: cover; }
.broker-info h1 { font-family: var(--serif); font-size: 28px; margin: 0 0 2px; }
.broker-title { color: var(--blue); font-weight: 600; font-size: 15px; }
.broker-bio { color: #35485c; font-size: 15px; margin: 12px 0 16px; }
.broker-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* "Listed by" card in the listing sidebar */
.listed-by { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-top: 14px; }
.listed-by-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.listed-by-row { display: flex; gap: 12px; align-items: center; text-decoration: none; }
.listed-by-row:hover { text-decoration: none; }
.listed-by-row:hover .listed-by-name { color: var(--blue); }
.listed-by-avatar { width: 58px; height: 58px; border-radius: 8px; flex: 0 0 58px; background: var(--navy);
  color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--serif);
  font-weight: 700; font-size: 20px; object-fit: cover; }
.listed-by-name { font-weight: 700; color: var(--navy); font-size: 15px; }
.listed-by-title { font-size: 12px; color: var(--muted); }
.listed-by-contact { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--line); font-size: 14px; font-weight: 600; }
/* Co-listing agents beyond the first */
.listed-by-agent.extra { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }

/* Admin: assigned-agents multi-select */
.agent-picker { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fbfcfe; }
.agent-picker label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500;
  padding: 5px 0; cursor: pointer; margin: 0; }
.agent-picker input[type=checkbox] { width: auto; margin: 0; }
.agent-all { border-bottom: 1px solid var(--line); margin-bottom: 4px !important; padding-bottom: 8px !important; }

@media (max-width: 620px) {
  .broker-hero { flex-direction: column; }
}

/* ---------- Empty / banner ---------- */
.demo-banner { background: #fdf6e3; border-bottom: 1px solid #f0e2b8; color: #7a5b00; font-size: 13px; text-align: center; padding: 7px 12px; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }

/* ====================================================================== */
/* ADMIN                                                                   */
/* ====================================================================== */
.admin-header { background: var(--navy); color: #fff; }
.admin-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.admin-header .name { font-weight: 700; font-size: 17px; color: #fff; }
.admin-tabs { display: flex; gap: 4px; }
.admin-tabs button { background: transparent; border: none; color: #b9cbe0; font: inherit; font-weight: 600;
  padding: 8px 14px; border-radius: 7px; cursor: pointer; }
.admin-tabs button.active { background: rgba(255,255,255,.14); color: #fff; }
.admin-tabs button:hover { color: #fff; }

.login-wrap { max-width: 380px; margin: 8vh auto; background: #fff; padding: 30px; border-radius: var(--radius); box-shadow: var(--shadow); }
.login-wrap h1 { font-size: 22px; margin: 0 0 4px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin: 22px 0 14px; gap: 12px; flex-wrap: wrap; }
.toolbar h2 { margin: 0; font-size: 22px; }

.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
.table th { background: #f7f9fc; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafcff; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* Pipeline board */
.board { display: grid; grid-template-columns: repeat(7, minmax(180px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 16px; }
.col { background: #eef2f7; border-radius: 10px; padding: 10px; min-height: 120px; }
.col h4 { margin: 2px 4px 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); display: flex; justify-content: space-between; }
.lead-card { background: #fff; border-radius: 8px; box-shadow: var(--shadow-sm); padding: 10px 11px; margin-bottom: 9px; cursor: pointer; border-left: 3px solid var(--blue); }
.lead-card.buyer { border-left-color: var(--green); }
.lead-card.seller { border-left-color: var(--gold); }
.lead-card.inquiry { border-left-color: var(--blue); }
.lead-card .ln { font-weight: 700; font-size: 14px; }
.lead-card .lm { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-type-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; }
.lead-type-tag.buyer { background: #e4f3ea; color: var(--green); }
.lead-type-tag.seller { background: #fdf0d9; color: var(--amber); }
.lead-type-tag.inquiry { background: #e7f0f8; color: var(--blue); }

.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.img-tile { position: relative; border-radius: 8px; overflow: hidden; box-shadow: var(--shadow-sm); }
.img-tile img { aspect-ratio: 3/2; object-fit: cover; width: 100%; display: block; }
.img-tile button { position: absolute; top: 6px; right: 6px; }

/* Two-column editor layout (photo beside the fields). */
.editor-cols { display: grid; grid-template-columns: 220px 1fr; gap: 26px; align-items: start; }
.photo-pick { display: flex; flex-direction: column; gap: 10px; }
.photo-preview { width: 200px; height: 200px; border-radius: 10px; overflow: hidden; background: var(--navy);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 60px; font-weight: 700; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-actions { display: flex; gap: 8px; flex-wrap: wrap; }
/* File inputs are hidden inside these labels, so make the label look clickable. */
.photo-actions label.btn, .btn > input[type=file] + *, label.btn { cursor: pointer; }
/* Needs to out-specify `.field textarea`, which sets min-height: 110px. */
.field textarea.bio-box { min-height: 230px; line-height: 1.6; }

@media (max-width: 760px) {
  .editor-cols { grid-template-columns: 1fr; gap: 16px; }
  .photo-preview { width: 150px; height: 150px; font-size: 44px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .detail { grid-template-columns: 1fr; }
  .finbox { position: static; }
  .listing-row { grid-template-columns: 170px 1fr; }
  .row-body { padding: 14px 18px; }
}
@media (max-width: 620px) {
  /* Scale the logo down so it and the nav still fit on one line. */
  .site-header .wrap { height: 74px; }
  .brand-logo { height: 48px; padding: 4px 8px; }
  .finbox { top: 94px; }
  /* Stack the row: image on top, details beneath. Drop the fixed height so it
     can grow, and give the thumbnail a fixed ratio. */
  .listing-row { grid-template-columns: 1fr; height: auto; }
  .row-thumb { aspect-ratio: 16 / 9; }
  .row-body .fin { gap: 20px; }
  .form-row { grid-template-columns: 1fr; }
  .site-header nav a { margin-left: 14px; }
}
