:root {
  color-scheme: light;
  --bg: #f5f6f1;
  --ink: #18201d;
  --muted: #65706a;
  --line: #cfd8d0;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-2: #8a4f18;
  --danger: #9f1239;
  --builder: #2f4f8f;
  --explorer: #0f766e;
  --saved: #5b5f1f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  min-height: 36px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  border-radius: 6px;
  padding: 0 12px;
  cursor: pointer;
}

button.secondary {
  background: white;
  color: var(--ink);
  border-color: var(--line);
}

select,
textarea {
  font: inherit;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: white;
  color: var(--ink);
}

#app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #eef2ed;
  padding: 18px;
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: white;
  font-weight: 800;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 20px;
}

h2 {
  font-size: 24px;
}

h3 {
  font-size: 16px;
}

p {
  margin: 4px 0 0;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.create-button {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--builder);
  color: white;
  font-weight: 800;
  text-decoration: none;
  margin-bottom: 12px;
}

.top-create {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--builder);
  color: white;
  font-weight: 800;
  padding: 0 12px;
  text-decoration: none;
  white-space: nowrap;
}

.side-section {
  margin-top: 20px;
}

.nav-group summary {
  cursor: pointer;
  list-style: none;
}

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

.nav-group summary::after {
  content: "collapse";
  float: right;
  font-size: 10px;
  opacity: 0.72;
  text-transform: none;
  letter-spacing: 0;
}

.nav-group:not([open]) summary::after {
  content: "open";
}

.section-title,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.mode-title {
  padding: 8px 10px;
  border-radius: 8px;
  color: white;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.explorer-title {
  background: var(--explorer);
}

.builder-title {
  background: var(--builder);
}

.saved-title {
  background: var(--saved);
}

.table-list {
  display: grid;
  gap: 6px;
}

.table-button {
  width: 100%;
  min-height: 42px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  color: var(--ink);
  border-color: var(--line);
}

.table-button.active {
  border-color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent);
}

.saved-view-button.active {
  border-color: var(--saved);
  box-shadow: inset 4px 0 0 var(--saved);
}

.helper-link {
  text-decoration: none;
}

.builder-surface {
  background: #090c0b;
  color: white;
}

.mance-chat-surface {
  min-height: 100vh;
  background: #0b0f0e;
  color: white;
}

.mance-chat-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px;
  gap: 14px;
}

.mance-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #28332f;
  padding-bottom: 14px;
}

.mance-chat-header h1 {
  font-size: 28px;
}

.mance-chat-header p,
.mance-chat-surface .eyebrow {
  color: #9fb0aa;
}

.mance-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.secondary-link {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #33413d;
  border-radius: 8px;
  padding: 0 12px;
  color: white;
  text-decoration: none;
  background: #121916;
}

.mance-status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px;
}

.mance-status-strip div {
  min-height: 70px;
  display: grid;
  gap: 5px;
  align-content: center;
  border: 1px solid #33413d;
  border-radius: 8px;
  background: #121916;
  padding: 10px;
}

.mance-status-strip span {
  color: #9fb0aa;
  font-size: 13px;
}

.mance-messages {
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
  padding: 8px 0 18px;
}

.mance-message {
  width: min(780px, 100%);
  border: 1px solid #33413d;
  border-radius: 8px;
  background: #121916;
  padding: 14px;
}

.mance-message.user {
  justify-self: end;
  background: #12332f;
  border-color: #16645c;
}

.mance-message.assistant {
  justify-self: start;
}

.mance-message.pending {
  opacity: 0.78;
}

.mance-message p {
  margin-top: 8px;
  color: #ecf4f1;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.error-message {
  border-color: #b91c1c;
}

.mance-run-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.mance-run-meta span {
  border: 1px solid #33413d;
  border-radius: 999px;
  padding: 4px 8px;
  color: #9fb0aa;
  font-size: 12px;
}

.mance-composer {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 92px;
  gap: 8px;
  align-items: end;
  border: 1px solid #33413d;
  border-radius: 10px;
  background: #121916;
  padding: 10px;
}

.mance-composer textarea {
  width: 100%;
  min-height: 76px;
  max-height: 180px;
  resize: vertical;
  border: 1px solid #33413d;
  border-radius: 8px;
  background: #090d0c;
  color: white;
  padding: 10px;
}

.mic-button {
  height: 76px;
  background: #1f2937;
  border-color: #405065;
}

.mic-button.recording {
  background: #8b1e2d;
  border-color: #f87171;
}

.mance-session-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #9fb0aa;
  font-size: 13px;
}

.mance-session-bar code {
  color: white;
  overflow-wrap: anywhere;
}

.mance-session-bar label {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mance-session-bar input {
  width: auto;
  min-height: auto;
}

.builder-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.builder-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid #2b3431;
  background: #101412;
}

.builder-topbar h1 {
  font-size: 22px;
}

.builder-select {
  min-height: 36px;
  border: 1px solid #394541;
  border-radius: 8px;
  padding: 0 10px;
  background: #171d1a;
  color: white;
}

.builder-workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr) 360px;
}

.thread-pane,
.execution-pane {
  border-right: 1px solid #2b3431;
  background: #121816;
  padding: 14px;
  overflow: auto;
}

.execution-pane {
  border-right: 0;
  border-left: 1px solid #2b3431;
}

.hidden-pane {
  display: none;
}

.pane-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.thread-messages {
  display: grid;
  gap: 8px;
}

.thread-compose {
  position: sticky;
  bottom: 0;
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  background: #121816;
}

.thread-compose textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid #394541;
  border-radius: 8px;
  background: #0c100f;
  color: white;
  padding: 10px;
}

.canvas-pane {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: #070908;
}

.node-palette {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  padding: 10px 12px;
  border-bottom: 1px solid #2b3431;
  background: #101412;
}

.node-palette button {
  white-space: nowrap;
  background: #1b2421;
  border-color: #35423e;
}

.visual-canvas {
  position: relative;
  min-height: 720px;
  overflow: auto;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.075) 1px, transparent 1px),
    #070908;
  background-size: 22px 22px;
}

.canvas-node {
  position: absolute;
  width: 180px;
  min-height: 68px;
  display: grid;
  gap: 4px;
  border: 1px solid #3a4642;
  border-radius: 10px;
  background: #171d1a;
  color: white;
  padding: 12px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}

.canvas-node span {
  color: #a9b8b1;
  font-size: 12px;
}

.start-node,
.database-node,
.r2-node,
.vector-node {
  border-color: #58c7a2;
}

.instruction-node,
.airtable-node {
  border-color: #d4a72c;
}

.worker-node,
.agent-node {
  border-color: #7fa7ff;
}

.approval-node {
  border-color: #f59e0b;
}

.main {
  padding: 20px;
  min-width: 0;
}

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

.toolbar-actions,
.table-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-actions {
  width: min(560px, 55vw);
}

.search {
  min-width: 180px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  overflow: auto;
}

.mode-band {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.explorer-band {
  background: #ecfdf5;
  border-color: #99d4bd;
}

.builder-band {
  background: #eef4ff;
  border-color: #abc4f3;
}

.hidden {
  display: none;
}

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

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.cockpit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  gap: 14px;
  margin-top: 14px;
}

.stack {
  display: grid;
  gap: 12px;
}

.mini-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfa;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  min-height: 82px;
}

.metric strong {
  display: block;
  font-size: 24px;
  margin-top: 6px;
}

.metric.good {
  border-color: #8bbf9f;
  background: #f0fdf4;
}

.metric.warn {
  border-color: #d6b36c;
  background: #fffbeb;
}

.metric.bad {
  border-color: #e5a3ad;
  background: #fff1f2;
}

.health-list {
  display: grid;
  gap: 8px;
}

.health-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.bar {
  height: 9px;
  border-radius: 999px;
  background: #e6ece7;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.bar.warn span {
  background: #b7791f;
}

.bar.bad span {
  background: var(--danger);
}

.graph-box {
  position: relative;
  min-height: 290px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(#e9efe9 1px, transparent 1px),
    linear-gradient(90deg, #e9efe9 1px, transparent 1px),
    #fbfcfa;
  background-size: 28px 28px;
}

.graph-line {
  position: absolute;
  height: 2px;
  transform-origin: left center;
  background: #9aa79f;
}

.graph-node {
  position: absolute;
  width: 112px;
  min-height: 54px;
  display: grid;
  place-items: center;
  padding: 8px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: white;
  text-align: center;
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.graph-node.focus {
  border-color: var(--accent-2);
  background: #fff7ed;
  font-weight: 800;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 9px;
  background: white;
  font-size: 12px;
  color: var(--muted);
}

.pill.good {
  border-color: #8bbf9f;
  color: #166534;
}

.pill.warn {
  border-color: #d6b36c;
  color: #92400e;
}

.semantic-result {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
  margin-top: 8px;
}

.saved-view-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}

.saved-view-grid aside,
.saved-view-grid section {
  display: grid;
  gap: 8px;
}

.log-card,
.compact-log-card {
  width: 100%;
  height: auto;
  min-height: 0;
  display: block;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 10px;
}

.log-card:hover,
.compact-log-card:hover {
  border-color: var(--accent);
  background: #fbfffd;
}

.log-card p {
  margin-top: 8px;
  color: var(--ink);
  white-space: normal;
  overflow-wrap: anywhere;
}

.log-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.log-card-head strong {
  color: var(--ink);
  text-transform: capitalize;
}

.compact-log-card {
  display: grid;
  gap: 5px;
}

.compact-log-card span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

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

.flow-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px;
  align-items: stretch;
  margin-top: 10px;
}

.flow-step {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
  min-height: 150px;
}

.flow-step::after {
  content: ">";
  position: absolute;
  right: -12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 800;
}

.flow-step:last-child::after {
  display: none;
}

.step-number {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  font-size: 12px;
  margin-bottom: 8px;
}

.config-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.config-row {
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr) 84px;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: white;
  font-size: 13px;
}

.ops-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
  min-height: 98px;
}

.ops-card strong {
  display: block;
  margin-bottom: 4px;
}

.run-list {
  display: grid;
  gap: 8px;
}

.run-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 86px 82px;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 7px;
  font-size: 13px;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}

.status-dot.warn::before {
  background: #b7791f;
}

.status-dot.bad::before {
  background: var(--danger);
}

.score {
  color: var(--accent);
  font-weight: 800;
}

.records {
  margin-top: 12px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}

tr {
  cursor: pointer;
}

tr:hover td {
  background: #f0fdfa;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(520px, 100vw);
  height: 100vh;
  transform: translateX(105%);
  transition: transform 160ms ease;
  background: white;
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.12);
  padding: 18px;
  overflow: auto;
  z-index: 10;
}

.drawer.open {
  transform: translateX(0);
}

.moxai-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(620px, 100vw);
  height: 100vh;
  transform: translateX(105%);
  transition: transform 160ms ease;
  background: #0f1513;
  color: white;
  border-left: 1px solid #33413d;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.22);
  padding: 18px;
  overflow: auto;
  z-index: 20;
}

.moxai-panel.open {
  transform: translateX(0);
}

.moxai-panel p,
.moxai-panel .muted,
.moxai-panel .eyebrow {
  color: #a8b8b2;
}

.moxai-context,
.moxai-messages {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.context-card,
.message-card {
  border: 1px solid #33413d;
  border-radius: 8px;
  background: #18211e;
  padding: 10px;
}

.context-card code,
.message-card code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.moxai-compose {
  position: sticky;
  bottom: 0;
  display: grid;
  gap: 8px;
  background: #0f1513;
  padding-top: 12px;
  margin-top: 14px;
}

.moxai-compose textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  border: 1px solid #33413d;
  border-radius: 8px;
  padding: 10px;
  background: #111a17;
  color: white;
  font: inherit;
}

.close {
  float: right;
  width: 36px;
  padding: 0;
  background: white;
  border-color: var(--line);
  color: var(--ink);
}

.kv {
  display: grid;
  grid-template-columns: minmax(120px, 190px) minmax(0, 1fr);
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  gap: 12px;
  font-size: 13px;
}

.kv code {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.highlight {
  color: var(--accent-2);
  font-weight: 700;
}

.search-group {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.result {
  width: 100%;
  text-align: left;
  background: white;
  color: var(--ink);
  border-color: var(--line);
  min-height: 54px;
  margin-top: 8px;
}

.error {
  color: var(--danger);
  white-space: pre-wrap;
}

.mance-app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 0;
  background: #f7f7f4;
  color: #1f2623;
}

.mance-app-shell:has(.cowork-panel.open) {
  grid-template-columns: 72px minmax(0, 1fr) 390px;
}

.mance-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border-right: 1px solid #d7ddd8;
  background: #ffffff;
  padding: 14px 10px;
}

.mance-logo,
.rail-button {
  width: 46px;
  min-height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid #d7ddd8;
  border-radius: 12px;
  background: #ffffff;
  color: #1f2623;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.mance-logo {
  background: #111816;
  color: white;
  border-color: #111816;
  font-size: 18px;
}

.rail-button.active,
.rail-button:hover {
  border-color: #0f766e;
  color: #0f766e;
}

.mance-main {
  min-width: 0;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
}

.mance-topbar {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 24px;
  border-bottom: 1px solid #d7ddd8;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
}

.mance-title-group {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.mance-title-group h1 {
  font-size: 20px;
}

.mance-title-group span {
  color: #66726c;
  font-size: 13px;
}

.mance-mode-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  border: 1px solid #d7ddd8;
  border-radius: 999px;
  background: #ffffff;
  padding: 4px;
}

.mode-chip {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #43504a;
  padding: 0 13px;
}

.mode-chip.active {
  background: #111816;
  color: white;
}

.mode-chip.voice.active {
  background: #0f766e;
}

.mance-chat-thread {
  width: min(900px, calc(100% - 32px));
  justify-self: center;
  display: grid;
  align-content: start;
  gap: 4px;
  overflow: auto;
  padding: 46px 0 28px;
}

.mance-empty-state {
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
  margin-top: min(18vh, 140px);
}

.mance-empty-state h2 {
  font-size: 34px;
}

.mance-empty-state p {
  max-width: 640px;
  color: #66726c;
  font-size: 16px;
}

.prompt-suggestions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: min(760px, 100%);
  margin-top: 8px;
}

.prompt-suggestions button {
  height: auto;
  min-height: 72px;
  text-align: left;
  border: 1px solid #d7ddd8;
  border-radius: 12px;
  background: #ffffff;
  color: #1f2623;
  padding: 12px;
}

.chat-message {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  padding: 18px 0;
}

.chat-message.user {
  background: transparent;
}

.avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #111816;
  color: white;
  font-size: 13px;
  font-weight: 800;
}

.chat-message.user .avatar {
  background: #0f766e;
}

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

.message-content strong {
  display: block;
  margin-top: 4px;
}

.message-body {
  margin-top: 8px;
  color: #1f2623;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.chat-message.pending .message-body {
  color: #66726c;
}

.mance-input-dock {
  width: min(900px, calc(100% - 32px));
  justify-self: center;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 62px;
  gap: 8px;
  align-items: end;
  border: 1px solid #cfd8d0;
  border-radius: 18px;
  background: #ffffff;
  padding: 8px;
  box-shadow: 0 18px 55px rgba(15, 23, 42, 0.09);
}

.mance-input-dock textarea {
  width: 100%;
  min-height: 46px;
  max-height: 180px;
  resize: none;
  border: 0;
  background: transparent;
  color: #1f2623;
  padding: 12px 4px;
  outline: none;
}

.chat-icon-button,
.send-button {
  min-height: 46px;
  border-radius: 12px;
}

.chat-icon-button {
  background: #f1f4f1;
  border-color: #d7ddd8;
  color: #1f2623;
  font-size: 12px;
}

.chat-icon-button.recording {
  background: #8b1e2d;
  color: white;
  border-color: #8b1e2d;
}

.send-button {
  background: #111816;
  border-color: #111816;
}

.mance-footnote {
  width: min(900px, calc(100% - 32px));
  justify-self: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 18px;
  color: #66726c;
  font-size: 12px;
}

.mance-footnote code {
  color: #1f2623;
}

.cowork-panel {
  min-width: 0;
  overflow: hidden auto;
  border-left: 1px solid #d7ddd8;
  background: #ffffff;
  padding: 18px;
  transform: translateX(100%);
  transition: transform 160ms ease;
}

.cowork-panel.open {
  transform: translateX(0);
}

.cowork-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}

.cowork-head h2 {
  font-size: 20px;
}

.cowork-section {
  border: 1px solid #d7ddd8;
  border-radius: 12px;
  padding: 12px;
  margin-top: 10px;
}

.cowork-flow {
  display: grid;
  gap: 8px;
}

.cowork-flow div,
.readiness-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #edf0ed;
  padding: 8px 0;
}

.cowork-flow div:last-child,
.readiness-row:last-child {
  border-bottom: 0;
}

.cowork-flow span,
.readiness-row span {
  color: #66726c;
}

@media (max-width: 860px) {
  #app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .toolbar,
  .toolbar-actions,
  .table-tools {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

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

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

  .flow-board {
    grid-template-columns: 1fr;
  }

  .flow-step::after {
    display: none;
  }

  .mance-chat-shell {
    padding: 12px;
  }

  .mance-chat-header,
  .mance-session-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .mance-status-strip {
    grid-template-columns: 1fr;
  }

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

  .mic-button {
    height: 44px;
  }

  .mance-session-bar label {
    margin-left: 0;
  }

  .mance-app-shell,
  .mance-app-shell:has(.cowork-panel.open) {
    grid-template-columns: 1fr;
  }

  .mance-rail {
    flex-direction: row;
    justify-content: center;
    border-right: 0;
    border-bottom: 1px solid #d7ddd8;
  }

  .mance-topbar,
  .mance-title-group,
  .mance-footnote {
    align-items: flex-start;
    flex-direction: column;
  }

  .mance-mode-controls {
    width: 100%;
    overflow-x: auto;
  }

  .prompt-suggestions {
    grid-template-columns: 1fr;
  }

  .mance-input-dock {
    grid-template-columns: 48px minmax(0, 1fr) 62px;
  }

  .cowork-panel {
    position: fixed;
    inset: auto 0 0 0;
    max-height: 72vh;
    z-index: 30;
    border-left: 0;
    border-top: 1px solid #d7ddd8;
  }
}
