/* 企业安全环保管理系统 V1.0 —— 主题样式 */
:root {
  --brand: #0d5c63;
  --brand-dark: #094247;
  --brand-light: #e8f2f2;
  --accent: #f0a500;
  --danger: #d32f2f;
  --warn: #f57c00;
  --ok: #388e3c;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f4f6f8;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

/* ---------- 导航 ---------- */
.app-navbar {
  background: linear-gradient(90deg, var(--brand-dark), var(--brand));
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}
.app-navbar .navbar-brand { font-weight: 600; letter-spacing: .5px; }
.app-navbar .nav-link { color: rgba(255, 255, 255, .82); border-radius: 6px; padding: .4rem .7rem; }
.app-navbar .nav-link:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.app-navbar .nav-link.active { color: #fff; background: rgba(255, 255, 255, .18); font-weight: 600; }

.app-footer { border-top: 1px solid var(--line); background: #fff; }

/* ---------- 卡片 ---------- */
.card {
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .04);
}
.card-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  border-radius: 10px 10px 0 0 !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
}
.card-header .title { display: flex; align-items: center; gap: .4rem; }

/* ---------- 统计块 ---------- */
.stat-card { padding: 1rem 1.1rem; height: 100%; }
.stat-card .label { color: var(--muted); font-size: .82rem; margin-bottom: .35rem; }
.stat-card .value { font-size: 1.7rem; font-weight: 700; line-height: 1.15; }
.stat-card .unit { font-size: .8rem; color: var(--muted); margin-left: .25rem; }
.stat-card .delta { font-size: .78rem; margin-top: .25rem; }
.stat-card.is-danger { border-left: 4px solid var(--danger); }
.stat-card.is-warn { border-left: 4px solid var(--warn); }
.stat-card.is-ok { border-left: 4px solid var(--ok); }
.stat-card.is-brand { border-left: 4px solid var(--brand); }
.stat-card.is-muted { border-left: 4px solid var(--muted); }

/* ---------- 表格 ---------- */
.table { font-size: .875rem; margin-bottom: 0; }
.table > thead > tr > th {
  background: #fafbfc;
  color: var(--muted);
  font-weight: 600;
  font-size: .8rem;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.table > tbody > tr:hover { background: #fafbfc; }
.table td { vertical-align: middle; }

/* ---------- 徽标 ---------- */
.badge-soft { font-weight: 500; padding: .3em .6em; border-radius: 6px; font-size: .78rem; }
.badge-soft.s-pending { background: #fef3c7; color: #92400e; }
.badge-soft.s-rectifying { background: #dbeafe; color: #1e40af; }
.badge-soft.s-reviewing { background: #ede9fe; color: #5b21b6; }
.badge-soft.s-completed, .badge-soft.s-approved { background: #d1fae5; color: #065f46; }
.badge-soft.s-returned, .badge-soft.s-cancelled, .badge-soft.s-overdue { background: #fee2e2; color: #991b1b; }
.badge-soft.s-need_fill { background: #f3f4f6; color: #374151; }
.badge-soft.s-extend { background: #fce7f3; color: #9d174d; }
.badge-soft.s-closed { background: #d1fae5; color: #065f46; }
.badge-soft.s-normal, .badge-soft.s-valid, .badge-soft.s-active { background: #d1fae5; color: #065f46; }
.badge-soft.s-warning, .badge-soft.s-expiring { background: #fef3c7; color: #92400e; }
.badge-soft.s-abnormal, .badge-soft.s-expired, .badge-soft.s-inactive { background: #fee2e2; color: #991b1b; }
.badge-soft.s-draft { background: #f3f4f6; color: #374151; }
.badge-soft.s-submitted, .badge-soft.s-listed { background: #dbeafe; color: #1e40af; }
.badge-soft.s-implemented, .badge-soft.s-published { background: #d1fae5; color: #065f46; }
.badge-soft.s-rejected { background: #fee2e2; color: #991b1b; }
.badge-soft.s-accepted { background: #ede9fe; color: #5b21b6; }

.lv-一般事故隐患 { background: #fef3c7; color: #92400e; }
.lv-较大事故隐患 { background: #ffe4cc; color: #9a3412; }
.lv-重大事故隐患 { background: #fee2e2; color: #991b1b; }

.risk-重大风险 { background: #fee2e2; color: #991b1b; }
.risk-较大风险 { background: #ffe4cc; color: #9a3412; }
.risk-一般风险 { background: #fef3c7; color: #92400e; }
.risk-低风险 { background: #d1fae5; color: #065f46; }

/* ---------- 任务链 ---------- */
.task-chain { position: relative; padding-left: 1.6rem; }
.task-node {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: .75rem .9rem;
  margin-bottom: .6rem;
}
.task-node::before {
  content: '';
  position: absolute;
  left: -1.6rem; top: 1.1rem;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--brand);
  transform: translateX(-3px);
}
.task-chain > .task-node:not(:last-child)::after {
  content: '';
  position: absolute;
  left: -1.05rem; top: 1.9rem; bottom: -.6rem;
  width: 2px; background: var(--line);
}
.task-node.is-rectify { border-left: 3px solid var(--accent); }
.task-node.is-review { border-left: 3px solid var(--brand); }
.task-node.is-extend { border-left: 3px solid #9d174d; }
.task-meta { font-size: .8rem; color: var(--muted); }
.task-title { font-weight: 600; margin-bottom: .2rem; }

/* ---------- 时间线 ---------- */
.timeline { list-style: none; padding-left: 0; margin: 0; }
.timeline li {
  position: relative;
  padding: 0 0 .9rem 1.4rem;
  border-left: 2px solid var(--line);
  margin-left: .35rem;
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: '';
  position: absolute; left: -6px; top: .25rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--brand); border: 2px solid #fff;
}
.timeline .t-head { font-size: .82rem; color: var(--muted); }

/* ---------- 图片 ---------- */
.thumb {
  width: 76px; height: 76px; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--line);
  cursor: pointer; transition: transform .15s;
}
.thumb:hover { transform: scale(1.05); }
.thumb-lg { width: 130px; height: 130px; }

/* ---------- 表单 ---------- */
.form-label { font-weight: 500; font-size: .85rem; margin-bottom: .25rem; }
.form-label .req { color: var(--danger); margin-left: 2px; }
.help-text { font-size: .78rem; color: var(--muted); }
.filter-bar { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; }

/* ---------- 空状态 ---------- */
.empty-state { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }
.empty-state i { font-size: 2.5rem; opacity: .35; display: block; margin-bottom: .6rem; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 55%, #12787f 100%);
  padding: 1rem;
}
.login-card { width: 100%; max-width: 400px; border-radius: 14px; overflow: hidden; }
.login-card .brand-side {
  background: rgba(255, 255, 255, .06);
  color: #fff; padding: 1.5rem 1.5rem 1rem;
}
.login-card .brand-side h1 { font-size: 1.15rem; font-weight: 600; margin: 0; }
.login-card .brand-side p { font-size: .78rem; opacity: .75; margin: .35rem 0 0; }

/* ---------- 厂区地图 ---------- */
.site-map-canvas {
  position: relative;
  width: 100%; min-height: 460px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  background-image: linear-gradient(#f1f3f5 1px, transparent 1px),
                    linear-gradient(90deg, #f1f3f5 1px, transparent 1px);
  background-size: 40px 40px;
  overflow: hidden;
}
.site-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: .2rem .5rem;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  font-size: .75rem;
  white-space: nowrap;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}
.site-marker:hover { z-index: 10; }

/* ---------- 打印 ---------- */
@media print {
  .app-navbar, .app-footer, .no-print, .btn { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

@media (max-width: 768px) {
  .stat-card .value { font-size: 1.35rem; }
  .thumb { width: 56px; height: 56px; }
}
