:root {
  --ink: #1d2530;
  --ink-2: #273241;
  --nav: #202838;
  --nav-soft: #2a3445;
  --muted: #6b7786;
  --line: #d9e1e8;
  --line-strong: #c7d1da;
  --surface: #eef2f5;
  --card: #ffffff;
  --card-soft: #f7f9fb;
  --teal: #0f8a8a;
  --teal-dark: #0b6f70;
  --teal-soft: #e8f5f5;
  --red: #c94b3c;
  --red-soft: #fff0ed;
  --amber-soft: #fff7e8;
  --matrix-blue: #d7f2fb;
  --matrix-green: #d6f4ee;
  --matrix-yellow: #fff5d6;
  --shadow: 0 18px 48px rgba(29, 37, 48, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

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

button {
  border: 0;
}

button,
a,
input,
select,
textarea {
  outline-color: var(--teal);
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 24px 14px;
  background: var(--nav);
  color: #edf2f7;
}

.brand {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  padding: 0 8px 24px;
  border-bottom: 1px solid rgba(237, 242, 247, 0.12);
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 800;
}

.brand strong {
  display: block;
  font-size: 18px;
  letter-spacing: 0;
}

.brand span {
  display: block;
  margin-top: 3px;
  color: #aeb8c5;
  font-size: 12px;
}

.module-nav {
  display: grid;
  gap: 6px;
  margin: 22px 0 24px;
}

.nav-group-title {
  margin: 16px 8px 6px;
  color: #8fd4d4;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.nav-group-metrics {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.nav-group-metrics span:last-child {
  color: #a6dada;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.nav-group-title:first-child {
  margin-top: 0;
}

.module-quick-tools {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 4px 0 10px;
}

.module-tool {
  display: grid;
  min-width: 0;
  min-height: 58px;
  align-content: center;
  gap: 3px;
  padding: 8px 5px;
  border: 1px solid rgba(143, 212, 212, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #d8e3ed;
  cursor: pointer;
}

.module-tool:hover {
  border-color: rgba(143, 212, 212, 0.5);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.module-tool:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.module-tool span,
.module-tool strong {
  display: block;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-tool span {
  color: #aeb8c5;
  font-size: 11px;
  font-weight: 800;
}

.module-tool strong {
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.progress-tool {
  border-color: rgba(15, 138, 138, 0.45);
  background: rgba(15, 138, 138, 0.16);
}

.progress-tool i {
  display: block;
  width: 100%;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.progress-tool i b {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #69dfb6;
  transition: width 160ms ease;
}

.module-nav a {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #cbd5df;
  text-decoration: none;
}

.nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-meta {
  display: grid;
  flex: 0 0 auto;
  gap: 2px;
  justify-items: end;
  min-width: 58px;
}

.nav-meta b,
.nav-meta em {
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
}

.nav-meta b {
  color: #8fd4d4;
}

.nav-meta em {
  color: #aeb8c5;
}

.nav-meta em.is-synced {
  color: #69dfb6;
}

.module-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.module-nav a.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.16);
}

.module-nav a.active .nav-meta b {
  color: var(--teal-dark);
}

.module-nav a.active .nav-meta em {
  color: var(--muted);
}

.module-nav a.active .nav-meta em.is-synced {
  color: var(--teal-dark);
}

.saved-rail {
  padding: 18px 8px 0;
  border-top: 1px solid rgba(237, 242, 247, 0.12);
}

.rail-heading p,
.eyebrow,
.module-label {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}

.rail-heading p {
  color: #8fd4d4;
}

.rail-heading h2 {
  margin: 0 0 12px;
  color: #fff;
  font-size: 17px;
}

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

.version-card,
.page-card,
.version-rules > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

.version-card {
  padding: 11px;
}

.sidebar .version-card {
  border-color: rgba(237, 242, 247, 0.12);
  background: rgba(255, 255, 255, 0.06);
}

.version-card strong {
  display: block;
  font-size: 14px;
}

.sidebar .version-card strong {
  color: #fff;
}

.version-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.sidebar .version-card span {
  color: #aeb8c5;
}

.version-card .mini-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.workspace {
  height: 100vh;
  min-width: 0;
  overflow: auto;
  padding: 26px 30px 56px;
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.module-submit-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-soft);
}

.module-submit-bar .primary-button {
  min-width: 150px;
}

.submit-help {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.draft-pill {
  align-self: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-soft);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.primary-button,
.secondary-button,
.ghost-button,
.dark-button,
.danger-button,
.tiny-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.dark-button:hover,
.danger-button:hover,
.tiny-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(29, 37, 48, 0.09);
}

.primary-button {
  background: var(--teal);
  color: #fff;
}

.primary-button:hover {
  background: var(--teal-dark);
}

.secondary-button {
  border: 1px solid rgba(15, 138, 138, 0.3);
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.sidebar .ghost-button {
  border-color: rgba(237, 242, 247, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #edf2f7;
}

.dark-button {
  background: var(--ink);
  color: #fff;
}

.dark-button:hover {
  background: #111821;
}

.danger-button {
  border: 1px solid rgba(201, 75, 60, 0.25);
  background: var(--red-soft);
  color: var(--red);
}

.tiny-button {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
}

.sidebar .tiny-button {
  border-color: rgba(237, 242, 247, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #edf2f7;
}

.full {
  width: 100%;
  margin-top: 12px;
}

.section-panel {
  display: none;
  margin-bottom: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(29, 37, 48, 0.045);
  scroll-margin-top: 18px;
}

.section-panel.active-page {
  display: block;
  animation: pageIn 180ms ease-out;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.section-heading h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.16;
}

.section-heading > p {
  max-width: 500px;
  margin: 5px 0 0;
  color: var(--muted);
}

.run-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 14px;
}

.run-grid label:nth-child(8) {
  grid-column: span 2;
}

.foundation-grid {
  display: grid;
  grid-template-columns: 1fr;
  counter-reset: foundation-field;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
}

.foundation-grid > label,
.foundation-grid > .foundation-row {
  counter-increment: foundation-field;
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  min-height: 92px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.foundation-grid > label > span,
.foundation-grid .foundation-title {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  align-content: center;
  min-height: 100%;
  margin: 0;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
  background: var(--card-soft);
}

.foundation-grid > label > span::before,
.foundation-grid .foundation-title::before {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  content: counter(foundation-field);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.foundation-grid > label > input,
.foundation-grid > label > select,
.foundation-grid > label > textarea {
  align-self: stretch;
  width: calc(100% - 28px);
  margin: 14px;
}

.foundation-grid > label > textarea {
  min-height: 92px;
}

.foundation-grid > label:nth-child(5) > textarea,
.foundation-grid > label:nth-child(8) > textarea {
  min-height: 120px;
}

.foundation-choice-row .choice-group {
  display: grid;
  grid-column: 2;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  padding: 14px;
}

.foundation-choice-row .choice-group label {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
  align-content: center;
  margin: 0;
  min-height: 58px;
  padding: 12px 46px 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.foundation-choice-row .choice-group label:has(input:checked) {
  border-color: rgba(15, 138, 138, 0.55);
  background: var(--teal-soft);
  color: var(--teal-dark);
  box-shadow: inset 0 0 0 1px rgba(15, 138, 138, 0.12);
}

.foundation-choice-row .choice-group input {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--teal);
}

.foundation-choice-row .choice-info {
  position: absolute;
  top: 12px;
  right: 14px;
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid rgba(112, 144, 154, 0.35);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.foundation-choice-row .choice-tooltip {
  position: absolute;
  top: calc(100% - 4px);
  right: 12px;
  left: 12px;
  z-index: 6;
  display: none;
  padding: 9px 10px;
  border: 1px solid rgba(20, 30, 45, 0.18);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 12px 28px rgba(20, 30, 45, 0.18);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
}

.foundation-choice-row .choice-group label:hover .choice-tooltip,
.foundation-choice-row .choice-group label:focus-within .choice-tooltip {
  display: block;
}

.foundation-choice-row .choice-group label:has(input:checked) .choice-info {
  border-color: rgba(15, 138, 138, 0.45);
  background: #fff;
  color: var(--teal-dark);
}

label span,
fieldset legend {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(15, 138, 138, 0.65);
  box-shadow: 0 0 0 3px rgba(15, 138, 138, 0.12);
}

input,
select {
  min-height: 44px;
  padding: 9px 11px;
}

textarea {
  min-height: 44px;
  padding: 10px 11px;
  resize: vertical;
}

.matrix-section {
  overflow: hidden;
}

.minimal-dev-card {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
}

.minimal-dev-heading {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}

.minimal-dev-heading strong {
  display: block;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.3;
}

.minimal-dev-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.minimal-dev-heading > span {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
}

.minimal-dev-host {
  overflow: auto;
  border: 1px solid #bdd7df;
  border-radius: 8px;
  background: var(--matrix-blue);
}

.minimal-dev-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
}

.minimal-dev-table th,
.minimal-dev-table td {
  border-right: 1px solid #bdd7df;
  border-bottom: 1px solid #bdd7df;
  vertical-align: middle;
}

.minimal-dev-table th:last-child,
.minimal-dev-table td:last-child {
  border-right: 0;
}

.minimal-dev-table tr:last-child td {
  border-bottom: 0;
}

.minimal-dev-table th {
  padding: 12px;
  background: var(--matrix-blue);
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}

.minimal-dev-table th:first-child,
.minimal-dev-table td:first-child {
  width: 170px;
  background: var(--matrix-yellow);
  color: var(--ink);
  font-weight: 900;
  text-align: left;
}

.minimal-dev-table td {
  height: 54px;
  background: var(--matrix-blue);
}

.minimal-dev-table textarea {
  display: block;
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  resize: vertical;
  box-shadow: none;
}

.minimal-dev-table textarea:focus {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.56);
  box-shadow: inset 0 0 0 2px rgba(15, 138, 138, 0.52);
}

.minimal-dev-label {
  display: block;
  padding: 12px;
}

.matrix-note {
  margin-bottom: 14px;
  padding: 13px 14px;
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  background: var(--card-soft);
  color: var(--ink-2);
}

.matrix-host {
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fffdf7;
}

.matrix-table {
  width: max-content;
  min-width: max-content;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.matrix-table th,
.matrix-table td {
  border-right: 1px solid #bdd7df;
  border-bottom: 1px solid #bdd7df;
  vertical-align: top;
}

.matrix-table .child-head,
.matrix-table .cell {
  width: var(--matrix-col-width, 188px);
  min-width: var(--matrix-col-width, 188px);
  max-width: var(--matrix-col-width, 188px);
}

.matrix-row-label-col {
  width: 188px;
  min-width: 188px;
}

.matrix-table .row-label {
  position: sticky;
  z-index: 2;
  width: 188px;
  min-width: 188px;
  max-width: 188px;
  font-weight: 800;
}

.matrix-table .row-label {
  left: 0;
  padding: 14px 12px;
  background: var(--matrix-yellow);
  color: var(--ink);
  vertical-align: middle;
}

.matrix-table .primary-head {
  padding: 10px;
  background: var(--matrix-blue);
  text-align: center;
}

.matrix-table .primary-head.alt {
  background: var(--matrix-green);
}

.matrix-table .child-head {
  position: relative;
  padding: 10px;
  background: var(--matrix-blue);
}

.matrix-table .child-head.alt {
  background: var(--matrix-green);
}

.matrix-table .cell {
  background: var(--matrix-blue);
}

.matrix-table .cell.alt {
  background: var(--matrix-green);
}

.matrix-table .cell textarea,
.matrix-table .cell input,
.matrix-table .cell select,
.matrix-table .child-title,
.matrix-table .primary-title {
  width: 100%;
  border-color: rgba(112, 144, 154, 0.32);
  background: rgba(255, 255, 255, 0.72);
}

.matrix-table .primary-title {
  border-color: rgba(112, 144, 154, 0.28);
  background: rgba(255, 255, 255, 0.46);
  color: var(--ink);
  text-align: center;
  font-weight: 800;
}

.matrix-table .child-title {
  text-align: center;
  font-weight: 800;
}

.matrix-table .cell textarea {
  min-height: 96px;
}

.matrix-table .compact-cell textarea {
  min-height: 60px;
}

.flow-title-row,
.child-title-row,
.matrix-actions {
  display: flex;
  gap: 7px;
  align-items: center;
}

.flow-title-row {
  justify-content: center;
}

.matrix-actions {
  margin-top: 8px;
  justify-content: center;
}

.matrix-table .primary-head .tiny-button,
.matrix-table .child-head .tiny-button {
  border-color: rgba(112, 144, 154, 0.28);
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink-2);
  box-shadow: none;
}

.matrix-col-resizer {
  position: absolute;
  top: 0;
  right: -4px;
  bottom: 0;
  z-index: 3;
  width: 8px;
  cursor: col-resize;
  touch-action: none;
}

.matrix-col-resizer::after {
  position: absolute;
  top: 10px;
  right: 3px;
  bottom: 10px;
  width: 2px;
  border-radius: 999px;
  background: rgba(15, 138, 138, 0);
  content: "";
  transition: background 0.14s ease;
}

.matrix-table .child-head:hover .matrix-col-resizer::after,
body.is-resizing-matrix .matrix-col-resizer::after {
  background: rgba(15, 138, 138, 0.65);
}

body.is-resizing-matrix {
  cursor: col-resize;
  user-select: none;
}

.checkbox-stack {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.checkbox-stack label {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--ink);
}

.checkbox-stack input {
  width: auto;
  min-height: auto;
}

.checkbox-stack input[type="text"],
.checkbox-stack input:not([type]) {
  width: 100%;
  min-height: 38px;
}

.matrix-option-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-content: start;
  padding: 10px;
}

.matrix-option-grid.radio-grid,
.matrix-option-grid.multi-grid,
.matrix-option-grid.frequency-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.matrix-option {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  min-height: 34px;
  align-items: flex-start;
  align-content: center;
  gap: 7px;
  padding: 6px 8px;
  border: 1px solid rgba(112, 144, 154, 0.28);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  cursor: pointer;
  line-height: 1.2;
}

.matrix-option:has(input:checked) {
  border-color: rgba(15, 138, 138, 0.55);
  background: rgba(232, 245, 245, 0.95);
  color: var(--teal-dark);
  box-shadow: inset 0 0 0 1px rgba(15, 138, 138, 0.1);
}

.matrix-option input {
  flex: 0 0 16px;
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
  accent-color: var(--teal);
}

.matrix-option span {
  display: block;
  min-width: 0;
  margin: 0;
  color: inherit;
  font-size: 12px;
  font-weight: 800;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.matrix-option .term-note {
  margin-left: 23px;
  font-size: 11px;
  line-height: 1.35;
}

.matrix-option-grid .custom-frequency {
  grid-column: 1 / -1;
  min-height: 38px;
  margin: 0;
  background: rgba(255, 255, 255, 0.72);
}

.reference-layout {
  display: grid;
  grid-template-columns: minmax(280px, 430px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.reference-table {
  display: grid;
  counter-reset: reference-field;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
}

.reference-row {
  counter-increment: reference-field;
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  min-height: 132px;
  border-bottom: 1px solid var(--line);
}

.reference-row:last-child {
  border-bottom: 0;
}

.reference-title {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  align-content: center;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
  background: var(--card-soft);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 800;
}

.reference-title::before {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  content: counter(reference-field);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.reference-control {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.reference-control textarea {
  min-height: 96px;
}

.upload-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px dashed rgba(15, 138, 138, 0.34);
  border-radius: 8px;
  background: rgba(232, 249, 249, 0.48);
  outline: none;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.upload-panel:focus,
.upload-panel:focus-within,
.upload-panel.is-dragging {
  border-color: var(--teal);
  background: var(--teal-soft);
  box-shadow: 0 0 0 3px rgba(15, 138, 138, 0.12);
}

.upload-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.upload-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border: 1px solid rgba(15, 138, 138, 0.3);
  border-radius: 8px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  cursor: pointer;
  font-weight: 800;
}

.upload-button input {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-count {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.upload-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.field-help {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.hidden-meta {
  display: none;
}

.reference-file-list {
  display: grid;
  gap: 6px;
  max-height: 210px;
  overflow: auto;
}

.reference-file-list.hidden-meta {
  display: none;
}

.reference-file-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(15, 138, 138, 0.2);
  border-radius: 8px;
  background: #fff;
}

.reference-file-item span {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-file-item small {
  grid-column: 1;
  color: var(--muted);
  font-size: 12px;
}

.file-remove-button {
  grid-row: 1 / span 2;
  grid-column: 2;
  min-height: 30px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.file-remove-button:hover {
  border-color: rgba(15, 138, 138, 0.32);
  color: var(--teal-dark);
}

.reference-image {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.reference-image img {
  display: block;
  width: 100%;
  height: auto;
}

.reference-image figcaption {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}

.page-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 14px;
}

.page-card {
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(29, 37, 48, 0.045);
}

.page-preview {
  display: grid;
  min-height: 132px;
  place-items: center;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(15, 138, 138, 0.12), rgba(255, 255, 255, 0)),
    #f5f8fa;
}

.page-preview img {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.mock-page {
  width: 82%;
  height: 86px;
  border: 1px solid rgba(29, 37, 48, 0.14);
  border-radius: 8px;
  background: #fff;
  box-shadow: 12px 12px 0 rgba(15, 138, 138, 0.12);
}

.mock-page::before,
.mock-page::after {
  display: block;
  width: 74%;
  height: 10px;
  margin: 14px;
  border-radius: 4px;
  background: rgba(29, 37, 48, 0.16);
  content: "";
}

.mock-page::after {
  width: 48%;
}

.page-body {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.page-body .inline-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.page-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.page-toggles label {
  display: flex;
  gap: 6px;
  align-items: center;
}

.page-toggles input {
  width: auto;
  min-height: auto;
}

.image-meta {
  padding: 8px 10px;
  border: 1px dashed rgba(15, 138, 138, 0.28);
  border-radius: 8px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 12px;
}

.page-actions {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
}

#module-4 .settings-grid {
  grid-template-columns: 1fr;
  gap: 0;
  counter-reset: settings-field;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
}

#module-4 .settings-row,
#module-5 .run-choice {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 0;
  min-height: 104px;
  margin: 0;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
}

#module-4 .settings-row {
  counter-increment: settings-field;
}

#module-5 .run-choice {
  counter-increment: run-field;
}

#module-4 .settings-row:last-child,
#module-5 .run-choice:last-child {
  border-bottom: 0;
}

#module-4 .settings-title,
#module-5 .run-title {
  display: inline-flex;
  flex-wrap: wrap;
  grid-column: 1;
  gap: 8px;
  align-items: center;
  align-content: center;
  width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
  background: var(--card-soft);
}

#module-5 .run-title {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  column-gap: 8px;
  row-gap: 8px;
  min-width: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#module-4 .settings-title::before,
#module-5 .run-title::before {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  content: counter(settings-field);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

#module-5 .run-title::before {
  content: counter(run-field);
}

#module-5 .run-title .choice-note {
  grid-column: 3;
  justify-self: start;
}

.choice-note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid rgba(15, 138, 138, 0.22);
  border-radius: 999px;
  background: rgba(232, 249, 249, 0.72);
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.label-help,
.term-note,
.row-help,
.inline-help,
.matrix-help {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.45;
}

.label-help {
  flex: 0 0 100%;
  margin-left: 32px;
}

#module-5 .run-title .label-help {
  grid-column: 2 / -1;
  min-width: 0;
  max-width: 100%;
  margin-left: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.term-note {
  flex: 0 0 100%;
  margin: -3px 0 0 28px;
}

.inline-help {
  display: block;
  margin-top: 4px;
}

.matrix-help {
  display: block;
  margin-top: 6px;
}

.row-label-title {
  display: block;
  color: var(--ink);
}

.row-help {
  display: block;
  margin-top: 5px;
  color: #725f26;
  font-size: 11px;
}

#module-4 .settings-row .choice-group label,
#module-5 .choice-group label {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
  align-content: center;
  margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

#module-4 .settings-row .choice-group label:has(input:checked),
#module-5 .choice-group label:has(input:checked) {
  border-color: rgba(15, 138, 138, 0.55);
  background: var(--teal-soft);
  color: var(--teal-dark);
  box-shadow: inset 0 0 0 1px rgba(15, 138, 138, 0.12);
}

#module-4 .settings-row .choice-group input,
#module-5 .choice-group input {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  accent-color: var(--teal);
}

#module-4 .settings-row .choice-group {
  display: grid;
  grid-column: 2;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  padding: 14px;
}

#module-5 .choice-group {
  display: grid;
  grid-column: 2;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  padding: 14px;
}

#module-5 .run-grid {
  grid-template-columns: 1fr;
  gap: 0;
  counter-reset: run-field;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
}

#module-5 .run-grid > label {
  counter-increment: run-field;
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  min-height: 92px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

#module-5 .run-grid > label:last-child {
  border-bottom: 0;
}

#module-5 .run-grid > label > span {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  column-gap: 8px;
  row-gap: 8px;
  align-items: center;
  align-content: center;
  min-width: 0;
  min-height: 100%;
  margin: 0;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
  background: var(--card-soft);
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#module-5 .run-grid > label > span::before {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  content: counter(run-field);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

#module-5 .run-grid > label > span .choice-note {
  grid-column: 3;
  justify-self: start;
}

#module-5 .run-grid > label > span .label-help {
  grid-column: 2 / -1;
  min-width: 0;
  max-width: 100%;
  margin-left: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#module-5 .run-grid > label input,
#module-5 .run-grid > label textarea {
  align-self: stretch;
  width: calc(100% - 28px);
  margin: 14px;
}

#module-5 .run-grid > label:nth-child(8) {
  grid-column: auto;
}

fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-soft);
}

fieldset label {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

fieldset input {
  width: auto;
  min-height: auto;
}

.prompt-output {
  min-height: 520px;
  border-color: var(--line-strong);
  background: #fbfcfd;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.68;
  white-space: pre-wrap;
}

.send-package {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-soft);
}

.send-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.send-package strong,
.send-package span {
  display: block;
}

.send-package span {
  margin-top: 2px;
  color: var(--muted);
}

.word-package {
  border-color: rgba(15, 138, 138, 0.28);
  background: var(--teal-soft);
}

.version-rules {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.version-rules > div {
  padding: 16px;
  background: var(--card-soft);
}

.version-rules span {
  display: inline-grid;
  width: 38px;
  height: 30px;
  place-items: center;
  margin-bottom: 10px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 800;
}

.version-rules strong {
  display: block;
  font-size: 16px;
}

.version-rules p {
  margin: 8px 0 0;
  color: var(--muted);
}

.empty-state {
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--card-soft);
  color: var(--muted);
}

.sidebar .empty-state {
  background: rgba(255, 255, 255, 0.08);
  color: #aeb8c5;
}

.saved-page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  gap: 18px;
  align-items: start;
}

.saved-page-copy {
  max-width: 780px;
  margin: 0 0 14px;
  color: var(--muted);
}

.saved-grid {
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 14px;
}

.saved-grid .version-card {
  padding: 16px;
  background: var(--card-soft);
}

.saved-grid .version-card strong {
  color: var(--ink);
  font-size: 16px;
}

.compact-rules {
  grid-template-columns: 1fr;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  gap: 18px;
  align-items: start;
}

.admin-settings {
  grid-template-columns: 1fr 1fr;
}

.admin-note {
  display: grid;
  grid-column: 1 / -1;
}

.user-table-wrap {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
}

.user-table th,
.user-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.user-table th {
  background: var(--card-soft);
  color: var(--ink-2);
  font-size: 13px;
}

.status-chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 4px 9px;
  border-radius: 7px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
}

.muted-chip {
  background: var(--card-soft);
  color: var(--muted);
}

.agent-page {
  overflow: hidden;
}

.agent-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(390px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.agent-chat-shell,
.agent-side-panel,
.agent-summary-box,
.agent-config-box {
  min-width: 0;
}

.agent-chat-shell,
.agent-summary-box,
.agent-config-box {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
}

.agent-chat-header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--card-soft);
}

.agent-chat-header strong,
.agent-chat-header span {
  display: block;
}

.agent-chat-header strong {
  color: var(--ink);
  font-size: 18px;
}

.agent-chat-header div > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 14px;
}

.agent-chat-header .agent-avatar {
  display: inline-grid;
  color: #0b6965;
  font-size: 20px;
}

.agent-chat-header .agent-badge {
  display: inline-flex;
  margin-top: 0;
  color: #7649e8;
  font-size: 13px;
  font-weight: 900;
}

.agent-chat-header .status-chip {
  display: inline-flex;
}

.feishu-agent-header {
  align-items: flex-start;
  border-bottom-color: #d8dee6;
  background: #fff;
}

.feishu-agent-identity {
  display: flex;
  min-width: 0;
  gap: 12px;
  align-items: flex-start;
}

.agent-avatar {
  display: inline-grid;
  width: 44px;
  min-width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(145deg, #d5f1ec, #85d6cb);
  color: #0b6965;
  font-size: 17px;
  font-weight: 900;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.75);
}

.agent-avatar-main {
  width: 52px;
  min-width: 52px;
  height: 52px;
  font-size: 20px;
}

.user-avatar {
  background: #eef1f5;
  color: var(--ink-2);
}

.agent-title-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.agent-chat-header .agent-title-line strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.25;
}

.agent-badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 4px 8px;
  border-radius: 7px;
  background: #e8ddff;
  color: #7649e8;
  font-size: 13px;
  font-weight: 900;
}

.feishu-agent-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
}

.agent-icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  font-weight: 900;
  cursor: default;
}

.agent-channel-tabs {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 20px 0;
  border-top: 1px solid rgba(216, 222, 230, 0.5);
  background: #fff;
}

.agent-channel-tabs span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--ink-2);
  font-weight: 900;
}

.agent-channel-tabs .active {
  background: #dbe8ff;
  color: #1754e8;
}

.agent-stage-label {
  padding: 16px 20px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.agent-chat-log {
  display: grid;
  gap: 28px;
  min-height: 500px;
  max-height: 620px;
  overflow: auto;
  padding: 22px 20px 34px;
  background:
    linear-gradient(90deg, rgba(15, 138, 138, 0.06) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(15, 138, 138, 0.06) 0 1px, transparent 1px 100%),
    #fbfdfe;
  background-size: 32px 32px;
}

.agent-message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  max-width: 100%;
}

.agent-message-body {
  display: grid;
  max-width: min(980px, calc(100% - 64px));
  gap: 6px;
}

.agent-message-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.agent-message-meta strong {
  color: var(--ink);
  font-size: 13px;
}

.agent-message p {
  margin: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.8;
  box-shadow: 0 8px 18px rgba(29, 37, 48, 0.04);
}

.user-message {
  justify-self: start;
}

.user-message .agent-message-meta {
  text-align: left;
}

.user-message p {
  border-color: #e1e5ea;
  background: #eef0f2;
  color: var(--ink);
}

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

.assistant-message p {
  border-color: #c7dcfa;
  background: #dbeafe;
}

.agent-reply-link {
  justify-self: start;
  border: 0;
  background: transparent;
  color: #1754e8;
  font-size: 13px;
  font-weight: 900;
  cursor: default;
}

.agent-suggestions,
.agent-composer {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.agent-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.agent-composer {
  display: grid;
  gap: 10px;
}

.agent-composer > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.agent-composer textarea {
  min-height: 120px;
}

.agent-composer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.agent-side-panel {
  display: grid;
  gap: 14px;
}

.agent-summary-box,
.agent-config-box {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.agent-summary-box {
  border-color: rgba(15, 138, 138, 0.28);
  background: var(--teal-soft);
}

.agent-summary-box > span {
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
}

.agent-summary-box p {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.7;
  white-space: pre-line;
}

.agent-summary-box .primary-button {
  justify-self: start;
}

.agent-config-box h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.agent-config-box ol {
  margin: 0;
  padding-left: 20px;
  color: var(--ink-2);
}

.agent-config-box li + li {
  margin-top: 6px;
}

.agent-module-drafts {
  display: grid;
  gap: 10px;
}

.agent-module-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.agent-module-card.is-filled {
  border-color: rgba(15, 138, 138, 0.36);
  background: linear-gradient(0deg, rgba(232, 245, 245, 0.82), rgba(255, 255, 255, 0.92));
}

.agent-module-card header {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.agent-module-card span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.agent-module-card strong {
  color: var(--ink);
  font-size: 14px;
}

.agent-module-card em {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.agent-module-card.is-filled em {
  color: var(--teal-dark);
}

.agent-module-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.agent-json-preview {
  min-height: 320px;
  color: var(--ink-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre;
}

.guide-page {
  overflow: hidden;
}

.guide-layout {
  display: grid;
  gap: 18px;
}

.guide-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
}

.guide-card-heading {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.guide-card-heading > span {
  display: inline-grid;
  width: 44px;
  min-width: 44px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.guide-card-heading h3 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.2;
}

.guide-card-heading p {
  margin: 5px 0 0;
  color: var(--muted);
}

.development-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.development-flow > span {
  display: none;
}

.development-flow article {
  position: relative;
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 150px;
  padding: 16px;
  border: 1px solid rgba(15, 138, 138, 0.24);
  border-radius: 8px;
  background: var(--teal-soft);
}

.development-flow article:not(:last-of-type)::after {
  position: absolute;
  top: 50%;
  right: -19px;
  z-index: 2;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--teal-dark);
  content: "→";
  font-weight: 900;
  transform: translateY(-50%);
}

.development-flow article:nth-of-type(even) {
  background: var(--matrix-blue);
}

.development-flow strong {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.35;
}

.development-flow p {
  margin: 0;
  color: var(--ink-2);
  line-height: 1.65;
}

.process-table {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
}

.process-row {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  min-height: 190px;
  border-bottom: 1px solid var(--line);
}

.process-row:last-child {
  border-bottom: 0;
}

.process-row-title {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: var(--card-soft);
}

.process-row-title .row-index {
  display: inline-grid;
  width: 36px;
  min-width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.process-row-title strong {
  display: block;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.25;
}

.process-row-title small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.process-row-content {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 18px;
}

.process-path {
  padding: 12px 14px;
  border: 1px solid rgba(15, 138, 138, 0.28);
  border-radius: 8px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-weight: 900;
  line-height: 1.5;
}

.process-step-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.advanced-step-list {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.process-step-list section {
  display: grid;
  gap: 7px;
  align-content: start;
  min-height: 128px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.process-step-list span {
  width: max-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff8df;
  color: #725a17;
  font-size: 12px;
  font-weight: 900;
}

.process-step-list h4 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.25;
}

.process-step-list p {
  margin: 0;
  color: var(--ink-2);
  line-height: 1.62;
}

.term-table-wrap {
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

.term-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #fff;
}

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

.term-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--card-soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.term-table td:first-child {
  width: 210px;
  background: #fff8df;
  color: var(--ink);
  font-weight: 900;
}

.term-table td:last-child {
  color: var(--ink-2);
}

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

[hidden] {
  display: none !important;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .foundation-grid,
  .settings-grid,
  .run-grid,
  .version-rules {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .foundation-grid > label,
  .foundation-grid > .foundation-row {
    grid-template-columns: minmax(150px, 200px) minmax(0, 1fr);
  }

  .reference-layout {
    grid-template-columns: 1fr;
  }

  .admin-layout,
  .admin-settings {
    grid-template-columns: 1fr;
  }

  .agent-layout {
    grid-template-columns: 1fr;
  }

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

  .development-flow article {
    min-height: auto;
  }

  .development-flow article:not(:last-of-type)::after {
    top: auto;
    right: auto;
    bottom: -20px;
    left: 50%;
    content: "↓";
    transform: translateX(-50%);
  }

  .process-step-list,
  .advanced-step-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #module-4 .settings-row,
  #module-5 .run-grid > label,
  #module-5 .run-choice {
    grid-template-columns: minmax(150px, 200px) minmax(0, 1fr);
  }
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .workspace {
    height: auto;
    overflow: visible;
  }

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

  .workspace {
    padding: 18px 14px 36px;
  }

  .section-actions {
    justify-content: flex-start;
  }

  .section-heading {
    display: grid;
  }

  .minimal-dev-heading {
    display: grid;
  }

  .minimal-dev-heading > span {
    width: max-content;
  }

  .foundation-grid,
    .settings-grid,
    .run-grid,
    .version-rules,
    .page-list,
    .saved-page-layout,
    .admin-layout,
    .admin-settings,
    .agent-layout,
    .guide-layout,
    .saved-grid,
    .send-package {
    grid-template-columns: 1fr;
  }

  .agent-chat-header,
  .agent-composer-actions {
    justify-content: flex-start;
  }

  .agent-message {
    max-width: 100%;
  }

  .page-body .inline-row {
    grid-template-columns: 1fr;
  }

  .run-grid > label:nth-child(8) {
    grid-column: auto;
  }

  .foundation-grid > label,
  .foundation-grid > .foundation-row {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .process-row {
    grid-template-columns: 1fr;
    min-height: auto;
  }

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

  .process-step-list,
  .advanced-step-list {
    grid-template-columns: 1fr;
  }

  .reference-row {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  #module-4 .settings-row,
  #module-5 .run-grid > label,
  #module-5 .run-choice {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .foundation-grid > label > span,
  .foundation-grid .foundation-title,
  .reference-title {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  #module-4 .settings-title,
  #module-5 .run-grid > label > span,
  #module-5 .run-title {
    grid-row: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  #module-4 .settings-row .choice-group,
  #module-4 .settings-row .choice-group label,
  #module-5 .choice-group,
  #module-5 .choice-group label {
    grid-column: 1;
  }

  .foundation-choice-row .choice-group,
  .foundation-choice-row .choice-group label {
    grid-column: 1;
  }

  .foundation-grid > label > input,
  .foundation-grid > label > select,
  .foundation-grid > label > textarea,
  #module-5 .run-grid > label input,
  #module-5 .run-grid > label textarea {
    width: calc(100% - 24px);
    margin: 12px;
  }

  .send-actions {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
