/* Immo Horizon agency desk — "framed sheet": a warm stone L-frame (sidebar + top bar) around a white sheet.
   Colour stays on data: the amber marks the pipeline counts and the selected tab; chrome is stone and ink.
   Grid arithmetic (1440 wide): 228 sidebar + 1196 sheet + 8 inset (+ 8 for the scrollbar gutter on some systems).
   Inside the sheet: 24 padding · KPI strip 6 equal columns · pairs of panels at 1fr 1fr with one 16px gutter. */

:root {
  --frame: #f2f1ee;          /* stone chrome: a low-chroma step of the brand's warm neutral */
  --surface: #ffffff;        /* the sheet and panels */
  --raised: #f6f6f4;         /* wells, hover rows */
  --active: #ecebe7;         /* selected row inside the sheet */
  --nav-active: #e5e3de;     /* the nav pill on the frame */
  --edge: #e4e2dd;           /* the sheet's 1px edge */
  --border: #e8e6e1;         /* panel edges */
  --rule: #f0eeea;           /* row rules */
  --control: #d3cfc8;        /* inputs, outlined buttons */
  --text: #1e1c1a;
  --muted: #5c564e;
  --faint: #6e675e;          /* meta: 4.8:1 on the frame, 5.5:1 on white */
  --accent: #b07a1a;         /* brand amber darkened to 3.7:1 on white: data only */
  --accent-ink: #8a5a0b;     /* amber as text, 5.8:1 */
  --accent-pale: #f7ead2;
  --primary: #1e1c1a;
  --primary-ink: #ffffff;
  --positive: #2f7a45;
  --negative: #b42318;

  --font: "General Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-brand: "Sentient", Georgia, serif;
  --fs-title: 24px; --fs-section: 16px; --fs-kpi: 26px; --fs-body: 14px; --fs-small: 12px;

  --sidebar-width: 228px;
  --topbar: 48px;
  --inset: 8px;
  --pad: 24px;
  --gap: 16px;
  --card-pad: 20px;
  --radius-sheet: 16px;
  --radius-card: 8px;
  --radius-control: 6px;
  --radius-chip: 4px;
  --control-height: 34px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-press: 120ms; --t-hover: 150ms; --t-ui: 200ms;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--frame); color: var(--text); font: 400 var(--fs-body)/20px var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 4px; }
.num, table, .kpi-value { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -40px; z-index: 50; padding: 8px 12px; background: var(--primary); color: var(--primary-ink); border-radius: var(--radius-control); }
.skip:focus { top: 8px; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-small); }
.ref { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--muted); }
.text-link { text-decoration: underline; text-underline-offset: 3px; }
.noscript { padding: 24px; }

/* ---------- shell: the L-frame and the sheet ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: var(--topbar) auto;
  min-height: 100svh;
}
.sidebar {
  grid-row: 1 / span 2;
  position: sticky; top: 0; height: 100svh;
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 12px 16px;
  overflow: auto;
}
.topbar {
  grid-column: 2; grid-row: 1;
  position: sticky; top: 0; z-index: 6;
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, 460px) minmax(0, 0.6fr); align-items: center; gap: 16px;
  height: var(--topbar); padding: 0 calc(var(--inset) + 8px) 0 8px;
  background: var(--frame);
}
.sheet {
  grid-column: 2; grid-row: 2;
  margin: 0 var(--inset) var(--inset) 0;
  min-height: calc(100svh - var(--topbar) - var(--inset));
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--radius-sheet);
  min-width: 0;
}
.sheet:focus { outline: none; }
.canvas { padding: var(--pad); }

/* sidebar */
.brand { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 6px; margin-bottom: 14px; }
.mark { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: var(--primary); color: #f4efe7; font: 500 13px/1 var(--font-brand); letter-spacing: 0.02em; }
.brand-text { display: grid; min-width: 0; line-height: 18px; }
.brand-text strong { font: 500 16px/20px var(--font-brand); }
.brand-text span { color: var(--faint); font-size: var(--fs-small); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn.menu-close { display: none; margin-left: auto; }
.nav { display: grid; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  height: 34px; padding: 0 10px; border-radius: 8px; border: 0; background: none; text-align: left; cursor: pointer;
  color: var(--muted);
  transition: background-color var(--t-hover) ease, color var(--t-hover) ease;
}
.nav-item svg { width: 16px; height: 16px; flex: none; }
.nav-item:hover { background: var(--nav-active); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--nav-active); color: var(--text); font-weight: 500; }
.nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--primary); color: var(--primary-ink); font-size: 11px; line-height: 20px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.side-bottom { margin-top: auto; display: grid; gap: 2px; padding-top: 16px; }
.viewer { display: grid; gap: 6px; padding: 0 4px 10px; color: var(--faint); font-size: var(--fs-small); }
.viewer .input { height: 34px; background: var(--surface); color: var(--text); font-size: var(--fs-body); }
.lang-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px 12px; color: var(--faint); font-size: var(--fs-small); }
.lang-switch { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); }
.lang-btn { min-width: 38px; height: 26px; padding: 0 8px; border: 0; border-radius: var(--radius-chip); background: transparent; color: var(--muted); font: 500 13px/26px var(--font); letter-spacing: 0.02em; cursor: pointer; }
.lang-btn:hover { color: var(--text); background: var(--raised); }
.lang-btn[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); }

/* the demonstration notice: in the top bar on desktop, at the top of the sheet when the bar folds */
.demo-line { display: none; padding: 10px var(--pad) 0; color: var(--faint); font-size: var(--fs-small); font-weight: 500; }

/* top bar */
.btn.menu-open, .mobile-title { display: none; }
.notice { min-width: 0; color: var(--muted); font-size: var(--fs-small); font-weight: 500; line-height: 1.3; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search .input { width: 100%; height: 34px; padding-left: 36px; background: var(--surface); border-color: transparent; }
.search .input:focus { border-color: var(--control); }
body[data-section="requests"] .topbar .search { visibility: hidden; }
.stamp { justify-self: end; display: flex; align-items: center; gap: 4px; color: var(--faint); font-size: var(--fs-small); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- title row ---------- */
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.title-row h1 { font-size: var(--fs-title); line-height: 30px; font-weight: 600; letter-spacing: -0.01em; }
.title-row .sub { margin-top: 4px; color: var(--muted); font-size: 15px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: none;
  height: var(--control-height); padding: 0 14px; border-radius: var(--radius-control);
  border: 1px solid var(--control); background: var(--surface); font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background-color var(--t-hover) ease, border-color var(--t-hover) ease, transform var(--t-press) var(--ease-out);
}
.btn:hover { background: var(--raised); border-color: #c7bfb2; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.btn.primary:hover { background: #3a3632; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(30, 28, 26, 0.06); }
.btn.danger { background: var(--negative); color: #fff; border-color: transparent; }
.btn.danger:hover { background: #93190f; }
.btn.tiny { height: 24px; padding: 0 8px; font-size: var(--fs-small); color: var(--muted); }
.icon-btn { width: 34px; padding: 0; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.small { width: 26px; height: 26px; }
.icon-btn.small svg { width: 14px; height: 14px; }
.btn.suggestion { align-self: end; border-style: dashed; color: var(--text); }

.input {
  height: var(--control-height); padding: 0 10px; min-width: 0;
  border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface);
  transition: border-color var(--t-hover) ease;
}
.input:hover { border-color: #c2b9ab; }
.input:focus { outline: 1px solid var(--text); outline-offset: 0; border-color: var(--text); }
.input::placeholder { color: var(--faint); }
textarea.input { height: auto; padding: 10px 12px; line-height: 20px; resize: vertical; width: 100%; }
select.input { padding-right: 28px; appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5l3-3' fill='none' stroke='%235c564e' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 9px center / 12px no-repeat; cursor: pointer; }
.input.mini { height: 28px; font-size: 13px; padding: 0 24px 0 8px; background-position: right 6px center; }
.control { display: grid; gap: 6px; min-width: 0; }
.control > span { font-size: 13px; font-weight: 500; color: var(--muted); }
.control.inline { display: flex; align-items: center; gap: 10px; }
.check { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--primary); cursor: pointer; }

/* ---------- pills and people ---------- */
.pill { display: inline-flex; align-items: center; flex: none; height: 22px; padding: 0 8px; border-radius: 999px; font-size: var(--fs-small); font-weight: 500; line-height: 1; white-space: nowrap; background: #efebe5; color: #3d3934; }
.pill.new { background: #f5e1bb; color: #4f3305; }
.pill.todo { background: #fbf1de; color: #6b4508; }
.pill.neutral { background: #efebe5; color: #3d3934; }
.pill.visit { background: #e6e1d8; color: #2e2b27; }
.pill.deal { background: #dcd5c9; color: #24211e; }
.pill.pos { background: #e1f1e3; color: #17401f; }
.pill.neg { background: #fbe7e4; color: #7e1f1b; }
.pill.live { background: var(--surface); color: var(--accent-ink); border: 1px solid #d9b46e; }
.pill.sample { background: transparent; color: var(--faint); border: 1px solid var(--border); font-weight: 400; }

.avatar { --s: 24px; flex: none; display: inline-grid; place-items: center; width: var(--s); height: var(--s); border-radius: 50%; background: var(--tint, #eee); color: #2e2b27; font-size: calc(var(--s) * 0.42); font-weight: 600; line-height: 1; vertical-align: middle; }
.avatar.unassigned { background: transparent; border: 1px solid var(--control); color: var(--faint); font-weight: 400; }
.thumb { --s: 48px; flex: none; width: var(--s); height: var(--s); border-radius: 6px; object-fit: cover; background: var(--raised); }
.thumb.none { display: inline-block; border: 1px solid var(--border); background: var(--raised) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M4 10 10 5l6 5v5H4z' fill='none' stroke='%23a59c8f' stroke-width='1.3' stroke-linejoin='round'/%3E%3C/svg%3E") center / 50% no-repeat; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 18px var(--card-pad) 20px; min-width: 0; display: flex; flex-direction: column; }
.panel > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel h2 { font-size: var(--fs-section); line-height: 22px; font-weight: 600; }
.panel > footer { margin-top: auto; padding-top: 12px; }
.panel .meta { color: var(--faint); font-size: var(--fs-small); }
.count { margin-left: 4px; color: var(--faint); font-weight: 500; }
.card-link { display: inline-flex; align-items: center; gap: 2px; padding: 0; border: 0; background: none; color: var(--text); font-weight: 500; cursor: pointer; white-space: nowrap; text-underline-offset: 3px; }
.card-link::after { content: ""; width: 12px; height: 12px; flex: none; background: currentColor; -webkit-mask: var(--chevron) center / 12px no-repeat; mask: var(--chevron) center / 12px no-repeat; }
.card-link:hover { text-decoration: underline; }
:root { --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4.5 2.5 8 6l-3.5 3.5' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.empty { display: grid; place-items: center; min-height: 72px; padding: 16px; border: 1px dashed var(--control); border-radius: var(--radius-card); color: var(--muted); text-align: center; }
.skeleton { background: var(--raised); border-radius: 4px; }
.error-block { display: flex; align-items: center; gap: 16px; padding: 16px; border: 1px solid #f3c7c1; border-radius: var(--radius-card); background: #fdf3f1; color: #7e1f1b; }

/* ---------- overview ---------- */
.overview { display: grid; gap: var(--gap); }
.overview .title-row { margin-bottom: 8px; }
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; }
.kpi { display: grid; align-content: start; gap: 2px; padding: 14px 18px 16px; min-width: 0; transition: background-color var(--t-hover) ease; }
.kpi + .kpi { border-left: 1px solid var(--border); }
a.kpi:hover { background: var(--raised); }
.kpi-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi-value { font-size: var(--fs-kpi); line-height: 34px; font-weight: 500; letter-spacing: -0.01em; }
.kpi-note { color: var(--faint); font-size: var(--fs-small); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-note.neg { color: var(--negative); }

.pipeline-panel { padding-bottom: 12px; }
.pipeline-strip { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 2fr); gap: 16px; }
.stages { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.stages.closed { border-left: 1px solid var(--border); padding-left: 12px; margin-left: -4px; }
.stage { display: grid; gap: 4px; padding: 8px 12px 10px; border-radius: var(--radius-control); transition: background-color var(--t-hover) ease; min-width: 0; }
.stage:hover { background: var(--raised); }
.stage.is-active { background: var(--active); }
.stage-label { color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-count { font-size: 24px; line-height: 30px; font-weight: 500; }
.stage-bar { height: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; }
.stage-bar span { display: block; height: 100%; border-radius: 3px; background: var(--accent); }

.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); align-items: stretch; }

.lead-rows, .task-rows { display: grid; }
.lead-row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 8px; margin: 0 -8px; border-radius: var(--radius-control); cursor: pointer; transition: background-color var(--t-hover) ease; }
.lead-row + .lead-row { border-top: 1px solid var(--rule); border-radius: 0; }
.lead-row:hover { background: var(--raised); }
.lead-main { display: grid; min-width: 0; flex: 1; gap: 2px; }
.lead-name { display: flex; align-items: center; gap: 8px; font-weight: 500; min-width: 0; white-space: nowrap; }
.lead-name.is-new { font-weight: 600; }
.lead-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-meta { display: grid; justify-items: end; gap: 4px; flex: none; }
.lead-time { color: var(--faint); font-size: var(--fs-small); }

.task-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto 24px; align-items: center; gap: 12px; min-height: 56px; padding: 8px 0; }
.task-row + .task-row { border-top: 1px solid var(--rule); }
.task-main { display: grid; gap: 2px; min-width: 0; }
.task-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-type { color: var(--text); font-weight: 500; }
.task-lead { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-lead a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.task-due { color: var(--muted); font-size: 13px; white-space: nowrap; text-align: right; }
.task-due.overdue { color: var(--negative); font-weight: 500; }
.task-row.is-done .task-title { color: var(--faint); text-decoration: line-through; text-decoration-color: var(--control); }
.task-rows.compact .task-row { min-height: 44px; }

.bar-list { display: grid; }
.bar-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; grid-template-rows: auto 2px; column-gap: 12px; row-gap: 6px; align-items: center; padding: 8px 0; }
.bar-row .thumb { grid-row: 1 / span 2; }
.bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row:hover .bar-label { text-decoration: underline; text-underline-offset: 3px; }
.bar-value { font-weight: 500; }
.bar-track { grid-column: 2 / span 2; height: 2px; }
.bar-track span { display: block; height: 2px; background: #b9b0a3; }
.bar-track span.lead { background: var(--accent); }

.team-table { width: 100%; border-collapse: collapse; }
.team-table th { height: 32px; padding: 0 8px; text-align: left; font-weight: 400; font-size: var(--fs-small); color: var(--muted); white-space: nowrap; }
.team-table td { padding: 8px; border-top: 1px solid var(--rule); vertical-align: middle; }
.team-table th:first-child, .team-table td:first-child { padding-left: 0; }
.team-table th:last-child, .team-table td:last-child { padding-right: 0; }
.team-table .n { text-align: right; width: 72px; }
.team-table td.zero { color: var(--faint); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who > span:last-child { display: grid; min-width: 0; }
.who strong { font-weight: 500; }
.who .sub { color: var(--faint); font-size: var(--fs-small); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- requests: inbox ---------- */
.requests .title-row { margin-bottom: 12px; }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { position: relative; flex: none; padding: 10px 0 11px; color: var(--muted); white-space: nowrap; transition: color var(--t-hover) ease; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-selected="true"] { color: var(--text); font-weight: 500; }
.tabs a[aria-selected="true"]::after { content: ""; position: absolute; left: -4px; right: -4px; bottom: -1px; height: 2px; background: var(--accent); }
.tab-count { color: var(--faint); margin-left: 2px; font-weight: 400; }

.inbox { display: grid; grid-template-columns: 372px minmax(0, 1fr); }
.inbox-list { position: sticky; top: var(--topbar); align-self: start; display: flex; flex-direction: column; max-height: calc(100svh - var(--topbar) - var(--inset) - 2px); padding: 16px 16px 0 0; border-right: 1px solid var(--border); }
.list-tools { display: grid; gap: 8px; padding-bottom: 8px; }
.list-tools .input { width: 100%; }
.tool-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.list-count { color: var(--faint); font-size: var(--fs-small); padding-top: 4px; }
.inbox-scroll { overflow-y: auto; margin: 0 -8px; padding: 0 8px 16px; overscroll-behavior: contain; }
.inbox-rows { display: grid; gap: 2px; }
.inbox-row { display: flex; gap: 12px; padding: 10px 8px; margin: 0 -8px; border-radius: var(--radius-card); transition: background-color var(--t-hover) ease; }
.inbox-row:hover { background: var(--raised); }
.inbox-row.is-selected { background: var(--active); }
.inbox-text { display: grid; gap: 3px; min-width: 0; flex: 1; }
.inbox-line1 { display: flex; justify-content: space-between; gap: 8px; }
.inbox-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-row.is-new .inbox-name { font-weight: 600; }
.inbox-time { flex: none; color: var(--faint); font-size: var(--fs-small); }
.inbox-line2 { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-line3 { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.inbox-agent { margin-left: auto; }

.inbox-detail { min-width: 0; padding: 20px 0 8px 24px; }
.back-link { display: none; }

/* the open request */
.record-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.record-title h2 { font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -0.01em; }
.record-meta { margin-top: 4px; color: var(--muted); }
.record-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 18px 0 8px; padding: 14px 16px; background: var(--raised); border-radius: var(--radius-card); }
.record-controls .control { width: 220px; }
.record-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; margin-top: 8px; }
.record-main, .record-aside { display: grid; align-content: start; min-width: 0; }
.block { padding: 20px 0; }
.block + .block { border-top: 1px solid var(--rule); }
.block h3 { display: flex; align-items: baseline; font-size: 15px; line-height: 20px; font-weight: 600; margin-bottom: 12px; }
.message { white-space: pre-wrap; font-size: 15px; line-height: 23px; max-width: 68ch; }
.visit-pref { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-card); background: var(--accent-pale); }
.visit-pref p { display: grid; gap: 2px; }
.visit-pref .muted { font-size: var(--fs-small); color: #6b4508; }

.task-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-bottom: 8px; }
.task-form .control { flex: 1 1 140px; }
.task-form .control.grow { flex: 3 1 260px; }
.task-form .control.narrow { flex: 0 1 110px; }
.task-form .input { width: 100%; }

.note-form { display: grid; gap: 8px; margin-bottom: 8px; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.notes { display: grid; }
.note { display: flex; gap: 12px; padding: 12px 0; }
.note + .note { border-top: 1px solid var(--rule); }
.note-meta { margin-bottom: 2px; }
.note-meta strong { font-weight: 500; margin-right: 6px; }
.note-text { white-space: pre-wrap; max-width: 68ch; }

.activity { display: grid; }
.activity li { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; }
.activity li + li { border-top: 1px solid var(--rule); }
.act-text { min-width: 0; }
.activity time { flex: none; font-size: var(--fs-small); }

.kv { display: grid; }
.kv > div { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 8px; align-items: center; min-height: 32px; }
.kv dt { color: var(--faint); font-size: 13px; }
.kv dd { display: flex; align-items: center; gap: 6px; min-width: 0; }
.kv dd a { text-decoration: underline; text-decoration-color: var(--control); text-underline-offset: 3px; }
.kv dd .btn.tiny { margin-left: auto; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.property-card { display: grid; gap: 4px; }
.property-photo { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: var(--radius-card); margin-bottom: 8px; }
.prop-title { font-weight: 600; }
.prop-meta { color: var(--muted); font-size: 13px; }
.prop-price { font-size: 16px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.property-card .card-link { margin-top: 8px; }

/* ---------- follow-ups ---------- */
.tasks-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--gap); align-items: start; }
.task-list { padding-top: 6px; }
.task-group { padding: 14px 0 6px; }
.task-group + .task-group { border-top: 1px solid var(--border); }
.task-group h2 { font-size: 15px; line-height: 20px; margin-bottom: 2px; }
.task-group.overdue h2 { color: var(--negative); }
.group-empty { padding: 10px 0 8px; color: var(--muted); }
.people { position: sticky; top: calc(var(--topbar) + 16px); }
.people-rows { display: grid; gap: 2px; }
.person-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 40px 40px; align-items: center; gap: 10px; min-height: 44px; padding: 6px 8px; margin: 0 -8px; border-radius: var(--radius-control); transition: background-color var(--t-hover) ease; }
.person-row:hover { background: var(--raised); }
.person-row.is-selected { background: var(--active); }
.person-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-open, .person-due { text-align: right; }
.person-due.zero { color: var(--faint); }
.avatar.all { background: var(--frame); font-size: 10px; font-weight: 500; }

/* ---------- pipeline board ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(176px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.column, .zone { display: flex; flex-direction: column; border-radius: var(--radius-card); background: var(--raised); transition: background-color var(--t-hover) ease, outline-color var(--t-hover) ease; }
.column { min-height: 440px; padding: 10px; }
.closed-col { gap: 10px; padding: 0; background: transparent; }
.zone { padding: 10px; flex: 1; }
.column.is-over, .zone.is-over { background: var(--accent-pale); outline: 1px solid #d9b46e; outline-offset: -1px; }
.column > header, .zone > header { display: flex; align-items: baseline; justify-content: space-between; padding: 2px 4px 10px; }
.column h2, .zone h2 { font-size: 14px; line-height: 18px; font-weight: 600; }
.col-count { font-size: 18px; font-weight: 500; color: var(--accent-ink); }
.cards { display: grid; gap: 8px; align-content: start; flex: 1; }
.card { display: grid; gap: 8px; padding: 10px; border-radius: var(--radius-card); background: var(--surface); border: 1px solid var(--border); cursor: grab; transition: border-color var(--t-hover) ease; }
.card:hover { border-color: var(--control); }
.card.is-dragging { opacity: 0.5; }
.card-top { display: flex; gap: 10px; min-width: 0; }
.card-text { display: grid; gap: 2px; min-width: 0; }
.card-name { font-weight: 600; line-height: 18px; overflow-wrap: anywhere; }
.card-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.card-sub { color: var(--muted); font-size: 13px; line-height: 17px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { display: flex; align-items: center; gap: 6px; }
.card-age { color: var(--faint); font-size: var(--fs-small); white-space: nowrap; margin-right: auto; }
.card .input.mini { width: 100%; }
.column-empty { padding: 14px 8px; color: var(--faint); font-size: var(--fs-small); text-align: center; border: 1px dashed var(--control); border-radius: var(--radius-card); }

/* ---------- toasts and dialog ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 40; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 14px; border-radius: var(--radius-card); background: var(--primary); color: #f4efe7; box-shadow: 0 8px 24px rgba(30, 28, 26, 0.18); /* taste-skill-ignore: a toast floats */ animation: toast-in var(--t-ui) var(--ease-out); }
.toast.neg { background: #7e1f1b; }
.toast span { flex: 1; }
.toast a { color: #f2c46d; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.toast-close { width: 26px; height: 26px; border: 0; border-radius: 4px; background: transparent; color: inherit; font-size: 18px; line-height: 1; cursor: pointer; }
.toast-close:hover { background: rgba(255, 255, 255, 0.12); }
.toast.leaving { opacity: 0; transform: translateY(4px); transition: opacity 160ms ease, transform 160ms ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.dialog { max-width: 460px; padding: 24px; border: 0; border-radius: 12px; color: var(--text); box-shadow: 0 24px 64px rgba(30, 28, 26, 0.25); /* taste-skill-ignore: a modal dialog floats */ }
.dialog::backdrop { background: rgba(30, 28, 26, 0.36); }
.dialog h2 { font-size: 18px; line-height: 24px; font-weight: 600; margin-bottom: 8px; }
.dialog p { color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ---------- narrower desktops ---------- */
@media (max-width: 1360px) {
  .record-body { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .record-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; order: -1; border-bottom: 1px solid var(--rule); }
  .record-aside .block + .block { border-top: 0; }
  .property-card { grid-template-columns: 120px minmax(0, 1fr); column-gap: 14px; align-content: start; }
  .property-card h3 { grid-column: 1 / -1; }
  .property-card .property-photo { grid-row: span 5; margin: 0; aspect-ratio: 1; }
  .kpi { padding: 12px 14px 14px; }
}
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(n + 4) { border-top: 1px solid var(--border); }
  .kpi:nth-child(4) { border-left: 0; }
  .pipeline-strip { grid-template-columns: minmax(0, 1fr); }
  .stages.closed { border-left: 0; margin-left: 0; padding-left: 0; border-top: 1px solid var(--rule); padding-top: 8px; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-flow: row; }
  .inbox { grid-template-columns: 320px minmax(0, 1fr); }
}

/* ---------- tablet and phone: the frame folds into a top bar ---------- */
@media (max-width: 1100px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--topbar) auto; }
  .sidebar { position: fixed; inset: 0; z-index: 30; width: min(340px, 100%); height: 100%; background: var(--frame); transform: translateX(-102%); transition: transform var(--t-ui) var(--ease-out); box-shadow: 0 0 0 100vmax rgba(30, 28, 26, 0); /* taste-skill-ignore: the folded menu is an overlay sheet */ }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(30, 28, 26, 0.32); /* taste-skill-ignore: scrim behind the open menu sheet */ }
  .btn.menu-close { display: inline-flex; }
  .topbar { grid-column: 1; grid-template-columns: auto minmax(0, 1fr) auto; padding: 0 12px 0 8px; }
  .btn.menu-open { display: inline-flex; }
  .notice { order: 3; grid-column: 1 / -1; display: none; }
  .search { display: none; }
  .mobile-title { display: block; font-weight: 600; font-size: 16px; }
  .sheet { grid-column: 1; margin: 0 var(--inset) var(--inset); }
  .demo-line { display: block; }
}
@media (max-width: 860px) {
  :root { --pad: 16px; }
  .sheet { margin: 0; border-radius: 0; border-width: 1px 0 0; min-height: calc(100svh - var(--topbar)); }
  .title-row { flex-wrap: wrap; align-items: flex-start; margin-bottom: 16px; }
  .title-row h1 { font-size: 22px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi + .kpi { border-left: 0; }
  .kpi:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .kpi:nth-child(n + 4) { border-top: 1px solid var(--border); }
  .kpi:nth-child(2n) { border-left: 1px solid var(--border); }
  .kpi:nth-child(4) { border-left: 1px solid var(--border); }
  .kpi:nth-child(3) { border-left: 0; }
  .stages.open { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stages.closed { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pair { grid-template-columns: minmax(0, 1fr); }
  .tasks-layout { grid-template-columns: minmax(0, 1fr); }
  .people { position: static; order: -1; padding: 12px; }
  .people > header { display: none; }
  .people-rows { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .person-row { display: flex; gap: 8px; margin: 0; padding: 6px 12px 6px 6px; min-height: 40px; border-radius: 999px; background: var(--raised); white-space: nowrap; }
  .person-row .person-due { display: none; }
  .person-name { overflow: visible; }

  /* one region at a time */
  .inbox { grid-template-columns: minmax(0, 1fr); }
  .inbox-list { position: static; max-height: none; padding: 12px 0 0; border-right: 0; }
  .inbox-scroll { overflow: visible; margin: 0; padding: 0; }
  .inbox-detail { padding: 8px 0 0; }
  .requests:not(.has-selection) .inbox-detail { display: none; }
  .requests.has-selection .inbox-list, .requests.has-selection .tabs { display: none; }
  .requests.has-selection .title-row { margin-bottom: 0; }
  .requests.has-selection .title-row .sub { display: none; }
  .back-link { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; color: var(--muted); font-weight: 500; }
  .back-link::before { content: ""; width: 12px; height: 12px; background: currentColor; -webkit-mask: var(--chevron) center / 12px no-repeat; mask: var(--chevron) center / 12px no-repeat; transform: rotate(180deg); }
  .record-head { flex-wrap: wrap; }
  .record-controls { padding: 12px; }
  .record-controls .control { width: 100%; }
  .record-controls .btn.suggestion { width: 100%; white-space: normal; height: auto; min-height: 40px; padding: 8px 12px; }
  .record-aside { grid-template-columns: minmax(0, 1fr); }
  .record-aside .block + .block { border-top: 1px solid var(--rule); }
  .task-form .control, .task-form .control.grow { flex: 1 1 100%; }
  .task-form .control.narrow { flex: 1 1 40%; }
  .task-form .btn { flex: 1 1 100%; height: 40px; }
  .activity li { flex-direction: column; gap: 2px; }
  .lead-meta .pill { display: none; }
  .btn, .input { min-height: 40px; }
  .input.mini, .btn.tiny, .icon-btn.small { min-height: 0; }
  .board { grid-auto-columns: 272px; scroll-snap-type: x mandatory; scroll-padding-left: 0; }
  .column { scroll-snap-align: start; min-height: 320px; }
  .toasts { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}
@media (max-width: 480px) {
  .task-row { grid-template-columns: 18px minmax(0, 1fr) 24px; }
  .task-row .task-due { grid-column: 2; grid-row: 2; text-align: left; }
  .task-row .avatar { grid-row: 1 / span 2; grid-column: 3; }
  .tool-row { grid-template-columns: minmax(0, 1fr); }
  .team-table .n { width: 44px; }
  .team-table th { white-space: normal; line-height: 16px; vertical-align: bottom; padding-bottom: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
}
