:root {
  --bg: #f4f8ff;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-2: rgba(255, 255, 255, 0.98);
  --card: var(--surface-2);
  --border: #d6e3f6;
  --border-strong: #bdd6f3;
  --text: #10233f;
  --muted: #617895;
  --primary: #1389d5;
  --primary-deep: #0f4fb9;
  --accent: #22c6df;
  --ok: #57bd25;
  --warning: #ff9b42;
  --danger: #e6526d;
  --shadow: 0 24px 70px rgba(16, 35, 63, 0.1);
  --glow: 0 14px 34px rgba(19, 137, 213, 0.18);
  --radius: 22px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Segoe UI, Microsoft YaHei, PingFang SC, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(19, 137, 213, 0.18), transparent 26%),
    radial-gradient(circle at 85% 10%, rgba(34, 198, 223, 0.16), transparent 24%),
    radial-gradient(circle at 75% 70%, rgba(87, 189, 37, 0.11), transparent 20%),
    var(--bg);
}

a { color: inherit; text-decoration: none; }

.topbar {
  height: 56px;
  display: grid;
  grid-template-columns: 340px 1fr minmax(400px, auto);
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--surface-2);
  border-bottom: 1px solid rgba(214, 227, 246, 0.95);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-weight: 700;
  letter-spacing: .5px;
}

.brand-logo {
  width: 195px;
  max-width: min(195px, 22vw);
  height: 52px;
  border-radius: 14px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.94);
  border: 1.5px solid rgba(190, 220, 250, 0.7);
  box-shadow:
    0 8px 28px rgba(16, 35, 63, 0.12),
    0 0 0 3px rgba(52, 152, 219, 0.08);
  flex: 0 0 auto;
  animation: logoGlow 3s ease-in-out infinite;
}

@keyframes logoGlow {
  0%, 100% {
    box-shadow:
      0 8px 28px rgba(16, 35, 63, 0.12),
      0 0 0 3px rgba(52, 152, 219, 0.08);
  }
  50% {
    box-shadow:
      0 8px 32px rgba(16, 35, 63, 0.16),
      0 0 0 5px rgba(52, 152, 219, 0.16),
      0 0 18px rgba(52, 152, 219, 0.1);
  }
}

.brand-text {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  font-size: 26px;
  font-weight: 800;
  color: #10233f;
}

.topbar-meta {
  justify-self: end;
  font-size: 12px;
  color: #133a67;
  padding: 10px 12px;
  border: 1px solid rgba(19, 137, 213, 0.16);
  border-radius: 999px;
  font-weight: 800;
  background: linear-gradient(135deg, rgba(19, 137, 213, 0.08), rgba(34, 198, 223, 0.08));
}

.topbar-center { display: flex; justify-content: center; align-items: center; }

.global-search {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.global-search input {
  width: 450px;
  max-width: min(450px, 48vw);
}

input, select, button {
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 0 12px;
  font-size: 14px;
  outline: none;
  background: rgba(255, 255, 255, 0.98);
}

/* ── AI 顶栏搜索框 ── */
.ai-search-wrap { display: flex; justify-content: center; }
.ai-search-input {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 440px;
  max-width: min(440px, 46vw);
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: rgba(255,255,255,.96);
  cursor: text;
  transition: border-color .2s, box-shadow .2s;
}
.ai-search-input:hover,
.ai-search-input.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(19,137,213,.12); }
.ai-search-icon { font-size: 15px; color: #999; flex-shrink: 0; }
.ai-search-input input {
  flex: 1; height: 100%; border: none; padding: 0;
  font-size: 13px; background: none; outline: none;
}
.ai-search-input input::placeholder { color: #bbb; }
.ai-search-shortcut {
  font-size: 11px; color: #bbb;
  background: #f0f2f5; padding: 1px 6px; border-radius: 4px;
  flex-shrink: 0;
}

/* ── AI 查询浮动面板 ── */
.ai-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.25);
  z-index: 999; display: none;
}
.ai-overlay.open { display: block; }
.ai-result-panel {
  position: fixed;
  top: 64px; left: 50%;
  transform: translateX(-50%);
  width: 680px; max-width: 94%;
  max-height: 75vh;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 48px rgba(0,0,0,.18);
  display: none;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
}
.ai-result-panel.open { display: flex; }

.ai-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px; color: #888;
  flex-shrink: 0;
}
.ai-panel-close {
  width: 28px; height: 28px; border-radius: 50%;
  border: none; background: #f5f5f5;
  cursor: pointer; font-size: 14px; color: #999;
  display: flex; align-items: center; justify-content: center;
}
.ai-panel-close:hover { background: #e8e8e8; }

.ai-panel-body {
  flex: 1; overflow-y: auto; padding: 16px 20px;
  min-height: 200px;
}
.ai-welcome { text-align: center; padding: 30px 10px 20px; }
.ai-welcome-icon { font-size: 32px; margin-bottom: 12px; }
.ai-welcome-examples { margin-top: 12px; }
.ai-welcome-examples code {
  display: inline-block;
  background: #f0f4f8; padding: 6px 14px;
  border-radius: 6px; margin: 4px;
  font-size: 13px; color: var(--primary);
  cursor: pointer; transition: background .2s;
}
.ai-welcome-examples code:hover { background: #dce6f2; }

.ai-panel-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.ai-panel-footer-icon { font-size: 14px; color: #999; flex-shrink: 0; }
.ai-panel-footer input {
  flex: 1; height: 40px; border-radius: 10px;
  border: 1.5px solid #ddd; padding: 0 14px; font-size: 14px;
  outline: none; font-family: inherit;
}
.ai-panel-footer input:focus { border-color: var(--primary); }
.ai-panel-send {
  height: 40px; padding: 0 18px; border: none; border-radius: 10px;
  background: var(--primary); color: #fff; font-size: 14px; font-weight: 500;
  cursor: pointer; flex-shrink: 0; transition: opacity .2s;
}
.ai-panel-send:hover { opacity: .85; }
.ai-panel-send:disabled { opacity: .4; cursor: not-allowed; }

/* 消息 */
.ai-msg { margin-bottom: 14px; display: flex; }
.ai-msg.user { justify-content: flex-end; }
.ai-msg .ai-msg-bubble {
  max-width: 80%; padding: 10px 16px; border-radius: 12px;
  line-height: 1.6; font-size: 14px; word-break: break-word;
  white-space: pre-wrap;
}
.ai-msg.user .ai-msg-bubble {
  background: var(--primary); color: #fff;
  border-bottom-right-radius: 4px;
}
.ai-msg.ai .ai-msg-bubble {
  background: #f7f8fa; color: #222;
  border: 1px solid #eee; border-bottom-left-radius: 4px;
}
.ai-msg-label { font-size: 11px; color: #aaa; margin-bottom: 4px; padding: 0 4px; }
.ai-msg.user .ai-msg-label { text-align: right; }

/* 加载动画 */
.ai-loading {
  display: flex; align-items: center; gap: 10px;
  justify-content: center; padding: 24px 0; color: #999;
}
.ai-spinner {
  width: 22px; height: 22px;
  border: 2.5px solid #e8e8e8; border-top-color: var(--primary);
  border-radius: 50%; animation: ai-spin .7s linear infinite;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }

@media (max-width: 820px) {
  .ai-result-panel { top: 60px; max-height: 80vh; }
  .ai-panel-body { padding: 12px 14px; }
  .ai-search-input { width: 100%; max-width: 100%; }
}

/* ── 表格样式（AI 面板内） ── */
.ai-msg.ai .ai-msg-bubble table {
  border-collapse: collapse; margin: 6px 0; font-size: 13px; width: 100%;
}
.ai-msg.ai .ai-msg-bubble th,
.ai-msg.ai .ai-msg-bubble td {
  border: 1px solid #ddd; padding: 5px 10px; text-align: left;
}
.ai-msg.ai .ai-msg-bubble th { background: #f5f7fa; font-weight: 600; }

input:focus, select:focus {
  border-color: rgba(19, 137, 213, 0.72);
  box-shadow: 0 0 0 4px rgba(34, 198, 223, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.btn:hover { transform: translateY(-1px); }

.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary-deep), var(--primary) 48%, var(--accent));
  color: #fff;
  box-shadow: var(--glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: 0 8px 20px rgba(16, 35, 63, 0.04);
}

.btn-ghost {
  background: transparent;
  border-color: rgba(171, 194, 222, 0.45);
  color: #2e4668;
}

.btn-danger {
  background: linear-gradient(135deg, #ff9db0 0%, #f26b84 45%, #df4d68 100%);
  border-color: rgba(199, 58, 86, 0.28);
  color: #fff;
  box-shadow: 0 10px 22px rgba(223, 77, 104, 0.22);
}

.btn-danger:hover {
  box-shadow: 0 14px 28px rgba(223, 77, 104, 0.28), 0 0 0 3px rgba(230, 82, 109, 0.14);
}

.btn-danger:active {
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(223, 77, 104, 0.22);
}

.shell {
  display: grid;
  grid-template-columns: 246px 1fr;
  min-height: calc(100vh - 56px);
}

.sidebar {
  border-right: 1px solid rgba(214, 227, 246, 0.95);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.66), transparent 22%),
    radial-gradient(circle at 85% 18%, rgba(196, 236, 255, 0.5), transparent 24%),
    radial-gradient(circle at 18% 82%, rgba(211, 244, 224, 0.4), transparent 20%),
    linear-gradient(180deg, #f1ecff 0%, #e8f4ff 52%, #edf8f2 100%);
  padding: 24px 18px 6px;
  display: flex;
  flex-direction: column;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nav-item {
  position: relative;
  height: 52px;
  min-height: 52px;
  padding: 5px 14px 5px 12px;
  border-radius: 14px;
  color: #315073;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  text-align: left;
  font-size: 15px;
  font-weight: 650;
  line-height: 1;
  border: 1px solid rgba(171, 194, 222, 0.28);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.46), rgba(255, 255, 255, 0.18));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, color 0.25s ease;
  animation: navFadeIn 0.5s ease backwards;
}

.nav-icon {
  flex-shrink: 0;
  opacity: 0.72;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.nav-item:hover .nav-icon {
  opacity: 0.92;
  transform: scale(1.08);
}
.nav-item.active .nav-icon {
  opacity: 0.95;
}

/* 为每个 nav-item 设置渐进的入场动画延迟 */
.nav-item:nth-child(1) { animation-delay: 0.05s; }
.nav-item:nth-child(2) { animation-delay: 0.1s; }
.nav-item:nth-child(3) { animation-delay: 0.15s; }
.nav-item:nth-child(4) { animation-delay: 0.2s; }
.nav-item:nth-child(5) { animation-delay: 0.25s; }

@keyframes navFadeIn {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.nav-item::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  width: 4px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(34, 198, 223, 0), rgba(34, 198, 223, 0));
  transform: translateY(-50%);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.nav-item:hover {
  transform: translateY(-2px) scale(1.02);
  background: linear-gradient(135deg, rgba(197, 231, 255, 0.82), rgba(227, 246, 255, 0.72));
  border-color: rgba(111, 183, 231, 0.4);
  color: #183f6f;
  box-shadow: 0 10px 22px rgba(126, 164, 206, 0.2), 0 0 0 3px rgba(34, 198, 223, 0.1);
}
.nav-item:hover::before {
  background: linear-gradient(180deg, rgba(34, 198, 223, 0.95), rgba(19, 137, 213, 0.95));
  box-shadow: 0 0 20px rgba(34, 198, 223, 0.36);
}
.nav-item.active {
  transform: translateY(-2px);
  background: linear-gradient(135deg, rgba(160, 217, 255, 0.95), rgba(209, 244, 255, 0.9) 55%, rgba(216, 244, 226, 0.92));
  border-color: rgba(125, 193, 235, 0.5);
  color: #133a67;
  box-shadow: 0 10px 20px rgba(125, 163, 202, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.62);
  animation: navPulse 3s ease-in-out infinite;
}
.nav-item.active::before {
  background: linear-gradient(180deg, #22c6df, #57bd25);
  box-shadow: 0 0 22px rgba(34, 198, 223, 0.4);
}

@keyframes navPulse {
  0%, 100% { box-shadow: 0 10px 20px rgba(125, 163, 202, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.62); }
  50% { box-shadow: 0 12px 26px rgba(125, 163, 202, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 0 0 4px rgba(34, 198, 223, 0.08); }
}
.nav-item.disabled {
  color: rgba(46, 70, 104, 0.45);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.12));
  cursor: not-allowed;
  border-color: rgba(171, 194, 222, 0.16);
  box-shadow: none;
  transform: none;
}

.sidebar-footer { padding-top: 16px; margin-top: auto; }
.hint {
  border: 1px solid rgba(173, 201, 231, 0.56);
  border-radius: 20px;
  padding: 16px;
  color: #2e4668;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.56)),
    linear-gradient(135deg, rgba(184, 221, 255, 0.42), rgba(216, 247, 228, 0.28));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), 0 16px 34px rgba(112, 143, 182, 0.16);
}
.hint-title { font-size: 12px; font-weight: 700; margin-bottom: 8px; color: #374151; }
.hint-text { font-size: 12px; line-height: 1.6; }

.sidebar-user {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.6));
  border: 1px solid rgba(173, 201, 231, 0.56);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), 0 12px 26px rgba(112, 143, 182, 0.16);
}
.sidebar-user-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
  transition: opacity 0.15s ease;
}
.sidebar-user-main:hover {
  opacity: 0.8;
}
.sidebar-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(19, 137, 213, 0.85), rgba(87, 189, 37, 0.85));
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  flex: 0 0 auto;
  object-fit: cover;
}
.sidebar-user-text {
  display: grid;
  gap: 3px;
  align-content: center;
  min-width: 0;
}
.sidebar-user-name {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-meta {
  font-size: 12px;
  color: rgba(46, 70, 104, 0.72);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-logout {
  height: 34px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(171, 194, 222, 0.45);
  background: transparent;
  color: rgba(46, 70, 104, 0.85);
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
  flex: 0 0 auto;
}
.sidebar-user-logout:hover {
  background: rgba(19, 137, 213, 0.08);
  color: rgba(46, 70, 104, 0.95);
}

.main { padding: 6px 18px 28px; }

.page-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.page-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .2px;
}

.page-actions { display: flex; gap: 8px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.grid-6 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.grid-7 { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

.card {
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(214, 227, 246, 0.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.card-title {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: .2px;
}

.muted { color: var(--muted); }

.table-wrap {
  border: 1px solid rgba(214, 227, 246, 0.96);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid #eef2f7; font-size: 14px; text-align: left; vertical-align: middle; }
th {
  background: linear-gradient(180deg, #f6fbff 0%, #eef7ff 100%);
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}
tr:hover td { background: linear-gradient(90deg, rgba(19, 137, 213, 0.06), rgba(87, 189, 37, 0.04)); }
td.num { text-align: center; white-space: nowrap; }
td.num a { color: #1389d5; }
td.num a:hover { text-decoration: underline; }
td.num a.btn-primary { color: #fff; }
.table-wrap tbody td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table-wrap tbody td .tags-wrap { overflow: hidden; }

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 2px;
  margin-bottom: 2px;
}
.filters .span-2 { grid-column: span 2; }
.filters .span-3 { grid-column: span 3; }
.filters .actions { display: flex; gap: 8px; }

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid rgba(214, 227, 246, 0.9);
  background: rgba(255, 255, 255, 0.86);
  color: #2e4668;
}

.badge.primary { background: rgba(19, 137, 213, 0.12); border-color: rgba(19, 137, 213, 0.22); color: var(--primary-deep); }
.badge.warning { background: rgba(255, 155, 66, 0.14); border-color: rgba(255, 155, 66, 0.24); color: #d9751f; }
.badge.danger { background: rgba(230, 82, 109, 0.14); border-color: rgba(230, 82, 109, 0.22); color: var(--danger); }
.badge.ok { background: rgba(87, 189, 37, 0.14); border-color: rgba(87, 189, 37, 0.22); color: #2f9b16; }

.avatar-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.avatar-preview {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}
.avatar-initial {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(19, 137, 213, 0.85), rgba(87, 189, 37, 0.85));
  color: #fff;
  font-weight: 900;
  font-size: 18px;
}

.cartoon-avatars {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-top: 4px;
}
.cartoon-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.cartoon-item:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(19, 137, 213, 0.16);
  transform: translateY(-2px);
}
.cartoon-item img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #eef2f7;
}
.cartoon-label {
  display: none;
}

/* ─── 弹窗 / 表单 ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
}
.modal {
  background: var(--surface-2);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(16, 35, 63, 0.2);
  width: min(560px, 94vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 800; }
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-footer {
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.form-group { margin-bottom: 12px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  margin-bottom: 4px;
}
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.full { width: 100%; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 2px 8px; font-size: 11px; border-radius: 6px; }
.tag-heat-cell { transition: none; }
.danger { color: var(--danger); }

/* ─── 详情页网格 ─── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}
.detail-grid .muted { font-size: 12px; }

/* ─── 阶段状态标签 ─── */
.badge.stage-初步接触 { background: rgba(147, 197, 253, 0.18); border-color: rgba(147, 197, 253, 0.4); color: #2563eb; }
.badge.stage-需求确认 { background: rgba(196, 181, 253, 0.18); border-color: rgba(167, 139, 250, 0.4); color: #7c3aed; }
.badge.stage-方案报价 { background: rgba(251, 207, 232, 0.18); border-color: rgba(244, 114, 182, 0.4); color: #db2777; }
.badge.stage-谈判 { background: rgba(253, 224, 71, 0.2); border-color: rgba(250, 204, 21, 0.5); color: #a16207; }
.badge.stage-已签约 { background: rgba(134, 239, 172, 0.18); border-color: rgba(74, 222, 128, 0.4); color: #16a34a; }
.badge.stage-已丢单 { background: rgba(252, 165, 165, 0.18); border-color: rgba(248, 113, 113, 0.4); color: #dc2626; }
.badge.status-进行中 { background: rgba(19, 137, 213, 0.12); border-color: rgba(19, 137, 213, 0.22); color: var(--primary-deep); }
.badge.status-已成功 { background: rgba(87, 189, 37, 0.14); border-color: rgba(87, 189, 37, 0.22); color: #16a34a; }
.badge.status-已关闭 { background: rgba(107, 114, 128, 0.14); border-color: rgba(107, 114, 128, 0.22); color: #6b7280; }

/* ─── 客户详情页布局 ─── */
.detail-grid-layout { align-items: start; }
.detail-grid-layout > :first-child { flex: 1; min-width: 0; }
.detail-grid-layout > :last-child { flex: 1; min-width: 0; }
.detail-grid-layout > :last-child > .card { display: flex; flex-direction: column; }
.detail-grid-layout .timeline { flex: 1; }
.grid-3.detail-grid-layout { grid-template-columns: 30% 40% 30%; }
.grid-3.detail-grid-layout > .ext-left-col { min-width: 0; font-size: 14px; }
.grid-3.detail-grid-layout > .ext-left-col h3 { font-size: 14px; }
.grid-3.detail-grid-layout > .ext-left-col table { table-layout: fixed; width: 100%; word-break: break-all; }
.grid-3.detail-grid-layout > .ext-left-col table th,
.grid-3.detail-grid-layout > .ext-left-col table td { word-break: break-all; white-space: normal; }
.grid-3.detail-grid-layout > .ext-left-col .table-wrap { overflow-x: hidden; }
.grid-3.detail-grid-layout > .ext-right-col { min-width: 0; }

/* 企业画像折叠区 */
.ent-sec-hdr {
  cursor: pointer;
  user-select: none;
  padding: 3px 0;
  margin: 4px 0 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ent-sec-hdr:hover { opacity: 0.8; }
.ent-tri {
  font-size: 10px;
  color: #6b7280;
  transition: transform 0.15s;
  flex-shrink: 0;
  width: 14px;
  text-align: center;
}
.ent-tri.collapsed {
  transform: rotate(-90deg);
}

.detail-grid-layout .table-wrap table { table-layout: fixed; }
.detail-grid-layout .table-wrap table td:first-child {
  word-break: break-word; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}

@media (max-width: 820px) {
  .cartoon-avatars {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.tags-wrap { display: flex; flex-wrap: nowrap; gap: 4px; overflow: hidden; }
.tag-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid transparent;
  background: #f3f4f6;
  color: #374151;
  white-space: nowrap;
  flex-shrink: 0;
}
.tag-a { background: #eef2ff; color: #4338ca; border-color: #c7d2fe; }
.tag-b { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.tag-c { background: #f8fafc; color: #334155; border-color: #cbd5e1; }
.tag-star { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.tag-win { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.tag-oper { background: #fffbeb; color: #a16207; border-color: #fde68a; }
.tag-garbage { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.tag-charge { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.tag-dev { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.tag-invalid { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

.pager {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 0 0;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card { width: min(420px, 96vw); }
.auth-hero {
  margin: 0 0 12px;
}
.auth-logo {
  display: block;
  width: min(240px, 80%);
  height: auto;
  margin: 0 auto 12px;
  border-radius: 16px;
  border: 1px solid rgba(214, 227, 246, 0.96);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 28px rgba(19, 137, 213, 0.08);
}
.auth-subtitle {
  text-align: center;
  font-size: 18px;
  font-weight: 900;
  color: #17345d;
  letter-spacing: 0.02em;
  margin: 0 0 12px;
}
.auth-desc {
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  margin: -6px 0 0;
}
.auth-title { font-size: 20px; font-weight: 900; margin-bottom: 14px; }
.auth-form { display: flex; flex-direction: column; }
.auth-label { font-size: 13px; color: #374151; margin-bottom: 6px; font-weight: 700; }
.auth-error {
  background: #fef2f2;
  border: 1px solid rgba(220,38,38,.25);
  color: #991b1b;
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 12px;
  font-size: 13px;
}
.notice-ok {
  background: #ecfdf5;
  border: 1px solid rgba(22,163,74,.25);
  color: #065f46;
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 12px;
  font-size: 13px;
}
.auth-hint { margin-top: 12px; color: var(--muted); font-size: 12px; line-height: 1.6; }

.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.25);
  display: none;
  z-index: 50;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(760px, 92vw);
  background: var(--surface-2);
  border-left: 1px solid rgba(214, 227, 246, 0.95);
  box-shadow: -18px 0 60px rgba(16, 35, 63, 0.18);
  transform: translateX(100%);
  transition: transform .18s ease;
  z-index: 60;
  display: grid;
  grid-template-rows: auto 1fr;
}

.drawer.open { transform: translateX(0); }

.drawer-header {
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(214, 227, 246, 0.95);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.drawer-title { font-size: 16px; font-weight: 800; }
.drawer-body { padding: 14px; overflow: auto; }

.kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 12px;
  align-items: start;
}

.section-title { margin: 16px 0 10px; font-size: 14px; font-weight: 800; }

.timeline { display: grid; gap: 10px; }
.tl-item { border: 1px solid rgba(214, 227, 246, 0.95); border-radius: 18px; padding: 14px; background: rgba(255,255,255,0.96); box-shadow: 0 12px 24px rgba(19, 137, 213, 0.06); }
.tl-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.tl-time { font-size: 12px; color: var(--muted); }
.tl-type { font-size: 12px; color: #374151; display: flex; align-items: center; gap: 5px; }
.tl-owner { font-size: 12px; }
.tl-owner span { display: inline-block; padding: 1px 8px; border-radius: 10px; background: #eef2ff; color: #4338ca; font-weight: 500; }
.tl-icon { width: 16px; height: 16px; flex-shrink: 0; }
.tl-msg { white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.55; }
.tl-images { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.tl-img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tl-img:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Lightbox */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.75);
  align-items: center;
  justify-content: center;
}
.lightbox-overlay.open { display: flex; }
.lightbox-overlay .lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.35);
}
.lightbox-overlay .lightbox-close {
  position: absolute;
  top: 20px;
  right: 28px;
  color: #fff;
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.15s;
}
.lightbox-overlay .lightbox-close:hover { opacity: 0.7; }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0,0,0,0.45);
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-card {
  background: #fff;
  border-radius: 14px;
  width: 460px;
  max-width: 92vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-weight: 700; font-size: 16px; }
.modal-body { padding: 16px 20px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}
.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; margin-top: 10px; color: var(--muted); }
.field-label:first-child { margin-top: 0; }
.field-input {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
}

textarea.field-input {
  height: auto;
  min-height: 160px;
  padding: 10px;
  resize: vertical;
}
.field-error { color: var(--danger); font-size: 13px; margin-top: 8px; }
.field-readonly {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
  background: var(--surface);
  color: var(--muted);
  display: flex;
  align-items: center;
}

/* Radio group */
.radio-group { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.radio-label { font-size: 13px; display: flex; align-items: center; gap: 4px; cursor: pointer; }
.radio-label input[type="radio"] { cursor: pointer; accent-color: var(--primary); }

/* Paste area */
.paste-area {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.paste-area:hover, .paste-area:focus { border-color: var(--primary); background: rgba(19,137,213,0.04); }

/* Tag chip input */
.tag-input-wrap { margin-top: 4px; }
.tag-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  min-height: 28px;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: rgba(19,137,213,0.1);
  color: var(--primary);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.tag-chip-remove {
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  opacity: 0.6;
  margin-left: 2px;
}
.tag-chip-remove:hover { opacity: 1; }

@media (max-width: 1100px) {
  .topbar { grid-template-columns: 300px 1fr minmax(300px, auto); }
  .shell { grid-template-columns: 210px 1fr; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .span-2 { grid-column: span 2; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-7 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .topbar { grid-template-columns: 1fr; height: auto; padding: 12px 16px; }
  .topbar-center { order: 3; }
  .topbar-right { display: none; }
  .global-search { width: 100%; }
  .global-search input { width: 100%; max-width: 100%; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 12px; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-7 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
}

/* ─── 输入联想下拉 ─── */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16, 35, 63, 0.14);
  z-index: 100;
}

.autocomplete-item {
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.12s;
}

.autocomplete-item:last-child { border-bottom: none; }

.autocomplete-item:hover,
.autocomplete-item.active {
  background: rgba(19, 137, 213, 0.08);
  color: var(--primary-deep);
}

.contract-edit-link {
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
}
.contract-edit-link:hover {
  text-decoration: underline;
}

.opp-edit-link,
.order-edit-link,
.payment-edit-link {
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
}
.opp-edit-link:hover,
.order-edit-link:hover,
.payment-edit-link:hover {
  text-decoration: underline;
}

/* ─── 成功概率单选按钮组 ─── */
.prob-radio-group {
  display: flex;
  gap: 6px;
  padding-top: 4px;
}

.prob-radio {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.prob-radio input[type="radio"] {
  accent-color: var(--primary);
  width: 14px;
  height: 14px;
}

.prob-radio:has(input:checked) {
  background: rgba(19, 137, 213, 0.1);
  border-color: var(--primary);
  color: var(--primary-deep);
}

/* 客户名称候选下拉 */
.suggest-list {
   list-style: none;
   margin: 0;
   padding: 0;
   border: 1px solid var(--border-strong);
   border-radius: 10px;
   background: #fff;
   max-height: 200px;
   overflow-y: auto;
   position: absolute;
   z-index: 100;
   box-shadow: var(--shadow);
   width: 100%;
   top: 100%;
   left: 0;
 }
.suggest-list li {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.suggest-list li:last-child { border-bottom: none; }
.suggest-list li:hover {
  background: rgba(19, 137, 213, 0.08);
  color: var(--primary);
}
.suggest-list .suggest-name { font-weight: 700; }
.suggest-list .suggest-meta { font-size: 11px; color: var(--muted); margin-left: 8px; }
.suggest-list .suggest-other { opacity: 0.65; }
.suggest-list .suggest-other:hover { opacity: 0.85; background: rgba(148,163,184,0.08); }

/* ─── AI 悬浮聊天气泡 ─── */
.ai-chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-deep), var(--primary));
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(19, 137, 213, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ai-chat-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 30px rgba(19, 137, 213, 0.5);
}
.ai-chat-bubble .dot {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #fff;
}

.ai-chat-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 9999;
  width: 400px;
  height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
}
.ai-chat-panel.open { display: flex; }

.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--primary-deep), var(--primary));
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}
.ai-chat-header-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  opacity: 0.8;
  line-height: 1;
  padding: 0 4px;
}
.ai-chat-header-close:hover { opacity: 1; }

.ai-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
}

.ai-chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}
.ai-chat-msg.user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ai-chat-msg.assistant {
  align-self: flex-start;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.ai-chat-footer {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: #fff;
}
.ai-chat-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  resize: none;
  font-family: inherit;
  max-height: 80px;
}
.ai-chat-input:focus { border-color: var(--primary); }
.ai-chat-send {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}
.ai-chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

.ai-chat-typing {
  align-self: flex-start;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  display: flex;
  gap: 4px;
}
.ai-chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: aiDot 1.4s infinite ease-in-out;
}
.ai-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aiDot {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* ============== 公众号文章编辑器 ============== */
.wa-layout {
  display: flex;
  gap: 0;
  height: calc(100vh - 52px);
  background: #f5f6f8;
}
.wa-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.wa-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.wa-sidebar-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}
.wa-article-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.wa-item {
  padding: 10px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.15s;
}
.wa-item:hover { background: #f0f4ff; }
.wa-item-active {
  background: #eef3ff;
  border-left-color: var(--primary);
}
.wa-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wa-item-meta {
  font-size: 11px;
  color: #999;
  margin-top: 3px;
}
.wa-loading, .wa-empty {
  padding: 24px 16px;
  text-align: center;
  color: #999;
  font-size: 13px;
}
.wa-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}
.wa-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
  gap: 8px;
}
.wa-toolbar-left, .wa-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wa-status {
  font-size: 12px;
  color: #999;
}
.wa-status-draft { color: #f39c12; }
.wa-status-sending { color: #3498db; }
.wa-status-published { color: #27ae60; }
.wa-form {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 40px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}
.wa-form-row { margin-bottom: 12px; }
.wa-input-title {
  width: 100%;
  font-size: 22px;
  font-weight: 700;
  border: none;
  outline: none;
  padding: 8px 0;
  color: var(--text);
  font-family: inherit;
}
.wa-input-title::placeholder { color: #ccc; }
.wa-form-meta {
  display: flex;
  gap: 12px;
}
.wa-input-meta {
  flex: 1;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  outline: none;
  font-family: inherit;
}
.wa-input-meta:focus { border-color: var(--primary); }
.wa-cover-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.wa-cover-preview {
  position: relative;
  width: 120px;
  height: 68px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.wa-cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.wa-cover-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.wa-cover-upload {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: #888;
  cursor: pointer;
  transition: all 0.15s;
}
.wa-cover-upload:hover { border-color: var(--primary); color: var(--primary); }
#waEditorContainer {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.ql-editor { min-height: 300px; font-size: 15px; line-height: 1.7; }
.ql-editor h1 { font-size: 20px; margin-bottom: 10px; }
.ql-editor h2 { font-size: 17px; margin-bottom: 8px; }
.ql-editor p { margin-bottom: 8px; }
.ql-toolbar { border-top-left-radius: 8px; border-top-right-radius: 8px; }
.ql-container { border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; }

/* Modal */
.wa-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.wa-modal {
  background: #fff;
  border-radius: 12px;
  padding: 0;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.wa-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 15px;
}
.wa-modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #999;
}
.wa-modal-body { padding: 20px; }
.wa-modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

/* Toast */
.wa-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #333;
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transition: all 0.3s;
  z-index: 9999;
  pointer-events: none;
}
.wa-toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
