/* EHS ç°åºç®¡ç - å±äº«æ ·å¼
   å¤ç¨ lihaq.cn çæ·±è² + cyan é£æ ¼
   éé PC (1280+) / å¹³æ¿ (768+)
*/
:root {
  --bg: #0f1419;
  --bg-2: #161b22;
  --bg-3: #1f2730;
  --border: #2a323d;
  --text: #e6edf3;
  --text-2: #8b949e;
  --text-3: #6e7681;
  --accent: #00d4d4;
  --accent-2: #0aa8a8;
  --green: #3fb950;
  --yellow: #d29922;
  --orange: #db6d28;
  --red: #f85149;
  --purple: #a371f7;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  /* PIVOT 64af7: 保证 sticky 顶部生效 (overflow-x: hidden 不能影响 Y 轴滚动) */
  overflow-x: hidden;
}
body {
  /* 字体 fallback 链: 优先 macOS / iOS → Windows → 通用中文 → 西文 → serif 兜底
     关键: 不要单独写 sans-serif 在最后 (Windows 上 sans-serif=Arial, 不含中文)
     把 SimSun (宋体) / Microsoft YaHei 都放进去, 几乎不可能全坏 */
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Segoe UI Emoji",
    "PingFang SC", "Hiragino Sans GB", "Heiti SC",
    "Microsoft YaHei", "微软雅黑", "WenQuanYi Micro Hei",
    "Noto Sans CJK SC", "Source Han Sans SC",
    SimSun, "宋体", SimHei, "黑体",
    Tahoma, Arial, Helvetica, sans-serif,
    "Apple Color Emoji", "Segoe UI Symbol";
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  /* PIVOT 64af7: overflow-y 显式 visible 让 sticky 生效 */
  overflow-y: visible;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ PIVOT 64b04 v3: 2 琛屽竷灞€ ============
   Row 1: 鍝佺墝 + 鐢ㄦ埛鍖?(鍏冩暟鎹? 绱у噾)
   Row 2: 5 妯″潡 + 鐭ヨ瘑搴?(姘歌繙鍙, 绛夊)
============================================== */
.ehs-top {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 200;
  -webkit-backface-visibility: hidden;
          backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
  gap: 0;
}
/* Row 1: 鍝佺墝 + 鐢ㄦ埛/闂ㄦ埛/绠＄悊 */
.ehs-top__row {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  min-height: 38px;
  gap: 8px;
  flex-wrap: nowrap;
}
.ehs-top__brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.ehs-top__brand-icon {
  width: 26px; height: 26px; border-radius: 6px;
  background: linear-gradient(135deg, var(--accent) 0%, #0a4d4d 100%);
  display: flex; align-items: center; justify-content: center;
  color: var(--bg); font-weight: 800; font-size: 14px;
  flex-shrink: 0;
}
.ehs-top__user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  color: var(--text-2);
  font-size: 12px;
}
.ehs-top__user strong { color: var(--text); }

/* Row 2: 5 妯″潡 + 鐭ヨ瘑搴?(绛夊鍒嗛厤, 姘歌繙鍙, 涓嶄細琚伄鎸? */
.ehs-top__modules {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,212,212,0.03);
}
.ehs-top__modules a {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  padding: 8px 4px;
  border-right: 1px solid rgba(255,255,255,0.04);
  color: var(--text-2);
  font-size: 13px;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.ehs-top__modules a:last-child { border-right: none; }
.ehs-top__modules a:hover { background: var(--bg-3); color: var(--text); text-decoration: none; }
.ehs-top__modules a.active { background: var(--accent); color: var(--bg); font-weight: 600; }
.ehs-top__modules .ehs-top__kb { color: var(--text-3); font-size: 12px; }
.ehs-top__modules .ehs-top__kb:hover { color: var(--text); }

/* 鍏煎鏃у紡 ehs-nav (e.g. 鍐呰仈瀵艰埅鍧? */
.ehs-nav { display: flex; gap: 4px; }
.ehs-nav a {
  padding: 8px 16px; border-radius: 6px;
  color: var(--text-2); font-size: 13px;
}
.ehs-nav a:hover { background: var(--bg-3); color: var(--text); text-decoration: none; }
.ehs-nav a.active { background: var(--accent); color: var(--bg); font-weight: 600; }

/* ============ 绉诲姩绔?(PIVOT 64b04 v3 绱у噾) ============ */
@media (max-width: 768px) {
  .ehs-top__row { padding: 5px 8px; min-height: 34px; gap: 6px; }
  .ehs-top__brand { font-size: 12px; gap: 4px; }
  .ehs-top__brand-icon { width: 22px; height: 22px; font-size: 13px; }
  .ehs-top__brand-text { display: none; }
  .ehs-top__user .ehs-admin-link { padding: 3px 7px; font-size: 11px; margin-right: 4px; }
  .ehs-top__user span#user-status { font-size: 11px; }
  .ehs-top__modules a { padding: 7px 3px; font-size: 12px; }
  .ehs-top__modules .ehs-top__kb { font-size: 11px; }
}
@media (max-width: 420px) {
  .ehs-top__modules a { padding: 6px 2px; font-size: 11px; }
  .ehs-top__modules .ehs-top__kb { font-size: 10px; }
}
.ehs-container {
  max-width: 1280px; margin: 0 auto; padding: 24px;
}
.ehs-h1 {
  font-size: 22px; font-weight: 700; margin-bottom: 6px;
  display: flex; align-items: center; gap: 12px;
}
.ehs-h1 small { font-size: 13px; color: var(--text-2); font-weight: 400; }
.ehs-subtitle { color: var(--text-2); font-size: 13px; margin-bottom: 20px; }

/* ============ å¡çç½æ ¼ ============ */
.ehs-grid { display: grid; gap: 16px; }
.ehs-grid-2 { grid-template-columns: 1fr 1fr; }
.ehs-grid-3 { grid-template-columns: repeat(3, 1fr); }
.ehs-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .ehs-grid-2, .ehs-grid-3, .ehs-grid-4 { grid-template-columns: 1fr; }
}

.ehs-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}
.ehs-card--accent { border-left: 3px solid var(--accent); }
.ehs-card__title { font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.ehs-card__value { font-size: 28px; font-weight: 700; }
.ehs-card__value--cyan { color: var(--accent); }
.ehs-card__value--red { color: var(--red); }
.ehs-card__value--green { color: var(--green); }
.ehs-card__value--yellow { color: var(--yellow); }
.ehs-card__value--orange { color: var(--orange); }
.ehs-card__sub { font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* ============ è¡¨æ ¼ ============ */
/* ============ Checklist (PTW 表单勾选框) - 仿政府/公司官方表格行式 ============ */
.ehs-check {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 4px 8px; border-radius: 3px; cursor: pointer;
  font-size: 13px; transition: background 0.1s;
  white-space: nowrap; user-select: none;
}
.ehs-check:hover { background: var(--bg-2); }
.ehs-check input[type="checkbox"] {
  margin: 0; cursor: pointer;
  width: 14px; height: 14px;
  accent-color: var(--accent);
}
.ehs-check--block {
  display: flex; align-items: flex-start; gap: 4px;
  white-space: normal;
}
.ehs-check--block .ehs-check__num {
  color: var(--text-3); font-weight: 600; flex-shrink: 0; min-width: 22px;
}
.ehs-check--block .ehs-check__text { flex: 1; line-height: 1.55; }

.ehs-checklist {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  min-height: 38px;
}
.ehs-checklist--row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px;
  max-height: 96px; overflow-y: auto;
}
.ehs-checklist--numbered {
  display: flex; flex-direction: column; gap: 0;
  max-height: 320px; overflow-y: auto;
  padding: 4px 10px;
}
.ehs-checklist--numbered .ehs-check {
  border-bottom: 1px dashed var(--border);
  padding: 6px 4px;
  border-radius: 0;
}
.ehs-checklist--numbered .ehs-check:last-child { border-bottom: none; }
.ehs-checklist::-webkit-scrollbar { width: 6px; }
.ehs-checklist::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.ehs-checklist-extra {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px;
}

/* ============ 表格 ============ */
.ehs-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ehs-table th, .ehs-table td {
  padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border);
}
.ehs-table th {
  color: var(--text-2); font-weight: 500; font-size: 12px;
  background: var(--bg-3); text-transform: uppercase; letter-spacing: 0.5px;
}
.ehs-table tbody tr:hover { background: var(--bg-3); }
.ehs-table .col-action { text-align: right; }
.ehs-table .empty { padding: 30px; text-align: center; color: var(--text-3); }

/* ============ ç¶æå¾½ç«  ============ */
.ehs-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.ehs-badge--open { background: rgba(248, 81, 73, 0.15); color: var(--red); }
.ehs-badge--assigned, .ehs-badge--pending, .ehs-badge--draft { background: rgba(210, 153, 34, 0.15); color: var(--yellow); }
.ehs-badge--rectifying, .ehs-badge--in_progress, .ehs-badge--reviewing { background: rgba(0, 212, 212, 0.15); color: var(--accent); }
.ehs-badge--closed, .ehs-badge--approved, .ehs-badge--pass { background: rgba(63, 185, 80, 0.15); color: var(--green); }
.ehs-badge--rejected, .ehs-badge--fail, .ehs-badge--cancelled { background: rgba(139, 148, 158, 0.15); color: var(--text-2); }
.ehs-badge--warning { background: rgba(219, 109, 40, 0.15); color: var(--orange); }
.ehs-badge--normal { background: rgba(63, 185, 80, 0.15); color: var(--green); }
.ehs-badge--risk { background: rgba(248, 81, 73, 0.15); color: var(--red); }

/* ============ è¡¨å ============ */
.ehs-form { display: flex; flex-direction: column; gap: 12px; }
.ehs-form__row { display: flex; gap: 12px; }
.ehs-form__row > * { flex: 1; }
.ehs-field { display: flex; flex-direction: column; gap: 4px; }
.ehs-field label { font-size: 12px; color: var(--text-2); }
.ehs-field input, .ehs-field select, .ehs-field textarea {
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
  padding: 8px 12px; border-radius: 6px; font-size: 13px; font-family: inherit;
}
.ehs-field input:focus, .ehs-field select:focus, .ehs-field textarea:focus {
  outline: none; border-color: var(--accent);
}
.ehs-field textarea { min-height: 80px; resize: vertical; }

/* ============ æé® ============ */
.ehs-btn {
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
  padding: 8px 16px; border-radius: 6px; font-size: 13px; cursor: pointer;
  font-family: inherit; display: inline-flex; align-items: center; gap: 6px;
}
.ehs-btn:hover { background: var(--border); }
.ehs-btn--primary { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 600; }
.ehs-btn--primary:hover { background: var(--accent-2); }
.ehs-btn--danger { background: var(--red); color: #fff; border-color: var(--red); }
.ehs-btn--danger:hover { opacity: 0.85; }
.ehs-btn--ghost { background: transparent; }
.ehs-btn--sm { padding: 4px 10px; font-size: 12px; }
.ehs-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============ Tab ============ */
.ehs-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.ehs-tab {
  padding: 10px 16px; background: transparent; border: none; color: var(--text-2);
  font-size: 13px; cursor: pointer; font-family: inherit;
  border-bottom: 2px solid transparent;
}
.ehs-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.ehs-tab .count {
  background: var(--bg-3); color: var(--text-2);
  padding: 1px 6px; border-radius: 8px; font-size: 11px; margin-left: 4px;
}
.ehs-tab.active .count { background: var(--accent); color: var(--bg); }

/* ============ Modal ============ */
.ehs-modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 100;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.ehs-modal-bg.open { display: flex; }
.ehs-modal {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 20px; max-width: 600px; width: 100%; max-height: 90vh; overflow-y: auto;
}
.ehs-modal__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.ehs-modal__head h3 { font-size: 16px; font-weight: 600; }
.ehs-modal__close {
  background: none; border: none; color: var(--text-2); cursor: pointer;
  font-size: 20px; padding: 0; width: 28px; height: 28px;
}
.ehs-modal__close:hover { color: var(--text); }
.ehs-modal__foot {
  display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px;
  padding-top: 16px; border-top: 1px solid var(--border);
}

/* ============ æç¤º ============ */
.ehs-toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 1000;
  background: var(--bg-3); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  padding: 12px 20px; border-radius: 6px; font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  opacity: 0; transform: translateX(100%); transition: all 0.3s;
}
.ehs-toast.show { opacity: 1; transform: translateX(0); }
.ehs-toast--error { border-left-color: var(--red); }
.ehs-toast--success { border-left-color: var(--green); }

/* ============ Loading ============ */
.ehs-loading {
  padding: 40px; text-align: center; color: var(--text-3); font-size: 13px;
}
.ehs-spinner {
  display: inline-block; width: 24px; height: 24px;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
  vertical-align: middle; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ æ¶é´çº¿ (logs) ============ */
.ehs-timeline { padding: 0; margin: 0; list-style: none; }
.ehs-timeline li {
  padding: 8px 0 8px 20px; border-left: 2px solid var(--border);
  position: relative; font-size: 13px;
}
.ehs-timeline li::before {
  content: ''; position: absolute; left: -5px; top: 14px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
}
.ehs-timeline .ts { color: var(--text-3); font-size: 11px; margin-right: 6px; }
.ehs-timeline .actor { color: var(--accent); font-weight: 500; }
.ehs-timeline .action { background: var(--bg-3); padding: 1px 6px; border-radius: 4px; font-size: 11px; margin-right: 4px; color: var(--text-2); }

/* ============ PTW 审批链 (vertical) ============ */
.ehs-approval-chain {
  list-style: none; padding: 0; margin: 8px 0 16px;
  border-left: 2px solid var(--border);
  padding-left: 0;
}
.ehs-approval-chain .apv {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 0 10px 16px; margin-left: -2px;
  border-left: 3px solid transparent;
  font-size: 13px; flex-wrap: wrap;
  position: relative;
}
.ehs-approval-chain .apv::before {
  content: ''; position: absolute; left: -7px; top: 50%;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg-2); border: 2px solid var(--border);
  transform: translateY(-50%);
}
.ehs-approval-chain .apv--approved { border-left-color: var(--green); }
.ehs-approval-chain .apv--approved::before { background: var(--green); border-color: var(--green); }
.ehs-approval-chain .apv--rejected { border-left-color: var(--red); }
.ehs-approval-chain .apv--rejected::before { background: var(--red); border-color: var(--red); }
.ehs-approval-chain .apv--skipped { border-left-color: var(--text-3); opacity: 0.5; }
.ehs-approval-chain .apv--skipped::before { background: var(--text-3); border-color: var(--text-3); }
.ehs-approval-chain .apv--pending { border-left-color: var(--yellow); }
.ehs-approval-chain .apv--pending::before { background: var(--yellow); border-color: var(--yellow); animation: apv-pulse 1.5s infinite; }
@keyframes apv-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(210,153,34,0.6); }
  50% { box-shadow: 0 0 0 6px rgba(210,153,34,0); }
}
.ehs-approval-chain .apv--current {
  background: rgba(0,212,212,0.08);
  border-radius: 4px;
  font-weight: 600;
}
.ehs-approval-chain .apv__icon { font-size: 16px; min-width: 20px; }
.ehs-approval-chain .apv__lvl {
  background: var(--bg-3); color: var(--accent);
  padding: 2px 6px; border-radius: 3px; font-size: 11px; font-weight: 700;
}
.ehs-approval-chain .apv__pos { color: var(--text); font-weight: 500; }
.ehs-approval-chain .apv__user { color: var(--text-2); font-size: 12px; }
.ehs-approval-chain .apv__content { width: 100%; maria (max-width: /* EHS top nav admin link (v1.0.1) */
.ehs-admin-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  background: rgba(0, 212, 212, 0.12);
  border: 1px solid rgba(0, 212, 212, 0.4);
  color: var(--accent);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  margin-right: 10px;
  transition: all 0.15s;
}
.ehs-admin-link:hover {
  background: rgba(0, 212, 212, 0.25);
  border-color: var(--accent);
  color: #fff;
}
.ehs-top__user {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ehs-top__user span#user-status {
  font-size: 12px;
  color: var(--text-2);
}
.ehs-top__user span#user-status strong {
  color: var(--accent);
}

/* ============ 日期时间行 (表单里 plan_start / plan_end 一行) ============ */
.ehs-dt-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.ehs-dt-row .ehs-dt-input {
  flex: 1;
  min-width: 0;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.ehs-dt-row .ehs-dt-input:hover {
  border-color: var(--accent);
}

/* ============ 自定义月历 (modal-datetime) ============ */
.dt-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-top: 6px;
  background: var(--bg-2);
  padding: 4px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.dt-cal-header {
  padding: 4px 0;
  text-align: center;
  font-size: 11px;
  color: var(--text-3);
  font-weight: 600;
}
.dt-cal-day {
  padding: 8px 0;
  text-align: center;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background 0.1s;
  user-select: none;
}
.dt-cal-day:hover {
  background: var(--bg-3);
  color: var(--accent);
}
.dt-cal-day--today {
  border: 1px solid var(--accent);
  font-weight: 600;
}
.dt-cal-day--selected {
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
}
.dt-cal-day--selected:hover {
  background: var(--accent-2);
  color: var(--bg);
}
.dt-cal-blank {
  background: transparent;
}

/* PIVOT 64c01: super admin company selector */
.ehs-company-selector {
  display: inline-flex;
  align-items: center;
  margin-right: 10px;
  padding: 3px 10px;
  background: linear-gradient(135deg, rgba(0,212,212,0.12), rgba(0,212,212,0.04));
  border: 1px solid rgba(0,212,212,0.40);
  border-radius: 16px;
  font-size: 13px;
  color: var(--text-1);
  white-space: nowrap;
}
.ehs-company-selector label {
  font-size: 12px;
  color: var(--text-3);
  margin-right: 6px;
  user-select: none;
}
.ehs-cid-select {
  background: var(--bg-2) !important;
  color: var(--text-1) !important;
  border: 1px solid var(--border) !important;
  border-radius: 4px !important;
  padding: 3px 8px !important;
  font-size: 13px !important;
  cursor: pointer !important;
  font-family: inherit !important;
  outline: none !important;
  max-width: 220px;
}
.ehs-cid-select:focus { border-color: var(--accent) !important; }
.ehs-cid-select option { background: var(--bg-2); color: var(--text-1); }
