/* B2B 企业后台 · 老板/财务/员工工作台 */
:root {
  --b2b-navy: #0f172a;
  --b2b-slate: #334155;
  --b2b-gold: #c9a227;
  --b2b-accent: #1e40af;
  --b2b-success: #059669;
  --b2b-warn: #d97706;
  --b2b-danger: #dc2626;
}

.b2b-page .content { max-width: 1440px; }

/* 角色切换 */
.role-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 16px;
  padding: 4px;
  background: #f4f4f5;
  border-radius: 8px;
}
.role-switcher a {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.role-switcher a:hover { color: #334155; background: #fff; }
.role-switcher a.active {
  background: #fff;
  color: var(--b2b-accent);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.role-switcher a.role-boss.active { color: #92400e; }
.role-switcher a.role-finance.active { color: #047857; }

.topbar .role-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #eff6ff;
  color: var(--b2b-accent);
  font-weight: 600;
}
.topbar .role-badge.boss { background: #fef3c7; color: #92400e; }
.topbar .role-badge.finance { background: #ecfdf5; color: #047857; }
.topbar .role-badge.ops { background: #f0fdf4; color: #15803d; }
.topbar .role-badge.warehouse { background: #eff6ff; color: #1d4ed8; }

/* 驾驶舱头部 */
.exec-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}
.exec-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--b2b-navy);
  letter-spacing: -0.02em;
}
.exec-header .meta { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.exec-header .period-pill {
  padding: 8px 16px;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}

/* 北极星 KPI */
.north-star-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 1100px) { .north-star-grid { grid-template-columns: repeat(2, 1fr); } }
.north-star-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  position: relative;
  overflow: hidden;
}
.north-star-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--b2b-accent), #60a5fa);
}
.north-star-card.gold::before { background: linear-gradient(90deg, #b45309, #fbbf24); }
.north-star-card.green::before { background: linear-gradient(90deg, #047857, #34d399); }
.north-star-card.purple::before { background: linear-gradient(90deg, #6d28d9, #a78bfa); }
.north-star-card .ns-label { font-size: 12px; color: #64748b; font-weight: 500; }
.north-star-card .ns-value { font-size: 26px; font-weight: 700; color: var(--b2b-navy); margin: 8px 0 4px; letter-spacing: -0.02em; }
.north-star-card .ns-sub { font-size: 11px; color: #94a3b8; }
.north-star-card .ns-trend { font-size: 12px; font-weight: 600; margin-top: 6px; }
.north-star-card .ns-trend.up { color: var(--b2b-success); }
.north-star-card .ns-trend.down { color: var(--b2b-danger); }
.north-star-card .progress-ring {
  position: absolute;
  top: 16px; right: 16px;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 3px solid #e2e8f0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: var(--b2b-accent);
}

/* 双栏布局 */
.b2b-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.b2b-grid-3-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 20px; }
.b2b-grid-1-3 { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; margin-bottom: 20px; }
@media (max-width: 960px) {
  .b2b-grid-2, .b2b-grid-3-1, .b2b-grid-1-3 { grid-template-columns: 1fr; }
}

.b2b-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 20px;
  margin-bottom: 0;
  box-shadow: none;
}
.b2b-card .card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--b2b-navy);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.b2b-card .card-title a { font-size: 12px; font-weight: 400; color: var(--b2b-accent); text-decoration: none; }

/* 趋势图 */
.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 140px;
  padding-top: 8px;
}
.trend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}
.trend-col .bar {
  width: 100%;
  max-width: 36px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #3b82f6, #1e40af);
  transform-origin: bottom;
  animation: barGrow 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.trend-col .bar.profit { background: linear-gradient(180deg, #34d399, #059669); }
.trend-col span { font-size: 10px; color: #94a3b8; }

/* 告警列表 */
.alert-list { display: flex; flex-direction: column; gap: 10px; }
.alert-item {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}
.alert-item:hover { border-color: #cbd5e1; background: #f8fafc; transform: translateX(2px); }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.alert-dot.warn { background: var(--b2b-warn); }
.alert-dot.info { background: #3b82f6; }
.alert-dot.ok { background: var(--b2b-success); }
.alert-item .alert-title { font-size: 13px; font-weight: 600; color: var(--b2b-navy); }
.alert-item .alert-desc { font-size: 11px; color: #94a3b8; margin-top: 2px; }

/* 利润结构 */
.profit-bars { display: flex; flex-direction: column; gap: 12px; }
.profit-row { display: flex; align-items: center; gap: 12px; }
.profit-row .name { width: 100px; font-size: 12px; color: #64748b; flex-shrink: 0; }
.profit-row .bar-wrap { flex: 1; height: 8px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.profit-row .bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.profit-row .val { width: 80px; text-align: right; font-size: 12px; font-weight: 600; color: var(--b2b-navy); }

/* 学校矩阵 */
.matrix-table { width: 100%; font-size: 12px; }
.matrix-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: #94a3b8; background: transparent; border-bottom: 1px solid #e2e8f0; }
.matrix-table td { border-bottom: 1px solid #f1f5f9; padding: 10px 8px; }
.trend-icon.up { color: var(--b2b-success); }
.trend-icon.down { color: var(--b2b-danger); }
.trend-icon.flat { color: #94a3b8; }

/* 工作台 */
.workbench-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  border-radius: 12px;
  padding: 24px 28px;
  color: #fff;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.workbench-hero h2 { font-size: 20px; font-weight: 600; }
.workbench-hero p { font-size: 13px; color: #94a3b8; margin-top: 4px; }
.workbench-stats {
  display: flex;
  gap: 24px;
}
.workbench-stats .ws-item { text-align: center; }
.workbench-stats .ws-num { font-size: 24px; font-weight: 700; }
.workbench-stats .ws-lbl { font-size: 11px; color: #94a3b8; margin-top: 2px; }

.task-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.task-card {
  padding: 16px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  position: relative;
}
.task-card:hover { border-color: var(--primary); box-shadow: 0 4px 16px rgba(0,0,0,0.06); transform: translateY(-1px); }
.task-card.urgent { border-left: 3px solid var(--b2b-danger); }
.task-card .task-count {
  position: absolute;
  top: 12px; right: 12px;
  min-width: 24px; height: 24px; line-height: 24px;
  text-align: center;
  background: #fef2f2;
  color: var(--b2b-danger);
  border-radius: 12px;
  font-size: 12px; font-weight: 700;
}
.task-card .task-title { font-size: 14px; font-weight: 600; color: var(--b2b-navy); }
.task-card .task-desc { font-size: 12px; color: #94a3b8; margin-top: 6px; line-height: 1.5; }

/* 财务待办 */
.todo-list { display: flex; flex-direction: column; gap: 0; }
.todo-item {
  display: grid;
  grid-template-columns: 80px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #f1f5f9;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}
.todo-item:hover { background: #f8fafc; margin: 0 -12px; padding-left: 12px; padding-right: 12px; }
.todo-type { font-size: 11px; font-weight: 600; color: var(--b2b-accent); background: #eff6ff; padding: 4px 8px; border-radius: 4px; text-align: center; }
.todo-type.withdraw { color: #92400e; background: #fef3c7; }
.todo-type.tax { color: #047857; background: #ecfdf5; }
.todo-title { font-size: 13px; font-weight: 500; }
.todo-amount { font-size: 13px; font-weight: 600; color: var(--b2b-navy); white-space: nowrap; }
.todo-due { font-size: 11px; color: #94a3b8; white-space: nowrap; }

/* 现金流 */
.cashflow-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) { .cashflow-grid { grid-template-columns: 1fr; } }
.cashflow-col h4 { font-size: 13px; color: #64748b; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid; }
.cashflow-col.in h4 { border-color: var(--b2b-success); color: var(--b2b-success); }
.cashflow-col.out h4 { border-color: var(--b2b-danger); color: var(--b2b-danger); }
.cf-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 13px; border-bottom: 1px dashed #f1f5f9; }
.cf-row .note { font-size: 11px; color: #94a3b8; }
.cf-net {
  margin-top: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cf-net .label { font-size: 13px; color: #047857; }
.cf-net .val { font-size: 22px; font-weight: 700; color: #065f46; }

/* 税日历 */
.tax-timeline { position: relative; padding-left: 24px; }
.tax-timeline::before {
  content: '';
  position: absolute;
  left: 7px; top: 4px; bottom: 4px;
  width: 2px;
  background: #e2e8f0;
}
.tax-event {
  position: relative;
  padding: 12px 0 12px 20px;
}
.tax-event::before {
  content: '';
  position: absolute;
  left: -20px; top: 16px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #cbd5e1;
}
.tax-event.critical::before { border-color: var(--b2b-danger); background: #fef2f2; }
.tax-event.done::before { border-color: var(--b2b-success); background: #ecfdf5; }
.tax-event .te-date { font-size: 11px; color: #94a3b8; }
.tax-event .te-title { font-size: 13px; font-weight: 600; color: var(--b2b-navy); margin: 2px 0; }
.tax-event .te-desc { font-size: 12px; color: #64748b; }

/* 角色入口卡片 */
.role-entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.role-entry {
  display: block;
  padding: 20px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  border: 1px solid #e2e8f0;
  transition: all 0.25s ease;
}
.role-entry:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
.role-entry.boss { background: linear-gradient(135deg, #fffbeb, #fef3c7); border-color: #fcd34d; }
.role-entry.finance { background: linear-gradient(135deg, #ecfdf5, #d1fae5); border-color: #6ee7b7; }
.role-entry.ops { background: linear-gradient(135deg, #f0fdf4, #dcfce7); border-color: #86efac; }
.role-entry.wh { background: linear-gradient(135deg, #eff6ff, #dbeafe); border-color: #93c5fd; }
.role-entry .re-icon { font-size: 28px; margin-bottom: 8px; }
.role-entry h3 { font-size: 15px; font-weight: 600; color: var(--b2b-navy); }
.role-entry p { font-size: 12px; color: #64748b; margin-top: 4px; line-height: 1.5; }
