:root {
  --sidebar-bg: #1f2a40;
  --sidebar-bg-soft: #26324c;
  --sidebar-text: #b9c3d6;
  --brand: #2f7ef0;
  --brand-dark: #2468cc;
  --page-bg: #eef1f6;
  --card: #ffffff;
  --border: #e6e9f0;
  --border-soft: #f0f2f7;
  --text: #1f2a40;
  --text-soft: #5b6577;
  --muted: #8a94a6;
  --green: #12a370;
  --orange: #e2930f;
  --red: #e0483c;
  --cyan: #0d9fbf;
  --purple: #7b5cf0;
  --gray: #6b7785;
  --dark: #212a35;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(31, 42, 64, 0.06), 0 2px 8px rgba(31, 42, 64, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--page-bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC",
    system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }

/* ---------------------------------------------------------- 登录页 */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(1200px 600px at 20% 10%, #2f4a7d 0%, #1f2a40 45%, #161f31 100%);
  padding: 24px;
}

.login-card {
  width: 420px;
  background: #fff;
  border-radius: 14px;
  padding: 32px 32px 24px;
  box-shadow: 0 24px 60px rgba(9, 15, 28, 0.45);
}

.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.login-logo {
  width: 46px; height: 46px; border-radius: 12px; background: var(--brand);
  color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 600;
}
.login-brand h1 { margin: 0; font-size: 19px; letter-spacing: 1px; }
.login-brand p { margin: 3px 0 0; font-size: 11px; color: var(--muted); letter-spacing: 1.2px; }

.login-form label { display: block; margin-bottom: 16px; }
.login-form label span { display: block; font-size: 12px; color: var(--text-soft); margin-bottom: 6px; }
.login-form input {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px; outline: none; background: #fbfcfe;
}
.login-form input:focus { border-color: var(--brand); background: #fff; }
.login-error { color: var(--red); font-size: 12px; min-height: 18px; margin-bottom: 6px; }

.login-demo { margin-top: 22px; border-top: 1px dashed var(--border); padding-top: 16px; }
.login-demo-title { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.login-demo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.login-demo-item {
  border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; cursor: pointer;
  background: #fbfcfe; transition: 0.15s; text-align: left;
}
.login-demo-item:hover { border-color: var(--brand); background: #f2f7ff; }
.login-demo-item b { display: block; font-size: 12px; font-weight: 600; }
.login-demo-item span { font-size: 11px; color: var(--muted); }

/* ---------------------------------------------------------- 框架 */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 182px;
  flex: 0 0 182px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand { padding: 16px 14px; display: flex; gap: 10px; align-items: center; }
.brand-logo {
  width: 30px; height: 30px; border-radius: 8px; background: var(--brand);
  color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 15px;
}
.brand-name { color: #fff; font-size: 14px; font-weight: 600; letter-spacing: 0.5px; }
.brand-sub { font-size: 9px; color: #7d89a1; letter-spacing: 0.8px; margin-top: 2px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 8px 14px; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #38455f; border-radius: 4px; }

.nav-group { margin: 12px 0 6px; padding: 0 8px; font-size: 10px; color: #6d7a93; letter-spacing: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; margin-bottom: 2px; border: 0; border-radius: 6px;
  background: transparent; color: var(--sidebar-text); font-size: 13px;
  cursor: pointer; text-align: left; transition: 0.15s;
}
.nav-item:hover { background: var(--sidebar-bg-soft); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; font-weight: 500; }
.nav-item .nav-icon { width: 16px; text-align: center; opacity: 0.9; font-size: 13px; }
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff; border-radius: 9px;
  padding: 0 6px; font-size: 10px; line-height: 16px; min-width: 16px; text-align: center;
}
.nav-item.active .nav-badge { background: rgba(255, 255, 255, 0.28); }

.nav-caret {
  margin-left: auto; font-size: 13px; opacity: 0.7; line-height: 1;
  transition: transform 0.15s; transform-origin: center;
}
.nav-caret.open { transform: rotate(90deg); }
.nav-item .nav-badge + .nav-caret { margin-left: 4px; }

.nav-sub { margin: 0 0 4px 8px; padding-left: 9px; border-left: 1px solid #36425c; }
.nav-subitem {
  display: flex; align-items: center; gap: 7px; width: 100%;
  padding: 6px 9px; margin-bottom: 1px; border: 0; border-radius: 5px;
  background: transparent; color: #97a3ba; font-size: 12px;
  cursor: pointer; text-align: left; transition: 0.15s;
}
.nav-subitem:hover { background: var(--sidebar-bg-soft); color: #fff; }
.nav-subitem.active { background: rgba(47, 126, 240, 0.18); color: #fff; font-weight: 500; }
.nav-subitem .dot { flex: 0 0 6px; }

.sidebar-logout {
  margin: 0 12px 16px; padding: 8px; border: 1px solid #36425c; border-radius: 6px;
  background: transparent; color: var(--sidebar-text); cursor: pointer; font-size: 12px;
}
.sidebar-logout:hover { background: var(--sidebar-bg-soft); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 50px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: baseline; gap: 10px; }
.topbar h2 { margin: 0; font-size: 15px; font-weight: 600; }
.topbar-sub { font-size: 11px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--border);
  background: #fff; color: var(--text-soft); cursor: pointer; font-size: 15px; line-height: 1;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }

.user-chip {
  display: flex; align-items: center; gap: 8px; background: var(--brand); color: #fff;
  border-radius: 18px; padding: 4px 12px 4px 5px;
}
.user-avatar {
  width: 24px; height: 24px; border-radius: 50%; background: rgba(255, 255, 255, 0.22);
  display: grid; place-items: center; font-size: 12px;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-size: 12px; }
.user-role { font-size: 10px; opacity: 0.82; }

.content { flex: 1; padding: 14px 16px 6px; }
.footer { text-align: center; color: var(--muted); font-size: 11px; padding: 12px 0 16px; }
#footer-version {
  display: inline-block; margin-left: 6px; color: var(--brand); cursor: pointer;
  border-bottom: 1px dashed transparent;
}
#footer-version:hover { border-bottom-color: var(--brand); }

.version-chip {
  border: 1px solid #c8daf7; background: #eef4ff; color: var(--brand);
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; font-weight: 700;
  height: 28px; padding: 0 10px; border-radius: 6px; cursor: pointer;
}
.version-chip:hover { background: #e0ecff; border-color: var(--brand); }

/* 更新版本记录 / 版本回溯 */
.changelog-toolbar { flex-wrap: wrap; gap: 8px; }
.changelog-select {
  height: 30px; border: 1px solid var(--border); border-radius: 6px; padding: 0 8px;
  background: #fff; color: var(--text); font-size: 12px; min-width: 150px;
}
.changelog-pills {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px;
}
.changelog-pill {
  border: 1px solid var(--border); background: #fff; color: var(--text-soft);
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px;
  height: 28px; padding: 0 10px; border-radius: 999px; cursor: pointer;
}
.changelog-pill:hover { border-color: var(--brand); color: var(--brand); }
.changelog-pill.active { border-color: var(--brand); background: #eef4ff; color: var(--brand); font-weight: 700; }
.changelog-pill.current { box-shadow: inset 0 0 0 1px rgba(18, 163, 112, 0.35); }

.changelog-focus-card { margin-bottom: 0; }
.changelog-focus-meta {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 10px;
}
@media (max-width: 900px) { .changelog-focus-meta { grid-template-columns: 1fr; } }
.changelog-focus-title { font-size: 14px; font-weight: 600; margin: 4px 0 2px; }
.changelog-path { margin-top: 10px; font-size: 11px; line-height: 1.7; }

.changelog-list { display: flex; flex-direction: column; gap: 0; }
.changelog-item {
  display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px;
  position: relative; padding-bottom: 22px; cursor: pointer;
}
.changelog-item:last-child { padding-bottom: 0; }
.changelog-rail { position: relative; }
.changelog-rail::before {
  content: ''; position: absolute; left: 7px; top: 18px; bottom: -22px; width: 1px; background: var(--border);
}
.changelog-item:last-child .changelog-rail::before { display: none; }
.changelog-dot {
  display: block; width: 15px; height: 15px; margin-top: 3px; border-radius: 50%;
  background: #fff; border: 2px solid var(--brand); box-sizing: border-box;
}
.changelog-item.current .changelog-dot {
  border-color: var(--green); background: var(--green);
  box-shadow: 0 0 0 3px rgba(18, 163, 112, 0.16);
}
.changelog-item.focus .changelog-dot {
  border-color: var(--brand); background: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 126, 240, 0.18);
}
.changelog-body {
  background: #fbfcfe; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; transition: border-color .15s ease, box-shadow .15s ease;
}
.changelog-item:hover .changelog-body { border-color: #c8daf7; }
.changelog-item.current .changelog-body {
  border-color: #b7e5cf; background: #f3fbf7;
}
.changelog-item.focus .changelog-body {
  border-color: var(--brand); box-shadow: 0 0 0 2px rgba(47, 126, 240, 0.12);
  background: #f7faff;
}
.changelog-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.changelog-version {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; font-weight: 700;
  color: var(--text);
}
.changelog-time { font-size: 11px; color: var(--muted); }
.changelog-title { margin: 8px 0 0; font-size: 13px; font-weight: 600; }
.changelog-highlights {
  margin: 8px 0 0; padding-left: 18px; color: var(--text-soft);
  font-size: 12px; line-height: 1.7;
}
.changelog-highlights li { margin-bottom: 2px; }

/* ---------------------------------------------------------- 通用卡片 */

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px;
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-bottom: 1px solid var(--border-soft);
}
.card-head h3 { margin: 0; font-size: 13px; font-weight: 600; }
.card-head .spacer { flex: 1; }
.card-body { padding: 12px 14px; }
.card-body.tight { padding: 0; }

.section-title {
  font-size: 13px; font-weight: 600; margin: 4px 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::before {
  content: ''; width: 3px; height: 13px; background: var(--brand); border-radius: 2px;
}

.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.toolbar .spacer { flex: 1; }
.toolbar-label { font-size: 12px; color: var(--text-soft); }

/* ---------------------------------------------------------- 表单控件 */

input, select, textarea {
  font-family: inherit; font-size: 12px; color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
  padding: 0 9px; height: 30px; outline: none;
}
textarea { height: auto; padding: 7px 9px; line-height: 1.6; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
input[type="date"] { padding-right: 4px; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12px; color: var(--text-soft); margin-bottom: 5px; }
label.field input, label.field select, label.field textarea { width: 100%; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }

.btn {
  height: 30px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--border);
  background: #fff; color: var(--text); font-size: 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px; transition: 0.15s;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #c93c31; border-color: #c93c31; color: #fff; }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #0e8c60; border-color: #0e8c60; color: #fff; }
.btn-sm { height: 24px; padding: 0 9px; font-size: 11px; }
.btn-block { width: 100%; height: 38px; justify-content: center; font-size: 14px; }
.btn-link { border: 0; background: transparent; color: var(--brand); padding: 0 4px; height: auto; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tab {
  border: 0; background: transparent; padding: 8px 14px; font-size: 13px;
  color: var(--text-soft); cursor: pointer; border-bottom: 2px solid transparent;
}
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 500; }
.tab .count { color: var(--muted); font-size: 11px; margin-left: 4px; }

.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--border); background: #fff; border-radius: 14px;
  padding: 3px 11px; font-size: 11px; color: var(--text-soft); cursor: pointer;
}
.chip.active { border-color: var(--brand); background: #eef4ff; color: var(--brand); }

/* ---------------------------------------------------------- KPI 卡片 */

.kpi-grid {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px; margin-bottom: 14px;
}
@media (max-width: 1500px) { .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.kpi {
  border-radius: var(--radius); padding: 12px 14px; color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 78px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi-dark { background: linear-gradient(135deg, #2b3442, #171d27); }
.kpi-green { background: linear-gradient(135deg, #17b47c, #0d8f61); }
.kpi-orange { background: linear-gradient(135deg, #eda31d, #cf7f07); }
.kpi-red { background: linear-gradient(135deg, #ec5b4f, #c93a2f); }
.kpi-gray { background: linear-gradient(135deg, #7b8798, #5c6675); }
.kpi-cyan { background: linear-gradient(135deg, #17b0d2, #0a8aa6); }
.kpi-purple { background: linear-gradient(135deg, #8a6bf5, #6a45de); }

.kpi-label { font-size: 11px; opacity: 0.86; }
.kpi-value { font-size: 22px; font-weight: 700; margin-top: 4px; letter-spacing: 0.5px; }
.kpi-value small { font-size: 12px; font-weight: 500; margin-left: 2px; opacity: 0.9; }
.kpi-delta { font-size: 10px; opacity: 0.85; margin-top: 3px; }
.kpi-chart { width: 88px; height: 42px; flex: 0 0 88px; opacity: 0.95; }

/* ---------------------------------------------------------- 表格 */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12px; }
table.data th {
  text-align: left; font-weight: 600; color: var(--text-soft); background: #f7f9fc;
  padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.data tbody tr:hover { background: #f8fbff; }
table.data tr.clickable { cursor: pointer; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--muted); padding: 34px 0; font-size: 12px; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 10px 12px; }
.pager span { font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------- 徽标 */

.badge {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 4px;
  padding: 2px 7px; font-size: 11px; line-height: 17px; white-space: nowrap;
}
.badge-info { background: #e8f1ff; color: #1f6fd8; }
.badge-success { background: #e4f7ef; color: #0e8c60; }
.badge-warn { background: #fdf3e0; color: #b97b06; }
.badge-danger { background: #fdeceb; color: #c93c31; }
.badge-muted { background: #f0f2f6; color: #6b7785; }
.badge-done { background: #eef0f4; color: #55617a; }
.badge-p0 { background: #fdeceb; color: #c93c31; font-weight: 600; }
.badge-p1 { background: #fdf3e0; color: #b97b06; font-weight: 600; }
.badge-p2 { background: #e8f1ff; color: #1f6fd8; }
.badge-p3 { background: #f0f2f6; color: #6b7785; }

.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.tag-square {
  width: 24px; height: 24px; border-radius: 5px; color: #fff; display: grid;
  place-items: center; font-size: 11px; flex: 0 0 24px;
}
.avatar {
  width: 24px; height: 24px; border-radius: 50%; color: #fff; display: grid;
  place-items: center; font-size: 11px; flex: 0 0 24px;
}
.avatar-lg { width: 40px; height: 40px; border-radius: 10px; font-size: 16px; flex-basis: 40px; }
.inline { display: flex; align-items: center; gap: 7px; }
.muted { color: var(--muted); }
.soft { color: var(--text-soft); }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, Menlo, Consolas, monospace; }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }

/* ---------------------------------------------------------- 看板：部门详情 */

.dash-split { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 12px; align-items: start; }
@media (max-width: 1100px) { .dash-split { grid-template-columns: 1fr; } }

.dept-focus-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
}
.dept-focus-head .name { font-size: 14px; font-weight: 600; }
.dept-focus-head .sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.metric-list { padding: 4px 0 8px; }
.metric-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 14px; font-size: 12px;
}
.metric-row:nth-child(odd) { background: #fafbfd; }
.metric-row .k { color: var(--text-soft); }
.metric-row .v { font-weight: 600; font-variant-numeric: tabular-nums; }

.dept-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft); cursor: pointer; transition: 0.12s;
}
.dept-row:hover { background: #f8fbff; }
.dept-row.selected { background: #f2f7ff; box-shadow: inset 3px 0 0 var(--brand); }
.dept-row .dept-main { min-width: 148px; }
.dept-row .dept-name { font-size: 13px; font-weight: 600; }
.dept-row .dept-duty { font-size: 11px; color: var(--muted); margin-top: 2px; }
.dept-row .dept-stats { display: flex; gap: 16px; flex: 1; flex-wrap: wrap; }
.dept-stat { min-width: 62px; }
.dept-stat .k { font-size: 10px; color: var(--muted); }
.dept-stat .v { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dept-row .dept-actions { display: flex; gap: 6px; }

/* ---------------------------------------------------------- 图表 */

.chart-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
@media (max-width: 1200px) { .chart-grid { grid-template-columns: 1fr; } }
.bar-list { display: flex; flex-direction: column; gap: 9px; }
.bar-item { font-size: 12px; }
.bar-head { display: flex; justify-content: space-between; margin-bottom: 4px; }
.bar-track { height: 6px; border-radius: 3px; background: #eef1f6; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; background: var(--brand); }

/* ---------------------------------------------------------- 工作台 */

.wb-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; align-items: start; }
@media (max-width: 1200px) { .wb-grid { grid-template-columns: 1fr; } }
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.stat-box {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; box-shadow: var(--shadow);
}
.stat-box .k { font-size: 11px; color: var(--muted); }
.stat-box .v { font-size: 20px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }
/* 协同动态过长时内部滚动，避免把整行栅格撑高 */
.wb-feed { max-height: 430px; overflow-y: auto; }
.wb-feed::-webkit-scrollbar { width: 5px; }
.wb-feed::-webkit-scrollbar-thumb { background: #dfe4ec; border-radius: 4px; }

/* 自动采购规则面板 */
.rule-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 4px 14px; margin-bottom: 4px;
}
.rule-field { margin-bottom: 10px; }
.rule-field > span { font-weight: 500; }
.rule-field .field-hint { min-height: 15px; }
.rule-field .mono-hint {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 10px; color: #9aa4b5;
}
.code-block {
  margin: 10px 0 0; padding: 12px 14px; background: #1f2a40; color: #d8e0ee;
  border-radius: var(--radius); font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11px; line-height: 1.7; overflow-x: auto; max-height: 380px;
}
.purchase-split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1300px) { .purchase-split { grid-template-columns: 1fr; } }

.timeline { position: relative; padding-left: 16px; }
.timeline::before {
  content: ''; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 1px; background: var(--border);
}
.timeline-item { position: relative; padding: 0 0 14px 4px; }
.timeline-item::before {
  content: ''; position: absolute; left: -16px; top: 4px; width: 9px; height: 9px;
  border-radius: 50%; background: #fff; border: 2px solid var(--brand);
}
.timeline-item.done::before { border-color: var(--green); background: var(--green); }
.timeline-item.reject::before { border-color: var(--red); background: var(--red); }
.timeline-item.wait::before { border-color: var(--border); }
.timeline-title { font-size: 12px; font-weight: 600; }
.timeline-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.timeline-text { font-size: 12px; color: var(--text-soft); margin-top: 4px; line-height: 1.6; }

/* ---------------------------------------------------------- 抽屉与弹窗 */

.drawer-mask, .modal-mask {
  position: fixed; inset: 0; background: rgba(17, 24, 39, 0.42); z-index: 60;
  animation: fade 0.15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide { from { transform: translateX(24px); opacity: 0.4; } to { transform: none; opacity: 1; } }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 620px; max-width: 96vw;
  background: var(--page-bg); z-index: 61; display: flex; flex-direction: column;
  animation: slide 0.18s ease; box-shadow: -8px 0 32px rgba(15, 23, 42, 0.16);
}
.drawer-head {
  background: #fff; border-bottom: 1px solid var(--border); padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
}
.drawer-head h3 { margin: 0; font-size: 14px; }
.drawer-head .spacer { flex: 1; }
.drawer-body { flex: 1; overflow-y: auto; padding: 12px 14px 20px; }
.drawer-foot {
  background: #fff; border-top: 1px solid var(--border); padding: 10px 14px;
  display: flex; justify-content: flex-end; gap: 8px;
}
.close-x {
  border: 0; background: transparent; font-size: 18px; color: var(--muted);
  cursor: pointer; line-height: 1; padding: 2px 6px;
}
.close-x:hover { color: var(--text); }

.modal {
  position: fixed; z-index: 61; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 520px; max-width: 94vw; max-height: 88vh; background: #fff;
  border-radius: 10px; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28);
}
.modal-head { padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-head h3 { margin: 0; font-size: 14px; flex: 1; }
.modal-body { padding: 16px; overflow-y: auto; }
.modal-foot { padding: 11px 16px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.detail-item .k { font-size: 11px; color: var(--muted); }
.detail-item .v { font-size: 12px; margin-top: 3px; word-break: break-all; }
.detail-block { font-size: 12px; line-height: 1.7; color: var(--text-soft); white-space: pre-wrap; }

/* ---------------------------------------------------------- 责权矩阵 */

.matrix-wrap { overflow: auto; max-height: calc(100vh - 240px); }
table.matrix { border-collapse: separate; border-spacing: 0; font-size: 12px; width: 100%; }
table.matrix th, table.matrix td { border-bottom: 1px solid var(--border-soft); padding: 7px 10px; }
table.matrix thead th {
  position: sticky; top: 0; background: #f7f9fc; z-index: 2; text-align: center;
  border-bottom: 1px solid var(--border); font-weight: 600; min-width: 84px;
}
table.matrix thead th:first-child { text-align: left; left: 0; z-index: 3; min-width: 220px; }
table.matrix tbody th {
  position: sticky; left: 0; background: #fff; text-align: left; font-weight: 400; z-index: 1;
}
table.matrix tbody tr:hover th, table.matrix tbody tr:hover td { background: #f8fbff; }
table.matrix td { text-align: center; }
.matrix-module th { background: #f2f5fa !important; font-weight: 600 !important; color: var(--text); }
.perm-name { font-size: 12px; }
.perm-code { font-size: 10px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }
input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--brand); cursor: pointer; }

.role-card {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 11px 12px;
  background: #fff; cursor: pointer;
}
.role-card.active { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(47, 126, 240, 0.12); }
.role-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1200px) { .role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------------------------------------------------------- Toast */

.toast-root {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  background: #1f2a40; color: #fff; padding: 8px 16px; border-radius: 6px;
  font-size: 12px; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.24); animation: fade 0.15s ease;
}
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }

.loading { text-align: center; color: var(--muted); padding: 40px 0; font-size: 12px; }

.stale-banner {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 95;
  display: flex; align-items: center; gap: 12px; background: #1f2a40; color: #fff;
  padding: 10px 16px; border-radius: 8px; font-size: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.3);
}
.stale-banner .btn { background: #fff; border-color: #fff; }
