:root {
  --plaster: #f4f5f5;
  --canvas: #f4f5f5;
  --ink: #303735;
  --moss: #626b67;
  --sheet: #ffffff;
  --line: #dce1de;
  --focus: #216c67;
  --accent: #edf4f2;
  color: var(--ink);
  background: var(--plaster);
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  font-size: 1.125rem;
  line-height: 1.45;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
}

main {
  width: min(38rem, calc(100% - 3rem));
  margin: 0 auto;
  padding: 12vh 0 4rem;
}

.name {
  margin: 0 0 1.5rem;
  font-weight: 600;
}

h1 {
  margin: 0;
  max-width: 16ch;
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 0.98;
}

.lead, .help, .notice {
  max-width: 38ch;
}

.lead {
  margin: 1.4rem 0 0;
  color: var(--moss);
}

.notice {
  margin: 1.2rem 0 0;
  padding: 0.75rem 0.9rem;
  background: var(--sheet);
  border: 1px solid var(--line);
}

#doors {
  display: grid;
  gap: 0.7rem;
  margin-top: 2rem;
  max-width: 22rem;
}

.workspace {
  max-width: none;
}

.door, .signout {
  display: block;
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--focus);
  border-radius: 6px;
  background: var(--focus);
  color: #fff;
  font: 600 1.05rem/1 "Source Sans 3", sans-serif;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.door.provider {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.door.provider:hover {
  border-color: var(--moss);
  background: var(--canvas);
}

.door:focus-visible, .signout:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.account {
  margin-top: 2rem;
}

.account p {
  margin: 0.2rem 0;
}

.account .via {
  color: var(--moss);
}

.signout {
  margin-top: 1.2rem;
  width: auto;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
}

.help {
  margin: 2.5rem 0 0;
  color: var(--moss);
  font-size: 1rem;
}

.who {
  margin: 0;
  color: var(--moss);
}

.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.2rem 0 0;
  padding: 0;
  list-style: none;
}

.steps li {
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--moss);
  font-size: 0.95rem;
}

.steps li.done {
  border-color: var(--focus);
  color: var(--ink);
}

.steps li.now {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--sheet);
}

.panel {
  display: grid;
  gap: 0.8rem;
}

.panel p, .wait {
  margin: 0;
}

.wait {
  padding-left: 1.2rem;
}

.sheet {
  display: grid;
  gap: 0.8rem;
}

.field {
  display: grid;
  gap: 0.3rem;
}

.field span {
  font-weight: 600;
}

.field input, .field textarea {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--sheet);
  color: var(--ink);
  font: 1rem/1.45 "Source Sans 3", sans-serif;
}

.field input:focus-visible, .field textarea:focus-visible, .secondary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.blocks {
  display: grid;
  gap: 0.6rem;
}

.block-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.block {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--focus);
  border-radius: 6px;
  background: var(--sheet);
  font-size: 0.95rem;
}

.notes {
  display: grid;
  gap: 0.45rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.secondary, .actions .door {
  width: auto;
}

.secondary {
  padding: 0.85rem 1rem;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: 600 1.05rem/1 "Source Sans 3", sans-serif;
  cursor: pointer;
}

@media (max-width: 640px) {
  main { width: min(38rem, calc(100% - 2rem)); padding-top: 8vh; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
}

/* ---------- Workspace (side navigation) ---------- */
body.wide main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  font-size: 1rem;
}

.app { min-height: calc(100vh - 5rem); display: flex; flex-direction: column; }
.topbar {
  height: 72px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.15rem;
  font-weight: 560;
}
.brand-mark {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  color: var(--focus);
  border: 1px solid var(--focus);
  border-radius: 5px;
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
}
.account { display: flex; gap: 12px; align-items: center; }
.accountname { color: var(--moss); font-size: 0.92rem; }
.avatar {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--canvas);
}
.topbar .secondary { border-color: transparent; background: transparent; color: var(--moss); padding: 0.4rem 0.2rem; }
.layout { display: grid; grid-template-columns: 216px minmax(0, 1fr); flex: 1; min-height: 0; }
.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 28px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.navlabel {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--moss);
  padding: 0 12px;
  margin-bottom: 8px;
}
.navitem {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--moss);
  padding: 11px 12px;
  border-radius: 5px;
  text-align: left;
  min-height: 42px;
  font: 500 0.95rem/1.2 "Source Sans 3", sans-serif;
  text-decoration: none;
  cursor: pointer;
}
.navitem:hover { background: var(--canvas); }
.navitem.active { background: var(--accent); color: var(--focus); font-weight: 700; }
.count {
  margin-left: auto;
  font-size: 0.72rem;
  background: var(--canvas);
  padding: 0 6px;
  min-width: 20px;
  text-align: center;
  border-radius: 4px;
  color: var(--ink);
}
.sidebarbottom { margin-top: auto; padding-top: 28px; }
.private { font-size: 0.8rem; color: var(--moss); padding: 12px; }
.workspace { padding: 2rem 2.25rem 1.5rem; min-width: 0; max-width: 1600px; }
.heading { margin-bottom: 1.4rem; }
.workspace h1.page-title {
  max-width: 28ch;
  margin: 0;
  font-size: 1.85rem;
  line-height: 1.25;
}
.heading p { margin: 0.4rem 0 0; color: var(--moss); max-width: 52ch; }
.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 1rem 0;
  margin-bottom: 1.5rem;
}
.summary > div + div { border-left: 1px solid var(--line); padding-left: 1.5rem; }
.summary .small { color: var(--moss); font-size: 0.85rem; }
.summary strong { display: block; font-size: 1.6rem; font-weight: 600; margin-top: 0.2rem; }
.page { min-width: 0; }

@media (max-width: 800px) {
  .topbar { height: 64px; padding: 0 16px; }
  .accountname { display: none; }
  .layout { display: block; }
  .sidebar {
    flex-direction: row;
    overflow: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
    gap: 4px;
  }
  .navlabel, .sidebarbottom { display: none; }
  .navitem { width: auto; white-space: nowrap; flex-shrink: 0; min-height: 38px; padding: 8px 10px; }
  .workspace { padding: 1.4rem 1rem 1rem; }
  .summary { gap: 0.75rem; }
  .summary > div + div { padding-left: 0.75rem; }
  .summary strong { font-size: 1.3rem; }
}

/* ---------- Dashboards ---------- */
.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  background: var(--sheet);
  border: 1px solid var(--line);
}
.bar span { color: var(--moss); flex: 1 1 auto; }
.inline { display: inline; margin: 0; }
.small { padding: 0.35rem 0.7rem !important; font-size: 0.9rem; min-height: 0 !important; width: auto !important; }
.frame {
  background: var(--sheet);
  border: 1px solid var(--line);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.frame h2 { font-size: 1.15rem; margin: 0; }
.frame h3 { font-size: 1.05rem; margin: 0; }
.frame-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.frame.bottom .list { max-height: none; }
.door:disabled, .secondary:disabled { opacity: 0.45; cursor: not-allowed; }
.pill {
  display: inline-block;
  padding: 0.15rem 0.65rem;
  border: 1px solid var(--focus);
  border-radius: 999px;
  font-size: 0.85rem;
  margin: 0.25rem 0;
}
.hint { color: var(--moss); font-size: 0.92rem; margin: 0.35rem 0; }
.note { background: #fff6dd; border-left: 4px solid #c99a1c; padding: 0.5rem 0.75rem; margin: 0.5rem 0; }
.private { color: var(--moss); font-size: 0.85rem; font-style: normal; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0.25rem 1rem; }
.grid .actions, .grid .msg, .grid label:has(textarea) { grid-column: 1 / -1; }
.msg { min-height: 0; margin: 0.4rem 0; font-size: 0.95rem; }
.msg.error { color: #a1260d; font-weight: 600; }
.msg.ok { color: var(--focus); font-weight: 600; }
.project { margin-top: 0.75rem; }
.engagements { margin: 0.5rem 0; padding-left: 1.1rem; }
.engagements li { margin: 0.35rem 0; }
.engagements button { margin-left: 0.4rem; }
.list { display: flex; flex-direction: column; gap: 0.5rem; }
.row {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid var(--line);
  padding: 0.6rem 0.75rem;
  cursor: pointer;
}
.row.selected { border: 2px solid var(--focus); background: #eaf4ee; }
.row.over { outline: 3px dashed var(--focus); }
.row.archived { font-style: italic; color: var(--moss); background: transparent; border-style: dashed; }
.row.project { margin-left: 1.25rem; width: calc(100% - 1.25rem); }
.row small { display: block; color: var(--moss); }
.row-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.badges { color: var(--focus); font-size: 0.9rem; font-weight: 600; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.15rem 0.75rem; margin: 0.4rem 0 0; font-size: 0.95rem; }
.facts dt { color: var(--moss); }
.facts dd { margin: 0; white-space: pre-wrap; }
.sticky { background: var(--sheet); padding-top: 0.5rem; align-items: center; }
.inline-field { display: inline-flex; gap: 0.4rem; align-items: center; }
.inline-field select { font: inherit; padding: 0.35rem; }
.chat-grid { display: grid; grid-template-columns: minmax(12rem, 18rem) 1fr; gap: 1rem; }
.chat-list { display: flex; flex-direction: column; gap: 0.35rem; }
.chat-item { text-align: left; font: inherit; background: #fff; border: 1px solid var(--line); padding: 0.5rem; cursor: pointer; }
.chat-item.selected { border: 2px solid var(--focus); }
.thread { max-height: 45vh; overflow: auto; display: flex; flex-direction: column; gap: 0.4rem; padding: 0.5rem; background: #fff; border: 1px solid var(--line); min-height: 8rem; }
.thread-head { font-weight: 600; margin: 0 0 0.25rem; }
.bubble { max-width: 75%; padding: 0.4rem 0.6rem; border: 1px solid var(--line); background: var(--sheet); align-self: flex-start; }
.bubble.mine { align-self: flex-end; background: #eaf4ee; }
.bubble.blocked { border-color: #a1260d; background: #fdecea; }
.bubble .who { display: block; font-size: 0.8rem; color: var(--moss); }
.compose { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; margin-top: 0.5rem; }
.compose textarea { font: inherit; padding: 0.5rem; }
.compose .msg { grid-column: 1 / -1; }
.match { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(18rem, 0.72fr); gap: 1rem; align-items: start; }
.match .detail { position: sticky; top: 0.5rem; max-height: calc(100vh - 7.5rem); overflow: auto; margin-bottom: 0; }
.board { position: relative; display: grid; grid-template-columns: 1fr 9rem 1fr; align-items: start; }
.board .side .list { max-height: 60vh; overflow: auto; margin: 0.5rem 0; padding-right: 0.25rem; }
.board .side > button { width: auto; }
svg.links { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
svg.links path { fill: none; stroke: var(--focus); stroke-width: 1.5; }
svg.links path.engaged { stroke-width: 3; }
svg.links path.interest { stroke: var(--moss); stroke-dasharray: 5 5; stroke-width: 1.25; }
.overlay { position: fixed; inset: 0; background: rgba(20, 33, 28, 0.35); display: grid; place-items: center; z-index: 10; }
.dialog { background: var(--sheet); border: 2px solid var(--focus); padding: 1.25rem; width: min(30rem, calc(100% - 2rem)); }
.dialog-q { font-weight: 600; margin: 0 0 0.5rem; }
.dialog-d { color: var(--moss); margin: 0 0 1rem; }
details.correction { margin-top: 0.8rem; border-top: 1px solid var(--line); padding-top: 0.6rem; }
details.correction > summary { cursor: pointer; font-weight: 700; color: var(--focus); }
@media (max-width: 1100px) {
  .match { grid-template-columns: 1fr; }
  .match .detail { position: static; max-height: none; }
}
@media (max-width: 760px) {
  .board { grid-template-columns: 1fr; }
  .board .gutter, svg.links { display: none; }
  .chat-grid { grid-template-columns: 1fr; }
}
[hidden] { display: none !important; }
.bubble.office-note { align-self: center; max-width: 90%; background: var(--plaster); border-style: dashed; font-size: 0.92rem; }
table.activity { width: 100%; border-collapse: collapse; font-size: 0.92rem; margin-top: 0.5rem; }
table.activity th, table.activity td { text-align: left; padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.activity th { color: var(--moss); font-weight: 600; }
.frame.detail h3 { margin-top: 1rem; }
.site-footer { text-align: center; color: var(--moss); font-size: 0.85rem; padding: 1.5rem 1rem 2rem; border-top: 1px solid var(--line); margin-top: 2rem; }
.notice-list { margin: 0.25rem 0; padding-left: 1.1rem; }
.notice-list li { margin: 0.3rem 0; }
.notice-list li.unread { font-weight: 600; }
.engagements button { display: inline-flex; vertical-align: middle; margin-top: 0.15rem; }
.field select { width: 100%; padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: 6px; background: var(--sheet); color: var(--ink); font: 1rem/1.45 "Source Sans 3", sans-serif; }
.grid.booking { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); align-items: end; }
.grid.booking .field[hidden] { display: none !important; }
.site-footer .sep { margin: 0 0.5rem; }
.footer-phone { color: inherit; text-decoration: none; white-space: nowrap; }
.footer-phone:hover strong, .footer-phone:focus-visible strong { text-decoration: underline; }
.footer-phone .icon { width: 0.95em; height: 0.95em; fill: currentColor; vertical-align: -0.12em; margin-right: 0.35rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.footer-link { color: inherit; text-decoration: none; white-space: nowrap; }
.footer-link:hover, .footer-link:focus-visible { text-decoration: underline; }
.footer-link .icon { width: 0.95em; height: 0.95em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.12em; margin-right: 0.35rem; }
.faq { max-width: 46rem; }
.faq .name a { color: inherit; text-decoration: none; }
.faq section { margin-top: 2rem; }
.faq h2 { font-size: 1.15rem; margin: 0 0 0.5rem; }
.faq details { border-top: 1px solid var(--line); padding: 0.6rem 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 0.5rem 0 0.2rem; }
.faq #terms p { margin: 0.6rem 0; }
/* Workspace polish (Oct 14): fixed top bar, card edges, folded past items, empty chat state. */
.topbar { position: sticky; top: 0; z-index: 20; }
article.project, details.project.adder { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.1rem; }
details.past { margin-top: 1rem; }
details.past > summary, details.more > summary { cursor: pointer; color: var(--moss); font-weight: 600; padding: 0.4rem 0; }
details.past article.project { opacity: 0.85; }
.chat-list details.past .chat-item { opacity: 0.8; }
.thread .empty { margin: 2rem auto; text-align: center; }
