:root {
  --paper: #fbfaf7;
  --raised: #ffffff;
  --sunk: #f3f1ec;
  --ink: #1f1d1a;
  --ink-2: #4a4741;
  --muted: #8a857b;
  --rule: #e4e0d7;
  --good: #2f8f5b;
  --good-soft: #e6f3ec;
  --warn: #b7791f;
  --warn-soft: #fbf1dc;
  --bad: #c2413a;
  --bad-soft: #fbe9e7;
  --active: #3b6fd4;
  --agent: #5a55c8;
  --agent-soft: #efeefb;
  --wet: #fff6d6;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  --shadow: 0 1px 2px rgba(31, 29, 26, 0.06), 0 4px 14px rgba(31, 29, 26, 0.06);
  --rail: #22201c;
  --rail-ink: #ece8df;
  --rail-muted: #a39d90;
  --rail-rule: #3a3731;
}

:root[data-theme='dark'] {
    --paper: #171613;
    --raised: #201f1b;
    --sunk: #12110f;
    --ink: #ebe7df;
    --ink-2: #c4bfb4;
    --muted: #8b867b;
    --rule: #33312b;
    --good: #58b985;
    --good-soft: #1b2a22;
    --warn: #d9a34a;
    --warn-soft: #2e2617;
    --bad: #e2726b;
    --bad-soft: #301c1a;
    --active: #7ba3f0;
    --agent: #a09cf0;
    --agent-soft: #24233b;
    --wet: #33290f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.3);
    --rail: #0f0e0c;
    --rail-rule: #2a2823;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.45;
}

p {
  margin: 0;
}

.muted {
  color: var(--muted);
}

.k {
  margin-right: 4px;
  font-weight: 600;
  color: var(--muted);
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.btn {
  padding: 4px 11px;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: var(--raised);
  font-size: 12.5px;
  font-weight: 540;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  border-color: var(--muted);
}

.btn--primary {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.btn--primary:hover:not(:disabled) {
  border-color: var(--ink);
  opacity: 0.86;
}

.link {
  padding: 0;
  border: none;
  background: none;
  color: var(--agent);
  font-size: 12px;
}

.link:hover {
  text-decoration: underline;
}

.field {
  display: block;
  width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: var(--raised);
  font-size: 13px;
  resize: none;
  overflow: hidden;
  outline: none;
}

.field:focus {
  border-color: var(--agent);
  box-shadow: 0 0 0 3px var(--agent-soft);
}

.caret {
  display: inline-block;
  width: 11px;
  color: var(--muted);
}

/* ── Lab chrome: the rail is the simulator, not part of the product ───────── */

.lab {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 16px 14px 40px;
  background: var(--rail);
  color: var(--rail-ink);
  font-size: 12.5px;
}

.rail .btn {
  border-color: var(--rail-rule);
  background: transparent;
  color: var(--rail-ink);
}

.rail .btn--primary {
  border-color: var(--rail-ink);
  background: var(--rail-ink);
  color: var(--rail);
}

.rail-head b {
  font-size: 14px;
  letter-spacing: -0.01em;
}

.rail-head p,
.rail-hint {
  margin-top: 4px;
  color: var(--rail-muted);
}

.rail-head p + p {
  margin-top: 8px;
}

.rail-hint + .case {
  margin-top: 6px;
}

.rail-block {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--rail-rule);
}

.rail-title {
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rail-muted);
}

.rail .row {
  margin-top: 0;
}

.progress {
  height: 3px;
  margin: 10px 0 6px;
  border-radius: 99px;
  background: var(--rail-rule);
  overflow: hidden;
}

.progress i {
  display: block;
  height: 100%;
  background: var(--rail-ink);
}

.case {
  margin: 0 -6px;
  border-radius: 8px;
}

.case.on {
  background: rgba(255, 255, 255, 0.07);
}

.case-head {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 6px;
  border: none;
  background: none;
  text-align: left;
  color: inherit;
}

.case-head:hover .case-name {
  text-decoration: underline;
}

.case-name {
  font-weight: 600;
}

.case-blurb {
  color: var(--rail-muted);
  font-size: 12px;
}

.note {
  margin: 0;
  padding: 2px 6px 10px;
}

.note dt {
  margin-top: 8px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rail-muted);
}

.note dd {
  margin: 1px 0 0;
  line-height: 1.45;
}

/* ── The product ─────────────────────────────────────────────────────────── */

.product {
  position: relative;
  min-width: 0;
}

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  height: 46px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.brand {
  font-weight: 650;
}

.brand .muted {
  font-weight: 400;
}

.now {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--ink-2);
}

.now-item {
  padding: 0;
  border: none;
  background: none;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now-item:hover {
  color: var(--ink);
}

.now-item + .now-item::before {
  content: '·';
  margin-right: 7px;
  color: var(--muted);
}

.triage {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}

.t-block {
  color: var(--warn);
}

.sheet {
  display: grid;
  grid-template-columns: minmax(0, 640px) 320px;
  justify-content: center;
  gap: 22px;
  padding: 34px 20px 200px;
}

.with-panel .sheet {
  grid-template-columns: minmax(0, 640px);
  justify-content: center;
  padding-right: 540px;
}

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

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

/* ── Your voice: the spec ────────────────────────────────────────────────── */

.doc {
  min-width: 0;
}

.blk {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
}

.blk--h1 {
  display: block;
  padding-left: 38px;
}

.blk--h1 h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.15;
}

/* Height is reserved so the page does not jump when an agent arrives or leaves. */
.whole {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding-top: 4px;
  font-size: 12px;
  color: var(--ink-2);
}

.blk--h2 {
  margin-top: 26px;
  align-items: start;
}

.blk--h2 h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.25;
}

.blk--h2 .gut {
  padding-top: 7px;
}

.blk--h2 .body {
  padding-bottom: 3px;
}

/* The space above a passage is always enough for the caption of an agent working there, so nothing moves when one arrives. */
.blk--p {
  padding: 7px 0 5px;
  border-radius: 7px;
  transition: background 0.3s;
}

.gut {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding-top: 6px;
}

.body {
  position: relative;
  min-width: 0;
  padding-right: 6px;
}

.txt {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  cursor: text;
  border-radius: 4px;
}

.txt--edit {
  display: block;
  width: calc(100% + 12px);
  margin: -3px -6px;
  padding: 3px 6px;
  border: none;
  outline: none;
  resize: none;
  overflow: hidden;
  background: var(--wet);
  color: var(--ink);
  cursor: text;
}

.discuss {
  position: absolute;
  top: -8px;
  right: 4px;
  padding: 0 7px;
  border: 1px solid var(--rule);
  border-radius: 99px;
  background: var(--raised);
  font-size: 11px;
  color: var(--ink-2);
  opacity: 0;
  transition: opacity 0.12s;
}

.blk--p:hover .discuss,
.discuss:focus-visible {
  opacity: 1;
}

.adder {
  display: flex;
  align-items: center;
  width: 100%;
  height: 12px;
  margin: -2px 0;
  padding: 0 0 0 38px;
  border: none;
  background: none;
  opacity: 0;
  transition: opacity 0.12s;
}

.adder:hover,
.adder:focus-visible {
  opacity: 1;
}

.adder span {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  font-size: 12px;
  line-height: 1;
  color: var(--muted);
}

.adder span::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* A passage a selected card is about. */
.lit {
  background: var(--agent-soft);
}

.lit--blocking {
  background: var(--warn-soft);
}

.wet .txt {
  background: var(--wet);
  box-shadow: 0 0 0 3px var(--wet);
}

.just {
  animation: landed 2.4s ease-out;
}

@keyframes landed {
  from {
    background: var(--good-soft);
  }
}

/* What an agent is doing at this passage. */
.tag {
  position: absolute;
  top: -14px;
  left: 0;
  max-width: calc(100% - 90px);
  overflow: hidden;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 13px;
  color: var(--active);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.by {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 650;
  color: var(--agent);
}

.caret-bar {
  display: inline-block;
  width: 1.5px;
  height: 1em;
  margin-left: 1px;
  background: var(--ink);
  vertical-align: text-bottom;
  animation: blink 1s steps(2) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* Proposed edits, shown in the text they would change. */
ins {
  background: var(--agent-soft);
  box-shadow: 0 0 0 2px var(--agent-soft);
  border-radius: 2px;
  color: var(--ink);
  text-decoration: none;
}

del {
  color: var(--muted);
  text-decoration-color: var(--bad);
}

.ghost {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  margin-top: 10px;
}

.ghost .txt {
  cursor: default;
}

.cons {
  margin-top: 5px;
  padding: 3px 9px;
  border-left: 3px solid var(--good);
  border-radius: 0 6px 6px 0;
  background: var(--good-soft);
  font-size: 12.5px;
  color: var(--ink);
}

.cons b {
  margin-right: 4px;
  color: var(--good);
}

.cons--partial {
  border-color: var(--warn);
  background: var(--warn-soft);
}

.cons--partial b {
  color: var(--warn);
}

.cons--breaks {
  border-color: var(--bad);
  background: var(--bad-soft);
}

.cons--breaks b {
  color: var(--bad);
}

.said {
  margin-top: 5px;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--sunk);
  font-size: 12.5px;
}

.said b {
  margin-right: 4px;
}

/* ── The agents' layer under your text ───────────────────────────────────── */

.specs,
.works {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.specs-toggle,
.works-toggle {
  padding: 0;
  border: none;
  background: none;
  font-size: 12px;
  color: var(--ink-2);
}

.new {
  color: var(--agent);
  font-weight: 600;
}

.specs-list,
.works-list {
  margin: 4px 0 4px 3px;
  padding: 2px 0 2px 12px;
  border-left: 2px solid var(--rule);
  list-style: none;
}

.spec {
  padding: 2px 0;
}

.spec-state {
  margin-left: 7px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.spec--confirmed .spec-state,
.spec--yours .spec-state {
  color: var(--good);
}

.spec-acts {
  margin-left: 8px;
  display: inline-flex;
  gap: 8px;
  opacity: 0;
}

.spec:hover .spec-acts {
  opacity: 1;
}

.spec-edit {
  padding: 2px 0 6px;
}

.works-list li {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 1px 0;
}

.mark {
  flex-shrink: 0;
}

.mark .ring {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.mark .dashed {
  stroke-dasharray: 2.6 2.6;
}

.mark .fill {
  fill: currentColor;
}

.mark .glyph {
  fill: none;
  stroke: var(--paper);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mark .stroke {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mark .track {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  opacity: 0.22;
}

.mark .arc {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  transform-origin: 9px 9px;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.mark--idle,
.mark--stale {
  color: var(--muted);
}

.mark--active {
  color: var(--active);
}

.mark--good,
.mark--ok,
.mark--part {
  color: var(--good);
}

.mark--warn {
  color: var(--warn);
}

/* ── The margin: what is waiting for you, beside what it is about ────────── */

.margin {
  position: relative;
  min-width: 0;
}

.card {
  position: absolute;
  left: 0;
  right: 0;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--agent);
  border-radius: 9px;
  background: var(--raised);
  transition: top 0.25s ease, box-shadow 0.15s;
  animation: arrive 0.35s ease-out;
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
}

.card.open {
  box-shadow: var(--shadow);
  z-index: 2;
}

.card--blocking {
  border-left-color: var(--warn);
}

.card--fyi {
  border-left-color: var(--muted);
}

.card-head {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  padding: 7px 10px 8px;
  border: none;
  background: none;
  text-align: left;
}

.kicker {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--agent);
}

.card--blocking .kicker,
.kicker--blocking {
  color: var(--warn);
}

.card--fyi .kicker {
  color: var(--muted);
}

.holds {
  font-weight: 400;
}

.card-title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
}

/* A passage you are editing: what the edit sets off, and when. */
.wetnote {
  position: absolute;
  left: 0;
  right: 0;
  padding: 1px 0 1px 10px;
  border-left: 3px solid var(--warn);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  transition: top 0.25s ease;
}

.wetnote b {
  font-weight: 600;
  color: var(--ink);
}

.wetnote .acts {
  display: flex;
  gap: 12px;
  margin-top: 1px;
}

.card-body {
  padding: 0 10px 10px;
  color: var(--ink-2);
}

.card-body > p + p,
.card-body > * + .aside {
  margin-top: 6px;
}

.card-body strong,
.panel strong {
  color: var(--ink);
}

.aside {
  font-size: 12.5px;
  color: var(--ink-2);
}

.card-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}

.reply {
  margin-top: 8px;
}

.opts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 8px -6px 0;
}

.opt {
  border-radius: 7px;
  transition: background 0.12s;
}

.opt:hover,
.opt.on {
  background: var(--sunk);
}

.opt-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 5px 6px;
  border: none;
  background: none;
  text-align: left;
}

.radio {
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border: 1.5px solid var(--muted);
  border-radius: 50%;
  flex-shrink: 0;
}

.opt.on .radio {
  border: 4px solid var(--ink);
}

.opt-label {
  font-weight: 600;
  color: var(--ink);
}

.reco-tag {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--good);
  white-space: nowrap;
}

.opt-sum,
.opt-con,
.opt-meta {
  display: block;
  margin: 0 6px 5px 26px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.opt-sum {
  margin-top: -3px;
}

.opt-con {
  padding: 0;
  border: none;
  background: none;
  text-align: left;
}

.opt-con b {
  font-weight: 600;
}

.opt-con--partial b {
  color: var(--warn);
}

.opt-con--breaks b {
  color: var(--bad);
}

.opt-meta {
  color: var(--muted);
}

.opt-confirm {
  padding: 2px 6px 7px 26px;
}

.evidence {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: 12.5px;
}

.evidence td {
  padding: 3px 0;
  border-bottom: 1px solid var(--rule);
}

.evidence td:last-child {
  text-align: right;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
}

.steps {
  margin: 8px 0 0;
  padding-left: 18px;
}

.steps li {
  padding: 1px 0;
}

/* A stand-in for a live preview of the built screen. */
.phone {
  margin-top: 9px;
  padding: 10px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  font-size: 12.5px;
}

.phone-bar {
  display: flex;
  justify-content: space-between;
  font-weight: 650;
}

.phone-note {
  margin: 2px 0 8px;
  font-size: 11.5px;
  color: var(--muted);
}

.pay {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 8px;
  padding: 6px 0;
  border-top: 1px solid var(--rule);
}

.amt {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.paid {
  grid-column: 1 / -1;
  font-size: 11.5px;
  color: var(--agent);
}

/* ── The side panel ──────────────────────────────────────────────────────── */

.panel {
  position: fixed;
  top: 46px;
  right: 0;
  bottom: 0;
  z-index: 6;
  width: 520px;
  max-width: calc(100vw - 292px);
  padding: 14px 20px 60px;
  overflow-y: auto;
  border-left: 1px solid var(--rule);
  background: var(--raised);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.06);
  color: var(--ink-2);
  animation: slide 0.22s ease-out;
}

@keyframes slide {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
}

.panel-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.panel-head h3 {
  margin-top: 0;
}

.x {
  flex-shrink: 0;
  margin-left: auto;
  padding: 2px 8px;
  border: none;
  border-radius: 6px;
  background: none;
  font-size: 12px;
  color: var(--muted);
}

.x:hover {
  background: var(--sunk);
  color: var(--ink);
}

.panel h3 {
  margin: 8px 0 6px;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
}

.panel > p + p,
.panel > .aside {
  margin-top: 8px;
}

.waiting .k {
  color: var(--warn);
}

.opts--rich {
  gap: 4px;
  margin-top: 12px;
}

.reco {
  margin-top: 12px;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--good-soft);
  color: var(--ink);
}

.quote {
  margin: 8px 0;
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--rule);
  font-family: var(--serif);
  font-size: 14.5px;
  color: var(--ink);
}

.thread {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.thread--compact {
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}

.msg {
  max-width: 92%;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--sunk);
  color: var(--ink);
  animation: arrive 0.25s ease-out;
}

.msg--you {
  align-self: flex-end;
  background: var(--agent-soft);
}

.prompts {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.prompt {
  padding: 4px 10px;
  border: 1px dashed var(--muted);
  border-radius: 99px;
  background: none;
  font-size: 12.5px;
  color: var(--ink-2);
  text-align: right;
}

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