/* ==========================================================================
   境德智能 · 稽真 — 演示工作台样式（Jizhen Console）
   依赖 style.css 的 design token
   ========================================================================== */

body.app-body { background: var(--bg); overflow: hidden; }

/* ---------- 布局 ---------- */
.app { display: flex; height: 100vh; overflow: hidden; }

/* 侧边栏 */
.side {
  width: 236px; flex-shrink: 0; background: var(--brand-950);
  display: flex; flex-direction: column; height: 100%;
  transition: width .28s var(--ease);
}
.side__head {
  height: var(--nav-h); display: flex; align-items: center; gap: 10px;
  padding: 0 20px; flex-shrink: 0;
}
.side__head svg { width: 30px; height: 30px; flex-shrink: 0; }
.side__head b { color: #fff; font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.side__head b em { color: var(--cyan-400); font-style: normal; font-weight: 500; font-size: 11px; display: block; letter-spacing: .06em; margin-top: -2px; }

.side__org {
  margin: 4px 14px 16px; padding: 10px 12px; border-radius: var(--r-sm);
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 9px;
}
.side__org i {
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
  background-color: #1361C4;
  background-image: linear-gradient(135deg, var(--brand-500), var(--cyan-500));
  display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; font-style: normal;
}
.side__org div { min-width: 0; }
.side__org b { display: block; color: #fff; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side__org span { font-size: 11px; color: rgba(255,255,255,.45); }

.side__nav { flex: 1; overflow-y: auto; padding: 0 12px 16px; }
.side__group { font-size: 11px; font-weight: 600; color: rgba(255,255,255,.3); letter-spacing: .09em; padding: 14px 12px 8px; }
.side__item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 12px; border-radius: var(--r-xs);
  color: rgba(255,255,255,.66); font-size: 14px; text-align: left;
  transition: background .2s, color .2s; margin-bottom: 2px;
}
.side__item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.side__item:hover { background: rgba(255,255,255,.07); color: #fff; }
.side__item.is-active { background: linear-gradient(135deg, var(--brand-600), var(--brand-700)); color: #fff; box-shadow: 0 6px 18px rgba(19,97,196,.4); }
.side__item.is-active svg { opacity: 1; }
.side__badge {
  margin-left: auto; font-family: var(--font-num); font-size: 11px; font-weight: 700;
  padding: 1px 7px; border-radius: var(--r-full); background: var(--danger); color: #fff;
}
.side__item.is-active .side__badge { background: rgba(255,255,255,.22); }

.side__foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); flex-shrink: 0; }
.side__user { display: flex; align-items: center; gap: 10px; }
.side__user i {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: #1361C4;
  background-image: linear-gradient(135deg, #2E7BF6, #00B9C7);
  display: grid; place-items: center; color: #fff; font-size: 12.5px; font-weight: 700; font-style: normal;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.22);
}
.side__user b { display: block; color: #fff; font-size: 13px; }
.side__user span { font-size: 11px; color: rgba(255,255,255,.45); }

/* 主区 */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100%; }

.topbar {
  height: var(--nav-h); flex-shrink: 0; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 18px; padding: 0 24px;
}
.topbar__crumb { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-400); }
.topbar__crumb b { color: var(--ink-900); font-weight: 600; font-size: 15px; }
.topbar__spacer { flex: 1; }
.search {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: var(--r-full); background: var(--bg); border: 1px solid var(--line);
  width: 260px; transition: border-color .2s, background .2s;
}
.search:focus-within { border-color: var(--brand-300); background: #fff; }
.search svg { width: 15px; height: 15px; color: var(--ink-400); flex-shrink: 0; }
.search input { border: none; background: none; outline: none; font-size: 13.5px; width: 100%; }
.search input::placeholder { color: var(--ink-300); }
.icon-btn {
  width: 38px; height: 38px; border-radius: var(--r-xs); display: grid; place-items: center;
  color: var(--ink-500); position: relative; transition: background .2s, color .2s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--bg); color: var(--brand-600); }
.icon-btn::after {
  content: none;
}
.icon-btn--dot::after {
  content: ""; position: absolute; top: 8px; right: 9px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--danger); border: 1.5px solid #fff;
}
.topbar__divider { width: 1px; height: 24px; background: var(--line); }
.topbar__user { display: flex; align-items: center; gap: 9px; }
.topbar__user i {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; font-style: normal;
  background-color: #2E7BF6;
  background-image: linear-gradient(135deg, #2E7BF6, #00B9C7);
  display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700;
}
.topbar__user b { font-size: 13px; color: var(--ink-900); }
.topbar__user span { display: block; font-size: 11px; color: var(--ink-400); }
.demo-tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-full);
  background: var(--warn-bg); color: var(--warn); font-size: 11.5px; font-weight: 600;
}

/* 内容区 */
.content { flex: 1; overflow-y: auto; padding: 24px; }
.view { display: none; animation: fadeUp .32s var(--ease); }
.view.is-active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.view-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.view-head h2 { font-size: 21px; }
.view-head p { font-size: 13.5px; color: var(--ink-400); margin-top: 4px; }
.view-head__actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }

/* KPI 大卡 */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 18px 20px; position: relative; overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; right: -46px; top: -52px; width: 148px; height: 148px;
  border-radius: 50%; background: radial-gradient(circle at 50% 50%, rgba(46,123,246,.10), rgba(46,123,246,0) 70%);
}
.kpi__label { font-size: 12.5px; color: var(--ink-400); display: flex; align-items: center; gap: 6px; position: relative; z-index: 1; }
.kpi__label svg { width: 14px; height: 14px; }
.kpi__val { font-family: var(--font-num); font-size: 30px; font-weight: 700; color: var(--ink-900); line-height: 1.25; margin-top: 8px; position: relative; z-index: 1; }
.kpi__val small { font-size: 14px; font-weight: 500; color: var(--ink-400); margin-left: 3px; }
.kpi__foot { margin-top: 8px; font-size: 12px; color: var(--ink-400); display: flex; align-items: center; gap: 6px; position: relative; z-index: 1; }
.kpi__foot b { font-weight: 600; }
.up { color: var(--ok); }
.down { color: var(--danger); }
.kpi--danger .kpi__val { color: var(--danger); }
.kpi--danger::after { background: radial-gradient(circle at 50% 50%, rgba(220,38,38,.11), rgba(220,38,38,0) 70%); }

/* 卡片容器 */
.box { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.box__head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line-2);
}
.box__head h3 { font-size: 15px; }
.box__head span { font-size: 12px; color: var(--ink-400); }
.box__head .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.box__body { padding: 20px; }
.box__body--flush { padding: 0; }

.row-2 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; margin-bottom: 16px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* 图例 */
.legend { display: flex; flex-direction: column; gap: 12px; }
.legend__item { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.legend__dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.legend__name { color: var(--ink-700); }
.legend__val { margin-left: auto; font-family: var(--font-num); font-weight: 700; color: var(--ink-900); }

/* 进度条列表 */
.barlist { display: flex; flex-direction: column; gap: 15px; }
.baritem__top { display: flex; align-items: center; gap: 10px; font-size: 13px; margin-bottom: 6px; }
.baritem__top b { color: var(--ink-800); font-weight: 600; }
.baritem__top span { margin-left: auto; font-family: var(--font-num); font-weight: 700; color: var(--ink-900); }
.baritem__top span small { color: var(--ink-400); font-weight: 500; margin-left: 3px; }
.bar { height: 7px; border-radius: var(--r-full); background: var(--line-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: var(--r-full); background: linear-gradient(90deg, var(--brand-600), var(--brand-500)); transition: width .8s var(--ease); }
.bar i.ok { background: linear-gradient(90deg, #16A34A, #3FCF6E); }
.bar i.warn { background: linear-gradient(90deg, #E8801A, #F5A63C); }
.bar i.danger { background: linear-gradient(90deg, #DC2626, #F05A5A); }
.bar i.cyan { background: linear-gradient(90deg, var(--cyan-600), var(--cyan-400)); }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.tbl { font-size: 13.5px; min-width: 900px; }
table.tbl thead th {
  text-align: left; padding: 11px 16px; background: var(--bg-2);
  font-size: 12px; font-weight: 600; color: var(--ink-400); letter-spacing: .03em;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tbl tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); color: var(--ink-700); vertical-align: middle; }
table.tbl tbody tr { transition: background .18s; cursor: pointer; }
table.tbl tbody tr:hover { background: var(--brand-50); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl td.num, table.tbl th.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
table.tbl .strong { color: var(--ink-900); font-weight: 600; }
table.tbl .muted { color: var(--ink-400); font-size: 12.5px; }

/* 紧凑表：用于卡片内的小清单，主副两行结构 */
table.tbl--compact { min-width: auto; }
table.tbl--compact td { padding: 11px 20px; }
table.tbl--compact .muted { font-size: 12px; margin-top: 3px; }

.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: var(--r-full); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.tag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.tag--danger { background: var(--danger-bg); color: var(--danger); }
.tag--warn { background: var(--warn-bg); color: var(--warn); }
.tag--ok { background: var(--ok-bg); color: #0F7A38; }
.tag--info { background: var(--brand-100); color: var(--brand-700); }
.tag--mute { background: var(--line-2); color: var(--ink-400); }

/* 筛选条 */
.filters { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; background: var(--bg-2); }
.select {
  height: 34px; padding: 0 30px 0 12px; border-radius: var(--r-xs);
  border: 1px solid var(--line); background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238496AC' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  font-size: 13px; color: var(--ink-700); appearance: none; outline: none; cursor: pointer;
}
.select:focus { border-color: var(--brand-300); }
.filters__spacer { flex: 1; }
.filters__count { font-size: 12.5px; color: var(--ink-400); }

/* 分页 */
.pager { display: flex; align-items: center; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--line-2); }
.pager__info { font-size: 12.5px; color: var(--ink-400); }
.pager__spacer { flex: 1; }
.pager button {
  min-width: 32px; height: 32px; padding: 0 9px; border-radius: var(--r-xs);
  border: 1px solid var(--line); background: #fff; font-size: 13px; color: var(--ink-500);
  font-family: var(--font-num); transition: .18s;
}
.pager button:hover:not(:disabled) { border-color: var(--brand-300); color: var(--brand-600); }
.pager button.is-active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; font-weight: 600; }
.pager button:disabled { opacity: .45; cursor: not-allowed; }

/* 抽屉 */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(6,46,92,.4); backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden; transition: .3s var(--ease); z-index: 950;
}
.drawer-mask.is-open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 520px; max-width: 92vw;
  background: #fff; z-index: 960; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .34s var(--ease);
  box-shadow: -20px 0 60px rgba(6,46,92,.18);
}
.drawer.is-open { transform: none; }
.drawer__head { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; gap: 14px; }
.drawer__head h3 { font-size: 17px; margin-bottom: 4px; }
.drawer__head p { font-size: 12.5px; color: var(--ink-400); }
.drawer__close { margin-left: auto; width: 32px; height: 32px; border-radius: var(--r-xs); display: grid; place-items: center; color: var(--ink-400); flex-shrink: 0; }
.drawer__close:hover { background: var(--bg); color: var(--ink-900); }
.drawer__body { flex: 1; overflow-y: auto; padding: 22px 24px; }
.drawer__foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; gap: 10px; }

.dl { display: grid; grid-template-columns: 82px 1fr; gap: 12px 16px; font-size: 13.5px; }
.dl dt { color: var(--ink-400); }
.dl dd { margin: 0; color: var(--ink-800); }

.block { margin-bottom: 24px; }
.block__title { font-size: 13px; font-weight: 700; color: var(--ink-900); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.block__title::before { content: ""; width: 3px; height: 13px; border-radius: 2px; background: var(--brand-600); }
.hl { background: linear-gradient(transparent 58%, #FFE3A8 58%); padding: 0 2px; border-radius: 2px; }
.hl--danger { background: linear-gradient(transparent 58%, #FFCFCF 58%); }
.hl--ok { background: linear-gradient(transparent 58%, #C8F0D8 58%); }

.note {
  padding: 12px 14px; border-radius: var(--r-sm); font-size: 13px; line-height: 1.7;
  background: var(--brand-50); border-left: 3px solid var(--brand-500); color: var(--ink-700);
}
.note--danger { background: var(--danger-bg); border-left-color: var(--danger); }
.note--warn { background: var(--warn-bg); border-left-color: var(--warn); }

/* 病历质控 */
.record { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; align-items: start; }
.record__text {
  font-family: var(--font-sans); font-size: 13.5px; line-height: 2.05; color: var(--ink-700);
  padding: 24px; white-space: pre-wrap; word-break: break-word;
}
.record__text h4 { font-size: 14px; margin: 0 0 10px; color: var(--ink-900); }
.record__text .meta { font-size: 12px; color: var(--ink-400); padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px dashed var(--line); }
.issue {
  display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: #fff; transition: .22s var(--ease);
}
.issue:hover { border-color: var(--brand-300); box-shadow: var(--sh-sm); }
.issue + .issue { margin-top: 10px; }
.issue__no {
  width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0; display: grid; place-items: center;
  font-family: var(--font-num); font-size: 11px; font-weight: 700;
}
.issue--danger .issue__no { background: var(--danger-bg); color: var(--danger); }
.issue--warn .issue__no { background: var(--warn-bg); color: var(--warn); }
.issue--ok .issue__no { background: var(--ok-bg); color: #0F7A38; }
.issue__body { min-width: 0; flex: 1; }
.issue__title { font-size: 13.5px; font-weight: 600; color: var(--ink-900); }
.issue__desc { font-size: 12.5px; color: var(--ink-500); margin-top: 4px; line-height: 1.65; }
.issue__rule { margin-top: 8px; font-size: 11.5px; font-family: var(--font-num); color: var(--brand-600); background: var(--brand-50); display: inline-block; padding: 2px 8px; border-radius: 4px; }
.issue__score { margin-left: auto; font-family: var(--font-num); font-size: 13px; font-weight: 700; flex-shrink: 0; }
.issue--danger .issue__score { color: var(--danger); }
.issue--warn .issue__score { color: var(--warn); }
.issue--ok .issue__score { color: #0F7A38; }

/* 规则库 */
.rules-layout { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
.tree__node {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: var(--r-xs);
  font-size: 13.5px; color: var(--ink-700); cursor: pointer; transition: .18s;
}
.tree__node:hover { background: var(--bg); }
.tree__node.is-active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.tree__node svg { width: 15px; height: 15px; opacity: .7; }
.tree__node span { margin-left: auto; font-family: var(--font-num); font-size: 11.5px; color: var(--ink-400); }
.tree__child { padding-left: 18px; }

/* 开关（span 默认是 inline，必须显式改为 inline-block，否则宽高与伪元素失效） */
.switch {
  display: inline-block; vertical-align: middle;
  width: 38px; height: 21px; border-radius: var(--r-full); background: #D3DFEC;
  position: relative; transition: background .22s; flex-shrink: 0; cursor: pointer;
  outline-offset: 2px;
}
.switch:focus-visible { outline: 2px solid var(--brand-500); }
.switch::after { content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .22s var(--ease); }
.switch.is-on { background: var(--brand-600); }
.switch.is-on::after { transform: translateX(17px); }

/* 整改看板 */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: start; }
.col__head { display: flex; align-items: center; gap: 8px; padding: 0 4px 12px; }
.col__head h4 { font-size: 13.5px; }
.col__dot { width: 8px; height: 8px; border-radius: 50%; }
.col__count { margin-left: auto; font-family: var(--font-num); font-size: 12px; font-weight: 700; color: var(--ink-400); background: var(--bg); padding: 1px 8px; border-radius: var(--r-full); }
.col__list { display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.task {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 14px; transition: .22s var(--ease);
}
.task:hover { transform: translateY(-2px); box-shadow: var(--sh-sm); border-color: var(--brand-100); }
.task__title { font-size: 13.5px; font-weight: 600; color: var(--ink-900); line-height: 1.5; }
.task__meta { margin-top: 10px; display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--ink-400); }
.task__meta .tag { font-size: 11px; padding: 2px 7px; }
.task__foot { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--ink-400); }
.task__foot i { width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; font-style: normal; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 700; background: linear-gradient(135deg, #2E7BF6, #00B9C7); }
.task__foot span:last-child { margin-left: auto; font-family: var(--font-num); }

/* 迷你工具条（演示用） */
.demo-bar {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 16px;
  border-radius: var(--r-sm); background: var(--brand-50); border: 1px dashed var(--brand-300);
  font-size: 13px; color: var(--brand-800);
}
.demo-bar svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--brand-600); }

/* 响应式 */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .row-2, .record { grid-template-columns: 1fr; }
  .rules-layout { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .side { position: fixed; left: 0; top: 0; bottom: 0; z-index: 980; transform: translateX(-100%); transition: transform .3s var(--ease); }
  .side.is-open { transform: none; box-shadow: 20px 0 60px rgba(6,46,92,.25); }
  .search { display: none; }
  .row-3 { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; gap: 10px; }
  .topbar__crumb b { font-size: 14px; }
  .view-head__actions { margin-left: 0; width: 100%; }
}
