/* ==========================================================================
   舆情统一平台 — 公共样式（浅色专业风，骨架继承贝叶思 demo）
   ========================================================================== */

:root {
  /* 背景 */
  --bg-page: #f5f7fa;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;

  /* 边框 */
  --border-1: #e5e9f0;
  --border-2: #d3dae4;

  /* 品牌色（青系，浅底下压深一档保证对比度） */
  --brand: #0891b2;
  --brand-hover: #0e7490;
  --brand-soft: #ecfeff;
  --brand-border: #a5f3fc;

  /* 状态色 */
  --st-negative: #dc2626;
  --st-negative-bg: #fef2f2;
  --st-positive: #16a34a;
  --st-positive-bg: #f0fdf4;
  --st-neutral: #64748b;
  --st-neutral-bg: #f1f5f9;
  --st-warning: #d97706;
  --st-warning-bg: #fffbeb;

  /* 文字 */
  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;

  /* 阴影 */
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.06);

  /* Element Plus 主色对齐品牌色 */
  --el-color-primary: #0891b2;
  --el-color-primary-light-3: #38b6cf;
  --el-color-primary-light-5: #6fcbe0;
  --el-color-primary-light-7: #a6e0ec;
  --el-color-primary-light-8: #c3eaf2;
  --el-color-primary-light-9: #e0f5f9;
  --el-color-primary-dark-2: #06748e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ==========================================================================
   布局：主壳子
   ========================================================================== */

/* 侧栏宽 / 顶栏高提为变量：chat.html 的对话区要绝对定位铺满内容区，
   必须与这里对齐。写死数字迟早对不上（2026-08-10 T3 差点错位 10px） */
:root { --shell-side-w: 220px; --shell-top-h: 56px; }

.app-shell {
  display: grid;
  grid-template-columns: var(--shell-side-w) 1fr;
  grid-template-rows: var(--shell-top-h) 1fr;
  grid-template-areas:
    "logo top"
    "side main";
  min-height: 100vh;
}

.app-logo-area {
  grid-area: logo;
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-right: 1px solid var(--border-1);
  border-bottom: 1px solid var(--border-1);
  background: var(--bg-sidebar);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.app-logo-mark {
  width: 32px; height: 32px;
  border-radius: 7px;
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.35);
}
.app-logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.app-logo-text-zh { font-size: 13.5px; font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.app-logo-text-en { font-size: 9px; color: var(--text-muted); letter-spacing: 0.06em; }

.app-top {
  grid-area: top;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-1);
  background: var(--bg-sidebar);
}

.top-breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.top-breadcrumb .crumb-active { color: var(--text-primary); font-weight: 500; }

.top-actions { display: flex; align-items: center; gap: 14px; }
.top-date { font-size: 12px; color: var(--text-muted); }
.top-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 14px;
  border-left: 1px solid var(--border-1);
}
.top-user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}
.top-user-name { font-size: 13px; color: var(--text-secondary); }

/* 侧边栏 */
.app-side {
  grid-area: side;
  border-right: 1px solid var(--border-1);
  background: var(--bg-sidebar);
  padding: 16px 0;
}

.nav-section-label {
  padding: 14px 22px 6px;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  border-left: 2px solid transparent;
  transition: all 0.15s;
  cursor: pointer;
}
.nav-item:hover { color: var(--brand); background: var(--brand-soft); }
.nav-item.is-active {
  color: var(--brand);
  background: linear-gradient(90deg, var(--brand-soft) 0%, transparent 100%);
  border-left-color: var(--brand);
  font-weight: 500;
}
.nav-item.is-disabled {
  color: var(--text-muted);
  cursor: default;
}
.nav-item.is-disabled:hover { color: var(--text-muted); background: transparent; }
.nav-item .nav-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }
.nav-tag {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-muted);
  border: 1px solid var(--border-1);
  border-radius: 3px;
  padding: 0 5px;
  line-height: 16px;
}

.app-main {
  grid-area: main;
  padding: 20px 24px;
  overflow-y: auto;
}

/* ==========================================================================
   页内组件
   ========================================================================== */

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 16px;
}
.page-title { font-size: 18px; font-weight: 600; margin: 0; color: var(--text-primary); }
.page-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-1);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
}

/* 统计条（轻量横排，非大卡片） */
.stat-strip {
  display: flex;
  gap: 32px;
  padding: 12px 20px;
  margin-bottom: 16px;
  align-items: baseline;
}
.stat-item .num {
  font-family: "DIN Alternate", -apple-system, sans-serif;
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.stat-item .num.is-negative { color: var(--st-negative); }
.stat-item .label { font-size: 12px; color: var(--text-muted); margin-left: 6px; }
.stat-strip .spacer { flex: 1; }
.stat-strip .hint { font-size: 12px; color: var(--text-muted); }

/* 状态徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: 3px;
  white-space: nowrap;
}
.badge-negative { background: var(--st-negative-bg); color: var(--st-negative); border: 1px solid #fecaca; }
.badge-positive { background: var(--st-positive-bg); color: var(--st-positive); border: 1px solid #bbf7d0; }
.badge-neutral  { background: var(--st-neutral-bg);  color: var(--st-neutral);  border: 1px solid #e2e8f0; }
.badge-warning  { background: var(--st-warning-bg);  color: var(--st-warning);  border: 1px solid #fde68a; }
.badge-brand    { background: var(--brand-soft);     color: var(--brand);       border: 1px solid var(--brand-border); }

/* 列表 + 详情分栏 */
.split-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 16px;
  align-items: start;
}
.list-pane { padding: 8px 0 16px; }
.list-pane .el-table { --el-table-header-bg-color: #f8fafc; }
.list-pane .el-table .el-table__row { cursor: pointer; }
.pager { display: flex; justify-content: flex-end; padding: 12px 16px 4px; }

.detail-pane {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding: 18px 20px;
}
.detail-empty {
  position: sticky;
  top: 20px;
  height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
}
.detail-empty .icon { font-size: 28px; opacity: 0.5; }

.detail-title { font-size: 15px; font-weight: 600; line-height: 1.5; margin: 0 0 10px; }
.detail-meta { font-size: 12px; color: var(--text-muted); line-height: 1.8; margin-bottom: 12px; }
.detail-meta a { color: var(--brand); text-decoration: none; word-break: break-all; }
.detail-meta a:hover { text-decoration: underline; }

.detail-section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 16px 0 8px;
  padding-left: 8px;
  border-left: 3px solid var(--brand);
}
.detail-text {
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
  background: #f8fafc;
  border: 1px solid var(--border-1);
  border-radius: 6px;
  padding: 12px;
}

.fact-grid { display: grid; grid-template-columns: 76px 1fr; row-gap: 8px; font-size: 13px; }
.fact-grid .k { color: var(--text-muted); }
.fact-grid .v { color: var(--text-primary); }

/* 事件库成员条目 */
.member-item {
  padding: 10px 0;
  border-bottom: 1px dashed var(--border-1);
  font-size: 13px;
}
.member-item:last-child { border-bottom: none; }
.member-item .t { color: var(--text-primary); line-height: 1.5; }
.member-item .m { color: var(--text-muted); font-size: 12px; margin-top: 4px; display: flex; gap: 10px; align-items: center; }

/* ==========================================================================
   顶栏：客户切换器 + 用户菜单（T3-1，2026-08-10）
   改造前顶栏只有面包屑和写死的「项目经理」。现在左侧常驻「当前客户」
   （全站唯一状态，切一次所有页面生效），右侧是真实账号 + 下拉菜单。
   ========================================================================== */

.top-left { display: flex; align-items: center; gap: 16px; min-width: 0; }

.top-switcher { position: relative; }

.switcher-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 10px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--brand-hover);
  transition: background .15s, border-color .15s;
}
.switcher-btn:hover { background: #dffafe; border-color: var(--brand); }

.switcher-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--st-positive);
  flex: none;
}
.switcher-name { white-space: nowrap; }
.switcher-caret { width: 13px; height: 13px; opacity: .55; flex: none; }

/* 单客户账号：不给切换器，只显示当前客户（用户拍板：避免多余点击） */
.top-single-client {
  font-size: 13px;
  font-weight: 500;
  color: var(--brand-hover);
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  border-radius: 6px;
  height: 30px;
  display: flex;
  align-items: center;
  padding: 0 10px;
}

.switcher-menu, .user-menu {
  position: absolute;
  top: calc(100% + 6px);
  min-width: 208px;
  background: var(--bg-card);
  border: 1px solid var(--border-1);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .12);
  padding: 6px;
  z-index: 2200;
}
.switcher-menu { left: 0; }
.user-menu { right: 0; }

.switcher-menu-label, .user-menu-role {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 8px 6px;
}

.switcher-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  text-align: left;
}
.switcher-item:hover { background: var(--bg-page); }
.switcher-item.is-current { color: var(--brand-hover); font-weight: 500; }

.switcher-item-radio {
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 1.5px solid var(--border-2);
  flex: none;
  position: relative;
}
.switcher-item.is-current .switcher-item-radio { border-color: var(--brand); }
.switcher-item.is-current .switcher-item-radio::after {
  content: '';
  position: absolute;
  inset: 2.5px;
  border-radius: 50%;
  background: var(--brand);
}

/* 用户区改为可点击 */
.top-user { cursor: pointer; position: relative; user-select: none; }
.user-menu-head { padding: 6px 8px 8px; border-bottom: 1px solid var(--border-1); margin-bottom: 4px; }
.user-menu-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.user-menu-role { padding: 2px 0 0; }

.user-menu-item {
  display: block;
  width: 100%;
  padding: 8px;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: left;
  text-decoration: none;
}
.user-menu-item:hover { background: var(--bg-page); color: var(--text-primary); }

/* 事件详情里的专项监测进度块（T3-6，2026-08-10）
   用户要求：能看到「还剩多久、已经报了多久」 */
.monitor-box {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--st-warning-bg);
  border: 1px solid #fde68a;
  border-radius: 6px;
}
.monitor-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.monitor-remain { font-size: 12px; font-weight: 600; color: var(--st-warning); }
.monitor-line { font-size: 12px; color: var(--text-secondary); line-height: 1.7; }

/* 页面底部的说明文字（T3-3/T3-5）：解释规则与边界，避免用户去猜 */
.hint-line {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.8;
}

/* 列表空态提示（T3-5）：告诉用户接下来能做什么，而不是留一片空白 */
.empty-tip {
  padding: 40px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.9;
}
