/* ═══════════════════════════════════════════════════════════════
   服务型制造高地诊断 · 主样式
   ═══════════════════════════════════════════════════════════════ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--ink-800);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* 防止个别元素溢出导致整页横向滚动（响应式必备兜底） */
  overflow-x: hidden;
}

h1, h2, h3, h4, p, ul, ol, figure {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

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

/* ── 布局骨架 ───────────────────────────────────────────── */

.app {
  display: flex;
  min-height: 100vh;
  /* 防止子元素撑破容器（响应式兜底） */
  max-width: 100%;
  overflow-x: hidden;
}

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--navy-900);
  color: var(--navy-100);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  padding: var(--sp-6) var(--sp-5);
  border-bottom: 1px solid rgba(168, 200, 220, .12);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}

.brand-logo {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.brand-title {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--white);
  letter-spacing: .2px;
  line-height: 1.3;
  white-space: nowrap;
}

.brand-sub {
  font-size: var(--fs-xs);
  color: var(--navy-400);
  letter-spacing: .4px;
  white-space: nowrap;
}

.sidebar-nav {
  padding: var(--sp-4) var(--sp-3);
  flex: 1;
}

.nav-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: var(--navy-400);
  text-transform: uppercase;
  padding: var(--sp-3) var(--sp-3) var(--sp-2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: 11px var(--sp-3);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  color: var(--navy-200);
  text-align: left;
  transition: background var(--transition), color var(--transition);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.nav-item:hover {
  background: rgba(168, 200, 220, .08);
  color: var(--white);
}

.nav-item.is-active {
  background: rgba(43, 179, 166, .16);
  color: var(--white);
  font-weight: 600;
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--accent-400);
}

.nav-num {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: var(--r-full);
  background: rgba(168, 200, 220, .14);
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  color: var(--navy-200);
  font-family: var(--font-num);
}

.nav-item.is-active .nav-num {
  background: var(--accent-500);
  color: var(--white);
}

.nav-item.is-done .nav-num {
  background: var(--accent-600);
  color: var(--white);
}

.sidebar-foot {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid rgba(168, 200, 220, .12);
  font-size: 11px;
  color: var(--navy-400);
  line-height: 1.7;
}

/* ── 主内容区 ───────────────────────────────────────────── */

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

.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--ink-200);
  padding: var(--sp-4) var(--sp-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left {
  min-width: 0;
}

.page-title {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -.2px;
  line-height: 1.3;
}

.page-desc {
  font-size: var(--fs-sm);
  color: var(--ink-500);
  margin-top: 2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

.content {
  flex: 1;
  padding: var(--sp-8);
  /* 默认铺满可用宽度。表单页/报告页都由卡片分区，
     不需要靠 max-width 限制行宽；限制反而会在宽屏右侧留出空白。
     真正需要「内容居中不铺满」的只有正文类阅读页面，本项目没有。 */
  max-width: none;
  min-width: 0;
  margin: 0 auto;
}

/* ── 按钮 ───────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 10px 18px;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--navy-700);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--navy-600);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  background: var(--navy-800);
}

.btn-accent {
  background: var(--accent-600);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.btn-accent:hover {
  background: var(--accent-500);
  box-shadow: var(--shadow-md);
}

.btn-ghost {
  background: var(--bg-card);
  color: var(--ink-700);
  border-color: var(--ink-300);
}

.btn-ghost:hover {
  background: var(--ink-50);
  border-color: var(--ink-400);
}

.btn-lg {
  padding: 14px 26px;
  font-size: var(--fs-md);
  border-radius: var(--r-lg);
}

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.btn-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ── 卡片 ───────────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card + .card {
  margin-top: var(--sp-5);
}

.card-head {
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--ink-200);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  background: var(--bg-subtle);
}

.card-head-main {
  min-width: 0;
}

.card-title {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--ink-900);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  line-height: 1.4;
}

.card-sub {
  font-size: var(--fs-xs);
  color: var(--ink-500);
  margin-top: 3px;
}

.card-body {
  padding: var(--sp-6);
}

.card-badge {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-num);
  padding: 3px 9px;
  border-radius: var(--r-full);
  background: var(--navy-100);
  color: var(--navy-700);
  letter-spacing: .3px;
  flex-shrink: 0;
}

/* ── 表单 ───────────────────────────────────────────────── */

.form-grid {
  display: grid;
  /* 默认三列；窄屏由响应式断点改为两列 / 单列。
     不用 auto-fit —— 它与跨列字段冲突，会导致排布错位。 */
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-5);
}

.form-grid > .field.is-wide {
  grid-column: span 2;
}

@media (max-width: 640px) {
  .form-grid > .field.is-wide { grid-column: auto; }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

/* switch 类型字段：横向排布，标签在左、开关在右，提示文字紧随其下。
   避免「标签 + 开关 + 提示」三层堆叠造成高度不齐。 */
.field.is-switch {
  grid-column: 1 / -1;
  gap: 4px;
}

.field.is-switch .switch-row {
  width: 100%;
}

/* 开关类的提示文字左对齐，不跟随开关缩进 */
.field.is-switch .field-hint {
  padding-left: 2px;
}

/* 单独一行的普通字段（如「核心区范围」）也铺满，避免右侧留空 */
.field.is-full {
  grid-column: 1 / -1;
}

/* 基本信息区：该区块用两列更自然（字段名长、下拉框宽）
   通过 .form-grid.is-two 在任意屏幕下固定两列 */
.form-grid.is-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.is-two > .field.is-full {
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  .form-grid.is-two { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .field.is-switch,
  .field.is-full { grid-column: auto; }
}

.field-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-700);
  display: flex;
  align-items: center;
  gap: 6px;
}

.field-hint {
  font-size: 12px;
  color: var(--ink-400);
  line-height: 1.5;
}

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

.input,
.select {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--ink-300);
  border-radius: var(--r-md);
  background: var(--bg-card);
  font-size: var(--fs-base);
  color: var(--ink-900);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.input:hover,
.select:hover {
  border-color: var(--ink-400);
}

.input:focus,
.select:focus {
  border-color: var(--navy-500);
  box-shadow: 0 0 0 3px rgba(47, 107, 143, .12);
}

.input.is-warn {
  border-color: var(--warn-500);
  background: var(--warn-50);
}

.input.is-danger {
  border-color: var(--danger-500);
  background: var(--danger-50);
}

.input-num {
  font-family: var(--font-num);
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: .3px;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23667085' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
  cursor: pointer;
}

/* 三态单选 */
.tri-group {
  display: flex;
  gap: 0;
  border: 1px solid var(--ink-300);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-card);
  min-height: 42px;
}

.tri-opt {
  flex: 1 1 0;
  min-width: 0;
  padding: 9px 4px;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--ink-500);
  border-right: 1px solid var(--ink-200);
  transition: all var(--transition);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tri-opt:last-child {
  border-right: none;
}

.tri-opt:hover {
  background: var(--ink-50);
  color: var(--ink-700);
}

.tri-opt.is-on[data-val="true"] {
  background: var(--ok-50);
  color: var(--ok-600);
  font-weight: 700;
}

.tri-opt.is-on[data-val="瑕疵"] {
  background: var(--warn-50);
  color: var(--warn-600);
  font-weight: 700;
}

.tri-opt.is-on[data-val="false"] {
  background: var(--danger-50);
  color: var(--danger-600);
  font-weight: 700;
}

/* 多选标签 */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.chip {
  padding: 7px 14px;
  border-radius: var(--r-full);
  border: 1px solid var(--ink-300);
  background: var(--bg-card);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--ink-600);
  transition: all var(--transition);
}

.chip:hover {
  border-color: var(--navy-400);
  color: var(--navy-700);
  background: var(--navy-50);
}

.chip.is-on {
  background: var(--navy-700);
  border-color: var(--navy-700);
  color: var(--white);
  font-weight: 600;
}

.chip.is-on:hover {
  background: var(--navy-600);
}

/* 开关 */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: 11px 14px;
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  transition: all var(--transition);
}

.switch-row:hover {
  border-color: var(--ink-300);
}

.switch-row.is-on {
  background: var(--accent-50);
  border-color: var(--accent-400);
}

.switch-label {
  font-size: var(--fs-sm);
  color: var(--ink-700);
  line-height: 1.45;
  min-width: 0;
}

.switch-row.is-on .switch-label {
  color: var(--accent-600);
  font-weight: 600;
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  border-radius: var(--r-full);
  background: var(--ink-300);
  transition: background var(--transition);
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition);
}

.switch-row.is-on .switch {
  background: var(--accent-500);
}

.switch-row.is-on .switch::after {
  transform: translateX(20px);
}

/* ── 政策红线计数卡 ─────────────────────────────────────── */

.redline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: var(--sp-4);
}

.redline {
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  background: var(--bg-card);
  transition: all var(--transition);
}

.redline.is-met {
  border-color: var(--ok-100);
  background: var(--ok-50);
}

.redline.is-miss {
  border-color: var(--danger-500);
  background: var(--danger-50);
  box-shadow: 0 0 0 3px rgba(217, 45, 32, .08);
}

.redline-label {
  font-size: var(--fs-xs);
  color: var(--ink-600);
  margin-bottom: var(--sp-2);
  font-weight: 500;
}

.redline-count {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-family: var(--font-num);
}

.redline-now {
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: 1;
  color: var(--ink-900);
}

.redline.is-miss .redline-now {
  color: var(--danger-600);
}

.redline.is-met .redline-now {
  color: var(--ok-600);
}

.redline-need {
  font-size: var(--fs-sm);
  color: var(--ink-400);
  font-weight: 600;
}

.redline-flag {
  font-size: 11px;
  font-weight: 700;
  margin-top: var(--sp-2);
  letter-spacing: .3px;
}

.redline.is-miss .redline-flag {
  color: var(--danger-600);
}

.redline.is-met .redline-flag {
  color: var(--ok-600);
}

/* ── 结果页 ─────────────────────────────────────────────── */

.grade-hero {
  border-radius: var(--r-xl);
  padding: var(--sp-8);
  color: var(--white);
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-8);
  align-items: center;
}

.grade-hero::before {
  content: "";
  position: absolute;
  right: -80px;
  top: -80px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .06);
}

.grade-hero::after {
  content: "";
  position: absolute;
  right: 60px;
  bottom: -120px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .04);
}

.grade-hero > * {
  position: relative;
  z-index: 1;
}

.grade-hero.g-excellent { background: linear-gradient(135deg, var(--accent-600) 0%, #0b5e57 100%); }
.grade-hero.g-qualify   { background: linear-gradient(135deg, var(--navy-700) 0%, var(--navy-900) 100%); }
.grade-hero.g-borderline { background: linear-gradient(135deg, #a15c0a 0%, #7a4408 100%); }
.grade-hero.g-defer    { background: linear-gradient(135deg, var(--warn-600) 0%, #8a3606 100%); }
.grade-hero.g-disqualified { background: linear-gradient(135deg, var(--danger-600) 0%, #7a1a12 100%); }

.grade-eyebrow {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: .75;
  margin-bottom: var(--sp-3);
}

.grade-title {
  font-size: var(--fs-3xl);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.5px;
  margin-bottom: var(--sp-3);
}

.grade-reason {
  font-size: var(--fs-base);
  opacity: .88;
  line-height: 1.6;
  max-width: 560px;
}

.grade-score-box {
  text-align: center;
  padding: var(--sp-4) var(--sp-6);
  background: rgba(255, 255, 255, .12);
  border-radius: var(--r-lg);
  border: 1px solid rgba(255, 255, 255, .18);
  backdrop-filter: blur(8px);
  min-width: 180px;
}

.grade-score-label {
  font-size: var(--fs-xs);
  opacity: .8;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.grade-score-val {
  font-family: var(--font-num);
  font-size: var(--fs-4xl);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -1px;
}

.grade-score-val small {
  font-size: var(--fs-lg);
  opacity: .6;
  font-weight: 600;
}

/* 维度卡 */
.dim-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.dim-row {
  display: grid;
  grid-template-columns: 150px 1fr 88px;
  gap: var(--sp-4);
  align-items: center;
}.dim-name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-800);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.dim-code {
  font-family: var(--font-num);
  font-size: 11px;
  color: var(--ink-400);
  font-weight: 700;
  background: var(--ink-100);
  padding: 1px 6px;
  border-radius: var(--r-sm);
}

.dim-track {
  height: 10px;
  background: var(--ink-100);
  border-radius: var(--r-full);
  overflow: hidden;
  position: relative;
}

.dim-fill {
  height: 100%;
  border-radius: var(--r-full);
  transition: width 700ms cubic-bezier(.16, 1, .3, 1);
  background: var(--navy-500);
}

/* 达成率色阶：积极色用青绿，中性用藏青，偏低用琥珀，严重不足才用红。
   注意 45%—70% 这段属于「正常但可提升」，不宜用警示色，避免整页发橙。 */
.dim-fill.is-high { background: var(--accent-500); }
.dim-fill.is-mid  { background: var(--navy-500); }
.dim-fill.is-low  { background: var(--navy-400); }
.dim-fill.is-poor { background: #c8791a; }
.dim-fill.is-crit { background: var(--danger-500); }

.dim-val {
  text-align: right;
  font-family: var(--font-num);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink-800);
}

.dim-val small {
  color: var(--ink-400);
  font-weight: 600;
  font-size: 12px;
}

/* 差距清单表 */
.gap-table {
  font-size: var(--fs-sm);
}

.gap-table th {
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-500);
  padding: 10px var(--sp-3);
  border-bottom: 1px solid var(--ink-200);
  background: var(--bg-subtle);
  white-space: nowrap;
}

.gap-table td {
  padding: 13px var(--sp-3);
  border-bottom: 1px solid var(--ink-100);
  vertical-align: middle;
}

.gap-table tbody tr {
  transition: background var(--transition);
}

.gap-table tbody tr:hover {
  background: var(--navy-50);
}

.gap-table .num {
  font-family: var(--font-num);
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.gap-rank {
  width: 30px;
  height: 30px;
  border-radius: var(--r-full);
  display: grid;
  place-items: center;
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 700;
  background: var(--ink-100);
  color: var(--ink-600);
}

.gap-rank.r1 { background: var(--accent-600); color: var(--white); }
.gap-rank.r2 { background: var(--accent-500); color: var(--white); }
.gap-rank.r3 { background: var(--accent-400); color: var(--white); }

.gap-item-name {
  font-weight: 600;
  color: var(--ink-900);
}

.gap-ref {
  font-size: 11px;
  color: var(--ink-400);
  margin-top: 2px;
}

.room-pos {
  color: var(--accent-600);
  font-size: var(--fs-md);
}

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
}

.tag-easy { background: var(--ok-100); color: var(--ok-600); }
.tag-mid  { background: var(--warn-100); color: var(--warn-600); }
.tag-hard { background: var(--danger-100); color: var(--danger-600); }

/* 红线警示列表（结果页） */
.warn-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.warn-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  line-height: 1.55;
}

.warn-item.is-danger {
  background: var(--danger-50);
  border-left: 3px solid var(--danger-500);
}

.warn-item.is-warn {
  background: var(--warn-50);
  border-left: 3px solid var(--warn-500);
}

.warn-item.is-ok {
  background: var(--ok-50);
  border-left: 3px solid var(--ok-500);
}

.warn-item.is-info {
  background: var(--navy-50);
  border-left: 3px solid var(--navy-400);
}

.warn-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.warn-item.is-danger .warn-icon { color: var(--danger-600); }
.warn-item.is-warn .warn-icon { color: var(--warn-600); }
.warn-item.is-ok .warn-icon { color: var(--ok-600); }
.warn-item.is-info .warn-icon { color: var(--navy-600); }

.warn-text strong {
  font-weight: 700;
}

/* 图表容器 */
.chart-wrap {
  position: relative;
  height: 340px;
}

.chart-wrap.is-tall {
  height: 400px;
}

/* 空状态 */
.empty {
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
  color: var(--ink-400);
}

.empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--sp-4);
  color: var(--ink-300);
}

.empty-title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--ink-600);
  margin-bottom: var(--sp-2);
}

/* ── 底部操作条 ─────────────────────────────────────────── */

.action-bar {
  position: sticky;
  bottom: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--ink-200);
  padding: var(--sp-4) var(--sp-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  box-shadow: 0 -4px 12px rgba(16, 24, 40, .04);
  z-index: 15;
}

.action-hint {
  font-size: var(--fs-xs);
  color: var(--ink-500);
}

.action-hint strong {
  color: var(--ink-800);
  font-family: var(--font-num);
}

/* ── 工具类 ─────────────────────────────────────────────── */

.u-mt-2 { margin-top: var(--sp-2); }
.u-mt-4 { margin-top: var(--sp-4); }
.u-mt-6 { margin-top: var(--sp-6); }
.u-mb-4 { margin-bottom: var(--sp-4); }
.u-flex { display: flex; }
.u-between { justify-content: space-between; }
.u-center { align-items: center; }
.u-gap-2 { gap: var(--sp-2); }
.u-gap-3 { gap: var(--sp-3); }
.u-hide { display: none !important; }

.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.text-muted { color: var(--ink-500); }

.section-title {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--ink-900);
  margin-bottom: var(--sp-2);
  letter-spacing: -.2px;
}

.section-desc {
  font-size: var(--fs-sm);
  color: var(--ink-500);
  margin-bottom: var(--sp-5);
  line-height: 1.6;
}

/* 旧数据提示条 */
.notice {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-md);
  background: var(--navy-50);
  border: 1px solid var(--navy-100);
  font-size: var(--fs-sm);
  color: var(--navy-700);
  margin-bottom: var(--sp-5);
}

.notice svg {
  flex-shrink: 0;
  color: var(--navy-500);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink-900);
  color: var(--white);
  padding: 12px 22px;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  opacity: 0;
  pointer-events: none;
  transition: all 260ms cubic-bezier(.16, 1, .3, 1);
  z-index: 100;
}

.toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── 响应式 ─────────────────────────────────────────────
   策略：用「显式列数」控制栅格，不用 auto-fit。
   原因：auto-fit + span 2 在窄屏会出现「第1个字段占满整行、
   其余字段挤在下一行只占半宽」的错位（实测 1080px 下发生）。
   断点按可用宽度（视口 - 侧栏）设计，而非视口宽度。
   ─────────────────────────────────────────────────────── */

/* 超宽屏：内容区铺满，只在两侧保留固定边距。
   早期版本设 max-width（1560/1440）是为了限制行宽，但表单页与报告页
   本来就有卡片分区，不需要限制行宽，反而会在宽屏右侧留下明显空白。
   这里改为「铺满 + 居中 + 两侧留白」的稳妥做法：给上下限，但足够宽。 */
@media (min-width: 1600px) {
  .sidebar { width: 280px; }
  .content { max-width: 1680px; }
  .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* 标准宽屏 */
@media (min-width: 1400px) and (max-width: 1599px) {
  .content { max-width: 100%; }
}

/* 1280 — 1399 */
@media (min-width: 1280px) and (max-width: 1399px) {
  .content { max-width: 100%; }
}

/* 1080 — 1279：内容区变窄，表单降为两列 */
@media (max-width: 1279px) {
  .content { max-width: 100%; }
}

/* 中屏：两列栅格，侧栏收窄 */
@media (max-width: 1180px) {
  .sidebar { width: 232px; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dim-row { grid-template-columns: 130px 1fr 80px; }
}

/* 小屏笔记本：侧栏进一步收窄，卡片内边距减小 */
@media (max-width: 1040px) {
  .sidebar { width: 208px; }
  .content { padding: var(--sp-6) var(--sp-5); }
  .topbar { padding: var(--sp-4) var(--sp-5); }
  .action-bar { padding: var(--sp-4) var(--sp-5); }
  .card-body { padding: var(--sp-5); }
  .card-head { padding: var(--sp-4) var(--sp-5); }
  .form-grid { gap: var(--sp-4); }
  .dim-row { grid-template-columns: 116px 1fr 74px; }
  /* 侧栏文字缩小，避免品牌名与导航项换行 */
  .brand-title { font-size: var(--fs-sm); }
  .brand-sub { font-size: 11px; }
  .nav-item { font-size: var(--fs-xs); padding: 10px var(--sp-2); }
  .nav-num { width: 20px; height: 20px; font-size: 10px; }
}

/* 窄屏：侧栏转为顶部横条 */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 30;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .brand {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: none;
    border-right: 1px solid rgba(168, 200, 220, .12);
    flex-shrink: 0;
  }
  .brand-logo { width: 26px; height: 26px; }
  .brand-sub { display: none; }
  .sidebar-nav {
    display: flex;
    padding: var(--sp-2);
    gap: var(--sp-1);
    flex: 1;
  }
  .nav-label { display: none; }
  .nav-item {
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 12px;
  }
  .nav-item.is-active::before { display: none; }
  .sidebar-foot { display: none; }
  .topbar { padding: var(--sp-3) var(--sp-4); flex-wrap: wrap; }
  .page-title { font-size: var(--fs-lg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .page-desc { display: none; }
  .topbar-left { min-width: 0; flex: 1 1 200px; }
  .content { padding: var(--sp-4); }
  .action-bar { padding: var(--sp-3) var(--sp-4); }
  .grade-hero { grid-template-columns: 1fr; gap: var(--sp-5); }
  .grade-score-box { min-width: 0; }
  .grade-title { font-size: var(--fs-2xl); }
}

/* 手机：单列 */
@media (max-width: 640px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid > .field { grid-column: auto !important; }
  .card-body { padding: var(--sp-4); }
  .card-head { padding: var(--sp-3) var(--sp-4); flex-wrap: wrap; }
  .card-title { font-size: var(--fs-base); }
  .dim-row { grid-template-columns: 1fr auto; gap: var(--sp-2) var(--sp-3); }
  .dim-row .dim-track { grid-column: 1 / -1; }
  .redline-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .action-bar { flex-wrap: wrap; gap: var(--sp-3); }
  .action-bar > div:last-child { width: 100%; }
  .action-bar .btn { flex: 1; }
  .topbar-actions { width: 100%; }
  .topbar-actions .btn { flex: 1; }

  /* 顶栏改为三行：标题 / 按钮，取消 900px 断点继承的 wrap 行为 */
  .topbar {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    position: static;
  }

  /* 关键：横向导航必须限制在容器内，否则 nowrap 的导航项会把 body 撑宽，
     导致整页出现横向滚动、右侧内容被推出屏幕。 */
  .sidebar {
    max-width: 100vw;
    overflow: hidden;
  }
  .sidebar-nav {
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
  }
  /* 横向滚动模式下导航项不参与压缩，由父容器滚动查看 */
  .sidebar-nav .nav-item {
    flex: 0 0 auto;
    width: auto;
  }
  .topbar-left { width: 100%; flex: none; }
  .page-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: var(--fs-md);
  }
  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-2);
  }
  .topbar-actions .btn {
    width: 100%;
    min-width: 0;
    padding: 9px 8px;
    font-size: 13px;
  }
  .topbar-actions .btn-icon { width: 14px; height: 14px; }
}

/* 打印 */
@media print {
  .sidebar, .topbar-actions, .action-bar { display: none; }
  .content { padding: 0; max-width: none; }
  .card { break-inside: avoid; box-shadow: none; border-color: #d0d5dd; }
  body { background: var(--white); font-size: 13px; }

  /* 打印时取消动画残留的透明状态 */
  .anim-in { animation: none !important; opacity: 1 !important; transform: none !important; }

  /* 等级大屏在打印时需要实底，渐变色打印机可能丢失 */
  .grade-hero {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    break-inside: avoid;
    padding: 24px;
  }
  .grade-title { font-size: 28px; }
  .grade-score-val { font-size: 40px; }

  /* 图表区在打印时缩一点，避免跨页 */
  .chart-wrap { height: 300px; break-inside: avoid; }
  .chart-wrap.is-tall { height: 330px; }

  /* 表格不跨页断行 */
  .gap-table tr { break-inside: avoid; }
  thead { display: table-header-group; }

  /* 隐藏返回/导出按钮残留间距 */
  .topbar { position: static; border-bottom: 2px solid var(--navy-700); }
  .page-title { font-size: 22px; }
}

/* 淡入动画 */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.anim-in {
  animation: fadeUp 420ms cubic-bezier(.16, 1, .3, 1) both;
}

.anim-in:nth-child(2) { animation-delay: 60ms; }
.anim-in:nth-child(3) { animation-delay: 120ms; }
.anim-in:nth-child(4) { animation-delay: 180ms; }
.anim-in:nth-child(5) { animation-delay: 240ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
