:root {
  --ink: #162033;
  --muted: #5d6678;
  --line: #d8dee8;
  --panel: #ffffff;
  --page: #f4f7fb;
  --navy: #1f4d78;
  --navy-deep: #16324e;
  --blue: #2e74b5;
  --teal: #2f8f83;
  --amber: #b7791f;
  --red: #b42318;
  --green: #17664f;
  --green-bg: #dff3ea;
  --blue-bg: #e8f1fb;
  --amber-bg: #fff3d6;
  --red-bg: #fde8e5;
  --gray-bg: #eef2f7;
  --radius: 8px;
  --shadow: 0 2px 10px rgba(22, 32, 51, 0.06);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { color: var(--ink); background: var(--page); letter-spacing: 0; font-size: 14px; }

a { color: var(--blue); cursor: pointer; text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); border-radius: 6px;
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { border-color: #b9c4d4; background: #f7f9fc; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.primary:hover { background: var(--navy-deep); }
.btn.blue { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn.blue:hover { background: #276399; }
.btn.danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn.danger:hover { background: #9a1d14; }
.btn.teal { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.ghost { background: transparent; color: #d7e2ef; border-color: rgba(255,255,255,.25); }
.btn.ghost:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.4); }
.btn.block { width: 100%; }

/* ============ 登录 / 注册 ============ */
.auth-view { min-height: 100vh; display: flex; flex-direction: column; background: var(--navy-deep); }
.auth-shell { display: grid; grid-template-columns: 1.05fr 1fr; flex: 1; }
.auth-brand {
  background: linear-gradient(150deg, #16324e 0%, #1f4d78 55%, #2e74b5 100%);
  color: #fff; display: flex; align-items: center; justify-content: center; padding: 48px;
}
.auth-brand-inner { max-width: 460px; }
.brand-logo { font-size: 15px; font-weight: 800; letter-spacing: 1px; opacity: .9; }
.brand-logo span { font-weight: 400; opacity: .7; margin-left: 4px; font-size: 13px; }
.auth-brand h2 { font-size: 30px; line-height: 1.35; margin: 26px 0 14px; font-weight: 700; }
.auth-brand p { font-size: 14px; line-height: 1.7; color: #cfe0f0; margin: 0 0 28px; }
.brand-points { list-style: none; margin: 0 0 30px; padding: 0; }
.brand-points li { padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.12); font-size: 13px; color: #e6eef6; }
.brand-points b { color: #ffd76a; margin-right: 8px; font-size: 13px; }
.brand-foot { font-size: 12px; color: rgba(255,255,255,.5); }
.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #fff; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h3 { font-size: 22px; color: var(--navy); margin: 0 0 22px; }
.auth-switch { margin-top: 18px; text-align: center; font-size: 13px; color: var(--muted); }
.auth-hint { margin-top: 22px; padding: 12px 14px; background: var(--blue-bg); border-radius: 6px; font-size: 12px; color: var(--navy); }
.auth-hint span { font-weight: 700; }
.auth-hint div { margin-top: 3px; color: var(--muted); font-family: Consolas, monospace; }
.auth-msg { margin-top: 14px; padding: 10px 12px; border-radius: 6px; font-size: 13px; background: var(--red-bg); color: var(--red); }

/* ============ 页脚备案信息 ============ */
.site-footer {
  width: 100%;
  padding: 14px 20px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  white-space: nowrap;
}
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer img { display: inline-block; height: 16px; width: auto; vertical-align: middle; margin-right: 4px; }
.site-footer .sep { margin: 0 8px; opacity: .55; }
.site-footer--main { margin-top: auto; }
.site-footer--login { color: rgba(255, 255, 255, .65); }
.site-footer--login a { color: rgba(255, 255, 255, .8); }

/* ============ 应用外壳 ============ */
.app-view { display: flex; min-height: 100vh; }
.sidebar {
  width: 224px; flex-shrink: 0; background: var(--navy-deep); color: #d7e2ef;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-brand { padding: 20px 20px 16px; font-size: 15px; font-weight: 800; color: #fff; letter-spacing: .5px; }
.side-brand span { font-weight: 400; opacity: .6; font-size: 12px; margin-left: 4px; }
.side-nav { flex: 1; padding: 6px 10px; overflow-y: auto; }
.side-nav .nav-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; margin: 2px 0;
  border-radius: 6px; cursor: pointer; font-size: 13.5px; color: #c6d4e2; transition: background .15s, color .15s;
}
.side-nav .nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-nav .nav-item.active { background: var(--blue); color: #fff; font-weight: 600; }
.side-nav .nav-ico { width: 18px; text-align: center; font-size: 15px; }
.side-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.1); }
.side-user { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.side-name { font-size: 13.5px; color: #fff; font-weight: 600; }
.side-role { font-size: 12px; color: #8fa7bf; margin-top: 1px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-size: 17px; font-weight: 700; color: var(--navy); }
.topbar-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.topbar-date { font-size: 13px; color: var(--muted); }
.content { padding: 20px 24px; max-width: 1500px; width: 100%; margin: 0 auto; }

/* ============ 卡片 / 区块 ============ */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head {
  display: flex; justify-content: space-between; align-items: center; padding: 12px 16px;
  border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 700; color: var(--navy);
}
.panel-body { padding: 16px; }
.section-gap { margin-top: 16px; }

/* ============ 表单 ============ */
.form-field { margin-bottom: 14px; }
.form-field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.form-field label small { font-weight: 400; color: #98a2b3; margin-left: 6px; }
.form-field label .req { color: var(--red); margin-left: 2px; }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; height: 36px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 6px; padding: 0 10px; font-size: 13.5px; font-family: inherit;
}
textarea { height: auto; min-height: 78px; padding: 8px 10px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(46,116,181,.12); }
input[readonly] { background: #f5f7fa; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 16px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.form-grid .full { grid-column: 1 / -1; }
.form-section-title { font-size: 14px; font-weight: 700; color: var(--navy); margin: 22px 0 12px; padding-left: 10px; border-left: 3px solid var(--blue); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ============ KPI 卡片 ============ */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(110px, 1fr)); gap: 12px; }
.kpi { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: #fff; min-height: 88px; }
.kpi b { display: block; font-size: 28px; color: var(--navy); line-height: 1.15; margin-top: 8px; }
.kpi b small { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 2px; }
.kpi span { color: var(--muted); font-size: 12.5px; }
.kpi.warn { background: var(--amber-bg); border-color: #e6c778; }
.kpi.bad { background: var(--red-bg); border-color: #efb4ad; }
.kpi.good { background: var(--green-bg); border-color: #9bcfba; }
.kpi.info { background: var(--blue-bg); border-color: #b8d4ee; }
.kpi b .unit { font-size: 13px; }

/* ============ 流程步骤 ============ */
.flow { display: grid; grid-template-columns: repeat(6, minmax(110px, 1fr)); gap: 8px; }
.step { border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 6px; padding: 12px; background: #fff; min-height: 88px; }
.step strong { display: block; font-size: 13px; margin-bottom: 6px; color: var(--navy); }
.step small { color: var(--muted); line-height: 1.5; font-size: 12px; }

/* ============ 表格 ============ */
.table-wrap { overflow: auto; }
table.tbl { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: 10px 10px; text-align: left; vertical-align: top; }
.tbl th { background: var(--blue); color: #fff; font-weight: 700; white-space: nowrap; position: sticky; top: 0; }
.tbl tbody tr { cursor: pointer; background: #fff; }
.tbl tbody tr:hover { background: #eef6ff; }
.tbl td .cell-sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.tbl .num { text-align: right; }

/* ============ 徽章 ============ */
.badge { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.a { background: var(--green-bg); color: var(--green); }
.badge.b { background: var(--blue-bg); color: var(--navy); }
.badge.c { background: var(--gray-bg); color: #4a5568; }
.badge.wait { background: var(--red-bg); color: var(--red); }
.badge.status { background: var(--gray-bg); color: #344054; }
.badge.s-待审核 { background: var(--amber-bg); color: #9a6510; }
.badge.s-草稿 { background: var(--gray-bg); color: #4a5568; }
.badge.s-已驳回 { background: var(--red-bg); color: var(--red); }
.badge.s-已立项 { background: var(--blue-bg); color: var(--navy); }
.badge.s-开发中 { background: #e0f2f1; color: #176a63; }
.badge.s-已交付 { background: #e6edf7; color: #33517a; }
.badge.s-已闭环 { background: var(--green-bg); color: var(--green); }
.badge.s-已关闭 { background: var(--gray-bg); color: #4a5568; }

/* ============ 筛选栏 ============ */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-bar select, .filter-bar input[type=text], .filter-bar input[type=date] { width: auto; min-width: 120px; }

/* ============ 图表 ============ */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-panel .panel-body { padding: 16px 18px; }
.chart-title { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 12px; }
.chart-box { width: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ============ 看板泳道 ============ */
.mini-board { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 10px; }
.lane { border: 1px solid var(--line); border-radius: var(--radius); min-height: 150px; background: #fbfcfe; }
.lane h3 { margin: 0; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--navy); background: var(--blue-bg); display: flex; justify-content: space-between; }
.lane-item { margin: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 12px; line-height: 1.5; cursor: pointer; }
.lane-item:hover { border-color: var(--blue); }

/* ============ 时间线 ============ */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 2px solid var(--line); margin-left: 8px; padding: 0 0 16px 14px; position: relative; font-size: 12.5px; color: var(--muted); }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); }
.timeline li.pass::before { background: var(--teal); }
.timeline li.reject::before { background: var(--red); }
.timeline li.ledger::before { background: var(--navy); }
.timeline strong { display: block; color: var(--ink); margin-bottom: 3px; font-weight: 600; }
.timeline .tl-time { color: #98a2b3; font-size: 11.5px; margin-left: 6px; }
.timeline .tl-note { color: var(--muted); margin-top: 2px; }

/* ============ 需求详情 ============ */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; }
.field-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 16px; }
.field { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.field:last-child { border-bottom: none; }
.field label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.field div { font-size: 13px; line-height: 1.55; word-break: break-word; }

/* ============ 表格行操作与链接 ============ */
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.row-link { color: var(--blue); font-weight: 600; cursor: pointer; }
.row-link:hover { text-decoration: underline; }
.score-live { float: right; font-size: 13px; color: var(--muted); }
.score-live b { color: var(--navy); font-size: 15px; }
.score-live .badge { margin-left: 4px; }

/* ============ 评分器 ============ */
.score-grid { display: grid; grid-template-columns: 1fr 70px; gap: 8px; align-items: center; margin: 8px 0; font-size: 12.5px; }
.score-grid input { width: 70px; text-align: center; }
.score-total { margin-top: 14px; padding: 12px; border-radius: 6px; background: var(--blue-bg); font-weight: 700; color: var(--navy); font-size: 13.5px; }
.score-total .pri { float: right; }

/* ============ 弹窗 ============ */
.modal-mask { position: fixed; inset: 0; background: rgba(18, 28, 42, .5); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 60px 20px; overflow: auto; }
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0,0,0,.25); animation: pop .18s ease; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 700; color: var(--navy); }
.modal-close { cursor: pointer; font-size: 20px; color: var(--muted); line-height: 1; }
.modal-body { padding: 18px 20px; max-height: 65vh; overflow: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============ Toast ============ */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 200; padding: 11px 20px; border-radius: 6px; font-size: 13.5px; box-shadow: 0 8px 24px rgba(0,0,0,.15); max-width: 80%; }
.toast.ok { background: #eafaf1; color: #17664f; border: 1px solid #9bcfba; }
.toast.err { background: var(--red-bg); color: var(--red); border: 1px solid #efb4ad; }

/* ============ 空状态 ============ */
.empty { text-align: center; color: var(--muted); padding: 40px 16px; font-size: 13px; }
.empty .big { font-size: 34px; margin-bottom: 8px; opacity: .5; }

/* ============ 管理员流程配置 ============ */
.flow-row { display: grid; grid-template-columns: 46px 1fr 1fr 90px 100px 40px; gap: 8px; align-items: center; margin-bottom: 8px; }
.flow-row .f-order { text-align: center; font-weight: 700; color: var(--blue); }

/* ============ 响应式 ============ */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .flow { grid-template-columns: repeat(3, 1fr); }
  .chart-grid, .detail-grid { grid-template-columns: 1fr; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .mini-board { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .app-view { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; }
  .side-brand { padding: 12px 16px; }
  .side-nav { display: flex; overflow-x: auto; padding: 6px; }
  .side-nav .nav-item { white-space: nowrap; }
  .side-foot { display: none; }
  .content { padding: 12px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
