/*
 * Self-hosted type assets:
 * - InterVariable.woff2: Inter variable roman, weights 400–600.
 * - noto-sans-jp.css: Noto Sans JP v56 unicode-range subsets, weights 400–600.
 * Both use font-display: swap; full provenance is recorded in assets/fonts/README.md.
 */
@font-face {
  font-family: "Inter";
  src: url("./assets/fonts/InterVariable.woff2") format("woff2-variations");
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
}

:root {
  --color-ink: #111314;
  --color-graphite: #232628;
  --color-charcoal: #34383B;
  --color-concrete: #D9D9D6;
  --color-concrete-secondary: #D3D4D2;
  --color-surface: #FFFFFF;
  --color-line: #C9C6C0;
  --color-text-secondary: #6B7075;
  --color-text-on-concrete: #232628;
  --color-difference: #D84C43;
  --color-text-quiet: rgb(107 112 117 / 78%);
  --asset-concrete-image: url("./assets/concrete-architectural-v6.jpg");
  --joint-primary: rgb(17 19 20 / 10%);
  --joint-secondary: rgb(17 19 20 / 9%);
  --font-ui: "Inter", "Noto Sans JP", "Noto Sans CJK JP", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  --font-wordmark-source: "Inter", sans-serif;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --sidebar-width: 168px;
  --container-outer: 1280px;
  --gutter: clamp(24px, 4vw, 56px);
  --radius-standard: 6px;
  --radius-frame: 8px;
  --radius-status: 4px;
  --control-height: 38px;
  --button-height: 42px;
  --shadow-document: 0 10px 24px rgb(17 19 20 / 6%);
  --shadow-modal: 0 18px 48px rgb(17 19 20 / 18%);
  --type-page-title: 36px;
  --type-section-title: 24px;
  --type-body: 16px;
  --type-support: 17px;
  --type-meta: 14px;
  --type-nav: 13px;
  --focus: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-ink);
  color: var(--color-ink);
  background: var(--color-concrete);
  font-family: var(--font-ui);
  font-synthesis: none;
}

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

html {
  background: var(--color-concrete-secondary);
}

body {
  margin: 0;
  min-width: 1040px;
  overflow-x: hidden;
  background-color: var(--color-concrete);
  color: var(--color-ink);
  font-size: var(--type-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.app-root {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
  background-color: var(--color-concrete);
  background-image: var(--asset-concrete-image);
  background-position: center top;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

.app-root::before {
  position: fixed;
  z-index: 0;
  top: 0;
  bottom: 0;
  left: 32%;
  width: 1px;
  background: var(--joint-primary);
  box-shadow: 40.7vw 0 0 var(--joint-secondary);
  content: "";
  pointer-events: none;
}

b,
strong {
  font-weight: 600;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

img {
  display: block;
  max-width: 100%;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 28px 10px 20px;
  border-right: 0;
  background: var(--color-graphite);
  color: var(--color-surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 10px 44px;
}

.brand > img {
  width: 128px;
  height: auto;
}

.brand .brand-compact {
  display: none;
}

.brand-mark {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  color: var(--color-surface);
}

.brand-mark svg {
  width: 28px;
  height: 28px;
  stroke-width: 1.6;
}

.sidebar nav {
  display: grid;
  gap: 2px;
}

.sidebar button {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: rgb(255 255 255 / 62%);
  font-size: var(--type-nav);
  font-weight: 500;
  text-align: left;
}

.sidebar button:hover {
  background: var(--color-charcoal);
  color: var(--color-surface);
}

.sidebar button:focus-visible {
  outline: 2px solid var(--color-surface);
  outline-offset: 2px;
}

.sidebar button.active {
  border-left-color: rgb(255 255 255 / 74%);
  background: transparent;
  color: var(--color-surface);
}

.sidebar button:disabled {
  color: var(--color-text-secondary);
  opacity: .7;
}

.sidebar-bottom {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.sidebar .reset {
  padding-top: 14px;
  border-top: 1px solid rgb(255 255 255 / 18%);
  border-left: 0;
  color: rgb(255 255 255 / 62%);
}

main {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  display: flex;
  height: 52px;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--color-line);
  background: var(--color-surface);
  font-size: var(--type-nav);
}

.topbar > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar > div:first-child > span {
  color: var(--color-line);
}

.topbar strong {
  font-weight: 500;
}

.crumb,
.back-link,
.text-button {
  border: 0;
  background: transparent;
  color: var(--color-graphite);
}

.crumb:hover,
.back-link:hover,
.text-button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.crumb:focus-visible,
.back-link:focus-visible,
.text-button:focus-visible {
  border-radius: 2px;
  outline: 2px solid var(--color-ink);
  outline-offset: 3px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.language-toggle {
  display: grid;
  min-height: var(--button-height);
  grid-template-columns: 52px 68px;
  align-items: center;
  gap: 0;
  overflow: hidden;
  padding: 0;
  border: 1px solid rgb(17 19 20 / 42%);
  border-radius: var(--radius-standard);
  background: rgb(255 255 255 / 78%);
  color: var(--color-graphite);
}

.language-toggle b {
  display: grid;
  min-width: 52px;
  min-height: 40px;
  place-items: center;
  padding: 0;
  border-radius: 0;
  background: var(--color-ink);
  color: var(--color-surface);
  font-size: 13px;
  letter-spacing: .04em;
  text-align: center;
}

.language-toggle span {
  display: grid;
  min-height: 40px;
  place-items: center;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.language-toggle:hover {
  border-color: var(--color-graphite);
}

.language-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.status-dot {
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius-standard);
  background: rgb(17 19 20 / 5%);
  color: var(--color-graphite);
  font-size: 13px;
  font-weight: 500;
}

.status-dot::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--color-text-secondary);
  content: "";
  vertical-align: 1px;
}

.stepper {
  display: flex;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--color-line);
  background: var(--color-surface);
}

.stepper > i {
  display: block;
  width: 44px;
  height: 1px;
  margin: 0 10px;
  background: var(--color-line);
}

.step {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-secondary);
  font-size: 12px;
}

.step span {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid var(--color-line);
  border-radius: 50%;
  background: var(--color-surface);
  font-size: 12px;
  font-weight: 400;
}

.step span svg {
  width: 11px;
}

.step.current {
  color: var(--color-graphite);
}

.step.current span {
  border-color: var(--color-ink);
  background: transparent;
  color: var(--color-ink);
}

.step.current b {
  color: var(--color-graphite);
  font-weight: 500;
}

.step.done b {
  color: var(--color-text-secondary);
  font-weight: 500;
}

.step.done span {
  border-color: var(--color-graphite);
  color: var(--color-graphite);
}

.content {
  max-width: var(--container-outer);
  margin: 0 auto;
  padding: var(--space-10) var(--gutter) 68px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 28px;
}

.page-heading.compact {
  align-items: center;
}

.eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.page-heading h1 {
  margin: 0 0 10px;
  font-size: var(--type-page-title);
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.25;
}

.page-heading p {
  margin: 0;
  color: var(--color-text-on-concrete);
  font-size: var(--type-support);
  font-weight: 500;
  line-height: 1.5;
}

.page-heading .eyebrow {
  color: var(--color-text-on-concrete);
}

.overview .page-heading {
  margin-bottom: var(--space-12);
}

.overview .contract-panel {
  min-height: clamp(360px, 50vh, 520px);
}

.overview .scope-row:not(.header) {
  min-height: 112px;
}

.primary,
.secondary,
.ghost {
  display: inline-flex;
  min-height: var(--button-height);
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-standard);
  font-size: 16px;
  font-weight: 600;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.primary {
  border: 1px solid var(--color-ink);
  background: var(--color-ink);
  color: var(--color-surface);
}

.primary:hover {
  border-color: var(--color-graphite);
  background: var(--color-graphite);
}

.primary svg {
  width: 16px;
}

.secondary,
.ghost {
  border: 1px solid var(--color-line);
  background: transparent;
  color: var(--color-ink);
}

.secondary:hover,
.ghost:hover {
  background: var(--color-concrete);
}

.primary:focus-visible,
.secondary:focus-visible,
.ghost:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.primary:disabled,
.secondary:disabled,
.ghost:disabled,
.language-toggle:disabled,
.compact-button:disabled {
  cursor: not-allowed;
  border-color: var(--color-line);
  background: var(--color-concrete-secondary);
  color: var(--color-text-secondary);
  opacity: .72;
}

.full {
  width: 100%;
}

.panel,
.customer-message,
.detected-change,
.price-panel,
.total-card,
.send-card,
.outcome-grid article {
  border: 1px solid var(--color-line);
  border-radius: var(--radius-standard);
  background: var(--color-surface);
  box-shadow: none;
}

.panel-head {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--color-line);
}

.panel-head h2 {
  margin: 0 0 3px;
  font-size: var(--type-section-title);
  font-weight: 600;
  line-height: 1.3;
}

.contract-panel .panel-head {
  padding: 28px 28px 26px;
}

.contract-panel .panel-head h2 {
  font-size: 22px;
  font-weight: 600;
}

.contract-panel .contract-panel-total > strong {
  font-size: 20px;
  font-weight: 500;
}

.contract-panel .contract-panel-total {
  position: relative;
  top: -2px;
}

.panel-head p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.contract-panel-total {
  display: flex;
  align-items: center;
  gap: 12px;
}

.contract-panel-total > small {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.contract-panel-total > strong {
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.signed {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--color-ink);
  font-size: var(--type-meta);
  font-weight: 500;
  white-space: nowrap;
}

.signed svg {
  width: 14px;
}

.scope-table {
  width: 100%;
}

.scope-row {
  display: grid;
  min-height: 70px;
  grid-template-columns: 1fr 96px 128px;
  align-items: center;
  padding: 18px 28px;
  border-bottom: 1px solid var(--color-line);
  font-size: var(--type-body);
}

.scope-row.header {
  min-height: 44px;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.scope-row > span:first-child {
  display: grid;
  gap: 4px;
}

.scope-row small {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.scope-row b {
  font-size: 15px;
  font-weight: 400;
}

.scope-row:not(.header) {
  align-items: end;
  padding-top: 23px;
  padding-bottom: 23px;
}

.scope-row > span:nth-child(2) {
  width: 100%;
  justify-self: stretch;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.scope-row > span:last-child {
  width: 100%;
  justify-self: stretch;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.text-button {
  margin: 18px 24px;
  padding: 4px;
  font-size: 15px;
  font-weight: 500;
}

.overlay,
.processing {
  position: fixed;
  inset: 0 0 0 clamp(360px, 34vw, 720px);
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(17 19 20 / 72%);
}

.contract-modal {
  position: relative;
  width: min(880px, calc(100vw - var(--sidebar-width) - 64px));
  max-height: 92vh;
  overflow: auto;
  border-radius: var(--radius-frame);
  background: var(--color-surface);
  box-shadow: var(--shadow-modal);
}

.contract-modal:focus {
  outline: 2px solid var(--color-surface);
  outline-offset: 4px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-standard);
  background: var(--color-surface);
  color: var(--color-graphite);
  font-size: 24px;
  line-height: 1;
}

.modal-close:hover {
  background: var(--color-concrete);
}

.modal-close:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.contract-paper {
  min-height: 0;
  padding: 40px 48px 32px;
  box-shadow: none;
}

.contract-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}

.contract-section-title h3 {
  margin: 0 0 3px;
  font-size: var(--type-section-title);
  font-weight: 600;
}

.contract-section-title p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.signed-contract-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-color: var(--color-ink);
  color: var(--color-ink);
}

.signed-contract-status svg {
  width: 14px;
}

.contract-paper .doc-address small {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
  font-weight: 500;
}

.contract-paper td:first-child {
  min-width: 320px;
}

.contract-totals {
  margin-bottom: 24px;
}

.contract-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 32px;
}

.contract-signatures > div {
  display: grid;
  gap: 5px;
  padding-top: 10px;
  border-top: 1px solid var(--color-graphite);
}

.contract-signatures span,
.contract-signatures small {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.contract-signatures strong {
  font-size: var(--type-body);
}

.contract-extract-note {
  margin: 28px 0 0;
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
  text-align: center;
}

.customer-message {
  display: grid;
  grid-template-columns: 224px 1fr;
  align-items: center;
  gap: 28px;
  margin-bottom: 20px;
  padding: 24px 28px;
}

.request-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.request-meta > div {
  display: grid;
  gap: 2px;
}

.request-meta .eyebrow {
  margin: 0 0 2px;
}

.request-meta strong {
  font-size: var(--type-body);
}

.request-meta small {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.customer-avatar {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border: 1px solid var(--color-line);
  border-radius: 50%;
  background: var(--color-concrete);
  color: var(--color-graphite);
  font-weight: 600;
}

.customer-message blockquote {
  margin: 0;
  padding: 0;
  border-left: 0;
  color: var(--color-graphite);
  font-size: var(--type-support);
  line-height: 1.7;
}

.message-thread {
  overflow: hidden;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-standard);
  background: var(--color-surface);
}

.thread-heading {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--color-line);
}

.thread-heading .eyebrow {
  margin: 0 0 2px;
}

.thread-heading h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
}

.thread-heading > small {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
  font-variant-numeric: tabular-nums;
}

.thread-entry {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  gap: 28px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--color-line);
}

.thread-identity {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.thread-identity > div {
  display: grid;
  gap: 2px;
}

.thread-identity strong {
  font-size: var(--type-body);
}

.thread-identity span:not(.customer-avatar):not(.staff-avatar) {
  color: var(--color-ink);
  font-size: var(--type-meta);
  font-weight: 500;
}

.thread-identity small {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.staff-avatar {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border-radius: 50%;
  background: var(--color-graphite);
  color: var(--color-surface);
  font-weight: 600;
}

.thread-message {
  min-width: 0;
}

.thread-message > p {
  margin: 0;
  color: var(--color-graphite);
  font-size: var(--type-support);
  line-height: 1.7;
  white-space: pre-line;
}

.selection-entry .thread-identity span:not(.customer-avatar),
.acceptance-entry .thread-identity span:not(.customer-avatar) {
  font-weight: 600;
}

.draft-editor {
  display: grid;
  gap: 7px;
}

.draft-editor > span {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
  font-weight: 500;
}

.draft-editor textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  padding: 14px 16px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-standard);
  outline: 0;
  background: var(--color-surface);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--type-body);
  line-height: 1.65;
}

.draft-editor textarea:focus {
  border-color: var(--color-ink);
  box-shadow: var(--focus);
}

.quote-attachment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 18px;
  padding: 15px 0;
  border-top: 1px solid var(--color-line);
  border-bottom: 1px solid var(--color-line);
}

.quote-attachment > div {
  display: grid;
  gap: 2px;
}

.quote-attachment > div:last-child {
  grid-template-columns: auto auto;
  align-items: center;
  gap: 14px;
}

.quote-attachment span,
.quote-attachment small {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.quote-attachment strong {
  font-size: var(--type-body);
}

.quote-attachment b {
  font-size: var(--type-body);
  font-variant-numeric: tabular-nums;
}

.compact-button {
  min-height: 40px;
  padding: 8px 14px;
  font-size: var(--type-meta);
}

.thread-actions,
.thread-completion {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.thread-completion {
  margin: 0;
  padding: 20px 28px;
}

.detected-list {
  display: grid;
  gap: 0;
  margin-bottom: 24px;
  padding: 0 28px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-standard);
  background: var(--color-surface);
  box-shadow: none;
}

.detected-change {
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: transparent;
  box-shadow: none;
}

.detected-change + .detected-change {
  border-top: 1px solid var(--color-line);
}

.detected-change > header {
  display: flex;
  min-height: 60px;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-line);
}

.detected-change > header > span {
  display: block;
  width: auto;
  height: auto;
  flex: 0 0 auto;
  border: 0;
  border-radius: 0;
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
  font-weight: 500;
  letter-spacing: .08em;
}

.detected-change h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
}

.change-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.change-comparison > div {
  display: grid;
  min-height: 144px;
  align-content: start;
  gap: 7px;
  padding: 20px 22px 24px 0;
}

.change-comparison > div + div {
  border-left: 1px solid var(--color-line);
}

.change-comparison span {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
  font-weight: 500;
}

.change-comparison p {
  margin: 0;
  color: var(--color-graphite);
  font-size: var(--type-body);
  line-height: 1.6;
}

.change-comparison small {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.change-comparison .ai-difference {
  padding-right: 0;
  padding-left: 22px;
  border-left: 2px solid var(--color-difference);
  background: var(--color-surface);
}

.ai-difference span {
  color: var(--color-difference);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.ai-difference strong {
  color: var(--color-ink);
  font-size: var(--type-body);
}

.ai-difference p {
  color: var(--color-graphite);
}

.suggestion-card > header > small {
  margin-left: auto;
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
  font-weight: 500;
}

.suggestion-rows > section {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--color-line);
}

.suggestion-rows > section:last-child {
  border-bottom: 0;
}

.suggestion-rows > section > span {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
  font-weight: 500;
  letter-spacing: .08em;
}

.suggestion-rows > section > div {
  display: grid;
  gap: 8px;
}

.suggestion-rows strong {
  font-size: var(--type-body);
  font-weight: 600;
}

.suggestion-rows p {
  margin: 0;
  color: var(--color-graphite);
  font-size: var(--type-body);
  line-height: 1.6;
}

.suggestion-rows dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.suggestion-rows dl > div {
  display: grid;
  gap: 2px;
}

.suggestion-rows dt {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.suggestion-rows dd {
  margin: 0;
  color: var(--color-ink);
  font-size: var(--type-body);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.page-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.pricing-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-standard);
  background: var(--color-surface);
}

.price-panel {
  overflow: hidden;
  border: 0;
  border-radius: 0;
}

.price-header,
.price-row {
  display: grid;
  grid-template-columns: minmax(200px, 1.7fr) 100px 82px 108px 108px 92px 120px;
  align-items: center;
  gap: 8px;
}

.price-header {
  min-height: 46px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--color-line);
  background: var(--color-concrete-secondary);
  color: var(--color-graphite);
  font-size: 13px;
  font-weight: 500;
}

.price-row {
  min-height: 116px;
  padding: 20px;
  border-bottom: 1px solid var(--color-line);
}

.price-row:last-child {
  border-bottom: 0;
}

.item-cell {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.item-cell > div {
  display: grid;
  gap: 4px;
}

.item-cell strong {
  font-size: var(--type-body);
  font-weight: 600;
  line-height: 1.45;
}

.item-cell small {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.kind {
  padding: 2px 0 2px 10px;
  border: 0;
  border-left: 2px solid var(--color-difference);
  border-radius: 0;
  color: var(--color-graphite);
  font-size: var(--type-meta);
  font-weight: 600;
  white-space: nowrap;
}

.kind.credit {
  background: var(--color-surface);
}

.price-row label,
.sell {
  display: grid;
  gap: 5px;
}

.price-row label > span,
.sell > span {
  display: none;
}

.price-row input,
.price-row select {
  width: 100%;
  height: var(--control-height);
  padding: 7px 9px;
  border: 1px solid var(--color-line);
  border-radius: 6px;
  outline: none;
  background: var(--color-surface);
  color: var(--color-ink);
  font-size: var(--type-body);
  font-variant-numeric: tabular-nums;
}

.price-row input:hover,
.price-row select:hover {
  border-color: var(--color-graphite);
}

.price-row input:focus,
.price-row select:focus {
  border-color: var(--color-ink);
  box-shadow: var(--focus);
}

.currency-input {
  position: relative;
}

.currency-input em {
  position: absolute;
  top: 9px;
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
  font-style: normal;
  pointer-events: none;
}

.currency-input em {
  right: auto;
  left: 9px;
}

.currency-input input {
  padding-left: 22px;
  text-align: right;
}

.unit-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  height: var(--control-height);
  overflow: hidden;
  border: 1px solid var(--color-line);
  border-radius: 6px;
  background: var(--color-surface);
}

.unit-input:hover {
  border-color: var(--color-graphite);
}

.unit-input:focus-within {
  border-color: var(--color-ink);
  box-shadow: var(--focus);
}

.unit-input input {
  min-width: 0;
  padding: 7px 4px 7px 9px;
  border: 0;
  border-radius: 0;
  text-align: right;
}

.unit-input input:hover,
.unit-input input:focus {
  border: 0;
  box-shadow: none;
}

.unit-input em {
  padding: 0 9px 0 4px;
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
  font-style: normal;
  white-space: nowrap;
}

.sell strong {
  font-size: var(--type-support);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.source {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
  line-height: 1.35;
  text-align: right;
}

.total-card {
  position: sticky;
  top: 20px;
  height: max-content;
  padding: 24px;
  border: 0;
  border-left: 1px solid var(--color-line);
  border-radius: 0;
}

.big-total {
  padding: 0;
  font-size: 36px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

.total-lines {
  padding: 0 0 18px;
}

.total-lines p,
.pricing-contract-rollup p,
.doc-totals p {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.total-lines p {
  margin: 0;
  padding: 8px 0;
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.total-lines b {
  color: var(--color-graphite);
  font-size: var(--type-body);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.total-lines .negative {
  color: var(--color-graphite);
  text-decoration: underline;
  text-decoration-color: var(--color-difference);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.total-lines .net-before-tax {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--color-line);
}

.final-change-total {
  margin-bottom: 20px;
  padding: 20px 0 22px;
  border-top: 2px solid var(--color-ink);
  border-bottom: 1px solid var(--color-line);
}

.final-change-total .eyebrow {
  margin-bottom: 5px;
  color: var(--color-ink);
}

.pricing-contract-rollup {
  margin: 2px 0 20px;
  padding: 18px 0 0;
  border: 0;
  border-top: 1px solid var(--color-line);
  border-radius: 0;
  background: transparent;
}

.pricing-contract-rollup p {
  margin: 0;
  padding: 5px 0;
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.pricing-contract-rollup b {
  color: var(--color-graphite);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.pricing-contract-rollup .projected {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--color-line);
}

.pricing-contract-rollup .projected span {
  color: var(--color-ink);
  font-weight: 600;
}

.pricing-contract-rollup strong {
  color: var(--color-ink);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.profit-box {
  display: grid;
  gap: 3px;
  margin-bottom: 20px;
  padding: 18px 0 0;
  border: 0;
  border-top: 1px solid var(--color-line);
  border-radius: 0;
  background: transparent;
}

.profit-box span,
.profit-box small {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.profit-box > strong {
  color: var(--color-ink);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.profit-box small b {
  font-size: inherit;
}

.back-link {
  display: block;
  margin: 14px auto 0;
  padding: 3px;
  font-size: var(--type-meta);
}

.document-layout {
  display: grid;
  grid-template-columns: minmax(700px, 1fr) 280px;
  align-items: start;
  gap: 32px;
}

.paper {
  min-height: 860px;
  padding: 52px 56px 32px;
  background: var(--color-surface);
  box-shadow: var(--shadow-document);
}

.paper.contract-paper {
  box-shadow: none;
}

.paper-top {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-top: 20px;
  border-top: 4px solid var(--color-ink);
}

.doc-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-ink);
  font-size: var(--type-meta);
  font-weight: 600;
  letter-spacing: .12em;
}

.doc-logo img {
  width: 104px;
  height: auto;
}

.paper-top h2 {
  margin: 8px 0 4px;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.25;
}

.paper-top p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.doc-status {
  height: max-content;
  padding: 7px 10px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-status);
  color: var(--color-graphite);
  font-size: var(--type-meta);
  font-weight: 500;
  white-space: nowrap;
}

.doc-address {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin: 40px 0;
}

.doc-address > div {
  display: grid;
  gap: 4px;
}

.doc-address > div:last-child {
  text-align: right;
}

.doc-address strong {
  font-size: var(--type-support);
}

.doc-address span {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.doc-message {
  display: grid;
  gap: 4px;
  margin-bottom: 28px;
  padding: 18px 0;
  border-top: 1px solid var(--color-line);
  border-right: 0;
  border-bottom: 1px solid var(--color-line);
  border-left: 0;
  background: transparent;
}

.doc-message strong {
  font-size: var(--type-body);
}

.doc-message span {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.paper table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--type-body);
  font-variant-numeric: tabular-nums;
}

.paper th {
  padding: 11px 10px;
  background: var(--color-graphite);
  color: var(--color-surface);
  font-size: var(--type-meta);
  font-weight: 600;
  text-align: left;
}

.paper th:nth-child(n + 2),
.paper td:nth-child(n + 2) {
  text-align: right;
}

.paper td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--color-line);
}

.paper td:first-child {
  display: grid;
  gap: 3px;
}

.paper td span {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.doc-totals {
  width: 360px;
  margin: 28px 0 36px auto;
  font-variant-numeric: tabular-nums;
}

.doc-totals p {
  margin: 0;
  padding: 7px 4px;
  border-bottom: 1px solid var(--color-line);
  font-size: 15px;
}

.doc-totals > .change-total {
  margin-top: 4px;
  padding: 11px 8px;
  border-bottom: 2px solid var(--color-ink);
}

.doc-totals > .change-total span {
  color: var(--color-ink);
  font-weight: 600;
}

.contract-rollup .positive-amount {
  color: var(--color-ink);
}

.doc-totals strong {
  font-size: 22px;
}

.contract-rollup {
  margin-top: 18px;
  padding-top: 8px;
  border-top: 1px solid var(--color-line);
}

.doc-totals p.revised-total {
  border-bottom: 2px solid var(--color-ink);
  color: var(--color-ink);
  font-size: var(--type-body);
}

.doc-notes {
  padding: 20px 0;
  border-top: 1px solid var(--color-line);
  border-right: 0;
  border-bottom: 1px solid var(--color-line);
  border-left: 0;
}

.doc-notes strong {
  font-size: 15px;
}

.doc-notes ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--color-graphite);
  font-size: 15px;
  line-height: 1.75;
}

.quote-scope-notes {
  display: grid;
  gap: 5px;
}

.quote-scope-notes strong:not(:first-child) {
  margin-top: 10px;
}

.quote-scope-notes p {
  margin: 0;
  color: var(--color-graphite);
  font-size: 15px;
  line-height: 1.7;
}

.quote-options {
  margin-top: 24px;
  border-top: 2px solid var(--color-ink);
}

.quote-options h3 {
  margin: 0;
  padding: 16px 4px 10px;
  font-size: 18px;
  font-weight: 600;
}

.quote-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  padding: 14px 4px;
  border-top: 1px solid var(--color-line);
}

.quote-option > div {
  display: grid;
  gap: 4px;
}

.quote-option span {
  width: max-content;
  color: var(--color-ink);
  font-size: var(--type-meta);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.quote-option strong,
.quote-option > b {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.quote-option p,
.quote-option small {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 14px;
  line-height: 1.65;
}

.quote-option > b {
  align-self: center;
}

.quote-paper {
  min-height: 0;
}

.paper footer {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  padding-top: 10px;
  border-top: 1px solid var(--color-line);
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.send-card {
  position: sticky;
  top: 20px;
  padding: 24px;
}

.send-card h3 {
  margin: 0 0 16px;
  font-size: var(--type-section-title);
}

.recipient {
  display: grid;
  gap: 4px;
  margin: 0 0 20px;
  padding: 16px 0;
  border-top: 1px solid var(--color-line);
  border-right: 0;
  border-bottom: 1px solid var(--color-line);
  border-left: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
}

.recipient span,
.recipient small {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.recipient strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.approved-page {
  max-width: 1080px;
}

.success-hero {
  padding: 24px 0 28px;
  text-align: center;
}

.success-check {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--color-ink);
  color: var(--color-surface);
}

.success-check svg {
  width: 28px;
  stroke-width: 2.2;
}

.success-hero .eyebrow {
  color: var(--color-ink);
}

.success-hero h1 {
  margin: 6px 0 10px;
  font-size: var(--type-page-title);
  font-weight: 600;
}

.success-hero p {
  margin: 0;
  color: var(--color-text-on-concrete);
  font-size: var(--type-support);
  font-weight: 500;
}

.approval-id {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 8px 12px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-status);
  background: var(--color-surface);
  color: var(--color-text-on-concrete);
  font-size: var(--type-meta);
}

.approval-id span {
  color: var(--color-ink);
  font-weight: 600;
}

.approval-id svg {
  width: 13px;
  vertical-align: -2px;
}

.outcome-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-standard);
  background: var(--color-surface);
}

.outcome-grid article {
  display: grid;
  gap: 5px;
  padding: 24px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.outcome-grid article + article {
  border-left: 1px solid var(--color-line);
}

.outcome-grid article.highlight {
  border-top: 2px solid var(--color-ink);
  box-shadow: none;
}

.outcome-grid span {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.outcome-grid strong {
  font-size: 26px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.outcome-grid .highlight strong {
  color: var(--color-ink);
}

.outcome-grid small {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.audit {
  margin: 18px 0 20px;
}

.audit-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.audit-flow > div {
  display: grid;
  justify-items: center;
  gap: 5px;
  text-align: center;
}

.audit-flow > div > span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--color-ink);
  border-radius: 50%;
  color: var(--color-ink);
  font-size: 13px;
  font-weight: 600;
}

.audit-flow svg {
  width: 14px;
}

.audit-flow b {
  font-size: var(--type-meta);
  font-weight: 500;
}

.audit-flow small {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.audit-flow > i {
  width: 88px;
  height: 1px;
  margin: 0 8px 30px;
  background: var(--color-ink);
}

.final-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
}

.final-actions svg {
  width: 16px;
}

.processing-card {
  width: min(420px, 100%);
  padding: 32px 36px;
  border-radius: var(--radius-frame);
  background: var(--color-surface);
  box-shadow: var(--shadow-modal);
  text-align: center;
}

.loader {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin: 0 auto 16px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-standard);
  color: var(--color-graphite);
}

.loader svg {
  width: 24px;
}

.processing-card > span {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
  font-weight: 600;
  letter-spacing: .12em;
}

.processing-card h2 {
  margin: 8px 0 4px;
  font-size: var(--type-section-title);
}

.processing-card p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--type-body);
}

.loading-line {
  height: 3px;
  margin-top: 20px;
  overflow: hidden;
  background: var(--color-line);
}

.loading-line i {
  display: block;
  width: 36%;
  height: 100%;
  background: var(--color-ink);
  animation: loading 900ms ease-in-out infinite;
}

/* Full scripted renovation demo */
.story-page {
  max-width: 1160px;
}

.story-page > * + * {
  margin-top: var(--space-6);
}

.story-email:last-child {
  border-bottom: 0;
}

.story-email .thread-message h3 {
  margin: 0 0 var(--space-4);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
}

.email-copy {
  color: var(--color-graphite);
  font-size: var(--type-body);
  line-height: 1.7;
}

.email-copy p {
  margin: 0 0 var(--space-4);
}

.email-copy p:last-child {
  margin-bottom: 0;
}

.email-copy ul,
.email-copy ol {
  margin: 0 0 var(--space-4);
  padding-left: var(--space-6);
}

.email-copy li + li {
  margin-top: var(--space-2);
}

.email-copy .document-table-wrap {
  margin: var(--space-4) 0;
}

.document-link {
  display: inline;
  padding: 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  background: transparent;
  color: var(--color-ink);
  font: inherit;
  font-weight: 600;
  line-height: inherit;
  text-align: left;
}

.document-link:hover {
  color: var(--color-text-secondary);
}

.document-link:focus-visible {
  outline: 2px solid var(--color-ink);
  outline-offset: 3px;
}

.record-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  padding: var(--space-7);
}

.record-card h2,
.decision-panel h2,
.final-account h2,
.site-confirmation-document h2,
.payment-panel h2 {
  margin: 0 0 var(--space-2);
  font-size: var(--type-section-title);
  font-weight: 600;
  line-height: 1.35;
}

.record-card p,
.decision-panel > p,
.final-account > div > p,
.site-confirmation-document > p,
.payment-panel p {
  margin: 0;
  color: var(--color-text-secondary);
}

.story-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

.story-actions.inline {
  margin-top: var(--space-6);
}

.story-actions.split {
  flex-wrap: wrap;
  justify-content: space-between;
  margin-top: var(--space-6);
}

.decision-panel {
  padding: var(--space-7);
}

.decision-panel .panel-head {
  margin: calc(var(--space-7) * -1) calc(var(--space-7) * -1) var(--space-6);
  padding: var(--space-5) var(--space-7);
}

.choice-grid,
.option-list,
.site-checks {
  display: grid;
  gap: var(--space-3);
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-grid legend,
.option-list legend,
.site-checks legend {
  grid-column: 1 / -1;
  margin-bottom: var(--space-1);
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
  font-weight: 600;
}

.choice-card,
.approval-check,
.site-checks label {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-standard);
  background: var(--color-surface);
  cursor: pointer;
}

.choice-card.single {
  margin-top: var(--space-3);
}

.choice-card:has(input:checked),
.approval-check:has(input:checked),
.site-checks label:has(input:checked) {
  border-color: var(--color-ink);
}

.choice-card input,
.approval-check input,
.site-checks input {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin: 3px 0 0;
  accent-color: var(--color-ink);
}

.choice-card > span {
  display: grid;
  min-width: 0;
  gap: var(--space-1);
}

.choice-card strong {
  font-size: var(--type-body);
}

.choice-card small,
.choice-card em {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
  font-style: normal;
}

.option-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-card.option > span {
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
}

.choice-card.option em {
  grid-column: 1 / -1;
}

.approval-check {
  margin-top: var(--space-5);
  line-height: 1.65;
}

.approval-check.static {
  cursor: default;
}

.decision-total {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--space-2) var(--space-6);
  margin-top: var(--space-5);
  padding: var(--space-5) 0;
  border-top: 1px solid var(--color-line);
  border-bottom: 2px solid var(--color-ink);
}

.decision-total > span,
.decision-total > small {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.decision-total > strong {
  grid-row: 1 / 3;
  grid-column: 2;
  font-size: 28px;
  font-variant-numeric: tabular-nums;
}

.site-checks {
  margin-top: var(--space-5);
}

.site-exception {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: var(--space-4);
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-line);
}

.site-exception label {
  display: grid;
  gap: var(--space-2);
  font-size: var(--type-meta);
  font-weight: 600;
}

.site-exception .site-cost-impact {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-graphite);
}

.site-exception .site-cost-impact input {
  width: auto;
  margin: 0;
}

.site-exception input,
.site-exception textarea {
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-standard);
  background: var(--color-surface);
}

.site-exception p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.field-error {
  color: #9d203b;
  font-size: 11px;
  font-weight: 600;
}

.price-review-error {
  grid-column: 1 / -1;
  margin-top: calc(var(--space-2) * -1);
}

.final-account {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(320px, 1.2fr);
  gap: var(--space-8);
  padding: var(--space-7);
}

.final-account dl {
  margin: 0;
}

.final-account dl > div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-6);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-line);
}

.final-account dt {
  color: var(--color-text-secondary);
}

.final-account dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.final-account .story-actions {
  grid-column: 1 / -1;
}

.master-modal {
  width: min(1200px, calc(100% - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: var(--color-surface);
}

.master-document {
  min-height: 0;
  box-shadow: none;
}

.master-document-top {
  margin-bottom: var(--space-10);
}

.master-copy {
  color: var(--color-graphite);
}

.master-copy h2 {
  margin: var(--space-10) 0 var(--space-3);
  padding-top: var(--space-5);
  border-top: 2px solid var(--color-ink);
  color: var(--color-ink);
  font-size: 28px;
  line-height: 1.3;
}

.master-copy h2:first-child {
  margin-top: 0;
}

.master-copy h3 {
  margin: var(--space-8) 0 var(--space-3);
  color: var(--color-ink);
  font-size: 21px;
}

.master-copy h4 {
  margin: var(--space-6) 0 var(--space-2);
  color: var(--color-ink);
  font-size: 18px;
}

.master-copy p {
  margin: 0 0 var(--space-4);
  line-height: 1.75;
}

.master-copy ul,
.master-copy ol {
  margin: 0 0 var(--space-5);
  padding-left: var(--space-6);
}

.master-copy li + li {
  margin-top: var(--space-2);
}

.document-table-wrap {
  width: 100%;
  margin: var(--space-5) 0 var(--space-7);
  overflow-x: auto;
  border: 1px solid var(--color-line);
}

.master-copy .document-table-wrap table,
.email-copy .document-table-wrap table {
  min-width: 720px;
}

.master-copy .document-table-wrap th,
.email-copy .document-table-wrap th {
  white-space: nowrap;
}

.master-copy .document-table-wrap td:first-child,
.email-copy .document-table-wrap td:first-child {
  display: table-cell;
}

.master-copy .document-table-wrap td,
.email-copy .document-table-wrap td {
  vertical-align: top;
  text-align: left;
}

.master-copy .document-table-wrap td:nth-child(n + 2),
.email-copy .document-table-wrap td:nth-child(n + 2) {
  text-align: right;
}

.quote-terms {
  margin-top: var(--space-10);
  border-top: 2px solid var(--color-ink);
  border-bottom: 1px solid var(--color-line);
}

.quote-terms summary {
  padding: var(--space-5) 0;
  font-weight: 600;
  cursor: pointer;
}

.quote-terms[open] {
  padding-bottom: var(--space-6);
}

.document-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-7);
  padding: var(--space-4);
  border: 1px solid var(--color-line);
  border-left: 3px solid var(--color-graphite);
  background: var(--color-surface);
}

.document-banner.current {
  border-left-color: var(--color-ink);
}

.document-banner.rejected {
  border-left-color: var(--color-difference);
}

.document-banner span {
  color: var(--color-text-secondary);
  font-size: var(--type-meta);
}

.site-confirmation-document {
  padding: 0 0 var(--space-4);
}

.completion-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin: var(--space-6) 0;
}

.completion-cards article {
  min-height: 180px;
  padding: var(--space-5);
  border: 1px solid var(--color-line);
  background: var(--color-concrete);
}

.completion-cards span {
  font-size: var(--type-meta);
  font-weight: 600;
}

.completion-cards p {
  margin: var(--space-8) 0 var(--space-3);
}

.completion-cards small {
  color: var(--color-text-secondary);
}

.payment-modal {
  width: min(560px, calc(100% - 32px));
  background: var(--color-surface);
}

.payment-panel {
  padding: var(--space-10);
}

.payment-panel > strong {
  display: inline-block;
  margin-top: var(--space-5);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-status);
}

.load-error {
  padding: var(--space-10);
}

.load-error .panel {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-8);
}

@keyframes loading {
  from { transform: translateX(-110%); }
  to { transform: translateX(310%); }
}

@media (max-width: 1500px) {
  .price-header {
    display: none;
  }

  .price-panel {
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: var(--color-surface);
    box-shadow: none;
  }

  #price-rows {
    display: grid;
    gap: 0;
  }

  .price-row {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px 10px;
    min-height: 0;
    padding: 20px;
    border: 0;
    border-bottom: 1px solid var(--color-line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .price-row:last-child {
    border-bottom: 0;
  }

  .item-cell {
    grid-column: 1 / -1;
  }

  .price-row label > span,
  .sell > span {
    display: block;
    color: var(--color-text-secondary);
    font-size: var(--type-meta);
    font-weight: 600;
  }

  .sell strong,
  .source {
    text-align: left;
  }
}

@media (min-width: 1101px) and (max-width: 1500px) {
  html[lang="en"] .price-row {
    grid-template-columns: .94fr .8fr 1.1fr 1.05fr .95fr 1.16fr;
  }

  html[lang="en"] .price-row label > span,
  html[lang="en"] .sell > span,
  html[lang="en"] .sell .source {
    white-space: nowrap;
  }

  html[lang="en"] .sell .source {
    text-align: left;
  }
}

@media (min-width: 801px) and (max-width: 1100px) {
  html[lang="en"] .price-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html[lang="en"] .item-cell,
  html[lang="en"] .sell {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1320px) {
  .pricing-layout {
    grid-template-columns: 1fr;
  }

  .total-card {
    position: static;
    border-top: 1px solid var(--color-line);
    border-left: 0;
  }

  .document-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
  }
}

@media (max-width: 1040px) {
  :root {
    --sidebar-width: 72px;
  }

  body {
    min-width: 760px;
  }

  .sidebar {
    padding: 22px 10px 18px;
  }

  .brand {
    justify-content: center;
    padding: 0 0 32px;
  }

  .brand > img,
  .sidebar button span {
    display: none;
  }

  .brand .brand-compact {
    display: grid;
  }

  .sidebar button {
    justify-content: center;
    padding: 10px;
  }

  .content {
    padding-right: 24px;
    padding-left: 24px;
  }

  .document-layout {
    grid-template-columns: 1fr;
  }

  .send-card {
    position: static;
  }
}

@media (max-width: 800px) {
  .app-root::before {
    left: 72%;
    box-shadow: none;
  }

  body {
    min-width: 0;
  }

  .topbar {
    padding: 0 16px;
  }

  .topbar > div:first-child > span,
  .topbar strong,
  .status-dot {
    display: none;
  }

  .stepper > i {
    width: 24px;
    margin: 0 5px;
  }

  .step b {
    display: none;
  }

  .content {
    padding: 24px 16px 48px;
  }

  .page-heading,
  .page-heading.compact {
    display: grid;
    align-items: start;
  }

  .page-heading h1 {
    font-size: 34px;
  }

  .page-heading > button {
    width: 100%;
  }

  .panel-head,
  .contract-panel-total {
    align-items: flex-start;
  }

  .panel-head {
    flex-direction: column;
  }

  .contract-panel-total {
    flex-wrap: wrap;
  }

  .scope-table {
    overflow-x: auto;
  }

  .scope-row {
    min-width: 650px;
  }

  .customer-message,
  .thread-entry,
  .change-comparison,
  .contract-signatures,
  .doc-address,
  .outcome-grid {
    grid-template-columns: 1fr;
  }

  .outcome-grid article + article {
    border-top: 1px solid var(--color-line);
    border-left: 0;
  }

  .customer-message {
    align-items: start;
  }

  .thread-entry {
    gap: 18px;
  }

  .thread-heading,
  .quote-attachment {
    align-items: flex-start;
  }

  .thread-heading {
    flex-direction: column;
    gap: var(--space-2);
  }

  .quote-attachment {
    flex-direction: column;
  }

  .quote-attachment > div:last-child {
    width: 100%;
    justify-content: space-between;
  }

  .customer-message blockquote {
    padding: 16px 0 0;
    border-top: 2px solid var(--color-graphite);
    border-left: 0;
  }

  .change-comparison > div + div,
  .change-comparison .ai-difference {
    border-top: 1px solid var(--color-line);
    border-left: 2px solid var(--color-difference);
  }

  .detected-list {
    padding-right: 20px;
    padding-left: 20px;
  }

  .suggestion-card > header {
    flex-wrap: wrap;
  }

  .suggestion-card > header > small {
    width: 100%;
    margin-left: 40px;
  }

  .suggestion-rows dl {
    grid-template-columns: 1fr;
  }

  .page-actions {
    display: grid;
    grid-template-columns: 1fr 2fr;
  }

  .price-header {
    display: none;
  }

  .price-panel {
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: var(--color-surface);
    box-shadow: none;
  }

  #price-rows {
    display: grid;
    gap: 0;
  }

  .price-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px 10px;
    min-width: 0;
    padding: 18px;
    border: 0;
    border-bottom: 1px solid var(--color-line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .price-row:last-child {
    border-bottom: 0;
  }

  .item-cell,
  .sell {
    grid-column: 1 / -1;
  }

  .price-row label > span,
  .sell > span {
    display: block;
    color: var(--color-text-secondary);
    font-size: var(--type-meta);
    font-weight: 600;
  }

  .sell {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .sell strong {
    grid-column: 2;
    grid-row: 1 / 3;
  }

  .source {
    text-align: left;
  }

  .document-layout {
    overflow-x: auto;
  }

  .paper {
    min-width: 680px;
  }

  .contract-modal {
    width: 100%;
    max-height: calc(100vh - 24px);
  }

  .overlay,
  .processing {
    padding: var(--space-3);
  }

  .quote-paper {
    min-width: 0;
    padding: var(--space-8) var(--space-5) var(--space-6);
  }

  .quote-paper .paper-top {
    display: grid;
  }

  .quote-paper .doc-status {
    justify-self: start;
  }

  .quote-paper .doc-address > div:last-child {
    text-align: left;
  }

  .quote-paper table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }

  .quote-paper td:first-child {
    min-width: 220px;
  }

  .quote-paper .doc-totals {
    width: 100%;
  }

  .quote-paper .quote-option {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

  .quote-paper .quote-option > b {
    justify-self: end;
  }

  .quote-paper footer {
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
  }

  .audit-flow {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: var(--space-5) var(--space-3);
  }

  .audit-flow > i {
    display: none;
  }

  .approval-id {
    display: grid;
    width: 100%;
    gap: var(--space-1);
    text-align: left;
  }

  .final-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 800px) {
  .story-page {
    padding-right: var(--space-4);
    padding-left: var(--space-4);
  }

  .story-page .thread-heading,
  .story-page .thread-entry {
    padding-right: var(--space-4);
    padding-left: var(--space-4);
  }

  .story-email .thread-message h3 {
    font-size: var(--type-body);
  }

  .record-card,
  .decision-panel,
  .final-account {
    padding: var(--space-5);
  }

  .record-card {
    display: grid;
  }

  .record-card > button {
    width: 100%;
  }

  .decision-panel .panel-head {
    margin: calc(var(--space-5) * -1) calc(var(--space-5) * -1) var(--space-5);
    padding: var(--space-4) var(--space-5);
  }

  .choice-grid,
  .option-list,
  .final-account,
  .site-exception,
  .completion-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .choice-card.option > span {
    grid-template-columns: minmax(0, 1fr);
  }

  .choice-card.option em {
    grid-column: auto;
  }

  .decision-total {
    grid-template-columns: minmax(0, 1fr);
  }

  .decision-total > strong {
    grid-row: auto;
    grid-column: auto;
  }

  .story-actions,
  .story-actions.split,
  .final-account .story-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .story-actions > button {
    width: 100%;
  }

  .site-exception p,
  .final-account .story-actions {
    grid-column: auto;
  }

  .master-modal {
    width: 100%;
    max-height: calc(100vh - 24px);
  }

  .master-document {
    min-width: 0;
    padding: var(--space-8) var(--space-5) var(--space-6);
  }

  .master-document-top,
  .document-banner {
    display: grid;
  }

  .master-copy h2 {
    font-size: var(--type-section-title);
  }

  .document-table-wrap {
    max-width: 100%;
  }

  .payment-panel {
    padding: var(--space-8) var(--space-5);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  .app-root {
    background: var(--color-surface);
  }

  .app-root::before {
    display: none;
  }

  .sidebar,
  .topbar,
  .stepper,
  .page-heading,
  .send-card {
    display: none !important;
  }

  body,
  main {
    min-width: 0;
    margin: 0;
    background: var(--color-surface);
  }

  .content {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .document-layout {
    display: block;
  }

  .paper {
    min-height: 0;
    margin: 0;
    box-shadow: none;
  }
}

/* Jobs list and wide handoff drawer */
.jobs-main {
  min-height: 100vh;
}

.jobs-topbar {
  justify-content: space-between;
}

.jobs-topbar > div:first-child {
  gap: var(--space-3);
}

.jobs-content {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding-top: var(--space-5);
  padding-bottom: var(--space-6);
}

.jobs-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-3);
}

.jobs-heading h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.2;
}

.jobs-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-secondary);
  font-size: 12px;
}

.jobs-search input {
  width: min(320px, 34vw);
  height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-standard);
  background: var(--color-surface);
  color: var(--color-ink);
  font-size: 13px;
}

.jobs-search input:focus-visible {
  outline: 2px solid var(--color-ink);
  outline-offset: 2px;
}

.jobs-panel {
  padding: 0;
  overflow: hidden;
}

.jobs-filters {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  min-height: 42px;
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--color-line);
}

.jobs-filters button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 12px;
}

.jobs-filters button[aria-pressed="true"] {
  border-bottom-color: var(--color-ink);
  color: var(--color-ink);
  font-weight: 600;
}

.jobs-filters span {
  min-width: 22px;
  padding: 1px var(--space-1);
  border-radius: var(--radius-status);
  background: #f0f0ed;
  color: var(--color-text-secondary);
  font-size: 12px;
  text-align: center;
}

.jobs-table {
  width: 100%;
}

.jobs-row {
  display: grid;
  grid-template-columns: minmax(230px, 1.3fr) minmax(96px, .55fr) minmax(225px, 1.2fr) minmax(88px, .5fr) 68px;
  align-items: center;
  gap: var(--space-3);
  min-height: 38px;
  padding: 3px var(--space-4);
  border-bottom: 1px solid var(--color-line);
  color: var(--color-graphite);
  font-size: 12px;
  line-height: 1.2;
}

.jobs-row[data-selected="true"] {
  background: #f4f4f1;
}

.aki-job {
  background: #fafaf8;
  box-shadow: inset 3px 0 var(--color-ink);
}

.sample-job {
  color: #747a7e;
}

.sample-job strong {
  color: #686e72;
  font-weight: 500;
}

.sample-job .attention-dot {
  opacity: .42;
}

.sample-badge {
  flex: 0 0 auto;
  padding: 2px 5px;
  border: 1px solid #d6d6d1;
  border-radius: var(--radius-status);
  background: #f5f5f2;
  color: #7a7f82;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.aki-job .job-next {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.aki-next-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.start-demo {
  display: inline-flex;
  min-height: 30px;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  border: 1px solid var(--color-ink);
  border-radius: var(--radius-standard);
  background: var(--color-ink);
  color: white;
  font-size: 11px;
  font-weight: 600;
}

.start-demo svg {
  width: 13px;
  height: 13px;
}

.start-demo:hover {
  background: #303436;
}

.jobs-columns {
  min-height: 32px;
  padding-top: 5px;
  padding-bottom: 5px;
  background: #f7f7f5;
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.job-name,
.job-next {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-2);
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.job-name > span:last-child,
.job-next {
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.job-name small,
.job-next small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--color-text-secondary);
  font-size: 10px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-name:focus-visible,
.job-next:focus-visible,
.aki-job:focus-visible,
.text-link:focus-visible,
.drawer-close:focus-visible,
.conversation-tabs button:focus-visible,
.send-mode button:focus-visible {
  outline: 2px solid var(--color-ink);
  outline-offset: 3px;
}

.attention-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--color-ink);
}

.attention-dot[data-job-bucket="waiting"] {
  background: #8c929a;
}

.attention-dot[data-job-bucket="closed"] {
  border: 1px solid #8c929a;
  background: transparent;
}

.job-stage,
.jobs-row time {
  color: var(--color-text-secondary);
  font-size: 11px;
}

.jobs-empty {
  padding: var(--space-8) var(--space-4);
  color: var(--color-text-secondary);
  font-size: 13px;
  text-align: center;
}

.jobs-pagination {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0 var(--space-4);
  color: var(--color-text-secondary);
  font-size: 12px;
}

.jobs-pagination > div {
  display: flex;
  gap: var(--space-2);
}

.jobs-pagination button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-standard);
  background: var(--color-surface);
  color: var(--color-ink);
  font-size: 11px;
}

.jobs-pagination button:disabled {
  background: #f2f2ef;
  color: var(--color-text-secondary);
}

.drawer-backdrop {
  position: fixed;
  z-index: 25;
  inset: 0;
  padding: 0;
  border: 0;
  background: rgb(17 19 20 / 22%);
  cursor: default;
}

/* The base page's architectural joints belong to the jobs view. Once the
   detail drawer is open, its wall texture supplies the continuous surface. */
body.drawer-is-open .app-root::before {
  display: none;
}

.job-drawer {
  position: fixed;
  z-index: 30;
  inset: 0 0 0 var(--sidebar-width);
  overflow-y: auto;
  border-left: 0;
  background-color: #858783;
  background-image:
    linear-gradient(135deg, rgb(255 255 255 / 46%) 0%, rgb(17 19 20 / 64%) 100%),
    var(--asset-concrete-image),
    var(--asset-concrete-image);
  background-position: center top;
  background-size: 100vw 100vh, 100vw 100vh, 100vw 100vh;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-blend-mode: normal, normal, soft-light;
  color: var(--color-ink);
  overscroll-behavior: contain;
}

.drawer-header {
  position: relative;
  z-index: 4;
  top: 0;
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-6);
  border-bottom: 1px solid rgb(17 19 20 / 42%);
  background: transparent;
}

.drawer-header > div:first-child {
  min-width: 0;
  margin-right: auto;
}

.drawer-header h2 {
  margin: 2px 0 0;
  font-size: 19px;
  line-height: 1.3;
}

.drawer-header .eyebrow {
  color: #4d5357;
  font-size: 11px;
  letter-spacing: .09em;
}

.drawer-close {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-standard);
  background: var(--color-surface);
  color: var(--color-ink);
  font-size: 12px;
}

.drawer-close span {
  color: var(--color-text-secondary);
  font-size: 17px;
  line-height: 1;
}

.send-mode {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-standard);
  background: #f2f2ef;
}

.send-mode button {
  min-height: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
}

.send-mode button[aria-pressed="true"] {
  background: var(--color-surface);
  color: var(--color-ink);
}

.mode-note {
  margin: 0;
  padding: 9px var(--space-6);
  border-bottom: 1px solid var(--color-graphite);
  background: var(--color-graphite);
  color: var(--color-surface);
  font-size: 12px;
}

.drawer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(220px, 26%, 270px);
  gap: var(--space-5);
  align-items: stretch;
  padding: var(--space-5) var(--space-6) var(--space-10);
  background: transparent;
}

.drawer-conversation {
  min-width: 0;
  background: transparent;
}

/* Keep the reading column calm on very wide displays while preserving the
   broad operational drawer and its fixed information rail. */
@media (min-width: 1500px) {
  .drawer-conversation,
  .conversation-tabs,
  .demo-notice,
  .email-thread,
  .reply-composer,
  .worker-check,
  .task-action {
    max-width: 1040px;
  }
}

.conversation-tabs {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid rgb(17 19 20 / 42%);
}

.conversation-tabs [role="tablist"] {
  display: flex;
  align-self: stretch;
  gap: var(--space-5);
}

.conversation-tabs button {
  padding: 0 0 var(--space-2);
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #454b4f;
  font-size: 12px;
}

.conversation-tabs button[aria-selected="true"] {
  border-bottom-color: var(--color-ink);
  color: var(--color-ink);
  font-weight: 600;
}

.conversation-tabs > span {
  color: rgb(255 255 255 / 88%);
  font-size: 11px;
}

.estimate-workspace {
  margin-bottom: var(--space-5);
  overflow: hidden;
  border: 1px solid #17191a;
  border-radius: 10px;
  background: #f4f4f1;
  box-shadow: 0 14px 34px rgb(17 19 20 / 20%);
}

.estimate-workspace-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-6);
  align-items: center;
  padding: var(--space-5);
  background: #17191a;
  color: #fff;
}

.estimate-workspace-header h2 {
  margin: 4px 0 5px;
  color: #fff;
  font-size: clamp(22px, 2.2vw, 31px);
  line-height: 1.12;
  letter-spacing: -.035em;
}

.estimate-workspace-header p {
  max-width: 720px;
  margin: 0;
  color: #cfd2d2;
  font-size: 12px;
  line-height: 1.55;
}

.estimate-kicker {
  color: #f0bd42;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .13em;
}

.estimate-total {
  display: grid;
  min-width: 190px;
  justify-items: end;
  gap: 2px;
  padding-left: var(--space-5);
  border-left: 1px solid rgb(255 255 255 / 25%);
}

.estimate-total > span {
  color: #aeb3b4;
  font-size: 10px;
}

.estimate-total > strong {
  color: #fff;
  font-size: 28px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
}

.estimate-total .text-link {
  margin-top: 4px;
  color: #fff;
  font-size: 10px;
}

.estimate-total svg,
.source-detail svg {
  width: 12px;
  height: 12px;
  vertical-align: -2px;
}

.estimate-coverage {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid #c7c9c6;
  background: #fff;
}

.estimate-coverage article {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 12px 14px;
  border-right: 1px solid #dedfdb;
}

.estimate-coverage article:last-child {
  border-right: 0;
}

.estimate-coverage article > span:first-child {
  color: #666d70;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.estimate-coverage strong {
  color: #17191a;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.estimate-coverage small {
  color: #747a7e;
  font-size: 9px;
}

.estimate-coverage .coverage-alert {
  background: #fff7e2;
}

.coverage-meter {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
  width: 100%;
  max-width: 120px;
  margin: 2px 0;
}

.coverage-meter i {
  height: 3px;
  border-radius: 2px;
  background: #e0e2df;
}

.coverage-meter i.filled {
  background: #285f93;
}

.estimate-flow {
  display: grid;
  grid-template-columns: minmax(185px, .78fr) minmax(245px, 1fr) minmax(250px, 1.05fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
}

.estimate-flow > section {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #d2d4d0;
  border-radius: 8px;
  background: #fff;
}

.flow-column-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 14px;
  border-bottom: 1px solid #dedfdb;
}

.flow-column-heading > span {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border: 1px solid #17191a;
  border-radius: 50%;
  color: #17191a;
  font-size: 10px;
  font-weight: 700;
}

.flow-column-heading small {
  display: block;
  color: #285f93;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .11em;
}

.flow-column-heading h3 {
  margin: 1px 0 0;
  color: #17191a;
  font-size: 13px;
  line-height: 1.3;
}

.site-photo-card {
  margin: 12px;
  overflow: hidden;
  border: 1px solid #d7d8d4;
  border-radius: 7px;
  background: #fff;
}

.site-photo-card > div {
  position: relative;
  height: 162px;
  overflow: hidden;
  background: #d9d9d4;
}

.site-photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.site-photo-card > div > span {
  position: absolute;
  right: 7px;
  bottom: 7px;
  padding: 4px 6px;
  border-radius: 3px;
  background: rgb(17 19 20 / 86%);
  color: #fff;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: .08em;
}

.site-photo-card figcaption {
  display: grid;
  gap: 2px;
  padding: 9px 10px;
}

.site-photo-card figcaption strong {
  font-size: 11px;
}

.site-photo-card figcaption small {
  color: #6b7174;
  font-size: 9px;
  line-height: 1.4;
}

.floor-plan-card {
  margin: 0 12px 12px;
  overflow: hidden;
  border: 1px solid #d7d8d4;
  border-radius: 7px;
  background: #f7f8f6;
}

.floor-plan-visual {
  padding: 6px;
  background: #edf1f3;
}

.floor-plan-visual svg {
  display: block;
  width: 100%;
  height: auto;
}

.floor-plan-visual .plan-room,
.floor-plan-visual .plan-hall,
.floor-plan-visual .plan-door {
  fill: #fff;
  stroke: #273139;
  stroke-width: 3;
}

.floor-plan-visual .plan-hall,
.floor-plan-visual .plan-door,
.floor-plan-visual .plan-measure {
  fill: none;
}

.floor-plan-visual .plan-measure {
  stroke: #d59a00;
  stroke-dasharray: 4 4;
  stroke-width: 1.5;
}

.floor-plan-visual circle {
  fill: #285f93;
  stroke: #fff;
  stroke-width: 2;
}

.floor-plan-visual text {
  fill: #535a5e;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 650;
}

.floor-plan-card > div:last-child {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  font-size: 10px;
}

.floor-plan-card > div:last-child span {
  color: #6b7174;
}

.evidence-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 12px 12px;
}

.evidence-tags span {
  padding: 4px 6px;
  border: 1px solid #e0ad37;
  border-radius: 4px;
  background: #fff7df;
  color: #4c4330;
  font-size: 8px;
  font-weight: 600;
}

.reason-card {
  margin: 10px 12px 0;
  padding: 10px;
  border: 1px solid #d9dbd7;
  border-radius: 6px;
  background: #f8f9f7;
}

.reason-card > span,
.source-map > span {
  display: block;
  margin-bottom: 4px;
  color: #285f93;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.reason-card p {
  margin: 0;
  color: #353b3e;
  font-size: 10px;
  line-height: 1.5;
}

.primary-reason {
  border-left: 3px solid #285f93;
  background: #f3f7fb;
}

.reason-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 12px 0;
}

.reason-grid .reason-card {
  margin: 0;
}

.reason-card.uncertainty {
  border-left: 3px solid #d59a00;
  background: #fff9e8;
}

.reason-card.uncertainty > span {
  color: #8c6500;
}

.source-map {
  padding: 12px;
}

.source-map > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.source-map > div > button {
  display: grid;
  min-width: 0;
  gap: 2px;
  padding: 7px;
  border: 1px solid #d6d9d6;
  border-radius: 5px;
  background: #fff;
  color: #343a3d;
  text-align: left;
}

.source-map > div > button:hover,
.source-map > div > button[aria-pressed="true"] {
  border-color: #285f93;
  background: #edf5fb;
}

.source-map button span {
  color: #6c7376;
  font-size: 7px;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.source-map button strong {
  overflow: hidden;
  font-size: 9px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-detail {
  display: grid;
  gap: 3px;
  margin-top: 7px;
  padding: 9px;
  border-left: 3px solid #285f93;
  background: #edf5fb;
}

.source-detail > span {
  color: #285f93;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.source-detail strong {
  font-size: 10px;
}

.source-detail p {
  margin: 0;
  color: #545b5e;
  font-size: 9px;
  line-height: 1.45;
}

.source-detail .text-link {
  justify-self: start;
  font-size: 9px;
}

.estimate-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 7px;
  align-items: end;
  margin: 0 12px 12px;
  padding: 10px;
  border: 1px solid #17191a;
  border-radius: 6px;
}

.estimate-editor legend {
  padding: 0 5px;
  font-size: 9px;
  font-weight: 700;
}

.estimate-editor label,
.estimate-fixed,
.estimate-calculated {
  display: grid;
  gap: 3px;
}

.estimate-editor label span,
.estimate-fixed small,
.estimate-calculated small {
  color: #686f72;
  font-size: 8px;
}

.estimate-editor input {
  width: 100%;
  min-width: 0;
  height: 31px;
  padding: 0 6px;
  border: 1px solid #bbbeba;
  border-radius: 4px;
  background: #fff;
  color: #17191a;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.formula-mark {
  padding-bottom: 7px;
  color: #767c7f;
}

.estimate-fixed,
.estimate-calculated {
  grid-column: 1 / -1;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding-top: 6px;
  border-top: 1px solid #dedfdb;
}

.estimate-fixed strong,
.estimate-calculated strong {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.estimate-lines {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.estimate-line {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  min-width: 0;
  padding: 9px;
  border: 1px solid #d7d9d5;
  border-radius: 6px;
  background: #fff;
  color: #17191a;
  text-align: left;
}

.estimate-line:hover {
  border-color: #7f878a;
  background: #fafaf8;
}

.estimate-line.active {
  border-color: #285f93;
  background: #edf5fb;
  box-shadow: inset 3px 0 #285f93;
}

.estimate-line-code {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: #17191a;
  color: #fff;
  font-size: 8px;
  font-weight: 700;
}

.estimate-line-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.estimate-line-copy strong {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.estimate-line-copy small {
  color: #6e7477;
  font-size: 8px;
  font-variant-numeric: tabular-nums;
}

.estimate-line-amount {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.quote-total-card {
  display: grid;
  gap: 3px;
  margin: 0 10px 10px;
  padding: 12px;
  border-radius: 6px;
  background: #17191a;
  color: #fff;
}

.quote-total-card > span {
  color: #c5c9c9;
  font-size: 8px;
}

.quote-total-card strong {
  font-size: 25px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
}

.quote-total-card small {
  color: #b4b9b9;
  font-size: 8px;
  line-height: 1.4;
}

.sample-suggestion {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  margin: 0 10px 10px;
  padding: 11px;
  border: 1px solid #d9a227;
  border-radius: 6px;
  background: #fff8e7;
}

.sample-suggestion > div {
  display: grid;
  gap: 2px;
}

.sample-suggestion span,
.sample-suggestion small {
  color: #8a650c;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: .05em;
}

.sample-suggestion strong {
  font-size: 10px;
}

.sample-suggestion b {
  color: #8a650c;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.sample-suggestion p,
.sample-suggestion small {
  grid-column: 1 / -1;
  margin: 0;
  line-height: 1.45;
}

.sample-suggestion p {
  color: #514a3b;
  font-size: 9px;
}

@media (max-width: 1300px) {
  .estimate-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .estimate-quote-column {
    grid-column: 1 / -1;
  }

  .estimate-lines {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  .estimate-workspace-header {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .estimate-total {
    min-width: 0;
    justify-items: start;
    padding: 14px 0 0;
    border-top: 1px solid rgb(255 255 255 / 25%);
    border-left: 0;
  }

  .estimate-coverage {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .estimate-coverage article:nth-child(2) {
    border-right: 0;
  }

  .estimate-coverage article:nth-child(-n + 2) {
    border-bottom: 1px solid #dedfdb;
  }

  .estimate-flow {
    grid-template-columns: minmax(0, 1fr);
  }

  .estimate-quote-column {
    grid-column: auto;
  }

  .estimate-lines {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  .estimate-workspace-header {
    padding: 18px;
  }

  .estimate-workspace-header h2 {
    font-size: 24px;
  }

  .estimate-coverage {
    grid-template-columns: minmax(0, 1fr);
  }

  .estimate-coverage article,
  .estimate-coverage article:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid #dedfdb;
  }

  .estimate-coverage article:last-child {
    border-bottom: 0;
  }

  .estimate-flow {
    padding: 8px;
  }

  .reason-grid,
  .source-map > div {
    grid-template-columns: minmax(0, 1fr);
  }

  .estimate-editor {
    grid-template-columns: minmax(0, 1fr);
  }

  .formula-mark {
    display: none;
  }
}

.demo-notice {
  display: none;
  margin-bottom: var(--space-4);
  padding: 9px var(--space-3);
  border: 1px solid var(--color-line);
  background: #f7f7f5;
  color: var(--color-text-secondary);
  font-size: 12px;
}

.earlier-chain {
  margin-bottom: var(--space-4);
  border-bottom: 1px solid rgb(17 19 20 / 42%);
}

.earlier-chain > summary {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0 0 var(--space-3);
  color: rgb(255 255 255 / 88%);
  font-size: 12px;
  cursor: pointer;
}

.earlier-chain .disclosure-label {
  color: #454b4f;
}

.disclosure-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.disclosure-chevron {
  display: inline-flex;
  width: 14px;
  height: 14px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-line);
  border-radius: 50%;
  color: var(--color-ink);
  font-size: 14px;
  line-height: 1;
  transition: transform .16s ease;
}

.earlier-chain[open] .disclosure-chevron {
  transform: rotate(90deg);
}

.disclosure-label > span:last-child,
.earlier-chain > summary small {
  font-size: 11px;
}

.earlier-chain > summary small {
  color: rgb(255 255 255 / 88%);
}

.earlier-list {
  display: grid;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
}

.email-group {
  width: calc(100% - 28px);
  min-width: 0;
}

.email-incoming {
  margin-right: 28px;
}

.email-outgoing {
  margin-left: 28px;
}

.email-group + .email-group {
  margin-top: var(--space-3);
}

.recent-conversation + .email-group {
  margin-top: var(--space-3);
}

.email-box {
  overflow: hidden;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-standard);
  background: var(--color-surface);
}

.email-incoming .email-box {
  border-color: #ca8694;
}

.email-outgoing .email-box {
  border-color: #8c929a;
}

.email-box > header,
.email-summary-header {
  display: block;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-line);
  background: #f7f7f5;
}

.email-incoming .email-box > header,
.email-incoming .email-summary-header {
  border-bottom-color: #ca8694;
  background: #f6ebed;
}

.email-outgoing .email-box > header,
.email-outgoing .email-summary-header {
  border-bottom-color: #8c929a;
  background: #ffffff;
  background-image: none;
}

.email-box > summary {
  display: block;
  padding: 0;
  border-bottom: 0;
  background: var(--color-surface);
  cursor: pointer;
}

.email-box[open] > summary {
  border-bottom: 0;
}

.compact-email > summary {
  padding: 0;
}

.compact-email .email-summary-header {
  padding: 9px var(--space-3);
}

.email-summary-preview {
  position: relative;
  padding: 8px 88px 9px var(--space-3);
  background: var(--color-surface);
}

.compact-email .email-fields {
  margin-bottom: var(--space-1);
}

.email-preview {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--color-graphite);
  font-size: 12px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.compact-email[open] .email-summary-preview {
  display: none;
}

.email-body {
  background: var(--color-surface);
}

.full-email-link {
  position: absolute;
  right: var(--space-3);
  bottom: var(--space-3);
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 500;
}

.email-fields {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-2);
  font-size: 12px;
}

.email-fields > div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 6px;
  min-width: 0;
}

.email-fields span,
.email-fields small,
.email-fields time span,
.email-box h3 > span {
  color: var(--color-text-secondary);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .02em;
}

.email-fields small {
  grid-column: 2;
}

.email-fields time {
  display: grid;
  flex: 0 0 auto;
  justify-items: end;
  color: var(--color-text-secondary);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.email-box h3 {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}

.email-body {
  padding: var(--space-4);
}

.email-copy {
  color: var(--color-graphite);
  font-size: 13px;
  line-height: 1.65;
}

.email-copy p,
.email-copy ul,
.email-copy ol {
  margin-bottom: var(--space-3);
}

.email-copy .document-table-wrap {
  margin: var(--space-3) 0;
}

.email-copy .document-table-wrap table {
  min-width: 580px;
  font-size: 11px;
}

.plain-email {
  white-space: pre-wrap;
}

.message-change {
  margin: var(--space-2) 0 var(--space-4) var(--space-4);
  padding: var(--space-4);
  border: 1px solid #b5b7b5;
  border-radius: var(--radius-standard);
  background: #ffffff;
  color: #303538;
  font-size: 12px;
}

.ai-change {
  border-color: #ca8694;
  box-shadow: inset 4px 0 #17191a;
}

.collapsed-email:not([open]) + .message-change {
  display: none;
}

.change-heading {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--color-ink);
}

.change-heading span {
  color: #596064;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
}

.change-columns,
.change-rows > div {
  display: grid;
  grid-template-columns: minmax(190px, 1.5fr) minmax(78px, .55fr) minmax(78px, .55fr) minmax(90px, .65fr);
  gap: var(--space-3);
  align-items: start;
}

.change-columns {
  padding: 2px 0 var(--space-1);
  color: #676d70;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.change-rows > div {
  padding: var(--space-2) 0;
  border-top: 1px solid rgb(17 19 20 / 28%);
}

.change-rows small {
  display: block;
  color: #596064;
}

.change-rows b,
.change-rows time {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.change-rows time {
  color: #596064;
}

.message-change p {
  margin: var(--space-2) 0;
  color: #596064;
}

.message-change .change-warning {
  padding: var(--space-2) var(--space-3);
  border-left: 3px solid #9c6b35;
  background: #fbf4e9;
  color: #342d25;
}

.message-change .change-decision {
  color: var(--color-graphite);
}

.change-links,
.draft-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
}

.text-link {
  padding: 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  background: transparent;
  color: var(--color-ink);
  font: inherit;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
}

.reply-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-5);
  margin-left: 28px;
}

.reply-bar .secondary {
  border-color: #737875;
}

.reply-bar span {
  color: var(--color-text-secondary);
  font-size: 12px;
}

.reply-composer {
  width: calc(100% - 28px);
  margin-top: var(--space-5);
  margin-left: 28px;
  overflow: hidden;
  border: 1px solid #8c929a;
  border-radius: var(--radius-standard);
  background: var(--color-surface);
}

.composer-heading,
.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: #ffffff;
  background-image: none;
}

.composer-heading {
  border-bottom: 1px solid #8c929a;
}

.composer-heading > div {
  display: grid;
  gap: 1px;
}

.composer-heading > .composer-heading-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.composer-heading-actions .primary {
  min-height: 34px;
  padding: 0 var(--space-3);
}

.composer-heading .draft-badge {
  display: inline-block;
  margin-right: 5px;
  padding: 2px 5px;
  border-radius: var(--radius-status);
  background: var(--color-ink);
  color: var(--color-surface);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .06em;
  line-height: 1.2;
  vertical-align: 1px;
}

.composer-heading span,
.composer-actions small {
  color: var(--color-text-secondary);
  font-size: 11px;
}

.subject-field,
.body-field {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-line);
}

.subject-field > span,
.body-field > span {
  padding-top: 5px;
  color: var(--color-text-secondary);
  font-size: 11px;
}

.subject-field input,
.body-field textarea {
  width: 100%;
  padding: 4px 0;
  border: 0;
  outline: 0;
  background: var(--color-surface);
  color: var(--color-ink);
  font-size: 13px;
  line-height: 1.65;
}

.body-field textarea {
  min-height: calc(6 * 1.65em + 8px);
  max-height: 260px;
  overflow: auto;
  resize: none;
}

.body-field.draft-expanded textarea {
  min-height: 360px;
  max-height: 58vh;
}

.draft-size-toggle {
  grid-column: 2;
  justify-self: start;
  margin-top: var(--space-1);
  font-size: 11px;
}

.subject-field input:focus,
.body-field textarea:focus {
  box-shadow: inset 0 -1px var(--color-ink);
}

.draft-attachments {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-line);
}

.draft-attachments > span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 7px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-status);
  background: #f7f7f5;
  font-size: 11px;
}

.remove-attachment {
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--color-text-secondary);
}

.composer-actions {
  border-top: 0;
}

.composer-actions .primary {
  flex: 0 0 auto;
}

.task-action {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-line);
}

.job-information {
  position: relative;
  min-width: 0;
  display: grid;
  gap: var(--space-3);
  align-content: start;
  align-self: stretch;
  min-height: calc(100vh - 72px);
  margin-top: calc(-1 * var(--space-5));
  margin-bottom: calc(-1 * var(--space-10));
  padding: var(--space-5) var(--space-4) var(--space-8);
  border-left: 0;
  background: transparent;
  font-size: 12px;
}

.job-information::before {
  display: none;
  position: absolute;
  z-index: 0;
  inset: 0;
  background-image:
    linear-gradient(90deg, rgb(255 255 255 / 12%), rgb(17 19 20 / 30%)),
    var(--asset-concrete-image),
    linear-gradient(0deg, transparent 0 42%, rgb(17 19 20 / 15%) 42% 42.25%, transparent 42.25% 100%);
  background-position: center top;
  background-size: 100vw 100vh, 100vw 100vh, 100vw 100vh;
  background-repeat: no-repeat;
  content: "";
  opacity: .8;
  background-blend-mode: normal, soft-light, normal;
  background-attachment: fixed, fixed, fixed;
  pointer-events: none;
}

.job-information > * {
  position: relative;
  z-index: 1;
}

.drawer-side-section {
  padding: var(--space-4);
  border: 1px solid #737875;
  border-radius: var(--radius-frame);
  background: var(--color-surface);
}

.job-information > .job-details {
  background: #ffffff;
  border-color: #969a96;
}

.job-information > .current-agreement,
.job-information > .quote-history,
.job-information > .more-details {
  background: #ffffff;
}

.drawer-side-section + .drawer-side-section {
  padding-top: var(--space-4);
}

.drawer-side-section h3 {
  margin: 0 0 var(--space-3);
  color: var(--color-graphite);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.job-information dl {
  margin: 0;
}

.job-information dl > div {
  display: grid;
  grid-template-columns: minmax(72px, .7fr) minmax(0, 1.3fr);
  gap: var(--space-3);
  align-items: start;
  padding: var(--space-3) 0;
  border-top: 1px solid #e7e7e3;
}

.job-information dt {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 10px;
  letter-spacing: .03em;
}

.job-information dd {
  margin: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.job-information dd small {
  display: block;
  margin-top: 2px;
  color: var(--color-text-secondary);
  font-size: 10px;
  text-align: right;
}

.drawer-side-section > .text-link,
.drawer-side-section details > .text-link {
  margin: var(--space-2) 0 0;
  font-size: 11px;
}

.current-agreement .current-quote {
  display: inline-block;
  margin: 0 0 var(--space-2);
  color: var(--color-ink);
  font-size: 14px;
}

.empty-agreement {
  margin: 0;
  color: var(--color-text-secondary);
}

.drawer-side-section summary {
  padding: 2px 0;
  font-weight: 600;
  cursor: pointer;
}

.current-agreement > details > summary {
  color: var(--color-graphite);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.scope-summary {
  margin-top: var(--space-2);
}

.scope-summary h4 {
  margin: var(--space-3) 0 var(--space-1);
  color: var(--color-text-secondary);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

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

.scope-list li {
  padding: 6px 0;
  border-top: 1px solid var(--color-line);
}

.scope-list strong,
.scope-list span {
  display: block;
}

.scope-list span,
.excluded-scope {
  color: var(--color-text-secondary);
  font-size: 10px;
}

.excluded-scope li {
  position: relative;
  padding-left: 12px;
}

.excluded-scope li::before {
  position: absolute;
  top: 6px;
  left: 0;
  content: "—";
}

.scope-summary details {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-line);
}

.scope-summary details ul {
  margin: var(--space-2) 0 0;
  padding-left: var(--space-4);
  color: var(--color-text-secondary);
  font-size: 10px;
}

.scope-summary details li + li {
  margin-top: 4px;
}

.quote-history > details > summary,
.more-details > details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  list-style: none;
}

.quote-history > details > summary::-webkit-details-marker,
.more-details > details > summary::-webkit-details-marker {
  display: none;
}

.side-summary-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.side-disclosure-arrow {
  display: inline-block;
  color: var(--color-graphite);
  font-size: 20px;
  font-weight: 500;
  line-height: .8;
  transform: rotate(0deg);
  transform-origin: center;
  transition: transform 120ms ease;
}

details[open] > summary .side-disclosure-arrow {
  transform: rotate(90deg);
}

.quote-history .side-summary-count {
  color: var(--color-text-secondary);
}

.quote-history ul {
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
}

.quote-history li {
  display: grid;
  gap: 2px;
  padding: var(--space-2) 0;
  border-top: 1px solid var(--color-line);
}

.quote-history li:first-child {
  border-top-color: #e7e7e3;
}

.quote-history li strong {
  font-variant-numeric: tabular-nums;
}

.quote-history li small {
  color: var(--color-text-secondary);
  font-size: 10px;
}

.more-details dl {
  margin-top: var(--space-2);
}

.worker-check,
.site-confirmation-document {
  margin-top: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-standard);
  background: var(--color-surface);
}

.worker-check h2,
.site-confirmation-document h2 {
  margin: var(--space-1) 0 var(--space-2);
  font-size: 20px;
}

.worker-check > p,
.site-confirmation-document > p {
  margin: 0 0 var(--space-3);
  color: var(--color-graphite);
  font-size: 13px;
}

.worker-price {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: var(--space-3);
  border: 1px solid var(--color-line);
}

.worker-price > div {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3);
}

.worker-price > div + div {
  border-left: 1px solid var(--color-line);
}

.worker-price span {
  color: var(--color-text-secondary);
  font-size: 10px;
}

.prepared-checks {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.prepared-checks span {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: 12px;
}

.prepared-checks svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.worker-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.site-exception {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-line);
}

.site-exception label {
  display: grid;
  gap: var(--space-2);
  color: var(--color-text-secondary);
  font-size: 11px;
}

.site-exception input,
.site-exception textarea {
  width: 100%;
  padding: var(--space-2);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-standard);
  background: var(--color-surface);
}

.site-exception p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 11px;
}

.site-problem-submit {
  grid-column: 1 / -1;
  justify-self: start;
}

.revised-proposal {
  grid-column: 1 / -1;
  padding: var(--space-4);
  border: 1px solid #ca8694;
  border-radius: var(--radius-standard);
  background: #fff8f9;
}

.revised-proposal h3 {
  margin: var(--space-1) 0 var(--space-2);
}

.revised-proposal p {
  margin: var(--space-1) 0;
  color: var(--color-graphite);
}

.revision-workflow {
  display: block;
}

.revision-facts {
  margin: var(--space-3) 0;
  border-top: 2px solid var(--color-ink);
}

.revision-facts > div {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: var(--space-3);
  padding: 9px 0;
  border-bottom: 1px solid var(--color-line);
}

.revision-facts dt {
  color: var(--color-text-secondary);
  font-size: 11px;
}

.revision-facts dd {
  margin: 0;
  color: var(--color-graphite);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.revision-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.revision-email-draft {
  grid-column: 1 / -1;
  margin-top: var(--space-4);
  border-color: #8c929a;
}

.revision-document .revision-facts {
  margin-bottom: var(--space-4);
}

.drawer-final {
  margin-top: var(--space-5);
  padding: var(--space-5);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-standard);
  background: var(--color-surface);
}

.drawer-final h2 {
  font-size: 21px;
}

.drawer-document {
  max-width: 1040px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-6) var(--space-12);
  outline: 0;
}

.document-navigation {
  position: relative;
  z-index: 3;
  top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  padding: var(--space-2) 0;
  background: transparent;
}

.document-navigation .text-link {
  padding: 6px 10px;
  border: 1px solid #737875;
  border-radius: var(--radius-standard);
  background: transparent;
  color: #232628;
}

.document-navigation > span {
  padding: 6px 10px;
  border: 1px solid #5f6562;
  border-radius: var(--radius-status);
  background: rgb(255 255 255 / 42%);
  color: #232628;
  font-size: 11px;
}

.drawer-document .master-document {
  border: 1px solid var(--color-line);
  box-shadow: none;
}

.document-summary {
  margin-bottom: var(--space-5);
  padding: var(--space-4);
  border: 1px solid #737875;
  border-radius: var(--radius-standard);
  background: #fafaf8;
}

.document-summary h3 {
  margin: var(--space-1) 0 var(--space-3);
  font-size: 22px;
}

.document-summary dl {
  margin: 0;
}

.document-summary dl > div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--color-line);
}

.document-summary dt {
  color: var(--color-text-secondary);
  font-size: 11px;
}

.document-summary dd {
  margin: 0;
  color: var(--color-graphite);
  font-weight: 600;
}

.document-primary-action {
  margin-top: var(--space-4);
}

.saved-record-note {
  margin: var(--space-3) 0 0;
  color: var(--color-text-secondary);
  font-size: 11px;
}

.document-section {
  margin-top: var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-standard);
  background: #fff;
}

.document-section > summary {
  padding: var(--space-3) var(--space-4);
  color: var(--color-graphite);
  font-weight: 600;
  cursor: pointer;
}

.document-section[open] > summary {
  border-bottom: 1px solid var(--color-line);
}

.document-section > .master-copy {
  padding: var(--space-4);
}

.final-account .balance-row {
  margin-top: var(--space-1);
  border-top: 2px solid var(--color-ink);
  font-size: 16px;
}

.document-summary.final-account {
  display: block;
  padding: var(--space-4);
}

.document-summary.final-account .account-status {
  margin: 0 0 var(--space-3);
  color: var(--color-graphite);
  font-size: 12px;
}

.drawer-document .master-copy table:has(th:nth-child(5)) th:nth-child(2),
.drawer-document .master-copy table:has(th:nth-child(5)) td:nth-child(2) {
  text-align: left;
}

.document-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-line);
}

.empty-thread {
  margin: var(--space-6) 0;
  color: var(--color-text-secondary);
}

@media (max-width: 1100px) {
  .job-drawer {
    left: clamp(280px, 28vw, 420px);
  }

  .drawer-layout {
    grid-template-columns: minmax(0, 1fr) 220px;
    padding-right: var(--space-4);
    padding-left: var(--space-4);
  }
}

@media (max-width: 800px) {
  body.drawer-is-open {
    overflow: hidden;
  }

  .jobs-table {
    overflow-x: auto;
  }

  .jobs-row {
    grid-template-columns: minmax(190px, 1fr) 86px minmax(210px, 1.2fr) 90px 70px;
    min-width: 720px;
  }

  .job-drawer {
    left: 0;
  }

  .drawer-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .job-information {
    grid-template-columns: 1fr;
    min-height: 0;
    margin-top: 0;
    margin-bottom: 0;
    border-top: 1px solid var(--color-line);
    border-left: 0;
    padding-top: var(--space-5);
    padding-left: 0;
  }

  .drawer-document {
    padding-right: var(--space-4);
    padding-left: var(--space-4);
  }

  .drawer-document .master-document {
    padding: var(--space-7) var(--space-5);
  }

  .change-rows > div {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .change-columns {
    display: none;
  }

  .change-rows > div > span:first-child {
    grid-column: 1 / -1;
  }

  .change-rows b,
  .change-rows strong,
  .change-rows time {
    white-space: normal;
    font-size: 11px;
  }
}

@media (max-width: 560px) {
  .jobs-content {
    padding-right: var(--space-3);
    padding-left: var(--space-3);
  }

  .jobs-heading {
    align-items: flex-end;
    gap: var(--space-3);
  }

  .jobs-heading h1 {
    font-size: 21px;
  }

  .jobs-search {
    flex: 1;
    justify-content: flex-end;
  }

  .jobs-search > span {
    display: none;
  }

  .jobs-search input {
    width: min(100%, 230px);
  }

  .jobs-filters {
    justify-content: space-between;
    gap: var(--space-2);
    padding: 0 var(--space-3);
  }

  .jobs-table {
    overflow: visible;
  }

  .jobs-columns {
    display: none;
  }

  .jobs-row:not(.jobs-columns) {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-2) var(--space-3);
    min-width: 0;
    padding: var(--space-3);
    line-height: 1.4;
  }

  .jobs-row > .job-name {
    grid-column: 1;
    grid-row: 1;
  }

  .jobs-row > .job-stage {
    grid-column: 2;
    grid-row: 1;
  }

  .jobs-row > .job-next {
    grid-column: 1 / -1;
    grid-row: 2;
    padding-left: 19px;
  }

  .aki-job .job-next {
    align-items: center;
  }

  .jobs-row > .job-waiting {
    grid-column: 1;
    grid-row: 3;
    padding-left: 19px;
    color: var(--color-text-secondary);
    font-size: 11px;
  }

  .jobs-row > time {
    grid-column: 2;
    grid-row: 3;
  }

  .jobs-pagination {
    padding: 0 var(--space-3);
  }

  .drawer-header {
    position: relative;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-3);
  }

  .drawer-header > div:first-child {
    width: calc(100% - 116px);
  }

  .drawer-header h2 {
    font-size: 16px;
  }

  .drawer-close {
    order: 2;
    margin-left: auto;
  }

  .drawer-header .language-toggle {
    order: 3;
  }

  .send-mode {
    order: 4;
  }

  .mode-note {
    padding-right: var(--space-3);
    padding-left: var(--space-3);
  }

  .drawer-layout {
    gap: var(--space-4);
    padding: var(--space-3) var(--space-3) var(--space-8);
  }

  .document-summary dl > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .site-exception {
    grid-template-columns: 1fr;
  }

  .conversation-tabs {
    align-items: flex-end;
  }

  .conversation-tabs [role="tablist"] {
    gap: var(--space-3);
  }

  .conversation-tabs > span {
    display: none;
  }

  .email-box > header,
  .email-summary-header,
  .email-body {
    padding: var(--space-3);
  }

  .email-box > summary {
    padding: 0;
  }

  .email-fields {
    display: grid;
  }

  .email-fields time {
    justify-items: start;
  }

  .compact-email > summary {
    padding: 0;
  }

  .compact-email .email-summary-preview {
    padding-right: 80px;
  }

  .compact-email .email-fields {
    display: flex;
  }

  .compact-email .email-fields time {
    justify-items: end;
  }

  .email-box h3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .email-box h3 > span {
    display: none;
  }

  .message-change {
    margin-left: var(--space-2);
    padding-left: var(--space-3);
  }

  .email-group {
    width: calc(100% - 10px);
  }

  .email-incoming {
    margin-right: 10px;
  }

  .email-outgoing,
  .reply-composer,
  .reply-bar {
    margin-left: 10px;
  }

  .reply-composer {
    width: calc(100% - 10px);
  }

  .change-heading,
  .composer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .scripted-composer .composer-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .scripted-composer .composer-heading-actions {
    justify-content: space-between;
  }

  .scripted-composer .composer-heading-actions .primary {
    flex: 1;
  }

  .composer-actions .primary {
    width: 100%;
  }

  .subject-field,
  .body-field {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-1);
    padding-right: var(--space-3);
    padding-left: var(--space-3);
  }

  .body-field textarea {
    min-height: 230px;
    font-size: 16px;
  }

  .worker-price,
  .site-exception,
  .drawer-final {
    grid-template-columns: minmax(0, 1fr);
  }

  .worker-price > div + div {
    border-top: 1px solid var(--color-line);
    border-left: 0;
  }

  .worker-actions,
  .worker-actions button {
    width: 100%;
  }

  .site-exception p,
  .drawer-final .story-actions {
    grid-column: 1;
  }

  .drawer-document {
    padding: var(--space-3) var(--space-3) var(--space-8);
  }

  .document-navigation {
    top: 0;
  }

  .drawer-document .master-document {
    padding: var(--space-5) var(--space-3);
  }
}
