/* ========================================
   Yong - WebRTC 坐席端样式 (现代白色主题)
   ======================================== */

/* --- CSS 变量 & 主题 --- */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #e8eef8;
  --sidebar-bg: #f8fafc;

  --accent-primary: #2563eb;
  --accent-secondary: #0f766e;
  --accent-glow: rgba(37, 99, 235, 0.24);
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-yellow: #f59e0b;
  --accent-blue: #3b82f6;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-accent: #2563eb;

  --border-color: rgba(15, 23, 42, 0.1);
  --border-active: rgba(37, 99, 235, 0.42);

  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-card-hover: 0 6px 16px rgba(15, 23, 42, 0.12);
  --shadow-glow: 0 0 24px rgba(37, 99, 235, 0.12);

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;

  --sidebar-width: 292px;
  --font-mono: 'JetBrains Mono', monospace;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    linear-gradient(180deg, rgba(238, 242, 255, 0.92), rgba(248, 250, 252, 0.98)),
    var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.42;
  font-size: 13px;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

input,
button,
textarea,
select {
  font-family: inherit;
}

/* --- 现代渐变背景 --- */
.bg-gradient {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  opacity: 0.03;
  z-index: 0;
  pointer-events: none;
}

.bg-mesh {
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(circle at 20% 30%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
  z-index: 0;
  pointer-events: none;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.08;
  pointer-events: none;
  z-index: 0;
  animation: float 20s ease-in-out infinite;
}

.bg-orb-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #6366f1, transparent);
  top: -100px;
  left: -100px;
  animation-delay: 0s;
}

.bg-orb-2 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, #8b5cf6, transparent);
  bottom: -50px;
  right: 20%;
  animation-delay: 7s;
}

.bg-orb-3 {
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, #3b82f6, transparent);
  top: 40%;
  left: 60%;
  animation-delay: 14s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.9); }
}

/* --- App 容器 --- */
.app-wrapper {
  display: flex;
  height: 100vh;
  position: relative;
  z-index: 1;
}

/* ========================================
   侧边栏
   ======================================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
  z-index: 10;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

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

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.logo-icon svg {
  width: 24px;
  height: 24px;
}

.logo-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.logo-name {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.sidebar-runtime-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #fff;
}

.runtime-phone-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.runtime-phone-icon svg {
  width: 16px;
  height: 16px;
}

.runtime-copy {
  min-width: 0;
}

.runtime-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
}

.runtime-subtitle {
  margin-top: 2px;
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.2;
  white-space: nowrap;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  padding: 10px 0 16px;
}

.sidebar-menu-trigger {
  width: 100%;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-bottom: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-menu-trigger:hover,
.sidebar-menu-trigger.active {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-primary);
}

.sidebar-menu-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-menu-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sidebar-menu-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.sidebar-menu-trigger[aria-expanded="true"] .sidebar-menu-chevron {
  transform: rotate(180deg);
}

.sidebar-menu-panel {
  display: none;
}

.sidebar-menu-panel.open {
  display: block;
}

.sidebar-submenu {
  padding: 8px 12px 12px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.76);
}

.sidebar-submenu-status {
  padding: 10px 8px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.sidebar-submenu-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-submenu-item {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font: inherit;
  text-align: left;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.sidebar-submenu-item:hover,
.sidebar-submenu-item.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 20px rgba(99, 102, 241, 0.22);
}

.sidebar-submenu-item.active .sidebar-submenu-meta,
.sidebar-submenu-item:hover .sidebar-submenu-meta {
  color: rgba(255, 255, 255, 0.82);
}

.sidebar-submenu-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}

.sidebar-submenu-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 11px;
}

.sidebar-submenu-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.sidebar-submenu-action {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: #fff;
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
}

.sidebar-submenu-action:hover {
  color: var(--accent-primary);
  border-color: rgba(99, 102, 241, 0.3);
}

/* 侧边栏区块 */
.sidebar-section {
  padding: 16px 20px 18px;
  border-bottom: 1px solid var(--border-color);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.section-icon {
  width: 16px;
  height: 16px;
  color: var(--accent-primary);
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* 表单 */
.config-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.label-icon {
  width: 14px;
  height: 14px;
  color: var(--accent-primary);
}

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

input[type="text"],
input[type="password"],
.form-select {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-primary);
  transition: var(--transition);
  outline: none;
  width: 100%;
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 32px;
}

input[type="text"]:focus,
input[type="password"]:focus,
.form-select:focus {
  border-color: var(--border-active);
  background: var(--bg-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

input::placeholder {
  color: var(--text-muted);
}

.autocall-event-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  flex-wrap: wrap;
}

.autocall-event-row input {
  flex: 1;
  min-width: 160px;
}

.autocall-event-row input[type="number"] {
  height: 40px;
  padding: 10px 40px 10px 14px;
  border: 1px solid rgba(99, 102, 241, 0.16);
  border-radius: var(--radius-sm);
  background-color: rgba(255, 255, 255, 0.92);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
  appearance: none;
  -moz-appearance: textfield;
}

.autocall-event-row input[type="number"]::-webkit-outer-spin-button,
.autocall-event-row input[type="number"]::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

.autocall-event-row input[type="number"]:focus {
  border-color: rgba(99, 102, 241, 0.42);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12), inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

.autocall-clear-btn {
  border: 1px solid rgba(239, 68, 68, 0.18);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(239, 68, 68, 0.05));
  color: #b91c1c;
  border-radius: var(--radius-sm);
  padding: 0 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  box-shadow: 0 1px 1px rgba(239, 68, 68, 0.05);
  min-height: 40px;
}

.autocall-clear-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.28);
  color: #991b1b;
  transform: translateY(-1px);
}

.autocall-lock-btn {
  border: 1px solid rgba(99, 102, 241, 0.22);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(99, 102, 241, 0.08));
  color: #4338ca;
  border-radius: var(--radius-sm);
  padding: 0 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  box-shadow: 0 1px 1px rgba(99, 102, 241, 0.05);
  min-height: 40px;
}

.autocall-lock-btn:hover {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.3);
  color: #312e81;
  transform: translateY(-1px);
}

.autocall-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(99, 102, 241, 0.14);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.96)),
    radial-gradient(circle at top right, rgba(99, 102, 241, 0.08), transparent 55%);
  box-shadow: var(--shadow-card);
}

.autocall-card .field-hint {
  background: rgba(248, 250, 252, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.autocall-hint {
  color: var(--text-secondary);
}

.field-hint {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  padding: 6px 8px;
  background: var(--bg-secondary);
  border-radius: 6px;
}

.autocall-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  width: 100%;
  border: 1px solid transparent;
  min-height: 36px;
}

.autocall-status-title {
  color: var(--text-secondary);
  flex: 0 0 auto;
  padding-right: 2px;
}

.autocall-status-value {
  flex: 1;
  min-width: 0;
  font-weight: 700;
}

.autocall-status-source {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.62);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.autocall-status.is-empty {
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(241, 245, 249, 0.96));
  color: var(--text-muted);
  border-color: rgba(148, 163, 184, 0.16);
}

.autocall-status.is-empty .autocall-status-source {
  color: var(--text-muted);
}

.autocall-status.is-active {
  background: linear-gradient(180deg, rgba(236, 253, 245, 0.98), rgba(209, 250, 229, 0.92));
  color: #047857;
  border-color: rgba(16, 185, 129, 0.18);
}

.autocall-status.is-active .autocall-status-source {
  color: #047857;
}

.autocall-status.is-locked {
  background: linear-gradient(180deg, rgba(238, 242, 255, 0.99), rgba(224, 231, 255, 0.94));
  color: #3730a3;
  border-color: rgba(99, 102, 241, 0.18);
}

.autocall-status.is-locked .autocall-status-source {
  color: #3730a3;
}

.autocall-status.is-invalid {
  background: linear-gradient(180deg, rgba(254, 242, 242, 0.98), rgba(254, 226, 226, 0.94));
  color: #991b1b;
  border-color: rgba(239, 68, 68, 0.2);
  box-shadow: 0 10px 20px rgba(239, 68, 68, 0.08);
}

.autocall-status.is-invalid .autocall-status-source {
  color: #b91c1c;
}

/* 切换开关 */
.mdns-filter-row,
.asr-source-row {
  flex-direction: row !important;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  gap: 12px !important;
}

.toggle-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: default;
  flex: 1;
  min-width: 0;
}

.toggle-label-text {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.toggle-label-text svg {
  width: 16px;
  height: 16px;
  color: var(--accent-primary);
}

.switch-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-thumb {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  transition: var(--transition);
}

.switch-thumb::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.switch-toggle input:checked + .switch-thumb {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.switch-toggle input:checked + .switch-thumb::before {
  transform: translateX(20px);
}

/* 连接按钮 */
.btn-connect {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 4px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-connect:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-icon {
  width: 18px;
  height: 18px;
}

.btn-icon svg {
  width: 100%;
  height: 100%;
}

/* 状态按钮 */
.status-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.status-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.status-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--text-muted);
}

.status-btn.active {
  background: rgba(99, 102, 241, 0.08);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

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

.status-dot.available {
  background: var(--accent-green);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.status-dot.busy {
  background: var(--accent-red);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

.status-dot.rest {
  background: var(--accent-yellow);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
}

.status-dot.offline {
  background: var(--text-muted);
}

/* 统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stat-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  transition: var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.stat-icon {
  width: 32px;
  height: 32px;
  margin: 0 auto 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-primary);
}

.stat-icon svg {
  width: 18px;
  height: 18px;
}

.stat-icon.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
}

.stat-icon.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  font-family: var(--font-mono);
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* 侧边栏底部 */
.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.agent-info {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.agent-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: white;
  box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3);
}

.agent-details {
  flex: 1;
  min-width: 0;
}

.agent-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.agent-ext {
  font-size: 11px;
  color: var(--text-muted);
}

.agent-company {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.register-status {
  position: absolute;
  right: 32px;
  top: 50%;
  transform: translateY(-50%);
}

.reg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.reg-dot.offline {
  background: var(--text-muted);
  box-shadow: none;
}

.logout-link {
  position: static;
  transform: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border: 1px solid rgba(127, 29, 29, 0.18);
  color: #ffffff;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.24);
  transition: var(--transition);
}

.logout-link:hover {
  background: linear-gradient(135deg, #f87171, #ef4444);
  box-shadow: 0 8px 18px rgba(239, 68, 68, 0.32);
  transform: translateY(-1px);
}

.logout-link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.logout-link span {
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

/* ========================================
   主内容区
   ======================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(238, 242, 255, 0.74));
}

/* 顶部导航栏 */
.top-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 28px rgba(79, 70, 229, 0.08);
  backdrop-filter: blur(10px);
}

.top-left {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.menu-toggle:hover {
  background: var(--bg-secondary);
}

.menu-toggle svg {
  width: 20px;
  height: 20px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.breadcrumb-icon {
  width: 16px;
  height: 16px;
  color: var(--accent-primary);
}

.breadcrumb-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.connection-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--text-muted);
}

.connection-badge .badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.connection-badge.connected .badge-dot {
  background: var(--accent-green);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.connection-badge.connected {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--accent-green);
}

.top-toolbar {
  display: flex;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}

.top-toolbar::-webkit-scrollbar {
  height: 4px;
}

.top-toolbar::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 999px;
}

.top-seat-card {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 178px;
}

.top-toolbar-card {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  min-height: 26px;
  min-width: 0;
  box-sizing: border-box;
}

.top-toolbar-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  min-width: auto;
  line-height: 1;
}

.top-inline-label {
  flex-shrink: 0;
}

.top-inline-input {
  min-width: 82px;
  height: 26px;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-connect-top {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin-top: 0;
  padding: 6px 12px;
  min-height: 26px;
  align-self: stretch;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.22);
  font-size: 12px;
  white-space: nowrap;
}

.status-selector-top {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
  width: 100%;
}

.status-selector-top .status-btn {
  min-width: 0;
  justify-content: center;
  padding: 5px 6px;
  font-size: 11px;
  white-space: nowrap;
}

.top-status-card {
  flex: 1 1 380px;
  min-width: 380px;
  gap: 10px;
}

.top-stats-card {
  flex: 1 1 420px;
  min-width: 420px;
  gap: 10px;
}

.stats-grid-top {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.stat-card-top {
  min-width: 0;
  flex: 1 1 0;
  padding: 6px 8px;
  border-radius: 8px;
  box-shadow: none;
  width: 100%;
}

.stat-card-top:hover {
  transform: none;
  box-shadow: none;
}

.stat-card-top .stat-value {
  font-size: 12px;
  margin-bottom: 2px;
}

.stat-card-top .stat-label {
  font-size: 9px;
  letter-spacing: 0;
}

.top-agent-card .agent-info {
  min-width: 0;
  min-height: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  flex: 1 1 auto;
}

.top-agent-card {
  flex: 1 1 320px;
  min-width: 320px;
}

.top-agent-card .agent-avatar {
  width: 24px;
  height: 24px;
  font-size: 11px;
}

.top-agent-card .agent-details {
  flex: 1 1 auto;
  min-width: 0;
}

.top-agent-card .agent-name {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-agent-card .agent-ext {
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-agent-card .agent-company {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-ext-hidden {
  display: none;
}

.top-agent-card .register-status {
  position: static;
  transform: none;
  flex-shrink: 0;
}

.top-agent-card .logout-link {
  position: static;
  transform: none;
  flex-shrink: 0;
}

.top-right {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-shrink: 0;
}

.time-display {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

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

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-red);
  color: white;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========================================
   来电浮层
   ======================================== */
.incoming-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.incoming-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 40px 48px;
  text-align: center;
  box-shadow: var(--shadow-card-hover);
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.incoming-avatar-ring {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
  border: 2px solid rgba(99, 102, 241, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  position: relative;
  animation: ringPulse 1.5s ease-in-out infinite;
}

@keyframes ringPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
}

.incoming-avatar-inner {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
}

.incoming-avatar-inner svg {
  width: 30px;
  height: 30px;
  color: white;
}

.incoming-info {
  margin-bottom: 28px;
}

.incoming-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.incoming-number {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.incoming-name {
  font-size: 16px;
  color: var(--text-secondary);
}

.incoming-company {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.incoming-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.action-btn svg {
  width: 28px;
  height: 28px;
}

.answer-btn {
  background: linear-gradient(135deg, #059669, #10b981);
  color: white;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
}

.answer-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(16, 185, 129, 0.5);
}

.reject-btn {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: white;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
}

.reject-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(239, 68, 68, 0.5);
}

/* ========================================
   通话区域
   ======================================== */
.call-area {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 0;
  overflow: hidden;
  background: var(--bg-primary);
}

.asr-runtime-panel {
  display: none !important;
}

.asr-runtime-stack {
  display: none;
  flex-direction: column;
  gap: 16px;
}

body.asr-running .asr-runtime-panel {
  display: flex !important;
}

body.asr-running .asr-runtime-stack {
  display: flex;
}

/* 中间面板 */
.center-panel {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid var(--border-color);
}

.workspace-panel {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.94)),
    var(--bg-primary);
}

.workspace-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.workspace-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.workspace-subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.workspace-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.workspace-kv {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  min-width: 0;
}

.workspace-kv-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.workspace-kv-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-section {
  margin-top: 16px;
}

.workspace-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.workspace-detail-panel {
  padding: 18px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.workspace-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.workspace-detail-title-block {
  min-width: 0;
}

.workspace-detail-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.workspace-detail-title-row h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
  color: var(--text-primary);
}

.workspace-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.18);
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent-primary);
  font-size: 12px;
  font-weight: 700;
}

.workspace-detail-subtitle {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.workspace-detail-summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.workspace-detail-summary-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  font-size: 12px;
}

.workspace-panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.workspace-detail-info-panels {
  grid-template-columns: 1fr;
}

.workspace-info-card {
  padding: 16px 18px 18px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(238, 242, 255, 0.58));
}

.workspace-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.workspace-compact-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.workspace-compact-grid > div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
}

.workspace-detail-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.workspace-detail-grid strong {
  display: block;
  min-width: 0;
  color: var(--text-primary);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.workspace-table-wrap {
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-card);
}

.workspace-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  font-size: 12px;
}

.workspace-table th,
.workspace-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  white-space: nowrap;
}

.workspace-table th {
  color: var(--text-secondary);
  background: #eef2ff;
  font-weight: 700;
}

.workspace-muted {
  color: var(--text-muted);
  font-size: 12px;
}

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

.workspace-table tr:last-child td {
  border-bottom: 0;
}

.workspace-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  color: var(--text-secondary);
  font-size: 12px;
}

.workspace-page-btn {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
}

.workspace-page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.workspace-inline-btn {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.workspace-inline-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.workspace-inline-btn-primary {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

.workspace-inline-btn-primary:hover:not(:disabled) {
  background: var(--accent-secondary);
  color: #fff;
}

.workspace-inline-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.recording-modal {
  width: min(520px, calc(100vw - 32px));
}

.recording-modal-body {
  padding: 20px;
  background: linear-gradient(180deg, #fff, #eef2ff);
}

.recording-file-name {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-secondary);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.recording-modal audio {
  width: 100%;
  display: block;
}

.recording-modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.recording-modal-actions .btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 16px;
  text-decoration: none;
}

.calllog-detail-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calllog-detail-item {
  width: fit-content;
  max-width: min(72%, 720px);
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--bg-secondary);
}

.calllog-detail-item-user {
  align-self: flex-start;
  border: 1px solid var(--border-color);
}

.calllog-detail-item-seat {
  align-self: flex-end;
  background: rgba(37, 99, 235, 0.10);
  border: 1px solid rgba(37, 99, 235, 0.22);
}

.calllog-detail-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.calllog-detail-speaker,
.calllog-detail-time,
.calllog-detail-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.calllog-detail-speaker {
  background: rgba(99, 102, 241, 0.10);
  color: var(--accent-primary);
}

.calllog-detail-item-seat .calllog-detail-meta {
  justify-content: flex-end;
}

.calllog-detail-item-seat .calllog-detail-speaker {
  background: rgba(37, 99, 235, 0.14);
  color: #1d4ed8;
}

.calllog-detail-time,
.calllog-detail-tag {
  background: var(--bg-primary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.calllog-detail-content {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.calllog-detail-item-seat .calllog-detail-content {
  text-align: left;
}

.resource-call-vars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.resource-call-var {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.resource-call-var span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-secondary);
  font-size: 12px;
}

.resource-call-var strong {
  display: block;
  color: var(--text-primary);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.workspace-tree {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.workspace-tree-node {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.workspace-tree-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.workspace-tree-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.workspace-flowchart {
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(99, 102, 241, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(99, 102, 241, 0.06) 1px, transparent 1px),
    #f8fafc;
  background-size: 28px 28px;
  box-shadow: var(--shadow-card);
}

.workspace-flowchart svg {
  display: block;
  max-width: none;
  height: auto;
  margin: 0 auto;
}

.speak-flow-svg {
  min-width: 760px;
}

.flow-edge {
  fill: none;
  stroke: #6366f1;
  stroke-width: 2.2;
  stroke-linecap: round;
  opacity: 0.82;
}

.flow-edge-label {
  font-size: 11px;
  fill: #4f46e5;
  paint-order: stroke;
  stroke: #f8fafc;
  stroke-width: 4px;
  stroke-linejoin: round;
}

.flow-node rect {
  fill: #ffffff;
  stroke: rgba(99, 102, 241, 0.42);
  stroke-width: 1.4;
  filter: drop-shadow(0 8px 14px rgba(79, 70, 229, 0.12));
}

.flow-node-kicker {
  font-size: 10px;
  fill: #6366f1;
  font-weight: 700;
}

.flow-node-title {
  font-size: 13px;
  fill: #0f172a;
  font-weight: 800;
}

.flow-node-meta {
  font-size: 10px;
  fill: #64748b;
}

.event-flow-tree {
  min-width: 760px;
  padding: 18px;
  border: 1px solid rgba(99, 102, 241, 0.22);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-card);
}

.event-flow-tree-title {
  margin-bottom: 12px;
  color: #312e81;
  font-size: 15px;
  font-weight: 800;
}

.event-flow-stage {
  margin-left: calc(var(--event-level, 0) * 28px);
  padding-left: 16px;
  border-left: 2px solid rgba(99, 102, 241, 0.28);
}

.event-flow-stage + .event-flow-stage,
.event-flow-children .event-flow-stage {
  margin-top: 12px;
}

.event-flow-stage-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #eef2ff;
}

.event-flow-stage-name {
  color: #312e81;
  font-weight: 800;
}

.event-flow-stage-level,
.event-flow-stage-super {
  color: #6366f1;
  font-size: 11px;
  font-weight: 700;
}

.event-flow-stage-lines {
  display: grid;
  gap: 8px;
  padding: 10px 0 2px;
}

.event-flow-line {
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 8px;
  background: #f8fafc;
}

.event-flow-line-title {
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
}

.event-flow-line-meta {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
}

.event-flow-line-badge {
  display: inline-flex;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.1);
  color: #16a34a;
  font-size: 11px;
  font-weight: 800;
}

.workspace-empty {
  padding: 28px 0;
  color: var(--text-muted);
}

.workspace-empty-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.workspace-empty-subtitle {
  margin-top: 6px;
  font-size: 13px;
}

/* 当前通话卡片 */
.current-call-card {
  display: none;
  flex-direction: column;
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
  background: var(--bg-primary);
}

.current-call-card.active {
  display: flex;
}

.call-state-indicator {
  width: 100%;
  margin-bottom: 24px;
}

/* 空闲状态 */
.state-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 0;
}

.phone-icon-wrapper {
  width: 120px;
  height: 120px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.phone-rings {
  position: absolute;
  inset: 0;
}

.ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid transparent;
  inset: 50%;
  transform: translate(-50%, -50%);
  animation: ringIdle 3s linear infinite;
}

.ring-1 {
  width: 60px;
  height: 60px;
  border-color: rgba(99, 102, 241, 0.15);
}

.ring-2 {
  width: 90px;
  height: 90px;
  border-color: rgba(99, 102, 241, 0.1);
  animation-delay: 0.5s;
}

.ring-3 {
  width: 120px;
  height: 120px;
  border-color: rgba(99, 102, 241, 0.05);
  animation-delay: 1s;
}

@keyframes ringIdle {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.5; }
}

.phone-icon-svg {
  width: 48px;
  height: 48px;
  color: var(--accent-primary);
  position: relative;
  z-index: 1;
}

.idle-text {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.idle-sub {
  font-size: 14px;
  color: var(--text-muted);
}

/* 活跃通话状态 */
.state-active {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.avatar-container {
  position: relative;
  width: 100px;
  height: 100px;
}

.call-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 700;
  color: white;
  position: relative;
  z-index: 1;
}

.call-status-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 3px solid var(--accent-primary);
  animation: pulseRing 1.5s ease-out infinite;
}

@keyframes pulseRing {
  0% { transform: scale(0.95); opacity: 1; }
  100% { transform: scale(1.15); opacity: 0; }
}

.call-number {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.call-name {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: -8px;
}

.call-company {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: -6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.call-timer-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.call-phase-badge {
  padding: 4px 12px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-yellow);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.call-phase-badge.connected {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--accent-green);
}

.call-timer {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* 音频可视化 */
.audio-visualizer {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 32px;
  padding: 8px 0;
}

.audio-visualizer .bar {
  width: 4px;
  background: linear-gradient(to top, var(--accent-primary), var(--accent-secondary));
  border-radius: 2px;
  animation: audioBar 0.8s ease-in-out infinite;
}

.audio-visualizer .bar:nth-child(1) { height: 20%; animation-delay: 0s; }
.audio-visualizer .bar:nth-child(2) { height: 40%; animation-delay: 0.1s; }
.audio-visualizer .bar:nth-child(3) { height: 60%; animation-delay: 0.2s; }
.audio-visualizer .bar:nth-child(4) { height: 80%; animation-delay: 0.3s; }
.audio-visualizer .bar:nth-child(5) { height: 100%; animation-delay: 0.4s; }
.audio-visualizer .bar:nth-child(6) { height: 80%; animation-delay: 0.5s; }
.audio-visualizer .bar:nth-child(7) { height: 60%; animation-delay: 0.6s; }
.audio-visualizer .bar:nth-child(8) { height: 40%; animation-delay: 0.7s; }

@keyframes audioBar {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1); }
}

/* AI 面板 */
.ai-panels-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.transcription-panel,
.ai-reply-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.transcription-header,
.ai-header {
  padding: 12px 16px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-red);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
  animation: pulseDot 1.5s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.5; }
}

.transcription-body,
.ai-reply-body {
  padding: 20px;
  min-height: 150px;
  max-height: 300px;
  overflow-y: auto;
}

.trans-placeholder {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 20px;
}

/* TTS 控制台 */
.tts-console {
  background: var(--bg-secondary);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.tts-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-primary);
}

.tts-header svg {
  width: 16px;
  height: 16px;
}

.tts-input-row {
  display: flex;
  gap: 8px;
}

.tts-send-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tts-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.tts-send-btn svg {
  width: 18px;
  height: 18px;
}

.tts-char-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.tts-char-hint strong {
  color: var(--accent-blue);
  font-weight: 600;
}

.tts-voices {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.voice-option {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
}

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

.tts-status {
  font-size: 11px;
  color: var(--text-muted);
  min-height: 16px;
}

/* 面板卡片 */
.panel-card {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

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

.panel-icon {
  width: 16px;
  height: 16px;
  color: var(--accent-primary);
}

.panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.record-count {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-primary);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
}

/* 通话记录列表 */
.call-history-list {
  overflow-y: auto;
  height: calc(100% - 45px);
  padding: 8px;
  max-height: 200px;
}

.call-history-list::-webkit-scrollbar {
  width: 4px;
}

.call-history-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.call-record {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  margin-bottom: 8px;
}

.call-record:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-card-hover);
}

.record-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.record-icon svg {
  width: 16px;
  height: 16px;
}

.record-icon.inbound {
  background: linear-gradient(135deg, var(--accent-green), #22c55e);
}

.record-icon.outbound {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
}

.record-icon.missed {
  background: linear-gradient(135deg, var(--accent-red), #f97316);
}

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

.record-number {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-time,
.record-company {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-duration {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.dial-from-record {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.dial-from-record:hover {
  background: rgba(99, 102, 241, 0.16);
  transform: translateY(-1px);
}

.dial-from-record svg {
  width: 14px;
  height: 14px;
}

.empty-history {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 120px;
  color: var(--text-muted);
  gap: 10px;
}

.empty-history svg {
  width: 32px;
  height: 32px;
  opacity: 0.4;
}

.empty-history p {
  font-size: 12px;
}

/* ========================================
   右侧面板 - 拨号盘
   ======================================== */
.right-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(238, 242, 255, 0.72));
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  overflow-y: auto;
}

#dialpadPanel {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.dialpad-display {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  gap: 8px;
}

.dialpad-display input {
  flex: 1;
  background: transparent;
  border: none;
  font-size: 18px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
}

.dialpad-display input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.clear-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.clear-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
}

.clear-btn svg {
  width: 18px;
  height: 18px;
}

.dialpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 16px;
}

.dial-key {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  gap: 2px;
}

.dial-key:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: var(--accent-primary);
}

.dial-key:active {
  background: rgba(99, 102, 241, 0.15);
  transform: scale(0.98);
}

.key-num {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1;
}

.key-alpha {
  font-size: 8px;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
}

.call-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  margin: 0 16px 16px;
  background: linear-gradient(135deg, #059669, #10b981);
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.call-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.call-btn svg {
  width: 20px;
  height: 20px;
}

/* 通话控制按钮 */
.controls-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 16px 16px;
}

.ctrl-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.ctrl-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.ctrl-btn.active {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.ctrl-btn.hangup-ctrl {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
}

.ctrl-btn.hangup-ctrl:hover {
  background: rgba(239, 68, 68, 0.15);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.ctrl-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ctrl-icon svg {
  width: 100%;
  height: 100%;
}

/* ========================================
   模态框
   ======================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 340px;
  box-shadow: var(--shadow-card-hover);
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.modal-card-wide {
  width: min(820px, calc(100vw - 32px));
}

.calllog-detail-modal-body {
  max-height: min(70vh, 720px);
  overflow: auto;
  padding: 18px 20px 20px;
  background: var(--bg-card);
}

.resource-call-modal-body {
  max-height: min(76vh, 760px);
  overflow: auto;
  padding: 18px 20px 20px;
  background: var(--bg-card);
}

.resource-call-form {
  display: grid;
  grid-template-columns: minmax(160px, 220px) 1fr auto;
  gap: 12px;
  align-items: end;
  padding-top: 4px;
}

.resource-call-form .form-group {
  margin: 0;
}

.resource-call-form select,
.resource-call-form input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-header button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.modal-header button:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.modal-header button svg {
  width: 16px;
  height: 16px;
}

.dtmf-display {
  padding: 20px;
  font-size: 24px;
  font-family: var(--font-mono);
  text-align: center;
  color: var(--text-primary);
  letter-spacing: 4px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.modal-card .dialpad-grid {
  background: var(--bg-card);
  padding: 16px;
}

.modal-card .dial-key {
  background: var(--bg-secondary);
}

.modal-card .dial-key:hover {
  background: rgba(99, 102, 241, 0.08);
}

/* 转接表单 */
.transfer-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.transfer-form .form-group {
  margin-bottom: 0;
}

.transfer-type {
  display: flex;
  gap: 16px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
}

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

.btn-primary {
  padding: 12px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

/* ========================================
   日志面板
   ======================================== */
.log-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 400px;
  max-height: 300px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card-hover);
  z-index: 150;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.log-header button {
  padding: 6px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.log-header button:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.log-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

.log-entry {
  line-height: 1.5;
  word-break: break-word;
}

.log-entry.success {
  color: var(--accent-green);
}

.log-entry.warning,
.log-entry.warn {
  color: var(--accent-yellow);
}

.log-entry.error {
  color: #dc2626;
  font-weight: 700;
}

.log-toggle-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-card);
  z-index: 140;
}

.log-toggle-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  transform: scale(1.05);
}

.log-toggle-btn svg {
  width: 20px;
  height: 20px;
}

/* ========================================
   响应式
   ======================================== */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 100;
    box-shadow: var(--shadow-card-hover);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .menu-toggle {
    display: flex;
  }

  .top-bar {
    align-items: flex-start;
  }

  .top-left {
    flex-wrap: wrap;
    gap: 10px;
  }

  .top-toolbar {
    width: 100%;
    align-items: stretch;
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .btn-connect-top,
  .top-toolbar-card {
    flex-basis: calc(50% - 5px);
  }

  .top-seat-card {
    min-width: 0;
  }

  .status-selector-top {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stats-grid-top {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .top-status-card {
    min-width: 0;
    flex-basis: 100%;
  }
  
  .call-area {
    grid-template-columns: 1fr;
  }
  
  .right-panel {
    display: none;
  }

  .resource-call-form {
    grid-template-columns: 1fr;
  }

  .resource-call-actions {
    justify-content: flex-end;
  }
}

@media (max-width: 700px) {
  .top-bar {
    padding: 12px 16px;
  }
  
  .breadcrumb {
    display: none;
  }

  .top-toolbar-card {
    width: 100%;
    flex-wrap: wrap;
  }

  .top-toolbar-label {
    min-width: 100%;
  }

  .btn-connect-top {
    width: 100%;
    flex-basis: 100%;
    justify-content: center;
  }

  .top-toolbar-card {
    flex-basis: 100%;
  }

  .top-inline-input {
    width: 100%;
  }

  .status-selector-top {
    width: 100%;
  }

  .stats-grid-top {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .top-stats-card {
    min-width: 0;
    flex-basis: 100%;
  }

  .top-agent-card .agent-info {
    min-width: 0;
    width: 100%;
  }
  
  .time-display {
    display: none;
  }
  
  .current-call-card {
    padding: 16px;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .stat-card {
    padding: 12px;
  }
  
  .stat-value {
    font-size: 18px;
  }

  .autocall-event-row {
    flex-direction: column;
  }

  .autocall-event-row input,
  .autocall-lock-btn,
  .autocall-clear-btn {
    width: 100%;
  }

  .autocall-status {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .autocall-status-value {
    order: 2;
    width: 100%;
  }

  .autocall-status-source {
    order: 3;
  }
}

/* ========================================
   紧凑工作台优化
   ======================================== */
.bg-orb {
  display: none;
}

.bg-gradient,
.bg-mesh {
  opacity: 0.02;
}

.sidebar-header {
  padding: 12px 14px;
  gap: 10px;
}

.logo {
  gap: 9px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  box-shadow: none;
}

.logo-icon svg {
  width: 20px;
  height: 20px;
}

.logo-name {
  font-size: 15px;
  line-height: 1.15;
}

.logo-sub {
  font-size: 10px;
  letter-spacing: 0;
}

.sidebar-runtime-status {
  gap: 6px;
  padding: 4px 6px;
}

.runtime-phone-icon {
  width: 24px;
  height: 24px;
}

.runtime-phone-icon svg {
  width: 14px;
  height: 14px;
}

.runtime-title {
  font-size: 11px;
}

.runtime-subtitle {
  font-size: 9px;
}

.sidebar-menu {
  padding: 6px 0 10px;
}

.sidebar-menu-trigger {
  min-height: 36px;
  padding: 0 14px;
  gap: 8px;
  font-size: 12px;
}

.sidebar-menu-title {
  gap: 6px;
}

.sidebar-menu-icon,
.sidebar-menu-chevron {
  width: 14px;
  height: 14px;
}

.sidebar-submenu {
  padding: 6px 8px 8px;
}

.sidebar-submenu-status {
  padding: 7px 6px;
  font-size: 11px;
}

.sidebar-submenu-list {
  gap: 4px;
}

.sidebar-submenu-item {
  min-height: 31px;
  padding: 6px 8px;
  gap: 2px;
}

.sidebar-submenu-name {
  font-size: 12px;
}

.sidebar-submenu-meta {
  font-size: 10px;
}

.sidebar-section {
  padding: 10px 14px 12px;
}

.section-header {
  margin-bottom: 8px;
}

.section-label,
.form-group label,
.toggle-label-text {
  font-size: 11px;
}

.config-form {
  gap: 8px;
}

.form-group {
  gap: 4px;
}

.form-row {
  gap: 8px;
}

input[type="text"],
input[type="password"],
.form-select {
  min-height: 32px;
  padding: 7px 9px;
  font-size: 12px;
}

.form-select {
  background-position: right 8px center;
  padding-right: 28px;
}

.field-hint {
  padding: 5px 7px;
  font-size: 10px;
  line-height: 1.35;
}

.mdns-filter-row,
.asr-source-row {
  padding: 7px 9px;
  gap: 8px !important;
}

.switch-toggle {
  width: 36px;
  height: 20px;
}

.switch-thumb::before {
  width: 14px;
  height: 14px;
}

.switch-toggle input:checked + .switch-thumb::before {
  transform: translateX(16px);
}

.btn-connect,
.btn-primary {
  padding: 9px 12px;
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.22);
}

.btn-icon,
.btn-icon svg {
  width: 16px;
  height: 16px;
}

.status-selector,
.stats-grid {
  gap: 6px;
}

.status-btn {
  gap: 6px;
  padding: 7px 8px;
  font-size: 12px;
}

.stat-card {
  padding: 9px 8px;
  border-radius: 8px;
}

.stat-icon {
  width: 26px;
  height: 26px;
  margin-bottom: 5px;
}

.stat-value {
  font-size: 17px;
  margin-bottom: 1px;
}

.stat-label {
  font-size: 10px;
  letter-spacing: 0;
}

.sidebar-footer {
  padding: 10px 14px;
}

.agent-info {
  gap: 8px;
}

.agent-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 12px;
  box-shadow: none;
}

.agent-name {
  font-size: 12px;
}

.agent-ext,
.agent-company {
  font-size: 10px;
}

.logout-link {
  padding: 3px 8px;
  box-shadow: none;
}

.top-bar {
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.top-left,
.top-right,
.top-actions {
  gap: 8px;
}

.menu-toggle,
.icon-btn {
  width: 30px;
  height: 30px;
}

.menu-toggle svg,
.icon-btn svg {
  width: 16px;
  height: 16px;
}

.breadcrumb {
  gap: 6px;
  padding: 5px 8px;
}

.breadcrumb-icon {
  width: 14px;
  height: 14px;
}

.breadcrumb-text,
.time-display {
  font-size: 12px;
}

.connection-badge {
  gap: 5px;
  padding: 4px 8px;
  font-size: 11px;
}

.top-toolbar {
  gap: 6px;
}

.top-toolbar-card {
  gap: 6px;
  padding: 4px 7px;
  border-radius: 7px;
  min-height: 24px;
}

.top-seat-card {
  min-width: 160px;
}

.top-status-card {
  flex-basis: 320px;
  min-width: 320px;
}

.top-stats-card {
  flex-basis: 360px;
  min-width: 360px;
}

.top-agent-card {
  flex-basis: 280px;
  min-width: 280px;
}

.top-inline-input {
  height: 24px;
  font-size: 11px;
}

.btn-connect-top {
  min-height: 24px;
  padding: 4px 10px;
  font-size: 11px;
}

.status-selector-top .status-btn {
  padding: 4px 5px;
  font-size: 10px;
}

.stat-card-top {
  padding: 4px 6px;
}

.call-area {
  grid-template-columns: minmax(0, 1fr) 340px;
}

.right-panel,
.asr-runtime-stack,
.ai-panels-wrapper {
  gap: 10px;
}

.workspace-panel {
  padding: 12px 16px;
}

.workspace-header,
.workspace-detail-header,
.workspace-panel-grid {
  gap: 10px;
  margin-bottom: 10px;
}

.workspace-title {
  font-size: 15px;
}

.workspace-subtitle,
.workspace-detail-subtitle {
  margin-top: 2px;
  font-size: 11px;
}

.workspace-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.workspace-kv,
.workspace-compact-grid > div,
.resource-call-var,
.workspace-tree-node,
.event-flow-line {
  padding: 7px 9px;
  border-radius: 6px;
}

.workspace-kv-label,
.workspace-detail-grid span,
.resource-call-var span,
.workspace-tree-meta,
.workspace-muted,
.workspace-pagination {
  font-size: 11px;
}

.workspace-kv-value,
.workspace-detail-grid strong,
.resource-call-var strong,
.workspace-tree-title,
.event-flow-line-title {
  font-size: 12px;
}

.workspace-section {
  margin-top: 10px;
}

.workspace-section-title {
  margin-bottom: 7px;
  font-size: 12px;
}

.workspace-detail-panel,
.workspace-info-card,
.workspace-flowchart,
.event-flow-tree {
  padding: 11px 12px;
  border-radius: 8px;
  box-shadow: none;
}

.workspace-detail-title-row {
  gap: 7px;
}

.workspace-detail-title-row h3 {
  font-size: 15px;
}

.workspace-badge {
  min-height: 20px;
  padding: 2px 7px;
  font-size: 11px;
}

.workspace-detail-summary-strip {
  gap: 6px;
  margin-top: 7px;
}

.workspace-detail-summary-strip span {
  min-height: 22px;
  padding: 3px 7px;
  font-size: 11px;
}

.workspace-detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.workspace-table {
  font-size: 11px;
}

.workspace-table th,
.workspace-table td {
  padding: 7px 9px;
}

.workspace-page-btn,
.workspace-inline-btn {
  height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 11px;
}

.calllog-detail-list,
.resource-call-vars,
.workspace-tree,
.event-flow-stage-lines {
  gap: 7px;
}

.calllog-detail-item {
  padding: 9px 10px;
  border-radius: 8px;
  max-width: 88%;
}

.calllog-detail-meta {
  gap: 6px;
  margin-bottom: 6px;
}

.calllog-detail-speaker,
.calllog-detail-time,
.calllog-detail-tag {
  min-height: 20px;
  padding: 2px 7px;
  font-size: 11px;
}

.calllog-detail-content {
  font-size: 12px;
  line-height: 1.55;
}

.event-flow-tree-title {
  margin-bottom: 8px;
  font-size: 13px;
}

.event-flow-stage {
  margin-left: calc(var(--event-level, 0) * 18px);
  padding-left: 10px;
}

.event-flow-stage + .event-flow-stage,
.event-flow-children .event-flow-stage {
  margin-top: 8px;
}

.event-flow-stage-header {
  min-height: 26px;
  padding: 4px 8px;
  gap: 6px;
}

.event-flow-stage-level,
.event-flow-stage-super,
.event-flow-line-badge {
  font-size: 10px;
}

.event-flow-line-meta {
  margin-top: 3px;
  font-size: 11px;
}

.workspace-empty {
  padding: 18px 0;
}

.workspace-empty-title {
  font-size: 15px;
}

.workspace-empty-subtitle {
  margin-top: 4px;
  font-size: 12px;
}

.current-call-card {
  padding: 14px 16px;
}

.call-state-indicator {
  margin-bottom: 14px;
}

.state-idle,
.state-active {
  gap: 10px;
}

.state-idle {
  padding: 22px 0;
}

.phone-icon-wrapper {
  width: 82px;
  height: 82px;
}

.ring-1 {
  width: 42px;
  height: 42px;
}

.ring-2 {
  width: 62px;
  height: 62px;
}

.ring-3 {
  width: 82px;
  height: 82px;
}

.phone-icon-svg {
  width: 34px;
  height: 34px;
}

.idle-text {
  font-size: 18px;
}

.idle-sub {
  font-size: 12px;
}

.avatar-container,
.call-avatar {
  width: 72px;
  height: 72px;
}

.call-avatar {
  font-size: 26px;
}

.call-number {
  font-size: 18px;
}

.call-name,
.call-company {
  font-size: 12px;
  margin-top: -4px;
}

.call-timer-wrapper {
  gap: 5px;
}

.call-phase-badge {
  padding: 3px 9px;
  font-size: 10px;
  letter-spacing: 0;
}

.call-timer {
  font-size: 22px;
}

.audio-visualizer {
  height: 24px;
  padding: 5px 0;
}

.transcription-panel,
.ai-reply-panel {
  border-radius: 8px;
}

.transcription-header,
.ai-header,
.panel-header,
.log-header {
  padding: 9px 12px;
  gap: 7px;
  font-size: 12px;
}

.transcription-body,
.ai-reply-body {
  padding: 12px;
  min-height: 110px;
  max-height: 220px;
}

.trans-placeholder {
  padding: 12px;
  font-size: 12px;
}

.tts-console {
  padding: 10px 12px;
  gap: 8px;
}

.tts-header,
.panel-title {
  font-size: 12px;
}

.tts-input-row {
  gap: 6px;
}

.tts-send-btn {
  width: 32px;
  height: 32px;
}

.tts-send-btn svg {
  width: 15px;
  height: 15px;
}

.tts-voices {
  gap: 8px;
}

.voice-option {
  font-size: 11px;
}

.call-history-list {
  padding: 6px;
  max-height: 160px;
}

.call-record {
  grid-template-columns: 26px minmax(0, 1fr) auto auto;
  gap: 7px;
  padding: 7px 8px;
  margin-bottom: 6px;
  box-shadow: none;
}

.record-icon {
  width: 26px;
  height: 26px;
}

.record-icon svg {
  width: 13px;
  height: 13px;
}

.record-number {
  font-size: 12px;
}

.record-time,
.record-company,
.record-duration {
  font-size: 10px;
}

.dial-from-record {
  width: 26px;
  height: 26px;
}

.dialpad-display {
  padding: 9px 12px;
}

.dialpad-display input {
  font-size: 15px;
}

.clear-btn {
  width: 28px;
  height: 28px;
}

.dialpad-grid {
  gap: 6px;
  padding: 12px;
}

.dial-key {
  padding: 9px 4px;
  border-radius: 8px;
}

.key-num {
  font-size: 17px;
}

.call-btn {
  gap: 7px;
  padding: 10px;
  margin: 0 12px 12px;
  border-radius: 8px;
  font-size: 12px;
}

.call-btn svg {
  width: 17px;
  height: 17px;
}

.controls-row {
  gap: 6px;
  padding: 0 12px 12px;
}

.ctrl-btn {
  gap: 5px;
  padding: 8px 6px;
  font-size: 10px;
}

.ctrl-icon {
  width: 14px;
  height: 14px;
}

.modal-card {
  width: 320px;
  border-radius: 10px;
}

.modal-card-wide {
  width: min(760px, calc(100vw - 24px));
}

.modal-header {
  padding: 11px 14px;
  font-size: 13px;
}

.modal-header button {
  width: 28px;
  height: 28px;
}

.calllog-detail-modal-body,
.resource-call-modal-body,
.recording-modal-body,
.transfer-form,
.modal-card .dialpad-grid,
.dtmf-display {
  padding: 12px 14px;
}

.resource-call-form {
  gap: 8px;
}

.resource-call-form select,
.resource-call-form input {
  height: 32px;
  padding: 0 9px;
  font-size: 12px;
}

.dtmf-display {
  font-size: 18px;
}

.transfer-form {
  gap: 10px;
}

.transfer-type {
  gap: 10px;
}

.radio-label {
  font-size: 12px;
}

.log-panel {
  right: 12px;
  bottom: 12px;
  width: 360px;
  max-height: 240px;
  border-radius: 10px;
}

.log-body {
  padding: 9px;
  font-size: 10px;
}

.log-toggle-btn {
  right: 12px;
  bottom: 12px;
  width: 34px;
  height: 34px;
}

@media (max-width: 1024px) {
  .call-area {
    grid-template-columns: 1fr;
  }

  .top-bar {
    align-items: flex-start;
  }
}

@media (max-width: 700px) {
  .top-bar {
    padding: 9px 10px;
  }

  .workspace-panel {
    padding: 10px 12px;
  }

  .current-call-card {
    padding: 12px;
  }

  .stat-card {
    padding: 8px;
  }

  .stat-value {
    font-size: 16px;
  }

  .log-panel {
    width: calc(100vw - 24px);
  }
}

.voiceprint-status {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.voiceprint-status.collected {
  color: var(--accent-green);
}

.voiceprint-status.need {
  color: #dc2626;
}
