/* ==========================================================================
   项目管理软件 —— 样式表
   纯手写，无外部依赖，可离线使用
   ========================================================================== */

:root {
  --c-primary: #4f46e5;
  --c-primary-dark: #4338ca;
  --c-primary-light: #eef2ff;
  --c-primary-soft: #e0e7ff;

  --c-success: #059669;
  --c-success-light: #ecfdf5;
  --c-warning: #d97706;
  --c-warning-light: #fffbeb;
  --c-danger: #dc2626;
  --c-danger-light: #fef2f2;
  --c-info: #0284c7;
  --c-info-light: #f0f9ff;

  --c-text: #1e293b;
  --c-text-soft: #64748b;
  --c-text-mute: #94a3b8;
  --c-border: #e2e8f0;
  --c-border-soft: #f1f5f9;
  --c-bg: #f5f7fb;
  --c-surface: #ffffff;
  --c-sidebar: #1e293b;
  --c-sidebar-hover: #334155;
  --c-sidebar-active: #4f46e5;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 2px 8px rgba(15, 23, 42, .08);
  --shadow-lg: 0 16px 48px rgba(15, 23, 42, .18);
  --sidebar-w: 232px;
  --header-h: 60px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB",
               "Source Han Sans SC", "Noto Sans CJK SC", -apple-system,
               BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: content-box; }

/* ---------------------------------------------------------------- 启动画面 */
.boot-screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px; color: var(--c-text-soft);
}
.boot-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--c-primary-soft);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================================ 登录页 */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 45%, #818cf8 100%);
}
.login-card {
  width: 100%; max-width: 400px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 38px 34px 30px;
}
.login-brand {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 6px;
}
.login-logo {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--c-primary), #818cf8);
  color: #fff; font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.login-card h1 { font-size: 20px; }
.login-sub { color: var(--c-text-soft); font-size: 13px; margin: 0 0 24px; }
.login-hint {
  margin-top: 20px; padding: 12px 14px;
  background: var(--c-primary-light);
  border-radius: var(--radius-sm);
  font-size: 12.5px; color: #3730a3; line-height: 1.8;
}
.login-hint code {
  background: #fff; padding: 1px 6px; border-radius: 4px;
  font-family: Consolas, Monaco, monospace; color: var(--c-primary-dark);
}

/* ================================================================ 布局 */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--c-sidebar);
  color: #cbd5e1;
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0;
  z-index: 40;
}
.sidebar-brand {
  height: var(--header-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex: 0 0 auto;
}
.sidebar-brand .logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--c-primary), #818cf8);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: #fff; flex: 0 0 auto;
}
.sidebar-brand .name { font-size: 15px; font-weight: 600; color: #fff; letter-spacing: .3px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-group-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: #64748b; padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: #cbd5e1; cursor: pointer;
  font-size: 13.5px; text-decoration: none;
  transition: background .12s, color .12s;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--c-sidebar-hover); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--c-sidebar-active); color: #fff; font-weight: 500; }
.nav-item .ico { width: 18px; text-align: center; flex: 0 0 auto; font-size: 15px; }

.sidebar-foot {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 11.5px; color: #64748b; line-height: 1.7;
}

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--header-h);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center;
  gap: 16px; padding: 0 22px;
  position: sticky; top: 0; z-index: 30;
}
.topbar h2 { font-size: 16.5px; font-weight: 600; }
.topbar .crumb { color: var(--c-text-mute); font-size: 13px; }
.topbar-spacer { flex: 1; }

.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 10px 5px 5px;
  border-radius: 999px; cursor: pointer;
  border: 1px solid var(--c-border);
  background: #fff; position: relative;
}
.user-chip:hover { background: var(--c-border-soft); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--c-primary), #818cf8);
  color: #fff; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.user-chip .u-name { font-size: 13px; font-weight: 500; line-height: 1.2; }
.user-chip .u-role { font-size: 11px; color: var(--c-text-mute); line-height: 1.2; }

.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: #fff; border: 1px solid var(--c-border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  min-width: 200px; padding: 6px; z-index: 50;
}
.dropdown button {
  display: block; width: 100%; text-align: left;
  padding: 9px 12px; border: none; background: none;
  border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13.5px; color: var(--c-text); font-family: inherit;
}
.dropdown button:hover { background: var(--c-border-soft); }
.dropdown button.danger { color: var(--c-danger); }
.dropdown .dd-head { padding: 10px 12px; border-bottom: 1px solid var(--c-border-soft); margin-bottom: 4px; }
.dropdown .dd-head .n { font-weight: 600; font-size: 13.5px; }
.dropdown .dd-head .r { font-size: 12px; color: var(--c-text-soft); }

.content { padding: 22px; flex: 1; min-width: 0; }

/* ================================================================ 卡片 */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--c-border-soft);
}
.card-head h3 { font-size: 14.5px; }
.card-head .sub { font-size: 12.5px; color: var(--c-text-mute); }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card-foot {
  padding: 12px 18px; border-top: 1px solid var(--c-border-soft);
  background: #fcfdff;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

/* ================================================================ 统计卡 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.stat::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--c-primary);
}
.stat.s-success::before { background: var(--c-success); }
.stat.s-warning::before { background: var(--c-warning); }
.stat.s-danger::before { background: var(--c-danger); }
.stat.s-info::before { background: var(--c-info); }
.stat .label { font-size: 12.5px; color: var(--c-text-soft); margin-bottom: 6px; }
.stat .value {
  font-size: 22px; font-weight: 600; letter-spacing: -.4px;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}
.stat .value.small { font-size: 17px; }
.stat .hint { font-size: 11.5px; color: var(--c-text-mute); margin-top: 4px; }

/* ================================================================ 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px;
  border: 1px solid var(--c-border);
  background: #fff; color: var(--c-text);
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: inherit; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
  line-height: 1.4;
}
.btn:hover:not(:disabled) { background: var(--c-border-soft); border-color: #cbd5e1; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 1px; }
.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--c-primary-dark); border-color: var(--c-primary-dark); }
.btn-danger { background: var(--c-danger); border-color: var(--c-danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; border-color: #b91c1c; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--c-text-soft); }
.btn-ghost:hover:not(:disabled) { background: var(--c-border-soft); color: var(--c-text); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 5px; }
.btn-block { width: 100%; }
.btn-lg { padding: 11px 20px; font-size: 14.5px; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row.end { justify-content: flex-end; }

/* ================================================================ 表单 */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px 18px;
}
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field.span-2 { grid-column: 1 / -1; }
.field.span-3 { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label {
  font-size: 13px; font-weight: 500; color: #475569;
}
.field > label .req { color: var(--c-danger); margin-left: 3px; }
.field .tip { font-size: 11.5px; color: var(--c-text-mute); }
.field .err { font-size: 12px; color: var(--c-danger); min-height: 0; }

input[type=text], input[type=password], input[type=number], input[type=date],
input[type=month], input[type=email], input[type=tel], input[type=search],
select, textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--c-text);
  background: #fff;
  transition: border-color .12s, box-shadow .12s;
  min-width: 0;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
input:disabled, select:disabled, textarea:disabled {
  background: #f8fafc; color: var(--c-text-mute); cursor: not-allowed;
}
textarea { resize: vertical; min-height: 68px; line-height: 1.6; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%2364748b' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }

.checkbox-line { display: flex; align-items: center; gap: 8px; padding-top: 4px; }
.checkbox-line input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--c-primary); cursor: pointer; margin: 0; }
.checkbox-line label { font-size: 13.5px; cursor: pointer; user-select: none; }

/* 筛选栏 */
.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
}
.filters .field { flex: 0 1 auto; min-width: 140px; }
.filters .field.wide { min-width: 220px; flex: 1 1 220px; }
.filters .btn-row { padding-bottom: 1px; }

/* ================================================================ 表格 */
.table-wrap { overflow-x: auto; }
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.tbl th {
  text-align: left;
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--c-border);
  font-weight: 600; font-size: 12.5px; color: #475569;
  white-space: nowrap;
  position: sticky; top: 0;
}
table.tbl td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-border-soft);
  vertical-align: middle;
}
table.tbl tbody tr:hover { background: #fafbff; }
table.tbl tbody tr.clickable { cursor: pointer; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.tbl td.center, table.tbl th.center { text-align: center; }
table.tbl td.actions { white-space: nowrap; text-align: right; }
table.tbl tfoot td {
  padding: 10px 14px; font-weight: 600;
  background: #f8fafc; border-top: 2px solid var(--c-border);
}
table.tbl .name-cell { font-weight: 500; }
table.tbl .sub-line { font-size: 11.5px; color: var(--c-text-mute); font-weight: 400; }
.money { font-variant-numeric: tabular-nums; }
.money.neg { color: var(--c-danger); }
.money.pos { color: var(--c-success); }

.empty {
  padding: 52px 20px;
  text-align: center;
  color: var(--c-text-mute);
}
.empty .ico { font-size: 40px; opacity: .35; margin-bottom: 10px; }
.empty p { margin: 6px 0; font-size: 13.5px; }

/* ================================================================ 徽标 */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 500;
  background: var(--c-border-soft); color: #475569;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge.b-success { background: var(--c-success-light); color: #047857; border-color: #a7f3d0; }
.badge.b-warning { background: var(--c-warning-light); color: #b45309; border-color: #fde68a; }
.badge.b-danger  { background: var(--c-danger-light); color: #b91c1c; border-color: #fecaca; }
.badge.b-info    { background: var(--c-info-light); color: #0369a1; border-color: #bae6fd; }
.badge.b-primary { background: var(--c-primary-light); color: #4338ca; border-color: var(--c-primary-soft); }

/* ================================================================ 进度条 */
.progress {
  height: 6px; background: var(--c-border-soft);
  border-radius: 3px; overflow: hidden; min-width: 56px;
}
.progress > i { display: block; height: 100%; background: var(--c-primary); border-radius: 3px; transition: width .3s; }
.progress.p-success > i { background: var(--c-success); }
.progress.p-warning > i { background: var(--c-warning); }
.progress.p-danger > i { background: var(--c-danger); }

/* ================================================================ 标签页 */
.tabs {
  display: flex; gap: 2px; border-bottom: 1px solid var(--c-border);
  margin-bottom: 18px; overflow-x: auto;
}
.tab {
  padding: 9px 16px; border: none; background: none;
  font-size: 13.5px; font-family: inherit; color: var(--c-text-soft);
  cursor: pointer; border-bottom: 2px solid transparent;
  white-space: nowrap; margin-bottom: -1px;
}
.tab:hover { color: var(--c-text); }
.tab.active { color: var(--c-primary); border-bottom-color: var(--c-primary); font-weight: 500; }
.tab .cnt { font-size: 11.5px; color: var(--c-text-mute); margin-left: 4px; }
/* 标签页上的待办数字，例如「采购付款 ③」——财务一眼看到有没有活 */
.tab .dot {
  display: inline-block;
  min-width: 16px;
  padding: 0 4px;
  margin-left: 6px;
  border-radius: 8px;
  background: var(--c-danger);
  color: #fff;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  vertical-align: 1px;
}

/* ================================================================ 弹窗 */
.modal-host { position: relative; z-index: 200; }
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .48);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 20px 20px;
  overflow-y: auto;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 620px;
  animation: slideUp .18s ease;
  margin: auto 0;
}
@keyframes slideUp { from { transform: translateY(14px); opacity: 0; } }
.modal.wide { max-width: 900px; }
.modal.narrow { max-width: 420px; }
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 17px 22px; border-bottom: 1px solid var(--c-border-soft);
}
.modal-head h3 { font-size: 15.5px; flex: 1; }
.modal-close {
  border: none; background: none; font-size: 21px; line-height: 1;
  color: var(--c-text-mute); cursor: pointer; padding: 0 4px;
  font-family: inherit;
}
.modal-close:hover { color: var(--c-text); }
.modal-body { padding: 20px 22px; max-height: 66vh; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 9px;
  padding: 14px 22px; border-top: 1px solid var(--c-border-soft);
  background: #fcfdff; border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  flex-wrap: wrap;
}

/* ================================================================ 提示 */
.toast-host {
  position: fixed; top: 18px; right: 18px; z-index: 300;
  display: flex; flex-direction: column; gap: 9px;
  pointer-events: none; max-width: 380px;
}
.toast {
  background: #fff; border: 1px solid var(--c-border);
  border-left: 4px solid var(--c-primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 12px 16px; font-size: 13.5px;
  animation: toastIn .2s ease;
  pointer-events: auto;
  word-break: break-word;
}
.toast.t-success { border-left-color: var(--c-success); }
.toast.t-error   { border-left-color: var(--c-danger); }
.toast.t-warning { border-left-color: var(--c-warning); }
.toast .t-title { font-weight: 600; margin-bottom: 2px; }
@keyframes toastIn { from { transform: translateX(28px); opacity: 0; } }

/* ================================================================ 附件 */
.file-list { display: flex; flex-direction: column; gap: 7px; }
.file-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 13px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: #fff;
}
.file-item:hover { border-color: #cbd5e1; background: #fcfdff; }
.file-icon {
  width: 32px; height: 32px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff; flex: 0 0 auto;
  text-transform: uppercase;
}
.file-meta { flex: 1; min-width: 0; }
.file-meta .n {
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-meta .d { font-size: 11.5px; color: var(--c-text-mute); }

/* 拖放上传区 */
.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius);
  padding: 24px; text-align: center;
  color: var(--c-text-soft); cursor: pointer;
  transition: border-color .15s, background .15s;
  background: #fcfdff;
}
.dropzone:hover, .dropzone.over { border-color: var(--c-primary); background: var(--c-primary-light); color: var(--c-primary-dark); }
.dropzone .ico { font-size: 26px; margin-bottom: 6px; opacity: .6; }
.dropzone .hint { font-size: 11.5px; color: var(--c-text-mute); margin-top: 4px; }

/* ================================================================ 图表 */
.chart-bars { display: flex; flex-direction: column; gap: 12px; }
.chart-bar-row { display: grid; grid-template-columns: 96px 1fr 118px; gap: 12px; align-items: center; font-size: 12.5px; }
.chart-bar-row .lbl { color: var(--c-text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-bar-row .track { background: var(--c-border-soft); border-radius: 4px; height: 20px; overflow: hidden; }
.chart-bar-row .track > i { display: block; height: 100%; border-radius: 4px; transition: width .4s; min-width: 2px; }
.chart-bar-row .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }

.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.donut-legend { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; flex: 1; min-width: 170px; }
.donut-legend .row { display: flex; align-items: center; gap: 9px; }
.donut-legend .dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.donut-legend .nm { flex: 1; color: var(--c-text-soft); }
.donut-legend .vl { font-variant-numeric: tabular-nums; font-weight: 500; }

/* 迷你趋势柱 */
.trend { display: flex; align-items: flex-end; gap: 4px; height: 132px; padding-top: 10px; }
.trend .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; min-width: 0; }
.trend .bars { display: flex; gap: 2px; align-items: flex-end; width: 100%; justify-content: center; flex: 1; }
.trend .bar { width: 9px; border-radius: 2px 2px 0 0; min-height: 2px; transition: height .4s; }
.trend .bar.b1 { background: var(--c-primary); }
.trend .bar.b2 { background: #f59e0b; }
.trend .bar.b3 { background: var(--c-success); }
.trend .m { font-size: 10.5px; color: var(--c-text-mute); white-space: nowrap; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--c-text-soft); }
.legend .k { display: flex; align-items: center; gap: 6px; }
.legend .k i { width: 10px; height: 10px; border-radius: 3px; display: block; }

/* ================================================================ 其它 */
.page-head {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.page-head h2 { font-size: 18px; }
.page-head .sub { color: var(--c-text-mute); font-size: 13px; }
.page-head .spacer { flex: 1; }

.kv-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px 24px; }
.kv .k { font-size: 12px; color: var(--c-text-mute); margin-bottom: 2px; }
.kv .v { font-size: 13.5px; word-break: break-word; }
.kv .v.strong { font-weight: 600; }

.def-list { display: flex; flex-direction: column; }
.def-row {
  display: grid; grid-template-columns: 130px 1fr;
  gap: 14px; padding: 9px 0;
  border-bottom: 1px solid var(--c-border-soft);
  font-size: 13.5px;
}
.def-row:last-child { border-bottom: none; }
.def-row .k { color: var(--c-text-soft); font-size: 13px; }

.divider { height: 1px; background: var(--c-border-soft); margin: 16px 0; }

.muted { color: var(--c-text-mute); }
.soft { color: var(--c-text-soft); }
.small { font-size: 12.5px; }
.xsmall { font-size: 11.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-18 { margin-bottom: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.grid-2 > .card { margin-bottom: 0; }
.flex { display: flex; } .flex-1 { flex: 1; }
.items-center { align-items: center; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.wrap { flex-wrap: wrap; }
.hidden { display: none !important; }

.loading-box { padding: 44px; text-align: center; color: var(--c-text-mute); }
.spinner {
  width: 26px; height: 26px; margin: 0 auto 10px;
  border: 2.5px solid var(--c-primary-soft);
  border-top-color: var(--c-primary);
  border-radius: 50%; animation: spin .8s linear infinite;
}

.pager {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px; border-top: 1px solid var(--c-border-soft);
  flex-wrap: wrap;
}
.pager .info { font-size: 12.5px; color: var(--c-text-soft); flex: 1; }
.pager .pages { display: flex; gap: 4px; align-items: center; }
.pager .pg {
  min-width: 30px; height: 30px; padding: 0 7px;
  border: 1px solid var(--c-border); background: #fff;
  border-radius: 5px; cursor: pointer; font-size: 12.5px;
  font-family: inherit; color: var(--c-text);
}
.pager .pg:hover:not(:disabled) { background: var(--c-border-soft); }
.pager .pg.active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; font-weight: 500; }
.pager .pg:disabled { opacity: .4; cursor: not-allowed; }

.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert.a-info { background: var(--c-info-light); border-color: #bae6fd; color: #075985; }
.alert.a-warning { background: var(--c-warning-light); border-color: #fde68a; color: #92400e; }
.alert.a-danger { background: var(--c-danger-light); border-color: #fecaca; color: #991b1b; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }

/* 权限矩阵 */
.perm-matrix { border: 1px solid var(--c-border); border-radius: var(--radius-sm); overflow: hidden; }
.perm-group-head {
  background: #f8fafc; padding: 9px 14px;
  font-size: 12.5px; font-weight: 600; color: #475569;
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: 10px;
}
.perm-row {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 9px 14px; border-bottom: 1px solid var(--c-border-soft);
  font-size: 13px;
}
.perm-row:last-child { border-bottom: none; }
.perm-row:hover { background: #fafbff; }
.perm-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--c-primary); margin: 2px 0 0; cursor: pointer; flex: 0 0 auto; }
.perm-row .p-name { font-weight: 500; }
.perm-row .p-code { font-family: Consolas, Monaco, monospace; font-size: 11px; color: var(--c-text-mute); }
.perm-row .p-desc { font-size: 12px; color: var(--c-text-soft); }

/* 响应式 */
@media (max-width: 980px) {
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .form-grid .field.span-2, .form-grid .field.span-3 { grid-column: auto; }
}
@media (max-width: 760px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .22s ease;
    width: 232px;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; }
  .content { padding: 14px; }
  .topbar { padding: 0 14px; }
  .menu-toggle { display: inline-flex !important; }
  .user-chip .u-meta { display: none; }
}
.menu-toggle {
  display: none; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: 1px solid var(--c-border);
  background: #fff; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 16px; padding: 0;
}

@media print {
  .sidebar, .topbar, .btn, .pager, .filters { display: none !important; }
  .main { margin-left: 0; }
  .card { break-inside: avoid; box-shadow: none; }
}
