:root {
  --b2b-brand: #2563eb;
  --b2b-green: #0f766e;
  --b2b-line: #dbe4f0;
  --b2b-dark: #0f172a;
  --b2b-surface: #f8fafc;
  --b2b-text-muted: #64748b;
}

body {
  font-family: "Microsoft YaHei", Arial, sans-serif;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, var(--b2b-brand), #14b8a6);
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(37, 99, 235, .25);
}

.brand-mark-dark {
  box-shadow: none;
}

.front-navbar {
  border-bottom: 1px solid rgba(219, 228, 240, .76);
  backdrop-filter: blur(10px);
}

.b2b-front .hero-section {
  padding: clamp(48px, 8vw, 92px) 0;
  background:
    radial-gradient(circle at 16% 24%, rgba(37, 99, 235, .14), transparent 28%),
    radial-gradient(circle at 80% 36%, rgba(15, 118, 110, .12), transparent 32%),
    linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.front-section {
  padding: 42px 0;
}

.front-auth-card,
.hero-metric-card,
.request-card {
  border: 0;
  box-shadow: 0 22px 55px rgba(15, 23, 42, .12);
}

.front-auth-card {
  border-radius: 22px;
}

.front-stat {
  height: 100%;
  padding: 16px;
  border: 1px solid rgba(219, 228, 240, .9);
  border-radius: 16px;
  background: rgba(255, 255, 255, .78);
}

.feature-card {
  height: 100%;
  border: 1px solid rgba(219, 228, 240, .9);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .06);
}

.feature-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  margin-bottom: 16px;
  font-size: 22px;
}

.auth-mode-group .btn {
  box-shadow: none;
}

.auth-mode-register #loginCustomer {
  display: none;
}

.auth-mode-login .auth-register-field {
  display: none;
}

.auth-mode-register .auth-register-field {
  display: block;
}

.auth-mode-register .d-grid .auth-register-field {
  display: inline-flex;
  justify-content: center;
}

.b2b-front.customer-logged-in .auth-mode-group,
.b2b-front.customer-logged-in #loginCustomer,
.b2b-front.customer-logged-in #registerCustomer,
.b2b-front.customer-logged-in #sendCustomerCode,
.b2b-front.customer-logged-in .auth-register-field {
  display: none;
}

.b2b-front:not(.customer-logged-in) #logoutCustomer {
  display: none;
}

.wechat-qr {
  width: 148px;
  height: 148px;
  object-fit: cover;
  border-radius: 18px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--b2b-line);
}

.selection-path {
  min-height: 48px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px dashed #b6c6e3;
  border-radius: 12px;
  background: #f8fbff;
  color: #64748b;
}

.selection-path span {
  padding: 7px 11px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--b2b-brand);
  border: 1px solid #bfdbfe;
  font-weight: 700;
}

.selection-path b {
  color: #94a3b8;
}

.option-cloud {
  min-height: 170px;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 28% 32%, rgba(37,99,235,.10), transparent 26%),
    radial-gradient(circle at 72% 58%, rgba(15,118,110,.10), transparent 28%),
    #f8fbff;
  border: 1px solid #e0e7ff;
}

.option-card {
  min-width: 132px;
  max-width: 190px;
  min-height: 82px;
  border-radius: 18px;
  padding: 14px 16px;
  color: #1d4ed8;
  background: linear-gradient(180deg, #fff, #eaf2ff);
  border: 1px solid rgba(37,99,235,.18);
  box-shadow: 0 12px 24px rgba(37,99,235,.12);
  transition: transform .16s ease, box-shadow .16s ease;
}

.option-card:focus {
  outline: 3px solid rgba(37, 99, 235, .22);
  outline-offset: 2px;
}

.option-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 32px rgba(37,99,235,.20);
}

.option-card strong,
.option-card small {
  display: block;
  text-align: center;
}

.option-card small {
  margin-top: 6px;
  color: #64748b;
  line-height: 1.35;
}

.lead-card-list {
  display: grid;
  gap: 12px;
}

.lead-card {
  padding: 16px;
  border: 1px solid var(--b2b-line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff, #fbfdff);
}

.lead-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.lead-card p {
  margin: 8px 0;
  line-height: 1.65;
}

.table-link {
  color: var(--b2b-brand);
  font-weight: 700;
}

.empty {
  padding: 18px;
  border: 1px dashed var(--b2b-line);
  border-radius: 12px;
  color: #64748b;
  text-align: center;
}

.bar-chart {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(84px, 160px) 1fr 54px;
  gap: 10px;
  align-items: center;
}

.bar-label,
.bar-value {
  color: #64748b;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.bar-value {
  text-align: right;
  color: #111827;
  font-weight: 700;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #e5eefb;
  overflow: hidden;
}

.bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--b2b-brand), var(--b2b-green));
}

.multi-chart {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 16px;
}

.trend-series {
  padding: 14px;
  border: 1px solid var(--b2b-line);
  border-radius: 14px;
  background: var(--b2b-surface);
}

.trend-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.trend-title span {
  color: var(--b2b-brand);
  font-weight: 800;
}

.line-chart {
  overflow-x: auto;
}

.line-chart svg {
  width: 100%;
  min-width: 280px;
  height: 150px;
}

.line-chart line {
  stroke: #cbd5e1;
  stroke-width: 1;
}

.line-chart polyline {
  fill: none;
  stroke: var(--line-color, var(--b2b-brand));
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.line-chart circle {
  fill: #fff;
  stroke: var(--line-color, var(--b2b-brand));
  stroke-width: 2;
  cursor: pointer;
}

.line-chart text {
  fill: #0f172a;
  font-size: 11px;
  font-weight: 800;
  paint-order: stroke;
  pointer-events: none;
  stroke: #fff;
  stroke-width: 3px;
  text-anchor: middle;
}

.line-point:hover circle {
  fill: var(--line-color, var(--b2b-brand));
}

.line-point:hover text {
  fill: var(--line-color, var(--b2b-brand));
}

.line-tooltip {
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
}

.line-tooltip rect {
  fill: #0f172a;
  stroke: rgba(255,255,255,.72);
  stroke-width: 1;
  filter: drop-shadow(0 8px 18px rgba(15,23,42,.22));
}

.line-tooltip text {
  fill: #fff;
  stroke: transparent;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .01em;
}

.line-point:hover .line-tooltip {
  opacity: 1;
}

.line-chart-labels {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--b2b-text-muted);
  font-size: 11px;
  min-width: 280px;
}

.lead-detail {
  margin-top: 8px;
}

.lead-detail summary {
  color: var(--b2b-brand);
  cursor: pointer;
  font-weight: 700;
  list-style-position: inside;
}

.lead-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.lead-detail-item {
  border: 1px solid var(--b2b-line);
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
  min-width: 0;
}

.lead-detail-item strong {
  display: block;
  color: var(--b2b-dark);
  margin-bottom: 5px;
}

.lead-detail-item p {
  color: #334155;
  line-height: 1.6;
  margin: 0;
  white-space: normal;
}

.status-list {
  display: grid;
  gap: 10px;
}

.status-strip {
  padding: 12px 14px;
  border: 1px solid #fed7aa;
  border-radius: 14px;
  color: #9a3412;
  background: #fff7ed;
}

.status-strip.ok {
  color: #166534;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.status-strip.running {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.status-strip.error {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.action-feedback {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--b2b-line);
  border-radius: 12px;
  color: #475569;
  background: #f8fafc;
}

.global-feedback {
  margin-bottom: 16px;
}

.action-feedback a {
  font-weight: 800;
  margin-left: 8px;
}

.action-feedback.running {
  color: #1d4ed8;
  border-color: #bfdbfe;
  background: #eff6ff;
}

.action-feedback.ok {
  color: #166534;
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.action-feedback.error {
  color: #991b1b;
  border-color: #fecaca;
  background: #fef2f2;
}

.btn.is-loading {
  pointer-events: none;
  opacity: .78;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--b2b-line);
}

.status-row.ok {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.status-row.warn {
  background: #fff7ed;
  border-color: #fed7aa;
}

.credit-input {
  width: 84px;
  display: inline-block;
  margin-right: 8px;
}

.credit-input + button {
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  color: var(--b2b-brand);
  background: #eff6ff;
  padding: 5px 10px;
}

.b2b-admin .page-wrapper {
  background: #f6f8fb;
}

.admin-sidebar {
  background: #111827;
  border-right: 0;
}

.admin-sidebar .nav-link {
  border-radius: 10px;
  margin: 2px 8px;
}

.admin-sidebar .nav-item.active .nav-link {
  background: rgba(255, 255, 255, .12);
}

.admin-topbar {
  border-bottom: 1px solid var(--b2b-line);
  background: #fff;
}

.admin-login-gate {
  padding: clamp(42px, 9vw, 96px) 0;
}

.admin-content {
  min-height: 60vh;
}

.b2b-admin:not(.admin-logged-in) .admin-sidebar,
.b2b-admin:not(.admin-logged-in) #refreshAdminAll,
.b2b-admin:not(.admin-logged-in) #logoutAdmin {
  display: none;
}

.b2b-admin.admin-logged-in #adminLoginGate {
  display: none;
}

@media (max-width: 900px) {
  .multi-chart {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }

  .front-navbar .collapse {
    flex-basis: 100%;
    order: 3;
  }

  .front-navbar .navbar-nav:not(.order-md-last) {
    flex-direction: row;
    flex-wrap: wrap;
    padding-top: 10px;
  }
}
