:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
  color: #1b2028;
  background: #f5f6f8;
  --paper: #ffffff;
  --ink: #1b2028;
  --muted: #687383;
  --line: #dfe3e8;
  --line-strong: #c8ced7;
  --accent: #146c5c;
  --accent-soft: #e7f3ef;
  --blue: #275d9b;
  --warning: #8a5b12;
  --warning-soft: #fff7df;
  --danger: #a33027;
  --danger-soft: #fff0ee;
}

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

.checkbox-list label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
}

.checkbox-list input {
  width: 16px;
  height: 16px;
  margin: 0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #f5f6f8;
  -webkit-font-smoothing: antialiased;
  font-synthesis: none;
}

a {
  color: var(--blue);
  text-decoration: none;
  text-underline-offset: 0.16em;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums slashed-zero;
  overflow-wrap: anywhere;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 24px 16px;
  background: #20252d;
  color: #f4f6f8;
  border-right: 1px solid #15191f;
}

.brand {
  display: block;
  padding: 0 10px 22px;
  color: #ffffff;
  font-size: 1.08rem;
  font-weight: 720;
}

.brand:hover,
.workspace-link:hover,
.nav a:hover {
  text-decoration: none;
}

.workspace-link {
  display: block;
  margin-bottom: 16px;
  padding: 12px 10px;
  color: #f4f6f8;
  border-top: 1px solid #3b424d;
  border-bottom: 1px solid #3b424d;
}

.workspace-link span {
  display: block;
  margin-bottom: 2px;
  color: #aeb6c2;
  font-size: 0.74rem;
  text-transform: uppercase;
}

.workspace-link strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav {
  display: grid;
  gap: 3px;
}

.nav a {
  display: block;
  padding: 9px 10px;
  color: #c7ced7;
  border-left: 3px solid transparent;
}

.nav a.active {
  color: #ffffff;
  background: #2b323c;
  border-left-color: #59b5a3;
}

.core-build {
  display: grid;
  gap: 2px;
  margin-top: auto;
  padding: 18px 10px 0;
  color: #8f99a7;
  font-size: 0.72rem;
}

.core-build code {
  color: #727d8b;
  font-size: 0.68rem;
}

.admin-logout {
  margin-top: 12px;
  padding: 18px 10px 0;
  border-top: 1px solid #3b424d;
}

.admin-logout input {
  display: none;
}

.admin-logout button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 0;
  color: #c7ced7;
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
}

.admin-logout button:hover,
.admin-logout button:focus-visible {
  color: #ffffff;
  outline: none;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f5f6f8;
}

.login-panel {
  width: min(100%, 390px);
  padding: 34px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 16px 42px rgb(24 32 43 / 8%);
}

.login-brand {
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.login-copy {
  margin-bottom: 24px;
  color: var(--muted);
}

.google-login-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 9px 14px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-weight: 650;
}

.password-login-form {
  display: grid;
  gap: 8px;
}

.password-login-form label {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
}

.password-login-form input {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font: inherit;
}

.password-login-form .primary-button {
  justify-content: center;
  min-height: 42px;
  margin-top: 8px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.google-login-button:hover,
.google-login-button:focus-visible {
  background: #f8f9fa;
  border-color: #aeb6c2;
  text-decoration: none;
  outline: none;
}

.google-mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #315f9c;
  font-weight: 750;
}

.login-fallback {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.main {
  min-width: 0;
  width: min(100%, 1380px);
  padding: 42px clamp(24px, 4vw, 64px) 72px;
}

.page-header {
  min-height: 88px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 7px;
  font-size: clamp(1.65rem, 2vw, 2.15rem);
  line-height: 1.2;
  font-weight: 720;
  text-wrap: balance;
}

.page-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-title-row h1 {
  margin-bottom: 7px;
}

.concept-help-button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin: 0 0 7px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.concept-help-button:hover,
.concept-help-button:focus-visible,
.concept-help-button[aria-expanded="true"] {
  color: var(--ink);
  background: #e9edf1;
  outline: none;
}

.concept-help-panel {
  max-width: 660px;
  margin-top: 12px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.concept-help-panel strong {
  display: block;
  margin-bottom: 4px;
}

.concept-help-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

h2 {
  margin-bottom: 4px;
  font-size: 1.05rem;
  line-height: 1.3;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

.page-header p,
.section-heading p,
.timeline-item > p {
  margin-bottom: 0;
  color: var(--muted);
}

.eyebrow {
  margin-bottom: 8px !important;
  color: var(--muted) !important;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.section {
  margin: 0 0 38px;
}

.task-setup-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: -8px 0 34px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.task-setup-summary p {
  margin: 0;
  color: var(--muted);
}

.task-setup-summary strong {
  color: var(--ink);
  font-weight: 650;
}

.profile-summary {
  margin-bottom: 20px;
}

.profile-name {
  display: block;
  margin-bottom: 4px;
  font-size: 1rem;
}

.profile-summary p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.profile-summary p span {
  color: var(--ink);
  font-weight: 620;
}

.section-subheading {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  text-transform: uppercase;
}

.compact-section {
  margin-bottom: 16px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 13px;
}

.table-wrap {
  overflow-x: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

th {
  color: #4f5966;
  background: #f8f9fa;
  font-size: 0.76rem;
  font-weight: 680;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fbfcfd;
}

.audit-table {
  table-layout: fixed;
}

.audit-table th:nth-child(1) {
  width: 20%;
}

.audit-table th:nth-child(2) {
  width: 31%;
}

.audit-table th:nth-child(3) {
  width: 24%;
}

.audit-table th:nth-child(4) {
  width: 11%;
}

.audit-table th:nth-child(5) {
  width: 14%;
}

.audit-table code {
  overflow-wrap: anywhere;
  word-break: normal;
}

.runtime-table {
  table-layout: fixed;
}

.runtime-table th:nth-child(1) {
  width: 11%;
}

.runtime-table th:nth-child(2) {
  width: 23%;
}

.runtime-table th:nth-child(3) {
  width: 14%;
}

.runtime-table th:nth-child(4) {
  width: 22%;
}

.runtime-table th:nth-child(5) {
  width: 16%;
}

.runtime-table th:nth-child(6) {
  width: 14%;
}

.model-table th {
  text-transform: none;
}

.model-table td:first-child {
  min-width: 340px;
}

.id-reference {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.id-reference a code {
  color: var(--blue);
}

.copy-button {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: #697585;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
}

.copy-button:hover,
.copy-button:focus-visible {
  color: var(--ink);
  background: #eef1f4;
  border-color: var(--line);
  outline: none;
}

.copy-button.is-copied {
  color: var(--accent);
  background: var(--accent-soft);
}

.copy-icon {
  display: block;
  width: 16px;
  height: 16px;
}

.primary-link {
  color: #184f86;
  font-weight: 670;
}

.cell-detail {
  max-width: 560px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.status {
  display: inline-block;
  padding: 2px 7px;
  color: #4d5867;
  background: #edf0f3;
  border: 1px solid #d7dce2;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 650;
}

.status-queued,
.status-running,
.status-starting,
.status-stopping,
.status-retry_backoff,
.status-waiting_on_runtime {
  color: #734b0e;
  background: #fff5d8;
  border-color: #ecd89d;
}

/* Operator authority reads as privileged; external content reads as untrusted.
   The distinction has to survive a glance, because acting on the wrong one is
   the failure this whole model exists to prevent. */
.status-operator,
.status-waiting_on_operator_question {
  color: #4b2c78;
  background: #f1ebfb;
  border-color: #d5c6ee;
}

.status-external,
.status-customer,
.status-waiting_on_question {
  color: #586270;
  background: #f0f2f4;
  border-color: #d8dde2;
}

.status-activation {
  color: #125b4e;
  background: var(--accent-soft);
  border-color: #b9ddd5;
}

.status-expired {
  color: #734b0e;
  background: #fbeee0;
  border-color: #e8cfae;
}

.status-done {
  color: #125b4e;
  background: var(--accent-soft);
  border-color: #b9ddd5;
}

.status-stopped,
.status-succeeded {
  color: #125b4e;
  background: var(--accent-soft);
  border-color: #b9ddd5;
}

.status-delivered,
.status-sent,
.status-answered {
  color: #125b4e;
  background: var(--accent-soft);
  border-color: #b9ddd5;
}

.status-pending,
.status-open,
.status-received {
  color: #734b0e;
  background: #fff5d8;
  border-color: #ecd89d;
}

.status-failed,
.status-cancelled,
.status-lost {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #edc7c2;
}

.status-idle {
  color: #586270;
  background: #f0f2f4;
}

.plain-tag {
  display: inline-block;
  margin: 0 6px 4px 0;
  color: #36505d;
  font-size: 0.88rem;
}

.empty {
  padding: 28px;
  color: var(--muted);
  background: var(--paper);
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  color: var(--muted);
}

.pagination a,
.filter button {
  padding: 7px 11px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

.pagination a:hover,
.filter button:hover {
  background: #f8f9fa;
  text-decoration: none;
}

.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 34px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.facts div {
  min-width: 0;
  padding: 14px 18px 14px 0;
}

.facts span,
.facts strong {
  display: block;
}

.facts span {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.facts strong {
  overflow-wrap: anywhere;
}

.document {
  margin: 0;
  padding: 20px;
  overflow: auto;
  white-space: pre-wrap;
  color: #252b34;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.88rem;
  line-height: 1.65;
}

.definition-list {
  margin: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.definition-list div {
  display: grid;
  grid-template-columns: minmax(160px, 0.3fr) minmax(0, 1fr);
  gap: 20px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
}

.definition-list div:last-child {
  border-bottom: 0;
}

.definition-list dt {
  font-weight: 650;
}

.definition-list dd {
  margin: 0;
  color: #4f5966;
  overflow-wrap: anywhere;
}

.model-fields {
  margin: 0;
  background: var(--paper);
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.model-fields > div {
  display: grid;
  grid-template-columns: minmax(170px, 0.24fr) minmax(0, 1fr);
  gap: 24px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.model-fields > div:last-child {
  border-bottom: 0;
}

.model-fields dt,
.model-fields dd {
  min-width: 0;
}

.model-fields dt {
  color: #4f5966;
  font-weight: 650;
}

.model-fields dd {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.editable-model-fields input:not([type="hidden"]),
.editable-model-fields textarea,
.editable-model-fields select {
  width: 100%;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font: inherit;
}

.editable-model-fields textarea {
  resize: vertical;
  line-height: 1.55;
}

.editable-model-fields input:focus,
.editable-model-fields textarea:focus,
.editable-model-fields select:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 18%, transparent);
  outline-offset: 1px;
}

.field-control-with-reference {
  display: grid;
  gap: 7px;
}

.current-reference {
  width: fit-content;
  max-width: 100%;
  font-size: 0.84rem;
}

.current-reference code {
  margin-left: 5px;
  color: var(--muted);
  font-size: 0.76rem;
}

.inline-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-strong);
}

.inline-form-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.resource-reference {
  display: grid;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
}

.resource-reference strong {
  color: var(--blue);
  font-weight: 650;
}

.resource-reference code,
.resource-links code {
  color: var(--muted);
  font-size: 0.78rem;
}

.resource-reference:hover {
  text-decoration: none;
}

.resource-reference:hover strong {
  text-decoration: underline;
}

.model-fields > .compact-reference-row {
  align-items: center;
  padding-top: 9px;
  padding-bottom: 9px;
}

.editable-model-fields input[type="hidden"] {
  display: none;
}

.compact-reference-row .resource-reference {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 10px;
}

.missing-reference {
  color: var(--danger);
}

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

.related-records {
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.resource-links {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--paper);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.resource-links li {
  display: grid;
  grid-template-columns: minmax(160px, 0.4fr) minmax(0, 1fr);
  gap: 20px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.resource-links li:last-child {
  border-bottom: 0;
}

.code-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.code-list code {
  padding: 2px 6px;
  color: #35404d;
  background: #eef1f4;
  border-radius: 3px;
}

.notice {
  margin-bottom: 24px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
}

.notice-warning {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: #e9d39a;
}

.notice-success {
  color: #125b4e;
  background: var(--accent-soft);
  border-color: #b9ddd5;
}

.notice-error {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #edc7c2;
}

.attention-callout {
  margin: 0 0 28px;
  padding: 18px 20px;
  background: var(--warning-soft);
  border: 1px solid #e9d39a;
  border-left: 4px solid #c48720;
  border-radius: 5px;
}

.attention-callout h2,
.attention-callout p:last-child {
  margin-bottom: 0;
}

.question-list {
  display: grid;
  gap: 12px;
}

.question-card {
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.question-card-open {
  border-left: 3px solid #c48720;
}

.question-prompt {
  margin-bottom: 14px;
  white-space: pre-wrap;
}

.question-deadline {
  margin: -8px 0 14px;
  color: #6b7480;
  font-size: 0.85rem;
}

.question-cancel-form {
  margin-top: 10px;
}

.question-answer-form,
.session-message-form {
  display: grid;
  gap: 10px;
}

.question-answer-form textarea,
.session-message-form textarea,
.session-message-form select {
  width: 100%;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font: inherit;
}

.question-answer-form textarea:focus,
.session-message-form textarea:focus,
.session-message-form select:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 18%, transparent);
  outline-offset: 1px;
}

.question-options {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  border: 0;
}

.question-options legend,
.field-label {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.question-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}

.question-option:has(input:checked) {
  background: var(--accent-soft);
  border-color: #9fcfc4;
}

.question-option input {
  margin-top: 4px;
}

.question-option span,
.question-option small {
  display: block;
}

.question-option small {
  margin-top: 2px;
  color: var(--muted);
}

.question-answer-form .primary-button {
  justify-self: start;
}

.session-message-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.message-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.message-composer textarea {
  resize: vertical;
}

.primary-button,
.secondary-button,
.icon-button {
  cursor: pointer;
  font: inherit;
}

.primary-button {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 8px 12px;
  color: #ffffff;
  background: var(--accent);
  border: 1px solid #0f5b4e;
  border-radius: 4px;
  font-weight: 650;
}

.primary-button:hover {
  background: #0f5b4e;
}

.secondary-button {
  flex: 0 0 auto;
  padding: 7px 11px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-weight: 620;
}

.secondary-button:hover {
  background: #f8f9fa;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: #4d5867;
  background: transparent;
  border: 0;
  border-radius: 4px;
  font-size: 1.65rem;
  line-height: 1;
}

.icon-button:hover {
  color: var(--ink);
  background: #eef1f4;
}

.editor-rail {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 20;
  width: min(640px, calc(100vw - 236px));
  min-width: 0;
  height: 100dvh;
  overflow: hidden;
  background: var(--paper);
  border-left: 1px solid var(--line-strong);
  box-shadow: -8px 0 24px rgba(22, 27, 34, 0.07);
}

.editor-rail[hidden],
.editor-panel[hidden] {
  display: none;
}

.editor-panel,
.editor-panel-form,
.editor-settings-form {
  height: 100%;
  min-height: 0;
}

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

.editor-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}

.editor-panel-header .eyebrow {
  margin-bottom: 4px !important;
}

.editor-panel-header h2 {
  font-size: 1.18rem;
}

.editor-destination {
  display: grid;
  gap: 2px;
  padding: 10px 24px 11px;
  color: var(--muted);
  background: #f8f9fa;
  border-bottom: 1px solid var(--line);
}

.editor-destination span {
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
}

.editor-destination .destination-secondary {
  margin-top: 6px;
}

.editor-destination code {
  color: #35404d;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.editor-destination small {
  font-size: 0.76rem;
}

.editor-panel-form {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.editor-settings-form {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.editor-settings-fields {
  min-height: 0;
  overflow-y: auto;
  padding: 22px 24px 32px;
}

.form-field {
  display: grid;
  gap: 7px;
  margin: 0 0 22px;
  padding: 0;
  border: 0;
}

.form-field > span,
.form-field > legend {
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 650;
}

.form-field input[type="text"],
.form-field textarea,
.form-field select {
  width: 100%;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font: inherit;
}

.form-field textarea {
  resize: vertical;
  line-height: 1.55;
}

.form-field .code-editor {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
}

.form-field textarea[name="system_prompt"] {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 18%, transparent);
  outline-offset: 1px;
}

.channel-picker {
  gap: 8px;
}

.channel-picker legend {
  margin-bottom: 7px;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.checkbox-row input {
  margin: 3px 0 0;
}

.checkbox-row span,
.checkbox-row strong,
.checkbox-row small {
  display: block;
}

.checkbox-row small,
.form-help {
  color: var(--muted);
  font-size: 0.8rem;
}

.form-help {
  margin: 0;
}

.editor-panel-form textarea {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  resize: none;
  padding: 22px 24px;
  color: var(--ink);
  background: #fbfcfd;
  border: 0;
  border-radius: 0;
  outline: none;
  font: 0.9rem/1.7 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  letter-spacing: 0;
  tab-size: 2;
}

.editor-panel-form textarea:focus {
  background: #ffffff;
  box-shadow: inset 2px 0 0 var(--accent);
}

.editor-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 18px 14px 24px;
  background: var(--paper);
  border-top: 1px solid var(--line);
}

.editor-panel-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.technical-details {
  margin-top: 4px;
  border-top: 1px solid var(--line);
}

.technical-details summary {
  padding: 15px 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 620;
}

.configuration-details {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.configuration-details > summary {
  padding: 13px 15px;
  cursor: pointer;
  font-weight: 650;
}

.configuration-details[open] > summary {
  border-bottom: 1px solid var(--line);
}

.session-details {
  padding: 0;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.session-details-summary {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
}

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

.session-details-summary::before {
  content: "\203A";
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  transform-origin: center;
  transition: transform 120ms ease;
}

.session-details[open] > .session-details-summary::before {
  transform: rotate(90deg);
}

.session-details-summary > span:first-of-type {
  display: grid;
  gap: 3px;
}

.session-details-summary strong {
  font-size: 1rem;
}

.session-details-summary small,
.session-details-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.session-details-meta {
  white-space: nowrap;
}

.session-details-body {
  padding: 0 18px 18px 44px;
  border-top: 1px solid var(--line);
}

.session-details-body > :first-child {
  margin-top: 18px;
}

.stacked-form {
  display: grid;
  gap: 16px;
  max-width: 720px;
  padding: 18px;
}

.stacked-form label {
  display: grid;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 650;
}

.stacked-form input,
.stacked-form select,
.stacked-form textarea {
  width: 100%;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font: inherit;
}

.stacked-form textarea {
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
}

.stacked-form input:focus,
.stacked-form select:focus,
.stacked-form textarea:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 18%, transparent);
  outline-offset: 1px;
}

.stacked-form .primary-button {
  justify-self: start;
}

.configuration-json {
  margin: 0 0 32px;
  padding: 18px;
  overflow: auto;
  color: #35404d;
  background: #eef1f4;
  border: 1px solid var(--line);
  border-radius: 5px;
  font: 0.82rem/1.65 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
}

.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;
}

.transcript,
.timeline {
  display: grid;
  gap: 10px;
}

.message,
.timeline-item {
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.message-outbound {
  border-left: 3px solid var(--accent);
}

.message header,
.timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 7px;
}

.message time,
.timeline-head time {
  color: var(--muted);
  font-size: 0.8rem;
}

.message p {
  margin-bottom: 0;
  white-space: pre-wrap;
}

.timeline-item blockquote {
  margin: 12px 0 0;
  padding-left: 13px;
  color: #3e4855;
  border-left: 2px solid #b9c2cc;
  white-space: pre-wrap;
}

.work-flow {
  max-width: 720px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.work-flow-phase + .work-flow-phase {
  margin-top: 18px;
}

.work-flow-phase h3 {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 720;
  text-transform: uppercase;
}

.work-flow-step {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 12px;
  min-height: 58px;
  color: var(--muted);
}

.work-flow-step:not(:last-child)::after {
  position: absolute;
  top: 30px;
  bottom: 0;
  left: 14px;
  width: 1px;
  content: "";
  background: var(--line-strong);
}

.work-flow-marker {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 0.76rem;
  font-weight: 700;
}

.work-flow-sections > .outline-section {
  grid-template-columns: 38px minmax(0, 1fr);
}

.work-flow-sections > .outline-section > .work-flow-marker,
.outline-substeps .work-flow-marker {
  width: 38px;
  font-size: 10px;
}

.outline-substeps {
  margin-top: 12px;
}

.outline-delegation {
  margin: 3px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.work-flow-step small,
.work-flow-step strong {
  display: block;
}

.work-flow-step small {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.work-flow-step strong {
  color: inherit;
  font-weight: 650;
}

.work-flow-step p {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

.work-flow-step.in_progress {
  color: var(--ink);
}

.work-flow-step.in_progress .work-flow-marker,
.work-flow-step.completed .work-flow-marker {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.work-flow-step.in_progress .work-flow-marker {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.work-flow-step.blocked {
  color: #734b0e;
}

.work-flow-step.blocked .work-flow-marker {
  color: #734b0e;
  border-color: #d8b66a;
}

.work-flow-step.skipped {
  opacity: 0.6;
}

.work-flow-template .work-flow-step {
  color: var(--ink);
}

.inline-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  color: var(--muted);
}

.compact-create-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 140px auto;
  gap: 10px;
  align-items: end;
  margin-top: 16px;
}

.role-guide {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.users-table td {
  vertical-align: middle;
}

.users-table td:first-child {
  min-width: 240px;
}

.user-role-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-role-form select {
  min-width: 110px;
  padding: 6px 28px 6px 8px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font: inherit;
}

.compact-button {
  padding: 6px 9px;
  font-size: 0.86rem;
}

.danger-text-button {
  padding: 0;
  color: var(--danger);
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 620;
}

.danger-text-button:hover {
  text-decoration: underline;
}

.subtle-label {
  display: inline-block;
  margin-left: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

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

.filter {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.audit-filter {
  margin-bottom: 13px;
}

.filter label {
  color: var(--muted);
  font-size: 0.84rem;
}

.filter select,
.filter input {
  min-width: 130px;
  padding: 7px 9px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font: inherit;
}

.filter select {
  padding-right: 28px;
}

.audit-filter input[type="search"] {
  width: min(360px, 100%);
}

.filter button {
  cursor: pointer;
  font: inherit;
}

@media (max-width: 860px) {
  .shell {
    display: block;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 14px 16px;
  }

  .brand {
    padding: 0 4px 10px;
  }

  .workspace-link {
    margin-bottom: 10px;
    padding: 9px 4px;
  }

  .nav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav a {
    flex: 0 0 auto;
    padding: 7px 9px;
    border-left: 0;
    border-bottom: 2px solid transparent;
  }

  .nav a.active {
    border-bottom-color: #59b5a3;
  }

  .core-build {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding: 0 4px;
  }

  .admin-logout {
    margin-top: 10px;
    padding: 8px 4px 0;
  }

  .main {
    padding: 26px 18px 48px;
  }

  .editor-rail {
    width: min(640px, 100vw);
  }

  .page-header {
    min-height: 0;
    display: block;
  }

  .filter {
    margin-top: 18px;
  }

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

  .definition-list div {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .model-fields > div,
  .resource-links li {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .page-header > :last-child:not(:first-child) {
    margin-top: 16px;
  }
}

@media (max-width: 520px) {
  .runtime-table-wrap {
    overflow: visible;
    background: transparent;
    border: 0;
  }

  .runtime-table,
  .runtime-table tbody,
  .runtime-table tr,
  .runtime-table td {
    display: block;
    width: 100%;
  }

  .runtime-table thead {
    display: none;
  }

  .runtime-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 13px 16px;
    margin-bottom: 12px;
    padding: 14px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 6px;
  }

  .runtime-table td {
    min-width: 0;
    padding: 0;
    border: 0;
  }

  .runtime-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: #4f5966;
    font-size: 0.68rem;
    font-weight: 680;
    text-transform: uppercase;
  }

  .runtime-state {
    grid-column: 1;
  }

  .runtime-activity {
    grid-column: 2;
    text-align: right;
  }

  .runtime-context,
  .runtime-run,
  .runtime-container,
  .runtime-node {
    grid-column: 1 / -1;
  }

  .audit-table-wrap {
    overflow: visible;
  }

  .audit-table,
  .audit-table tbody,
  .audit-table tr,
  .audit-table td {
    display: block;
    width: 100%;
  }

  .audit-table thead {
    display: none;
  }

  .audit-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
    padding: 14px;
    border-bottom: 1px solid var(--line);
  }

  .audit-table tr:last-child {
    border-bottom: 0;
  }

  .audit-table td {
    min-width: 0;
    padding: 0;
    border: 0;
  }

  .audit-action {
    grid-column: 1;
    grid-row: 1;
  }

  .audit-status {
    grid-column: 2;
    grid-row: 1;
  }

  .audit-actor,
  .audit-resource,
  .audit-time {
    grid-column: 1 / -1;
    display: grid !important;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 8px;
    color: var(--muted);
    font-size: 0.78rem;
  }

  .audit-actor::before,
  .audit-resource::before,
  .audit-time::before {
    content: attr(data-label);
    color: #4f5966;
    font-size: 0.68rem;
    font-weight: 680;
    text-transform: uppercase;
  }

  .editor-panel-header {
    padding: 18px;
  }

  .editor-panel-form textarea {
    padding: 18px;
  }

  .editor-panel-footer {
    align-items: stretch;
    flex-direction: column;
    padding: 14px 18px 18px;
  }

  .editor-panel-footer .primary-button {
    width: 100%;
  }

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

  .inline-form-actions .primary-button {
    width: 100%;
  }

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

  .facts div {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  .facts div:last-child {
    border-bottom: 0;
  }

  .section-heading,
  .message header,
  .timeline-head {
    align-items: flex-start;
  }

  .session-details-summary {
    grid-template-columns: 16px minmax(0, 1fr);
  }

  .session-details-meta {
    grid-column: 2;
  }

  .session-details-body {
    padding-left: 18px;
  }
}
