/*
 * 文件说明：AURELIA CRM 控制台全局样式。
 * 功能说明：管理深海蓝品牌色、响应式布局、数据表格、负载进度与动态交互效果。
 */

/* 品牌与语义颜色变量，便于统一维护视觉系统 */
:root {
  --bg: #06101d;
  --bg-elevated: #091827;
  --sidebar: #081725;
  --card: #0d2237;
  --card-light: #102a43;
  --primary: #25a7f0;
  --primary-light: #72c9fb;
  --primary-soft: rgba(37, 167, 240, .13);
  --text: #edf7ff;
  --text-soft: #b5c8d8;
  --muted: #748ca2;
  --border: rgba(145, 184, 216, .13);
  --success: #3adba2;
  --warning: #f3bc61;
  --danger: #ff7188;
  --purple: #b38cff;
  --sidebar-width: 258px;
  --topbar-height: 82px;
  --radius: 14px;
  --transition: 220ms cubic-bezier(.2, .8, .2, 1);

  /* 全局字体尺寸变量：集中管理页面层级和业务数据字号 */
  --font-base: 15px;
  --font-title: clamp(24px, 2.4vw, 28px);
  --font-module-title: clamp(18px, 1.7vw, 20px);
  --font-card-value: clamp(32px, 3vw, 36px);
  --font-description: 14px;
  --font-table-head: 14px;
  --font-table: 15px;
  --font-important: 16px;
  --font-nav: 16px;
  --font-button: 15px;
  --font-status: 14px;
}

/* 基础重置与页面背景 */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; color: var(--text); background: radial-gradient(circle at 88% 0, rgba(37,167,240,.1), transparent 26%), var(--bg); font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif; font-size: var(--font-base); line-height: 1.55; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button { color: inherit; font: inherit; }
input, select, textarea { font-family: inherit; }
button:focus-visible, .table-wrap:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

/* ==============================
 * AURELIA侧栏品牌Logo
 * 使用透明PNG替换文字图标，并保持42px固定尺寸及深海蓝视觉协调
 * ============================== */
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; display: flex; width: var(--sidebar-width); padding: 25px 18px; flex-direction: column; background: linear-gradient(180deg, #0a1d30, var(--sidebar)); border-right: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 9px 28px; border-bottom: 1px solid var(--border); }
.brand-mark { display: block; width: 42px; height: 42px; flex: 0 0 42px; object-fit: contain; filter: drop-shadow(0 6px 12px rgba(209,169,84,.24)); }
.brand strong { display: block; letter-spacing: 2.2px; }
.brand small, .system-status small, .admin-profile small, td small, .load-card small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; letter-spacing: .7px; }
.side-nav { display: grid; gap: 7px; margin-top: 25px; }
.nav-item { display: flex; width: 100%; padding: 13px 14px; align-items: center; gap: 13px; color: #8ea4b9; background: transparent; border: 1px solid transparent; border-radius: 9px; cursor: pointer; text-align: left; transition: var(--transition); }
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.04); transform: translateX(3px); }
.nav-item.active { color: #fff; background: var(--primary-soft); border-color: rgba(37,167,240,.2); }
.nav-icon { display: inline-grid; width: 23px; place-items: center; color: var(--primary); }
.system-status { display: flex; margin-top: auto; padding: 15px 13px; align-items: center; gap: 11px; background: rgba(58,219,162,.05); border: 1px solid rgba(58,219,162,.13); border-radius: 10px; font-size: 12px; }

/* 状态点与呼吸动画 */
.status-dot { display: inline-block; width: 8px; height: 8px; flex: none; background: var(--success); border-radius: 50%; box-shadow: 0 0 0 5px rgba(58,219,162,.1); }
.pulse { animation: breathe 2s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 4px rgba(58,219,162,.08); opacity: .8; } 50% { box-shadow: 0 0 0 8px rgba(58,219,162,.02), 0 0 13px rgba(58,219,162,.65); opacity: 1; } }

/* 顶栏与主内容容器 */
.app-shell { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; height: var(--topbar-height); padding: 0 34px; align-items: center; justify-content: space-between; background: rgba(6,16,29,.88); border-bottom: 1px solid var(--border); backdrop-filter: blur(18px); }
.topbar h1 { margin: 3px 0 0; font-size: 19px; letter-spacing: 1px; }
.eyebrow, .section-kicker { margin: 0; color: var(--primary); font-size: 9px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.icon-button, .menu-toggle { position: relative; border: 0; background: transparent; cursor: pointer; }
.notification-dot { position: absolute; top: 1px; right: 0; width: 6px; height: 6px; background: var(--primary); border-radius: 50%; }
.admin-profile { display: flex; padding-left: 17px; align-items: center; gap: 10px; border-left: 1px solid var(--border); font-size: 12px; }
.admin-profile > span, .agent-avatar { display: inline-grid; place-items: center; background: linear-gradient(145deg, #174a70, #102a43); border: 1px solid rgba(37,167,240,.24); border-radius: 50%; }
.admin-profile > span { width: 36px; height: 36px; color: var(--primary-light); font-size: 11px; font-weight: 700; }
.menu-toggle { display: none; font-size: 22px; }

/* 顶部实时状态带 */
.realtime-bar { position: relative; z-index: 10; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); min-height: 48px; padding: 0 34px; align-items: center; background: rgba(10,27,44,.72); border-bottom: 1px solid var(--border); }
.realtime-item { display: flex; min-height: 25px; padding: 0 20px; align-items: center; justify-content: center; gap: 9px; color: var(--text-soft); border-right: 1px solid var(--border); font-size: 11px; white-space: nowrap; }
.realtime-item:first-child { padding-left: 0; }
.realtime-item:last-child { padding-right: 0; border-right: 0; }
.realtime-item strong { color: var(--text); }
.realtime-icon { color: var(--primary); font-size: 9px; }
.sync-icon { color: var(--warning); filter: drop-shadow(0 0 5px rgba(243,188,97,.45)); }
.main-content { max-width: 1600px; margin: 0 auto; padding: 31px 34px 45px; }
.welcome-row { display: flex; margin-bottom: 25px; align-items: flex-end; justify-content: space-between; }
.welcome-row h2 { margin: 7px 0; font-size: clamp(24px, 3vw, 31px); font-weight: 600; }
.welcome-row > div > p:last-child { margin: 0; color: var(--muted); font-size: 13px; }
.live-badge, .panel-note { display: flex; padding: 9px 13px; align-items: center; gap: 9px; color: var(--text-soft); background: rgba(16,42,67,.7); border: 1px solid var(--border); border-radius: 20px; font-size: 10px; }

/* 核心数据卡片及悬浮反馈 */
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 21px; }
.stat-card { position: relative; display: flex; min-height: 135px; padding: 22px; align-items: center; gap: 17px; overflow: hidden; background: linear-gradient(145deg, var(--card-light), #0b1d30); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,.12); transition: var(--transition); }
.stat-card::after { content: ""; position: absolute; right: -28px; bottom: -48px; width: 105px; height: 105px; background: var(--primary-soft); border-radius: 50%; filter: blur(4px); transition: var(--transition); }
.stat-card:hover { border-color: rgba(37,167,240,.34); box-shadow: 0 18px 40px rgba(0,0,0,.2), 0 0 0 1px rgba(37,167,240,.05); transform: translateY(-5px); }
.stat-card:hover::after { transform: scale(1.2); }
.stat-icon { display: grid; width: 45px; height: 45px; flex: none; place-items: center; color: var(--primary-light); background: var(--primary-soft); border: 1px solid rgba(37,167,240,.19); border-radius: 11px; font-size: 15px; font-weight: 700; }
.stat-copy { position: relative; z-index: 1; }
.stat-copy p { margin: 0 0 9px; color: #8da3b7; font-size: 12px; }
.stat-copy strong { display: block; margin-bottom: 8px; font-size: 27px; font-weight: 600; font-variant-numeric: tabular-nums; background: linear-gradient(90deg, #fff, var(--primary-light)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-copy strong small { color: var(--muted); font-size: 13px; -webkit-text-fill-color: var(--muted); }
.trend { font-size: 10px; }
.trend.up { color: var(--success); }
.trend.warning-text { color: var(--warning); }
.trend.normal-text { color: var(--primary-light); }

/*
 * WhatsApp 分配策略设置样式
 * 以深海蓝选择卡片展示权重和轮询两种自动分配模式
 */
.distribution-mode-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 18px 20px; }
.distribution-mode-card { position: relative; display: flex; min-height: 78px; padding: 15px 48px 15px 15px; align-items: center; gap: 13px; color: var(--text-soft); background: rgba(4,16,28,.48); border: 1px solid var(--border); border-radius: 11px; cursor: pointer; transition: var(--transition); }
.distribution-mode-card:hover { border-color: rgba(37,167,240,.3); background: rgba(13,42,66,.72); transform: translateY(-2px); }
.distribution-mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.distribution-mode-card > span:nth-of-type(2) { min-width: 0; }
.distribution-mode-card strong { display: block; color: var(--text); font-size: 15px; font-weight: 700; }
.distribution-mode-card small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.distribution-mode-icon { display: grid; width: 42px; height: 42px; flex: none; place-items: center; color: var(--primary-light); background: var(--primary-soft); border: 1px solid rgba(37,167,240,.2); border-radius: 10px; font-size: 17px; font-weight: 700; }
.distribution-mode-card i { position: absolute; right: 18px; width: 13px; height: 13px; border: 2px solid #476177; border-radius: 50%; transition: var(--transition); }
.distribution-mode-card:has(input:checked) { color: var(--text); background: linear-gradient(145deg, rgba(37,167,240,.14), rgba(9,29,47,.72)); border-color: rgba(37,167,240,.42); box-shadow: inset 0 0 22px rgba(37,167,240,.04); }
.distribution-mode-card:has(input:checked) i { border-color: var(--primary); box-shadow: inset 0 0 0 3px #0b2237; background: var(--primary); }

/* 国家路由配置管理：表单和列表独立于分配算法 */
.country-route-form { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) auto; padding: 18px 20px; align-items: end; gap: 14px; border-bottom: 1px solid var(--border); }
.country-route-form-actions { display: flex; min-height: 43px; align-items: center; gap: 9px; }
.country-route-table { min-width: 620px; }
.country-route-table td:last-child { width: 180px; }
.route-mode-label { display: inline-flex; padding: 5px 9px; color: var(--primary-light); background: var(--primary-soft); border-radius: 15px; font-size: 11px; }

/* ==============================
 * 页面模块隔离
 * 所有后台页面默认隐藏，仅 active 页面显示
 * ============================== */
.page { display: none; }
.page.active { display: block; animation: pageEnter 280ms ease-out both; }
@keyframes pageEnter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* 通用面板、按钮与表格 */
.panel { margin-bottom: 21px; overflow: hidden; background: linear-gradient(145deg, var(--card), #0b1d30); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 14px 34px rgba(0,0,0,.13); transition: border-color var(--transition), box-shadow var(--transition); }
.panel:hover { border-color: rgba(145,184,216,.2); box-shadow: 0 18px 42px rgba(0,0,0,.16); }
.panel-header { display: flex; min-height: 78px; padding: 17px 21px; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--border); }
.panel-header h3 { margin: 6px 0 0; font-size: 16px; font-weight: 600; }
.account-header-actions { display: flex; align-items: center; gap: 10px; }
.account-header-actions button:disabled { opacity: .62; cursor: wait; transform: none; }
.primary-button, .outline-button { min-height: 36px; padding: 9px 15px; border-radius: 8px; cursor: pointer; font-size: 11px; transition: var(--transition); }
.primary-button { background: var(--primary); border: 1px solid var(--primary); box-shadow: 0 6px 18px rgba(37,167,240,.18); }
.primary-button:hover { background: #46b8f8; box-shadow: 0 9px 24px rgba(37,167,240,.28); transform: translateY(-2px); }
.outline-button { color: var(--text-soft); background: transparent; border: 1px solid var(--border); }
.outline-button:hover { color: var(--primary-light); border-color: var(--primary); transform: translateY(-1px); }
.table-wrap { width: 100%; overflow-x: auto; scrollbar-color: #245477 #0a1a2b; scrollbar-width: thin; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.customer-table { min-width: 1180px; }

/* ==============================
 * 仪表盘广告效果分析
 * 展示广告漏斗指标与四类业务维度统计
 * ============================== */
.advertising-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; padding: 18px 20px 20px; }
.advertising-metrics article { min-height: 92px; padding: 15px; background: rgba(4,16,28,.5); border: 1px solid var(--border); border-radius: 10px; }
.advertising-metrics span { display: block; color: var(--muted); font-size: 11px; }
.advertising-metrics strong { display: block; margin-top: 10px; color: var(--primary-light); font-size: 25px; line-height: 1; }
.advertising-analysis-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.advertising-analysis-card { min-width: 0; }
.advertising-analysis-table { min-width: 520px; }
.advertising-analysis-table th:not(:first-child), .advertising-analysis-table td:not(:first-child) { text-align: center; }
.advertising-analysis-table td:first-child { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.performance-converted { display: inline-grid; min-width: 30px; height: 26px; place-items: center; color: var(--success); background: rgba(58,219,162,.09); border-radius: 13px; font-weight: 700; }
.account-table { min-width: 1180px; }
th { padding: 12px 21px; color: #6f879d; background: rgba(4,13,23,.34); font-size: 9px; font-weight: 600; letter-spacing: 1px; text-align: left; text-transform: uppercase; }
td { padding: 16px 21px; color: var(--text-soft); border-top: 1px solid rgba(145,184,216,.07); font-size: 11px; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: rgba(37,167,240,.045); }
td strong { color: var(--text); font-size: 11px; font-weight: 600; }
.weight { display: inline-grid; min-width: 32px; height: 24px; place-items: center; color: var(--primary-light); background: var(--primary-soft); border-radius: 5px; font-weight: 700; }
.customer-load-count { color: var(--primary-light); font-size: 15px; font-weight: 700; }
.badge, .source, .customer-status { display: inline-flex; padding: 5px 9px; align-items: center; gap: 6px; border-radius: 15px; font-size: 10px; }
.badge::before, .customer-status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; }
.badge.online { color: var(--success); background: rgba(58,219,162,.09); }
.badge.online::before, .customer-status.won::before { background: var(--success); }
.badge.offline, .customer-status.closed { color: var(--danger); background: rgba(255,113,136,.09); }
.badge.offline::before, .customer-status.closed::before { background: var(--danger); }
.source.facebook { color: #70b5ff; background: rgba(63,135,255,.12); }
.source.instagram { color: #ef8cff; background: rgba(215,81,255,.11); }
.source.google { color: #ffd36a; background: rgba(255,190,67,.11); }
.source.direct { color: #a9bdce; background: rgba(169,189,206,.1); }
.customer-status.new { color: var(--primary-light); background: var(--primary-soft); }
.customer-status.new::before { background: var(--primary); }
.customer-status.following { color: var(--warning); background: rgba(243,188,97,.1); }
.customer-status.following::before { background: var(--warning); }
.customer-status.won { color: var(--success); background: rgba(58,219,162,.09); }
.text-button { padding: 7px 0; color: var(--primary-light); background: transparent; border: 0; cursor: pointer; font-size: 11px; }
.text-button:hover { text-decoration: underline; }
.action-group { display: flex; align-items: center; gap: 12px; }
.action-button { padding: 5px 0; color: var(--primary-light); background: transparent; border: 0; cursor: pointer; font-size: 10px; transition: color var(--transition); }
.action-button:hover { color: #fff; }
.action-button.delete { color: var(--danger); }
.action-button.status { color: var(--success); }
.action-button.status.to-online { color: var(--warning); }
.empty-row td { height: 118px; color: var(--muted); text-align: center; }
.agent-avatar { width: 25px; height: 25px; margin-right: 7px; color: #b9e6ff; font-size: 9px; vertical-align: middle; }

/*
 * 客户管理统计和工具栏样式
 * 保持 Dashboard 深海蓝卡片风格，并管理搜索与状态筛选控件
 */
.customer-page-heading { margin-bottom: 25px; }
.customer-data-source-badge { white-space: nowrap; }
.customer-data-source-badge.fallback { color: var(--warning); border-color: rgba(243,188,97,.35); }
.customer-data-source-badge.fallback .status-dot { background: var(--warning); }
.customer-stats-grid .stat-card { min-height: 126px; }
.customer-toolbar { min-height: 86px; align-items: flex-start; flex-direction: column; }
.customer-filters { display: flex; width: 100%; align-items: center; flex-wrap: wrap; gap: 10px; }
.search-field { display: flex; width: min(300px, 32vw); height: 38px; padding: 0 12px; align-items: center; gap: 8px; color: var(--muted); background: rgba(4,16,28,.6); border: 1px solid var(--border); border-radius: 8px; transition: var(--transition); }
.search-field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,167,240,.08); }
.search-field input { width: 100%; color: var(--text); background: transparent; border: 0; outline: 0; font-size: 11px; }
.search-field input::placeholder { color: #526a80; }
.filter-field select { height: 38px; padding: 0 32px 0 12px; color: var(--text-soft); background: #091c2e; border: 1px solid var(--border); border-radius: 8px; outline: 0; cursor: pointer; font-size: 11px; }
.customer-filters .filter-field select { min-width: 132px; max-width: 210px; }
.customer-filter-reset { margin-left: auto; }
.filter-field select:focus { border-color: var(--primary); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ==============================
 * 统一搜索下拉组件
 * 深海蓝筛选触发器、固定搜索框和可滚动选项列表
 * ============================== */
.customer-management-panel { overflow: visible; }
.search-dropdown { position: relative; min-width: 142px; }
.search-dropdown-trigger { display: flex; width: 100%; height: 38px; padding: 0 11px 0 12px; align-items: center; justify-content: space-between; gap: 12px; overflow: hidden; color: var(--text-soft); background: #091c2e; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 11px; transition: var(--transition); }
.search-dropdown-trigger span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-dropdown-trigger i { color: var(--muted); font-size: 13px; font-style: normal; transition: transform var(--transition); }
.search-dropdown.open .search-dropdown-trigger { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,167,240,.08); }
.search-dropdown.open .search-dropdown-trigger i { transform: rotate(180deg); }
.search-dropdown-panel { position: absolute; top: calc(100% + 7px); left: 0; z-index: 45; width: max(230px, 100%); overflow: hidden; background: linear-gradient(145deg, #102a43, #091b2d); border: 1px solid rgba(114,201,251,.24); border-radius: 10px; box-shadow: 0 18px 45px rgba(0,0,0,.48); }
.search-dropdown-panel[hidden] { display: none; }
.search-dropdown-search { position: sticky; top: 0; z-index: 2; display: flex; height: 44px; padding: 0 11px; align-items: center; gap: 8px; color: var(--muted); background: #102a43; border-bottom: 1px solid var(--border); }
.search-dropdown-search input { width: 100%; color: var(--text); background: transparent; border: 0; outline: 0; font-size: 11px; }
.search-dropdown-search input::placeholder { color: #678197; }
.search-dropdown-options { max-height: 230px; padding: 6px; overflow-y: auto; scrollbar-color: #245477 #0a1a2b; scrollbar-width: thin; }
.search-dropdown-options button { display: flex; width: 100%; min-height: 36px; padding: 8px 9px; align-items: center; justify-content: space-between; gap: 12px; color: var(--text-soft); background: transparent; border: 0; border-radius: 7px; cursor: pointer; text-align: left; font-size: 11px; }
.search-dropdown-options button:hover, .search-dropdown-options button:focus-visible { color: #fff; background: rgba(37,167,240,.12); outline: 0; }
.search-dropdown-options button small { color: var(--muted); font-size: 9px; }
.search-dropdown-empty { padding: 18px 10px; color: var(--muted); text-align: center; font-size: 10px; }

/*
 * 客户管理表格样式
 * 控制完整客户字段、来源标签、分配账号和可编辑状态控件
 */
.customer-management-table { min-width: 1680px; }
.customer-country-code { display: inline-flex; min-width: 42px; padding: 5px 9px; justify-content: center; color: var(--primary-light); background: rgba(37,167,240,.09); border: 1px solid rgba(37,167,240,.2); border-radius: 14px; font-weight: 700; }

/*
 * 客户列表阅读增强样式
 * 放大表头与数据字体，提高行高，并突出客户 ID 和客户姓名
 */
.customer-management-table th { font-size: 14px; }
.customer-management-table td { height: 65px; font-size: 15px; }
.customer-management-table td:nth-child(2) strong { font-size: 16px; font-weight: 700; }
.customer-id { color: var(--primary-light); font-size: 16px; font-weight: 700; letter-spacing: .4px; }
.assigned-account { display: inline-flex; align-items: center; gap: 7px; color: var(--text-soft); }
.assigned-account::before { content: "W"; display: inline-grid; width: 21px; height: 21px; place-items: center; color: var(--success); background: rgba(58,219,162,.09); border-radius: 50%; font-size: 8px; font-weight: 800; }
.customer-state-select { height: 30px; min-width: 84px; padding: 0 24px 0 9px; color: var(--state-color, var(--text-soft)); background: rgba(4,16,28,.62); border: 1px solid currentColor; border-radius: 15px; outline: 0; cursor: pointer; font-size: 10px; }
.customer-state-select.status-new { --state-color: var(--primary-light); }
.customer-state-select.status-contacted { --state-color: #8ebcff; }
.customer-state-select.status-interested { --state-color: var(--warning); }
.customer-state-select.status-quoted { --state-color: var(--purple); }
.customer-state-select.status-negotiating { --state-color: #ffad73; }
.customer-state-select.status-paid { --state-color: #72e6bb; }
.customer-state-select.status-completed { --state-color: var(--success); }
.customer-state-select.status-lost { --state-color: var(--danger); }
.customer-list-footer { display: flex; min-height: 49px; padding: 0 21px; align-items: center; justify-content: space-between; color: var(--muted); border-top: 1px solid var(--border); font-size: 10px; }
.customer-list-footer span:first-child { color: var(--text-soft); }

/* ==============================
 * D1客户列表分页
 * 展示页码、每页数量及上一页下一页操作
 * ============================== */
.customer-pagination { display: flex; min-height: 48px; align-items: center; gap: 9px; }
.customer-pagination .outline-button { min-width: 66px; min-height: 32px; padding: 6px 10px; }
.customer-pagination > span { min-width: 76px; color: var(--text-soft); text-align: center; }
.customer-pagination label { display: flex; align-items: center; gap: 6px; }
.customer-pagination select { height: 32px; padding: 0 26px 0 9px; color: var(--text-soft); color-scheme: dark; background: #091c2e; border: 1px solid var(--border); border-radius: 7px; outline: 0; }
.customer-pagination button:disabled, .customer-pagination select:disabled { opacity: .45; cursor: not-allowed; }
.customer-pagination.local-mode { opacity: .72; }

/*
 * 客户详情记录分页
 * 复用深海蓝分页组件，并为分配记录与操作记录保持紧凑的详情布局
 */
.customer-detail-list-footer { min-height: 44px; margin-top: 2px; padding: 10px 0 0; gap: 12px; }
.customer-detail-pagination { min-height: 36px; }
.customer-care-error { color: #ff9aae !important; border-color: rgba(255, 113, 136, .35) !important; }

/* ==============================
 * 广告素材列表分页
 * 复用后台深海蓝分页控件并保持总数、页码和数据来源清晰排列
 * ============================== */
.ad-creative-list-footer { gap: 18px; }
.ad-creative-pagination { margin-left: auto; }
.ad-creative-list-footer > span:last-child { white-space: nowrap; }

/* WhatsApp账号分页：复用深海蓝分页组件并保持账号总数与控件横向排列。 */
.whatsapp-account-list-footer { gap: 18px; }
.whatsapp-account-pagination { margin-left: auto; }

/* 数据统计独立分页与系统设置分页：统一复用深海蓝后台分页布局。 */
.report-table-pagination { padding: 8px 14px; gap: 12px; background: rgba(4,16,28,.26); }
.report-table-pagination .customer-pagination, .settings-pagination-controls { margin-left: auto; }
.settings-list-footer { margin-top: 16px; gap: 18px; background: rgba(4,16,28,.35); border: 1px solid var(--border); border-radius: 10px; }

/*
 * 分配记录页面样式
 * 保持深海蓝业务后台视觉，并管理统计、筛选和完整分配历史表格
 */
.assignment-page-heading { margin-bottom: 25px; }
.assignment-stats-grid .stat-card { min-height: 126px; }
.assignment-toolbar { min-height: 86px; }
.assignment-filters { display: flex; align-items: center; gap: 10px; }
.assignment-records-table { min-width: 1420px; }
.assignment-records-table th:first-child { width: 185px; }
.assignment-records-table td { vertical-align: middle; }
.assignment-customer-id { color: var(--primary-light); font-weight: 700; }
.assignment-account { color: var(--text); font-weight: 700; }
.assignment-origin { color: var(--muted); }

/*
 * 分配方式和结果标签
 * 使用不同强调色区分自动权重、轮询、人工转移和管理员指定
 */
.assignment-method, .assignment-result { display: inline-flex; min-height: 30px; padding: 5px 10px; align-items: center; border: 1px solid currentColor; border-radius: 15px; font-size: 13px; font-weight: 600; }
.assignment-method.auto-weight { color: var(--success); background: rgba(58,219,162,.08); }
.assignment-method.round-robin { color: var(--primary-light); background: rgba(37,167,240,.09); }
.assignment-method.country-route { color: var(--purple); background: rgba(179,140,255,.09); }
.assignment-method.manual-transfer { color: var(--warning); background: rgba(243,188,97,.09); }
.assignment-method.manual-assign { color: var(--purple); background: rgba(179,140,255,.09); }
.assignment-result.success { color: var(--success); background: rgba(58,219,162,.08); }
.assignment-result.failed { color: var(--danger); background: rgba(255,113,136,.08); }

/*
 * 操作日志页面样式
 * 保持深海蓝审计后台视觉，并管理统计卡片、搜索筛选和日志表格
 */
.activity-log-heading { margin-bottom: 25px; }
.activity-log-stats .stat-card { min-height: 126px; }
.activity-log-toolbar { min-height: 86px; }
.activity-log-filters { display: flex; align-items: center; gap: 10px; }
.activity-log-table { min-width: 980px; }
.activity-log-table th:first-child { width: 190px; }
.activity-log-table th:nth-child(2) { width: 150px; }
.activity-log-table th:nth-child(3) { width: 190px; }
.activity-log-table th:nth-child(4) { width: 190px; }
.activity-log-table td:last-child { min-width: 300px; color: var(--text-soft); white-space: normal; }

/*
 * 操作日志类型标签
 * 使用不同强调色区分客户、账号和系统操作
 */
.activity-type { display: inline-flex; min-height: 30px; padding: 5px 10px; align-items: center; border: 1px solid currentColor; border-radius: 15px; font-size: 13px; font-weight: 600; }
.activity-type.customer { color: var(--primary-light); background: rgba(37,167,240,.09); }
.activity-type.account { color: var(--warning); background: rgba(243,188,97,.09); }
.activity-type.system { color: var(--purple); background: rgba(179,140,255,.09); }
.activity-target { color: var(--text); font-weight: 700; }
.activity-time { color: var(--muted); font-variant-numeric: tabular-nums; }

/*
 * 客户列表行交互样式
 * 提示用户可点击客户行打开详情，同时避免状态控件继承行点击效果
 */
.customer-management-table tbody tr:not(.empty-row) { cursor: pointer; }
.customer-management-table tbody tr:not(.empty-row):hover { background: rgba(37,167,240,.075); box-shadow: inset 3px 0 0 var(--primary); }
.customer-management-table .customer-state-select { cursor: pointer; }

/*
 * 客户详情弹窗样式
 * 控制详情字段、状态修改、客服转移和 WhatsApp 操作区域
 */
.customer-detail-modal { width: min(100%, 760px); }
.customer-detail-content { display: grid; gap: 14px; max-height: min(70vh, 650px); padding: 20px 22px; overflow-y: auto; }
.customer-detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; overflow: hidden; background: rgba(4,16,28,.42); border: 1px solid var(--border); border-radius: 11px; }
.customer-source-section { overflow: hidden; background: rgba(4,16,28,.3); border: 1px solid var(--border); border-radius: 11px; }
.customer-source-heading { padding: 13px 15px; border-bottom: 1px solid var(--border); }
.customer-source-heading h4 { margin: 5px 0 0; font-size: 14px; }
.customer-source-grid { border: 0; border-radius: 0; }
.detail-field { min-width: 0; padding: 15px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.detail-field:nth-child(3n) { border-right: 0; }
.detail-field dt { margin-bottom: 7px; color: var(--muted); font-size: 9px; letter-spacing: .6px; }
.detail-field dd { margin: 0; overflow: hidden; color: var(--text); font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.detail-field.wide { grid-column: span 2; }
.customer-detail-action { display: flex; min-height: 72px; padding: 13px 15px; align-items: center; justify-content: space-between; gap: 16px; background: rgba(4,16,28,.42); border: 1px solid var(--border); border-radius: 10px; }
.customer-detail-action strong { display: block; font-size: 11px; }
.customer-detail-action small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }
.detail-control-row { display: flex; align-items: center; gap: 9px; }
.detail-control-row select { min-width: 150px; height: 36px; padding: 0 30px 0 11px; color: var(--text-soft); background: #091c2e; border: 1px solid var(--border); border-radius: 8px; outline: 0; cursor: pointer; font-size: 10px; }
.detail-control-row select:focus { border-color: var(--primary); }
.customer-detail-footer { display: flex; min-height: 68px; padding: 14px 22px; align-items: center; justify-content: space-between; gap: 15px; border-top: 1px solid var(--border); }
.customer-detail-footer > span { color: var(--muted); font-size: 9px; }
.customer-detail-source { display: block; margin-top: 6px; color: var(--primary-light); font-size: 9px; }
.customer-detail-source.fallback { color: var(--warning); }
.customer-detail-loading { grid-column: 1 / -1; padding: 28px 16px; color: var(--muted); text-align: center; font-size: 11px; }

/* ==============================
 * 广告素材CRUD管理中心
 * 管理列表操作、详情字段、编辑预览和客户归因视频播放器
 * ============================== */
.ad-creative-heading { margin-bottom: 25px; }
.ad-creative-table { min-width: 1320px; }
.ad-creative-table td { vertical-align: middle; }
.ad-creative-table td:first-child strong { color: var(--text); font-size: 14px; }
.action-buttons { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.table-action { min-height: 30px; padding: 5px 9px; color: var(--text-soft); background: rgba(7, 29, 48, .82); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font-size: 10px; }
.table-action:hover { color: #fff; border-color: var(--primary); }
.table-action.view { color: var(--primary-light); }
.table-action.delete { color: #ff9b9b; }
.creative-id { color: var(--primary-light); font-weight: 700; }
.creative-video-link { color: var(--success); text-decoration: none; font-weight: 600; }
.creative-video-link:hover { text-decoration: underline; }
.ad-creative-form-preview { width: 100%; max-height: 280px; margin-top: 12px; background: #02080e; border: 1px solid var(--border); border-radius: 9px; }
.ad-creative-detail-modal { width: min(850px, calc(100vw - 32px)); }
.ad-creative-detail-content { display: grid; gap: 16px; padding: 20px; overflow-y: auto; }
.ad-creative-preview-panel { display: grid; gap: 12px; justify-items: start; padding: 15px; background: rgba(4, 16, 28, .55); border: 1px solid var(--border); border-radius: 10px; }
.ad-creative-preview-panel video { width: 100%; max-height: 380px; background: #02080e; border-radius: 8px; }
.ad-creative-preview-panel p { width: 100%; margin: 0; padding: 22px; color: var(--muted); border: 1px dashed var(--border); border-radius: 8px; text-align: center; }
.ad-creative-preview-panel .outline-button { display: inline-flex; align-items: center; text-decoration: none; }
.ad-preview-link { color: var(--primary-light); font-weight: 600; text-decoration: none; }
.ad-preview-link:hover { text-decoration: underline; }
.ad-preview-field { grid-column: span 2; }
.customer-ad-video-section { display: grid; gap: 12px; padding: 15px; overflow: hidden; background: rgba(4,16,28,.42); border: 1px solid var(--border); border-radius: 11px; }
.customer-ad-video-player { display: block; width: 100%; max-height: 360px; background: #02080e; border: 1px solid var(--border); border-radius: 9px; }
.customer-ad-video-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; color: var(--muted); font-size: 10px; }
.customer-ad-video-meta strong { width: 100%; color: var(--text); font-size: 13px; }
.customer-ad-video-empty { padding: 22px 14px; color: var(--muted); background: rgba(9,28,46,.55); border: 1px dashed var(--border); border-radius: 8px; text-align: center; font-size: 11px; }

/* ==============================
 * 客户成交过程管理
 * 标签、备注与跟进时间线沿用 CRM 深海蓝视觉体系
 * ============================== */
.customer-care-section { display: grid; gap: 12px; padding: 15px; background: rgba(4,16,28,.42); border: 1px solid var(--border); border-radius: 11px; }
.customer-care-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.customer-care-heading h4 { margin: 5px 0 0; font-size: 14px; }
.customer-care-heading small, .customer-care-empty { color: var(--muted); font-size: 10px; }
.customer-tag-list { display: flex; min-height: 30px; align-items: center; flex-wrap: wrap; gap: 8px; }
.customer-tag { display: inline-flex; min-height: 29px; padding: 4px 6px 4px 10px; align-items: center; gap: 7px; color: var(--primary-light); background: rgba(37,167,240,.09); border: 1px solid rgba(37,167,240,.25); border-radius: 16px; font-size: 11px; font-weight: 600; }
.customer-tag button { display: grid; width: 20px; height: 20px; padding: 0; place-items: center; color: var(--muted); background: transparent; border: 0; border-radius: 50%; cursor: pointer; font-size: 16px; }
.customer-tag button:hover { color: #fff; background: rgba(255,113,136,.2); }
.customer-care-controls, .customer-care-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.customer-care-controls select { min-width: 170px; height: 38px; padding: 0 30px 0 11px; color: var(--text-soft); background: #091c2e; border: 1px solid var(--border); border-radius: 8px; outline: 0; }
.customer-care-section textarea { width: 100%; padding: 11px 13px; resize: vertical; color: var(--text); background: rgba(4,16,28,.66); border: 1px solid var(--border); border-radius: 8px; outline: 0; font: inherit; font-size: 11px; line-height: 1.65; }
.customer-care-section textarea:focus, .customer-care-controls select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,167,240,.1); }
.next-followup-action input { min-width: 205px; height: 36px; padding: 0 11px; color: var(--text-soft); color-scheme: dark; background: #091c2e; border: 1px solid var(--border); border-radius: 8px; outline: 0; }
.next-followup-action input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,167,240,.1); }
.customer-followup-timeline { display: grid; margin: 2px 0 0; padding: 0; gap: 10px; list-style: none; }
.customer-followup-timeline li { position: relative; padding: 11px 13px 11px 20px; background: rgba(9,28,46,.7); border-left: 2px solid var(--primary); border-radius: 0 8px 8px 0; }
.customer-followup-timeline li::before { content: ""; position: absolute; top: 15px; left: -5px; width: 8px; height: 8px; background: var(--primary-light); border-radius: 50%; }
.customer-followup-timeline li span, .customer-followup-timeline li small { color: var(--muted); font-size: 9px; }
.customer-followup-timeline li p { margin: 6px 0; color: var(--text-soft); font-size: 11px; line-height: 1.6; white-space: pre-wrap; }
.customer-followup-timeline li.customer-care-empty { padding-left: 13px; border-left-color: var(--border); }
.customer-followup-timeline li.customer-care-empty::before { display: none; }
.customer-followup-delete { position: absolute; top: 8px; right: 0; padding: 3px 7px; color: #ef9a9a; background: transparent; border: 1px solid rgba(239, 154, 154, .25); border-radius: 6px; cursor: pointer; }
.customer-followup-delete:hover { color: #fff; background: rgba(190, 53, 53, .3); }
.customer-activity-timeline { display: grid; margin: 0; padding: 0; gap: 8px; list-style: none; }
.customer-activity-timeline li { display: grid; grid-template-columns: minmax(120px, .65fr) minmax(80px, .5fr) minmax(100px, .6fr) minmax(180px, 2fr); gap: 10px; padding: 10px 12px; align-items: center; color: var(--text-soft); background: rgba(9,28,46,.7); border: 1px solid var(--border); border-radius: 8px; font-size: 10px; }
.customer-activity-timeline time, .customer-activity-timeline small { color: var(--muted); }
.customer-activity-type { color: var(--primary-light); font-weight: 600; }
.customer-assignment-timeline { display: grid; margin: 0; padding: 0; gap: 8px; list-style: none; }
.customer-assignment-timeline li { display: grid; grid-template-columns: minmax(125px, .7fr) minmax(100px, .8fr) 28px minmax(100px, .8fr) minmax(80px, .5fr); gap: 8px; padding: 11px 12px; align-items: center; color: var(--text-soft); background: rgba(9,28,46,.7); border: 1px solid var(--border); border-radius: 8px; font-size: 10px; }
.customer-assignment-timeline time { color: var(--muted); }
.assignment-history-arrow { color: var(--primary-light); text-align: center; }

/* 客服负载卡片和进度条 */
.load-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 20px; }
.load-card { padding: 18px; background: rgba(7,23,38,.64); border: 1px solid var(--border); border-radius: 11px; transition: var(--transition); }
.load-card:hover { background: rgba(15,43,68,.82); border-color: rgba(37,167,240,.25); transform: translateY(-3px); }
.load-card-head { display: flex; align-items: center; }
.load-card-head .agent-avatar { width: 38px; height: 38px; margin-right: 10px; font-size: 11px; }
.load-card-head strong { font-size: 12px; font-weight: 600; }
.load-card-head em { margin-left: auto; color: var(--primary-light); font-size: 18px; font-style: normal; font-weight: 600; }
.load-meta { display: flex; margin: 17px 0; justify-content: space-between; color: var(--muted); font-size: 10px; }
.load-meta b { color: var(--text-soft); font-weight: 600; }
.load-label { display: flex; margin-bottom: 8px; justify-content: space-between; color: var(--muted); font-size: 9px; }
.progress { height: 7px; overflow: hidden; background: #071523; border-radius: 9px; }
.progress span { display: block; width: var(--load); height: 100%; background: linear-gradient(90deg, #1478ba, var(--primary), var(--success)); border-radius: inherit; box-shadow: 0 0 12px rgba(37,167,240,.3); animation: growBar 1s ease-out both; }
@keyframes growBar { from { width: 0; } to { width: var(--load); } }

/* WhatsApp 账号弹窗：深海蓝玻璃面板与表单控件 */
.modal-backdrop { position: fixed; inset: 0; z-index: 80; display: grid; padding: 20px; place-items: center; visibility: hidden; opacity: 0; background: rgba(1,8,16,.78); backdrop-filter: blur(8px); transition: var(--transition); }
.modal-backdrop[hidden] { display: none !important; visibility: hidden !important; opacity: 0 !important; pointer-events: none !important; }
.modal-backdrop.show { visibility: visible; opacity: 1; }
.modal-backdrop.show[aria-hidden="false"] { pointer-events: auto; }
.account-modal { width: min(100%, 680px); max-height: calc(100vh - 40px); overflow-y: auto; background: linear-gradient(145deg, #102a43, #091b2d); border: 1px solid rgba(114,201,251,.2); border-radius: 16px; box-shadow: 0 28px 80px rgba(0,0,0,.55), 0 0 35px rgba(37,167,240,.08); transform: translateY(18px) scale(.98); transition: var(--transition); }
.account-modal[hidden] { display: none !important; }
.modal-backdrop.show .account-modal { transform: translateY(0) scale(1); }
.modal-header { display: flex; min-height: 78px; padding: 18px 22px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 6px 0 0; font-size: 17px; }
.modal-close { display: grid; width: 36px; height: 36px; place-items: center; color: var(--muted); background: rgba(255,255,255,.03); border: 1px solid var(--border); border-radius: 9px; cursor: pointer; font-size: 22px; transition: var(--transition); }
.modal-close:hover { color: #fff; border-color: rgba(37,167,240,.35); transform: rotate(4deg); }
.account-form { display: grid; gap: 17px; padding: 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-field { display: grid; gap: 8px; color: var(--text-soft); font-size: 11px; }
.form-field input, .form-field select { width: 100%; height: 43px; padding: 0 13px; color: var(--text); background: rgba(4,16,28,.66); border: 1px solid var(--border); border-radius: 8px; outline: 0; transition: var(--transition); }
.form-field input::placeholder { color: #50677c; }
.form-field input:focus, .form-field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,167,240,.1); }
.form-field select { color-scheme: dark; cursor: pointer; }
.status-options { display: flex; margin: 0; padding: 0; gap: 10px; border: 0; }
.status-options legend { margin-bottom: 8px; color: var(--text-soft); font-size: 11px; }
.status-options label { flex: 1; cursor: pointer; }
.status-options input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card { display: flex; height: 42px; align-items: center; justify-content: center; gap: 8px; color: var(--muted); background: rgba(4,16,28,.5); border: 1px solid var(--border); border-radius: 8px; font-size: 11px; transition: var(--transition); }
.radio-card i { width: 7px; height: 7px; background: currentColor; border-radius: 50%; }
.status-options input:checked + .online-option { color: var(--success); background: rgba(58,219,162,.08); border-color: rgba(58,219,162,.35); }
.status-options input:checked + .offline-option { color: var(--danger); background: rgba(255,113,136,.08); border-color: rgba(255,113,136,.35); }
.modal-actions { display: flex; margin-top: 4px; justify-content: flex-end; gap: 10px; }
.modal-actions button { min-width: 88px; }

/*
 * 统一 Toast 提示样式
 * 支持普通、成功和错误状态，并允许多行展示业务结果
 */
.toast { position: fixed; right: 25px; bottom: 25px; z-index: 100; min-width: 260px; max-width: min(390px, calc(100vw - 30px)); padding: 14px 18px; opacity: 0; color: #dff4ff; background: #123451; border: 1px solid rgba(37,167,240,.3); border-radius: 10px; box-shadow: 0 16px 38px rgba(0,0,0,.38); pointer-events: none; transform: translateY(12px); transition: var(--transition); font-size: 14px; font-weight: 600; line-height: 1.65; white-space: pre-line; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.toast-success { color: #dffff3; background: linear-gradient(145deg, #103b38, #0d2a31); border-color: rgba(58,219,162,.45); }
.toast.toast-error { color: #ffe4e9; background: linear-gradient(145deg, #452132, #271b2a); border-color: rgba(255,113,136,.48); }
.toast.toast-info { color: #dff4ff; background: #123451; border-color: rgba(37,167,240,.3); }

/* 详情操作按钮处理中状态：禁止重复点击并提供明确视觉反馈 */
.customer-detail-action button:disabled { opacity: .68; cursor: not-allowed; transform: none; }
.customer-detail-action button[aria-busy="true"] { color: var(--primary-light); border-color: rgba(37,167,240,.42); box-shadow: inset 0 0 14px rgba(37,167,240,.08); }
.sidebar-overlay { display: none; }

/*
 * AURELIA CRM 全局字体系统
 * 统一中英文显示层级，提升标题、数据、表格和操作控件的商务后台可读性
 */

/* 页面主标题：覆盖顶部页面名称和各页面内容标题 */
.topbar h1,
.welcome-row h2 { font-size: var(--font-title); font-weight: 700; line-height: 1.25; letter-spacing: .2px; }

/* 模块标题：统一面板、弹窗和客户列表标题的视觉层级 */
.panel-header h3,
.modal-header h3 { font-size: var(--font-module-title); font-weight: 700; line-height: 1.3; }

/* 左侧导航：增大菜单字体并加强当前业务入口的辨识度 */
.nav-item { font-size: var(--font-nav); font-weight: 500; }
.nav-item.active { font-weight: 600; }

/* 统计卡片：放大核心数字，同时提高名称和趋势说明的可读性 */
.stat-copy p { font-size: var(--font-description); line-height: 1.45; }
.stat-copy strong { font-size: var(--font-card-value); font-weight: 700; line-height: 1.15; }
.stat-copy strong small { font-size: var(--font-description); }
.trend { font-size: var(--font-description); font-weight: 500; }

/* 说明文字：统一页面介绍、实时状态和辅助信息字号 */
.welcome-row > div > p:last-child,
.live-badge,
.panel-note,
.realtime-item { font-size: var(--font-description); }

/* 全局表格：统一表头、数据和重要字段的字号及字重 */
th { font-size: var(--font-table-head); font-weight: 700; line-height: 1.4; }
td { font-size: var(--font-table); line-height: 1.5; }
td strong,
.customer-id,
.customer-management-table td:nth-child(2) strong { font-size: var(--font-important); font-weight: 700; }

/* 按钮文字：覆盖主要操作、次要操作和表格内操作按钮 */
.primary-button,
.outline-button,
.text-button,
.action-button { font-size: var(--font-button); font-weight: 600; }

/* 状态与来源标签：统一在线、离线、客户状态和渠道标签字号 */
.badge,
.source,
.customer-status,
.customer-management-table .customer-state-select { font-size: var(--font-status); font-weight: 600; }

/* 客户详情操作：保持详情页字段和操作控件与全局字体系统一致 */
.detail-field dt,
.customer-detail-action small,
.customer-detail-footer > span { font-size: 12px; }
.detail-field dd,
.customer-detail-action strong,
.detail-control-row select { font-size: var(--font-description); }

/* 中等屏幕：数据卡片换为两列，状态栏允许换行 */
@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .realtime-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 7px 34px; }
  .realtime-item:nth-child(2) { border-right: 0; }
  .load-grid { grid-template-columns: 1fr 1fr; }
  .advertising-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* 手机和平板：侧栏抽屉、按钮和内容间距适配 */
/* ==============================
   历史数据迁移
   深海蓝系统设置面板与迁移结果展示
============================== */
.migration-header { align-items: flex-start; gap: 20px; }
.migration-actions { display: flex; gap: 10px; }
.migration-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 20px; border-top: 1px solid var(--border); }
.migration-stat { padding: 18px; border: 1px solid var(--border); border-radius: 12px; background: rgba(8, 30, 49, .58); }
.migration-stat span { display: block; margin-bottom: 9px; color: var(--muted); font-size: 12px; }
.migration-stat strong { color: var(--text); font-size: 25px; }
.migration-result { margin: 0 20px 20px; padding: 14px 16px; border: 1px solid rgba(57, 189, 248, .18); border-radius: 10px; color: var(--muted); background: rgba(4, 20, 35, .72); line-height: 1.7; }

/* ==============================
 * Admin Token会话验证提示
 * 展示当前会话验证状态，不显示或持久化Token内容
 * ============================== */
.admin-session-banner { display: flex; min-height: 48px; margin-bottom: 18px; padding: 10px 15px; align-items: center; gap: 12px; color: var(--muted); background: rgba(7, 29, 48, .78); border: 1px solid var(--border); border-radius: 10px; }
.admin-session-banner > span { color: var(--text-soft); }
.admin-session-banner strong { color: #f0b46c; }
.admin-session-banner strong.verified { color: var(--success); }
.admin-session-banner small { margin-left: auto; color: var(--muted); }
.migration-progress { height: 8px; margin: 0 20px 10px; overflow: hidden; border-radius: 999px; background: rgba(145, 184, 216, .12); }
.migration-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #1e8ac4, #63c8ef); transition: width .25s ease; }
.migration-status-line { margin: 0 20px 12px; color: var(--muted); font-size: 12px; }
.migration-status-line strong { color: var(--text); text-transform: uppercase; }
.kv-sync-status { display: grid; min-width: 150px; gap: 3px; text-align: right; }
.kv-sync-status strong { color: var(--success); font-size: 11px; }
.kv-sync-status small { color: var(--muted); font-size: 9px; }
.kv-sync-status.syncing strong { color: var(--primary-light); }
.kv-sync-status.failed strong { color: var(--danger); }
.customer-write-mode { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.pixel-management-panel { margin-top: 20px; }
.pixel-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 20px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.pixel-default-field { display: flex; align-items: center; gap: 8px; color: var(--text-soft); font-size: 11px; }
.pixel-default-field input { accent-color: var(--primary); }
.pixel-remark-field { grid-column: span 2; }
.pixel-form-actions { display: flex; align-items: flex-end; justify-content: flex-end; gap: 9px; }
.pixel-status { display: inline-flex; padding: 4px 8px; border-radius: 12px; font-size: 9px; }
.pixel-status.active { color: var(--success); background: rgba(37, 200, 135, .1); }
.pixel-status.inactive { color: var(--muted); background: rgba(145, 184, 216, .08); }
.pixel-default { color: var(--primary-light); font-weight: 600; }

@media (max-width: 760px) {
  :root { --topbar-height: 70px; }
  body.menu-open { overflow: hidden; }
  .sidebar { width: min(82vw, 280px); transform: translateX(-102%); transition: transform var(--transition); box-shadow: 18px 0 40px rgba(0,0,0,.35); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { position: fixed; inset: 0; z-index: 25; display: block; visibility: hidden; opacity: 0; background: rgba(1,8,16,.7); transition: var(--transition); }
  .sidebar-overlay.show { visibility: visible; opacity: 1; }
  .app-shell { margin-left: 0; }
  .topbar { padding: 0 17px; }
  .menu-toggle { display: block; min-width: 42px; min-height: 42px; }
  .topbar-title { margin-right: auto; margin-left: 10px; }
  .topbar .eyebrow, .admin-profile div, .icon-button { display: none; }
  .admin-profile { padding-left: 0; border-left: 0; }
  .realtime-bar { grid-template-columns: 1fr 1fr; padding: 7px 15px; }
  .realtime-item { padding: 5px 8px; justify-content: flex-start; border-right: 0; font-size: 10px; }
  .main-content { padding: 23px 15px 32px; }
  .welcome-row { align-items: flex-start; gap: 15px; }
  .live-badge { display: none; }
  .stats-grid { gap: 11px; }
  .stat-card { min-height: 140px; padding: 16px; align-items: flex-start; flex-direction: column; gap: 12px; }
  .stat-icon { width: 38px; height: 38px; }
  .stat-copy strong { font-size: var(--font-card-value); }
  .load-grid { grid-template-columns: 1fr; padding: 14px; }
  .advertising-analysis-grid { grid-template-columns: 1fr; }
  .advertising-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px; }
  .distribution-mode-options { grid-template-columns: 1fr; padding: 14px; }
  .country-route-form { grid-template-columns: 1fr; padding: 14px; }
  .customer-toolbar { align-items: flex-start; flex-direction: column; }
  .account-header-actions { width: 100%; align-items: stretch; flex-direction: column; }
  .account-header-actions button { width: 100%; }
  .migration-header, .migration-actions { width: 100%; flex-direction: column; }
  .migration-actions button { width: 100%; }
  .admin-session-banner { align-items: flex-start; flex-direction: column; gap: 4px; }
  .admin-session-banner small { margin-left: 0; }
  .migration-stats { grid-template-columns: 1fr; padding: 14px; }
  .migration-result { margin: 0 14px 14px; }
  .migration-progress, .migration-status-line { margin-right: 14px; margin-left: 14px; }
  .pixel-form { grid-template-columns: 1fr; padding: 14px; }
  .pixel-remark-field { grid-column: auto; }
  .customer-filters { width: 100%; }
  .search-dropdown { flex: 1 1 142px; }
  .customer-filter-reset { margin-left: 0; }
  .activity-log-toolbar { align-items: flex-start; flex-direction: column; }
  .activity-log-filters { width: 100%; }
  .assignment-toolbar { align-items: flex-start; flex-direction: column; }
  .assignment-filters { width: 100%; }
  .search-field { width: 100%; }
  .panel-header { padding: 15px; }
  .primary-button, .outline-button { min-height: 42px; padding: 10px 13px; }
  th, td { padding-right: 15px; padding-left: 15px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .modal-backdrop { padding: 14px; }
  .account-modal { max-height: calc(100vh - 28px); overflow-y: auto; }
  .customer-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-field:nth-child(3n) { border-right: 1px solid var(--border); }
  .detail-field:nth-child(2n) { border-right: 0; }
}

/* 窄屏手机：卡片单列、状态区单列，确保操作按钮易于点击 */
@media (max-width: 480px) {
  .realtime-bar { grid-template-columns: 1fr; padding: 8px 15px; }
  .realtime-item { min-height: 29px; border-bottom: 1px solid rgba(145,184,216,.07); }
  .realtime-item:last-child { border-bottom: 0; }
  .stats-grid { grid-template-columns: 1fr; }
  .advertising-metrics { grid-template-columns: 1fr; }
  .stat-card { min-height: auto; flex-direction: row; align-items: center; }
  .panel-header { align-items: center; }
  .panel-header h3 { font-size: 18px; }
  .panel-note { display: none; }
  .primary-button, .outline-button { flex: none; }
  .form-grid { grid-template-columns: 1fr; }
  .account-form { padding: 18px; }
  .modal-actions button { flex: 1; }
  .customer-filters { align-items: stretch; flex-direction: column; }
  .search-dropdown, .search-dropdown-panel { width: 100%; }
  .activity-log-filters { align-items: stretch; flex-direction: column; }
  .assignment-filters { align-items: stretch; flex-direction: column; }
  .search-field, .filter-field select { width: 100%; }
  .customer-filters .filter-field select { max-width: none; }
  .customer-filter-reset { width: 100%; }
  .customer-list-footer { padding: 12px 15px; align-items: flex-start; flex-direction: column; gap: 5px; }
  .customer-pagination { width: 100%; flex-wrap: wrap; }
  .customer-pagination .outline-button { flex: 1; }
  .ad-creative-pagination { margin-left: 0; }
  .whatsapp-account-pagination { margin-left: 0; }
  .report-table-pagination .customer-pagination, .settings-pagination-controls { margin-left: 0; }
  .customer-detail-list-footer { padding: 10px 0 0; }
  .customer-detail-pagination label { margin-left: auto; }
  .customer-detail-content { padding: 15px; }
  .customer-detail-grid { grid-template-columns: 1fr; }
  .detail-field, .detail-field:nth-child(2n), .detail-field:nth-child(3n) { grid-column: auto; border-right: 0; }
  .customer-detail-action { align-items: stretch; flex-direction: column; }
  .detail-control-row { align-items: stretch; flex-direction: column; }
  .detail-control-row select, .detail-control-row button { width: 100%; }
  .customer-care-controls { align-items: stretch; flex-direction: column; }
  .customer-care-controls select, .customer-care-controls button, .customer-care-actions button { width: 100%; }
  .customer-activity-timeline li { grid-template-columns: 1fr 1fr; }
  .customer-activity-timeline p { grid-column: 1 / -1; margin: 0; }
  .customer-assignment-timeline li { grid-template-columns: 1fr auto 1fr; }
  .customer-assignment-timeline time, .customer-assignment-timeline small { grid-column: 1 / -1; }
  .customer-detail-footer { align-items: stretch; flex-direction: column; }
  .customer-detail-footer .primary-button { width: 100%; }
  .toast { right: 15px; bottom: 15px; left: 15px; text-align: center; }
}

/* 尊重系统减少动态效果设置 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/*
=================================
数据统计报表中心

功能：
- 历史报表筛选布局
- 五类统计结果展示
- 深海蓝响应式报表卡片

说明：
仅作用于数据统计页面，不改变仪表盘和其他业务模块。
=================================
*/
.report-filter-panel { margin-bottom: 18px; }
.report-range-buttons { display: flex; gap: 9px; padding: 0 22px 18px; flex-wrap: wrap; }
.report-range-button { min-height: 38px; padding: 8px 15px; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); background: rgba(5, 25, 43, .72); cursor: pointer; transition: var(--transition); }
.report-range-button:hover, .report-range-button.active { color: var(--gold); border-color: rgba(209, 169, 84, .6); background: rgba(209, 169, 84, .1); }
.report-filter-grid { display: grid; grid-template-columns: repeat(6, minmax(135px, 1fr)); gap: 12px; padding: 0 22px 18px; }
.report-filter-grid select, .report-filter-grid input { width: 100%; }
.report-filter-actions { display: flex; justify-content: flex-end; padding: 0 22px 22px; }
.report-center-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.report-panel { min-width: 0; margin: 0; }
.report-panel-wide { grid-column: 1 / -1; }
.report-panel .table-wrap { max-height: 390px; overflow: auto; }
.report-panel th { position: sticky; top: 0; z-index: 1; background: #071b2c; }
/* 销售趋势与客户来源分析：共享完全一致的面板、表格及分页尺寸。 */
.report-comparable-table-panel { display: flex; min-height: 518px; flex-direction: column; }
.report-comparable-table-panel .table-wrap { width: 100%; height: 390px; min-height: 390px; max-height: 390px; overflow: auto; border-bottom: 1px solid var(--border); }
.report-comparable-table { width: 100%; min-width: 640px; table-layout: fixed; border-collapse: collapse; font-size: var(--font-table); line-height: 1.5; }
.report-comparable-table th { height: 44px; padding: 12px 21px; font-size: var(--font-table-head); line-height: 1.4; }
.report-comparable-table td { height: 48px; padding: 12px 21px; font-size: var(--font-table); line-height: 1.5; }
.report-comparable-table-panel .report-table-pagination { min-height: 49px; margin-top: auto; border-top: 0; }
.report-empty { padding: 28px 18px !important; color: var(--muted); text-align: center; }
.report-status-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 0 22px 22px; }
.report-status-card { display: flex; min-height: 84px; padding: 16px; align-items: center; justify-content: space-between; border: 1px solid var(--border); border-radius: 10px; background: rgba(4, 22, 38, .7); }
.report-status-card span { color: var(--muted); font-size: 13px; }
.report-status-card strong { color: var(--gold); font-family: Georgia, serif; font-size: 25px; }

/*
=================================
数据统计图表分析模块

功能：
- 报表与图表Tab切换
- Chart.js响应式画布
- 核心指标和销售漏斗展示

说明：
保持AURELIA深海蓝后台视觉风格。
=================================
*/
.report-view-tabs { display: inline-flex; gap: 5px; margin-bottom: 18px; padding: 5px; border: 1px solid var(--border); border-radius: 11px; background: rgba(3, 18, 31, .72); }
.report-view-tab { min-width: 112px; min-height: 40px; padding: 9px 17px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; transition: var(--transition); }
.report-view-tab:hover, .report-view-tab.active { color: #07131e; background: linear-gradient(135deg, #e0bd70, #b98b37); box-shadow: 0 8px 22px rgba(209, 169, 84, .15); }
.report-chart-tab-panel[hidden], #reportDataTabPanel[hidden] { display: none; }
.report-chart-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.report-chart-metrics article { display: flex; min-height: 105px; padding: 19px; flex-direction: column; justify-content: space-between; border: 1px solid var(--border); border-radius: 12px; background: linear-gradient(145deg, rgba(10, 39, 62, .92), rgba(4, 22, 38, .94)); }
.report-chart-metrics span { color: var(--muted); font-size: 13px; }
.report-chart-metrics strong { color: var(--gold); font-family: Georgia, serif; font-size: 29px; }
.report-chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.report-chart-card { min-width: 0; margin: 0; }
.report-chart-wide { grid-column: 1 / -1; }
.report-chart-canvas { position: relative; height: 330px; padding: 0 20px 20px; }
.report-chart-wide .report-chart-canvas { height: 380px; }
.report-chart-empty { display: grid; height: 100%; margin: 0; place-items: center; color: var(--muted); text-align: center; }
.report-funnel { display: flex; min-height: 330px; padding: 0 20px 20px; align-items: center; flex-direction: column; justify-content: center; gap: 8px; }
.report-funnel-stage { display: grid; min-height: 49px; padding: 9px 15px; grid-template-columns: 1fr auto auto; align-items: center; gap: 14px; border: 1px solid rgba(209, 169, 84, .25); border-radius: 8px; background: linear-gradient(90deg, rgba(209, 169, 84, .22), rgba(48, 104, 138, .25)); transition: var(--transition); }
.report-funnel-stage span { color: #dce8f0; font-size: 13px; }
.report-funnel-stage strong { color: var(--gold); font-size: 20px; }
.report-funnel-stage small { min-width: 58px; color: var(--muted); text-align: right; }
.report-funnel-note { margin: 7px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

@media (max-width: 1180px) {
  .report-filter-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
}

@media (max-width: 760px) {
  .report-center-grid { grid-template-columns: 1fr; }
  .report-panel-wide { grid-column: auto; }
  .report-comparable-table-panel { min-height: 500px; }
  .report-comparable-table-panel .table-wrap { height: 360px; min-height: 360px; max-height: 360px; -webkit-overflow-scrolling: touch; }
  .report-comparable-table { min-width: 640px; }
  .report-comparable-table th, .report-comparable-table td { padding-right: 15px; padding-left: 15px; }
  .report-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 14px 14px; }
  .report-range-buttons { padding: 0 14px 14px; }
  .report-filter-actions { padding: 0 14px 14px; }
  .report-filter-actions button { width: 100%; }
  .report-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 14px 14px; }
  .report-chart-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-chart-grid { grid-template-columns: 1fr; }
  .report-chart-wide { grid-column: auto; }
  .report-chart-canvas, .report-chart-wide .report-chart-canvas { height: 310px; padding: 0 14px 14px; }
  .report-funnel { min-height: 300px; padding: 0 14px 14px; }
}

@media (max-width: 480px) {
  .report-filter-grid, .report-status-grid { grid-template-columns: 1fr; }
  .report-range-button { flex: 1 1 calc(50% - 9px); }
  .report-view-tabs { display: flex; width: 100%; }
  .report-view-tab { flex: 1; min-width: 0; }
  .report-chart-metrics { grid-template-columns: 1fr 1fr; gap: 10px; }
  .report-chart-metrics article { min-height: 90px; padding: 14px; }
  .report-chart-metrics strong { font-size: 23px; }
  .report-chart-canvas, .report-chart-wide .report-chart-canvas { height: 280px; }
  .report-funnel-stage { width: 100% !important; }
}
