:root {
  color-scheme: dark;
  --bg: #0b0f11;
  --panel: #111719;
  --panel-2: #172024;
  --line: #29363b;
  --line-strong: #405158;
  --muted: #89999f;
  --text: #edf3f2;
  --green: #43d483;
  --cyan: #51d0d2;
  --amber: #efb84f;
  --red: #ed6d68;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

button,
input,
select,
textarea {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #111719;
  color: var(--text);
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 9px 10px;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

button {
  min-height: 38px;
  padding: 8px 14px;
  border-color: #34885a;
  background: #23653f;
  cursor: pointer;
  font-weight: 650;
}

button:hover {
  background: #2b7a4d;
}

button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.shell {
  display: grid;
  grid-template-columns: minmax(210px, 260px) minmax(360px, 1fr) minmax(290px, 360px);
  width: 100%;
  height: 100dvh;
}

.rooms-panel,
.mission-panel,
.conversation {
  min-width: 0;
  min-height: 0;
  background: var(--panel);
}

.rooms-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

.brand,
.conversation-header,
.mission-panel > header {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.conversation-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.canonical-context {
  display: flex;
  min-width: 0;
  max-width: 520px;
  align-items: center;
  gap: 8px;
  text-align: right;
}

.canonical-context > div {
  min-width: 0;
}

.canonical-context strong,
.canonical-context span:not(.status) {
  display: block;
  overflow-wrap: anywhere;
}

.canonical-context strong {
  font-size: 11px;
}

.canonical-context span:not(.status) {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.brand div,
.mission-panel > header {
  min-width: 0;
}

.brand strong {
  display: block;
  color: var(--green);
  font-size: 16px;
}

.brand span,
.mission-panel > header span,
.conversation-header p {
  color: var(--muted);
  font-size: 12px;
}

.room-create {
  display: grid;
  grid-template-columns: 1fr 38px;
  gap: 7px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.room-create button {
  width: 38px;
  padding: 0;
  font-size: 20px;
}

.rooms {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.room-item {
  width: 100%;
  min-height: 56px;
  margin-bottom: 5px;
  padding: 9px 10px;
  border-color: transparent;
  background: transparent;
  text-align: left;
  font-weight: 500;
}

.room-item:hover,
.room-item.active {
  border-color: var(--line);
  background: var(--panel-2);
}

.room-item.active {
  border-left-color: var(--green);
}

.room-item strong,
.room-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.conversation {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  background: #121719;
}

.system-area {
  min-width: 0;
  min-height: 0;
  border-bottom: 1px solid var(--line);
  background: #111719;
}

.system-summary {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px clamp(12px, 2vw, 24px);
  cursor: pointer;
  list-style: none;
}

.system-summary::-webkit-details-marker {
  display: none;
}

.system-summary::after {
  margin-left: auto;
  color: var(--muted);
  content: "+";
  font-size: 18px;
  line-height: 1;
}

.system-area[open] .system-summary::after {
  content: "−";
}

.system-summary > span:first-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.system-summary strong,
.system-summary span:not(.status) {
  overflow-wrap: anywhere;
}

.system-summary strong {
  font-size: 12px;
}

.system-summary span:not(.system-kicker):not(.status) {
  color: var(--muted);
  font-size: 10px;
}

.system-kicker,
.initiative-kicker,
.initiative-label {
  color: var(--cyan);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.system-content {
  max-height: min(72dvh, 760px);
  overflow-y: auto;
  border-top: 1px solid var(--line);
}

.truth-gap-panel {
  min-height: 0;
  max-height: min(360px, 42dvh);
  overflow-y: auto;
  padding: 12px clamp(12px, 2vw, 24px);
  border-bottom: 1px solid var(--line);
  background: #151c1f;
}

.director-panel {
  min-height: 0;
  max-height: min(320px, 36dvh);
  overflow-y: auto;
  padding: 12px clamp(12px, 2vw, 24px);
  border-bottom: 1px solid var(--line);
  background: #131a1d;
}

.director-panel .truth-gap-kicker {
  color: var(--amber);
}

.system-content .truth-gap-panel,
.system-content .director-panel {
  max-height: none;
  overflow: visible;
}

.truth-gap-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.truth-gap-kicker {
  display: block;
  color: var(--cyan);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.truth-gap-header h2 {
  margin: 3px 0 0;
  font-size: 14px;
}

.truth-gap-summary {
  margin: 7px 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.truth-gap-body {
  display: grid;
  gap: 10px;
}

.truth-gap-section {
  min-width: 0;
}

.truth-gap-section h3 {
  margin: 0 0 7px;
  color: #d6e0e1;
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.truth-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 7px;
}

.truth-fact {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #111719;
}

.truth-fact-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.truth-fact-label {
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.truth-fact .status {
  flex: 0 0 auto;
  min-height: 18px;
  padding: 2px 5px;
  font-size: 9px;
}

.truth-fact-value {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-size: 11px;
  line-height: 1.4;
}

.truth-fact code {
  color: #c8e5ea;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 10px;
  word-break: break-all;
}

.truth-fact-detail {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.conversation-header h1,
.mission-panel h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 16px;
}

.conversation-header p {
  margin: 4px 0 0;
}

.messages {
  min-height: 0;
  overflow-y: auto;
  padding: 18px clamp(12px, 3vw, 42px);
}

.message {
  max-width: 780px;
  margin: 0 auto 18px;
  padding-left: 12px;
  border-left: 2px solid var(--line);
}

.message[data-kind="decision"] {
  border-left-color: var(--green);
}

.message[data-kind="critique"] {
  border-left-color: var(--amber);
}

.message[data-kind="objective"] {
  border-left-color: var(--cyan);
}

.message-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.message-head strong {
  color: var(--cyan);
}

.message-head span {
  color: var(--muted);
  font-size: 11px;
}

.message-action {
  min-height: 28px;
  margin-left: auto;
  padding: 4px 8px;
  border-color: var(--cyan);
  background: transparent;
  color: var(--cyan);
  font-size: 11px;
  line-height: 1;
}

.message-action:hover:not(:disabled) {
  background: rgba(85, 199, 220, 0.14);
}

.message-action-icon {
  display: inline-grid;
  width: 28px;
  min-width: 28px;
  padding: 0;
  place-items: center;
}

.message-action-glyph {
  font-size: 13px;
}

.message-body {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  line-height: 1.55;
}

.message-engagement--routing {
  margin-top: 9px;
  padding: 9px 10px;
  border: 1px solid #5c4b2d;
  background: #201d17;
}

.message-engagement--routing .message-engagement-summary {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.message-engagement-disclosure > summary {
  cursor: pointer;
  list-style: none;
}

.message-engagement-disclosure > summary::-webkit-details-marker {
  display: none;
}

.message-engagement-disclosure-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 10px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  background: #171b1c;
}

.message-engagement-disclosure-summary .message-engagement-header {
  grid-column: 1 / -1;
}

.message-engagement-disclosure-summary .message-engagement-summary {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.message-engagement-disclosure[open] .message-engagement-disclosure-summary {
  border-bottom-color: transparent;
}

.message-engagement-disclosure:not([open]) + .message-engagement-body {
  display: none;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.composer-fields {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(100px, 180px) minmax(100px, 150px);
  gap: 8px;
}

.composer textarea {
  min-height: 66px;
}

.composer > button {
  align-self: stretch;
}

.mission-panel {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-left: 1px solid var(--line);
}

.initiative-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px 14px;
  border-bottom: 1px solid var(--line);
  background: #141b1e;
}

.initiative-header,
.initiative-section-head,
.initiative-actions,
.initiative-action-buttons,
.initiative-meta-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 9px;
}

.initiative-header > div,
.initiative-actions > div:first-child {
  min-width: 0;
}

.initiative-header h2 {
  margin: 2px 0 0;
  font-size: 15px;
}

.initiative-summary {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.factory-start-status {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.factory-start-status[data-state="ready"] {
  color: var(--cyan);
}

.factory-run-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px 12px;
  border-bottom: 1px solid var(--line);
  background: #11181b;
}

.factory-run-header,
.factory-run-checkpoint-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.factory-run-header > div,
.factory-run-checkpoint-head > * {
  min-width: 0;
}

.factory-run-header h2 {
  margin: 2px 0 0;
  font-size: 14px;
}

.factory-run-summary,
.factory-run-empty {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.factory-run-body,
.factory-run-lanes {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.factory-run-lane {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(48px, .45fr) minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 7px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.factory-run-lane-header {
  padding-top: 0;
  border-top: 0;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.factory-run-lane-header .factory-run-field {
  display: block;
}

.factory-run-lane-header .factory-run-value {
  color: var(--muted);
  font-size: 9px;
}

.factory-run-lane-name,
.factory-run-assignment,
.factory-run-refs,
.factory-run-field {
  min-width: 0;
}

.factory-run-lane-name {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.factory-run-lane-name strong {
  overflow-wrap: anywhere;
  font-size: 11px;
}

.factory-run-assignment,
.factory-run-refs {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.factory-run-field {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.factory-run-label {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.factory-run-value {
  min-width: 0;
  color: var(--text);
  font-size: 10px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.factory-run-checkpoint {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(84px, .8fr) minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) minmax(90px, .85fr);
  gap: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

.factory-run-checkpoint-head {
  flex-direction: column;
  gap: 4px;
}

.factory-run-checkpoint-head strong {
  font-size: 10px;
}

.factory-run-facts {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.3fr) minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

.activity-timeline {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
  padding: 8px clamp(12px, 2vw, 24px) 9px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #111719;
}

.activity-header {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.activity-header h2 {
  margin: 2px 0 0;
  font-size: 12px;
}

.activity-summary,
.activity-empty,
.activity-omitted {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.activity-omitted {
  color: var(--amber);
}

.activity-body,
.activity-body-content {
  min-width: 0;
}

.activity-events {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 0 0 3px;
  gap: 5px;
  overflow: visible;
  list-style: none;
}

.activity-event {
  display: grid;
  min-width: 0;
  gap: 3px;
  padding: 5px 12px 4px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--line);
}

.activity-event time,
.activity-event code {
  color: var(--muted);
  font-size: 9px;
  overflow-wrap: anywhere;
}

.activity-event strong {
  color: var(--text);
  font-size: 10px;
  overflow-wrap: anywhere;
}

.activity-event span {
  color: #c4d1d2;
  font-size: 10px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.initiative-body {
  display: grid;
  min-width: 0;
  gap: 9px;
}

.initiative-objective,
.initiative-section,
.initiative-stage-wrap {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #101618;
}

.initiative-objective {
  border-left: 3px solid var(--cyan);
}

.initiative-objective h3 {
  margin: 5px 0 4px;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.initiative-objective p,
.initiative-council-summary,
.initiative-empty {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.initiative-meta-row {
  align-items: baseline;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
}

.initiative-meta-row code,
.initiative-artifact-detail,
.initiative-action-status {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.initiative-meta-row code {
  color: #c8e5ea;
  font-family: "Cascadia Code", Consolas, monospace;
}

.initiative-stage-wrap {
  overflow: visible;
}

.initiative-stage-bar {
  display: grid;
  grid-template-columns: repeat(7, minmax(62px, 1fr));
  min-width: 470px;
  gap: 4px;
  margin-top: 7px;
}

.initiative-stage {
  min-width: 0;
  padding: 7px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #151d20;
  text-align: center;
}

.initiative-stage strong,
.initiative-stage span {
  display: block;
  overflow-wrap: anywhere;
}

.initiative-stage strong {
  font-size: 10px;
}

.initiative-stage span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.initiative-stage[data-state="CURRENT"] {
  border-color: var(--cyan);
  box-shadow: inset 0 -2px 0 var(--cyan);
}

.initiative-stage[data-state="DONE"] {
  border-color: #2f8b59;
  color: var(--green);
}

.initiative-stage[data-state="BLOCKED"] {
  border-color: var(--red);
  color: var(--red);
}

.initiative-stage[data-state="UNKNOWN"] {
  color: var(--amber);
}

.initiative-two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 9px;
}

.initiative-section-head {
  align-items: center;
  margin-bottom: 6px;
}

.initiative-section-head strong {
  font-size: 11px;
}

.initiative-dissent,
.initiative-artifacts {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.initiative-dissent li,
.initiative-artifact {
  min-width: 0;
  padding: 6px 7px;
  border-left: 2px solid var(--amber);
  background: #151d20;
}

.initiative-dissent strong,
.initiative-artifact strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 10px;
}

.initiative-dissent span,
.initiative-artifact-detail {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.initiative-artifact[data-state="PRESENT"],
.initiative-artifact[data-state="DONE"] {
  border-left-color: var(--green);
}

.initiative-artifact[data-state="UNKNOWN"],
.initiative-artifact[data-state="BLOCKED"] {
  border-left-color: var(--amber);
}

.initiative-actions {
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.initiative-action-status {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.initiative-action-buttons {
  flex: 0 0 auto;
}

.initiative-action-buttons button {
  min-height: 32px;
  padding: 6px 10px;
}

.initiative-action-buttons button[data-action="reject"] {
  border-color: #87403d;
  background: #5d2928;
}

.initiative-action-buttons button[data-action="reject"]:hover:not(:disabled) {
  background: #7b3431;
}

.initiative-actions button:disabled {
  cursor: not-allowed;
}

.mission-tools {
  border-bottom: 1px solid var(--line);
}

.mission-tools > summary {
  padding: 10px 14px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  list-style: none;
}

.mission-tools > summary::-webkit-details-marker {
  display: none;
}

.mission-tools > summary::before {
  margin-right: 7px;
  content: "+";
  color: var(--cyan);
}

.mission-tools[open] > summary::before {
  content: "−";
}

.mission-panel > header {
  display: block;
}

.mission-panel > header span {
  display: block;
  margin-top: 4px;
}

.mission-form {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.mission-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.mission-output {
  padding: 14px;
}

.mission-output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.mission-output pre {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  color: #c8d3d6;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.status {
  display: inline-flex;
  min-width: 54px;
  min-height: 22px;
  align-items: center;
  justify-content: center;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.status-ok {
  border-color: #2f8b59;
  color: var(--green);
}

.status-warn {
  border-color: #8a672d;
  color: var(--amber);
}

.status-error {
  border-color: #87403d;
  color: var(--red);
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 220px minmax(360px, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .mission-panel {
    display: flex;
    grid-column: 1 / -1;
    grid-row: 2;
    max-height: min(46dvh, 520px);
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 640px) {
  body {
    overflow: auto;
  }

  .shell {
    display: block;
    height: auto;
  }

  .rooms-panel {
    height: 220px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .conversation {
    min-height: calc(100dvh - 220px);
  }

  .mission-panel {
    max-height: none;
    border-top: 1px solid var(--line);
  }

  .system-content {
    max-height: 58dvh;
  }

  .conversation-header,
  .conversation-status {
    align-items: flex-start;
  }

  .conversation-header {
    flex-direction: column;
  }

  .conversation-status {
    width: 100%;
    justify-content: space-between;
  }

  .factory-run-panel {
    padding: 10px;
  }

  .factory-run-lane-header {
    display: none;
  }

  .factory-run-lane {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .factory-run-refs {
    grid-column: 2;
  }

  .factory-run-checkpoint {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .factory-run-checkpoint-head {
    grid-column: 1 / -1;
  }

  .factory-run-facts {
    grid-template-columns: 1fr;
  }

  .activity-timeline {
    padding: 8px 10px 9px;
  }

  .activity-event {
    min-width: 0;
  }

  .canonical-context {
    text-align: left;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .composer-fields,
  .composer > button {
    grid-column: 1;
  }

  .initiative-two-column {
    grid-template-columns: 1fr;
  }

  .initiative-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .initiative-action-buttons {
    width: 100%;
  }

  .initiative-action-buttons button {
    flex: 1;
  }
}

/* D8 command-center pass: compact scan path, explicit states, bounded evidence. */
body { font-size: 13px; letter-spacing: 0.01em; }

button, input, select, textarea { border-radius: 3px; }

button { min-height: 34px; border-color: #2c8c5c; background: #1b5b3b; }

button:hover:not(:disabled) { border-color: var(--green); background: #24754b; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
.room-item:focus-visible,
.icon-button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

button:disabled { cursor: not-allowed; }

.shell { grid-template-columns: 240px minmax(0, 1fr) 340px; }

.brand, .conversation-header, .mission-panel > header { min-height: 60px; padding: 10px 14px; }

.brand strong { letter-spacing: 0.04em; }

.pane-kicker {
  display: block;
  color: var(--cyan);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1.1;
  text-transform: uppercase;
}

.conversation-header h1, .mission-panel h2 { font-size: 15px; letter-spacing: 0.01em; }
.conversation-header p { margin-top: 3px; font-size: 11px; }
.canonical-context { max-width: 430px; }
.conversation { grid-template-rows: auto auto minmax(0, 1fr) auto; }
.system-summary { min-height: 42px; padding: 7px 14px; }
.system-summary::after { font-size: 16px; }
.messages { padding: 14px clamp(12px, 3vw, 36px); }
.message { margin-bottom: 14px; padding-left: 10px; }
.message-head { gap: 6px; margin-bottom: 4px; }
.message-body { line-height: 1.45; }
.composer { padding: 9px 12px; }
.composer textarea { min-height: 58px; }
.mission-panel { scrollbar-color: var(--line-strong) transparent; }
.mission-panel > header > div { min-width: 0; }
.mission-panel > header > span { white-space: nowrap; }

.initiative-panel { gap: 7px; padding: 9px 11px 10px; }
.initiative-summary, .factory-start-status { font-size: 10px; line-height: 1.3; }
.initiative-body { gap: 6px; }
.initiative-objective, .initiative-section, .initiative-stage-wrap { padding: 7px; border-radius: 3px; }
.initiative-objective h3 { margin: 4px 0 3px; font-size: 12px; }
.initiative-objective p { display: -webkit-box; max-height: 2.8em; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 10px; line-height: 1.4; }
.initiative-meta-row { font-size: 9px; }
.initiative-stage-wrap { overflow: hidden; }
.initiative-stage-bar { min-width: 0; margin-top: 5px; gap: 3px; }
.initiative-stage { padding: 6px 3px; }
.initiative-stage strong { font-size: 9px; }
.initiative-stage span { margin-top: 2px; font-size: 8px; }
.initiative-two-column { gap: 6px; }
.initiative-section h3 { margin-bottom: 5px; font-size: 9px; }
.initiative-council-summary, .initiative-dissent li, .initiative-action-status { font-size: 10px; line-height: 1.3; }
.initiative-dissent { max-height: 24px; overflow: hidden; }
.initiative-block .initiative-meta-row { flex-wrap: nowrap; gap: 4px; white-space: nowrap; font-size: 8px; }
.initiative-actions { gap: 6px; }
.initiative-actions button { min-height: 30px; padding: 5px 9px; font-size: 11px; }

.factory-run-panel { gap: 6px; padding: 8px 11px 10px; }
.factory-run-header h2 { font-size: 13px; }
.factory-run-summary, .factory-run-empty { font-size: 10px; }
.factory-run-body, .factory-run-lanes { gap: 4px; }
.factory-run-lane { grid-template-columns: minmax(48px, .42fr) minmax(0, 1fr); gap: 5px; padding-top: 5px; align-items: center; }
.factory-run-lane-name { display: flex; min-width: 0; align-items: center; gap: 3px; flex-direction: row; flex-wrap: nowrap; }
.factory-run-state { min-height: 18px; padding: 2px 4px; font-size: 7px; }
.factory-run-assignment { display: grid; grid-template-columns: minmax(70px, .7fr) minmax(0, 1.3fr); gap: 4px; align-items: center; }
.factory-run-assignment .factory-run-field { min-width: 0; }
.factory-run-refs { display: none; }
.factory-run-label, .factory-run-value { display: inline; }
.factory-run-label { margin-right: 3px; }
.factory-run-lane-name strong, .factory-run-value { font-size: 9px; }
.factory-run-label { font-size: 7px; }
.factory-run-checkpoint, .factory-run-facts { gap: 5px; padding-top: 5px; }
.factory-run-facts { font-size: 9px; }

.evidence-drawer { border-bottom: 1px solid var(--line); background: #0e1416; }
.evidence-drawer > summary { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 9px; padding: 7px 11px; cursor: pointer; list-style: none; }
.evidence-drawer > summary::-webkit-details-marker { display: none; }
.evidence-drawer > summary::after { color: var(--muted); content: "+"; font-size: 16px; }
.evidence-drawer[open] > summary::after { content: "−"; }
.evidence-drawer > summary > span:first-child { display: grid; min-width: 0; gap: 2px; }
.evidence-drawer strong { font-size: 11px; }
.evidence-body { max-height: 360px; overflow-y: auto; padding: 0 11px 10px; border-top: 1px solid var(--line); }
.evidence-empty { margin: 10px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.evidence-list { display: grid; gap: 5px; margin: 8px 0 0; padding: 0; list-style: none; }
.evidence-item { min-width: 0; padding: 6px 7px; border-left: 2px solid var(--line-strong); background: #121a1d; }
.evidence-item-head { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 7px; }
.evidence-item strong, .evidence-item span, .evidence-item code { overflow-wrap: anywhere; }
.evidence-item strong { font-size: 10px; }
.evidence-item code { display: block; margin-top: 4px; color: #c5e5e5; font-family: "Cascadia Code", Consolas, monospace; font-size: 9px; line-height: 1.35; word-break: break-all; }
.evidence-item > span { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; }

.parliament-overview {
  min-width: 0;
  margin: 0 14px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  border-radius: 6px;
  background: #101719;
}

.parliament-overview-disclosure,
.parliament-overview-next,
.parliament-overview-row-head {
  display: flex;
  align-items: center;
  min-width: 0;
}

.parliament-overview > summary {
  list-style: none;
}

.parliament-overview > summary::-webkit-details-marker {
  display: none;
}

.parliament-overview-disclosure {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
}

.parliament-overview-disclosure-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.parliament-overview-disclosure-line {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.parliament-overview-compact {
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.parliament-overview-toggle-label {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  align-self: center;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
}

.parliament-overview-content {
  display: grid;
  gap: 0;
  padding: 0 12px 10px;
}

.parliament-overview:not([open]) .parliament-overview-content {
  display: none;
}

.parliament-overview[open] .parliament-overview-disclosure {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(93, 128, 129, 0.18);
}

.parliament-overview-meter {
  display: grid;
  grid-template-columns: auto minmax(64px, 96px) auto;
  align-items: center;
  gap: 8px;
}

.parliament-overview-progress {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  font-weight: 800;
}

.parliament-overview-meter progress {
  width: 100%;
  height: 6px;
  border: 0;
  background: var(--line);
  accent-color: var(--green);
}

.parliament-overview-summary,
.parliament-overview-freshness {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.parliament-overview-next {
  flex-wrap: wrap;
  gap: 5px 8px;
  margin-top: 9px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(81, 208, 210, .06);
}

.parliament-overview-next-label,
.parliament-overview-label,
.parliament-overview-meta {
  color: var(--cyan);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}

.parliament-overview-next-action {
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.parliament-overview-next-predicate,
.parliament-overview-predicate {
  max-width: 100%;
  color: var(--amber);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 9px;
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.parliament-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-width: 0;
  margin: 10px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  list-style: none;
}

.parliament-overview-row {
  min-width: 0;
  min-height: 75px;
  padding: 8px 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .012);
}

.parliament-overview-row-head {
  justify-content: space-between;
  gap: 7px;
}

.parliament-overview-row-head .status {
  flex: 0 0 auto;
  white-space: nowrap;
}

.parliament-overview-detail {
  min-width: 0;
  margin: 6px 0 0;
  color: var(--text);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.parliament-overview-meta {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.parliament-overview-predicate {
  display: block;
  margin-top: 5px;
}

.parliament-overview-freshness {
  font-size: 10px;
}

@media (max-width: 980px) {
  .parliament-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .parliament-overview {
    margin: 0 10px 10px;
  }

  .parliament-overview-disclosure {
    grid-template-columns: minmax(0, 1fr);
    align-items: flex-start;
    gap: 8px;
    padding: 10px;
  }

  .parliament-overview-content {
    padding: 0 10px 10px;
  }

  .parliament-overview-meter { grid-template-columns: auto minmax(56px, 80px) auto; }
  .parliament-overview-toggle-label {
    justify-self: start;
  }
  .parliament-overview-grid { margin-top: 8px; }
  .parliament-overview-row { min-height: 84px; padding: 8px; }
  .parliament-overview-detail { font-size: 11px; }
}

@media (max-width: 360px) {
  .parliament-overview-grid { grid-template-columns: 1fr; }
  .parliament-overview-row { min-height: auto; }
}
.icon-button { display: inline-grid; width: 26px; min-width: 26px; min-height: 26px; padding: 0; place-items: center; border-color: var(--line-strong); background: transparent; color: var(--cyan); font-size: 14px; line-height: 1; }
.icon-button:hover:not(:disabled) { background: #1a2b2d; }
.truth-gap-panel, .director-panel { scrollbar-color: var(--line-strong) transparent; }
[data-state="loading"] { min-height: 72px; }
[data-state="error"] .status-error, [data-state="UNKNOWN"] .status-warn, [data-state="unknown"] .status-warn { color: var(--amber); }

@media (max-width: 980px) {
  .shell { grid-template-columns: 220px minmax(0, 1fr); }
  .mission-panel { grid-column: 1 / -1; max-height: 48vh; }
}

@media (max-width: 640px) {
  html, body { min-width: 0; overflow-x: hidden; }
  .rooms-panel { height: 176px; }
  .conversation { min-height: calc(100dvh - 176px); }
  .conversation-header, .mission-panel > header { padding: 9px 11px; }
  .conversation-status { gap: 6px; }
  .canonical-context { max-width: none; }
  .factory-run-panel, .initiative-panel { padding-right: 10px; padding-left: 10px; }
  .initiative-stage-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; }
  .factory-run-lane { grid-template-columns: 48px minmax(0, 1fr); }
  .factory-run-assignment { grid-template-columns: minmax(54px, .7fr) minmax(0, 1.3fr); }
  .evidence-body { max-height: 300px; }
}

/* Auth boundary: identity first, workspace withheld until /v1/auth/me is trusted. */
[hidden] {
  display: none !important;
}

.auth-gate {
  display: grid;
  width: 100%;
  min-height: 100dvh;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.auth-card {
  display: grid;
  width: min(100%, 420px);
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--panel);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .22);
}

.auth-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.auth-card h1 {
  margin: 4px 0 0;
  font-size: 18px;
  letter-spacing: .01em;
}

.auth-card label,
.password-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.auth-card input,
.password-form input {
  padding: 10px;
  border-color: var(--line-strong);
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
}

.auth-message,
.auth-error,
.account-feedback {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.auth-error,
.account-feedback[data-state="error"] {
  color: var(--red);
}

.account-feedback[data-state="ready"] {
  color: var(--green);
}

.brand-controls {
  display: flex;
  flex: 0 0 auto;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.account-control {
  position: relative;
  flex: 0 0 34px;
  min-width: 0;
}

.account-control > summary {
  display: flex;
  flex: 0 0 34px;
  width: 34px;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 2px 4px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #151d1e;
  color: var(--text);
  cursor: pointer;
  font-size: 10px;
  list-style: none;
}

.account-summary-copy {
  display: none;
  min-width: 0;
  gap: 1px;
}

.account-summary-label {
  color: var(--cyan);
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
}

.account-control > summary::-webkit-details-marker,
.password-control > summary::-webkit-details-marker {
  display: none;
}

.account-avatar {
  display: inline-grid;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--cyan);
  border-radius: 50%;
  color: var(--cyan);
  font-size: 10px;
  font-weight: 800;
}

.account-username {
  max-width: 92px;
  overflow: hidden;
  color: var(--text) !important;
  font-size: 10px !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-popover {
  position: absolute;
  z-index: 5;
  top: calc(100% + 7px);
  right: 0;
  display: grid;
  width: 260px;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #101719;
  box-shadow: 0 16px 36px rgba(0, 0, 0, .35);
}

.account-identity,
.account-grants-block {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.account-directory {
  display: grid;
  min-width: 0;
  gap: 8px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.account-directory-head {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.account-directory-title {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.account-directory-title strong {
  color: var(--text);
  font-size: 11px;
}

.account-directory-meta {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.account-directory-meta > span:first-child {
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
}

.account-directory-meta .account-feedback {
  min-width: 0;
  font-size: 10px;
}

.account-directory-list {
  display: grid;
  max-height: 224px;
  margin: 0;
  padding: 0;
  gap: 5px;
  overflow: auto;
  list-style: none;
}

.account-directory-row {
  display: grid;
  min-width: 0;
  grid-template-columns: 26px minmax(0, 1fr) max-content;
  align-items: center;
  gap: 7px;
  padding: 5px 0;
  border-top: 1px solid var(--line);
}

.account-directory-avatar {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--cyan);
  border-radius: 50%;
  color: var(--cyan);
  font-size: 9px;
  font-weight: 800;
}

.account-directory-identity,
.account-directory-access {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.account-directory-identity strong,
.account-directory-identity span,
.account-directory-role {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 10px;
}

.account-directory-identity span,
.account-directory-role {
  color: var(--muted);
}

.account-directory-access {
  justify-items: end;
  gap: 3px;
}

.account-directory-access .status {
  width: max-content;
  font-size: 8px;
}

.account-identity strong,
.account-grants {
  overflow-wrap: anywhere;
  font-size: 10px;
}

.account-identity span,
.account-grants {
  color: var(--muted);
}

.account-label {
  color: var(--cyan);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .08em;
}

.password-control {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.password-control > summary {
  color: var(--cyan);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  list-style: none;
}

.password-control > summary::before {
  margin-right: 5px;
  color: var(--muted);
  content: "+";
}

.password-control[open] > summary::before { content: "−"; }

.password-form {
  display: grid;
  gap: 8px;
  margin-top: 9px;
}

.password-form label { font-size: 9px; }
.password-form input { padding: 8px; font-size: 12px; }
.password-form button,
.account-logout { min-height: 30px; padding: 5px 9px; font-size: 10px; }
.account-logout { border-color: #87403d; background: #5d2928; }
.account-logout:hover:not(:disabled) { background: #7b3431; }

@media (max-width: 640px) {
  .auth-gate { align-items: start; padding: 16px; }
  .auth-card { margin-top: max(0px, 8dvh); padding: 18px; }
  .brand-controls { gap: 4px; }
  .account-popover { position: fixed; top: 64px; right: 10px; left: 10px; width: auto; }
}

/* D8 QA follow-up: readable operations text, wrapped stages, no primary rail overflow. */
body,
body * {
  letter-spacing: 0px !important;
}

body { font-size: 13px; }

.pane-kicker,
.initiative-kicker,
.truth-gap-kicker,
.system-kicker,
.initiative-label,
.account-label {
  font-size: 10px;
}

.initiative-meta-row,
.initiative-council-summary,
.initiative-action-status,
.factory-run-summary,
.factory-run-empty,
.activity-summary,
.activity-empty,
.activity-omitted {
  font-size: 10px;
}

.initiative-block .initiative-meta-row {
  font-size: 10px;
}

.initiative-stage-wrap {
  overflow: visible;
}

.initiative-stage-bar {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-width: 0;
  gap: 5px;
}

.initiative-stage {
  min-width: 0;
  min-height: 44px;
  padding: 7px 4px;
}

.initiative-stage strong,
.initiative-stage span {
  font-size: 10px;
  line-height: 1.2;
  overflow-wrap: anywhere;
  white-space: normal;
}

.initiative-stage span { margin-top: 3px; }

.factory-run-state,
.factory-run-label,
.factory-run-value {
  font-size: 10px;
}

.factory-run-lane-header,
.factory-run-lane-header * {
  font-size: 10px;
}

body .factory-run-header-cell .factory-run-value,
body .password-form label,
body .status {
  font-size: 10px !important;
}

.status,
.auth-card label {
  font-size: 10px;
}

body .initiative-block .initiative-meta-row {
  min-width: 0;
  flex-wrap: wrap;
  white-space: normal;
}

body .initiative-block .initiative-meta-row > * {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

body .initiative-block .initiative-meta-row > .status {
  min-width: 0;
  white-space: normal;
  text-align: center;
}

.factory-run-state {
  min-height: 20px;
  padding: 3px 5px;
}

.activity-events {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  overflow: visible;
}

.activity-event {
  min-width: 0;
  padding: 6px 8px;
}

.activity-event time,
.activity-event strong,
.activity-event span {
  font-size: 10px;
}

.activity-event span {
  line-height: 1.35;
}

@media (max-width: 640px) {
  .initiative-stage-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .initiative-stage {
    min-height: 42px;
  }

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

/* D9 responsive falsifiers: primary conversation and controls must fit, wrap, and remain focusable. */
html,
body {
  min-width: 0;
  overflow-x: hidden;
}

.shell,
.rooms-panel,
.conversation,
.mission-panel,
.conversation-header,
.conversation-status,
.messages,
.message,
.message-head,
.message-body,
.room-create,
.rooms,
.initiative-panel,
.factory-run-panel,
.activity-timeline {
  min-width: 0;
  max-width: 100%;
}

.room-create {
  grid-template-columns: minmax(0, 1fr) 34px;
}

.room-create input,
.room-create button {
  min-width: 0;
  max-width: 100%;
}

.room-create button,
.message-action-icon,
.icon-button {
  width: 34px;
  min-width: 28px;
  min-height: 28px;
}

.room-item,
.room-item strong,
.room-item span {
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.conversation-header > div,
.conversation-status,
.canonical-context,
.canonical-context > div,
.canonical-context .status,
.system-summary > span,
.system-summary .status,
.activity-header > div,
.activity-header .status,
.message-head > *,
.message-body {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}

.conversation-status {
  flex-wrap: wrap;
}

.conversation-status .status,
.activity-header .status,
.truth-gap-header .status,
.initiative-header .status,
.factory-run-header .status {
  flex: 0 1 auto;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}

.message-head {
  align-items: flex-start;
}

.message-head strong,
.message-head span,
.message-body {
  overflow: visible;
  text-overflow: clip;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-action {
  flex: 0 0 auto;
  margin-left: auto;
}

.messages,
.messages .message,
.messages .message-body {
  overflow-x: visible;
}

.initiative-stage strong,
.initiative-stage span,
.factory-run-lane-name strong,
.factory-run-value,
.factory-run-label,
.activity-event,
.activity-event time,
.activity-event strong,
.activity-event span,
.initiative-block,
.initiative-block * {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}

button,
summary,
input,
select,
textarea,
.room-item {
  max-width: 100%;
}

button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.room-item:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .brand,
  .conversation-header,
  .mission-panel > header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .brand > div,
  .conversation-header > div,
  .mission-panel > header > div {
    flex: 1 1 0;
  }

  .brand-controls,
  .conversation-status {
    width: 100%;
    justify-content: flex-start;
  }

  .conversation-status {
    align-items: flex-start;
  }

  .conversation-status .canonical-context {
    flex: 1 1 170px;
  }

  .conversation-status > .status {
    flex: 0 1 auto;
  }

  .message-head {
    gap: 4px 6px;
  }

  .message-head strong,
  .message-head span {
    flex: 1 1 100%;
  }

  .message-action {
    margin-left: 0;
  }

  .rooms-panel {
    overflow: hidden;
  }

  .room-create {
    width: 100%;
    padding-right: 10px;
    padding-left: 10px;
  }

  .room-create button {
    justify-self: end;
  }

  .conversation-header h1,
  .conversation-header p,
  .conversation-status,
  .canonical-context strong,
  .canonical-context span:not(.status) {
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .activity-event,
  .activity-events {
    width: 100%;
    max-width: 100%;
  }
}

/* D9 visual falsifiers: keep the real Factory lifecycle in the first useful desktop scan. */
.initiative-artifacts-summary {
  min-width: 0;
  max-width: 100%;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

@media (min-width: 641px) {
  .initiative-panel {
    gap: 6px;
    padding: 8px 10px 9px;
  }

  .initiative-header h2 {
    font-size: 13px;
  }

  .initiative-summary,
  .factory-start-status {
    font-size: 10px;
    line-height: 1.3;
  }

  .initiative-objective,
  .initiative-section,
  .initiative-stage-wrap {
    padding: 7px;
  }

  .initiative-objective h3 {
    margin: 3px 0 2px;
    font-size: 11px;
  }

  .initiative-objective p {
    max-height: 2.6em;
    font-size: 10px;
    line-height: 1.3;
  }

  .initiative-meta-row {
    margin-top: 4px;
    gap: 5px;
    font-size: 10px;
  }

  .initiative-stage-wrap {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .initiative-stage-bar {
    margin-top: 4px;
    gap: 3px;
  }

  .initiative-stage {
    min-height: 38px;
    padding: 5px 3px;
  }

  .initiative-stage strong,
  .initiative-stage span {
    font-size: 10px;
  }

  .initiative-stage span {
    margin-top: 1px;
  }

  .initiative-two-column {
    gap: 5px;
  }

  .initiative-section-head {
    margin-bottom: 3px;
  }

  .initiative-section-head strong {
    font-size: 10px;
  }

  .initiative-council-summary,
  .initiative-dissent li,
  .initiative-action-status {
    font-size: 10px;
    line-height: 1.25;
  }

  .initiative-dissent {
    gap: 3px;
    margin-top: 4px;
    max-height: 24px;
  }

  .initiative-dissent li {
    padding: 3px 4px;
  }

  .initiative-dissent span {
    font-size: 10px;
  }

  .initiative-block .initiative-meta-row {
    margin-top: 0;
  }

  .initiative-block .initiative-artifacts-summary {
    max-height: 2.5em;
    margin-top: 3px;
  }

  .initiative-actions {
    gap: 4px;
    padding-top: 4px;
  }

  .initiative-actions button {
    min-height: 28px;
    padding: 4px 7px;
    font-size: 10px;
  }

  .factory-run-panel {
    gap: 5px;
    padding: 7px 10px 8px;
  }

  .factory-run-header h2 {
    font-size: 12px;
  }

  .factory-run-summary,
  .factory-run-empty {
    font-size: 10px;
    line-height: 1.25;
  }
}

@media (max-width: 640px) {
  .room-create {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .rooms {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .room-item {
    min-height: 48px;
    margin-bottom: 4px;
    padding: 6px 8px;
  }

  .room-item span {
    margin-top: 2px;
  }

  .brand-controls {
    min-width: 0;
    max-width: 100%;
  }

  .brand-controls > *,
  .account-control,
  .account-control > summary {
    min-width: 0;
    max-width: 100%;
  }

  .account-control > summary {
    overflow-wrap: anywhere;
  }

  .account-popover {
    width: min(300px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
  }

  .account-directory-row {
    grid-template-columns: 26px minmax(0, 1fr);
  }

  .account-directory-access {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
}

/* D10 narrow status integrity: keep operational words whole in a dedicated track. */
@media (max-width: 390px) {
  .system-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content max-content;
    align-items: start;
    column-gap: 6px;
    row-gap: 4px;
  }

  .system-summary::after {
    margin-left: 0;
    align-self: start;
  }

  .system-summary .status,
  .conversation-status .status,
  .activity-header .status,
      .truth-gap-header .status,
      .initiative-header .status,
      .factory-run-header .status,
      .status,
      body .truth-fact .status,
      body .initiative-block .initiative-meta-row > .status {
        min-width: max-content;
        max-width: max-content;
        white-space: nowrap;
        overflow-wrap: normal;
        word-break: keep-all;
  }

  .initiative-stage strong,
      .initiative-stage span,
      .account-control,
      .account-control > summary,
      .account-username {
        overflow-wrap: normal;
        word-break: keep-all;
        text-overflow: clip;
      }
}

/* LACUNA AAA polish: keep the Factory checkpoint scannable in the fixed right rail. */
.factory-run-panel .factory-run-summary,
.factory-run-panel .factory-run-empty,
.factory-run-panel .factory-run-state,
.factory-run-panel .factory-run-label,
.factory-run-panel .factory-run-value,
.factory-run-panel .factory-run-checkpoint-head strong,
.factory-run-panel .factory-run-header-cell .factory-run-value,
.factory-run-panel .status {
  font-size: 11px !important;
}

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

.factory-run-checkpoint-head {
  grid-column: 1 / -1;
}

.factory-run-checkpoint > .factory-run-field {
  min-width: 0;
  overflow-wrap: anywhere;
}

.initiative-actions button:disabled,
.initiative-actions button[aria-disabled="true"] {
  border-color: #4a5558 !important;
  background: #242c2e !important;
  color: #aab7b8 !important;
  box-shadow: none !important;
  cursor: not-allowed;
  opacity: 1;
}

.initiative-actions button:disabled:hover,
.initiative-actions button[aria-disabled="true"]:hover {
  border-color: #4a5558 !important;
  background: #242c2e !important;
  color: #aab7b8 !important;
}

/* LACUNA-D20: objective-bound brief, kept in the conversation scan path. */
.production-brief-card {
  max-width: 860px;
  margin: -4px 0 18px 44px;
  padding: 12px;
  border: 1px solid var(--workspace-line);
  border-left: 3px solid var(--workspace-amber);
  border-radius: 6px;
  background: #1a1d1e;
}

.production-brief-card > summary {
  cursor: pointer;
  list-style: none;
}

.production-brief-card > summary::-webkit-details-marker {
  display: none;
}

.production-brief-short-summary {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.production-brief-card:not([open]) .production-brief-understanding,
.production-brief-card:not([open]) .production-brief-form {
  display: none;
}

.production-brief-card[data-state="ready"] {
  border-left-color: var(--workspace-green);
}

.production-brief-heading,
.production-brief-field-head,
.production-brief-footer {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.production-brief-heading {
  align-items: flex-start;
}

.production-brief-kicker,
.production-brief-field-state,
.production-brief-status {
  color: var(--workspace-muted);
  font-size: 11px;
}

.production-brief-heading h3 {
  margin: 2px 0 0;
  font-size: 15px;
}

.production-brief-understanding {
  max-width: 720px;
  margin: 8px 0 12px;
  color: #d6ddd8;
  font-size: 13px;
  line-height: 1.42;
}

.production-brief-form {
  display: grid;
  gap: 10px;
}

.production-brief-checklist,
.production-brief-proposals {
  display: grid;
  min-width: 0;
  margin: 0;
  padding: 9px;
  border: 1px solid #363b3d;
  border-radius: 5px;
}

.production-brief-checklist {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.production-brief-checklist legend,
.production-brief-proposals legend {
  padding: 0 4px;
  color: var(--workspace-text);
  font-size: 12px;
  font-weight: 700;
}

.production-brief-checklist legend {
  grid-column: 1 / -1;
}

.production-brief-field,
.production-brief-proposal {
  display: grid;
  min-width: 0;
  gap: 5px;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: #151819;
}

.production-brief-field[data-state="complete"],
.production-brief-proposal[data-selected="true"] {
  border-color: #385442;
  background: #1b2520;
}

.production-brief-field-head {
  align-items: baseline;
}

.production-brief-field-head strong,
.production-brief-proposal strong {
  min-width: 0;
  color: var(--workspace-text);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.production-brief-field-state {
  flex: 0 0 auto;
  color: var(--workspace-amber);
  font-size: 10px;
  font-weight: 700;
}

.production-brief-field[data-state="complete"] .production-brief-field-state {
  color: var(--workspace-green);
}

.production-brief-field input {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 7px 8px;
  border: 1px solid #363b3d;
  border-radius: 4px;
  background: #111314;
  color: var(--workspace-text);
  font-size: 12px;
}

.production-brief-field input::placeholder {
  color: #7f8986;
}

.production-brief-proposals {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.production-brief-proposals legend {
  grid-column: 1 / -1;
}

.production-brief-proposal {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 7px;
}

.production-brief-proposal input {
  margin: 2px 0 0;
  accent-color: var(--workspace-blue);
}

.production-brief-proposal small {
  display: block;
  margin-top: 3px;
  color: var(--workspace-muted);
  font-size: 11px;
  line-height: 1.35;
}

.production-brief-footer {
  align-items: flex-start;
  flex-wrap: wrap;
}

.production-brief-status {
  flex: 1 1 280px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.production-brief-submit {
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 4px;
  font-size: 12px;
}

.production-brief-submit:disabled,
.production-brief-submit[aria-disabled="true"] {
  border-color: #4a5558;
  background: #242c2e;
  color: #aab7b8;
  cursor: not-allowed;
  opacity: 1;
}

@media (max-width: 760px) {
  .production-brief-card {
    margin: -2px 0 14px;
    padding: 10px;
  }

  .production-brief-checklist,
  .production-brief-proposals {
    grid-template-columns: 1fr;
  }

  .production-brief-checklist legend,
  .production-brief-proposals legend {
    grid-column: 1;
  }
}

@media (max-width: 640px) {
  .factory-run-checkpoint {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .factory-run-checkpoint-head {
    grid-column: 1 / -1;
  }
}

.history-mode {
  border-top: 1px solid var(--workspace-line);
  background: #131516;
}

.history-toggle {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--workspace-text);
  text-align: left;
}

.history-toggle:hover:not(:disabled) {
  background: var(--workspace-soft);
}

.history-toggle > span:first-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.history-toggle strong {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.history-panel {
  display: grid;
  max-height: 250px;
  gap: 7px;
  padding: 0 9px 10px;
  overflow-y: auto;
}

.history-summary,
.history-empty {
  margin: 0;
  color: var(--workspace-muted);
  font-size: 11px;
  line-height: 1.35;
}

.history-list {
  display: grid;
  gap: 4px;
}

.history-item {
  display: grid;
  min-width: 0;
  gap: 3px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: #1b1e1f;
  color: var(--workspace-text);
  text-align: left;
}

.history-item:hover:not(:disabled),
.history-item.active {
  border-color: #385442;
  background: #1b2520;
}

.history-item strong,
.history-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.history-item strong {
  font-size: 12px;
}

.history-item span {
  color: var(--workspace-muted);
  font-size: 10px;
}

.history-detail-panel {
  display: grid;
  gap: 9px;
  margin: 0 12px 12px;
  padding: 11px 12px;
  border: 1px solid var(--workspace-line);
  border-left: 3px solid var(--workspace-blue);
  border-radius: 5px;
  background: #1a1d1e;
}

.history-detail-panel[data-state="current"] {
  border-left-color: var(--workspace-green);
}

.history-detail-header {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.history-detail-header h2 {
  max-width: 260px;
  margin: 2px 0 0;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.history-detail-body {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.history-detail-objective,
.history-detail-brief {
  margin: 0;
  color: #d6ddd8;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.history-detail-brief {
  color: var(--workspace-muted);
}

.history-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.history-fact {
  display: grid;
  min-width: 0;
  gap: 2px;
  padding: 6px 7px;
  border: 1px solid #363b3d;
  border-radius: 4px;
  background: #151819;
}

.history-fact span {
  color: var(--workspace-muted);
  font-size: 10px;
}

.history-fact strong,
.history-fact code {
  min-width: 0;
  color: var(--workspace-text);
  font-size: 11px;
  overflow-wrap: anywhere;
  white-space: normal;
}

@media (max-width: 760px) {
  .history-detail-panel {
    margin: 0 10px 10px;
  }

  .history-facts {
    grid-template-columns: 1fr;
  }
}

.calculator-panel {
  display: grid;
  gap: 9px;
  margin: 0 12px 12px;
  padding: 11px 12px;
  border: 1px solid var(--workspace-line);
  border-left: 3px solid var(--workspace-blue);
  border-radius: 5px;
  background: #171a1b;
}

.calculator-panel[data-state="error"] {
  border-left-color: var(--workspace-red);
}

.calculator-header,
.calculator-actions {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.calculator-header h2 {
  margin: 2px 0 0;
  font-size: 14px;
}

.calculator-form {
  display: grid;
  gap: 7px;
}

.calculator-expression {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--workspace-line-bright);
  border-radius: 4px;
  background: #101212;
  color: var(--workspace-text);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 14px;
}

.calculator-result {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #385442;
  border-radius: 4px;
  background: #1b2520;
  color: var(--workspace-green);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 17px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.calculator-error {
  margin: 0;
  color: var(--workspace-red);
  font-size: 11px;
  line-height: 1.35;
}

.calculator-keypad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.calculator-key {
  min-width: 0;
  min-height: 34px;
  padding: 5px;
  border-color: var(--workspace-line);
  background: var(--workspace-soft);
  color: var(--workspace-text);
  font-size: 13px;
}

.calculator-key:hover:not(:disabled) {
  border-color: var(--workspace-blue);
  background: #29333a;
}

.calculator-key[data-calculator-input="÷"],
.calculator-key[data-calculator-input="×"],
.calculator-key[data-calculator-input="−"],
.calculator-key[data-calculator-input="="] {
  color: var(--workspace-blue);
}

.calculator-clear,
.calculator-actions button[type="submit"] {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 11px;
}

.calculator-clear {
  border-color: var(--workspace-line);
  background: transparent;
  color: var(--workspace-muted);
}

.calculator-history-wrap {
  display: grid;
  gap: 5px;
  border-top: 1px solid var(--workspace-line);
  padding-top: 8px;
}

.calculator-history {
  display: grid;
  max-height: 120px;
  gap: 3px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.calculator-history li {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 3px;
  background: #151819;
  color: var(--workspace-muted);
  font-size: 11px;
}

.calculator-history-empty {
  color: var(--workspace-muted);
  font-style: italic;
}

.calculator-history code {
  min-width: 0;
  overflow-wrap: anywhere;
}

.calculator-history strong {
  flex: 0 0 auto;
  color: var(--workspace-text);
}

@media (max-width: 760px) {
  .calculator-panel {
    margin: 0 10px 10px;
  }

  .calculator-key {
    min-height: 40px;
  }
}
