/* CPK · 布局（颜色见 brand-theme.css） */

.top {
  position: relative;
  text-align: left;
  margin: 0 auto;
  padding: 2rem 1rem 0.75rem;
}

.theme-toggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-solid, var(--panel));
  box-shadow: var(--shadow-sm);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.eyebrow {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.top h1 {
  margin: 0.25rem 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

header.site-head .brand .sub {
  margin: 0;
}

@media (max-width: 520px) {
  header.site-head .brand .sub {
    display: none;
  }
}

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

.head-row .theme-toggle {
  position: static;
}

.lang {
  display: flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--overlay);
  backdrop-filter: blur(8px);
}

.lang-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--muted);
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease;
}

.lang-btn.active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #042f2e;
  font-weight: 700;
}

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

/* .wrap 宽度见 brand-theme.css 流体自适应 */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius, 12px);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

label.inline {
  margin-top: 0.5rem;
}

input,
textarea,
select {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  font-size: 1rem;
  background: var(--input-bg);
  color: var(--text);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

textarea {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.92rem;
  resize: vertical;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}

.report-head {
  margin-bottom: 0.25rem;
}

.logo-field {
  margin-bottom: 0.75rem;
}

.logo-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
  min-height: 3.25rem;
  padding: 0.45rem 0.65rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm, 8px);
  background: var(--surface-deep);
  cursor: pointer;
}

.logo-box input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.logo-preview {
  max-height: 2.5rem;
  max-width: 5.5rem;
  object-fit: contain;
  flex-shrink: 0;
}

.logo-ph {
  font-size: 0.82rem;
}

.logo-clear {
  position: relative;
  z-index: 2;
  margin-left: auto;
  font-size: 0.82rem;
  padding: 0.15rem 0.35rem;
}

.tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: nowrap;
  margin-bottom: 0.75rem;
}

.tabs-row .tabs {
  margin-bottom: 0;
  flex-shrink: 1;
  min-width: 0;
  align-items: center;
  flex-wrap: nowrap;
}

.tabs-row .form-nav .link-btn {
  display: inline-flex;
  align-items: center;
  min-height: 2.35rem;
  padding: 0 0.35rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
}

.form-nav {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  flex-shrink: 0;
}

.icon-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.icon-tool svg {
  display: block;
}

.icon-tool:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.icon-tool:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.icon-tool:disabled:hover {
  border-color: var(--border);
  background: var(--input-bg);
  color: var(--text);
}

.icon-tool-danger:hover:not(:disabled) {
  border-color: var(--fail);
  background: var(--lock-bg);
  color: var(--lock-text);
}

.grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 0.75rem;
}

.spec-box {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0 1rem;
  background: var(--surface-deep, transparent);
}

.spec-box legend {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0 0.35rem;
}

.tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}

.hint {
  font-size: 0.85rem;
  margin: 0.35rem 0 0;
}

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

.file-label input {
  display: none;
}

.file-label span {
  display: inline-block;
  padding: 0.55rem 1rem;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  color: var(--accent);
  cursor: pointer;
  background: var(--upload-bg, var(--accent-soft));
}

.preview {
  margin-top: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: var(--surface-deep);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.82rem;
  font-family: ui-monospace, Menlo, monospace;
  line-height: 1.5;
  max-height: 12rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text);
  -webkit-overflow-scrolling: touch;
}

.btn,
.btn-ghost {
  border: none;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn {
  width: 100%;
  color: var(--primary-btn-text, #fff);
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
}

.btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.btn-ghost {
  width: auto;
  background: var(--btn-secondary-bg);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 0.88rem;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--btn-secondary-hover);
}

.btn-secondary {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: var(--btn-secondary-bg);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--btn-secondary-hover);
}

.result-actions {
  margin: 1rem 0 0;
  text-align: center;
}

.err {
  color: var(--err);
  font-size: 0.9rem;
  padding: 0.55rem 0.75rem;
  background: var(--lock-bg);
  border-radius: 8px;
  border: 1px solid var(--lock-border);
}

.out {
  margin-top: 0.5rem;
}

.result-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius, 12px);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.result-card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  color: var(--accent2);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.kpi {
  padding: 0.65rem;
  border-radius: 10px;
  background: var(--surface-deep);
  border: 1px solid var(--border);
  text-align: center;
}

.kpi .k {
  font-size: 0.78rem;
  color: var(--muted);
}

.kpi .v {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent2);
}

.kpi.highlight .v {
  color: var(--accent);
  font-size: 1.45rem;
}

.grade-badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--primary-btn-text, #fff);
  font-weight: 700;
  margin-left: 0.35rem;
}

.meta-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin-bottom: 1rem;
}

.meta-table th,
.meta-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 0.35rem;
  text-align: left;
}

.meta-table th {
  color: var(--muted);
  font-weight: 500;
  width: 38%;
}

.chart-wrap {
  position: relative;
  height: 360px;
  margin-top: 0.35rem;
  padding: 10px 12px 8px;
  background: #fff;
  border: 1px solid #000;
  border-radius: 0;
}

.chart-wrap canvas {
  display: block;
}

@media (min-width: 768px) {
  .out .chart-wrap {
    max-width: 960px;
    margin-inline: auto;
  }
}

/* 分析结果 · SPC 控制图 / 竖版图表在宽屏居中 */
.result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.65rem;
}

.result-head h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--accent2);
}

.grade {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.875rem;
}

.grade-b {
  background: #d1fae5;
  color: #065f46;
}

.grade-d {
  background: #fee2e2;
  color: #991b1b;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: var(--surface-deep);
}

.data-table th,
.data-table td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: var(--formula-bg, var(--accent-soft));
  color: var(--accent);
  font-weight: 600;
}

.data-table tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--surface-deep) 55%, var(--panel) 45%);
}

.data-table-rules {
  table-layout: fixed;
}

.data-table-rules .col-rule-no {
  width: 3.2rem;
  white-space: nowrap;
  text-align: center;
}

.data-table-rules .col-rule-desc {
  width: 48%;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.data-table-rules .col-rule-pts {
  width: 38%;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 0.88rem;
  color: var(--muted);
}

.result-section {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: var(--surface-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.result-section h3 {
  margin: 0 0 0.65rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent2);
}

.chart-fig {
  margin: 1rem auto 0;
  padding: 0.75rem;
  background: var(--surface-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  max-width: 100%;
}

.chart-fig img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
}

.chart-fig figcaption {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
  color: var(--muted);
}

@media (min-width: 768px) {
  .out .chart-fig {
    max-width: min(100%, 820px);
  }
}

.hist-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.25rem;
  margin: 1rem 0 0.35rem;
}

.hist-title {
  margin: 0;
  font-size: 1rem;
  color: var(--accent2);
}

.hist-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.25rem;
  font-size: 0.85rem;
  color: var(--text);
}

.hist-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.lg-bar {
  display: inline-block;
  width: 12px;
  height: 8px;
  background: #a4c8ec;
  border: 1px solid #000;
  flex-shrink: 0;
}

.lg-normal {
  display: inline-block;
  width: 18px;
  height: 0;
  border-top: 2px solid #000;
  flex-shrink: 0;
}

.lg-normal-dash {
  border-top-style: dashed;
}

.lg-skew {
  display: inline-block;
  width: 18px;
  height: 0;
  border-top: 3px solid #8b0000;
  flex-shrink: 0;
}

.lg-fit {
  display: inline-block;
  width: 18px;
  height: 0;
  border-top: 3px solid #1565c0;
  flex-shrink: 0;
}

footer.foot {
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  padding: 1rem;
}

#viewAql .ws-foot .foot {
  text-align: left;
  padding: 0;
}

/* ── 会员 / 激活码（对标 5000） ── */
.license-zone {
  padding: 10px 14px;
  margin-bottom: 12px;
}

.license-zone.hidden {
  display: none;
}

.license-zone.lz-collapsed {
  padding: 8px 14px;
}

.lz-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
}

.lz-label {
  flex-shrink: 0;
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
}

.license-preview {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.license-zone.lz-collapsed .license-key-row {
  display: none;
}

.license-zone:not(.lz-collapsed) .license-key-row .license-preview {
  display: none;
}

.license-key-row {
  margin-top: 8px;
}

.device-code-display {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 0;
  background: transparent;
  border: none;
}

.license-key-row #licenseKey {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 6px 8px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.lz-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.lz-action-btn {
  font-size: 0.88rem;
  line-height: 1.35;
  padding: 4px 0;
  white-space: nowrap;
}

.license-auto-hint {
  color: var(--muted);
  white-space: nowrap;
  font-size: 12px;
}

.license-auto-hint.hidden {
  display: none;
}

.license-zone.lz-collapsed .lz-extra {
  display: none;
}

.license-zone.lz-collapsed.lz-pin-extra .lz-extra {
  display: block;
  margin-top: 8px;
}

.license-zone.lz-pin-extra .hint.lz-extra {
  color: var(--lock-text, #be123c);
  font-weight: 600;
}

.license-zone .hint.lz-extra {
  margin: 10px 0 0;
  font-size: 0.85rem;
  line-height: 1.45;
}

.lock-banner {
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: rgba(190, 18, 60, 0.12);
  color: var(--lock-text, #be123c);
  font-size: 0.9rem;
  line-height: 1.45;
}

.lock-banner.hidden {
  display: none;
}

.card.disabled,
form.disabled {
  opacity: 0.65;
  pointer-events: none;
}

.btn-locked {
  opacity: 0.85;
  border-style: dashed;
}

.result-actions .btn-locked {
  cursor: pointer;
}

@media (max-width: 560px) {
  .grid2,
  .grid3 {
    grid-template-columns: 1fr;
  }

  .tabs-row {
    flex-wrap: nowrap;
    gap: 0.35rem;
  }

  .tabs-row .tab {
    padding: 0.4rem 0.55rem;
    font-size: 0.8125rem;
    min-height: 2.05rem;
  }

  .tabs-row .icon-tool {
    width: 2.05rem;
    height: 2.05rem;
  }

  .tabs-row .form-nav {
    width: auto;
    flex-shrink: 0;
    gap: 0.25rem;
  }

  .tabs-row .form-nav .link-btn {
    min-height: 2.05rem;
    font-size: 0.8125rem;
    padding: 0 0.2rem;
  }

  .lz-row {
    flex-wrap: wrap;
  }
  .lz-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .license-preview {
  width: 100%;
  }
  .lz-action-btn {
    min-height: 44px;
    padding: 8px 0;
  }
}

/* ⚙️ / ? 弹窗 · 会员说明与客服（高对比 · 深浅色均清晰） */
.head-menu-panel .head-menu-hint,
#licenseMenuHint {
  display: block;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1.5 !important;
  color: #f8fafc !important;
  background: rgba(30, 41, 59, 0.92) !important;
  border: 1px solid rgba(148, 163, 184, 0.45);
  text-shadow: none;
}

html[data-theme="light"] .head-menu-panel .head-menu-hint,
html[data-theme="light"] #licenseMenuHint {
  color: #0f172a !important;
  background: #e2e8f0 !important;
  border-color: #94a3b8;
}

.head-menu-panel .head-menu-hint-ok,
#licenseMenuHint.head-menu-hint-ok {
  color: #052e16 !important;
  background: #bbf7d0 !important;
  border-color: #4ade80 !important;
}

html:not([data-theme="light"]) .head-menu-panel .head-menu-hint-ok,
html:not([data-theme="light"]) #licenseMenuHint.head-menu-hint-ok {
  color: #ecfdf5 !important;
  background: rgba(6, 78, 59, 0.85) !important;
  border-color: #34d399 !important;
}

html[data-theme="light"] .head-menu-panel .head-menu-hint-warn,
html[data-theme="light"] #licenseMenuHint.head-menu-hint-warn {
  color: #7f1d1d !important;
  background: #ffe4e6 !important;
  border: 1px solid #e11d48 !important;
}

.head-help-panel .head-menu-support-hint,
.head-help-panel .head-menu-support-intro {
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1.55 !important;
  color: #f1f5f9 !important;
}

html[data-theme="light"] .head-help-panel .head-menu-support-hint,
html[data-theme="light"] .head-help-panel .head-menu-support-intro {
  color: #334155 !important;
}

.head-help-panel .head-menu-support-row .head-menu-inline-label,
.head-menu-panel .head-menu-inline-row .head-menu-inline-label {
  color: #e2e8f0 !important;
  font-weight: 700 !important;
}

html[data-theme="light"] .head-help-panel .head-menu-support-row .head-menu-inline-label,
html[data-theme="light"] .head-menu-panel .head-menu-inline-row .head-menu-inline-label {
  color: #475569 !important;
}

.head-help-panel .head-menu-support-value {
  font-size: 13px !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  letter-spacing: 0.02em;
}

html[data-theme="light"] .head-help-panel .head-menu-support-value {
  color: #0f172a !important;
}

.qc-suite-main {
  display: flex;
  flex-direction: column;
  width: 100%;
  box-sizing: border-box;
}

.qc-main-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 12px;
  padding: 0;
  flex-shrink: 0;
}
.qc-main-tab {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border, rgba(148, 163, 184, 0.35));
  border-radius: 10px;
  background: var(--card, rgba(15, 23, 42, 0.4));
  color: inherit;
  font-size: 14px;
  cursor: pointer;
}
.qc-main-tab.active {
  border-color: var(--accent, #10b981);
  box-shadow: 0 0 0 1px var(--accent, #10b981);
}
.qc-view-panel.hidden {
  display: none !important;
}

/* 三 Tab 内容区：与 Tab 同宽（CPK 表单 / AQL·SPC iframe 统一） */
.qc-view-cpk {
  width: 100%;
  padding-inline: 0;
  margin-inline: 0;
  box-sizing: border-box;
}
.qc-view-cpk > form.card,
#viewCpk > form.card {
  width: 100%;
  max-width: none;
  margin-inline: 0;
  box-sizing: border-box;
}
.qc-embed-frame {
  display: block;
  width: 100%;
  min-height: 78vh;
  border: 0;
  border-radius: 0;
  background: transparent;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
}
.qc-aql-frame {
  min-height: 88vh;
}
.qc-shared-header {
  margin-bottom: 12px;
  --qc-field-h: 2.75rem;
}
.qc-shared-header .grid2 {
  row-gap: 0.75rem;
}
.qc-shared-header .report-head {
  margin-bottom: 0;
}
.qc-shared-header label {
  margin-bottom: 0;
}
.qc-shared-header .logo-field {
  margin-bottom: 0;
}
.qc-shared-header .logo-box,
.qc-shared-header input[type="text"] {
  height: var(--qc-field-h);
  min-height: var(--qc-field-h);
  margin-top: 0.35rem;
  box-sizing: border-box;
}
.qc-shared-header .logo-box {
  padding: 0 0.65rem;
}
.qc-shared-header .logo-preview {
  max-height: calc(var(--qc-field-h) - 0.5rem);
}
.form-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 8px;
}
.qc-handoff-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.qc-handoff-bar .hint {
  margin: 0;
}
.result-card .qc-handoff-bar {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border, rgba(148, 163, 184, 0.25));
}
#viewAql .aql-lead {
  margin: 0 0 12px;
}

/* AQL 内嵌一体（§M-3.1.5 · 与 CPK form.card 同宽同风格） */
#viewAql .worksheet {
  margin: 0 0 1rem;
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius, 12px);
  box-shadow: var(--shadow-sm);
  backdrop-filter: none;
  box-sizing: border-box;
  padding: 0;
}
#viewAql .worksheet::before {
  display: none;
}

/* SPC 内嵌一体（§M-3.1.5 · 与 CPK form.card 同宽同风格） */
html[data-spc-embed="1"] #viewSpc form.card,
html[data-spc-embed="1"] #viewSpc .out {
  margin: 0 0 1rem;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius, 12px);
  box-shadow: var(--shadow-sm);
}

/* 5003 手机端：Tab / CPK / AQL / SPC 统一贴边，去掉 iframe 独立窗口感 */
@media (max-width: 767px) {
  .qc-shared-header.card {
    margin-bottom: 0;
  }

  .qc-main-tabs {
    gap: 0;
    margin-bottom: 0;
    padding-inline: var(--page-gutter);
    border-bottom: 1px solid var(--border);
  }

  .qc-main-tab {
    border-radius: 0;
    border-top: none;
    border-left: none;
    border-right: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: transparent;
    box-shadow: none;
  }

  .qc-main-tab.active {
    border-bottom-color: var(--accent, #10b981);
    box-shadow: none;
  }

  .qc-view-cpk > form.card,
  #viewCpk > form.card {
    margin-inline: 0;
    border-radius: 0;
  }

  .qc-embed-frame {
    border-radius: 0;
    min-height: 72vh;
    background: transparent;
  }

  .qc-aql-frame {
    min-height: 78vh;
  }

  #viewAql .worksheet {
    margin-bottom: 0;
    border-top: none;
    border-left: none;
    border-right: none;
    border-radius: 0;
    box-shadow: none;
  }

  html[data-spc-embed="1"] #viewSpc form.card,
  html[data-spc-embed="1"] #viewSpc .out {
    margin-bottom: 0;
    border-top: none;
    border-left: none;
    border-right: none;
    border-radius: 0;
    box-shadow: none;
  }
}

/* ── 按行输入（子组表格）── */
.row-table-wrap {
  overflow-x: auto;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
}
.row-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.row-table th {
  background: var(--surface2, #f5f5f5);
  color: var(--muted);
  font-weight: 500;
  font-size: 0.75rem;
  padding: 0.4rem 0.5rem;
  text-align: center;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.row-table td {
  padding: 0.15rem 0.35rem;
  border-bottom: 1px solid var(--border-subtle, #eee);
}
.row-table td.row-no {
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
  width: 2.5rem;
  min-width: 2.5rem;
}
.row-table input {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.875rem;
  width: 5.5rem;
  min-width: 4.5rem;
  padding: 0.35rem 0.4rem;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  text-align: center;
  background: transparent;
  transition: border-color 0.15s, background 0.15s;
}
.row-table input:hover {
  background: var(--surface2, #f5f5f5);
}
.row-table input:focus {
  outline: none;
  border-color: var(--accent, #2E7D32);
  background: var(--surface, #fff);
  box-shadow: 0 0 0 1px var(--accent, #2E7D32);
}
.row-table-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.row-table-actions .btn-outline {
  font-size: 0.8125rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: transparent;
  color: var(--body);
  cursor: pointer;
}
.row-table-actions .btn-outline:hover {
  background: var(--surface2, #f5f5f5);
  border-color: var(--accent, #2E7D32);
  color: var(--accent, #2E7D32);
}
/* 子组结果明细表 */
.subgroup-table-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0.75rem 0 0.35rem;
  color: var(--body);
}
.subgroup-table-wrap {
  overflow-x: auto;
  margin-bottom: 0.5rem;
}
.subgroup-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  margin-top: 0.75rem;
  margin-bottom: 0.5rem;
}
.subgroup-detail-table th,
.subgroup-detail-table td {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  text-align: center;
}
.subgroup-detail-table th {
  background: var(--surface2, #f5f5f5);
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--muted);
}
.subgroup-detail-table td.vals {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.75rem;
  text-align: left;
  white-space: nowrap;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.subgroup-detail-table td.num {
  font-family: ui-monospace, Menlo, monospace;
}
