/* ============================================================
   企业安全卫士 · 设计系统
   设计概念：安全标识体系（Safety Signage System）
   视觉母题取自工业安全标识：高可视黄、警示斜纹、安全绿/隐患红语义色
   字体：Barlow（道路标识字体，用于标题/数字）+ 系统中文字体
   ============================================================ */

/* [部署修正 2026-11-14] 原此处 @import Google Fonts（Barlow）已移除：
   该 @import 阻塞首屏渲染，且中国大陆不可达。已回退系统字体栈。 */
/* ---------- 设计令牌 ---------- */
:root {
  /* 色彩 */
  --ink: #14263a;          /* 钢青墨：应用界面底色、主文字 */
  --ink-2: #1c3350;        /* 钢青墨浅一档 */
  --ink-3: #27415f;        /* hover 态 */
  --paper: #f3f5f8;        /* 页面内容背景 */
  --card: #ffffff;         /* 卡片 */
  --hi-vis: #ffb800;       /* 高可视黄：主行动色 */
  --hi-vis-soft: #fff1c9;  /* 高可视黄淡底 */
  --safety: #2e9e6e;       /* 安全绿：已整改/安全 */
  --safety-soft: #e3f4ec;
  --hazard: #e8503a;       /* 隐患红橙：隐患/待整改/逾期 */
  --hazard-soft: #fdeae6;
  --warn: #f5a800;         /* 整改中 */
  --warn-soft: #fdf0d4;
  --info: #2b6cb0;         /* 信息蓝（沿用 SCORE 蓝作辅助） */
  --info-soft: #e8f0f9;

  /* 文字 */
  --text: #1a2b3c;
  --text-2: #5a6b7c;
  --text-3: #8b99a8;
  --line: #e4e9ef;
  --line-2: #d3dbe4;

  /* 字体 */
  --font-display: 'Barlow', 'Barlow Condensed', -apple-system, 'PingFang SC',
    'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  --font-body: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC',
    'Segoe UI', sans-serif;

  /* 尺寸 */
  --radius: 10px;
  --radius-lg: 16px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(20, 38, 58, 0.06);
  --shadow: 0 6px 24px rgba(20, 38, 58, 0.08);
  --shadow-lg: 0 16px 48px rgba(20, 38, 58, 0.14);

  /* 警示斜纹 */
  --stripe: repeating-linear-gradient(
    45deg,
    #ffb800 0,
    #ffb800 14px,
    #14263a 14px,
    #14263a 28px
  );
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; display: block; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.5em;
  color: var(--ink);
  letter-spacing: 0.01em;
}
p { margin: 0 0 1em; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; }
:focus-visible { outline: 3px solid var(--hi-vis); outline-offset: 2px; }
::selection { background: var(--hi-vis); color: var(--ink); }

/* 数字使用标识字体 */
.num, .stat-num, .kpi-num {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

/* ---------- 警示斜纹（签名元素） ---------- */
.stripe {
  height: 6px;
  background: var(--stripe);
  background-size: 40px 40px;
}
.stripe--tall { height: 10px; }
.stripe--thin { height: 3px; }

/* ---------- 布局工具 ---------- */
.container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.section { padding: 72px 0; }
.section--tight { padding: 40px 0; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.mono {
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 0.9em;
}
.hidden { display: none !important; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--hi-vis); color: var(--ink); }
.btn--primary:hover { background: #ffc633; text-decoration: none; }
.btn--dark { background: var(--ink); color: #fff; }
.btn--dark:hover { background: var(--ink-3); text-decoration: none; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn--ghost:hover { border-color: var(--ink); text-decoration: none; }
.btn--danger { background: var(--hazard); color: #fff; }
.btn--danger:hover { background: #d23e2b; text-decoration: none; }
.btn--safety { background: var(--safety); color: #fff; }
.btn--safety:hover { background: #238a5e; text-decoration: none; }
.btn--lg { padding: 15px 28px; font-size: 16px; border-radius: var(--radius-sm); }
.btn--sm { padding: 7px 14px; font-size: 13px; }
.btn--block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- 徽章 / 状态 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.badge--hazard { background: var(--hazard-soft); color: #c0341f; }
.badge--warn { background: var(--warn-soft); color: #a87200; }
.badge--safety { background: var(--safety-soft); color: #1f7a53; }
.badge--info { background: var(--info-soft); color: #215a92; }
.badge--ink { background: #e8edf3; color: var(--ink); }
.badge--dot::before {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card--flat { box-shadow: none; }
.card + .card { margin-top: 16px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.tbl th {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: #f8fafc; }
.tbl--hover tbody tr { cursor: pointer; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--ink); }
.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  transition: border 0.12s ease, box-shadow 0.12s ease;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--info);
  box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.12);
  outline: none;
}
.textarea { min-height: 96px; resize: vertical; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ---------- 顶栏（营销页） ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.navbar-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 17px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.nav-links { display: flex; align-items: center; gap: 24px; margin-left: auto; }
.nav-links a { color: var(--text-2); font-size: 14px; font-weight: 500; }
.nav-links a:hover { color: var(--ink); text-decoration: none; }

/* ---------- 应用框架（登录后的页面） ---------- */
.app { display: flex; min-height: 100vh; }
.app-sidebar {
  width: 240px;
  flex: none;
  background: var(--ink);
  color: #cdd8e4;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.app-sidebar .brand { color: #fff; padding: 20px 20px 16px; }
.app-sidebar .brand:hover { text-decoration: none; }
.side-nav { padding: 8px 12px; flex: 1; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  color: #b6c3d1;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}
.side-nav a:hover { background: var(--ink-2); color: #fff; text-decoration: none; }
.side-nav a.active { background: var(--hi-vis); color: var(--ink); font-weight: 700; }
.side-nav .ico { width: 18px; height: 18px; flex: none; opacity: 0.9; }
.side-foot { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,0.08); font-size: 12px; color: #7f92a6; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 40;
}
.app-topbar .page-title { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--ink); margin: 0; }
.app-topbar .spacer { flex: 1; }
.app-content { padding: 28px; max-width: 1200px; width: 100%; margin: 0 auto; }

/* 用户菜单 */
.user-chip { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--hi-vis); color: var(--ink);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
}

/* ---------- KPI 卡片 ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; background: var(--info);
}
.kpi--hazard::before { background: var(--hazard); }
.kpi--warn::before { background: var(--warn); }
.kpi--safety::before { background: var(--safety); }
.kpi--hi-vis::before { background: var(--hi-vis); }
.kpi-label { font-size: 13px; color: var(--text-2); margin-bottom: 4px; }
.kpi-num { font-size: 34px; font-weight: 800; color: var(--ink); line-height: 1; }
.kpi-delta { font-size: 12px; color: var(--text-3); margin-top: 8px; }
.kpi-delta.up { color: var(--safety); }
.kpi-delta.down { color: var(--hazard); }

/* ---------- 页面头 ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 22px; }
.page-head .lead { color: var(--text-2); margin: 4px 0 0; font-size: 14px; }

/* ---------- 网格 / 分栏 ---------- */
.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: 1fr 1fr; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--sidebar { grid-template-columns: 1fr 320px; }
@media (max-width: 960px) {
  .grid--2, .grid--3, .grid--sidebar { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- 图表占位 ---------- */
.chart-box { width: 100%; min-height: 220px; }

/* ---------- 进度条 ---------- */
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--info); border-radius: 999px; }
.progress--safety > span { background: var(--safety); }
.progress--warn > span { background: var(--warn); }
.progress--hazard > span { background: var(--hazard); }

/* ---------- 列表行 ---------- */
.list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: none; }
.list-item .thumb { width: 44px; height: 44px; border-radius: 8px; background: var(--paper); border: 1px solid var(--line); flex: none; overflow: hidden; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; color: var(--ink); }
.list-item .sub { font-size: 13px; color: var(--text-2); }

/* ---------- 空状态 ---------- */
.empty {
  text-align: center; padding: 60px 20px; color: var(--text-2);
}
.empty .empty-ico { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }

/* ---------- 通知 toast ---------- */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  background: var(--ink); color: #fff;
  padding: 13px 20px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  transform: translateY(20px); opacity: 0;
  transition: all 0.25s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast--safety { background: var(--safety); }
.toast--hazard { background: var(--hazard); }

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .app { flex-direction: column; }
  .app-sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; }
  .side-nav { display: flex; overflow-x: auto; }
  .side-nav a { white-space: nowrap; }
  .side-foot { display: none; }
  .app-topbar { padding: 12px 16px; }
  .app-content { padding: 18px 16px; }
  .nav-links { display: none; }
  .section { padding: 48px 0; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
