:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --primary: #0f6cbd;
  --primary-dark: #0a4f8a;
  --primary-soft: #e4f0fb;
  --accent: #e8842a;
  --text: #1c2733;
  --text-muted: #5a6b7b;
  --border: #d7dee7;
  --danger: #c0392b;
  --ok: #1f8a4c;
  --shadow: 0 1px 3px rgba(16, 38, 59, .08), 0 6px 18px rgba(16, 38, 59, .06);
  --radius: 12px;
  --radius-sm: 8px;
  --maxw: 1180px;
  --header-h: 60px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
    "Noto Sans", "Noto Sans CJK SC", "Noto Sans CJK KR", "Noto Sans CJK JP",
    "Microsoft YaHei", "PingFang SC", "Hiragino Sans", "Malgun Gothic", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- Top toolbar ---------------- */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  box-shadow: var(--shadow);
}
.toolbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
  font-size: 15px;
  white-space: nowrap;
}
.toolbar .brand .logo {
  width: 30px; height: 30px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: grid; place-items: center;
  font-size: 16px;
}
.toolbar .spacer { flex: 1 1 auto; }
.toolbar .nav-links {
  display: flex; gap: 4px; align-items: center;
}
.toolbar .nav-links a {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
}
.toolbar .nav-links a:hover { background: var(--surface-2); text-decoration: none; }
.toolbar .nav-links a.active { color: var(--primary); background: var(--primary-soft); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { filter: brightness(.95); }

.lang-switch { position: relative; }
.lang-switch select {
  appearance: none;
  padding: 8px 30px 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.lang-switch::after {
  content: "\25BE";
  position: absolute; right: 11px; top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-muted);
}

/* ---------------- Layout ---------------- */
.container { max-width: var(--maxw); margin: 0 auto; padding: 24px 16px 56px; }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 28px; margin: 0 0 6px; }
.page-head p { color: var(--text-muted); margin: 0; max-width: 760px; }

/* ---------------- Hero ---------------- */
.hero {
  background: linear-gradient(135deg, #0f6cbd 0%, #0a4f8a 60%, #073a66 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 40px 32px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}
.hero h1 { font-size: 34px; margin: 0 0 10px; color: #fff; }
.hero p { font-size: 17px; color: #d8e8f7; max-width: 720px; margin: 0 0 18px; }
.hero .hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn-ghost {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.4);
  color: #fff;
}
.hero .btn-ghost:hover { background: rgba(255,255,255,.22); }

/* ---------------- Cards / grid ---------------- */
.grid { display: grid; gap: 16px; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease;
}
a.card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(16,38,59,.12); text-decoration: none; }
.card h3 { margin: 0 0 6px; font-size: 17px; color: var(--text); }
.card p { margin: 0; color: var(--text-muted); font-size: 14px; }
.card .tag {
  display: inline-block; font-size: 12px; font-weight: 700;
  padding: 2px 9px; border-radius: 999px; margin-bottom: 10px;
  background: var(--primary-soft); color: var(--primary-dark);
}

.section-title { font-size: 20px; margin: 30px 0 14px; display: flex; align-items: center; gap: 10px; }
.section-title .bar { width: 5px; height: 22px; background: var(--accent); border-radius: 3px; }
.section-sub { color: var(--text-muted); font-size: 14px; margin: -6px 0 16px; max-width: 760px; line-height: 1.5; }

/* cross-recommendation cards (defect <-> material) */
.mini-params { font-size: 13px; color: var(--text-muted); margin-top: 6px !important; }
.mini-params .v { color: var(--text); font-weight: 700; }
.card-link {
  display: inline-block; margin-top: 12px; font-weight: 700; font-size: 14px;
  color: var(--primary); text-decoration: none;
}
a.card:hover .card-link { text-decoration: underline; }

/* bidirectional Material <-> Defect loop on home/guide */
.loop { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.loop-col { min-width: 0; }
.loop-label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text); font-size: 15px; margin-bottom: 14px; cursor: pointer;
}
.chips-label {
  font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted); margin: 10px 0 6px;
}
/* defect chips inside a material card (loop-back) */
.card .chips { margin-top: 10px; margin-bottom: 0; }
.card a.chip { text-decoration: none; }

/* ---------------- Category chips ---------------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); font-weight: 600; font-size: 14px;
  cursor: pointer; user-select: none;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------------- Search ---------------- */
.search-wrap { position: relative; margin-bottom: 14px; }
.search-wrap input {
  width: 100%; padding: 12px 14px 12px 42px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 15px; background: var(--surface); color: var(--text);
}
.search-wrap .icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted);
}
.count-line { color: var(--text-muted); font-size: 14px; margin-bottom: 12px; }

/* ---------------- Detail page ---------------- */
.breadcrumb { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--text-muted); }
.detail-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.detail-head .sym-icon {
  width: 56px; height: 56px; border-radius: 14px; flex: 0 0 auto;
  background: var(--primary-soft); color: var(--primary-dark);
  display: grid; place-items: center; font-size: 26px;
}
.detail-head h1 { font-size: 28px; margin: 0; }
.detail-meta { color: var(--text-muted); font-size: 14px; margin: 2px 0 0; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.panel h2 { font-size: 18px; margin: 0 0 12px; display: flex; align-items: center; gap: 9px; }
.panel h2 .ic { color: var(--primary); }

.cause-item {
  border-left: 4px solid var(--accent);
  background: var(--surface-2);
  padding: 12px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 12px;
}
.cause-item .c-label { font-weight: 700; color: var(--danger); margin-bottom: 4px; }
.cause-item .s-label { font-weight: 700; color: var(--ok); margin-top: 8px; margin-bottom: 2px; }
.cause-item p { margin: 0; }

.symptom-box { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; }
.symptom-box .lbl { font-weight: 700; color: var(--text-muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }

/* ---------------- Guide / process ---------------- */
.steps { counter-reset: step; }
.step {
  position: relative; padding: 16px 18px 16px 64px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 16px; top: 16px; width: 34px; height: 34px;
  background: var(--primary); color: #fff; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700;
}
.step h3 { margin: 0 0 4px; font-size: 16px; }
.step p { margin: 0; color: var(--text-muted); font-size: 14px; }

/* ---------------- Footer ---------------- */
.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 22px 16px;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}
.footer a { color: var(--primary); }

/* ---------------- Material spec table ---------------- */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.spec-table th, .spec-table td {
  text-align: left;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.spec-table tr:last-child th, .spec-table tr:last-child td { border-bottom: none; }
.spec-table th {
  width: 38%;
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 14px;
}
.spec-table td { font-size: 15px; }
.spec-table td .val { font-weight: 700; color: var(--primary-dark); }
.spec-table td .unit { color: var(--text-muted); font-weight: 400; font-size: 14px; }
.range-hint { color: var(--text-muted); font-size: 13px; }

/* ---------------- Material process card (工艺卡片) ---------------- */
.proc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 12px 0 20px;
  box-shadow: var(--shadow);
}
.proc-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}
.proc-head .ic { color: var(--primary); }
.proc-dry {
  font-size: 13.5px;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
  line-height: 1.55;
}
.proc-dry .proc-lbl { color: var(--text); font-weight: 700; margin-right: 4px; }
.proc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 16px;
}
.proc-item {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.proc-lbl {
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: 3px;
}
.proc-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.35;
}

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
  .proc-grid { grid-template-columns: repeat(2, 1fr); }
  .loop { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .toolbar { gap: 8px; padding: 0 10px; flex-wrap: wrap; height: auto; padding-top: 8px; padding-bottom: 8px; }
  .toolbar .brand span.brand-text { display: none; }
  .toolbar .nav-links { order: 3; width: 100%; justify-content: space-between; }
  .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; }
  .proc-grid { grid-template-columns: 1fr; }
  .hero { padding: 28px 20px; }
  .hero h1 { font-size: 26px; }
  .page-head h1 { font-size: 23px; }
}
