/* ============================================================
   组件测试台 · UI Test Bench
   视觉方向：检测实验室 / 工程仪表 —— 纸白基底 + 仪表绿 + 信号橙，
   以「测试编号 + 状态印章」为签名元素，等宽字体承载读数。
   ============================================================ */

:root {
  /* 色板 */
  --paper: #F4F3EE;          /* 纸白基底 */
  --surface: #FFFFFF;        /* 卡片面 */
  --surface-alt: #FBFBF7;    /* 浅浮层 */
  --ink: #1C2420;            /* 主墨色 */
  --ink-2: #4A5550;          /* 次级文字 */
  --ink-3: #7C8781;          /* 弱化文字 */
  --line: #E2E0D7;           /* 分隔线 */
  --line-strong: #C9C6BA;    /* 强调分隔线 */
  --green: #1F7A5C;          /* 仪表绿（主色） */
  --green-deep: #165C47;
  --green-soft: #E6F0EA;
  --amber: #C77A1F;          /* 信号橙（强调） */
  --amber-soft: #F7ECDD;
  --red: #B3452E;
  --red-soft: #F7E9E4;
  --blue: #3E6E8E;
  --blue-soft: #E4EEF3;

  /* 字体 */
  --sans: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, 'Courier New', monospace;

  /* 间距与圆角 */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --shadow-1: 0 1px 2px rgba(28, 36, 32, 0.06), 0 4px 14px rgba(28, 36, 32, 0.05);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  border-radius: 2px;
}

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

/* ============================================================
   顶部控制台
   ============================================================ */

.console {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 251, 247, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.console__inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.brand__mark {
  width: 26px;
  height: 26px;
  color: var(--green);
  flex: none;
}

.brand__name {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.brand__tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-3);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.console__right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.console__status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2.4s ease-in-out infinite;
}

.status-dot.is-pass {
  background: var(--green);
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ============================================================
   按钮
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.1s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn--primary { background: var(--green); color: #fff; }
.btn--primary:hover { background: var(--green-deep); }

.btn--secondary { background: var(--green-soft); color: var(--green-deep); }
.btn--secondary:hover { background: #d5e7de; }

.btn--outline { background: transparent; color: var(--green-deep); border-color: var(--green); }
.btn--outline:hover { background: var(--green-soft); }

.btn--ghost { background: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: #ECE9E0; color: var(--ink); }

.btn--danger { background: var(--red); color: #fff; }
.btn--danger:hover { background: #96382a; }

.btn--sm { padding: 6px 12px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn--lg { padding: 12px 26px; font-size: 15.5px; border-radius: var(--r-md); }

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.spinner {
  width: 14px;
  height: 14px;
  color: currentColor;
  animation: spin 0.8s linear infinite;
  flex: none;
}

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

/* ============================================================
   首屏
   ============================================================ */

.hero {
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 85% 20%, rgba(31, 122, 92, 0.10), transparent 42%),
    radial-gradient(circle at 12% 90%, rgba(199, 122, 31, 0.08), transparent 40%),
    var(--surface-alt);
}

.hero__inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 72px 24px 56px;
}

.hero__kicker {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--green);
  margin: 0 0 14px;
}

.hero__title {
  font-size: clamp(34px, 5.4vw, 52px);
  line-height: 1.14;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
  font-weight: 700;
}

.hero__sub {
  max-width: 560px;
  color: var(--ink-2);
  font-size: 16px;
  margin: 0 0 30px;
}

.hero__stats {
  display: flex;
  gap: 40px;
  margin: 0 0 34px;
}

.stat { display: flex; flex-direction: column; }

.stat__num {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--ink);
}

.stat__label {
  font-size: 12.5px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ============================================================
   测试台主体
   ============================================================ */

.bench {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 24px 64px;
  display: grid;
  gap: 22px;
}

/* —— 检测卡片 —— */

.specimen {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  scroll-margin-top: 72px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.specimen.is-pass {
  border-color: rgba(31, 122, 92, 0.45);
  box-shadow: 0 0 0 1px rgba(31, 122, 92, 0.12), var(--shadow-1);
}

.specimen__head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #FDFDF9, #FAF9F3);
}

.specimen__id {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--green-deep);
  background: var(--green-soft);
  border: 1px solid rgba(31, 122, 92, 0.25);
  padding: 3px 9px;
  border-radius: 999px;
  flex: none;
}

.specimen__title {
  font-size: 16.5px;
  font-weight: 700;
  margin: 0;
  flex: 1;
  min-width: 0;
}

/* —— 状态印章 —— */

.stamp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1.5px dashed var(--line-strong);
  color: var(--ink-3);
  flex: none;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.stamp__icon {
  width: 13px;
  height: 13px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stamp[data-stamp="pass"] {
  background: var(--green-soft);
  border-color: var(--green);
  border-style: solid;
  color: var(--green-deep);
}

.stamp[data-stamp="pass"] .stamp__icon { opacity: 1; }

/* —— 分区内容 —— */

.specimen__body { padding: 22px; }

.demo-item { margin-bottom: 20px; }
.demo-item:last-child { margin-bottom: 0; }

.demo-item__label {
  display: inline-block;
  font-size: 12.5px;
  color: var(--ink-3);
  margin-bottom: 10px;
  letter-spacing: 0.04em;
}

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

.demo-note {
  font-size: 13px;
  color: var(--ink-3);
  margin: 14px 0 0;
}

/* ============================================================
   表单
   ============================================================ */

.form-card { max-width: 520px; }

.field { margin-bottom: 16px; }

.field label,
.field__label {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 6px;
}

.field input[type="text"],
.field input[type="email"],
.field select,
.field textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 92, 0.15);
}

.field textarea { resize: vertical; }

.field .count {
  display: block;
  text-align: right;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 4px;
}

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

.check,
.radio {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}

.check input,
.radio input {
  accent-color: var(--green);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ============================================================
   选项卡
   ============================================================ */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.tab {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  background: transparent;
  border: none;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.16s ease, border-color 0.16s ease;
}

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

.tab.is-active {
  color: var(--green-deep);
  border-bottom-color: var(--green);
  font-weight: 600;
}

.panels { min-height: 96px; }

.panel p { margin: 0; color: var(--ink-2); font-size: 14.5px; }

/* ============================================================
   手风琴
   ============================================================ */

.accordion { max-width: 720px; }

.acc-item {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--surface);
}

.acc-item:last-child { margin-bottom: 0; }

.acc-item__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  font-family: var(--sans);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface-alt);
  border: none;
  padding: 13px 16px;
  cursor: pointer;
  text-align: left;
}

.acc-item__head:hover { background: #F0EEE6; }

.acc-item__chev {
  width: 16px;
  height: 16px;
  color: var(--ink-3);
  flex: none;
  transition: transform 0.22s ease;
}

.acc-item.is-open .acc-item__chev { transform: rotate(180deg); }

.acc-item__body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.28s ease;
}

.acc-item.is-open .acc-item__body { max-height: 200px; }

.acc-item__body p {
  margin: 0;
  padding: 4px 16px 15px;
  font-size: 14px;
  color: var(--ink-2);
}

/* ============================================================
   弹窗
   ============================================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal[hidden] { display: none; }

.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(28, 36, 32, 0.55);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal__card {
  position: relative;
  width: min(480px, 100%);
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: 0 20px 60px rgba(28, 36, 32, 0.28);
  animation: riseIn 0.24s cubic-bezier(0.2, 0.7, 0.3, 1);
  padding: 24px;
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

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

.modal__title { font-size: 17px; font-weight: 700; margin: 0; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--ink-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  flex: none;
  transition: background 0.16s ease, color 0.16s ease;
}

.icon-btn:hover { background: #ECE9E0; color: var(--ink); }

.icon-btn svg { width: 16px; height: 16px; }

.modal__text { font-size: 14.5px; color: var(--ink-2); margin: 0 0 20px; }

.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============================================================
   提示 Toast
   ============================================================ */

.toast-wrap {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: #fff;
  background: var(--ink);
  border-radius: var(--r-md);
  padding: 11px 16px;
  box-shadow: 0 10px 30px rgba(28, 36, 32, 0.22);
  animation: toastIn 0.26s cubic-bezier(0.2, 0.7, 0.3, 1);
  max-width: 340px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: none; }
}

.toast.is-leaving {
  transition: opacity 0.25s ease, transform 0.25s ease;
  opacity: 0;
  transform: translateX(24px);
}

.toast__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.toast--ok { background: var(--green-deep); }
.toast--warn { background: var(--amber); }
.toast--err { background: var(--red); }

/* ============================================================
   徽章与标签
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 999px;
}

.badge--pass { background: var(--green-soft); color: var(--green-deep); }
.badge--warn { background: var(--amber-soft); color: #92581a; }
.badge--err { background: var(--red-soft); color: var(--red); }
.badge--info { background: var(--blue-soft); color: var(--blue); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 6px 6px 6px 12px;
  color: var(--ink-2);
  animation: tagIn 0.2s ease;
}

@keyframes tagIn { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }

.tag__x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--ink-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.tag__x:hover { background: #E5E2D8; color: var(--red); }

.tag__x svg { width: 13px; height: 13px; }

/* ============================================================
   进度
   ============================================================ */

.progress {
  width: 100%;
  max-width: 520px;
  height: 12px;
  background: #EDEBE2;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress__bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--green-deep), var(--green));
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(0.3, 0.8, 0.3, 1);
}

/* ============================================================
   表格
   ============================================================ */

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

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

.table th {
  text-align: left;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  text-transform: uppercase;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-strong);
}

.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
}

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

.table tbody tr { transition: background 0.12s ease; }

.table tbody tr:hover { background: var(--surface-alt); }

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

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pill--pass { background: var(--green-soft); color: var(--green-deep); }
.pill--run { background: var(--blue-soft); color: var(--blue); }
.pill--wait { background: #F0EEE6; color: var(--ink-3); }

/* ============================================================
   滑块与开关
   ============================================================ */

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  max-width: 520px;
  height: 6px;
  border-radius: 999px;
  background: #EDEBE2;
  outline: none;
  margin: 2px 0 12px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--green);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(28, 36, 32, 0.2);
  transition: transform 0.12s ease;
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.1); }

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--green);
  cursor: pointer;
}

.preview {
  width: 100%;
  max-width: 520px;
  height: 10px;
  background: #EDEBE2;
  border-radius: 999px;
  overflow: hidden;
}

.preview__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--amber), #E09B45);
  border-radius: 999px;
  transition: width 0.12s ease;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch__slider {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 21px;
  background: #D5D2C6;
  border-radius: 999px;
  transition: background 0.18s ease;
  flex: none;
}

.switch__slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
  box-shadow: 0 1px 2px rgba(28, 36, 32, 0.25);
}

.switch input:checked + .switch__slider { background: var(--green); }
.switch input:checked + .switch__slider::after { transform: translateX(17px); }

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

.switch input:disabled + .switch__slider {
  opacity: 0.5;
  cursor: not-allowed;
}

.switch input:disabled ~ span:last-child { opacity: 0.55; }

/* ============================================================
   图表
   ============================================================ */

.chart {
  display: flex;
  align-items: flex-end;
  gap: clamp(10px, 2.4vw, 22px);
  height: 200px;
  padding: 14px 6px 0;
  border-bottom: 1px solid var(--line-strong);
  margin-bottom: 12px;
  max-width: 720px;
}

.chart__col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  min-width: 0;
}

.chart__track {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: 4px;
  background: repeating-linear-gradient(
    to top,
    transparent 0,
    transparent calc(25% - 1px),
    rgba(28, 36, 32, 0.06) calc(25% - 1px),
    rgba(28, 36, 32, 0.06) 25%
  );
}

.chart__bar {
  width: clamp(18px, 60%, 40px);
  background: linear-gradient(180deg, var(--green), var(--green-deep));
  border-radius: 5px 5px 0 0;
  transition: height 0.5s cubic-bezier(0.3, 0.8, 0.3, 1);
}

.chart__col:nth-child(5) .chart__bar {
  background: linear-gradient(180deg, #E09B45, var(--amber));
}

.chart__label {
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
}

/* ============================================================
   页脚
   ============================================================ */

.foot {
  border-top: 1px solid var(--line);
  text-align: center;
  padding: 30px 24px 44px;
  color: var(--ink-2);
}

.foot p { margin: 0; font-size: 14px; }

.foot__sub {
  font-size: 12.5px !important;
  color: var(--ink-3);
  margin-top: 4px !important;
}

/* ============================================================
   响应式
   ============================================================ */

@media (max-width: 640px) {
  .console__inner { padding: 10px 16px; }
  .brand__tag { display: none; }
  .hero__inner { padding: 48px 18px 40px; }
  .hero__stats { gap: 26px; }
  .bench { padding: 28px 14px 48px; }
  .specimen__head { padding: 13px 16px; }
  .specimen__body { padding: 16px; }
  .toast-wrap { left: 14px; right: 14px; align-items: stretch; }
  .toast { max-width: none; }
}
