/* 亚新科风险减量平台 · 视觉系统
   设计取向：专业系统（左侧分组导航 + 列表/详情两级）而非单页看板
   配色：深蓝主色 + 四色风险分级（红橙黄蓝，GB/T 27921 通例） */
:root {
  --ink: #0B2545;
  --ink-2: #13315C;
  --blue: #1D6FA5;
  --blue-l: #2E8BC0;
  --blue-bg: #EDF3F9;
  --gold: #8A5E0E;   /* 加深：原 #C8901A 当文字色只有 2.6:1 */
  --gold-bg: #FDF6E3;
  --danger: #C0392B;
  --danger-bg: #FDECEA;
  --warn: #F37021;        /* 爱马仕橙 —— 只作填充/描边 */
  --warn-text: #B8500E;   /* 橙色当文字用时换深色（#F37021 压白底只有 2.94:1）*/
  --warn-bg: #FEF5E7;
  --ok: #1E8449;
  --ok-bg: #EAF7EF;
  --muted: #7B8794;
  --muted-bg: #F1F3F5;
  --line: #DFE5EC;
  --line-2: #EEF2F6;
  --bg: #F5F7FA;
  --card: #FFFFFF;
  --side-w: 232px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(11,37,69,.06), 0 4px 16px rgba(11,37,69,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 13.5px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3,h4 { font-weight: 600; }

/* ══ 应用外壳 ══ */
.app { display: flex; min-height: 100vh; }

/* 左侧导航 */
.sidebar { width: var(--side-w); background: var(--ink); color: #fff; flex: none;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 3px; }
.sb-brand { padding: 17px 18px 15px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sb-brand .nm { font-size: 17px; font-weight: 700; letter-spacing: 2px; display: flex; align-items: center; gap: 8px; }
.sb-brand .nm i { width: 8px; height: 8px; border-radius: 50%; background: #4FA8DB; box-shadow: 0 0 9px #4FA8DB; flex: none; }
.sb-brand .sub { font-size: 13px; color: #9EC9E8; font-weight: 500; margin-top: 4px; letter-spacing: 2.6px; }
.sb-group { padding: 13px 0 3px; }
.sb-group > .gt { font-size: 11px; opacity: .42; padding: 0 18px 6px; letter-spacing: .8px; }
.sb-group a { display: flex; align-items: center; gap: 9px; padding: 8px 18px; color: rgba(255,255,255,.8);
  font-size: 13px; border-left: 3px solid transparent; transition: .13s; }
.sb-group a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.sb-group a.on { background: rgba(255,255,255,.13); color: #fff; font-weight: 600; border-left-color: #4FA8DB; }
.sb-group a.off { opacity: .34; cursor: not-allowed; }
.sb-group a.off:hover { background: none; color: rgba(255,255,255,.8); }
.sb-group a .ic { width: 15px; text-align: center; opacity: .75; font-size: 12px; flex: none; }
.sb-foot { margin-top: auto; padding: 12px 0 14px; border-top: 1px solid rgba(255,255,255,.1); }
.sb-foot a, .sb-foot span { display: block; padding: 7px 18px; color: rgba(255,255,255,.6); font-size: 12px; }
.sb-foot .off { opacity: .35; }

/* 主区 */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 0 22px; height: 52px;
  display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 30; }
.crumb { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.crumb b { color: var(--ink); font-weight: 600; }
.crumb .sep { opacity: .4; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 12.5px; }
.tb-right .who { display: flex; align-items: center; gap: 8px; }
.tb-right .role { background: var(--blue-bg); color: var(--blue); padding: 1px 9px; border-radius: 20px; font-size: 11.5px; }
.tb-right .sc { color: var(--muted); }
.tb-right a { color: var(--muted); }
.content { padding: 20px 22px 40px; max-width: 1560px; width: 100%; }

/* 页面头 */
.page-h { margin: 0 0 16px; }
.page-h h1 { font-size: 19px; margin: 0 0 3px; }
.page-h .sub { color: var(--muted); font-size: 12.5px; }
.page-h .row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; overflow-x: auto; }
  .sb-group { padding: 6px 0; } .sb-group > .gt { display: none; }
  .sb-foot { margin: 0; border: none; display: flex; }
}

/* ══ 通用组件 ══ */
.grid { display: grid; gap: 13px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1080px) { .g3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.card > h3 { margin: 0 0 13px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.card > h3 .more { margin-left: auto; font-size: 12px; font-weight: 400; }
.card > h3 .hint { font-size: 11.5px; color: var(--muted); font-weight: 400; }

/* 待办卡 */
.todo { display: flex; align-items: center; gap: 13px; padding: 14px 17px; border-radius: var(--radius);
  border-left: 4px solid var(--muted); background: var(--card); box-shadow: var(--shadow); transition: .14s; }
.todo:hover { transform: translateX(2px); }
.todo.warn { border-left-color: var(--warn); background: linear-gradient(90deg, var(--warn-bg), var(--card) 40%); }
.todo.danger { border-left-color: var(--danger); background: linear-gradient(90deg, var(--danger-bg), var(--card) 40%); }
.todo.info { border-left-color: var(--blue); background: linear-gradient(90deg, var(--blue-bg), var(--card) 40%); }
.todo .n { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; min-width: 28px; }
.todo.warn .n { color: var(--warn-text); } .todo.danger .n { color: var(--danger); } .todo.info .n { color: var(--blue); }
.todo .t { font-weight: 600; font-size: 14px; }
.todo .d { color: var(--muted); font-size: 12px; }
.todo .go { margin-left: auto; color: var(--blue); font-size: 12.5px; white-space: nowrap; }

/* 数字格 */
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 13px 15px; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 23px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; }
.stat .v small { font-size: 12.5px; font-weight: 400; color: var(--muted); margin-left: 3px; }
.stat .f { font-size: 11px; color: var(--muted); opacity: .8; margin-top: 2px; }

/* 标签 */
.tag { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 11.5px; line-height: 1.7; white-space: nowrap; }
.t-danger { background: var(--danger-bg); color: var(--danger); }
.t-warn { background: var(--warn-bg); color: var(--warn-text); }
.t-info { background: var(--blue-bg); color: var(--blue); }
.t-ok { background: var(--ok-bg); color: var(--ok); }
.t-muted { background: var(--muted-bg); color: var(--muted); }
.t-gold { background: var(--gold-bg); color: var(--gold); }

/* 表格 */
.tb-wrap { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th { background: #F8FAFC; text-align: left; padding: 10px 12px; font-weight: 600; color: var(--ink-2);
  border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 2; }
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #F8FBFF; }
tbody tr.clickable { cursor: pointer; }
.tb-scroll { max-height: 66vh; overflow: auto; }

/* 筛选 */
.filters { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-bottom: 13px;
  background: var(--card); padding: 12px 14px; border-radius: var(--radius); box-shadow: var(--shadow); }
.filters label { font-size: 12px; color: var(--muted); }
select, input[type=text], input[type=password] { font-family: inherit; font-size: 12.5px; padding: 6px 9px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); outline: none; }
select:focus, input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(29,111,165,.14); }
.btn { font-family: inherit; font-size: 12.5px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; color: var(--ink); cursor: pointer; transition: .14s; }
.btn:hover { border-color: var(--blue-l); color: var(--blue); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--ink-2); color: #fff; }
.pager { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 13px; font-size: 12.5px; color: var(--muted); }
.pager button { font-family: inherit; padding: 4px 12px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; }
.pager button:disabled { opacity: .4; cursor: default; }

/* 面包屑式返回 */
.back { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; margin-bottom: 12px; }
.back:hover { color: var(--blue); }

/* 详情页 */
.dl { display: grid; grid-template-columns: 92px 1fr; gap: 9px 14px; font-size: 13px; }
.dl dt { color: var(--muted); font-size: 12.5px; }
.dl dd { margin: 0; }
.tabs2 { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs2 .t { padding: 8px 15px; font-size: 13px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs2 .t.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--blue); }
.tabs2 .t:hover { color: var(--ink); }
.prose { font-size: 13px; line-height: 1.85; white-space: pre-wrap; }
.kv-note { background: var(--blue-bg); border-left: 3px solid var(--blue-l); padding: 10px 13px; border-radius: 0 6px 6px 0; font-size: 12.5px; color: #2C4A66; }
.kv-note.warn { background: var(--warn-bg); border-left-color: var(--warn); color: #7A5410; }
.kv-note.danger { background: var(--danger-bg); border-left-color: var(--danger); color: #7A241A; }

/* 风险矩阵：6 列（1 个刻度列 + 5 个数据列）× 7 行，全部显式定位，不靠 grid 自动排布
   （早期版本用自动排布+跨行，结果左上角被留空、坐标轴标签错位到右侧） */
.matrix { display: grid; grid-template-columns: 36px repeat(5, 1fr); gap: 3px; }
.mx-cell { border-radius: 5px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; transition: .13s; color: #fff; min-height: 52px; }
.mx-cell:hover { transform: scale(1.05); box-shadow: 0 4px 14px rgba(0,0,0,.18); z-index: 2; }
.mx-cell.empty { background: #F4F6F8; cursor: default; color: #7B8794; }   /* 空格角标加深：#C3CBD4 压 #F4F6F8 只有 1.5:1 */
.mx-cell.empty:hover { transform: none; box-shadow: none; }
.mx-cell .c { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.mx-cell .r { font-size: 10px; opacity: .85; letter-spacing: .3px; }
.mx-lab { display: flex; align-items: center; justify-content: center; font-size: 11.5px; color: var(--muted); }
.mx-corner { display: flex; align-items: flex-end; justify-content: flex-end; font-size: 10px; color: #6B7A8A; padding: 0 4px 2px 0; }
.mx-legend { display: flex; gap: 15px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 13px; }
.mx-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* 风险点卡 */
/* min-width:0 必需：卡片内有 white-space:nowrap 的文本时，grid 列的默认 min-width:auto
   会按最长一行撑宽整列，第 4 张卡就顶出网格 7px（实测出血）。 */
.rp { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; border-left: 4px solid var(--muted); min-width: 0; }
.rp .hd { display: flex; align-items: baseline; gap: 9px; margin-bottom: 5px; flex-wrap: wrap; }
.rp .hd .nm { font-weight: 600; font-size: 13.5px; }
.rp .hd .lv { font-size: 11.5px; padding: 1px 8px; border-radius: 20px; color: #fff; }
/* 公司全称长短差很多（"宁国市亚新科五金制品有限公司" vs "亚新科双环智能制造分公司"），
   不截断就会换行，把下面整块内容顶下去 —— 11 张卡片横向对不齐。锁成单行＋省略号。 */
.rp .mt { font-size: 11.5px; color: var(--muted); margin-bottom: 9px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp .nums { display: flex; gap: 13px; font-size: 11.5px; color: #5A6B80; }
.rp .nums > div { padding-left: 12px; border-left: 1px solid var(--line-2); white-space: nowrap; }
.rp .nums > div:first-child { padding-left: 0; border-left: none; }
.rp .nums b { display: block; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.rp .pf-index { display: flex; align-items: baseline; gap: 6px; margin: 2px 0 9px; }
.rp .pf-index b { font-size: 26px; font-variant-numeric: tabular-nums; line-height: 1; }
.rp .pf-index span { font-size: 11.5px; color: #5A6B80; }
/* 小标题不能省：三条维度是 0-100 的相对分，底部四个是绝对条数，
   同名的「持续未整改」在两处量级完全不同，不点明会被当成同一个数。 */
.rp .pf-cap { font-size: 11px; color: #5A6B80; margin-bottom: 5px; }
.rp .pf-dims { margin-bottom: 11px; padding-top: 8px; border-top: 1px solid var(--line-2); }
.rp .pf-dims .r { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: #5A6B80; margin: 5px 0; }
.rp .pf-dims .k { width: 62px; flex: none; }
/* 轨道色别太浅：填充分为 0 时整条不可见，会被当成加载失败而不是"确实是 0" */
.rp .pf-dims .t { flex: 1; height: 6px; background: #E2E8F0; border-radius: 3px; overflow: hidden; }
.rp .pf-dims .t i { display: block; height: 100%; border-radius: 3px; }
.rp .pf-dims .v { width: 28px; text-align: right; flex: none; font-variant-numeric: tabular-nums; }

/* 图表 */
.chartbox { padding: 2px 0 0; }
.bar-row { display: flex; align-items: center; gap: 10px; margin: 7px 0; font-size: 12.5px; }
/* 标签列宽要放得下中文长标签（如"双环活塞环·消防水泵房"≈11字≈137px）。
   早期设 112px 导致 Top 列表 8 条标签**全部被省略号截断**，是实测 scrollWidth>clientWidth 才发现的。 */
.bar-row .lb { width: 150px; flex: none; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row.wide .lb { width: 176px; }
.bar-row .tr { flex: 1; height: 15px; background: #F1F4F7; border-radius: 3px; overflow: hidden; }
.bar-row .tr i { display: block; height: 100%; border-radius: 3px; }
.bar-row .vl { width: 34px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }

/* 登录页 */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, #0B2545 0%, #13315C 52%, #1D4E79 100%); padding: 24px; }
.login-box { width: 100%; max-width: 386px; background: #fff; border-radius: 13px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); padding: 36px 32px 28px; }
.login-box .lg { border-left: 4px solid #1D6FA5; padding-left: 16px; }
.login-box .lg-nm { font-size: 31px; font-weight: 700; line-height: 1.1; letter-spacing: 4px; color: var(--ink); }
.login-box .lg-plat { font-size: 17px; font-weight: 600; letter-spacing: 6px; color: #1D6FA5; margin-top: 9px; }
.login-box .lg-sub { color: #5A6B80; font-size: 13px; letter-spacing: 1.4px; margin: 17px 0 24px; padding-left: 20px; }
.login-box .fg { margin-bottom: 15px; }
.login-box .fg label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 5px; font-weight: 500; }
.login-box .fg input { width: 100%; padding: 10px 12px; font-size: 14px; }
.login-box .btn.primary { width: 100%; padding: 11px; font-size: 15px; margin-top: 5px; }
.login-err { color: var(--danger); font-size: 12.5px; min-height: 19px; margin-top: 11px; text-align: center; }
.login-note { color: var(--muted); font-size: 11.5px; margin-top: 20px; line-height: 1.75; border-top: 1px solid var(--line); padding-top: 14px; }
.login-note b { color: var(--ink-2); }

/* 空 / 建设中 */
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .ic { font-size: 30px; opacity: .3; margin-bottom: 9px; }
.empty .tt { font-size: 14.5px; color: var(--ink-2); font-weight: 500; margin-bottom: 5px; }
.footer { text-align: center; color: var(--muted); font-size: 11.5px; padding: 8px 20px 26px; line-height: 1.85; }
.loading { text-align: center; padding: 40px; color: var(--muted); font-size: 12.5px; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; color: #5A6B80; }

/* ── AI 问答小组件（工作台 / 任务页 共用）── */
.askmini textarea { width: 100%; font-family: inherit; font-size: 13.5px; line-height: 1.6; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 8px; resize: vertical; outline: none; }
.askmini textarea:focus { border-color: var(--blue-l); box-shadow: 0 0 0 3px rgba(46,139,192,.12); }
.askmini .row { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.askmini .tip { flex: 1; font-size: 11.5px; color: var(--muted); }
.qa.mini { background: #F8FAFC; border-radius: 8px; padding: 13px 15px; margin-top: 11px; }
.qa.mini .q { font-size: 13.5px; font-weight: 600; margin-bottom: 9px; }
.qa.mini .q::before { content: 'Q '; color: var(--blue); }
.qa.mini .a { font-size: 13px; line-height: 1.9; white-space: pre-wrap; color: #1C2E42; }
.qa.mini .srcs { margin-top: 11px; border-top: 1px solid var(--line); padding-top: 9px; }
.qa.mini .src { font-size: 12px; padding: 4px 0; display: flex; gap: 8px; }
.qa.mini .src .no { font-family: ui-monospace,Menlo,monospace; font-size: 11px; color: var(--muted); flex: none; width: 128px; }
.qa.mini .src .sm { color: #44546A; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa.mini .meta { font-size: 11px; color: var(--muted); margin-top: 8px; }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line);
  border-top-color: var(--blue); border-radius: 50%; animation: sp .7s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes sp { to { transform: rotate(360deg); } }
