/**
 * 管理后台现代主题
 * 主题色统一 #ff6a1a（对齐 BilzatOS 前台）
 * 只做视觉升级，不改布局结构。
 */
:root {
  --am-purple: #ff6a1a;
  --am-purple-mid: #ffb347;
  --am-lavender: #ffd0b3;
  --am-soft: #fff4ec;
  --am-softer: #fff8f2;
  --am-theme: #ff6a1a;
  --am-theme-deep: #e85d12;
  --am-bg: #f9fafb;
  --am-surface: #ffffff;
  --am-border: #eef0f4;
  --am-text: #1f2937;
  --am-muted: #6b7280;
  --am-radius: 12px;
  --am-radius-lg: 16px;
  --am-shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.04);
  --am-shadow: 0 10px 28px rgba(255, 106, 26, 0.10);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif !important;
  background-color: var(--am-bg) !important;
  background-image:
    linear-gradient(rgba(17, 17, 17, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 17, 17, 0.035) 1px, transparent 1px),
    radial-gradient(900px 480px at 85% -5%, rgba(255, 179, 71, 0.35), transparent 55%),
    radial-gradient(700px 400px at 10% 25%, rgba(255, 106, 26, 0.12), transparent 50%),
    linear-gradient(180deg, #fff 0%, #f9fafb 50%, #f3f4f6 100%) !important;
  background-size: 48px 48px, 48px 48px, auto, auto, auto;
  color: var(--am-text);
  -webkit-font-smoothing: antialiased;
}

/* —— 侧栏（对齐 ai.barbiz.cn 用户运营红框结构，细则在 nav.css） —— */
.admin-sidebar {
  background: #fafbfc !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-right: 1px solid #e8e8e8 !important;
  box-shadow: none;
}

.sidebar-header {
  background: #fff !important;
  border-bottom: 1px solid #eef0f3 !important;
}

.sidebar-title {
  color: #1a1a2e !important;
  letter-spacing: 0.02em;
}

.sidebar-menu-item {
  border-radius: 0 !important;
  margin-right: 0 !important;
}

.sidebar-menu-item:hover {
  background: #fff4ec !important;
  color: #e85d12 !important;
}

.sidebar-menu-item.active {
  background: #fff4ec !important;
  border: 0 !important;
  border-left: 3px solid #ff6a1a !important;
  color: #ff6a1a !important;
  font-weight: 500 !important;
  box-shadow: none !important;
}

.sidebar-menu-group-title {
  color: #ff6a1a !important;
}

.sidebar-menu-group.open > .sidebar-menu-group-title,
.sidebar-menu-group-title.has-active-child {
  color: #ff6a1a !important;
}

.user-avatar {
  background: linear-gradient(135deg, #ffb347 0%, #ff6a1a 100%) !important;
  box-shadow: none;
}

.sidebar-menu::-webkit-scrollbar-thumb {
  background: #d0d5dd !important;
}

.ov-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ff6a1a;
}

.logout-btn {
  border-radius: 6px !important;
}

.logout-btn:hover {
  box-shadow: none;
  border-color: #ff6a1a !important;
  color: #ff6a1a !important;
  background: #fff !important;
}

/* —— 主内容 —— */
.main-content {
  position: relative;
  z-index: 1;
}

.page-header h2 {
  letter-spacing: -0.02em;
  color: #111827 !important;
}

.page-header p {
  color: var(--am-muted) !important;
}

/* —— 卡片 / 面板 —— */
.stat-card,
.panel,
.card,
.placeholder-panel,
.content-card,
.admin-card,
.gs-panel,
.log-panel,
.filter-bar,
.table-wrap {
  border-radius: var(--am-radius) !important;
  border: 1px solid rgba(196, 181, 253, 0.55);
  box-shadow: var(--am-shadow-sm) !important;
  transition: box-shadow 0.22s ease, border-color 0.22s ease, transform 0.18s ease;
}

.stat-card:hover,
.panel:hover,
.card:hover {
  box-shadow: var(--am-shadow) !important;
  border-color: #ffd0b3;
}

.stat-card-icon.purple {
  background: rgba(255, 106, 26, 0.12) !important;
  color: var(--am-purple);
}

.panel-header a {
  color: var(--am-purple) !important;
}

.panel-header a:hover {
  color: var(--am-theme-deep) !important;
}

/* —— 表格 —— */
.data-table th,
table thead th {
  color: var(--am-theme-deep) !important;
  background: linear-gradient(180deg, #fff8f2 0%, #fff4ec 100%);
  border-bottom-color: #ffd0b3 !important;
  font-weight: 600 !important;
}

.data-table tbody tr:hover td {
  background: rgba(255, 106, 26, 0.06);
}

/* —— 按钮 —— */
.btn-primary,
.btn-search,
.search-btn,
.primary-btn,
button.primary {
  background: linear-gradient(135deg, var(--am-purple-mid) 0%, var(--am-purple) 100%) !important;
  border: none !important;
  border-radius: 8px !important;
  box-shadow: 0 6px 16px rgba(255, 106, 26, 0.26);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease !important;
}

.btn-primary:hover,
.btn-search:hover,
.search-btn:hover,
.primary-btn:hover {
  filter: brightness(1.03);
  box-shadow: 0 8px 20px rgba(255, 106, 26, 0.34);
  transform: translateY(-1px);
}

.btn-outline,
.btn-secondary,
.btn-ghost {
  border-radius: 8px !important;
  color: var(--am-purple) !important;
  border-color: #ffd0b3 !important;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s !important;
}

.btn-outline:hover,
.btn-secondary:hover {
  background: var(--am-softer) !important;
  border-color: var(--am-lavender) !important;
  box-shadow: 0 2px 10px rgba(255, 106, 26, 0.12);
}

.action-btn:hover {
  border-color: var(--am-lavender) !important;
  color: var(--am-purple) !important;
  background: rgba(255, 106, 26, 0.06) !important;
}

/* —— 表单 —— */
.form-group input,
.form-group select,
.form-group textarea,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
select,
textarea {
  border-radius: 8px !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: #ffd0b3 !important;
  box-shadow: 0 0 0 3px rgba(255, 106, 26, 0.16) !important;
  outline: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(255, 106, 26, 0.45);
  outline-offset: 2px;
}

/* —— Tabs / 标签 —— */
.tab.active,
.tabs .active,
.filter-chip.active,
.seg-btn.active,
.network-btn.active {
  background: linear-gradient(135deg, var(--am-purple-mid) 0%, var(--am-purple) 100%) !important;
  border-color: var(--am-purple) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(255, 106, 26, 0.28);
}

.status-tag.info {
  background: rgba(255, 106, 26, 0.1) !important;
  color: var(--am-purple) !important;
}

/* —— 共享节点等业务块 —— */
.shared-node-card {
  border-left-color: var(--am-purple) !important;
  background: linear-gradient(180deg, #ffffff 0%, #fffaf5 100%) !important;
  box-shadow: var(--am-shadow-sm);
}

.shared-node-card.local {
  border-left-color: var(--am-purple) !important;
}

/* —— 链接 —— */
.main-content a:not(.btn-primary):not(.logout-btn):not(.sidebar-menu-item) {
  text-underline-offset: 2px;
}

/* —— 滚动条 —— */
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 179, 71, 0.45);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 106, 26, 0.55);
  background-clip: padding-box;
  border: 2px solid transparent;
}

/* —— Hero / 引导块常见样式 —— */
.gs-hero,
.page-hero,
.onboard-hero {
  border-radius: var(--am-radius-lg) !important;
  box-shadow: 0 12px 32px rgba(255, 106, 26, 0.18);
}

.ok-badge { display:inline-block; padding:2px 8px; border-radius:999px; background:#dcfce7; color:#166534; font-size:12px; font-weight:600; }
.fail-badge { display:inline-block; padding:2px 8px; border-radius:999px; background:#fee2e2; color:#991b1b; font-size:12px; font-weight:600; }
.status-on { color:#059669; font-weight:600; }
.status-off { color:#9ca3af; }
.iam-split { display:grid; grid-template-columns: 1.2fr 0.8fr; gap:20px; margin-bottom:20px; }
.trend-bars { display:flex; align-items:flex-end; gap:8px; height:140px; padding:8px 0 0; }
.trend-col { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; height:100%; }
.trend-bar { width:100%; max-width:28px; background:linear-gradient(180deg,#ffb347,#ff6a1a); border-radius:6px 6px 0 0; min-height:4px; }
.trend-lab { font-size:10px; color:#9ca3af; margin-top:6px; }
.donut { width:140px; height:140px; border-radius:50%; margin:12px auto; }
.protocol-list { font-size:13px; color:#374151; line-height:1.8; }
.score-hero { font-size:42px; font-weight:700; color:#ff6a1a; letter-spacing:-0.03em; }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px 16px; }
.form-control, .form-group textarea { width:100%; padding:9px 12px; border:1px solid #e0e0e0; border-radius:6px; font-size:13px; box-sizing:border-box; }
.bw-pay-runtime { display:flex; flex-wrap:wrap; gap:8px; }
.bw-pay-status { font-size:12px; padding:4px 8px; border-radius:999px; background:#f3f4f6; color:#4b5563; }
.bw-pay-status.ok { background:#dcfce7; color:#166534; }
.bw-pay-status.bad { background:#fee2e2; color:#991b1b; }
.bw-api-hint { font-size:13px; color:#64748b; line-height:1.6; margin:8px 0 14px; }
.bw-api-section { margin:18px 0 10px; font-size:15px; }
.bw-sms-panel { display:none; }
.bw-sms-panel.is-active { display:block; }
.card-header { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; flex-wrap:wrap; margin-bottom:12px; }
.ma-pipe {
  display: grid;
  grid-template-columns: 1fr 18px 1fr 18px 1fr 18px 1fr;
  gap: 8px;
  align-items: stretch;
  margin: 12px 0 4px;
}
.ma-step {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px 14px;
}
.ma-step.on { border-color: rgba(22, 163, 74, 0.45); background: #f4fbf6; }
.ma-step.wait { border-color: rgba(217, 119, 6, 0.4); background: #fffbeb; }
.ma-step .ma-k { font-size: 11px; color: #6b7280; font-weight: 700; letter-spacing: 0.04em; }
.ma-step .ma-t { margin-top: 4px; font-size: 15px; font-weight: 750; }
.ma-step .ma-d { margin-top: 4px; font-size: 12px; color: #6b7280; line-height: 1.45; word-break: break-all; }
.ma-arr { display: flex; align-items: center; justify-content: center; color: #ff6a1a; font-weight: 800; }
@media (max-width: 1023px) {
  .iam-split { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .form-grid { grid-template-columns: 1fr; }
  .ma-pipe { grid-template-columns: 1fr; }
  .ma-arr { display: none; }
}

/* —— 对齐 ai.barbiz.cn/admin/users（橙主题） —— */
.bz-sub { margin: 0 0 18px; color: var(--am-muted); font-size: 13px; }
.bz-card {
  background: #fff;
  border: 1px solid #e4e9f2;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(37, 43, 54, 0.04);
}
.ov-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.ov-kpi {
  background: #fff;
  border: 1px solid #e4e9f2;
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 8px 24px rgba(37, 43, 54, 0.04);
  position: relative;
  overflow: hidden;
}
.ov-kpi::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 106, 26, 0.14), transparent 70%);
  pointer-events: none;
}
.ov-kpi .lbl { color: var(--am-muted); font-size: 12px; font-weight: 600; }
.ov-kpi .num {
  margin-top: 10px;
  font-size: 28px;
  font-weight: 780;
  letter-spacing: -0.02em;
  color: #151922;
  line-height: 1.1;
}
.ov-kpi .hint { margin-top: 4px; font-size: 11px; color: var(--am-muted); }
.ov-card-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.ov-card-h h3 { margin: 0; font-size: 15px; color: #151922; }
.ov-card-h .bz-sub { margin: 0; color: #ff6a1a; font-weight: 650; }
.users-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.users-search {
  min-width: 180px;
  padding: 8px 12px;
  border: 1px solid #e4e9f2;
  border-radius: 10px;
  background: #fff8f2;
  font: inherit;
  font-size: 13px;
}
.users-search:focus {
  outline: none;
  border-color: #ffd0b3;
  box-shadow: 0 0 0 3px rgba(255, 106, 26, 0.16);
}
.bz-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bz-table th, .bz-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid #e4e9f2;
  vertical-align: middle;
}
.bz-table th { color: var(--am-muted); font-weight: 700; font-size: 12px; }
.ov-act-av {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #fff4ec;
  color: #ff6a1a;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 750;
}
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff4ec;
  color: #c45c26;
  font-size: 12px;
  font-weight: 600;
}
.pill.up { color: #16a34a; background: rgba(22, 163, 74, 0.1); }
.pill.down { color: #e11d48; background: rgba(225, 29, 72, 0.1); }
@media (max-width: 980px) {
  .ov-kpi-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .ov-kpi-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
