/* The app shell. Region styles live in print.css, which loads first. Tokens are in DESIGN.md. */

@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("/web/fonts/PublicSans-Regular.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-style: italic; font-weight: 400; font-display: swap; src: url("/web/fonts/PublicSans-Italic.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("/web/fonts/PublicSans-Medium.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("/web/fonts/PublicSans-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("/web/fonts/PublicSans-Bold.woff2") format("woff2"); }

html {
  height: 100%;
  background: var(--fog);
}

body {
  height: 100%;
  background: var(--fog);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

:where(button, input, select, textarea) {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

svg {
  flex: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 50;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  text-decoration: none;
}

.skip:focus {
  top: 12px;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--rule-strong);
  border-bottom-width: 2px;
  background: var(--paper);
  color: var(--ink);
  font: 600 12px/1 var(--sans);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 160ms var(--ease);
}

.icon-button:hover {
  background: var(--fog);
}

.icon-button svg,
.rail svg,
.pill svg,
.lookup-icon,
.photo-upload svg,
.segmented svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rail svg .fill {
  fill: currentColor;
}

/* ---------- Frame ---------- */

.app {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  height: 100dvh;
  transition: grid-template-columns 160ms var(--ease);
}

.app[data-rail="collapsed"] {
  grid-template-columns: 76px minmax(0, 1fr);
}

/* ---------- Rail ---------- */

.rail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px 12px 16px 16px;
}

.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 20px;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
  border-radius: 10px;
}

.mark {
  width: 36px;
  height: 36px;
}

.mark-tile {
  fill: var(--ink);
}

.mark-lot {
  fill: rgb(255 255 255 / 14%);
  stroke: var(--paper);
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.mark-dot {
  fill: #9cc5b5;
}

.wordmark h1 {
  margin: 0;
  display: grid;
  min-width: 0;
}

.wm-city {
  font: 500 12px/14px var(--sans);
  color: var(--slate);
}

.wm-name {
  font: 600 16px/20px var(--sans);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.wm-name::first-letter {
  text-transform: uppercase;
}

.rail-menu {
  display: none;
}

.rail-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0 -4px;
  padding: 0 4px;
}

.rail-group {
  font: 500 12px/16px var(--sans);
  color: var(--slate);
  margin: 16px 12px 6px;
}

.rail-group:first-child {
  margin-top: 0;
}

.rail-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rail-list a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font: 500 15px/20px var(--sans);
  transition: background-color 160ms var(--ease);
}

.rail-list a:hover {
  background: var(--hover);
}

.rail-list a[aria-current="true"] {
  background: rgb(27 29 33 / 7.5%);
  font-weight: 600;
}

.rail-list a span {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
}

.dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-sizing: border-box;
  border: 1.5px solid #b9bec6;
}

.dot[data-tone="ok"] { background: var(--moss); border-color: var(--moss); }
.dot[data-tone="warn"] { background: var(--amber); border-color: var(--amber); }
.dot[data-tone="bad"] { background: var(--brick); border-color: var(--brick); }
.dot[data-tone="busy"] { border-color: var(--amber); animation: pulse 1s ease-in-out infinite alternate; }

@keyframes pulse {
  from { background: transparent; }
  to { background: var(--amber); }
}

.rail-foot {
  margin-top: auto;
  padding: 20px 8px 0;
  display: grid;
  gap: 10px;
}

.rail-date {
  margin: 0;
  font-size: 12px;
  line-height: 16px;
  color: var(--slate);
}

.segmented {
  display: inline-flex;
  justify-self: start;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: rgb(27 29 33 / 6%);
}

.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--slate);
  font: 500 14px/20px var(--sans);
  cursor: pointer;
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}

.segmented button svg {
  width: 16px;
  height: 16px;
}

.segmented button[aria-pressed="true"] {
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgb(27 29 33 / 12%);
}

/* Collapsed rail: icons and dots only. */
.app[data-rail="collapsed"] .rail {
  padding-right: 12px;
}

.app[data-rail="collapsed"] .rail-head {
  flex-direction: column;
  gap: 12px;
}

.app[data-rail="collapsed"] .wordmark h1,
.app[data-rail="collapsed"] .rail-list a span,
.app[data-rail="collapsed"] .rail-date,
.app[data-rail="collapsed"] .segmented span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.app[data-rail="collapsed"] .rail-group {
  height: 1px;
  margin: 10px 12px;
  background: var(--rule-strong);
  color: transparent;
  overflow: hidden;
}

.app[data-rail="collapsed"] .rail-list a {
  justify-content: center;
  padding: 0;
}

.app[data-rail="collapsed"] .rail-list .dot {
  position: absolute;
  top: 7px;
  right: 9px;
}

.app[data-rail="collapsed"] .segmented {
  flex-direction: column;
  justify-self: center;
}

.app[data-rail="collapsed"] .segmented button {
  justify-content: center;
  padding: 0 10px;
}

/* ---------- Surface ---------- */

.surface {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  margin: 12px 12px 12px 0;
  border-radius: var(--r-float);
  background: var(--paper);
  box-shadow: 0 0 0 1px rgb(27 29 33 / 6%), 0 1px 3px rgb(27 29 33 / 5%);
  overflow: hidden;
}

.topbar {
  flex: none;
  display: flex;
  justify-content: center;
  padding: 16px 24px 12px;
  border-bottom: 1px solid transparent;
  transition: border-color 160ms var(--ease);
}

.topbar:empty {
  display: none;
}

.surface[data-scrolled] .topbar {
  border-bottom-color: var(--rule);
}

.lookup {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 640px;
  height: 52px;
  padding: 0 6px 0 16px;
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--rule-strong), 0 6px 20px -10px rgb(27 29 33 / 25%);
  transition: box-shadow 160ms var(--ease);
}

.lookup:focus-within {
  box-shadow: 0 0 0 2px var(--ink), 0 8px 24px -10px rgb(27 29 33 / 30%);
}

.lookup-icon {
  color: var(--slate);
}

.lookup input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: 500 16px/24px var(--sans);
}

.lookup input::placeholder {
  color: #8a9099;
  font-weight: 400;
}

.lookup:focus-within .lookup-key {
  visibility: hidden;
}

.lookup button {
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font: 600 15px/20px var(--sans);
  cursor: pointer;
  transition: background-color 160ms var(--ease);
}

.lookup button:hover {
  background: #33363c;
}

body[data-busy] .lookup button {
  background: #4a4e56;
}

.work {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 32px 200px;
  scroll-padding-top: 16px;
}

/* ---------- Home ---------- */

.home {
  max-width: 760px;
  margin: 0 auto;
  padding: 72px 0 40px;
}

body[data-stage="memo"] .home {
  display: none;
}

.home h2 {
  font: 700 40px/46px var(--sans);
  letter-spacing: -0.025em;
  max-width: 20ch;
  text-wrap: balance;
  margin: 0 0 28px;
}

.home .lookup {
  max-width: none;
  height: 60px;
  padding-left: 18px;
  border-radius: 16px;
}

.home .lookup input {
  font-size: 17px;
}

.home .lookup button {
  height: 46px;
  padding: 0 22px;
  border-radius: 12px;
}

.steps {
  list-style: none;
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin: 36px 0 28px;
  padding: 0;
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 2px 12px;
}

.steps li::before {
  content: counter(step);
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--fog);
  font: 600 13px/1 var(--sans);
}

.steps strong {
  font: 600 15px/22px var(--sans);
}

.steps span {
  color: var(--slate);
  font-size: 14px;
  line-height: 20px;
}

.lede {
  margin: 0;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  color: var(--slate);
  font-size: 14px;
  line-height: 20px;
}

/* ---------- Memo layout ---------- */

.memo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  column-gap: 40px;
  max-width: 1160px;
  margin: 0 auto;
}

.memo > section[data-section] {
  grid-column: 1;
  padding: 28px 0;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 8px;
}

.memo > section[data-section="parcel"] {
  border-top: 0;
  padding-top: 20px;
}

.memo > [data-section="parcel"] { order: 1; }
.memo > [data-section="zoning"] { order: 2; }
.memo > [data-section="permits"] { order: 3; }
.memo > [data-section="flood"] { order: 4; }
.memo > [data-section="goal"] { order: 5; }
.memo > [data-section="rules"] { order: 6; }
.memo > [data-section="photos"] { order: 7; }
.memo > [data-section="repairs"] { order: 8; }
.memo > [data-section="money"] { order: 9; }
.memo > [data-section="questions"] { order: 10; }

.memo > section[data-section="summary"] {
  order: 0;
  grid-column: 2;
  grid-row: 1 / span 20;
  align-self: start;
  position: sticky;
  top: 12px;
  margin-top: 20px;
  padding: 20px;
  border: 0;
  border-radius: var(--r-float);
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--rule), var(--shadow-float);
}

body[data-stage="home"] .memo > section[data-section="summary"] {
  margin-top: 28px;
}

/* On screen the footer below the work carries the disclaimers; the sheet keeps its date and link. */
.memo [data-memo-footer] p:not([data-field="memo-date"]):not(:has(a)) {
  display: none;
}

.memo [data-memo-footer] {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.memo [data-memo-footer] p {
  margin: 0;
}

.legal {
  max-width: 1160px;
  margin: 8px auto 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--rule);
  color: var(--slate);
  font-size: 12px;
  line-height: 18px;
}

.legal p {
  margin: 0 0 4px;
  max-width: 100ch;
}

.legal a {
  color: inherit;
}

/* While a city call is in flight, its region shows a skeleton under its header. */
.memo > section[data-loading] > :not(.region-head) {
  display: none;
}

.memo > section[data-loading]::after {
  content: "";
  display: block;
  height: 72px;
  background:
    linear-gradient(#eceef1 0 0) 0 2px / 58% 16px no-repeat,
    linear-gradient(#eceef1 0 0) 0 30px / 82% 12px no-repeat,
    linear-gradient(#eceef1 0 0) 0 54px / 40% 12px no-repeat;
  animation: breathe 1.1s ease-in-out infinite alternate;
}

@keyframes breathe {
  from { opacity: 1; }
  to { opacity: 0.45; }
}

/* Photo control, moved into the photo region by the shell. */
.photo-add {
  margin: 0 0 16px;
}

.photo-upload {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 16px;
  border: 1.5px dashed var(--rule-strong);
  border-radius: var(--r-card);
  cursor: pointer;
  font-weight: 600;
  transition: border-color 160ms var(--ease), background-color 160ms var(--ease);
}

.photo-upload:hover {
  border-color: var(--slate);
  background: var(--fog);
}

.photo-upload:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.photo-upload small {
  font-weight: 400;
  color: var(--slate);
  font-size: 13px;
  margin-left: auto;
}

.photo-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.photo-note:not(:empty) {
  margin: 8px 0 0;
  color: var(--brick);
  font-size: 14px;
  font-weight: 500;
}

/* ---------- Dock: key hints and the goal pill ---------- */

.surface::after {
  content: "";
  position: absolute;
  left: 0;
  right: 12px;
  bottom: 0;
  height: 112px;
  background: linear-gradient(to bottom, rgb(255 255 255 / 0), rgb(255 255 255 / 92%) 55%, var(--paper));
  pointer-events: none;
  z-index: 4;
}

.dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  z-index: 5;
}

.dock > * {
  pointer-events: auto;
}

.keys {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 7px 12px;
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--rule), var(--shadow-float);
  font-size: 13px;
  line-height: 20px;
  color: var(--slate);
}

.keys span {
  margin-right: 10px;
}

.keys span:last-child {
  margin-right: 0;
}

kbd.wide {
  padding: 0 7px;
}

.goal-bar {
  max-width: calc(100% - 32px);
}

.pill {
  display: flex;
  gap: 4px;
  padding: 6px;
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--rule), 0 16px 40px -16px rgb(27 29 33 / 35%), 0 2px 6px rgb(27 29 33 / 6%);
  overflow-x: auto;
  scrollbar-width: none;
}

.pill::-webkit-scrollbar {
  display: none;
}

.pill button {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 84px;
  height: 58px;
  padding: 6px 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--ink);
  font: 500 13px/16px var(--sans);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}

.pill button:hover {
  background: var(--fog);
}

.pill button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
}

/* ---------- Client view: what the buyer sees ---------- */

body[data-view="client"] .topbar,
body[data-view="client"] .dock,
body[data-view="client"] [data-photo-control],
body[data-view="client"] .memo :is(button[type="submit"], button[aria-pressed="false"], [data-action="tag-form"], [data-action="edit-tag"], [data-action="delete-tag"], [data-action="confirm-tag"], [data-action="confirm-room"]),
body[data-view="client"] .memo label:has(> input[type="checkbox"]:not(:checked)),
body[data-view="client"] .agent-only {
  display: none !important;
}

body[data-view="client"] .memo :is(input:not([type="checkbox"]), select) {
  pointer-events: none;
  border-color: transparent;
  background: transparent;
  padding: 0;
  min-height: 0;
  height: auto;
  appearance: none;
  box-shadow: none;
}

body[data-view="client"] .memo input[type="checkbox"] {
  pointer-events: none;
}

body[data-view="client"] .memo button[aria-pressed="true"] {
  pointer-events: none;
}

/* ---------- Narrower screens ---------- */

@media (max-width: 1180px) {
  .memo {
    grid-template-columns: minmax(0, 1fr);
    max-width: 760px;
  }

  .memo > section[data-section="summary"] {
    grid-column: 1;
    grid-row: auto;
    position: static;
    margin-top: 16px;
  }

  .memo > section[data-section="summary"] + section,
  .memo > section[data-section="parcel"] {
    border-top: 0;
  }

  .legal {
    max-width: 760px;
  }
}

@media (max-width: 760px) {
  html,
  body {
    height: auto;
  }

  body {
    background: var(--paper);
  }

  .app,
  .app[data-rail="collapsed"] {
    display: block;
    height: auto;
  }

  .rail {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 10px 12px 10px 16px;
    background: rgb(255 255 255 / 92%);
    backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid var(--rule);
  }

  .rail-head,
  .app[data-rail="collapsed"] .rail-head {
    flex-direction: row;
    margin: 0;
  }

  .app[data-rail="collapsed"] .wordmark h1 {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
  }

  .mark {
    width: 32px;
    height: 32px;
  }

  .rail-collapse {
    display: none;
  }

  .rail-menu {
    display: inline-grid;
    width: 44px;
    height: 44px;
  }

  .rail-body {
    display: none;
  }

  .app[data-menu="open"] .rail-body {
    display: flex;
    position: fixed;
    top: 72px;
    left: 12px;
    right: 12px;
    max-height: calc(100dvh - 88px);
    margin: 0;
    padding: 12px;
    border-radius: var(--r-float);
    background: var(--paper);
    box-shadow: 0 0 0 1px var(--rule), 0 24px 48px -16px rgb(27 29 33 / 40%);
  }

  .app[data-menu="open"]::after {
    content: "";
    position: fixed;
    inset: 65px 0 0;
    z-index: 15;
    background: rgb(27 29 33 / 24%);
  }

  .app[data-menu="open"] .rail {
    z-index: 30;
  }

  .rail-list a {
    height: 44px;
  }

  .app[data-rail="collapsed"] .rail-list a span,
  .app[data-rail="collapsed"] .rail-date,
  .app[data-rail="collapsed"] .segmented span {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
  }

  .segmented button {
    height: 40px;
  }

  .surface {
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }

  .topbar {
    position: sticky;
    top: 65px;
    z-index: 10;
    padding: 10px 16px;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
  }

  .lookup {
    height: 48px;
    padding-left: 12px;
    border-radius: 12px;
  }

  .lookup-key {
    display: none;
  }

  .lookup button {
    padding: 0 14px;
  }

  .work {
    overflow: visible;
    padding: 0 16px 120px;
  }

  .home {
    padding: 32px 0 24px;
  }

  .home h2 {
    font-size: 30px;
    line-height: 36px;
    margin-bottom: 20px;
  }

  .home .lookup {
    height: 56px;
  }

  .home .lookup button {
    height: 44px;
    padding: 0 16px;
  }

  .steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    margin: 28px 0 24px;
  }

  .memo > section[data-section] {
    padding: 24px 0;
  }

  .memo > section[data-section="summary"] {
    margin-top: 12px;
    padding: 16px;
  }

  .lot.has-plat {
    grid-template-columns: minmax(0, 1fr);
  }

  .lot-title {
    font-size: 24px;
    line-height: 30px;
  }

  .dock {
    position: fixed;
    bottom: 12px;
  }

  .keys {
    display: none;
  }

  .goal-bar {
    max-width: calc(100% - 24px);
  }

  .goal-bar,
  .pill {
    width: calc(100vw - 24px);
  }

  .pill button {
    flex: 1 1 0;
    min-width: 0;
    height: 58px;
    padding: 6px 2px;
    font-size: 11px;
    line-height: 13px;
    white-space: normal;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Print from the app ---------- */

@media print {
  html,
  body,
  .app {
    height: auto;
    background: var(--paper);
  }

  .app {
    display: block;
  }

  .rail,
  .topbar,
  .dock,
  .home,
  .skip {
    display: none !important;
  }

  .surface {
    margin: 0;
    box-shadow: none;
    overflow: visible;
  }

  .work {
    overflow: visible;
    padding: 0;
  }

  .memo {
    display: flex;
    flex-direction: column;
    max-width: none;
  }

  .memo > section[data-section],
  .memo > section[data-section="summary"] {
    order: 0;
    align-self: stretch;
    container-type: normal;
    position: static;
    margin: 0;
    padding: 14px 0;
    border-radius: 0;
    box-shadow: none;
    border-top: 1px solid var(--rule);
  }

  .memo > section[data-section="summary"] {
    border-top: 0;
    padding-top: 0;
  }

  .memo [data-memo-footer] p {
    display: block !important;
  }
}

/* ---------- The call, as the dark hero card (Claude Design canvas, Main artboard) ---------- */

@media screen {
  .memo > section[data-section="summary"] {
    background: var(--ink);
    color: #ffffff;
    box-shadow: var(--shadow-float);
  }

  .memo > section[data-section="summary"] h2,
  .memo > section[data-section="summary"] .call-kind {
    color: #b9bec7;
  }

  .memo > section[data-section="summary"] li.call-line {
    margin: 0 0 8px;
    padding: 12px 14px 12px 34px;
    border: 0;
    border-radius: var(--r-card);
    background: #2a2d33;
  }

  .memo > section[data-section="summary"] li.call-line::before {
    left: 14px;
    top: 34px;
    border-color: #6b717c;
  }

  .memo > section[data-section="summary"] li.call-line[data-tone="ok"]::before { background: #7fc3a5; border-color: #7fc3a5; }
  .memo > section[data-section="summary"] li.call-line[data-tone="warn"]::before { background: #e9c46a; border-color: #e9c46a; }
  .memo > section[data-section="summary"] li.call-line[data-tone="bad"]::before { background: #f08a7c; border-color: #f08a7c; }

  .memo > section[data-section="summary"] [data-field] a,
  .memo > section[data-section="summary"] .call-count a {
    color: #ffffff;
  }

  .memo > section[data-section="summary"] li.call-line[data-tone="idle"] [data-field] {
    color: #b9bec7;
  }

  .memo > section[data-section="summary"] .call-stop {
    background: rgb(240 138 124 / 16%);
    color: #f6b3a9;
  }

  .memo > section[data-section="summary"] .screen-only button {
    border-color: #3a3e45;
    background: #2a2d33;
    color: #ffffff;
  }

  .memo > section[data-section="summary"] .screen-only button:first-child {
    background: #ffffff;
    border-color: #ffffff;
    color: var(--ink);
  }

  .memo > section[data-section="summary"] .screen-only button:disabled {
    opacity: 0.45;
  }

  .memo > section[data-section="summary"] [data-field="save-note"]:not(:empty) {
    color: #f6b3a9;
  }

  /* Source lines read as quiet citations, not as body links. */
  p.source a,
  .source-line a,
  .row-cite a {
    color: var(--slate);
    text-decoration: underline dotted;
    text-underline-offset: 3px;
  }

  p.source a:hover,
  .source-line a:hover,
  .row-cite a:hover {
    color: var(--ink);
    text-decoration-style: solid;
  }
}

/* ---------- Error toast: what broke and the id to quote ---------- */

.error-toast {
  position: fixed;
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  z-index: 50;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: var(--r-card);
  background: var(--ink);
  color: #ffffff;
  font: 500 14px/20px var(--sans);
  box-shadow: var(--shadow-float);
}

.error-toast[hidden] {
  display: none;
}

@media print {
  .error-toast {
    display: none !important;
  }
}

/* ---------- Account: save state, workspace link, first-run chip ---------- */

.topbar:not(:has(form)):not(:has([data-save-state]:not([hidden]))) {
  display: none;
}

.topbar {
  align-items: center;
  gap: 12px;
}

.save-state {
  order: 2;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  margin: 0;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--fog);
  color: var(--slate);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.save-state[hidden] {
  display: none;
}

.save-state[data-state="saved"] {
  background: var(--moss-soft);
  color: var(--moss);
}

.save-state[data-state="error"],
.save-state[data-state="limit"] {
  background: var(--brick-soft);
  color: var(--brick);
}

.save-state a {
  color: inherit;
  font-weight: 600;
}

.link-button {
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.rail-account {
  margin-bottom: 4px;
}

.rail-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
}

.rail-user[hidden],
.rail-account[hidden],
.rail-plans[hidden] {
  display: none;
}

.rail-user-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-plans {
  margin: 0 0 8px;
  font-size: 13px;
}

.rail-plans a {
  color: var(--ink);
  font-weight: 600;
}

.sample-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 12px 0 0;
  color: var(--slate);
  font-size: 14px;
}

.sample-chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px dashed var(--rule-strong);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.sample-chip:hover {
  border-style: solid;
  border-color: var(--ink);
}

@media print {
  .save-state,
  .sample-row {
    display: none !important;
  }
}
