/* ==========================================================================
   质量管理学院 · 工具页统一主题（青蓝 / Cyan，与外页学院首页一致）
   用途：替代各工具页内联的混乱/损坏样式，实现里外页配色统一、文字可读
   ========================================================================== */

:root {
    --qc-bg: #f5f8fa;
    --qc-surface: #ffffff;
    --qc-text: #1f2d3d;
    --qc-text-2: #4a5568;
    --qc-text-3: #8896a6;
    --qc-border: #e3e9f0;
    --qc-border-2: #eef2f7;

    --qc-cyan-50: #ecfeff;
    --qc-cyan-100: #cffafe;
    --qc-cyan-200: #a5f3fc;
    --qc-cyan-500: #06b6d4;
    --qc-cyan-600: #0891b2;
    --qc-cyan-700: #0e7490;
    --qc-cyan-900: #164e63;

    --qc-amber-500: #f59e0b;
    --qc-amber-50: #fffbeb;
    --qc-green-600: #059669;
    --qc-green-50: #ecfdf5;
    --qc-green-200: #a7f3d0;
    --qc-red-500: #ef4444;

    --qc-shadow-sm: 0 2px 10px rgba(15, 42, 74, 0.06);
    --qc-shadow-md: 0 8px 24px rgba(15, 42, 74, 0.10);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: var(--qc-bg);
    color: var(--qc-text);
    line-height: 1.8;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--qc-cyan-600); text-decoration: none; }

.container { max-width: 1200px; margin: 0 auto; padding: 30px 20px; }

/* ---------- 页头横幅（工具页内联 hero） ---------- */
.header {
    background: linear-gradient(135deg, var(--qc-cyan-900) 0%, var(--qc-cyan-700) 60%, var(--qc-cyan-600) 100%);
    color: #fff;
    padding: 38px 32px;
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: var(--qc-shadow-md);
}
.header h1 { font-size: 2rem; margin-bottom: 8px; color: #fff; line-height: 1.3; }
.header p, .header .subtitle { opacity: .9; font-size: 1.05em; color: #fff; }
.header .back-link { background: rgba(255,255,255,.16); color: #fff; }
.header .back-link:hover { background: rgba(255,255,255,.28); }

/* ---------- 返回链接 ---------- */
.back-link, .back-btn, .bk {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--qc-cyan-700); text-decoration: none;
    margin-bottom: 18px; padding: 8px 14px;
    background: var(--qc-cyan-50); border-radius: 8px;
    font-weight: 500; transition: all .25s ease;
}
.back-link:hover, .back-btn:hover, .bk:hover {
    background: var(--qc-cyan-600); color: #fff; text-decoration: none;
}

/* ---------- 通用区块 ---------- */
.section, .content-section, .sec {
    background: var(--qc-surface);
    border: 1px solid var(--qc-border);
    border-radius: 14px;
    padding: 28px 26px;
    margin-bottom: 22px;
    box-shadow: var(--qc-shadow-sm);
}
.section h2, .content-section h2, .sec h2, .section-title {
    color: var(--qc-cyan-700);
    font-size: 1.45rem;
    margin: 0 0 18px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--qc-cyan-100);
}
.section h2, .content-section h2, .sec h2 { padding-left: 0; border-left: none; }

h1 { color: var(--qc-cyan-900); }
h2 { color: var(--qc-cyan-700); }
h3 { color: var(--qc-cyan-600); font-size: 1.15rem; margin: 18px 0 10px; }
h4 { color: var(--qc-text); margin-bottom: 8px; }

p { margin-bottom: 12px; color: var(--qc-text-2); }
ul, ol { margin: 14px 0 14px 22px; color: var(--qc-text-2); }
li { margin-bottom: 8px; }

/* ---------- 公式 / 案例 / 提示 框 ---------- */
.formula-box {
    background: var(--qc-cyan-50);
    border-left: 4px solid var(--qc-cyan-600);
    padding: 14px 18px; margin: 14px 0;
    border-radius: 0 8px 8px 0;
    font-family: "Consolas", "SFMono-Regular", monospace;
    color: var(--qc-text); line-height: 1.9;
}
.case-box, .case, .highlight-box {
    background: var(--qc-green-50);
    border: 1px solid var(--qc-green-200);
    border-radius: 10px; padding: 18px; margin: 14px 0;
}
.case-box h4, .case h4, .highlight-box h4 { color: var(--qc-green-600); margin-bottom: 10px; }
.note-box, .content-box {
    background: var(--qc-amber-50);
    border-left: 4px solid var(--qc-amber-500);
    padding: 14px 18px; margin: 14px 0;
    border-radius: 0 8px 8px 0;
}
.note-box h3, .note-box h4, .content-box h4 { color: var(--qc-amber-500); margin-bottom: 8px; }
.content-box { background: var(--qc-bg); border: 1px solid var(--qc-border); border-left: none; }
.content-box ol { padding-left: 20px; }
.content-box ol li { padding: 8px 0; border-bottom: 1px dotted var(--qc-border); }

/* 风险等级着色（FMEA RPN） */
.rpn-high { color: var(--qc-red-500); font-weight: 700; }
.rpn-medium { color: var(--qc-amber-500); font-weight: 700; }
.rpn-low { color: var(--qc-green-600); font-weight: 700; }

/* ---------- 控制图（深色代码风格展示块） ---------- */
.control-chart {
    background: #0f172a; border-radius: 10px; padding: 20px; margin: 18px 0;
    font-family: "Consolas", monospace; overflow-x: auto; color: #cbd5e1;
}
.chart-row { display: flex; justify-content: space-between; align-items: center;
    padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,.1); }
.ucl { color: #f87171; } .cl { color: #4ade80; } .lcl { color: #f87171; }
.point-normal { color: #60a5fa; }
.point-alarm { color: #fbbf24; background: rgba(251,191,36,.1); }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: .95em; }
th, td { padding: 11px 14px; text-align: left; border: 1px solid var(--qc-border); }
th { background: var(--qc-cyan-700); color: #fff; font-weight: 600; }
tr:nth-child(even) { background: var(--qc-border-2); }
.sigma-table th, .sigma-table td, .content-table th, .content-table td { text-align: center; }
.content-table th, .content-table td { text-align: left; border-bottom: 1px solid var(--qc-border); }

/* ---------- 导航 / 卡片网格（总览页） ---------- */
.nav {
    background: var(--qc-surface); border: 1px solid var(--qc-border);
    border-radius: 12px; padding: 20px; margin-bottom: 24px;
}
.nav h3 { color: var(--qc-cyan-700); margin-bottom: 12px; }
.nav ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px; list-style: none; margin: 0; }
.nav a { color: var(--qc-text-2); text-decoration: none; padding: 10px 14px;
    display: block; border-radius: 6px; transition: all .25s ease; }
.nav a:hover { background: var(--qc-cyan-600); color: #fff; padding-left: 18px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 22px; }
.card {
    background: var(--qc-surface); border: 1px solid var(--qc-border);
    border-radius: 12px; padding: 24px; box-shadow: var(--qc-shadow-sm); transition: all .25s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--qc-shadow-md); border-color: var(--qc-cyan-200); }
.card h2 { color: var(--qc-cyan-700); font-size: 1.3rem; margin-bottom: 12px;
    padding-bottom: 10px; border-bottom: 2px solid var(--qc-cyan-100); }
.card p { color: var(--qc-text-2); margin-bottom: 12px; }
.card .tag, .tag {
    display: inline-block; background: var(--qc-cyan-600); color: #fff;
    padding: 4px 12px; border-radius: 14px; font-size: .8em; margin: 4px 6px 0 0;
}

/* 工具卡（tools/index 的 .crd） */
.grd { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.crd {
    background: var(--qc-bg); padding: 22px; border-radius: 10px;
    border: 1px solid var(--qc-border); display: block; text-decoration: none;
    color: var(--qc-text); transition: all .3s ease;
}
.crd:hover { transform: translateY(-3px); box-shadow: var(--qc-shadow-md); border-color: var(--qc-cyan-200); }
.crd h4 { color: var(--qc-cyan-700); margin-bottom: 6px; font-size: 1.05rem; }
.crd p { font-size: .9em; color: var(--qc-text-2); }

/* 顶部导航条（8D 等） */
.nav-bar { background: var(--qc-cyan-700); padding: 12px 30px; text-align: center; margin-bottom: 20px; }
.nav-bar a { color: #fff; text-decoration: none; margin: 0 12px; font-weight: 500; }

/* 等级 / 步骤网格 */
.level-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-top: 18px; }
.level-item { background: var(--qc-bg); padding: 18px; border-radius: 8px; border-left: 4px solid var(--qc-cyan-600); }
.level-item h4 { color: var(--qc-cyan-700); margin-bottom: 8px; }

.steps { counter-reset: step-counter; }
.step { position: relative; padding-left: 58px; margin-bottom: 22px; }
.step::before {
    counter-increment: step-counter; content: counter(step-counter);
    position: absolute; left: 0; top: 0; width: 40px; height: 40px;
    background: var(--qc-cyan-600); color: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.step h4 { color: var(--qc-cyan-700); margin-bottom: 8px; }

/* ---------- 页脚 ---------- */
.footer, .ft {
    background: var(--qc-cyan-900); color: rgba(255,255,255,.6);
    text-align: center; padding: 24px; margin-top: 40px; font-size: .9em;
}

/* ---------- 通用学习小结块（.dcx-* 注入模板，统一青蓝化） ---------- */
.dcx-wrap { max-width: 960px; margin: 34px auto; padding: 0 18px; }
.dcx-card {
    background: var(--qc-surface); border: 1px solid var(--qc-border);
    border-radius: 14px; padding: 26px 30px; margin-bottom: 22px; box-shadow: var(--qc-shadow-sm);
}
.dcx-h { font-size: 1.35rem; margin: 0 0 16px; padding-bottom: 10px;
    border-bottom: 3px solid var(--qc-cyan-600); color: var(--qc-cyan-900); }
.dcx-p { color: var(--qc-text-2); line-height: 1.95; margin: 0 0 14px; font-size: 1rem; }
.dcx-ul { list-style: none; margin: 0; padding: 0; }
.dcx-ul li { position: relative; padding: 9px 0 9px 26px; border-bottom: 1px dashed var(--qc-border);
    line-height: 1.85; color: var(--qc-text-2); font-size: .98rem; }
.dcx-ul li:before { content: '▍'; position: absolute; left: 0; color: var(--qc-cyan-600); }
.dcx-strong { color: var(--qc-cyan-700); font-weight: 600; }
.dcx-box { background: var(--qc-cyan-50); border-left: 4px solid var(--qc-cyan-600);
    padding: 16px 20px; border-radius: 8px; margin: 14px 0; color: var(--qc-text-2); line-height: 1.95; font-size: .98rem; }
.dcx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 6px; }
.dcx-mod { background: var(--qc-bg); border: 1px solid var(--qc-border); border-radius: 10px; padding: 18px; }
.dcx-mod h4 { margin: 0 0 8px; color: var(--qc-cyan-700); }
.dcx-mod li { padding: 5px 0; color: var(--qc-text-2); font-size: .94rem; line-height: 1.8; }
.dcx-foot { text-align: center; color: var(--qc-text-3); font-size: .85rem; margin: 18px 0 6px; }
@media (max-width: 600px) { .dcx-card { padding: 20px; } .dcx-h { font-size: 1.2rem; } }
