/* 电站安全管理系统 · 统一样式 */
:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --text: #1b1f24;
  --muted: #6b7280;
  --line: #e4e7ec;
  --brand: #1a6fb5;
  --brand-weak: #e8f2fb;
  --danger: #d93025;
  --danger-weak: #fdeceb;
  --ok: #13795b;
  --ok-weak: #e6f5ef;
  --warn: #b06000;
  --warn-weak: #fdf2e2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
h1 { font-size: 18px; }
h2 { font-size: 16px; }
h3 { font-size: 15px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.3;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.btn:hover { background: #f7f8fa; }
.btn:active { transform: translateY(.5px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #15629e; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #bd2a20; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--brand); padding: 6px 8px; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 6px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 16px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}
.card-body { padding: 16px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field > label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
}
.field .req::after { content: " *"; color: var(--danger); }
input[type="text"], input[type="password"], input[type="date"],
input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 16px;      /* iOS 小于 16px 会自动放大页面 */
  font-family: inherit;
  line-height: 1.4;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
textarea { resize: vertical; min-height: 88px; }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26, 111, 181, .12);
}
select { background-image: none; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.err-text { color: var(--danger); font-size: 13px; margin-top: 6px; }

@media (min-width: 900px) {
  input[type="text"], input[type="password"], input[type="date"],
  input[type="number"], input[type="search"], select, textarea { font-size: 14px; padding: 8px 11px; }
}

/* ---------- 标签 ---------- */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.6;
  white-space: nowrap;
}
.tag-gray { background: #f0f1f4; color: #5b6270; }
.tag-blue { background: var(--brand-weak); color: var(--brand); }
.tag-orange { background: var(--warn-weak); color: var(--warn); }
.tag-red { background: var(--danger-weak); color: var(--danger); }
.tag-green { background: var(--ok-weak); color: var(--ok); }

/* ---------- 表格 ---------- */
.tbl-wrap { width: 100%; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 12.5px;
  padding: 10px 12px;
  background: #fafbfc;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.tbl td {
  padding: 11px 12px;
  border-bottom: 1px solid #f0f1f4;
  vertical-align: middle;
}
table.tbl tbody tr:hover { background: #fafbfc; }
table.tbl tr.clickable { cursor: pointer; }

/* ---------- 空状态 / 加载 ---------- */
.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}
.loading { padding: 40px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast-item {
  background: rgba(27, 31, 36, .92);
  color: #fff;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  max-width: 80vw;
  animation: toastIn .18s ease-out;
}
.toast-item.err { background: rgba(190, 42, 32, .95); }
.toast-item.ok { background: rgba(19, 121, 91, .95); }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 弹层 ---------- */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, .42);
  z-index: 900;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.mask.center { align-items: center; padding: 20px; }
.sheet {
  background: #fff;
  width: 100%;
  max-width: 560px;
  border-radius: 14px 14px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  max-height: 88vh;
  overflow-y: auto;
  animation: sheetUp .2s ease-out;
}
.mask.center .sheet { border-radius: 12px; padding: 20px; }
@keyframes sheetUp { from { transform: translateY(24px); } to { transform: none; } }
.sheet-title { font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet-actions .btn { flex: 1; }

/* ---------- 时间线 ---------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--line);
}
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand);
}
.tl-item.done::before { border-color: var(--ok); background: var(--ok); }
.tl-head { font-size: 13.5px; font-weight: 600; }
.tl-meta { font-size: 12px; color: var(--muted); margin-top: 1px; }
.tl-note {
  margin-top: 6px;
  padding: 8px 10px;
  background: #f7f8fa;
  border-radius: 6px;
  font-size: 13px;
  color: #3d434d;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- 照片 ---------- */
.pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.pic {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: #f0f1f4;
  border: 1px solid var(--line);
}
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pic .del {
  position: absolute;
  right: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .58);
  color: #fff;
  font-size: 13px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
}

/* ---------- 移动端 ---------- */
.m-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 14px;
  background: var(--brand);
  color: #fff;
}
.m-topbar .title { font-size: 16px; font-weight: 600; flex: 1; }
.m-topbar .who { font-size: 12.5px; opacity: .9; }
.m-topbar button {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 13px;
  padding: 6px 4px;
  cursor: pointer;
  font-family: inherit;
}
.m-view { padding: 12px 12px calc(72px + env(safe-area-inset-bottom)); min-height: calc(100vh - 52px); }
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  height: calc(56px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
  border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  color: var(--muted);
  font-size: 11.5px;
}
.tabbar a.active { color: var(--brand); }
.tabbar .ico { font-size: 19px; line-height: 1.1; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.stat .n { font-size: 24px; font-weight: 600; line-height: 1.2; }
.stat .l { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stat.red .n { color: var(--danger); }
.stat.orange .n { color: var(--warn); }
.stat.green .n { color: var(--ok); }

.hz-item {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  margin-bottom: 10px;
  color: inherit;
}
.hz-item:active { background: #fafbfc; }
.hz-title { font-size: 14.5px; font-weight: 600; line-height: 1.4; word-break: break-word; }
.hz-meta { font-size: 12.5px; color: var(--muted); margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.fab {
  position: fixed;
  right: 16px;
  bottom: calc(72px + env(safe-area-inset-bottom));
  z-index: 55;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  border: 0;
  font-size: 26px;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(26, 111, 181, .38);
  cursor: pointer;
}

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, #1a6fb5 0%, #14548a 42%, #f4f5f7 42%, #f4f5f7 100%);
}
.login-box {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 14px;
  padding: 28px 24px;
  box-shadow: 0 10px 40px rgba(16, 24, 40, .14);
}
.login-box h1 { font-size: 20px; text-align: center; }
.login-box .sub { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 22px; }

/* ---------- 桌面端 ---------- */
.d-layout { display: flex; min-height: 100vh; }
.d-side {
  width: 208px;
  flex: 0 0 208px;
  background: #14344e;
  color: #cfe0ee;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.d-brand { padding: 18px 18px 14px; font-size: 15px; font-weight: 600; color: #fff; border-bottom: 1px solid rgba(255,255,255,.1); }
.d-brand small { display: block; font-size: 11.5px; font-weight: 400; color: #8fb4d0; margin-top: 3px; }
.d-nav { padding: 10px 8px; flex: 1; overflow-y: auto; }
.d-nav a {
  display: block;
  padding: 9px 12px;
  border-radius: 7px;
  color: #cfe0ee;
  font-size: 13.5px;
  margin-bottom: 2px;
}
.d-nav a:hover { background: rgba(255,255,255,.07); }
.d-nav a.active { background: var(--brand); color: #fff; }
.d-user { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.1); font-size: 12.5px; color: #8fb4d0; }
.d-user b { color: #fff; font-weight: 600; display: block; font-size: 13px; }

.d-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.d-top {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.d-top h1 { font-size: 16px; }
.d-content { padding: 18px 22px 40px; flex: 1; }

.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; }
.kpi .n { font-size: 26px; font-weight: 600; line-height: 1.2; }
.kpi .l { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.kpi.red .n { color: var(--danger); }
.kpi.orange .n { color: var(--warn); }
.kpi.green .n { color: var(--ok); }
.kpi.blue .n { color: var(--brand); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1200px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters .field { margin-bottom: 0; }
.filters input, .filters select { min-width: 130px; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 13px; }
.bar-row .name { width: 78px; flex: 0 0 78px; color: #3d434d; }
.bar-row .bar { flex: 1; height: 20px; background: #f0f2f5; border-radius: 4px; overflow: hidden; }
.bar-row .bar span { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.bar-row .num { width: 52px; text-align: right; color: var(--muted); flex: 0 0 52px; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .detail-grid { grid-template-columns: 1fr; } }

.dl { display: grid; grid-template-columns: 88px 1fr; gap: 6px 12px; font-size: 13.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; word-break: break-word; }

.mobile-only { display: block; }
.desktop-only { display: none; }
@media (min-width: 900px) {
  .mobile-only { display: none; }
  .desktop-only { display: block; }
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.text-right { text-align: right; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.flex { display: flex; } .flex-1 { flex: 1; } .items-center { align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .justify-between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.draft-tip {
  background: var(--warn-weak);
  color: var(--warn);
  border: 1px solid #f2d9b0;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  margin-bottom: 12px;
}
