/* 管理后台。版面取自车间：左边是机身（导航），顶上一条灯板（各工位的指示灯），台面上放当前这一页的活。
   分区靠留白和细线，不靠一堆带阴影的卡片；只有浮层（对话框、提示、工单坞）才有阴影。 */

.admin {
  min-height: 100vh;
}

.boot-note {
  margin: 0;
  padding: 80px 24px;
  color: var(--ink-3);
  text-align: center;
}

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

/* 带 hidden 属性的元素一律不显示：按钮、表单项这些自己设了 display 的也不例外 */
[hidden] {
  display: none !important;
}

.icon {
  flex: none;
  vertical-align: -0.18em;
}

h1,
h2,
h3,
p {
  margin: 0;
}

/* ---------------------------------------------------------------- 外壳 */

.shell {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  min-height: 100vh;
  /* 机身的颜色铺满整列：页面比一屏长时，导航下面不露出台面 */
  background: linear-gradient(to right, var(--machine) 208px, transparent 208px);
}

.rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 18px 12px 14px;
  background: var(--machine);
  color: var(--machine-ink);
  overflow-y: auto;
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 8px 18px;
  color: var(--machine-ink);
}

.rail-brand:hover {
  text-decoration: none;
}

.rail-brand img {
  display: block;
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.rail-brand b {
  display: block;
  font-size: 15px;
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.rail-brand small {
  display: block;
  color: var(--machine-dim);
  font-size: 12px;
}

.nav-group {
  margin-top: 14px;
}

.nav-group-label {
  padding: 0 10px 6px;
  color: var(--machine-dim);
  font-size: 12px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius);
  color: var(--machine-ink);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.nav-item.is-on {
  background: rgba(255, 255, 255, 0.14);
  font-weight: 600;
}

.nav-item.is-on::before {
  /* 安全黄的定位标：只标当前所在的工位 */
  content: "";
  position: absolute;
  left: -12px;
  top: 6px;
  bottom: 6px;
  width: 4px;
  border-radius: 0 2px 2px 0;
  background: var(--signal);
}

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--signal);
  color: var(--signal-ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.rail-foot {
  margin-top: auto;
  padding-top: 16px;
}

.rail-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--machine-dim);
  font-size: 13px;
}

.rail-user button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--machine-ink);
  font: inherit;
  cursor: pointer;
}

.rail-user button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* 灯板：每个角色一盏灯，再加沙箱、任务、提审额度。任何一页都看得到「系统的智能是否健康」 */

.board {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 20px;
  background: var(--board);
  color: var(--board-ink);
  font-size: 13px;
  overflow-x: auto;
  white-space: nowrap;
}

.board-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: var(--radius);
  color: var(--board-ink);
}

a.board-item:hover {
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.board-item b {
  font-weight: 600;
}

.board-item .num {
  font-size: 14px;
}

.board-label {
  color: var(--board-dim);
}

.board-sep {
  flex: none;
  width: 1px;
  height: 18px;
  margin: 0 8px;
  background: rgba(255, 255, 255, 0.16);
}

.board-fill {
  flex: 1;
}

.board-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  background: none;
  color: var(--board-dim);
  font: inherit;
  cursor: pointer;
}

/* 灯板上的东西多了放不下时，状态项在左边自己滚动，搜索按钮始终留在右端看得见 */
.board-search {
  position: sticky;
  right: 0;
  flex: none;
  margin-left: 12px;
  background: var(--board);
  box-shadow: -14px 0 12px 2px var(--board);
}

@media (max-width: 1500px) {
  .board {
    gap: 0;
    padding: 0 14px;
  }

  .board-item {
    gap: 5px;
    padding: 5px 7px;
  }

  .board-sep {
    margin: 0 4px;
  }
}

.board-search:hover {
  color: var(--board-ink);
  border-color: rgba(255, 255, 255, 0.4);
}

.board-search kbd {
  font-family: var(--font-num);
  font-size: 12px;
}

.page {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  padding: 28px 32px 96px;
}

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

.page-title {
  font-size: 22px;
  line-height: 1.35;
  font-weight: 700;
}

.page-sub {
  margin-top: 4px;
  max-width: 46em;
  color: var(--ink-2);
}

.page-crumb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
  color: var(--ink-3);
  font-size: 13px;
}

.page-actions {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

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

.stack--tight {
  gap: 12px;
}

.cols {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

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

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

.row--between {
  justify-content: space-between;
}

.row--top {
  align-items: flex-start;
}

.grow {
  flex: 1;
  min-width: 0;
}

/* ---------------------------------------------------------------- 指示灯与标签 */

.lamp {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.lamp-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--lamp, var(--off));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--lamp, var(--off)) 22%, transparent);
}

.lamp--ok { --lamp: var(--ok); }
.lamp--info { --lamp: var(--info); }
.lamp--warn { --lamp: var(--warn); }
.lamp--bad { --lamp: var(--bad); }
.lamp--run { --lamp: var(--signal); }

/* 形状也不同：注意是菱形，故障是方块，熄灭是空心圈 */
.lamp--warn .lamp-dot {
  border-radius: 1px;
  transform: rotate(45deg) scale(0.9);
}

.lamp--bad .lamp-dot {
  border-radius: 1px;
}

.lamp--off .lamp-dot {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--off);
}

.lamp--run .lamp-dot {
  animation: lamp-pulse 1.4s ease-in-out infinite;
}

.lamp--quiet .lamp-dot {
  box-shadow: none;
}

.lamp--quiet.lamp--off .lamp-dot {
  box-shadow: inset 0 0 0 2px var(--off);
}

@keyframes lamp-pulse {
  0%, 100% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--signal) 35%, transparent); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--signal) 0%, transparent); }
}

.tag {
  display: inline-block;
  padding: 0 7px;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  background: var(--sheet-2);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 20px;
  white-space: nowrap;
}

.tag--ok { border-color: transparent; background: var(--ok-bg); color: var(--ok-ink); }
.tag--warn { border-color: transparent; background: var(--warn-bg); color: var(--warn-ink); }
.tag--bad { border-color: transparent; background: var(--bad-bg); color: var(--bad-ink); }
.tag--info { border-color: transparent; background: var(--info-bg); color: var(--info-ink); }
.tag--signal { border-color: transparent; background: var(--signal); color: var(--signal-ink); font-weight: 600; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 6px 4px 0;
  padding: 1px 8px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--sheet);
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 20px;
}

button.chip {
  font-family: inherit;
  cursor: pointer;
}

button.chip:hover,
.chip.is-on {
  border-color: var(--accent);
  background: var(--tint);
  color: var(--ink);
}

/* ---------------------------------------------------------------- 按钮与输入 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--sheet);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

a.btn:hover {
  text-decoration: none;
}

.btn:hover {
  border-color: var(--ink-3);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn--primary {
  border-color: var(--btn);
  background: var(--btn);
  color: var(--btn-ink);
}

.btn--primary:hover {
  border-color: var(--btn);
  opacity: 0.9;
}

.btn--signal {
  border-color: var(--signal);
  background: var(--signal);
  color: var(--signal-ink);
  font-weight: 700;
}

.btn--danger {
  color: var(--bad-ink);
}

.btn--danger:hover {
  border-color: var(--bad);
}

.btn--ghost {
  border-color: transparent;
  background: none;
  color: var(--accent);
}

.btn--ghost:hover {
  border-color: transparent;
  background: var(--tint);
}

.btn.is-off {
  opacity: 0.5;
  cursor: default;
}

.btn.is-off:hover {
  border-color: var(--line-2);
}

.btn--small {
  min-height: 26px;
  padding: 0 8px;
  font-size: 13px;
}

.btn--icon {
  padding: 0;
  min-width: 32px;
}

.btn--icon.btn--small {
  min-width: 26px;
}

.btn.is-busy {
  position: relative;
  color: transparent;
}

.btn.is-busy::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--ink-3);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn--primary.is-busy::after {
  border-color: var(--btn-ink);
  border-top-color: transparent;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.input {
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--sheet);
  color: var(--ink);
  font: inherit;
}

textarea.input {
  display: block;
  line-height: 1.55;
  resize: vertical;
}

.input::placeholder {
  color: var(--ink-3);
  opacity: 0.8;
}

.input:hover {
  border-color: var(--ink-3);
}

.input:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 28%, transparent);
  outline-offset: 0;
}

.input--mono {
  font-family: var(--font-mono);
  font-size: 13px;
}

.input--slim {
  width: auto;
  min-height: 30px;
  padding: 3px 8px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  border-radius: 10px;
  background: var(--off);
  transition: background 0.15s;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}

.switch input:checked + .switch-track {
  background: var(--ok);
}

.switch input:checked + .switch-track::after {
  transform: translateX(14px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--info);
  outline-offset: 2px;
}

.switch input:disabled + .switch-track {
  opacity: 0.5;
}

.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--sheet-2);
}

.seg-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 0;
  border-radius: 3px;
  background: none;
  color: var(--ink-2);
  font: inherit;
  cursor: pointer;
}

.seg-item:hover {
  color: var(--ink);
}

.seg-item.is-on {
  background: var(--sheet);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--line-2);
}

.seg-count {
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 400;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.filters .input {
  width: auto;
  min-width: 150px;
}

/* ---------------------------------------------------------------- 三种状态 */

.state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 28px 4px;
  color: var(--ink-2);
}

.state--loading {
  flex-direction: row;
  align-items: center;
  color: var(--ink-3);
}

.state--compact {
  padding: 14px 4px;
}

.state-title {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.state-hint {
  max-width: 44em;
}

.state .btn {
  margin-top: 6px;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--line-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ---------------------------------------------------------------- 面板、表格、标签页 */

.panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--sheet);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px 0;
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
}

.panel-hint {
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 13px;
}

.panel-actions {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.panel-body {
  padding: 14px 18px 18px;
}

.panel--flush > .panel-body {
  padding: 8px 0 0;
}

.panel--flush > .panel-body > .state {
  padding-left: 18px;
  padding-right: 18px;
}

.section-title {
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 700;
}

.section-title small {
  margin-left: 8px;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 400;
}

.table-wrap {
  overflow-x: auto;
}

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

.table th {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 400;
  text-align: left;
  white-space: nowrap;
}

.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

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

.table th:first-child,
.table td:first-child {
  padding-left: 18px;
}

/* 放在有内边距的面板里的表格：两头不再留边，和面板里的文字对齐 */
.panel:not(.panel--flush) > .panel-body .table th:first-child,
.panel:not(.panel--flush) > .panel-body .table td:first-child {
  padding-left: 0;
}

.panel:not(.panel--flush) > .panel-body .table th:last-child,
.panel:not(.panel--flush) > .panel-body .table td:last-child {
  padding-right: 0;
}

.table th:last-child,
.table td:last-child {
  padding-right: 18px;
}

.table .is-right {
  text-align: right;
}

.table .is-nowrap {
  white-space: nowrap;
}

.table tr.is-clickable {
  cursor: pointer;
}

.table tr.is-clickable:hover td {
  background: var(--sheet-2);
}

.table tr.is-dim td {
  color: var(--ink-3);
}

.cell-main {
  font-weight: 600;
}

.cell-sub {
  display: block;
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 400;
}

.cell-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line-2);
  overflow-x: auto;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: -1px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--ink-2);
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}

.tab:hover {
  color: var(--ink);
}

.tab.is-on {
  border-bottom-color: var(--ink);
  color: var(--ink);
  font-weight: 700;
}

.tab-count {
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 400;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px 24px;
  margin: 0;
}

.facts--wide {
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.facts--wide .fact {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 12px;
}

.fact dt {
  color: var(--ink-3);
  font-size: 13px;
}

.fact dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.progress {
  width: 100%;
  min-width: 60px;
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}

.progress i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--signal);
  transition: width 0.4s;
}

.progress--ok i { background: var(--ok); }
.progress--bad i { background: var(--bad); }

/* 额度表：数字用铭牌字，轨道是同一色系的浅色 */

.meter + .meter {
  margin-top: 14px;
}

.meter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.meter-label {
  color: var(--ink-2);
}

.meter-figure {
  color: var(--ink-3);
  font-size: 15px;
}

.meter-figure b {
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
}

.meter-track {
  height: 8px;
  margin-top: 4px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--meter, var(--off)) 20%, var(--sheet));
  overflow: hidden;
}

.meter-track i {
  display: block;
  min-width: 0;
  height: 100%;
  border-radius: 4px;
  background: var(--meter, var(--off));
}

.meter--ok { --meter: var(--accent); }
.meter--warn { --meter: var(--warn); }
.meter--bad { --meter: var(--bad); }

.meter-note {
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 12.5px;
}

.code {
  max-height: 560px;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sheet-2);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  overflow: auto;
  tab-size: 4;
  white-space: pre;
}

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

/* 数据视图 */

.dv-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}

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

.dv-key {
  color: var(--ink-3);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.dv-val {
  min-width: 0;
  overflow-wrap: anywhere;
}

.dv-val .dv {
  padding-left: 12px;
  border-left: 2px solid var(--line);
}

.dv-null {
  color: var(--ink-3);
}

.dv-text {
  max-height: 260px;
  margin: 0;
  font: inherit;
  white-space: pre-wrap;
  overflow: auto;
}

.dv-list {
  margin: 0;
  padding-left: 20px;
}

.dv-list li + li {
  margin-top: 6px;
}

/* ---------------------------------------------------------------- 对话框、提示、工单坞 */

.dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--sheet);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.dialog[open] {
  display: flex;
  flex-direction: column;
}

.dialog::backdrop {
  background: rgba(10, 16, 13, 0.5);
}

.dialog--small {
  width: min(420px, calc(100vw - 32px));
}

.dialog--wide {
  width: min(860px, calc(100vw - 32px));
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px 12px;
}

.dialog-head h2 {
  font-size: 17px;
  font-weight: 700;
}

.dialog-close {
  display: inline-flex;
  padding: 4px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--ink-3);
  cursor: pointer;
}

.dialog-close:hover {
  background: var(--sheet-2);
  color: var(--ink);
}

.dialog-body {
  flex: 1;
  min-height: 0;
  padding: 4px 20px 16px;
  overflow-y: auto;
}

.dialog-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line);
}

.dialog-intro,
.dialog-detail {
  margin-bottom: 14px;
  color: var(--ink-2);
}

.dialog-detail {
  margin: 10px 0 0;
  font-size: 13px;
}

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

.field {
  grid-column: 1 / -1;
  min-width: 0;
}

.field--half {
  grid-column: auto;
}

.field[hidden] {
  display: none;
}

.field-label {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

.field-req {
  color: var(--bad);
}

.field-hint {
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 12.5px;
}

.field-error,
.form-problem {
  margin-top: 4px;
  color: var(--bad-ink);
  font-size: 13px;
}

.form-problem {
  margin-top: 14px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--bad-bg);
}

.field.has-error .input {
  border-color: var(--bad);
}

.form-note {
  grid-column: 1 / -1;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--sheet-2);
  color: var(--ink-2);
  font-size: 13px;
}

.checks {
  display: grid;
  gap: 6px;
}

.checks--cols {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px 14px;
}

.checks--scroll {
  max-height: 190px;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  overflow-y: auto;
}

.check {
  display: flex;
  align-items: baseline;
  gap: 8px;
  cursor: pointer;
}

.check small {
  color: var(--ink-3);
}

.pairs {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.pair {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr) auto;
  gap: 6px;
  width: 100%;
}

.order-chosen {
  display: grid;
  gap: 4px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.order-chosen li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 4px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--sheet-2);
}

.order-rank {
  color: var(--ink-3);
}

.order-name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.order-empty {
  margin-bottom: 8px;
  color: var(--ink-3);
  font-size: 13px;
}

.toasts {
  position: fixed;
  z-index: 100;
  inset: auto auto 24px 50%;
  display: grid;
  gap: 8px;
  width: min(520px, calc(100vw - 32px));
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  overflow: visible;
  transform: translateX(-50%);
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px 10px 14px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--sheet);
  box-shadow: var(--shadow);
}

.toast .lamp {
  margin-top: 6px;
}

.toast-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast-action {
  flex: none;
  font-weight: 600;
}

.toast-close {
  display: inline-flex;
  flex: none;
  margin-top: 2px;
  padding: 2px;
  border: 0;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
}

.dock {
  position: fixed;
  z-index: 60;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 8px;
  width: 300px;
}

.dock-row {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 8px 10px 12px;
  border: 1px solid var(--line-2);
  border-left: 4px solid var(--signal);
  border-radius: 6px;
  background: var(--sheet);
  box-shadow: var(--shadow);
}

.dock-row--bad {
  border-left-color: var(--bad);
}

.dock-row--ok {
  border-left-color: var(--ok);
}

.dock-main {
  display: grid;
  flex: 1;
  gap: 4px;
  min-width: 0;
  color: var(--ink);
}

.dock-main:hover {
  text-decoration: none;
}

.dock-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.dock-step {
  color: var(--ink-3);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dock-close {
  display: inline-flex;
  padding: 2px;
  border: 0;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
}

/* ---------------------------------------------------------------- 任务日志 */

.joblog-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  min-height: 28px;
  margin-bottom: 10px;
}

.joblog-step {
  flex: 1;
  min-width: 120px;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.joblog-progress {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 190px;
}

.joblog-error {
  color: var(--bad-ink);
}

.log {
  height: 360px;
  margin: 0;
  padding: 10px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sheet-2);
  font-size: 13px;
  line-height: 1.6;
  list-style: none;
  overflow-y: auto;
}

.log--tall {
  height: min(62vh, 640px);
}

.log-line {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  column-gap: 10px;
  padding: 1px 14px;
}

.log-line time {
  color: var(--ink-3);
}

.log-text {
  grid-column: 2;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.log-level {
  margin-right: 8px;
  font-size: 12px;
  font-weight: 700;
}

.log-line--warn {
  background: var(--warn-bg);
}

.log-line--warn .log-level {
  color: var(--warn-ink);
}

.log-line--error {
  background: var(--bad-bg);
}

.log-line--error .log-level {
  color: var(--bad-ink);
}

.log-data {
  grid-column: 2;
  margin: 2px 0 4px;
}

.log-data summary {
  color: var(--ink-3);
  cursor: pointer;
}

.log-empty {
  padding: 8px 14px;
  color: var(--ink-3);
}

/* ---------------------------------------------------------------- 登录 */

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

.login-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 48px;
  background: var(--machine);
  color: var(--machine-ink);
}

.login-side .rail-brand {
  padding: 0;
}

.login-motto {
  max-width: 15em;
  text-wrap: balance;
  font-size: 30px;
  line-height: 1.4;
  font-weight: 700;
}

.login-side small {
  color: var(--machine-dim);
}

.login-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  width: min(360px, 100%);
  margin: 0 auto;
  padding: 40px 24px;
}

.login-form h1 {
  margin-bottom: 4px;
  font-size: 22px;
}

.login-form .btn {
  min-height: 38px;
  margin-top: 4px;
}

/* ---------------------------------------------------------------- 总览 */

.alerts {
  display: grid;
  gap: 6px;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 12px 9px 14px;
  border-radius: var(--radius);
  background: var(--sheet);
  border: 1px solid var(--line);
}

.alert .lamp {
  margin-top: 6px;
}

.alert--error {
  border-color: transparent;
  background: var(--bad-bg);
}

.alert--warn {
  border-color: transparent;
  background: var(--warn-bg);
}

.alert-text {
  flex: 1;
  min-width: 0;
}

/* 「下一步」是整套界面里唯一用力的地方：警示带、大字、黄色按钮 */

.next {
  position: relative;
  padding: 26px 24px 22px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--sheet);
  overflow: hidden;
}

.next::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 8px;
  /* 警示带的深色条在浅色、深色模式下都是同一种近黑，像真的胶带 */
  background: repeating-linear-gradient(-45deg, var(--signal) 0 12px, #17201b 12px 24px);
}

.next-label {
  color: var(--ink-3);
  font-size: 13px;
}

.next-title {
  margin-top: 4px;
  max-width: 24em;
  font-size: 24px;
  line-height: 1.4;
  font-weight: 700;
  text-wrap: balance;
}

.next-why {
  margin-top: 10px;
  max-width: 46em;
  color: var(--ink-2);
}

.next-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.next-actions .btn {
  min-height: 38px;
  padding: 0 18px;
  font-size: 15px;
}

.next-rest {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.next-rest h3 {
  margin-bottom: 6px;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 400;
}

.next-rest ol,
.next-rest ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.next-rest li {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.next-rest .num {
  flex: none;
  width: 14px;
  color: var(--ink-3);
}

/* 产品流转：五个工位连成一条线，数字是当前停在这一站的资产数 */

.flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow-station {
  position: relative;
  display: block;
  padding: 0 12px 0 0;
  color: var(--ink);
}

a.flow-station:hover {
  text-decoration: none;
}

a.flow-station:hover .flow-name {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.flow-count {
  display: block;
  font-family: var(--font-num);
  font-size: 40px;
  line-height: 1.1;
  font-weight: 600;
}

.flow-station.is-empty .flow-count {
  color: var(--off);
}

.flow-rail {
  position: relative;
  height: 10px;
  margin: 8px 0;
}

.flow-rail::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 4px;
  height: 2px;
  background: var(--line-2);
}

.flow-rail::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--sheet);
  box-shadow: inset 0 0 0 2px var(--line-2);
}

.flow-station.is-filled .flow-rail::after {
  background: var(--accent);
  box-shadow: none;
}

.flow li:last-child .flow-rail::before {
  right: auto;
  width: 10px;
}

.flow-name {
  font-weight: 600;
}

.flow-hint {
  display: block;
  color: var(--ink-3);
  font-size: 12.5px;
}

.flow-side {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
}

.brief {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.brief > li,
.brief > a {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.brief > :last-child {
  border-bottom: 0;
}

.brief a:hover {
  text-decoration: none;
}

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

.brief-sub {
  color: var(--ink-3);
  font-size: 12.5px;
}

.jobrow {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.jobrow:last-child {
  border-bottom: 0;
}

a.jobrow:hover {
  text-decoration: none;
}

.jobrow-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.jobrow-step {
  color: var(--ink-3);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- 模型路由 */

.station {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--sheet);
}

.station + .station {
  margin-top: 12px;
}

.station > * + * {
  margin-top: 12px;
}

.station > .guide-text {
  margin-top: 6px;
}

.station-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

.station-name {
  font-size: 16px;
  font-weight: 700;
}

.station-hint {
  color: var(--ink-3);
  font-size: 13px;
}

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

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

.kind-more {
  margin-left: 8px;
  color: var(--accent);
  font-size: 13px;
}

.kind-summary[open] .kind-more {
  display: none;
}

.station-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 10px;
  color: var(--ink-3);
  font-size: 13px;
}

/* 回退链：按顺序排开，第一个是首选，后面的依次顶上 */

.chain {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 0;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.chain-item {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 8px;
  min-width: 170px;
  max-width: 260px;
  margin-right: 26px;
  padding: 7px 12px 7px 9px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--sheet-2);
}

.chain-item::after {
  content: "";
  position: absolute;
  top: 27px;
  right: -22px;
  width: 18px;
  height: 2px;
  background: var(--line-2);
}

.chain-item:last-child {
  margin-right: 0;
}

.chain-item:last-child::after {
  display: none;
}

.chain-item.is-first {
  border-color: var(--accent);
  background: var(--tint);
}

.chain-item.is-down {
  border-style: dashed;
}

.chain-rank {
  grid-row: 1 / 3;
  align-self: center;
  width: 22px;
  color: var(--ink-3);
  font-family: var(--font-num);
  font-size: 20px;
  text-align: center;
}

.chain-item.is-first .chain-rank {
  color: var(--accent);
}

.chain-model {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.chain-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  color: var(--ink-3);
  font-size: 12.5px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--sheet);
}

.tile {
  padding: 14px 18px;
  border-left: 1px solid var(--line);
}

.tile:first-child {
  border-left: 0;
}

a.tile {
  color: var(--ink);
}

a.tile:hover {
  background: var(--sheet-2);
  text-decoration: none;
}

.tile-label {
  color: var(--ink-3);
  font-size: 13px;
}

.tile-value {
  font-family: var(--font-num);
  font-size: 28px;
  line-height: 1.25;
  font-weight: 600;
}

.tile-note {
  color: var(--ink-3);
  font-size: 12.5px;
}

/* 每日调用：单一系列的柱图，柱头圆角、贴着基线 */

.bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 150px;
  padding-top: 6px;
  border-bottom: 1px solid var(--line-2);
}

.bar {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
  min-width: 0;
}

.bar i {
  display: block;
  width: min(24px, 70%);
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: var(--accent);
}

.bar i.bar-fail {
  min-height: 0;
  margin-bottom: 2px;
  border-radius: 4px;
  background: var(--bad);
}

.bar:hover::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--tint);
  opacity: 0.6;
}

.bar i {
  position: relative;
}

.bar-tip {
  position: absolute;
  z-index: 5;
  bottom: 100%;
  left: 50%;
  display: none;
  padding: 6px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--sheet);
  box-shadow: var(--shadow);
  font-size: 12.5px;
  white-space: nowrap;
  transform: translateX(-50%);
}

.bar:hover .bar-tip,
.bar:focus-visible .bar-tip {
  display: block;
}

.bars-axis {
  display: flex;
  gap: 2px;
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 12px;
}

.bars-axis span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-align: center;
  white-space: nowrap;
}

.legend {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
  color: var(--ink-2);
  font-size: 13px;
}

.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 2px;
  background: var(--accent);
}

.legend i.is-fail {
  background: var(--bad);
}

.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: 96px 100px minmax(0, 1fr);
  align-items: baseline;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

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

.timeline time {
  color: var(--ink-3);
}

.more {
  display: flex;
  justify-content: center;
  padding-top: 14px;
}

/* ---------------------------------------------------------------- 产品 */

.group-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 26px 0 8px;
  font-size: 15px;
  font-weight: 700;
}

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

.group-title small {
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 400;
}

/* 流转卡：一行一个资产，右边五个站点标出它走到了哪一步 */

.ticket {
  display: grid;
  grid-template-columns: 44px minmax(0, 1.4fr) minmax(0, 0.7fr) 210px minmax(0, 0.8fr);
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-top-width: 0;
  background: var(--sheet);
  color: var(--ink);
}

.ticket:first-of-type {
  border-top-width: 1px;
  border-radius: 6px 6px 0 0;
}

.ticket:last-of-type {
  border-radius: 0 0 6px 6px;
}

.ticket:only-of-type {
  border-radius: 6px;
}

.ticket:hover {
  background: var(--sheet-2);
  text-decoration: none;
}

.mono {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 9px;
  background: hsl(var(--hue, 150) 28% 42%);
  color: #fff;
  font-size: 19px;
  font-weight: 700;
}

.mono--large {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  font-size: 30px;
}

.avatar {
  display: block;
  width: 72px;
  height: 72px;
  border-radius: 14px;
  background: var(--sheet-2);
  object-fit: cover;
}

.ticket-name {
  font-size: 15px;
  font-weight: 700;
}

.ticket-id {
  display: block;
  color: var(--ink-3);
  font-size: 12.5px;
}

.ticket-steps {
  display: grid;
  gap: 4px;
}

.steps {
  display: flex;
  align-items: center;
}

.steps i {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px var(--line-2);
}

.steps b {
  flex: 1;
  height: 2px;
  background: var(--line-2);
}

.steps i.is-done,
.steps b.is-done {
  background: var(--accent);
  box-shadow: none;
}

.steps i.is-now {
  width: 14px;
  height: 14px;
  background: var(--signal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 30%, transparent);
}

.steps.is-bad i.is-now {
  border-radius: 2px;
  background: var(--bad);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 25%, transparent);
}

.steps.is-live i.is-now {
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent);
}

.ticket-money {
  text-align: right;
}

.detail-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

.detail-head .page-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 4px;
  color: var(--ink-3);
}

/* 上架步骤：真的是一个顺序，所以编号 */

.guide {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: guide;
}

.guide-step {
  position: relative;
  padding: 0 0 20px 44px;
  counter-increment: guide;
}

.guide-step::before {
  content: counter(guide);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--sheet);
  box-shadow: inset 0 0 0 2px var(--line-2);
  color: var(--ink-3);
  font-family: var(--font-num);
  font-size: 15px;
  font-weight: 600;
}

.guide-step::after {
  content: "";
  position: absolute;
  left: 13px;
  top: 32px;
  bottom: 4px;
  width: 2px;
  background: var(--line);
}

.guide-step:last-child {
  padding-bottom: 0;
}

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

.guide-step.is-done::before {
  content: "✓";
  background: var(--accent);
  box-shadow: none;
  color: var(--sheet);
}

.guide-step.is-done::after {
  background: var(--accent);
}

.guide-step.is-now::before {
  background: var(--signal);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--signal) 28%, transparent);
  color: var(--signal-ink);
}

.guide-title {
  padding-top: 3px;
  font-weight: 700;
}

.guide-step.is-todo .guide-title {
  color: var(--ink-2);
  font-weight: 600;
}

.guide-text {
  margin-top: 2px;
  max-width: 44em;
  color: var(--ink-2);
}

.guide-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.guide-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--ink-2);
}

.guide-list li + li {
  margin-top: 4px;
}

.guide details {
  margin-top: 8px;
}

.guide summary {
  color: var(--accent);
  cursor: pointer;
}

.files {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.files-tree {
  max-height: 640px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--sheet);
  overflow-y: auto;
}

.files-root {
  padding: 8px 12px 4px;
  color: var(--ink-3);
  font-size: 12.5px;
}

.files-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 5px 12px;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.files-item span:first-child {
  overflow-wrap: anywhere;
}

.files-item small {
  flex: none;
  color: var(--ink-3);
}

.files-item:hover {
  background: var(--sheet-2);
}

.files-item.is-on {
  background: var(--tint);
  font-weight: 600;
}

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

.preview-image {
  display: block;
  max-width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.issue-error td:first-child {
  box-shadow: inset 3px 0 0 var(--bad);
}

/* ---------------------------------------------------------------- 选题 */

.idea {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-top-width: 0;
  background: var(--sheet);
}

.idea:first-child {
  border-top-width: 1px;
  border-radius: 6px 6px 0 0;
}

.idea:last-child {
  border-radius: 0 0 6px 6px;
}

.idea:only-child {
  border-radius: 6px;
}

.idea-score {
  text-align: center;
}

.idea-score b {
  display: block;
  font-family: var(--font-num);
  font-size: 34px;
  line-height: 1.1;
  font-weight: 600;
}

.idea-score small {
  color: var(--ink-3);
  font-size: 12px;
}

.idea-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
}

.idea-lines {
  display: grid;
  gap: 4px;
  margin: 8px 0 0;
}

.idea-lines div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
}

.idea-lines dt {
  color: var(--ink-3);
  font-size: 13px;
}

.idea-lines dd {
  margin: 0;
  color: var(--ink-2);
}

.idea details {
  margin-top: 8px;
}

.idea summary {
  color: var(--accent);
  cursor: pointer;
}

.idea-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.idea-actions .row {
  gap: 2px;
  flex-wrap: nowrap;
}

/* ---------------------------------------------------------------- 配置、杂项 */

.setting {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px 28px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.setting:last-child {
  border-bottom: 0;
}

.setting.is-target {
  background: var(--signal-bg);
}

.setting-key {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.setting-desc {
  margin-top: 2px;
}

.setting-default {
  margin-top: 6px;
  color: var(--ink-3);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.setting-edit {
  display: grid;
  gap: 8px;
  align-content: start;
}

.notice {
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--sheet-2);
  color: var(--ink-2);
}

.notice--warn {
  background: var(--warn-bg);
  color: var(--warn-ink);
}

.notice--bad {
  background: var(--bad-bg);
  color: var(--bad-ink);
}

.notice--ok {
  background: var(--ok-bg);
  color: var(--ok-ink);
}

.secret-once {
  display: grid;
  gap: 10px;
}

.secret-once code {
  display: block;
  padding: 10px 12px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  background: var(--sheet-2);
  font-family: var(--font-mono);
  font-size: 13px;
  overflow-wrap: anywhere;
}

code,
kbd {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.inline-code {
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--sheet-2);
}

/* 全局搜索 */

.palette {
  width: min(600px, calc(100vw - 32px));
  margin-top: 12vh;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--sheet);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.palette::backdrop {
  background: rgba(10, 16, 13, 0.45);
}

.palette-input {
  width: 100%;
  padding: 14px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  outline: none;
}

.palette-list {
  max-height: 46vh;
  margin: 0;
  padding: 6px;
  list-style: none;
  overflow-y: auto;
}

.palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
}

.palette-item.is-on {
  background: var(--tint);
}

.palette-item small {
  flex: none;
  color: var(--ink-3);
}

.palette-empty {
  padding: 16px 18px;
  color: var(--ink-3);
}

/* ---------------------------------------------------------------- 窄屏 */

@media (max-width: 1080px) {
  .cols,
  .cols--even {
    grid-template-columns: minmax(0, 1fr);
  }

  .ticket {
    grid-template-columns: 44px minmax(0, 1fr) 170px;
  }

  .ticket > :nth-child(3),
  .ticket > :nth-child(5) {
    display: none;
  }
}

@media (max-width: 820px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    background: none;
  }

  .rail {
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    height: auto;
    padding: 8px 12px;
    overflow-x: auto;
  }

  .rail-brand {
    padding: 0 8px 0 0;
  }

  .rail-brand div,
  .nav-group-label,
  .rail-foot {
    display: none;
  }

  .nav-group {
    display: flex;
    gap: 2px;
    margin: 0;
  }

  .nav-item {
    white-space: nowrap;
  }

  .nav-item.is-on::before {
    display: none;
  }

  .page {
    padding: 20px 16px 96px;
  }

  .page-head {
    flex-direction: column;
  }

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

  .login-side {
    display: none;
  }

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

  .files,
  .setting,
  .form {
    grid-template-columns: minmax(0, 1fr);
  }

  .idea {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .idea-actions {
    grid-column: 1 / -1;
    flex-direction: row;
  }

  .dock {
    left: 12px;
    right: 12px;
    width: auto;
  }
}

/* ---------------------------------------------------------------- 流程：工序图
   按角色分泳道：每条泳道是一个工位（规划、执行、评审、出图、程序、人工），左端铭牌上写着这个工位现在用的模型。
   工序按先后从左到右排开，落在负责它的那条泳道上；连线画的是「先做完哪一步才轮到这一步」。 */

.flow-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.flow-progress .progress {
  flex: 1;
}

.lanes-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--sheet);
}

.flow-page > * {
  min-width: 0;      /* 工序图自己横向滚动，不把整页撑宽 */
}

.lanes {
  position: relative;
  display: grid;
  grid-auto-rows: minmax(84px, auto);
}

.lane-track {
  border-bottom: 1px solid var(--line);
}

.lane-track:nth-last-of-type(1),
.lanes > .lane-track:last-of-type {
  border-bottom: 0;
}

.lane-head {
  position: sticky;
  left: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  padding: 10px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--sheet-2);
  line-height: 1.35;
}

.lane-head b {
  font-size: 14px;
}

.lane-head span {
  color: var(--ink-2);
  font-family: var(--font-num);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.lane-head small {
  color: var(--ink-3);
  font-size: 11.5px;
  overflow-wrap: anywhere;
}

.lane-links {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.lane-link {
  fill: none;
  stroke: var(--line-2);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}

.lane-link.is-passed {
  stroke: var(--accent);
  stroke-dasharray: none;
}

.proc {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: auto 1fr;
  align-content: center;
  gap: 2px 8px;
  align-self: center;
  margin: 12px 9px;
  padding: 8px 9px 7px;
  border: 1px solid var(--line-2);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--sheet);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.proc:hover {
  border-color: var(--ink-3);
}

.proc.is-on {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

.proc--done { border-left-color: var(--ok); }
.proc--running { border-left-color: var(--info); background: var(--info-bg); }
.proc--failed { border-left-color: var(--bad); background: var(--bad-bg); }
.proc--waiting { border-left-color: var(--warn); background: var(--warn-bg); }
.proc--skipped { border-left-color: var(--off); color: var(--ink-3); }
.proc--pending { border-left-color: var(--line-2); border-style: dashed; border-left-style: solid; }

.proc-no {
  grid-row: span 2;
  align-self: start;
  color: var(--ink-3);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
}

.proc-title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
}

.proc-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 6px;
  min-width: 0;
  font-size: 12px;
}

.proc-by {
  color: var(--ink-3);
  font-style: normal;
  font-size: 11.5px;
}

.proc-card {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--line-2);
  border-radius: 6px;
  background: var(--sheet);
}

.proc-card--done { border-top-color: var(--ok); }
.proc-card--running { border-top-color: var(--info); }
.proc-card--failed { border-top-color: var(--bad); }
.proc-card--waiting { border-top-color: var(--warn); }

.proc-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.proc-card-head h2 {
  margin: 0;
  font-size: 17px;
}

.proc-card-head .proc-no {
  font-size: 22px;
}

.proc-who {
  color: var(--ink-2);
  font-size: 13px;
}

.proc-card-body {
  display: grid;
  gap: 14px;
  padding: 16px 18px 18px;
}

.proc-card-body h3 {
  margin: 0 0 2px;
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 600;
}

.proc-card-body p {
  margin: 0;
}

.proc-explain {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px 28px;
}

.proc-result p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.proc-error {
  max-height: 260px;
  margin: 6px 0 0;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.proc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
}

.proc-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.proc-file {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--sheet-2);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12.5px;
  cursor: pointer;
}

.proc-file:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tile-value--word {
  font-family: var(--font);
  font-size: 16px;
  line-height: 2.2;
}

.tile .progress {
  margin-top: 6px;
}

/* 自己动手做一步时的工作区 */

.work-area {
  width: 100%;
  min-height: 260px;
  resize: vertical;
}

.work-problem {
  max-height: 220px;
  overflow: auto;
  font-family: var(--font);
  white-space: pre-wrap;
}

.work-ref {
  margin-top: 10px;
}

.work-ref > summary {
  color: var(--accent);
  cursor: pointer;
}

.work-ref > .code,
.work-ref > .dv-root {
  max-height: 320px;
  margin-top: 8px;
  overflow: auto;
}

.work-files {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  margin-top: 10px;
}

.work-files-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: stretch;
}

.work-files-list .files-item {
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.work-files-list .files-item.is-on {
  background: var(--tint);
  font-weight: 600;
}

.work-files-list .btn {
  align-self: flex-start;
  margin-top: 6px;
}

/* ---------------------------------------------------------------- 官方文档：变化卡片与改动片段 */

.changes {
  display: grid;
  gap: 10px;
}

.change {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--sheet);
}

.change--major {
  border-left-color: var(--bad);
}

.change-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
}

.change-url {
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.change-delta {
  display: inline-flex;
  gap: 8px;
  font-size: 13px;
}

.change-delta i {
  font-style: normal;
}

.change-delta .is-add { color: var(--ok-ink); }
.change-delta .is-del { color: var(--bad-ink); }

.change-impact {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
}

.diff {
  max-height: 60vh;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sheet-2);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  overflow: auto;
}

.diff-line {
  padding: 0 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.diff-line--add { background: var(--ok-bg); color: var(--ok-ink); }
.diff-line--del { background: var(--bad-bg); color: var(--bad-ink); text-decoration: line-through; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }
.diff-line--hunk { color: var(--ink-3); border-top: 1px dashed var(--line-2); }

/* ---------------------------------------------------------------- 成本与定价 */

.meters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px 28px;
  margin-bottom: 14px;
}

.markup {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 12px;
  color: var(--ink-2);
}

.markup > b {
  color: var(--ink);
  font-size: 40px;
  font-weight: 600;
  line-height: 1.1;
}

.filters--inset {
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.table-note {
  margin: 0;
  padding: 8px 16px 12px;
  color: var(--ink-3);
  font-size: 12.5px;
}

.is-loss { color: var(--bad-ink); }
.is-gain { color: var(--ok-ink); }

@media (max-width: 760px) {
  .work-files {
    grid-template-columns: 1fr;
  }
}

.meters > .meter {
  margin-top: 0;     /* 并排放的用量条顶端对齐（默认的上下排列带间距） */
}

/* 确认换上新定义之前：逐处的差别 */

.kdiff-wrap {
  margin-top: 18px;
}

.kdiff-wrap > .muted {
  margin: 2px 0 0;
}

.kdiff {
  max-height: 46vh;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sheet-2);
  overflow: auto;
}

.kdiff-item {
  padding: 8px 0 6px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.kdiff-item:last-child {
  border-bottom: 0;
}

.kdiff-item > code {
  display: block;
  padding: 0 12px 4px;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

/* 品类「后台实测的规则」 */
.kind-facts-text {
  white-space: pre-wrap;
}
