/* CS Dashboard */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  background: #f0f2f5;
  color: #262626;
  height: 100vh;
  overflow: hidden;
  font-size: 13px;
}
.hidden { display: none !important; }
.boot-splash {
  position: fixed; inset: 0; z-index: 3000;
  display: flex; align-items: center; justify-content: center;
  background: #f0f2f5;
}
.boot-splash.hidden { display: none !important; }
.boot-splash-card {
  background: #fff; border: 1px solid #e8e8e8; border-radius: 4px;
  padding: 18px 28px; color: #8c8c8c; font-size: 14px;
}

/* Login */
#loginPage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f2f5;
  padding: 24px;
}
.login-panel {
  width: 380px;
  max-width: 100%;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
}
.login-head {
  padding: 28px 32px 8px;
  background: #fff;
  color: #262626;
  border-bottom: none;
}
.login-head h1 { font-size: 18px; font-weight: 600; margin-bottom: 6px; color: #262626; }
.login-head p { font-size: 13px; color: #8c8c8c; }
.login-body { padding: 20px 32px 28px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: #595959; margin-bottom: 6px; }
.field input {
  width: 100%; height: 36px; padding: 0 10px;
  border: 1px solid #d9d9d9; border-radius: 4px; font-size: 13px; outline: none;
}
.field input:focus { border-color: #1677ff; }
.field-check { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #8c8c8c; margin-bottom: 16px; cursor: pointer; }
.err { color: #cf1322; font-size: 12px; min-height: 18px; margin-bottom: 10px; }
.btn {
  height: 32px; padding: 0 14px; border: 1px solid transparent; border-radius: 4px;
  font-size: 13px; line-height: 30px; cursor: pointer; font-family: inherit;
  background: #fff; color: #262626;
}
.btn:hover { opacity: .92; }
.btn-block { width: 100%; height: 36px; line-height: 34px; }
.btn-primary { background: #1677ff; color: #fff; border-color: #1677ff; }
.btn-primary:hover { background: #4096ff; border-color: #4096ff; opacity: 1; }
.btn-primary:disabled { background: #91caff; border-color: #91caff; cursor: not-allowed; opacity: 1; }
.btn-default { background: #fff; color: #262626; border-color: #d9d9d9; }
.btn-default:hover { color: #1677ff; border-color: #1677ff; opacity: 1; }
.btn-danger { background: #fff; color: #cf1322; border-color: #ffa39e; }
.btn-danger:hover { background: #fff1f0; opacity: 1; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; line-height: 26px; }
.btn-green { background: #52c41a; color: #fff; border-color: #52c41a; }

/* App shell */
#appRoot { display: flex; height: 100vh; overflow: hidden; }

/* Left nav */
.nav-rail {
  width: 60px;
  background: #0b1f3a;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  z-index: 10;
  padding-top: 8px;
}
.nav-item {
  width: 40px; height: 40px; margin: 4px 0; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.55); cursor: pointer; font-size: 18px;
  border: none; background: none;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-item.active { color: #fff; background: #1677ff; }
.nav-item svg { width: 20px; height: 20px; fill: currentColor; }

/* Agent panel */
.agent-panel {
  width: 300px;
  background: #fff;
  border-right: 1px solid #e6ebf2;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.agent-header {
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
}
.agent-avatar {
  width: 40px; height: 40px; border-radius: 4px;
  background: #1677ff;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px; font-weight: 600; flex-shrink: 0;
  overflow: hidden;
}
.agent-avatar img { width: 100%; height: 100%; object-fit: cover; }
.agent-info { flex: 1; min-width: 0; }
.agent-name { font-size: 14px; font-weight: 600; color: #1a2740; }
.agent-status {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; margin-top: 2px; cursor: pointer;
  padding: 1px 6px; border-radius: 2px;
}
.agent-status.online { color: #52c41a; background: #f6ffed; }
.agent-status.stop-new { color: #faad14; background: #fffbe6; }
.agent-status.stop-all { color: #ff4d4f; background: #fff2f0; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.conv-search {
  padding: 10px 12px 6px;
  display: flex; gap: 6px;
}
.conv-search input {
  flex: 1; height: 32px; padding: 0 10px;
  border: 1px solid #d9d9d9; border-radius: 4px; font-size: 12px; outline: none;
  background: #fafafa;
}
.conv-search input:focus { border-color: #1677ff; background: #fff; }
.conv-search .icon-btn,
.conv-search button {
  width: 32px; height: 32px; border: 1px solid #d9d9d9;
  background: #fff; border-radius: 4px; cursor: pointer; font-size: 14px; color: #595959;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.conv-search button:hover { color: #1677ff; border-color: #91caff; }

.conv-filters {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 6px; padding: 6px 10px 10px;
}
.conv-filter {
  padding: 8px 4px; text-align: center; cursor: pointer;
  border: 1px solid #f0f0f0; background: #fafafa; font-family: inherit;
  font-size: 11px; color: #8c8c8c; border-radius: 4px;
}
.conv-filter .num { display: block; font-size: 16px; font-weight: 700; color: #1a2740; line-height: 1.2; }
.conv-filter.active {
  background: #e6f4ff; color: #1677ff; border-color: #91caff;
}
.conv-filter.active .num { color: #1677ff; }

.conv-list { flex: 1; overflow-y: auto; background: #fff; }
.conv-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-bottom: 1px solid #f3f5f8;
  cursor: pointer; transition: background .1s; position: relative;
}
.conv-item:hover { background: #f5f5f5; }
.conv-item.active { background: #e6f4ff; }
.conv-item.pinned .name::before {
  content: '顶'; display: inline-block; margin-right: 4px;
  font-size: 10px; font-weight: 600; color: #1677ff;
  border: 1px solid #91caff; background: #e6f4ff;
  border-radius: 2px; padding: 0 3px; line-height: 14px; vertical-align: 1px;
}
.conv-item .mark-bar {
  position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 2px 2px 0;
}
.conv-item.mark-red .mark-bar { background: #ff4d4f; }
.conv-item.mark-orange .mark-bar { background: #fa8c16; }
.conv-item.mark-teal .mark-bar { background: #13c2c2; }
.conv-item.mark-blue .mark-bar { background: #1677ff; }
.conv-avatar {
  position: relative;
  width: 36px; height: 36px; border-radius: 4px; flex-shrink: 0;
  background: #1677ff;
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600;
  overflow: visible;
}
.conv-main { flex: 1; min-width: 0; }
.conv-item .row1 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.conv-item .name { font-size: 14px; font-weight: 600; color: #1a2740; }
.conv-item .time { font-size: 11px; color: #b0b7c3; flex-shrink: 0; margin-left: 8px; }
.conv-item .preview {
  font-size: 12px; color: #8c8c8c; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; margin-bottom: 4px;
}
.conv-item .meta { font-size: 11px; color: #b0b7c3; display: flex; justify-content: space-between; gap: 6px; }
.conv-item .meta-left { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .meta-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.conv-item .tag {
  font-size: 10px; padding: 1px 6px; border-radius: 3px;
  background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f;
}
.conv-item .tag-black { background: #fff1f0; color: #ff4d4f; border-color: #ffa39e; }
.conv-item .tag-muted { background: #f5f5f5; color: #999; border-color: #d9d9d9; }
.conv-item .tag-send { background: #f6ffed; color: #389e0d; border-color: #b7eb8f; }
.conv-item .tag-wait { background: #fff7e6; color: #d46b08; border-color: #ffd591; }
.conv-item .tag-soft { opacity: .85; }
.unread-badge {
  background: #ff4d4f; color: #fff; font-size: 10px;
  min-width: 16px; height: 16px; line-height: 16px;
  text-align: center; border-radius: 8px; padding: 0 4px;
}

/* Conversation context menu */
.conv-ctx-menu {
  position: fixed; z-index: 9999; min-width: 168px;
  background: #fff; border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.04);
  padding: 6px 0; font-size: 13px; color: #333;
}
.conv-ctx-menu.hidden { display: none; }
.conv-ctx-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; background: transparent; padding: 8px 14px;
  cursor: pointer; text-align: left; color: inherit; font-size: 13px; line-height: 1.3;
}
.conv-ctx-menu button:hover { background: #f5f5f5; }
.conv-ctx-menu button.danger { color: #ff4d4f; }
.conv-ctx-menu button.danger:hover { background: #fff1f0; }
.conv-ctx-menu .ico {
  width: 16px; text-align: center; font-size: 13px; color: #666; flex-shrink: 0;
}
.conv-ctx-menu button.danger .ico { color: #ff4d4f; }
.conv-ctx-sep { height: 1px; background: #f0f0f0; margin: 4px 0; }
.conv-ctx-block { padding: 6px 14px 8px; }
.conv-ctx-label {
  display: flex; align-items: center; gap: 10px; color: #333; margin-bottom: 8px; font-size: 13px;
}
.conv-ctx-label .ico { color: #666; }
.conv-ctx-colors { display: flex; gap: 8px; padding-left: 26px; }
.color-dot {
  width: 18px !important; height: 18px; padding: 0 !important; border-radius: 50%;
  border: 1px solid transparent !important; cursor: pointer; display: inline-flex !important;
  align-items: center; justify-content: center; font-size: 11px; line-height: 1;
}
.color-dot.red { background: #ff4d4f; }
.color-dot.orange { background: #fa8c16; }
.color-dot.teal { background: #13c2c2; }
.color-dot.blue { background: #1677ff; }
.color-dot.clear {
  background: #f5f5f5; color: #999; border-color: #d9d9d9 !important;
}
.color-dot:hover { transform: scale(1.08); }

/* Main workspace */
.workspace { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; background: #f0f2f5; }
.page-header {
  height: 52px; background: #fff; border-bottom: 1px solid #e6ebf2;
  padding: 0 20px; display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.page-header-left { display: flex; align-items: baseline; gap: 0; }
.page-title { font-size: 16px; font-weight: 600; color: #1a2740; }
.page-date { font-size: 12px; color: #999; margin-left: 12px; font-weight: 400; }
.page-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 32px; height: 32px; border: 1px solid #d9d9d9; background: #fff;
  border-radius: 4px; cursor: pointer; font-size: 14px; color: #595959;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.icon-btn:hover { color: #1677ff; border-color: #1677ff; }
.icon-btn.is-off { color: #bfbfbf; }
.page-body { flex: 1; overflow-y: auto; padding: 16px 20px; }
.page-body.chat-mode { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.page-body.chat-mode #chatMount { flex: 1; min-height: 0; display: flex; }

/* Dashboard */
.hero-banner {
  background: #fff; border: 1px solid #e8e8e8;
  border-radius: 4px; padding: 16px 20px; color: #262626; margin-bottom: 16px;
}
.hero-banner h2 { font-size: 16px; margin-bottom: 4px; font-weight: 600; }
.hero-banner p { font-size: 13px; color: #8c8c8c; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi-card {
  background: #fff; border: 1px solid #e8e8e8; border-radius: 4px; padding: 16px 18px;
}
.kpi-card .label { font-size: 12px; color: #888; margin-bottom: 8px; }
.kpi-card .value { font-size: 28px; font-weight: 700; color: #1677ff; }
.kpi-card .sub { font-size: 11px; color: #bbb; margin-top: 4px; }
.waiting-section {
  background: #fff; border: 1px solid #e8e8e8; border-radius: 4px; padding: 16px 20px;
  margin-bottom: 16px;
}
.waiting-section h3 { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: #222; }
.waiting-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid #f5f5f5; cursor: pointer;
}
.waiting-item:last-child { border-bottom: none; }
.waiting-item:hover { color: #1677ff; }

/* Chat 3-column */
.chat-layout {
  display: flex; flex: 1; overflow: hidden; width: 100%; height: 100%; min-height: 0;
}
.chat-center {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
  background: #f5f5f5;
}
.chat-header {
  position: relative;
  min-height: 64px; background: #fff; border-bottom: 1px solid #e6ebf2;
  padding: 10px 16px; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-shrink: 0; flex-wrap: wrap;
}
.chat-sense-tip {
  flex: 0 0 100%;
  order: -1;
  background: #e6f4ff; color: #0958d9; border: 1px solid #91caff;
  font-size: 12px; line-height: 1.4;
  padding: 6px 10px; border-radius: 4px;
  pointer-events: none;
}
.chat-sense-tip.hidden { display: none !important; }
.chat-header-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chat-header-avatar {
  position: relative;
  width: 36px; height: 36px; border-radius: 4px; flex-shrink: 0;
  background: #1677ff;
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 15px;
}
.chat-header-info { min-width: 0; }
.chat-header-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chat-header .title { font-size: 15px; font-weight: 600; color: #1a2740; }
.chat-status-tag {
  font-size: 11px; padding: 1px 8px; border-radius: 3px;
  background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f;
}
.chat-status-tag.muted { background: #f5f5f5; color: #999; border-color: #d9d9d9; }
.chat-status-tag.danger { background: #fff2f0; color: #cf1322; border-color: #ffccc7; }
.chat-warn-banner {
  margin: 0 16px 8px; padding: 10px 14px; border-radius: 8px;
  background: #fff7e6; border: 1px solid #ffd591; color: #ad6800;
  font-size: 13px; line-height: 1.6;
}
.chat-progress {
  font-size: 11px; color: #1677ff; background: #e6f4ff;
  border: 1px solid #91caff; border-radius: 3px; padding: 1px 8px;
}
.chat-header-meta {
  font-size: 11px; color: #8c8c8c; margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-header-actions { flex-shrink: 0; }

.messages {
  flex: 1; overflow-y: auto; padding: 20px 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.msg-empty {
  margin: auto; color: #b0b7c3; font-size: 13px; padding: 40px 0;
}
.msg-row {
  display: flex; gap: 10px; align-items: flex-start; max-width: 78%;
}
.msg-row.in { align-self: flex-start; }
.msg-row.out { align-self: flex-end; flex-direction: row; }
.msg-avatar {
  position: relative;
  width: 32px; height: 32px; border-radius: 4px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 600;
}
.msg-avatar.visitor { background: #52c41a; }
.msg-avatar.agent { background: #1677ff; }
.avatar-status-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-sizing: border-box;
  pointer-events: none;
  z-index: 2;
}
.msg-avatar .avatar-status-dot {
  width: 8px;
  height: 8px;
  border-width: 1.5px;
}
.avatar-status-dot.online { background: #52c41a; box-shadow: 0 0 0 1px rgba(82,196,26,.25); }
.avatar-status-dot.reachable { background: #faad14; box-shadow: 0 0 0 1px rgba(250,173,20,.25); }
.avatar-status-dot.offline { background: #c9cdd4; }
.msg-col { min-width: 0; display: flex; flex-direction: column; }
.msg-row.out .msg-col { align-items: flex-end; }
.msg-meta { font-size: 12px; color: #8c8c8c; margin-bottom: 4px; }
.msg-bubble {
  padding: 10px 14px; font-size: 14px; line-height: 1.55;
  word-break: break-word; border-radius: 10px; max-width: 100%;
}
.msg-row.in .msg-bubble {
  background: #fff; border: 1px solid #e6ebf2; color: #1a2740;
  border-top-left-radius: 4px;
}
.msg-row.out .msg-bubble {
  background: #1677ff; color: #fff; border-top-right-radius: 4px;
}
.msg-foot {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: #b0b7c3; margin-top: 4px;
}
.msg-sent { color: #52c41a; }

.composer-panel {
  flex-shrink: 0;
  padding: 0;
  background: #fff;
  border-top: 1px solid #e8e8e8;
}
.composer-card {
  position: relative;
  background: #fff;
  border: 0;
  border-radius: 0;
}
.composer-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 10px 4px;
}
.composer-tool {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: #6b7c93;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .15s, color .15s;
}
.composer-tool svg {
  width: 18px;
  height: 18px;
  display: block;
}
.composer-tool:hover {
  background: #f3f7fc;
  color: #3d4f67;
}
.composer-tool.active {
  color: #1677ff;
  background: #eef4ff;
}
.composer-tool.tool-mic {
  color: #52c41a;
}
.composer-tool.tool-mic:hover {
  background: #f6ffed;
  color: #389e0d;
}
.composer-tool.tool-mic.is-recording {
  color: #fff !important;
  background: #ff4d4f !important;
  animation: micPulse 1.2s ease-in-out infinite;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 77, 79, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(255, 77, 79, 0); }
}

.quote-bar {
  margin: 0 12px 8px;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  background: #f7f8fa;
  overflow: hidden;
}
.quote-bar-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}
.quote-bar-text {
  flex: 1;
  font-size: 12px;
  color: #595959;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-left: 3px solid #1677ff;
  padding-left: 8px;
}
.quote-bar-close {
  border: 0;
  background: transparent;
  color: #8c8c8c;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.quote-bar-close:hover { color: #262626; }

.composer-input-box {
  position: relative;
  margin: 0;
  border: 0;
  border-top: 1px solid #f0f0f0;
  background: #fff;
}
.composer-input-box textarea {
  display: block;
  width: 100%;
  min-height: 96px;
  max-height: 160px;
  padding: 10px 84px 10px 12px;
  border: 0;
  border-radius: 0;
  resize: none;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: transparent;
  line-height: 1.55;
  color: #1a2740;
}
.composer-input-box textarea::placeholder { color: #b0bac8; }
.composer-input-box textarea:focus { box-shadow: none; }
.composer-input-box .send-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-width: 72px;
  height: 32px;
  padding: 0 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}
.composer-input-box .send-btn:disabled { opacity: .6; cursor: not-allowed; }

.emoji-panel, .quick-popover {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(100% - 6px);
  z-index: 20;
  padding: 8px;
  background: #fff;
  border: 1px solid #e3e9f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .12);
}
.emoji-panel {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 2px;
  max-height: 160px;
  overflow-y: auto;
}
.emoji-panel.hidden, .quick-popover.hidden { display: none; }
.emoji-item {
  border: 0;
  background: transparent;
  font-size: 18px;
  line-height: 32px;
  cursor: pointer;
  border-radius: 6px;
}
.emoji-item:hover { background: #f0f5ff; }

.quick-popover { max-height: 220px; overflow-y: auto; }
.quick-pop-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}
.quick-pop-item:hover { background: #f0f5ff; }
.quick-pop-title { display: block; font-size: 13px; font-weight: 500; color: #333; }
.quick-pop-preview { display: block; font-size: 12px; color: #999; margin-top: 2px; }
.quick-pop-empty { padding: 12px; color: #bbb; font-size: 12px; text-align: center; }

.msg-image {
  max-width: 220px; max-height: 220px; border-radius: 6px; display: block;
  background: rgba(0,0,0,.04); object-fit: contain;
}
.msg-video-wrap { display: flex; flex-direction: column; gap: 6px; max-width: 260px; }
.msg-video {
  display: block; width: 100%; max-height: 240px; border-radius: 6px; background: #000;
}
.msg-file {
  color: inherit; text-decoration: none; word-break: break-all;
}
.msg-row.out .msg-file { color: #fff; text-decoration: underline; }
.msg-row.in .msg-file { color: #1677ff; }

.visitor-panel {
  width: 300px; background: #fff; border-left: 1px solid #e6ebf2;
  display: flex; flex-direction: column; flex-shrink: 0; min-height: 0;
}
.vp-tabs {
  display: flex; border-bottom: 1px solid #f0f0f0; flex-shrink: 0;
}
.vp-tab {
  flex: 1; border: 0; background: #fff; padding: 12px 0;
  font-size: 14px; color: #666; cursor: pointer; font-family: inherit;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.vp-tab.active { color: #1677ff; border-bottom-color: #1677ff; font-weight: 500; }
.vp-body { flex: 1; overflow-y: auto; }
.vp-profile { padding: 16px 16px 12px; border-bottom: 1px solid #f5f5f5; }
.vp-name { font-size: 16px; font-weight: 600; color: #1a2740; margin-bottom: 8px; }
.vp-badge {
  display: inline-block; font-size: 11px; color: #52c41a;
  background: #f6ffed; border: 1px solid #b7eb8f; border-radius: 3px; padding: 1px 6px;
}
.vp-meta-list { border-bottom: 8px solid #fafafa; }
.vp-meta-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 11px 16px; border-bottom: 1px solid #f5f5f5; font-size: 13px;
}
.vp-meta-label { color: #8c8c8c; flex-shrink: 0; min-width: 72px; }
.vp-meta-value {
  color: #1a2740; text-align: right; word-break: break-all; line-height: 1.4;
}
.vp-status-tag {
  font-size: 12px; padding: 1px 8px; border-radius: 3px; border: 1px solid;
}
.vp-status-tag.ok { color: #52c41a; background: #f6ffed; border-color: #b7eb8f; }
.vp-status-tag.warn { color: #faad14; background: #fffbe6; border-color: #ffe58f; }
.vp-status-tag.danger { color: #ff4d4f; background: #fff1f0; border-color: #ffa39e; }
.vp-status-tag.muted { color: #999; background: #fafafa; border-color: #d9d9d9; }
.vp-ref-tag {
  font-size: 12px; color: #1677ff; background: #e6f4ff;
  border: 1px solid #91caff; border-radius: 3px; padding: 1px 8px;
}
.vp-section-title {
  padding: 14px 16px 8px; font-size: 13px; font-weight: 600; color: #333;
}
.vp-contact-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-bottom: 1px solid #f5f5f5; min-height: 40px;
}
.vp-contact-row.editing { background: #fafafa; }
.vp-contact-label { font-size: 13px; color: #333; width: 42px; flex-shrink: 0; }
.vp-contact-value {
  flex: 1; font-size: 13px; color: #333; word-break: break-all;
  cursor: text; min-height: 20px; line-height: 20px;
}
.vp-contact-value.empty { color: #bfbfbf; }
.vp-contact-input {
  display: none; flex: 1; min-width: 0; height: 28px;
  border: 1px solid #1677ff; border-radius: 4px; padding: 0 8px;
  font-size: 13px; color: #333; outline: none; font-family: inherit;
  box-shadow: 0 0 0 2px rgba(22,119,255,.12);
}
.vp-contact-row.editing .vp-contact-value { display: none; }
.vp-contact-row.editing .vp-contact-input { display: block; }
.vp-contact-row.editing .vp-edit-btn { color: #1677ff; }
.vp-edit-btn {
  border: 0; background: transparent; color: #bfbfbf; cursor: pointer;
  font-size: 14px; padding: 4px; line-height: 1; flex-shrink: 0;
}
.vp-edit-btn:hover { color: #1677ff; }
.vp-actions { padding: 16px; }
.vp-blacklist-btn {
  width: 100%; height: 36px; border: 1px solid #ff4d4f; background: #fff;
  color: #ff4d4f; border-radius: 4px; font-size: 14px; cursor: pointer; font-family: inherit;
}
.vp-blacklist-btn:hover { background: #fff1f0; }
.vp-quick-list { padding: 8px; }
.vp-quick-item {
  display: block; width: 100%; text-align: left; border: 1px solid #f0f0f0;
  background: #fff; border-radius: 6px; padding: 10px 12px; margin-bottom: 8px;
  cursor: pointer; font-family: inherit;
}
.vp-quick-item:hover { border-color: #91caff; background: #f0f5ff; }
.vp-quick-title { display: block; font-size: 13px; font-weight: 500; color: #333; margin-bottom: 4px; }
.vp-quick-preview { display: block; font-size: 12px; color: #999; line-height: 1.4; }
.vp-empty { padding: 24px 16px; font-size: 12px; color: #bbb; text-align: center; line-height: 1.6; }

.info-row {
  padding: 10px 16px; border-bottom: 1px solid #f8f8f8;
  display: flex; flex-direction: column; gap: 2px;
}
.info-row .label { font-size: 11px; color: #999; }
.info-row .value { font-size: 13px; color: #333; word-break: break-all; }

/* Tables */
.data-table {
  width: 100%; background: #fff; border: 1px solid #e8e8e8; border-radius: 4px;
  overflow: hidden;
}
.data-table table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: #fafafa; padding: 12px 16px; text-align: left;
  font-size: 12px; color: #888; font-weight: 500; border-bottom: 1px solid #f0f0f0;
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid #f8f8f8; font-size: 13px; }
.data-table tr:hover td { background: #fafafa; }
.data-table .actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Cards / tabs */
.tabs { display: flex; gap: 0; border-bottom: 2px solid #f0f0f0; margin-bottom: 16px; }
.tab {
  padding: 10px 20px; cursor: pointer; font-size: 14px; color: #666;
  border: none; background: none; font-family: inherit;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab.active { color: #1677ff; border-bottom-color: #1677ff; font-weight: 500; }
.card {
  background: #fff; border: 1px solid #e8e8e8; border-radius: 4px; padding: 20px;
  margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; color: #222; }
.info-banner {
  background: #e6f4ff; border: 1px solid #91caff; border-radius: 8px;
  padding: 12px 16px; font-size: 13px; color: #0958d9; line-height: 1.6; margin-bottom: 16px;
}
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.qr-card {
  border: 1px solid #e8e8e8; border-radius: 10px; padding: 16px;
  text-align: center; background: #fafafa;
}
.qr-card img { width: 180px; height: 180px; display: block; margin: 0 auto 12px; border: 1px solid #eee; }
.qr-card .countdown { font-size: 13px; color: #1677ff; font-weight: 600; margin-bottom: 8px; }
.qr-card .status { font-size: 12px; color: #888; }

.entry-card {
  border: 1px solid #e8e8e8; border-radius: 10px; padding: 16px;
  display: grid; grid-template-columns: 120px 1fr; gap: 14px; margin-bottom: 12px;
  background: #fff;
}
.entry-card-qr img { width: 110px; height: 110px; border: 1px solid #eee; border-radius: 6px; display: block; }
.entry-card-title {
  font-weight: 600; margin-bottom: 4px; display: flex; align-items: center; gap: 8px;
}
.entry-badge {
  font-size: 11px; font-weight: 600; color: #1677ff; background: #e6f4ff;
  border: 1px solid #91caff; border-radius: 4px; padding: 1px 6px;
}
.entry-card-desc { font-size: 12px; color: #8c8c8c; margin-bottom: 8px; }

.user-entry-toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  justify-content: flex-start; margin-bottom: 16px;
}
.user-entry-toolbar .entry-search,
.user-entry-toolbar select {
  height: 34px; border: 1px solid #d9d9d9; border-radius: 8px;
  padding: 0 12px; font-size: 13px; font-family: inherit; background: #fff;
}
.user-entry-toolbar .entry-search { flex: 1; min-width: 180px; max-width: 320px; }
.user-entry-toolbar .btn { margin-left: auto; }

.user-entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.user-entry-card {
  background: #fff; border: 1px solid #e8e8e8; border-radius: 4px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.user-entry-card.is-off { opacity: .72; }
.user-entry-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; padding: 16px 16px 8px;
}
.user-entry-head-left { display: flex; gap: 10px; align-items: center; min-width: 0; }
.user-entry-ico {
  width: 36px; height: 36px; border-radius: 10px; background: #e6f4ff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-entry-title {
  font-size: 16px; font-weight: 700; color: #1a2740; line-height: 1.3;
  word-break: break-word;
}
.user-entry-badge {
  flex-shrink: 0; font-size: 12px; font-weight: 600;
  border-radius: 2px; padding: 2px 8px;
}
.user-entry-badge.on { color: #389e0d; background: #f6ffed; border: 1px solid #b7eb8f; }
.user-entry-badge.off { color: #8c8c8c; background: #f5f5f5; border: 1px solid #d9d9d9; }
.user-entry-badge.warn { color: #d46b08; background: #fff7e6; border: 1px solid #ffd591; }
.user-entry-sense { font-size: 11px; color: #8c8c8c; margin-top: 2px; }
.user-entry-qr-wrap {
  padding: 8px 28px 12px; display: flex; justify-content: center;
}
.user-entry-qr {
  width: 200px; height: 200px; display: block;
  border-radius: 8px; background: #fff;
}
.user-entry-foot { padding: 0 16px 16px; }
.user-entry-meta {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: #666; margin-bottom: 8px;
}
.user-entry-toggle { width: 40px; height: 22px; vertical-align: middle; }
.user-entry-toggle-label { font-size: 12px; color: #8c8c8c; }
.user-entry-url {
  font-size: 11px; color: #8c8c8c; word-break: break-all;
  background: #f7f9fc; border: 1px solid #eef2f7; border-radius: 8px;
  padding: 8px 10px; margin-bottom: 10px; max-height: 3.2em; overflow: hidden;
}
.user-entry-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* Entry page */
.entry-page-head { margin-bottom: 12px; }
.entry-page-head h2 { font-size: 20px; font-weight: 700; color: #1a2740; margin: 0 0 6px; }
.entry-page-head p { margin: 0; font-size: 13px; color: #8c8c8c; }
.entry-tabs {
  display: flex; gap: 0; flex-wrap: wrap; margin-bottom: 16px;
  padding: 0; background: transparent; border-bottom: 1px solid #e8e8e8; width: 100%;
}
.entry-tab {
  border: none; background: transparent; cursor: pointer; font-family: inherit;
  padding: 10px 16px; border-radius: 0; font-size: 13px; color: #595959;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.entry-tab.active { background: transparent; color: #1677ff; font-weight: 500; box-shadow: none; border-bottom-color: #1677ff; }
.entry-toolbar { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 16px; }
.entry-once-layout {
  display: grid; grid-template-columns: minmax(260px, 1fr) minmax(240px, 340px);
  gap: 20px; align-items: start;
}
@media (max-width: 900px) {
  .entry-once-layout { grid-template-columns: 1fr; }
}
.entry-bullets { margin: 0 0 12px; padding-left: 18px; color: #555; font-size: 13px; line-height: 1.8; }

.once-info-banner {
  display: flex; align-items: flex-start; gap: 10px;
}
.once-info-ico {
  width: 22px; height: 22px; border-radius: 50%; background: #1677ff; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0; line-height: 1;
}
.once-toolbar { justify-content: flex-end; }
.once-panel {
  background: #fff; border: 1px solid #e8e8e8; border-radius: 4px;
  min-height: 360px;
  padding: 24px;
}
.once-empty {
  min-height: 320px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; color: #b0bac8;
}
.once-empty-text { font-size: 14px; color: #9aa6b8; }

.once-connect-card {
  max-width: 420px; margin: 0 auto;
}
.once-connect-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.once-connect-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 700; color: #1a2740;
}
.once-connect-logo { width: 22px; height: 22px; border-radius: 6px; }
.once-connect-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.once-tag {
  font-size: 12px; font-weight: 600; border-radius: 6px; padding: 3px 8px;
}
.once-tag-green { color: #389e0d; background: #f6ffed; border: 1px solid #b7eb8f; }
.once-tag-blue { color: #1677ff; background: #e6f4ff; border: 1px solid #91caff; }
.once-connect-qr {
  display: flex; justify-content: center; padding: 8px 0 20px;
}
.once-connect-qr img {
  width: 240px; height: 240px; display: block; border-radius: 8px;
  background: #fff;
}
.once-connect-qr-ph {
  width: 240px; height: 240px; display: flex; align-items: center; justify-content: center;
  background: #f5f7fb; color: #bbb; border-radius: 8px; font-size: 13px;
}
.once-connect-timer { padding-top: 4px; }
.once-timer-row {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 14px; color: #555; margin-bottom: 10px;
}
.once-timer-row strong {
  font-size: 28px; font-weight: 700; color: #1677ff; letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
}
.once-progress {
  height: 8px; background: #e8eef6; border-radius: 999px; overflow: hidden;
  margin-bottom: 10px;
}
.once-progress-bar {
  height: 100%; background: #1677ff;
  border-radius: 0; transition: width .8s linear;
}
.once-end-time { font-size: 12px; color: #9aa6b8; }

.once-confirm-modal { width: 440px; }
.once-confirm-head {
  display: flex; align-items: center; gap: 10px;
}
.once-confirm-head h2 { margin: 0; }
.once-confirm-warn {
  width: 28px; height: 28px; border-radius: 50%; background: #faad14; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; flex-shrink: 0;
}
.once-confirm-desc { margin: 0; font-size: 14px; color: #666; line-height: 1.7; }
.once-confirm-actions { justify-content: flex-end; }
.once-confirm-actions .btn { flex: 0 0 auto; min-width: 96px; }

.repair-modal { width: 520px; max-width: 94vw; }
.repair-modal-head h2 { font-size: 17px; }
.repair-modal-desc {
  margin: 0 0 16px; font-size: 14px; color: #595959; line-height: 1.75;
}
.repair-line-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.repair-line-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border: 1px solid #e8e8e8; border-radius: 10px;
  cursor: pointer; font-size: 14px; color: #1a2740; background: #fafbfc;
}
.repair-line-opt:has(input:checked) {
  border-color: #1677ff; background: #e6f4ff; color: #0958d9;
}
.repair-line-opt input { accent-color: #1677ff; width: 16px; height: 16px; }
.repair-warn {
  background: #fffbe6; border: 1px solid #ffe58f; color: #ad6800;
  border-radius: 8px; padding: 10px 12px; font-size: 13px; line-height: 1.6;
  margin-bottom: 4px;
}
.repair-modal-actions { justify-content: flex-end; }
.repair-modal-actions .btn { flex: 0 0 auto; min-width: 88px; }

.qr-frame-card {
  max-width: 360px; margin: 0 auto; background: #fff; border-radius: 14px;
  box-shadow: 0 10px 28px rgba(26,39,64,.1); overflow: hidden; border: 1px solid #e8eef6;
}
.qr-frame-title {
  text-align: center; font-size: 20px; font-weight: 700; color: #111;
  padding: 22px 16px 8px; letter-spacing: .02em;
}
.qr-frame-body { padding: 8px 28px 18px; display: flex; justify-content: center; }
.qr-frame-img { width: 100%; max-width: 240px; aspect-ratio: 1; display: block; }
.qr-frame-placeholder {
  width: 220px; height: 220px; display: flex; align-items: center; justify-content: center;
  background: #f5f7fb; color: #bbb; border-radius: 8px; font-size: 13px;
}
.qr-frame-footer {
  background: #1677ff; color: #fff; text-align: center;
  padding: 14px 12px; font-size: 16px; font-weight: 600; letter-spacing: .04em;
}
.qr-frame-status { text-align: center; padding: 10px 12px 0; font-size: 12px; color: #666; }
.qr-frame-status .muted { color: #bbb; }
.qr-frame-actions { display: flex; gap: 8px; justify-content: center; padding: 12px 12px 16px; }

.qr-style-layout {
  display: grid; grid-template-columns: minmax(260px, 1fr) minmax(320px, 420px);
  gap: 20px; align-items: start;
}
@media (max-width: 960px) {
  .qr-style-layout { grid-template-columns: 1fr; }
}
.qr-style-preview {
  background: #f5f7fb; border-radius: 14px; padding: 28px 16px;
  min-height: 420px; display: flex; align-items: center; justify-content: center;
}
.logo-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.logo-opt {
  width: 44px; height: 44px; border-radius: 6px; border: 1px solid #d9d9d9;
  background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #8c8c8c; padding: 0;
}
.logo-opt img { width: 26px; height: 26px; object-fit: contain; }
.logo-opt-plus { font-size: 20px; line-height: 1; color: #8c8c8c; }
.logo-opt.active { border-color: #1677ff; box-shadow: 0 0 0 2px rgba(22,119,255,.15); }
.qr-style-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.qr-style-controls .field-hint { font-size: 12px; color: #8c8c8c; margin-top: 8px; }
.qr-range { width: 100%; accent-color: #1677ff; }
.qr-shadow-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.qr-shadow-row label { margin-bottom: 0; }
.qr-frame-card.is-plain .qr-frame-footer {
  background: #f5f5f5; color: #262626; font-weight: 500;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid #d9d9d9; background: #fff; border-radius: 6px;
  padding: 6px 12px; font-size: 12px; cursor: pointer; font-family: inherit; color: #555;
}
.chip.active { border-color: #1677ff; color: #1677ff; background: #e6f4ff; }

.app-toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%) translateY(-12px);
  background: #1a2740; color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13px; opacity: 0; pointer-events: none; z-index: 3000;
  transition: opacity .2s, transform .2s; box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.app-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Settings */
.settings-layout { display: grid; grid-template-columns: 200px 1fr; gap: 16px; }
.settings-nav { background: #fff; border: 1px solid #e8e8e8; border-radius: 4px; padding: 8px 0; }
.settings-nav-group {
  padding: 12px 16px 6px; font-size: 11px; color: #98a2b3;
  font-weight: 600; letter-spacing: .04em;
}
.settings-nav-item {
  padding: 10px 16px; cursor: pointer; font-size: 14px; color: #333;
  border-left: 3px solid transparent;
}
.settings-nav-item:hover { background: #fafafa; }
.settings-nav-item.active { color: #1677ff; background: #e6f4ff; border-left-color: #1677ff; }
.settings-welcome-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 20px;
}
.settings-welcome-desc {
  margin: 0; font-size: 13px; color: #667085; line-height: 1.6; max-width: 520px;
}
.settings-welcome-badge {
  flex-shrink: 0; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
}
.settings-welcome-badge.is-on { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.settings-welcome-badge.is-off { background: #f5f5f5; color: #8c8c8c; border: 1px solid #e8e8e8; }
.settings-form .field { margin-bottom: 20px; }
.settings-form label { display: block; font-size: 13px; color: #666; margin-bottom: 8px; }
.settings-form input, .settings-form select {
  width: 100%; max-width: 400px; height: 36px; padding: 0 10px;
  border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px;
}
.settings-form textarea {
  width: 100%; max-width: 480px; min-height: 96px; padding: 10px;
  border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px;
  font-family: inherit; resize: vertical; line-height: 1.5;
}
.settings-toggle-row {
  display: flex !important; align-items: center; gap: 8px;
  margin-bottom: 10px !important; font-size: 13px !important; color: #333 !important;
  font-weight: 400 !important; cursor: pointer;
}
.settings-toggle-row input { width: auto !important; max-width: none !important; height: auto !important; }
.settings-bind-intro {
  font-size: 13px; color: #666; line-height: 1.7; margin: 0 0 16px;
}
.settings-bind-status {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: 10px; margin-bottom: 16px;
}
.settings-bind-status.is-on { background: #f6ffed; border: 1px solid #b7eb8f; }
.settings-bind-status.is-off { background: #fff7e6; border: 1px solid #ffd591; }
.settings-bind-status-dot {
  width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0;
}
.settings-bind-status.is-on .settings-bind-status-dot { background: #52c41a; box-shadow: 0 0 0 4px rgba(82,196,26,.18); }
.settings-bind-status.is-off .settings-bind-status-dot { background: #fa8c16; box-shadow: 0 0 0 4px rgba(250,140,22,.18); }
.settings-bind-status-title { font-size: 14px; font-weight: 700; color: #1a2740; }
.settings-bind-status-sub { font-size: 12px; color: #8c8c8c; margin-top: 4px; }
.settings-bind-qr-block {
  margin-top: 20px; padding-top: 18px; border-top: 1px solid #f0f0f0;
}
.settings-bind-qr-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.settings-bind-qr-tip { font-size: 12px; color: #999; margin: 0 0 12px; }
.settings-bind-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.settings-bind-card .qr-wrap { max-width: 280px; margin: 0; }
.status-btns { display: flex; gap: 8px; }
.status-btn {
  padding: 8px 16px; border: 1px solid #d9d9d9; border-radius: 6px;
  background: #fff; cursor: pointer; font-size: 13px; font-family: inherit;
}
.status-btn.active-online { background: #f6ffed; border-color: #52c41a; color: #52c41a; }
.status-btn.active-stop-new { background: #fffbe6; border-color: #faad14; color: #faad14; }
.status-btn.active-stop-all { background: #fff2f0; border-color: #ff4d4f; color: #ff4d4f; }

.empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: #8c8c8c; gap: 8px;
  min-height: 240px; font-size: 13px;
}
.empty-state .icon { display: none; }

/* Modal */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
#appDialogOverlay { z-index: 2600; }
.modal-box {
  background: #fff; border-radius: 4px; width: 420px; max-width: 92vw;
  box-shadow: 0 8px 28px rgba(0,0,0,.16); overflow: hidden;
}
.app-dialog { width: 420px; }
.app-dialog-msg { margin: 0; font-size: 14px; color: #595959; line-height: 1.7; white-space: pre-wrap; }
.app-dialog-fields { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.app-dialog-fields .field { margin: 0; }
.app-dialog-fields input,
.app-dialog-fields textarea {
  width: 100%; padding: 8px 10px;
  border: 1px solid #d9d9d9; border-radius: 4px; font-size: 13px;
  font-family: inherit; outline: none;
}
.app-dialog-fields input { height: 36px; padding: 0 10px; }
.app-dialog-fields textarea {
  min-height: 88px; resize: vertical;
}
.app-dialog-fields textarea:focus,
.app-dialog-fields input:focus { border-color: #1677ff; }
.app-dialog-actions { justify-content: flex-end; }
.app-dialog-actions .btn { flex: 0 0 auto; min-width: 72px; }
.app-dialog-ok.danger { background: #ff4d4f; border-color: #ff4d4f; color: #fff; }
.app-dialog-ok.danger:hover { background: #cf1322; border-color: #cf1322; }
.modal-box.wide { width: 560px; }
.modal-head { padding: 20px 24px 12px; }
.modal-head h2 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.modal-head p { font-size: 13px; color: #888; line-height: 1.5; }
.modal-body { padding: 12px 24px 20px; }
.modal-actions { display: flex; gap: 8px; padding: 0 24px 20px; }
.modal-actions .btn { flex: 1; }
.qr-wrap {
  display: flex; flex-direction: column; align-items: center;
  min-height: 220px; justify-content: center; background: #fafafa;
  border: 1px solid #eee; border-radius: 8px;
}
.qr-wrap img { width: 200px; height: 200px; }
.qr-status { font-size: 13px; margin-top: 12px; text-align: center; color: #666; min-height: 20px; }
.qr-status.wait { color: #faad14; }
.qr-status.ok { color: #52c41a; }
.qr-status.err { color: #ff4d4f; }

.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider {
  position: absolute; inset: 0; background: #ccc; border-radius: 22px; cursor: pointer; transition: .2s;
}
.toggle .slider:before {
  content: ''; position: absolute; width: 18px; height: 18px;
  left: 2px; bottom: 2px; background: #fff; border-radius: 50%; transition: .2s;
}
.toggle input:checked + .slider { background: #1677ff; }
.toggle input:checked + .slider:before { transform: translateX(18px); }

@media (max-width: 900px) {
  .visitor-panel { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

.mobile-only { display: none !important; }
.mobile-nav { display: none; }

#mobileMoreOverlay { align-items: flex-end; }
.mobile-more-sheet {
  width: min(480px, 100%);
  background: #fff;
  border-radius: 12px 12px 0 0;
  padding: 6px 0 calc(8px + env(safe-area-inset-bottom, 0px));
}
.mobile-more-sheet button {
  display: block; width: 100%; height: 48px; border: 0; background: #fff;
  border-bottom: 1px solid #f0f0f0; font-size: 15px; font-family: inherit; cursor: pointer; color: #262626;
}
.mobile-more-sheet button:hover { background: #f5f7fb; }
.mobile-more-sheet .more-cancel { color: #8c8c8c; border-bottom: 0; margin-top: 4px; }

/* Pad workbench */
body.device-pad .agent-panel { width: 260px; }
body.device-pad .visitor-panel { display: none !important; }
body.device-pad .kpi-grid { grid-template-columns: repeat(2, 1fr); }
body.device-pad .settings-layout { grid-template-columns: 148px 1fr; }
body.device-pad .qr-style-layout,
body.device-pad .entry-once-layout { grid-template-columns: 1fr; }
body.device-pad .page-date { display: none; }

/* Mobile workbench */
body.device-m .mobile-only { display: inline-flex !important; }
body.device-m .mobile-only.hidden { display: none !important; }
body.device-m #appRoot {
  padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
}
body.device-m .nav-rail { display: none; }
body.device-m .page-date { display: none; }
body.device-m .agent-panel { width: 100%; border-right: none; }
body.device-m #appRoot.mobile-page .agent-panel,
body.device-m #appRoot.mobile-chat-open .agent-panel { display: none; }
body.device-m #appRoot.mobile-list-only .workspace { display: none; }
body.device-m .page-header { height: 48px; padding: 0 10px; }
body.device-m .page-body { padding: 12px; }
body.device-m .page-body.chat-mode { padding: 0; }
body.device-m .kpi-grid { grid-template-columns: 1fr 1fr; }
body.device-m .settings-layout { grid-template-columns: 1fr; }
body.device-m .settings-nav { display: flex; padding: 0; overflow-x: auto; }
body.device-m .settings-nav-group { display: none; }
body.device-m .settings-nav-item { flex: 1; text-align: center; border-left: none; border-bottom: 2px solid transparent; }
body.device-m .settings-nav-item.active { border-left: none; border-bottom-color: #1677ff; }
body.device-m .user-entry-grid { grid-template-columns: 1fr; }
body.device-m .user-entry-toolbar,
body.device-m .entry-toolbar { flex-wrap: wrap; }
body.device-m .qr-style-layout,
body.device-m .entry-once-layout { grid-template-columns: 1fr; }
body.device-m .once-connect-qr img,
body.device-m .once-connect-qr-ph { width: 200px; height: 200px; }
body.device-m .login-panel { width: 100%; border: none; }
body.device-m #loginPage { padding: 12px; align-items: flex-start; }
body.device-m .login-head,
body.device-m .login-body { padding-left: 20px; padding-right: 20px; }
body.device-m .field input,
body.device-m .btn-block { height: 40px; }
body.device-m .visitor-panel { display: none !important; }
body.device-m .chat-header { padding: 10px 12px; }
body.device-m .mobile-nav {
  display: flex;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(56px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #fff;
  border-top: 1px solid #e8e8e8;
  z-index: 80;
}
.mobile-nav-item {
  flex: 1; border: 0; background: none; color: #8c8c8c;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 10px; font-family: inherit; cursor: pointer;
}
.mobile-nav-item svg { width: 20px; height: 20px; fill: currentColor; }
.mobile-nav-item.active { color: #1677ff; }

@media (max-width: 767px) {
  body.device-pc .nav-rail { width: 52px; }
  body.device-pc .agent-panel { width: 220px; }
}

/* —— Enterprise dashboard / visitors / stats —— */
.ent-hero {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px;
  background: linear-gradient(135deg, #0b1f3a 0%, #163a6b 55%, #1a4f8c 100%);
  color: #fff; border-radius: 8px; padding: 22px 24px; margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(15, 40, 80, .18);
}
.ent-hero-kicker {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  opacity: .72; margin-bottom: 6px;
}
.ent-hero h2 { font-size: 22px; font-weight: 700; margin: 0 0 6px; color: #fff; }
.ent-hero p { margin: 0; font-size: 13px; opacity: .85; }
.ent-hero-actions { display: flex; gap: 8px; flex-shrink: 0; }
.ent-hero-actions .btn { border: 0; }
.ent-hero-actions .btn-default { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25); }
.ent-hero-actions .btn-default:hover { background: rgba(255,255,255,.2); }

.kpi-grid.ent-kpi { margin-bottom: 12px; }
.kpi-grid.ent-kpi-secondary { margin-bottom: 16px; }
.kpi-card.soft .value { font-size: 22px; color: #1a2740; }
.kpi-card.soft .label { color: #8c8c8c; }

.ent-split {
  display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px;
}
.ent-panel { padding: 16px 18px; }
.ent-panel .card-title {
  font-size: 14px; font-weight: 600; color: #1a2740;
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.ent-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: #e6f4ff; color: #1677ff; font-size: 12px; font-weight: 600;
}
.ent-waiting {
  display: flex; align-items: center; gap: 12px; justify-content: flex-start;
  padding: 10px 4px;
}
.ent-waiting-main { flex: 1; min-width: 0; }
.ent-waiting-name { font-size: 14px; font-weight: 600; color: #1a2740; }
.ent-waiting-sub { font-size: 12px; color: #8c8c8c; margin-top: 2px; }
.ent-waiting-time { font-size: 11px; color: #b0b7c3; flex-shrink: 0; }
.ent-empty, .ent-empty-row { text-align: center; color: #b0b7c3; padding: 24px 8px; font-size: 13px; }

.ent-page-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 14px;
}
.ent-page-head h3 { margin: 0 0 4px; font-size: 18px; color: #1a2740; }
.ent-page-head p { margin: 0; font-size: 13px; color: #8c8c8c; }

.ent-toolbar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-bottom: 12px; background: #fff; border: 1px solid #e8e8e8;
  border-radius: 6px; padding: 10px 12px;
}
.ent-select, .ent-input {
  height: 32px; border: 1px solid #d9d9d9; border-radius: 4px;
  padding: 0 10px; font-size: 13px; font-family: inherit; background: #fff;
}
.ent-input { flex: 1; min-width: 160px; }
.ent-select:focus, .ent-input:focus { outline: none; border-color: #1677ff; }

.ent-table { background: #fff; border: 1px solid #e8e8e8; border-radius: 6px; overflow: hidden; }
.ent-table table { width: 100%; border-collapse: collapse; }
.ent-table th {
  background: #fafbfc; text-align: left; font-size: 12px; color: #8c8c8c;
  font-weight: 600; padding: 10px 14px; border-bottom: 1px solid #f0f0f0;
}
.ent-table td {
  padding: 12px 14px; font-size: 13px; color: #262626;
  border-bottom: 1px solid #f5f5f5; vertical-align: middle;
}
.ent-table tr:last-child td { border-bottom: none; }
.ent-table tr:hover td { background: #fafcff; }
.ent-table .actions { white-space: nowrap; }
.ent-table .tag-black {
  display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 3px;
  background: #fff1f0; color: #ff4d4f; border: 1px solid #ffa39e;
}

.ent-user-cell { display: flex; align-items: center; gap: 10px; }
.ent-user-name { font-weight: 600; color: #1a2740; }
.ent-user-id { font-size: 11px; color: #b0b7c3; margin-top: 2px; font-family: ui-monospace, monospace; }

.user-avatar {
  overflow: hidden;
}
.conv-avatar, .chat-header-avatar, .msg-avatar {
  overflow: visible;
}
.user-avatar {
  position: relative;
  width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0;
  background: #1677ff; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600;
}
.user-avatar.sm { width: 36px; height: 36px; border-radius: 6px; font-size: 14px; }
.user-avatar img,
.conv-avatar img,
.chat-header-avatar img,
.msg-avatar img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block; z-index: 1;
  border-radius: inherit;
}
.user-avatar .avatar-fallback,
.conv-avatar .avatar-fallback,
.chat-header-avatar .avatar-fallback,
.msg-avatar .avatar-fallback {
  display: none;
}
.ent-pagination {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-top: 14px; flex-wrap: wrap;
  background: #fff; border: 1px solid #e8e8e8; border-radius: 6px;
  padding: 10px 14px;
}
.ent-page-info { font-size: 13px; color: #8c8c8c; }
.ent-page-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.ent-page-btns .btn[disabled] { opacity: .45; cursor: not-allowed; }

.ent-bars {
  display: flex; align-items: flex-end; gap: 10px; height: 148px;
  padding: 8px 4px 0;
}
.ent-bar-col {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; gap: 6px; min-width: 0;
}
.ent-bar {
  width: 100%; max-width: 36px;
  background: linear-gradient(180deg, #69b1ff, #1677ff);
  border-radius: 4px 4px 2px 2px;
}
.ent-bar-label { font-size: 11px; color: #8c8c8c; white-space: nowrap; }

/* —— Stats trend chart —— */
.stats-trend-card { margin-bottom: 16px; padding: 18px 20px 16px; }
.stats-trend-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.stats-trend-title { font-size: 14px; font-weight: 600; color: #1a2740; }
.stats-trend-legend { display: flex; align-items: center; gap: 14px; }
.stats-trend-legend-item {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: #8c8c8c;
}
.stats-trend-legend-item .dot {
  width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0;
}
.stats-trend-legend-item .dot.is-reception { background: #1677ff; }
.stats-trend-legend-item .dot.is-reply { background: #95de64; }

.stats-trend-body {
  display: flex; align-items: stretch; gap: 10px; min-height: 204px;
}
.stats-trend-yaxis {
  width: 28px; flex-shrink: 0; display: flex; flex-direction: column;
  justify-content: space-between; align-items: flex-end;
  padding: 0 0 28px; font-size: 11px; color: #b0b7c3; line-height: 1;
}
.stats-trend-plot {
  flex: 1; min-width: 0; position: relative;
  background: linear-gradient(180deg, #fafbfd 0%, #fff 100%);
  border: 1px solid #eef1f6; border-radius: 8px;
  padding: 12px 10px 0;
}
.stats-trend-grid {
  position: absolute; inset: 12px 10px 28px; pointer-events: none;
}
.stats-trend-grid-line {
  position: absolute; left: 0; right: 0; height: 1px;
  background: #eef1f6;
}
.stats-trend-cols {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px; align-items: end; min-height: 196px;
}
.stats-trend-col {
  display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; gap: 8px; min-width: 0; position: relative;
  padding: 0 2px 0; border-radius: 6px 6px 0 0;
}
.stats-trend-col.is-today {
  background: rgba(22, 119, 255, .04);
}
.stats-trend-col.is-today .stats-trend-xlabel {
  color: #1677ff; font-weight: 600;
}
.stats-trend-bar-group {
  width: 100%; max-width: 52px;
  display: flex; align-items: flex-end; justify-content: center;
  gap: 4px;
}
.stats-trend-bar {
  flex: 1; max-width: 22px;
  border-radius: 4px 4px 1px 1px;
  position: relative; transition: opacity .15s ease, transform .15s ease;
}
.stats-trend-bar.is-reception { background: #1677ff; }
.stats-trend-bar.is-reply { background: #95de64; }
.stats-trend-bar-val {
  position: absolute; left: 50%; top: -18px; transform: translateX(-50%);
  font-size: 10px; color: #595959; white-space: nowrap; opacity: 0;
  pointer-events: none; transition: opacity .15s ease;
}
.stats-trend-col:hover .stats-trend-bar-val { opacity: 1; }
.stats-trend-col:hover .stats-trend-bar { opacity: .92; transform: translateY(-1px); }
.stats-trend-xlabel {
  font-size: 11px; color: #8c8c8c; white-space: nowrap;
  padding-bottom: 8px; text-align: center;
}
.stats-trend-tip {
  position: absolute; left: 50%; top: -6px; transform: translate(-50%, -100%);
  background: rgba(26, 39, 64, .92); color: #fff;
  font-size: 11px; line-height: 1.35; padding: 6px 10px; border-radius: 6px;
  white-space: nowrap; opacity: 0; pointer-events: none; z-index: 3;
  box-shadow: 0 6px 16px rgba(15, 40, 80, .18);
  transition: opacity .15s ease, transform .15s ease;
}
.stats-trend-col:hover .stats-trend-tip {
  opacity: 1; transform: translate(-50%, calc(-100% - 2px));
}
.stats-trend-empty {
  text-align: center; color: #b0b7c3; padding: 48px 12px; font-size: 13px;
}

@media (max-width: 900px) {
  .ent-split { grid-template-columns: 1fr; }
  .ent-hero { flex-direction: column; align-items: flex-start; }
}
body.device-m .ent-kpi { grid-template-columns: 1fr 1fr; }
body.device-m .stats-trend-cols { gap: 2px; }
body.device-m .stats-trend-bar-group { max-width: 42px; gap: 2px; }
body.device-m .stats-trend-xlabel { font-size: 10px; }
body.device-m .stats-trend-tip { display: none; }
body.device-m .ent-bars { gap: 6px; }

/* inbound media + wechat emoji */
.wx-emoji {
  width: 24px; height: 24px; vertical-align: -6px;
  display: inline-block; margin: 0 1px;
}
.msg-voice {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  min-width: 180px;
}
.msg-audio { max-width: 260px; height: 36px; }
.msg-voice-tip { font-size: 12px; color: #8c8c8c; }
.msg-voice-asr {
  margin-top: 6px;
  font-size: 12px;
  color: #595959;
  line-height: 1.45;
  background: rgba(0,0,0,.03);
  border-radius: 4px;
  padding: 4px 6px;
}
.msg-quote {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  max-width: 100%;
}
.msg-quote-bar {
  width: 3px;
  border-radius: 2px;
  background: #91caff;
  flex-shrink: 0;
}
.msg-quote-body {
  font-size: 12px;
  color: #8c8c8c;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.msg-voice-fail, .msg-media-fail {
  font-size: 13px; color: #8c8c8c; padding: 4px 0;
}
.msg-media-hint { font-size: 11px; color: #bfbfbf; margin-top: 2px; }
.msg-caption { margin-top: 6px; font-size: 13px; line-height: 1.5; }

/* message actions */
.msg-bubble-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
}
.msg-row.out .msg-bubble-wrap { flex-direction: row; }
.msg-more-btn {
  opacity: 0;
  border: 0;
  background: transparent;
  color: #8c8c8c;
  width: 24px; height: 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: opacity .15s, background .15s, color .15s;
}
.msg-row:hover .msg-more-btn,
.msg-more-btn:focus { opacity: 1; }
.msg-more-btn:hover { background: #f0f0f0; color: #1677ff; }
.msg-bubble-revoked {
  background: #f5f5f5 !important;
  color: #8c8c8c !important;
  border-color: transparent !important;
  font-size: 12px;
  padding: 8px 12px;
}
.msg-row.out .msg-bubble-revoked { background: #eef2f7 !important; color: #8c8c8c !important; }
.msg-revoked { font-style: italic; }
.msg-revoked-tag { color: #bfbfbf; }
.msg-ctx-menu button.hidden { display: none; }
body.device-m .msg-more-btn { opacity: .7; }
.wx-emoji-uni {
  font-size: 22px;
  line-height: 1;
  vertical-align: -3px;
  display: inline-block;
  margin: 0 1px;
}

/* 平台管理后台（无聊天侧栏） */
#appRoot.platform-console .agent-panel { display: none !important; }
#appRoot.platform-console .main { margin-left: 0; }
.platform-split {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(300px, 1.2fr);
  gap: 12px;
  align-items: start;
}
.platform-readonly-chat { min-height: 360px; max-height: 70vh; display: flex; flex-direction: column; }
.platform-msg-list {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px 8px;
}
.platform-msg {
  max-width: 88%;
  padding: 8px 12px;
  border-radius: 10px;
  background: #f2f4f7;
  font-size: 13px;
  line-height: 1.45;
  color: #344054;
}
.platform-msg.out {
  align-self: flex-end;
  background: #eef4ff;
  color: #175cd3;
}
.platform-msg.in { align-self: flex-start; }
.platform-msg-meta {
  font-size: 11px;
  color: #98a2b3;
  margin-bottom: 4px;
}
.platform-msg-body { white-space: pre-wrap; word-break: break-word; }
.ent-table tr.is-active-row td { background: #f5f8ff; }
@media (max-width: 900px) {
  .platform-split { grid-template-columns: 1fr; }
}

/* =========================
 * 平台后台 · 苹果CMS风格
 * ========================= */
:root {
  --pcm-sidebar: 210px;
  --pcm-bg: #ecf0f5;
  --pcm-side: #1e222d;
  --pcm-side-2: #2a3040;
  --pcm-accent: #3c8dbc;
  --pcm-success: #00a65a;
  --pcm-warning: #f39c12;
  --pcm-danger: #dd4b39;
  --pcm-info: #00c0ef;
}
#appRoot.platform-console {
  display: grid !important;
  background: var(--pcm-bg);
  grid-template-columns: var(--pcm-sidebar) 1fr;
  grid-template-rows: 1fr;
  min-height: 100vh;
}
#appRoot.platform-console .agent-panel,
#appRoot.platform-console .mobile-nav { display: none !important; }
#appRoot.platform-console .nav-rail,
#appRoot.platform-console .pcm-sidebar {
  grid-column: 1;
  grid-row: 1;
  width: var(--pcm-sidebar);
  background: linear-gradient(180deg, #1e222d 0%, #171a22 100%);
  color: #b8c0cc;
  display: flex;
  flex-direction: column;
  overflow: auto;
  border-right: 1px solid #11141b;
}
#appRoot.platform-console .workspace {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--pcm-bg);
}
#appRoot.platform-console .page-header {
  background: #fff;
  border-bottom: 1px solid #d2d6de;
  box-shadow: 0 1px 1px rgba(0,0,0,.04);
  padding: 10px 16px;
  min-height: 50px;
}
#appRoot.platform-console .page-title {
  font-size: 15px;
  font-weight: 600;
  color: #444;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
#appRoot.platform-console .pcm-crumb { color: #999; font-weight: 500; }
#appRoot.platform-console .pcm-crumb-sep { color: #ccc; margin: 0 2px; }
#appRoot.platform-console .page-body {
  padding: 14px 16px 28px;
  overflow: auto;
}
.pcm-brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 16px 14px;
  background: #181b24;
  border-bottom: 1px solid #111;
}
.pcm-brand-mark {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--pcm-accent); color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 13px;
}
.pcm-brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.pcm-brand-text strong { color: #fff; font-size: 13px; }
.pcm-brand-text span { font-size: 11px; color: #8892a0; }
.pcm-nav-group { padding: 10px 0 4px; }
.pcm-nav-group-title {
  padding: 4px 16px 8px;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #6d7685;
}
.pcm-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border: 0;
  background: transparent;
  color: #c5cbd6;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  border-left: 3px solid transparent;
}
.pcm-nav-item:hover { background: rgba(255,255,255,.04); color: #fff; }
.pcm-nav-item.active {
  background: #2a3040;
  color: #fff;
  border-left-color: var(--pcm-accent);
}
.pcm-nav-ico { width: 18px; height: 18px; display: inline-flex; opacity: .85; }
.pcm-nav-ico svg { width: 18px; height: 18px; fill: currentColor; }
.pcm-sidebar-foot {
  margin-top: auto;
  padding: 14px;
  border-top: 1px solid #111;
}
.pcm-user { font-size: 12px; color: #9aa3b2; margin-bottom: 8px; }
.pcm-logout {
  width: 100%;
  border: 1px solid #3a4150;
  background: transparent;
  color: #c5cbd6;
  border-radius: 4px;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 12px;
}
.pcm-logout:hover { border-color: var(--pcm-danger); color: #fff; }
.pcm-page-hd {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.pcm-page-hd h3 { margin: 0 0 4px; font-size: 18px; color: #333; }
.pcm-page-hd p { margin: 0; font-size: 12px; color: #888; }
.pcm-page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pcm-box {
  background: #fff;
  border: 1px solid #d2d6de;
  border-radius: 3px;
  margin-bottom: 14px;
  box-shadow: 0 1px 1px rgba(0,0,0,.04);
}
.pcm-box-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
  font-size: 14px;
  font-weight: 600;
  color: #444;
}
.pcm-box-bd { padding: 12px 14px; }
.pcm-stat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.pcm-stat-grid.sm { grid-template-columns: repeat(4, 1fr); }
.pcm-stat {
  background: #fff;
  border: 1px solid #d2d6de;
  border-top: 3px solid var(--pcm-accent);
  border-radius: 3px;
  padding: 12px 14px;
}
.pcm-stat:nth-child(2) { border-top-color: var(--pcm-success); }
.pcm-stat:nth-child(3) { border-top-color: var(--pcm-info); }
.pcm-stat:nth-child(4) { border-top-color: var(--pcm-warning); }
.pcm-stat:nth-child(5) { border-top-color: #605ca8; }
.pcm-stat:nth-child(6) { border-top-color: var(--pcm-danger); }
.pcm-stat .k { font-size: 12px; color: #888; }
.pcm-stat .v { font-size: 26px; font-weight: 700; color: #333; line-height: 1.2; margin: 4px 0; }
.pcm-stat .s { font-size: 11px; color: #999; }
.pcm-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.pcm-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.pcm-toolbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.pcm-tabs { display: flex; gap: 0; border: 1px solid #d2d6de; border-radius: 3px; overflow: hidden; background: #fff; }
.pcm-tab {
  border: 0;
  background: #fff;
  padding: 7px 14px;
  font-size: 12px;
  color: #555;
  cursor: pointer;
  border-right: 1px solid #d2d6de;
}
.pcm-tab:last-child { border-right: 0; }
.pcm-tab.active { background: var(--pcm-accent); color: #fff; }
.pcm-btn {
  border: 1px solid #d2d6de;
  background: #f4f4f4;
  color: #444;
  border-radius: 3px;
  padding: 7px 12px;
  font-size: 12px;
  cursor: pointer;
  line-height: 1.2;
}
.pcm-btn:hover { background: #e7e7e7; }
.pcm-btn.primary { background: var(--pcm-accent, #3c8dbc); border-color: #367fa9; color: #fff; }
.pcm-btn.primary:hover { background: #367fa9; color: #fff; }
.pcm-btn.success { background: var(--pcm-success, #00a65a); border-color: #008d4c; color: #fff; }
.pcm-btn.danger { background: var(--pcm-danger, #dd4b39); border-color: #d73925; color: #fff; }
.pcm-btn.danger:hover { background: #d73925; color: #fff; }
.pcm-btn.warning { background: var(--pcm-warning, #f39c12); border-color: #e08e0b; color: #fff; }
.pcm-layer-ft .pcm-btn {
  min-width: 72px;
  font-weight: 600;
}
.pcm-btn.xs { padding: 3px 8px; font-size: 11px; }
.pcm-input {
  border: 1px solid #d2d6de;
  border-radius: 3px;
  padding: 6px 10px;
  font-size: 13px;
  background: #fff;
  min-width: 160px;
}
.pcm-input.w90 { width: 90px; min-width: 90px; }
.pcm-input.w70 { width: 70px; min-width: 70px; }
.pcm-input.flex { flex: 1; min-width: 140px; }
.pcm-form-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pcm-form-row.wrap { gap: 8px; }
.pcm-form-row label { font-size: 12px; color: #666; }
.pcm-form { display: flex; flex-direction: column; gap: 12px; max-width: 640px; }
.pcm-field { display: flex; flex-direction: column; gap: 6px; }
.pcm-field label { font-size: 12px; color: #666; }
.pcm-table-wrap { overflow: auto; }
.pcm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.pcm-table th {
  background: #f5f7fa;
  color: #555;
  font-weight: 600;
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid #e5e9f0;
  white-space: nowrap;
}
.pcm-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #f0f2f5;
  color: #444;
  vertical-align: middle;
}
.pcm-table tr:hover td { background: #f9fbff; }
.pcm-table tr.is-active td { background: #eef6fc; }
.pcm-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}
.pcm-badge-success { background: #00a65a; color: #fff; }
.pcm-badge-danger { background: #dd4b39; color: #fff; }
.pcm-badge-warning { background: #f39c12; color: #fff; }
.pcm-badge-info { background: #00c0ef; color: #fff; }
.pcm-badge-muted { background: #d2d6de; color: #444; }
.pcm-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: #f4f6f8;
  padding: 2px 6px;
  border-radius: 2px;
  cursor: pointer;
}
.pcm-code:hover { background: #e8eef5; }
.pcm-ops { white-space: nowrap; display: flex; gap: 4px; }
.pcm-link {
  border: 0; background: none; color: var(--pcm-accent);
  cursor: pointer; padding: 0; font-size: inherit;
}
.pcm-link:hover { text-decoration: underline; }
.pcm-muted { color: #999; font-size: 12px; }
.pcm-sub { font-size: 11px; color: #999; margin-top: 2px; }
.pcm-warn-text { color: #dd4b39; font-weight: 700; }
.pcm-empty { text-align: center; color: #999; padding: 28px 12px; font-size: 13px; }
.pcm-loading { text-align: center; color: #888; padding: 48px 12px; }
.pcm-alert {
  padding: 10px 12px;
  border-radius: 3px;
  margin-bottom: 10px;
  font-size: 13px;
  border: 1px solid transparent;
}
.pcm-alert.warning { background: #fcf8e3; border-color: #faebcc; color: #8a6d3b; }
.pcm-alert.danger { background: #f2dede; border-color: #ebccd1; color: #a94442; }
.pcm-alert.info { background: #d9edf7; border-color: #bce8f1; color: #31708f; }
.pcm-spark {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 56px;
  padding-top: 8px;
}
.pcm-spark i {
  flex: 1;
  display: block;
  background: linear-gradient(180deg, #3c8dbc, #7bb7d9);
  border-radius: 2px 2px 0 0;
  min-width: 10px;
}
.pcm-split {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 12px;
}
.pcm-split-tall {
  min-height: 520px;
  align-items: stretch;
}
.pcm-split-tall > * { min-height: 0; }
.pcm-tenant-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #d2d6de;
  border-radius: 4px;
  margin-bottom: 12px;
}
.pcm-tenant-hero-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pcm-tenant-title-row { display: flex; align-items: center; gap: 12px; }
.pcm-tenant-title-row h3 { margin: 0 0 6px; font-size: 18px; color: #333; }
.pcm-avatar {
  width: 44px; height: 44px; border-radius: 8px;
  background: linear-gradient(135deg, #3c8dbc, #5fa6cb);
  color: #fff; font-weight: 700; font-size: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.pcm-avatar-sm {
  width: 22px; height: 22px; border-radius: 4px;
  background: #e8eef5; color: #3c8dbc; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  margin-right: 6px; vertical-align: middle;
}
.pcm-tenant-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pcm-chip {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 2px;
  background: #f4f6f8; color: #666; font-size: 11px;
  border: 1px solid #e5e9f0;
}
.pcm-chip.warn { background: #fcf8e3; border-color: #faebcc; color: #8a6d3b; }
.pcm-tabs-detail { margin-bottom: 12px; flex-wrap: wrap; }
.pcm-tenant-panel { min-height: 280px; }
.pcm-conv-list { display: flex; flex-direction: column; }
.pcm-conv-item {
  position: relative;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #f0f2f5;
  background: #fff;
  padding: 10px 12px;
  cursor: pointer;
  width: 100%;
}
.pcm-conv-item:hover { background: #f7fafc; }
.pcm-conv-item.active { background: #eef6fc; }
.pcm-conv-item .row {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 13px; color: #333; margin-bottom: 4px;
}
.pcm-conv-item .row span { color: #99a; font-size: 11px; flex-shrink: 0; }
.pcm-conv-item .preview {
  font-size: 12px; color: #888;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding-right: 28px;
}
.pcm-conv-item .unread { position: absolute; right: 10px; bottom: 10px; }
.pcm-table-tenant td { white-space: nowrap; }
@media (max-width: 900px) {
  .pcm-split-tall { min-height: 0; }
}
.pcm-readonly {
  border: 1px solid #d2d6de;
  background: #fff;
  border-radius: 3px;
  min-height: 360px;
  display: flex;
  flex-direction: column;
}
.pcm-readonly-hd {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  background: #fafafa;
  font-size: 13px;
  font-weight: 600;
  color: #555;
}
.pcm-msg-list {
  flex: 1;
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f7f9fb;
}
.pcm-msg {
  max-width: 85%;
  padding: 8px 10px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #e8ecf1;
  font-size: 13px;
}
.pcm-msg.out { align-self: flex-end; background: #e8f4fc; border-color: #cfe6f5; }
.pcm-msg.in { align-self: flex-start; }
.pcm-msg .meta { font-size: 11px; color: #98a2b3; margin-bottom: 4px; }
.pcm-msg .body { white-space: pre-wrap; word-break: break-word; color: #333; }
.pcm-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}
.pcm-meta-grid span { display: block; font-size: 11px; color: #999; }
.pcm-meta-grid b { font-size: 13px; color: #333; font-weight: 600; }
.pcm-ellipsis {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 1200px) {
  .pcm-stat-grid { grid-template-columns: repeat(3, 1fr); }
  .pcm-grid-2, .pcm-split { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  #appRoot.platform-console {
    grid-template-columns: 1fr;
  }
  #appRoot.platform-console .pcm-sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    max-height: none;
    z-index: 20;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .pcm-brand { width: 100%; }
  .pcm-nav-group { display: flex; flex-wrap: wrap; padding: 0; }
  .pcm-nav-group-title { display: none; }
  .pcm-nav-item { width: auto; border-left: 0; border-bottom: 2px solid transparent; padding: 8px 12px; }
  .pcm-nav-item.active { border-bottom-color: var(--pcm-accent); background: transparent; }
  .pcm-sidebar-foot { display: none; }
  .pcm-stat-grid, .pcm-stat-grid.sm { grid-template-columns: 1fr 1fr; }
}

/* =========================
 * 平台二层弹窗 + 表格列规划
 * ========================= */
.pcm-layer {
  position: fixed;
  inset: 0;
  z-index: 2800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.pcm-layer.hidden { display: none !important; }
.pcm-layer-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .45);
}
.pcm-layer-panel {
  position: relative;
  z-index: 1;
  width: 520px;
  max-width: 96vw;
  max-height: min(86vh, 720px);
  background: #fff;
  border: 1px solid #d2d6de;
  border-radius: 4px;
  box-shadow: 0 12px 40px rgba(0,0,0,.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pcm-layer-panel.pcm-w-sm { width: 420px; }
.pcm-layer-panel.pcm-w-md { width: 560px; }
.pcm-layer-panel.pcm-w-lg { width: 680px; }
.pcm-layer-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #f7f9fb;
  border-bottom: 1px solid #e5e9f0;
}
.pcm-layer-hd h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #333;
}
.pcm-layer-x {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: #889;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  border-radius: 3px;
}
.pcm-layer-x:hover { background: #eef1f5; color: #333; }
.pcm-layer-bd {
  padding: 16px;
  overflow: auto;
  flex: 1;
}
.pcm-layer-ft {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #eef1f5;
  background: #fafafa;
}
.pcm-layer-msg {
  margin: 0;
  font-size: 13px;
  color: #555;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.pcm-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}
.pcm-field-grid .pcm-field.span-2 { grid-column: 1 / -1; }
.pcm-field { display: flex; flex-direction: column; gap: 6px; }
.pcm-field label {
  font-size: 12px;
  color: #666;
  font-weight: 600;
}
.pcm-field .pcm-input,
.pcm-field textarea.pcm-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.pcm-field textarea.pcm-input {
  min-height: 84px;
  resize: vertical;
  font-family: inherit;
}
.pcm-field .hint {
  font-size: 11px;
  color: #999;
  line-height: 1.4;
}
.pcm-result-box {
  background: #f5f8fb;
  border: 1px solid #dce6f0;
  border-radius: 4px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 280px;
  overflow: auto;
  color: #334;
}
.pcm-table {
  table-layout: fixed;
  width: 100%;
}
.pcm-table th,
.pcm-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pcm-table td.pcm-ops,
.pcm-table th.pcm-ops {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}
.pcm-table-wrap {
  overflow: auto;
  max-width: 100%;
}
.pcm-page {
  max-width: 1280px;
}
.pcm-stat-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.pcm-stat-grid.sm {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 1100px) {
  .pcm-stat-grid,
  .pcm-stat-grid.sm { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pcm-field-grid { grid-template-columns: 1fr; }
}
#appRoot.platform-console #appDialogOverlay { display: none !important; }

.entry-domain-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
}
.entry-domain-bar .label { font-size: 12px; color: #888; margin-right: 8px; }
.entry-domain-bar strong { font-size: 13px; color: #1a2740; word-break: break-all; }
.entry-domain-bar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
