/* ============================================================
   PMS 设计系统（自包含，不依赖任何外部 CDN）
   设计基准：参考 React 版的 Tailwind 主题（brand / slate / 状态色）
   ============================================================ */
:root {
  --brand-50: #eef4ff;
  --brand-100: #d9e6ff;
  --brand-200: #bcd3ff;
  --brand-300: #8eb6ff;
  --brand-400: #598cff;
  --brand-500: #3366ff;
  --brand-600: #1f47e6;
  --brand-700: #1836b4;
  --brand-800: #1a3091;
  --brand-900: #1b2e73;

  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  --rose-500: #f43f5e;
  --rose-600: #e11d48;
  --emerald-600: #059669;
  --sky-500: #0ea5e9;
  --amber-600: #d97706;

  --bg: #f5f7fb;
  --card-shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --pop-shadow: 0 12px 32px rgba(16, 24, 40, 0.12);
  --radius-xl: 12px;
  --radius-2xl: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background-color: var(--bg);
  color: var(--slate-800);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, 0.3); border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.5); }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; background: #fff;
  border-right: 1px solid var(--slate-100);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px; }
.sidebar-brand .logo {
  width: 36px; height: 36px; border-radius: var(--radius-xl);
  background: var(--brand-600); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.sidebar-brand .t1 { font-size: 14px; font-weight: 600; color: var(--slate-800); line-height: 1.2; }
.sidebar-brand .t2 { font-size: 11px; color: var(--slate-400); }
.nav { flex: 1; padding: 8px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius-xl);
  color: var(--slate-500); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background-color .15s, color .15s;
}
.nav-link:hover { background: var(--slate-50); color: var(--slate-700); }
.nav-link.active { background: var(--brand-50); color: var(--brand-700); }
.nav-link .ic { width: 18px; height: 18px; flex-shrink: 0; }
.nav-link .badge-dot {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--rose-500); color: #fff;
  font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center;
}
.nav-sub { margin-left: 14px; padding-left: 12px; border-left: 1px solid var(--slate-100);
  display: none; flex-direction: column; gap: 2px; margin-top: 2px; margin-bottom: 4px; }
.nav-sub.open { display: flex; }
.nav-toggle .nav-caret { margin-left: auto; transition: transform .2s; display: flex; opacity: .7; }
.nav-toggle:not(.active) .nav-caret { transform: rotate(-90deg); }
.nav-sub a {
  padding: 8px 14px; border-radius: 10px; color: var(--slate-500);
  font-size: 13px; transition: background-color .15s;
}
.nav-sub a:hover { background: var(--slate-50); color: var(--slate-700); }
.nav-sub a.active { background: var(--brand-50); color: var(--brand-700); font-weight: 500; }
.sidebar-foot { padding: 16px; font-size: 11px; line-height: 1.6; color: var(--slate-400); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 64px;
  display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: rgba(255, 255, 255, 0.9); border-bottom: 1px solid var(--slate-100);
  backdrop-filter: blur(6px);
}
.topbar h1 { font-size: 18px; font-weight: 600; color: var(--slate-800); margin: 0; }
.topbar .spacer { flex: 1; }
.avatar {
  width: 32px; height: 32px; border-radius: 999px; background: var(--brand-600);
  color: #fff; font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center;
}
.user-chip { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-xl); cursor: pointer; }
.user-chip:hover { background: var(--slate-100); }
.user-chip .uname { font-size: 14px; font-weight: 500; color: var(--slate-700); line-height: 1.1; }
.user-chip .urole { font-size: 11px; color: var(--slate-400); }
.menu-pop {
  position: absolute; right: 24px; top: 60px; width: 208px; background: #fff;
  border-radius: var(--radius-xl); box-shadow: var(--pop-shadow); padding: 4px; z-index: 50; overflow: hidden;
}
.menu-pop .mi { padding: 8px 12px; font-size: 14px; color: var(--slate-600); border-radius: 10px; cursor: pointer; }
.menu-pop .mi:hover { background: var(--slate-50); }
.menu-pop .mi.danger { color: var(--rose-600); }
.menu-pop .sep { height: 1px; background: var(--slate-100); margin: 4px 0; }
.hidden { display: none !important; }

.content { flex: 1; padding: 24px; }
.content-inner { max-width: 1280px; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }

/* ---------- 卡片 / 网格 ---------- */
.card {
  background: #fff; border: 1px solid var(--slate-100);
  border-radius: var(--radius-2xl); box-shadow: var(--card-shadow); padding: 20px;
}
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.span-1 { grid-column: span 1; }
.span-2 { grid-column: span 2; }
@media (max-width: 1024px) { .cols-3, .cols-4 { grid-template-columns: repeat(2, 1fr); } .span-2 { grid-column: span 2; } }
@media (max-width: 640px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; } .span-2 { grid-column: span 1; } }

/* ---------- 统计卡 ---------- */
.stat-card { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px; border-radius: var(--radius-2xl); background: #fff; border: 1px solid var(--slate-100); box-shadow: var(--card-shadow); animation: fade-in .25s ease-out; }
.stat-card .label { font-size: 14px; color: var(--slate-500); }
.stat-card .value { margin-top: 6px; font-size: 24px; font-weight: 600; color: var(--slate-800); }
.stat-card .sub { margin-top: 4px; font-size: 12px; color: var(--slate-400); }
.icon-box { width: 44px; height: 44px; border-radius: var(--radius-xl); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 16px; border-radius: var(--radius-xl); font-size: 14px; font-weight: 500;
  border: none; cursor: pointer; transition: background-color .15s, color .15s; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand-600); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-700); }
.btn-ghost { background: transparent; color: var(--slate-600); }
.btn-ghost:hover { background: var(--slate-100); }
.btn-outline { background: #fff; border: 1px solid var(--slate-200); color: var(--slate-700); }
.btn-outline:hover { background: var(--slate-50); }
.btn-danger { background: var(--rose-600); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #be123c; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-xs { padding: 4px 10px; font-size: 12px; }

/* ---------- 表单 ---------- */
.input {
  width: 100%; padding: 8px 12px; border-radius: var(--radius-xl);
  border: 1px solid var(--slate-200); background: #fff; font-size: 14px; color: var(--slate-800);
  outline: none; transition: border-color .15s, box-shadow .15s; font-family: inherit;
}
.input:focus { border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--brand-100); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
textarea.input { min-height: 72px; resize: vertical; }
.label { display: block; font-size: 14px; font-weight: 500; color: var(--slate-600); margin-bottom: 6px; }
.form-row { margin-bottom: 16px; }

/* ---------- 标签 / 徽章 ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px;
  padding: 4px 10px; font-size: 12px; font-weight: 500;
}
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--slate-400); padding: 10px 12px; border-bottom: 1px solid var(--slate-100); }
.table th.r, .table td.r { text-align: right; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--slate-50); color: var(--slate-700); }
.table tbody tr:hover { background: var(--slate-50); }
.t-num { font-variant-numeric: tabular-nums; }

/* ---------- 分区标题 ---------- */
.section-title { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 14px; font-weight: 600; color: var(--slate-700); }
.section-title .ic { color: var(--brand-500); }

/* ---------- 空态 / 无权限 ---------- */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 64px 0; text-align: center; }
.empty .ico { width: 56px; height: 56px; border-radius: var(--radius-2xl); background: var(--slate-100); color: var(--slate-400); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.empty .t { font-size: 16px; font-weight: 500; color: var(--slate-700); }
.empty .d { margin-top: 4px; max-width: 320px; font-size: 14px; color: var(--slate-400); }

/* ---------- 状态时间线 ---------- */
.timeline { display: flex; align-items: center; overflow-x: auto; padding: 8px 0; }
.tl-node { width: 80px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 32px; height: 32px; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.tl-label { margin-top: 6px; font-size: 10px; font-weight: 500; }
.tl-line { flex: 1; height: 2px; }

/* ---------- 提示条 ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-xl); font-size: 14px; margin-bottom: 16px; }
.alert-info { background: var(--brand-50); color: var(--brand-700); }
.alert-warn { background: #fef3c7; color: #92400e; }

/* ---------- 图表 ---------- */
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut { border-radius: 50%; }
.legend { display: flex; flex-direction: column; gap: 8px; }
.legend .li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--slate-600); }
.legend .sw { width: 10px; height: 10px; border-radius: 999px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.bar-row .bl { width: 36px; color: var(--slate-500); flex-shrink: 0; }
.bar-track { flex: 1; background: var(--slate-100); border-radius: 6px; height: 22px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--slate-50); flex-wrap: wrap; }
.pager .info { font-size: 12px; color: var(--slate-400); }
.pager .pg { display: flex; align-items: center; gap: 4px; }
.pg button { min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--slate-500); background: transparent; border: none; cursor: pointer; }
.pg button:hover:not(:disabled) { background: var(--slate-100); }
.pg button.active { background: var(--brand-600); color: #fff; }
.pg button:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- 杂项 ---------- */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.muted { color: var(--slate-400); }
.divider { height: 1px; background: var(--slate-100); margin: 16px 0; }
.tag-toggle { display: inline-flex; background: var(--slate-100); border-radius: var(--radius-xl); padding: 4px; }
.tag-toggle button { padding: 6px 16px; border-radius: 10px; font-size: 14px; font-weight: 500; color: var(--slate-500); background: transparent; border: none; cursor: pointer; }
.tag-toggle button.active { background: #fff; color: var(--brand-700); box-shadow: var(--card-shadow); }
.filter-chip { border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 500; border: none; cursor: pointer; background: var(--slate-100); color: var(--slate-500); transition: background-color .15s; }
.filter-chip:hover { background: var(--slate-200); }
.filter-chip.active { color: #fff; }
.member-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--radius-xl); background: var(--slate-50); font-size: 14px; }
.gradient-card { background: linear-gradient(135deg, var(--brand-600), var(--brand-700)); color: #fff; }
.gradient-card .sub { opacity: .8; }
.link-brand { color: var(--brand-600); }
.link-brand:hover { text-decoration: underline; }
.dl-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
.dl-row .k { color: var(--slate-400); }
.dl-row .v { font-weight: 500; color: var(--slate-700); }

@keyframes fade-in { 0% { opacity: 0; transform: translateY(6px); } 100% { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fade-in .25s ease-out; }
@media (prefers-reduced-motion: reduce) { .fade-in, .stat-card { animation: none; } }
