:root {
  /* 科技现代调色板 */
  --accent: #4f46e5;
  --accent-rgb: 79 70 229;
  --accent-light: #6366f1;
  --accent-soft: #eef2ff;
  --accent-grad: linear-gradient(135deg, #6366f1 0%, #4f46e5 55%, #3730a3 100%);
  
  --canvas: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --surface-hover: #e2e8f0;
  
  --ink: #0f172a;
  --ink-secondary: #334155;
  --mute: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  
  --live: #10b981;
  --live-soft: #ecfdf5;
  --warn: #f59e0b;
  --warn-soft: #fffbeb;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

svg {
  flex-shrink: 0;
  vertical-align: middle;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

/* -------------------------------------------------------------
 * 1. 顶部导航栏 (Top Nav)
 * ------------------------------------------------------------- */
.top-nav {
  flex: 0 0 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: #0f172a;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 20;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-badge {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #6366f1, #4338ca);
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
}

.brand-icon {
  width: 18px;
  height: 18px;
  color: #fff;
}

.live-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live);
  border: 1.5px solid #0f172a;
  box-shadow: 0 0 6px var(--live);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title strong {
  font-size: 14px;
  font-weight: 750;
  color: #fff;
  letter-spacing: -0.01em;
}

.brand-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.brand-endpoint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--faint);
}

.brand-endpoint code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.copy-mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font: inherit;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.copy-mini-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.copy-mini-btn svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Mock AI 开关 */
.auto-reply-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: background 0.15s ease;
}

.auto-reply-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

.auto-reply-toggle input {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 28px;
  height: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.2);
  transition: background 0.2s ease;
}

.toggle-slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.auto-reply-toggle input:checked + .toggle-slider {
  background: var(--live);
}

.auto-reply-toggle input:checked + .toggle-slider::after {
  transform: translateX(12px);
}

.toggle-label {
  font-size: 11.5px;
  font-weight: 650;
  color: #e2e8f0;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.nav-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.pills-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  transition: all 0.2s ease;
}

.status-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 7px;
}

.status-pill.is-live {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-pill.is-live .dot {
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  animation: pulse-dot 2s ease infinite;
}

.status-pill.is-off {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.status-pill.is-off .dot {
  background: #94a3b8;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.15); }
}

/* -------------------------------------------------------------
 * 2. 主三栏布局 (Main Layout)
 * ------------------------------------------------------------- */
.main-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 280px minmax(360px, 1fr) 380px;
  gap: 12px;
  padding: 12px 14px 6px;
  overflow: hidden;
}

.col {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  min-height: 0;
  overflow: hidden;
}

.col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  flex: 0 0 auto;
}

.col-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.col-title svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--accent);
}

.col-title h3 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 750;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.count-badge {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-alt);
  color: var(--mute);
  border: 1px solid var(--line);
}

/* -------------------------------------------------------------
 * 3. 左栏：助手与会话 (Left Column)
 * ------------------------------------------------------------- */
.col-agent {
  overflow-y: auto;
  gap: 0;
}

.agent-empty-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 16px;
  gap: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-bottom: 1px solid var(--line);
}

.agent-empty-box .empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  margin-bottom: 2px;
  flex: 0 0 44px;
}

.agent-empty-box .empty-icon svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.agent-empty-box strong {
  font-size: 13px;
  color: var(--ink);
}

.agent-empty-box p {
  margin: 0;
  font-size: 11.5px;
  color: var(--mute);
  line-height: 1.6;
}

.clickable-code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--ink);
  cursor: pointer;
}

.agent-card {
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.agent-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-grad);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.agent-header-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.agent-header-meta strong {
  font-size: 13px;
  font-weight: 750;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-ip {
  font-size: 11px;
  color: var(--mute);
}

.badge-online {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.meta-item.full-width {
  grid-column: span 2;
  border-top: 1px dashed var(--line);
  padding-top: 6px;
  margin-top: 2px;
}

.meta-label {
  font-size: 10.5px;
  color: var(--faint);
  font-weight: 600;
}

.meta-val {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.info-chip {
  font-size: 11px;
  font-weight: 680;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-chip.dim {
  background: var(--surface-alt);
  color: var(--faint);
}

.info-chip.is-current {
  background: var(--live-soft);
  color: var(--live);
}

.info-chip img,
.cid-avatar img,
.agent-avatar-img,
.stream-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 22px;
  background: var(--surface-alt);
}

.agent-avatar-img {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
}

.stream-avatar {
  width: 20px;
  height: 20px;
}

.info-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.info-chip em {
  font-style: normal;
}

.unread-dot {
  display: inline-block;
  margin-left: 6px;
  min-width: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  vertical-align: middle;
}

.cid-avatar {
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.log-inspector.is-collapsed .inspector-body {
  display: none;
}

.caps-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.caps-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.caps-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cap-tag {
  font-style: normal;
  font-size: 11px;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb) / 0.15);
  cursor: pointer;
  transition: all 0.15s ease;
}

.cap-tag:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
}

.session-header {
  border-top: 1px solid var(--line);
  background: var(--surface-alt);
}

.header-action-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.text-mini-btn {
  border: 0;
  background: transparent;
  color: var(--mute);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.text-mini-btn:hover {
  background: var(--line);
  color: var(--ink);
}

.cid-list-box {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cid-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  font: inherit;
  position: relative;
}

.cid-item:hover {
  border-color: rgba(var(--accent-rgb) / 0.4);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transform: translateY(-1px);
}

.cid-item.is-fresh {
  background: #eef2ff;
  box-shadow: inset 3px 0 0 var(--accent);
  animation: cid-flash 1.2s ease;
}

@keyframes cid-flash {
  from { background: #c7d2fe; }
  to { background: #eef2ff; }
}

.cid-item.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.cid-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-size: 12px;
  font-weight: 750;
  display: grid;
  place-items: center;
  flex: 0 0 28px;
}

.cid-item.is-selected .cid-avatar {
  background: var(--accent);
  color: #fff;
}

.cid-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cid-top-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.cid-buyer-name {
  font-size: 12px;
  font-weight: 750;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cid-time {
  font-size: 10.5px;
  color: var(--faint);
}

.cid-code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10.5px;
  color: var(--mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* -------------------------------------------------------------
 * 4. 中栏：实时进线与事件流 (Center Column)
 * ------------------------------------------------------------- */
.col-stream {
  background: #f8fafc;
}

.stream-header {
  gap: 12px;
  padding: 8px 12px;
}

.stream-filters {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.stream-filters::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--mute);
  font: inherit;
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.filter-btn:hover {
  color: var(--ink);
  border-color: #cbd5e1;
}

.filter-btn.is-active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.stream-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  height: 26px;
  width: 140px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 24px 0 8px;
  font: inherit;
  font-size: 11px;
  background: #fff;
  color: var(--ink);
  transition: all 0.15s ease;
}

.search-input:focus {
  outline: none;
  width: 170px;
  border-color: var(--accent);
}

.clear-search-btn {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 0;
  background: var(--surface-hover);
  color: var(--mute);
  font-size: 10px;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: all 0.12s ease;
}

.clear-search-btn:hover {
  background: #cbd5e1;
  color: var(--ink);
}

.icon-tool-btn {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--mute);
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-tool-btn:hover {
  background: #fee2e2;
  color: var(--danger);
  border-color: #fca5a5;
}

.icon-tool-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.stream-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stream-empty-state {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  color: var(--faint);
  padding: 30px 20px;
}

.stream-empty-state svg {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  opacity: 0.45;
  margin-bottom: 2px;
}

.stream-empty-state p {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--mute);
}

.stream-empty-state span {
  font-size: 11.5px;
  color: var(--faint);
  max-width: 260px;
}

/* 消息流卡片 */
.stream-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
  animation: card-appear 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

@keyframes card-appear {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.stream-card.is-in {
  border-left: 3.5px solid var(--accent);
}

.stream-card.is-out {
  border-left: 3.5px solid var(--live);
  background: #f0fdf4;
}

.stream-card.is-conv {
  border-left: 3.5px solid var(--warn);
}

.stream-card.is-notice {
  border-left: 3.5px solid var(--faint);
}

.stream-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-tag-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-tag {
  font-size: 10.5px;
  font-weight: 750;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.stream-card.is-in .card-tag {
  background: var(--accent-soft);
  color: var(--accent);
}

.stream-card.is-out .card-tag {
  background: var(--live-soft);
  color: var(--live);
}

.stream-card.is-conv .card-tag {
  background: var(--warn-soft);
  color: var(--warn);
}

.stream-card.is-notice .card-tag {
  background: var(--surface-alt);
  color: var(--mute);
}

.card-user {
  font-size: 12px;
  font-weight: 750;
  color: var(--ink);
}

.card-time {
  font-size: 11px;
  color: var(--faint);
}

.card-body-text {
  font-size: 12.5px;
  color: var(--ink-secondary);
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}

/* 富媒体卡片预览（商品卡、售后单等） */
.stream-rich-card {
  display: flex;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid var(--line);
  margin-top: 4px;
}

.rich-card-cover {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  object-fit: cover;
  background: #e2e8f0;
  cursor: zoom-in;
  transition: transform 0.15s ease;
}

.rich-card-cover:hover {
  transform: scale(1.05);
}

.rich-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rich-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rich-card-price {
  font-size: 12px;
  font-weight: 800;
  color: #dc2626;
}

.stream-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
  border-top: 1px solid var(--line-soft);
}

.card-cid {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10px;
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-act-btn {
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 1px 6px;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.card-act-btn:hover {
  background: var(--accent-soft);
}

/* -------------------------------------------------------------
 * 5. 右栏：下发能力控制台 (Right Column)
 * ------------------------------------------------------------- */
.col-action {
  overflow-y: auto;
}

.action-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.tab-item {
  height: 25px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--mute);
  font: inherit;
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-item:hover {
  color: var(--ink);
  border-color: #cbd5e1;
}

.tab-item.is-active {
  background: var(--accent-soft);
  border-color: rgba(var(--accent-rgb) / 0.35);
  color: var(--accent);
  font-weight: 750;
}

.tab-item.highlight {
  border-color: rgba(16, 185, 129, 0.35);
  color: #059669;
}

.tab-item.highlight.is-active {
  background: #ecfdf5;
}

.action-panel {
  display: none;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}

.action-panel.is-active {
  display: flex;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-row-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-panel label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-secondary);
}

.req {
  color: var(--danger);
  margin-left: 2px;
}

.action-panel input,
.action-panel textarea,
.action-panel select {
  width: 100%;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 9px;
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  background: #f8fafc;
  transition: all 0.16s ease;
}

.action-panel textarea {
  height: auto;
  padding: 7px 9px;
  resize: vertical;
  line-height: 1.45;
}

.action-panel input:focus,
.action-panel textarea:focus,
.action-panel select:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb) / 0.12);
}

.label-with-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.label-with-counter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.text-counter {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--faint);
}

.quick-snippets {
  display: flex;
  gap: 4px;
}

.snippet-btn {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--surface-alt);
  color: var(--accent);
  cursor: pointer;
  transition: all 0.14s ease;
}

.snippet-btn:hover {
  background: var(--accent);
  color: #fff;
}

.mini-tool-btn {
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--mute);
  font: inherit;
  font-size: 10.5px;
  font-weight: 650;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.mini-tool-btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.mini-tool-btn:hover {
  border-color: rgba(var(--accent-rgb) / 0.35);
  color: var(--accent);
}

.mini-tool-btn.danger:hover {
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--danger);
  background: #fef2f2;
}

/* 现代化图片上传 Dropzone */
.image-dropzone {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 22px 16px;
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  cursor: pointer;
  outline: none;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.image-dropzone:hover,
.image-dropzone:focus-visible {
  border-color: var(--accent);
  background: #eef2ff;
  transform: translateY(-1px);
}

.image-dropzone.is-dragover {
  border-color: var(--accent);
  background: #e0e7ff;
  border-style: solid;
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb) / 0.18);
  transform: scale(1.01);
}

.dropzone-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #fff;
  display: grid;
  place-items: center;
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.15);
  transition: transform 0.18s ease;
  flex: 0 0 48px;
}

.image-dropzone:hover .dropzone-icon {
  transform: scale(1.08);
}

.dropzone-icon svg {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.dropzone-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dropzone-text strong {
  font-size: 12.5px;
  font-weight: 750;
  color: var(--ink);
}

.dropzone-text span {
  font-size: 11px;
  color: var(--mute);
}

/* 选中后的精致图片预览卡片 */
.image-preview-card {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.image-preview-card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(var(--accent-rgb) / 0.3);
}

.preview-thumb-wrap {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f1f5f9;
  flex: 0 0 54px;
  cursor: zoom-in;
}

.preview-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}

.preview-thumb-wrap:hover img {
  transform: scale(1.08);
}

.preview-zoom-badge {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.preview-thumb-wrap:hover .preview-zoom-badge {
  opacity: 1;
}

.preview-zoom-badge svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.preview-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.preview-meta strong {
  font-size: 12.5px;
  font-weight: 750;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-specs {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--faint);
}

.spec-dot {
  opacity: 0.6;
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 在线状态分段控件 */
.presence-segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.presence-opt {
  cursor: pointer;
}

.presence-opt input {
  display: none;
}

.opt-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #f8fafc;
  transition: all 0.15s ease;
}

.opt-box .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.presence-opt.online .dot { background: var(--live); }
.presence-opt.hang .dot { background: var(--warn); }
.presence-opt.offline .dot { background: #94a3b8; }

.presence-opt input:checked + .opt-box {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 2px 6px rgba(var(--accent-rgb) / 0.12);
}

.presence-opt.online input:checked + .opt-box { border-color: var(--live); background: #f0fdf4; }
.presence-opt.hang input:checked + .opt-box { border-color: var(--warn); background: #fefce8; }
.presence-opt.offline input:checked + .opt-box { border-color: #64748b; background: #f1f5f9; }

.panel-hint-box {
  padding: 10px 12px;
  border-radius: 7px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.panel-hint-box strong {
  display: block;
  font-size: 12px;
  color: var(--ink);
  margin-bottom: 2px;
}

.panel-hint-box p {
  margin: 0;
  font-size: 11.5px;
  color: var(--mute);
  line-height: 1.5;
}

.panel-hint-box.success {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.panel-hint-box.success strong {
  color: #15803d;
}

.mock-status-view {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mock-tag {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.mock-tag.is-active {
  background: #dcfce7;
  color: #15803d;
}

.mock-tag.is-off {
  background: #f1f5f9;
  color: #94a3b8;
}

.submit-btn {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 7px;
  background: #0f172a;
  color: #fff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 750;
  cursor: pointer;
  transition: all 0.16s ease;
  margin-top: 4px;
}

.submit-btn.primary {
  background: var(--accent-grad);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
}

.submit-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.submit-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.submit-btn:active {
  transform: translateY(0);
}

/* 回执结果卡片 */
.receipt-card {
  margin: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  background: #0f172a;
  color: #f1f5f9;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.receipt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.receipt-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.receipt-badge {
  font-size: 10px;
  font-weight: 750;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
}

.receipt-badge.ok {
  background: #16a34a;
  color: #fff;
}

.receipt-badge.fail {
  background: #dc2626;
  color: #fff;
}

.receipt-op {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
}

.receipt-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.receipt-time {
  font-size: 10.5px;
  color: #64748b;
}

.receipt-pre {
  margin: 0;
  max-height: 180px;
  overflow-y: auto;
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* -------------------------------------------------------------
 * 6. 底部：帧日志分析器 (Bottom Frame Inspector)
 * ------------------------------------------------------------- */
.log-inspector {
  flex: 0 0 170px;
  height: 170px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-top: 1px solid var(--line);
  transition: height 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10;
}

.log-inspector.is-expanded {
  flex: 0 0 380px;
  height: 380px;
}

.inspector-header {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  flex: 0 0 34px;
}

.inspector-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.title-with-icon {
  display: flex;
  align-items: center;
  gap: 6px;
}

.title-with-icon svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.title-with-icon strong {
  font-size: 12px;
  font-weight: 750;
  color: var(--ink);
}

.badge-pill {
  padding: 1px 6px;
  border-radius: 999px;
  background: #e2e8f0;
  font-size: 10px;
  font-weight: 700;
  color: var(--mute);
}

.inspector-filters {
  display: flex;
  align-items: center;
  gap: 3px;
}

.log-tab {
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  border: 0;
  background: transparent;
  color: var(--mute);
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  transition: all 0.14s ease;
}

.log-tab:hover {
  background: #e2e8f0;
  color: var(--ink);
}

.log-tab.is-active {
  background: #0f172a;
  color: #fff;
}

.inspector-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auto-scroll-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--mute);
  cursor: pointer;
}

.inspector-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
  background: #ffffff;
}

.log-list {
  display: flex;
  flex-direction: column;
}

.log-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.1s ease;
  border-bottom: 1px solid #f8fafc;
}

.log-row:hover {
  background: #f1f5f9;
}

.log-time {
  color: var(--faint);
  flex: 0 0 65px;
}

.log-dir {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  flex: 0 0 18px;
}

.log-row.in .log-dir {
  background: #eef2ff;
  color: #4338ca;
}

.log-row.out .log-dir {
  background: #ecfdf5;
  color: #059669;
}

.log-row.err .log-dir {
  background: #fee2e2;
  color: #dc2626;
}

.log-row.ping .log-dir {
  background: #f1f5f9;
  color: #64748b;
}

.log-kind-tag {
  font-weight: 700;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 10px;
  text-transform: uppercase;
}

.log-row.in .log-kind-tag { color: #4338ca; }
.log-row.out .log-kind-tag { color: #059669; }
.log-row.err .log-kind-tag { color: #dc2626; }
.log-row.ping .log-kind-tag { color: #64748b; }

.log-op {
  font-weight: 750;
  color: var(--ink);
}

.log-msg {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--mute);
}

.log-id {
  color: var(--faint);
  font-size: 10px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* -------------------------------------------------------------
 * 7. JSON 模态弹窗 / 抽屉 (Modal)
 * ------------------------------------------------------------- */
.json-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
}

.modal-sheet {
  position: relative;
  width: 90%;
  max-width: 640px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  background: #0f172a;
  color: #fff;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
  animation: modal-zoom 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-zoom {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dir-tag {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
}

.modal-title strong {
  font-size: 13px;
  letter-spacing: -0.01em;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.close-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 12px;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal-code {
  margin: 0;
  padding: 14px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.5;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Toast 提示 */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  z-index: 100;
  animation: toast-fade 0.2s ease;
}

@keyframes toast-fade {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* 全屏图片灯箱 (Lightbox) */
.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  animation: modal-fade 0.18s ease;
}

@keyframes modal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-dialog {
  position: relative;
  max-width: 85vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  z-index: 1;
  animation: modal-zoom 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lightbox-caption {
  font-size: 12px;
  font-weight: 700;
  color: #e2e8f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 400px;
}

.lightbox-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lightbox-close-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 12px;
  transition: background 0.15s ease;
}

.lightbox-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.lightbox-body {
  padding: 12px;
  display: grid;
  place-items: center;
  overflow: auto;
  background: #090d16;
}

.lightbox-body img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.hidden {
  display: none !important;
}

/* 响应式排版 */
@media (max-width: 1080px) {
  .main-layout {
    grid-template-columns: 240px 1fr 340px;
  }
}

@media (max-width: 860px) {
  body {
    overflow: auto;
  }
  .main-layout {
    display: flex;
    flex-direction: column;
    overflow: visible;
  }
  .log-inspector {
    flex: 0 0 240px;
    height: 240px;
  }
}
