/* Nesteelo Properties CRM — brand tokens from the Visual Identity System.
   Palette: Slate #2F4358, Sand #EDE6DD, Stone #B5AEA4, Sage #A9B8AA,
   Terracotta #B97A63, Cloud #FAF9F7, Ink #2C2C2A, Olive #7C8577.
   Darker derived steps (--terra-ink, --muted) exist only to meet WCAG AA for text. */

:root {
  color-scheme: light;
  --slate: #2f4358;
  --slate-700: #243546;
  --slate-100: #dfe5ec;
  --slate-050: #eef1f5;
  --sand: #ede6dd;
  --sand-050: #f5f1ec;
  --stone: #b5aea4;
  --stone-100: #e6e1da;
  --sage: #a9b8aa;
  --sage-100: #e2e9e2;
  --sage-ink: #42564a;
  --terra: #b97a63;
  --terra-ink: #8c5440;
  --terra-050: #f7ece7;
  --cloud: #faf9f7;
  --ink: #2c2c2a;
  --olive: #7c8577;
  --muted: #5c6459;
  --white: #ffffff;

  --bg: var(--cloud);
  --surface: var(--white);
  --border: #e3ded7;
  --control-border: var(--olive); /* 3.8:1 on white, meets non-text contrast */
  --focus-ring: 0 0 0 3px rgba(47, 67, 88, 0.35);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 12px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --font: "Inter", "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --sidebar-w: 248px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--slate); text-underline-offset: 2px; }
a:hover { color: var(--slate-700); }
h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 600; color: var(--slate); }
h1 { font-size: 1.75rem; letter-spacing: -0.01em; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 var(--s3); }
:focus-visible { outline: 3px solid var(--slate); outline-offset: 2px; }
.icon { flex: none; vertical-align: middle; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--white); padding: 8px 12px; z-index: 100; border-radius: var(--radius-sm); }
.skip-link:focus { left: 8px; }

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  height: 56px; padding: 0 var(--s4);
  background: var(--slate); color: var(--white);
}
.topbar .icon-btn { color: var(--white); }
.brand { display: inline-flex; flex-direction: column; text-decoration: none; color: inherit; line-height: 1.1; }
.brand:hover { color: inherit; }
.brand-name { font-weight: 600; letter-spacing: 0.28em; font-size: 0.95rem; }
.brand-descriptor { font-size: 0.62rem; letter-spacing: 0.42em; opacity: 0.85; margin-top: 3px; }
/* Approved white (reversed) logos on the slate areas; padding keeps clear space of 0.25 emblem width. */
.brand-mark { display: block; padding: var(--s3) var(--s3) var(--s2); }
.brand-mark img { display: block; width: 180px; height: auto; }
.brand-topbar { display: block; }
.brand-topbar img { display: block; height: 40px; width: auto; }
.brand-mark:focus-visible, .brand-topbar:focus-visible { outline-color: var(--sand); }
.print-brand { display: none; }

/* EN / ES language switch */
.lang-switch { display: inline-flex; align-items: center; gap: 2px; padding: 3px; margin: 0; border-radius: 10px; background: var(--stone-100); flex: none; }
.lang-switch .icon { margin: 0 4px 0 6px; color: var(--muted); }
.lang-switch button {
  min-width: 40px; min-height: 36px; padding: 0 8px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink); font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.lang-switch button:hover { background: rgba(255, 255, 255, 0.6); }
.lang-switch button[aria-pressed="true"] { background: var(--white); color: var(--slate); box-shadow: 0 1px 2px rgba(44, 44, 42, 0.12); }
.topbar .lang-switch { background: rgba(255, 255, 255, 0.14); }
.topbar .lang-switch button { color: var(--white); min-width: 34px; min-height: 32px; padding: 0 6px; font-size: 0.8rem; }
.topbar .lang-switch button:hover { background: rgba(255, 255, 255, 0.12); }
.topbar .lang-switch button[aria-pressed="true"] { background: var(--white); color: var(--slate); }
.utility-bar { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s4); }
.utility-bar .global-search { flex: 1; margin: 0; }
.auth-tools { display: flex; justify-content: flex-end; margin: calc(-1 * var(--s3)) 0 var(--s3); }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: min(84vw, 300px);
  display: flex; flex-direction: column;
  background: var(--slate); color: var(--white);
  transform: translateX(-100%); transition: transform 0.2s ease;
  overflow-y: auto;
}
.nav-open .sidebar { transform: none; }
.nav-overlay { display: none; }
.nav-open .nav-overlay { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(44, 44, 42, 0.45); }
.sidebar-head { display: flex; align-items: flex-start; gap: var(--s2); padding: var(--s4) var(--s4) var(--s2); }
.sidebar nav { padding: var(--s2) var(--s3); flex: 1; }
.nav-section { margin: var(--s4) var(--s3) var(--s1); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.7; }
.nav-link {
  display: flex; align-items: center; gap: var(--s3);
  min-height: 44px; padding: 0 var(--s3); border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.88); text-decoration: none; font-weight: 500;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.08); color: var(--white); }
.nav-link[aria-current="page"] { background: rgba(255, 255, 255, 0.14); color: var(--white); }
.nav-count { margin-left: auto; background: var(--terra-050); color: var(--terra-ink); border-radius: 999px; font-size: 0.75rem; font-weight: 600; padding: 0 8px; line-height: 20px; }
.sidebar-foot { padding: var(--s4) var(--s5) var(--s5); border-top: 1px solid rgba(255, 255, 255, 0.12); font-size: 0.875rem; }
.sidebar-foot .who { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }
.sidebar-foot a, .sidebar-foot button { color: rgba(255, 255, 255, 0.9); }
.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--sand); color: var(--slate); font-weight: 600; font-size: 0.8rem;
}
.avatar.sm { width: 28px; height: 28px; font-size: 0.7rem; }
.mantra { font-size: 0.75rem; opacity: 0.7; margin-top: var(--s3); }

/* width + min-width keep the grid item inside its track (auto margins alone would size it to content). */
.main { padding: var(--s4); width: 100%; min-width: 0; max-width: 1320px; margin: 0 auto; }
.global-search { display: flex; gap: var(--s2); margin-bottom: var(--s4); }
.global-search input { flex: 1; }

@media (min-width: 1024px) {
  .topbar { display: none; }
  .app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; height: 100vh; width: auto; transform: none; }
  .sidebar-head .icon-btn { display: none; }
  .brand-mark { padding: var(--s2) var(--s3) var(--s3); }
  .nav-overlay { display: none !important; }
  .main { padding: var(--s6) var(--s6) var(--s7); }
}

/* ---------- Page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s3) var(--s4); margin-bottom: var(--s5); }
.page-head .eyebrow { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s1); }
.page-head .sub { color: var(--muted); margin: var(--s1) 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.breadcrumb { font-size: 0.875rem; margin-bottom: var(--s2); }
.breadcrumb a { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s4);
  border: 1px solid var(--slate); border-radius: 8px;
  background: var(--slate); color: var(--white);
  font: inherit; font-weight: 600; font-size: 0.95rem; line-height: 1.2;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--slate-700); border-color: var(--slate-700); color: var(--white); }
.btn-secondary { background: var(--white); color: var(--slate); border-color: var(--control-border); }
.btn-secondary:hover { background: var(--slate-050); color: var(--slate); border-color: var(--slate); }
.btn-ghost { background: transparent; color: var(--slate); border-color: transparent; }
.btn-ghost:hover { background: var(--slate-050); color: var(--slate); border-color: transparent; }
.btn-danger { background: var(--white); color: var(--terra-ink); border-color: var(--terra); }
.btn-danger:hover { background: var(--terra-050); color: var(--terra-ink); border-color: var(--terra-ink); }
.btn-sm { min-height: 36px; padding: 0 var(--s3); font-size: 0.875rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: var(--radius); background: transparent; color: var(--slate); cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); }
.link-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--slate); text-decoration: underline; cursor: pointer; }
.inline-form { display: inline; margin: 0; }

/* ---------- Cards & layout ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--s4); }
.card + .card, .stack > * + * { margin-top: var(--s4); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s3); }
.card-head .meta { font-size: 0.85rem; color: var(--muted); }
.card.sand { background: var(--sand-050); border-color: var(--sand); }
.grid { display: grid; gap: var(--s4); }
.grid-2 { display: grid; gap: var(--s4); grid-template-columns: minmax(0, 1fr); }
.grid-3 { display: grid; gap: var(--s4); grid-template-columns: minmax(0, 1fr); }
.layout-detail { display: grid; gap: var(--s4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) {
  .card { padding: var(--s5); }
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .layout-detail { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
}
.section-title { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: var(--s5) 0 var(--s2); }

/* ---------- Stat tiles ---------- */
.kpis { display: grid; gap: var(--s3); grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: var(--s4); }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s4); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--s4); }
.kpi .label { font-size: 0.85rem; font-weight: 500; color: var(--muted); }
.kpi .value { font-size: 1.6rem; font-weight: 600; color: var(--slate); margin-top: var(--s1); line-height: 1.2; }
.kpi .sub { font-size: 0.8rem; color: var(--muted); margin-top: var(--s1); }
.kpi.attention { border-color: var(--terra); background: var(--terra-050); }
.kpi.attention .value { color: var(--terra-ink); }
@media (min-width: 900px) { .kpi .value { font-size: 1.9rem; } }

/* ---------- Badges & labels ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 9px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 600; line-height: 1.6; white-space: nowrap;
  background: var(--slate-050); color: var(--slate); border: 1px solid transparent;
}
.badge .icon { width: 14px; height: 14px; }
.badge.neutral { background: var(--stone-100); color: var(--ink); }
.badge.sand { background: var(--sand); color: var(--ink); }
.badge.sage { background: var(--sage-100); color: var(--sage-ink); }
.badge.solid { background: var(--slate); color: var(--white); }
.badge.attention { background: var(--terra-050); color: var(--terra-ink); border-color: #e8cdbf; }
.badge.outline { background: transparent; border-color: var(--stone); color: var(--muted); }

.stage-inquiry { background: var(--sand); color: var(--ink); }
.stage-showing { background: var(--sage-100); color: var(--sage-ink); }
.stage-offer { background: var(--slate-100); color: var(--slate); }
.stage-under_contract { background: var(--slate); color: var(--white); }
.stage-closed { background: var(--sage); color: var(--ink); }
.stage-lost { background: var(--stone-100); color: var(--muted); }
.pstatus-active { background: var(--sage-100); color: var(--sage-ink); }
.pstatus-under_contract { background: var(--slate); color: var(--white); }
.pstatus-sold { background: var(--sand); color: var(--ink); }
.pstatus-off_market { background: var(--stone-100); color: var(--muted); }
.info-owner_supplied { background: var(--sand); color: var(--ink); }
.info-pending { background: var(--terra-050); color: var(--terra-ink); }
.info-confirmed { background: var(--sage-100); color: var(--sage-ink); }

/* ---------- Tables (stack into cards on small screens) ---------- */
.table-wrap { width: 100%; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.925rem; }
table.data th { text-align: left; font-size: 0.78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: var(--s3); border-bottom: 1px solid var(--border); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--sand-050); }
table.data .num, .num { font-variant-numeric: tabular-nums; }
table.data th.num, table.data td.num { text-align: right; white-space: nowrap; }
table.data .primary { font-weight: 600; }
table.data .secondary { color: var(--muted); font-size: 0.85rem; }
table.data tfoot td { font-weight: 600; border-top: 1px solid var(--border); }
@media (max-width: 759px) {
  table.stack-mobile thead { display: none; }
  table.stack-mobile, table.stack-mobile tbody, table.stack-mobile tr, table.stack-mobile td { display: block; width: 100%; }
  table.stack-mobile tr { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s2) var(--s3); margin-bottom: var(--s3); background: var(--surface); }
  table.stack-mobile td { display: flex; justify-content: space-between; gap: var(--s3); border: 0; padding: 6px 0; text-align: right; }
  table.stack-mobile td::before { content: attr(data-label); font-size: 0.78rem; font-weight: 600; color: var(--muted); text-align: left; }
  table.stack-mobile td.cell-main { display: block; text-align: left; font-size: 1rem; }
  table.stack-mobile td.cell-main::before { content: none; }
  table.stack-mobile tfoot { display: block; }
  table.stack-mobile tbody tr:hover { background: var(--surface); }
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Forms ---------- */
.form-section { margin-bottom: var(--s4); }
.form-section > h2 { margin-bottom: var(--s4); }
.form-grid { display: grid; gap: var(--s4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .form-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.span-full { grid-column: 1 / -1; }
.field > label, .field-label { font-size: 0.875rem; font-weight: 600; color: var(--ink); }
.field .required { color: var(--terra-ink); }
.field.checkbox { flex-direction: row; align-items: flex-start; gap: var(--s2); padding-top: 4px; }
.field.checkbox label { font-weight: 500; }
.help { font-size: 0.8rem; color: var(--muted); margin: 0; }
input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="url"],
input[type="password"], input[type="search"], input[type="date"], input[type="datetime-local"], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px;
  border: 1px solid var(--control-border); border-radius: 8px;
  background: var(--white); color: var(--ink); font: inherit; font-size: 1rem;
}
textarea { min-height: 96px; resize: vertical; }
input[type="file"] { font: inherit; font-size: 0.9rem; max-width: 100%; }
input[type="checkbox"] { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--slate); flex: none; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--slate); box-shadow: var(--focus-ring); }
[aria-invalid="true"] { border-color: var(--terra-ink) !important; }
.field-error { color: var(--terra-ink); font-size: 0.85rem; font-weight: 500; margin: 0; }
.form-errors { margin-bottom: var(--s4); }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-top: var(--s4); }
.form-actions .spacer { flex: 1; }

/* Filters */
.filters { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: var(--s4); }
.filters > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: var(--s3) var(--s4); min-height: 48px; font-weight: 600; color: var(--slate); }
.filters > summary::-webkit-details-marker { display: none; }
.filters > summary .hint { font-weight: 500; font-size: 0.85rem; color: var(--muted); }
.filters[open] .when-closed, .filters:not([open]) .when-open { display: none; }
.filters form { padding: 0 var(--s4) var(--s4); }
.filter-grid { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); }
.filter-grid .field > label { font-size: 0.8rem; }
.filter-actions { display: flex; gap: var(--s2); margin-top: var(--s3); flex-wrap: wrap; }

/* ---------- Alerts ---------- */
.messages { display: grid; gap: var(--s2); margin-bottom: var(--s4); }
.alert { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--radius); border: 1px solid var(--border); border-left-width: 4px; background: var(--surface); }
.alert .alert-text { flex: 1; }
.alert-success { border-left-color: var(--sage-ink); background: var(--sage-100); }
.alert-info { border-left-color: var(--slate); background: var(--slate-050); }
.alert-warning { border-left-color: var(--terra); background: var(--sand-050); }
.alert-error { border-left-color: var(--terra-ink); background: var(--terra-050); }
.alert .icon-btn { width: 32px; height: 32px; margin: -4px -8px -4px 0; }

/* ---------- Lists, timeline, empty ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) 0; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; }
.list .meta { font-size: 0.85rem; color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: var(--s3); padding-bottom: var(--s4); }
.timeline li::before { content: ""; position: absolute; left: 17px; top: 36px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--slate-050); color: var(--slate); }
.timeline .dot.scheduled { background: var(--sand); }
.timeline .body { font-size: 0.925rem; white-space: pre-line; margin-top: var(--s1); color: var(--ink); }
.timeline .meta { font-size: 0.82rem; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: var(--s5) var(--s4); border: 1px dashed var(--stone); border-radius: var(--radius-lg); background: var(--surface); }
.empty .btn { margin-top: var(--s3); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s3) var(--s4); margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 0.78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.facts dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s2) var(--s4); margin: 0; font-size: 0.925rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0 !important; }
.mt-2 { margin-top: var(--s2); }
.mt-4 { margin-top: var(--s4); }
.row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.between { justify-content: space-between; }

/* Overdue: always icon + word, never colour alone */
.is-overdue { box-shadow: inset 3px 0 0 var(--terra); }
li.is-overdue { padding-left: var(--s3); }
.overdue-text { color: var(--terra-ink); font-weight: 600; }

/* ---------- Charts (single-series bars, slate) ---------- */
.bars { display: grid; gap: var(--s3); }
.bar-row { display: grid; grid-template-columns: minmax(96px, 30%) minmax(0, 1fr); gap: var(--s1) var(--s3); align-items: center; }
.bar-label { font-size: 0.875rem; font-weight: 500; overflow-wrap: anywhere; }
.bar-label .muted { font-weight: 400; }
.bar-line { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.bar-track { flex: 1; height: 12px; background: var(--slate-050); border-radius: 0 4px 4px 0; overflow: visible; position: relative; }
.bar-fill { height: 100%; background: var(--slate); border-radius: 0 4px 4px 0; }
.bar-value { font-size: 0.85rem; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; min-width: 4.5em; text-align: right; }
.bar-row:hover .bar-fill, .bar-row:focus-within .bar-fill { background: var(--slate-700); }
.chart-note { font-size: 0.8rem; color: var(--muted); margin-top: var(--s3); }
.definition { font-size: 0.8rem; color: var(--muted); margin: var(--s1) 0 0; }
.plain-list { margin: 0; padding-left: 1.1rem; }
.plain-list li + li { margin-top: var(--s1); }

/* ---------- Pipeline board ---------- */
.board {
  position: relative; /* contains absolutely positioned (sr-only) labels so they don't widen the page */
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(84vw, 1fr);
  gap: var(--s3); overflow-x: auto; padding-bottom: var(--s3);
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
}
@media (min-width: 640px) { .board { grid-auto-columns: minmax(300px, 1fr); } }
@media (min-width: 1400px) { .board { grid-auto-columns: minmax(0, 1fr); } }
.col { background: var(--sand-050); border: 1px solid var(--sand); border-radius: var(--radius-lg); padding: var(--s3); scroll-snap-align: start; min-height: 240px; display: flex; flex-direction: column; }
.col.drag-over { outline: 2px dashed var(--slate); outline-offset: -4px; background: var(--slate-050); }
.col-head { padding: var(--s1) var(--s1) var(--s3); border-bottom: 1px solid var(--sand); margin-bottom: var(--s3); }
.col-head .name { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); font-weight: 600; color: var(--slate); }
.col-head .totals { font-size: 0.8rem; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.col-cards { display: grid; gap: var(--s2); align-content: start; flex: 1; }
.deal-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s3); }
.deal-card[draggable="true"] { cursor: grab; }
.deal-card.dragging { opacity: 0.5; }
.deal-card .t { font-weight: 600; color: var(--slate); text-decoration: none; display: block; line-height: 1.3; }
.deal-card .who { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.deal-card .money { display: flex; justify-content: space-between; gap: var(--s2); margin-top: var(--s2); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.deal-card .next { font-size: 0.82rem; margin-top: var(--s2); padding-top: var(--s2); border-top: 1px dashed var(--border); }
.deal-card .foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-top: var(--s2); }
.deal-card .foot .inline-form { flex: none; }
.deal-card select { min-height: 36px; padding: 4px 8px; font-size: 0.85rem; width: auto; min-width: 124px; }
.board-status { min-height: 1.5em; }

/* ---------- Deal stepper & status panel ---------- */
.steps { list-style: none; margin: 0 0 var(--s4); padding: 0; display: flex; gap: var(--s1); overflow-x: auto; }
.steps li { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; font-size: 0.8rem; color: var(--muted); position: relative; }
.steps li::after { content: ""; position: absolute; top: 15px; left: calc(50% + 18px); right: calc(-50% + 18px); height: 2px; background: var(--stone-100); }
.steps li:last-child::after { display: none; }
.steps .marker { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--stone); background: var(--white); font-weight: 600; color: var(--muted); }
.steps li.done .marker { background: var(--sage); border-color: var(--sage); color: var(--ink); }
.steps li.done::after { background: var(--sage); }
.steps li.current .marker { background: var(--slate); border-color: var(--slate); color: var(--white); }
.steps li.current { color: var(--slate); font-weight: 600; }
.status-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: var(--s4); }
@media (min-width: 640px) { .status-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .status-panel { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.status-panel > div { background: var(--surface); padding: var(--s3) var(--s4); }
.status-panel .k { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.status-panel .v { margin-top: 4px; font-weight: 500; }

/* ---------- Property cards & media ---------- */
.prop-grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.prop-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; }
.prop-card .photo { aspect-ratio: 3 / 2; background: var(--sand); display: grid; place-items: center; color: var(--muted); font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; position: relative; }
.prop-card .photo img { width: 100%; height: 100%; object-fit: cover; }
.prop-card .photo .badge { position: absolute; left: var(--s2); top: var(--s2); }
.prop-card .photo .featured-badge { left: auto; right: var(--s2); text-transform: none; letter-spacing: 0; }
.prop-card .body { padding: var(--s3) var(--s4) var(--s4); display: flex; flex-direction: column; gap: 4px; flex: 1; }
.prop-card .price { font-size: 1.15rem; font-weight: 600; color: var(--ink); }
.prop-card .title { font-weight: 600; color: var(--slate); text-decoration: none; line-height: 1.3; }
.prop-card .specs { font-size: 0.85rem; color: var(--muted); }
.gallery { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); }
.gallery figure { margin: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.gallery .thumb { aspect-ratio: 4 / 3; background: var(--sand); display: grid; place-items: center; }
.gallery .thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery figcaption { padding: var(--s2) var(--s3); font-size: 0.8rem; display: grid; gap: 6px; }
.hero-photo { border-radius: var(--radius-lg); overflow: hidden; background: var(--sand); aspect-ratio: 16 / 9; display: grid; place-items: center; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.85rem; margin-bottom: var(--s4); }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Pagination ---------- */
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); margin-top: var(--s4); font-size: 0.9rem; color: var(--muted); }

/* ---------- Segmented tabs ---------- */
.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--stone-100); flex-wrap: wrap; }
.tabs a { padding: 6px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: 0.875rem; font-weight: 500; min-height: 36px; display: inline-flex; align-items: center; }
.tabs a[aria-current="page"] { background: var(--white); color: var(--slate); font-weight: 600; box-shadow: 0 1px 2px rgba(44, 44, 42, 0.12); }

/* ---------- Dialog ---------- */
dialog.modal { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(92vw, 460px); color: var(--ink); }
dialog.modal::backdrop { background: rgba(44, 44, 42, 0.5); }
dialog.modal form { padding: var(--s5); display: grid; gap: var(--s3); }

/* ---------- Login ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: var(--s4); background: var(--sand); }
.auth-card { width: min(100%, 420px); background: var(--surface); border-radius: var(--radius-lg); padding: var(--s6) var(--s5); border: 1px solid var(--stone-100); }
.auth-card .auth-logo { display: block; width: 240px; max-width: 100%; height: auto; margin: 0 auto var(--s5); }
.auth-card h1 { font-size: 1.4rem; margin-bottom: var(--s1); }
.auth-card .mantra { color: var(--muted); opacity: 1; margin: var(--s5) 0 0; text-align: center; }
.auth-wrap { width: min(100%, 420px); }
.auth-wrap .auth-card { width: 100%; }
.auth-options .field.checkbox { padding-top: 0; }
.auth-options input[type="checkbox"] { margin-top: 3px; }
.auth-link { text-align: center; margin: var(--s4) 0 0; }
.auth-footer { margin-top: var(--s4); text-align: center; font-size: 0.8rem; color: var(--muted); }
.auth-footer p { margin: 0 0 2px; }

/* ---------- Top left of every page: last sign-in, this session's time and location ---------- */
.session-info { display: flex; flex-wrap: wrap; gap: 2px var(--s4); margin: 0 0 var(--s3); font-size: 0.8rem; color: var(--muted); text-align: left; }
.session-info strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.session-info .icon { margin-right: 2px; vertical-align: -3px; }

/* ---------- Page footer: copyright and credit, centred ---------- */
.app-footer { margin-top: var(--s7); padding-top: var(--s4); border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--muted); text-align: center; }
.app-footer p { margin: 0 0 2px; }
.legal-links a { color: inherit; }

/* ---------- Cookie policy (/cookies/): wider card for its tables ---------- */
.policy-wrap { width: min(100%, 860px); }
.policy-card { width: 100%; }
.policy-card .auth-logo { width: 180px; margin-bottom: var(--s4); }
.policy h2 { margin-top: var(--s5); font-size: 1.2rem; }
.policy h3 { margin: var(--s4) 0 var(--s1); font-size: 1rem; }
.policy .cookie-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; margin-top: var(--s2); }
.policy .cookie-table th { text-align: left; font-size: 0.78rem; color: var(--muted); padding: var(--s2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.policy .cookie-table td { padding: var(--s2); border-bottom: 1px solid var(--border); vertical-align: top; }
.policy .hint { color: var(--muted); font-size: 0.8rem; }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--sage-ink); margin-right: 8px; vertical-align: 1px; }

/* Code / pre */
pre.email-preview { white-space: pre-wrap; font-family: var(--font); font-size: 0.9rem; background: var(--sand-050); border: 1px solid var(--sand); border-radius: var(--radius); padding: var(--s3) var(--s4); margin: 0; }
code { font-size: 0.85em; background: var(--slate-050); padding: 1px 5px; border-radius: 4px; }

@media (max-width: 759px) { .hide-mobile { display: none !important; } }
@media (min-width: 760px) { .show-mobile { display: none !important; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print {
  .sidebar, .topbar, .global-search, .actions, .filters, .no-print, .session-info { display: none !important; }
  .app-shell { display: block; }
  .main { padding: 0; }
  .print-brand { display: block; margin-bottom: 16px; }
  .print-brand img { width: 200px; height: auto; }
  .utility-bar { display: none !important; }
  .card, .kpi { break-inside: avoid; }
}

/* "Add new" next to a category or type select, and character counters */
.add-option { margin-top: 6px; font-size: 0.875rem; }
.char-count { margin: 4px 0 0; text-align: right; }
dialog.modal h2 { margin: 0; font-size: 1.125rem; }
