:root {
  --workspace-bg: #101212;
  --workspace-panel: #151718;
  --workspace-raised: #1c1f20;
  --workspace-soft: #242829;
  --workspace-line: #363b3d;
  --workspace-line-bright: #535a5d;
  --workspace-text: #f2f4f1;
  --workspace-muted: #a7aeac;
  --workspace-green: #58c77a;
  --workspace-blue: #66a6ff;
  --workspace-amber: #efb657;
  --workspace-red: #e77972;
}

html,
body {
  background: var(--workspace-bg);
  color: var(--workspace-text);
  font-size: 14px;
}

body,
body * {
  letter-spacing: 0 !important;
}

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

button,
input,
select,
textarea {
  border-color: var(--workspace-line);
  border-radius: 5px;
  background: var(--workspace-raised);
  color: var(--workspace-text);
}

button {
  border-color: #39794d;
  background: #28613a;
}

button:hover:not(:disabled) {
  border-color: #4b9b64;
  background: #34794a;
}

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

.shell {
  grid-template-columns: 272px minmax(520px, 1fr) 410px;
  background: var(--workspace-bg);
}

.rooms-panel,
.conversation,
.mission-panel {
  background: var(--workspace-panel);
}

.rooms-panel {
  border-right-color: var(--workspace-line);
}

.mission-panel {
  border-left: 1px solid var(--workspace-line);
}

.brand,
.conversation-header,
.mission-panel > header {
  min-height: 72px;
  padding: 13px 16px;
  border-bottom-color: var(--workspace-line);
  background: #131516;
}

.brand {
  justify-content: flex-start;
  gap: 8px;
}

.brand-lockup {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.brand-lockup > div {
  min-width: 0;
}

.brand-lockup > div > span {
  display: none;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 1px solid #467957;
  border-radius: 6px;
  background: #1d2d23;
  color: var(--workspace-green);
  font-size: 16px;
  font-weight: 800;
}

.brand strong {
  color: var(--workspace-text);
  font-size: 15px;
}

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

.brand-controls {
  margin-left: auto;
}

.rooms-toolbar {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--workspace-line);
}

.rooms-toolbar-head,
.workspace-title-row,
.factory-heading-row,
.composer-context {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rooms-toolbar-head strong {
  font-size: 12px;
}

.rooms-toolbar-head span {
  color: var(--workspace-muted);
  font-size: 12px;
}

.room-search {
  position: relative;
}

.room-search input {
  padding: 9px 10px 9px 32px;
  background: #1b1e1f;
  font-size: 13px;
}

.room-search::before {
  position: absolute;
  top: 50%;
  left: 11px;
  color: var(--workspace-muted);
  content: "\2315";
  font-size: 15px;
  transform: translateY(-50%);
}

.room-create {
  padding: 0;
  border: 0;
}

.rooms {
  padding: 7px 8px 14px;
}

.room-item {
  position: relative;
  min-height: 58px;
  margin-bottom: 3px;
  padding: 9px 10px 9px 14px;
  border-radius: 5px;
}

.room-item::before {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 5px;
  width: 2px;
  border-radius: 2px;
  background: transparent;
  content: "";
}

.room-item.active {
  border-color: #3a4541;
  background: #202523;
}

.room-item.active::before {
  background: var(--workspace-green);
}

.rooms-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-top: 1px solid var(--workspace-line);
  color: var(--workspace-muted);
  font-size: 12px;
}

.rooms-footer::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--workspace-green);
  content: "";
  box-shadow: 0 0 0 3px rgb(88 199 122 / 12%);
}

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

.conversation-header {
  display: grid;
  grid-template-areas:
    "heading stages actions"
    "heading status actions";
  grid-template-columns: minmax(160px, 0.7fr) minmax(250px, 1.3fr) 76px;
  align-items: stretch;
  gap: 8px 14px;
}

.workspace-heading {
  display: grid;
  grid-area: heading;
  min-width: 0;
  align-content: center;
  gap: 3px;
}

.workspace-title-row {
  display: grid;
  justify-items: start;
  gap: 5px;
}

.workspace-title-row h1 {
  width: 100%;
  margin: 0;
  overflow: hidden;
  font-size: 18px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-summary {
  max-width: 620px;
  overflow: hidden;
  color: var(--workspace-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-actions {
  display: flex;
  grid-area: actions;
  align-items: center;
  align-self: stretch;
  gap: 7px;
}

.workspace-mode-toggle {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border-color: var(--workspace-line);
  background: transparent;
  color: var(--workspace-muted);
  font-size: 11px;
  white-space: nowrap;
}

.workspace-mode-toggle.active,
.workspace-mode-toggle:hover:not(:disabled) {
  border-color: #467957;
  background: #1d2d23;
  color: var(--workspace-text);
}

@media (min-width: 761px) {
  .shell[data-workspace-mode="simple"] {
    grid-template-columns: 272px minmax(520px, 1fr);
  }

  .shell[data-workspace-mode="simple"] .mission-panel,
  .shell[data-workspace-mode="simple"] .council-presence,
  .shell[data-workspace-mode="simple"] .system-area,
  .shell[data-workspace-mode="simple"] .activity-timeline {
    display: none;
  }

  .shell[data-workspace-mode="simple"] .conversation-status,
  .shell[data-workspace-mode="simple"] .workspace-heading > p {
    display: none;
  }

  .shell[data-workspace-mode="simple"] .conversation {
    grid-column: 2;
  }
}

.workspace-icon-button {
  display: grid;
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  place-items: center;
  padding: 0;
  border-color: var(--workspace-line);
  background: transparent;
  color: var(--workspace-muted);
  font-size: 18px;
}

.workspace-icon-button:hover:not(:disabled) {
  border-color: var(--workspace-line-bright);
  background: var(--workspace-soft);
  color: var(--workspace-text);
}

.workspace-stage-rail {
  display: grid;
  grid-area: stages;
  min-width: 0;
  align-content: center;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
}

.conversation-status {
  grid-area: status;
  flex-wrap: nowrap;
  justify-content: flex-start;
}

.canonical-context {
  flex: 1 1 auto;
  max-width: none;
  text-align: left;
}

.canonical-context > .status,
.conversation-status > .status {
  min-width: 64px;
  white-space: nowrap;
}

.workspace-stage {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 6px;
  color: var(--workspace-muted);
  font-size: 11px;
  font-weight: 650;
  text-align: center;
}

.workspace-stage::before {
  height: 3px;
  border-radius: 2px;
  background: var(--workspace-line);
  content: "";
}

.workspace-stage[data-state="DONE"] {
  color: #b9d8c2;
}

.workspace-stage[data-state="DONE"]::before {
  background: #397a4d;
}

.workspace-stage[data-state="CURRENT"] {
  color: var(--workspace-text);
}

.workspace-stage[data-state="CURRENT"]::before {
  background: var(--workspace-amber);
  box-shadow: 0 0 0 2px rgb(239 182 87 / 12%);
}

.council-presence {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 7px 16px 8px;
  border-bottom: 1px solid var(--workspace-line);
  background: #151718;
}

.council-label {
  display: grid;
  gap: 2px;
}

.council-label strong {
  font-size: 12px;
}

.council-label span {
  color: var(--workspace-muted);
  font-size: 11px;
}

.council-roster {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(7, minmax(72px, 1fr));
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.council-seat {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 3px;
  padding: 2px 3px;
  border: 1px solid transparent;
  border-radius: 5px;
}

.council-seat[data-state="WORKING"],
.council-seat[data-state="TERMINAL"] {
  border-color: #385442;
  background: #1b2520;
}

.council-seat[data-state="CONTRIBUTED"] {
  border-color: #3e4f63;
  background: #1c2228;
}

.council-avatar {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  place-items: center;
  border: 1px solid #3b4a47;
  border-radius: 50%;
  background: #242a28;
  color: #d9e3df;
  font-size: 11px;
  font-weight: 800;
}

.council-seat[data-state="WORKING"] .council-avatar {
  border-color: #4c8f62;
  color: var(--workspace-green);
}

.council-seat[data-state="TERMINAL"] .council-avatar {
  border-color: #5d8dc8;
  color: var(--workspace-blue);
}

.council-identity {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.council-identity strong,
.council-identity span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.council-identity strong {
  font-size: 12px;
}

.council-identity span {
  color: var(--workspace-muted);
  font-size: 11px;
}

.system-area {
  border-bottom-color: var(--workspace-line);
  background: #131516;
}

.system-summary {
  min-height: 42px;
  padding: 7px 16px;
}

.messages {
  padding: 18px clamp(16px, 3vw, 34px);
  background: #17191a;
}

.message {
  display: grid;
  max-width: 860px;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 16px;
  padding: 0;
  border: 0;
  background: transparent;
}

.message-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #424a49;
  border-radius: 50%;
  background: #242829;
  color: #dfe5e2;
  font-size: 11px;
  font-weight: 800;
}

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

.message-head {
  min-height: 24px;
  align-items: center;
}

.message-head strong {
  font-size: 13px;
}

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

.message-body {
  margin: 2px 0 0;
  color: #e6e9e5;
  font-size: 14px;
  line-height: 1.48;
}

.message[data-kind="objective"] .message-main {
  padding: 10px 12px;
  border-left: 2px solid var(--workspace-amber);
  background: #1d1d19;
}

.activity-timeline {
  max-height: 150px;
  padding: 9px 16px;
  border-top: 1px solid var(--workspace-line);
  border-bottom: 1px solid var(--workspace-line);
  background: #131516;
  overflow-y: auto;
}

.activity-header h2,
.activity-summary {
  font-size: 12px;
}

.activity-events {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

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

.composer {
  display: grid;
  gap: 8px;
  padding: 11px 16px 13px;
  border-top: 1px solid var(--workspace-line);
  background: #131516;
}

.composer-context {
  justify-content: flex-start;
  color: var(--workspace-muted);
  font-size: 11px;
}

.composer-context strong {
  color: var(--workspace-text);
}

.composer-main {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr) 84px;
  align-items: end;
  gap: 8px;
}

.composer select,
.composer textarea,
.composer button {
  min-height: 42px;
}

.composer textarea {
  max-height: 140px;
  resize: none;
}

.mission-panel {
  scrollbar-color: var(--workspace-line-bright) transparent;
}

.mission-panel > header {
  position: sticky;
  top: 0;
  z-index: 4;
}

.factory-heading-row h2 {
  margin: 0;
  font-size: 16px;
}

.workspace-decision {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid var(--workspace-line);
  border-radius: 4px;
  color: var(--workspace-muted);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.workspace-decision[data-state="approved"] {
  border-color: #447a54;
  background: #1c2a20;
  color: var(--workspace-green);
}

.workspace-decision[data-state="pending"] {
  border-color: #806b42;
  background: #2a251b;
  color: var(--workspace-amber);
}

.workspace-decision[data-state="rejected"] {
  border-color: #834a46;
  background: #2b1e1d;
  color: var(--workspace-red);
}

.initiative-panel,
.factory-run-panel,
.evidence-drawer,
.mission-tools {
  border-bottom-color: var(--workspace-line);
  background: transparent;
}

.initiative-panel,
.factory-run-panel {
  padding: 12px 14px;
}

.initiative-header h2,
.factory-run-header h2 {
  font-size: 14px;
}

.initiative-summary,
.factory-start-status,
.factory-run-summary,
.initiative-council-summary,
.initiative-action-status,
.initiative-artifacts-summary,
.factory-run-empty,
.factory-run-label,
.factory-run-value,
.factory-run-state,
body .status {
  font-size: 12px !important;
  line-height: 1.35;
}

.initiative-objective,
.initiative-section,
.initiative-stage-wrap {
  border-color: var(--workspace-line);
  border-radius: 5px;
  background: #1a1d1e;
}

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

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

.initiative-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 0 -14px -12px;
  padding: 10px 14px;
  border-top: 1px solid var(--workspace-line);
  background: rgb(19 21 22 / 96%);
  backdrop-filter: blur(8px);
}

.initiative-action-buttons button {
  min-height: 34px;
  font-size: 12px;
}

.factory-run-lane {
  border-color: var(--workspace-line);
  background: #1a1d1e;
}

.factory-run-lane[data-state="LEASED"],
.factory-run-lane[data-state="ASSIGNED"] {
  border-left: 2px solid var(--workspace-blue);
}

.factory-run-lane[data-state="TERMINAL"] {
  border-left: 2px solid var(--workspace-green);
}

.evidence-drawer {
  background: #111314;
}

.mobile-workspace-nav {
  display: none;
}

@media (max-width: 1280px) and (min-width: 761px) {
  .conversation-header {
    grid-template-columns: minmax(190px, 0.9fr) minmax(250px, 1.1fr) 76px;
  }

  .workspace-title-row h1 {
    line-height: 1.15;
    white-space: normal;
  }

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

  .council-label {
    display: none;
  }

  .council-roster {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
  }

  .council-seat {
    gap: 2px;
    padding: 2px;
  }
}

@media (max-width: 1180px) and (min-width: 761px) {
  .shell {
    grid-template-columns: 226px minmax(440px, 1fr) 350px;
  }

  .council-label {
    display: none;
  }

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

  .council-identity span {
    display: none;
  }
}

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

  .shell {
    display: block;
    height: calc(100dvh - 62px);
  }

  .rooms-panel,
  .conversation,
  .mission-panel {
    display: none;
    width: 100%;
    height: 100%;
    border: 0;
  }

  .shell[data-mobile-pane="rooms"] .rooms-panel,
  .shell[data-mobile-pane="council"] .conversation,
  .shell[data-mobile-pane="activity"] .conversation,
  .shell[data-mobile-pane="factory"] .mission-panel {
    display: flex;
  }

  .shell[data-mobile-pane="council"] .conversation,
  .shell[data-mobile-pane="activity"] .conversation {
    display: grid;
  }

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

  .conversation-header {
    display: grid;
    grid-template-areas:
      "heading actions"
      "stages stages";
    grid-template-columns: minmax(0, 1fr) 76px;
    min-height: auto;
    gap: 10px;
    padding: 11px 12px;
  }

  .workspace-title-row h1 {
    font-size: 16px;
  }

  .workspace-summary {
    max-width: calc(100vw - 110px);
  }

  .workspace-stage-rail {
    min-width: 0;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .workspace-stage {
    font-size: 11px;
  }

  .conversation-status {
    display: none;
  }

  .council-presence {
    display: block;
    padding: 8px 10px;
    overflow-x: auto;
  }

  .council-label {
    display: none;
  }

  .council-roster {
    width: max-content;
    min-width: 100%;
    grid-template-columns: repeat(7, minmax(78px, 1fr));
  }

  .system-summary {
    padding: 7px 12px;
  }

  .messages {
    padding: 14px 12px;
  }

  .activity-timeline {
    max-height: 125px;
  }

  .composer {
    padding: 9px 10px 10px;
  }

  .composer-main {
    grid-template-columns: 98px minmax(0, 1fr) 64px;
  }

  .composer-context {
    display: none;
  }

  .shell[data-mobile-pane="activity"] .council-presence,
  .shell[data-mobile-pane="activity"] .system-area,
  .shell[data-mobile-pane="activity"] .messages,
  .shell[data-mobile-pane="activity"] .composer {
    display: none;
  }

  .shell[data-mobile-pane="activity"] .conversation {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .shell[data-mobile-pane="activity"] .activity-timeline {
    display: block;
    max-height: none;
    overflow-y: auto;
  }

  .mission-panel {
    overflow-y: auto;
  }

  .mobile-workspace-nav {
    position: fixed;
    z-index: 50;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    height: 62px;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid var(--workspace-line);
    background: #111314;
  }

  .mobile-workspace-nav button {
    display: grid;
    min-width: 0;
    min-height: 62px;
    place-items: center;
    gap: 2px;
    padding: 6px 3px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--workspace-muted);
    font-size: 11px;
  }

  .mobile-workspace-nav button span:first-child {
    font-size: 18px;
    line-height: 1;
  }

  .mobile-workspace-nav button.active {
    color: var(--workspace-green);
    box-shadow: inset 0 2px var(--workspace-green);
  }
}

@media (max-width: 390px) {
  .workspace-stage {
    font-size: 11px;
  }

  .composer-main {
    grid-template-columns: 80px minmax(0, 1fr) 84px;
  }

  .composer-main button {
    padding: 6px;
  }
}

@media (max-width: 760px) {
  .shell[data-workspace-mode="simple"] .council-presence,
  .shell[data-workspace-mode="simple"] .system-area,
  .shell[data-workspace-mode="simple"] .activity-timeline,
  .shell[data-workspace-mode="simple"] .mobile-workspace-nav button[data-mobile-pane="factory"],
  .shell[data-workspace-mode="simple"] .mobile-workspace-nav button[data-mobile-pane="activity"] {
    display: none;
  }

  .shell[data-workspace-mode="simple"] .conversation {
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }

  .shell[data-workspace-mode="simple"] .mobile-workspace-nav {
    grid-template-columns: repeat(2, 1fr);
  }
}
