/* ===== 费用360 - design tokens (based on original site design system) ===== */
:root {
  --primary: #2c6cff;
  --foreground: #0a1120;
  --muted-foreground: #898c93;
  --border: #e9e9e9;
  --page-bg: #f5f7fc;
  --card-border: #e4eaf5;
  --brand: #2c6cff;
  --brand-light: #e2efff;
  --brand-deep: #1949c8;
  --risk-high: #f84721;
  --risk-mid: #ffa500;
  --risk-low: #ffd250;
  --success: #40c48c;
  --purple: #b980f0;
  --cyan: #83d5fd;
  --sidebar-bg: #0a1120;
  --shadow: 0 2px 8px rgba(44, 108, 255, 0.06);
  --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  background: var(--page-bg);
  color: var(--foreground);
  font-size: 14px;
  line-height: 1.5;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; }

/* ===== app shell: sidebar + main ===== */
.app { display: flex; min-height: 100vh; }

/* ===== sidebar ===== */
.sidebar {
  width: 224px; flex: none; background: var(--sidebar-bg);
  color: #cbd2e0; position: fixed; top: 0; left: 0; bottom: 0; z-index: 200;
  display: flex; flex-direction: column;
  transition: width .25s ease;
  overflow: hidden;
}
.sidebar-logo { padding: 22px 20px 14px; border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar-logo h1 {
  font-size: 19px; font-weight: 700; color: #fff;
  display: flex; align-items: center; gap: 9px; white-space: nowrap;
}
.sidebar-logo .logo-mark {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, #2c6cff, #5a91ff);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: #fff;
}
.sidebar-logo p { font-size: 12px; color: #6b7488; margin-top: 5px; padding-left: 41px; white-space: nowrap; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 12px 20px; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 2px; }

.nav-group-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 10px 6px; font-size: 13px; font-weight: 600; color: #e8ecf5;
  cursor: pointer; user-select: none; white-space: nowrap;
}
.nav-group-title .caret { font-size: 10px; color: #6b7488; transition: transform .2s; }
.nav-group.collapsed .caret { transform: rotate(-90deg); }
.nav-group.collapsed .nav-sub { display: none; }

.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px 8px 24px; border-radius: 8px;
  font-size: 12px; color: #9aa3b8; cursor: pointer;
  transition: all .15s; white-space: nowrap; margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(44,108,255,.22); color: #fff; font-weight: 600; }
.nav-item .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .6; flex: none; }

.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.06); }
.sidebar-collapse-btn {
  width: 100%; display: flex; align-items: center; gap: 8px;
  background: transparent; border: none; color: #9aa3b8;
  font-size: 12px; cursor: pointer; padding: 8px 10px; border-radius: 8px; white-space: nowrap;
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,.06); color: #fff; }

/* collapsed state */
body.sidebar-collapsed .sidebar { width: 64px; }
body.sidebar-collapsed .sidebar-logo h1 span, body.sidebar-collapsed .sidebar-logo p,
body.sidebar-collapsed .nav-group-title, body.sidebar-collapsed .nav-item,
body.sidebar-collapsed .sidebar-collapse-btn span { display: none; }
body.sidebar-collapsed .main-wrap { margin-left: 64px; }
body.sidebar-collapsed .sidebar-collapse-btn { justify-content: center; }
body.sidebar-collapsed .sidebar-collapse-btn .icon { transform: rotate(180deg); }

/* ===== main area ===== */
.main-wrap { flex: 1; margin-left: 224px; transition: margin-left .25s ease; min-width: 0; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 100; height: 56px;
  background: #fff; border-bottom: 1px solid var(--card-border);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  box-shadow: 0 1px 4px rgba(10,17,32,.04);
}
.crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; }
.crumb .app-name { font-weight: 700; color: var(--foreground); font-size: 14px; }
.crumb .sep { color: #c5cad6; }
.crumb .current { color: var(--brand-deep); font-weight: 600; }

.month-picker {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--card-border); border-radius: 8px;
  padding: 5px 12px; font-size: 13px; color: var(--foreground);
  background: #fff; cursor: pointer; white-space: nowrap;
}
.month-picker .cal { color: var(--brand); }
.month-picker .caret { color: var(--muted-foreground); font-size: 10px; }

.search-box {
  flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px;
  background: #f1f3f8; border-radius: 8px; padding: 7px 14px;
  color: var(--muted-foreground); font-size: 13px; cursor: text;
}
.search-box input { border: none; background: transparent; outline: none; flex: 1; font-size: 13px; color: var(--foreground); }

.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #2c6cff, #5a91ff);
  color: #fff; font-size: 13px; display: flex; align-items: center; justify-content: center;
}
.user-meta .nm { font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-meta .rl { font-size: 11px; color: var(--muted-foreground); }

/* ===== layout ===== */
.container { max-width: 1480px; margin: 0 auto; padding: 24px 24px 60px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g5 { grid-template-columns: repeat(5, 1fr); }
.g21 { grid-template-columns: 2fr 1fr; }
.g12 { grid-template-columns: 1fr 2fr; }
section.module { margin-bottom: 28px; }

/* section header */
.section-head { margin: 24px 0 12px; display: flex; align-items: baseline; gap: 12px; }
.section-head h2 { font-size: 16px; font-weight: 700; }
.section-head p { font-size: 12px; color: var(--muted-foreground); }
.anchor { display: block; height: 0; }

/* ===== cards ===== */
.card {
  background: #fff; border: 1px solid var(--card-border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px;
}
.card-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.card-title h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-title h3::before {
  content: ""; width: 4px; height: 15px; border-radius: 2px;
  background: linear-gradient(180deg, #2c6cff, #5a91ff); flex: none;
}
.card-sub { font-size: 12px; color: var(--muted-foreground); }

/* ===== KPI cards (overview) ===== */
.kpi-card { text-align: left; position: relative; overflow: hidden; }
.kpi-card .kpi-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.kpi-label { font-size: 13px; color: var(--muted-foreground); font-weight: 600; }
.kpi-value { font-size: 28px; font-weight: 700; line-height: 1.1; }
.kpi-value small { font-size: 14px; font-weight: 500; color: var(--muted-foreground); margin-left: 4px; }
.kpi-trend { margin-top: 6px; font-size: 12px; color: var(--muted-foreground); }
.kpi-trend .up { color: var(--risk-high); font-weight: 600; }
.kpi-trend .down { color: var(--success); font-weight: 600; }
.kpi-accent { position: absolute; right: -18px; top: -18px; width: 72px; height: 72px; border-radius: 50%; opacity: .12; }
.kpi-subs { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #eef1f8; }
.kpi-subs .ks { font-size: 11px; color: var(--muted-foreground); }
.kpi-subs .ks b { color: var(--foreground); font-weight: 600; margin-left: 3px; }
.kpi-icon {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 13px; color: #fff;
}

/* badges / tags */
.tag { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag-blue { background: var(--brand-light); color: var(--brand-deep); }
.tag-red { background: #ffe7e1; color: var(--risk-high); }
.tag-orange { background: #fff3e0; color: #e68a00; }
.tag-green { background: #e3f8ef; color: #1d9e6c; }
.tag-gray { background: #f1f3f8; color: var(--muted-foreground); }
.tag-purple { background: #f3e8ff; color: #8b3fd6; }

/* charts */
.chart { width: 100%; height: 240px; }
.chart-sm { height: 180px; }
.chart-lg { height: 300px; }

/* legend */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted-foreground); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

/* tables */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; padding: 8px; color: var(--muted-foreground);
  font-weight: 600; border-bottom: 1px solid var(--border); background: #fafbff;
  white-space: nowrap;
}
.tbl td { padding: 7px 8px; border-bottom: 1px solid #f2f4f9; }
.tbl tr:hover td { background: #f8faff; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

/* progress bar */
.bar { height: 6px; background: #eef1f8; border-radius: 99px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #2c6cff, #5a91ff); }
.bar.green > i { background: linear-gradient(90deg, #40c48c, #5adcaa); }
.bar.red > i { background: linear-gradient(90deg, #f84721, #ff7850); }
.bar.orange > i { background: linear-gradient(90deg, #ffa500, #ffc83c); }

/* risk list (风险预警 TOP10) */
.risk-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px; background: #fafbff; margin-bottom: 6px;
}
.risk-item .n { font-size: 13px; font-weight: 600; flex: 1; }
.risk-item .v { font-size: 12px; color: var(--muted-foreground); white-space: nowrap; }
.risk-item .v b { color: var(--risk-high); font-size: 13px; }
.risk-item .bar { flex: 1.2; max-width: 120px; }
.risk-item .bar > i { background: linear-gradient(90deg, #f84721, #ff7850); }

/* expense top10 list (费用 TOP10) */
.exp-item { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed #eef1f8; }
.exp-item:last-child { border-bottom: none; }
.exp-item .amt { font-size: 13px; font-weight: 700; width: 64px; text-align: right; flex: none; }
.exp-item .bar { flex: 1.6; }

/* AI panels */
.ai-panel { background: linear-gradient(135deg, #f3f8fe 0%, #fff 60%); border: 1px solid #d7e6ff; }
.ai-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ai-icon {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, #2c6cff, #b980f0);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px;
}
.ai-head h3 { font-size: 15px; font-weight: 700; }
.ai-head p { font-size: 12px; color: var(--muted-foreground); }
.ai-block { margin-bottom: 12px; }
.ai-block h4 { font-size: 13px; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.ai-block p, .ai-block li { font-size: 13px; color: #3a4152; line-height: 1.7; }
.ai-block ul { padding-left: 18px; }
.dot-red { color: var(--risk-high); } .dot-orange { color: var(--risk-mid); }
.dot-green { color: var(--success); } .dot-blue { color: var(--brand); }

.insight-card { border: 1px solid var(--card-border); border-radius: 8px; padding: 14px; margin-bottom: 12px; background: #fff; }
.insight-card .ic-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 8px; }
.insight-card h4 { font-size: 14px; font-weight: 700; }
.insight-card p { font-size: 13px; color: #4a5265; line-height: 1.7; }
.confidence { font-size: 11px; color: var(--brand-deep); background: var(--brand-light); padding: 2px 8px; border-radius: 99px; white-space: nowrap; }

/* stat tiles */
.stat-tile { background: #fafbff; border: 1px solid #eef1f8; border-radius: 8px; padding: 12px; }
.stat-tile .st-label { font-size: 12px; color: var(--muted-foreground); }
.stat-tile .st-value { font-size: 20px; font-weight: 700; margin: 3px 0 2px; }
.stat-tile .st-note { font-size: 12px; color: var(--muted-foreground); }

/* inline stats row (人员汇总等) */
.inline-stats { display: flex; gap: 0; border-top: 1px solid #eef1f8; margin-top: 12px; padding-top: 10px; }
.inline-stats .is-item { flex: 1; text-align: center; }
.inline-stats .is-item .l { font-size: 12px; color: var(--muted-foreground); }
.inline-stats .is-item .v { font-size: 15px; font-weight: 700; margin-top: 2px; }

/* eff indicator tile */
.eff-tile { background: #fafbff; border: 1px solid #eef1f8; border-radius: 8px; padding: 12px; display: flex; justify-content: space-between; align-items: center; }
.eff-tile .l { font-size: 12px; color: var(--muted-foreground); }
.eff-tile .v { font-size: 18px; font-weight: 700; margin-top: 2px; }

/* expense distribution card */
.dist-card { padding: 14px 16px; }
.dist-card .card-title { flex-direction: column; align-items: flex-start; gap: 2px; margin-bottom: 10px; }
.dist-row { display: flex; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px dashed #eef1f8; font-size: 11px; }
.dist-row:last-of-type { border-bottom: none; }
.dist-row .swatch { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.dist-row .nm { width: 56px; font-weight: 600; flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dist-row .yoy { width: 38px; text-align: center; color: var(--muted-foreground); flex: none; }
.dist-row .pct { width: 34px; text-align: center; font-weight: 600; flex: none; }
.dist-row .amt { flex: 1; text-align: right; white-space: nowrap; min-width: 0; }
.dist-row .exec { width: 36px; text-align: right; color: var(--muted-foreground); flex: none; }
.dist-row .exec b { color: var(--foreground); }
.dist-legend { display: flex; gap: 8px; justify-content: center; font-size: 10px; color: var(--muted-foreground); margin-top: 8px; flex-wrap: wrap; }
.dist-legend span { display: flex; align-items: center; gap: 3px; }

/* rank list */
.rank-item { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed #eef1f8; }
.rank-item.exec-row { padding: 5px 0; }
.rank-item.exec-row .rank-sub { margin-top: 1px; }
.rank-item:last-child { border-bottom: none; }
.rank-no {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; background: #f1f3f8; color: var(--muted-foreground);
}
.rank-no.top { background: var(--brand); color: #fff; }
.rank-name { flex: 1; font-size: 13px; font-weight: 600; }
.rank-sub { font-size: 12px; color: var(--muted-foreground); font-weight: 400; }
.rank-val { font-size: 13px; font-weight: 700; }

/* alert list */
.alert-item { border-left: 3px solid var(--risk-high); background: #fff7f5; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.alert-item.mid { border-left-color: var(--risk-mid); background: #fffaf0; }
.alert-item.low { border-left-color: var(--risk-low); background: #fffdf2; }
.alert-item h4 { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.alert-item .meta { font-size: 12px; color: var(--muted-foreground); display: flex; gap: 10px; flex-wrap: wrap; }
.alert-item p { font-size: 12px; color: #6b7280; margin-top: 4px; line-height: 1.5; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 8px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--card-border); background: #fff; color: #3a4152;
  transition: all .15s;
}
.btn:hover { border-color: var(--brand); color: var(--brand-deep); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-deep); color: #fff; }
.btn-ghost { border: none; background: transparent; color: var(--brand); font-size: 12px; padding: 4px 8px; }

.pill-group { display: inline-flex; background: #f1f3f8; border-radius: 8px; padding: 3px; }
.pill-group button {
  border: none; background: transparent; padding: 4px 12px; border-radius: 6px;
  font-size: 12px; color: var(--muted-foreground); cursor: pointer;
}
.pill-group button.active { background: #fff; color: var(--brand-deep); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* expandable rows */
tr.expandable { cursor: pointer; }
tr.detail-row td { background: #fafbff; padding: 0; }
.detail-box { padding: 14px 18px; font-size: 13px; color: #4a5265; display: none; }
.detail-box.open { display: block; }
.detail-box .dline { margin: 4px 0; }
.detail-box b { color: var(--foreground); }

/* compliance hero */
.hero-stat { text-align: center; padding: 16px 8px; }
.hero-stat .hv { font-size: 32px; font-weight: 700; }
.hero-stat .hl { font-size: 12px; color: var(--muted-foreground); margin-top: 4px; }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--success); margin-right: 6px; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

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

/* ===== design-logic modal ===== */
.design-logic-btn { flex: none; }
.dl-modal-mask {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(10,17,32,.45);
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.dl-modal-mask.open { display: flex; }
.dl-modal {
  width: 100%; max-width: 760px; max-height: 86vh;
  background: #fff; border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 12px 48px rgba(10,17,32,.28);
  animation: dl-in .22s ease;
}
@keyframes dl-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.dl-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; border-bottom: 1px solid var(--card-border);
  background: linear-gradient(90deg, #f2f7ff, #fff);
}
.dl-modal-head h3 { font-size: 17px; font-weight: 700; }
.dl-close {
  border: none; background: #f1f3f8; width: 30px; height: 30px; border-radius: 8px;
  font-size: 14px; color: var(--muted-foreground); cursor: pointer; line-height: 1;
}
.dl-close:hover { background: #ffe7e1; color: var(--risk-high); }
.dl-modal-body { padding: 20px 24px 28px; overflow-y: auto; }

.dl-section { margin-bottom: 26px; }
.dl-section:last-child { margin-bottom: 0; }
.dl-section > p { font-size: 13px; color: #4a5265; line-height: 1.8; }
.dl-sec-title { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.dl-num {
  width: 22px; height: 22px; border-radius: 7px; flex: none;
  background: linear-gradient(135deg, #2c6cff, #5a91ff); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}

.dl-flow { display: flex; flex-direction: column; gap: 2px; }
.dl-flow-item {
  background: #fafbff; border: 1px solid var(--card-border); border-radius: 10px;
  padding: 10px 14px;
}
.dl-flow-item b { font-size: 13px; display: block; color: var(--brand-deep); }
.dl-flow-item span { font-size: 12px; color: var(--muted-foreground); line-height: 1.6; }
.dl-flow-arrow { text-align: center; color: #c5cad6; font-size: 13px; line-height: 1; padding: 3px 0; }

.dl-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dl-chip {
  display: flex; align-items: flex-start; gap: 10px;
  background: #fafbff; border: 1px solid var(--card-border); border-radius: 10px; padding: 10px 12px;
}
.dl-chip i { width: 16px; height: 16px; border-radius: 5px; flex: none; margin-top: 2px; }
.dl-chip b { font-size: 12.5px; display: block; }
.dl-chip span { font-size: 11.5px; color: var(--muted-foreground); line-height: 1.5; }

.dl-arch { display: flex; flex-direction: column; gap: 10px; }
.dl-arch-layer {
  display: flex; align-items: flex-start; gap: 12px;
  border-left: 3px solid var(--brand); background: #f2f7ff; border-radius: 0 10px 10px 0; padding: 10px 14px;
}
.dl-arch-layer b { font-size: 13px; color: var(--brand-deep); flex: none; width: 52px; }
.dl-arch-layer span { font-size: 12.5px; color: #4a5265; line-height: 1.6; }

.dl-list { list-style: none; padding: 0; margin: 8px 0 0; }
.dl-list li {
  font-size: 13px; color: #4a5265; padding: 7px 0 7px 20px; position: relative; line-height: 1.6;
  border-bottom: 1px dashed #eef1f8;
}
.dl-list li::before { content: "✓"; position: absolute; left: 0; color: var(--success); font-weight: 700; }
.dl-list li b { color: var(--foreground); }

@media (max-width: 1200px) {
  .g4, .g5 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .g2, .g3, .g21, .g12 { grid-template-columns: 1fr; }
  .sidebar { width: 64px; }
  .sidebar-logo h1 span, .sidebar-logo p, .nav-group-title, .nav-item, .sidebar-collapse-btn span { display: none; }
  .main-wrap { margin-left: 64px; }
}
