:root {
  --charcoal: #1e1e1e;
  --green: #81963a;            /* AREG brand green */
  --green-dark: #6d7f31;
  --green-tint: #f2f5e8;
  --green-text: #5a6b26;
  --amber: #b7791f;
  --amber-tint: #fdf3e0;
  --red: #c0392b;
  --red-tint: #faeae7;
  --bg: #f7f7f4;
  --card: #ffffff;
  --text: #212121;
  --muted: #6e746a;
  --border: #e6e8e0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(30, 30, 30, 0.05), 0 4px 14px rgba(30, 30, 30, 0.05);
  --font-body: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-heading: "Libre Franklin", "Poppins", sans-serif;
}

* { box-sizing: border-box; min-width: 0; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Always reserve the scrollbar gutter. Without this, a filter that returns
     enough rows to need scrolling narrows the viewport, the header controls
     wrap to a second line, and the whole page jumps down ~50px. */
  scrollbar-gutter: stable;
  overflow-y: scroll;
}
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3 { font-family: var(--font-heading); font-weight: 600; }

/* ---------- Header ---------- */

header.site {
  background: var(--charcoal);
  color: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
header.site h1 { font-size: 1.02rem; margin: 0; letter-spacing: 0.02em; }
header.site .sub { color: #a9aea2; font-size: 0.76rem; }
header.site .who { color: #a9aea2; font-size: 0.85rem; }
header.site .brand { display: flex; align-items: center; gap: 16px; }
header.site .logo {
  height: 40px;
  width: auto;
  filter: brightness(0) invert(1);
}
header.site .brand-divider { width: 1px; height: 34px; background: #454545; }
.topbar-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
header.site button.secondary {
  color: #fff;
  box-shadow: inset 0 0 0 1.5px #4a4a4a;
}
header.site button.secondary:hover:not(:disabled) { background: #2e2e2e; }
a.plain { color: inherit; }

main { width: 100%; max-width: 1800px; margin: 0 auto; padding: 28px 28px 80px; }

/* ---------- Card grid (board + admin listings) ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
  align-items: stretch;
}
.card-grid .card {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  padding: 20px;
}
.card-grid .card h2 { font-size: 1.08rem; }
.card-grid .listing-head {
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 10px;
}
.card-grid .empty { grid-column: 1 / -1; }
.card-foot { margin-top: auto; padding-top: 18px; }
.card-foot button { width: 100%; }
.card-grid .card-actions { margin-top: auto; }

/* ---------- Cards ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0; font-size: 1.28rem; line-height: 1.3; }

.board-hint {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 auto 14px;
  max-width: 900px;
  text-align: center;
}
.board-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.search-input {
  max-width: 340px;
  border-radius: 999px;
  padding: 9px 18px;
}
.listings-toolbar .search-input { margin-left: auto; }
.board-filters { display: flex; gap: 8px; flex-wrap: wrap; }

/* Native select arrows sit hard against the edge on a pill — draw our own. */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%236e746a' d='M1.4 0 6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 10px;
  padding-right: 38px;
}
.filter-select {
  width: auto;
  max-width: 100%;
  border-radius: 999px;
  padding: 8px 34px 8px 16px;
  font-size: 0.85rem;
  background-color: var(--card);
  background-position: right 12px center;
}
.oh-filter {
  background: var(--card);
  color: var(--text);
  box-shadow: inset 0 0 0 1.5px var(--border);
  padding: 8px 16px;
  font-size: 0.85rem;
}
.oh-filter:hover:not(:disabled) { background: #f1f2ec; }
.oh-filter.active {
  background: var(--green);
  color: #fff;
  box-shadow: none;
}
.oh-filter.active:hover:not(:disabled) { background: var(--green-dark); }
.clear-filters {
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  font-size: 0.82rem;
  text-decoration: underline;
}
.clear-filters:hover:not(:disabled) { background: transparent; color: var(--text); }
.filter-select.is-set {
  border-color: var(--green);
  background-color: var(--green-tint);
  color: var(--green-text);
  font-weight: 600;
}

/* Property-type folders */
.subgroup { margin-bottom: 18px; }
.subgroup > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 2px 10px;
  user-select: none;
}
.subgroup > summary::-webkit-details-marker { display: none; }
.subgroup > summary::before {
  content: "▾";
  color: var(--muted);
  font-size: 0.78rem;
  transition: transform 0.15s ease;
}
.subgroup:not([open]) > summary::before { transform: rotate(-90deg); }
.sg-label {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.subgroup > summary:hover .sg-label { color: var(--text); }

.tile-specs { color: #494e45; font-size: 0.83rem; font-weight: 600; }
.lbl-note { font-weight: 400; color: var(--muted); font-size: 0.76rem; }
.form-section {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--green-text);
  margin: 24px 0 2px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Notification bell */
.bell {
  position: relative;
  background: transparent;
  color: #fff;
  border-radius: 999px;
  padding: 8px 10px;
  line-height: 0;
  box-shadow: inset 0 0 0 1.5px #4a4a4a;
}
.bell:hover:not(:disabled) { background: #2e2e2e; }
.bell.has-pending { box-shadow: inset 0 0 0 1.5px var(--green); color: #cfe08a; }
.bell-count {
  position: absolute;
  top: -5px; right: -5px;
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  padding: 3px 6px;
  min-width: 18px;
}
@keyframes bell-ring {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(14deg); }
  40% { transform: rotate(-12deg); }
  60% { transform: rotate(8deg); }
  80% { transform: rotate(-6deg); }
}
.bell.ring { animation: bell-ring 0.6s ease 2; }

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: 14px;
  z-index: 100;
  background: var(--charcoal);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 8px 26px rgba(20, 22, 18, 0.3);
  max-width: calc(100vw - 24px);
}

/* On-card open house toggle */
.oh-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
  background: #f1f2ec;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.oh-toggle.on { background: var(--green-tint); color: var(--green-text); }
.oh-toggle input { width: 16px; height: 16px; accent-color: var(--green); margin: 0; }
.slot-dur { color: var(--muted); font-weight: 400; font-size: 0.85em; }
a.tel { color: inherit; font-weight: 600; }

/* Request history rows (admin History folders) */
.req-history { display: flex; flex-direction: column; }
.req-history-row {
  padding: 13px 2px;
  border-bottom: 1px solid var(--border);
}
.req-history-row:last-child { border-bottom: none; }
.rh-main {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.rh-agent { font-weight: 600; }
.rh-slot { color: #494e45; font-size: 0.92rem; flex: 1; min-width: 200px; }
.rh-sub { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.card.flyer-done { opacity: 0.72; border-left: 4px solid var(--green); }
.dash-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

/* ---------- Hot sheet print / PDF ---------- */

.print-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #f2f2ef;
  overflow-y: auto;
}
.print-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--charcoal);
  color: #fff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.print-bar .meta { color: #a9aea2; display: block; font-size: 0.8rem; }
.print-bar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.print-toggle { margin: 0; color: #fff; font-size: 0.82rem; gap: 6px; }
.print-toggle span { font-weight: 600; }
/* Secondary buttons default to dark text — unreadable on this dark bar. */
.print-bar button.secondary { color: #fff; box-shadow: inset 0 0 0 1.5px #4a4a4a; }
.print-bar button.secondary:hover:not(:disabled) { background: #2e2e2e; }

.print-sheet {
  background: #fff;
  max-width: 1100px;
  margin: 20px auto 60px;
  padding: 28px 32px;
  box-shadow: var(--shadow);
  color: #111;
}
.ps-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  border-bottom: 2px solid #111;
  padding-bottom: 10px;
}
.ps-title { font-family: var(--font-heading); font-weight: 700; font-size: 1.15rem; }
.ps-sub { font-size: 0.9rem; color: #444; }
.ps-meta { text-align: right; font-size: 0.75rem; color: #444; }
/* Each section gets its own weight so the three groups stay obvious even on a
   black-and-white office printer. */
.ps-block { margin-top: 14px; }
.ps-section {
  font-family: var(--font-heading);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 4px;
  padding: 5px 9px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ps-active .ps-section { background: #111; color: #fff; }
.ps-signed .ps-section { background: #d8d8d3; color: #111; border-left: 6px solid #111; }
.ps-pipeline .ps-section {
  background: #fff; color: #111;
  border: 1px dashed #777; border-left: 6px solid #777;
}
.ps-count { font-weight: 700; opacity: 0.75; }
.ps-block { break-inside: avoid-page; }
.ps-active table, .ps-signed table { border-left: 2px solid #111; }
.ps-pipeline table { border-left: 2px dashed #777; }

.ps-table { width: 100%; border-collapse: collapse; font-size: 0.7rem; background: #fff; }
.ps-table th {
  text-align: left;
  background: #f2f2ef;
  color: #222;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.66rem;
  font-weight: 700;
  padding: 3px 6px;
  border-bottom: 1px solid #999;
}
.ps-table td { padding: 3px 6px; border-bottom: 1px solid #e3e3e0; vertical-align: top; }
.ps-oh { white-space: nowrap; }
.ps-table .num { text-align: right; white-space: nowrap; }
.ps-addr { font-weight: 600; }
.ps-host { color: #555; }
.ps-tag { font-size: 0.62rem; font-weight: 700; color: #5a6b26; letter-spacing: 0.05em; }
.ps-notes { color: #444; max-width: 240px; }
.ps-foot { margin-top: 22px; font-size: 0.68rem; color: #777; text-align: center; }

@media print {
  /* Only the sheet goes on paper. */
  body.printing > *:not(#print-overlay) { display: none !important; }
  .no-print { display: none !important; }
  .print-overlay {
    position: static;
    background: #fff;
    overflow: visible;
  }
  .print-sheet {
    max-width: none;
    margin: 0;
    padding: 0;
    box-shadow: none;
  }
  /* Tuned so a full book of listings lands on one or two pages, and a section
     never starts at the bottom of a page with its rows orphaned overleaf. */
  .ps-table { font-size: 7.4pt; }
  .ps-table th { font-size: 7pt; padding: 2px 5px; }
  .ps-table td { padding: 2px 5px; }
  .ps-head { padding-bottom: 6px; }
  .ps-title { font-size: 12pt; }
  .ps-sub, .ps-meta { font-size: 7.5pt; }
  .ps-block { margin-top: 9px; }
  .ps-section { font-size: 8pt; padding: 3px 7px; }
  .ps-notes { max-width: 200px; }
  .ps-section { break-after: avoid; page-break-after: avoid; }
  .ps-table thead { display: table-header-group; }
  .ps-table tr { break-inside: avoid; page-break-inside: avoid; }
  .ps-block { break-inside: auto; }
  .ps-foot { margin-top: 10px; font-size: 6.5pt; }
  @page { margin: 10mm; size: landscape; }
}
.rh-admin { margin-top: 8px; }
.rh-note {
  margin-top: 6px;
  background: #f7f8f4;
  border-left: 3px solid var(--border);
  border-radius: 0 8px 8px 0;
  padding: 7px 12px;
  font-size: 0.87rem;
}
.view-toggle {
  display: inline-flex;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--card);
}
.view-toggle button {
  background: transparent;
  color: var(--muted);
  border-radius: 0;
  padding: 6px 16px;
  font-size: 0.82rem;
}
.view-toggle button:hover:not(:disabled) { background: #f1f2ec; color: var(--text); }
.view-toggle button.active { background: var(--charcoal); color: #fff; }

/* List view */
.list-stack { display: flex; flex-direction: column; gap: 8px; }
.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px 18px;
  cursor: pointer;
  color: var(--text);
  font-weight: 400;
}
button.list-row:hover:not(:disabled) { background: var(--card); border-color: var(--green); }
.lr-address { font-family: var(--font-heading); font-weight: 600; font-size: 0.95rem; flex: 1; min-width: 220px; }
.lr-meta { color: var(--muted); font-size: 0.82rem; display: flex; gap: 10px; flex-wrap: wrap; }

.callout.tips { background: var(--amber-tint); border-left-color: var(--amber); }
.callout.tips .callout-lbl { color: var(--amber); }

/* ---------- History folders ---------- */

details.folder {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
}
details.folder summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  flex-wrap: wrap;
}
details.folder summary::-webkit-details-marker { display: none; }
details.folder summary::before {
  content: "▸";
  color: var(--muted);
  font-size: 0.9rem;
  transition: transform 0.15s ease;
}
details.folder[open] summary::before { transform: rotate(90deg); }
details.folder summary:hover { background: #fbfbf8; }
.folder-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  flex: 1;
  min-width: 220px;
}
.folder-counts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.folder-body {
  padding: 4px 20px 20px;
  border-top: 1px solid var(--border);
}
.folder-body .table-wrap { box-shadow: none; margin-top: 14px; }
.folder-body .meta { display: block; margin-top: 12px; }

.listing-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chip {
  background: #f1f2ec;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8rem;
  color: #4a4f45;
  white-space: nowrap;
}
.chip .chip-lbl {
  color: var(--green-text);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  margin-right: 4px;
}

.status-pill {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.status-pill.open { background: var(--green); color: #fff; }
.status-pill.closed { background: #ececec; color: #8a8a8a; }
.status-pill.signed { background: var(--amber-tint); color: var(--amber); }
.status-pill.pipeline { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--border); }
.status-pill.contract { background: #e6edf7; color: #2c5282; }
.status-pill.sold { background: #ece9f5; color: #553c9a; }

/* Listing cards: identical three-row skeleton so a grid of them lines up */
.listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
  align-items: stretch;
}
.listing-card {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  padding: 18px 18px 14px;
}
/* Each row is its own fixed band, so a chip is never sliced in half by a
   clipped container — a row either fits or scrolls sideways as a whole. */
.lc-address {
  font-size: 1.02rem;
  line-height: 1.3;
  height: 2.6em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}
.lc-line {
  display: flex;
  gap: 6px;
  align-items: center;
  height: 30px;
  margin-top: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.lc-line::-webkit-scrollbar { display: none; }
.lc-line .chip { flex: 0 0 auto; }
/* Tags always show in full — no scrolling inside a card. Cards in the same grid
   row still stretch to match, and the footer stays pinned to the bottom. */
.lc-tags {
  min-height: 58px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: flex-start;
  padding: 9px 0;
  margin: 10px 0 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.lc-foot {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* Toggle and badge variants must occupy the same height or cards drift */
.lc-oh { display: flex; align-items: center; height: 32px; }
.lc-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
/* The five status buttons get the full card width on their own row — sharing it
   with Edit squeezed them until the selected pill clipped its own label. */
.lc-actions { display: flex; }
.lc-actions .status-switch { width: 100%; }
.status-switch { display: flex; }
.status-switch button {
  flex: 1 1 0;
  min-width: 0;
  padding: 7px 4px;
  font-size: 0.72rem;
  white-space: nowrap;
}
.status-switch button:disabled { opacity: 0.35; cursor: not-allowed; }
.chip-n { opacity: 0.6; font-weight: 600; }
.filter-legend {
  align-self: center;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-right: 2px;
}
/* Source filter reads as a different axis than status */
#source-filters {
  padding-left: 12px;
  border-left: 2px solid var(--border);
}
#source-filters button { border-radius: 8px; background: transparent; box-shadow: inset 0 0 0 1.5px var(--border); }
#source-filters button:hover:not(:disabled) { background: #f1f2ec; }
#source-filters button.active { background: var(--charcoal); color: #fff; box-shadow: none; }

/* Inline popover (availability editor) */
.popover {
  position: absolute;
  z-index: 60;
  width: 320px;
  max-width: calc(100vw - 24px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 34px rgba(20, 22, 18, 0.22);
  padding: 14px;
}
.pop-title { font-family: var(--font-heading); font-weight: 600; font-size: 0.95rem; }
.pop-sub { color: var(--muted); font-size: 0.78rem; margin-bottom: 8px; }
.popover textarea { min-height: 62px; font-size: 0.88rem; }
.pop-error:empty { display: none; }
.pop-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }

/* ---------- Compact tiles + sections ---------- */

.section-head {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.02rem;
  margin: 26px 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-head:first-of-type { margin-top: 8px; }
.count-pill {
  background: #e9ebe4;
  color: var(--muted);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 1px 9px;
}

/* Tinted zones: signed + pipeline read as different spaces than active inventory */
.zone {
  border-radius: var(--radius);
  padding: 4px 16px 16px;
  margin-top: 22px;
}
.zone .section-head { margin-top: 14px; }
.zone-signed {
  background: var(--amber-tint);
  border: 1px solid #eddfbd;
}
.zone-signed .section-head { color: #7a5511; }
.zone-signed .tile, .zone-signed .list-row, .zone-signed .pipeline-row { border-color: #eddfbd; }
.zone-pipeline {
  background: #eef0ea;
  border: 1px dashed #cfd4c8;
}
.zone-pipeline .section-head { color: var(--muted); }

/* Admin listing cards: status accent edge */
.card.st-active { border-left: 4px solid var(--green); }
.card.st-signed { border-left: 4px solid var(--amber); }
.card.st-pipeline { border-left: 4px dashed #b9beb2; }
.card.st-under-contract { border-left: 4px solid #2c5282; }
.card.st-sold { border-left: 4px solid #553c9a; }
.card.st-archived { border-left: 4px solid #b9beb2; opacity: 0.85; }

/* Status bands on the admin Listings page */
.status-zone {
  border-radius: var(--radius);
  padding: 2px 16px 14px;
  margin-bottom: 20px;
  border: 1px solid transparent;
}
.status-zone .section-head { margin-top: 16px; }
.sz-active { background: #f3f6ec; border-color: #e2e8d2; }
.sz-signed { background: var(--amber-tint); border-color: #eddfbd; }
.sz-pipeline { background: #eef0ea; border-color: #cfd4c8; border-style: dashed; }
.sz-under-contract { background: #eef2f8; border-color: #d5e0ee; }
.sz-sold { background: #f1eef8; border-color: #ddd5ee; }
.sz-archived { background: #f0f0ee; border-color: var(--border); }

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}
.tile {
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  cursor: pointer;
  color: var(--text);
  font-weight: 400;
  transition: border-color 0.12s ease, transform 0.12s ease;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
button.tile:hover:not(:disabled) { background: var(--card); border-color: var(--green); transform: translateY(-1px); }
.tile-address {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.3;
  /* Two-line box so one- and two-line addresses still line up */
  min-height: 2.6em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile-meta {
  color: var(--muted);
  font-size: 0.8rem;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tile-date { color: var(--green-text); font-weight: 600; }
.tile-date.muted-date { color: var(--muted); font-weight: 400; }
.tile-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }

.pipeline-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 16px;
  margin-bottom: 8px;
}
.pipeline-address { font-weight: 600; font-size: 0.93rem; flex: 1; min-width: 200px; }

.detail-top { margin-bottom: 10px; }

/* Admin: clickable compact cards + status switcher */
.card-click { cursor: pointer; transition: border-color 0.12s ease; }
.card-click:hover { border-color: var(--green); }
.status-switch {
  display: inline-flex;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}
.status-switch button {
  background: transparent;
  color: var(--muted);
  border-radius: 0;
  padding: 6px 13px;
  font-size: 0.78rem;
}
.status-switch button:hover:not(:disabled) { background: #f1f2ec; color: var(--text); }
.status-switch button.on { background: var(--green); color: #fff; }

/* Modal variants + dirty bar */
.modal-mode {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 3px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.modal.mode-add { border-top: 5px solid var(--green); background: #fcfdf8; }
.modal.mode-add .modal-mode { background: var(--green); color: #fff; }
.modal.mode-edit { border-top: 5px solid var(--charcoal); }
.modal.mode-edit .modal-mode { background: var(--charcoal); color: #fff; }
/* Unsaved-changes prompt: centered over the page, not buried in the form */
.modal-backdrop.confirm-backdrop {
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 70;
}
.confirm-box {
  background: #fff;
  border-radius: 16px;
  padding: 26px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 56px rgba(20, 22, 18, 0.32);
  border-top: 5px solid var(--amber);
  margin: auto;
}
.confirm-box h3 { margin: 0 0 6px; font-family: var(--font-heading); font-size: 1.1rem; }
.confirm-box p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.confirm-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.confirm-actions button { flex: 1 1 auto; }
.actions-spacer { flex: 1; }
.modal .actions { align-items: center; }

/* ---------- Dashboard stats ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 16px 18px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--text);
  transition: border-color 0.12s ease;
}
button.stat:hover:not(:disabled) { background: var(--card); border-color: var(--green); }
.stat .stat-num {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.7rem;
  line-height: 1.1;
  color: var(--green-text);
}
.stat.alert .stat-num { color: var(--amber); }
.stat .stat-lbl {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.callout {
  background: var(--green-tint);
  border-left: 3px solid var(--green);
  border-radius: 0 10px 10px 0;
  padding: 12px 16px;
  margin-top: 16px;
  font-size: 0.92rem;
}
.callout .callout-lbl {
  display: block;
  color: var(--green-text);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  margin-bottom: 2px;
}

.notes {
  margin: 14px 0 0;
  color: #494e45;
  font-size: 0.92rem;
  white-space: pre-wrap;
}

.section-lbl {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  margin: 18px 0 8px;
}

/* ---------- Schedule slots ---------- */

.slot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 10px;
  margin-top: 8px;
}
.slot.booked { border-left-color: var(--green); background: #fcfdf9; }
.slot.pending { border-left-color: var(--amber); background: #fffdf8; }
.slot-when { font-weight: 600; font-size: 0.92rem; }
.slot-who { color: var(--muted); font-size: 0.84rem; }

.badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.badge.approved { background: var(--green-tint); color: var(--green-text); }
.badge.pending { background: var(--amber-tint); color: var(--amber); }
.badge.denied { background: var(--red-tint); color: var(--red); }
.badge.archived { background: #ececec; color: #8a8a8a; }
.badge.avail { background: var(--green-tint); color: var(--green-text); }
.badge.unavail { background: #ececec; color: #8a8a8a; }

/* ---------- Buttons ---------- */

button, .btn {
  font: inherit;
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  cursor: pointer;
  background: var(--green);
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.15s ease;
}
button:hover:not(:disabled) { background: var(--green-dark); }
button.secondary { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--border); }
button.secondary:hover:not(:disabled) { background: #f1f2ec; }
button.deny { background: transparent; color: var(--red); box-shadow: inset 0 0 0 1.5px #eccdc7; }
button.deny:hover:not(:disabled) { background: var(--red-tint); }
button.approve { background: var(--green); }
button.small { padding: 7px 14px; font-size: 0.82rem; }
button:disabled { opacity: 0.5; cursor: default; }
.request-btn { margin-top: 18px; }

/* ---------- Forms ---------- */

label { display: block; font-size: 0.82rem; font-weight: 600; margin: 14px 0 5px; }
input, textarea, select {
  font: inherit;
  font-size: 0.92rem;
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--green);
}
textarea { min-height: 72px; resize: vertical; }
.row { display: flex; gap: 14px; }
.row > * { flex: 1; min-width: 0; }
.checkbox-row { display: flex; align-items: center; gap: 9px; margin-top: 16px; }
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--green); }
.checkbox-row label { margin: 0; }
.field-hint { color: var(--muted); font-size: 0.78rem; margin-top: 4px; }

.error { color: var(--red); font-size: 0.88rem; margin-top: 10px; min-height: 1.2em; }
.success { color: var(--green-text); font-size: 0.92rem; font-weight: 600; }

/* ---------- Gate / login ---------- */

.gate { max-width: 400px; margin: 10vh auto 0; }
.gate .card { padding: 30px; }
.gate h2 { font-size: 1.2rem; margin-bottom: 4px; }
.gate .meta { color: var(--muted); font-size: 0.88rem; margin: 0 0 6px; }
.gate button { width: 100%; margin-top: 18px; }

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 22, 18, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 4vh 14px;
  overflow-y: auto;
  z-index: 50;
}
.modal {
  background: #fff;
  border-radius: 16px;
  padding: 26px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 18px 50px rgba(20, 22, 18, 0.25);
}
.modal h3 { margin: 0 0 2px; font-family: var(--font-heading); font-size: 1.15rem; }
.modal .meta { color: var(--muted); font-size: 0.85rem; margin: 0; }
.modal .actions { display: flex; gap: 10px; margin-top: 22px; justify-content: flex-end; }

/* ---------- Admin: tabs ---------- */

.tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 22px;
  flex-wrap: wrap;
  align-items: stretch;
  border-bottom: 2px solid var(--border);
}
.tabs-spacer { flex: 1 1 auto; }
.tabs button {
  background: none;
  color: var(--muted);
  font-weight: 600;
  border-radius: 0;
  padding: 10px 16px 12px;
  position: relative;
  margin-bottom: -2px;
  border-bottom: 2px solid transparent;
}
.tabs button:hover { background: none; color: var(--text); }
.tabs button.active {
  color: var(--text);
  border-bottom-color: var(--green);
}
.tab-count {
  display: inline-block;
  background: var(--green);
  color: #fff;
  border-radius: 999px;
  font-size: 0.7rem;
  padding: 1px 8px;
  margin-left: 7px;
  vertical-align: 1px;
}

/* ---------- Admin: request cards ---------- */

.req-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.req-head .meta { color: var(--muted); font-size: 0.8rem; }

.req-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
  margin-top: 16px;
}
.req-grid .lbl {
  display: block;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  margin-bottom: 2px;
}
.req-grid .val { font-size: 0.94rem; }
.req-grid .val .sub-val { color: var(--muted); font-size: 0.84rem; }

.warn {
  background: var(--amber-tint);
  color: #7a5511;
  border-left: 3px solid var(--amber);
  border-radius: 0 10px 10px 0;
  padding: 10px 14px;
  font-size: 0.87rem;
  margin-top: 14px;
}

.decide-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}
.decide-row input { flex: 1; min-width: 220px; }

/* ---------- Admin: listings ---------- */

.private-box {
  background: #faf9f5;
  border: 1.5px dashed #d9d5c8;
  border-radius: 10px;
  padding: 12px 16px;
  margin-top: 16px;
  font-size: 0.9rem;
}
.private-box .private-lbl {
  display: block;
  color: #94896a;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  margin-bottom: 2px;
}
.card-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ---------- Tables ---------- */

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: var(--card); }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: #fbfbf8;
}
tr:last-child td { border-bottom: none; }
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--card);
}
td .meta, .meta { color: var(--muted); font-size: 0.82rem; }

/* ---------- Misc ---------- */

.empty {
  color: var(--muted);
  text-align: center;
  padding: 48px 20px;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
}
.flash {
  background: var(--green-tint);
  color: var(--green-text);
  border: 1px solid #d5ddba;
  border-radius: var(--radius);
  padding: 13px 16px;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 0.92rem;
}
.flash.err { background: var(--red-tint); color: var(--red); border-color: #eccdc7; }
.section-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  margin: 30px 0 12px;
}
.toolbar { margin-bottom: 16px; }
.listings-toolbar { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chips button {
  background: #e9ebe4;
  color: var(--text);
  padding: 6px 14px;
  font-size: 0.82rem;
}
.filter-chips button:hover:not(:disabled) { background: #dde0d5; }
.filter-chips button.active { background: var(--charcoal); color: #fff; }

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  main { padding: 18px 12px 70px; }
  .card { padding: 18px; }
  .row { flex-direction: column; gap: 0; }
  .req-grid { grid-template-columns: 1fr; }
  .listing-head { flex-direction: column-reverse; }
  .request-btn, .decide-row button { width: 100%; }
  .decide-row input { min-width: 100%; }
  header.site .logo { height: 32px; }

  /* Search centered + full width; tiles only (list view collapses to the same thing) */
  .board-tools { justify-content: center; }
  .search-input { width: 100%; max-width: 100%; }
  .view-toggle { display: none; }
  .board-filters { width: 100%; }
  .listing-grid { grid-template-columns: 1fr; }
  .lc-address { height: auto; }
  .lc-tags { min-height: 0; }
  .status-zone { padding: 2px 10px 10px; }
  .tabs-spacer { display: none; }
  .listings-toolbar { gap: 10px; }
  #source-filters { padding-left: 0; border-left: none; border-top: 1px solid var(--border); padding-top: 10px; width: 100%; }
  .listings-toolbar .search-input { margin-left: 0; }
  .filter-select {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    padding-left: 12px;
    background-position: right 10px center;
  }
  .zone { padding: 2px 10px 10px; }

  /* Popups become full-screen sheets on phones */
  .modal-backdrop { padding: 0; align-items: stretch; }
  .modal {
    max-width: 100%;
    min-height: 100dvh;
    border-radius: 0;
    padding: 22px 18px calc(24px + env(safe-area-inset-bottom));
  }
  .modal .actions { margin-top: 26px; }
  .modal .actions button { flex: 1; }
}

@media (min-width: 641px) {
  .modal { max-height: 92vh; overflow-y: auto; }
}
