/* ============================================================
 * 电力成套项目管理系统 · 样式
 * ============================================================ */
:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --line: #e4e8f0;
  --line-2: #eef1f7;
  --text: #1e293b;
  --muted: #64748b;
  --brand: #2563eb;
  --brand-d: #1d4ed8;
  --brand-l: #eff4ff;
  --danger: #dc2626;
  --danger-l: #fef2f2;
  --warn: #d97706;
  --warn-l: #fffbeb;
  --ok: #16a34a;
  --ok-l: #f0fdf4;
  --info: #0891b2;
  --info-l: #ecfeff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .18);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 通用 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border: 1px solid var(--line); background: #fff;
  border-radius: 8px; cursor: pointer; white-space: nowrap;
  transition: .15s; font-size: 13px; line-height: 1.6;
}
.btn:hover { border-color: #c7d2fe; background: #f8faff; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-d); border-color: var(--brand-d); }
.btn-danger { color: var(--danger); border-color: #fecaca; background: var(--danger-l); }
.btn-danger:hover { background: #fee2e2; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: #eef2ff; color: var(--brand); }
.btn-sm { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 999px; font-size: 12px;
  background: #f1f5f9; color: var(--muted); border: 1px solid transparent; white-space: nowrap;
}
.badge.ok { background: var(--ok-l); color: var(--ok); border-color: #bbf7d0; }
.badge.warn { background: var(--warn-l); color: var(--warn); border-color: #fde68a; }
.badge.danger { background: var(--danger-l); color: var(--danger); border-color: #fecaca; }
.badge.info { background: var(--info-l); color: var(--info); border-color: #a5f3fc; }
.badge.brand { background: var(--brand-l); color: var(--brand); border-color: #c7d2fe; }
.badge.gray { background: #f8fafc; color: #94a3b8; border-color: var(--line); }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-1 { flex: 1; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.empty { padding: 42px 16px; text-align: center; color: #94a3b8; }
.empty .big { font-size: 30px; display: block; margin-bottom: 8px; opacity: .55; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-hd { padding: 12px 16px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-hd h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card-bd { padding: 16px; }

/* ---------- 登录 ---------- */
.login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 32px 16px;
  background: radial-gradient(1200px 600px at 15% -10%, #dbeafe 0%, transparent 55%),
              radial-gradient(1000px 500px at 100% 0%, #e0e7ff 0%, transparent 50%), #f4f6fb;
}
.login-box { width: 100%; max-width: 960px; }
.login-title { text-align: center; margin-bottom: 26px; }
.login-title h1 { margin: 0 0 6px; font-size: 25px; letter-spacing: .5px; }
.login-title p { margin: 0; color: var(--muted); font-size: 13px; }
.login-title .logo { font-size: 34px; display: block; margin-bottom: 6px; }
.role-group { margin-bottom: 16px; }
.role-group > .lbl { font-size: 12px; color: var(--muted); margin: 0 0 8px 2px; letter-spacing: .5px; }
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
.user-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; cursor: pointer; transition: .16s; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px;
}
.user-card:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(37, 99, 235, .16); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 600; letter-spacing: .5px;
}
.user-card .nm { font-weight: 600; }
.user-card .rl { font-size: 12px; color: var(--muted); }

/* ---------- 布局 ---------- */
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 18px;
  position: sticky; top: 0; z-index: 50;
}
.topbar .brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; white-space: nowrap; }
.topbar .brand .ic { font-size: 19px; }
.nav { display: flex; gap: 3px; margin-left: 10px; overflow-x: auto; }
.nav a {
  padding: 6px 13px; border-radius: 8px; color: var(--muted); font-size: 13.5px;
  cursor: pointer; white-space: nowrap; transition: .15s;
}
.nav a:hover { background: #f1f5f9; color: var(--text); }
.nav a.on { background: var(--brand-l); color: var(--brand); font-weight: 600; }
.topbar .spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--line); cursor: pointer; }
.me:hover { border-color: var(--brand); }
.bell { position: relative; cursor: pointer; padding: 6px 8px; border-radius: 8px; font-size: 17px; }
.bell:hover { background: #f1f5f9; }
.bell .dot {
  position: absolute; top: 1px; right: 0; min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--danger); color: #fff; border-radius: 999px;
  font-size: 10.5px; line-height: 17px; text-align: center; font-weight: 600;
}
.view { padding: 18px; max-width: 1720px; margin: 0 auto; }
.page-hd { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-hd h2 { margin: 0; font-size: 19px; }
.page-hd .sub { color: var(--muted); font-size: 12.5px; }
.page-hd .spacer { flex: 1; }

/* ---------- 统计卡 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 15px; box-shadow: var(--shadow); }
.stat .k { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.stat .v { font-size: 21px; font-weight: 700; margin-top: 4px; letter-spacing: -.3px; }
.stat .v small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.stat.danger .v { color: var(--danger); }
.stat.warn .v { color: var(--warn); }
.stat.ok .v { color: var(--ok); }
.stat.brand .v { color: var(--brand); }

/* ---------- 看板 ---------- */
.board { display: flex; gap: 13px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.col {
  min-width: 292px; width: 292px; flex: none; background: #eef1f7;
  border-radius: var(--radius); padding: 9px; display: flex; flex-direction: column;
  max-height: calc(100vh - 210px); border: 1px solid #e6eaf2;
}
.col-hd { display: flex; align-items: center; gap: 7px; padding: 3px 5px 9px; }
.col-hd .nm { font-weight: 600; font-size: 13.5px; }
.col-hd .cnt {
  margin-left: auto; background: #fff; border-radius: 999px; padding: 0 8px;
  font-size: 12px; color: var(--muted); border: 1px solid var(--line);
}
.col-bd { overflow-y: auto; display: flex; flex-direction: column; gap: 9px; padding: 1px; min-height: 70px; }
.col.done { background: #f6f7f9; border-style: dashed; }
.col.done .col-bd { opacity: .8; }

.pcard {
  background: #fff; border: 1px solid var(--line); border-radius: 9px;
  padding: 11px 12px; cursor: pointer; transition: .15s; box-shadow: 0 1px 2px rgba(16,24,40,.05);
  border-left: 3px solid var(--brand);
}
.pcard:hover { border-color: #c7d2fe; box-shadow: 0 6px 18px rgba(16, 24, 40, .1); transform: translateY(-1px); }
.pcard .t { font-weight: 600; font-size: 13.5px; margin-bottom: 2px; }
.pcard .c { font-size: 12px; color: var(--muted); }
.pcard .row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.pcard .row .badge { font-size: 11px; }
.pcard .bar { height: 4px; background: #eef1f7; border-radius: 3px; margin-top: 8px; overflow: hidden; }
.pcard .bar > i { display: block; height: 100%; background: var(--brand); border-radius: 3px; transition: width .3s; }
.pcard .bar.ok > i { background: var(--ok); }
.pcard .bar.danger > i { background: var(--danger); }
.pcard .amt { font-weight: 600; font-variant-numeric: tabular-nums; }
.pcard.late { border-left-color: var(--danger); }
.pcard.soon { border-left-color: var(--warn); }
.pcard.done-card { border-left-color: var(--ok); }

/* ---------- 表格 ---------- */
.tbl-wrap { overflow: auto; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.tbl th {
  background: #f8fafc; text-align: left; font-weight: 600; color: #475569;
  padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
table.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.tbl tbody tr:hover td { background: #f8faff; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .ops { white-space: nowrap; text-align: right; }
tfoot.sum td { background: #f8fafc; font-weight: 600; border-top: 1px solid var(--line); }

/* ---------- 详情 ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; background: #fff; border-radius: var(--radius) var(--radius) 0 0; padding: 0 8px; }
.tabs a {
  padding: 11px 13px; color: var(--muted); cursor: pointer; white-space: nowrap;
  font-size: 13.5px; border-bottom: 2px solid transparent; transition: .15s;
}
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tabs a .n { font-size: 11px; color: #94a3b8; margin-left: 3px; }
.tab-body { background: #fff; border: 1px solid var(--line); border-top: none; border-radius: 0 0 var(--radius) var(--radius); padding: 16px; box-shadow: var(--shadow); }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 2px 20px; }
.kv .it { padding: 8px 0; border-bottom: 1px dashed var(--line-2); display: flex; gap: 10px; }
.kv .it .k { color: var(--muted); font-size: 12.5px; flex: none; min-width: 84px; }
.kv .it .v { font-weight: 500; word-break: break-all; }

/* 流程进度 */
.flow { display: flex; align-items: flex-start; gap: 0; overflow-x: auto; padding: 6px 2px 2px; }
.flow .st { flex: 1; min-width: 96px; text-align: center; position: relative; }
.flow .st .cir {
  width: 26px; height: 26px; border-radius: 50%; margin: 0 auto 6px;
  background: #fff; border: 2px solid var(--line); color: #94a3b8;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
  position: relative; z-index: 2;
}
.flow .st .nm { font-size: 12px; color: var(--muted); }
.flow .st .who { font-size: 11px; color: #a3aab8; }
.flow .st::before {
  content: ''; position: absolute; top: 13px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 1;
}
.flow .st:first-child::before { display: none; }
.flow .st.ok .cir { background: var(--ok); border-color: var(--ok); color: #fff; }
.flow .st.ok::before { background: var(--ok); }
.flow .st.ok .nm { color: var(--text); }
.flow .st.cur .cir { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 4px var(--brand-l); }
.flow .st.cur .nm { color: var(--brand); font-weight: 600; }

/* 进度条组 */
.meter { margin-bottom: 11px; }
.meter .top { display: flex; font-size: 12.5px; margin-bottom: 4px; }
.meter .top .k { color: var(--muted); }
.meter .top .v { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.meter .track { height: 8px; background: #eef1f7; border-radius: 5px; overflow: hidden; }
.meter .track > i { display: block; height: 100%; border-radius: 5px; background: var(--brand); transition: width .35s; }
.meter .track > i.ok { background: var(--ok); }
.meter .track > i.warn { background: var(--warn); }
.meter .track > i.danger { background: var(--danger); }

/* ---------- 提醒 ---------- */
.rm-list { display: flex; flex-direction: column; gap: 9px; }
.rm {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px;
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--info);
  border-radius: 9px; box-shadow: var(--shadow);
}
.rm.danger { border-left-color: var(--danger); background: #fffbfb; }
.rm.warn { border-left-color: var(--warn); background: #fffdf7; }
.rm.ok { border-left-color: var(--ok); }
.rm .ic { font-size: 18px; line-height: 1.3; }
.rm .bd { flex: 1; min-width: 0; }
.rm .bd .t { font-weight: 600; margin-bottom: 2px; }
.rm .bd .d { font-size: 12.5px; color: var(--muted); }
.rm .bd .who { margin-top: 6px; display: flex; gap: 5px; flex-wrap: wrap; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 13px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field > label { font-size: 12.5px; color: #475569; font-weight: 500; }
.field > label .req { color: var(--danger); margin-left: 2px; }
.field input, .field select, .field textarea {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; outline: none; transition: .15s; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-l); }
.field input[readonly], .field input:disabled, .field select:disabled, .field textarea[readonly] { background: #f8fafc; color: var(--muted); cursor: not-allowed; }
.field textarea { resize: vertical; min-height: 74px; }
.field .hint { font-size: 11.5px; color: #94a3b8; }
.field .err { font-size: 11.5px; color: var(--danger); }
.multi { display: flex; flex-wrap: wrap; gap: 6px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.multi label { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; cursor: pointer; padding: 2px 8px; border-radius: 6px; background: #f8fafc; border: 1px solid var(--line); }
.multi label:has(input:checked) { background: var(--brand-l); border-color: #c7d2fe; color: var(--brand); }

/* ---------- 弹窗 ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .48); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: #fff; border-radius: 13px; width: 100%; max-width: 760px;
  box-shadow: var(--shadow-lg); animation: pop .18s cubic-bezier(.2, .8, .3, 1.2);
  margin-bottom: 40px;
}
@keyframes pop { from { transform: translateY(-12px) scale(.98); opacity: 0; } }
.modal-hd { padding: 15px 20px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; }
.modal-hd h3 { margin: 0; font-size: 16px; }
.modal-hd .x { margin-left: auto; cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; padding: 0 4px; }
.modal-hd .x:hover { color: var(--danger); }
.modal-bd { padding: 18px 20px; }
.modal-ft { padding: 13px 20px; border-top: 1px solid var(--line-2); display: flex; gap: 9px; justify-content: flex-end; align-items: center; }
.modal-ft .msg { margin-right: auto; font-size: 12.5px; color: var(--danger); }
.modal.wide { max-width: 980px; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 9px; align-items: flex-end; }
.toast {
  background: #1e293b; color: #fff; padding: 10px 15px; border-radius: 9px;
  font-size: 13px; box-shadow: var(--shadow-lg); max-width: 390px;
  animation: slide .2s ease; display: flex; gap: 8px; align-items: flex-start;
}
@keyframes slide { from { transform: translateX(20px); opacity: 0; } }
.toast.ok { background: #15803d; }
.toast.err { background: #b91c1c; }
.toast.warn { background: #b45309; }

/* ---------- 项目卡片列表 ---------- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 13px; }
.pg-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 15px; cursor: pointer; transition: .16s; box-shadow: var(--shadow); }
.pg-card:hover { border-color: #c7d2fe; transform: translateY(-2px); box-shadow: 0 10px 26px rgba(16,24,40,.1); }
.pg-card .hd { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 4px; }
.pg-card .hd .t { font-weight: 600; font-size: 14.5px; }
.pg-card .no { font-size: 12px; color: #94a3b8; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 13px; }
.filters select, .filters input {
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; outline: none;
}
.filters input:focus, .filters select:focus { border-color: var(--brand); }
.filters input[type=search] { min-width: 210px; }

.seg { display: inline-flex; background: #eef1f7; border-radius: 8px; padding: 2px; gap: 2px; }
.seg button { border: none; background: transparent; padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 12.5px; color: var(--muted); }
.seg button.on { background: #fff; color: var(--brand); font-weight: 600; box-shadow: 0 1px 3px rgba(16,24,40,.1); }

.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); align-items: center; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 4px; }

.rule-note {
  background: var(--brand-l); border: 1px solid #c7d2fe; color: #1e40af;
  border-radius: 9px; padding: 9px 13px; font-size: 12.5px; margin-bottom: 13px;
}
.rule-note b { font-weight: 600; }

/* 卡点提示（老板看板核心） */
.stuck {
  display: flex; align-items: flex-start; gap: 7px;
  margin-top: 8px; padding: 7px 9px; border-radius: 7px;
  background: #f8fafc; border-left: 3px solid #94a3b8;
  font-size: 12.5px; line-height: 1.45;
}
.stuck .ic { font-size: 15px; line-height: 1.25; flex: none; }
.stuck b { font-weight: 600; display: block; }
.stuck .dt { color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.stuck .who {
  margin-left: auto; flex: none; font-size: 11px;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 0 7px; color: var(--muted); white-space: nowrap;
}
.stuck.warn { background: var(--warn-l); border-left-color: var(--warn); }
.stuck.warn b { color: #92400e; }
.stuck.danger { background: var(--danger-l); border-left-color: var(--danger); }
.stuck.danger b { color: #b91c1c; }
.stuck.ok { background: var(--ok-l); border-left-color: var(--ok); }
.stuck.ok b { color: #15803d; }

@media (max-width: 820px) {
  .view { padding: 12px; }
  .topbar { padding: 0 10px; gap: 8px; }
  .topbar .brand span.full { display: none; }
  .col { min-width: 258px; width: 258px; }
}
