/* 核桃安全 EHS工作台 - 平台通用样式（出版物风格·暖色调） */

:root {
  /* 清新浅绿背景与文字（护眼舒适） */
  --bg-primary: #F2FAEE;
  --bg-secondary: #F7FCF4;
  --bg-card: #FFFFFF;
  --bg-hover: #E5F4DC;
  --text-primary: #1F3322;
  --text-secondary: #4A6348;
  --text-muted: #7D9A7A;
  /* 品牌色（安全绿+活力橙红） */
  --accent-red: #C04A1A;
  --accent-red-hover: #9C3A12;
  --accent-orange: #D97706;
  --accent-yellow: #EAB308;
  --accent-green: #3F7A1A;
  --accent-blue: #2563EB;
  --accent-blue-hover: #1D4ED8;
  --accent-cyan: #0891B2;
  /* 强调色：深绿棕（用于标签/标题） */
  --accent-deep: #2E5A2A;
  --border-color: #CFE5C3;
  --border-strong: #AED39E;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(31, 51, 34, 0.06);
  --shadow-strong: 0 8px 28px rgba(31, 51, 34, 0.1);
  --max-width: 900px;
  --max-width-wide: 1180px;
  --font-serif: "Source Han Serif SC", "Noto Serif SC", "STSong", "SimSun", "Songti SC", Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans SC", sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  font-size: 15px;
}

/* 平台统一头部（出版物风：白色+暖边框） */
.platform-header {
  background: rgba(255, 252, 242, 0.92);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(107, 44, 15, 0.04);
}

.platform-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.back-home {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

.back-home:hover {
  color: var(--accent-deep);
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
}

.site-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #6B2C0F 0%, #C04A1A 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #FFF9EC;
  font-family: var(--font-serif);
  font-weight: 700;
}

.site-name-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

/* 通用容器 */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px;
}

/* 按钮（出版物风：主按钮用深红棕/橙红） */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-red);
  color: #FFFCF2;
}

.btn-primary:hover {
  background: var(--accent-red-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(192, 74, 26, 0.3);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--accent-deep);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

/* 卡片（暖色纸张+边） */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-family: var(--font-serif);
}

/* 表单元素 */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 14px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 3px rgba(192, 74, 26, 0.12);
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* 标签（出版物风：药丸+大写字母+字距） */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(107, 44, 15, 0.08);
  color: var(--accent-deep);
}

.tag-red { background: rgba(192, 74, 26, 0.12); color: var(--accent-red); }
.tag-orange { background: rgba(217, 119, 6, 0.12); color: #C2410C; }
.tag-yellow { background: rgba(234, 179, 8, 0.14); color: #B45309; }
.tag-green { background: rgba(77, 124, 15, 0.12); color: #3F6212; }
.tag-blue { background: rgba(37, 99, 235, 0.1); color: #1D4ED8; }
.tag-cyan { background: rgba(8, 145, 178, 0.12); color: #155E75; }

/* 底部（暖色纸张感） */
.platform-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 32px 20px;
  margin-top: 40px;
  box-shadow: 0 -1px 0 rgba(107, 44, 15, 0.04);
}

.platform-footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.platform-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.platform-footer a:hover {
  color: var(--accent-red);
}

/* 风险等级颜色（暖色调版） */
.risk-critical { color: #C04A1A; font-weight: 700; }
.risk-high { color: #D97706; font-weight: 700; }
.risk-medium { color: #CA8A04; font-weight: 700; }
.risk-low { color: #4D7C0F; font-weight: 700; }

.bg-risk-critical { background: linear-gradient(135deg, #C04A1A 0%, #6B2C0F 100%); color: #FFFCF2; }
.bg-risk-high { background: linear-gradient(135deg, #D97706 0%, #C2410C 100%); color: #FFFCF2; }
.bg-risk-medium { background: linear-gradient(135deg, #EAB308 0%, #CA8A04 100%); color: #3A1A05; }
.bg-risk-low { background: linear-gradient(135deg, #84CC16 0%, #4D7C0F 100%); color: #FFFCF2; }

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

.fade-in {
  animation: fadeIn 0.4s ease-out;
}

/* ===== 工具页统一：浮动"返回HSE工具列表"按钮 ===== */
.hse-back-btn {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px 10px 14px;
  background: #FAF3DD;
  border: 1px solid var(--accent-deep);
  border-radius: 999px;
  color: #D97706;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-sans);
  box-shadow: 0 6px 20px rgba(31, 51, 34, 0.14);
  /* 2026-10-21：原来过渡属性写的是 all —— 连 bottom 一起动画，
     移动端停靠位置一变就滑 0.2 秒，看起来就是「一跳一跳」。只过渡视觉属性。 */
  transition: background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.hse-back-btn::before {
  content: "←";
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
  color: #D97706;
}

.hse-back-btn:hover {
  background: var(--accent-deep);
  color: #FAF3DD;
  border-color: var(--accent-deep);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(46, 90, 42, 0.28);
}

.hse-back-btn:hover::before {
  color: #FAF3DD;
}

/* ===== 工具页统一：浮动"回到顶部"按钮（2026-10-21 P2） =====
   位于返回按钮上方，竖排按钮组；滚动超过 400px 才显示（显隐由 common-nav.js 控制）。 */
.hse-top-btn {
  position: fixed;
  right: 22px;
  bottom: 78px;
  z-index: 9998;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--accent-deep);
  background: #FAF3DD;
  color: #D97706;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(31, 51, 34, 0.14);
  transition: opacity 0.25s, transform 0.2s, background 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
}

.hse-top-btn:hover {
  background: var(--accent-deep);
  color: #FAF3DD;
  transform: translateY(-2px);
}

/* ===== 工具页统一：浮动"搜索工具"按钮（2026-10-21 P2） =====
   与「回到顶部」同列、位于其上方；始终可见（搜索是高频入口）。 */
.hse-search-btn {
  position: fixed;
  right: 22px;
  bottom: 134px;
  z-index: 9997;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--accent-deep);
  background: #FAF3DD;
  color: #D97706;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(31, 51, 34, 0.14);
  transition: transform 0.2s, background 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hse-search-btn:hover {
  background: var(--accent-deep);
  color: #FAF3DD;
  transform: translateY(-2px);
}

/* ===== 工具页统一：结果区"再算一次"按钮（2026-10-21 P1） ===== */
.hse-recalc-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 12px 4px 4px 0;
  padding: 9px 18px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s;
}

.hse-recalc-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent-deep);
  color: var(--accent-deep);
  transform: translateY(-1px);
}

.hse-recalc-btn:active {
  transform: translateY(0);
}

/* ===== 工具页统一：底部 QR 区已移除（不再注入） ===== */

/* 移动端适配 */
@media (max-width: 768px) {
  .platform-header-inner {
    flex-wrap: wrap;
    gap: 10px;
  }

  .site-name-sub {
    display: none;
  }

  .container {
    padding: 16px;
  }

  .card {
    padding: 16px;
  }
}

/* ===== 工具页统一：顶部 hero 区（深色渐变 + 白字） ===== */
.tool-hero {
  border-radius: var(--radius);
  padding: 26px 28px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  color: #fff;
  box-shadow: 0 4px 18px rgba(0,0,0,.12);
}

.tool-hero-icon {
  width: 68px;
  height: 68px;
  background: rgba(255,255,255,.15);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  flex-shrink: 0;
}

.tool-hero h2 {
  font-size: 24px;
  margin-bottom: 6px;
  color: #fff !important;
}

.tool-hero p {
  font-size: 13px;
  color: rgba(255,255,255,.95);
  line-height: 1.7;
  max-width: 760px;
}

.tool-hero .badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.tool-hero .badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,.18);
  color: #fff;
}

/* ===== 工具页统一：底部免责声明 ===== */
.tool-disclaimer {
  font-size: 12px;
  color: #64748b;
  line-height: 1.7;
  margin-top: 18px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.tool-disclaimer b {
  color: #334155;
}

@media (max-width: 768px) {
  .tool-hero { padding: 18px; }
  .tool-hero-icon { width: 56px; height: 56px; font-size: 28px; }
  .tool-hero h2 { font-size: 20px; }
}
/* ============================================================
 * 移动端统一加固（2026-09-28，共享资源层）
 * 全部规则仅限 <=768px 生效，桌面端表现零变化。
 * ============================================================ */
@media (max-width: 768px) {
  /* 根治横向滚动条（clip 不创建新的 BFC/滚动容器） */
  html, body {
    overflow-x: clip;
  }
  /* 旧浏览器回退：不支持 overflow:clip 时用 hidden */
  @supports not (overflow: clip) {
    html, body {
      overflow-x: hidden;
    }
  }

  /* iOS 微信输入框聚焦自动放大防护：表单控件字号统一 16px */
  input, select, textarea {
    font-size: 16px !important;
  }

  /* 触控目标：按钮最小高度 44px */
  .btn {
    min-height: 44px;
  }

  /* 返回按钮：移动端固定屏幕左下角，并整体缩小尺寸（2026-10-01 修订）
     ① 位置：回到**屏幕左下角**（bottom 12px + 安全区），紧贴视口边缘。
        2026-09-30 曾写死 bottom:88px（为避开底部通栏会员状态条 #msBanner），
        实测在手机上观感是「浮在左下偏中、离屏幕底还有一段」，用户要求贴回左下角。
        改用「默认贴角 + 按需避让」：状态条未出现时贴角；确实出现时由 common-nav.js
        的 placeBackBtn() 实测状态条底部并把它抬到状态条上方（含 member-split.js
        把状态条抬高避让页面底栏的情况），两者永不互压。
     ② 尺寸：字号 14→12px、内边距 10/18→8/13px，投影同步收敛，可用面积约 -35%，
        不再压住正文段落；
     ③ min-height 用 !important 只是防御：emergcard / riskcard 两页曾各自在移动端声明
        .hse-back-btn{min-height:44px}（该二页未引本文件，故当前是空操作）。本文件以
        <link> 先于页面内联 <style> 生效，同为类选择器时后者胜出 —— 将来若有页面再写
        同类覆盖，不加 !important 会让那一页退回大号尺寸，破坏全站一致性。 */
  .hse-back-btn {
    left: 10px;
    right: auto;
    /* env() 在未声明 viewport-fit=cover 时为 0，退化为纯 12px，行为一致 */
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    min-height: 0 !important;
    padding: 8px 13px 8px 10px;
    gap: 4px;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
    border-radius: 999px;
    box-shadow: 0 3px 12px rgba(31, 51, 34, .12);
  }

  .hse-back-btn::before {
    font-size: 13px;
  }

  /* 移动端：回到顶部按钮与返回按钮同列（左下角竖排），
     bottom 对齐返回按钮上方 8px（返回按钮高约 30px，这里用 44px 组距），
     触控目标保持 44px。 */
  .hse-top-btn {
    left: 10px;
    right: auto;
    bottom: calc(58px + env(safe-area-inset-bottom, 0px));
    width: 44px;
    height: 44px;
    font-size: 18px;
    box-shadow: 0 3px 12px rgba(31, 51, 34, .12);
  }

  /* 移动端：搜索按钮位于回到顶部按钮上方（竖排第三位） */
  .hse-search-btn {
    left: 10px;
    right: auto;
    bottom: calc(114px + env(safe-area-inset-bottom, 0px));
    width: 44px;
    height: 44px;
    font-size: 17px;
    box-shadow: 0 3px 12px rgba(31, 51, 34, .12);
  }

  .hse-recalc-btn {
    min-height: 44px;
    padding: 10px 20px;
    font-size: 15px;
  }
}